/* =====================================================================
   Amazing Mairy — design system "Lavanda vibrante"
   Tokens primeiro; componentes depois. Claro e escuro.
   ===================================================================== */
:root {
  --bg: #F6F5FB; --surface: #FFFFFF; --surface-2: #FBFAFE; --ink: #17142B; --muted: #666380; --faint: #9A97B0; --line: #E8E6F2;
  --brand: #5B3DF5; --brand-strong: #4527E0; --brand-ink: #FFFFFF; --brand-soft: #EEEBFF; --brand-soft-ink: #4A2FE0;
  --hero: linear-gradient(135deg, #5B3DF5 0%, #8B5CF6 100%); --hero-ink: #FFFFFF; --hero-muted: rgba(255,255,255,.80); --hero-tile: rgba(255,255,255,.14);
  --accent: #FF7A59;
  --ok: #15803D; --ok-soft: #DCFCE7; --warn: #B45309; --warn-soft: #FEF3C7; --bad: #DC2626; --bad-soft: #FEE2E2;
  --info: #475569; --info-soft: #EEF2F7;
  --r-lg: 22px; --r-md: 16px; --r-sm: 12px; --pill: 999px; --tap: 52px;
  --shadow-sm: 0 1px 2px rgba(23,20,43,.05);
  --shadow: 0 1px 2px rgba(23,20,43,.04), 0 8px 24px rgba(23,20,43,.06);
  --shadow-brand: 0 8px 18px rgba(91,61,245,.28);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F0D1A; --surface: #1A1729; --surface-2: #1E1B30; --ink: #EEEDF7; --muted: #A3A0BD; --faint: #6F6B8A; --line: #2B2742;
    --brand: #6A55FF; --brand-strong: #7D6BFF; --brand-ink: #FFFFFF; --brand-soft: #262049; --brand-soft-ink: #B9AEFF;
    --hero: linear-gradient(135deg, #4B33D6 0%, #7246E8 100%);
    --ok: #4ADE80; --ok-soft: #12301F; --warn: #FBBF24; --warn-soft: #33270E; --bad: #F87171; --bad-soft: #3A1717;
    --info: #CBD5E1; --info-soft: #252336;
    --shadow-sm: none; --shadow: 0 1px 0 rgba(255,255,255,.02); --shadow-brand: 0 8px 18px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-appearance: none; appearance: none; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h2 { font-size: 22px; font-weight: 800; } h3 { font-size: 17px; font-weight: 700; }
p { margin: 6px 0; }
a { color: var(--brand); }
svg { flex: none; }
.muted { color: var(--muted); font-size: 14px; }
.center { text-align: center; }
.cap::first-letter { text-transform: uppercase; }
.num, .price, .big-number, .kpi b, .bal-big { font-variant-numeric: tabular-nums; }
.loading { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- Estrutura ---------- */
.app { display: flex; flex-direction: column; height: 100%; height: 100dvh; max-width: 720px; margin: 0 auto; }
.topbar { display: flex; align-items: center; gap: 8px; padding: calc(env(safe-area-inset-top) + 12px) 18px 8px; background: var(--bg); min-height: 64px; }
.topbar h1 { flex: 1; font-size: 28px; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar.sub h1 { font-size: 19px; font-weight: 700; }
.icon-btn { width: 42px; height: 42px; border: 0; background: var(--surface); border-radius: var(--r-sm); display: grid; place-items: center; margin-left: -4px; cursor: pointer; box-shadow: var(--shadow-sm); color: var(--ink); }
.icon-btn:active { background: var(--brand-soft); }
.content { flex: 1; overflow-y: auto; padding: 8px 18px 112px; -webkit-overflow-scrolling: touch; }
.tabbar { display: grid; grid-template-columns: repeat(6, 1fr); background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px 2px calc(env(safe-area-inset-bottom) + 4px); }
.tabbar button { border: 0; background: transparent; padding: 4px 0; min-height: 58px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--faint); cursor: pointer; }
.tabbar .bub { display: grid; place-items: center; width: 52px; height: 30px; border-radius: var(--pill); transition: background .15s; }
.tabbar button.on { color: var(--brand); }
.tabbar button.on .bub { background: var(--brand-soft); }

.sync-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: var(--pill); padding: 6px 11px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap; cursor: pointer; background: var(--surface); color: var(--muted); max-width: 52vw; overflow: hidden; text-overflow: ellipsis; }
.sync-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.sync-ok .dot { background: #22C55E; }
.sync-chip.sync-icon { width: 38px; height: 38px; padding: 0; justify-content: center; color: #16A34A; }
.sync-busy { color: var(--brand); } .sync-busy .dot { animation: pulse 1s infinite; }
.sync-warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.sync-off { color: var(--muted); } .sync-off .dot { background: var(--faint); }
.sync-bad { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- Blocos ---------- */
.stack { display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow); }
.card h3 { margin-bottom: 6px; }
.hero { background: var(--hero); color: var(--hero-ink); border: 0; border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow-brand); }
.hero .muted, .hero .hero-date { color: var(--hero-muted); font-size: 13px; font-weight: 600; }
.hero h2 { font-size: 23px; margin: 4px 0 14px; color: var(--hero-ink); }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kpi { background: var(--hero-tile); border-radius: 14px; padding: 10px 11px; min-width: 0; }
.kpi b { display: block; font-size: 20px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi span { font-size: 11.5px; color: var(--hero-muted); }
.soon { border-style: dashed; box-shadow: none; }
.notes { white-space: pre-wrap; background: var(--bg); border-radius: var(--r-sm); padding: 10px 12px; }
.warn { color: var(--warn); font-size: 14px; }
.big-number { font-size: 30px; font-weight: 800; margin: 6px 0; color: var(--ink); letter-spacing: -.02em; }
.section-title, .sec-head { display: flex; justify-content: space-between; align-items: baseline; margin: 14px 2px 0; font-size: 17px; font-weight: 800; color: var(--ink); text-transform: none; letter-spacing: -.01em; }
.sec-head span { font-size: 13px; font-weight: 600; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stats-2 { grid-template-columns: repeat(2, 1fr); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; text-align: left; box-shadow: var(--shadow-sm); }
.stat strong { display: block; font-size: 24px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-sm { font-size: 20px !important; }
.stat span { font-size: 12.5px; color: var(--muted); }
.kv { display: grid; gap: 10px; }
.kv-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.kv-row strong { text-align: right; }
ul.plain { margin: 0; padding-left: 18px; }
.badge { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: var(--pill); margin-left: 8px; vertical-align: middle; }
.badge-muted { background: var(--info-soft); color: var(--muted); }
.dot-pending { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-left: 8px; vertical-align: middle; }
.empty { text-align: center; color: var(--muted); padding: 26px 14px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r-lg); }
.empty .btn { margin-top: 10px; }

/* Ícone em quadrado suave e avatares */
.ico-tile { width: 40px; height: 40px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-soft-ink); flex: none; }
.ico-tile.ok { background: var(--ok-soft); color: var(--ok); } .ico-tile.warn { background: var(--warn-soft); color: var(--warn); }
.ico-tile.bad { background: var(--bad-soft); color: var(--bad); } .ico-tile.info { background: var(--info-soft); color: var(--info); }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 14px; color: #fff; flex: none; }
.avatars { display: flex; margin-top: 6px; }
.avatars i { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 10.5px; font-style: normal; font-weight: 800; color: #fff;
  border: 2px solid var(--surface); margin-right: -6px; }

/* ---------- Listas ---------- */
.list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow); }
.row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line);
  background: transparent; padding: 13px 14px; min-height: 60px; cursor: pointer; color: var(--ink); }
.row:last-child { border-bottom: 0; }
.row:active { background: var(--surface-2); }
.row-static { cursor: default; }
.row-main { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.row-main strong { font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; }
.row-main .muted { font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.row > svg { color: var(--faint); }

/* ---------- Busca, segmentos ---------- */
.toolbar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 4px; gap: 4px; align-self: flex-start; }
.seg-full { align-self: stretch; } .seg-full button { flex: 1; }
.seg button { border: 0; background: transparent; padding: 9px 18px; border-radius: var(--r-sm); font-weight: 700; color: var(--muted); min-height: 40px; cursor: pointer; font-size: 15px; }
.seg button.on { background: var(--brand); color: var(--brand-ink); box-shadow: var(--shadow-brand); }

/* ---------- Botões ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 0 18px;
  border-radius: 14px; border: 0; background: var(--brand-soft); color: var(--brand-soft-ink); font-weight: 700; font-size: 15.5px;
  text-decoration: none; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; transition: transform .08s, filter .15s; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; }
.btn-primary { background: var(--brand); color: var(--brand-ink); box-shadow: var(--shadow-brand); }
.btn-primary:active { background: var(--brand-strong); }
.btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-ghost-danger { background: transparent; color: var(--bad); border: 1.5px solid color-mix(in srgb, var(--bad) 30%, transparent); }
.btn-warn { background: var(--warn-soft); color: var(--warn); }
.btn-block { width: 100%; }
.btn-small { min-height: 38px; padding: 0 12px; font-size: 13.5px; border-radius: 11px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.btn-row .btn { flex: 1 1 140px; }
.link-big { display: inline-flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 700; text-decoration: none; min-height: 44px; }
.fab { position: fixed; right: max(18px, calc(50% - 342px)); bottom: calc(env(safe-area-inset-bottom) + 84px); z-index: 5;
  display: inline-flex; align-items: center; gap: 8px; height: 56px; padding: 0 20px 0 16px; border-radius: 18px; border: 0;
  background: var(--brand); color: var(--brand-ink); font-weight: 800; font-size: 15.5px; box-shadow: var(--shadow-brand), 0 2px 6px rgba(0,0,0,.12); cursor: pointer; }

/* ---------- Formulários ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label { font-weight: 700; font-size: 14.5px; }
.req { color: var(--accent); }
.hint { color: var(--muted); font-size: 13px; }
.form-error { color: var(--bad); font-weight: 700; min-height: 1px; margin: 0; }
input[type=search], .field input, .field select, .field textarea {
  width: 100%; min-height: var(--tap); padding: 12px 15px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); font-size: 16px; }
input[type=search] { background: var(--surface) no-repeat 14px 50% / 18px; }
.field textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
button:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px; }
.money-wrap { display: flex; align-items: center; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); padding-left: 15px; }
.money-wrap:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.money-wrap span { font-weight: 800; color: var(--muted); }
.money-wrap input { border: 0 !important; box-shadow: none !important; padding-left: 6px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices button { min-height: 44px; padding: 0 14px; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--surface);
  font-weight: 600; font-size: 15px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; color: var(--ink); max-width: 100%; text-align: left; }
.choices button.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-soft-ink); font-weight: 700; }
.choices button.on::before { content: ""; width: 16px; height: 16px; flex: none; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--tap); }
.toggle-row label { flex: 1; font-weight: 700; }
.toggle, .field input.toggle { -webkit-appearance: none; appearance: none; width: 52px; height: 32px; min-height: 32px; padding: 0; border: 0; border-radius: 16px; background: var(--line); position: relative; cursor: pointer; flex: none; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle:checked { background: var(--brand); } .toggle:checked::after { left: 23px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
.login-hero { background: var(--hero); color: #fff; padding: calc(env(safe-area-inset-top) + 56px) 24px 64px; text-align: center; border-radius: 0 0 32px 32px; }
.login-hero img { border-radius: 20px; box-shadow: 0 10px 24px rgba(0,0,0,.25); }
.login-hero h1 { font-size: 28px; font-weight: 800; margin-top: 14px; }
.login-hero p { color: rgba(255,255,255,.82); margin: 4px 0 0; }
.login { width: calc(100% - 32px); max-width: 420px; margin: -36px auto 24px; background: var(--surface); border-radius: var(--r-lg); padding: 22px 18px; box-shadow: var(--shadow); border: 1px solid var(--line); }

/* ---------- Diálogos e avisos ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15,13,26,.5); display: grid; place-items: end center; z-index: 20; padding: 12px; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 24px; padding: 22px 18px 18px; width: 100%; max-width: 480px; margin-bottom: env(safe-area-inset-bottom); animation: up .2s ease-out; }
.modal h3 { font-size: 19px; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; } .modal-actions .btn { flex: 1; }
.modal-stack { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.modal-stack .btn { height: auto; min-height: 54px; padding: 10px 16px; flex-direction: column; gap: 2px; white-space: normal; text-align: center; }
.btn-sub { display: block; font-weight: 500; font-size: 12.5px; opacity: .8; }
@keyframes fade { from { opacity: 0; } } @keyframes up { from { transform: translateY(24px); opacity: .6; } }
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 88px); transform: translate(-50%, 20px); opacity: 0;
  background: #17142B; color: #fff; padding: 12px 16px; border-radius: 14px; font-weight: 600; font-size: 14.5px; z-index: 30; transition: all .25s;
  max-width: calc(100vw - 32px); box-shadow: 0 10px 24px rgba(0,0,0,.25); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-warn { background: var(--warn); color: #fff; }
.conflict { border-color: var(--bad); }
table.diff { width: 100%; border-collapse: collapse; font-size: 14px; margin: 8px 0; }
table.diff th, table.diff td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: top; word-break: break-word; }
table.diff th { font-size: 12.5px; color: var(--muted); }
table.diff tr.changed td { background: var(--warn-soft); }
table.sum-table td:not(:first-child), table.sum-table th:not(:first-child) { white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.summary-line { display: flex; justify-content: space-between; padding: 9px 0; border-top: 1px solid var(--line); font-weight: 700; }

/* ---------- Agenda ---------- */
.datebar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.datebar .label { flex: 1; display: block; text-align: center; font-weight: 800; font-size: 16px; }
.datebar .label::first-letter { text-transform: uppercase; }
.round-btn { width: 44px; height: 44px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; flex: none; color: var(--ink); }
.today-btn { margin-bottom: 12px; }
.visit-list { display: flex; flex-direction: column; gap: 12px; }
.visit { display: flex; gap: 12px; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 14px; box-shadow: var(--shadow); cursor: pointer; align-items: flex-start; color: var(--ink); }
.visit:active { background: var(--surface-2); }
.visit .when { flex: none; width: 58px; padding: 9px 0; border-radius: 14px; background: var(--brand-soft); color: var(--brand-soft-ink); text-align: center; }
.visit .when strong { display: block; font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.visit .when span { font-size: 11.5px; color: var(--muted); }
.visit.is-done .when { background: var(--ok-soft); color: var(--ok); }
.visit.is-in_progress .when, .visit.is-traveling .when { background: var(--warn-soft); color: var(--warn); }
.visit.is-canceled .when { background: var(--info-soft); color: var(--muted); }
.visit .what { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.visit .chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 3px; }
.visit .what strong { font-size: 16.5px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visit .what .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.visit .addr { display: flex; align-items: center; gap: 4px; }
.visit .side { flex: none; text-align: right; }
.visit .price { font-weight: 800; font-size: 16px; }
.visit.is-canceled { opacity: .65; }
.visit.is-canceled .what strong { text-decoration: line-through; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: var(--pill); white-space: nowrap; }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-scheduled { background: var(--info-soft); color: var(--info); }
.st-next { background: var(--brand-soft); color: var(--brand-soft-ink); }
.st-traveling, .st-in_progress { background: var(--warn-soft); color: var(--warn); }
.st-done { background: var(--ok-soft); color: var(--ok); }
.st-canceled { background: var(--info-soft); color: var(--muted); }
.chip-repeat { background: transparent; border: 1px solid var(--line); color: var(--muted); font-weight: 600; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; margin: 16px 2px 8px; }
.day-head strong { font-size: 17px; font-weight: 800; }
.day-head.is-today strong::after { content: " · hoje"; color: var(--brand); }
.month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.month .wd { text-align: center; font-size: 12px; color: var(--muted); font-weight: 700; padding: 4px 0; }
.month button { aspect-ratio: 1 / 1.08; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm); display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start; padding: 7px 0 0; gap: 4px; cursor: pointer; font-weight: 700; min-height: 46px; color: var(--ink); }
.month button.out { opacity: .35; }
.month button.today { border: 2px solid var(--brand); }
.month button.sel { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.month .count { font-size: 10.5px; font-weight: 800; border-radius: var(--pill); padding: 1px 7px; background: var(--brand-soft); color: var(--brand-soft-ink); }
.month button.sel .count { background: rgba(255,255,255,.25); color: #fff; }
.conflict-box { background: var(--warn-soft); color: var(--warn); border-radius: var(--r-md); padding: 14px; font-size: 14.5px; font-weight: 600; }

/* ---------- Dia de trabalho ---------- */
.visit-wrap { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.visit-wrap .visit { border: 0; box-shadow: none; border-radius: 0; }
.visit-wrap .actions { padding: 0 14px 14px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.actions > :only-child { grid-column: 1 / -1; }
.actions .btn { min-height: 48px; font-size: 15px; padding: 0 12px; }
.ok-line { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); font-weight: 700; padding: 6px 2px; grid-column: 1 / -1; }
.person p { margin: 4px 0; }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick .btn { min-height: 52px; }
.qa { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.qa button { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 4px; display: flex; flex-direction: column;
  align-items: center; gap: 7px; font-size: 12px; font-weight: 700; color: var(--ink); cursor: pointer; box-shadow: var(--shadow-sm); min-height: 88px; }
.qa button:active { background: var(--surface-2); }
.qa .ico-tile { width: 40px; height: 40px; }
.photo-preview { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.photo-preview img { max-width: 100%; max-height: 280px; border-radius: var(--r-sm); border: 1px solid var(--line); }
.workday { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.workday .wd-text { flex: 1; min-width: 0; }
.workday .wd-text strong { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.workday .wd-text .muted { font-size: 13px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workday .btn { min-height: 40px; padding: 0 14px; font-size: 14px; }
.warn-card { background: var(--warn-soft); color: var(--warn); border-color: transparent; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 600; }

/* Financeiro */
.bal { background: var(--hero); color: var(--hero-ink); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow-brand); }
.bal .hero-date { color: var(--hero-muted); font-size: 13px; font-weight: 600; }
.bal-big { font-size: 34px; font-weight: 800; letter-spacing: -.02em; margin: 2px 0 12px; }
.flow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.flow div { background: var(--hero-tile); border-radius: 14px; padding: 10px 11px; font-size: 12px; color: var(--hero-muted); }
.flow b { display: block; color: var(--hero-ink); font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.bal-note { font-size: 12px; color: var(--hero-muted); margin: 10px 0 0; }

/* ---------- Etapa 6: leitura pela IA ---------- */
.ai-box { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: var(--r-md); background: var(--brand-soft); color: var(--brand-soft-ink); font-size: 14.5px; line-height: 1.4; }
.ai-box > svg { margin-top: 1px; }
.ai-box b { display: block; font-size: 15px; margin-bottom: 2px; }
.ai-box.ai-warn { background: var(--warn-soft); color: var(--warn); }
.ai-box.ai-bad { background: var(--bad-soft); color: var(--bad); }
.ai-box.ai-off { background: var(--info-soft); color: var(--info); }
.ai-box .spin { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.ai-tag { display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: var(--pill); font-size: 11px; font-weight: 800; letter-spacing: .02em; background: var(--brand-soft); color: var(--brand-soft-ink); vertical-align: middle; }
.field.ai-filled input, .field.ai-filled .choices button.on { box-shadow: 0 0 0 2px var(--brand-soft); }
.field.ai-low .ai-tag { background: var(--warn-soft); color: var(--warn); }
.field.ai-low input { box-shadow: 0 0 0 2px var(--warn); }
.scan-hero { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--r-lg); background: var(--hero); color: var(--hero-ink); box-shadow: var(--shadow-brand); border: 0; width: 100%; text-align: left; cursor: pointer; }
.scan-hero .ico-tile { background: var(--hero-tile); color: var(--hero-ink); }
.scan-hero b { display: block; font-size: 16.5px; }
.scan-hero span { color: var(--hero-muted); font-size: 13.5px; }
.doc-row { display: flex; gap: 12px; align-items: center; }
.doc-thumb { width: 52px; height: 52px; border-radius: var(--r-sm); object-fit: cover; background: var(--info-soft); flex: none; border: 1px solid var(--line); }
.chip-ai-done { background: var(--brand-soft); color: var(--brand-soft-ink); }
.chip-ai-waiting { background: var(--info-soft); color: var(--info); }
.chip-ai-illegible, .chip-ai-error { background: var(--warn-soft); color: var(--warn); }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.warn-card.ai-card { background: var(--brand-soft); color: var(--brand-soft-ink); }

/* ---------- Etapa 7: extrato do cartão ---------- */
.progress { height: 8px; border-radius: var(--pill); background: var(--hero-tile); overflow: hidden; margin: 10px 0 4px; }
.progress i { display: block; height: 100%; background: #fff; border-radius: inherit; transition: width .3s; }
.amt-in { color: var(--ok); }
.stmt-item .doc-row strong.num { white-space: nowrap; }
details.help summary { cursor: pointer; font-weight: 700; padding: 2px 0; }
details.help[open] summary { margin-bottom: 8px; }
.stmt-item .row-actions .chip { white-space: normal; flex-basis: 100%; line-height: 1.35; padding: 6px 10px; border-radius: var(--r-sm); font-size: 12.5px; }
