/* Espelho — sistema de design.  Ver DESIGN.md.
   Tokens → base → layout → componentes. Sem estilos inline (a política de segurança do painel os bloqueia). */

@font-face { font-family: "Geist"; src: url("/static/fonts/Geist-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/static/fonts/GeistMono-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

/* ───────── tokens: escala neutra de 12 degraus + semânticas (claro) ───────── */
:root {
  --n1: #fcfcfd; --n2: #f9f9fb; --n3: #f0f0f3; --n4: #e8e8ec; --n5: #e0e1e6; --n6: #d9d9e0;
  --n7: #cdced6; --n8: #b9bbc6; --n9: #8b8d98; --n10: #80838d; --n11: #60646c; --n12: #1c2024;
  --accent: #0d74ce; --accent-solid: #0090ff; --accent-bg: #e6f4fe; --focus: #0090ff;
  --ok: #18794e; --ok-solid: #30a46c; --ok-bg: #e9f6e9; --ok-line: #b2ddb5;
  --warn: #ab6400; --warn-solid: #ffc53d; --warn-bg: #fff7c2; --warn-line: #f3d673;
  --bad: #ce2c31; --bad-solid: #e5484d; --bad-bg: #feebec; --bad-line: #fdbdbe;
  --info: #0d74ce; --info-bg: #e6f4fe; --info-line: #acd8fc;
  --menu-shadow: 0 8px 30px rgba(0, 0, 0, .12);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --n1: #111113; --n2: #18191b; --n3: #212225; --n4: #272a2d; --n5: #2e3135; --n6: #363a3f;
    --n7: #43484e; --n8: #5a6169; --n9: #696e77; --n10: #777b84; --n11: #b0b4ba; --n12: #edeef0;
    --accent: #70b8ff; --accent-bg: #0d2847; --focus: #3b9eff;
    --ok: #3dd68c; --ok-bg: #132d21; --ok-line: #20573e;
    --warn: #ffca16; --warn-bg: #302008; --warn-line: #5b3d0a;
    --bad: #ff9592; --bad-bg: #3b1219; --bad-line: #72232d;
    --info: #70b8ff; --info-bg: #0d2847; --info-line: #104d87;
    --menu-shadow: 0 8px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --n1: #111113; --n2: #18191b; --n3: #212225; --n4: #272a2d; --n5: #2e3135; --n6: #363a3f;
  --n7: #43484e; --n8: #5a6169; --n9: #696e77; --n10: #777b84; --n11: #b0b4ba; --n12: #edeef0;
  --accent: #70b8ff; --accent-bg: #0d2847; --focus: #3b9eff;
  --ok: #3dd68c; --ok-bg: #132d21; --ok-line: #20573e;
  --warn: #ffca16; --warn-bg: #302008; --warn-line: #5b3d0a;
  --bad: #ff9592; --bad-bg: #3b1219; --bad-line: #72232d;
  --info: #70b8ff; --info-bg: #0d2847; --info-line: #104d87;
  --menu-shadow: 0 8px 30px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

:root {
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px;
  --side-w: 236px;
}

/* ───────── base ───────── */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--n1); color: var(--n12); font: 14px/1.5 var(--font); font-feature-settings: "calt", "ss01"; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
h1 { font-size: 24px; line-height: 1.25; letter-spacing: -0.02em; }
h2 { font-size: 16px; line-height: 1.4; }
h3 { font-size: 14px; }
p { margin: 0 0 var(--s2); }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; text-underline-offset: 3px; }
code, .mono { font-family: var(--mono); font-size: .93em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--n11); } .small { font-size: 12px; } .center { text-align: center; } .right { margin-left: auto; }
.hide { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
::selection { background: var(--accent-bg); }

/* ícones: grade de 24, traço fino (1,5 ≈ 1 px a 16 px) */
.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.i.lg { width: 20px; height: 20px; } .i.xl { width: 24px; height: 24px; }

/* ───────── estrutura ───────── */
.app { min-height: 100vh; }
.side { display: none; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--s2); height: 52px; padding: 0 var(--s4); background: var(--n1); box-shadow: 0 1px 0 var(--n6); }
.brand { display: flex; align-items: center; gap: var(--s2); font-weight: 600; color: var(--n12); letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.brand svg { width: 22px; height: 22px; }
.main { padding: var(--s5) var(--s4) 96px; max-width: 1096px; margin: 0 auto; }
.tabbar { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--n1); box-shadow: 0 -1px 0 var(--n6); padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 7px; font-size: 11px; color: var(--n11); }
.tabbar a:hover { text-decoration: none; }
.tabbar a[aria-current="page"] { color: var(--n12); }
.tabbar a[aria-current="page"] .i { color: var(--accent); }

@media (min-width: 960px) {
  .topbar, .tabbar { display: none; }
  .app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .side { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: var(--s4) var(--s3); background: var(--n2); box-shadow: 1px 0 0 var(--n6); }
  .side .brand { padding: var(--s2) var(--s2) var(--s4); font-size: 15px; }
  .main { padding: var(--s8) var(--s8) var(--s10); width: 100%; }
}
.nav-label { padding: var(--s4) var(--s2) var(--s1); font-size: 12px; color: var(--n10); font-weight: 500; }
.nav a { display: flex; align-items: center; gap: var(--s3); height: 32px; padding: 0 var(--s2); border-radius: var(--r-md); color: var(--n11); font-weight: 500; }
.nav a:hover { background: var(--n4); color: var(--n12); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--n4); color: var(--n12); }
.nav a[aria-current="page"] .i { color: var(--accent); }
.nav .count { margin-left: auto; font-size: 12px; font-variant-numeric: tabular-nums; background: var(--warn-bg); color: var(--warn); border-radius: 999px; padding: 0 7px; line-height: 18px; }
.side-foot { margin-top: auto; display: grid; gap: var(--s3); padding-top: var(--s3); box-shadow: 0 -1px 0 var(--n6); }
.who { display: flex; align-items: center; gap: var(--s2); padding: 0 var(--s1); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--n5); color: var(--n12); display: grid; place-items: center; font-weight: 600; font-size: 12px; text-transform: uppercase; }
.who a { color: var(--n12); font-weight: 500; } .who form { margin-left: auto; }

/* tema: controle segmentado */
.seg { display: inline-flex; padding: 2px; background: var(--n3); border-radius: var(--r-md); gap: 2px; }
.seg button { display: grid; place-items: center; width: 28px; height: 26px; padding: 0; border-radius: var(--r-sm); background: transparent; color: var(--n11); box-shadow: none; }
.seg button:hover { color: var(--n12); background: transparent; box-shadow: none; }
.seg button[aria-pressed="true"] { background: var(--n1); color: var(--n12); box-shadow: 0 0 0 1px var(--n6); }

/* ───────── cabeçalho de página ───────── */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s3) var(--s4); margin-bottom: var(--s6); }
.page-head .lead { flex: 1 1 280px; min-width: 0; }
.page-head p { margin: var(--s1) 0 0; color: var(--n11); }
.crumb { display: flex; align-items: center; gap: var(--s1); font-size: 13px; color: var(--n11); margin-bottom: var(--s2); }
.crumb a { color: var(--n11); } .crumb a:hover { color: var(--n12); }
.page-head .actions { display: flex; gap: var(--s2); flex-wrap: wrap; }
.section { margin-top: var(--s8); }
.section > h2 { margin-bottom: var(--s3); }

/* ───────── botões ───────── */
.btn, button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 var(--s3); border: 0; border-radius: var(--r-md); font: inherit; font-weight: 500; line-height: 1; cursor: pointer; white-space: nowrap; background: var(--n12); color: var(--n1); box-shadow: 0 0 0 1px var(--n12); }
.btn:hover, button:hover { background: var(--n11); box-shadow: 0 0 0 1px var(--n11); text-decoration: none; }
.btn-secondary, button.btn-secondary { background: var(--n1); color: var(--n12); box-shadow: 0 0 0 1px var(--n7); }
.btn-secondary:hover, button.btn-secondary:hover { background: var(--n3); box-shadow: 0 0 0 1px var(--n8); }
.btn-ghost, button.btn-ghost { background: transparent; color: var(--n11); box-shadow: none; padding: 0 var(--s2); }
.btn-ghost:hover, button.btn-ghost:hover { background: var(--n4); color: var(--n12); box-shadow: none; }
.btn-danger, button.btn-danger { background: var(--bad-solid); color: #fff; box-shadow: 0 0 0 1px var(--bad-solid); }
.btn-danger:hover, button.btn-danger:hover { background: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.btn-danger-quiet, button.btn-danger-quiet { background: var(--n1); color: var(--bad); box-shadow: 0 0 0 1px var(--bad-line); }
.btn-danger-quiet:hover, button.btn-danger-quiet:hover { background: var(--bad-bg); box-shadow: 0 0 0 1px var(--bad-line); }
.btn-sm, button.btn-sm { height: 28px; padding: 0 var(--s2); font-size: 13px; }
.btn-icon { width: 32px; padding: 0; } .btn-icon.btn-sm { width: 28px; }
.btn:disabled, button:disabled { opacity: .5; cursor: not-allowed; }
form.inline { display: inline; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s4); }

/* ───────── superfícies ───────── */
.card { background: var(--n1); box-shadow: 0 0 0 1px var(--n6); border-radius: var(--r-lg); padding: var(--s5); margin: var(--s4) 0; }
.card.flush { padding: 0; overflow: hidden; }
.card > h2:first-child, .card > h3:first-child { margin-bottom: var(--s3); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); background: var(--n1); box-shadow: 0 0 0 1px var(--n6); border-radius: var(--r-lg); overflow: hidden; }
.stat { padding: var(--s4) var(--s5); box-shadow: 0 0 0 .5px var(--n6); }
.stat .v { display: block; font-size: 24px; font-weight: 600; line-height: 1.2; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .k { font-size: 13px; color: var(--n11); }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, 1fr); } }

/* painel retrátil (details) */
details.panel { background: var(--n1); box-shadow: 0 0 0 1px var(--n6); border-radius: var(--r-lg); margin: var(--s3) 0; }
details.panel > summary { display: flex; align-items: center; gap: var(--s3); padding: var(--s4) var(--s5); cursor: pointer; font-weight: 500; list-style: none; color: var(--n12); }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary .i:first-child { color: var(--n10); }
details.panel > summary .chev { margin-left: auto; color: var(--n10); }
details.panel[open] > summary .chev { transform: rotate(180deg); }
details.panel[open] > summary { box-shadow: 0 1px 0 var(--n6); }
details.panel .body { padding: var(--s5); }
details.inline-d { margin: var(--s2) 0 0; } details.inline-d > summary { cursor: pointer; font-size: 13px; color: var(--accent); list-style: none; display: inline-flex; align-items: center; gap: 6px; height: 24px; }
details.inline-d > summary::-webkit-details-marker { display: none; }
details.inline-d .body { margin-top: var(--s2); padding: var(--s3); background: var(--n2); border-radius: var(--r-md); box-shadow: 0 0 0 1px var(--n6); }

/* ───────── avisos ───────── */
.callout { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r-md); margin: var(--s3) 0; box-shadow: 0 0 0 1px var(--n6); background: var(--n2); color: var(--n12); }
.callout .i { margin-top: 2px; }
.callout.ok { background: var(--ok-bg); box-shadow: 0 0 0 1px var(--ok-line); } .callout.ok .i { color: var(--ok); }
.callout.warn { background: var(--warn-bg); box-shadow: 0 0 0 1px var(--warn-line); } .callout.warn .i { color: var(--warn); }
.callout.bad { background: var(--bad-bg); box-shadow: 0 0 0 1px var(--bad-line); } .callout.bad .i { color: var(--bad); }
.callout.info { background: var(--info-bg); box-shadow: 0 0 0 1px var(--info-line); } .callout.info .i { color: var(--info); }
a.callout { color: var(--n12); } a.callout:hover { text-decoration: none; filter: brightness(.98); }
.callout .chev { margin-left: auto; color: var(--n10); }

/* ───────── etiquetas de estado ───────── */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 var(--s2); border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--n3); color: var(--n11); box-shadow: 0 0 0 1px var(--n6); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--n9); }
.badge.ok { background: var(--ok-bg); color: var(--ok); box-shadow: 0 0 0 1px var(--ok-line); } .badge.ok::before { background: var(--ok-solid); }
.badge.warn { background: var(--warn-bg); color: var(--warn); box-shadow: 0 0 0 1px var(--warn-line); } .badge.warn::before { background: var(--warn-solid); }
.badge.bad { background: var(--bad-bg); color: var(--bad); box-shadow: 0 0 0 1px var(--bad-line); } .badge.bad::before { background: var(--bad-solid); }
.badge.info { background: var(--info-bg); color: var(--info); box-shadow: 0 0 0 1px var(--info-line); } .badge.info::before { background: var(--accent-solid); }
.badge.plain::before { display: none; }

/* ───────── formulários ───────── */
label { display: block; font-size: 13px; font-weight: 500; margin: var(--s4) 0 6px; color: var(--n12); }
label:first-child { margin-top: 0; }
input, select, textarea { width: 100%; height: 36px; padding: 0 var(--s3); border: 0; border-radius: var(--r-md); background: var(--n1); color: var(--n12); font: inherit; box-shadow: 0 0 0 1px var(--n7); }
input::placeholder, textarea::placeholder { color: var(--n10); }
input:hover, select:hover, textarea:hover { box-shadow: 0 0 0 1px var(--n8); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; box-shadow: none; }
textarea { height: auto; min-height: 96px; padding: var(--s2) var(--s3); resize: vertical; line-height: 1.5; }
select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b8d98' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; padding: 0; accent-color: var(--n12); flex: none; margin: 0; }
.check { display: flex; align-items: flex-start; gap: var(--s2); font-weight: 400; margin: var(--s3) 0; cursor: pointer; }
.check input { margin-top: 3px; }
.help { color: var(--n11); font-size: 12px; margin: 6px 0 0; }
.cols { display: grid; gap: 0 var(--s4); grid-template-columns: 1fr; }
@media (min-width: 560px) { .cols { grid-template-columns: 1fr 1fr; } }
.fgroup { margin-top: var(--s6); padding-top: var(--s5); box-shadow: 0 -1px 0 var(--n6); }
.fgroup:first-of-type { margin-top: 0; padding-top: 0; box-shadow: none; }
.fgroup > h3 { margin-bottom: var(--s1); }
.fgroup > .desc { color: var(--n11); font-size: 13px; margin: 0 0 var(--s3); }
@media (max-width: 719px) { input, select, textarea { font-size: 16px; height: 42px; } textarea { height: auto; } .btn, button { height: 40px; } .btn-sm, button.btn-sm { height: 34px; } .seg button { height: 26px; } }

/* ───────── lista de itens (projetos, fila, contas) ───────── */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: var(--s4) var(--s5); box-shadow: 0 -1px 0 var(--n6); }
.list > li:first-child { box-shadow: none; }
.row { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.ico-box { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-md); background: var(--n3); color: var(--n11); flex: none; box-shadow: 0 0 0 1px var(--n6); }
.grow { flex: 1 1 200px; min-width: 0; }
.title { font-weight: 500; color: var(--n12); } a.title:hover { text-decoration: underline; }
.meta { color: var(--n11); font-size: 13px; }
.errtxt { color: var(--bad); font-size: 13px; margin-top: 4px; word-break: break-word; }
.kv { display: flex; gap: var(--s4); flex-wrap: wrap; margin-top: var(--s3); }
.kv div { min-width: 70px; } .kv b { display: block; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; } .kv span { font-size: 12px; color: var(--n11); }
.proj { display: grid; gap: var(--s3); }
.actions-row { margin-top: var(--s3); }
@media (min-width: 720px) { .proj { grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: var(--s6); } .proj .kv { margin: 0; } }

/* tabela simples (formatos, diário) */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 500; color: var(--n11); padding: var(--s2) var(--s3); }
td { padding: var(--s3); box-shadow: 0 -1px 0 var(--n6); vertical-align: middle; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
progress { width: 100%; height: 6px; appearance: none; border: 0; border-radius: 999px; background: var(--n4); overflow: hidden; accent-color: var(--accent-solid); }
progress::-webkit-progress-bar { background: var(--n4); border-radius: 999px; } progress::-webkit-progress-value { background: var(--accent-solid); border-radius: 999px; } progress::-moz-progress-bar { background: var(--accent-solid); }

/* estado vazio */
.empty { display: grid; justify-items: center; text-align: center; gap: var(--s2); padding: var(--s10) var(--s5); color: var(--n11); }
.empty .ico-box { width: 40px; height: 40px; border-radius: 50%; }
.empty h3 { color: var(--n12); font-size: 15px; }
.empty p { max-width: 42ch; margin: 0; }
.steps { text-align: left; margin: var(--s2) 0 0; padding-left: var(--s5); } .steps li { margin: 4px 0; }

.thumb { width: 168px; max-width: 100%; border-radius: var(--r-md); display: block; box-shadow: 0 0 0 1px var(--n6); }
.pager { display: flex; gap: var(--s2); align-items: center; justify-content: center; margin: var(--s4) 0 0; }
.filters { display: grid; gap: 0 var(--s3); grid-template-columns: 1fr 1fr auto; align-items: end; padding: var(--s4) var(--s5); }
.filters label { margin-top: 0; }
.balance { display: inline-flex; align-items: center; gap: var(--s2); font-size: 13px; color: var(--n11); }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: var(--s5); background: var(--n2); }
.login { width: 100%; max-width: 372px; }
.login .brand { justify-content: center; font-size: 18px; margin-bottom: var(--s6); }
.login .card { padding: var(--s6); box-shadow: 0 0 0 1px var(--n6), 0 1px 2px rgba(0, 0, 0, .04); }
.login .btn-row .btn, .login .btn-row button { width: 100%; }

@media (prefers-reduced-motion: no-preference) { details.panel > summary .chev { transition: transform .15s; } }
@media print { .side, .topbar, .tabbar { display: none; } }

/* logotipo (duas telas espelhadas) */
.mark { width: 22px; height: 22px; fill: none; stroke-width: 1.5; stroke-linejoin: round; }
.mark .a { stroke: var(--n12); }
.mark .b { stroke: var(--accent-solid); fill: var(--accent-bg); }
.col { min-width: 0; }
