/* DRE Intelligence · Decolafin: base, layout e componentes. Todas as cores vêm de tokens.css. */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
  min-height: 100vh;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: 2px; border-radius: 4px; }
.num, .tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); }
.secondary { color: var(--text-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px;
  border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface);
  font-weight: 500; font-size: var(--fs-base); color: var(--text);
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast), transform var(--dur-fast);
  white-space: nowrap;
}
.btn:hover { background: var(--surface-hover); }
.btn:active { transform: translateY(0.5px); }
.btn.primary { background: var(--brand-ink); color: var(--bg); border-color: transparent; }
.btn.primary:hover { opacity: 0.9; }
.btn.accent { background: var(--brand-green); color: #fff; border-color: transparent; }
.btn.accent:hover { background: var(--brand-green-2); }
.btn.danger { color: var(--bad-text); }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: transparent; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn.sm { height: 28px; padding: 0 10px; font-size: var(--fs-sm); border-radius: 7px; }
.btn.icon { width: 34px; padding: 0; justify-content: center; }
.btn.sm.icon { width: 28px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Segmentado ---------- */
.seg { display: inline-flex; padding: 2px; border-radius: 9px; background: var(--surface-sunken); border: 1px solid var(--border); gap: 2px; }
.seg button { border: 0; background: transparent; height: 28px; padding: 0 11px; border-radius: 7px; font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }

.select {
  height: 32px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface);
  padding: 0 28px 0 10px; font-size: var(--fs-sm); font-weight: 500; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 14px) 14px, calc(100% - 10px) 14px; background-size: 4px 4px; background-repeat: no-repeat;
}
.input { height: 32px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); padding: 0 10px; font-size: var(--fs-sm); }
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .01em; background: var(--surface-sunken); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.badge svg.i { width: 12px; height: 12px; }
.badge.good { background: var(--good-weak); color: var(--good-text); border-color: transparent; }
.badge.warn { background: var(--warn-weak); color: var(--warn-text); border-color: transparent; }
.badge.bad { background: var(--bad-weak); color: var(--bad-text); border-color: transparent; }
.badge.info { background: var(--info-weak); color: var(--accent); border-color: transparent; }
.badge.demo { background: var(--demo-weak); color: var(--demo); border-color: transparent; }
.badge.real { background: var(--real-weak); color: var(--real); border-color: transparent; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }

.delta { display: inline-flex; align-items: center; gap: 3px; font-size: var(--fs-sm); font-weight: 600; font-variant-numeric: tabular-nums; }
.delta.good { color: var(--good-text); }
.delta.bad { color: var(--bad-text); }
.delta.flat { color: var(--text-3); }
.delta svg.i { width: 12px; height: 12px; stroke-width: 2.2; }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow-y: auto;
  background: var(--sidebar-bg); color: var(--sidebar-ink); padding: 16px 12px; gap: 6px; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; }
.brand-logo { height: 30px; width: auto; display: block; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--brand-navy); display: grid; place-items: center; flex: none; }
.brand-mark img { width: 20px; height: auto; }
.brand-name { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.01em; font-size: var(--fs-md); line-height: 1.1; }
.brand-name small { display: block; font-family: var(--font); font-weight: 500; color: var(--text-3); font-size: var(--fs-xs); letter-spacing: 0; }
.sidebar .brand-name small { color: var(--sidebar-ink-3); }
.back-link { display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin: 0 0 4px; border-radius: 8px; color: var(--sidebar-ink-2); font-size: var(--fs-sm); font-weight: 500; border: 1px solid var(--sidebar-line); }
.back-link:hover { background: var(--sidebar-hover); color: #fff; }
.back-link svg.i { transform: rotate(180deg); width: 14px; height: 14px; }
.back-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-label { font-size: var(--fs-xs); color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; padding: 12px 10px 4px; }
.sidebar .nav-label { color: var(--sidebar-ink-3); }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 8px;
  color: var(--sidebar-ink-2); font-weight: 500; font-size: var(--fs-base); transition: background var(--dur-fast), color var(--dur-fast);
}
.nav a:hover { background: var(--sidebar-hover); color: #fff; }
.nav a.on { background: var(--sidebar-on); color: #fff; }
.nav a.on::before { content: ""; position: absolute; left: -12px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand-green); }
.nav a.on svg.i { color: var(--brand-green); }
.nav a .count { margin-left: auto; font-size: var(--fs-xs); color: var(--sidebar-ink-3); font-weight: 600; font-variant-numeric: tabular-nums; }
.nav a .count.warn { color: #f6c453; }
.nav a .count.bad { color: #ff9b9b; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 12px; }
.source-card { border: 1px solid var(--sidebar-line); border-radius: var(--radius); background: rgba(255, 255, 255, 0.05); padding: 10px 12px; font-size: var(--fs-sm); color: var(--sidebar-ink); }
.source-card .file { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; margin: 6px 0 2px; }
.source-card .meta { color: var(--sidebar-ink-3); font-size: var(--fs-xs); display: block; }
.source-card .badge.real { background: var(--brand-green-weak); color: #7fdc93; }
.source-card .badge.demo { color: #fbbf24; }
.sidebar .btn { background: transparent; border-color: var(--sidebar-line); color: var(--sidebar-ink); }
.sidebar .btn:hover { background: var(--sidebar-hover); }
.privacy { display: flex; gap: 6px; align-items: flex-start; color: var(--sidebar-ink-3); font-size: var(--fs-xs); padding: 0 6px; line-height: 1.4; }
.privacy svg.i { width: 13px; height: 13px; margin-top: 1px; }
.save-state { display: flex; gap: 6px; align-items: center; font-size: var(--fs-xs); color: var(--sidebar-ink-3); padding: 0 6px; }
.save-state .dot { width: 6px; height: 6px; }
.save-state.saved .dot { color: var(--brand-green); }
.save-state.saving .dot { color: #f6c453; }
.save-state.error { color: #ff9b9b; }
.save-state button { border: 0; background: none; color: inherit; text-decoration: underline; padding: 0; font-size: inherit; }

.main { min-width: 0; display: flex; flex-direction: column; }
.mode-strip { height: 30px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: var(--fs-sm); font-weight: 500; border-bottom: 1px solid var(--border); }
.mode-strip.demo { background: repeating-linear-gradient(-45deg, var(--demo-weak), var(--demo-weak) 10px, var(--demo-stripe) 10px, var(--demo-stripe) 20px); color: var(--demo); }
.mode-strip.real { background: var(--real-weak); color: var(--real); }
.mode-strip b { font-weight: 700; letter-spacing: .04em; }

.topbar {
  position: sticky; top: 0; z-index: 15; min-height: var(--topbar-h); display: flex; align-items: center; gap: 12px;
  padding: 10px 28px; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.topbar .crumbs { display: flex; flex-direction: column; min-width: 0; margin-right: auto; }
.topbar .crumbs .co { font-size: var(--fs-xs); color: var(--text-3); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar h1 { margin: 0; font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 700; letter-spacing: -0.015em; line-height: 1.2; color: var(--brand-ink); }
.topbar .controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.period-picker { display: inline-flex; align-items: center; gap: 6px; }
.period-picker .sep { color: var(--text-3); font-size: var(--fs-sm); }
.menu-toggle { display: none; }

.content { padding: 24px 28px 64px; display: flex; flex-direction: column; gap: 20px; max-width: 1480px; width: 100%; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.view-head p { margin: 2px 0 0; color: var(--text-2); max-width: 760px; }
.view-head .eyebrow { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .07em; font-weight: 600; color: var(--text-3); }

/* ---------- Grid ---------- */
.grid { display: grid; gap: 16px; }
.g-kpi { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.g-main-r { grid-template-columns: minmax(0, 1fr) minmax(0, 1.65fr); }
.span-2 { grid-column: span 2; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); min-width: 0; display: flex; flex-direction: column; }
.card-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px 6px; }
.card-h h3 { margin: 0; font-family: var(--font-display); font-size: var(--fs-md); font-weight: 650; letter-spacing: -0.005em; }
.card-h p { margin: 2px 0 0; color: var(--text-3); font-size: var(--fs-sm); }
.card-h .tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.card-b { padding: 8px 18px 18px; flex: 1; min-width: 0; }
.card-b.flush { padding: 0; }
.card-f { padding: 10px 18px; border-top: 1px solid var(--border); color: var(--text-3); font-size: var(--fs-xs); display: flex; gap: 8px; align-items: center; }
.chart { width: 100%; height: 300px; }
.chart.sm { height: 220px; }
.chart.lg { height: 360px; }
.chart.xl { height: 420px; }

/* KPI */
.kpi { padding: 16px 18px 12px; gap: 6px; position: relative; overflow: hidden; }
.kpi .k-label { font-size: var(--fs-sm); color: var(--text-2); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi .k-label .tag { margin-left: auto; }
.kpi .k-value { font-family: var(--font-display); font-size: var(--fs-2xl); font-weight: 650; letter-spacing: -0.025em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi .k-value.neg { color: var(--bad-text); }
.kpi .k-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: var(--fs-sm); color: var(--text-3); min-height: 20px; }
.kpi .k-spark { height: 38px; margin: 2px -6px -4px; }
.kpi.unavailable .k-value { color: var(--text-3); font-size: var(--fs-lg); font-weight: 500; letter-spacing: 0; }

/* Stat inline */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1px; background: var(--border); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.stat { background: var(--surface); padding: 12px 14px; }
.stat .s-l { font-size: var(--fs-xs); color: var(--text-3); font-weight: 500; }
.stat .s-v { font-size: var(--fs-lg); font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

/* Legend */
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: var(--fs-sm); color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.line { height: 2px; border-radius: 2px; width: 14px; }

/* ---------- Tabelas ---------- */
.table-wrap { overflow: auto; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }
.t th, .t td { padding: 8px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.t th { position: sticky; top: 0; background: var(--surface-2); color: var(--text-3); font-weight: 600; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .04em; z-index: 2; }
.t th:first-child, .t td:first-child { text-align: left; }
.t tbody tr:hover td { background: var(--surface-hover); }
.t td.neg { color: var(--bad-text); }
.t td.pos { color: var(--good-text); }
.t tr.total td { font-weight: 650; background: var(--surface-2); }
.t .bar-cell { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.t .bar-track { width: 70px; height: 6px; border-radius: 3px; background: var(--surface-sunken); overflow: hidden; }
.t .bar-fill { height: 100%; border-radius: 3px; background: var(--s1); }

/* DRE detalhada */
.dre-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.dre-tools .grow { flex: 1; }
.dre-tools .input { width: 220px; }
.dre-table-wrap { overflow: auto; max-height: calc(100vh - 230px); }
table.dre { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: var(--fs-sm); }
.dre th, .dre td { padding: 0 12px; height: 34px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.dre thead th { position: sticky; top: 0; z-index: 3; background: var(--surface-2); color: var(--text-3); font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; height: 38px; }
.dre th.sticky, .dre td.sticky { position: sticky; left: 0; z-index: 2; background: var(--surface); text-align: left; min-width: 340px; max-width: 420px; border-right: 1px solid var(--border); }
.dre thead th.sticky { z-index: 4; background: var(--surface-2); }
.dre td.sticky .lbl { display: flex; align-items: center; gap: 6px; overflow: hidden; }
.dre td.sticky .lbl span.t { overflow: hidden; text-overflow: ellipsis; }
.dre .tog { width: 18px; height: 18px; border: 0; background: transparent; padding: 0; display: grid; place-items: center; color: var(--text-3); border-radius: 4px; flex: none; }
.dre .tog:hover { background: var(--surface-hover); color: var(--text); }
.dre .tog svg { width: 12px; height: 12px; transition: transform var(--dur) var(--ease); }
.dre tr.open .tog svg { transform: rotate(90deg); }
.dre tr.lvl-0 td { font-weight: 600; }
.dre tr.lvl-1 td.sticky .lbl { padding-left: 20px; }
.dre tr.lvl-2 td.sticky .lbl { padding-left: 44px; }
.dre tr.acc td { color: var(--text-2); }
.dre tr.acc td.sticky { color: var(--text); font-weight: 400; }
.dre tr.result td { background: var(--surface-sunken); font-weight: 700; }
.dre tr.result td.sticky { background: var(--surface-sunken); }
.dre tr.result.final td { background: var(--accent-weak); }
.dre tr.result.final td.sticky { background: color-mix(in srgb, var(--accent) 9%, var(--surface)); }
.dre tr.aggregate td { color: var(--text-3); font-style: italic; font-weight: 500; }
.dre td.neg { color: var(--bad-text); }
.dre td.col-total { background: color-mix(in srgb, var(--surface-sunken) 60%, transparent); font-weight: 600; }
.dre tbody tr:hover td { background: var(--surface-hover); }
.dre tbody tr:hover td.sticky { background: var(--surface-hover); }
.dre tbody tr.clickable { cursor: pointer; }
.dre tr.hl td { animation: hl 2.4s var(--ease); }
@keyframes hl { 0%, 40% { background: var(--accent-weak); } 100% { background: transparent; } }
.dre .flag { display: inline-flex; color: var(--warn-text); margin-left: 4px; vertical-align: -2px; }
.dre .flag svg { width: 12px; height: 12px; }
.dre .role { font-size: 10px; color: var(--text-3); font-weight: 500; border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; margin-left: 6px; flex: none; }

/* ---------- Insights ---------- */
.insight { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; border-left: 3px solid var(--border-strong); }
.insight.critical { border-left-color: var(--bad); }
.insight.attention { border-left-color: var(--warn); }
.insight.positive { border-left-color: var(--good); }
.insight.neutral { border-left-color: var(--s1); }
.insight .i-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.insight h4 { margin: 0; font-size: var(--fs-md); font-weight: 600; letter-spacing: -0.005em; line-height: 1.35; }
.insight p { margin: 0; color: var(--text-2); }
.insight .evidence { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.insight .evidence div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.insight .evidence span { display: block; font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.insight .evidence b { font-variant-numeric: tabular-nums; font-weight: 650; }
.insight .action { display: flex; gap: 8px; align-items: flex-start; font-size: var(--fs-sm); color: var(--text); background: var(--accent-weak); border-radius: 8px; padding: 8px 10px; }
.insight .action svg.i { color: var(--accent); margin-top: 2px; }
.insight .i-foot { display: flex; justify-content: flex-end; }
.insight-mini { display: flex; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.insight-mini:last-child { border-bottom: 0; }
.insight-mini .ic { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; flex: none; }
.insight-mini .ic.critical { background: var(--bad-weak); color: var(--bad-text); }
.insight-mini .ic.attention { background: var(--warn-weak); color: var(--warn-text); }
.insight-mini .ic.positive { background: var(--good-weak); color: var(--good-text); }
.insight-mini .ic.neutral { background: var(--info-weak); color: var(--accent); }
.insight-mini h5 { margin: 0 0 2px; font-size: var(--fs-base); font-weight: 600; }
.insight-mini p { margin: 0; font-size: var(--fs-sm); color: var(--text-3); }

/* ---------- Qualidade ---------- */
.check { display: flex; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.check:last-child { border-bottom: 0; }
.check .ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; margin-top: 1px; }
.check .ic svg.i { width: 13px; height: 13px; stroke-width: 2.2; }
.check .ic.ok { background: var(--good-weak); color: var(--good-text); }
.check .ic.info { background: var(--info-weak); color: var(--accent); }
.check .ic.warning { background: var(--warn-weak); color: var(--warn-text); }
.check .ic.error { background: var(--bad-weak); color: var(--bad-text); }
.check h5 { margin: 0; font-size: var(--fs-base); font-weight: 600; }
.check p { margin: 2px 0 0; color: var(--text-2); font-size: var(--fs-sm); }
.check .area { font-size: var(--fs-xs); color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.check table.t { margin-top: 8px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.check table.t th { position: static; }
code, .code { font-family: var(--font-mono); font-size: 11.5px; background: var(--surface-sunken); border: 1px solid var(--border); padding: 1px 5px; border-radius: 4px; color: var(--text-2); }

.tree-row { display: flex; align-items: center; gap: 8px; padding: 7px 18px; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
.tree-row.l1 { padding-left: 38px; }
.tree-row .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-row .rule { color: var(--text-3); font-size: var(--fs-xs); max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); align-items: flex-start; }
.callout.warn { background: var(--warn-weak); border-color: transparent; }
.callout.bad { background: var(--bad-weak); border-color: transparent; }
.callout.info { background: var(--info-weak); border-color: transparent; }
.callout.demo { background: var(--demo-weak); border-color: transparent; }
.callout .grow { flex: 1; }
.callout h4 { margin: 0; font-size: var(--fs-base); font-weight: 600; }
.callout p { margin: 2px 0 0; color: var(--text-2); font-size: var(--fs-sm); }

.empty { padding: 48px 24px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; color: var(--text-2); }
.empty .ill { width: 52px; height: 52px; border-radius: 14px; background: var(--surface-sunken); display: grid; place-items: center; color: var(--text-3); border: 1px solid var(--border); }
.empty .ill svg.i { width: 24px; height: 24px; }
.empty h3 { margin: 6px 0 0; color: var(--text); font-size: var(--fs-lg); font-weight: 600; }
.empty p { margin: 0; max-width: 520px; }
.empty .chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }

/* ---------- Drawer ---------- */
.drawer-back { position: fixed; inset: 0; background: var(--overlay); z-index: 60; opacity: 0; animation: fade var(--dur) var(--ease) forwards; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--surface); z-index: 61; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; transform: translateX(24px); opacity: 0; animation: slidein var(--dur) var(--ease) forwards; }
.drawer-h { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; gap: 12px; align-items: flex-start; }
.drawer-h h3 { margin: 0; font-size: var(--fs-lg); font-weight: 650; letter-spacing: -0.01em; }
.drawer-h p { margin: 2px 0 0; color: var(--text-3); font-size: var(--fs-sm); }
.drawer-b { padding: 18px 20px; overflow: auto; display: flex; flex-direction: column; gap: 16px; }
@keyframes fade { to { opacity: 1; } }
@keyframes slidein { to { transform: none; opacity: 1; } }

/* ---------- Upload ---------- */
.landing { min-height: 100vh; display: flex; flex-direction: column; background:
  radial-gradient(1200px 500px at 50% -10%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%), var(--bg); }
.landing-top { display: flex; align-items: center; justify-content: space-between; padding: 18px 28px; }
.landing-main { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 40px 20px 60px; gap: 28px; }
.hero { text-align: center; max-width: 700px; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.hero h1 { margin: 0; font-family: var(--font-display); font-size: var(--fs-3xl); line-height: 1.12; letter-spacing: -0.035em; font-weight: 700; }
.hero p { margin: 0; font-size: var(--fs-lg); color: var(--text-2); max-width: 580px; }
.eyebrow-pill { display: inline-flex; gap: 8px; align-items: center; height: 26px; padding: 0 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: var(--fs-sm); color: var(--text-2); box-shadow: var(--shadow-sm); }
.upload-shell { width: min(720px, 100%); display: flex; flex-direction: column; gap: 14px; }
.dropzone {
  position: relative; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-xl); background: var(--surface);
  padding: 40px 28px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), box-shadow var(--dur), transform var(--dur);
  box-shadow: var(--shadow);
}
.dropzone:hover { border-color: var(--accent); }
.dropzone.drag { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, var(--surface)); box-shadow: 0 0 0 6px var(--accent-weak), var(--shadow); transform: scale(1.005); }
.dropzone .dz-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-weak); color: var(--accent); }
.dropzone .dz-icon svg.i { width: 24px; height: 24px; }
.dropzone h2 { margin: 0; font-size: var(--fs-xl); font-weight: 650; letter-spacing: -0.02em; }
.dropzone p { margin: 0; color: var(--text-2); }
.dropzone .formats { display: flex; gap: 6px; }
.dropzone input { display: none; }

.process { border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow); padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; }
.file-row { display: flex; align-items: center; gap: 12px; }
.file-ic { width: 40px; height: 40px; border-radius: 10px; background: color-mix(in srgb, #1d6f42 14%, var(--surface)); color: #1d6f42; display: grid; place-items: center; flex: none; font-weight: 800; font-size: 11px; letter-spacing: .02em; }
.file-row .fname { font-weight: 600; }
.file-row .fmeta { color: var(--text-3); font-size: var(--fs-sm); }
.steps { display: flex; flex-direction: column; gap: 2px; }
.step { display: flex; align-items: center; gap: 10px; padding: 7px 4px; color: var(--text-3); font-size: var(--fs-base); }
.step .s-ic { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--border-strong); flex: none; }
.step .s-ic svg.i { width: 12px; height: 12px; stroke-width: 2.4; }
.step.active { color: var(--text); }
.step.active .s-ic { border-color: var(--accent); border-top-color: transparent; animation: spin .8s linear infinite; }
.step.done { color: var(--text); }
.step.done .s-ic { background: var(--good); border-color: var(--good); color: #fff; }
.step.fail { color: var(--bad-text); }
.step.fail .s-ic { background: var(--bad); border-color: var(--bad); color: #fff; }
.step .s-note { margin-left: auto; font-size: var(--fs-sm); color: var(--text-3); font-variant-numeric: tabular-nums; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress { height: 4px; border-radius: 2px; background: var(--surface-sunken); overflow: hidden; }
.progress > div { height: 100%; background: var(--brand-green); border-radius: 2px; transition: width 300ms var(--ease); }

.alt-entry { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.alt-card { border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-lg); padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; text-align: left; transition: border-color var(--dur), box-shadow var(--dur); }
.alt-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.alt-card .ac-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.alt-card.demo .ac-ic { background: var(--demo-weak); color: var(--demo); }
.alt-card.dl .ac-ic { background: var(--surface-sunken); color: var(--text-2); }
.alt-card h4 { margin: 0; font-size: var(--fs-base); font-weight: 600; }
.alt-card p { margin: 2px 0 0; font-size: var(--fs-sm); color: var(--text-3); }
.trust { display: flex; gap: 22px; justify-content: center; flex-wrap: wrap; color: var(--text-3); font-size: var(--fs-sm); }
.trust span { display: inline-flex; align-items: center; gap: 6px; }

.toast-zone { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--brand-navy); color: #fff; padding: 10px 14px; border-radius: 10px; font-size: var(--fs-sm); box-shadow: var(--shadow-lg); display: flex; gap: 8px; align-items: center; animation: slideup var(--dur) var(--ease); }
@keyframes slideup { from { transform: translateY(8px); opacity: 0; } }

.fade-in { animation: fadeup 260ms var(--ease) both; }
@keyframes fadeup { from { opacity: 0; transform: translateY(4px); } }

/* ---------- Responsivo ---------- */
@media (max-width: 1180px) {
  .g-main, .g-main-r { grid-template-columns: 1fr; }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 272px; transform: translateX(-100%); transition: transform var(--dur) var(--ease); box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open::after { content: ""; position: fixed; inset: 0; background: var(--overlay); z-index: 19; }
  .menu-toggle { display: inline-flex; }
  .topbar { padding: 10px 16px; }
  .content { padding: 16px 16px 48px; }
  .g-2, .g-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .alt-entry { grid-template-columns: 1fr; }
  .hero h1 { font-size: var(--fs-2xl); }
  .dre th.sticky, .dre td.sticky { min-width: 220px; max-width: 240px; }
  .topbar .controls { width: 100%; }
  .card-h { flex-wrap: wrap; }
  .card-h .tools { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
@media print {
  .sidebar, .topbar .controls, .mode-strip { display: none; }
  .app { grid-template-columns: 1fr; }
  .card { break-inside: avoid; }
}

/* ==================== Dashboard: camada visual moderna ==================== */
/* Inspiração: componentes de 21st.dev (spotlight card, number ticker, bento, glass tooltip). */

/* Entrada escalonada dos blocos do conteúdo */
.content.enter > *, .content.enter .grid > * { animation: rise 560ms var(--ease) both; }
.content.enter > :nth-child(2) { animation-delay: 40ms; } .content.enter > :nth-child(3) { animation-delay: 80ms; }
.content.enter > :nth-child(4) { animation-delay: 120ms; } .content.enter > :nth-child(5) { animation-delay: 160ms; }
.content.enter > :nth-child(n+6) { animation-delay: 200ms; }
.content.enter .grid > :nth-child(2) { animation-delay: 60ms; } .content.enter .grid > :nth-child(3) { animation-delay: 120ms; }
.content.enter .grid > :nth-child(4) { animation-delay: 180ms; } .content.enter .grid > :nth-child(5) { animation-delay: 240ms; }
.content.enter .grid > :nth-child(n+6) { animation-delay: 300ms; }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.995); } to { opacity: 1; transform: none; } }

/* Cartões: borda que acende e leve elevação; spotlight segue o cursor */
.card { position: relative; transition: border-color 220ms var(--ease), box-shadow 260ms var(--ease), transform 260ms var(--ease); }
.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity 300ms var(--ease); z-index: 0;
  background: radial-gradient(520px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--c, var(--accent)) 7%, transparent), transparent 42%);
}
.card:hover::before { opacity: 1; }
.card > * { position: relative; z-index: 1; }

/* KPI */
.kpi { padding: 16px 18px 10px; gap: 8px; isolation: isolate; }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kpi::before { background: radial-gradient(300px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--c, var(--accent)) 14%, transparent), transparent 60%); }
.kpi::after {
  content: ""; position: absolute; left: 16px; right: 16px; top: -1px; height: 2px; border-radius: 2px; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--c, var(--accent)), transparent); opacity: .55; transition: opacity 300ms var(--ease), left 400ms var(--ease), right 400ms var(--ease);
}
.kpi:hover::after { opacity: 1; left: 0; right: 0; }
.kpi .k-label { gap: 8px; }
.k-ic {
  width: 26px; height: 26px; border-radius: 8px; display: inline-grid; place-items: center; flex: none;
  color: var(--c, var(--accent)); background: color-mix(in srgb, var(--c, var(--accent)) 13%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c, var(--accent)) 22%, transparent);
  transition: transform 300ms var(--ease);
}
.k-ic svg.i { width: 14px; height: 14px; stroke-width: 2; }
.kpi:hover .k-ic { transform: rotate(-6deg) scale(1.08); }
.kpi .k-value { font-size: calc(var(--fs-2xl) * 1.06); }
.kpi .k-value .num { display: inline-block; min-width: 4ch; }
.kpi .k-sub .delta { padding: 2px 7px 2px 5px; border-radius: 999px; font-size: var(--fs-xs); }
.kpi .k-sub .delta.good { background: var(--good-weak); }
.kpi .k-sub .delta.bad { background: var(--bad-weak); }
.kpi .k-sub .delta.flat { background: var(--surface-sunken); }
.kpi .k-spark { height: 46px; margin: 0 -10px -6px; }

/* Faixa de estatísticas com marcador de cor */
.stat { position: relative; padding-left: 18px; }
.stat::before { content: ""; position: absolute; left: 8px; top: 14px; bottom: 14px; width: 3px; border-radius: 3px; background: var(--c, transparent); }
.stat .s-v.neg { color: var(--bad-text); }

/* Legenda interativa */
.legend.interactive { gap: 4px; }
.legend.interactive button {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent; background: transparent; color: var(--text-2);
  font: inherit; font-size: var(--fs-sm); padding: 3px 9px; border-radius: 999px; cursor: pointer; transition: background 160ms, border-color 160ms, opacity 160ms, color 160ms;
}
.legend.interactive button:hover { background: var(--surface-hover); border-color: var(--border); color: var(--text); }
.legend.interactive button[aria-pressed="false"] { opacity: .45; text-decoration: line-through; }
.legend.interactive button[aria-pressed="false"] i { background: var(--text-3) !important; }
.legend.interactive button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.card-h .tools .legend + .seg { margin-left: 6px; }

/* Segmentado com transição suave */
.seg button { transition: background 200ms var(--ease), color 200ms var(--ease), box-shadow 200ms var(--ease); }

/* Barras de tabela animadas */
.bar-fill { transform-origin: left; animation: growx 900ms var(--ease) both; animation-delay: 200ms; }
@keyframes growx { from { transform: scaleX(0); } }

/* Destaques: realce ao passar o mouse */
.insight-mini { transition: background 200ms var(--ease); }
.insight-mini:hover { background: var(--surface-hover); }
.insight-mini .ic { transition: transform 300ms var(--ease); }
.insight-mini:hover .ic { transform: scale(1.1); }

@media (prefers-reduced-motion: reduce) {
  .kpi:hover { transform: none; }
  .content.enter > *, .content.enter .grid > *, .bar-fill { animation: none !important; }
}
