/* ERP Pró-Ativa — folha de estilos única.
   Paleta: azul institucional + grafite. Sem degradês decorativos. */
:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #eef2f7;
  --line: #e3e8ef;
  --line-strong: #cfd8e3;
  --text: #121a2b;
  --text-2: #3a4659;
  --muted: #667085;
  --blue: #1d5fd1;
  --blue-hover: #174fae;
  --blue-soft: #eaf1fd;
  --blue-ink: #1849a9;
  --deep: #121a2b;
  --rail: #111827;
  --rail-2: #1b2435;
  --rail-text: #c3cad6;
  --green: #0b7a4b;
  --green-soft: #e9f7ef;
  --amber: #a15c07;
  --amber-soft: #fff6e5;
  --red: #b42335;
  --red-soft: #fdf0f1;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 18px 48px rgba(16, 24, 40, .18);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 16px; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); line-height: 1.5; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
a { color: var(--blue); text-underline-offset: 2px; }
img { max-width: 100%; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { color: var(--text); margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 24px; line-height: 1.25; letter-spacing: -.02em; overflow-wrap: anywhere; }
h2 { font-size: 16px; line-height: 1.35; }
h3 { font-size: 14px; line-height: 1.4; margin: 0 0 10px; }
h4 { font-size: 13px; margin: 0 0 8px; }
p { margin: 0 0 10px; }
ul { margin: 6px 0 0; padding-left: 18px; }
.muted { color: var(--muted); }
.small-text { font-size: 12.5px; }
.loading { padding: 48px; color: var(--muted); }
:focus-visible { outline: 3px solid #8fb4f2; outline-offset: 2px; }

/* ---------- Acesso ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); }
.auth-card { width: min(100%, 420px); background: var(--surface); padding: 32px; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 40px rgba(16, 24, 40, .08); }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.auth-brand img { width: 44px; height: 44px; object-fit: contain; }
.auth-brand strong { display: block; font-size: 18px; }
.auth-brand small { color: var(--muted); font-size: 12px; }
.auth-card h1 { font-size: 22px; margin-bottom: 6px; }
.auth-card p { color: var(--muted); margin: 0 0 22px; }

/* ---------- Estrutura ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--rail); color: var(--rail-text); padding: 18px 12px 14px; overflow: hidden; }
.rail-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rail-brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px; color: #fff; }
.brand-mark { flex: 0 0 34px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: #fff; }
.brand-mark img { max-width: 28px; max-height: 28px; object-fit: contain; }
.rail-brand strong { display: block; font-size: 15px; letter-spacing: -.01em; }
.rail-brand small { display: block; color: #8b95a7; font-size: 11px; }
.menu-toggle { display: none; border: 1px solid #2c374b; background: transparent; color: #fff; border-radius: 8px; height: 36px; padding: 0 12px; font-size: 13px; font-weight: 600; }
.unit-picker { display: block; margin: 18px 4px 6px; }
.unit-picker > span { display: block; color: #8b95a7; font-size: 11px; font-weight: 600; margin: 0 0 6px 2px; }
.contract-select { width: 100%; height: 38px; padding: 0 10px; border: 1px solid #2c374b; border-radius: 8px; background: var(--rail-2); color: #fff; font-size: 13px; font-weight: 600; }
.contract-select option { color: var(--text); background: #fff; }
.rail-nav { flex: 1; min-height: 0; overflow-y: auto; margin: 8px -4px 0; padding: 0 4px; scrollbar-width: thin; scrollbar-color: #354157 transparent; }
.nav-group { margin-top: 14px; }
.nav-section-label { padding: 0 10px 6px; color: #7c8699; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.nav-list { display: grid; gap: 2px; }
.nav-btn { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 0 10px; border: 0; border-radius: 8px; color: var(--rail-text); background: transparent; text-align: left; font-size: 13.5px; font-weight: 500; text-decoration: none; }
.nav-btn:hover { background: var(--rail-2); color: #fff; }
.nav-btn.active { background: var(--blue); color: #fff; font-weight: 600; }
.nav-icon { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav-btn.active .nav-icon { opacity: 1; }
.rail-footer { border-top: 1px solid #263044; margin-top: 10px; padding-top: 12px; display: flex; align-items: center; gap: 10px; }
.avatar { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #233150; color: #dbe6ff; font-weight: 700; font-size: 13px; }
.rail-user { min-width: 0; flex: 1; }
.rail-user strong { display: block; color: #fff; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-user button { border: 0; background: none; padding: 0; color: #8b95a7; font-size: 12px; }
.rail-user button:hover { color: #fff; text-decoration: underline; }
.logout-btn { flex: none; border: 1px solid #2c374b; background: transparent; color: var(--rail-text); border-radius: 8px; height: 32px; padding: 0 10px; font-size: 12px; font-weight: 600; }
.logout-btn:hover { background: var(--rail-2); color: #fff; }
.workspace { min-width: 0; width: 100%; max-width: 1480px; margin: 0 auto; padding: 8px 32px 48px; }

/* ---------- Cabeçalho da página ---------- */
.heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin: 22px 0 20px; flex-wrap: wrap; }
.heading > div:first-child { min-width: 0; }
.heading p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; max-width: 75ch; }
.eyebrow { display: none; }
.heading-actions { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; justify-content: flex-end; }
.heading-actions .field { min-width: 160px; }
.heading-actions .inline-form .field { min-width: 150px; }
.section-tabs { display: flex; gap: 2px; flex-wrap: wrap; margin: 20px 0 0; padding: 4px; background: var(--surface-3); border-radius: 10px; width: fit-content; max-width: 100%; }
.section-tabs .btn, .tabbar .btn { border-color: transparent; background: transparent; color: var(--text-2); min-height: 32px; padding: 5px 9px; box-shadow: none; }
.section-tabs .btn:hover, .tabbar .btn:hover { background: #fff; }
.section-tabs .btn.primary, .tabbar .btn.primary { background: #fff; color: var(--blue-ink); border-color: var(--line); box-shadow: var(--shadow); }
.tabbar { display: flex; gap: 4px; flex-wrap: wrap; padding: 4px; background: var(--surface-3); border-radius: 10px; width: fit-content; max-width: 100%; margin-bottom: 16px; }

/* ---------- Superfícies ---------- */
.card { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.card > h2, .card > .toolbar { margin-bottom: 14px; }
.card h2 { font-size: 15.5px; }
.card p { line-height: 1.55; }
.card.hero { border-top: 3px solid var(--blue); }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.main-side { grid-template-columns: minmax(0, 1.7fr) minmax(300px, .85fr); align-items: start; }
.workspace > * + * { margin-top: 16px; }
.workspace > .heading { margin: 22px 0 20px; }
.workspace > .heading + *, .workspace > .section-tabs + .heading { margin-top: 0; }
.workspace > .section-tabs { margin-top: 20px; }
.workspace > .section-tabs + .heading { margin-top: 18px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar h2 { margin: 0; }
.toolbar-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar .field { min-width: 170px; }
.divider { height: 1px; background: var(--line); margin: 20px 0; }

/* Métricas */
.metric { padding: 16px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); min-width: 0; }
.metric small, .metric > span:first-child { display: block; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.metric strong { display: block; margin-top: 4px; color: var(--text); font-size: 24px; font-weight: 700; line-height: 1.25; letter-spacing: -.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric-caption { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.metric a, .metric button { margin-top: 6px; }
.balance-metric, .finance-metrics .metric.balance-metric { background: var(--rail); border-color: var(--rail); }
.balance-metric strong { color: #fff; }
.balance-metric small, .balance-metric .metric-caption { color: #a9b4c6; }
.hero-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.hero-metrics .metric { box-shadow: none; }
.finance-metrics, .report-metrics, .stock-metrics { margin-bottom: 0; }

/* Avisos */
.setup-notice { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0; padding: 14px 16px; border: 1px solid #cfe0fb; border-left: 4px solid var(--blue); border-radius: 10px; background: var(--blue-soft); }
.card .setup-notice { margin-bottom: 14px; }
.setup-notice strong { color: var(--blue-ink); }
.setup-notice p { margin: 2px 0 0; color: var(--text-2); font-size: 13px; }
.section-note { margin: 0; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; color: var(--text-2); font-size: 13px; }
.report-warning { margin: 0 0 12px; padding: 12px 14px; background: var(--amber-soft); border: 1px solid #f3d9a6; border-radius: 10px; color: #7a4a06; font-size: 13px; }
.form-error { grid-column: 1 / -1; padding: 12px 14px; border: 1px solid #f1c3c9; border-radius: 10px; background: var(--red-soft); color: var(--red); font-size: 13px; font-weight: 500; }
.hint { margin: 8px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 13px; background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: 10px; margin: 0; }
.soft-panel { padding: 14px; border-radius: 10px; background: var(--blue-soft); border: 1px solid #d6e4fb; }

/* ---------- Formulários ---------- */
.field { display: flex; flex-direction: column; gap: 6px; color: var(--text-2); font-size: 12.5px; font-weight: 600; min-width: 0; }
.field input, .field select, .field textarea, .input, .amount-input { width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; color: var(--text); font-size: 14px; font-weight: 400; outline: none; transition: border-color .12s, box-shadow .12s; }
.field textarea { height: auto; min-height: 90px; padding: 9px 11px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus, .amount-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px #d9e6fc; }
.field input:disabled, .field select:disabled { background: var(--surface-3); color: var(--muted); }
.field input:user-invalid { border-color: #e0868f; }
.field small { font-weight: 400; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: end; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid > .btn { justify-self: start; }
.form-stack { display: grid; gap: 14px; }
.form-stack > .btn { justify-self: start; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { min-width: 170px; flex: 1; }
.row-form { display: flex; align-items: center; gap: 6px; }
.amount-input { width: 130px; height: 34px; }
.compact { width: auto; min-width: 140px; height: 34px; }
.check-row { display: flex; align-items: center; gap: 9px; min-height: 30px; font-size: 13px; color: var(--text-2); font-weight: 500; }
.check-row input { width: 16px; height: 16px; accent-color: var(--blue); flex: none; }
.check-row small { margin-left: auto; }
.permission-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 16px; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 16px; min-width: 0; margin: 0; }
legend { font-weight: 650; padding: 0 6px; }
.draft-notice { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border-radius: 8px; background: var(--amber-soft); color: #7a4a06; font-size: 12.5px; }

/* Botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 7px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: #fff; color: var(--text); font-size: 13px; font-weight: 600; line-height: 1.25; text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s, color .12s; }
.btn:hover { background: var(--surface-2); border-color: #b8c4d4; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--blue-ink); }
.btn.ghost:hover { background: var(--blue-soft); }
.btn.danger { color: var(--red); border-color: #efc2c8; background: #fff; }
.btn.danger:hover { background: var(--red-soft); border-color: #e3a1aa; }
.btn.small { min-height: 30px; padding: 4px 10px; font-size: 12.5px; }
.btn.full { width: 100%; }

/* Etiquetas de situação */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.6; color: var(--text-2); background: var(--surface-3); white-space: nowrap; }
.pill.tone-info { color: var(--blue-ink); background: var(--blue-soft); }
.pill.tone-ok { color: var(--green); background: var(--green-soft); }
.pill.tone-warn { color: var(--amber); background: var(--amber-soft); }
.pill.tone-bad { color: var(--red); background: var(--red-soft); }
.pill.off { color: var(--muted); background: var(--surface-3); }
.type-badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.type-badge.income { background: var(--green-soft); color: var(--green); }
.type-badge.expense { background: var(--surface-3); color: var(--text-2); }

/* ---------- Tabelas e listas ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 1.45; }
th { text-align: left; color: var(--muted); font-size: 12px; font-weight: 600; padding: 9px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child { border-top-left-radius: 8px; }
th:last-child { border-top-right-radius: 8px; }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8fafd; }
td strong { color: var(--text); font-weight: 600; }
td small, .card td small { display: block; color: var(--muted); margin-top: 2px; font-size: 12px; }
td > .btn:last-child, td .toolbar-group { justify-content: flex-end; }
td:last-child:has(> .btn) { text-align: right; }
.money, td.money { font-weight: 650; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-pagination { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.outside-page { display: none; }
.list { display: grid; gap: 8px; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.list-row > div:first-child { min-width: 0; }
.list-row strong { display: block; font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.list-row small { display: block; margin-top: 2px; color: var(--muted); font-size: 12.5px; }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.detail-grid > div { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.detail-grid small { display: block; color: var(--muted); font-size: 12px; }
.detail-grid strong { display: block; margin-top: 2px; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.subdocs { margin: 6px 0 14px 14px; padding: 6px 0 6px 14px; border-left: 2px solid var(--line-strong); }
.supplier-list { display: grid; gap: 6px; max-height: 260px; overflow-y: auto; }

/* Recolher/abrir */
details { border-radius: 10px; }
details > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); font-size: 13px; font-weight: 600; color: var(--text-2); }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: ""; flex: none; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); opacity: .6; transition: transform .15s; }
details[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
details > summary:hover { border-color: var(--line-strong); color: var(--text); }
details[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
details[open] > :not(summary) { margin-top: 0; }
details[open] > form, details[open] > div, details[open] > p { padding: 16px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 10px 10px; }
.card details { margin: 12px 0; }
.context-help > summary, .statement-format-help > summary, .inline-source > summary { background: transparent; border-color: transparent; padding: 6px 0; color: var(--blue-ink); font-weight: 600; justify-content: flex-start; }
.context-help[open] > p, .statement-format-help[open] > p, .inline-source[open] > div { border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); margin: 4px 0 0; font-size: 12.5px; }
.statement-format-help[open] > p + p { margin-top: 6px; }
.group-details { margin: 8px 0; }
.classification-editor { margin-top: 16px; }

.panel-header { display: flex; align-items: center; gap: 10px; margin-bottom: 0 !important; }
.panel-header h2 { flex: 1; min-width: 0; margin: 0; }
.panel-header .pill { flex: none; }
.panel-header.collapsible { cursor: pointer; user-select: none; }
.panel-toggle { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); padding: 0; }
.panel-toggle:hover { background: var(--surface-3); color: var(--text); }
.panel-toggle::before { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s; }
.panel-toggle[aria-expanded="true"]::before { transform: rotate(-135deg) translate(-2px, -2px); }
.panel-count { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.panel-body:not([hidden]) { margin-top: 14px; }

/* Arquivos */
.file-picker { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px dashed #9fb3d1; border-radius: 10px; background: var(--surface-2); min-width: 0; position: relative; flex-wrap: wrap; font-weight: 400; }
.file-picker:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px #d9e6fc; }
.file-input { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0; padding: 0 !important; overflow: hidden; }
.file-info { flex: 1; min-width: 140px; }
.file-label { display: block; font-size: 13px; color: var(--text); overflow-wrap: anywhere; }
.file-meta { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.file-actions { display: flex; gap: 6px; }
.upload-form { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }

/* ---------- Gráficos simples ---------- */
.bar-row { display: grid; grid-template-columns: 140px minmax(0, 1fr) 110px; align-items: center; gap: 10px; margin: 12px 0; color: var(--text-2); font-size: 12.5px; }
.bar-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track, .compare-track, .cash-track { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar-fill, .compare-planned { height: 100%; border-radius: 999px; background: var(--blue); }
.compare-spent { height: 100%; border-radius: 999px; background: #3a4659; }
.bar-row b { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.compare-legend { display: flex; gap: 16px; font-size: 12px; margin: 0 0 12px; color: var(--muted); }
.compare-legend span::first-letter { color: var(--blue); }
.compare-legend span:last-child::first-letter { color: #3a4659; }
.compare-row { margin: 14px 0; }
.compare-row .toolbar { margin-bottom: 6px; }
.compare-row strong { font-size: 13px; font-weight: 600; }
.compare-row small { color: var(--muted); font-variant-numeric: tabular-nums; }
.compare-track + .compare-track { margin-top: 4px; }
.cash-chart { display: grid; gap: 18px; margin: 8px 0 18px; }
.cash-bar .toolbar { margin-bottom: 6px; }
.cash-track { height: 10px; }
.cash-track > span { display: block; height: 100%; background: var(--blue); border-radius: 999px; }
.cash-track > .expense { background: #3a4659; }

/* ---------- Compras ---------- */
.flow-steps { display: flex; gap: 0; flex-wrap: wrap; margin: 4px 0 16px; counter-reset: step; }
.flow-step { position: relative; padding: 6px 14px 6px 10px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.flow-step::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: var(--line-strong); vertical-align: 1px; }
.flow-step.done { color: var(--text-2); }
.flow-step.done::before { background: var(--green); }
.flow-step.current { color: var(--blue-ink); background: var(--blue-soft); border-radius: 999px; }
.flow-step.current::before { background: var(--blue); }
.multi-item { display: grid; grid-template-columns: 2fr .8fr .8fr 1.5fr auto; gap: 12px; align-items: end; padding: 14px; margin-bottom: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; }
.purchase-timeline { margin: 4px 0 0; padding: 0; list-style: none; }
.timeline-event { position: relative; border-left: 2px solid var(--line); padding: 0 0 16px 18px; margin-left: 5px; }
.timeline-event::before { content: ""; position: absolute; width: 10px; height: 10px; border-radius: 50%; background: var(--blue); left: -6px; top: 5px; box-shadow: 0 0 0 3px #fff; }
.timeline-event:last-child { padding-bottom: 0; border-color: transparent; }
.timeline-event .event-heading { display: flex; gap: 10px; justify-content: space-between; align-items: baseline; }
.timeline-event .event-heading strong { font-size: 13px; }
.timeline-event time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.timeline-event .event-actor { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.timeline-event .event-detail { margin: 6px 0 0; padding: 7px 10px; background: var(--surface-2); border-radius: 8px; font-size: 12.5px; color: var(--text-2); }
.timeline-event.received::before, .timeline-event.approved::before { background: var(--green); }
.timeline-event.cancelled::before, .timeline-event.divergent::before { background: var(--red); }

/* ---------- Financeiro ---------- */
.bank-filter { padding: 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; margin: 0 0 14px; }
.bank-entry { padding: 10px 0 12px; border-bottom: 1px solid var(--line); }
.bank-entry:last-child { border-bottom: 0; }
.bank-entry .inline-form { margin: 8px 0; }
.bank-entry .list-row { gap: 12px; }
.bank-entry .list-row > div:first-of-type { flex: 1; min-width: 0; }
.bank-selection { margin: 12px 0; flex-wrap: wrap; }
.record-buttons { margin: 10px 0; flex-wrap: wrap; }
.bank-entry > .record-buttons { display: inline-flex; margin: 8px 8px 0 0; }
.record-history { margin: 12px 0; }
.financial-trash { margin-top: 16px; }
.statement-identification { margin-top: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.statement-identification h3, .statement-identification h4 { margin-top: 0; }
.statement-identification form { margin-top: 12px; }
.finance-layout .list-row .toolbar-group { justify-content: flex-end; }
.balance-setup-grid { align-items: start; }
.balance-account-info { line-height: 1.7; overflow-wrap: anywhere; margin: 0 0 16px; }
.balance-duplicate-action { margin-top: 14px; }
.accounting-table { min-width: 960px; table-layout: auto; font-size: 12.5px; }
.accounting-table th { background: var(--rail); color: #fff; border-bottom: 0; }
.accounting-table tbody tr:nth-child(even) { background: var(--surface-2); }
.accounting-table td:nth-child(1), .accounting-table td:nth-child(2), .accounting-table td:nth-child(6), .accounting-table td:nth-child(8) { white-space: nowrap; }
.accounting-totals { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 28px; margin-top: 16px; font-size: 12.5px; color: var(--muted); }
.accounting-totals strong { display: block; margin-top: 2px; font-size: 18px; color: var(--text); font-variant-numeric: tabular-nums; }
.report-section { margin-bottom: 0; }
#print-report > * + * { margin-top: 16px; }
.report-footnote { color: var(--muted); font-size: 12px; margin-top: 16px; }
.report-column { border-bottom: 1px solid var(--line); padding: 8px 0; }
.print-title { display: none; }

/* Menu de exportação */
.menu { position: relative; }
.menu > summary { border: 1px solid var(--line-strong); background: #fff; color: var(--text); padding: 7px 14px; min-height: 36px; border-radius: var(--radius-sm); }
.menu[open] > summary { border-radius: var(--radius-sm); }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 320px; padding: 6px !important; border: 1px solid var(--line) !important; border-radius: 12px !important; background: #fff; box-shadow: var(--shadow-lg); display: grid; gap: 2px; }
.menu-list .btn, .menu-list a { display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 1px; width: 100%; min-height: 0; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text); text-align: left; white-space: normal; font-weight: 600; text-decoration: none; }
.menu-list .btn:hover, .menu-list a:hover { background: var(--surface-2); }
.menu-list .btn.primary { background: transparent; color: var(--blue-ink); }
.menu-list small { font-weight: 400; color: var(--muted); font-size: 12px; }

/* ---------- Estoque e RH ---------- */
.stock-tabs .toolbar-group { gap: 4px; padding: 4px; background: var(--surface-3); border-radius: 10px; }
.stock-badge { display: inline-block; border: 1px solid; border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.stock-green { color: var(--green); background: var(--green-soft); border-color: #bfe5d0; }
.stock-yellow { color: var(--amber); background: var(--amber-soft); border-color: #f1d49c; }
.stock-red { color: var(--red); background: var(--red-soft); border-color: #efbcc3; }
.stock-expired { color: #fff; background: var(--red); border-color: var(--red); }
.stock-none { color: var(--text-2); background: var(--surface-3); border-color: var(--line); }
.stock-empty { padding: 16px 0; }
.stock-json { max-width: 500px; max-height: 350px; overflow: auto; white-space: pre-wrap; font-size: 11px; }
.stock-alert { text-align: left; color: var(--text); }
.stock-alert:hover { border-color: #86ace9; background: #f3f7ff; }
.hr-editor-row { border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin: 10px 0; background: var(--surface-2); }
.hr-editor-row .toolbar-group { margin-top: 10px; }
.hr-tax-row .form-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.hr-period { display: flex; align-items: flex-end; gap: 8px; margin: 0 0 16px; }
.hr-period .field { min-width: 180px; }

/* ---------- Diálogos e mensagens ---------- */
.erp-dialog { border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 22px; max-width: 520px; width: calc(100% - 32px); color: var(--text); }
.erp-dialog::backdrop { background: rgba(17, 24, 39, .45); }
.erp-dialog h2 { margin: 0; }
.erp-dialog p { margin: 0; font-size: 13.5px; }
.dialog-actions { justify-content: flex-end; margin-top: 8px; }
.record-dialog-backdrop { position: fixed; inset: 0; background: rgba(17, 24, 39, .45); display: grid; place-items: center; padding: 20px; z-index: 1000; }
.record-dialog { width: min(100%, 540px); max-height: 90vh; overflow: auto; box-shadow: var(--shadow-lg); }
.record-dialog p { color: var(--muted); font-size: 13.5px; }
.record-dialog .toolbar-group { margin-top: 18px; justify-content: flex-end; }
#toast { position: fixed; z-index: 2000; bottom: 20px; right: 20px; max-width: min(520px, calc(100vw - 40px)); padding: 12px 16px; border-radius: 10px; background: var(--rail); color: #fff; box-shadow: var(--shadow-lg); font-size: 13.5px; line-height: 1.5; opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .18s, transform .18s; }
#toast.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
#toast.show.error { display: flex; align-items: center; gap: 12px; background: var(--red); }
#toast .btn { flex: none; }
.toast-dismiss { flex: none; cursor: pointer; border: 1px solid rgba(255,255,255,.45); border-radius: 6px; background: transparent; color: #fff; padding: 4px 8px; font-size: 12px; }
.nav-loading { opacity: .65; pointer-events: none; }

/* ---------- Responsivo ---------- */
@media (max-width: 1180px) {
  .grid.main-side { grid-template-columns: 1fr; }
  .workspace { padding: 8px 22px 40px; }
  .multi-item { grid-template-columns: 2fr 1fr 1fr; }
  .multi-item .field:nth-child(4) { grid-column: 1 / 3; }
}
@media (max-width: 900px) {
  .shell { display: block; }
  .rail { position: sticky; top: 0; z-index: 50; height: auto; padding: 10px 14px; overflow: visible; }
  .menu-toggle { display: inline-flex; align-items: center; }
  .rail-nav, .rail-footer, .unit-picker { display: none; }
  .rail.open { height: 100vh; overflow-y: auto; }
  .rail.open .rail-nav, .rail.open .unit-picker { display: block; }
  .rail.open .rail-footer { display: flex; }
  .workspace { padding: 4px 16px 32px; }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .heading { flex-direction: column; align-items: stretch; margin: 18px 0 16px; }
  .heading-actions { justify-content: flex-start; }
  .setup-notice { flex-direction: column; align-items: flex-start; }
  .hero-metrics { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .form-grid, .permission-grid, .detail-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .multi-item { grid-template-columns: 1fr 1fr; }
  .multi-item > .field:first-child, .multi-item > .field:nth-child(4) { grid-column: 1 / -1; }
  .bar-row { grid-template-columns: 90px minmax(0, 1fr) 90px; gap: 6px; }
  .auth-card { padding: 24px; }
  .metric strong { font-size: 21px; }
  .card { padding: 16px; }
  .menu-list { right: auto; left: 0; width: min(320px, calc(100vw - 32px)); }
  .heading-actions > *, .heading-actions .field { min-width: 0; }
}

/* ---------- Impressão ---------- */
@media print {
  :root, body { background: #fff !important; color: #000; }
  .shell { display: block; }
  .workspace { padding: 0 !important; max-width: none; }
  .rail, .heading, .no-print, #toast, .panel-toggle, .table-pagination, .section-tabs { display: none !important; }
  .panel-body[hidden] { display: block !important; }
  .outside-page { display: table-row !important; }
  .print-title { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 16px; border-bottom: 2px solid #074698; padding-bottom: 10px; font-size: 14px; }
  .print-title strong { color: #074698; }
  .report-metrics { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .metric { box-shadow: none !important; border: 1px solid #d8e2ee !important; background: #fff !important; }
  .metric strong, .balance-metric strong { font-size: 18px; color: #000; }
  .card { box-shadow: none; border: 0; border-radius: 0; padding: 8px 0; }
  .report-section { break-inside: auto; }
  table { font-size: 9px; }
  th, td { padding: 5px 6px; }
  .table-wrap { overflow: visible !important; }
  thead { display: table-header-group; }
  tr { break-inside: avoid; }
  .accounting-table { min-width: 0; font-size: 9px; }
  .accounting-table th { background: #1d2939 !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .accounting-table .money { white-space: normal; }
  .print-accounting-only #print-report > :not(.print-title):not(.accounting-report) { display: none !important; }
  .print-accounting-only .report-metrics { display: none !important; }
  .print-accounting-only .card:not(.accounting-report) { display: none !important; }
  .list-row { border: 0; border-bottom: 1px solid #ddd; background: none; }
  @page { size: A4; margin: 14mm; }
}

/* Colunas laterais estreitas: formulários em uma coluna. */
.grid.main-side > .grid:last-child .form-grid, .upload-form .form-grid { grid-template-columns: 1fr; }
.grid.main-side > .grid:last-child .form-grid .wide { grid-column: auto; }
.financial-trash { padding-top: 14px; padding-bottom: 14px; }
.financial-trash > .toolbar { margin-bottom: 0; }
.financial-trash > .toolbar h2 { font-size: 14px; color: var(--text-2); }
.financial-trash > .toolbar + * { margin-top: 14px; }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.negative, .metric strong.negative { color: var(--red); }
@media screen { .report-footnote { display: none; } }
@media (max-width: 1180px) { .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid.four { grid-template-columns: 1fr; } }
form[data-form="overview-filter"] button[type="submit"], form[data-form="hr-period"] button[type="submit"] { display: none; }
.link-btn { display: block; margin-top: 2px; padding: 0; border: 0; background: none; color: var(--blue-ink); font-size: 12px; font-weight: 500; }
.link-btn:hover { text-decoration: underline; }
@media (max-width: 900px) {
  .rail.open { position: fixed; inset: 0; z-index: 100; height: 100vh; overflow-y: auto; }
  .finance-metrics .metric, .report-metrics .metric { padding: 12px 14px; }
  .metric strong { font-size: 20px; }
}
.upload-details { margin: 10px 0 0; }
.upload-details > summary { background: transparent; border-color: transparent; padding: 6px 0; color: var(--blue-ink); justify-content: flex-start; }
.upload-details[open] > form { margin-top: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.upload-details .upload-form { margin-top: 0; padding-top: 16px; }
.card > .record-buttons:last-child { margin: 20px 0 0; padding-top: 14px; border-top: 1px solid var(--line); }
/* Cartão que só contém um "abrir formulário": vira uma barra simples. */
.card:has(> details:only-child) { padding: 0; border: 0; background: transparent; box-shadow: none; }
.card > details:only-child { margin: 0; }
.card > details:only-child > summary { background: var(--surface); padding: 14px 18px; border: 1px solid var(--line); border-radius: 12px; font-size: 14px; color: var(--blue-ink); box-shadow: var(--shadow); }
.card > details:only-child[open] > summary { border-radius: 12px 12px 0 0; }
.card > details:only-child[open] > :not(summary) { background: var(--surface); padding: 18px; border-radius: 0 0 12px 12px; }
#multi-items > .multi-item:only-child [data-action="ex-remove-item"] { visibility: hidden; }

/* ---------- Certidões ---------- */
.cert-grid { align-items: stretch; }
.cert-card { display: flex; flex-direction: column; gap: 12px; border-left: 4px solid var(--line-strong); }
.cert-card > .toolbar { margin-bottom: 0; align-items: flex-start; }
.cert-card > .toolbar h2 { font-size: 15px; }
.cert-card.status-valid { border-left-color: var(--green); }
.cert-card.status-warning { border-left-color: #e0a100; background: #fffdf5; }
.cert-card.status-expired, .cert-card.status-missing { border-left-color: var(--red); }
.cert-card.status-expired { background: #fffafa; }
.cert-card .toolbar-group { margin-top: auto; }
.cert-card .classification-editor { margin: 0; }
.cert-dates { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.cert-dates small { display: block; color: var(--muted); font-size: 12px; }
.cert-dates strong { display: block; font-size: 14px; font-weight: 600; }
.status-warning .cert-dates div:nth-child(2) strong { color: var(--amber); }
.status-expired .cert-dates div:nth-child(2) strong { color: var(--red); }
.metric strong.warn { color: var(--amber); }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; font-size: 11.5px; font-weight: 700; color: #fff; background: var(--red); }
.nav-badge.warn { background: #d99a00; color: #1a1300; }
@media (max-width: 640px) { .cert-dates { grid-template-columns: 1fr 1fr; } }

/* ---------- Contrato de gestão ---------- */
.mg-facts { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 12px; }
.mg-facts > div { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 10px; font-size: 13px; }
.mg-facts small { color: var(--muted); font-size: 12.5px; }
.mg-facts span { overflow-wrap: anywhere; }
.mg-plan-table .mg-group-row td { background: var(--surface-2); border-top: 1px solid var(--line); }
.mg-plan-table .mg-total-row td { border-top: 2px solid var(--line-strong); font-weight: 700; }
.mg-plan-table td:first-child { padding-left: 18px; }
.mg-plan-table .mg-group-row td:first-child, .mg-plan-table .mg-total-row td:first-child { padding-left: 12px; }
tr.mg-selected td { background: var(--blue-soft); }
.mg-inactive { opacity: .6; }
.mg-checklist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 18px; }
.mg-checklist .check-row { align-items: flex-start; padding: 4px 0; }
.mg-checklist .check-row input { margin-top: 2px; }
.mg-period-panel { border-left: 4px solid var(--blue); }
.mg-preview { margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); display: grid; gap: 10px; }
.mg-errors { margin: 0; color: var(--red); font-size: 12.5px; }
.mg-add-item { margin-top: 12px; }
.mg-actions { margin-top: 12px; }
.section-tabs .nav-badge { margin-left: 6px; }
@media (max-width: 640px) { .mg-checklist { grid-template-columns: 1fr; } .mg-facts > div { grid-template-columns: 1fr; gap: 0; } }

/* ---------- Metas e indicadores ---------- */
.mg-goals-toolbar { justify-content: flex-start; align-items: flex-end; }
.mg-goals-toolbar .field { min-width: 180px; }
.mg-results-table td { vertical-align: top; }
.mg-results-table select, .mg-results-table input, .mg-results-table textarea { width: 100%; min-width: 110px; height: 34px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; font-size: 13px; }
.mg-results-table textarea { height: auto; min-height: 52px; padding: 6px 8px; margin-top: 6px; resize: vertical; }
.mg-results-table td:last-child { min-width: 260px; }
.mg-ratio { display: grid; grid-template-columns: minmax(80px, 1fr) auto minmax(80px, 1fr); gap: 6px; align-items: center; min-width: 200px; }
.mg-concepts { display: grid; gap: 8px; }
.mg-concept-row { display: grid; grid-template-columns: 140px minmax(0, 1fr) 140px; gap: 10px; }
.mg-report { display: none; }
@media print {
  body.mg-print .workspace > :not(.mg-report) { display: none !important; }
  body.mg-print .mg-report { display: block !important; }
  .mg-report h2 { font-size: 15px; margin: 8px 0; }
  .mg-report h3 { font-size: 12px; margin: 14px 0 6px; }
  .mg-report p { font-size: 11px; margin: 0 0 6px; }
}
@media (max-width: 640px) { .mg-concept-row { grid-template-columns: 1fr; } }
@media print { .mg-report table + p { margin-top: 10px; } .mg-report table { margin-bottom: 4px; } }

/* ---------- Extrato em tabela ---------- */
.bank-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin: 4px 0 8px; }
.bank-bar .tabbar { margin: 0; }
.tab-count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: rgba(16, 24, 40, .08); font-size: 12px; font-weight: 700; text-align: center; }
.bank-search { display: flex; gap: 8px; flex: 1 1 100%; min-width: 0; }
.bank-search input, .bank-search select { flex: 1; min-width: 0; height: 36px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; color: var(--text); font: inherit; }
.bank-search select { flex: 0 1 200px; }
.bank-period { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.bank-period strong { color: var(--text); }
.bank-period .link-btn { display: inline; font-size: inherit; }
.bank-dates > summary { display: inline-flex; align-items: center; gap: 8px; min-height: 0; padding: 0; border: 0; background: none; box-shadow: none; cursor: pointer; color: var(--blue-ink); font-size: 13px; font-weight: 600; }
.bank-table .desc strong, .bank-table .desc small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bank-table td:not(.desc), .bank-table th { white-space: nowrap; }
.bank-dates-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-top: 8px; }
.bank-table .sel { width: 34px; padding-right: 0; }
.bank-table .date { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.bank-table .desc { width: 100%; max-width: 0; min-width: 160px; }
.bank-table .num { text-align: right; }
.bank-table .money.positive { color: var(--green); }
.bank-table .money.negative { color: var(--text); }
.bank-table tr.is-pending > td:first-child { box-shadow: inset 3px 0 0 #e8a317; }
.bank-table .actions .toolbar-group { flex-wrap: nowrap; gap: 6px; }
.row-menu > summary { padding: 4px 10px; min-height: 30px; font-weight: 700; letter-spacing: .05em; }
.row-menu > summary::after { display: none; }
.row-menu .menu-list { width: 290px; }
.bank-panel-row > td { padding: 0 12px 14px; background: var(--surface-2); }
.bank-panel-row:hover { background: transparent; }
.bank-panel-row .statement-identification { margin-top: 0; padding: 14px 4px 0; border: 0; background: transparent; }
.bank-selection { display: flex; justify-content: flex-end; margin: 0 0 8px; }
.bank-selection[hidden] { display: none; }
.imports-box { margin-top: 14px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; }
.imports-box > summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; font-weight: 600; font-size: 13.5px; }
.imports-box[open] > summary { margin-bottom: 10px; }

/* ---------- Financeiro enxuto ---------- */
.card-tabs { margin: 0; }
.card-tabs .btn.small { min-height: 30px; padding: 0 10px; }
.compact-table td { padding-top: 9px; padding-bottom: 9px; }
.compact-table .num, .compact-table th.num { text-align: right; }
.compact-table .date { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.compact-table td small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 340px; }

/* ---------- Telas enxutas ---------- */
.attention-card .list-row small { display: block; color: var(--muted); font-size: 12px; }
.attention-card .list-row strong { font-weight: 600; }
.mg-facts-box > summary { cursor: pointer; color: var(--blue-ink); font-weight: 600; font-size: 13px; }
.mg-facts-box[open] > summary { margin-bottom: 12px; }

/* ---------- Relatório gerencial ---------- */
.print-only { display: none; }
.board-report { max-width: 1040px; }
.board-report .br-page { padding: 32px 36px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.board-report .br-page + .br-page { margin-top: 16px; }
.br-page h2 { margin: 0 0 18px; padding-bottom: 10px; border-bottom: 2px solid var(--blue); font-size: 20px; color: var(--rail); }
.br-page h3 { margin: 22px 0 10px; font-size: 14px; color: var(--rail); }
.br-cover { min-height: 420px; display: flex; flex-direction: column; justify-content: center; }
.br-cover-mark { width: 84px; height: 84px; border-radius: 50%; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; margin-bottom: 26px; }
.br-cover-mark img { width: 62px; height: 62px; object-fit: contain; }
.br-kicker { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--blue); }
.br-cover h1 { margin: 8px 0 6px; font-size: 34px; letter-spacing: -.02em; color: var(--rail); }
.br-period { margin: 0; font-size: 22px; font-weight: 600; color: var(--text); }
.br-audience { margin: 6px 0 30px; color: var(--muted); }
.br-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 0; padding-top: 18px; border-top: 1px solid var(--line); }
.br-meta dt { font-size: 12px; color: var(--muted); }
.br-meta dd { margin: 2px 0 0; font-weight: 600; }
.br-org { margin: 18px 0 0; font-size: 12px; color: var(--muted); }
#board-comment-status { margin: 6px 0 0; }
.br-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.br-kpi { padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.br-kpi small { display: block; color: var(--muted); font-size: 12px; }
.br-kpi strong { display: block; margin: 4px 0 2px; font-size: 22px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.br-kpi.dark { background: var(--rail); border-color: var(--rail); color: #fff; }
.br-kpi.dark small, .br-kpi.dark .br-sub { color: #aab3c2; }
.br-sub { display: block; font-size: 12px; color: var(--muted); }
.br-var { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
.br-var.up { color: var(--green); }
.br-var.down { color: var(--red); }
.br-highlights { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.br-highlights li { padding: 8px 12px; border-left: 3px solid var(--blue); background: var(--surface-2); border-radius: 0 8px 8px 0; font-size: 13.5px; }
.br-highlights li.ok { border-left-color: var(--green); }
.br-highlights li.warn { border-left-color: #e8a317; }
.br-highlights li.bad { border-left-color: var(--red); }
#board-comment { width: 100%; padding: 12px; border: 1px solid var(--line-strong); border-radius: 10px; font: inherit; resize: vertical; }
.br-comment { padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; white-space: pre-wrap; font-size: 13px; }
.br-quality { margin: 16px 0 0; padding: 10px 12px; border-radius: 8px; background: var(--amber-soft); color: var(--amber); font-size: 12.5px; }
.br-table td, .br-table th { padding: 8px 10px; }
.br-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.br-table td small { display: block; }
.br-table .br-total td { font-weight: 700; border-top: 2px solid var(--line-strong); background: var(--surface-2); }
.br-chart { width: 100%; height: auto; display: block; margin-top: 6px; font: 11px "Segoe UI", sans-serif; fill: #667085; }
.br-legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.br-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.br-note { margin: 12px 0 0; font-size: 11.5px; color: var(--muted); }
.br-text { margin: 0; font-size: 13.5px; }
.br-sign { display: flex; justify-content: flex-end; margin-top: 46px; }
.br-sign div { width: 300px; text-align: center; font-weight: 600; }
.br-sign span { display: block; border-top: 1px solid var(--text); margin-bottom: 6px; }
.br-sign small { display: block; font-weight: 400; color: var(--muted); }
@media screen and (max-width: 760px) { .br-kpis, .br-meta { grid-template-columns: 1fr; } .board-report .br-page { padding: 20px 16px; } }
@media print { .br-kpis { grid-template-columns: repeat(3, 1fr) !important; } .br-meta { grid-template-columns: repeat(3, 1fr) !important; } .br-cover { border-top: 6px solid var(--blue); padding-top: 28mm !important; justify-content: flex-start; } }
@media print {
  .print-only { display: block !important; }
  body.board-print .workspace > :not(.board-report) { display: none !important; }
  .board-report { max-width: none; page: board; }
  .board-report .br-page { border: 0; box-shadow: none; border-radius: 0; padding: 0; break-before: page; }
  .board-report .br-page:first-child { break-before: auto; }
  .board-report .br-page + .br-page { margin-top: 0; }
  .br-cover { min-height: 240mm; }
  .br-kpi, .br-kpi.dark, .br-highlights li, .br-table .br-total td, .br-quality, .pill, .br-chart rect, .br-legend i { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .br-table, .br-table th, .br-table td, .br-table td strong { font-size: 10px !important; }
  .br-table td small, .card .br-table td small { font-size: 8.5px !important; }
  .br-table .pill { font-size: 8.5px !important; padding: 1px 7px; }
  .br-highlights li, .br-text, .br-comment { font-size: 10.5px !important; }
  .br-chart { max-height: 70mm; }
  .br-kpi strong { font-size: 17px; }
}
@page board { size: A4; margin: 16mm 14mm 18mm;
  @bottom-left { content: "Relatório gerencial · uso interno"; font: 8pt "Segoe UI", sans-serif; color: #667085; }
  @bottom-right { content: "Página " counter(page) " de " counter(pages); font: 8pt "Segoe UI", sans-serif; color: #667085; }
}
@page board:first { @bottom-left { content: none; } @bottom-right { content: none; } }

/* ---------- Peças da prestação de contas ---------- */
.pc-toolbar { align-items: flex-end; }
.pc-hint { flex-basis: 100%; margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.pc-warnings { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 13px; color: var(--amber); }
.pc-docs { display: grid; gap: 16px; }
.pc-doc { position: relative; max-width: 820px; padding: 40px 44px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: #000; font-size: 12.5px; }
.pc-doc-tools { position: absolute; top: 12px; right: 12px; }
.pc-head { text-align: center; margin-bottom: 18px; }
.pc-head p { margin: 2px 0; font-weight: 600; }
.pc-head h3 { margin: 6px 0; font-size: 15px; letter-spacing: .01em; line-height: 1.35; }
.pc-doc h4 { margin: 18px 0 6px; font-size: 12.5px; text-transform: uppercase; }
.pc-id, .pc-grid { width: 100%; border-collapse: collapse; margin: 8px 0 12px; font-size: 11.5px; }
.pc-id th, .pc-id td, .pc-grid th, .pc-grid td { border: 1px solid #555; padding: 3px 6px; text-align: left; vertical-align: top; }
.pc-id th { width: 34%; font-weight: 600; background: #f2f4f7; }
.pc-grid th { background: #f2f4f7; font-weight: 700; }
.pc-grid .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pc-grid .pc-caption { text-align: center; }
.pc-grid .pc-total td { font-weight: 700; }
.pc-rp06 th { font-size: 9.5px; }
.pc-lines { margin: 0 0 12px; }
.pc-lines div { display: flex; gap: 6px; margin: 2px 0; }
.pc-lines dt { font-weight: 700; white-space: nowrap; }
.pc-lines dd { margin: 0; }
.pc-note, .pc-text { margin: 10px 0; text-align: justify; line-height: 1.45; }
.pc-place { margin: 18px 0 0; text-align: right; }
.pc-sign { width: 320px; margin: 46px auto 0; text-align: center; }
.pc-sign span { display: block; border-top: 1px solid #000; margin-bottom: 4px; }
.pc-sign strong { display: block; text-transform: uppercase; }
.pc-sign small { display: block; }
.pc-stamp-screen { margin: 26px 0 0 auto; max-width: 260px; font-size: 9px; text-transform: uppercase; color: #777; text-align: left; }
.pc-stamp-print { display: none; }
@media print {
  body.pc-print .workspace > :not(.pc-docs) { display: none !important; }
  body.pc-print .pc-doc.pc-skip { display: none !important; }
  .pc-docs { display: block; page: pc; }
  .pc-doc { max-width: none; padding: 0; border: 0; box-shadow: none; border-radius: 0; break-before: page; font-size: 11px; }
  .pc-doc:not(.pc-skip) ~ .pc-doc { break-before: page; }
  .pc-docs > .pc-doc:first-of-type { break-before: auto; }
  .pc-id th, .pc-grid th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pc-stamp-screen { display: none; }
  .pc-stamp-print { display: none !important; }
  .pc-grid tr, .pc-id tr { break-inside: avoid; }
}
@page pc { size: A4; margin: 16mm 16mm 26mm; }
.pc-grid th.num { white-space: normal; }
.pc-rp06 { table-layout: fixed; }
.pc-rp06 th:first-child, .pc-rp06 td:first-child { width: 26%; }
.pc-rp06 td.num { font-size: 10.5px; }

/* ---------- Caderno completo da prestação ---------- */
.pc-parts { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.pc-parts .check-row { font-size: 13px; }
.pc-logo-list { display: flex; flex-wrap: wrap; gap: 12px; margin: 6px 0 10px; }
.pc-logo-item { display: grid; gap: 4px; justify-items: center; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.pc-logo-item img { max-width: 160px; max-height: 60px; object-fit: contain; }
.pc-progress { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 50; padding: 10px 18px; border-radius: 999px; background: #10233f; color: #fff; font-size: 13px; box-shadow: var(--shadow); }
.pc-book { display: none; }
@media print {
  body.pc-book-print .workspace > :not(.pc-book) { display: none !important; }
  body.pc-book-print .pc-book { display: block; page: pc; color: #000; }
  body.pc-book-print .pc-book .pc-stamp-print { display: none !important; }
  .pc-book .pc-part, .pc-book .pc-doc { break-before: page; }
  .pc-book .pc-doc-tools, .pc-book .pc-stamp-screen { display: none; }
  .pc-book .mg-report { display: block !important; }
  .pc-logos { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 14mm; }
  .pc-logos img { max-height: 20mm; max-width: 55mm; object-fit: contain; }
  .pc-logos img:only-child { margin: 0 auto; }
  .pc-cover { position: relative; min-height: 250mm; text-align: center; page: pc-cover; }
  .pc-cover-body { margin-top: 45mm; display: grid; gap: 4mm; font-size: 14px; }
  .pc-cover-body p { margin: 0; }
  .pc-cover h1 { margin: 6mm 0; font-size: 30px; text-transform: uppercase; letter-spacing: .04em; color: #074698; }
  .pc-back .pc-cover-body { margin-top: 90mm; font-size: 12px; }
  .pc-cover-footer { position: absolute; left: 0; right: 0; bottom: 16mm; margin: 0; font-size: 10px; text-align: center; color: #333; }
  .pc-index { position: relative; min-height: 250mm; }
  .pc-index h2 { margin: 0 0 2mm; text-align: center; font-size: 18px; text-transform: uppercase; letter-spacing: .04em; }
  .pc-index-sub { margin: 0 0 10mm; text-align: center; font-size: 11px; color: #333; }
  .pc-index ol { margin: 0; padding-left: 8mm; font-size: 13px; line-height: 2; }
  .pc-office { font-size: 12px; }
  .pc-office-number { margin: 0; font-weight: 700; }
  .pc-office .pc-place { margin: 2mm 0 10mm; }
  .pc-office-text p { margin: 0 0 4mm; text-align: justify; line-height: 1.5; }
  .pc-scan { text-align: center; }
  .pc-scan-title { margin: 0 0 3mm; font-size: 9px; text-align: left; color: #444; text-transform: uppercase; }
  .pc-scan img { display: block; max-width: 100%; max-height: 226mm; width: auto; height: auto; margin: 0 auto; border: 1px solid #ccc; }
  .pc-missing { margin-top: 40mm; font-size: 13px; }
  .pc-statement h3 { margin: 0 0 2mm; font-size: 13px; }
  .pc-statement .pc-grid { font-size: 10px; }
}
@page pc { @bottom-left { content: "Página " counter(page) " de " counter(pages); font-size: 8pt; color: #666; } }
@page pc-cover { size: A4; margin: 16mm 16mm 26mm; }

/* ---------- Transparência do contrato ---------- */
.tr-toolbar { align-items: flex-end; }
.tr-docs { display: grid; gap: 16px; }
.tr-head p { display: none; }
.tr-head h2 { margin: 0 0 10px; }
.tr-grid { width: 100%; border-collapse: collapse; font-size: 13px; }
.tr-grid th, .tr-grid td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tr-grid th { font-size: 12px; color: var(--muted); font-weight: 600; }
.tr-grid .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tr-grid th.num { white-space: normal; }
.tr-grid .tr-total td { font-weight: 700; border-top: 2px solid var(--line); }
.tr-goals td:first-child { min-width: 240px; }
.tr-met { color: #157f3b; }
.tr-partial { color: #a15c00; }
.tr-not { color: #b42318; font-weight: 600; }
.tr-note { margin: 10px 0 0; font-size: 12px; color: var(--muted); }
@media print {
  body.tr-print .workspace > :not(.tr-docs) { display: none !important; }
  body.tr-print .tr-docs { display: block; page: tr; color: #000; }
  .tr-doc { break-before: page; border: 0 !important; box-shadow: none !important; padding: 0 !important; margin: 0 !important; }
  .tr-docs > .tr-doc:first-child { break-before: auto; }
  .tr-head { border-bottom: 2px solid #074698; margin-bottom: 8px; padding-bottom: 6px; }
  .tr-head p { display: block; margin: 0 0 2px; font-size: 10px; color: #333; }
  .tr-head h2 { margin: 0; font-size: 15px; color: #074698; }
  .tr-grid { font-size: 10px; }
  .tr-grid th, .tr-grid td { padding: 3px 5px; border: 1px solid #999; }
  .tr-grid th { color: #000; background: #f2f4f7; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .tr-grid tr { break-inside: avoid; }
  .tr-note { font-size: 9px; color: #333; }
  .tr-met, .tr-partial, .tr-not { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@page tr { size: A4 landscape; margin: 12mm 12mm 14mm; @bottom-left { content: "Página " counter(page) " de " counter(pages); font-size: 8pt; color: #666; } }

/* ---------- Tabelas dos documentos (peças, caderno, transparência): bordas completas e cabeçalhos que quebram linha ---------- */
.pc-grid tbody tr:last-child > *, .pc-id tbody tr:last-child > * { border-bottom: 1px solid #555; }
.pc-grid th, .pc-id th { white-space: normal; color: #000; border-radius: 0; }
.pc-id th { font-weight: 600; }
.tr-grid tbody tr:last-child > * { border-bottom: 1px solid var(--line); }
.tr-grid th { border-radius: 0; }
@media print {
  .tr-grid tbody tr:last-child > * { border-bottom: 1px solid #999; }
  .mg-report table th { border-radius: 0; }
  .mg-report tbody tr:last-child > * { border-bottom: 1px solid #c8ced8; }
}

/* ---------- Relatório mensal de execução e comparativo de metas (padrão do caderno) ---------- */
.mg-report { color: #000; }
.mg-report .rep-title { text-align: center; margin: 0 0 12px; }
.mg-report .rep-title h2 { margin: 0 0 4px; font-size: 15px; text-transform: uppercase; letter-spacing: .02em; }
.mg-report .rep-title p { margin: 2px 0; font-size: 12px; font-weight: 600; text-align: center; }
.mg-report h3 { margin: 16px 0 6px; padding-bottom: 3px; border-bottom: 1.5px solid #2b3445; font-size: 12.5px; text-transform: uppercase; color: #1d2939; break-after: avoid; }
.mg-report h4 { margin: 12px 0 4px; font-size: 11.5px; break-after: avoid; }
.mg-report p { margin: 0 0 6px; font-size: 11px; line-height: 1.45; text-align: justify; }
.rep-kv, .rep-grid, .rep-card { width: 100%; border-collapse: collapse; margin: 4px 0 10px; font-size: 10.5px; }
.rep-kv th, .rep-kv td, .rep-grid th, .rep-grid td, .rep-card th, .rep-card td { padding: 3px 6px; border: 1px solid #9aa3b1; text-align: left; vertical-align: middle; white-space: normal; color: #000; border-radius: 0; font-size: 10.5px; }
.mg-report tbody tr:last-child > * { border-bottom: 1px solid #9aa3b1; }
.rep-kv th { width: 26%; background: #eef1f5; font-weight: 600; }
.rep-grid thead th, .rep-card thead th { background: #2b3445; color: #fff; font-weight: 600; }
.rep-grid .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rep-grid .rep-total td { background: #eef1f5; font-weight: 700; }
.rep-card td:first-child { width: 22%; background: #f4f6f9; font-weight: 600; }
.rep-card { break-inside: avoid; }
.mg-report tr { break-inside: avoid; }
.mg-report .rep-legend { font-size: 9.5px; color: #333; text-align: left; }
.rep-annexes { margin: 0 0 8px; padding-left: 18px; font-size: 11px; }
.mg-report .rep-place { margin: 18px 0 0; text-align: right; }
.rep-signs { display: flex; justify-content: space-around; gap: 24px; margin-top: 44px; break-inside: avoid; }
.rep-signs div { width: 42%; text-align: center; font-size: 11px; }
.rep-signs span { display: block; margin-bottom: 4px; border-top: 1px solid #000; }
.rep-signs strong { display: block; text-transform: uppercase; }
.rep-signs small { display: block; }
@media print {
  .rep-kv th, .rep-grid thead th, .rep-card thead th, .rep-card td:first-child, .rep-grid .rep-total td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
/* Relação nominal, índice com subitens e alinhamento das tabelas das peças */
.pc-grid td { vertical-align: middle; }
.pc-rp06 th:first-child, .pc-rp06 td:first-child { width: 29%; }
.pc-staff td, .pc-staff th { font-size: 10.5px; }
.pc-small { font-size: 10px; color: #333; }
.pc-index ol ul { margin: 0 0 4px; padding-left: 6mm; font-size: 11.5px; line-height: 1.6; list-style: disc; }

/* Usuários: ações em coluna estreita */
.user-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
