/* Glautec Gestão
   Marca: marinho Glautec (#020B16) na moldura, área de trabalho clara e arejada.
   Títulos, números de documento e valores em TeX Gyre Adventor; interface em Inter. */
@font-face { font-family: "Inter"; src: url(/fonts/inter-400.woff) format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url(/fonts/inter-500.woff) format("woff"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url(/fonts/inter-600.woff) format("woff"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url(/fonts/inter-700.woff) format("woff"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Adventor"; src: url(/fonts/adventor-400.woff) format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Adventor"; src: url(/fonts/adventor-700.woff) format("woff"); font-weight: 700; font-display: swap; }

:root {
  --navy: #020B16;          /* marca */
  --navy-2: #0B1A2D;
  --navy-3: #13263F;
  --navy-line: #1A2C44;
  --navy-text: #A8B7CB;
  --blue: #1F6BFF;          /* ação */
  --blue-ink: #1450CC;
  --blue-soft: #EAF1FF;
  --bg: #F5F7FA;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --line: #E4E9F0;
  --line-strong: #CFD7E2;
  --text: #0C1A2B;
  --muted: #5E6E84;
  --faint: #8C9AAE;
  --green: #12A15F; --amber: #D98A00; --red: #E5484D; --purple: #7C5CFF; --gray: #8D99AB; --info: #1F6BFF;
  --danger: #D93A40;
  --focus: 0 0 0 3px rgba(31, 107, 255, .22);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --display: "Adventor", "Inter", system-ui, sans-serif;
  --r-sm: 8px; --r: 12px; --r-lg: 16px;
  /* nomes antigos usados no código */
  --ink: var(--navy); --ink-2: var(--navy-2); --ink-line: var(--navy-line);
  --signal: var(--blue); --signal-soft: var(--blue-soft);
  --led-green: var(--green); --led-blue: var(--info); --led-amber: var(--amber); --led-red: var(--red); --led-gray: var(--gray); --led-purple: var(--purple);
  --font-num: var(--font);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #060E19; --surface: #0C1726; --surface-2: #101D2F; --line: #1B2B40; --line-strong: #2A3D56;
    --text: #E6EDF6; --muted: #93A3B8; --faint: #6D7E95; --blue-soft: #10264A; --blue-ink: #7FA8FF;
    --focus: 0 0 0 3px rgba(79, 140, 255, .35);
    color-scheme: dark;
  }
  .side { border-right: 1px solid var(--line); }
  .bars .bar.out { background: #3A4C66; }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01"; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: none; box-shadow: var(--focus); }
.num, td.money, .money, .code { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
svg { flex: none; }

/* ───── marca ───── */
.marca { display: inline-flex; align-items: center; min-width: 0; }
.marca-img { display: block; height: 30px; width: auto; max-width: 168px; object-fit: contain; }
.marca-chip { display: inline-flex; padding: 6px 10px; border-radius: 10px; }
.marca-chip.chip-claro { background: #fff; }
.marca-chip.chip-escuro { background: var(--navy); }
.marca-chip .marca-img { height: 24px; }
.wordmark { font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: -.02em; line-height: 1; color: inherit; }
.brand { display: flex; align-items: center; gap: 10px; padding: 22px 20px 18px; color: #fff; }
.brand .marca { color: #fff; }
.brand .produto { font-size: 12px; color: var(--navy-text); border-left: 1px solid var(--navy-line); padding-left: 10px; line-height: 1.2; }

/* ───── estrutura ───── */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--navy); color: var(--navy-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--navy-3) transparent; }
.nav { padding: 2px 12px 18px; flex: 1; }
.nav > a { margin-bottom: 6px; }
.nav-group { margin-top: 18px; }
.nav-group > span { display: block; padding: 0 10px 6px; font-size: 12px; font-weight: 500; color: #62738B; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 7px 10px; border-radius: 9px; color: #C3CEDC; font-size: 13.5px; font-weight: 500; position: relative; }
.nav a:hover { background: var(--navy-2); text-decoration: none; color: #fff; }
.nav a.on { background: var(--navy-3); color: #fff; }
.nav a.on::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--blue); }
.nav a.on svg { color: #6FA0FF; opacity: 1; }
.nav svg { width: 18px; height: 18px; opacity: .7; }
.side-foot { margin: 0 12px 12px; padding: 12px; border-radius: 12px; background: var(--navy-2); font-size: 12.5px; display: grid; grid-template-columns: 34px 1fr; gap: 0 10px; align-items: center; }
.side-foot .avatar { grid-row: span 2; width: 34px; height: 34px; border-radius: 50%; background: var(--navy-3); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.side-foot .who { color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .role { color: var(--navy-text); }
.side-foot .links { grid-column: 1 / -1; display: flex; gap: 14px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--navy-line); flex-wrap: wrap; }
.side-foot button, .side-foot .links a { background: none; border: 0; color: #9DBBFF; padding: 0; cursor: pointer; font-size: 12.5px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.page { padding: 30px 36px 64px; max-width: 1440px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin: 0; font-family: var(--display); font-size: 25px; line-height: 1.15; font-weight: 700; letter-spacing: -.015em; }
.page-head .sub { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.crumb a { color: var(--muted); }

/* ───── botões ───── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 13.5px; white-space: nowrap; color: var(--text); transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); border-color: var(--faint); text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18); }
.btn.primary:hover { background: var(--blue-ink); border-color: var(--blue-ink); }
.btn.danger { color: var(--danger); }
.btn.danger.primary, .btn.primary.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ───── status (etiquetas) ───── */
.led { --c: var(--gray); display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; white-space: nowrap; color: var(--text); }
.led::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); flex: none; }
.led.green { --c: var(--green); } .led.blue { --c: var(--info); } .led.amber { --c: var(--amber); }
.led.red { --c: var(--red); } .led.gray { --c: var(--gray); } .led.purple { --c: var(--purple); }

/* ───── painéis ───── */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.005em; }
.panel-body { padding: 20px; }

/* ───── lista ───── */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.toolbar .search { flex: 1 1 260px; position: relative; }
.toolbar .search input { padding-left: 36px; width: 100%; background: var(--surface-2); }
.toolbar .search svg { position: absolute; left: 11px; top: 11px; width: 16px; height: 16px; color: var(--faint); }
.toolbar select, .toolbar input[type=date] { width: auto; max-width: 210px; }
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.grid th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); position: sticky; top: 0; }
.grid th.sortable { cursor: pointer; user-select: none; }
.grid th.sortable:hover { color: var(--text); }
.grid td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid tbody tr { cursor: pointer; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid tbody tr:hover td { background: color-mix(in srgb, var(--blue-soft) 60%, var(--surface)); }
.grid td.money, .grid th.money, .grid td.num, .grid th.num { text-align: right; }
.grid tfoot td { font-weight: 600; background: var(--surface-2); border-bottom: 0; border-top: 1px solid var(--line); }
.grid .code { font-weight: 600; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; color: var(--muted); font-size: 13px; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--line); }
.empty { padding: 56px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; font-weight: 600; }

/* ───── formulário ───── */
label.f { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
label.f > span { font-size: 13px; color: var(--muted); font-weight: 500; }
label.f > span i { color: var(--danger); font-style: normal; }
label.f small { color: var(--faint); font-size: 12px; }
input, select, textarea { width: 100%; height: 38px; padding: 7px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); transition: border-color .12s, box-shadow .12s; }
select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238C9AAE' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
input[type=checkbox], input[type=radio] { width: 17px; height: 17px; padding: 0; accent-color: var(--blue); }
textarea { height: auto; min-height: 84px; resize: vertical; line-height: 1.5; }
input:disabled, select:disabled, textarea:disabled, input[readonly] { background: var(--surface-2); color: var(--muted); border-color: var(--line); }
input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover:not(:disabled) { border-color: var(--faint); }
input:focus, select:focus, textarea:focus { border-color: var(--blue); outline: none; box-shadow: var(--focus); }
.check { display: flex; align-items: center; gap: 9px; min-height: 38px; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px 20px; }
.w1 { grid-column: span 1; } .w2 { grid-column: span 2; } .w3 { grid-column: span 3; } .w4 { grid-column: span 4; }
.ro-value { min-height: 38px; display: flex; align-items: center; gap: 6px; padding: 7px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; color: var(--text); }

/* cabeçalho do registro: o número do documento é o destaque */
.rec-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; flex-wrap: wrap; margin-bottom: 22px; }
.doc-no { font-family: var(--display); font-size: 34px; line-height: 1.05; font-weight: 700; letter-spacing: -.015em; margin: 2px 0 6px; }
.doc-title { font-size: 15px; color: var(--muted); }
.rec-meta { display: flex; gap: 10px 16px; align-items: center; flex-wrap: wrap; margin-top: 10px; font-size: 13px; color: var(--muted); }
.lock-note { display: flex; gap: 9px; align-items: center; padding: 11px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.lock-note svg { width: 16px; height: 16px; }
.rec-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.section-title { font-size: 15px; font-weight: 600; margin: 0; }

/* itens (tabela editável) */
.items { width: 100%; border-collapse: collapse; }
.items th { font-size: 12.5px; color: var(--muted); font-weight: 500; text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.items td { padding: 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.items td.money { text-align: right; padding-top: 14px; }
.items tfoot td { border: 0; padding-top: 12px; font-weight: 600; }
.items .rm { width: 38px; }

/* referência com busca */
.ref { position: relative; }
.ref input { padding-right: 32px; }
.ref .clear { position: absolute; right: 5px; top: 6px; height: 26px; width: 24px; border: 0; background: none; color: var(--faint); cursor: pointer; font-size: 17px; border-radius: 6px; }
.ref .clear:hover { background: var(--surface-2); color: var(--text); }
.ref .drop { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(2, 11, 22, .14); max-height: 280px; overflow-y: auto; padding: 4px; }
.ref .drop .none { color: var(--muted); cursor: default; }

/* abas */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 14px; overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 14px 10px 12px; cursor: pointer; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; margin-bottom: -1px; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); border-bottom-color: var(--blue); font-weight: 600; }

/* painel inicial: números numa faixa única, não em cartões soltos */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; margin-bottom: 18px; }
.kpi { background: var(--surface); padding: 18px 20px 16px; display: block; color: var(--text); position: relative; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0 -1px -1px 0; }
a.kpi:hover { text-decoration: none; background: var(--surface-2); }
.kpi .k { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi .v { font-family: var(--display); font-size: 27px; font-weight: 700; margin-top: 6px; letter-spacing: -.01em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .d { font-size: 12.5px; color: var(--faint); margin-top: 6px; }
.kpi.alert .v { color: var(--red); }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.mini { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.mini td { padding: 11px 20px; border-top: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
.mini td + td { padding-left: 4px; }
.mini tr:first-child td { border-top: 0; }
.mini tr.click { cursor: pointer; } .mini tr.click:hover td { background: var(--surface-2); }
.mini td.money { text-align: right; }
.bars { display: flex; gap: 14px; align-items: flex-end; height: 180px; padding: 12px 4px 0; }
.bars .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bars .pair { display: flex; gap: 4px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.bars .bar { width: 40%; max-width: 22px; border-radius: 6px 6px 2px 2px; min-height: 3px; }
.bars .bar.in { background: var(--blue); } .bars .bar.out { background: #B8C4D6; }
.bars .bar.one { background: var(--blue); width: 56%; max-width: 30px; }
.bars .lbl { font-size: 12px; color: var(--faint); }
.legend { display: flex; gap: 18px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.statline { display: flex; flex-wrap: wrap; gap: 10px; padding: 18px 20px; }
.statline .led { height: 30px; font-size: 13px; }
.statline .led b { font-size: 14px; margin-left: 4px; font-weight: 700; }

/* modal e avisos */
.overlay { position: fixed; inset: 0; background: rgba(2, 11, 22, .52); backdrop-filter: blur(2px); display: flex; align-items: flex-start; justify-content: center; padding: 9vh 16px 16px; z-index: 50; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 18px; width: 100%; max-width: 500px; box-shadow: 0 24px 64px rgba(2, 11, 22, .32); }
.modal.wide { max-width: 780px; }
.modal-head { padding: 22px 24px 4px; } .modal-head h3 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.modal-body { padding: 14px 24px; display: grid; gap: 14px; }
.modal-body p { margin: 0; color: var(--muted); }
.modal-foot { padding: 14px 24px 22px; display: flex; justify-content: flex-end; gap: 8px; }
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 60; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--navy); color: #fff; padding: 12px 16px 12px 14px; border-radius: 12px; box-shadow: 0 12px 32px rgba(2, 11, 22, .28); font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; animation: tin .18s ease-out; }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-top: 6px; flex: none; }
.toast.err::before { background: var(--red); }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }

/* login: a marca em destaque */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(380px, 1fr); }
.login-art { background: var(--navy); color: var(--navy-text); padding: 44px 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; position: relative; overflow: hidden; isolation: isolate; }
.login-art::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: .5;
  background-image: linear-gradient(var(--navy-line) 1px, transparent 1px), linear-gradient(90deg, var(--navy-line) 1px, transparent 1px); background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 70% at 85% 100%, #000 10%, transparent 70%); }
.login-art .marca-img { height: 40px; max-width: 220px; }
.login-art .wordmark { font-size: 30px; color: #fff; }
.login-art h2 { font-family: var(--display); color: #fff; font-size: clamp(34px, 3.6vw, 52px); line-height: 1.04; margin: 0; max-width: 13ch; font-weight: 700; letter-spacing: -.025em; }
.login-art p { max-width: 44ch; margin: 18px 0 0; color: var(--navy-text); font-size: 15px; }
.servicos { display: flex; flex-wrap: wrap; gap: 8px; max-width: 520px; }
.servicos span { border: 1px solid var(--navy-line); color: #C3CEDC; border-radius: 999px; padding: 6px 13px; font-size: 13px; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 40px 32px; background: var(--surface); }
.login-form form { width: 100%; max-width: 360px; display: grid; gap: 16px; }
.login-form h1 { margin: 0; font-family: var(--display); font-size: 28px; letter-spacing: -.015em; }
.login-form .lead { margin: -8px 0 6px; color: var(--muted); }
.login-form .err { color: var(--danger); font-size: 13px; min-height: 18px; }
.login-form .btn.primary { height: 44px; font-size: 14.5px; }
.login-form .marca-mobile { display: none; }

/* permissões */
.perm-table { border-collapse: collapse; }
.perm-table td, .perm-table th { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; }
.perm-table th { color: var(--muted); font-weight: 500; }
.perm-table tr.g td { font-weight: 600; background: var(--surface-2); }
.perm-table select { height: 32px; max-width: 220px; }

.files { display: grid; gap: 6px; }
.file { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.file small { color: var(--muted); }
.timeline { display: grid; gap: 0; }
.timeline div { padding: 9px 0 9px 18px; border-left: 2px solid var(--line); position: relative; font-size: 13px; }
.timeline div::before { content: ""; position: absolute; left: -5px; top: 15px; width: 8px; height: 8px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); }
.timeline small { color: var(--muted); display: block; }

.report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.spin { display: inline-block; width: 20px; height: 20px; border: 2px solid var(--line-strong); border-top-color: var(--blue); border-radius: 50%; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.loading { padding: 48px; display: flex; justify-content: center; }

/* ───── responsivo ───── */
@media (max-width: 1100px) { .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .w3, .w4 { grid-column: span 2; } .dash-grid, .report-grid { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 40; transform: translateX(-100%); transition: transform .22s ease; }
  .shell.menu .side { transform: none; box-shadow: 0 0 0 100vmax rgba(2, 11, 22, .5); }
  .topbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 20; }
  .topbar button { background: none; border: 0; color: #fff; padding: 6px; margin-left: -6px; cursor: pointer; display: flex; border-radius: 8px; }
  .topbar svg { width: 22px; height: 22px; }
  .topbar .marca-img { height: 24px; }
  .topbar .wordmark { font-size: 19px; }
  .page { padding: 20px 16px 48px; }
  .page-head h1 { font-size: 24px; }
  .login { grid-template-columns: 1fr; } .login-art { display: none; }
  .login-form { align-items: flex-start; padding-top: 12vh; }
  .login-form .marca-mobile { display: block; margin-bottom: 18px; }
  .doc-no { font-size: 27px; }
}
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } .w1, .w2, .w3, .w4 { grid-column: span 1; } .toolbar select, .toolbar input[type=date] { max-width: none; flex: 1 1 45%; } .kpi .v { font-size: 23px; } }
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }

/* ───── impressão ───── */
#print-area { display: none; }
@media print {
  @page { margin: 14mm; }
  body { background: #fff; color: #000; font-size: 11.5px; }
  body > #app { display: none; }
  #print-area { display: block; }
  .p-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2px solid #020B16; padding-bottom: 8px; margin-bottom: 12px; }
  .p-head .marca-img { height: 34px; margin-bottom: 6px; }
  .p-head .emp b { font-size: 15px; } .p-head .emp div { color: #333; }
  .p-doc { text-align: right; } .p-doc .n { font-family: var(--display); font-size: 22px; font-weight: 700; }
  .p-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 14px; margin-bottom: 12px; }
  .p-fields div span { display: block; color: #555; font-size: 10px; }
  .p-fields .wide { grid-column: span 3; white-space: pre-wrap; }
  .p-table { width: 100%; border-collapse: collapse; margin: 6px 0 12px; }
  .p-table th, .p-table td { border-bottom: 1px solid #ccc; padding: 4px 6px; text-align: left; }
  .p-table .r { text-align: right; }
  .p-sign { display: flex; gap: 40px; margin-top: 50px; } .p-sign div { flex: 1; border-top: 1px solid #000; text-align: center; padding-top: 4px; }
  .p-foot { margin-top: 18px; color: #555; font-size: 10px; text-align: center; }
}

/* ───── módulos de integração ───── */
.form-section { grid-column: 1 / -1; font-weight: 600; font-size: 14px; padding-top: 18px; margin-top: 4px; border-top: 1px solid var(--line); color: var(--text); }
.form-section:first-child { border-top: 0; padding-top: 0; }
.warn-box { background: color-mix(in srgb, var(--amber) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--amber) 35%, transparent); border-radius: 12px; padding: 11px 14px; font-size: 13px; display: grid; gap: 3px; }
.mini-label { font-size: 13px; color: var(--muted); font-weight: 500; display: block; margin-bottom: 6px; }
.chat { display: grid; gap: 10px; margin-bottom: 16px; max-height: 480px; overflow-y: auto; padding: 2px; }
.msg { max-width: 78%; padding: 10px 14px; border-radius: 14px 14px 14px 4px; background: var(--surface-2); border: 1px solid var(--line); white-space: pre-wrap; }
.msg.equipe { justify-self: end; border-radius: 14px 14px 4px 14px; background: var(--blue-soft); border-color: color-mix(in srgb, var(--blue) 22%, transparent); }
.msg.interno { background: color-mix(in srgb, var(--amber) 9%, var(--surface)); border-style: dashed; border-color: color-mix(in srgb, var(--amber) 40%, transparent); }
.msg-meta { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.chat-form { display: grid; gap: 10px; }
.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px 20px; }
.kv span { display: block; font-size: 12.5px; color: var(--muted); } .kv b { font-weight: 500; word-break: break-word; }
.disk { display: grid; gap: 5px; margin-bottom: 12px; font-size: 13px; }
.disk-bar { height: 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.disk-bar i { display: block; height: 100%; border-radius: 99px; }
.cmd { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; display: grid; gap: 8px; }
.cmd-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.cmd code { display: block; font-size: 12px; background: var(--navy); color: #D6E4F5; padding: 10px 12px; border-radius: 8px; overflow-x: auto; white-space: nowrap; }
.cmd small { color: var(--muted); }
table.map th select { min-width: 150px; font-weight: 400; }

/* logo nas configurações */
.marca-config { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.marca-slot { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.marca-slot .prev { height: 96px; display: grid; place-items: center; padding: 16px; }
.marca-slot .prev.escuro { background: var(--navy); color: #fff; }
.marca-slot .prev.claro { background: #fff; color: var(--navy); border-bottom: 1px solid var(--line); }
.marca-slot .prev .marca-img { height: 40px; max-width: 240px; }
.marca-slot .info { padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.marca-slot .info small { display: block; color: var(--muted); font-size: 12px; }
@media (max-width: 720px) { .marca-config { grid-template-columns: 1fr; } }

/* ───── boleto (impressão) ───── */
.boleto { font-family: Arial, Helvetica, sans-serif; color: #000; width: 190mm; margin: 0 auto 6mm; page-break-after: always; font-size: 8.5pt; }
.boleto:last-child { page-break-after: auto; }
.bl-cab { display: flex; align-items: flex-end; border-bottom: 2px solid #000; margin-top: 4mm; }
.bl-banco { font-weight: 700; font-size: 13pt; padding: 0 3mm 1mm 0; }
.bl-cod { font-weight: 700; font-size: 15pt; border-left: 2px solid #000; border-right: 2px solid #000; padding: 0 3mm; }
.bl-linha { flex: 1; text-align: right; font-weight: 700; font-size: 11.5pt; letter-spacing: .02em; padding-bottom: 1mm; }
.bl-row { display: flex; border-bottom: 1px solid #000; }
.bl-cel { flex: 1; border-left: 1px solid #000; padding: .6mm 1.5mm; min-height: 8mm; }
.bl-cel:first-child { border-left: 0; }
.bl-cel span { display: block; font-size: 6.5pt; color: #333; }
.bl-cel b { font-weight: 700; font-size: 8.5pt; }
.bl-cel.g3 { flex: 3; } .bl-cel.g4 { flex: 4; } .bl-cel.g5 { flex: 5; } .bl-cel.g6 { flex: 6; }
.bl-cel.r { flex: 0 0 45mm; text-align: right; background: #f2f2f2; }
.bl-instr div { font-size: 8pt; margin-top: .6mm; }
.bl-somas div { border-top: 1px solid #000; min-height: 6mm; text-align: left; } .bl-somas div:first-child { border-top: 0; }
.bl-aut { text-align: right; font-size: 7pt; padding-top: 1mm; }
.bl-corte { border-top: 1px dashed #000; margin: 6mm 0 2mm; font-size: 6.5pt; text-align: right; color: #555; }
.bl-barras { display: flex; justify-content: space-between; align-items: flex-start; padding-top: 2mm; }
.bl-barras .bc svg { width: 103mm; height: 13mm; display: block; fill: #000; }
.bl-barras > span:last-child { font-size: 7pt; }
@media print { .overlay, .toasts { display: none !important; } }

/* assinatura, triagem, régua, PIX */
.doc-preview { white-space: pre-wrap; font: 13px/1.6 var(--font); background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; max-height: 300px; overflow: auto; margin: 0; }
.ia-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ia-tag { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--navy); color: #fff; }
.ia-resumo { margin: 14px 0 4px; font-weight: 600; font-size: 15px; }
.ia-box { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13.5px; }
.ia-box p { margin: 4px 0 10px; white-space: pre-wrap; }
.ia-box ol { margin: 4px 0 0; padding-left: 20px; }
.ia-box ol li { margin: 3px 0; }
.ia-box a { display: inline-flex; align-items: center; gap: 6px; }
.ia-box a svg { width: 15px; height: 15px; }
.ia-sim { margin: 8px 0; }
.ia-sim div { color: var(--muted); font-size: 12.5px; }
.regua { display: grid; gap: 10px; }
.regua-item { display: flex; gap: 14px; align-items: flex-start; padding: 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; }
.regua-item small { color: var(--muted); font-size: 12px; }
.regua-item textarea { width: 100%; }
.bl-pix { display: flex; gap: 16px; align-items: center; margin-top: 14px; border-top: 1px dashed #999; padding-top: 12px; font-size: 12px; }
.bl-pix .qr { width: 120px; flex: none; }
.bl-pix .qr svg { width: 100%; height: auto; display: block; }
@media (max-width: 720px) { .regua-item { flex-direction: column; } }

/* ───── painel inicial ───── */
:root { --bar-out: #C3CDDA; }
.dash { display: grid; gap: 22px; }
.dash-h { font-size: 15px; font-weight: 600; margin: 0 0 10px; }
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.att-item { --c: var(--blue); display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; color: var(--text); position: relative; overflow: hidden; }
.att-item::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
.att-item:hover { text-decoration: none; border-color: var(--line-strong); background: var(--surface-2); }
.att-item.red { --c: var(--red); } .att-item.amber { --c: var(--amber); } .att-item.blue { --c: var(--blue); }
.att-n { font-family: var(--display); font-size: 26px; font-weight: 700; min-width: 34px; text-align: center; color: var(--c); line-height: 1; }
.att-t { display: grid; font-weight: 500; line-height: 1.3; min-width: 0; }
.att-t small { color: var(--muted); font-weight: 400; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-ok { display: flex; align-items: center; gap: 10px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; color: var(--muted); }
.att-ok svg { width: 18px; height: 18px; color: var(--green); }
.dash-cols { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.dash-more { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; align-items: start; }
.dash-panel .panel-head { padding: 14px 18px; }
.ph-link { font-size: 13px; font-weight: 500; }
.mstats { display: flex; flex-wrap: wrap; gap: 4px 28px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.mstats:last-child { border-bottom: 0; }
.mstat { display: grid; color: var(--text); }
a.mstat:hover { text-decoration: none; }
a.mstat:hover b { color: var(--blue-ink); }
.mstat b { font-family: var(--display); font-size: 24px; line-height: 1.1; font-weight: 700; font-variant-numeric: tabular-nums; }
.mstat span { font-size: 12.5px; color: var(--muted); }
.mstat.red b { color: var(--red); } .mstat.amber b { color: var(--amber); }
.q-list, .l-list { display: grid; }
.q-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 18px; border-top: 1px solid var(--line); color: var(--text); }
.q-row:first-child { border-top: 0; }
.q-row:hover { background: var(--surface-2); text-decoration: none; }
.q-prio { width: 8px; height: 8px; border-radius: 50%; background: var(--gray); }
.q-prio.red { background: var(--red); } .q-prio.amber { background: var(--amber); } .q-prio.blue { background: var(--blue); } .q-prio.gray { background: var(--gray); }
.q-main { display: grid; min-width: 0; }
.q-tit { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-sub { font-size: 12.5px; color: var(--muted); white-space: pre; overflow: hidden; text-overflow: ellipsis; }
.q-side { display: grid; justify-items: end; font-size: 12.5px; white-space: nowrap; }
.q-side small { color: var(--faint); font-size: 12px; }
.q-late { color: var(--red); font-weight: 600; }
.q-due { color: var(--muted); }
.f-body { padding: 18px; display: grid; gap: 14px; }
.f-meta { display: grid; gap: 7px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.f-meta-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.f-meta-top span { color: var(--muted); }
.f-meta-top b { font-family: var(--display); font-size: 24px; font-variant-numeric: tabular-nums; }
.f-meta small { color: var(--muted); font-size: 12.5px; }
.f-bar { height: 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.f-bar i { display: block; height: 100%; background: var(--blue); border-radius: 99px; }
.f-row { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; align-items: baseline; }
.f-row span { color: var(--muted); }
.f-row b { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.f-row b.red { color: var(--red); }
.f-row small { grid-column: 1 / -1; color: var(--faint); font-size: 12px; }
.f-chart { padding-top: 6px; border-top: 1px solid var(--line); }
.f-chart .legend { margin: 8px 0 0; }
.bars.sm { height: 120px; gap: 10px; }
.bars .bar.out { background: var(--bar-out); opacity: 1; }
.l-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 18px; border-top: 1px solid var(--line); color: var(--text); }
.l-row:first-child { border-top: 0; }
.l-row:hover { background: var(--surface-2); text-decoration: none; }
.l-main { display: grid; min-width: 0; }
.l-main > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.l-main small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.l-side { font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); }
.l-side.red { color: var(--red); font-weight: 600; } .l-side.in { color: var(--green); font-weight: 600; } .l-side.out { color: var(--text); font-weight: 600; }
.empty.sm { padding: 26px 18px; }
@media (max-width: 1180px) { .dash-cols { grid-template-columns: 1fr; } }

/* ───── busca e filtros das listas ───── */
.toolbar { gap: 10px; }
.toolbar .search { flex: 1 1 320px; }
.filter-btn { position: relative; }
.filter-btn.on { background: var(--blue-soft); border-color: color-mix(in srgb, var(--blue) 40%, transparent); color: var(--blue-ink); }
.filter-count { display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px; background: var(--blue); color: #fff; font-size: 11.5px; font-weight: 700; margin-left: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 0 16px 14px; border-bottom: 1px solid var(--line); margin-top: -2px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 6px 0 12px; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-size: 13px; color: var(--text); }
.chip:hover { border-color: var(--faint); background: var(--surface-2); }
.chip-l { color: var(--muted); }
.chip b { font-weight: 600; }
.chip-x { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; color: var(--muted); font-size: 15px; }
.chip:hover .chip-x { background: var(--line); color: var(--text); }
.chip-clear { border: 0; background: none; color: var(--blue-ink); cursor: pointer; font-size: 13px; padding: 0 4px; }
.toolbar:has(+ .chips[hidden]) { border-bottom: 1px solid var(--line); }
.toolbar:has(+ .chips:not([hidden])) { border-bottom: 0; }
.filter-panel { padding: 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px 16px; }
.filter-grid .f { display: grid; gap: 6px; }
.filter-grid .f > span { font-size: 13px; color: var(--muted); font-weight: 500; }
.filter-periodo { grid-column: span 2; }
.periodo-in { display: flex; align-items: center; gap: 8px; }
.periodo-in .ate { color: var(--muted); font-size: 13px; }
.filter-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
@media (max-width: 560px) { .filter-periodo { grid-column: auto; } .periodo-in { flex-wrap: wrap; } }

/* células de texto quebram em até 2 linhas, em vez de cortar */
.grid td.txt { white-space: normal; min-width: 150px; max-width: 360px; }
.grid td.nw { white-space: nowrap; }
.cell-txt { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.4; }
.grid tbody tr:hover td { background: var(--surface-2); }

/* ───── campo de busca em cadastro ───── */
.ref > span:first-child { position: absolute; left: 12px; top: 11px; color: var(--faint); pointer-events: none; }
.ref > span:first-child svg { width: 16px; height: 16px; display: block; }
.ref input { padding-left: 36px; padding-right: 34px; text-overflow: ellipsis; }
.ref input:disabled + .drop + .clear, .ref.vazio .clear { display: none; }
.ref .clear { position: absolute; right: 6px; top: 6px; width: 26px; height: 26px; display: grid; place-items: center; border: 0; background: none; border-radius: 7px; color: var(--faint); cursor: pointer; padding: 0; }
.ref .clear svg { width: 14px; height: 14px; }
.ref .clear:hover { background: var(--surface-2); color: var(--text); }
.ref .drop { padding: 6px; max-height: 340px; min-width: 280px; }
.ref .drop .opt { display: grid; gap: 2px; padding: 9px 11px; border-radius: 9px; cursor: pointer; }
.ref .drop .opt.hl { background: var(--blue-soft); }
.ref .drop .opt:hover { background: var(--blue-soft); }
.opt-l { font-weight: 500; color: var(--text); }
.opt-l mark { background: none; color: var(--blue-ink); font-weight: 700; }
.opt-s { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 12.5px; color: var(--muted); }
.ref .drop .none { padding: 12px; color: var(--muted); cursor: default; }
.drop-foot { margin-top: 4px; padding: 9px 11px 5px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.drop-foot button { border: 0; background: none; color: var(--blue-ink); cursor: pointer; padding: 0; font: inherit; font-weight: 600; }

/* menu "Mais ações" */
.menu-wrap { position: relative; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 35; min-width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 36px rgba(2, 11, 22, .16); padding: 6px; display: grid; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px; border: 0; background: none; border-radius: 8px; cursor: pointer; font-size: 13.5px; font-weight: 500; color: var(--text); text-align: left; white-space: nowrap; height: auto; justify-content: flex-start; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); text-decoration: none; box-shadow: none; }
.menu-item svg { width: 16px; height: 16px; color: var(--muted); }
.menu-item.perigo, .menu-item.perigo svg { color: var(--danger); }
.rec-head .btn-row { justify-content: flex-end; }

/* abas: as principais à vista, o resto em "Mais" */
.tabs { flex-wrap: wrap; overflow: visible; row-gap: 0; }
.tab-mais-wrap { position: relative; display: flex; }
.tab-mais { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 14px 10px 12px; cursor: pointer; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab-mais:hover { color: var(--text); }
.tab-mais.on { color: var(--text); border-bottom-color: var(--blue); font-weight: 600; }
.tab-mais svg { width: 15px; height: 15px; }
.tabs-pop { left: 0; right: auto; top: calc(100% + 2px); max-height: 360px; overflow-y: auto; }
