/* ==========================================================================
   Lavanderia Gramadense — Sistema Financeiro
   Design system: roxo #5e2a82 / laranja #f47920 (identidade do site),
   Montserrat nos títulos, Inter na interface (números tabulares).
   ========================================================================== */

:root {
  --roxo-900: #2a1240;
  --roxo-800: #3a1958;
  --roxo-700: #4a2167;
  --roxo-600: #5e2a82;
  --roxo-500: #7a3fa6;
  --roxo-300: #b892d6;
  --roxo-100: #efe6f6;
  --roxo-50: #f7f2fb;
  --laranja-600: #d9631a;
  --laranja-500: #f47920;
  --laranja-300: #ffa756;
  --laranja-100: #fff0e4;

  --bg: #f6f4f9;
  --surface: #ffffff;
  --surface-2: #faf8fc;
  --surface-3: #f2eef6;
  --border: #e7e1ee;
  --border-strong: #d6cde0;
  --text: #241b2e;
  --text-2: #5d526a;
  --text-3: #8b8197;
  --primary: var(--roxo-600);
  --primary-hover: var(--roxo-700);
  --primary-soft: var(--roxo-100);
  --primary-text: var(--roxo-600);
  --accent: var(--laranja-500);
  --accent-hover: var(--laranja-600);
  --accent-soft: var(--laranja-100);

  --ok: #12805c;      --ok-soft: #e3f5ee;
  --warn: #a86400;    --warn-soft: #fff3dc;
  --danger: #c2341d;  --danger-soft: #fdeae6;
  --info: #2563a8;    --info-soft: #e6f0fb;

  --chart-1: #7a3fa6; /* despesas */
  --chart-2: #f47920; /* receitas */
  --chart-grid: #ece7f1;
  --chart-pos: #12805c; /* lucro */
  --chart-neg: #c2341d; /* prejuízo */

  --sidebar-bg: linear-gradient(180deg, #4a2167 0%, #3a1958 100%);
  --sidebar-text: rgba(255, 255, 255, .78);
  --sidebar-active: rgba(255, 255, 255, .14);

  --shadow-sm: 0 1px 2px rgba(42, 18, 64, .06);
  --shadow: 0 1px 3px rgba(42, 18, 64, .06), 0 6px 20px rgba(42, 18, 64, .06);
  --shadow-lg: 0 10px 40px rgba(42, 18, 64, .18);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-title: 'Montserrat', 'Inter', system-ui, sans-serif;
  --sidebar-w: 236px;
  --content-max: 1720px;
  --topbar-h: 64px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}

/* Tokens do modo escuro. O tema é resolvido por js/tema.js (claro / escuro / automático
   pelo sistema) e aplicado como data-theme no <html> antes da pintura. */
:root[data-theme="dark"] {
  --bg: #141019;
  --surface: #1c1622;
  --surface-2: #211a28;
  --surface-3: #2a2232;
  --border: #322a3b;
  --border-strong: #43394e;
  --text: #f1ecf6;
  --text-2: #bdb2c9;
  --text-3: #8d829a;
  --primary: #9a63c7;
  --primary-hover: #ad7ad6;
  --primary-soft: #33244a;
  --primary-text: #c9a6e6;
  --accent: #f08a3e;
  --accent-hover: #f59c57;
  --accent-soft: #3d2a1c;
  --ok: #4cc69a;      --ok-soft: #173229;
  --warn: #f0b24c;    --warn-soft: #3a2c14;
  --danger: #f27a66;  --danger-soft: #3d1d18;
  --info: #6aa8ec;    --info-soft: #172a40;
  --chart-1: #a46fd0;
  --chart-2: #d9671c;
  --chart-grid: #2c2434;
  --chart-pos: #2f9a72;
  --chart-neg: #e2604a;
  --sidebar-bg: linear-gradient(180deg, #231530 0%, #1a1024 100%);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 3px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01';
}
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-title); margin: 0; letter-spacing: -.01em; color: var(--text); }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 600; }
.num, td.num, .tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.small { font-size: 12.5px; }
.xs { font-size: 11.5px; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mb-16 { margin-bottom: 16px; }
.text-ok { color: var(--ok); } .text-danger { color: var(--danger); } .text-warn { color: var(--warn); }
::selection { background: var(--roxo-300); color: #fff; }

svg.lucide { width: 18px; height: 18px; stroke-width: 1.9; flex-shrink: 0; }
.ico-sm svg.lucide, svg.lucide.ico-sm { width: 15px; height: 15px; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--sidebar-bg); color: var(--sidebar-text);
  display: flex; flex-direction: column; padding: 14px 10px; z-index: 30;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent;
}
.sidebar .brand { display: flex; align-items: center; padding: 2px 8px 6px; }
.sidebar .brand img { height: 30px; width: auto; }
.sidebar .brand-sub { font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: rgba(255,255,255,.5); padding: 0 10px 8px; font-weight: 600; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-section { display: flex; align-items: center; justify-content: space-between; width: 100%; border: 0; background: none; cursor: pointer;
  font: 600 10px/1 var(--font); letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.42); padding: 12px 10px 5px; }
.nav-section:hover { color: rgba(255,255,255,.7); }
.nav-section svg.lucide { width: 13px; height: 13px; transition: transform .2s; }
.nav-group.fechado .nav-section svg.lucide { transform: rotate(-90deg); }
.nav-group.fechado .nav-itens { display: none; }
.nav-itens { display: flex; flex-direction: column; gap: 1px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 6.5px 10px; border-radius: 8px;
  color: var(--sidebar-text); font-weight: 500; font-size: 13px; line-height: 1.3; text-decoration: none;
  transition: background .15s, color .15s; position: relative;
}
.nav a svg.lucide { width: 16px; height: 16px; opacity: .9; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.active { background: var(--sidebar-active); color: #fff; }
.nav a.active::before { content: ''; position: absolute; left: -10px; top: 6px; bottom: 6px; width: 3px; border-radius: 0 3px 3px 0; background: var(--laranja-500); }
.nav a .badge-count { margin-left: auto; background: var(--laranja-500); color: #fff; font-size: 10.5px; font-weight: 700; border-radius: 999px; padding: 1px 6px; min-width: 18px; text-align: center; }
.nav a .em-breve { margin-left: auto; font-size: 9.5px; font-weight: 600; letter-spacing: .04em; color: rgba(255,255,255,.45); border: 1px solid rgba(255,255,255,.18); border-radius: 99px; padding: 0 6px; }
.sidebar-foot { margin-top: auto; padding: 10px 4px 0; border-top: 1px solid rgba(255,255,255,.08); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 20; border-bottom: 1px solid transparent;
}
.topbar-inner { height: 100%; display: flex; align-items: center; gap: 12px; max-width: var(--content-max); margin: 0 auto; }
.topbar.scrolled { border-bottom-color: var(--border); }
.topbar .menu-btn { display: none; }
.topbar .page-title-mobile { display: none; font-family: var(--font-title); font-weight: 700; font-size: 15px; }
.content { padding: 8px 28px 48px; max-width: var(--content-max); width: 100%; margin: 0 auto; }
.sidebar-backdrop { display: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 10px 0 22px; flex-wrap: wrap; }
.page-head .eyebrow { font-size: 12px; font-weight: 600; color: var(--accent); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 4px; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px 0; }
.card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-body { padding: 16px 22px 20px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-dash { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.grid > * { min-width: 0; }

/* KPI / stat tiles */
.kpi { padding: 18px 20px; position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 6px; cursor: default; transition: transform .2s var(--ease), box-shadow .2s; }
a.kpi, .kpi.clicavel { cursor: pointer; color: inherit; text-decoration: none; }
a.kpi:hover, .kpi.clicavel:hover { transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; }
.kpi .kpi-label { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.kpi .kpi-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-text); }
.kpi .kpi-ico svg { width: 16px; height: 16px; }
.kpi.danger .kpi-ico { background: var(--danger-soft); color: var(--danger); }
.kpi.warn .kpi-ico { background: var(--warn-soft); color: var(--warn); }
.kpi.ok .kpi-ico { background: var(--ok-soft); color: var(--ok); }
.kpi.accent .kpi-ico { background: var(--accent-soft); color: var(--accent); }
.kpi .kpi-value { font-family: var(--font-title); font-size: 25px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi .kpi-foot { font-size: 12px; color: var(--text-3); }
.kpi-hero, a.kpi.kpi-hero { background: linear-gradient(135deg, #5e2a82 0%, #4a2167 60%, #3a1958 100%); color: #fff; border: 0; }
.kpi-hero .kpi-label, .kpi-hero .kpi-foot { color: rgba(255,255,255,.75); }
.kpi-hero .kpi-ico { background: rgba(255,255,255,.14); color: #fff; }
.kpi-hero::after { content: ''; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle, rgba(244,121,32,.45), transparent 70%); }

/* ---------- Buttons ---------- */
.btn {
  --b: var(--surface); --c: var(--text); --bd: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 15px;
  border-radius: 10px; border: 1px solid var(--bd); background: var(--b); color: var(--c);
  font: 600 13.5px/1 var(--font); cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .08s;
}
.btn:hover { text-decoration: none; background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 35%, transparent); outline-offset: 1px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-primary { --b: var(--primary); --c: #fff; --bd: transparent; box-shadow: 0 2px 8px color-mix(in srgb, var(--primary) 30%, transparent); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-accent { --b: var(--accent); --c: #fff; --bd: transparent; box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn-accent:hover { background: var(--accent-hover); }
.btn-ghost { --b: transparent; --bd: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { --b: var(--surface); --c: var(--danger); --bd: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 7px; gap: 5px; }
.btn-icon { width: 38px; padding: 0; }
.btn-sm.btn-icon { width: 32px; }
.btn-xs.btn-icon { width: 26px; }
.btn .spinner { width: 15px; height: 15px; border-width: 2px; }
.btn-group { display: inline-flex; }
.btn-group .btn:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; }
.btn-group .btn:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.field .hint { font-size: 11.5px; color: var(--text-3); }
.field .error { font-size: 12px; color: var(--danger); }
.input, .select, textarea.input {
  height: 40px; width: 100%; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: 14px var(--font); transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 76px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.input:hover, .select:hover { border-color: color-mix(in srgb, var(--primary) 35%, var(--border-strong)); }
.input:focus, .select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.input.invalid { border-color: var(--danger); }
.input[readonly] { background: var(--surface-2); }
.input-sm, .select.input-sm { height: 34px; font-size: 13px; border-radius: 8px; }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b8197' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; cursor: pointer; }
.input-group { position: relative; display: flex; align-items: center; }
.input-group > svg.lucide { position: absolute; left: 12px; color: var(--text-3); pointer-events: none; width: 16px; height: 16px; }
.input-group > .input { padding-left: 38px; }
.input-group .prefix { position: absolute; left: 12px; color: var(--text-3); font-weight: 600; font-size: 13px; pointer-events: none; }
.input-group .prefix + .input { padding-left: 36px; }
.input-money { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px 14px; }
.col-12 { grid-column: span 12; } .col-8 { grid-column: span 8; } .col-6 { grid-column: span 6; } .col-4 { grid-column: span 4; } .col-3 { grid-column: span 3; } .col-9 { grid-column: span 9; }
.form-section { font-family: var(--font-title); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); grid-column: span 12; padding-top: 6px; display: flex; align-items: center; gap: 10px; }
.form-section::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; user-select: none; }
.checkbox input { width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; }
.switch input { appearance: none; width: 36px; height: 21px; border-radius: 99px; background: var(--border-strong); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { transform: translateX(15px); }

/* Segmented control */
.segmented { display: inline-flex; background: var(--surface-3); border-radius: 11px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented button { border: 0; background: transparent; color: var(--text-2); font: 600 13px var(--font); padding: 7px 13px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; transition: background .15s, color .15s; }
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented .count { font-size: 11px; font-weight: 700; background: var(--border); color: var(--text-2); padding: 0 6px; border-radius: 99px; line-height: 17px; }
.segmented button.active .count { background: var(--primary-soft); color: var(--primary-text); }
.segmented .count.danger { background: var(--danger-soft); color: var(--danger); }

/* Tabs (sublinhado) */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; font: 600 13.5px var(--font); color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 7px; align-items: center; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--primary-text); border-bottom-color: var(--accent); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); padding: 11px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.table th:first-child { border-top-left-radius: var(--radius-lg); }
.table th:last-child { border-top-right-radius: var(--radius-lg); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .12s; }
.table tbody tr.clicavel { cursor: pointer; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.selected { background: color-mix(in srgb, var(--primary-soft) 60%, transparent); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; }
.table td.check, .table th.check { width: 42px; padding-right: 0; }
.table .td-main { font-weight: 600; color: var(--text); }
.table .td-sub { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border); }
.table-compact td { padding: 8px 12px; }

/* ---------- Badges / chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge svg.lucide { width: 12px; height: 12px; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-primary { background: var(--primary-soft); color: var(--primary-text); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-outline { background: transparent; border: 1px solid var(--border-strong); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; background: var(--text-3); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 99px; background: var(--primary-soft); color: var(--primary-text); font-size: 12.5px; font-weight: 600; }
.chip button { border: 0; background: none; color: inherit; cursor: pointer; display: grid; place-items: center; padding: 0; opacity: .7; }
.chip button:hover { opacity: 1; }
.chip svg.lucide { width: 14px; height: 14px; }

/* Avatar */
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; background: var(--roxo-500); flex-shrink: 0; font-family: var(--font-title); }
.avatar-sm { width: 26px; height: 26px; font-size: 11px; }

/* ---------- Filters bar ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.toolbar .input-group { min-width: 240px; flex: 1; max-width: 360px; }
.filters-active { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 16px 12px; }
.bulkbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--primary-soft); color: var(--primary-text); font-weight: 600; border-bottom: 1px solid var(--border); flex-wrap: wrap; }

/* ---------- Empty, skeleton, spinner ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--text-2); }
.empty .empty-ico { width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 14px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-text); }
.empty .empty-ico svg { width: 28px; height: 28px; }
.empty h3 { margin-bottom: 4px; }
.empty p { margin: 0 auto 16px; max-width: 420px; }
.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.spinner { width: 22px; height: 22px; border: 2.5px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: currentColor; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-page { display: grid; place-items: center; min-height: 50vh; color: var(--primary-text); }

/* ---------- Modal / drawer ---------- */
.overlay { position: fixed; inset: 0; background: rgba(26, 12, 38, .42); backdrop-filter: blur(3px); z-index: 100; opacity: 0; transition: opacity .2s; }
.overlay.open { opacity: 1; }
.modal { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -46%) scale(.98); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); z-index: 101; opacity: 0; transition: opacity .2s, transform .25s var(--ease); }
.modal.open { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.modal.lg { width: min(820px, calc(100vw - 32px)); }
.modal.xl { width: min(1180px, calc(100vw - 32px)); height: calc(100vh - 48px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 17px; }
.modal-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--surface); box-shadow: var(--shadow-lg); z-index: 101; display: flex; flex-direction: column; transform: translateX(100%); transition: transform .28s var(--ease); }
.drawer.open { transform: none; }
.drawer.wide { width: min(760px, 100vw); }

/* ---------- Toast ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast { display: flex; align-items: flex-start; gap: 10px; min-width: 280px; max-width: 420px; padding: 13px 15px; background: var(--surface); color: var(--text); border-radius: 12px; box-shadow: var(--shadow-lg); border-left: 4px solid var(--primary); animation: toastIn .3s var(--ease); font-size: 13.5px; }
.toast.ok { border-left-color: var(--ok); } .toast.ok svg { color: var(--ok); }
.toast.erro { border-left-color: var(--danger); } .toast.erro svg { color: var(--danger); }
.toast.aviso { border-left-color: var(--warn); } .toast.aviso svg { color: var(--warn); }
.toast .toast-close { margin-left: auto; border: 0; background: none; cursor: pointer; color: var(--text-3); padding: 0; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Dropdown / popover / combobox ---------- */
.dropdown { position: relative; display: inline-block; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 60; display: none; }
.menu.open { display: block; animation: pop .15s var(--ease); }
.menu.left { left: 0; right: auto; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; border: 0; background: none; color: var(--text); font: 500 13.5px var(--font); text-align: left; cursor: pointer; text-decoration: none; }
.menu a:hover, .menu button:hover { background: var(--surface-3); text-decoration: none; }
.menu .sep { height: 1px; background: var(--border); margin: 6px 0; }
.menu .danger { color: var(--danger); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.combo { position: relative; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 280px; overflow-y: auto; z-index: 70; padding: 5px; display: none; }
.combo-list.open { display: block; }
.combo-item { padding: 8px 10px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.combo-item:hover, .combo-item.hl { background: var(--surface-3); }
.combo-item .sub { font-size: 12px; color: var(--text-3); margin-left: auto; }
.combo-item.novo { color: var(--primary-text); font-weight: 600; }

/* ---------- Dropzone ---------- */
.dropzone { display: block; border: 2px dashed var(--border-strong); border-radius: var(--radius-lg); padding: 30px 20px; text-align: center; background: var(--surface-2); cursor: pointer; transition: border-color .2s, background .2s, transform .2s; position: relative; overflow: hidden; }
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: color-mix(in srgb, var(--primary-soft) 55%, var(--surface)); }
.dropzone.over { transform: scale(1.005); }
.dropzone .dz-ico { width: 54px; height: 54px; margin: 0 auto 12px; border-radius: 16px; background: linear-gradient(135deg, var(--roxo-500), var(--roxo-700)); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 35%, transparent); }
.dropzone .dz-ico svg { width: 26px; height: 26px; }
.dropzone h3 { margin-bottom: 4px; }
.dropzone input { display: none; }
.dropzone.compact { padding: 16px; display: flex; align-items: center; gap: 14px; text-align: left; }
.dropzone.compact .dz-ico { margin: 0; width: 40px; height: 40px; border-radius: 12px; }
.dropzone.compact .dz-ico svg { width: 20px; height: 20px; }

/* ---------- Caixa de entrada (documentos) ---------- */
.inbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.doc-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; position: relative; }
.doc-card:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); box-shadow: var(--shadow); transform: translateY(-1px); }
.doc-card .doc-top { display: flex; gap: 12px; align-items: flex-start; }
.doc-thumb { width: 46px; height: 56px; border-radius: 8px; background: var(--surface-3); display: grid; place-items: center; color: var(--text-3); flex-shrink: 0; overflow: hidden; border: 1px solid var(--border); }
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-card .doc-valor { font-family: var(--font-title); font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; }
.doc-card .doc-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.doc-card.processando { cursor: progress; }
.doc-card.processando::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, transparent, var(--accent), transparent); background-size: 50% 100%; background-repeat: no-repeat; animation: scan 1.4s infinite; border-radius: 0 0 var(--radius) var(--radius); }
@keyframes scan { from { background-position: -50% 0; } to { background-position: 150% 0; } }
.review { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); height: 100%; min-height: 0; }
.review-preview { background: var(--surface-3); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.review-preview iframe, .review-preview img { flex: 1; width: 100%; height: 100%; border: 0; object-fit: contain; background: #fff; }
.review-form { overflow-y: auto; padding: 20px 22px; }
.ai-box { border-radius: 12px; padding: 12px 14px; background: linear-gradient(135deg, color-mix(in srgb, var(--primary-soft) 80%, var(--surface)), var(--surface)); border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border)); display: flex; gap: 10px; align-items: flex-start; }
.ai-box .ai-ico { color: var(--primary-text); }
.ai-box ul { margin: 6px 0 0; padding-left: 18px; color: var(--text-2); font-size: 12.5px; }
.sugestao { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; background: var(--surface-2); }
.sugestao.forte { border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); background: var(--ok-soft); }
.confianca { height: 6px; width: 64px; border-radius: 99px; background: var(--border); overflow: hidden; }
.confianca > span { display: block; height: 100%; border-radius: 99px; background: var(--ok); }

/* ---------- Conciliação ---------- */
.conc-list { display: flex; flex-direction: column; }
.conc-item { display: grid; grid-template-columns: 92px minmax(0, 1.2fr) 130px minmax(0, 1.4fr); gap: 16px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.conc-item:last-child { border-bottom: 0; }
.conc-item:hover { background: var(--surface-2); }
.conc-item .conc-data { font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.conc-item .conc-valor { text-align: right; font-weight: 700; font-family: var(--font-title); font-variant-numeric: tabular-nums; font-size: 15px; }
.conc-item .conc-valor.saida { color: var(--text); }
.conc-item .conc-valor.entrada { color: var(--ok); }
.match { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 12px; border-radius: 10px; border: 1px dashed var(--border-strong); background: var(--surface); }
.match.forte { border-style: solid; border-color: color-mix(in srgb, var(--ok) 50%, var(--border)); background: color-mix(in srgb, var(--ok-soft) 70%, var(--surface)); }
.match.feito { border-style: solid; border-color: transparent; background: var(--ok-soft); }
.match .match-info { flex: 1; min-width: 0; }
.score { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); }
.score.alto { background: var(--ok-soft); color: var(--ok); }
.bank-card { border-radius: var(--radius-lg); padding: 18px 20px; color: #fff; position: relative; overflow: hidden; cursor: pointer; transition: transform .2s var(--ease), box-shadow .2s; min-height: 132px; display: flex; flex-direction: column; justify-content: space-between; border: 2px solid transparent; }
.bank-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.bank-card.active { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.bank-card::after { content: ''; position: absolute; right: -30px; bottom: -50px; width: 150px; height: 150px; border-radius: 50%; background: rgba(255,255,255,.08); }
.bank-card .bank-saldo { font-family: var(--font-title); font-weight: 700; font-size: 20px; font-variant-numeric: tabular-nums; }
.progress { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--ok), color-mix(in srgb, var(--ok) 70%, #fff)); border-radius: 99px; transition: width .5s var(--ease); }

/* ---------- DRE ---------- */
.dre-table th:first-child, .dre-table td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 2; min-width: 280px; }
.dre-table th:first-child { background: var(--surface-2); z-index: 3; }
.dre-table td { padding: 9px 14px; white-space: nowrap; }
.dre-table tr.grupo td { font-weight: 700; cursor: pointer; }
.dre-table tr.grupo td:first-child::before { content: '▸'; display: inline-block; width: 16px; color: var(--text-3); transition: transform .15s; }
.dre-table tr.grupo.open td:first-child::before { transform: rotate(90deg); }
.dre-table tr.cat td { color: var(--text-2); font-size: 13px; }
.dre-table tr.cat td:first-child { padding-left: 38px; }
.dre-table tr.resultado td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border-strong); }
.dre-table tr.resultado td:first-child { background: var(--surface-2); }
.dre-table tr.resultado.final td { background: var(--primary-soft); color: var(--primary-text); font-size: 14.5px; }
.dre-table tr.resultado.final td:first-child { background: var(--primary-soft); }
.dre-table td.neg { color: var(--danger); }
.dre-table tr.memo td { color: var(--text-3); font-style: italic; }

/* ---------- Charts ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .axis-label { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.chart .value-label { fill: var(--text-2); font-size: 11px; font-weight: 600; font-family: var(--font); }
.chart .bar { transition: opacity .15s; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:hover + .bar, .chart .bar.hover { opacity: .82; }
.chart-tip { position: absolute; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 9px 12px; font-size: 12.5px; z-index: 5; opacity: 0; transition: opacity .12s; min-width: 150px; }
.chart-tip.show { opacity: 1; }
.chart-tip .tip-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.chart-tip .tip-row b { font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding: 7px 0; font-size: 13px; }
.hbar .hbar-track { grid-column: 1 / -1; grid-row: 2; height: 10px; position: relative; }
.hbar .hbar-fill { height: 100%; border-radius: 0 4px 4px 0; background: var(--chart-1); min-width: 2px; transition: width .6s var(--ease); }
.hbar .hbar-val { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }

/* Lista de vencimentos */
.venc-list { display: flex; flex-direction: column; }
.venc-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.venc-item:last-child { border-bottom: 0; }
.venc-item:hover .venc-desc { color: var(--primary-text); }
.venc-date { width: 46px; text-align: center; border-radius: 10px; background: var(--surface-3); padding: 5px 0; flex-shrink: 0; }
.venc-date b { display: block; font-family: var(--font-title); font-size: 16px; line-height: 1.1; }
.venc-date span { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 600; }
.venc-date.vencido { background: var(--danger-soft); color: var(--danger); }
.venc-date.vencido span { color: var(--danger); }
.venc-date.hoje { background: var(--accent-soft); color: var(--accent); }
.venc-date.hoje span { color: var(--accent); }

/* Checklist do fechamento */
.check-item { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.check-item:last-child { border-bottom: 0; }
.check-ico { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.check-ico.ok { background: var(--ok-soft); color: var(--ok); }
.check-ico.pend { background: var(--warn-soft); color: var(--warn); }
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item { display: flex; gap: 12px; padding-bottom: 14px; position: relative; }
.tl-item::before { content: ''; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: var(--border); }
.tl-item:last-child::before { display: none; }
.tl-dot { width: 28px; height: 28px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-text); display: grid; place-items: center; flex-shrink: 0; }
.tl-dot svg { width: 14px; height: 14px; }

/* Detalhe (drawer) */
.detail-head { padding: 22px 24px 18px; border-bottom: 1px solid var(--border); }
.detail-valor { font-family: var(--font-title); font-size: 30px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.detail-body { padding: 18px 24px; overflow-y: auto; flex: 1; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 9px 14px; font-size: 13.5px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.kv dd .badge { white-space: normal; height: auto; min-height: 22px; padding-top: 2px; padding-bottom: 2px; }
.attach { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); }
.attach + .attach { margin-top: 8px; }
.attach .grow a { font-weight: 600; }

/* ---------- Auth pages ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(420px, .9fr); background: var(--surface); }
.auth-art { position: relative; overflow: hidden; background: linear-gradient(150deg, #5e2a82 0%, #4a2167 45%, #2a1240 100%); color: #fff; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-art::before { content: ''; position: absolute; inset: 0; background: url('../img/pattern-light.png') center/cover; opacity: .08; mix-blend-mode: screen; }
.auth-art .bolha { position: absolute; border-radius: 50%; filter: blur(2px); }
.auth-art .b1 { width: 380px; height: 380px; right: -120px; top: -100px; background: radial-gradient(circle, rgba(244,121,32,.55), transparent 65%); }
.auth-art .b2 { width: 300px; height: 300px; left: -80px; bottom: -60px; background: radial-gradient(circle, rgba(184,146,214,.45), transparent 65%); }
.auth-art img.logo { height: 44px; width: auto; align-self: flex-start; position: relative; }
.auth-art h1 { color: #fff; font-size: 38px; line-height: 1.15; max-width: 480px; position: relative; font-weight: 800; }
.auth-art h1 em { font-style: normal; color: var(--laranja-300); }
.auth-art p { color: rgba(255,255,255,.75); max-width: 440px; position: relative; font-size: 15px; }
.auth-feats { display: grid; gap: 14px; position: relative; margin-top: 28px; }
.auth-feats div { display: flex; gap: 12px; align-items: center; color: rgba(255,255,255,.88); }
.auth-feats .lucide { width: 34px; height: 34px; padding: 8px; border-radius: 10px; background: rgba(255,255,255,.12); }
.auth-panel { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.auth-box { width: 100%; max-width: 380px; }
.auth-box h2 { font-size: 26px; margin-bottom: 6px; }
.auth-box .logo-mobile { display: none; height: 38px; margin-bottom: 26px; }
.alert { padding: 11px 14px; border-radius: 10px; font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; }
.alert-erro { background: var(--danger-soft); color: var(--danger); }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.pw-meter { height: 5px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.pw-meter span { display: block; height: 100%; width: 0; transition: width .3s, background .3s; }


/* ---------- Mural de recados / Início ---------- */
.recado { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--recado-cor, var(--primary)); border-radius: var(--radius-lg); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow-sm); }
.recado.alta { box-shadow: 0 0 0 1px color-mix(in srgb, var(--danger) 30%, transparent), var(--shadow); }
.recado.fixado { background: linear-gradient(180deg, color-mix(in srgb, var(--primary-soft) 45%, var(--surface)), var(--surface) 70%); }
.recado-titulo { font-size: 17px; line-height: 1.3; }
.recado-texto { color: var(--text-2); font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.recado-texto p { margin: 0 0 8px; }
.recado-texto p:last-child { margin-bottom: 0; }
.recado-texto ul { margin: 0 0 8px; padding-left: 20px; }
.recado-texto b { color: var(--text); }
.recado footer { padding-top: 10px; border-top: 1px solid var(--border); }
.modulos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.modulo { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s, box-shadow .15s; }
.modulo:hover { text-decoration: none; border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.modulo b { font-family: var(--font-title); font-size: 14px; }
.modulo span:last-child { font-size: 12px; color: var(--text-3); line-height: 1.35; }
.modulo-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-text); margin-bottom: 4px; }
.pend-link { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; font-size: 13.5px; }
.pend-link:last-child { border-bottom: 0; }
.pend-link:hover { text-decoration: none; color: var(--primary-text); }
.pend-link .check-ico { width: 32px; height: 32px; }

/* ---------- Balanço ---------- */
.balanco { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.bal-lado h2 { display: flex; justify-content: space-between; align-items: baseline; padding: 16px 20px; border-bottom: 1px solid var(--border); font-size: 15px; letter-spacing: .04em; text-transform: uppercase; }
.bal-lado h2 b { font-variant-numeric: tabular-nums; font-size: 18px; letter-spacing: 0; text-transform: none; }
.bal-grupo { padding: 6px 0; border-bottom: 1px solid var(--border); }
.bal-grupo:last-child { border-bottom: 0; }
.bal-grupo-tit { display: flex; justify-content: space-between; padding: 10px 20px 6px; font-weight: 700; font-size: 13.5px; color: var(--text); }
.bal-linha { display: flex; justify-content: space-between; gap: 12px; padding: 7px 20px 7px 30px; font-size: 13.5px; color: var(--text-2); cursor: pointer; }
.bal-linha:hover { background: var(--surface-2); }
.bal-linha .v { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); white-space: nowrap; }
.bal-linha .nome::before { content: '▸'; display: inline-block; width: 14px; color: var(--text-3); transition: transform .15s; }
.bal-linha.open .nome::before { transform: rotate(90deg); }
.bal-linha.sem-itens .nome::before { visibility: hidden; }
.bal-itens { display: none; padding: 0 20px 8px 58px; }
.bal-linha.open + .bal-itens { display: block; }
.bal-item { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; color: var(--text-3); padding: 3px 0; }
.bal-item span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.bal-total { display: flex; justify-content: space-between; padding: 14px 20px; background: var(--primary-soft); color: var(--primary-text); font-weight: 700; border-radius: 0 0 var(--radius-lg) var(--radius-lg); font-variant-numeric: tabular-nums; }
@media (max-width: 1100px) { .balanco { grid-template-columns: 1fr; } }

/* ---------- Responsivo ---------- */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-dash { grid-template-columns: minmax(0, 1fr); }
  .conc-item { grid-template-columns: 80px minmax(0, 1fr) 110px; }
  .conc-item .conc-match { grid-column: 1 / -1; }
}

/* Tablet e celular: menu vira gaveta */
@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(290px, 86vw); transform: translateX(-105%); transition: transform .28s var(--ease); box-shadow: var(--shadow-lg); padding-top: max(14px, env(safe-area-inset-top)); }
  .sidebar.open { transform: none; }
  .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(26,12,38,.45); z-index: 29; opacity: 0; pointer-events: none; transition: opacity .25s; }
  .sidebar-backdrop.open { opacity: 1; pointer-events: auto; }
  .nav a { padding: 10px 12px; font-size: 14.5px; }
  .topbar { padding: 0 12px; padding-top: env(safe-area-inset-top); height: calc(var(--topbar-h) + env(safe-area-inset-top)); }
  .topbar .menu-btn { display: inline-flex; }
  .topbar .page-title-mobile { display: block; }
  .content { padding: 4px 16px calc(40px + env(safe-area-inset-bottom)); }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .review { grid-template-columns: 1fr; grid-template-rows: 38vh auto; }
  .review-preview { border-right: 0; border-bottom: 1px solid var(--border); }
  .auth { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; min-height: 100dvh; }
  .auth-art { padding: max(28px, env(safe-area-inset-top)) 22px 30px; gap: 18px; justify-content: flex-start; }
  .auth-art img.logo { height: 34px; }
  .auth-art h1 { font-size: 25px; }
  .auth-art p, .auth-art small { display: none; }
  .auth-feats { margin-top: 14px; gap: 8px; font-size: 13px; }
  .auth-feats .lucide { width: 28px; height: 28px; padding: 6px; }
  .auth-panel { place-items: start center; padding: 26px 20px 40px; margin-top: -14px; border-radius: 18px 18px 0 0; position: relative; }
  .form-grid .col-6, .form-grid .col-4, .form-grid .col-3, .form-grid .col-8, .form-grid .col-9 { grid-column: span 12; }
  .kv { grid-template-columns: 130px 1fr; }
  .hide-mobile { display: none !important; }
  .dre-table th:first-child, .dre-table td:first-child { min-width: 190px; max-width: 230px; white-space: normal; }
}

/* Celular */
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  /* iOS não dá zoom em campos com 16px */
  .input, .select, textarea.input, .input-sm, .select.input-sm { font-size: 16px; }
  .input-sm, .select.input-sm { height: 40px; }
  .page-head { margin: 6px 0 16px; align-items: stretch; }
  .page-head h1 { font-size: 21px; }
  .page-head > .row, .page-head > div:last-child:not(:first-child) { width: 100%; }
  .page-head > .row .btn, .page-head > div:last-child:not(:first-child) > .btn { flex: 1; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grid { gap: 12px; }
  .kpi { padding: 14px; gap: 4px; }
  .kpi .kpi-value { font-size: 19px; }
  .kpi .kpi-label { font-size: 12px; }
  .kpi .kpi-ico { width: 26px; height: 26px; }
  .kpi .kpi-foot { font-size: 11.5px; }
  .card-head { padding: 16px 16px 0; }
  .card-body { padding: 12px 16px 16px; }
  .card-pad { padding: 16px; }
  .toolbar { padding: 12px; gap: 8px; }
  .toolbar > * { flex: 1 1 100%; width: 100% !important; max-width: none !important; min-width: 0 !important; }
  .toolbar > .grow { display: none; }
  .segmented { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .segmented::-webkit-scrollbar { display: none; }
  .segmented button { white-space: nowrap; flex-shrink: 0; }
  .tabs { margin-bottom: 14px; }

  /* Tabelas viram cartões: cada <td data-label> mostra o rótulo */
  .table.resp thead { display: none; }
  .table.resp, .table.resp tbody, .table.resp tfoot { display: block; }
  .table.resp tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); position: relative; }
  .table.resp tbody tr:last-child { border-bottom: 0; }
  .table.resp td { display: block; padding: 0; border: 0; text-align: left; white-space: normal !important; min-width: 0; }
  .table.resp td.num { text-align: right; }
  .table.resp td[data-label]::before { content: attr(data-label); display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 600; margin-bottom: 1px; }
  .table.resp td.c-full { grid-column: 1 / -1; }
  .table.resp td.check { position: absolute; left: 14px; top: 14px; width: auto; }
  .table.resp tr.has-check { padding-left: 44px; }
  .table.resp tfoot tr { background: var(--surface-2); }
  .table.resp tfoot td:empty { display: none; }
  /* Lançamentos no celular: descrição em cima, vencimento × valor, situação × ação */
  .tabela-lanc.resp td.c-desc { order: -1; grid-column: 1 / -1; max-width: none !important; }
  .tabela-lanc.resp td.c-desc .td-main { white-space: normal; }
  .tabela-lanc.resp td.c-venc { grid-column: 1; }
  .tabela-lanc.resp td.c-valor { grid-column: 2; align-self: center; }
  .tabela-lanc.resp td.c-sit { grid-column: 1; align-self: center; }
  .tabela-lanc.resp td.c-acao { grid-column: 2; }
  .tabela-lanc.resp tfoot tr { grid-template-columns: 1fr auto; }
  .tabela-lanc.resp tfoot td[colspan] { grid-column: 1; }

  /* Modais em tela cheia (estilo app) */
  .modal, .modal.lg, .modal.xl { width: 100vw; max-height: none; height: 100%; height: 100dvh; top: 0; left: 0; transform: translateY(16px); border-radius: 0; }
  .modal.open { transform: none; }
  .modal-head { padding: 14px 16px; padding-top: max(14px, env(safe-area-inset-top)); }
  .modal-body { padding: 16px; }
  .modal-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-radius: 0; flex-wrap: wrap; }
  .modal-foot .btn { flex: 1 1 auto; }
  .modal-foot .grow { display: none; }
  .drawer, .drawer.wide { width: 100vw; }
  .detail-head { padding: 16px; padding-top: max(16px, env(safe-area-inset-top)); }
  .detail-body { padding: 14px 16px calc(24px + env(safe-area-inset-bottom)); }
  .detail-valor { font-size: 26px; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .review { grid-template-rows: 34vh auto; }
  .review-form { padding: 16px; }

  .conc-item { grid-template-columns: 1fr auto; padding: 12px 14px; gap: 8px 12px; }
  .conc-item .conc-data { grid-column: 1 / -1; font-size: 12.5px; }
  .bank-card { min-height: 112px; padding: 14px 16px; }
  .inbox-grid { grid-template-columns: 1fr; }
  .recado { padding: 14px; }
  .modulos { grid-template-columns: 1fr 1fr; }
  .bal-linha { padding-left: 20px; }
  .bal-itens { padding-left: 34px; }
  .dropzone { padding: 22px 14px; }
  .toasts { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .toast { min-width: 0; max-width: none; }
  .hbar .hbar-val { min-width: 0; }
  .chart-tip { min-width: 130px; }
  .attach { flex-wrap: wrap; }
}
@media (max-width: 380px) {
  .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .auth-feats { display: none; }
}
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .app { display: block; }
  .card { box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
