/* =====================================================================
   GESTRA — interface
   ===================================================================== */
:root {
  --brand: #4f46e5;
  --brand-600: #4338ca;
  --brand-soft: #eef0ff;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --line: #e7e8ec;
  --line-strong: #d6d8de;
  --ink: #111318;
  --ink-2: #4a4f5c;
  --muted: #7b808c;
  --pos: #0f7a4f;
  --neg: #b42318;
  --wa: #128c4a;

  --red: #dc2626;    --red-bg: #fef2f2;
  --orange: #ea580c; --orange-bg: #fff4ec;
  --yellow: #ca8a04; --yellow-bg: #fefbe8;
  --green: #16a34a;  --green-bg: #effbf3;
  --blue: #2563eb;   --blue-bg: #eff5ff;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 18, 24, .04), 0 1px 1px rgba(16, 18, 24, .03);
  --shadow-lg: 0 10px 30px -10px rgba(16, 18, 24, .18);
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --tabbar-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #7c7cff;
    --brand-600: #9b9bff;
    --brand-soft: #1f2040;
    --bg: #0f1115;
    --surface: #16181d;
    --surface-2: #1b1e24;
    --line: #262a31;
    --line-strong: #333842;
    --ink: #eceef2;
    --ink-2: #b7bcc7;
    --muted: #8a909c;
    --pos: #4ade80;
    --neg: #f87171;
    --wa: #25d366;
    --red: #f87171;    --red-bg: #2a1616;
    --orange: #fb923c; --orange-bg: #2b1c12;
    --yellow: #facc15; --yellow-bg: #29240f;
    --green: #4ade80;  --green-bg: #12261a;
    --blue: #60a5fa;   --blue-bg: #13203a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; font-feature-settings: 'cv11', 'ss01';
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; }
h1 { font-size: 26px; font-weight: 700; line-height: 1.2; }
h2 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
.ic { flex: none; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 13.5px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 700; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.grow { flex: 1; min-width: 0; }
.pre { white-space: pre-wrap; color: var(--ink-2); }
.mt { margin-top: 14px; }
.mr-auto { margin-right: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; flex: none; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex: none; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 6px; padding: 20px 14px;
  background: var(--surface); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand strong { display: block; font-size: 16px; letter-spacing: .06em; }
.brand small { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.2; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--ink-2); font-weight: 500;
}
.side-nav a:hover { background: var(--surface-2); color: var(--ink); }
.side-nav a.active { background: var(--brand-soft); color: var(--brand); }
.side-cta { margin-top: 14px; }
.side-user {
  margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 0;
  border-top: 1px solid var(--line);
}
.side-user strong { display: block; font-size: 13.5px; }
.side-user small { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 12px 32px; background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid transparent;
}
.brand-mobile { display: none; padding: 0; }
.content { width: 100%; max-width: 1180px; margin: 0 auto; padding: 8px 32px 48px; display: flex; flex-direction: column; gap: 18px; }

/* ---------- Busca ---------- */
.search {
  flex: 1; max-width: 520px; display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 12px;
  color: var(--muted); transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.search input { flex: 1; border: 0; outline: 0; background: transparent; padding: 11px 0; font: inherit; color: var(--ink); min-width: 0; }
.search-page { max-width: none; }

/* ---------- Tipografia de página ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 8px; }
.eyebrow { color: var(--muted); font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13.5px; font-weight: 500; margin-bottom: 6px; }
.back:hover { color: var(--ink); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2, .card-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
.card-title { margin-bottom: 14px; }
.card-head .card-title { margin: 0; }
.card-head h2 .ic, .card-title .ic { color: var(--muted); }
.count { font-size: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; padding: 0 8px; color: var(--ink-2); }
.link { color: var(--brand); font-size: 13.5px; font-weight: 500; }
.list-card { padding: 6px; }
.split > * { min-width: 0; }
.split { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.split-wide { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-lg { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 16px; border-radius: 11px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; font-size: 14px;
  cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn-soft { background: var(--brand-soft); border-color: transparent; color: var(--brand); }
.btn-soft:hover { background: var(--brand-soft); filter: brightness(.97); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn-wa:hover { background: var(--wa); filter: brightness(.95); }
.btn-block { width: 100%; }
.btn-lg { height: 48px; font-size: 15px; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.danger-text { color: var(--red); }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  border: 0; background: transparent; color: var(--ink-2); cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.xs { width: 26px; height: 26px; border-radius: 7px; vertical-align: middle; }
.icon-btn.danger:hover { color: var(--red); }
.icon-btn.is-disabled { opacity: .3; pointer-events: none; }

/* ---------- Chips / badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px;
  font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--ink-2);
  border: 1px solid var(--line);
}
.chip-red { background: var(--red-bg); color: var(--red); border-color: transparent; }
.chip-orange { background: var(--orange-bg); color: var(--orange); border-color: transparent; }
.chip-yellow { background: var(--yellow-bg); color: var(--yellow); border-color: transparent; }
.chip-green { background: var(--green-bg); color: var(--green); border-color: transparent; }
.chip-blue { background: var(--blue-bg); color: var(--blue); border-color: transparent; }
.chip-ok { color: var(--ink-2); }
.chip-ok .dot { color: var(--green); }
.chip-none .dot { color: var(--muted); }
.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 8px;
  border-radius: 6px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); vertical-align: middle;
}
.badge-ok { background: var(--green-bg); color: var(--green); border-color: transparent; }
.badge-gift { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.tone-red { --tone: var(--red); --tone-bg: var(--red-bg); }
.tone-orange { --tone: var(--orange); --tone-bg: var(--orange-bg); }
.tone-yellow { --tone: var(--yellow); --tone-bg: var(--yellow-bg); }
.tone-green { --tone: var(--green); --tone-bg: var(--green-bg); }
.tone-blue { --tone: var(--blue); --tone-bg: var(--blue-bg); }

/* ---------- Flash ---------- */
.flash {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px;
  font-size: 14px; font-weight: 500; border: 1px solid;
}
.flash > span { flex: 1; }
.flash a { text-decoration: underline; }
.flash-ok { background: var(--green-bg); color: var(--pos); border-color: color-mix(in srgb, var(--green) 25%, transparent); }
.flash-error { background: var(--red-bg); color: var(--neg); border-color: color-mix(in srgb, var(--red) 25%, transparent); }
.flash-x { background: none; border: 0; color: inherit; cursor: pointer; opacity: .6; padding: 0; }

/* ---------- Dashboard ---------- */
.month-switch { display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.month-switch span:not(.icon-btn) { font-size: 13.5px; font-weight: 600; padding: 0 8px; min-width: 140px; text-align: center; }
.quick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.qa {
  display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); font-weight: 600; font-size: 14px; box-shadow: var(--shadow);
  transition: border-color .15s, transform .1s;
}
.qa .ic { color: var(--brand); }
.qa:hover { border-color: var(--line-strong); }
.qa-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.qa-primary .ic { color: #fff; }
.qa-primary:hover { background: var(--brand-600); }

.attention .card-head h2 .ic { color: var(--orange); }
.attn-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.attn {
  display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 12px;
  background: var(--tone-bg); border: 1px solid transparent; transition: border-color .15s;
}
.attn:hover { border-color: color-mix(in srgb, var(--tone) 35%, transparent); }
.attn-top { display: flex; align-items: center; gap: 7px; color: var(--tone); font-weight: 600; font-size: 13.5px; }
.attn-top .ic { margin-left: auto; opacity: .6; }
.attn-n { font-size: 30px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.attn-names { display: flex; flex-direction: column; font-size: 13px; color: var(--ink-2); gap: 1px; }
.attn-names span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attn-names em { font-style: normal; color: var(--muted); font-variant-numeric: tabular-nums; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kpis-2 { grid-template-columns: repeat(2, 1fr); }
.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi-label { color: var(--muted); font-size: 13px; font-weight: 500; }
.kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -.03em; line-height: 1.2; }
.kpi-sub { color: var(--muted); font-size: 12.5px; }
.progress { height: 6px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; overflow: hidden; margin: 4px 0 2px; }
.progress span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }

.due-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.due-tile {
  display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface-2); transition: border-color .15s, background .15s;
}
.due-tile span { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.due-tile .dot { color: var(--tone); }
.due-tile strong { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.due-tile:hover { background: var(--tone-bg); border-color: transparent; }

.chart { position: relative; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .axis { stroke: var(--line-strong); stroke-width: 1; }
.chart .bar path { fill: color-mix(in srgb, var(--brand) 35%, var(--surface)); transition: fill .15s; }
.chart .bar.is-sel path { fill: var(--brand); }
.chart .bar:hover path { fill: var(--brand-600); }
.chart .hit { fill: transparent; }
.chart .lbl { fill: var(--muted); font-size: 13px; font-family: var(--font); }
.chart .val { fill: var(--ink); font-size: 13px; font-weight: 600; font-family: var(--font); }
.chart-tip {
  position: absolute; pointer-events: none; transform: translate(-50%, -100%); background: var(--ink); color: var(--bg);
  font-size: 12.5px; font-weight: 600; padding: 5px 9px; border-radius: 8px; white-space: nowrap;
}

/* ---------- Listas ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li + li { border-top: 1px solid var(--line); }
.list li > a { display: flex; align-items: center; gap: 12px; padding: 11px 10px; border-radius: 10px; }
.list-card .list li > a:hover { background: var(--surface-2); }
.list strong { display: block; font-size: 14px; font-weight: 600; }
.list small { display: block; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; color: var(--muted); padding: 28px 16px; }
.empty.big { padding: 80px 16px; }
.date-badge {
  display: flex; flex-direction: column; align-items: center; justify-content: center; width: 44px; height: 44px; flex: none;
  border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: 11px; color: var(--muted); line-height: 1.1;
}
.date-badge b { font-size: 16px; color: var(--ink); }

.avatar {
  width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 14px; letter-spacing: .02em;
}
.avatar.sm { width: 32px; height: 32px; font-size: 12px; border-radius: 10px; }
.avatar.lg { width: 56px; height: 56px; font-size: 19px; border-radius: 16px; }
.avatar.sq { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }

.client-row { display: flex; align-items: center; gap: 12px; padding: 12px 10px; border-radius: 10px; }
.client-row + .client-row { border-top: 1px solid var(--line); border-top-left-radius: 0; border-top-right-radius: 0; }
.client-row:hover { background: var(--surface-2); }
.client-row.is-inactive { opacity: .6; }
.cr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cr-main strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-main small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.cr-side strong { font-size: 14px; }
.matches { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.match { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 1px 7px; border-radius: 6px; background: var(--brand-soft); color: var(--brand); }

.chips-scroll { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -2px; padding: 2px; }
.chips-scroll::-webkit-scrollbar { display: none; }
.fchip {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 99px; flex: none;
  border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 500; color: var(--ink-2);
}
.fchip .dot { color: var(--tone); }
.fchip b { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.fchip.active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.fchip.active b { color: var(--bg); }
.list-tools { display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg a { padding: 5px 11px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--muted); }
.seg a.active { background: var(--surface-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }

/* ---------- Formulários ---------- */
.form-layout { display: flex; flex-direction: column; gap: 18px; }
.form-layout.narrow { max-width: 720px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.span-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px; outline: none;
  transition: border-color .15s, box-shadow .15s; min-height: 44px;
}
.search > input[type=search]:not([type=checkbox]) { border: 0; min-height: 0; padding: 11px 0; box-shadow: none; border-radius: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
textarea { resize: vertical; line-height: 1.5; }
input[type=date] { min-height: 44px; }
.err { color: var(--neg); font-size: 12.5px; font-weight: 500; }
.hint { color: var(--muted); font-size: 12.5px; display: flex; gap: 6px; align-items: flex-start; }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; font-weight: 500; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); flex: none; margin: 0; }
.check span { display: inline-flex; align-items: center; gap: 6px; }
.check.big { font-size: 15px; font-weight: 600; }
.check.big input { width: 20px; height: 20px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 46px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.form-actions.flat { padding: 0; }
.total-pill { font-size: 13px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; padding: 4px 12px; }
.total-pill b { color: var(--ink); font-size: 14px; }

.acc-rows { display: flex; flex-direction: column; gap: 12px; margin: 14px 0; }
.acc-rows .acc-row { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--surface-2); }
.acc-row-head { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.acc-num { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-right: auto; }
.acc-final { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; margin-right: 6px; }
.acc-final.is-courtesy, [data-final].is-courtesy { color: var(--brand); }
.acc-row-foot { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.acc-row-foot .reason { flex: 1; min-width: 200px; }
.acc-rows .acc-row input { background: var(--surface); }

/* ---------- Cliente ---------- */
.client-hero { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.ch-id { display: flex; align-items: center; gap: 14px; min-width: 0; }
.ch-id h1 { font-size: 24px; }
.ch-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; font-size: 13.5px; }
.ch-meta .muted { display: inline-flex; align-items: center; gap: 5px; }
.ch-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.fin { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.fin div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.fin dt { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.fin dd { margin: 2px 0 0; font-weight: 700; font-size: 16px; }
.fin .fin-total { background: var(--brand-soft); border-color: transparent; }
.fin .fin-total dt { color: var(--brand); }
.fin .fin-total dd { font-size: 20px; }
.acc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.acc { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface-2); min-width: 0; }
.acc header { display: flex; align-items: center; gap: 8px; margin: -4px -6px 6px 0; }
.acc header strong { display: inline-flex; align-items: center; gap: 6px; font-size: 14.5px; }
.acc header strong .ic { color: var(--muted); }
.acc-dl { margin: 0; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px 12px; }
.acc-dl dt { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.acc-dl dd { margin: 0; font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-dl dd.mono { overflow: visible; white-space: nowrap; }
.acc-note { margin-top: 8px; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; position: relative; }
.timeline li + li { border-top: 1px dashed var(--line); }
.tl-ic { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.tl-pay .tl-ic { background: var(--green-bg); color: var(--green); }
.tl-renew .tl-ic { background: var(--brand-soft); color: var(--brand); }
.timeline strong { display: block; font-size: 13.5px; font-weight: 600; }
.timeline small { display: block; font-size: 12.5px; color: var(--muted); }
.danger-zone .btn { margin-top: 10px; }
.del { margin-top: 12px; }
.del summary { cursor: pointer; color: var(--red); font-size: 13.5px; font-weight: 500; }
.del form { margin-top: 10px; }
.summary-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 4px 0; }
.summary-line > span:first-child { color: var(--muted); font-size: 13.5px; min-width: 170px; }
.new-due { background: var(--brand-soft); color: var(--brand); border-radius: 10px; padding: 10px 14px; font-size: 14px; }
.wa-text { font-size: 15px; }

/* ---------- Autenticação ---------- */
.auth-body { display: grid; place-items: center; min-height: 100vh; padding: 20px; background: radial-gradient(1200px 500px at 50% -10%, var(--brand-soft), var(--bg)); }
.auth { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 22px; }
.auth-brand { display: flex; align-items: center; gap: 12px; justify-content: center; }
.auth-brand .logo { width: 44px; height: 44px; }
.auth-brand strong { display: block; font-size: 20px; letter-spacing: .08em; }
.auth-brand small { display: block; color: var(--muted); font-size: 13px; }
.auth-card { padding: 26px; box-shadow: var(--shadow-lg); }
.auth-card h1 { font-size: 22px; }
.auth-card .muted { margin: 4px 0 18px; font-size: 14px; }
.auth-card .flash { margin-bottom: 14px; }
.auth-foot { text-align: center; font-size: 12.5px; color: var(--muted); }

/* ---------- Barra inferior (mobile) ---------- */
.tabbar { display: none; }
.mobile-only { display: none; }

@media (max-width: 1100px) {
  .quick { grid-template-columns: repeat(3, 1fr); }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .sidebar { display: none; }
  .brand-mobile { display: flex; }
  .brand-mobile strong { font-size: 15px; letter-spacing: .08em; }
  .brand-mobile .logo { width: 28px; height: 28px; }
  .mobile-only { display: block; }
  .desktop-only { display: none; }
  .topbar { padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); }
  .topbar .search { display: none; }
  .content { padding: 4px 16px calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom)); gap: 14px; }
  .split, .split-wide { grid-template-columns: minmax(0, 1fr); }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; align-items: center;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 0 6px env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
    border-top: 1px solid var(--line);
  }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 500; color: var(--muted); padding: 6px 0; }
  .tabbar a.active { color: var(--brand); }
  .tabbar .tab-fab {
    flex: none; width: 52px; height: 52px; border-radius: 16px; background: var(--brand); color: #fff; display: grid; place-items: center;
    margin: 0 6px; box-shadow: 0 8px 20px -6px color-mix(in srgb, var(--brand) 70%, transparent); padding: 0;
  }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  h1 { font-size: 23px; }
  .card { padding: 16px; border-radius: 16px; }
  .list-card { padding: 4px; }
  .quick { display: flex; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; gap: 8px; }
  .quick::-webkit-scrollbar { display: none; }
  .qa { flex: none; padding: 11px 14px; font-size: 13.5px; }
  .attn-grid { grid-template-columns: 1fr; gap: 8px; }
  .attn { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 2px 10px; padding: 12px 14px; }
  .attn-top { flex: 1; order: 1; }
  .attn-top .ic { margin-left: 4px; }
  .attn-n { font-size: 22px; order: 2; }
  .attn-names { flex-basis: 100%; order: 3; }
  .kpis { gap: 10px; }
  .kpi-value { font-size: 21px; }
  .kpi .kpi-sub { font-size: 12px; }
  .due-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .due-grid .due-tile:first-child { grid-column: span 2; flex-direction: row; align-items: center; justify-content: space-between; }
  .due-tile { padding: 10px 12px; }
  .due-tile strong { font-size: 20px; }
  .month-switch { width: 100%; justify-content: space-between; }
  .page-head { align-items: stretch; }
  .grid-2 { grid-template-columns: 1fr; gap: 12px; }
  .span-2 { grid-column: auto; }
  .acc-rows .acc-row .grid-2 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .acc-rows .acc-row .grid-2 .field:first-child, .acc-rows .acc-row .grid-2 .field:nth-child(2) { grid-column: span 2; }
  .form-actions { position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 8px); background: var(--surface); padding: 10px; border-radius: 14px; border: 1px solid var(--line); box-shadow: var(--shadow-lg); z-index: 5; }
  .form-actions.flat { position: static; box-shadow: none; border: 0; padding: 0; background: none; }
  .form-actions .btn { flex: 1; }
  .form-actions .mr-auto { flex-basis: 100%; margin: 0; }
  .client-hero { flex-direction: column; align-items: stretch; }
  .ch-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .ch-actions .btn { padding: 0 10px; }
  .ch-actions .btn-primary { grid-column: span 2; }
  .acc-dl { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 10px; }
  .acc { padding: 10px 12px; }
  .acc-list { grid-template-columns: 1fr; }
  .fin { grid-template-columns: 1fr 1fr; }
  .fin .fin-total { grid-column: span 2; }
  .summary-line > span:first-child { min-width: 0; width: 100%; font-size: 12.5px; }
  .client-row { padding: 12px 8px; gap: 10px; }
  .cr-side strong { font-size: 13.5px; }
  .list-tools { flex-direction: column; }
  .seg { width: 100%; }
  .seg a { flex: 1; text-align: center; }
}
