/* ERP HUB Projetos: mesmo desenho do Click Hub e do CRM (trilho preto, árvore, área de trabalho). Fonte do sistema. */
:root {
  --ink: #0A0A0A; --paper: #FFFFFF; --bg: #FFFFFF; --surface: #F7F8F9; --surface-2: #EEF0F3; --line: #E8EAED; --line-strong: #D5D8DD;
  --text: #292D34; --muted: #656F7D; --faint: #9AA1AB; --focus: #2E3192; --link: #1F6FEB;
  --tree-bg: #FAFBFC; --tree-hover: #F0F1F3; --tree-on: #E9EBEF; --rail-bg: #0A0A0A; --rail-text: #F2F2F0; --rail-muted: #8F8F8A; --rail-hover: #1C1C1C; --rail-on: #262626;
  --shadow-md: 0 4px 12px rgba(16, 24, 40, .08), 0 1px 3px rgba(16, 24, 40, .06); --shadow-lg: 0 16px 48px rgba(16, 24, 40, .18), 0 2px 8px rgba(16, 24, 40, .08);
  --amb-a: #6CBE45; --amb-b: #00A99D; --arq-a: #2E3192; --arq-b: #F15A3A;
  --tc-laranja: #E8590C; --tc-roxo: #7048E8; --tc-rosa: #D6336C; --tc-azul: #1C7ED6;
  --s-ok: #1B7A47; --s-warn: #8A5A00; --s-crit: #C0281C; --s-info: #2450B8; --s-neutral: #6B6B66;
  --danger: #D93A2B; --mock: #FFF6DB; --mock-text: #6B4E00; --scroll: #CDD1D6;
  --f-body: -apple-system, system-ui, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --r: 6px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1E1F21; --surface: #25262A; --surface-2: #2E3035; --line: #34363B; --line-strong: #464950;
    --text: #E6E7E9; --muted: #A2A7AF; --faint: #757B84; --focus: #8C90F0; --link: #6EA8FE;
    --tree-bg: #1A1B1D; --tree-hover: #26282C; --tree-on: #2F3136; --rail-bg: #000000; --rail-hover: #161616; --rail-on: #222;
    --shadow-md: 0 4px 14px rgba(0, 0, 0, .45); --shadow-lg: 0 18px 50px rgba(0, 0, 0, .6);
    --tc-laranja: #FF922B; --tc-roxo: #9775FA; --tc-rosa: #F06595; --tc-azul: #4DABF7;
    --s-ok: #4CC98A; --s-warn: #E8B04A; --s-crit: #FF7B6E; --s-info: #7DA2FF; --s-neutral: #A6A6A0;
    --danger: #FF6A5C; --mock: #3A3015; --mock-text: #F3D98A; --scroll: #45484E; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1E1F21; --surface: #25262A; --surface-2: #2E3035; --line: #34363B; --line-strong: #464950;
  --text: #E6E7E9; --muted: #A2A7AF; --faint: #757B84; --focus: #8C90F0; --link: #6EA8FE;
  --tree-bg: #1A1B1D; --tree-hover: #26282C; --tree-on: #2F3136; --rail-bg: #000000; --rail-hover: #161616; --rail-on: #222;
  --shadow-md: 0 4px 14px rgba(0, 0, 0, .45); --shadow-lg: 0 18px 50px rgba(0, 0, 0, .6);
  --tc-laranja: #FF922B; --tc-roxo: #9775FA; --tc-rosa: #F06595; --tc-azul: #4DABF7;
  --s-ok: #4CC98A; --s-warn: #E8B04A; --s-crit: #FF7B6E; --s-info: #7DA2FF; --s-neutral: #A6A6A0;
  --danger: #FF6A5C; --mock: #3A3015; --mock-text: #F3D98A; --scroll: #45484E; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--f-body); font-size: 14px; line-height: 1.45; display: flex; flex-direction: column; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; text-align: left; }
a { color: var(--link); text-decoration: none; } a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: 22px; line-height: 1.2; } h2 { font-size: 16px; line-height: 1.3; } h3 { font-size: 14px; }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.eyebrow { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }

/* faixa do mockup (fora do app) */
.mockbar { flex: none; display: flex; align-items: center; gap: 10px; padding: 6px max(16px, env(safe-area-inset-right, 0px)) 6px max(16px, env(safe-area-inset-left, 0px)); background: var(--mock); color: var(--mock-text); font-size: 12.5px; }
.mockbar b { font-weight: 650; }
.mockbar .sp { flex: 1; }
.mockbar button { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--mock-text) 35%, transparent); font-size: 12px; font-weight: 600; }
.mockbar button.on { background: var(--mock-text); color: var(--mock); }

/* estrutura */
.app { flex: 1; min-height: 0; display: grid; grid-template-columns: 64px 236px minmax(0, 1fr); }
.app.com-notas { grid-template-columns: 64px 236px minmax(0, 1fr) 340px; }
.rail { background: var(--rail-bg); color: var(--rail-text); display: flex; flex-direction: column; align-items: center; padding: 12px 0; gap: 3px; overflow-y: auto; }
.rail .mark { width: 38px; color: #fff; margin-bottom: 4px; } .rail .mark svg { width: 38px; height: 18px; display: block; }
.rail .app-n { font-size: 9.5px; letter-spacing: .14em; color: var(--rail-muted); margin-bottom: 10px; font-weight: 700; }
.rail-btn { width: 56px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 0; border-radius: var(--r); color: var(--rail-muted); font-size: 10.5px; position: relative; text-align: center; line-height: 1.15; }
.rail-btn svg { width: 19px; height: 19px; }
.rail-btn:hover { background: var(--rail-hover); color: var(--rail-text); }
.rail-btn.on { background: var(--rail-on); color: #fff; }
.rail-btn .dot { position: absolute; top: 2px; right: 7px; background: var(--danger); color: #fff; border-radius: 8px; font-size: 10.5px; line-height: 15px; min-width: 15px; padding: 0 4px; font-weight: 700; }
.rail .spacer { flex: 1; }

.tree { background: var(--tree-bg); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; overflow-y: auto; padding: 14px 10px 20px; gap: 14px; }
.tree-t { font-size: 15px; font-weight: 650; padding: 0 6px; }
.tree-g { display: flex; flex-direction: column; gap: 1px; }
.tree-g .eyebrow { padding: 4px 6px 4px; font-size: 10.5px; }
.ti { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--r); color: var(--text); font-size: 13.5px; text-decoration: none; }
.ti:hover { background: var(--tree-hover); text-decoration: none; }
.ti.on { background: var(--tree-on); font-weight: 600; }
.ti svg { color: var(--muted); width: 15px; height: 15px; }
.ti .n { margin-left: auto; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ti .n.alerta { color: #fff; background: var(--danger); border-radius: 8px; padding: 0 6px; font-weight: 700; }

.main { min-width: 0; min-height: 0; overflow-y: auto; background: var(--bg); }
.page { padding: 18px 24px 56px; display: flex; flex-direction: column; gap: 18px; max-width: 1320px; }
.page-h { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.page-h .t { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 4px; }
.page-h .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.crumb { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.crumb a { color: var(--muted); }

/* controles */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--bg); font-weight: 500; font-size: 13px; white-space: nowrap; }
.btn:hover { background: var(--surface); }
.btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.primary:hover { opacity: .9; }
:root[data-theme="dark"] .btn.primary { background: #F2F2F0; color: #111; border-color: #F2F2F0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { background: #F2F2F0; color: #111; border-color: #F2F2F0; } }
.btn.ok { background: var(--s-ok); border-color: var(--s-ok); color: #fff; }
.btn.sm { padding: 3px 9px; font-size: 12.5px; }
.btn.ghost { border-color: transparent; }
.btn svg { width: 14px; height: 14px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r); overflow: hidden; }
.seg button { padding: 5px 11px; font-size: 12.5px; border-right: 1px solid var(--line-strong); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--surface-2); font-weight: 650; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 3px 10px; border-radius: 12px; border: 1px solid var(--line-strong); font-size: 12.5px; color: var(--muted); }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip .n { font-variant-numeric: tabular-nums; margin-left: 4px; opacity: .8; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); font-weight: 500; min-width: 0; }
input.in, select.in, textarea.in { width: 100%; padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--bg); font-size: 13.5px; color: var(--text); }
textarea.in { resize: vertical; min-height: 70px; line-height: 1.45; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

/* selos */
.pill { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px; border-radius: 10px; font-size: 11.5px; font-weight: 600; white-space: nowrap; --c: var(--s-info); color: var(--c); background: color-mix(in srgb, var(--c) 12%, var(--bg)); }
.pill svg { width: 12px; height: 12px; }
.pill.ok { --c: var(--s-ok); } .pill.warn { --c: var(--s-warn); } .pill.crit { --c: var(--s-crit); } .pill.neutral { --c: var(--s-neutral); } .pill.info { --c: var(--s-info); }
.pill.dash { background: transparent; border: 1px dashed color-mix(in srgb, var(--c) 60%, transparent); }
.tipo { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--c); white-space: nowrap; }
.tipo svg { width: 13px; height: 13px; }
.sis { display: inline-flex; align-items: center; justify-content: center; font-size: 9.5px; font-weight: 800; letter-spacing: .04em; padding: 1px 5px; border-radius: 4px; color: #fff; background: var(--c); flex: none; }
.sis.crm { --c: var(--arq-a); } .sis.ch { --c: var(--amb-b); } .sis.erp { --c: var(--ink); }
:root[data-theme="dark"] .sis.erp { --c: #5B5F66; } @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sis.erp { --c: #5B5F66; } }
:root[data-theme="dark"] .sis.crm { --c: #5A5FD6; } @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sis.crm { --c: #5A5FD6; } }
.av { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 9.5px; font-weight: 700; color: #fff; flex: none; background: var(--ac, #888); }

/* caixas */
.box { border: 1px solid var(--line); border-radius: 10px; background: var(--bg); min-width: 0; }
.box-h { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.box-h h2 { flex: 1; min-width: 160px; font-size: 14.5px; }
.box-b { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

/* números do topo */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.kpi { padding: 12px 16px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.kpi:last-child { border-right: 0; }
.kpi .v { font-size: 19px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.kpi .s { font-size: 12px; color: var(--muted); }
.kpi.crit .v { color: var(--s-crit); } .kpi.warn .v { color: var(--s-warn); }

/* fila de pendências */
.fila { display: flex; flex-direction: column; }
.fi { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 4px 12px; padding: 11px 16px; border-bottom: 1px solid var(--line); align-items: center; text-decoration: none; color: inherit; }
.fi:last-child { border-bottom: 0; }
.fi:hover { background: var(--surface); text-decoration: none; }
.fi .ic { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 12%, var(--bg)); }
.fi .ic svg { width: 15px; height: 15px; }
.fi .tt { font-weight: 600; font-size: 13.5px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.fi .dd { font-size: 12.5px; color: var(--muted); }
.fi .vv { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; white-space: nowrap; }

/* tabela */
.tw { overflow-x: auto; min-width: 0; }
table.t { border-collapse: collapse; width: 100%; font-size: 13px; }
table.t th { text-align: left; font-weight: 600; font-size: 11.5px; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--bg); }
table.t td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t td.r, table.t th.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t tbody tr.click { cursor: pointer; } table.t tbody tr.click:hover td { background: var(--surface); }
table.t tfoot td { font-weight: 650; border-top: 1px solid var(--line-strong); border-bottom: 0; }
.cell2 { display: flex; flex-direction: column; gap: 1px; min-width: 0; } .cell2 small { color: var(--muted); font-size: 12px; }

/* carteira em visão de planilha */
.cart { border-collapse: separate; border-spacing: 0; font-size: 12.5px; width: 100%; min-width: 980px; }
.cart th { position: sticky; top: 0; background: var(--surface); font-weight: 650; font-size: 11.5px; color: var(--muted); padding: 7px 8px; text-align: right; border-bottom: 1px solid var(--line-strong); white-space: nowrap; z-index: 1; }
.cart th:first-child { text-align: left; position: sticky; left: 0; z-index: 2; }
.cart th.atual { color: var(--text); }
.cart td { border-bottom: 1px solid var(--line); padding: 3px 4px; text-align: right; vertical-align: middle; }
.cart td.rot { text-align: left; padding: 6px 8px; position: sticky; left: 0; background: var(--bg); z-index: 1; min-width: 250px; max-width: 290px; }
.cart td.rot b { font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart td.rot small { color: var(--muted); display: flex; gap: 6px; align-items: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart tr.grp td { background: var(--surface); font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 650; padding: 6px 8px; text-align: left; position: sticky; left: 0; }
.cc { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; width: 100%; min-width: 92px; padding: 5px 7px; border-radius: 6px; border: 1px solid transparent; font-variant-numeric: tabular-nums; }
.cc:hover { border-color: var(--line-strong); background: var(--surface); }
.cc .v { font-weight: 600; }
.cc small { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.cc.ok .v { color: var(--muted); font-weight: 500; } .cc.ok small { color: var(--s-ok); }
.cc.atr { background: color-mix(in srgb, var(--s-crit) 9%, var(--bg)); } .cc.atr .v, .cc.atr small { color: var(--s-crit); }
.cc.sol { background: color-mix(in srgb, var(--s-warn) 11%, var(--bg)); } .cc.sol small { color: var(--s-warn); font-weight: 650; }
.cc.ent { border: 1px dashed var(--line-strong); }
.cc.ctr { border: 1px dashed var(--line-strong); color: var(--muted); } .cc.ctr .v { font-weight: 500; }
.cc .adi { color: var(--s-warn); font-weight: 650; }
.cart tfoot td { background: var(--surface); font-weight: 650; padding: 7px 11px; font-variant-numeric: tabular-nums; border-bottom: 1px solid var(--line); white-space: nowrap; }
.cart tfoot td.rot { background: var(--surface); }
.cart tfoot tr.res td { font-size: 13px; }
.neg { color: var(--s-crit); } .pos { color: var(--s-ok); }
.legenda { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); align-items: center; }
.legenda span { display: inline-flex; align-items: center; gap: 6px; }
.legenda i { width: 14px; height: 12px; border-radius: 3px; display: inline-block; border: 1px solid var(--line-strong); }
.legenda i.atr { background: color-mix(in srgb, var(--s-crit) 18%, var(--bg)); border-color: transparent; }
.legenda i.sol { background: color-mix(in srgb, var(--s-warn) 22%, var(--bg)); border-color: transparent; }
.legenda i.ent { border-style: dashed; }
/* A pagar em planilha (proposta do quadro, 94 a 98): a linha do grupo com os totais, a média e a marca da variação */
.cart tr.grpt td { background: var(--surface); font-weight: 650; padding: 6px 11px; font-variant-numeric: tabular-nums; white-space: nowrap; border-bottom: 1px solid var(--line); }
.cart tr.grpt td.rot { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); padding: 6px 8px; background: var(--surface); }
.cart tr.grpt td.rot .faint { text-transform: none; letter-spacing: 0; font-weight: 500; }
.cart th.med, .cart td.med { border-left: 1px solid var(--line); }
.cart td.med { color: var(--muted); padding-right: 11px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cart-p .cc .v { display: inline-flex; align-items: center; gap: 3px; }
.cc .var { display: inline-flex; }
.cc .var svg.i { width: 12px; height: 12px; stroke-width: 2.4; }
.cc .var.sobe { color: var(--s-crit); }
.cc .var.desce { color: var(--s-ok); }
.legenda i.ctr { border-style: dashed; opacity: .55; }
.filtro-p { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; font-size: 12.5px; }

/* esteira */
.esteira { display: grid; grid-template-columns: repeat(3, minmax(250px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 4px; }
.col { background: color-mix(in srgb, var(--text) 4%, var(--bg)); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.col-h { display: flex; align-items: center; gap: 8px; padding: 2px 4px 4px; font-weight: 650; font-size: 13px; }
.col-h .n { color: var(--muted); font-weight: 500; }
.col-h .sub { margin-left: auto; font-size: 11.5px; color: var(--muted); font-weight: 500; }
.card { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 1px 2px rgba(16, 24, 40, .05); text-decoration: none; color: inherit; }
.card:hover { border-color: var(--line-strong); text-decoration: none; box-shadow: var(--shadow-md); }
.card .t1 { font-weight: 600; font-size: 13.5px; }
.card .t2 { font-size: 12.5px; color: var(--muted); }
.card .rw { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.card .rw .v { margin-left: auto; color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; font-size: 13px; }

/* barra de etapas do CRM (mesma do CRM) */
.etapas-bar { display: flex; gap: 2px; overflow-x: auto; padding: 2px 0; }
.eb { flex: 1 0 104px; display: flex; flex-direction: column; gap: 1px; padding: 6px 12px 6px 18px; background: var(--surface-2); clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%); min-width: 0; }
.eb:first-child { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); padding-left: 12px; border-radius: 6px 0 0 6px; }
.eb-n { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eb-d { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eb.feita { background: color-mix(in srgb, var(--text) 16%, var(--bg)); }
.eb.on { background: var(--text); color: var(--bg); } .eb.on .eb-d { color: color-mix(in srgb, var(--bg) 75%, transparent); }
.eb.erp-on { background: var(--arq-a); color: #fff; } .eb.erp-on .eb-d { color: rgba(255, 255, 255, .8); }
.crm-box { display: flex; flex-direction: column; gap: 8px; }
.crm-sub { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }

/* contrato */
.ct-h { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.ct-h .t { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 6px; }
.ct-h .meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--muted); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { padding: 8px 12px; font-size: 13px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500; }
.tabs button.on { color: var(--text); border-bottom-color: var(--text); font-weight: 650; }
.dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 7px 16px; font-size: 13px; margin: 0; }
.dl dt { color: var(--muted); } .dl dd { margin: 0; min-width: 0; }

/* rastreabilidade */
.trilha { display: flex; flex-direction: column; position: relative; }
.tr { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; padding-bottom: 14px; position: relative; }
.tr::before { content: ""; position: absolute; left: 16px; top: 22px; bottom: 0; width: 2px; background: var(--line); }
.tr:last-child::before { display: none; }
.tr .sis { width: 34px; height: 22px; font-size: 10px; border-radius: 6px; }
.tr .x { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tr .x b { font-weight: 600; font-size: 13px; }
.tr .x span { font-size: 12.5px; color: var(--muted); }
.tr.futuro .sis { background: transparent; color: var(--muted); border: 1px dashed var(--line-strong); }
.tr.futuro .x b { color: var(--muted); font-weight: 500; }
.codigo { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--surface-2); padding: 1px 6px; border-radius: 4px; white-space: nowrap; }

/* medições e progresso */
.passos { display: flex; gap: 0; align-items: center; flex-wrap: wrap; font-size: 11.5px; }
.passo { display: inline-flex; align-items: center; gap: 4px; color: var(--faint); padding-right: 4px; white-space: nowrap; }
.passo::after { content: ""; width: 14px; height: 1px; background: var(--line-strong); margin-left: 4px; }
.passo:last-child::after { display: none; }
.passo.feito { color: var(--s-ok); } .passo.agora { color: var(--text); font-weight: 650; }
.passo i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.mcard { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; align-items: start; }
.mcard.sol { border-color: color-mix(in srgb, var(--s-warn) 45%, var(--line)); background: color-mix(in srgb, var(--s-warn) 5%, var(--bg)); }
.mcard .t1 { font-weight: 650; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mcard .t2 { font-size: 12.5px; color: var(--muted); }
.mcard .v { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.mcard .acts { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }
.aviso-ch { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; background: var(--surface); border-radius: 8px; padding: 8px 10px; }
.aviso-ch .sis { margin-top: 1px; }

/* guarda-chuva */
.consumo { display: flex; flex-direction: column; gap: 8px; }
.cbar { position: relative; height: 26px; border-radius: 6px; background: var(--surface-2); overflow: hidden; display: flex; }
.cbar .a { background: var(--amb-b); } .cbar .b { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--amb-b) 55%, var(--bg)) 0 6px, color-mix(in srgb, var(--amb-b) 30%, var(--bg)) 6px 12px); }
.cbar .tempo { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); }
.cleg { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.cleg span { display: inline-flex; align-items: center; gap: 6px; } .cleg b { color: var(--text); font-variant-numeric: tabular-nums; }
.cleg i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.alerta { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; font-size: 13px; background: color-mix(in srgb, var(--c, var(--s-warn)) 10%, var(--bg)); color: var(--text); }
.alerta svg { color: var(--c, var(--s-warn)); margin-top: 1px; }
.alerta.crit { --c: var(--s-crit); } .alerta.info { --c: var(--s-info); }

/* parceria */
.split { display: flex; height: 34px; border-radius: 8px; overflow: hidden; font-size: 12.5px; font-weight: 650; }
.split div { display: flex; align-items: center; justify-content: center; color: #fff; min-width: 0; white-space: nowrap; overflow: hidden; }
.split .hub { background: var(--ink); } .split .par { background: var(--tc-rosa); }
:root[data-theme="dark"] .split .hub { background: #4A4D54; } @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .split .hub { background: #4A4D54; } }
.presets { display: flex; gap: 8px; flex-wrap: wrap; }
.opt { border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 11px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; min-width: 0; }
.opt small { color: var(--muted); font-size: 12px; }
.opt.on { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.opt b { font-weight: 650; }
/* Os cartões dos tipos de contrato: os cinco na mesma linha quando cabem (a 1440 px, sim); mais estreitos que isso, o último
   desce para a linha de baixo. O nome do tipo quebra a linha dentro do cartão (o padrão de .tipo é não quebrar). */
.tipos5 { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 8px; }
.tipos5 .opt { align-items: flex-start; }
.tipos5 .opt .tipo { font-size: 13px; white-space: normal; align-items: flex-start; overflow-wrap: anywhere; }
.tipos5 .opt .tipo svg { margin-top: 3px; }
.tipos5.q4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

/* conversa */
.conv { display: flex; flex-direction: column; gap: 12px; }
.msg { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; }
/* o texto fica sempre na segunda coluna: sem o avatar (ou o selo) na primeira, ele não cai na coluna estreita */
.msg .q { display: flex; flex-direction: column; gap: 3px; min-width: 0; grid-column: 2; }
.msg .q .hd { display: flex; gap: 6px; align-items: center; font-size: 12.5px; flex-wrap: wrap; } .msg .q .hd b { font-weight: 650; } .msg .q .hd span { color: var(--muted); }
.msg .q p { font-size: 13.5px; }
.msg.sistema .q p { color: var(--muted); font-size: 12.5px; }
.compor { display: flex; gap: 8px; align-items: flex-end; }
.compor textarea { min-height: 42px; }

/* gráfico */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--f-body); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .ent { fill: var(--amb-b); } .chart .ent2 { fill: color-mix(in srgb, var(--amb-b) 35%, var(--bg)); stroke: var(--amb-b); stroke-dasharray: 3 2; }
.chart .sai { fill: var(--tc-laranja); }
.chart .saldo { fill: none; stroke: var(--text); stroke-width: 2; }
.chart .ponto { fill: var(--bg); stroke: var(--text); stroke-width: 2; }
.chart .lbl { fill: var(--text); font-weight: 650; }
.chart .zero { stroke: var(--line-strong); }
.barras { display: flex; flex-direction: column; gap: 8px; }
.barra { display: grid; grid-template-columns: 150px minmax(0, 1fr) 110px; gap: 10px; align-items: center; font-size: 13px; }
.barra .tr2 { height: 12px; background: var(--surface-2); border-radius: 6px; overflow: hidden; } .barra .tr2 div { height: 100%; background: var(--c); border-radius: 6px; }
.barra .r { text-align: right; font-variant-numeric: tabular-nums; }

/* gaveta, janela e aviso */
.layer { position: fixed; inset: 0; z-index: 50; display: flex; justify-content: flex-end; background: rgba(10, 12, 16, .32); }
.drawer { width: min(480px, 100%); height: 100%; background: var(--bg); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
.drawer-h { display: flex; gap: 10px; align-items: flex-start; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.drawer-h .t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.drawer-b { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 16px; }
.drawer-f { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; }
.layer.centro { justify-content: center; align-items: center; padding: 16px; }
.modal { width: min(620px, 100%); max-height: 100%; background: var(--bg); border-radius: 12px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; }
.x-btn { padding: 4px; border-radius: 6px; color: var(--muted); } .x-btn:hover { background: var(--surface); }
.hist { display: flex; flex-direction: column; gap: 8px; }
.hist .h1 { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 10px; font-size: 12.5px; }
.hist .h1 b { font-weight: 650; }
#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 8px; font-size: 13px; opacity: 0; transition: opacity .2s, transform .2s; z-index: 80; max-width: calc(100% - 32px); pointer-events: none; }
#toast.on { opacity: 1; transform: translateX(-50%); }

/* notas do quadro */
.notas { border-left: 1px solid var(--line); background: var(--surface); overflow-y: auto; padding: 16px 18px 40px; display: flex; flex-direction: column; gap: 14px; font-size: 13px; min-width: 0; }
.notas h2 { font-size: 14px; display: flex; align-items: center; gap: 8px; }
.notas h3 { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.notas ul, .notas ol { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.notas li { line-height: 1.45; }
.notas .nbox { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.notas .fecha { margin-left: auto; }
.notas .ch-prev { border: 1px solid var(--line); border-radius: 8px; background: var(--bg); padding: 10px; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.notas .ch-prev .lin { display: flex; gap: 8px; align-items: center; } .notas .ch-prev .lin span:first-child { color: var(--muted); width: 92px; flex: none; }

.importar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.passo-i { border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.passo-i .k { width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.drop { border: 1.5px dashed var(--line-strong); border-radius: 10px; padding: 22px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 6px; align-items: center; }
.int-g { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.int-c { border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.int-c p { font-size: 12.5px; color: var(--muted); }
.menu-btn { display: none; }

/* celular e telas estreitas */
@media (max-width: 1279px) { .app.com-notas { grid-template-columns: 64px 236px minmax(0, 1fr); } .app.com-notas .notas { position: fixed; right: 0; top: 0; bottom: 0; width: min(380px, 100%); z-index: 40; box-shadow: var(--shadow-lg); padding-top: calc(16px + env(safe-area-inset-top, 0px)); } }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .kpi:nth-child(3) { border-right: 0; } .kpi:nth-child(n+4) { border-top: 1px solid var(--line); } .cols { grid-template-columns: minmax(0, 1fr); } .tipos5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .int-g { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 820px) {
  body { overflow: auto; display: block; height: auto; }
  .app, .app.com-notas { display: flex; flex-direction: column; min-height: 0; }
  .rail { flex-direction: row; overflow-x: auto; padding: 6px max(10px, env(safe-area-inset-left, 0px)); gap: 2px; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; }
  body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 31; background: var(--rail-bg); }
  .rail .mark, .rail .app-n, .rail .spacer { display: none; }
  .rail-btn { width: auto; min-width: 58px; flex: none; }
  .tree { display: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .tree.aberta { display: flex; }
  .menu-btn { display: inline-flex; }
  .main { overflow: visible; }
  .page { padding: 14px max(16px, env(safe-area-inset-right, 0px)) 48px max(16px, env(safe-area-inset-left, 0px)); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi { border-right: 1px solid var(--line) !important; border-top: 1px solid var(--line); } .kpi:nth-child(-n+2) { border-top: 0; } .kpi:nth-child(2n) { border-right: 0 !important; }
  .grid2, .grid3, .importar, .int-g, .tipos5 { grid-template-columns: minmax(0, 1fr); }
  .esteira { grid-template-columns: repeat(3, minmax(260px, 86%)); }
  .barra { grid-template-columns: 110px minmax(0, 1fr) 92px; }
  .fi { grid-template-columns: 28px minmax(0, 1fr); } .fi .vv { grid-column: 2; text-align: left; }
}

/* formulários */
.fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.fgrid .cheia { grid-column: 1 / -1; }
label.f > span:first-child { color: var(--muted); }
.ck { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; color: var(--text); cursor: pointer; }
.ck input { margin-top: 3px; flex: none; }
.ck > span { display: flex; flex-direction: column; gap: 2px; }
.ajuda { font-size: 12px; color: var(--faint); font-weight: 400; line-height: 1.4; }
.req { color: var(--s-crit); }
.fm-set { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 16px; min-width: 0; }
.fm-set legend { padding: 0; margin-bottom: 6px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.fm-set .ajuda { flex-basis: 100%; }
.fm-info { font-size: 13px; background: var(--surface); border-radius: 8px; padding: 9px 11px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.modal .presets .opt { flex: 1 1 150px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
/* busca */
.busca { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); border-radius: var(--r); padding: 5px 8px; background: var(--bg); color: var(--muted); }
.busca input { border: 0; outline: 0; background: transparent; width: 100%; font-size: 13px; color: var(--text); min-width: 0; }
.busca:focus-within { border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.bres { display: flex; flex-direction: column; gap: 1px; border: 1px solid var(--line); border-radius: 8px; padding: 4px; background: var(--bg); box-shadow: var(--shadow-md); }
.bres a, .bres button { display: flex; flex-direction: column; gap: 1px; padding: 6px 8px; border-radius: 6px; font-size: 13px; color: var(--text); text-decoration: none; text-align: left; width: 100%; }
.bres a:hover, .bres button:hover { background: var(--tree-hover); text-decoration: none; }
.bres small { color: var(--muted); font-size: 11.5px; }
/* carteira: navegação dos meses, observação */
.janela-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.obsm { color: var(--s-info); font-weight: 650; display: inline-flex; vertical-align: middle; }
.obsm svg { width: 13px; height: 13px; }
.obs { font-size: 13px; background: color-mix(in srgb, var(--s-info) 8%, var(--bg)); border-radius: 8px; padding: 8px 10px; display: flex; gap: 8px; align-items: flex-start; }
.obs svg { color: var(--s-info); margin-top: 2px; }
.fila .fi { width: 100%; text-align: left; }
/* fechamento */
.chk { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.chk .ok { color: var(--s-ok); } .chk .no { color: var(--s-warn); }
.in.sm { padding: 4px 6px; font-size: 12.5px; width: auto; max-width: 100%; }
@media (max-width: 820px) { .fgrid { grid-template-columns: minmax(0, 1fr); } }
/* janelas no celular: não passar da largura da tela */
.layer > .modal, .layer > .drawer { min-width: 0; }
.fgrid > *, .drawer-b > *, .drawer-h .t { min-width: 0; }
select.in { min-width: 0; max-width: 100%; text-overflow: ellipsis; }
.drawer-h h2, .drawer-h .muted { overflow-wrap: anywhere; }
/* paginação das pendências */
.pag-nav { display: flex; align-items: center; gap: 6px; padding: 10px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pag-nav .muted { margin-right: auto; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.pag-nav .btn { min-width: 30px; justify-content: center; }
.btn.on { background: var(--surface-2); font-weight: 650; border-color: var(--line-strong); }
/* abas: sem barra de rolagem; quebram linha quando não cabem, e o sublinhado da ativa fica dentro do botão */
.tabs { flex-wrap: wrap; overflow: visible; }
.tabs button { border-bottom: 0; margin-bottom: 0; }
.tabs button.on { box-shadow: inset 0 -2px 0 var(--text); }
/* esteira: as três colunas cabem no computador, mesmo com as notas abertas; no celular, rolam embaixo dos cards */
@media (min-width: 821px) { .esteira { grid-template-columns: repeat(3, minmax(210px, 1fr)); } }
/* quadro de contratos no Início */
.ctiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ctile { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; background: var(--bg); text-align: left; min-width: 0; }
.ctile:hover { border-color: var(--line-strong); }
.ctile.on { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.ctile .v { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; }
.ctile .s { font-size: 12px; color: var(--muted); }
.ctile.warn .v { color: var(--s-warn); } .ctile.crit .v { color: var(--s-crit); }
@media (max-width: 820px) { .ctiles { grid-template-columns: minmax(0, 1fr); } }
.chcel { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
table.quadro td:first-child { min-width: 170px; }
table.quadro td:nth-child(3) { min-width: 220px; }


/* Só na produção (web/montar.mjs): a página não tem a moldura do artifact em volta. */
html, body { margin: 0; }
