/* ===== Painel DPC — tema ===== */
/* Identidade visual DPC (dpcnet.com.br): verde #007030, verde-claro #3EC252, verde-escuro #02271A, fonte Open Sans */
:root {
  color-scheme: light;
  --bg: #f3f6f4;
  --surface: #ffffff;
  --surface-2: #f6f9f7;
  --border: #e1e7e3;
  --border-strong: #c9d3cc;
  --text: #1b231e;
  --text-2: #435047;
  --muted: #737f77;
  --brand: #02271a;
  --brand-2: #007030;
  --brand-3: #3ec252;
  --on-brand: #ffffff;
  --accent: #007030;
  --side-bg: #02271a;
  --side-text: #c4d8cb;
  --side-active: #ffffff;
  --side-hover: rgba(255,255,255,.07);
  --good: #0b8a0b;
  --good-bg: #e7f6e7;
  --warn: #a96b00;
  --warn-bg: #fff4dc;
  --crit: #c22f2f;
  --crit-bg: #fde9e9;
  --info: #1f5fae;
  --info-bg: #e8f1fc;
  /* paleta de gráficos validada (daltonismo e contraste): verde DPC na 1ª posição */
  --series-1: #007030; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #2a78d6; --series-7: #e34948; --series-8: #4a3aa7;
  --grid: #e9eeea;
  --shadow: 0 1px 2px rgba(2,39,26,.05), 0 1px 3px rgba(2,39,26,.06);
  --radius: 10px;
  --font: 'Open Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1411; --surface: #151d18; --surface-2: #1b251f; --border: #26332b; --border-strong: #33443a;
    --text: #eef3ef; --text-2: #c2cfc6; --muted: #8b9a90; --brand: #7fd99a; --brand-2: #3ec252; --brand-3: #3ec252; --on-brand: #01170f; --accent: #4fcf68;
    --side-bg: #01170f; --side-text: #a9c4b2;
    --good: #3cc23c; --good-bg: #13301a; --warn: #f0b23a; --warn-bg: #332810; --crit: #f07272; --crit-bg: #3a1616; --info: #7fb0ee; --info-bg: #142640;
    --series-1: #1f8f3e; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #3987e5; --series-7: #e66767; --series-8: #9085e9;
    --grid: #223029; --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1411; --surface: #151d18; --surface-2: #1b251f; --border: #26332b; --border-strong: #33443a;
  --text: #eef3ef; --text-2: #c2cfc6; --muted: #8b9a90; --brand: #7fd99a; --brand-2: #3ec252; --brand-3: #3ec252; --on-brand: #01170f; --accent: #4fcf68;
  --side-bg: #01170f; --side-text: #a9c4b2;
  --good: #3cc23c; --good-bg: #13301a; --warn: #f0b23a; --warn-bg: #332810; --crit: #f07272; --crit-bg: #3a1616; --info: #7fb0ee; --info-bg: #142640;
  --series-1: #1f8f3e; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #3987e5; --series-7: #e66767; --series-8: #9085e9;
  --grid: #223029; --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 16px; } h3 { font-size: 14px; }
button, input, select, textarea { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--muted); } .small { font-size: 12px; } .tiny { font-size: 11px; }
.hidden { display: none !important; }

/* ===== layout ===== */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--side-bg); color: var(--side-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; }
.brand .logo { width: 34px; height: 34px; border-radius: 8px; background: linear-gradient(135deg, #007030, #3ec252); display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; }
.brand b { display: block; font-size: 14px; } .brand span { font-size: 11px; opacity: .7; }
.nav { padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav .sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; opacity: .55; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--side-text); font-size: 13.5px; }
.nav a:hover { background: var(--side-hover); text-decoration: none; color: #fff; }
.nav a.active { background: rgba(255,255,255,.12); color: var(--side-active); font-weight: 600; }
.nav svg { width: 17px; height: 17px; flex: none; opacity: .9; }
.side-foot { margin-top: auto; padding: 14px 18px; font-size: 11.5px; opacity: .75; border-top: 1px solid rgba(255,255,255,.08); }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); padding: 10px 24px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.top .title { flex: 1; min-width: 180px; }
.top .title h1 { font-size: 18px; }
.top .title .sub { font-size: 12px; color: var(--muted); }
.controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.content { padding: 20px 24px 40px; display: flex; flex-direction: column; gap: 18px; max-width: 1600px; width: 100%; }
.btn.menu-btn { display: none; padding: 0 8px; }
.btn.menu-btn svg { width: 18px; height: 18px; }

/* ===== controles ===== */
.select, .input { height: 34px; border: 1px solid var(--border-strong); background: var(--surface); border-radius: 8px; padding: 0 10px; }
.input { min-width: 0; }
textarea.input { height: auto; padding: 8px 10px; }
.btn { height: 34px; border: 1px solid var(--border-strong); background: var(--surface); border-radius: 8px; padding: 0 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--brand-2); border-color: var(--brand-2); color: var(--on-brand); font-weight: 600; }
.btn.danger { color: var(--crit); }
.btn.small { height: 28px; padding: 0 9px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: default; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 0 11px; height: 32px; cursor: pointer; font-size: 13px; color: var(--text-2); }
.seg button.on { background: var(--brand-2); color: var(--on-brand); font-weight: 600; }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); cursor: pointer; user-select: none; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 4px; border-radius: 20px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; position: relative; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--brand-2); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.dropdown { position: absolute; right: 0; top: 40px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.14); min-width: 220px; padding: 6px; z-index: 50; }
.dropdown button { width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.dropdown button:hover { background: var(--surface-2); }
.dropdown .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }

/* ===== cartões ===== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; min-width: 0; }
.card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-h .hint { font-size: 12px; color: var(--muted); }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 14px 10px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi .lbl { font-size: 12px; color: var(--text-2); font-weight: 550; }
.kpi .val { font-size: 22px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .row { display: flex; justify-content: space-between; align-items: end; gap: 8px; }
.kpi .sub { font-size: 11.5px; color: var(--muted); min-height: 16px; }
.kpi canvas { width: 96px !important; height: 30px !important; }
.delta { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.delta.up { color: var(--good); } .delta.down { color: var(--crit); } .delta.flat { color: var(--muted); }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 20px; white-space: nowrap; border: 1px solid transparent; }
.badge.good { background: var(--good-bg); color: var(--good); } .badge.warning { background: var(--warn-bg); color: var(--warn); }
.badge.critical { background: var(--crit-bg); color: var(--crit); } .badge.info { background: var(--info-bg); color: var(--info); }
.badge.neutral { background: var(--surface-2); color: var(--text-2); border-color: var(--border); }

.alerts { display: flex; flex-direction: column; gap: 8px; }
.alert { display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); }
.alert .ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #fff; }
.alert.critical .ic { background: var(--crit); } .alert.warning .ic { background: var(--warn); } .alert.info .ic { background: var(--info); } .alert.good .ic { background: var(--good); }
.alert b { display: block; font-size: 13px; } .alert span { font-size: 12.5px; color: var(--text-2); }
.alert a { font-size: 12px; }

/* ===== tabelas ===== */
.tbl-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 8px; max-width: 100%; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.tbl thead th { position: sticky; top: 0; background: var(--surface-2); font-size: 11.5px; font-weight: 650; color: var(--text-2); text-transform: uppercase; letter-spacing: .03em; z-index: 1; white-space: nowrap; }
.tbl tbody tr:hover td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.tbl tr.total td { font-weight: 700; background: var(--surface-2); }
.tbl tr.grand td { font-weight: 800; background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-top: 2px solid var(--border-strong); }
.tbl tr.group td { font-weight: 700; color: var(--brand); padding-top: 12px; }
.tbl tr.sub td:first-child { padding-left: 22px; }
.tbl tr.minor td { color: var(--text-2); font-style: italic; }
.tbl tr.clickable { cursor: pointer; }
.tbl td.neg { color: var(--crit); }
.tbl .sticky-col { position: sticky; left: 0; background: var(--surface); z-index: 1; }
.tbl thead .sticky-col { z-index: 2; background: var(--surface-2); }
.tbl tr.total .sticky-col, .tbl tr.grand .sticky-col { background: var(--surface-2); }
.tbl td.fc { background: color-mix(in srgb, var(--series-4) 9%, transparent); }
.tbl td.orc { background: color-mix(in srgb, var(--series-7) 8%, transparent); }
.tbl-scroll { max-height: 560px; }
.drill-row td { background: var(--surface-2); font-size: 12.5px; }
.drill-row td:first-child { padding-left: 30px; }

/* ===== gráficos ===== */
.chart { position: relative; height: 280px; }
.chart.tall { height: 340px; } .chart.short { height: 220px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ===== tabs ===== */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tabs button { border: 0; background: none; padding: 9px 14px; cursor: pointer; color: var(--text-2); border-bottom: 2px solid transparent; font-weight: 550; }
.tabs button.on { color: var(--brand); border-bottom-color: var(--accent); }

/* ===== modal ===== */
.modal-bg { position: fixed; inset: 0; background: rgba(10,15,25,.45); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: var(--surface); border-radius: 12px; width: min(720px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.wide { width: min(1100px, 100%); }
.modal-h { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-b { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.modal-f { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.x { border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.form { display: grid; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.chk { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.chk label { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; color: var(--text); padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; }
.secret { font-family: ui-monospace, Consolas, monospace; font-size: 18px; padding: 10px 14px; background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: 8px; text-align: center; letter-spacing: .05em; user-select: all; }

/* ===== diversos ===== */
.empty { padding: 30px; text-align: center; color: var(--muted); }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.spinner { width: 22px; height: 22px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 8px; z-index: 200; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: 420px; }
.toast.err { background: var(--crit); color: #fff; }
.score { width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; font-weight: 800; flex: none; }
.bar-mini { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; border: 1px solid var(--border); }
.bar-mini > i { display: block; height: 100%; background: var(--accent); }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.prose { white-space: pre-wrap; font-size: 13px; line-height: 1.55; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.pill-list { display: flex; flex-wrap: wrap; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.on { background: var(--good); box-shadow: 0 0 0 3px var(--good-bg); } .dot.off { background: var(--border-strong); }
.check-row { display: grid; grid-template-columns: 110px 1fr auto; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); align-items: start; }
.check-row:last-child { border-bottom: 0; }
details summary { cursor: pointer; color: var(--accent); font-size: 12.5px; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ===== login ===== */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-hero { background: linear-gradient(150deg, #02271a 0%, #00502a 55%, #007030 100%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.login-hero h1 { font-size: 30px; line-height: 1.2; max-width: 460px; }
.login-hero p { opacity: .85; max-width: 440px; }
.login-box { display: grid; place-items: center; padding: 32px 16px; }
.login-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; }
.login-card .input { height: 42px; }
.login-card .btn { height: 42px; justify-content: center; }
.err { color: var(--crit); font-size: 13px; min-height: 18px; }

/* ===== responsivo ===== */
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-2-1 { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 60; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .btn.menu-btn { display: inline-flex; }
  .top { padding: 10px 16px; } .content { padding: 16px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .login-page { grid-template-columns: 1fr; } .login-hero { display: none; }
  .check-row { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
}
@media print {
  .side, .top .controls, .menu-btn, .theme-btn { display: none !important; }
  .app { grid-template-columns: 1fr; } .top { position: static; }
  .card, .kpi { break-inside: avoid; box-shadow: none; }
}

/* ===== Balanço lado a lado ===== */
.bp-table td, .bp-table th { padding: 5px 8px; }
.bp-table .bp-lbl { min-width: 210px; }
.bp-table .bp-title { font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--brand-2); padding-top: 10px; }
.bp-table .bp-group { font-weight: 700; color: var(--brand); }
.bp-table .bp-sub { color: var(--muted); font-size: 12px; padding-left: 14px; }
.bp-table .bp-total { font-weight: 700; border-top: 1px solid var(--border-strong); background: var(--surface-2); }
.bp-table .bp-grand { font-weight: 800; border-top: 2px solid var(--brand-2); border-bottom: 3px double var(--brand-2); background: color-mix(in srgb, var(--brand-2) 8%, var(--surface)); }
.bp-table .bp-gap { width: 22px; min-width: 22px; padding: 0; background: var(--bg); border-bottom: 0; }
.bp-table tbody tr:hover td.bp-gap { background: var(--bg); }
.bp-table .muted-num { color: var(--text-2); }
.drill-ic { color: var(--brand-2); font-size: 10px; margin-right: 5px; display: inline-block; }
td.clickable:hover { color: var(--brand-2); text-decoration: underline; cursor: pointer; }

/* ===== Marca ===== */
.brand .logo-img { height: 30px; width: auto; display: block; }
.nav a.active { box-shadow: inset 3px 0 0 var(--brand-3); }
.kpi { border-top: 3px solid var(--brand-2); }
.card-h h2, .kpi .lbl { color: var(--brand); }
.tabs button.on { color: var(--brand-2); border-bottom-color: var(--brand-3); }
.score { border: 3px solid currentColor; }

/* ===== Celular ===== */
.side-backdrop { display: none; }
@media (max-width: 860px) {
  .side-backdrop.on { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 55; }
  .top { gap: 8px; padding: 8px 12px; }
  .top .title { min-width: 0; flex: 1 1 calc(100% - 160px); }
  .top .title h1 { font-size: 16px; }
  .top .title .sub { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .user-chip span { display: none; }
  .controls { order: 3; width: 100%; }
  .controls .select { flex: 1; min-width: 0; }
  .content { padding: 12px; gap: 12px; }
  .card { padding: 12px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 10px; }
  .kpi .val { font-size: 18px; }
  .kpi .row { flex-wrap: wrap; }
  .kpi canvas { width: 100% !important; height: 26px !important; }
  .kpi .sub { font-size: 11px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; width: 100%; }
  .tabs button { white-space: nowrap; padding: 8px 10px; }
  .toolbar { gap: 8px; }
  .toolbar .spacer { display: none; }
  .tbl { font-size: 12px; }
  .tbl th, .tbl td { padding: 6px 8px; }
  .tbl .sticky-col { min-width: 150px !important; max-width: 190px; white-space: normal; }
  .bp-table .bp-lbl { min-width: 150px; max-width: 190px; white-space: normal; }
  .chart { height: 230px; } .chart.tall { height: 270px; } .chart.short { height: 190px; }
  .modal-bg { padding: 0; place-items: stretch; }
  .modal, .modal.wide { width: 100%; max-height: 100vh; height: 100vh; border-radius: 0; }
  .alert { grid-template-columns: 20px 1fr; padding: 8px 10px; }
  .score { width: 88px; height: 88px; font-size: 24px; }
  .seg button { padding: 0 8px; font-size: 12px; }
  .legend { gap: 8px; }
}
@media (max-width: 420px) {
  .kpi .val { font-size: 16px; }
  .kpi .lbl { font-size: 11px; }
}
.bp-side { font-size: 12.5px; }
.bp-side .bp-lbl { min-width: 0; width: 34%; }
.bp-side td.num, .bp-side th.num { padding-left: 6px; padding-right: 6px; }

/* Seleção de empresas (várias, agrupadas por CD) */
.emp-btn { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; cursor: pointer; }
.emp-pop { position: absolute; z-index: 60; width: min(520px, calc(100vw - 16px)); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.emp-pop-h { display: flex; gap: 6px; align-items: center; padding: 10px; border-bottom: 1px solid var(--border); }
.emp-pop-b { max-height: min(60vh, 460px); overflow: auto; padding: 6px 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 14px; }
.emp-grp { padding: 6px 0; }
.emp-cd { display: flex; gap: 6px; align-items: center; font-weight: 700; color: var(--brand-2); padding: 4px 0; cursor: pointer; }
.emp-it { display: flex; gap: 6px; align-items: center; font-size: 13px; padding: 3px 0 3px 18px; cursor: pointer; color: var(--text); }
.emp-pop-f { padding: 8px 10px; border-top: 1px solid var(--border); }
.tbl td.ind { padding-left: 26px; }
.tbl tr.sec td { font-weight: 700; color: var(--brand-2); background: var(--surface); padding-top: 14px; border-bottom: 1px solid var(--border-strong); }
.dre-bar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 12px; }
.dre-bar .grp { display: inline-flex; gap: 6px; align-items: center; }
.th-sub { font-weight: 400; font-size: 11px; color: var(--muted); }

/* (i) informativo */
.info-btn { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; margin-left: 5px; padding: 0; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-2); font: italic 700 10.5px/1 Georgia, serif; cursor: help; vertical-align: middle; flex: 0 0 auto; }
.info-btn:hover, .info-btn:focus-visible { background: var(--brand-2); border-color: var(--brand-2); color: var(--on-brand); outline: none; }
.info-tip { position: fixed; z-index: 100; max-width: min(340px, calc(100vw - 16px)); padding: 10px 12px; border-radius: 8px; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); box-shadow: 0 10px 28px rgba(0,0,0,.22); font-size: 12.5px; line-height: 1.45; white-space: pre-line; pointer-events: none; }
.card-h h2 .info-btn { margin-left: 7px; }
@media print { .info-btn { display: none; } }

/* Botão de tema (claro/escuro) */
.theme-btn { width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.theme-btn svg { width: 18px; height: 18px; }
.login-theme { position: fixed; top: 14px; right: 14px; z-index: 10; }

/* Valores longos nos cartões (ex.: R$ 1.673.119.637) em uma linha só */
.kpi .val { white-space: nowrap; }
.kpi .val.long { font-size: 17px; letter-spacing: -.03em; }
.kpi .row:has(.val.long) canvas { width: 70px !important; }

/* Título de seção dentro de uma tela (ex.: Impostos a recuperar) */
.sec-title { font-size: 16px; margin: 26px 0 12px; padding-top: 14px; border-top: 1px solid var(--border); color: var(--brand-2); }

/* Tabelas com grupos de colunas (ex.: Impostos: pago | a recolher | a recuperar) */
.tbl th.grp-h { text-align: center; border-bottom: 1px solid var(--border-strong); }
.tbl .sep { border-left: 2px solid var(--border-strong); }

/* Análise de Balancete */
.tbl tr.sel td { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
.tbl.razao td.hist { min-width: 320px; max-width: 520px; white-space: normal; line-height: 1.35; }
.tbl td.nowrap { white-space: nowrap; }

/* Análise de Balancete: filtro em passos (conta → histórico → filtrar) */
.filtro-passos { display: grid; grid-template-columns: minmax(260px, 1.3fr) minmax(220px, 1fr) auto; gap: 12px; align-items: end; }
.passo { display: flex; gap: 10px; align-items: flex-end; min-width: 0; }
.passo-c { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.passo-n { width: 24px; height: 24px; border-radius: 50%; background: var(--brand-2); color: var(--on-brand); font-weight: 700; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; margin-bottom: 8px; }
.passo-btn { gap: 8px; }
.chips-box { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 38px; padding: 4px 8px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); }
.chips-box input { flex: 1; min-width: 140px; border: 0; outline: none; background: transparent; color: var(--text); font: inherit; padding: 4px 2px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 8px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 22%, var(--surface)); color: var(--text); font-size: 12.5px; white-space: nowrap; }
.chip button { border: 0; background: transparent; color: var(--text-2); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 4px; }
.mais-filtros { margin-top: 10px; }
.mais-filtros summary { cursor: pointer; color: var(--text-2); }
@media (max-width: 760px) { .filtro-passos { grid-template-columns: 1fr; } }
.razao-link { font-size: 11.5px; margin-left: 6px; padding: 1px 7px; border-radius: 10px; border: 1px solid var(--border-strong); text-decoration: none; white-space: nowrap; }
.razao-link:hover { background: var(--brand-2); color: var(--on-brand); border-color: var(--brand-2); }

/* DRE Gerencial Online: mesmos destaques da aba DRE da planilha Google */
.tbl.dreon td, .tbl.dreon th { white-space: nowrap; }
/* DRE Gerencial Online: mesmo desenho da planilha, com as cores do painel */
.tbl.dreon { font-size: 13px; }
.tbl.dreon thead th { background: var(--side-bg); color: var(--side-active, #fff); border-bottom: 0; }
.tbl.dreon thead .sticky-col { background: var(--side-bg); }
.tbl.dreon td { border-bottom-color: var(--border); }
.dreon-cod { display: inline-block; min-width: 30px; margin-right: 6px; padding: 0 5px; border-radius: 6px; text-align: center; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); font-size: 10.5px; font-weight: 600; line-height: 16px; }
/* linhas comuns: rótulo recuado */
.tbl.dreon tr.dreon-normal td.sticky-col, .tbl.dreon tr.dreon-negrito td.sticky-col { padding-left: 18px; }
.tbl.dreon tr.dreon-negrito td { font-weight: 700; }
/* percentuais: discretos, em verde do painel */
.tbl.dreon tr.dreon-pct td { color: var(--brand-2); font-size: 11.5px; font-style: italic; padding-top: 3px; padding-bottom: 3px; background: var(--surface); }
.tbl.dreon tr.dreon-pct td.sticky-col { padding-left: 30px; }
/* subtotais (Receita líquida, Lucro bruto, Resultado operacional…) */
.tbl.dreon tr.dreon-total td { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); font-weight: 700; color: var(--brand); border-top: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border)); }
.tbl.dreon tr.dreon-total-forte td { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); font-weight: 800; color: var(--brand); border-top: 2px solid var(--accent); }
/* resultado líquido */
.tbl.dreon tr.dreon-grand td { background: var(--brand-2); color: var(--on-brand); font-weight: 800; border-bottom: 0; }
/* margens em destaque (margem de contribuição, % resultado operacional, EBITDA) */
.tbl.dreon tr.dreon-destaque td { background: color-mix(in srgb, var(--brand-3) 18%, var(--surface)); color: var(--brand); font-weight: 800; }
.tbl.dreon tr.dreon-destaque td.sticky-col { box-shadow: inset 4px 0 0 var(--brand-3); }
.tbl.dreon tr.dreon-destaque-verde td { background: var(--good-bg); color: var(--good); font-weight: 800; }
.tbl.dreon tr.dreon-destaque-verde td.sticky-col { box-shadow: inset 4px 0 0 var(--good); }
/* títulos de bloco (EBITDA, Custo fixo + frete, Apuração CMV) */
.tbl.dreon tr.dreon-secao td { background: var(--side-bg); color: var(--side-active, #fff); font-weight: 700; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; padding-top: 8px; padding-bottom: 8px; border-bottom: 0; }
.tbl.dreon tr.dreon-vazio td { height: 12px; padding: 0; border: 0; background: var(--surface); }
.tbl.dreon tr td.neg { color: inherit; }
.tbl.dreon tr.dreon-grand .dreon-cod, .tbl.dreon tr.dreon-secao .dreon-cod { background: transparent; color: inherit; border-color: currentColor; opacity: .7; }
/* passar o mouse: destaca a linha sem perder a cor dela */
.tbl.dreon tbody tr:hover td { filter: brightness(.97); }
:root[data-theme="dark"] .tbl.dreon tbody tr:hover td { filter: brightness(1.15); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tbl.dreon tbody tr:hover td { filter: brightness(1.15); } }
.dreon-periodos { margin: 4px 0 12px; }
.dreon-periodos summary { cursor: pointer; color: var(--text-2); }
.dreon-atalhos { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 8px; }
.dreon-chips { display: grid; gap: 6px; }
.dreon-ano { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dreon-ano > b { min-width: 48px; color: var(--brand-2); }
.dreon-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border: 1px solid var(--border-strong); border-radius: 14px; font-size: 12px; cursor: pointer; user-select: none; }
.dreon-chip input { display: none; }
.dreon-chip.on { background: var(--brand-2); border-color: var(--brand-2); color: var(--on-brand); }

/* Dados e sincronização: banco de dados e espaço */
.cr-sel { position: relative; display: inline-flex; align-items: center; gap: 6px; }
.cr-btn { min-width: 240px; max-width: 320px; text-align: left; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-painel { position: absolute; left: 0; top: 40px; z-index: 50; width: min(440px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.14); padding: 10px; }
.cr-painel[hidden] { display: none; }
.cr-painel .input { width: 100%; }
.cr-lista { max-height: 340px; overflow-y: auto; margin: 8px 0; }
.cr-item { display: flex; align-items: center; min-height: 28px; }
.cr-item:hover { background: var(--surface-2); }
.cr-item label { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; cursor: pointer; padding: 3px 4px; }
.cr-item input { flex: none; width: 16px; height: 16px; margin: 0; accent-color: var(--series-1); }
.cr-grupo label > span:first-of-type { font-weight: 600; }
.cr-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0 0; }
.cr-chips:empty { display: none; }
.arm-t { font-size: 13px; margin: 0 0 8px; color: var(--text-2); }
.arm-barra { display: flex; height: 16px; border-radius: 8px; overflow: hidden; background: color-mix(in srgb, var(--text) 8%, var(--surface)); }
.arm-barra span { display: block; height: 100%; }
.arm-leg { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0; font-size: 12px; color: var(--text-2); }
.arm-leg i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* DRE Gerencial Online calculada pelo painel */
.dreon-abas { margin-bottom: 14px; }
.dreon-op { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.dreon-sep { font-size: 11px; color: var(--muted); margin: 0 2px 0 8px; }
.tbl.dreon td.clic { cursor: pointer; }
.tbl.dreon td.clic:hover { text-decoration: underline; color: var(--brand-2); }
.dreon-marca { color: var(--accent, #e3a008); font-size: 9px; margin-left: 4px; vertical-align: super; }
.tbl.dreon td.dreon-dif { background-image: linear-gradient(color-mix(in srgb, var(--warn, #d97706) 12%, transparent), color-mix(in srgb, var(--warn, #d97706) 12%, transparent)); }
.dreon-delta { display: block; font-size: 10.5px; font-weight: 600; color: var(--warn, #b45309); line-height: 1.1; }
.tbl tfoot td { border-top: 2px solid var(--border-strong); }
.dreon-conf { margin-top: 12px; } .dreon-conf summary { cursor: pointer; color: var(--text-2); display: flex; gap: 8px; align-items: center; }
.bal-filtros { margin: 4px 0 10px; }
.tbl tr.bal-fora td { background: color-mix(in srgb, var(--warn, #d97706) 10%, var(--surface)); }
.tbl td.bal-ref { white-space: nowrap; }
.aj-resumo { display: flex; gap: 28px; flex-wrap: wrap; margin: 2px 0 12px; }
.aj-resumo > div { display: flex; flex-direction: column; gap: 2px; }
.aj-resumo b { font-size: 20px; font-variant-numeric: tabular-nums; }
.tbl tr.aj-excluido td { opacity: .55; text-decoration: line-through; }
.tbl tr.aj-excluido td:last-child, .tbl tr.aj-excluido td:nth-last-child(2) { text-decoration: none; }
:root[data-theme="dark"] .tbl.dreon tr.dreon-grand td { background: #1d6b35; color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tbl.dreon tr.dreon-grand td { background: #1d6b35; color: #fff; } }
/* faixa do topo da DRE Gerencial Online e quadro do plano de contas */
.dreon-status { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; padding: 8px 12px; margin-bottom: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); min-height: 38px; }
.dreon-status:empty { display: none; }
.dreon-status-i { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.plano-lista { margin: 8px 0; }
.plano-lista summary { cursor: pointer; color: var(--text-2); }
/* modo "ver como" */
.vercomo-bar { display: flex; gap: 10px; align-items: center; padding: 8px 16px; background: var(--warn-bg); color: var(--text); border-bottom: 2px solid var(--warn); font-size: 13px; position: sticky; top: 0; z-index: 20; }
.vercomo-bar svg { width: 18px; height: 18px; color: var(--warn); display: block; }
.vercomo-bar > div { flex: 1; }

/* ===== Fechamento e Revisão ===== */
.fe-resumo { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 4px 0 12px; }
.fe-card { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); cursor: pointer; color: var(--text); }
.fe-card span { font-size: 12px; color: var(--text-2); }
.fe-card b { font-size: 20px; font-variant-numeric: tabular-nums; }
.fe-card small { font-size: 11.5px; color: var(--muted); }
.fe-card.on { border-color: var(--brand-2); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); box-shadow: inset 0 -3px 0 var(--brand-2); }
.fe-spark polyline { fill: none; stroke: var(--brand-2); stroke-width: 1.6; }
.fe-spark circle { fill: var(--warn); }
.fe-spark line.z { stroke: var(--border-strong); stroke-dasharray: 2 2; }
.fe-nota { margin-top: 3px; max-width: 280px; }
.btn-link { border: 0; background: none; color: var(--brand-2); cursor: pointer; font-size: 11.5px; padding: 0 2px; }
.book { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 26px; }
.book h3 { margin: 22px 0 8px; font-size: 14px; color: var(--brand); text-transform: uppercase; letter-spacing: .04em; }
.book-capa { display: flex; justify-content: space-between; align-items: flex-end; padding: 16px 20px; border-radius: var(--radius); background: var(--side-bg); color: #fff; margin-bottom: 16px; }
.book-capa b { display: block; font-size: 20px; } .book-capa span { opacity: .85; }
.book-msg { border-left: 4px solid var(--brand-3); background: var(--surface-2); padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; }
.book-msg p { margin: 6px 0; }
.book-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.book-kpis > div { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; }
.book-kpis span { font-size: 11.5px; color: var(--text-2); } .book-kpis b { font-size: 19px; color: var(--brand); } .book-kpis small { font-size: 11px; color: var(--muted); }
.book-dre td, .book-dre th { padding: 4px 8px; font-size: 12px; }
.tbl tr.book-coment td { font-size: 11.5px; color: var(--text-2); font-style: italic; background: color-mix(in srgb, var(--warn) 8%, var(--surface)); padding: 4px 8px 6px 26px; }
@media (max-width: 800px) { .book-kpis { grid-template-columns: repeat(2, 1fr); } .book { padding: 14px; } }
@media print {
  .no-print, .top, .vercomo-bar, .dreon-abas { display: none !important; }
  .content { padding: 0 !important; }
  .book { border: 0; padding: 0; }
  .book-capa, .tbl.dreon tr td, .tbl.dreon thead th, .book-msg, .tbl tr.book-coment td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .book-dre tr { break-inside: avoid; }
}
.fe-tag { display: inline-block; margin: 1px 3px 1px 0; padding: 1px 7px; border-radius: 10px; font-size: 11px; background: var(--warn-bg); color: var(--warn); white-space: nowrap; }
.book-dre .btn-link { opacity: 0; } .book-dre tr:hover .btn-link, .book-dre .btn-link.tem, .book-dre .btn-link:focus { opacity: 1; }
.dreon-det-acoes { margin-bottom: 10px; gap: 10px; }
/* aviso que abre a lista de contas fora da DRE (aba Balancete) */
details.alert.bal-fora-aviso { display: block; }
.bal-fora-aviso > summary { display: grid; grid-template-columns: 22px 1fr 18px; gap: 10px; cursor: pointer; list-style: none; }
.bal-fora-aviso > summary::-webkit-details-marker { display: none; }
.bal-fora-aviso > summary::after { content: '▾'; color: var(--warn); font-size: 14px; transition: transform .15s; }
.bal-fora-aviso[open] > summary::after { transform: rotate(180deg); }
.bal-fora-aviso > summary:hover b { text-decoration: underline; }
.bal-fora-aviso .tbl-wrap { margin-top: 10px; background: var(--surface); border-radius: 6px; }
/* Análise de Balancete: resumo por centro de resultado */
.cr-resumo { margin: 0 0 12px; border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; background: var(--surface-2); }
.cr-resumo > summary { cursor: pointer; }
.cr-resumo .tbl { background: var(--surface); }
.tbl tr.cr-sel td { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.cr-barra { display: inline-block; width: 60px; height: 6px; border-radius: 3px; background: var(--grid); vertical-align: middle; margin-right: 4px; overflow: hidden; }
.cr-barra i { display: block; height: 100%; background: var(--brand-2); }
.cr-caminho a { font-size: 12.5px; } .cr-caminho { gap: 6px; }
/* cadastro de usuários: permissões especiais */
.perm-box { margin-top: 12px; padding: 10px 12px; border: 1px dashed var(--border-strong); border-radius: 8px; display: grid; gap: 6px; }
.perm-box label.perm { display: grid; grid-template-columns: 18px 1fr; gap: 2px 8px; font-weight: 500; font-size: 13px; color: var(--text); }
.perm-box label.perm .tiny { grid-column: 2; }
/* Análise de Balancete em árvore */
.tbl.bal-arvore td, .tbl.bal-arvore th { white-space: nowrap; }
.tbl.bal-arvore tr.bal-n1 td { background: var(--side-bg); color: var(--side-active, #fff); font-weight: 800; }
.tbl.bal-arvore tr.bal-n2 td { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); font-weight: 750; color: var(--brand); }
.tbl.bal-arvore tr.bal-n3 td { background: color-mix(in srgb, var(--accent) 7%, var(--surface)); font-weight: 700; }
.tbl.bal-arvore tr.bal-n4 td { font-weight: 650; }
.tbl.bal-arvore tr.bal-n1 .neg, .tbl.bal-arvore tr.bal-n1 .muted { color: inherit; }
.bal-seta { display: inline-block; width: 18px; border: 0; background: none; color: inherit; cursor: pointer; font-size: 12px; padding: 0; text-align: left; }
.bal-ir { font-size: 11px; color: var(--brand-2); margin-left: 6px; opacity: 0; }
.tbl.bal-arvore tr.clickable:hover .bal-ir { opacity: 1; }
.bal-ir-g { font-size: 11px; margin-left: 8px; color: inherit; opacity: .75; }
.tbl.bal-arvore tr.bal-n1 .bal-ir-g { color: #fff; }
