:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1d2433;
  --muted: #667085;
  --line: #e4e7ec;
  --brand: #ff9900;
  --brand-ink: #1d2433;
  --accent: #2563eb;
  --ok: #12805c;
  --warn: #b54708;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.45 "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: var(--accent); }
button, input, select { font: inherit; }

.topbar { background: #1d2433; color: #fff; padding: 12px 24px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.topbar h1 { font-size: 17px; margin: 0; font-weight: 600; }
.topbar .sub { color: #c7cdd8; font-size: 12.5px; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 12.5px; color: #c7cdd8; text-align: right; }
.topbar button, .topbar select { background: #2f3a4f; color: #fff; border: 1px solid #45526b; border-radius: 6px; padding: 5px 10px; cursor: pointer; }
.demo-badge { background: var(--brand); color: #1d2433; font-weight: 700; font-size: 11px; padding: 2px 8px; border-radius: 99px; letter-spacing: .4px; }

main { padding: 18px 24px 40px; max-width: 1400px; margin: 0 auto; }

.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.filters label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.filters input, .filters select { border: 1px solid #cfd4dc; border-radius: 6px; padding: 6px 8px; min-width: 150px; background: #fff; color: var(--ink); }
.filters .reset { background: none; border: none; color: var(--accent); cursor: pointer; padding: 6px 4px; }
.asof { margin-left: auto; font-size: 12px; color: var(--muted); text-align: right; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 14px 0; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi .k { font-size: 12px; color: var(--muted); }
.kpi .v { font-size: 22px; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; }

.widget { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-top: 16px; overflow: hidden; }
.widget-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.widget-head h2 { font-size: 15px; margin: 0; }
.widget-head .hint { color: var(--muted); font-size: 12px; }
.widget-head .actions { margin-left: auto; display: flex; gap: 8px; }
.btn { border: 1px solid #cfd4dc; background: #fff; border-radius: 6px; padding: 5px 11px; cursor: pointer; color: var(--ink); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: default; }

.table-wrap { overflow-x: auto; }
table.sheet { border-collapse: collapse; width: 100%; font-size: 13px; }
table.sheet .band th { background: var(--brand); color: var(--brand-ink); font-weight: 700; text-align: center; padding: 5px; border: 1px solid #e08a00; }
table.sheet thead tr.cols th { background: #fafbfc; font-weight: 600; text-align: center; padding: 7px 8px; border: 1px solid var(--line); white-space: nowrap; }
table.sheet td { padding: 6px 8px; border: 1px solid var(--line); vertical-align: top; }
table.sheet td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.sheet td.ref { white-space: nowrap; font-weight: 600; }
table.sheet td.csv { max-width: 320px; }
table.sheet td.extra, table.sheet th.extra { color: var(--muted); background: #fcfcfd; }
table.sheet tfoot td { font-weight: 700; background: #fafbfc; }
table.sheet tbody tr:hover td { background: #f7f9fc; }
.att a { display: inline-block; margin-right: 6px; white-space: nowrap; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.tag { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 4px; background: #eef2ff; color: #3730a3; margin-left: 6px; font-weight: 500; }

.note { background: #fffaeb; border: 1px solid #fedf89; color: #7a2e0e; border-radius: var(--radius); padding: 10px 14px; margin-top: 14px; font-size: 13px; }
.note.info { background: #eff8ff; border-color: #b2ddff; color: #194185; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1d2433; color: #fff; padding: 8px 16px; border-radius: 8px; font-size: 13px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }

/* login */
.login { max-width: 360px; margin: 10vh auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 26px; }
.login h1 { font-size: 18px; margin: 0 0 4px; }
.login p { color: var(--muted); margin: 0 0 18px; font-size: 13px; }
.login label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.login input { width: 100%; border: 1px solid #cfd4dc; border-radius: 6px; padding: 8px 10px; margin-top: 4px; }
.login .err { color: #b42318; font-size: 13px; min-height: 18px; margin-bottom: 8px; }
.login button { width: 100%; padding: 9px; }

/* admin */
.admin textarea { width: 100%; min-height: 160px; font: 12.5px/1.4 Consolas, monospace; border: 1px solid #cfd4dc; border-radius: 6px; padding: 8px; }
.admin .body { padding: 12px 14px; }
.admin .body p { margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.admin code { background: #f2f4f7; padding: 1px 4px; border-radius: 4px; }
