/* Claude Usage: shared styles. Tokens first; light + dark. */
@font-face {
  font-family: "Inter";
  src: url("vendor/fonts/inter-var-latin.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}

:root {
  --bg: #f7f7f5; --surface: #ffffff; --surface-2: #f2f1ee; --line: #e7e5e0; --line-strong: #d6d3cc;
  --ink: #17171a; --ink-2: #52514e; --ink-3: #8a8883;
  --accent: #c2603c; --accent-ink: #ffffff; --accent-soft: #f6e7e0; --accent-bar: #d0714d;
  --good: #0ca30c; --warn: #d99400; --bad: #d03b3b; --good-soft: #e5f5e5; --warn-soft: #fbf1dc; --bad-soft: #fbe7e7;
  --focus: #2a78d6;
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 16, 20, .04), 0 1px 1px rgba(16, 16, 20, .03);
  --sidebar: 248px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141413; --surface: #1c1c1b; --surface-2: #232321; --line: #2e2d2b; --line-strong: #3a3936;
    --ink: #f0efec; --ink-2: #c3c2b7; --ink-3: #8f8d86;
    --accent: #e3825d; --accent-ink: #1a1009; --accent-soft: #3a2519; --accent-bar: #e3825d;
    --good: #3fbf3f; --warn: #fab219; --bad: #ef6b6b; --good-soft: #17301a; --warn-soft: #34290f; --bad-soft: #3a1c1c;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 14px/1.5 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.num, .tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.sub { color: var(--ink-2); font-size: 13px; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

/* ---------- buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface);
  cursor: pointer; text-decoration: none; white-space: nowrap; font-weight: 500;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--bad); }
.btn.small { height: 28px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: default; }
.field, select.field {
  height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); min-width: 0;
}
.field:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px rgba(42, 120, 214, .15); }
.msg { font-size: 13px; min-height: 18px; margin-top: 8px; }
.msg.ok { color: var(--good); } .msg.err { color: var(--bad); }

/* ---------- app shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh;
  background: linear-gradient(to right, var(--surface) calc(var(--sidebar) - 1px), var(--line) calc(var(--sidebar) - 1px), var(--line) var(--sidebar), var(--bg) var(--sidebar)); }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--line); padding: 18px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 650; font-size: 15px; }
.brand .logo {
  width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
}
.nav-group { margin: 6px 0 14px; }
.nav-label { padding: 0 10px 6px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--ink-2); text-decoration: none; font-weight: 500;
}
.nav a svg { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active { background: var(--accent-soft); color: var(--ink); }
.nav a.active svg { stroke: var(--accent); }
.sidebar .spacer { flex: 1; }
.me { border-top: 1px solid var(--line); padding: 14px 10px 0; }
.me .name { font-weight: 600; }
.me .role { font-size: 12px; color: var(--ink-3); margin-bottom: 10px; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); font-weight: 500; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }

.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  padding: 16px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -.01em; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.menu-btn { display: none; }
.content { padding: 24px 28px 56px; max-width: 1280px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; min-width: 0; }
.card h2 { margin: 0 0 4px; font-size: 14px; font-weight: 600; }
.card .card-sub { color: var(--ink-3); font-size: 12px; margin-bottom: 12px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.card-head a { font-size: 13px; color: var(--ink-2); text-decoration: none; }
.card-head a:hover { color: var(--accent); }
.grid { display: grid; gap: 16px; }
.grid.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 16px; }
.section { margin-top: 16px; }

.kpi .label { color: var(--ink-2); font-size: 12px; font-weight: 500; }
.kpi .value { font-size: 28px; font-weight: 650; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .note { margin-top: 6px; font-size: 12px; color: var(--ink-3); display: flex; gap: 6px; align-items: center; }
.delta { font-weight: 600; color: var(--ink-2); }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
td.num, th.num, .mono { font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th { font-size: 12px; font-weight: 500; color: var(--ink-3); background: transparent; }
th.num, td.num { text-align: right; width: 84px; white-space: nowrap; }
td.name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
td .sub { font-weight: 400; font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
td { overflow-wrap: anywhere; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--surface-2); }
.bar { height: 4px; background: var(--surface-2); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent-bar); border-radius: 2px; }
.empty { color: var(--ink-3); padding: 28px 0; text-align: center; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.dot.good { background: var(--good); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }

/* ---------- chart ---------- */
#chart { width: 100%; height: 240px; display: block; }
#chart .b { fill: var(--accent-bar); } #chart .b:hover { fill: var(--accent); }
#chart text { fill: var(--ink-3); font-size: 11px; }
#chart line { stroke: var(--line); }
.tip { position: fixed; z-index: 20; pointer-events: none; background: var(--ink); color: var(--bg); padding: 6px 9px; border-radius: 6px; font-size: 12px; display: none; box-shadow: 0 4px 12px rgba(0,0,0,.15); }

/* ---------- banner + wizard ---------- */
.banner { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 16px; border-color: var(--accent); background: var(--accent-soft); }
.banner b { font-weight: 600; }
.steps { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 18px; }
.steps span { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); color: var(--ink-3); }
.steps span i { font-style: normal; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--surface-2); font-size: 12px; font-weight: 600; }
.steps span.on { border-color: var(--accent); color: var(--ink); font-weight: 600; }
.steps span.on i { background: var(--accent); color: var(--accent-ink); }
.steps span.done { color: var(--ink-2); } .steps span.done i { background: var(--good-soft); color: var(--good); }
.step p { margin: 0 0 10px; }
.choice-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.choice { padding: 14px 18px; min-width: 160px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); cursor: pointer; text-align: left; }
.choice b { display: block; font-weight: 600; } .choice span { font-size: 12px; color: var(--ink-3); }
.choice.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.cmd { display: block; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); word-break: break-all; margin: 8px 0; }
.ok-text { color: var(--good); font-weight: 600; }
.why { color: var(--ink-3); font-size: 12px; margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.secret { margin-top: 12px; padding: 14px; border-radius: var(--radius-sm); border: 1px dashed var(--accent); background: var(--accent-soft); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.stack > * + * { margin-top: 16px; }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card .brand { padding: 0 0 18px; }
.auth-card h1 { margin: 0 0 4px; font-size: 20px; font-weight: 650; }
.auth-card p { color: var(--ink-2); margin: 0 0 18px; }
.auth-card .field { width: 100%; height: 40px; margin-bottom: 10px; }
.auth-card .btn { width: 100%; height: 40px; justify-content: center; }
.auth-card .err { color: var(--bad); font-size: 13px; margin-top: 10px; display: none; }
.auth-card .small { font-size: 12px; color: var(--ink-3); }
#mfa-qr { display: block; margin: 8px auto 12px; background: #fff; border-radius: 8px; padding: 8px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .grid.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; background: var(--bg); }
  .sidebar { position: fixed; z-index: 30; left: 0; top: 0; width: 272px; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.2); }
  .app.menu-open .sidebar { transform: none; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 12px 16px; }
  .content { padding: 16px 16px 48px; }
  .grid.two { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  /* phones: keep the name + tokens, drop the secondary columns */
  table:not(#users):not(#my-keys):not(#all-keys):not(#t-uploads):not(#t-daily):not(#t-daily-full) th.num:nth-last-child(-n+2),
  table:not(#users):not(#my-keys):not(#all-keys):not(#t-uploads):not(#t-daily):not(#t-daily-full) td.num:nth-last-child(-n+2) { display: none; }
  .opt { display: none !important; }
  #t-daily th:first-child, #t-daily-full th:first-child { width: 92px !important; }
  .grid.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card { padding: 14px; }
  .kpi .value { font-size: 22px; }
  .kpi .note { display: none; }
  .filters .field { flex: 1 1 140px; }
}
