/* =========================================================
   Dashboard Financeiro — tema "Navy Glass"
   ========================================================= */
:root {
  /* cores da primeira versão */
  --bg: #0c1220;
  --main: #0e1525;
  --main-2: #0c1220;
  --sidebar: #131a2b;
  --panel: #111828;
  --card: #151d2e;
  --card-2: #1b2539;
  --card-3: #222d45;
  --line: rgba(255, 255, 255, .06);
  --line-2: rgba(255, 255, 255, .11);
  --text: #e9edf6;
  --text-2: #a3adc2;
  --muted: #6f7a93;
  --accent: #4f7cff;
  --accent-2: #7b5cff;
  --link: #7ea6ff;          /* valores em azul (painel direito) */
  --mint: #3ddc97;
  --coral: #ff6b6b;
  /* séries dos gráficos (validadas para daltonismo na superfície escura) */
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --good: #3ddc97; --warn: #f5b14c; --bad: #ff6b6b;
  --radius: 16px;
  --shadow: 0 14px 34px rgba(0, 0, 0, .35);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13.5px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
code { background: var(--card-3); padding: 1px 6px; border-radius: 6px; font-size: 12px; word-break: break-all; }
pre { background: var(--main-2); padding: 12px; border-radius: 10px; overflow-x: auto; font-size: 12px; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #2a3550; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- layout em 3 colunas ---------- */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr) 300px; min-height: 100vh; }
.main {
  background: radial-gradient(1200px 600px at 30% -10%, rgba(79, 124, 255, .10), transparent 60%),
              linear-gradient(180deg, var(--main) 0%, var(--main-2) 100%);
  padding: 28px 30px 44px; min-width: 0;
}

/* ---------- sidebar ---------- */
.sidebar {
  background: var(--sidebar);
  padding: 30px 18px 22px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 18px;
  overflow-y: auto; border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 500; padding: 0 8px; }
.brand b { font-weight: 800; color: var(--accent); margin-left: 2px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; position: relative; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 18px rgba(79, 124, 255, .35);
}
.brand-mark::after { content: ''; position: absolute; inset: 8px; border: 2.5px solid #fff; border-radius: 50%; border-right-color: transparent; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-label { color: var(--muted); font-size: 11.5px; margin: 18px 12px 8px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 9px;
  color: var(--muted); cursor: pointer; font-size: 13px;
  transition: background .2s, color .2s, transform .2s;
}
.nav a:hover { color: var(--text); background: rgba(255, 255, 255, .03); transform: translateX(2px); }
.nav a.active { background: var(--card-3); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav a .nb { margin-left: auto; font-size: 10px; font-weight: 600; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 5px; display: grid; place-items: center; background: var(--card-3); color: #cfd6ee; }
.nav a .nb.g { background: #1f7a59; color: #c8ffe6; }
.nav a .nb.r { background: #8c3640; color: #ffd9dc; }
.nav a .nb:empty { display: none; }
.side-foot { margin-top: auto; font-size: 11.5px; color: var(--muted); line-height: 1.6; padding: 0 12px; }

.ico { width: 17px; height: 17px; display: inline-block; background: currentColor; flex: none;
  -webkit-mask: var(--m) center/contain no-repeat; mask: var(--m) center/contain no-repeat; }
.ico-grid { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M3 10l9-7 9 7v10a1 1 0 01-1 1h-5v-6H9v6H4a1 1 0 01-1-1z'/%3E%3C/svg%3E"); }
.ico-flow { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M3 17l6-6 4 4 8-8M15 7h6v6'/%3E%3C/svg%3E"); }
.ico-up { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 16V8M8 12l4-4 4 4'/%3E%3C/svg%3E"); }
.ico-down { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8v8M8 12l4 4 4-4'/%3E%3C/svg%3E"); }
.ico-table { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Crect x='4' y='3' width='16' height='18' rx='2'/%3E%3Cpath d='M8 8h8M8 12h8M8 16h5'/%3E%3C/svg%3E"); }
.ico-clock { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E"); }
.ico-spark { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M3 20h18M5 16l4-5 3 3 6-8'/%3E%3Cpath d='M15 6h3v3'/%3E%3C/svg%3E"); }
.ico-bag { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M5 8h14l-1 12H6z'/%3E%3Cpath d='M9 8a3 3 0 016 0'/%3E%3C/svg%3E"); }
.ico-list { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01'/%3E%3C/svg%3E"); }
.ico-plug { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M9 2v6M15 2v6M6 8h12v4a6 6 0 01-12 0zM12 18v4'/%3E%3C/svg%3E"); }
.ico-out { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M15 4h4v16h-4M10 17l5-5-5-5M15 12H3'/%3E%3C/svg%3E"); }
.ico-bell { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M6 16V11a6 6 0 0112 0v5l2 2H4zM10 20a2 2 0 004 0'/%3E%3C/svg%3E"); }
.ico-wallet { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6'%3E%3Crect x='3' y='6' width='18' height='14' rx='2'/%3E%3Cpath d='M16 13h2M3 9l13-5 1 2'/%3E%3C/svg%3E"); }
.ico-gem { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6'%3E%3Cpath d='M6 3h12l3 6-9 12L3 9zM3 9h18M9 3l3 18 3-18'/%3E%3C/svg%3E"); }
.ico-hourglass { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6'%3E%3Cpath d='M6 3h12M6 21h12M7 3c0 5 10 5 10 9s-10 4-10 9M17 3c0 5-10 5-10 9s10 4 10 9'/%3E%3C/svg%3E"); }
.ico-tag { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6'%3E%3Cpath d='M3 12V4h8l10 10-8 8z'/%3E%3Ccircle cx='7.5' cy='8.5' r='1.5'/%3E%3C/svg%3E"); }
.ico-pct { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6'%3E%3Cpath d='M19 5L5 19'/%3E%3Ccircle cx='7' cy='7' r='2.5'/%3E%3Ccircle cx='17' cy='17' r='2.5'/%3E%3C/svg%3E"); }
.ico-alert { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6'%3E%3Cpath d='M12 3l10 18H2zM12 10v4M12 17.5v.5'/%3E%3C/svg%3E"); }
.ico-in { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6'%3E%3Cpath d='M12 3v12M7 10l5 5 5-5M4 19h16'/%3E%3C/svg%3E"); }
.ico-outflow { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6'%3E%3Cpath d='M12 15V3M7 8l5-5 5 5M4 19h16'/%3E%3C/svg%3E"); }
.ico-users { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6'%3E%3Ccircle cx='9' cy='8' r='3.5'/%3E%3Cpath d='M2 20c0-4 3-6 7-6s7 2 7 6M16 4.5a3.5 3.5 0 010 7M18 14c2.5.5 4 2.5 4 6'/%3E%3C/svg%3E"); }
.ico-pencil { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6'%3E%3Cpath d='M4 20h4L19 9l-4-4L4 16z'/%3E%3C/svg%3E"); }

/* ---------- topo ---------- */
.topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.topbar h1 { font-size: 15px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; }
.topbar .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.sync-info { color: var(--muted); font-size: 11.5px; text-align: right; line-height: 1.5; }
.sync-info b { color: var(--text-2); font-weight: 500; }
.icon-btn { background: var(--card); border: 1px solid var(--line); border-radius: 10px; width: 38px; height: 38px; cursor: pointer; }
.only-mobile { display: none !important; }

/* ---------- filtros ---------- */
.filters {
  display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: flex-end;
  padding: 0 0 4px; position: relative; z-index: 20;
}
.f-group { display: flex; flex-direction: column; gap: 7px; }
.f-group > label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .14em; }
.f-group:first-child .dates { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 12px; }
.seg { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.seg button {
  border: 1px solid var(--line-2); background: var(--card); color: var(--text-2);
  padding: 7px 15px; border-radius: 999px; cursor: pointer; font-size: 11.5px; font-weight: 500; white-space: nowrap;
  transition: all .2s ease;
}
.seg button:hover { color: #fff; border-color: rgba(91, 141, 255, .5); }
.seg button.on {
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff;
  box-shadow: 0 6px 18px rgba(79, 124, 255, .4);
}
input[type=month], input.search, .inline-form input, .login-card input {
  background: var(--bg); border: 1px solid var(--line-2); border-radius: 999px; padding: 7px 14px; color: var(--text);
  outline: none; min-width: 0; font-size: 12px;
}
input[type=month] { width: 160px; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(76, 125, 255, .18); }

.ms { position: relative; }
.ms-btn {
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
  min-width: 170px; max-width: 230px; background: var(--bg); border: 1px solid var(--line-2);
  border-radius: 999px; padding: 7px 14px; cursor: pointer; text-align: left; font-size: 12px; color: var(--text-2);
  transition: border-color .2s;
}
.ms-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-btn.has { border-color: var(--accent); color: #fff; background: rgba(76, 125, 255, .16); }
.ms-btn::after { content: '▾'; color: var(--muted); }
.ms-pop {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 50; width: 310px; max-width: 86vw;
  background: var(--card-2); border: 1px solid var(--line-2); border-radius: 14px; padding: 10px;
  box-shadow: 0 24px 50px rgba(5, 8, 20, .55); display: none;
  animation: pop .18s ease-out;
}
.ms.open .ms-pop { display: block; }
.ms-pop input { width: 100%; margin-bottom: 8px; background: var(--main-2); border: 1px solid var(--line-2); border-radius: 9px; padding: 8px 10px; color: var(--text); }
.ms-list { max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; }
.ms-list label { display: flex; gap: 9px; align-items: center; padding: 7px 7px; border-radius: 8px; cursor: pointer; font-size: 12.5px; }
.ms-list label:hover { background: rgba(255, 255, 255, .05); }
.ms-list label .v { margin-left: auto; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.ms-list input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
.ms-actions { display: flex; justify-content: space-between; margin-top: 8px; gap: 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.chips:empty { margin: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; background: rgba(76, 125, 255, .15);
  border: 1px solid rgba(91, 141, 255, .4); color: #cdd9ff; padding: 5px 6px 5px 12px; border-radius: 999px; font-size: 11.5px;
  animation: pop .2s ease-out;
}
.chip b { color: #fff; font-weight: 500; }
.chip button { border: 0; background: rgba(255, 255, 255, .12); width: 20px; height: 20px; border-radius: 50%; cursor: pointer; line-height: 1; }
.chip-clear { background: transparent; border-color: var(--line-2); color: var(--text-2); cursor: pointer; padding: 5px 12px; }

/* ---------- páginas & cards ---------- */
.page { display: none; flex-direction: column; gap: 20px; margin-top: 22px; }
.page.active { display: flex; }
.page.active > * { animation: rise .55s cubic-bezier(.2, .7, .2, 1) both; }
.page.active > *:nth-child(2) { animation-delay: .06s; }
.page.active > *:nth-child(3) { animation-delay: .12s; }
.page.active > *:nth-child(4) { animation-delay: .18s; }
.page.active > *:nth-child(5) { animation-delay: .24s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }

.grid { display: grid; gap: 20px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .025), transparent 40%), var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; min-width: 0;
  box-shadow: var(--shadow);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s;
}
.card:hover { border-color: rgba(91, 141, 255, .18); }
.card.pad { padding: 22px; }
.card-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-h h3 { font-size: 11.5px; font-weight: 400; letter-spacing: .16em; text-transform: uppercase; color: var(--text-2); margin-bottom: 4px; }
.card-h h3 b { font-weight: 600; color: var(--text); }
.card-h .muted { font-size: 11.5px; }
.chart { width: 100%; }
.h-240 { height: 240px; } .h-260 { height: 260px; } .h-280 { height: 280px; } .h-300 { height: 300px; } .h-320 { height: 320px; } .h-340 { height: 340px; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-2); align-items: center; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.legend i.line { height: 3px; border-radius: 2px; width: 14px; vertical-align: 3px; }
.legend i.dash { height: 0; border-top: 2px dashed; background: none !important; width: 14px; border-radius: 0; vertical-align: 3px; }
.legend-pill { background: var(--bg); border: 1px solid var(--line); padding: 5px 12px; border-radius: 999px; }

/* ---------- KPIs (estilo "10 / 03 / 06") ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.kpis.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi {
  background: linear-gradient(160deg, rgba(255, 255, 255, .03), transparent 50%), var(--card);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 16px 18px 14px; position: relative; overflow: hidden; min-width: 0; min-height: 132px;
  display: flex; flex-direction: column; box-shadow: var(--shadow);
  transition: transform .25s ease, box-shadow .25s ease;
}
.kpi:hover { transform: translateY(-3px); box-shadow: 0 18px 40px rgba(8, 11, 24, .45); }
.kpi-top { display: flex; justify-content: flex-end; min-height: 20px; position: relative; z-index: 1; }
.kpi-v {
  font-size: clamp(21px, 1.85vw, 34px); font-weight: 300; letter-spacing: -.01em; text-align: center; margin: 2px 0 8px;
  font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kpi.coral .kpi-v { color: #ff7b7b; }
.kpi.mint .kpi-v { color: #6fe3b0; }
.kpi-bottom { margin-top: auto; display: flex; align-items: flex-end; gap: 8px; }
.kpi-l { color: var(--text-2); font-size: 11.5px; line-height: 1.35; }
.kpi-l small { display: block; color: var(--muted); font-size: 10.5px; margin-top: 2px; }
.kpi-ico { margin-left: auto; color: var(--text-2); opacity: .8; }
.kpi-ico .ico { width: 22px; height: 22px; }
.kpi.small { min-height: 110px; }
.kpi.small .kpi-v { font-size: clamp(19px, 1.5vw, 25px); }
.kpi.hero {
  background:
    radial-gradient(140px 140px at 85% 15%, rgba(255, 255, 255, .22), transparent 70%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, .05) 0 2px, transparent 2px 14px),
    linear-gradient(135deg, #3b6cff 0%, #5a55ff 55%, #6a4dff 100%);
  border: 0; box-shadow: 0 16px 40px rgba(79, 92, 255, .4);
}
.kpi.hero::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .16) 45%, transparent 60%);
  transform: translateX(-100%); animation: sheen 5s ease-in-out 1s infinite;
}
@keyframes sheen { 0%, 60% { transform: translateX(-100%); } 85%, 100% { transform: translateX(100%); } }
.kpi.hero .kpi-l, .kpi.hero .kpi-ico { color: rgba(255, 255, 255, .92); }
.kpi.hero .kpi-l small { color: rgba(255, 255, 255, .72); }
.delta { font-weight: 600; font-size: 10.5px; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.delta.good { color: var(--good); background: rgba(61, 220, 151, .13); }
.delta.bad { color: var(--bad); background: rgba(255, 107, 107, .13); }
.delta.neu { color: var(--text-2); background: rgba(255, 255, 255, .07); }
.kpi.hero .delta { background: rgba(255, 255, 255, .2); color: #fff; }
.kpi-spark { position: absolute; left: 0; right: 0; bottom: 0; height: 46px; opacity: .5; pointer-events: none; }
.kpi-bottom, .kpi-v { position: relative; z-index: 1; }

/* ---------- anéis / medidores ---------- */
.rings { display: grid; grid-template-columns: 1fr 1fr; }
.ring-wrap { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.ring-wrap + .ring-wrap { border-left: 1px solid var(--line); }
.ring { width: 100%; height: 190px; }
.ring-leg { display: flex; gap: 16px; font-size: 11px; color: var(--muted); margin-top: 4px; flex-wrap: wrap; justify-content: center; }
.ring-leg span { display: inline-flex; align-items: center; gap: 6px; }
.ring-leg i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid; display: inline-block; }

/* ---------- painel direito ---------- */
.rpanel {
  background: var(--panel); border-left: 1px solid var(--line);
  padding: 22px 18px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 16px;
}
.rp-top { display: flex; align-items: center; gap: 12px; padding: 0 4px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 0 0 3px rgba(79, 124, 255, .2); text-transform: uppercase;
}
.rp-user { display: flex; flex-direction: column; font-size: 12.5px; }
.rp-user span { color: var(--muted); font-size: 11px; }
.bell { margin-left: auto; position: relative; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line-2); background: transparent; color: var(--text-2); display: grid; place-items: center; cursor: pointer; }
.bell-n { position: absolute; top: -4px; right: -4px; background: var(--coral); color: #fff; font-size: 9.5px; font-weight: 700; min-width: 17px; height: 17px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; box-shadow: 0 0 0 3px var(--panel); }
.bell-n:empty { display: none; }
.rp-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; position: relative; animation: rise .6s ease-out both; }
.rp-card::after { content: ''; position: absolute; right: 0; top: 46%; width: 3px; height: 46px; border-radius: 3px; background: var(--mint); box-shadow: 0 0 12px var(--mint); }
.rp-head { padding: 18px 18px 16px; border-bottom: 1px solid var(--line); position: relative; }
.rp-head .lbl { font-size: 10.5px; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; }
.rp-head .big { font-size: 24px; font-weight: 600; margin-top: 4px; letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.rp-head .ico-pencil { position: absolute; right: 18px; top: 24px; color: var(--muted); }
.rp-row { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
.rp-row.one { grid-template-columns: 1fr; }
.rp-cell { padding: 13px 18px; min-width: 0; }
.rp-cell .lbl { font-size: 11px; color: var(--text-2); margin-bottom: 5px; font-weight: 500; }
.rp-cell .val { font-size: 13px; color: var(--link); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-cell .val.neg { color: #ff8a8a; }
.rp-cell .val.pos { color: #6fe3b0; }
.rp-section { font-size: 10.5px; color: var(--muted); letter-spacing: .14em; text-transform: uppercase; padding: 14px 18px 4px; }
.rp-bank { display: flex; justify-content: space-between; gap: 10px; padding: 7px 18px; font-size: 12px; }
.rp-bank:last-child { padding-bottom: 16px; }
.rp-bank span:first-child { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-bank span:last-child { color: var(--link); font-variant-numeric: tabular-nums; }

/* ranking */
.rank { display: flex; flex-direction: column; gap: 2px; }
.rank-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 8px; border-radius: 9px; cursor: pointer; transition: background .2s; }
.rank-row:hover { background: rgba(255, 255, 255, .04); }
.rank-row .pos { color: var(--muted); font-size: 11.5px; text-align: right; }
.rank-row .nm { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .bar { height: 4px; border-radius: 4px; margin-top: 6px; transform-origin: left; animation: grow .8s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes grow { from { transform: scaleX(0); } }
.rank-row .val { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--link); }

/* tabelas & matrizes */
.table-wrap, .matrix-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 11px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 12.5px; }
th { color: var(--muted); font-weight: 500; font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; position: sticky; top: 0; background: var(--card); cursor: pointer; user-select: none; }
td.num, th.num { text-align: right; }
tbody tr { transition: background .15s; }
tbody tr:hover td { background: rgba(255, 255, 255, .025); }
.matrix th:first-child, .matrix td:first-child { position: sticky; left: 0; background: var(--card); z-index: 1; min-width: 230px; white-space: normal; }
.matrix tr.grp td { font-weight: 600; background: var(--card-2); cursor: pointer; }
.matrix tr.grp td:first-child { background: var(--card-2); }
.matrix tr.tot td { font-weight: 600; border-top: 1px solid var(--line-2); background: var(--card-3); }
.matrix tr.tot td:first-child { background: var(--card-3); }
.matrix tr.sub td:first-child { padding-left: 30px; color: var(--text-2); }
.matrix tr.sub td.neg { color: var(--text-2); }
.matrix tr.collapsed-child { display: none; }
.matrix .caret { display: inline-block; width: 14px; color: var(--muted); transition: transform .2s; }
.matrix tr.grp.closed .caret { transform: rotate(-90deg); }
.neg { color: #ff8a8a; }
.pos { color: #6fe3b0; }
.av { color: var(--muted); font-size: 11px; }

.badge { font-size: 10.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; display: inline-flex; gap: 5px; align-items: center; }
.b-ok { color: var(--good); background: rgba(61, 220, 151, .13); }
.b-warn { color: var(--warn); background: rgba(245, 177, 76, .13); }
.b-bad { color: var(--bad); background: rgba(255, 107, 107, .13); }
.b-neu { color: var(--text-2); background: rgba(255, 255, 255, .07); }

.pager { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.row-gap { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
input.search { width: 280px; max-width: 100%; }

/* cenários */
.scen-row { display: flex; flex-wrap: wrap; gap: 18px 28px; align-items: flex-end; }
.slider { display: flex; flex-direction: column; gap: 10px; min-width: 200px; flex: 1; }
.slider label { font-size: 11px; color: var(--text-2); display: flex; justify-content: space-between; letter-spacing: .04em; }
.slider b { color: #fff; font-variant-numeric: tabular-nums; font-weight: 600; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 4px; background: var(--card-3); outline: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 4px solid var(--accent); box-shadow: 0 0 0 4px rgba(76, 125, 255, .25); cursor: pointer; }
input[type=range]::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 4px solid var(--accent); cursor: pointer; }

/* botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--card-3); border: 1px solid var(--line-2); border-radius: 999px;
  padding: 9px 18px; cursor: pointer; font-weight: 500; color: var(--text); font-size: 12.5px;
  transition: all .2s;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: 0; color: #fff; box-shadow: 0 8px 22px rgba(76, 125, 255, .4); }
.btn-primary:hover { box-shadow: 0 10px 28px rgba(76, 125, 255, .55); transform: translateY(-1px); }
.btn-sm { padding: 6px 14px; font-size: 11.5px; }
.btn-block { width: 100%; }

.pill { font-size: 10.5px; font-weight: 600; padding: 5px 11px; border-radius: 999px; letter-spacing: .06em; }
.pill-warn { color: #241900; background: var(--warn); }
.pill-ok { color: var(--good); background: rgba(61, 220, 151, .13); }
.pill-off { color: var(--text-2); background: rgba(255, 255, 255, .07); }
.pill-err { color: var(--bad); background: rgba(255, 107, 107, .13); }

.alert { padding: 12px 14px; border-radius: 10px; margin: 14px 0; font-size: 13px; }
.alert-ok { background: rgba(61, 220, 151, .1); border: 1px solid rgba(61, 220, 151, .3); }
.alert-error { background: rgba(255, 107, 107, .1); border: 1px solid rgba(255, 107, 107, .3); }
.alert-warn { background: rgba(245, 177, 76, .1); border: 1px solid rgba(245, 177, 76, .3); }

#loading { position: fixed; inset: 0; background: var(--bg); display: flex; flex-direction: column; gap: 14px; align-items: center; justify-content: center; z-index: 100; color: var(--text-2); transition: opacity .4s; }
#loading.hide { opacity: 0; pointer-events: none; }
.spinner { width: 36px; height: 36px; border: 3px solid var(--card-3); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { color: var(--muted); padding: 30px; text-align: center; }

/* login & páginas simples */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 16px;
  background: radial-gradient(900px 500px at 20% 0%, rgba(76, 125, 255, .22), transparent), linear-gradient(180deg, var(--main), var(--bg)); }
.login-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 32px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 30px 60px rgba(5, 8, 20, .5); animation: rise .5s ease-out both; }
.login-card .brand { padding: 0; }
.login-card h1 { font-size: 20px; margin-top: 12px; font-weight: 500; }
.login-card p { margin: 0; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 11.5px; color: var(--text-2); }
.login-card input { padding: 11px 16px; font-size: 13px; }
.page-simple { padding: 30px 16px; background: linear-gradient(180deg, var(--main), var(--bg)); min-height: 100vh; }
.simple-wrap { max-width: 900px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.simple-wrap h1 { font-size: 22px; font-weight: 500; }
.simple-wrap h2 { font-size: 15px; font-weight: 500; }
.back { color: var(--text-2); font-size: 13px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.callout { margin-top: 18px; padding: 16px; border-radius: 12px; background: var(--main-2); border: 1px solid var(--line); }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; }

/* ---------- responsivo ---------- */
@media (max-width: 1440px) {
  .app { grid-template-columns: 220px minmax(0, 1fr) 270px; }

}
@media (max-width: 1240px) {
  .app { grid-template-columns: 220px minmax(0, 1fr); }
  .rpanel { display: none; }
  .kpis.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1000px) {
  .g-2-1 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 250px; z-index: 60; transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: none; box-shadow: 20px 0 60px rgba(0, 0, 0, .5); }
  .only-mobile { display: inline-flex !important; align-items: center; justify-content: center; }
  .main { padding: 16px; }
  .g-2 { grid-template-columns: 1fr; }
  .top-actions .sync-info { display: none; }
  .top-actions .pill { font-size: 9px; padding: 3px 7px; }
  .ms-btn { min-width: 140px; }
}
@media (max-width: 520px) {
  .kpis, .kpis.k4 { grid-template-columns: 1fr 1fr; gap: 12px; }
  .kpi { padding: 12px; min-height: 112px; }
  .kpi-v, .kpi.small .kpi-v { font-size: 19px; }
  .f-group { width: 100%; }
  .ms-btn { max-width: none; width: 100%; }
  .inline-form { flex-direction: column; }
  .ring { height: 160px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* =========================================================
   Meu painel (dashboard personalizável)
   ========================================================= */
.ico-star { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Crect x='3' y='3' width='8' height='8' rx='2'/%3E%3Crect x='13' y='3' width='8' height='5' rx='2'/%3E%3Crect x='13' y='10' width='8' height='11' rx='2'/%3E%3Crect x='3' y='13' width='8' height='8' rx='2'/%3E%3C/svg%3E"); }
/* nesta página o período e a comparação vêm da barra própria */
body.pg-custom #filters > .f-group:first-child, body.pg-custom #filters .f-compare { display: none; }

.cd-bar { display: flex; flex-direction: column; gap: 14px; padding: 16px 18px; }
.cd-row { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: flex-end; }
.cd-bar .dates { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
input[type=date] { background: var(--bg); border: 1px solid var(--line-2); border-radius: 999px; padding: 6px 12px; color: var(--text); outline: none; font-size: 12px; color-scheme: dark; }
.cd-cmpwrap, .cd-dows { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#cdDows.disabled { opacity: .45; pointer-events: none; }
.seg button:disabled { opacity: .35; cursor: not-allowed; }
.lnk { background: none; border: 0; color: var(--link); font-size: 11.5px; cursor: pointer; padding: 2px 4px; }
.lnk:hover { text-decoration: underline; }
.cd-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
#cdEdit.on { border-color: var(--accent); background: rgba(79, 124, 255, .18); color: #fff; }
.cd-info { font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; }
.cd-info b { color: var(--text-2); font-weight: 600; }
.warn-t { color: var(--warn); }

.cd-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; grid-auto-flow: dense; }
.cw {
  background: linear-gradient(180deg, rgba(255, 255, 255, .025), transparent 40%), var(--card);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; min-width: 0; position: relative;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s, opacity .2s;
  animation: rise .5s cubic-bezier(.2, .7, .2, 1) both;
}
.cw:hover { border-color: rgba(79, 124, 255, .25); }
.w-2 { grid-column: span 2; } .w-3 { grid-column: span 3; } .w-4 { grid-column: span 4; }
.w-6 { grid-column: span 6; } .w-8 { grid-column: span 8; } .w-12 { grid-column: span 12; }
.cw.h-1 { height: 168px; } .cw.h-2 { height: 360px; } .cw.h-3 { height: 480px; }
.cw-h { display: flex; align-items: center; gap: 8px; padding: 12px 14px 4px; min-height: 38px; }
.cw-h h4 { margin: 0; font-size: 10.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--text-2); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cw-grip { cursor: grab; color: var(--muted); letter-spacing: -3px; font-size: 13px; opacity: .35; user-select: none; padding-right: 3px; transition: opacity .2s; }
.cw:hover .cw-grip, .editing .cw-grip { opacity: 1; }
.cw-act { display: flex; gap: 2px; opacity: 0; transition: opacity .2s; }
.cw:hover .cw-act, .editing .cw-act { opacity: 1; }
.cw-act button { width: 24px; height: 24px; border-radius: 7px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; display: grid; place-items: center; }
.cw-act button:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.cw-act [data-a=del]:hover { color: var(--bad); }
.cw-b { flex: 1; min-height: 0; padding: 4px 16px 14px; display: flex; flex-direction: column; position: relative; }
.cw-size { display: none; flex-wrap: wrap; gap: 4px; padding: 0 12px 10px; }
.editing .cw-size { display: flex; }
.cw-size span { width: 8px; }
.cw-size button { border: 1px solid var(--line-2); background: var(--bg); color: var(--muted); border-radius: 6px; font-size: 10px; padding: 3px 7px; cursor: pointer; }
.cw-size button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.editing .cw { outline: 1px dashed rgba(79, 124, 255, .35); outline-offset: 3px; }
.cw.dragging { opacity: .35; transform: scale(.98); }
.cw.drop-b { box-shadow: -4px 0 0 var(--accent), var(--shadow); }
.cw.drop-a { box-shadow: 4px 0 0 var(--accent), var(--shadow); }
.cw.leaving { opacity: 0; transform: scale(.94); }
.cw.flash { animation: flash 1.4s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 3px var(--accent), 0 0 40px rgba(79, 124, 255, .6); } 100% { box-shadow: var(--shadow); } }
.cw-add {
  grid-column: span 4; min-height: 120px; border: 1.5px dashed var(--line-2); border-radius: 14px; background: transparent;
  color: var(--muted); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 12.5px;
  transition: all .2s;
}
.cw-add span { font-size: 24px; color: var(--accent); }
.cw-add:hover { border-color: var(--accent); color: #fff; background: rgba(79, 124, 255, .06); }

.cd-chart { width: 100%; flex: 1; min-height: 0; }
.cd-note { font-size: 11px; color: var(--muted); padding-top: 6px; }
.cd-note b { color: var(--text-2); }
.cd-note.center { text-align: center; }
.cd-scroll { overflow-y: auto; min-height: 0; flex: 1; }

/* KPI compacto (estilo da referência) */
.ck { display: flex; flex-direction: column; height: 100%; justify-content: space-between; gap: 4px; }
.ck-row { display: flex; align-items: center; gap: 10px; min-height: 0; flex: 1; }
.ck-v { font-size: clamp(20px, 1.9vw, 30px); font-weight: 700; letter-spacing: -.01em; white-space: nowrap; font-variant-numeric: tabular-nums; overflow: hidden; min-width: 0; flex: 0 1 auto; }
.ck.bad .ck-v { color: #ff7b7b; }
.ck-spark { flex: 1; height: 52px; min-width: 60px; }
.ck-foot { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
.ck-meta { display: flex; align-items: center; gap: 8px; font-size: 10.5px; }
.ck-meta.ok span { color: var(--good); }
.ck-meta.no span { color: var(--bad); }
.ck-bar { flex: 1; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .06); overflow: hidden; }
.ck-bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); animation: grow 1s cubic-bezier(.2, .7, .2, 1) both; transform-origin: left; }
.ck-meta.ok .ck-bar i { background: linear-gradient(90deg, #199e70, var(--good)); }
.ck-meta.no .ck-bar i { background: linear-gradient(90deg, #c94b4b, var(--bad)); }
.ck.big { align-items: center; justify-content: center; }
.ck.big .ck-v { font-size: 48px; }

/* rosca com legenda */
.cd-donut { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 8px; flex: 1; min-height: 0; align-items: center; }
.cd-donut .cd-chart { height: 100%; }
.cd-leg { display: flex; flex-direction: column; gap: 12px; }
.dl { display: flex; gap: 9px; cursor: pointer; padding: 3px; border-radius: 8px; }
.dl:hover { background: rgba(255, 255, 255, .04); }
.dl i { width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; flex: none; }
.dl div { display: flex; flex-direction: column; min-width: 0; font-size: 11.5px; }
.dl b { color: #fff; font-size: 13px; }
.dl span { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl small { color: var(--muted); font-size: 10.5px; }

.cd-badge { margin-top: 8px; font-size: 11px; padding: 8px 12px; border-radius: 10px; }
.cd-badge.ok { color: #9ff0c8; background: rgba(61, 220, 151, .1); border: 1px solid rgba(61, 220, 151, .3); }
.cd-badge.no { color: #ffb3b3; background: rgba(255, 107, 107, .1); border: 1px solid rgba(255, 107, 107, .3); }

/* tabela de status */
.cd-table td, .cd-table th { padding: 9px 10px; font-size: 12px; }
.cd-table tbody tr { cursor: pointer; }
.st { font-size: 9.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; border: 1px solid; }
.st-ok { color: var(--good); border-color: rgba(61, 220, 151, .4); background: rgba(61, 220, 151, .1); }
.st-warn { color: var(--warn); border-color: rgba(245, 177, 76, .4); background: rgba(245, 177, 76, .1); }
.st-bad { color: var(--bad); border-color: rgba(255, 107, 107, .4); background: rgba(255, 107, 107, .1); }
.st-neu { color: var(--text-2); border-color: var(--line-2); background: rgba(255, 255, 255, .04); }

/* ranking com alerta */
.cd-top { display: flex; flex-direction: column; gap: 12px; padding-top: 4px; }
.tr { cursor: pointer; }
.tr-h { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }
.tr-h span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-bar { height: 5px; border-radius: 5px; background: rgba(255, 255, 255, .05); margin: 6px 0 2px; overflow: hidden; }
.tr-bar i { display: block; height: 100%; border-radius: 5px; transform-origin: left; animation: grow .9s cubic-bezier(.2, .7, .2, 1) both; }
.tr small { color: var(--muted); font-size: 10.5px; }
.cd-alert {
  margin-top: 10px; width: 100%; text-align: left; border: 1px solid rgba(255, 107, 107, .45); background: rgba(255, 107, 107, .1);
  border-radius: 10px; padding: 9px 12px; color: #ffc0c0; cursor: pointer; display: flex; flex-direction: column; gap: 2px; font-size: 11px;
  animation: pulse 2.4s ease-in-out infinite;
}
.cd-alert b { color: var(--bad); letter-spacing: .08em; font-size: 10.5px; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0); } 50% { box-shadow: 0 0 0 4px rgba(255, 107, 107, .12); } }

/* comparação */
.cd-cmp-head { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; padding-bottom: 6px; }
.cd-cmp-head div { display: flex; flex-direction: column; }
.cd-cmp-head small { color: var(--muted); font-size: 10.5px; }
.cd-cmp-head b { font-size: 20px; font-weight: 700; }
.cd-cmp-head b.dim { color: var(--text-2); font-weight: 400; }

/* modais */
.cd-modal { position: fixed; inset: 0; z-index: 200; background: rgba(5, 8, 16, .6); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 20px; animation: mFade .2s ease-out both; }
@keyframes mFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes mRise { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.cd-mbox {
  position: relative; width: min(520px, 100%); max-height: 92vh; overflow-y: auto; background: var(--card); border: 1px solid var(--line-2);
  border-radius: 18px; padding: 24px; box-shadow: 0 40px 80px rgba(0, 0, 0, .6); animation: mRise .28s cubic-bezier(.2, .7, .2, 1) both;
}
.cd-mbox.wide { width: min(860px, 100%); }
.cd-mbox.pop { width: min(1180px, 100%); display: flex; flex-direction: column; gap: 14px; }
.cd-mbox h3 { font-size: 17px; margin-bottom: 4px; }
.cd-x { position: absolute; right: 14px; top: 14px; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--bg); color: var(--text-2); cursor: pointer; z-index: 2; }
.cd-x:hover { color: #fff; border-color: var(--accent); }
.cd-cat { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-top: 16px; }
.cd-cat-i { text-align: left; border: 1px solid var(--line-2); background: var(--bg); border-radius: 14px; padding: 14px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; transition: all .2s; color: var(--text); }
.cd-cat-i:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 10px 24px rgba(79, 124, 255, .2); }
.cd-cat-i .ci { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 17px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; margin-bottom: 6px; box-shadow: 0 6px 16px rgba(79, 124, 255, .35); }
.cd-cat-i b { font-size: 13px; }
.cd-cat-i small { color: var(--muted); font-size: 11.5px; }
.cd-form { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.cd-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--text-2); }
.cd-form input, .cd-form select { background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 12px; color: var(--text); font: inherit; font-size: 13px; outline: none; }
.cd-form input:focus, .cd-form select:focus { border-color: var(--accent); }
.cd-form-act { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.cd-pop-h { padding-right: 40px; }
.cd-pop-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.ps { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.ps small { color: var(--muted); font-size: 11px; }
.ps b { font-size: 19px; }
.ps .delta { align-self: flex-start; }
.cd-pop-main { flex: none; height: 400px; padding: 0; }
.cd-pop-tabs { display: flex; gap: 6px; align-items: center; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.cd-pop-tabs [data-tab] { border: 0; background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 12.5px; }
.cd-pop-tabs [data-tab].on { background: var(--card-3); color: #fff; }
.cd-pop-tabs .btn { margin-left: auto; }
.cd-pop-table { flex: none; max-height: 340px; overflow-y: auto; }
.cd-toast { position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 20px); background: var(--card-3); border: 1px solid var(--line-2); color: #fff; padding: 9px 16px; border-radius: 999px; font-size: 12px; opacity: 0; transition: all .25s; z-index: 300; pointer-events: none; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }
.cd-toast.show { opacity: 1; transform: translate(-50%, 0); }
.cd-toast.err { border-color: var(--bad); }

/* a grade responde à largura disponível (com ou sem o painel lateral) */
.cd-wrap { container-type: inline-size; }
@container (max-width: 1280px) {
  .w-2 { grid-column: span 4; } .w-3 { grid-column: span 4; }
}
@container (max-width: 1000px) {
  .w-3, .w-4 { grid-column: span 6; } .w-8 { grid-column: span 12; } .cw-add { grid-column: span 6; }
}
@container (max-width: 640px) {
  .cd-grid { gap: 12px; }
  .w-2 { grid-column: span 6; }
  .w-3, .w-4, .w-6, .w-8, .w-12, .cw-add { grid-column: span 12; }
  .cw.h-2 { height: 340px; }
  .cd-donut { grid-template-columns: 1fr; }
  .cd-donut .cd-chart { height: 170px; flex: none; }
}
@media (max-width: 760px) {
  .cd-actions { margin-left: 0; }
  .cd-pop-stats { grid-template-columns: 1fr 1fr; }
}

/* =========================================================
   Painel de filtros recolhível
   ========================================================= */
.ico-filter { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9'%3E%3Cpath d='M4 5h16l-6 7.5V19l-4 2v-8.5z'/%3E%3C/svg%3E"); }
.fbtn { gap: 7px; position: relative; }
.fbtn .ico { width: 14px; height: 14px; }
.fbtn .fcount { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; font-size: 10px; display: grid; place-items: center; background: var(--accent); color: #fff; box-shadow: 0 0 0 3px rgba(79, 124, 255, .2); }
.fbtn .fcount:empty { display: none; }
.fbtn.has { border-color: rgba(79, 124, 255, .55); }
body.filters-open .fbtn { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; box-shadow: 0 6px 18px rgba(79, 124, 255, .4); }
body.filters-open .fbtn .fcount { background: #fff; color: var(--accent); }

.fpanel {
  display: none; position: relative; z-index: 30;
  background: var(--card); border: 1px solid var(--line-2); border-radius: 16px;
  padding: 16px 18px 12px; box-shadow: 0 18px 40px rgba(0, 0, 0, .35); margin-bottom: 4px;
}
body.filters-open .fpanel { display: block; animation: fpIn .28s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes fpIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.fp-title { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-2); font-weight: 600; margin-bottom: 10px; }
.fp-g { margin-top: 4px; }
.cd-filters { display: none; flex-direction: column; gap: 14px; padding-bottom: 16px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
body.pg-custom .cd-filters { display: flex; }
.cd-filters .dates { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.fpanel .filters { padding: 0; }
.fp-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }

/* barra do Meu painel (sempre visível) */
.cd-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cd-toolbar .cd-info { flex: 1; min-width: 220px; border: 0; padding: 0; font-size: 12px; }
.cd-toolbar .cd-actions { margin-left: auto; }

@media (max-width: 900px) {
  .fpanel { padding: 14px; }
  .fpanel .filters { flex-direction: column; align-items: stretch; }
  .fpanel .f-group { width: 100%; }
  .fpanel .ms-btn { max-width: none; width: 100%; }
  .fpanel .seg { flex-wrap: wrap; }
  .cd-toolbar .cd-actions { margin-left: 0; width: 100%; }
  .cd-toolbar .cd-actions .btn { flex: 1; }
  .fbtn span { display: none; }
}

/* =========================================================
   Logo + menu lateral recolhível
   ========================================================= */
.brand-logo { padding: 2px 10px 6px; display: flex; align-items: center; min-height: 52px; }
.brand-logo img { display: block; filter: drop-shadow(0 4px 14px rgba(79, 124, 255, .25)); }
.brand-logo .logo-full { width: 150px; height: auto; transition: opacity .2s; }
.brand-logo .logo-mini { display: none; width: 34px; height: 34px; }
.login-card .brand-logo { padding: 0; min-height: 0; }
.login-card .brand-logo .logo-full { width: 170px; }
.ico-chev { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M15 6l-6 6 6 6'/%3E%3Cpath d='M20 6l-6 6 6 6' opacity='.45'/%3E%3C/svg%3E"); }

.app { transition: grid-template-columns .28s cubic-bezier(.2, .7, .2, 1); }
.nav a { position: relative; }
.nav a .lbl { min-width: 0; line-height: 1.3; }
.sb-toggle {
  display: flex; align-items: center; gap: 12px; margin-top: 10px; padding: 9px 12px;
  border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 10px;
  cursor: pointer; font-size: 12.5px; transition: color .2s, background .2s, border-color .2s;
}
.sb-toggle:hover { color: #fff; background: rgba(255, 255, 255, .04); border-color: var(--line-2); }
.sb-toggle .ico { transition: transform .28s; }

/* ---- estado recolhido (só ícones) ---- */
@media (min-width: 901px) {
  .sb-collapsed .app { grid-template-columns: 76px minmax(0, 1fr) 300px; }
  .sb-collapsed .sidebar { padding: 26px 12px 18px; overflow: visible; }
  .sb-collapsed .brand-logo { justify-content: center; padding: 2px 0 6px; }
  .sb-collapsed .brand-logo .logo-full { display: none; }
  .sb-collapsed .brand-logo .logo-mini { display: block; }
  .sb-collapsed .nav a { justify-content: center; padding: 11px 0; gap: 0; }
  .sb-collapsed .nav a:hover { transform: none; }
  .sb-collapsed .nav a .lbl, .sb-collapsed .sb-toggle .lbl, .sb-collapsed .side-foot { display: none; }
  .sb-collapsed .nav-label { margin: 14px 8px 8px; height: 1px; background: var(--line-2); }
  .sb-collapsed .nav-label .lbl { display: none; }
  /* contadores viram um selo sobre o ícone */
  .sb-collapsed .nav a .nb { position: absolute; top: 3px; right: 8px; margin: 0; min-width: 16px; height: 15px; padding: 0 4px; font-size: 9px; border-radius: 8px; box-shadow: 0 0 0 2px var(--sidebar); }
  .sb-collapsed .sb-toggle { justify-content: center; padding: 9px 0; }
  .sb-collapsed .sb-toggle .ico { transform: rotate(180deg); }
  /* dica com o nome ao passar o mouse */
  .sb-collapsed .nav a::after {
    content: attr(data-tip); position: absolute; left: calc(100% + 14px); top: 50%; transform: translate(-6px, -50%);
    background: var(--card-3); color: #fff; border: 1px solid var(--line-2); padding: 6px 11px; border-radius: 8px;
    font-size: 12px; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .15s, transform .15s; z-index: 80;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .4);
  }
  .sb-collapsed .nav a:hover::after { opacity: 1; transform: translate(0, -50%); }
}
@media (min-width: 901px) and (max-width: 1440px) {
  .sb-collapsed .app { grid-template-columns: 76px minmax(0, 1fr) 270px; }
}
@media (min-width: 901px) and (max-width: 1240px) {
  .sb-collapsed .app { grid-template-columns: 76px minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .sb-toggle { display: none; }
}

/* =========================================================
   Painel direito: ações, calendário, alertas e modo recolhido
   ========================================================= */
.ico-sync { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9'%3E%3Cpath d='M20 11a8 8 0 00-14.3-4.9L4 8M4 4v4h4M4 13a8 8 0 0014.3 4.9L20 16M20 20v-4h-4'/%3E%3C/svg%3E"); }
.ico-cal { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E"); }

.rp-top { flex-wrap: nowrap; }
.rp-user { min-width: 0; flex: 1; }
.rp-user b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-icons { display: flex; gap: 6px; margin-left: auto; }
.rp-ic, .rp-icons .bell {
  position: relative; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line-2); background: transparent;
  color: var(--text-2); display: grid; place-items: center; cursor: pointer; margin: 0; transition: all .2s; flex: none;
}
.rp-ic:hover { color: #fff; border-color: var(--accent); background: rgba(79, 124, 255, .12); }
.rp-ic .ico { width: 15px; height: 15px; }
.rp-ic.spin { color: var(--accent); border-color: var(--accent); }
.rp-ic.spin .ico { animation: spin 1s linear infinite; }
.rp-cal-ic { display: none; }
#rpToggle .ico { transform: rotate(180deg); transition: transform .28s; }
.rp-body { display: flex; flex-direction: column; gap: 16px; }

/* células: valor + detalhe, sem cortar; clicáveis quando levam a algum lugar */
.rp-cell { padding: 12px 14px; }
.rp-cell .val { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: break-word; line-height: 1.35; }
.rp-cell .val.money, .rp-cell .sub.money { white-space: nowrap; }
.rp-cell .sub { font-size: 11px; color: var(--muted); margin-top: 3px; overflow-wrap: break-word; }
.rp-cell.go { cursor: pointer; transition: background .15s; }
.rp-cell.go:hover, .rp-cell.go:focus-visible { background: rgba(79, 124, 255, .07); outline: none; }
.rp-cell.go .lbl::after { content: ' ›'; color: var(--muted); }
.rp-bank { gap: 12px; }
.rp-bank span:first-child { white-space: normal; }
.rp-bank span:last-child { white-space: nowrap; }

/* calendário */
.rp-calendar { padding: 14px 14px 12px; }
.rp-calendar::after { display: none; }
.cal-h { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.cal-h b { font-size: 12.5px; font-weight: 600; text-transform: capitalize; flex: 1; text-align: center; }
.cal-nav { width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--line-2); background: transparent; color: var(--text-2); cursor: pointer; font-size: 15px; line-height: 1; }
.cal-nav:hover { color: #fff; border-color: var(--accent); }
.cal-g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-w { font-size: 10px; color: var(--muted); text-align: center; padding-bottom: 2px; }
.cal-d {
  position: relative; aspect-ratio: 1; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--text-2);
  font-size: 11.5px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 0;
  transition: background .15s, border-color .15s, transform .15s;
}
.cal-d.has { background: rgba(79, 124, 255, var(--h)); color: #fff; }
.cal-d:hover { border-color: var(--accent); transform: translateY(-1px); }
.cal-d.today { border-color: var(--mint); color: #fff; font-weight: 700; }
.cal-d.sel { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 6px 14px rgba(79, 124, 255, .45); }
.cal-d.late::before { content: ''; position: absolute; top: 3px; right: 3px; width: 5px; height: 5px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 6px var(--bad); }
.cal-d i { display: flex; gap: 2px; height: 4px; }
.cal-d em, .cal-f em { display: inline-block; width: 4px; height: 4px; border-radius: 50%; }
em.r { background: #6da7ec; } em.p { background: #f0905f; }
.cal-f { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 10.5px; color: var(--muted); }
.cal-f em { width: 7px; height: 7px; margin-right: 5px; vertical-align: 0; }

/* central de alertas */
.am-list { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.am-item { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg); color: var(--text); cursor: pointer; text-align: left; font-size: 13px; transition: all .15s; }
.am-item:hover:not([disabled]), .am-item.on { border-color: var(--accent); background: rgba(79, 124, 255, .08); }
.am-item[disabled] { opacity: .45; cursor: default; }
.am-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.am-bad .am-dot { background: var(--bad); box-shadow: 0 0 8px var(--bad); }
.am-warn .am-dot { background: var(--warn); }
.am-neu .am-dot { background: #f0905f; }
.am-ok .am-dot { background: var(--good); }
.am-t { flex: 1; }
.am-item b { min-width: 30px; text-align: center; padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, .07); font-size: 12px; }
.am-v { min-width: 110px; text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; }
.am-detail h4 { margin: 16px 0 8px; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-2); }
.am-table { max-height: 46vh; overflow-y: auto; }

/* ---- painel direito recolhido: faixa só com os ícones ---- */
@media (min-width: 1241px) {
  .rp-collapsed .app { grid-template-columns: 236px minmax(0, 1fr) 64px; }
  .rp-collapsed.sb-collapsed .app { grid-template-columns: 76px minmax(0, 1fr) 64px; }
  .rp-collapsed .rpanel { padding: 22px 0; align-items: center; overflow: visible; }
  .rp-collapsed .rp-top { flex-direction: column; padding: 0; gap: 14px; }
  .rp-collapsed .rp-user, .rp-collapsed .rp-body { display: none; }
  .rp-collapsed .rp-icons { flex-direction: column; margin: 0; gap: 10px; }
  .rp-collapsed .rp-cal-ic { display: grid; }
  .rp-collapsed #rpToggle { order: 9; margin-top: 6px; }
  .rp-collapsed #rpToggle .ico { transform: none; }
}
@media (min-width: 1241px) and (max-width: 1440px) {
  .rp-collapsed .app { grid-template-columns: 220px minmax(0, 1fr) 64px; }
}
@media (max-width: 760px) {
  .am-v { min-width: 0; }
}

/* =========================================================
   Cards clicáveis + popup explicativo
   ========================================================= */
.kpi { cursor: pointer; }
.kpi:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* a linha mês a mês fica "por baixo" do texto, mas recebe o mouse para mostrar os valores */
.kpi-spark { pointer-events: auto; z-index: 2; }
.kpi-v, .kpi-bottom, .kpi-top { pointer-events: none; }
.kpi:hover .kpi-spark { opacity: .85; }
.kpi-spark { transition: opacity .2s; }

.kp-hero { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.kp-v { font-size: 34px; font-weight: 300; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.kp-v.neg { color: #ff7b7b; }
.kp-box { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 13px; line-height: 1.55; min-width: 0; }
.kp-box > b:first-child { display: block; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-2); font-weight: 600; margin-bottom: 4px; }
.kp-box p { margin: 4px 0 0; color: var(--text-2); }
.kp-box p b { color: var(--text); }
.kp-box.warn { border-color: rgba(245, 177, 76, .45); background: rgba(245, 177, 76, .07); }
.kp-box.bad { border-color: rgba(255, 107, 107, .45); background: rgba(255, 107, 107, .07); }
.kp-n { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kp-n.neg { color: #ff8a8a; }
.kp-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kp-split3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.kp-chart { height: 280px; flex: none; }
.kp-table { max-height: 340px; overflow-y: auto; flex: none; }
.kp-table tr.fut td { color: var(--text-2); background: rgba(245, 177, 76, .04); }
.kp-table tr.tot td { font-weight: 700; border-top: 1px solid var(--line-2); background: var(--card-2); }
.kp-top { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.kp-top:last-child { border-bottom: 0; }
.kp-top span:last-child { white-space: nowrap; color: var(--link); font-variant-numeric: tabular-nums; }
.kp-top small { color: var(--muted); margin-left: 4px; }
.kp-h4 { margin: 6px 0 0; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-2); }
@media (max-width: 760px) {
  .kp-split, .kp-split3 { grid-template-columns: 1fr; }
  .kp-v { font-size: 26px; }
}
