:root {
  --ink: #14171a; --ink-2: #3c4348; --muted: #6a736d; --faint: #98a09a;
  --line: #e3e6e1; --line-2: #eef0ec; --bg: #fff; --panel: #f5f6f3; --hover: #ecefe9;
  --accent: #1f4fe0; --accent-tint: rgba(31, 79, 224, .09); --accent-2: #b26a00;
  --good: #0e7c4a; --bad: #c4321c;
  --sans: "Inter var", Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--sans); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1 { font-size: 20px; font-weight: 650; letter-spacing: -.01em; margin: 0; }
h2 { font-size: 13px; font-weight: 650; margin: 0; }
h3 { font-size: 13px; font-weight: 600; margin: 0 0 6px; }
p { margin: 0 0 10px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12.5px; }

/* shell */
.shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 16px 10px 20px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 16px; letter-spacing: -.02em; padding: 2px 8px 16px; }
.brand i { width: 14px; height: 14px; background: var(--accent); display: block; }
.nav-group { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); padding: 14px 8px 5px; }
.nav a { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px; border-radius: 6px; color: var(--ink-2); font-size: 13.5px; }
.nav a:hover { background: var(--hover); }
.nav a.on { background: var(--ink); color: #fff; font-weight: 550; }
.nav a small { font-size: 10px; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); }
.usage { margin-top: auto; padding: 14px 8px 0; font-size: 12px; color: var(--muted); }
.meter { height: 4px; background: var(--line); margin: 6px 0 8px; }
.meter b { display: block; height: 100%; background: var(--ink); }
.meter.hot b { background: var(--bad); }

.main { min-width: 0; }
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 28px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: rgba(255, 255, 255, .96); z-index: 20; }
.top .grow { flex: 1; }
.page { padding: 22px 28px 60px; max-width: 1480px; }
.page-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.crumb { color: var(--muted); font-size: 13px; }

/* controls */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px; border: 1px solid var(--line); background: var(--bg); border-radius: 6px; cursor: pointer; font-size: 13px; white-space: nowrap; }
.btn:hover { background: var(--panel); border-color: #cfd4cc; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 550; }
.btn.primary:hover { background: #000; }
.btn.danger { color: var(--bad); }
.btn.sm { height: 26px; padding: 0 8px; font-size: 12px; }
.btn.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn[disabled] { opacity: .5; cursor: default; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; background: var(--bg); height: 30px; padding: 0 10px; cursor: pointer; font-size: 12.5px; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--ink); color: #fff; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], select, textarea { height: 32px; padding: 0 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); min-width: 0; }
textarea { height: auto; padding: 8px 9px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label.f { display: block; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
label.f > span { display: block; margin-bottom: 4px; }
label.f input, label.f select, label.f textarea { width: 100%; color: var(--ink); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pop-wrap { position: relative; }
.pop { position: absolute; top: 36px; left: 0; min-width: 240px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 12px 32px rgba(20, 23, 26, .14); padding: 6px; z-index: 40; max-height: 70vh; overflow: auto; }
.pop.right { left: auto; right: 0; }
.pop .item { display: flex; justify-content: space-between; gap: 14px; width: 100%; text-align: left; padding: 7px 9px; border: 0; background: none; border-radius: 5px; cursor: pointer; font-size: 13px; }
.pop .item:hover, .pop .item.on { background: var(--panel); }
.pop .sep { height: 1px; background: var(--line); margin: 5px 0; }
.pop .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 7px 9px 3px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 4px 0 9px; background: var(--accent-tint); color: #173aa6; border-radius: 13px; font-size: 12.5px; }
.chip button { border: 0; background: none; cursor: pointer; color: inherit; font-size: 15px; line-height: 1; padding: 0 5px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 28px; border-bottom: 1px solid var(--line-2); background: #fcfcfb; }

/* KPI strip: metrics as tabs, not cards */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.kpi { padding: 14px 16px 12px; border: 0; border-right: 1px solid var(--line); background: none; text-align: left; cursor: pointer; position: relative; }
.kpi:last-child { border-right: 0; }
.kpi:hover { background: var(--panel); }
.kpi.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--ink); }
.kpi .l { font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.kpi .v { font-size: 26px; font-weight: 650; letter-spacing: -.02em; margin-top: 3px; font-variant-numeric: tabular-nums; }
.delta { font-size: 12px; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--good); } .delta.down { color: var(--bad); }
.kpi.static { cursor: default; } .kpi.static:hover { background: none; }

.chart-box { padding: 14px 0 6px; position: relative; }
.chart-tools { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 14px; height: 2px; background: var(--accent); vertical-align: middle; margin-right: 5px; }
.legend i.cmp { background: none; border-top: 2px dashed var(--faint); }
svg.chart { display: block; width: 100%; overflow: visible; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; font-size: 12px; padding: 6px 9px; border-radius: 5px; white-space: nowrap; transform: translate(-50%, -110%); z-index: 5; }
.tip b { font-variant-numeric: tabular-nums; }

.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 44px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 44px; }
.block { padding: 22px 0 4px; min-width: 0; }
.block-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.block-head a { font-size: 12.5px; color: var(--accent); }
.block-head a:hover { text-decoration: underline; }

/* tables */
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: right; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none; }
table.t th.sortable { cursor: pointer; }
table.t th.sortable:hover { color: var(--ink); }
table.t th:first-child, table.t td:first-child { text-align: left; padding-left: 0; }
table.t th.dim, table.t td.dim { text-align: left; }
table.t td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t td.dim { max-width: 420px; overflow: hidden; text-overflow: ellipsis; position: relative; }
table.t tr:hover td { background: #fafbf9; }
table.t td .bar { position: absolute; left: 0; top: 4px; bottom: 4px; background: var(--accent-tint); z-index: 0; border-radius: 2px; }
table.t td .lbl { position: relative; z-index: 1; padding-left: 7px; }
table.t td .lbl a:hover { text-decoration: underline; }
table.t td small { color: var(--faint); margin-left: 5px; }
table.t tfoot td { font-weight: 600; border-top: 1px solid var(--line); border-bottom: 0; }
.table-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.empty { padding: 34px 0; color: var(--muted); text-align: center; font-size: 13px; }
.err { color: var(--bad); font-size: 13px; padding: 8px 0; }
.note { font-size: 12.5px; color: var(--muted); max-width: 70ch; }

.live { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--good); }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--good); animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.big { font-size: 56px; font-weight: 680; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }

/* settings */
.set { max-width: 860px; }
.set section { padding: 22px 0; border-bottom: 1px solid var(--line); }
.set section:last-child { border-bottom: 0; }
.set h2 { font-size: 15px; margin-bottom: 4px; }
pre.code { background: #14171a; color: #e8ebe6; padding: 14px 16px; border-radius: 6px; font: 12.5px/1.55 var(--mono); overflow-x: auto; margin: 10px 0; white-space: pre-wrap; word-break: break-all; }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); text-transform: capitalize; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.plan { padding: 16px; border-right: 1px solid var(--line); }
.plan:last-child { border-right: 0; }
.plan.cur { background: var(--panel); }
.plan .price { font-size: 22px; font-weight: 650; margin: 6px 0; }
.plan ul { list-style: none; padding: 0; margin: 8px 0 0; font-size: 12.5px; color: var(--ink-2); }
.plan li { padding: 2px 0; }

/* auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth .pitch { background: var(--ink); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.auth .pitch h1 { font-size: 40px; line-height: 1.08; letter-spacing: -.03em; max-width: 14ch; }
.auth .pitch ul { list-style: none; padding: 0; margin: 0; color: #c4cac4; font-size: 14px; }
.auth .pitch li { padding: 9px 0; border-top: 1px solid #2c3136; }
.auth .form { padding: 56px; display: flex; align-items: center; }
.auth form { width: 100%; max-width: 360px; margin: 0 auto; }
.auth form h2 { font-size: 22px; margin-bottom: 18px; }
.auth form .btn { width: 100%; justify-content: center; height: 38px; }
.auth form p { font-size: 13px; color: var(--muted); margin-top: 14px; }
.auth form p a { color: var(--accent); cursor: pointer; }
.modal-bg { position: fixed; inset: 0; background: rgba(20, 23, 26, .35); display: grid; place-items: center; z-index: 100; padding: 20px; }
.modal { background: var(--bg); border-radius: 10px; padding: 22px; width: 100%; max-width: 440px; box-shadow: 0 24px 60px rgba(0, 0, 0, .25); }
.modal h2 { font-size: 16px; margin-bottom: 14px; }
.blocked { max-width: 560px; margin: 80px auto; text-align: center; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side .nav { display: flex; flex-wrap: wrap; gap: 2px; }
  .nav-group, .usage { display: none; }
  .brand { padding: 4px 8px; width: 100%; }
  .top, .filters, .page { padding-left: 14px; padding-right: 14px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .dash-top { grid-template-columns: minmax(0, 1fr) !important; }
  .nav a { gap: 6px; }
  .auth { grid-template-columns: 1fr; } .auth .pitch { display: none; } .auth .form { padding: 28px 18px; }
  .kpi .v { font-size: 21px; }
  table.t td.dim { max-width: 190px; }
  .tablewrap { overflow-x: auto; }
}
