/* ============================================================
   TIKO — design tokens
   Light-first, hairline surfaces, console density.
   ============================================================ */

:root, .theme-light {
  /* Ink scale — slightly cool neutrals */
  --ink-0:    #ffffff;
  --ink-50:   #fafafb;
  --ink-100:  #f4f4f7;
  --ink-150:  #ececf1;
  --ink-200:  #e3e3ea;
  --ink-300:  #d3d4de;
  --ink-400:  #b3b5c2;
  --ink-500:  #888a99;
  --ink-600:  #5d5f6e;
  --ink-700:  #3a3c4a;
  --ink-800:  #20222d;
  --ink-900:  #0a0d18;

  /* Brand */
  --brand-50:  #eef0ff;
  --brand-100: #dde1ff;
  --brand-200: #b8c0ff;
  --brand-300: #8e98fb;
  --brand-400: #6b75f0;
  --brand-500: #4f5ae8;     /* primary */
  --brand-600: #3f47cf;
  --brand-700: #313aa6;
  --brand-800: #232879;
  --brand-900: #161a4f;

  /* Semantic */
  --success: #11a36b;
  --success-bg: #e6f6ee;
  --warning: #c98a16;
  --warning-bg: #fbf2dd;
  --danger:  #d8483a;
  --danger-bg: #fbe9e6;
  --info:    #3989d1;
  --info-bg: #e6f1fb;

  /* Tier accents */
  --tier-bronze: #a06a3c;
  --tier-silver: #6e7382;
  --tier-gold:   #c2922f;
  --tier-plat:   #4f6b85;

  /* Surfaces */
  --bg:        var(--ink-50);
  --surface:   var(--ink-0);
  --surface-2: var(--ink-100);
  --surface-3: var(--ink-150);
  --border:    rgba(10,13,24,.08);
  --border-strong: rgba(10,13,24,.14);
  --hairline:  rgba(10,13,24,.05);

  /* Text */
  --text:        var(--ink-900);
  --text-muted:  var(--ink-600);
  --text-faint:  var(--ink-500);
  --text-ghost:  var(--ink-400);

  /* Radii */
  --r-1: 4px;
  --r-2: 6px;
  --r-3: 8px;
  --r-4: 10px;
  --r-5: 14px;
  --r-full: 999px;

  /* Spacing scale (4-base) */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px;  --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-7: 32px;  --s-8: 40px;
  --s-9: 56px; --s-10: 72px;

  /* Elevation */
  --el-1: 0 1px 0 rgba(10,13,24,.04);
  --el-2: 0 1px 2px rgba(10,13,24,.06), 0 0 0 1px rgba(10,13,24,.04);
  --el-3: 0 8px 24px rgba(10,13,24,.10), 0 0 0 1px rgba(10,13,24,.06);
  --el-4: 0 24px 60px rgba(10,13,24,.18), 0 0 0 1px rgba(10,13,24,.08);

  /* Type */
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Inter", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --t-12: 12px; --t-13: 13px; --t-14: 14px; --t-15: 15px;
  --t-16: 16px; --t-18: 18px; --t-22: 22px; --t-28: 28px;
  --t-36: 36px; --t-48: 48px;

  /* Layout */
  --rail-w: 232px;
  --topbar-h: 48px;
  --row-h: 36px;
}

.theme-dark {
  --ink-0:    #0a0d18;
  --ink-50:   #0d111d;
  --ink-100:  #131725;
  --ink-150:  #181d2d;
  --ink-200:  #1f2436;
  --ink-300:  #2b3145;
  --ink-400:  #3e445a;
  --ink-500:  #6a6f83;
  --ink-600:  #8e93a4;
  --ink-700:  #b3b6c4;
  --ink-800:  #d3d5df;
  --ink-900:  #eceef5;

  --brand-50:  #161a3a;
  --brand-100: #1c2150;
  --brand-200: #292f73;
  --brand-300: #3a42a8;
  --brand-400: #5e68d8;
  --brand-500: #7a83f0;
  --brand-600: #9097f5;
  --brand-700: #b8bdfa;
  --brand-800: #d4d7fc;
  --brand-900: #ebedfe;

  --success-bg: #0e2a1e;
  --warning-bg: #2b2210;
  --danger-bg:  #2c1612;
  --info-bg:    #102236;

  --bg:        var(--ink-50);
  --surface:   var(--ink-100);
  --surface-2: var(--ink-150);
  --surface-3: var(--ink-200);
  --border:    rgba(255,255,255,.06);
  --border-strong: rgba(255,255,255,.12);
  --hairline:  rgba(255,255,255,.04);

  --text:        var(--ink-900);
  --text-muted:  var(--ink-700);
  --text-faint:  var(--ink-600);
  --text-ghost:  var(--ink-500);

  --el-1: 0 1px 0 rgba(0,0,0,.4);
  --el-2: 0 1px 2px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.04);
  --el-3: 0 8px 24px rgba(0,0,0,.5),  0 0 0 1px rgba(255,255,255,.06);
  --el-4: 0 24px 60px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.08);
}

/* ─────── Reset & base ─────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: var(--t-13);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}
button { font: inherit; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
.mono { font-family: var(--font-mono); font-feature-settings: "tnum"; letter-spacing: -.01em; }
.tnum { font-variant-numeric: tabular-nums; }

/* ─────── App shell ─────── */
.app {
  display: grid;
  grid-template-columns: var(--rail-w) 1fr;
  min-height: 100vh;
  background: var(--bg);
}
.rail {
  border-right: 1px solid var(--hairline);
  background: var(--surface);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.rail__head { padding: 14px 14px 10px; }
.rail__ws {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px; border-radius: var(--r-3);
  cursor: default;
  transition: background .14s;
}
.rail__ws:hover { background: var(--surface-2); }
.rail__ws-name { font-weight: 600; font-size: var(--t-13); line-height: 1; }
.rail__ws-meta { color: var(--text-faint); font-size: 11px; line-height: 1; margin-top: 4px; }
.rail__ws-chev { margin-left: auto; color: var(--text-faint); }

.rail__group {
  padding: 14px 8px 4px;
}
.rail__label {
  font-size: 10px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-ghost);
  padding: 0 8px 6px;
}
.rail__nav { display: flex; flex-direction: column; gap: 1px; }
.rail__item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px;
  border-radius: var(--r-2);
  color: var(--text-muted);
  font-size: var(--t-13);
  cursor: default;
  position: relative;
  user-select: none;
}
.rail__item:hover { background: var(--surface-2); color: var(--text); }
.rail__item--active { color: var(--text); background: var(--surface-2); font-weight: 500; }
.rail__item--active::before {
  content: ""; position: absolute; left: -8px; top: 8px; bottom: 8px;
  width: 2px; background: var(--brand-500); border-radius: 2px;
}
.rail__ico {
  width: 16px; height: 16px; flex: 0 0 16px;
  color: var(--text-faint);
  display: inline-flex; align-items: center; justify-content: center;
}
.rail__item--active .rail__ico { color: var(--brand-500); }
.rail__badge {
  margin-left: auto; font-family: var(--font-mono);
  font-size: 10.5px; color: var(--text-faint);
  background: var(--surface-3);
  padding: 1px 5px; border-radius: var(--r-1);
}
.rail__tag {
  margin-left: auto;
  font-size: 9.5px; font-weight: 600;
  letter-spacing: .06em;
  padding: 1px 5px; border-radius: 3px;
  color: var(--brand-600);
  background: var(--brand-50);
}
.rail__foot {
  margin-top: auto; padding: 12px 14px;
  border-top: 1px solid var(--hairline);
  display: flex; align-items: center; gap: 10px;
}

/* ─────── Topbar ─────── */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid var(--hairline);
  background: color-mix(in oklab, var(--surface) 80%, transparent);
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: saturate(160%) blur(8px);
}
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--text-faint); font-size: var(--t-13); }
.crumbs .sep { color: var(--text-ghost); }
.crumbs .now { color: var(--text); font-weight: 500; }
.topbar__spacer { flex: 1; }
.topbar__group { display: flex; align-items: center; gap: 6px; }

.search {
  display: inline-flex; align-items: center; gap: 8px;
  height: 28px; padding: 0 10px 0 8px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-2);
  color: var(--text-faint); font-size: var(--t-13);
  min-width: 220px;
}
.search kbd {
  font-family: var(--font-mono); font-size: 10.5px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  padding: 1px 5px; border-radius: 3px;
  margin-left: auto;
  color: var(--text-faint);
}
.icon-btn {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--r-2);
  cursor: default;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn[aria-pressed="true"] { background: var(--surface-2); color: var(--text); }
.avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--brand-500); color: white;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 600;
  border: 1px solid var(--border);
}

/* ─────── Page header & content ─────── */
.page {
  padding: 24px 28px 60px;
  max-width: 1480px;
  margin: 0 auto;
  width: 100%;
}
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px; letter-spacing: .08em;
  color: var(--text-faint);
  text-transform: uppercase;
}
.pagetitle { font-size: var(--t-22); font-weight: 600; letter-spacing: -.01em; margin: 2px 0 6px; line-height: 1.1; }
.pagesub { color: var(--text-muted); font-size: var(--t-13); max-width: 64ch; }
.pageactions { display: flex; align-items: center; gap: 8px; }

/* ─────── Buttons ─────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 10px;
  border-radius: var(--r-2);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text); font-size: var(--t-13);
  font-weight: 500; cursor: default; user-select: none;
  transition: background .14s, border-color .14s, color .14s;
}
.btn:hover { background: var(--surface-2); }
.btn--ghost { border-color: transparent; background: transparent; color: var(--text-muted); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }
.btn--primary { background: var(--ink-900); color: var(--ink-0); border-color: var(--ink-900); }
.theme-dark .btn--primary { background: var(--ink-900); color: var(--ink-0); }
.btn--primary:hover { background: var(--ink-800); border-color: var(--ink-800); }
.btn--brand { background: var(--brand-500); color: white; border-color: var(--brand-500); }
.btn--brand:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn--danger { color: var(--danger); }
.btn--sm { height: 24px; padding: 0 8px; font-size: 12px; }
.btn--lg { height: 34px; padding: 0 14px; }

/* ─────── Inputs ─────── */
.input {
  width: 100%; height: 30px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  padding: 0 10px;
  font-size: var(--t-13);
  color: var(--text);
  outline: none;
  transition: border-color .14s, box-shadow .14s;
}
.input:hover { border-color: var(--border-strong); }
.input:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-50); }
.theme-dark .input:focus { box-shadow: 0 0 0 3px rgba(124,131,240,.18); }
textarea.input { height: auto; padding: 8px 10px; min-height: 72px; resize: vertical; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field__label { font-size: 11.5px; font-weight: 500; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.field__hint { font-size: 11px; color: var(--text-faint); }
.field__error { font-size: 11px; color: var(--danger); display: flex; align-items: center; gap: 4px; }

/* Input with leading/trailing slot */
.input-wrap {
  position: relative; display: flex; align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  transition: border-color .14s, box-shadow .14s;
  min-width: 0;
}
.input-wrap:hover { border-color: var(--border-strong); }
.input-wrap:focus-within { border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-50); }
.theme-dark .input-wrap:focus-within { box-shadow: 0 0 0 3px rgba(124,131,240,.18); }
.input-wrap .input {
  border: 0; background: transparent; height: 28px;
  box-shadow: none !important; padding: 0 8px; flex: 1; min-width: 0;
}
.input-wrap .input:focus { box-shadow: none; }
.input-wrap__lead, .input-wrap__trail {
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-faint); padding: 0 8px; flex: 0 0 auto;
}
.input-wrap__lead { border-right: 1px solid var(--hairline); }
.input-wrap__trail { border-left: 1px solid var(--hairline); }
.input-wrap__prefix {
  padding: 0 8px; color: var(--text-faint); font-family: var(--font-mono); font-size: 12px;
  border-right: 1px solid var(--hairline);
}
.input-wrap__suffix {
  padding: 0 10px; color: var(--text-faint); font-family: var(--font-mono); font-size: 12px;
  border-left: 1px solid var(--hairline);
}
.input-wrap--invalid { border-color: var(--danger); }
.input-wrap--invalid:focus-within { box-shadow: 0 0 0 3px var(--danger-bg); }
.input-wrap--disabled { background: var(--surface-2); color: var(--text-faint); }
.input-wrap--disabled .input { color: var(--text-faint); cursor: not-allowed; }

/* Search bar (large + small variants) */
.search-bar {
  display: inline-flex; align-items: center;
  height: 34px; padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  gap: 8px; min-width: 240px;
  color: var(--text);
  transition: border-color .14s, box-shadow .14s;
}
.search-bar:hover { border-color: var(--border-strong); }
.search-bar:focus-within { border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-50); }
.theme-dark .search-bar:focus-within { box-shadow: 0 0 0 3px rgba(124,131,240,.18); }
.search-bar .ico { color: var(--text-faint); flex: 0 0 auto; }
.search-bar input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font: inherit; color: inherit; height: 100%;
}
.search-bar input::placeholder { color: var(--text-faint); }
.search-bar kbd {
  font-family: var(--font-mono); font-size: 10.5px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  padding: 1px 5px; border-radius: 3px; color: var(--text-faint);
}
.search-bar--filled { background: var(--surface-2); }

/* Dropdown / select trigger */
.select {
  display: inline-flex; align-items: center; gap: 8px;
  height: 30px; padding: 0 8px 0 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  font-size: var(--t-13);
  color: var(--text);
  cursor: default; user-select: none;
  min-width: 0;
}
.select:hover { border-color: var(--border-strong); }
.select[aria-expanded="true"] { border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-50); }
.theme-dark .select[aria-expanded="true"] { box-shadow: 0 0 0 3px rgba(124,131,240,.18); }
.select__lbl { color: var(--text-faint); font-size: 11.5px; margin-right: -2px; }
.select__val { font-weight: 500; }
.select__chev { color: var(--text-faint); margin-left: auto; }

/* Dropdown menu */
.menu {
  position: absolute; top: calc(100% + 6px); left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  box-shadow: var(--el-3);
  min-width: 220px; padding: 4px;
  z-index: 50;
}
.menu__item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: var(--r-2);
  font-size: var(--t-13); cursor: default;
}
.menu__item:hover { background: var(--surface-2); }
.menu__item--active { background: var(--surface-2); }
.menu__item .check { margin-left: auto; color: var(--brand-500); opacity: 0; }
.menu__item--checked .check { opacity: 1; }
.menu__group {
  padding: 6px 10px 4px; color: var(--text-faint);
  font-size: 10.5px; letter-spacing: .06em;
  text-transform: uppercase; font-weight: 600;
}
.menu hr.sep { margin: 4px 0; }

/* Chip filter (selected = filled brand) */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 9px;
  border-radius: var(--r-full);
  font-size: 12px;
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  cursor: default;
  transition: background .14s, color .14s, border-color .14s;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip--on {
  background: var(--brand-500);
  border-color: var(--brand-500);
  color: white;
}
.chip--on:hover { background: var(--brand-600); border-color: var(--brand-600); color: white; }
.chip__count {
  font-family: var(--font-mono); font-size: 10.5px;
  padding: 0 4px; border-radius: 3px;
  background: var(--surface-3); color: var(--text-faint);
}
.chip--on .chip__count { background: rgba(255,255,255,.22); color: white; }

/* Date input + range pill */
.date {
  display: inline-flex; align-items: center; gap: 8px;
  height: 30px; padding: 0 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  font-family: var(--font-mono); font-size: 12px;
  color: var(--text);
  cursor: default;
}
.date:hover { border-color: var(--border-strong); }
.date .ico { color: var(--text-faint); }
.date__range-sep { color: var(--text-ghost); padding: 0 2px; }

/* Calendar popover */
.cal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-4);
  box-shadow: var(--el-3);
  padding: 12px;
  width: 260px;
}
.cal__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.cal__title { font-size: 12.5px; font-weight: 600; }
.cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.cal__dow { color: var(--text-faint); font-size: 10.5px; text-align: center; padding: 4px 0; font-family: var(--font-mono); }
.cal__d {
  height: 30px; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 12px;
  border-radius: var(--r-2);
  color: var(--text);
  cursor: default;
}
.cal__d:hover { background: var(--surface-2); }
.cal__d--out { color: var(--text-ghost); }
.cal__d--today { box-shadow: inset 0 0 0 1px var(--border-strong); }
.cal__d--start, .cal__d--end { background: var(--brand-500); color: white; }
.cal__d--in { background: var(--brand-50); color: var(--brand-700); border-radius: 0; }
.theme-dark .cal__d--in { background: var(--brand-100); color: var(--brand-700); }
.cal__d--start { border-radius: var(--r-2) 0 0 var(--r-2); }
.cal__d--end { border-radius: 0 var(--r-2) var(--r-2) 0; }
.cal__presets {
  display: flex; flex-wrap: wrap; gap: 4px; padding-top: 10px;
  margin-top: 10px; border-top: 1px solid var(--hairline);
}

/* Combobox / autocomplete list */
.combo-list {
  max-height: 260px; overflow: auto;
  border-top: 1px solid var(--hairline);
  margin-top: 6px; padding-top: 6px;
}
.combo-list .menu__item .mono { font-size: 11px; color: var(--text-faint); margin-left: auto; }

/* ─────── Card / surfaces ─────── */
.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-4);
}
.card--inset { background: var(--surface-2); }
.card__head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--hairline);
}
.card__title { font-size: var(--t-13); font-weight: 600; }
.card__sub { color: var(--text-faint); font-size: 12px; }
.card__body { padding: 14px; }
.card__foot {
  padding: 10px 14px;
  border-top: 1px solid var(--hairline);
  color: var(--text-faint); font-size: 12px;
  display: flex; align-items: center; gap: 8px;
}

/* ─────── Dot / pill / chips ─────── */
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-faint);
  display: inline-block;
  flex: 0 0 7px;
  position: relative;
}
.dot--success { background: var(--success); }
.dot--warning { background: var(--warning); }
.dot--danger  { background: var(--danger); }
.dot--info    { background: var(--info); }
.dot--brand   { background: var(--brand-500); }
.dot--pulse::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%;
  border: 1px solid currentColor; opacity: .35;
  animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse { 0%{transform:scale(.8);opacity:.6} 100%{transform:scale(1.8);opacity:0} }

.tag {
  display: inline-flex; align-items: center; gap: 6px;
  height: 20px; padding: 0 7px;
  border-radius: var(--r-1);
  font-size: 11px; font-weight: 500;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--hairline);
}
.tag .dot { width: 6px; height: 6px; flex-basis: 6px; }
.tag.mono { font-family: var(--font-mono); }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 10px;
  border-radius: var(--r-full);
  font-size: 10.5px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  border: 1px solid currentColor;
  background: transparent;
}
.pill--bronze { color: var(--tier-bronze); }
.pill--silver { color: var(--tier-silver); }
.pill--gold   { color: var(--tier-gold); }
.pill--plat   { color: var(--tier-plat); }

/* ─────── Tables ─────── */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--t-13);
}
.table th, .table td {
  text-align: left;
  padding: 0 14px;
  height: var(--row-h);
  vertical-align: middle;
}
.table thead th {
  color: var(--text-faint);
  font-weight: 500;
  font-size: 11.5px;
  letter-spacing: .02em;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface);
  position: sticky; top: 0;
}
.table tbody tr { border-bottom: 1px solid var(--hairline); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.is-selected { background: var(--brand-50); }
.theme-dark .table tbody tr.is-selected { background: rgba(124,131,240,.08); }
.table td.num { font-family: var(--font-mono); text-align: right; font-feature-settings: "tnum"; }
.table th.num { text-align: right; }
.table .cell-id { color: var(--text-faint); font-family: var(--font-mono); }

/* ─────── Stat tile ─────── */
.tile {
  padding: 14px 16px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-4);
  background: var(--surface);
  display: flex; flex-direction: column; gap: 8px;
  min-width: 0;
}
.tile__label {
  font-size: 11px; color: var(--text-faint);
  display: flex; align-items: center; gap: 6px;
  text-transform: uppercase; letter-spacing: .04em;
}
.tile__value {
  font-size: 26px; font-weight: 500;
  letter-spacing: -.02em;
  line-height: 1; font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}
.tile__sub {
  display: flex; align-items: baseline; gap: 8px;
  color: var(--text-faint); font-size: 12px;
}
.delta { font-family: var(--font-mono); font-size: 12px; }
.delta--up { color: var(--success); }
.delta--down { color: var(--danger); }

/* ─────── Module card (Home) ─────── */
.modgrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--hairline);
  border: 1px solid var(--hairline);
  border-radius: var(--r-4);
  overflow: hidden;
}
.modcard {
  background: var(--surface);
  padding: 22px 22px 20px;
  display: flex; flex-direction: column; gap: 14px;
  position: relative; cursor: default;
  min-height: 168px;
  transition: background .14s;
}
.modcard:hover { background: var(--surface-2); }
.modcard__top { display: flex; align-items: center; justify-content: space-between; }
.modcard__ico {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-3);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  color: var(--text-muted);
}
.modcard__name { font-size: var(--t-15); font-weight: 600; letter-spacing: -.01em; }
.modcard__desc { color: var(--text-faint); font-size: 12.5px; max-width: 26ch; }
.modcard__foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; }
.modcard__stat { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }

/* ─────── Misc layout helpers ─────── */
.row { display: flex; align-items: center; gap: 8px; }
.row--sb { justify-content: space-between; }
.col { display: flex; flex-direction: column; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.gap-4 { gap: 16px; } .gap-5 { gap: 20px; } .gap-6 { gap: 24px; }
.grid { display: grid; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.ghost { color: var(--text-ghost); }
.center { display: flex; align-items: center; justify-content: center; }
.sep { height: 1px; background: var(--hairline); margin: 0; border: 0; }
.vsep { width: 1px; align-self: stretch; background: var(--hairline); }

/* ─────── TIKO Logo glyph ─────── */
.tiko-mark {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--brand-500);
  position: relative;
  flex: 0 0 18px;
  box-shadow: 0 0 0 0 currentColor;
}
.tiko-mark::after {
  content: ""; position: absolute; inset: 28%;
  background: var(--surface);
  border-radius: 50%;
}
.tiko-mark--lg { width: 28px; height: 28px; flex-basis: 28px; }
.tiko-mark--xl { width: 72px; height: 72px; flex-basis: 72px; }
.tiko-mark--xl::after { inset: 30%; }

.wordmark {
  font-family: var(--font-sans);
  font-weight: 600; letter-spacing: -.04em;
  font-size: 18px;
  display: inline-flex; align-items: center;
}
.wordmark .o {
  display: inline-flex; align-items: center; justify-content: center;
  width: .85em; height: .85em;
  border-radius: 50%;
  background: var(--brand-500);
  margin: 0 .02em;
  position: relative;
}
.wordmark .o::after {
  content: ""; width: 32%; height: 32%; border-radius: 50%;
  background: var(--surface);
}
.wordmark--lg { font-size: 36px; }
.wordmark--xl { font-size: 72px; }

/* ─────── Live (chat) bubbles ─────── */
.bubble {
  max-width: 86%;
  padding: 8px 11px;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.4;
}
.bubble--user { background: var(--surface-2); }
.bubble--host { background: var(--brand-500); color: white; align-self: flex-end; }
.bubble--ai { background: var(--surface); border: 1px solid var(--hairline); }
.bubble__meta { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; font-size: 11px; color: var(--text-faint); }
.bubble--host .bubble__meta { color: rgba(255,255,255,.7); }

/* ─────── Switch ─────── */
.switch {
  width: 28px; height: 16px; border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  position: relative; cursor: default;
  flex: 0 0 28px;
}
.switch::after {
  content: ""; position: absolute; left: 1px; top: 1px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--el-2);
  transition: left .16s;
}
.switch[aria-checked="true"] { background: var(--brand-500); border-color: var(--brand-500); }
.switch[aria-checked="true"]::after { left: 13px; background: white; }

/* ─────── Modal ─────── */
.scrim {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(10,13,24,.45);
  display: flex; align-items: center; justify-content: center;
  animation: fadein .14s ease-out;
}
@keyframes fadein { from { opacity: 0 } to { opacity: 1 } }
.modal {
  width: 560px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-5);
  box-shadow: var(--el-4);
  overflow: hidden;
}
.modal__head { padding: 18px 20px 8px; }
.modal__title { font-size: var(--t-16); font-weight: 600; }
.modal__body { padding: 8px 20px 18px; }
.modal__foot {
  padding: 12px 20px; border-top: 1px solid var(--hairline);
  display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2);
}

/* ─────── Sparkline / bars ─────── */
.spark { display: block; }
.bar-track {
  height: 4px; background: var(--surface-3);
  border-radius: 2px; overflow: hidden;
}
.bar-fill {
  height: 100%; background: var(--brand-500); border-radius: 2px;
}

/* progress (animated) */
@keyframes shimmer { from { background-position: 0% 50%; } to { background-position: 200% 50%; } }
.shimmer {
  background: linear-gradient(90deg, var(--brand-100), var(--brand-300), var(--brand-100));
  background-size: 200% 100%;
  animation: shimmer 1.8s linear infinite;
}

/* ─────── Brand page tokens ─────── */
.swatch {
  display: flex; flex-direction: column; gap: 6px;
  font-family: var(--font-mono); font-size: 11px;
}
.swatch__chip {
  height: 64px; border-radius: var(--r-3);
  border: 1px solid var(--hairline);
}
.swatch__row { display: flex; justify-content: space-between; color: var(--text-faint); }
.swatch__row .v { color: var(--text); }

/* Stat strip animated values */
.stripnum {
  font-family: var(--font-mono); font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

/* Gantt */
.gantt {
  display: grid; grid-template-columns: 220px 1fr;
  border: 1px solid var(--hairline); border-radius: var(--r-4);
  overflow: hidden; background: var(--surface);
}
.gantt__head { background: var(--surface-2); border-bottom: 1px solid var(--hairline); }
.gantt__lbl { padding: 10px 14px; border-bottom: 1px solid var(--hairline); display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.gantt__row { padding: 10px 0; border-bottom: 1px solid var(--hairline); position: relative; height: 44px; }
.gantt__bar {
  position: absolute; top: 50%; transform: translateY(-50%);
  height: 22px; border-radius: 6px;
  display: flex; align-items: center; padding: 0 8px;
  font-size: 11px; color: white; white-space: nowrap;
  overflow: hidden; cursor: default;
}
.gantt__scale {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--text-faint);
  border-bottom: 1px solid var(--hairline);
}
.gantt__scale > div { padding: 6px 10px; border-left: 1px solid var(--hairline); }
.gantt__grid {
  position: absolute; inset: 0;
  background-image: linear-gradient(to right, var(--hairline) 1px, transparent 1px);
  background-size: calc(100% / 12) 100%;
  pointer-events: none;
}

/* Chart axes */
.axis { font-family: var(--font-mono); font-size: 10.5px; fill: var(--text-faint); }
.gridline { stroke: var(--hairline); stroke-width: 1; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 8px; border: 2px solid var(--bg);
  background-clip: padding-box;
}
