/* 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 { display: flex; align-items: center; justify-content: space-between; width: calc(100% - var(--s2)); margin: var(--s3) var(--s1) var(--s1); padding: var(--s1) var(--s2); background: none; border: 0; border-radius: var(--radius); font: inherit; font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--side-muted); cursor: pointer; text-align: left; }
.side .group:hover { background: var(--side-hover); color: var(--side-text); }
.side .group .icon { width: 14px; height: 14px; transition: transform .15s; }
.side .group[aria-expanded="false"] .icon { transform: rotate(-90deg); }
@media (prefers-reduced-motion: reduce) { .side .group .icon { transition: none; } }
.side a[hidden] { display: none; }
.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); }
  .side a.favlink, .side a.favlink[hidden] { display: none; }                          /* a faixa do celular já lista as telas: favoritos não repetem */
  .side a[hidden] { display: flex; }                         /* no celular o menu é uma faixa sem grupos: nada fica recolhido */
  .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; }

/* agenda de obrigações */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); margin: var(--s2) 0; }
.cal-head { background: var(--sunk); padding: var(--s1) var(--s2); font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.cal-empty { background: var(--sunk); min-height: 56px; }
.cal-day { display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: var(--s1); min-height: 56px; padding: var(--s1) var(--s2); background: var(--panel); border: 0; border-radius: 0; color: var(--text); text-align: left; cursor: pointer; }
.cal-day:hover { background: var(--sunk); }
.cal-day.today b { color: var(--brand); text-decoration: underline; }
.cal-day.sel { outline: 2px solid var(--brand); outline-offset: -2px; }
.cal-marks { display: flex; flex-wrap: wrap; gap: var(--s1); }
.mk { font-style: normal; font-size: var(--t-xs); font-variant-numeric: tabular-nums; padding: 0 var(--s1); border-radius: var(--radius); }
.mk.bad { background: var(--bad-bg); color: var(--bad); }
.mk.warn { background: var(--warn-bg); color: var(--warn); }
.mk.ok { background: var(--ok-bg); color: var(--ok); }
.bad-text { color: var(--bad); }
@media (max-width: 760px) { .cal-day { min-height: 44px; } }

/* busca global, favoritos */
.search-open { display: inline-flex; align-items: center; gap: var(--s2); color: var(--muted); }
.search-open kbd, .palette kbd { font: inherit; font-size: var(--t-xs); padding: 0 var(--s1); border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--sunk); color: var(--muted); }
.fav[aria-pressed="true"] .icon { fill: var(--accent); color: var(--accent); }
.palette-overlay { position: fixed; inset: 0; z-index: 50; background: var(--overlay); display: flex; justify-content: center; align-items: flex-start; padding: 10vh var(--s3) var(--s3); }
.palette { width: 100%; max-width: 640px; max-height: 76vh; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--elev); }
.palette-bar { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); }
.palette-input { flex: 1; min-width: 0; border: 0; background: none; font-size: var(--t-md); color: var(--text); outline: none; padding: var(--s2) 0; }
.palette-list { overflow-y: auto; padding: var(--s1) 0; }
.palette-group { padding: var(--s2) var(--s4) var(--s1); font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.palette-item { display: flex; align-items: center; justify-content: flex-start; gap: var(--s3); width: 100%; padding: var(--s2) var(--s4); border: 0; border-left: 3px solid transparent; border-radius: 0; background: none; color: var(--text); text-align: left; cursor: pointer; min-height: 44px; }
.palette-item.active { background: var(--sunk); border-left-color: var(--brand); }
.palette-label { display: flex; flex-direction: column; min-width: 0; }
.palette-label .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-foot { display: flex; gap: var(--s4); flex-wrap: wrap; padding: var(--s2) var(--s4); border-top: 1px solid var(--line); }
@media (max-width: 760px) { .search-open kbd, .palette-foot { display: none; } .palette-overlay { padding-top: var(--s3); } }

.tablewrap select.small { min-width: 190px; max-width: 280px; }

/* painel por perfil: gráficos em SVG, barras de proporção e divisão em colunas */
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s5); align-items: start; }
@media (max-width: 980px) { .split { grid-template-columns: minmax(0, 1fr); } }
.chart { margin: 0; }
.chart-svg { width: 100%; height: auto; display: block; }
.ch-grid { stroke: var(--line); stroke-width: 1; }
.ch-t { fill: var(--muted); font-size: 11px; font-family: var(--font-text); font-variant-numeric: tabular-nums; }
.ch-s0 { fill: var(--brand); background: var(--brand); }
.ch-s1 { fill: var(--accent); background: var(--accent); }
.chart-legend { display: flex; gap: var(--s4); margin-top: var(--s1); }
.sw { display: inline-block; width: 10px; height: 10px; margin-right: var(--s1); border-radius: 2px; vertical-align: baseline; }
.chart-table { margin-top: var(--s2); }
.chart-table summary { cursor: pointer; color: var(--muted); }
.chart-table table { margin-top: var(--s2); }
.hbars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s3); }
.hbar-head { display: flex; justify-content: space-between; gap: var(--s3); }
.hbar { display: block; width: 100%; height: 6px; margin-top: var(--s1); }
.hbar-bg { fill: var(--sunk); background: var(--sunk); }
.hbar-fill { fill: var(--brand); }
.progress { display: flex; align-items: center; gap: var(--s3); margin: var(--s2) 0 var(--s3); }
.progress svg { flex: 1; height: 8px; }
.stack { display: block; width: 100%; height: 10px; }
.st-ok { fill: var(--ok); background: var(--ok); }
.st-bad { fill: var(--bad); background: var(--bad); }
.st-warn { fill: var(--warn); background: var(--warn); }
.st-off { fill: var(--line-strong); background: var(--line-strong); }
.legend { list-style: none; margin: var(--s2) 0 var(--s3); padding: 0; display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); }
.chart-svg { max-width: 760px; }
.stat.md b { font-size: var(--t-xl); }

/* painel de conciliação bancária */
.bank-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--s4); margin: var(--s3) 0 var(--s5); }
.bank-acct { display: flex; flex-direction: column; align-items: stretch; gap: var(--s2); padding: var(--s3) var(--s4); text-align: left; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-left: 3px solid var(--line-strong); border-radius: var(--radius); cursor: pointer; height: auto; }
.bank-acct.warn { border-left-color: var(--accent); }
.bank-acct[aria-pressed="true"] { outline: 2px solid var(--brand); outline-offset: -2px; }
.bank-acct:hover { background: var(--sunk); }
.bank-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); }
.bank-kv { margin: var(--s1) 0; }
.ok-text { color: var(--ok); }
.toolbar select, .toolbar input[type="search"] { width: auto; min-width: 200px; max-width: 320px; }
.ch-s2 { fill: var(--ok); background: var(--ok); }
.seg { display: inline-flex; }
.seg button { border-radius: 0; }
.seg button:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.seg button:last-child { border-radius: 0 var(--radius) var(--radius) 0; margin-left: -1px; }
.seg button[aria-pressed="true"] { background: var(--brand); color: var(--brand-text); border-color: var(--brand); }
.indent { display: inline-block; padding-left: var(--s5); }
.toolbar > .field { flex: 0 0 auto; }
.toolbar .seg { flex: none; align-self: flex-end; }
.journal-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s1); }
.journal td { vertical-align: top; }

/* aviso de vencimentos: faixa no topo e etiqueta na barra superior */
.fiscal-banner { display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s5); background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid var(--warn); }
.fiscal-banner p { margin: 0; flex: 1; }
.fiscal-banner b { font-weight: 600; }
.fiscal-chip { display: inline-flex; align-items: center; gap: var(--s2); padding: 0 var(--s3); min-height: var(--control); border: 1px solid var(--warn); border-radius: var(--radius); background: var(--warn-bg); color: var(--warn); text-decoration: none; font-size: var(--t-sm); }
.fiscal-chip.bad { border-color: var(--bad); background: var(--bad-bg); color: var(--bad); }
@media (max-width: 760px) { .fiscal-banner { flex-wrap: wrap; padding: var(--s2) var(--s3); } }

/* fluxo de caixa projetado */
.fc-in { fill: var(--ok); background: var(--ok); }
.fc-out { fill: var(--info); background: var(--info); }
.fc-tax { fill: var(--accent); background: var(--accent); }
.fc-line { stroke: var(--text); stroke-width: 2; }
.fc-dot { fill: var(--text); }
.fc-line-sw { background: var(--text); height: 3px; vertical-align: middle; }
.chart-svg.wide { max-width: 100%; }
.month-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--s4); margin: var(--s3) 0 var(--s5); }
.month-card { display: flex; flex-direction: column; align-items: stretch; gap: var(--s2); padding: var(--s3) var(--s4); text-align: left; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-left: 3px solid var(--line-strong); border-radius: var(--radius); cursor: pointer; height: auto; }
.month-card:hover { background: var(--sunk); }
.month-card.sel { border-left-color: var(--brand); outline: 2px solid var(--brand); outline-offset: -2px; }
.month-final { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--line); padding-top: var(--s2); }
.money-in { width: 140px; text-align: right; }
.chart-svg.wide { max-width: 900px; }
.month-card .kv, .bank-acct .kv { grid-template-columns: minmax(0, 1fr) auto; gap: var(--s1) var(--s3); }
.month-card .kv dd, .bank-acct .kv dd { margin: 0; text-align: right; }
.month-card .kv dt, .bank-acct .kv dt { margin: 0; }
.chart-svg rect.ch-neg { fill: var(--bad); }

/* relatórios oficiais: a folha é sempre "papel" (fundo branco), também no tema escuro */
.official-sheet { background: #fff; color: #14201d; border: 1px solid var(--line-strong); padding: var(--s6); max-width: 900px; margin: var(--s4) auto; font-size: 13px; }
.official-sheet header { text-align: center; border-bottom: 2px solid #14201d; margin-bottom: var(--s4); padding-bottom: var(--s3); }
.official-sheet h2 { font-family: var(--font-title); font-size: 1.15rem; letter-spacing: .04em; margin: 0 0 var(--s1); }
.official-sheet h3 { font-family: var(--font-title); font-size: 1rem; color: #0e4f55; margin: var(--s3) 0 0; text-transform: uppercase; }
.official-sheet h4 { display: flex; justify-content: space-between; margin: 0 0 var(--s2); padding: var(--s2) var(--s3); background: #ebe7db; }
.official-sheet p { margin: var(--s1) 0; }
.official-sheet .muted, .official-sheet .small.mono { color: #566059; }
.official-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.official-table th, .official-table td { border: 1px solid #b9b2a0; padding: 3px var(--s2); background: #fff; color: #14201d; }
.official-table th { background: #ebe7db; color: #14201d; }
.official-table .lvl2 { padding-left: var(--s3); } .official-table .lvl3 { padding-left: var(--s5); } .official-table .lvl4 { padding-left: var(--s6); } .official-table .lvl5 { padding-left: 40px; }
.official-total td, .official-total { font-weight: 600; background: #e6f1ec; border-top: 2px solid #14201d; }
.official-line { display: flex; justify-content: space-between; gap: var(--s3); padding: 2px var(--s3); }
p.official-total { padding: var(--s2) var(--s3); }
.official-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
.official-months { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s2); margin: var(--s3) 0; }
.official-months > div { border: 1px solid #b9b2a0; padding: var(--s2) var(--s3); display: flex; flex-direction: column; }
.official-sign { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s6); margin-top: var(--s6); text-align: center; }
.official-sign > div { display: flex; flex-direction: column; gap: 2px; }
.sign-line { display: block; border-top: 1px solid #14201d; margin: var(--s6) auto var(--s2); width: 80%; }
.official-sheet footer { margin-top: var(--s4); padding-top: var(--s2); border-top: 1px solid #b9b2a0; font-size: 11px; word-break: break-all; }
.official-preview { text-align: center; background: #f6e8c6; color: #7d5200; border: 1px solid #7d5200; padding: var(--s2); font-weight: 600; }
@media (max-width: 760px) { .official-cols, .official-sign { grid-template-columns: minmax(0, 1fr); } .official-months { grid-template-columns: repeat(2, minmax(0, 1fr)); } .official-sheet { padding: var(--s3); } }
@media print { .official-sheet { border: 0; padding: 0; margin: 0; max-width: none; } .fiscal-banner, .fiscal-chip, .search-open, .fav { display: none !important; } }

/* Painel do RH: fila de solicitações */
.req-list { display: grid; gap: 0; border-top: 1px solid var(--line); }
.req-card { padding: var(--s3) 0; border-bottom: 1px solid var(--line); }
.req-card.open { border-left: 3px solid var(--warn); padding-left: var(--s3); }
.req-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); flex-wrap: wrap; }
.req-card p { margin: var(--s1) 0 0; }
.req-reply { color: var(--muted); }
.req-actions { display: flex; justify-content: flex-end; gap: var(--s2); margin-top: var(--s2); }
.tech .stat.warn b { color: var(--warn); }
.tech .stat.ok b { color: var(--ok); }

.row-actions { display: flex; flex-direction: column; align-items: stretch; gap: var(--s1); min-width: 120px; }
.req-head .mono { font-size: var(--t-xs); }

/* Portal do colaborador: Minhas férias */
.vac-panel { margin-bottom: var(--s5); }
.vac-grid { margin-bottom: var(--s3); }
.vac-grid .stat b.small-num { font-size: var(--t-lg); }
.vac-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin-top: var(--s2); }

/* Avisos do RH */
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s3); }
.chip { display: inline-flex; align-items: center; gap: var(--s2); min-height: 44px; padding: 0 var(--s3); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); font: inherit; cursor: pointer; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip-n { font-variant-numeric: tabular-nums; font-size: var(--t-xs); font-weight: 600; opacity: .8; }
.kind { display: inline-flex; align-items: center; gap: var(--s2); font-weight: 600; }

/* Conformidade fiscal */
.fiscal-kpis .stat.ok b { color: var(--ok); }
.fiscal-kpis .stat.warn b { color: var(--warn); }
.fiscal-kpis .stat.bad b { color: var(--bad); }
.toolbar .chips { margin-bottom: 0; }

/* Gestão financeira */
.fin-kpis .stat.bad b { color: var(--bad); }
.cols3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--s5); margin-bottom: var(--s4); }
.kv-list { margin: 0; }
.kv-list .kv-row { display: grid; grid-template-columns: 1fr auto; gap: 2px var(--s3); padding: var(--s2) 0; border-bottom: 1px solid var(--line); }
.kv-list dt { color: var(--muted); font-size: var(--t-sm); }
.kv-list dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.kv-list .note { grid-column: 1 / -1; }
.hbar-fill.normal { fill: var(--ok); }
.hbar-fill.alerta { fill: var(--warn); }
.hbar-fill.estourado { fill: var(--bad); }
td svg.hbar { width: 120px; height: 6px; display: block; margin-bottom: 2px; }

/* Arquivos */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1); min-height: 44px; }
.crumbs .link { padding: 0; }
.drive-quota { display: flex; align-items: center; gap: var(--s3); margin: 0 0 var(--s3); }
.drive-quota svg.hbar { width: 160px; height: 6px; flex: 0 0 auto; }
.kind.link { display: inline-flex; align-items: center; gap: var(--s2); font-weight: 600; text-align: left; }

/* Notas fiscais: importação à esquerda, demais telas à direita, numa faixa só */
.notas-bar { display: flex; flex-wrap: wrap; gap: var(--s4); align-items: flex-start; justify-content: space-between; padding-bottom: var(--s3); margin-bottom: var(--s4); border-bottom: 1px solid var(--line); }
.import-group .field { flex: 0 0 200px; }
.import-group .hint { max-width: 75ch; }
.notas-tools { display: flex; flex-wrap: wrap; gap: var(--s2); justify-content: flex-end; align-self: flex-end; }
@media (max-width: 760px) { .notas-tools { justify-content: flex-start; } }

/* Varredura de alinhamento (2026-11): ações do topo que quebram de linha, números lado a lado que não passam da tela, campos de barra que encolhem no celular */
.page-actions { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.figures { flex-wrap: wrap; row-gap: var(--s3); }
.toolbar > .field, .row > .field { max-width: 100%; }
.toolbar select, .row select { max-width: min(320px, 100%); }
.official-scroll { overflow-x: auto; }
@media print { .official-scroll { overflow: visible; } }
@media (max-width: 760px) {
  .seg { flex-wrap: wrap; max-width: 100%; gap: var(--s1); }
  .seg button, .seg button:first-child, .seg button:last-child { border-radius: var(--radius); margin-left: 0; }
}

/* Pedidos de documento: o título ganha largura; os botões quebram de linha em vez de empurrar a tabela */
.pedidos td:first-child { min-width: 15rem; }
.pedido-acoes { justify-content: flex-end; min-width: 11rem; }
.pedidos ul.files { margin: 0; padding: 0; list-style: none; }

/* Árvore organizacional (Cadastros > Organizações): provedor > escritórios > empresas */
ul.orgtree { list-style: none; margin: 0; padding: 0; }
ul.orgtree ul.orgtree { margin-left: var(--s5); border-left: 1px solid var(--line); padding-left: var(--s2); }
ul.orgtree.root { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: var(--s2) var(--s3); }
.orgrow { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; min-height: 40px; padding: var(--s1) 0; border-bottom: 1px solid var(--line); }
li:last-child > .orgrow { border-bottom: 0; }
.orgrow.off .orgname { text-decoration: line-through; color: var(--muted); }
.orgrow.provider .orgname { font: 600 var(--t-lg, 1.15rem) var(--font-title, inherit); }
.orgrow.firm .orgname { font-weight: 600; }
.orgtoggle { width: 28px; min-height: 28px; padding: 0; flex: none; }
span.orgtoggle { display: inline-block; border: 0; background: none; }
li[aria-expanded="false"] > .orgrow .orgtoggle .icon { transform: rotate(-90deg); }          /* o ícone base aponta para baixo (aberto) */
.badge.kind-provider { background: var(--brand); color: var(--brand-text); }
.badge.kind-firm { background: var(--warn-bg); color: var(--warn); }
.orgsum { margin-left: var(--s2); }
.orgrow .spacer { flex: 1; }
.orgempty { margin: 0 0 var(--s2) var(--s6); }
@media (prefers-reduced-motion: no-preference) { .orgtoggle .icon { transition: transform .12s; } }

/* Seletor de empresa: escritório da empresa escolhida ao lado */
.topbar .company-firm { margin-left: var(--s2); white-space: nowrap; max-width: 20rem; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1500px) { .topbar .company-firm { display: none; } }          /* em telas menores a barra não cabe: o escritório continua no agrupamento da lista */

/* Ver como: faixa fixa no topo enquanto o administrador do provedor vê o sistema como outra pessoa */
.viewas-bar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; padding: var(--s2) var(--s4);
  background: var(--warn-bg); color: var(--warn); border-bottom: 2px solid var(--warn); font-weight: 500; }

.company-picker { display: inline-flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.company-picker select.company { max-width: 22rem; }

/* ---- Jurídico: formulário em colunas, tarefas em quadro e identidade por escritório ---- */
.formgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3) var(--s4); }
.formgrid .field { min-width: 0; }
.formgrid .field.full { grid-column: 1 / -1; }
.modal .actions .grow { flex: 1; }
button.danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s3); align-items: start; }
.board .col { background: var(--sunk); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s2); min-height: 120px; }
.board .col h3 { display: flex; justify-content: space-between; margin: var(--s1) var(--s1) var(--s2); font-size: var(--t-sm); }
.tcard { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--info); border-radius: var(--radius); padding: var(--s2) var(--s3); margin-bottom: var(--s2); }
.tcard.alta { border-left-color: var(--bad); } .tcard.baixa { border-left-color: var(--line-strong); }
.tcard .t { font-weight: 600; cursor: pointer; overflow-wrap: anywhere; }
.tcard .meta { font-size: var(--t-sm); color: var(--muted); margin: var(--s1) 0 var(--s2); }
.tcard .mv { display: flex; justify-content: space-between; }
.daybar { font-weight: 600; background: var(--sunk); padding: var(--s1) var(--s3); margin-top: var(--s3); border: 1px solid var(--line); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; }
.notes { list-style: none; padding: 0; margin: 0 0 var(--s4); }
.notes li { padding: var(--s2) 0; border-top: 1px solid var(--line); }
.notes p { margin: 2px 0 0; white-space: pre-wrap; }
.dl { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: var(--s1) var(--s4); margin: var(--s3) 0 var(--s4); }
.dl dt { color: var(--muted); font-size: var(--t-sm); } .dl dd { margin: 0; overflow-wrap: anywhere; }
.logo-preview { max-height: 64px; max-width: 220px; border: 1px solid var(--line); padding: 4px; background: #fff; }
.foot-firm { padding: var(--s4) var(--s5); color: var(--muted); font-size: var(--t-sm); border-top: 1px solid var(--line); text-align: center; }
@media (max-width: 800px) { .formgrid, .board { grid-template-columns: minmax(0, 1fr); } .dl { grid-template-columns: minmax(0, 1fr); } }

/* cor do escritório: o tema do produto continua o mesmo, só a cor de destaque e o menu lateral mudam */
:root[data-firm] { --brand: var(--firm); --brand-hover: color-mix(in srgb, var(--firm) 80%, #000); --focus: var(--firm);
  --side-bg: color-mix(in srgb, var(--firm) 38%, #000); --side-hover: color-mix(in srgb, var(--firm) 48%, #000); --side-active: color-mix(in srgb, var(--firm) 58%, #000);
  --entrada-bg: color-mix(in srgb, var(--firm) 38%, #000); --entrada-line: color-mix(in srgb, var(--firm) 55%, #000); }
@media (prefers-color-scheme: dark) { :root[data-firm]:not([data-theme="light"]) { --brand: color-mix(in srgb, var(--firm) 55%, #fff); --brand-hover: color-mix(in srgb, var(--firm) 70%, #fff); --focus: color-mix(in srgb, var(--firm) 55%, #fff); } }
:root[data-firm][data-theme="dark"] { --brand: color-mix(in srgb, var(--firm) 55%, #fff); --brand-hover: color-mix(in srgb, var(--firm) 70%, #fff); --focus: color-mix(in srgb, var(--firm) 55%, #fff); }
.side .group-label { text-transform: uppercase; letter-spacing: .08em; font-size: var(--t-xs); color: var(--side-muted); margin: var(--s4) var(--s3) var(--s1); }
.narrowform { max-width: 620px; }
@media (max-width: 800px) { .side .group-label { display: none; } }
