/* ===============================================================
   AutoPace — design system
   Studio-neutral surfaces · single electric-violet accent · flat
   Type: Hanken Grotesk (UI) + JetBrains Mono (technical values)
   =============================================================== */

:root {
  /* ---- Surface (true neutral, no blue tint) ---- */
  --bg:           #0b0b0d;
  --bg-elevated:  #0f0f12;
  --bg-card:      #141417;
  --bg-card-2:    #1a1a1e;
  --bg-input:     #0d0d10;
  --bg-tint:      #131316;

  /* ---- Borders ---- */
  --line:         #242429;
  --line-soft:    #1b1b1f;
  --line-strong:  #33333b;

  /* ---- Text ---- */
  --text:         #e7e7ea;
  --text-strong:  #fbfbfd;
  --text-soft:    #a3a3ad;
  --text-muted:   #71717c;
  --text-faint:   #4e4e58;

  /* ---- Brand: electric violet ---- */
  --accent:        #7c5cff;
  --accent-hover:  #927aff;
  --accent-deep:   #6344e6;
  --accent-ink:    #ffffff;          /* text on a solid accent fill */
  --accent-bg:     rgba(124, 92, 255, 0.13);
  --accent-bg-2:   rgba(124, 92, 255, 0.22);
  --accent-border: rgba(124, 92, 255, 0.42);
  --accent-glow:   rgba(124, 92, 255, 0.10);

  /* ---- Status (quieted so accent stays the hero) ---- */
  --success:       #43c98b;
  --success-bg:    rgba(67, 201, 139, 0.11);
  --success-border:rgba(67, 201, 139, 0.32);

  --warn:          #e0a93b;
  --warn-bg:       rgba(224, 169, 59, 0.11);
  --warn-border:   rgba(224, 169, 59, 0.30);

  --danger:        #ef6f6f;
  --danger-bg:     rgba(239, 111, 111, 0.10);
  --danger-border: rgba(239, 111, 111, 0.32);

  --info:          #5aa2e0;
  --info-bg:       rgba(90, 162, 224, 0.11);
  --info-border:   rgba(90, 162, 224, 0.30);

  /* ---- Radii (tighter, less bubbly) ---- */
  --radius:        6px;
  --radius-sm:     4px;
  --radius-lg:     9px;

  /* ---- Shadows (flat; reserved for overlays only) ---- */
  --shadow-pop:    0 16px 48px -16px rgba(0,0,0,0.7), 0 2px 8px -2px rgba(0,0,0,0.5);

  /* ---- Type ---- */
  --font-ui:   'Hanken Grotesk', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  /* ── Type scale — adjust these to resize all text globally ──────────── */
  /* "tiny" was 11px (+2 requested) · "small" was 12px (+2 requested)      */
  --fs-2xs:   9px;    /* badge/chip micro labels                            */
  --fs-xs:   10.5px;  /* field overlays, sidebar email, ds labels           */
  --fs-tiny: 13px;    /* hint text, crumbs, chips, tiny labels  (was 11px)  */
  --fs-small: 14px;   /* .small utility, inputs, buttons, tables (was 12px) */
  --fs-body:  15px;   /* body baseline, h3, nav items, page sub             */
  --fs-h2:   18px;    /* section / page sub-headings                        */
  --fs-kpi:  24px;    /* KPI display numbers                                */
  --fs-h1:   25px;    /* page titles                                        */
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body {
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

::selection { background: var(--accent-bg-2); color: var(--text-strong); }

#root { position: relative; z-index: 1; }

.mono {
  font-family: var(--font-mono);
  font-feature-settings: 'liga' 0;
  font-size: 0.92em;
  letter-spacing: -0.01em;
}

/* ===============================================================
   App layout
   =============================================================== */
.app {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}

/* ----- Sidebar ----- */
.sidebar {
  background: var(--bg-elevated);
  border-right: 1px solid var(--line);
  padding: 20px 12px 12px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 8px 18px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 14px;
}
.brand-mark {
  width: 26px; height: 26px;
  border-radius: 6px;
  background: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand-mark svg { display: block; }
.sidebar-brand .wordmark {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-strong);
  font-family: var(--font-ui);
}
.sidebar-brand .v {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-faint);
  margin-left: 2px;
}
.sidebar-section { margin-bottom: 4px; }
.sidebar-label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-faint);
  padding: 12px 10px 6px;
  font-weight: 600;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-body);
  font-weight: 500;
  color: var(--text-soft);
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: background 0.12s, color 0.12s;
}
.sidebar-item:hover { background: var(--bg-card); color: var(--text); }
.sidebar-item.active {
  background: var(--bg-card-2);
  color: var(--text-strong);
}
.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: -12px; top: 7px; bottom: 7px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.sidebar-item.active .ico-stroke { stroke: var(--accent); }
.sidebar-item .ico {
  width: 16px; height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-item .ico-stroke { stroke: currentColor; fill: none; stroke-width: 1.6; }
.sidebar-item .ico-fill { fill: currentColor; }

.sidebar-spacer { flex: 1; }
.sidebar-foot {
  border-top: 1px solid var(--line-soft);
  padding: 14px 8px 4px;
  font-size: var(--fs-tiny);
}
.sidebar-foot .me { color: var(--text); font-weight: 600; margin-bottom: 2px; }
.sidebar-foot .email { color: var(--text-muted); font-family: var(--font-mono); font-size: var(--fs-xs); word-break: break-all; }
.sidebar-foot .signout {
  display: inline-flex; margin-top: 10px;
  padding: 6px 10px;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: var(--fs-tiny);
  cursor: pointer;
  font-family: inherit;
  transition: color 0.12s, border-color 0.12s;
}
.sidebar-foot .signout:hover { color: var(--text); border-color: var(--text-muted); }

/* ----- Main area ----- */
.main {
  padding: 28px 36px 64px;
  min-width: 0;
  position: relative;
}
.page-head {
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}
.crumb {
  font-size: var(--fs-tiny);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-family: var(--font-mono);
}
.crumb .sep { color: var(--text-faint); }
.crumb a, .crumb .link {
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
}
.crumb a:hover, .crumb .link:hover { color: var(--text); }
.crumb .now { color: var(--text-soft); }
.h1 {
  font-size: var(--fs-h1);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 0;
  color: var(--text-strong);
}
.h2 {
  font-size: var(--fs-h2);
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--text-strong);
}
.h3 {
  font-size: var(--fs-body);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--text);
}
.sub {
  color: var(--text-muted);
  font-size: var(--fs-body);
  margin-top: 7px;
}

/* ===============================================================
   Primitives
   =============================================================== */

/* Cards / panels */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-body { padding: 18px; }
.card-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Buttons — flat, no gradient, no glow */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-small);
  font-weight: 600;
  font-family: inherit;
  background: var(--bg-card-2);
  color: var(--text);
  border: 1px solid var(--line-strong);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: #232329; border-color: var(--text-faint); }
.btn:active:not(:disabled) { background: var(--bg-card); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent-deep);
}
.btn.primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent);
}
.btn.primary:active:not(:disabled) { background: var(--accent-deep); }

.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover:not(:disabled) { border-color: var(--line-strong); background: var(--bg-card); }

.btn.danger { color: var(--danger); border-color: var(--line); background: transparent; }
.btn.danger:hover:not(:disabled) { background: var(--danger-bg); border-color: var(--danger-border); }

.btn.sm { padding: 6px 10px; font-size: var(--fs-small); }
.btn.xs { padding: 4px 8px; font-size: var(--fs-tiny); }

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

/* Icon button */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-soft);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.icon-btn:hover:not(:disabled) { background: var(--bg-card); color: var(--text); border-color: var(--line-strong); }
.icon-btn.sm { width: 26px; height: 26px; }

/* Chips / pills — neutral by default, accent used sparingly */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 5px;
  font-size: var(--fs-tiny);
  background: var(--bg-card-2);
  border: 1px solid var(--line);
  color: var(--text-soft);
  white-space: nowrap;
  font-weight: 500;
}
.chip .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.chip.accent { background: var(--accent-bg); color: var(--accent-hover); border-color: var(--accent-border); }
.chip.success { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.chip.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-border); }
.chip.danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.chip.info { background: var(--info-bg); color: var(--info); border-color: var(--info-border); }
.chip.solid {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent-deep);
}

.tag-kv {
  font-family: var(--font-mono);
  font-size: var(--fs-tiny);
  color: var(--text-soft);
}

/* Inputs */
input[type="text"], input[type="email"], input[type="search"], input[type="password"], input[type="number"], input[type="tel"], input[type="url"], input:not([type]), select, textarea {
  background: var(--bg-input);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 8px 11px;
  font-family: inherit;
  font-size: var(--fs-small);
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
  width: 100%;
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
/* Keep browser-autofilled fields (e.g. a saved password) on the dark theme so
   they match every other input instead of flashing a white background. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--bg-input) inset;
  box-shadow: 0 0 0 1000px var(--bg-input) inset;
  transition: background-color 9999s ease-in-out 0s;
}
input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--bg-input) inset, 0 0 0 3px var(--accent-bg);
  box-shadow: 0 0 0 1000px var(--bg-input) inset, 0 0 0 3px var(--accent-bg);
}
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%23a3a3ad' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 30px;
  cursor: pointer;
}

label.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
label.field .lbl {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  font-weight: 600;
}

/* Checkboxes (custom) */
.cb {
  width: 16px; height: 16px;
  border: 1.5px solid var(--line-strong);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  background: var(--bg-input);
  transition: border-color 0.12s, background 0.12s;
}
.cb.checked {
  background: var(--accent);
  border-color: var(--accent);
}
.cb.checked::after {
  content: '';
  width: 9px; height: 5px;
  border-left: 2px solid var(--accent-ink);
  border-bottom: 2px solid var(--accent-ink);
  transform: rotate(-45deg) translate(1px, -1px);
}

/* Switch (toggle) */
.switch {
  width: 34px; height: 20px;
  border-radius: 999px;
  background: var(--bg-input);
  border: 1px solid var(--line-strong);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.16s, border-color 0.16s;
}
.switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform 0.16s, background 0.16s;
}
.switch.on { background: var(--accent); border-color: var(--accent-deep); }
.switch.on::after { transform: translateX(14px); background: #fff; }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  padding: 10px 14px;
  text-align: left;
  font-size: var(--fs-small);
}
.table th {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--line);
  background: var(--bg-tint);
}
.table tbody tr { border-bottom: 1px solid var(--line-soft); transition: background 0.1s; }
.table tbody tr:last-child { border-bottom: 0; }
.table tbody tr:hover { background: var(--bg-card-2); }
.table tbody tr.active { background: var(--accent-bg); }
.table tbody tr.clickable { cursor: pointer; }

/* Drop zones */
.drop {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 32px 18px;
  text-align: center;
  color: var(--text-muted);
  font-size: var(--fs-small);
  background: var(--bg-tint);
  transition: border-color 0.12s, background 0.12s, color 0.12s;
  cursor: pointer;
}
.drop:hover, .drop.active {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--text);
}
.drop strong {
  display: block;
  color: var(--text);
  font-weight: 600;
  font-size: var(--fs-body);
  margin-bottom: 4px;
}
.drop .hint {
  font-size: var(--fs-tiny);
  color: var(--text-muted);
  margin-top: 6px;
}
.drop.big { padding: 52px 18px; }
.drop .icon {
  width: 32px; height: 32px;
  display: block;
  margin: 0 auto 10px;
  color: var(--text-muted);
}

/* Progress */
.progress-track {
  width: 100%;
  height: 6px;
  background: var(--bg-input);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--line-soft);
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.35s ease;
}
.progress-fill.success { background: var(--success); }
.progress-fill.indeterminate {
  width: 30% !important;
  animation: indeterm 1.4s ease-in-out infinite;
}
@keyframes indeterm {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

/* KPI tile */
.kpi {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 15px 16px;
  flex: 1;
  min-width: 0;
}
.kpi .k-label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  font-weight: 600;
}
.kpi .k-val {
  font-size: var(--fs-kpi);
  font-weight: 700;
  margin-top: 5px;
  letter-spacing: -0.03em;
  color: var(--text-strong);
  font-family: var(--font-mono);
}
.kpi .k-sub { font-size: var(--fs-tiny); color: var(--text-muted); margin-top: 3px; }
.kpi.accent { border-color: var(--accent-border); }
.kpi.accent .k-val { color: var(--accent-hover); }
.kpi.success .k-val { color: var(--success); }
.kpi.danger .k-val { color: var(--danger); }

/* Waveform mini */
.wave {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 24px;
}
.wave i {
  display: block;
  width: 3px;
  border-radius: 1.5px;
  background: var(--text-faint);
}
.wave.accent i { background: var(--accent); opacity: 0.9; }
.wave.success i { background: var(--success); opacity: 0.9; }

/* Audio mini card */
.audio-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-card-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: var(--fs-small);
  transition: border-color 0.12s, background 0.12s;
}
.audio-mini:hover { border-color: var(--line-strong); }
.audio-mini .play {
  width: 22px; height: 22px;
  background: var(--bg-input);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-2xs);
  color: var(--text-soft);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.audio-mini .play:hover { background: var(--accent-bg); color: var(--accent); border-color: var(--accent-border); }
.audio-mini .name {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.audio-mini.selected {
  background: var(--accent-bg);
  border-color: var(--accent-border);
}

/* Hero — clean elevated panel with a single restrained accent wash */
.hero {
  position: relative;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(124, 92, 255, 0.10), transparent 55%),
    var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-border), transparent);
}

/* Stepper */
.stepper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.stepper .step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-small);
  color: var(--text-muted);
}
.stepper .step .num {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--bg-input);
  color: var(--text-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-tiny);
  font-weight: 600;
}
.stepper .step.active { color: var(--text); font-weight: 600; }
.stepper .step.active .num { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.stepper .step.done { color: var(--text-soft); }
.stepper .step.done .num { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
.stepper .bar { width: 24px; height: 1px; background: var(--line-strong); }

/* Checklist */
.checklist { display: flex; flex-direction: column; gap: 8px; }
.checklist .ck {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-card);
  font-size: var(--fs-body);
  transition: border-color 0.12s, background 0.12s;
}
.checklist .ck .bx {
  width: 18px; height: 18px;
  border: 1.5px solid var(--line-strong);
  border-radius: 4px;
  flex-shrink: 0;
}
.checklist .ck .sub { font-size: var(--fs-tiny); color: var(--text-muted); margin-top: 2px; }
.checklist .ck .arrow { margin-left: auto; color: var(--text-faint); }
.checklist .ck.done { color: var(--text-soft); }
.checklist .ck.done .bx { background: var(--success); border-color: var(--success); position: relative; }
.checklist .ck.done .bx::after {
  content: ''; position: absolute; left: 4px; top: 2px;
  width: 6px; height: 10px;
  border-right: 2px solid #0a0e15; border-bottom: 2px solid #0a0e15;
  transform: rotate(45deg);
}
.checklist .ck.active {
  border-color: var(--accent-border);
  background: var(--accent-bg);
}
.checklist .ck.active .bx { border-color: var(--accent); }

/* Tabs */
.tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  border-bottom: 1px solid var(--line);
}
.tabs .tab {
  padding: 9px 14px;
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.12s, border-color 0.12s;
}
.tabs .tab:hover { color: var(--text); }
.tabs .tab.active { color: var(--text-strong); border-bottom-color: var(--accent); }

/* Keyboard hint */
.kbd {
  font-family: var(--font-mono);
  font-size: var(--fs-tiny);
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-input);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  color: var(--text-soft);
}

/* Utility */
.row { display: flex; gap: 12px; align-items: center; }
.col { display: flex; flex-direction: column; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.grow { flex: 1; min-width: 0; }
.right { margin-left: auto; }
.center { display: flex; align-items: center; justify-content: center; }
.muted { color: var(--text-muted); }
.soft { color: var(--text-soft); }
.small { font-size: var(--fs-small); }
.tiny { font-size: var(--fs-tiny); }
.bold { font-weight: 700; }
.semi { font-weight: 600; }
.divider { height: 1px; background: var(--line-soft); margin: 12px 0; border: 0; }
.divider-strong { height: 1px; background: var(--line); margin: 16px 0; border: 0; }
.gap-2 > * + * { margin-top: 2px; }
.gap-4 > * + * { margin-top: 4px; }
.gap-6 > * + * { margin-top: 6px; }
.gap-8 > * + * { margin-top: 8px; }
.gap-12 > * + * { margin-top: 12px; }
.gap-16 > * + * { margin-top: 16px; }
.gap-24 > * + * { margin-top: 24px; }

/* Empty state */
.empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}
.empty .ico-big {
  width: 40px; height: 40px;
  margin: 0 auto 12px;
  color: var(--text-faint);
}

/* Toasts */
.toasts {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: var(--fs-small);
  color: var(--text);
  box-shadow: var(--shadow-pop);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  animation: toast-in 0.25s ease;
  pointer-events: auto;
}
.toast.success { border-color: var(--success-border); }
.toast.success .ico { color: var(--success); }
.toast.error { border-color: var(--danger-border); }
.toast.error .ico { color: var(--danger); }
@keyframes toast-in {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Slide-over panel */
.slideover-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 50;
  animation: fade 0.2s ease;
}
.slideover {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 420px;
  background: var(--bg-elevated);
  border-left: 1px solid var(--line);
  z-index: 51;
  padding: 22px 22px 14px;
  overflow-y: auto;
  animation: slide 0.22s ease;
  box-shadow: var(--shadow-pop);
}
@keyframes slide {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.slideover-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.slideover-close {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-soft);
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: var(--fs-body);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.slideover-close:hover { background: var(--bg-card); color: var(--text); }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 9, 0.78);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade 0.2s ease;
  padding: 24px;
}
.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  width: min(560px, 100%);
  box-shadow: var(--shadow-pop);
}

/* Segmented toggle */
.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  overflow: hidden;
  padding: 2px;
  gap: 2px;
}
.seg .opt {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  font-size: var(--fs-small);
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 3px;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
}
.seg .opt:hover { color: var(--text); }
.seg .opt.active {
  background: var(--bg-card-2);
  color: var(--text-strong);
}

/* Drag-link canvas */
.link-canvas {
  display: grid;
  grid-template-columns: 1fr 80px 1fr;
  gap: 8px;
  align-items: stretch;
  min-height: 280px;
}
.link-canvas .col-files { display: flex; flex-direction: column; gap: 6px; }
.link-canvas svg { width: 100%; height: 100%; }

/* Section header with action */
.section-h {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}
.section-h h3 { flex: 1; }

/* Status dot animation */
.status-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  position: relative;
}
.status-dot.pulse::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.4;
  animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse {
  0% { transform: scale(0.6); opacity: 0.6; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* Style shelf card */
.shelf-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.shelf-card:hover {
  border-color: var(--line-strong);
  background: var(--bg-card-2);
}
.shelf-card.default { border-color: var(--accent-border); }
.shelf-card.default:hover { border-color: var(--accent); }

/* Tip box */
.tip {
  background: var(--bg-tint);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: var(--fs-small);
  color: var(--text-soft);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.tip .tip-ico { color: var(--accent); font-size: inherit; line-height: inherit; }
.tip strong { color: var(--text); font-weight: 600; }

/* Warning banner */
.banner {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: var(--fs-small);
}
.banner.danger { background: var(--danger-bg); border-color: var(--danger-border); }
.banner.info { background: var(--info-bg); border-color: var(--info-border); }

/* Onboarding empty cells */
.empty-cell {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 22px 16px;
  text-align: center;
  background: var(--bg-tint);
}
.empty-cell .label { color: var(--text-soft); font-weight: 600; }
.empty-cell .hint { color: var(--text-muted); font-size: var(--fs-tiny); margin-top: 4px; }

/* Fade transition for routes */
.route-fade { animation: route-in 0.22s ease forwards; }
@keyframes route-in {
  from { transform: translateY(4px); }
  to { transform: translateY(0); }
}

/* Scrollbar styling (subtle) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* ===============================================================
   Design-system reference page (Components screen)
   =============================================================== */
.ds-section { margin-bottom: 32px; }
.ds-section > .ds-h {
  font-size: var(--fs-tiny);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
}
.ds-swatch {
  height: 64px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.ds-swatch-label { font-size: var(--fs-tiny); margin-top: 6px; color: var(--text-soft); }
.ds-swatch-hex { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-muted); }
.ds-specimen {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  padding: 22px;
}
.ds-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}