:root {
  /* Layout: barra lateral no computador, barra inferior no celular; cartões de caderneta com números tabulares. */
  --bg: #f3f5f4; --surface: #ffffff; --surface-2: #eaeeed; --line: #d7dedc;
  --ink: #14211f; --ink-2: #4c5c59; --ink-3: #74837f;
  --accent: #0d5f63; --accent-ink: #ffffff; --accent-soft: #dcecea;
  --good: #19794a; --good-soft: #dcf0e4; --warn: #9a6a08; --warn-soft: #f6ead0; --crit: #b3362b; --crit-soft: #f8e0dc;
  --s1: #0a8f80; --s2: #c96f0c;
  --font-d: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-b: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --r: 12px; --shadow: 0 1px 2px rgba(20, 33, 31, .06), 0 4px 14px rgba(20, 33, 31, .05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #101615; --surface: #18201f; --surface-2: #212b29; --line: #2e3a38;
    --ink: #e8efed; --ink-2: #a9b8b4; --ink-3: #81908c;
    --accent: #58c2bd; --accent-ink: #06201f; --accent-soft: #1c3836;
    --good: #5fcf94; --good-soft: #17352a; --warn: #e2b04a; --warn-soft: #3a2f14; --crit: #f08a7e; --crit-soft: #3f1f1b;
    --s1: #10988a; --s2: #c47d1e; --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101615; --surface: #18201f; --surface-2: #212b29; --line: #2e3a38;
  --ink: #e8efed; --ink-2: #a9b8b4; --ink-3: #81908c;
  --accent: #58c2bd; --accent-ink: #06201f; --accent-soft: #1c3836;
  --good: #5fcf94; --good-soft: #17352a; --warn: #e2b04a; --warn-soft: #3a2f14; --crit: #f08a7e; --crit-soft: #3f1f1b;
  --s1: #10988a; --s2: #c47d1e; --shadow: none;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
#app { height: 100%; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font-b); -webkit-text-size-adjust: 100%; }
h1, h2, h3 { font-family: var(--font-d); margin: 0; text-wrap: balance; letter-spacing: -.01em; }
h1 { font-size: 24px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
p { margin: 0; }
a { color: var(--accent); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--ink-2); } .small { font-size: 13px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Estrutura */
.shell { display: flex; height: 100%; }
.side { width: 232px; flex: none; background: var(--surface); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; font-family: var(--font-d); font-weight: 700; font-size: 17px; }
.brand i { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-style: normal; font-size: 15px; }
.nav { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: var(--ink-2); text-decoration: none; font-weight: 500; border: 0; background: none; font: inherit; cursor: pointer; text-align: left; width: 100%; }
.nav:hover { background: var(--surface-2); color: var(--ink); }
.nav.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav svg { width: 19px; height: 19px; flex: none; }
.nav .cnt { margin-left: auto; background: var(--crit); color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 7px; font-weight: 600; }
.main { flex: 1; min-width: 0; overflow-y: auto; padding: 22px 26px 40px; }
.wrap { max-width: 1080px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.head .grow { flex: 1; min-width: 160px; }
.tabbar { display: none; }
@media (max-width: 899px) {
  .shell { flex-direction: column; }
  .side { display: none; }
  .main { padding: 16px 16px 24px; }
  .tabbar { display: flex; flex: none; background: var(--surface); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px)); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; font-size: 11px; color: var(--ink-2); text-decoration: none; border-radius: 9px; font-weight: 500; position: relative; }
  .tabbar a.on { color: var(--accent); font-weight: 600; }
  .tabbar svg { width: 22px; height: 22px; }
  .tabbar .cnt { position: absolute; top: 2px; left: 55%; background: var(--crit); color: #fff; border-radius: 99px; font-size: 10px; padding: 0 5px; }
  h1 { font-size: 21px; }
}

/* Componentes */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; }
.card > h2 { margin-bottom: 12px; }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); }
.tile .k { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.tile .v { font-family: var(--font-d); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile .s { font-size: 12.5px; color: var(--ink-3); }
.tile.alert { border-left: 4px solid var(--crit); } .tile.today { border-left: 4px solid var(--warn); } .tile.soon { border-left: 4px solid var(--accent); }
button.tile { font: inherit; color: inherit; text-align: left; cursor: pointer; }
button.tile:hover { border-color: var(--accent); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 14px var(--font-b); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.pri { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.wa { background: #12804a; border-color: #12804a; color: #fff; }
.btn.danger { color: var(--crit); }
.btn.sm { min-height: 32px; padding: 4px 10px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.good { background: var(--good-soft); color: var(--good); } .pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.crit { background: var(--crit-soft); color: var(--crit); } .pill.info { background: var(--accent-soft); color: var(--accent); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 99px; padding: 6px 12px; font: 500 13px var(--font-b); cursor: pointer; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.item:first-child { border-top: 0; }
.item .grow { flex: 1; min-width: 150px; }
.item .t { font-weight: 600; } .item .d { font-size: 13px; color: var(--ink-2); }
button.item { background: none; border: 0; border-top: 1px solid var(--line); font: inherit; color: inherit; text-align: left; cursor: pointer; width: 100%; }
button.item:hover { background: var(--surface-2); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; flex: none; }
.empty { padding: 28px 16px; text-align: center; color: var(--ink-2); }
.banner { background: var(--warn-soft); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.banner .grow { flex: 1; min-width: 180px; }
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; font-size: 12px; color: var(--ink-2); font-weight: 600; padding: 9px 12px; background: var(--surface-2); white-space: nowrap; }
td { padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
td.r, th.r { text-align: right; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 16px; }
.kv div span { display: block; font-size: 12px; color: var(--ink-2); }
.kv div b { font-weight: 600; overflow-wrap: anywhere; }

/* Formulários */
form { display: flex; flex-direction: column; gap: 12px; }
.fg { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
label.f.wide { grid-column: 1 / -1; }
input, select, textarea { font: 15px var(--font-b); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; min-height: 42px; width: 100%; }
textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; padding: 0; accent-color: var(--accent); }
label.ck { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); }
.search { max-width: 340px; }

/* Modal */
.ov { position: fixed; inset: 0; background: rgba(8, 14, 13, .55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal { background: var(--surface); border-radius: 16px; width: 100%; max-width: 560px; max-height: 100%; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; border: 1px solid var(--line); }
.modal.wide { max-width: 760px; }
.modal .mh { display: flex; align-items: center; gap: 10px; }
.modal .mh h2 { flex: 1; }
.x { border: 0; background: var(--surface-2); color: var(--ink); width: 34px; height: 34px; border-radius: 50%; font-size: 18px; cursor: pointer; line-height: 1; }
@media (max-width: 599px) { .ov { align-items: flex-end; padding: 0; } .modal { border-radius: 16px 16px 0 0; max-height: 94%; } }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 500; z-index: 60; max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0, 0, 0, .25); }

/* Específicos */
.sig { border: 2px dashed var(--line); border-radius: 12px; background: #fff; touch-action: none; width: 100%; height: 190px; display: block; cursor: crosshair; }
.doc { background: var(--surface-2); border-radius: 10px; padding: 14px; white-space: pre-wrap; font-size: 13.5px; line-height: 1.55; max-height: 46vh; overflow-y: auto; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumb { width: 84px; display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--ink-2); border: 0; background: none; padding: 0; cursor: pointer; text-align: left; }
.thumb img { width: 84px; height: 84px; object-fit: cover; border-radius: 9px; border: 1px solid var(--line); }
img { max-width: 100%; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dw { font-size: 11px; color: var(--ink-3); text-align: center; padding: 2px 0; font-weight: 600; }
.cal button { border: 1px solid var(--line); background: var(--surface); border-radius: 9px; min-height: 58px; padding: 4px 5px; font: inherit; color: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 1px; text-align: left; min-width: 0; }
.cal button.out { opacity: .35; } .cal button.hoje { border-color: var(--accent); border-width: 2px; } .cal button.sel { background: var(--accent-soft); }
.cal .dn { font-size: 12px; font-weight: 600; }
.cal .dv { font-size: 10.5px; font-variant-numeric: tabular-nums; color: var(--ink-2); overflow: hidden; text-overflow: clip; white-space: nowrap; }
.cal .late .dv { color: var(--crit); font-weight: 600; }
.chart { position: relative; max-width: 780px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart text { fill: var(--ink-2); font: 12px var(--font-b); }
@media (max-width: 599px) { .chart text { font-size: 19px; } }
.chart .gl { stroke: var(--line); stroke-width: 1; }
.chart .bar { cursor: pointer; } .chart .bar:hover { opacity: .8; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--ink-2); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.tip { position: absolute; background: var(--ink); color: var(--bg); padding: 5px 9px; border-radius: 7px; font-size: 12px; pointer-events: none; white-space: nowrap; transform: translate(-50%, -110%); z-index: 5; }
.meter { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--crit); border-radius: 99px; }
.menu { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.menu a { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 14px; text-decoration: none; color: var(--ink); font-weight: 600; display: flex; flex-direction: column; gap: 8px; }
.menu a svg { width: 24px; height: 24px; color: var(--accent); }
.auth { min-height: 100%; display: grid; place-items: center; padding: 20px; }
.auth .card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; }
.total { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--line); }
.total:first-child { border-top: 0; }
.total.big b { font-family: var(--font-d); font-size: 20px; }
details summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 13px; }
@media (prefers-reduced-motion: no-preference) { .modal { animation: up .16s ease-out; } @keyframes up { from { transform: translateY(10px); opacity: .6; } } }

/* Cara de banco digital: cartão de saldo, atalhos redondos e extrato */
.hero { background: linear-gradient(140deg, #0b4a4e 0%, #0d6b68 55%, #15877a 100%); color: #fff; border-radius: 20px; padding: 20px; display: flex; flex-direction: column; gap: 4px; box-shadow: 0 10px 28px rgba(11, 74, 78, .28); }
.hero-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.hero-top .who { flex: 1; font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 10px; min-width: 0; }
.hero-top .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-top .who i { width: 36px; height: 36px; border-radius: 50%; background: rgba(255, 255, 255, .18); display: grid; place-items: center; font-style: normal; font-weight: 700; flex: none; }
.eye { border: 0; background: rgba(255, 255, 255, .16); color: #fff; width: 38px; height: 38px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; }
.eye svg { width: 19px; height: 19px; }
.hero-k { font-size: 13px; opacity: .85; }
.hero-v { font-family: var(--font-d); font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; overflow-wrap: anywhere; }
.hero-s { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; font-size: 13px; }
.hero-s div span { display: block; opacity: .8; font-size: 12px; }
.hero-s div b { font-variant-numeric: tabular-nums; font-size: 15px; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.quick a, .quick button { display: flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none; color: var(--ink); font: 600 12.5px var(--font-b); border: 0; background: none; cursor: pointer; padding: 4px 0; }
.quick i { width: 54px; height: 54px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; color: var(--accent); box-shadow: var(--shadow); }
.quick svg { width: 23px; height: 23px; }
.quick a:hover i, .quick button:hover i { border-color: var(--accent); }
.mov { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 700; }
.mov.in { background: var(--good-soft); color: var(--good); } .mov.out { background: var(--crit-soft); color: var(--crit); }
.oculto .hero-v, .oculto .hero-s b, .oculto .tile .v, .oculto .val { filter: blur(9px); user-select: none; }
@media (min-width: 900px) { .hero { padding: 26px 28px; } .hero-v { font-size: 40px; } .quick { max-width: 460px; } }

/* Entrada, avisos e página pública de assinatura */
.aviso { background: var(--warn-soft); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-size: 14px; }
.linkbtn { border: 0; background: none; color: var(--accent); font: 600 14px var(--font-b); cursor: pointer; padding: 6px 0; text-decoration: underline; }
.auth .card.largo { max-width: 720px; }
.auth form { gap: 12px; }
#nuvem-aviso:empty { display: none; }

/* Marca Caixinha do Fiel */
.brand img { width: 34px; height: 34px; border-radius: 9px; flex: none; }
.hero-top .who img { width: 40px; height: 40px; border-radius: 11px; flex: none; box-shadow: 0 2px 8px rgba(0, 0, 0, .25); }
.marca { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.marca img { border-radius: 22px; box-shadow: 0 8px 22px rgba(6, 36, 37, .3); }
.marca-nome { width: 230px; max-width: 100%; color: var(--ink); }
.marca-nome svg { display: block; width: 100%; height: auto; }
.marca.linha { flex-direction: row; text-align: left; gap: 12px; }
.marca.linha img { border-radius: 11px; box-shadow: none; flex: none; }
.marca.linha .marca-nome { width: 190px; margin-bottom: 3px; }
