/* ============ Tokens ============ */
:root {
  --bg: #f3f4f6; --surface: #ffffff; --surface-2: #f8fafc; --surface-3: #eef2f7; --line: #e2e8f0; --line-strong: #cbd5e1;
  --fg: #0f172a; --fg-2: #334155; --muted: #64748b; --faint: #94a3b8;
  --primary: #4f46e5; --primary-fg: #ffffff; --primary-soft: #eef2ff; --primary-text: #4338ca;
  --ok: #059669; --ok-soft: #ecfdf5; --warn: #d97706; --warn-soft: #fffbeb; --bad: #dc2626; --bad-soft: #fef2f2; --info: #0284c7; --info-soft: #f0f9ff;
  --side-bg: #0f172a; --side-fg: #cbd5e1; --side-active: #1e293b; --side-accent: #818cf8;
  --shadow: 0 1px 2px rgb(15 23 42 / .06), 0 1px 3px rgb(15 23 42 / .08);
  --shadow-lg: 0 10px 30px rgb(15 23 42 / .18);
  --r: 12px; --r-sm: 8px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
:root[data-theme="dark"] {
  --bg: #0b1120; --surface: #111a2e; --surface-2: #16213a; --surface-3: #1c2a47; --line: #233350; --line-strong: #324565;
  --fg: #e5e9f2; --fg-2: #c3cbdc; --muted: #8b97ad; --faint: #5f6b82;
  --primary: #6366f1; --primary-fg: #ffffff; --primary-soft: #1e2250; --primary-text: #a5b4fc;
  --ok: #34d399; --ok-soft: #0b2e24; --warn: #fbbf24; --warn-soft: #3a2a0a; --bad: #f87171; --bad-soft: #3a1414; --info: #38bdf8; --info-soft: #0c2a3d;
  --side-bg: #070c18; --side-fg: #aab4c8; --side-active: #141d33; --side-accent: #818cf8;
  --shadow: 0 1px 2px rgb(0 0 0 / .4); --shadow-lg: 0 10px 30px rgb(0 0 0 / .6);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0b1120; --surface: #111a2e; --surface-2: #16213a; --surface-3: #1c2a47; --line: #233350; --line-strong: #324565;
  --fg: #e5e9f2; --fg-2: #c3cbdc; --muted: #8b97ad; --faint: #5f6b82;
  --primary: #6366f1; --primary-fg: #ffffff; --primary-soft: #1e2250; --primary-text: #a5b4fc;
  --ok: #34d399; --ok-soft: #0b2e24; --warn: #fbbf24; --warn-soft: #3a2a0a; --bad: #f87171; --bad-soft: #3a1414; --info: #38bdf8; --info-soft: #0c2a3d;
  --side-bg: #070c18; --side-fg: #aab4c8; --side-active: #141d33; --side-accent: #818cf8;
  --shadow: 0 1px 2px rgb(0 0 0 / .4); --shadow-lg: 0 10px 30px rgb(0 0 0 / .6);
  color-scheme: dark;
}}

/* ============ Base ============ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 14px; line-height: 1.5; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary-text); text-decoration: none; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.ok { color: var(--ok); } .bad { color: var(--bad); } .warn { color: var(--warn); } .info { color: var(--info); }
[hidden] { display: none !important; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

/* ============ Layout ============ */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--side-bg); color: var(--side-fg); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; }
.logo .mark { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, #6366f1, #22d3ee); display: grid; place-items: center; font-weight: 800; font-size: 15px; color: #fff; flex: none; }
.logo b { font-size: 15px; font-weight: 700; display: block; line-height: 1.1; }
.logo span { font-size: 11px; opacity: .7; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: inherit; font-weight: 500; font-size: 13.5px; }
.nav a:hover { background: var(--side-active); color: #fff; }
.nav a.active { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 var(--side-accent); }
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav a .badge { margin-left: auto; font-size: 11px; font-weight: 600; background: var(--bad); color: #fff; border-radius: 99px; padding: 1px 7px; }
.nav .sep { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; opacity: .5; padding: 14px 10px 4px; }
.side-foot { margin-top: auto; padding: 10px; font-size: 11.5px; opacity: .6; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar h1 { font-size: 18px; margin: 0; font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-btn { display: none; }
.month-nav { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.month-nav button { border: 0; background: transparent; width: 34px; height: 34px; font-size: 18px; line-height: 1; color: var(--fg-2); }
.month-nav button:hover { background: var(--surface-3); }
.month-nav input { border: 0; background: transparent; font-weight: 600; padding: 0 4px; width: 150px; text-align: center; height: 34px; }
.month-nav input::-webkit-calendar-picker-indicator { opacity: .5; }
.month-nav .today { font-size: 12px; font-weight: 600; width: auto; padding: 0 10px; color: var(--primary-text); border-left: 1px solid var(--line); }
.content { padding: 22px 24px 60px; display: grid; gap: 18px; align-content: start; }

@media (max-width: 1080px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 50; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .side.open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgb(0 0 0 / .45); z-index: 40; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 10px 14px; flex-wrap: wrap; }
  .topbar h1 { font-size: 16px; }
  .content { padding: 14px 14px 80px; gap: 14px; }
  .month-nav input { width: 125px; }
}

/* ============ Cards / Grid ============ */
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1200px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .g2, .g3, .g4, .g-main { grid-template-columns: 1fr; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-h h2 { margin: 0; font-size: 14px; font-weight: 700; }
.card-h .sub { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 6px; }
.card-b { padding: 16px 18px; }
.card-b.flush { padding: 0; }

.kpi { padding: 16px 18px; display: grid; gap: 2px; position: relative; overflow: hidden; }
.kpi .l { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi .v { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.kpi .s { font-size: 12px; color: var(--muted); }
.kpi .icon { position: absolute; right: 14px; top: 14px; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-text); }
.kpi .icon svg { width: 18px; height: 18px; }
.kpi.ok .icon { background: var(--ok-soft); color: var(--ok); } .kpi.bad .icon { background: var(--bad-soft); color: var(--bad); } .kpi.warn .icon { background: var(--warn-soft); color: var(--warn); } .kpi.info .icon { background: var(--info-soft); color: var(--info); }
.progress { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 8px; }
.progress i { display: block; height: 100%; background: var(--ok); border-radius: 99px; transition: width .4s; }
.progress i.primary { background: var(--primary); }

/* ============ Buttons / Inputs ============ */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--fg); padding: 7px 12px; border-radius: 9px; font-weight: 500; font-size: 13px; white-space: nowrap; line-height: 1.3; }
.btn:hover { background: var(--surface-2); border-color: var(--faint); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { padding: 4px 9px; font-size: 12px; border-radius: 7px; }
.btn.icon { padding: 6px; width: 30px; height: 30px; justify-content: center; }
.btn svg { width: 15px; height: 15px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 9px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 6px 12px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }

.field { display: grid; gap: 5px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 500; color: var(--fg-2); }
.field > span small { color: var(--faint); font-weight: 400; margin-left: 4px; }
.input, .field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 9px; padding: 8px 10px; font-size: 14px; color: var(--fg); min-height: 38px; }
.field textarea { min-height: 76px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }
.field.err input, .field.err select { border-color: var(--bad); }
.field .hint { font-size: 11.5px; color: var(--muted); }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .c2 { grid-column: 1 / -1; }
.money-in { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.check input { width: 16px; height: 16px; min-height: 0; accent-color: var(--primary); }
.search { position: relative; }
.search input { padding-left: 32px; min-width: 220px; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--faint); }

/* ============ Tables ============ */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td { padding: 10px 14px; text-align: left; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl thead th { border-top: 0; background: var(--surface-2); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; position: sticky; top: 0; z-index: 1; white-space: nowrap; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tr.paid td { background: color-mix(in srgb, var(--ok-soft) 55%, var(--surface)); }
.tbl tr.paid:hover td { background: color-mix(in srgb, var(--ok-soft) 80%, var(--surface)); }
.tbl tr.late td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.tbl tr.done { opacity: .6; }
.tbl tfoot td { font-weight: 700; background: var(--surface-2); border-top: 2px solid var(--line-strong); }
.tbl .acts { display: flex; gap: 4px; justify-content: flex-end; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl .money { width: 128px; text-align: right; border: 1px solid transparent; background: var(--surface-3); border-radius: 7px; padding: 6px 8px; font-family: var(--mono); font-size: 13.5px; }
.tbl .money:hover { border-color: var(--line-strong); }
.tbl .money:focus { background: var(--surface); border-color: var(--primary); outline: 0; box-shadow: 0 0 0 2px var(--primary-soft); }
.tbl .money::placeholder { color: var(--faint); }
.tbl .obs-in { width: 100%; min-width: 120px; border: 0; border-bottom: 1px dashed var(--line-strong); background: transparent; font-size: 12.5px; padding: 3px 2px; color: var(--fg-2); }
.tbl .obs-in:focus { outline: 0; border-bottom-color: var(--primary); }
.cardname { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.ltile { height: 32px; min-width: 32px; max-width: 104px; width: auto; border-radius: 7px; background: #fff; border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; flex: none; overflow: hidden; padding: 4px 7px; box-shadow: 0 1px 2px rgb(0 0 0 / .08); box-sizing: border-box; }
.ltile img { height: 100%; width: auto; max-width: 100%; object-fit: contain; display: block; }
.ltile.ini { width: 32px; padding: 0; color: #fff; font-weight: 800; font-size: 12px; letter-spacing: .02em; border: 0; }
.ltile.sm { height: 24px; min-width: 24px; max-width: 76px; border-radius: 5px; padding: 3px 5px; font-size: 10px; } .ltile.ini.sm { width: 24px; }
.ltile.lg { height: 44px; min-width: 44px; max-width: 120px; border-radius: 10px; padding: 6px 10px; font-size: 15px; } .ltile.ini.lg { width: 44px; }
:root[data-theme="dark"] .ltile, :root:not([data-theme="light"]) .ltile { border-color: transparent; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .ltile { border-color: var(--line); } }
.cardname b { font-weight: 600; display: block; line-height: 1.2; }
.cardname .meta { font-size: 11.5px; color: var(--muted); }
.delta { font-size: 11px; color: var(--muted); display: block; margin-top: 2px; text-align: right; }
.delta.up { color: var(--bad); } .delta.down { color: var(--ok); }

.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 99px; white-space: nowrap; line-height: 1.3; }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.bad { background: var(--bad-soft); color: var(--bad); } .pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.info { background: var(--info-soft); color: var(--info); } .pill.idle { background: var(--surface-3); color: var(--muted); } .pill.primary { background: var(--primary-soft); color: var(--primary-text); }
.tag { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .05em; padding: 1px 6px; border-radius: 5px; background: var(--primary-soft); color: var(--primary-text); vertical-align: middle; }
.tag.pj { background: var(--warn-soft); color: var(--warn); }

/* ============ Lists ============ */
.list { display: flex; flex-direction: column; }
.li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 18px; border-top: 1px solid var(--line); }
.li:first-child { border-top: 0; }
.li .ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: 12px; color: #fff; }
.li .t { font-weight: 600; display: block; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .d { font-size: 12px; color: var(--muted); }
.li .v { font-weight: 700; text-align: right; white-space: nowrap; }
.li .v small { display: block; font-weight: 500; font-size: 11.5px; color: var(--muted); }
.li.done { opacity: .55; } .li.done .t { text-decoration: line-through; }
.alert { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; }
.alert .pill { flex: none; }
.alert .v { margin-left: auto; font-weight: 600; white-space: nowrap; }
.alert.erro { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); background: color-mix(in srgb, var(--bad-soft) 60%, var(--surface)); }
.alert.aviso { border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); background: color-mix(in srgb, var(--warn-soft) 60%, var(--surface)); }
.empty { padding: 34px 18px; text-align: center; color: var(--muted); font-size: 13.5px; }
.empty b { display: block; color: var(--fg); font-size: 15px; margin-bottom: 4px; }
.empty svg { width: 36px; height: 36px; color: var(--faint); margin-bottom: 8px; }

/* ============ Timeline (agenda) ============ */
.tl { display: grid; gap: 0; }
.tl-day { display: grid; grid-template-columns: 64px 1fr; gap: 14px; padding: 12px 18px; border-top: 1px solid var(--line); }
.tl-day:first-child { border-top: 0; }
.tl-date { text-align: center; }
.tl-date b { display: block; font-size: 22px; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.tl-date span { font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: .06em; }
.tl-date.today b { color: var(--primary-text); }
.tl-date.past b { color: var(--faint); }
.tl-items { display: grid; gap: 6px; }
.tl-it { display: grid; grid-template-columns: 4px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 9px; background: var(--surface-2); }
.tl-it i { width: 4px; height: 100%; min-height: 28px; border-radius: 99px; }
.tl-it .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-it .d { font-size: 12px; color: var(--muted); }
.tl-it .v { font-weight: 700; white-space: nowrap; }
.tl-it.done { opacity: .55; } .tl-it.done .t { text-decoration: line-through; }
@media (max-width: 600px) { .tl-day { grid-template-columns: 48px 1fr; padding: 10px 12px; } .tl-it { grid-template-columns: 4px minmax(0, 1fr) auto; } .tl-it .acts { grid-column: 2 / -1; justify-self: start; } }

/* ============ Charts ============ */
.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--font); fill: var(--muted); font-size: 11px; }
.chart .bar { fill: var(--primary); opacity: .9; }
.chart .bar.pj { fill: var(--warn); }
.chart .bar.sel { opacity: 1; stroke: var(--fg); stroke-width: 1.5; }
.chart .grid line { stroke: var(--line); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 6px 12px; align-items: center; font-size: 13px; }
.hbar .track { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.hbar .track i { display: block; height: 100%; border-radius: 99px; }
.hbar .n { font-weight: 600; text-align: right; }

/* ============ Drawer / Modal / Toast ============ */
.drawer-scrim { position: fixed; inset: 0; background: rgb(15 23 42 / .45); z-index: 90; backdrop-filter: blur(2px); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--surface); z-index: 95; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide .2s ease-out; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-h { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer-h h2 { margin: 0; font-size: 16px; }
.drawer-h p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.drawer-b { padding: 20px; overflow-y: auto; flex: 1; display: grid; gap: 14px; align-content: start; }
.drawer-f { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; align-items: center; background: var(--surface-2); }
.drawer-f .left { margin-right: auto; }
.form-err { background: var(--bad-soft); color: var(--bad); border-radius: 9px; padding: 9px 12px; font-size: 13px; }
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgb(15 23 42 / .5); padding: 16px; }
.modal .box { background: var(--surface); border-radius: 14px; padding: 22px; width: min(420px, 100%); box-shadow: var(--shadow-lg); }
.modal h3 { margin: 0 0 6px; font-size: 16px; }
.modal p { margin: 0 0 18px; color: var(--muted); font-size: 13.5px; }
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 110; pointer-events: none; }
.toast { background: var(--fg); color: var(--bg); padding: 9px 16px; border-radius: 99px; font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lg); animation: pop .2s; }
.toast.err { background: var(--bad); color: #fff; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

.summary-bar { display: flex; gap: 18px; flex-wrap: wrap; padding: 12px 18px; background: var(--surface-2); border-top: 1px solid var(--line); font-size: 13px; }
.summary-bar b { font-weight: 700; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 500; }
.steps { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 4px; }
.steps i { height: 8px; border-radius: 4px; background: var(--surface-3); }
.steps i.pg { background: var(--ok); } .steps i.late { background: var(--bad); } .steps i.now { background: var(--primary); }
.loader { padding: 40px; text-align: center; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media print { .side, .topbar .btn, .month-nav, .drawer, .drawer-scrim { display: none !important; } .app { grid-template-columns: 1fr; } .card { box-shadow: none; break-inside: avoid; } }

/* ============ Usuário / notificações / barra inferior ============ */
.side-user { padding: 10px; border-top: 1px solid rgb(255 255 255 / .08); margin-top: 6px; }
.userbox { display: flex; align-items: center; gap: 10px; }
.userbox .av { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #6366f1, #22d3ee); color: #fff; font-weight: 800; font-size: 12px; display: grid; place-items: center; flex: none; }
.userbox b { display: block; color: #fff; font-size: 13px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userbox span { font-size: 11px; opacity: .65; }
.nbadge { position: absolute; top: -2px; right: -2px; min-width: 16px; height: 16px; border-radius: 99px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.notif-panel { position: absolute; right: 60px; top: 54px; width: min(420px, calc(100vw - 24px)); max-height: 70vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 60; }
.notif-h { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.notif { display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.notif.nova { background: color-mix(in srgb, var(--primary-soft) 50%, var(--surface)); }
.notif .ic { font-size: 16px; }
.bottom-nav { display: none; }
@media (max-width: 760px) {
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); z-index: 30; padding-bottom: env(safe-area-inset-bottom, 0); }
  .bottom-nav a { flex: 1; display: grid; justify-items: center; gap: 2px; padding: 8px 2px 6px; font-size: 10.5px; color: var(--muted); position: relative; }
  .bottom-nav a svg { width: 20px; height: 20px; }
  .bottom-nav a.active { color: var(--primary-text); }
  .bottom-nav .dotb { position: absolute; top: 6px; right: calc(50% - 14px); width: 7px; height: 7px; border-radius: 99px; background: var(--bad); }
  .content { padding-bottom: 90px; }
  .topbar #tipoSeg { order: 5; }
}

/* ============ Hoje ============ */
.hj-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.hj-l { display: flex; flex-direction: column; }
.hj-g { border-top: 1px solid var(--line); }
.hj-g:first-child { border-top: 0; }
.hj-t { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; padding: 10px 18px 4px; }
.hj-i { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; gap: 12px; align-items: center; padding: 10px 18px; border-top: 1px solid var(--line); }
.hj-m { min-width: 0; } .hj-m b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .hj-m span { font-size: 12px; color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hj-d { text-align: right; font-size: 12px; color: var(--muted); white-space: nowrap; } .hj-d b { display: block; color: var(--fg); font-size: 13px; } .hj-d.bad b, .hj-d.bad { color: var(--bad); } .hj-d.warn b { color: var(--warn); }
.hj-v { font-weight: 700; white-space: nowrap; text-align: right; min-width: 100px; }
.hj-a { display: flex; gap: 6px; }
@media (max-width: 700px) { .hj-i { grid-template-columns: auto minmax(0, 1fr) auto; row-gap: 6px; padding: 10px 12px; } .hj-d { grid-column: 2; text-align: left; } .hj-d b { display: inline; margin-right: 6px; } .hj-v { grid-column: 3; grid-row: 1; } .hj-a { grid-column: 3; grid-row: 2; justify-self: end; } }
.d7 { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; }
.d7-c b { display: block; font-size: 13px; } .d7-c span { font-size: 10.5px; color: var(--muted); display: block; } .d7-c small { font-size: 10px; color: var(--muted); display: block; height: 14px; }
.d7-b { height: 54px; display: flex; align-items: flex-end; justify-content: center; margin-bottom: 4px; } .d7-b i { display: block; width: 70%; min-height: 3px; border-radius: 4px 4px 0 0; background: var(--primary); opacity: .85; }

/* ============ Modo rápido / responsivo de tabelas ============ */
.modo-rapido .c-pago, .modo-rapido .c-hist, .modo-rapido .c-obs, .modo-rapido .c-acts, .modo-rapido .delta { display: none !important; }
.modo-rapido .tbl td { padding-block: 7px; }
.modo-rapido .tbl .money { font-size: 16px; width: 150px; padding: 8px 10px; }
@media (max-width: 760px) {
  .tbl.resp thead { display: none; }
  .tbl.resp, .tbl.resp tbody, .tbl.resp tr, .tbl.resp td, .tbl.resp tfoot { display: block; width: 100%; }
  .tbl.resp tr { border-top: 6px solid var(--bg); padding: 8px 12px 10px; }
  .tbl.resp td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; align-items: center; gap: 10px; text-align: right; }
  .tbl.resp td[data-l]::before { content: attr(data-l); font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; text-align: left; flex: none; }
  .tbl.resp td:first-child { text-align: left; } .tbl.resp td:first-child::before { display: none; }
  .tbl.resp .acts { justify-content: flex-end; width: 100%; }
  .tbl.resp .c-hist { display: none; }
  .tbl.resp tr.late td:first-child { box-shadow: none; } .tbl.resp tr.late { box-shadow: inset 3px 0 0 var(--bad); }
  .tbl.resp tfoot td { display: flex; } .tbl.resp tfoot td:empty { display: none; }
  .tbl.resp .money { width: 140px; } .tbl.resp .obs-in { min-width: 0; }
  .tbl.resp .parc-row td { display: block; padding: 0; }
  .form-grid { grid-template-columns: 1fr; } .form-grid .c2 { grid-column: auto; }
  #qAdd { grid-template-columns: 1fr 1fr !important; }
}
@media (max-width: 760px) {
  .g4, .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 12px; } .kpi .v { font-size: 18px; } .kpi .icon { display: none; } .kpi .l { font-size: 11px; }
  .hj-head h2 { font-size: 19px !important; }
}
