/* Hunter · design system. Troque a marca aqui (--brand*). */
:root {
  --brand: #0d9488; --brand-600: #0f766e; --brand-700: #115e59; --brand-50: #f0fdfa; --brand-100: #ccfbf1;
  --ink: #0f172a; --ink-2: #334155; --muted: #64748b; --faint: #94a3b8;
  --bg: #f6f7f9; --surface: #ffffff; --line: #e6e8ec; --line-2: #f0f2f5;
  --side: #0b1220; --side-2: #131c2e; --side-ink: #a9b4c7;
  --ok: #059669; --ok-bg: #ecfdf5; --bad: #dc2626; --bad-bg: #fef2f2; --warn: #b45309; --warn-bg: #fffbeb;
  --info: #2563eb; --info-bg: #eff6ff;
  --r: 12px; --r-sm: 8px;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 1px 3px rgba(15,23,42,.06);
  --shadow-lg: 0 10px 30px -10px rgba(15,23,42,.25);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-700); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
svg.lucide { width: 18px; height: 18px; stroke-width: 1.9; flex-shrink: 0; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.sidebar { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 20px 14px; z-index: 40; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; color: #fff; }
.brand-mark { width: 36px; height: 36px; border-radius: 9px; display: block; flex-shrink: 0; box-shadow: 0 4px 14px -4px rgba(20,184,166,.6); }
.brand-mark svg.lucide { color: #fff; width: 19px; height: 19px; }
.brand b { display: block; font-size: 16px; letter-spacing: -.02em; }
.brand span { display: block; font-size: 11.5px; color: var(--side-ink); margin-top: -2px; }
.nav-label { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .09em; color: #5b6b85; padding: 16px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: var(--r-sm); color: var(--side-ink); font-weight: 500; margin-bottom: 2px; transition: background .15s, color .15s; }
.nav a:hover { background: var(--side-2); color: #fff; }
.nav a.active { background: rgba(20,184,166,.14); color: #5eead4; }
.nav a.active svg.lucide { color: #2dd4bf; }
.side-foot { margin-top: auto; background: var(--side-2); border-radius: var(--r); padding: 14px; font-size: 12.5px; }
.side-foot b { color: #fff; display: block; font-size: 13px; margin-bottom: 2px; }
.side-foot .row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 64px; background: rgba(255,255,255,.85); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 0 28px; position: sticky; top: 0; z-index: 30; }
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13.5px; min-width: 0; }
.crumbs a { color: var(--muted); } .crumbs a:hover { color: var(--ink); }
.crumbs b { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs svg.lucide { width: 14px; height: 14px; color: var(--faint); }
.topbar .spacer { flex: 1; }
.btn.menu-btn { display: none; }
.scrim { display: none; }
.page { padding: 28px; max-width: 1360px; width: 100%; }

/* user menu */
.dropdown { position: relative; }
.dropdown > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 5px 8px 5px 5px; border-radius: 99px; border: 1px solid transparent; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown > summary:hover, .dropdown[open] > summary { background: var(--surface); border-color: var(--line); }
.dropdown .who { line-height: 1.2; text-align: left; }
.dropdown .who b { display: block; font-size: 13px; font-weight: 600; }
.dropdown .who span { font-size: 11.5px; color: var(--muted); }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 8px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); min-width: 230px; padding: 6px; z-index: 50; }
.dropdown-menu .head { padding: 10px 10px 12px; border-bottom: 1px solid var(--line-2); margin-bottom: 6px; }
.dropdown-menu a, .dropdown-menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); color: var(--ink-2); background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--bg); color: var(--ink); }
.dropdown-menu form { margin: 0; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12.5px; font-weight: 600; color: var(--brand-700); background: var(--brand-100); flex-shrink: 0; }
.avatar.sm { width: 30px; height: 30px; font-size: 11.5px; }
.avatar.sq { border-radius: 9px; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: 500 13.5px var(--font); cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s; box-shadow: var(--shadow); }
.btn:hover { background: #fafbfc; border-color: #d5d9e0; color: var(--ink); }
.btn svg.lucide { width: 16px; height: 16px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(13,148,136,.3), inset 0 1px 0 rgba(255,255,255,.15); }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: var(--bad-bg); border-color: #fecaca; color: var(--bad); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--line-2); border-color: transparent; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 12.5px; }
.btn-icon { width: 36px; padding: 0; }
.btn-block { width: 100%; height: 42px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 0; }
.card-head h3 { font-size: 15px; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.card-body { padding: 20px; }
.stack { display: grid; gap: 20px; }
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { padding: 18px 20px; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-weight: 500; font-size: 13px; }
.chip { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-600); }
.chip.red { background: var(--bad-bg); color: var(--bad); }
.chip.blue { background: var(--info-bg); color: var(--info); }
.chip.amber { background: var(--warn-bg); color: var(--warn); }
.kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 10px; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 15px; color: var(--muted); font-weight: 500; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 99px; margin-top: 8px; }
.delta svg.lucide { width: 13px; height: 13px; stroke-width: 2.4; }
.delta.good { color: var(--ok); background: var(--ok-bg); }
.delta.bad { color: var(--bad); background: var(--bad-bg); }
.delta.flat { color: var(--muted); background: var(--line-2); }
.delta + .vs { font-size: 12px; color: var(--faint); margin-left: 4px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 3px 9px; border-radius: 99px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: #047857; }
.badge.bad { background: var(--bad-bg); color: #b91c1c; }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.info { background: var(--info-bg); color: #1d4ed8; }
.badge.brand { background: var(--brand-50); color: var(--brand-700); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.live .dot { box-shadow: 0 0 0 0 currentColor; animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(5,150,105,.5); } 70% { box-shadow: 0 0 0 6px rgba(5,150,105,0); } 100% { box-shadow: 0 0 0 0 rgba(5,150,105,0); } }

/* Alerts & toasts */
.alert { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--r); border: 1px solid; margin-bottom: 20px; font-size: 13.5px; }
.alert.warn { background: var(--warn-bg); border-color: #fde68a; color: #92400e; }
.alert.info { background: var(--info-bg); border-color: #bfdbfe; color: #1e40af; }
.alert .grow { flex: 1; }
.alert a { font-weight: 600; color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; z-index: 100; }
.toast { display: flex; align-items: center; gap: 10px; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: var(--r); box-shadow: var(--shadow-lg); font-size: 13.5px; max-width: 420px; animation: slidein .25s ease-out; }
.toast svg.lucide { color: #5eead4; }
.toast.warning svg.lucide { color: #fbbf24; }
@keyframes slidein { from { transform: translateY(10px); opacity: 0; } }

/* Tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: #fafbfc; padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafbfc; }
.table .cell-main { display: flex; align-items: center; gap: 12px; }
.table .cell-main b { font-weight: 600; display: block; color: var(--ink); }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.inline-bar { height: 6px; border-radius: 99px; background: var(--line-2); min-width: 80px; }
.inline-bar span { display: block; height: 100%; border-radius: 99px; background: var(--brand); }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.pager { display: flex; gap: 6px; }

/* Forms */
.field { display: grid; gap: 6px; margin-bottom: 18px; align-content: start; }
.field > label, .label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field .help { font-size: 12px; color: var(--muted); }
.field .errorlist, .errorlist { list-style: none; margin: 0; padding: 0; color: var(--bad); font-size: 12.5px; }
.input, .field input[type=text], .field input[type=email], .field input[type=password], .field input[type=date], .field input[type=search], .field select, .field textarea, .filters input, .filters select {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid #d9dde3; border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: 14px var(--font); transition: border-color .15s, box-shadow .15s; }
.field textarea { height: auto; padding: 10px 12px; font-family: var(--mono); font-size: 13px; resize: vertical; }
.field select, .filters select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364748b' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 34px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand) !important; box-shadow: 0 0 0 3px rgba(13,148,136,.15); }
.field.has-error input, .field.has-error select { border-color: #fca5a5; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; color: var(--ink-2); }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--brand); margin: 0; }
.checklist > div { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.checklist > div label { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer; font-size: 13.5px; transition: border-color .15s, background .15s; }
.checklist > div label:hover { border-color: #cfd5dc; }
.checklist > div label:has(input:checked) { border-color: var(--brand); background: var(--brand-50); }
.form-card { max-width: 760px; }
.form-section { padding: 22px 24px; border-bottom: 1px solid var(--line-2); }
.form-section h4 { font-size: 14px; margin-bottom: 4px; }
.form-section > p { margin: 0 0 18px; color: var(--muted); font-size: 13px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; background: #fafbfc; border-radius: 0 0 var(--r) var(--r); }

/* Filters */
.filters { display: grid; grid-template-columns: 2fr 1.3fr 1fr 1fr 1fr; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.filters label { display: grid; gap: 5px; font-size: 12px; font-weight: 500; color: var(--muted); }
.filters input, .filters select { height: 38px; font-size: 13.5px; }
.search { position: relative; }
.search svg.lucide { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 16px; height: 16px; pointer-events: none; }
.search input { padding-left: 34px; }
.htmx-request.results, .htmx-request .results { opacity: .55; transition: opacity .2s; }

/* Unit cards */
.units { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.unit { display: block; color: inherit; padding: 18px 20px; transition: border-color .15s, box-shadow .15s, transform .15s; }
.unit:hover { color: inherit; border-color: #cbd5e1; box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.unit-head { display: flex; align-items: flex-start; gap: 12px; }
.unit-head .grow { flex: 1; min-width: 0; }
.unit-head h4 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unit-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.unit-stats span { display: block; font-size: 11.5px; color: var(--muted); }
.unit-stats b { font-size: 14px; font-variant-numeric: tabular-nums; }

/* Detail list */
.dl { display: grid; gap: 0; }
.dl > div { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
.dl > div:last-child { border-bottom: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; text-align: right; }
.token { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px 6px 6px 12px; }
.token code { flex: 1; font-family: var(--mono); font-size: 12px; word-break: break-all; color: var(--ink-2); }

/* Chart */
.chart-box { position: relative; height: 260px; }

/* Empty */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .chip { width: 48px; height: 48px; margin: 0 auto 14px; border-radius: 12px; }
.empty .chip svg.lucide { width: 22px; height: 22px; }
.empty h4 { color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.empty p { margin: 0 auto; max-width: 360px; }

/* Login */
.auth { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; background: var(--surface); }
.auth-hero { background: radial-gradient(1200px 600px at 0% 0%, #134e4a 0%, var(--side) 55%); color: #cbd5e1; padding: 48px 56px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.auth-hero::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(circle, rgba(45,212,191,.25), transparent 65%); }
.auth-hero .brand { padding: 0; }
.auth-hero h2 { color: #fff; font-size: 34px; line-height: 1.2; letter-spacing: -.025em; margin: auto 0 18px; max-width: 480px; }
.auth-hero h2 em { font-style: normal; color: #5eead4; }
.auth-hero > p { font-size: 15.5px; max-width: 440px; margin: 0 0 32px; color: #94a3b8; }
.perks { display: grid; gap: 14px; margin-bottom: auto; }
.perks div { display: flex; align-items: center; gap: 12px; font-size: 14px; color: #e2e8f0; }
.perks .chip { background: rgba(45,212,191,.12); color: #5eead4; }
.auth-hero small { color: #64748b; margin-top: 40px; position: relative; z-index: 1; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-form .box { width: min(380px, 100%); }
.auth-form h1 { font-size: 24px; margin-bottom: 6px; }
.auth-form .box > p { color: var(--muted); margin: 0 0 28px; }
.error-box { display: flex; gap: 10px; align-items: center; background: var(--bad-bg); color: #b91c1c; border: 1px solid #fecaca; padding: 10px 12px; border-radius: var(--r-sm); margin-bottom: 18px; font-size: 13.5px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .search { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 272px; transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 35; }
  .btn.menu-btn { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .dropdown .who { display: none; }
  .page { padding: 20px 16px; }
  .auth { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 20px; }
  .filters { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 20px; }
}

/* Consulta de CNPJ */
.cnpj-box:empty { display: none; }
.cnpj-msg { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 8px 0 0; }
.cnpj-msg.carregando { color: var(--muted); }
.cnpj-msg.carregando svg.lucide { animation: girar 1s linear infinite; }
.cnpj-msg.erro { color: var(--bad); }
@keyframes girar { to { transform: rotate(360deg); } }
.cnpj-card { margin-top: 8px; padding: 12px 14px; border: 1px solid var(--brand-100); background: var(--brand-50); border-radius: var(--r-sm); display: grid; gap: 3px; }
.cnpj-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.cnpj-top b { font-size: 13.5px; }
.cnpj-alerta { margin-top: 6px; font-size: 12.5px; font-weight: 600; color: var(--bad); }

/* Filtro de documentos */
.filtro-linha { display: flex; align-items: flex-end; gap: 16px; padding: 16px 20px 0; flex-wrap: wrap; }
.segmented { display: inline-flex; background: var(--line-2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented label { cursor: pointer; position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 7px 14px; border-radius: 8px; font-weight: 500; font-size: 13px; color: var(--muted); transition: background .15s, color .15s; }
.segmented label:hover span { color: var(--ink); }
.segmented input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.segmented input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 1px; }
.datas { display: none; gap: 10px; }
.filtro:has(input[name=periodo][value=custom]:checked) .datas { display: flex; }
.datas label { display: grid; gap: 4px; font-size: 12px; font-weight: 500; color: var(--muted); }
.datas input { height: 36px; padding: 0 10px; border: 1px solid #d9dde3; border-radius: var(--r-sm); font: 13.5px var(--font); }
.filtro .filters { grid-template-columns: 2fr 1.2fr 1fr 1fr; }
.resumo { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--line); background: #fafbfc; flex-wrap: wrap; }
.resumo-periodo { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; }
.resumo-periodo svg.lucide { width: 16px; height: 16px; color: var(--brand); }
.resumo-num { color: var(--muted); font-size: 13px; margin-top: 2px; }
.resumo-num b { color: var(--ink); }
.btn.baixando { opacity: .7; pointer-events: none; }
@media (max-width: 860px) { .filtro .filters { grid-template-columns: 1fr; } .segmented { width: 100%; } }

/* Rodapé do menu: usuário + sair */
.side-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.side-user .grow { min-width: 0; }
.side-user b, .side-user span span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .avatar { background: rgba(45,212,191,.15); color: #5eead4; }
.side-foot form { margin: 12px 0 0; }
.side-sair { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; height: 36px; border-radius: var(--r-sm); border: 1px solid rgba(255,255,255,.12); background: transparent; color: var(--side-ink); font: 500 13px var(--font); cursor: pointer; transition: background .15s, color .15s; }
.side-sair:hover { background: rgba(248,113,113,.12); border-color: rgba(248,113,113,.35); color: #fca5a5; }
.side-sair svg.lucide { width: 16px; height: 16px; }

/* Clientes e lojas */
.cliente-head { display: flex; align-items: center; gap: 14px; padding: 18px 20px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.cliente-head .grow { flex: 1; min-width: 200px; }
.cliente-head h3 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.cliente-head p { margin: 2px 0 0; }
.lojas { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; padding: 16px 20px; }
.loja { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); color: inherit; transition: border-color .15s, background .15s; }
.loja:hover { border-color: var(--brand); background: var(--brand-50); color: inherit; }
.loja .grow { flex: 1; min-width: 0; }
.loja b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loja > svg.lucide { color: var(--muted); }
.loja.nova { border-style: dashed; color: var(--brand-600); justify-content: center; font-weight: 500; }
.loja.nova svg.lucide { color: var(--brand-600); }

/* Passos do instalador */
.passos { margin: 14px 0 12px; padding-left: 20px; color: var(--ink-2); font-size: 13px; display: grid; gap: 4px; }

/* ---------- Celular ---------- */
.so-celular { display: none; }
@media (max-width: 640px) {
  .so-celular { display: inline; }
  .so-desktop { display: none !important; }
  /* iOS dá zoom ao focar campo com fonte < 16px */
  input, select, textarea, .filters input, .filters select, .datas input { font-size: 16px !important; }
  /* Atalhos de período: uma faixa que desliza para o lado */
  .filtro-linha { padding: 14px 16px 0; }
  .segmented { width: auto; max-width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .segmented::-webkit-scrollbar { display: none; }
  .segmented span { white-space: nowrap; padding: 7px 12px; }
  .datas { width: 100%; }
  .datas label { flex: 1; }
  /* Filtros compactos: busca e unidade inteiras, tipo e situação lado a lado */
  .filtro .filters { grid-template-columns: 1fr 1fr; padding: 14px 16px; gap: 10px; }
  .filtro .filters .search, .filtro .filters label:nth-child(2) { grid-column: 1 / -1; }
  .resumo { padding: 14px 16px; }
  .resumo .btn { width: 100%; }
  /* Cada documento vira um cartão */
  .doc-cards thead { display: none; }
  .doc-cards, .doc-cards tbody { display: block; }
  .doc-cards tbody tr { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 14px 16px; border-bottom: 1px solid var(--line-2);
    grid-template-areas: "tipo valor" "unidade emissao" "chave chave" "receb acao"; align-items: center; }
  .doc-cards td { padding: 0 !important; border: 0 !important; background: none !important; }
  .doc-cards .c-tipo { grid-area: tipo; } .doc-cards .c-valor { grid-area: valor; font-weight: 700; }
  .doc-cards .c-unidade { grid-area: unidade; font-weight: 500; } .doc-cards .c-emissao { grid-area: emissao; text-align: right; }
  .doc-cards .c-chave { grid-area: chave; word-break: break-all; font-size: 11px; color: var(--muted); }
  .doc-cards .c-receb { grid-area: receb; } .doc-cards .c-acao { grid-area: acao; }
  .table-foot { padding: 12px 16px; }
  /* Tabelas genéricas: linhas empilhadas com rótulo */
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr { display: block; }
  .table-stack tr { padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
  .table-stack td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 0 !important; border: 0 !important; text-align: right; background: none !important; }
  .table-stack td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; text-align: left; }
  .table-stack td:first-child { text-align: left; padding-bottom: 8px !important; }
  .table-stack td.right:last-child { justify-content: flex-end; padding-top: 8px !important; }
  /* Cabeçalhos e ações */
  .page-head { margin-bottom: 18px; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1; }
  .cliente-head .actions { width: 100%; }
  .cliente-head .actions .btn:not(.btn-icon) { flex: 1; }
  .lojas { grid-template-columns: 1fr; padding: 14px 16px; }
  .form-section { padding: 18px 16px; }
  .form-actions { padding: 14px 16px; }
  .form-actions .btn { flex: 1; }
  .kpi-top { font-size: 12.5px; }
  .delta + .vs { display: block; margin: 4px 0 0; }
  .toasts { left: 12px; right: 12px; bottom: 12px; }
  .toast { max-width: none; }
}
