/* ==========================================================================
   Growth Engine Design System v2 : GitHub (Primer) look
   Dense, bordered, information-first. White canvas, #d0d7de borders,
   6px radii, system font stack, blue links, green primary actions,
   orange active-tab underline. Reference: Beck's GitHub screenshots,
   21 Jul 2026 (tank/decisions.md).
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans",
    Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Primer-ish palette */
  --canvas: #ffffff;
  --canvas-subtle: #f6f8fa;
  --canvas-inset: #eff2f5;
  --border: #d0d7de;
  --border-muted: #d8dee4;
  --fg: #1f2328;
  --fg-muted: #59636e;
  --fg-subtle: #818b98;
  --accent: #0969da;
  --accent-muted: #ddf4ff;
  --success: #1a7f37;
  /* Primary actions: deep elegant blue (was Primer green) */
  --success-emphasis: #1e3a8a;
  --success-muted: #dafbe1;
  --primary: #1e3a8a;
  --primary-hover: #172f70;
  --primary-muted: #e4e9f7;
  --danger: #d1242f;
  --danger-muted: #ffebe9;
  --attention: #9a6700;
  --attention-muted: #fff8c5;
  --done: #8250df;
  --done-muted: #fbefff;
  --tab-active: #1e3a8a;

  /* Legacy aliases kept so existing views/styles keep working */
  --ink-900: #1f2328;
  --ink-800: #24292f;
  --ink-700: #424a53;
  --ink-500: #59636e;
  --ink-400: #818b98;
  --ink-300: #d0d7de;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --surface-dim: #f6f8fa;
  --line: #d8dee4;
  --line-dark: #d0d7de;
  --coral-500: #fd8c73;
  --coral-600: #cf222e;
  --pink-500: #bf3989;
  --magenta-500: #bf3989;
  --peach-200: #ffebe9;
  --peach-100: #fff1e5;
  --gold-400: #d4a72c;
  --grad-hero: linear-gradient(118deg, #f98e60 0%, #f4506e 52%, #ec3fa6 100%);
  --grad-bar: linear-gradient(180deg, #54aeff 0%, #0969da 100%);
  --grad-progress: #0969da;
  --up: #1a7f37;
  --up-bg: #dafbe1;
  --down: #d1242f;
  --down-bg: #ffebe9;
  --warn: #9a6700;
  --warn-bg: #fff8c5;
  --info: #0969da;
  --info-bg: #ddf4ff;

  /* Chart series (validated categorical palette; fixed order) */
  --chart-1: #e5563b;
  --chart-2: #3e5ebe;
  --chart-3: #a8790d;
  --chart-4: #de3d82;
  --chart-track: #d0d7de;

  --r: 6px;
  --r-lg: 6px;
  --r-md: 6px;
  --r-sm: 6px;
  --r-xl: 6px;
  --r-pill: 999px;
  --shadow-card: 0 1px 0 rgba(31, 35, 40, 0.04);
  --shadow-pop: 0 8px 24px rgba(140, 149, 159, 0.2);
  --ring: 0 0 0 3px rgba(30, 58, 138, 0.25);
}

::selection { background: rgba(30, 58, 138, 0.15); }

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p { margin: 0; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  box-shadow: none;
}

.icon { flex: none; display: block; }

/* --------------------------------------------------------------------------
   3. Typography helpers
   -------------------------------------------------------------------------- */
.display { font-size: 32px; font-weight: 600; }
.h1 { font-size: 26px; font-weight: 600; }
.h2 { font-size: 20px; font-weight: 600; }
.h3 { font-size: 16px; font-weight: 600; }
.h4 { font-size: 14px; font-weight: 600; }
.body-lg { font-size: 14px; }
.body-sm { font-size: 12px; }
.caption { font-size: 12px; color: var(--fg-muted); }
.muted { color: var(--fg-subtle); }
.subtle { color: var(--fg-muted); }
.num { font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   4. App shell: header, tabs, subnav
   -------------------------------------------------------------------------- */
.gh-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--canvas-subtle);
  border-bottom: 1px solid var(--border-muted);
  /* Subtle brand accent along the very top of the app */
  border-top: 3px solid var(--primary);
}

.gh-burger {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--fg-muted);
  background: transparent;
}

.gh-burger:hover { background: var(--canvas-inset); }

.gh-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gh-brand img { width: 32px; height: 32px; }

.gh-crumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--fg);
}

.gh-crumb a { color: var(--fg); }
.gh-crumb__sep { color: var(--fg-subtle); }
.gh-crumb strong { font-weight: 600; color: var(--primary); }

.gh-header__right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.gh-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 300px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--canvas);
  color: var(--fg-subtle);
  font-size: 13px;
}

.gh-search:focus-within { border-color: var(--accent); box-shadow: var(--ring); }

.gh-search input {
  border: 0;
  background: none;
  font: inherit;
  color: var(--fg);
  width: 100%;
}

.gh-search input:focus { outline: none; }
.gh-search kbd {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 5px;
  font-size: 11px;
  color: var(--fg-subtle);
  font-family: var(--font-sans);
}

.gh-iconbtn {
  position: relative;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--fg-muted);
  background: transparent;
}

.gh-iconbtn:hover { background: var(--canvas-inset); text-decoration: none; }

.gh-iconbtn__dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--canvas-subtle);
}

.gh-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
}

/* Tab nav */
.gh-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 16px;
  background: var(--canvas-subtle);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

.gh-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px 11px;
  font-size: 14px;
  color: var(--fg);
  white-space: nowrap;
  border-radius: var(--r) var(--r) 0 0;
}

.gh-tab:hover { text-decoration: none; }
.gh-tab:hover::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--border);
}

.gh-tab .icon { color: var(--fg-muted); }

.gh-tab--disabled {
  color: var(--fg-subtle);
  opacity: 0.55;
  cursor: default;
}

.gh-tab--disabled:hover::after { display: none; }

.gh-tab.is-active { font-weight: 600; }
.gh-tab.is-active::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--tab-active);
}

.counter {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: rgba(175, 184, 193, 0.2);
  font-size: 12px;
  font-weight: 500;
  color: var(--fg);
}

/* Content area */
.gh-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 24px 64px;
}

.gh-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

/* Section subnav (GitHub issues-page style) */
.gh-subnav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gh-subnav__title {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
  padding: 6px 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.gh-subnav__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--r);
  font-size: 14px;
  color: var(--fg);
  position: relative;
}

.gh-subnav__item:hover { background: var(--canvas-inset); text-decoration: none; }

.gh-subnav__item.is-active {
  background: var(--canvas-inset);
  font-weight: 600;
}

.gh-subnav__item.is-active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 6px;
  bottom: 6px;
  width: 4px;
  border-radius: 4px;
  background: var(--primary);
}

.gh-subnav__item .counter { margin-left: auto; }
.gh-subnav__item .icon { color: var(--fg-muted); }

/* Page heading row */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.topbar__title {
  font-size: 20px;
  font-weight: 600;
  margin-right: auto;
}

.topbar__actions { display: flex; align-items: center; gap: 8px; }

/* --------------------------------------------------------------------------
   5. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 16px;
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  white-space: nowrap;
  border: 1px solid var(--border);
  background: var(--canvas-subtle);
  color: var(--fg);
  transition: background 0.12s ease;
}

.btn:hover { background: var(--canvas-inset); text-decoration: none; }

.btn--dark {
  background: var(--canvas-subtle);
  color: var(--fg);
}

.btn--accent {
  background: var(--success-emphasis);
  border-color: rgba(31, 35, 40, 0.15);
  color: #fff;
}

.btn--accent:hover { background: var(--primary-hover); }

.btn--ghost { background: transparent; }
.btn--ghost:hover { background: var(--canvas-subtle); }

.btn--soft {
  background: var(--canvas-subtle);
  color: var(--accent);
}

.btn--sm { padding: 3px 12px; font-size: 12px; line-height: 20px; }
.btn--lg { padding: 8px 20px; font-size: 14px; }

.btn[disabled], .btn.is-disabled { opacity: 0.5; pointer-events: none; }

.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r);
  color: var(--fg-muted);
}

.icon-btn:hover { background: var(--canvas-inset); color: var(--fg); }

.icon-btn--solid { border: 1px solid var(--border); background: var(--canvas-subtle); }

.icon-btn__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  display: grid;
  place-items: center;
}

/* --------------------------------------------------------------------------
   6. Boxes (cards)
   -------------------------------------------------------------------------- */
.card {
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
}

.card--flush { padding: 0; }

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.card__title { font-size: 14px; font-weight: 600; }

/* Hero stat box (formerly the gradient card) */
.card--hero {
  background: var(--canvas);
  color: var(--fg);
}

.hero-number { font-size: 32px; font-weight: 600; line-height: 1.2; }

.hero-breakdown { display: flex; margin-top: 12px; }

.hero-breakdown__item {
  flex: 1;
  padding: 0 12px;
  border-left: 1px solid var(--border-muted);
}

.hero-breakdown__item:first-child { padding-left: 0; border-left: 0; }
.hero-breakdown__label { font-size: 12px; color: var(--fg-muted); }
.hero-breakdown__value { font-size: 16px; font-weight: 600; }

/* Small stat tile */
.stat-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 16px;
}

.stat-tile__figure {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: var(--r);
  background: var(--primary-muted);
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.stat-tile__figure .icon { color: var(--primary); }
.stat-tile__number { font-size: 15px; font-weight: 600; }
.stat-tile__body { flex: 1; min-width: 0; }
.stat-tile__label { font-size: 13px; font-weight: 600; margin-bottom: 8px; }

.icon-tile {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: var(--r);
  display: grid;
  place-items: center;
  background: var(--canvas-subtle);
  border: 1px solid var(--border-muted);
  color: var(--fg-muted);
}

.icon-tile--peach { background: var(--danger-muted); color: var(--danger); border-color: transparent; }
.icon-tile--cream { background: var(--canvas-subtle); color: var(--fg-muted); }
.icon-tile--dark  { background: var(--ink-800); color: #fff; border-color: transparent; }

/* --------------------------------------------------------------------------
   7. Labels (badges & pills)
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0 7px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge--up      { background: var(--success-muted); color: var(--success); }
.badge--down    { background: var(--danger-muted); color: var(--danger); }
.badge--warn    { background: var(--attention-muted); color: var(--attention); }
.badge--info    { background: var(--accent-muted); color: var(--accent); }
.badge--neutral { background: rgba(175, 184, 193, 0.2); color: var(--fg-muted); }
.badge--dark    { background: var(--ink-800); color: #fff; }

.pill-label {
  display: inline-flex;
  align-items: center;
  padding: 1px 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--canvas);
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
}

/* --------------------------------------------------------------------------
   8. Tabs (in-page)
   -------------------------------------------------------------------------- */
.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.tab {
  position: relative;
  padding: 8px 12px 10px;
  font-size: 14px;
  color: var(--fg-muted);
}

.tab:hover { color: var(--fg); text-decoration: none; }
.tab.is-active { color: var(--fg); font-weight: 600; }

.tab.is-active::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--tab-active);
}

/* --------------------------------------------------------------------------
   9. Forms
   -------------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 14px; font-weight: 600; }
.field__hint { font-size: 12px; color: var(--fg-muted); }
.field__error { font-size: 12px; font-weight: 500; color: var(--danger); }

.input, .select, .textarea {
  width: 100%;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--canvas);
  font: inherit;
  line-height: 20px;
  color: var(--fg);
}

.input::placeholder, .textarea::placeholder { color: var(--fg-subtle); }

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}

.input.is-invalid { border-color: var(--danger); }

.textarea { min-height: 90px; resize: vertical; }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2359636e' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 30px;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--canvas);
  color: var(--fg-subtle);
  min-width: 220px;
}

.search:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.search input { border: 0; background: none; font: inherit; color: var(--fg); width: 100%; }
.search input:focus { outline: none; }

.checkbox, .radio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}

.checkbox input, .radio input { width: 16px; height: 16px; accent-color: var(--accent); }

.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; position: relative; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }

.toggle__track {
  width: 36px;
  height: 20px;
  border-radius: var(--r-pill);
  background: var(--border);
  position: relative;
  transition: background 0.15s ease;
}

.toggle__track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(31, 35, 40, 0.25);
  transition: transform 0.15s ease;
}

.toggle input:checked + .toggle__track { background: var(--success-emphasis); }
.toggle input:checked + .toggle__track::after { transform: translateX(16px); }
.toggle input:focus-visible + .toggle__track { box-shadow: var(--ring); }

/* --------------------------------------------------------------------------
   10. List rows (joined bordered list, GitHub file-list style)
   -------------------------------------------------------------------------- */
.row-list {
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--canvas);
}

.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-muted);
}

.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--canvas-subtle); }

.list-row__main { flex: 1; min-width: 0; }

.list-row__title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}

.list-row__title .icon { color: var(--fg-subtle); }
.list-row__sub { font-size: 12px; color: var(--fg-muted); margin-top: 1px; }
.list-row__meta { flex: none; width: 100px; font-size: 12px; color: var(--fg-muted); }
.list-row__stat { flex: none; width: 48px; text-align: right; font-size: 13px; font-weight: 600; }

/* --------------------------------------------------------------------------
   11. Avatars
   -------------------------------------------------------------------------- */
.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ink-800);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  overflow: hidden;
}

.avatar img, .gh-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.avatar--sm { width: 22px; height: 22px; font-size: 9px; }
.avatar--lg { width: 40px; height: 40px; font-size: 14px; }
.avatar--frame { width: 48px; height: 48px; border-radius: var(--r); font-size: 16px; }
.avatar--peach { background: var(--danger-muted); color: var(--danger); }

.avatar-badge { position: relative; display: inline-block; }

.avatar-badge__count {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  display: grid;
  place-items: center;
  border: 2px solid var(--canvas);
}

/* --------------------------------------------------------------------------
   12. Progress
   -------------------------------------------------------------------------- */
.progress {
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--canvas-inset);
  overflow: hidden;
  border: 0;
}

.progress__fill { height: 100%; border-radius: var(--r-pill); background: var(--accent); }
.progress__fill--dark { background: var(--success-emphasis); }
.progress__fill--gold { background: var(--gold-400); }

/* --------------------------------------------------------------------------
   13. Charts
   -------------------------------------------------------------------------- */
.bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 140px;
  padding: 6px 4px 0;
}

.bars__col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
  justify-content: flex-end;
}

.bar {
  position: relative;
  width: 12px;
  border-radius: 4px 4px 0 0;
  background: var(--chart-track);
}

.bar--accent { background: var(--grad-bar); }

.bar--accent .bar__cap {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--canvas);
  display: grid;
  place-items: center;
  color: #fff;
}

.bar:hover { filter: brightness(0.92); }
.bars__label { font-size: 11px; font-weight: 500; color: var(--fg-muted); }

[data-tip] { position: relative; }

[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink-800);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--r);
  white-space: nowrap;
  box-shadow: var(--shadow-pop);
  z-index: 20;
  pointer-events: none;
}

.donut-wrap { display: flex; align-items: center; gap: 20px; }
.donut { flex: none; }
.donut circle { fill: none; stroke-width: 12; stroke-linecap: butt; }
.donut__track { stroke: var(--canvas-inset); }

.legend { display: flex; flex-direction: column; gap: 8px; }
.legend__item { display: flex; flex-direction: column; gap: 0; }

.legend__key {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--fg-muted);
}

.legend__dot { width: 8px; height: 8px; border-radius: 50%; }
.legend__value { font-size: 16px; font-weight: 600; padding-left: 14px; }

.sparkline { width: 100%; height: 48px; margin-top: 8px; }

.swatch-row { display: flex; gap: 10px; flex-wrap: wrap; }

.swatch {
  width: 104px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--canvas);
}

.swatch__color { height: 48px; }
.swatch__label { padding: 6px 8px; font-size: 11px; font-weight: 500; color: var(--fg-muted); }

/* --------------------------------------------------------------------------
   14. Tables
   -------------------------------------------------------------------------- */
.table-card {
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}

.table { width: 100%; border-collapse: collapse; }

.table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
  padding: 6px 12px;
  background: var(--canvas-subtle);
  border-bottom: 1px solid var(--border);
  text-transform: none;
  letter-spacing: 0;
}

.table td {
  padding: 5px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-muted);
  line-height: 1.4;
}

/* button_to renders a form; keep them inline so action cells stay one line */
.table form,
.list-row form,
.row-actions form {
  display: inline-flex;
  vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--canvas-subtle); }
.table .num { text-align: right; }

/* --------------------------------------------------------------------------
   15. Alerts (GitHub flash banners)
   -------------------------------------------------------------------------- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--r);
  border: 1px solid;
  font-size: 14px;
}

.alert .icon { margin-top: 3px; }
.alert__title { font-weight: 600; }
.alert__link { font-weight: 600; text-decoration: underline; color: inherit; }

.alert--info    { background: var(--accent-muted); border-color: rgba(9, 105, 218, 0.3); color: var(--fg); }
.alert--info .icon { color: var(--accent); }
.alert--success { background: var(--success-muted); border-color: rgba(26, 127, 55, 0.3); color: var(--fg); }
.alert--success .icon { color: var(--success); }
.alert--warning { background: var(--attention-muted); border-color: rgba(154, 103, 0, 0.3); color: var(--fg); }
.alert--warning .icon { color: var(--attention); }
.alert--danger  { background: var(--danger-muted); border-color: rgba(209, 36, 47, 0.3); color: var(--fg); }
.alert--danger .icon { color: var(--danger); }

.flash { margin-bottom: 16px; }

/* --------------------------------------------------------------------------
   16. Pagination
   -------------------------------------------------------------------------- */
.pagination { display: flex; align-items: center; gap: 4px; }

.page-btn {
  display: grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  border-radius: var(--r);
  font-size: 13px;
  color: var(--fg);
}

.page-btn:hover { border: 1px solid var(--border); text-decoration: none; }
.page-btn.is-active { background: var(--primary); color: #fff; }

/* --------------------------------------------------------------------------
   17. Empty state
   -------------------------------------------------------------------------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  padding: 40px 24px;
}

.empty__art {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary-muted);
  border: 1px solid transparent;
  color: var(--primary);
  display: grid;
  place-items: center;
}

.empty__title { font-size: 16px; font-weight: 600; }
.empty__text { max-width: 340px; color: var(--fg-muted); font-size: 13px; }

/* --------------------------------------------------------------------------
   18. Dashboard layout
   -------------------------------------------------------------------------- */
.dash {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

.dash__main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.dash__row {
  display: grid;
  grid-template-columns: minmax(0, 11fr) minmax(0, 9fr);
  gap: 16px;
  align-items: stretch;
}

.dash__side { display: flex; flex-direction: column; gap: 16px; }

.stats-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-muted);
}

.stats-footer__label { font-weight: 600; font-size: 13px; }
.stats-footer__value { margin-left: auto; font-size: 20px; font-weight: 600; }

@media (max-width: 1100px) {
  .dash { grid-template-columns: 1fr; }
  .dash__row { grid-template-columns: 1fr; }
  .gh-layout { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   19. SEO Tech module
   -------------------------------------------------------------------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.kpi {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 8px 12px;
}

.kpi:hover { background: var(--canvas-subtle); text-decoration: none; }
.kpi.is-active { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }

.kpi__num { font-size: 20px; font-weight: 600; line-height: 1.2; color: var(--fg); }
.kpi__label { font-size: 12px; color: var(--fg-muted); }
.kpi .icon-tile { width: 28px; height: 28px; }

.text-down { color: var(--danger); }
.text-warn { color: var(--attention); }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.toolbar__filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar__search { min-width: 240px; }
.toolbar__select { width: auto; }
.toolbar__actions { display: flex; align-items: center; gap: 8px; }

.inline-form { display: inline-flex; }
.inline-form button { display: inline-flex; }

.import-card { margin-bottom: 12px; }
.import-card > summary { list-style: none; display: inline-flex; cursor: pointer; }
.import-card > summary::-webkit-details-marker { display: none; }
.import-card__body { margin-top: 8px; }

.import-card__cols {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.import-card__cols > div:first-child { max-width: 560px; }
.import-card__template { font-weight: 600; }
.import-card__form { display: flex; align-items: center; gap: 8px; }

.file-field { font-size: 13px; color: var(--fg-muted); }

.file-field::file-selector-button {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
  background: var(--canvas-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 4px 12px;
  margin-right: 10px;
  cursor: pointer;
}

.table--pages td { vertical-align: middle; }
.url-td { max-width: 320px; white-space: nowrap; }

.url-cell {
  display: inline-block;
  max-width: 270px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  font-weight: 600;
  color: var(--accent);
}

.url-ext { color: var(--fg-subtle); vertical-align: middle; margin-left: 2px; }
.url-ext:hover { color: var(--accent); }
.url-ext .icon { display: inline-block; }

.row-actions { white-space: nowrap; text-align: right; }
.icon-btn--table { width: 26px; height: 26px; color: var(--fg-subtle); }

.radar-btn.is-on { color: var(--accent); }
.radar-btn.is-risk { color: var(--danger); }

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.page-detail { display: flex; flex-direction: column; gap: 16px; }
.page-detail__crumb { margin-bottom: -4px; }

.crumb-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-muted);
}

.crumb-link:hover { color: var(--accent); text-decoration: none; }

.page-detail__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-detail__url { word-break: break-all; font-size: 20px; font-weight: 600; }
.page-detail__full { display: inline-flex; align-items: center; gap: 4px; margin-top: 2px; color: var(--fg-muted); }
.page-detail__full:hover { color: var(--accent); }
.page-detail__actions { display: flex; gap: 8px; flex: none; }

.page-detail__tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.verdict__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
  margin-bottom: 8px;
}

@media (max-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .page-detail__tiles { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   20. Optimisation board (GitHub Projects style)
   -------------------------------------------------------------------------- */
.ob-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.ob-toolbar__left, .ob-toolbar__right { display: flex; align-items: center; gap: 12px; }

.ob-legend { display: flex; align-items: center; gap: 12px; }

.ob-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-muted);
}

.ob-legend__dot { width: 9px; height: 9px; border-radius: 3px; }

.ob-track-content { background: var(--chart-1); }
.ob-track-design  { background: var(--chart-3); }
.ob-track-dev     { background: var(--chart-2); }

.ob-view-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}

.ob-view-btn {
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-muted);
  background: var(--canvas);
}

.ob-view-btn + .ob-view-btn { border-left: 1px solid var(--border); }
.ob-view-btn.is-active { background: var(--canvas-inset); color: var(--fg); font-weight: 600; }

.ob-board {
  display: flex;
  align-items: stretch;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
}

.ob-col {
  flex: 0 0 260px;
  display: flex;
  flex-direction: column;
  /* Fixed column height; overflowing cards scroll inside the column */
  height: calc(100vh - 250px);
  min-height: 340px;
  background: var(--canvas-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 8px;
}

.ob-col-over { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

.ob-col-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 4px 8px;
}

.ob-col-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.ob-col-dot--todo   { background: var(--fg-subtle); }
.ob-col-dot--active { background: var(--success-emphasis); }
.ob-col-dot--done   { background: var(--done); }

.ob-col-title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ob-col-count { margin-left: auto; }

.ob-col-count,
.ob-col .counter {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: rgba(175, 184, 193, 0.2);
  font-size: 12px;
  font-weight: 500;
  color: var(--fg);
  display: grid;
  place-items: center;
}

.ob-col-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.ob-col-add {
  flex: none;
  display: block;
  margin-top: 8px;
  padding: 5px;
  border-radius: var(--r);
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-muted);
}

.ob-col-add:hover { background: var(--canvas-inset); color: var(--fg); text-decoration: none; }

.ob-card {
  position: relative;
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 8px 10px 8px 14px;
  cursor: grab;
}

.ob-card:hover { border-color: var(--fg-subtle); }
.ob-card-dragging { opacity: 0.5; cursor: grabbing; }

.ob-card-bar {
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 3px;
}

.ob-card-title { font-size: 13px; font-weight: 600; line-height: 1.4; margin-bottom: 6px; }

.ob-card-tags {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.ob-card-page { font-size: 11px; padding: 0 8px; }

.ob-card-review {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-muted);
  border-radius: var(--r);
  padding: 3px 6px;
  margin-bottom: 6px;
}

.ob-card-meta { display: flex; align-items: center; gap: 8px; min-height: 18px; }

.ob-card-due, .ob-card-comments {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-muted);
}

.ob-card-due.is-overdue { color: var(--danger); }
.ob-card-avatar { margin-left: auto; width: 20px; height: 20px; font-size: 8px; }

.ob-dialog {
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-pop);
  padding: 20px;
  width: min(420px, 90vw);
}

.ob-dialog::backdrop { background: rgba(31, 35, 40, 0.5); }
.ob-dialog-form { display: flex; flex-direction: column; gap: 12px; }

.ob-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.ob-comments { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.ob-comment { display: flex; align-items: flex-start; gap: 8px; }
.ob-comment__body { flex: 1; }
.ob-comment__head { display: flex; align-items: baseline; gap: 6px; }
.ob-comment-form { display: flex; align-items: center; gap: 8px; }

/* --------------------------------------------------------------------------
   20b. New Content section
   -------------------------------------------------------------------------- */
.nc-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 20px;
  align-items: start;
}

@media (max-width: 1100px) {
  .nc-grid { grid-template-columns: 1fr; }
}

.nc-cited-on { color: var(--attention); }

.rab-set-active { color: var(--accent); background: var(--accent-muted); }

.edit-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

@media (max-width: 1100px) {
  .edit-grid { grid-template-columns: 1fr; }
}

.ob-comment-form--stack {
  flex-direction: column;
  align-items: stretch;
}

.ob-view-switch form + form .ob-view-btn { border-left: 1px solid var(--border); }

.nc-insights {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

@media (max-width: 1280px) {
  .nc-insights { grid-template-columns: 1fr; }
}

.nc-funnel { padding: 12px 14px; }

.nc-funnel__head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nc-funnel__health { margin-left: auto; font-size: 13px; font-weight: 600; }

.nc-funnel__meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
}

.nc-funnel__meta span { display: inline-flex; align-items: center; gap: 3px; }

.nc-board-counts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nc-board-count {
  flex: 1;
  min-width: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px;
  border: 1px solid var(--border-muted);
  border-radius: var(--r);
  background: var(--canvas-subtle);
}

/* New Content board: 5 columns fill the row */
.nc-col { flex: 1 1 0; min-width: 196px; }

.nc-bar-tofu { background: var(--chart-2); }
.nc-bar-mofu { background: var(--chart-3); }
.nc-bar-bofu { background: var(--ink-800); }

/* --------------------------------------------------------------------------
   20d. Thought Leadership
   -------------------------------------------------------------------------- */
.stepper {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  padding: 12px 16px;
}

.stepper__step {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 4px;
  border-radius: var(--r-pill);
  white-space: nowrap;
  color: var(--fg-subtle);
}

.stepper__step + .stepper__step { margin-left: 8px; position: relative; }

.stepper__step + .stepper__step::before {
  content: "";
  position: absolute;
  left: -10px;
  width: 12px;
  height: 1px;
  background: var(--border);
}

.stepper__dot {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  background: var(--canvas);
}

.stepper__label { font-size: 12.5px; font-weight: 500; }

.stepper__step--done { color: var(--success); }
.stepper__step--done .stepper__dot { background: var(--success-muted); border-color: transparent; color: var(--success); }

.stepper__step--current { color: var(--fg); }
.stepper__step--current .stepper__dot { background: var(--primary); border-color: transparent; color: #fff; }
.stepper__step--current .stepper__label { font-weight: 600; }

/* Distribution checklist rows */
.dist-group {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 12px 0 4px;
}

.dist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}

.dist-item__check {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.dist-item__check input { width: 15px; height: 15px; accent-color: var(--success-emphasis); flex: none; }

.dist-item__name { font-size: 13px; }
.dist-item__name.is-done { color: var(--fg-muted); text-decoration: line-through; }

.dist-item__url {
  width: 220px;
  flex: none;
  padding: 2px 8px;
  font-size: 12px;
}

/* --------------------------------------------------------------------------
   20c. Auth
   -------------------------------------------------------------------------- */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  background: var(--canvas-subtle);
}

.auth-card {
  width: min(380px, 100%);
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 32px 28px;
  text-align: center;
}

.auth-logo {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
}

.auth-title { font-size: 20px; font-weight: 600; }

.auth-subtitle {
  font-size: 13px;
  color: var(--fg-muted);
  margin: 4px 0 20px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}

.auth-foot { margin-top: 16px; }

.impersonate-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 6px 16px;
  background: var(--attention-muted);
  border-bottom: 1px solid rgba(154, 103, 0, 0.3);
  font-size: 13px;
  color: var(--fg);
}

.impersonate-bar__exit button,
.impersonate-bar__exit {
  font-size: 12px;
  font-weight: 600;
  color: var(--attention);
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   21. Styleguide
   -------------------------------------------------------------------------- */
.sg { display: flex; flex-direction: column; gap: 20px; max-width: 1080px; }

.sg-section__label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
  margin-bottom: 8px;
}

.sg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.sg-cluster { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* --------------------------------------------------------------------------
   22. Utilities
   -------------------------------------------------------------------------- */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }
.text-right { text-align: right; }
