/* Direção visual: utilitário sóbrio com toque editorial. Papel de livro-razão (neutros quentes), tinta azul-petróleo como cor dominante,
   âmbar só para destaque, títulos em serifa, dados em sans densa com números tabulares. Sem sombras decorativas, um único raio, escala de 4/8 px.
   Fontes guardadas em /app/fonts (licença OFL); nada é carregado de fora. */

@font-face { font-family: "Plex Sans"; src: url(fonts/plex-sans-400.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Plex Sans"; src: url(fonts/plex-sans-500.woff2) format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Plex Sans"; src: url(fonts/plex-sans-600.woff2) format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url(fonts/plex-mono-400.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Serif"; src: url(fonts/source-serif-600.woff2) format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }

:root {
  /* cor: claro */
  --bg: #f3f0e8; --panel: #fcfbf7; --sunk: #ebe7db; --text: #1b2321; --muted: #566059; --line: #d8d2c3; --line-strong: #b9b2a0;
  --brand: #0e4f55; --brand-text: #ffffff; --brand-hover: #0a3a3f; --accent: #8f520f; --focus: #0e4f55;
  --ok: #1c6b41; --ok-bg: #dcefe3; --warn: #7d5200; --warn-bg: #f6e8c6; --bad: #a1271e; --bad-bg: #f6dcd7; --info: #1e4f7a; --info-bg: #dbe7f2;
  --entrada-bg: #0f2f31; --entrada-line: #2a5a5e;
  --side-bg: #0f2f31; --side-text: #d3e3e1; --side-muted: #97b8b4; --side-hover: #174044; --side-active: #1d4d52; --side-accent: #e0a458;
  --overlay: rgba(16, 22, 21, .55); --elev: 0 12px 32px rgba(16, 22, 21, .28);
  /* tipo */
  --font-text: "Plex Sans", "Segoe UI", "Helvetica Neue", sans-serif;
  --font-title: "Source Serif", Georgia, "Times New Roman", serif;
  --font-mono: "Plex Mono", Consolas, "Courier New", monospace;
  --t-xs: .8rem; --t-sm: .875rem; --t-md: 1rem; --t-lg: 1.15rem; --t-xl: 1.6rem; --t-num: 1.9rem;
  /* espaço (4/8) e forma */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --radius: 4px; --control: 32px;
  font-family: var(--font-text); font-size: 14px; line-height: 1.5; color-scheme: light;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
  --bg: #101615; --panel: #171e1c; --sunk: #1f2826; --text: #e6ebe8; --muted: #9fada8; --line: #2a3532; --line-strong: #3a4742;
  --brand: #62b5bb; --brand-text: #08191b; --brand-hover: #7cc6cb; --accent: #e0a458; --focus: #62b5bb;
  --ok: #66c590; --ok-bg: #16301f; --warn: #e5b45a; --warn-bg: #33270f; --bad: #f19288; --bad-bg: #3a1c19; --info: #7ebbe6; --info-bg: #14283a;
  --entrada-bg: #0d3033; --entrada-line: #2a5a5e;
  --side-bg: #0b1211; --side-text: #d3e3e1; --side-muted: #8fa8a4; --side-hover: #141e1c; --side-active: #1a2a28; --side-accent: #e0a458;
  --overlay: rgba(0, 0, 0, .65); --elev: 0 12px 32px rgba(0, 0, 0, .55);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg: #101615; --panel: #171e1c; --sunk: #1f2826; --text: #e6ebe8; --muted: #9fada8; --line: #2a3532; --line-strong: #3a4742;
    --brand: #62b5bb; --brand-text: #08191b; --brand-hover: #7cc6cb; --accent: #e0a458; --focus: #62b5bb;
    --ok: #66c590; --ok-bg: #16301f; --warn: #e5b45a; --warn-bg: #33270f; --bad: #f19288; --bad-bg: #3a1c19; --info: #7ebbe6; --info-bg: #14283a;
    --entrada-bg: #0d3033; --entrada-line: #2a5a5e;
    --side-bg: #0b1211; --side-text: #d3e3e1; --side-muted: #8fa8a4; --side-hover: #141e1c; --side-active: #1a2a28; --side-accent: #e0a458;
    --overlay: rgba(0, 0, 0, .65); --elev: 0 12px 32px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--brand); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2 { font-family: var(--font-title); font-weight: 600; letter-spacing: -.005em; line-height: 1.2; }
h1 { font-size: var(--t-xl); margin: 0 0 var(--s1); }
h2 { font-size: var(--t-lg); margin: var(--s5) 0 var(--s2); }
h3 { font-size: var(--t-md); font-weight: 600; margin: var(--s4) 0 var(--s2); }
.muted { color: var(--muted); }
.small { font-size: var(--t-sm); }
.right { text-align: right; }
.mono { font-family: var(--font-mono); font-size: .92em; }
.big { font-size: 1.35rem; letter-spacing: .06em; user-select: all; padding: var(--s2) var(--s3); background: var(--surface-2, rgba(127,127,127,.12)); border-radius: var(--radius); display: inline-block; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 600; }
.neg { color: var(--bad); }
.pos { color: var(--ok); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wrap { word-break: break-all; }
.body { white-space: pre-wrap; overflow-wrap: anywhere; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: var(--s2); top: var(--s2); background: var(--panel); padding: var(--s2) var(--s3); z-index: 50; border: 1px solid var(--line-strong); border-radius: var(--radius); }

/* ícones: um único estilo (traço de 1,75 px, pontas arredondadas) */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }

/* ---------------------------------------------------------------- estrutura */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side-bg); color: var(--side-text); padding: var(--s4) var(--s3); position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { display: flex; align-items: center; gap: var(--s2); font-family: var(--font-title); font-weight: 600; font-size: var(--t-lg); color: #fff; padding: var(--s1) var(--s2) var(--s4); }
.side .brand .icon { width: 22px; height: 22px; color: var(--side-accent); }
.side a { display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s3); border-left: 3px solid transparent; border-radius: var(--radius); color: var(--side-text); text-decoration: none; }
.side a:hover { background: var(--side-hover); }
.side a.active { background: var(--side-active); border-left-color: var(--side-accent); color: #fff; font-weight: 500; }
.side .group { margin: var(--s4) var(--s3) var(--s1); font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--side-muted); }
.main { min-width: 0; }
.topbar { display: flex; gap: var(--s3); align-items: center; padding: var(--s2) var(--s5); background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; min-height: 52px; }
.topbar .grow { flex: 1; }
.topbar .small { margin: 0; }
.topbar select.company { width: auto; max-width: 300px; }
.content { padding: var(--s5); max-width: 1240px; }

/* ---------------------------------------------------------------- componentes */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s4); margin-bottom: var(--s4); }
.card > h3:first-child { margin-top: 0; }
.toolbar { display: flex; gap: var(--s2); align-items: end; flex-wrap: wrap; margin: var(--s2) 0 var(--s4); }
.toolbar .spacer { flex: 1; }
.toolbar h1 + .muted { max-width: 70ch; }
.row { display: flex; gap: var(--s3); flex-wrap: wrap; align-items: end; }
.row .spacer { flex: 1; }
.row.row-end { justify-content: flex-end; }
.hint { font-size: var(--t-sm); color: var(--muted); margin-top: var(--s1); }
.pad { padding: var(--s4); }

/* números em faixa (painel do escritório): sem caixas, separados por filetes */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); border-top: 2px solid var(--text); border-bottom: 1px solid var(--line); margin-bottom: var(--s4); }
.stat { padding: var(--s3) var(--s4); border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: var(--s1); }
.stat b { display: block; font-size: var(--t-num); font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .muted { font-size: var(--t-sm); order: -1; }
a.stat { color: var(--text); text-decoration: none; }
a.stat:hover b { color: var(--brand); }
a.stat:hover .muted { text-decoration: underline; }
a.stat b { color: var(--brand); }

/* tabelas densas */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 6px var(--s3); text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: var(--t-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--sunk); border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--sunk); }
.total-row td { font-weight: 600; background: var(--sunk); }
.lines input { min-width: 6rem; }
.lines td { padding: var(--s1) var(--s2); }
.indent-0 { padding-left: 0; } .indent-1 { padding-left: 16px; } .indent-2 { padding-left: 32px; } .indent-3 { padding-left: 48px; } .indent-4 { padding-left: 64px; } .indent-5 { padding-left: 80px; }

/* formulários */
label { display: block; font-size: var(--t-sm); color: var(--muted); margin-bottom: var(--s1); }
input, select, textarea, button { font: inherit; }
input, select, textarea { width: 100%; min-height: var(--control); padding: 5px var(--s2); border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--panel); color: var(--text); }
textarea { min-height: 4.5rem; padding: var(--s2); }
input[type=checkbox] { width: auto; min-height: 0; accent-color: var(--brand); }
input[type=file] { padding: var(--s1); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
.field { min-width: 150px; flex: 1; }
.field.narrow { flex: 0 0 150px; min-width: 120px; }
.field.check { flex: 0 0 auto; min-width: 0; }
.field.check label { display: flex; align-items: center; gap: var(--s2); }

button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--control); padding: 0 var(--s3); border-radius: var(--radius); border: 1px solid var(--line-strong);
  background: var(--panel); color: var(--text); cursor: pointer; text-decoration: none; font-weight: 500; transition: background-color .12s, border-color .12s; }
button:hover, .btn:hover { background: var(--sunk); }
button.primary { background: var(--brand); color: var(--brand-text); border-color: var(--brand); }
button.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
button.danger { color: var(--bad); border-color: var(--bad); }
button.danger:hover { background: var(--bad-bg); }
button.small, .btn.small { min-height: 26px; padding: 0 var(--s2); font-size: var(--t-sm); }
button.small .icon { width: 15px; height: 15px; vertical-align: -2px; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.link { min-height: 0; background: none; border: 0; color: var(--brand); padding: 0; text-decoration: underline; font-weight: 400; }
button.link:hover { background: none; }

/* rótulos de situação: mesmo raio dos demais elementos */
.badge { display: inline-block; padding: 0 6px; border-radius: 3px; font-size: var(--t-xs); font-weight: 500; line-height: 1.6; background: var(--sunk); color: var(--text); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }

.alert { display: flex; gap: var(--s2); padding: var(--s2) var(--s3); border-left: 3px solid var(--info); border-radius: var(--radius); margin: var(--s2) 0; background: var(--info-bg); color: var(--info); }
.alert.bad { background: var(--bad-bg); color: var(--bad); border-left-color: var(--bad); }
.alert.warn { background: var(--warn-bg); color: var(--warn); border-left-color: var(--warn); }
.alert.ok { background: var(--ok-bg); color: var(--ok); border-left-color: var(--ok); }

.kv { display: grid; grid-template-columns: 11rem 1fr; gap: var(--s1) var(--s3); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.tabs { display: flex; gap: var(--s1); border-bottom: 1px solid var(--line); margin-bottom: var(--s4); flex-wrap: wrap; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--muted); padding: 0 var(--s3); margin-bottom: -1px; }
.tabs button:hover { color: var(--text); background: none; }
.tabs button.active { border-bottom-color: var(--brand); color: var(--text); font-weight: 600; }

/* janelas e avisos temporários: os únicos elementos com sombra (elevação real) */
.overlay { position: fixed; inset: 0; background: var(--overlay); display: flex; align-items: flex-start; justify-content: center; padding: 4vh var(--s4); overflow-y: auto; z-index: 20; }
.modal { background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: var(--s5); width: min(640px, 100%); box-shadow: var(--elev); }
.modal h2 { margin-top: 0; }
.modal .actions { display: flex; gap: var(--s2); justify-content: flex-end; margin-top: var(--s4); }
.modal.wide { width: min(1000px, 100%); }
.toasts { position: fixed; right: var(--s4); bottom: var(--s4); display: grid; gap: var(--s2); z-index: 30; max-width: min(420px, 90vw); }
.toast { padding: var(--s3) var(--s4); border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line-strong); border-left: 3px solid var(--info); box-shadow: var(--elev); }
.toast.ok { border-left-color: var(--ok); }
.toast.bad { border-left-color: var(--bad); }

/* entrada: painel de identidade (escritório ou plataforma) + formulário */
.entrada { display: grid; grid-template-columns: minmax(340px, 6fr) minmax(360px, 5fr); min-height: 100vh; }
.entrada-marca { background: var(--entrada-bg); color: var(--side-text); padding: clamp(24px, 4vw, 64px); display: grid; grid-template-rows: 1fr auto; gap: var(--s5); }
.entrada-centro { align-self: center; max-width: 34rem; }
.entrada-topo { margin-bottom: var(--s5); }
.entrada-logo { display: inline-flex; background: #fff; border-radius: var(--radius); padding: var(--s3) var(--s4); max-width: 100%; }
.entrada-logo img { display: block; max-height: 64px; max-width: 240px; object-fit: contain; }
.entrada-mono { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; border: 1px solid var(--side-accent); border-radius: var(--radius); font-family: var(--font-title); font-size: 1.5rem; color: var(--side-accent); }
.entrada-marca h1 { color: #fff; font-size: clamp(2rem, 3.4vw, 3.1rem); line-height: 1.1; margin: 0 0 var(--s4); overflow-wrap: anywhere; }
.entrada-lead { max-width: 38ch; font-size: 1.1rem; line-height: 1.55; margin: 0; color: #e8f0ee; }
.entrada-itens { list-style: none; margin: var(--s6) 0 0; padding: 0; }
.entrada-itens li { display: grid; grid-template-columns: 24px 1fr; gap: var(--s3); padding: var(--s3) 0; border-top: 1px solid var(--entrada-line); }
.entrada-itens li:last-child { border-bottom: 1px solid var(--entrada-line); }
.entrada-itens .icon { width: 20px; height: 20px; color: var(--side-accent); margin-top: 2px; }
.entrada-itens b { display: block; color: #fff; font-weight: 600; }
.entrada-itens span span { display: block; color: var(--side-muted); font-size: var(--t-sm); line-height: 1.45; }
.entrada-rodape { display: grid; gap: var(--s1); font-size: var(--t-sm); color: var(--side-muted); overflow-wrap: anywhere; }
.entrada-rodape b { color: var(--side-text); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; font-size: var(--t-xs); }
.entrada-form { display: flex; align-items: center; justify-content: center; padding: var(--s6) var(--s5); }
.entrada-form .box { width: min(380px, 100%); }
.entrada-form .eyebrow { margin: 0 0 var(--s2); font-size: var(--t-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.entrada-form h2 { font-size: 1.75rem; margin: 0 0 var(--s3); }
.entrada-btn { width: 100%; justify-content: center; min-height: 44px; margin: var(--s2) 0 var(--s3); }
.dev-users { grid-template-columns: 1fr; border: 0; gap: var(--s2); }
.dev-users button { justify-content: flex-start; text-align: left; height: auto; padding: var(--s2) var(--s3); flex-direction: column; align-items: flex-start; gap: 0; }
@media (max-width: 860px) {
  .entrada { grid-template-columns: 1fr; min-height: 0; }
  .entrada-marca { padding: var(--s5) var(--s4); gap: var(--s4); grid-template-rows: auto auto; }
  .entrada-marca h1 { font-size: 1.6rem; margin-bottom: var(--s2); }
  .entrada-lead { font-size: var(--t-md); }
  .entrada-itens { display: none; }
  .entrada-form { padding: var(--s5) var(--s4); }
}

.side .brand-logo { display: inline-flex; background: #fff; border-radius: var(--radius); padding: var(--s1) var(--s2); flex: 0 0 auto; max-width: 100%; }
.side .brand-logo.plain, .entrada-logo.plain { background: none; padding: 0; }
.side .brand-logo.plain img, .entrada-logo.plain img { border-radius: var(--radius); }
.side .brand-logo img { display: block; max-height: 40px; max-width: 168px; object-fit: contain; }
.side .brand-name { overflow-wrap: anywhere; line-height: 1.2; }

.bell { position: relative; }
.bell .n { position: absolute; top: -6px; right: -6px; background: var(--bad); color: #fff; border-radius: 3px; font-size: var(--t-xs); font-weight: 600; padding: 0 5px; min-width: 18px; text-align: center; line-height: 1.5; }

/* estados: carregando, vazio */
.skeleton { display: grid; gap: var(--s2); padding: var(--s2) 0; max-width: 520px; }
.skeleton span { display: block; height: 12px; border-radius: var(--radius); background: var(--sunk); animation: pulse 1.2s ease-in-out infinite; }
.skeleton span:nth-child(2) { width: 80%; } .skeleton span:nth-child(3) { width: 55%; }
@keyframes pulse { 50% { opacity: .45; } }
.empty { display: flex; align-items: center; gap: var(--s3); padding: var(--s4); border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--muted); }
.empty .icon { width: 22px; height: 22px; }

.sug { align-items: center; padding: var(--s2) 0; border-top: 1px solid var(--line); }
.sug:first-of-type { border-top: 0; }
.acct { display: flex; flex-direction: column; gap: var(--s1); }
.acct-q { font-size: var(--t-sm); }
.pdf-frame { width: 100%; height: 70vh; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--panel); }

/* ---------------------------------------------------------------- portal do colaborador */
/* duas colunas editoriais, sem caixas: cada bloco é aberto por um filete */
.dash { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: var(--s6) 40px; align-items: start; }
.dash-main, .dash-side { display: grid; gap: var(--s6); align-content: start; min-width: 0; }
.panel { border-top: 2px solid var(--text); padding-top: var(--s2); min-width: 0; }
.panel > .row, .panel > button { margin-top: var(--s3); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s2); }
.panel-head h3 { margin: 0; font-family: var(--font-text); font-size: var(--t-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.notice { border-left: 3px solid var(--brand); padding: var(--s1) 0 var(--s1) var(--s3); margin: var(--s4) 0; }
.notice:first-of-type { margin-top: var(--s2); }
.notice.pinned { border-left-color: var(--accent); }
.notice > .row { align-items: baseline; }
.notice > .row b { font-family: var(--font-title); font-size: var(--t-lg); font-weight: 600; }
.notice .body { margin-top: var(--s1); max-width: 68ch; }
.docline, .mini { display: flex; gap: var(--s3); justify-content: space-between; align-items: center; flex-wrap: wrap; padding: var(--s2) 0; border-bottom: 1px solid var(--line); }
.docline > div, .mini > div, .mini > span:first-child { flex: 1 1 11rem; min-width: 0; }
.docline:last-of-type, .mini:last-of-type { border-bottom: 0; }
.figures { display: flex; gap: var(--s5); margin: var(--s1) 0 var(--s2); }
.figures .stat { border: 0; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: var(--s3); }
.chip { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--text); }
.chip:hover b { color: var(--brand); text-decoration: underline; }
.figures .stat b { font-size: var(--t-num); }
.req { display: grid; gap: var(--s1); }
.reply { background: var(--sunk); border-left: 3px solid var(--brand); padding: var(--s2) var(--s3); border-radius: var(--radius); }
.req-mini { margin: var(--s2) 0; display: grid; gap: var(--s1); }

/* ---------------------------------------------------------------- impressão */
.print-only { display: none; }
@media print {
  .side, .topbar, .toolbar, .tabs, .toasts, .no-print { display: none !important; }
  .shell { display: block; }
  .content { max-width: none; padding: 0; }
  .print-only { display: block; margin-bottom: var(--s3); }
  body { background: #fff; color: #000; }
  tr { break-inside: avoid; }
}

/* ---------------------------------------------------------------- telas estreitas e toque */
@media (max-width: 900px) {
  .dash { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: sticky; top: 0; z-index: 10; height: auto; display: flex; flex-wrap: nowrap; gap: var(--s1); overflow-x: auto; padding: var(--s2); -webkit-overflow-scrolling: touch; }
  .side .brand, .side .group { display: none; }
  .side a { white-space: nowrap; flex: 0 0 auto; border-left: 0; border-bottom: 3px solid transparent; border-radius: var(--radius) var(--radius) 0 0; }
  .side a.active { border-bottom-color: var(--side-accent); }
  .topbar { padding: var(--s2) var(--s3); }
  .toolbar button, .toolbar .btn { flex: 0 0 auto; }
  .kv { grid-template-columns: 1fr; } .kv dt { margin-top: var(--s2); }
  .content { padding: var(--s3); }
  .modal { padding: var(--s4); }
  .pdf-frame { height: 60vh; }
  .stat { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; }
  .stat:first-child { border-top: 0; }
}
/* alvos de toque de pelo menos 44 px em telas de toque e em telas estreitas */
@media (pointer: coarse), (max-width: 760px) {
  button, .btn, input:not([type=checkbox]), select, .side a { min-height: 44px; }
  button.small, .btn.small { min-height: 44px; padding: 0 var(--s3); }
  input[type=checkbox] { width: 22px; height: 22px; }
  .tabs button { min-height: 44px; }
  .composer textarea { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* configurações */
.options { display: grid; gap: 0; border-top: 1px solid var(--line); max-width: 640px; }
.option { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.option input { width: 18px; min-height: 0; }
.option .icon { color: var(--muted); }
.option b { display: block; }
progress { width: 100%; min-width: 90px; height: 8px; accent-color: var(--brand); }

/* comunicador */
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius); background: var(--brand); color: var(--brand-text); font-size: var(--t-xs); font-weight: 600; font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.side a .count { margin-left: auto; background: var(--side-accent); color: #10201f; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: var(--radius); background: var(--brand); color: var(--brand-text); font-weight: 600; font-size: var(--t-sm); flex: 0 0 auto; }
.avatar.group { background: var(--sunk); color: var(--text); border: 1px solid var(--line-strong); }
.chat { display: grid; grid-template-columns: 340px minmax(0, 1fr); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); height: calc(100vh - 200px); min-height: 460px; overflow: hidden; }
.chat-items { display: flex; flex-direction: column; overflow-y: auto; border-right: 1px solid var(--line); min-height: 0; }
.chat-search { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 1; }
.chat-search input { border: 0; min-height: 28px; padding: 0; background: transparent; }
.chat-search input:focus-visible { outline: none; }
.chat-search:focus-within { outline: 2px solid var(--focus); outline-offset: -2px; }
.chat-item { display: flex; gap: var(--s3); padding: var(--s3); border-bottom: 1px solid var(--line); border-left: 3px solid transparent; color: var(--text); text-decoration: none; }
.chat-item:hover { background: var(--sunk); }
.chat-item.active { background: var(--sunk); border-left-color: var(--brand); }
.chat-item-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.chat-item-top, .chat-item-bottom { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s2); min-width: 0; }
.chat-item-bottom { align-items: center; }
.chat-thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-blank { align-items: center; justify-content: center; background: var(--bg); }
.chat-blank .empty { border: 0; }
.thread-head { display: flex; align-items: center; gap: var(--s3); padding: var(--s3); border-bottom: 1px solid var(--line); }
.thread-head .back { display: none; }
.thread-body { flex: 1; overflow-y: auto; padding: var(--s4); display: flex; flex-direction: column; gap: var(--s2); background: var(--bg); min-height: 0; }
.day { align-self: center; font-size: var(--t-xs); color: var(--muted); background: var(--sunk); padding: 2px var(--s3); border-radius: var(--radius); margin: var(--s2) 0; }
.msg { max-width: min(560px, 80%); padding: 6px var(--s3); border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); overflow-wrap: anywhere; }
.msg.mine { align-self: flex-end; background: var(--brand); color: var(--brand-text); border-color: var(--brand); }
.msg .who { font-size: var(--t-xs); font-weight: 600; color: var(--accent); }
.msg .body { white-space: pre-wrap; }
.msg .meta { display: flex; justify-content: flex-end; gap: var(--s2); font-size: var(--t-xs); font-variant-numeric: tabular-nums; }
.msg.theirs .meta { color: var(--muted); }
.attach-wrap { display: flex; gap: var(--s2); align-items: stretch; }
.attach-wrap .attach { flex: 1; min-width: 0; }
.msg .attach.view { flex: 0 0 44px; width: 44px; padding: 0; justify-content: center; }
.preview-img { display: block; max-width: 100%; max-height: 70vh; margin: 0 auto; object-fit: contain; background: var(--sunk); }
.msg .attach { display: flex; align-items: center; gap: var(--s2); width: 100%; min-height: 44px; padding: var(--s2); margin: 2px 0; border: 1px solid currentColor; border-radius: var(--radius); background: transparent; color: inherit; text-align: left; font-weight: 400; cursor: pointer; justify-content: flex-start; }
.msg .attach:hover { background: rgb(128 128 128 / 0.14); }
.msg .attach .name { display: flex; flex-direction: column; min-width: 0; }
.msg .attach .name b { overflow-wrap: anywhere; font-weight: 600; }
.msg .attach .name span { font-size: var(--t-xs); opacity: 0.85; }
.pending { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s3); border-top: 1px solid var(--line); background: var(--sunk); font-size: var(--t-sm); }
.pending b { overflow-wrap: anywhere; }
.pending .spacer { flex: 1; }
label.check { display: flex; align-items: center; gap: var(--s2); min-height: 44px; cursor: pointer; color: var(--text); font-size: var(--t-sm); }
label.check input { width: 20px; height: 20px; flex: 0 0 auto; }
.composer { display: flex; gap: var(--s2); align-items: flex-end; padding: var(--s3); border-top: 1px solid var(--line); }
.composer textarea { min-height: 40px; resize: none; }
.contacts { list-style: none; margin: var(--s2) 0 0; padding: 0; max-height: 46vh; overflow-y: auto; border-top: 1px solid var(--line); }
.contact { display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: 48px; padding: var(--s2) var(--s1); border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; text-align: left; font-weight: 400; cursor: pointer; justify-content: flex-start; color: var(--text); }
.contact:hover { background: var(--sunk); }
.contact span:last-child { display: flex; flex-direction: column; }
@media (max-width: 760px) {
  .chat { grid-template-columns: minmax(0, 1fr); height: calc(100dvh - 250px); min-height: 380px; }
  .chat-page.thread-open > .toolbar { display: none; }
  .chat-page.thread-open .chat { height: calc(100dvh - 190px); }
  .chat.thread-open .chat-items { display: none; }
  .chat:not(.thread-open) .chat-thread { display: none; }
  .thread-head .back { display: inline-flex; }
  .msg { max-width: 90%; }
  .composer textarea { min-height: 44px; }
}

.row-actions { display: flex; flex-wrap: wrap; gap: var(--s1); justify-content: flex-end; min-width: 120px; }

/* anexos de solicitações e confirmação de leitura */
ul.files { list-style: none; margin: var(--s2) 0; padding: 0; display: flex; flex-direction: column; gap: var(--s1); }
ul.files li { display: flex; align-items: center; gap: var(--s2); min-height: 44px; padding: var(--s1) var(--s2); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
ul.files li .ellipsis { flex: 1; min-width: 0; }
.attach-box { display: flex; flex-direction: column; gap: var(--s2); align-items: flex-start; margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--line); }
.ack { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-top: var(--s2); }
.ack.ok { color: var(--ok); gap: var(--s2); }

/* DRE mês a mês: 14 colunas, números compactos e rolagem horizontal só na tabela */
table.monthly { font-size: var(--t-sm); }
table.monthly th, table.monthly td { white-space: nowrap; padding: var(--s1) var(--s2); }
table.monthly td:first-child, table.monthly th:first-child { position: sticky; left: 0; background: var(--panel); min-width: 220px; white-space: normal; }
@media (max-width: 760px) { table.monthly td:first-child, table.monthly th:first-child { min-width: 150px; max-width: 150px; font-size: var(--t-xs); } }

/* duas colunas em formulários largos; uma só no celular */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; column-gap: var(--s4); }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }
.ret-days { width: 7rem; }
.ident { display: grid; gap: var(--s2); max-width: 760px; }
.ident-logo { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }

/* ---- console técnico da plataforma (provedor): mais denso, números em fonte de código ---- */
.tech .grid { margin-bottom: var(--s4); }
.tech .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tech table td, .tech table th { padding: var(--s1) var(--s3); font-size: var(--t-sm); }
.tech h4 { margin: var(--s4) 0 var(--s2); font-size: var(--t-sm); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stat .sub { order: 2; font-size: var(--t-sm); color: var(--muted); }
.tech .panel { margin-bottom: var(--s4); }
.tone-bad { color: var(--bad); }
.tone-warn { color: var(--warn); }
.tone-ok { color: var(--ok); }
.cols2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: var(--s4); margin-bottom: var(--s4); }
.bars { width: 100%; height: auto; max-height: 170px; display: block; }
.bar { fill: var(--brand); }
.bar-l { font: 10px var(--font-mono); fill: var(--muted); }
.raio { margin-top: var(--s5); margin-bottom: var(--s5); border-left: 3px solid var(--brand); padding-left: var(--s4); }
.switch { display: inline-flex; align-items: center; gap: var(--s2); cursor: pointer; min-height: 32px; }
.switch input { width: 18px; height: 18px; accent-color: var(--brand); }
.modhelp { margin-top: var(--s3); padding-left: var(--s4); }
.modrow { display: flex; align-items: flex-start; gap: var(--s3); padding: var(--s2) 0; border-top: 1px solid var(--line); width: 100%; }
.modrow .block { display: block; }

.how { margin-top: 2px; max-width: 70ch; }
