/* KUDO admin console (admin.kudo-fit.com). Light and dark, chart colours validated (dataviz reference palette). */
:root {
  color-scheme: light;
  --bg: #f4f4f2;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --border: #e4e3df;
  --text: #0b0b0b;
  --text-2: #52514e;
  --text-3: #75746f;
  --grid: #e8e7e3;
  --series: #eb6834;
  --series-soft: rgba(235, 104, 52, 0.12);
  --accent: #d94f00;
  --accent-text: #ffffff;
  --danger: #c62828;
  --good: #1b7f4b;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.04);
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #111110;
    --surface: #1a1a19;
    --surface-2: #232321;
    --border: #2e2e2b;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --text-3: #9a9990;
    --grid: #2c2c29;
    --series: #d95926;
    --series-soft: rgba(217, 89, 38, 0.18);
    --accent: #e8661f;
    --accent-text: #111110;
    --danger: #ef6b6b;
    --good: #4cc38a;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111110; --surface: #1a1a19; --surface-2: #232321; --border: #2e2e2b; --text: #f0efec; --text-2: #c3c2b7;
  --text-3: #9a9990; --grid: #2c2c29; --series: #d95926; --series-soft: rgba(217, 89, 38, 0.18); --accent: #e8661f;
  --accent-text: #111110; --danger: #ef6b6b; --good: #4cc38a; --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.45 "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
.boot { padding: 48px 16px; text-align: center; color: var(--text-3); }
.num { font-variant-numeric: tabular-nums; }

/* ---- sign-in ---- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 28px 24px; box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; letter-spacing: 0.2px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: var(--accent-text);
  display: grid; place-items: center; font-weight: 700; font-size: 18px;
}
.brand small { font-weight: 500; color: var(--text-3); font-size: 14px; }
.auth h1 { font-size: 20px; margin: 22px 0 4px; }
.auth p.lead { margin: 0 0 18px; color: var(--text-2); font-size: 14px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.field input {
  height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.btn {
  height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent; cursor: pointer; font-weight: 600;
}
.btn-primary { background: var(--accent); color: var(--accent-text); width: 100%; }
.btn-primary:disabled { opacity: 0.6; cursor: default; }
.btn-ghost { background: transparent; border-color: var(--border); }
.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-weight: 500; }
.auth-foot { margin-top: 16px; font-size: 14px; color: var(--text-2); text-align: center; }
.msg { border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 14px; }
.msg.error { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.msg.info { background: var(--surface-2); color: var(--text-2); }

/* ---- shell ---- */
.top {
  position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.top-inner {
  max-width: 1200px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 12px;
}
.top .who { margin-left: auto; font-size: 13px; color: var(--text-3); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.page { max-width: 1200px; margin: 0 auto; padding: 16px 16px 48px; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 4px 0 18px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; }
.seg button {
  border: 0; background: none; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 14px;
  color: var(--text-2); font-weight: 500;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.updated { margin-left: auto; font-size: 13px; color: var(--text-3); display: flex; align-items: center; gap: 8px; }

h2.section { font-size: 15px; font-weight: 600; margin: 26px 0 10px; color: var(--text); }
h2.section small { font-weight: 400; color: var(--text-3); margin-left: 6px; }

.live {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px;
}
.live .tile { display: flex; align-items: center; gap: 12px; }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--good); flex: none;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 20%, transparent); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.tiles + .tiles { margin-top: 10px; }
.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px;
}
.tile .label { font-size: 13px; color: var(--text-2); }
.tile .value { font-size: 28px; font-weight: 600; line-height: 1.15; margin-top: 4px; }
.tile .sub { font-size: 12px; color: var(--text-3); margin-top: 4px; }

.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 10px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px 10px;
  min-width: 0;
}
.card h3 { margin: 0; font-size: 14px; font-weight: 600; }
.card .card-sub { font-size: 12px; color: var(--text-3); margin: 2px 0 8px; }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .axis text { fill: var(--text-3); font-size: 11px; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--border); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--series); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--series-soft); }
.chart .bar { fill: var(--series); }
.chart .bar.dim { opacity: 0.45; }
.chart .cross { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .dot { fill: var(--series); stroke: var(--surface); stroke-width: 2; }
.chart .end-label { fill: var(--text); font-size: 12px; font-weight: 600; }
.tip {
  position: absolute; pointer-events: none; background: var(--text); color: var(--surface); font-size: 12px;
  padding: 6px 8px; border-radius: 8px; white-space: nowrap; transform: translate(-50%, -100%); z-index: 2;
}
.tip b { font-weight: 600; }
.empty { color: var(--text-3); font-size: 13px; padding: 24px 0; text-align: center; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; align-items: start; }
.kv { width: 100%; border-collapse: collapse; font-size: 14px; }
.kv td { padding: 7px 0; border-bottom: 1px solid var(--border); }
.kv tr:last-child td { border-bottom: 0; }
.kv td:last-child { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.kv td small { color: var(--text-3); font-weight: 400; }

.hbars { display: grid; gap: 10px; margin-top: 6px; }
.hbar-row { display: grid; grid-template-columns: 110px 1fr auto; align-items: center; gap: 10px; font-size: 14px; }
.hbar-track { height: 10px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.hbar-fill { height: 100%; background: var(--series); border-radius: 0 4px 4px 0; }
.hbar-row .val { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; min-width: 3ch; }
.hbar-row .meta { grid-column: 2 / 4; font-size: 12px; color: var(--text-3); margin-top: -6px; }

details.table-view { margin-top: 18px; }
details.table-view summary { cursor: pointer; color: var(--text-2); font-size: 14px; }
.table-wrap { overflow-x: auto; margin-top: 10px; border: 1px solid var(--border); border-radius: 12px; }
table.daily { border-collapse: collapse; font-size: 13px; width: 100%; background: var(--surface); }
table.daily th, table.daily td { padding: 7px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border); }
table.daily th:first-child, table.daily td:first-child { text-align: left; }
table.daily th { font-weight: 500; color: var(--text-2); background: var(--surface-2); }
table.daily td { font-variant-numeric: tabular-nums; }
.note { font-size: 12px; color: var(--text-3); margin-top: 22px; }

@media (max-width: 520px) {
  .charts, .grid-2 { grid-template-columns: 1fr; }
  .tile .value { font-size: 24px; }
  .updated { margin-left: 0; width: 100%; }
  .hbar-row { grid-template-columns: 90px 1fr auto; }
}
