/* ===========================================================================
 * Design tokens
 * ---------------------------------------------------------------------------
 * Palette is HSL so we can compose alpha variants with hsl(... / .12).
 * Spacing is a 4px grid (1=4px, 2=8px, …). Radii / type scale follow
 * the same shadcn-inspired conventions used by the rest of the homelab.
 * ========================================================================= */

:root {
  --bg:            220 33% 6%;
  --bg-elevated:   220 24% 10%;
  --bg-subtle:     220 20% 13%;
  --border:        220 18% 18%;
  --border-strong: 220 18% 24%;
  --text:          210 40% 98%;
  --text-muted:    220 12% 65%;
  --text-subtle:   220 10% 50%;

  --accent:        221 83% 62%;
  --accent-hover:  221 83% 70%;
  --accent-soft:   221 83% 62%;

  --success:       142 60% 50%;
  --warning:       38  92% 56%;
  --danger:         0 70% 60%;

  --radius-sm: 6px;
  --radius:    8px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 2px hsl(220 40% 0% / 0.3);
  --shadow:    0 6px 24px -6px hsl(220 40% 0% / 0.5);
  --shadow-lg: 0 16px 48px -12px hsl(220 50% 0% / 0.6);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  --sidebar-w: 240px;
  --content-max: 1200px;
  --content-prose: 820px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
               "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo,
               Monaco, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: hsl(var(--bg));
  color: hsl(var(--text));
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
}

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

/* ===========================================================================
 * Layout: sidebar + main
 * ========================================================================= */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: hsl(var(--bg-elevated));
  border-right: 1px solid hsl(var(--border));
  padding: var(--space-6) var(--space-4);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-2);
}
.sidebar-brand .brand-mark {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, hsl(var(--accent)), hsl(263 78% 60%));
  display: grid;
  place-items: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
}
.sidebar-brand .brand-text {
  font-weight: 600;
  letter-spacing: -0.01em;
  color: hsl(var(--text));
}
.sidebar-brand .brand-sub {
  font-size: 11px;
  color: hsl(var(--text-subtle));
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-nav .nav-section {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: hsl(var(--text-subtle));
  padding: var(--space-3) var(--space-3) var(--space-1);
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  color: hsl(var(--text-muted));
  font-size: 13px;
  font-weight: 500;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.sidebar-nav a:hover {
  background: hsl(var(--bg-subtle));
  color: hsl(var(--text));
}
.sidebar-nav a.active {
  background: hsl(var(--accent) / 0.12);
  color: hsl(var(--accent-hover));
}
.sidebar-nav a svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.sidebar-foot {
  margin-top: auto;
  padding: var(--space-3);
  font-size: 11px;
  color: hsl(var(--text-subtle));
}

.main {
  min-width: 0;
  padding: var(--space-8) var(--space-8) var(--space-12);
}
.main > .container {
  max-width: var(--content-max);
  margin: 0 auto;
}

/* ===========================================================================
 * Page header
 * ========================================================================= */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.page-header h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1.2;
  color: hsl(var(--text));
}

/* Reading column: caps line length on prose-heavy item pages for
 * comfortable reading (code blocks and tables still use the full width). */
.reading { max-width: var(--content-prose); }
.page-header .lead {
  margin: var(--space-1) 0 0;
  color: hsl(var(--text-muted));
  font-size: 14px;
}
.page-header .actions {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
}

nav.crumbs {
  font-size: 12px;
  color: hsl(var(--text-subtle));
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
nav.crumbs a { color: hsl(var(--text-muted)); }
nav.crumbs a:hover { color: hsl(var(--text)); }
nav.crumbs .sep { color: hsl(var(--text-subtle)); }

/* ===========================================================================
 * Topic pages (sections grouped under a topic tab)
 * ========================================================================= */

.topic-group + .topic-group { margin-top: var(--space-6); }
.topic-group-title {
  margin: 0 0 var(--space-3);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: hsl(var(--text));
}
.topic-group-title a { color: inherit; }
.topic-group-title a:hover { color: hsl(var(--text-muted)); }

/* ===========================================================================
 * Cards
 * ========================================================================= */

.card {
  background: hsl(var(--bg-elevated));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: var(--space-4); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin: -4px 0 var(--space-4);
}
.card-header h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: hsl(var(--text));
}
.card-header .count {
  font-size: 11px;
  color: hsl(var(--text-subtle));
  background: hsl(var(--bg-subtle));
  padding: 2px 8px;
  border-radius: 999px;
}

.muted { color: hsl(var(--text-muted)); font-size: 13px; margin: 0 0 var(--space-5); }
.empty-state {
  color: hsl(var(--text-muted));
  padding: var(--space-12) var(--space-4);
  text-align: center;
}
.empty-state p { margin: var(--space-1) 0; }
.empty-state code {
  background: hsl(var(--bg-subtle));
  border: 1px solid hsl(var(--border));
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

/* ===========================================================================
 * Lists
 * ========================================================================= */

ul.list, ol.list {
  list-style: none;
  padding: 0;
  margin: 0;
}
ul.list li, ol.list.stages li {
  padding: var(--space-3);
  border-bottom: 1px solid hsl(var(--border));
  border-radius: var(--radius-sm);
  transition: background-color 0.1s ease;
}
ul.list li:hover, ol.list.stages li:hover {
  background: hsl(var(--bg-subtle));
}
ul.list li:last-child, ol.list.stages li:last-child { border-bottom: none; }
ul.list .title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 15px;
  font-weight: 500;
  color: hsl(var(--text));
}
ul.list .title > span:first-child { flex: 1; min-width: 0; }
.list-count {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 500;
  color: hsl(var(--text-subtle));
  background: hsl(var(--bg-subtle));
  border: 1px solid hsl(var(--border));
  border-radius: 999px;
  padding: 1px 9px;
}
/* Affordance chevron on navigable list rows. */
ul.list .title::after {
  content: "›";
  color: hsl(var(--text-subtle));
  font-size: 18px;
  line-height: 1;
  transition: transform 0.12s ease, color 0.12s ease;
}
ul.list li:hover .title::after { color: hsl(var(--accent)); transform: translateX(2px); }
ul.list .title:hover { color: hsl(var(--accent-hover)); }
ul.list .meta {
  color: hsl(var(--text-muted));
  font-size: 12px;
  margin-top: var(--space-1);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
ul.list .meta > span { display: inline-flex; align-items: center; gap: var(--space-1); }

ol.list.stages { padding-left: var(--space-6); list-style: decimal; counter-reset: stage; }
ol.list.stages li::marker { color: hsl(var(--text-subtle)); font-size: 12px; }

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.row form { margin: 0; }
.stage-actions { display: flex; gap: var(--space-2); align-items: center; }
.stage-actions form { margin: 0; }

/* ===========================================================================
 * Buttons
 * ========================================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:focus-visible {
  outline: 2px solid hsl(var(--accent) / 0.5);
  outline-offset: 2px;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

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

.btn-secondary {
  background: hsl(var(--bg-elevated));
  border-color: hsl(var(--border-strong));
  color: hsl(var(--text));
}
.btn-secondary:hover { background: hsl(var(--bg-subtle)); }

.btn-ghost {
  background: transparent;
  color: hsl(var(--text-muted));
}
.btn-ghost:hover { background: hsl(var(--bg-subtle)); color: hsl(var(--text)); }

.btn-danger {
  background: transparent;
  color: hsl(var(--danger));
  border-color: hsl(var(--danger) / 0.3);
}
.btn-danger:hover { background: hsl(var(--danger) / 0.1); border-color: hsl(var(--danger) / 0.5); }

.btn-sm { padding: 4px 10px; font-size: 12px; }

button.link-danger, button.link-edit {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background-color 0.12s ease;
  font-family: inherit;
}
button.link-danger { color: hsl(var(--danger)); }
button.link-danger:hover { background: hsl(var(--danger) / 0.1); }
button.link-edit { color: hsl(var(--accent)); }
button.link-edit:hover { background: hsl(var(--accent) / 0.1); }

/* ===========================================================================
 * Badges / statuses
 * ========================================================================= */

.status {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid hsl(var(--border-strong));
  background: hsl(var(--bg-subtle));
  color: hsl(var(--text-muted));
  font-weight: 500;
}

.status-applied   { color: hsl(217 90% 70%); border-color: hsl(217 60% 30%); background: hsl(217 60% 18% / .35); }
.status-screen    { color: hsl(263 80% 75%); border-color: hsl(263 50% 35%); background: hsl(263 50% 18% / .35); }
.status-tech      { color: hsl(38  90% 65%); border-color: hsl(38  60% 30%); background: hsl(38  60% 18% / .35); }
.status-final     { color: hsl(170 70% 65%); border-color: hsl(170 50% 28%); background: hsl(170 50% 16% / .35); }
.status-offer     { color: hsl(142 75% 65%); border-color: hsl(142 55% 28%); background: hsl(142 55% 16% / .45); }
.status-rejected  { color: hsl(0   75% 70%); border-color: hsl(0   55% 32%); background: hsl(0   55% 18% / .30); }
.status-withdrawn { color: hsl(var(--text-subtle)); }
.status-scheduled { color: hsl(217 90% 70%); border-color: hsl(217 60% 30%); }
.status-completed { color: hsl(142 75% 65%); border-color: hsl(142 55% 28%); }
.status-cancelled { color: hsl(var(--text-subtle)); }

/* ===========================================================================
 * Funnel (kanban)
 * ========================================================================= */

.funnel {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-3);
}
.funnel-closed { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.funnel-col {
  background: hsl(var(--bg-elevated));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  min-height: 120px;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.funnel-col h2 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: hsl(var(--text-muted));
  margin: 0 var(--space-1) var(--space-2);
  font-weight: 600;
}
.funnel-col h2 .count {
  background: hsl(var(--bg-subtle));
  color: hsl(var(--text));
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.funnel-col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.funnel-col li {
  background: hsl(var(--bg));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: var(--space-3);
  transition: border-color 0.12s ease, transform 0.12s ease;
  cursor: pointer;
}
.funnel-col li:hover {
  border-color: hsl(var(--border-strong));
  background: hsl(var(--bg-subtle));
}
.funnel-col li a { color: hsl(var(--text)); font-weight: 500; font-size: 13px; display: block; }
.funnel-col li a:hover { color: hsl(var(--accent-hover)); }
.funnel-col li .meta { color: hsl(var(--text-muted)); font-size: 11px; margin-top: var(--space-1); }
.funnel-col p.empty {
  color: hsl(var(--text-subtle));
  font-size: 12px;
  font-style: italic;
  margin: 0;
  padding: var(--space-3);
  text-align: center;
}

/* ===========================================================================
 * Forms
 * ========================================================================= */

.form-block, details.form-block {
  margin-top: var(--space-6);
  background: hsl(var(--bg-elevated));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}
details.form-block > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: hsl(var(--accent));
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
details.form-block > summary::before {
  content: "+";
  font-size: 16px;
  line-height: 1;
  width: 16px;
  display: inline-block;
  text-align: center;
}
details.form-block[open] > summary::before { content: "−"; }
details.form-block[open] > summary { margin-bottom: var(--space-4); }
details.form-block > summary::-webkit-details-marker { display: none; }

.form-block form { display: grid; gap: var(--space-4); }
.form-block label {
  display: grid;
  gap: 6px;
  font-size: 11px;
  color: hsl(var(--text-muted));
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}
.form-block input,
.form-block textarea,
.form-block select {
  background: hsl(var(--bg));
  border: 1px solid hsl(var(--border-strong));
  border-radius: var(--radius);
  color: hsl(var(--text));
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}
.form-block input:focus,
.form-block textarea:focus,
.form-block select:focus {
  outline: none;
  border-color: hsl(var(--accent));
  background: hsl(var(--bg-elevated));
  box-shadow: 0 0 0 3px hsl(var(--accent) / 0.18);
}
.form-block textarea {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  resize: vertical;
  min-height: 80px;
}
.form-block button[type="submit"] {
  justify-self: start;
  background: hsl(var(--accent));
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.12s ease;
}
.form-block button[type="submit"]:hover { background: hsl(var(--accent-hover)); }

/* ===========================================================================
 * Markdown content
 * ========================================================================= */

.content { font-size: 16px; line-height: 1.7; color: hsl(var(--text)); }
.content h1, .content h2, .content h3, .content h4 {
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
  letter-spacing: -0.015em;
  font-weight: 600;
}
.content h1 { font-size: 24px; }
.content h2 { font-size: 20px; }
.content h3 { font-size: 16px; }
.content h4 { font-size: 14px; color: hsl(var(--text-muted)); text-transform: uppercase; letter-spacing: 0.05em; }
.content > *:first-child { margin-top: 0; }
.content p, .content ul, .content ol { margin: var(--space-3) 0; }
.content code {
  background: hsl(var(--bg-subtle));
  border: 1px solid hsl(var(--border));
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13.5px;
}
.content pre {
  background: hsl(var(--bg-subtle));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: var(--space-4);
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.55;
}
.content pre code { background: transparent; padding: 0; border: none; }
.content table {
  border-collapse: collapse;
  width: 100%;
  margin: var(--space-4) 0;
  font-size: 14px;
}
.content th, .content td {
  border: 1px solid hsl(var(--border));
  padding: var(--space-2) var(--space-3);
  text-align: left;
}
.content th { background: hsl(var(--bg-subtle)); font-weight: 600; }
.content blockquote {
  margin: var(--space-4) 0;
  padding: var(--space-2) var(--space-4);
  border-left: 3px solid hsl(var(--accent));
  background: hsl(var(--bg-subtle));
  color: hsl(var(--text-muted));
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* ===========================================================================
 * Tags
 * ========================================================================= */

.tag-list { margin: var(--space-2) 0 var(--space-5); display: flex; flex-wrap: wrap; gap: var(--space-2); }
.tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid hsl(var(--border-strong));
  background: hsl(var(--bg-subtle));
  color: hsl(var(--text-muted));
  font-weight: 500;
}
.tag:hover { color: hsl(var(--accent)); border-color: hsl(var(--accent) / 0.4); }

/* ===========================================================================
 * Search
 * ========================================================================= */

.search-form {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
  max-width: 640px;
}
.search-form input[type="search"] {
  flex: 1;
  background: hsl(var(--bg-elevated));
  color: hsl(var(--text));
  border: 1px solid hsl(var(--border-strong));
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
}
.search-form input[type="search"]:focus {
  outline: none;
  border-color: hsl(var(--accent));
  box-shadow: 0 0 0 3px hsl(var(--accent) / 0.18);
}
.search-form button {
  background: hsl(var(--accent));
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.search-form button:hover { background: hsl(var(--accent-hover)); }

.snippet { color: hsl(var(--text-muted)); font-size: 13px; margin-top: var(--space-2); line-height: 1.5; }
.snippet mark {
  background: hsl(var(--accent) / 0.2);
  color: hsl(var(--text));
  padding: 0 3px;
  border-radius: 3px;
}

/* ===========================================================================
 * Action items
 * ========================================================================= */

.actions-list { margin-top: var(--space-2); }
.action-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-bottom: 1px solid hsl(var(--border));
}
.action-item:last-child { border-bottom: none; }
.action-item .body { flex: 1; min-width: 0; }
.action-item .title { font-size: 14px; font-weight: 500; color: hsl(var(--text)); }
.action-item .title.struck { text-decoration: line-through; color: hsl(var(--text-subtle)); }
.action-item.action-done { opacity: 0.65; }
.action-item .meta { color: hsl(var(--text-muted)); font-size: 12px; margin-top: 2px; }
.action-item .toggle, .action-item .toggle form { margin: 0; }
.toggle-btn {
  background: hsl(var(--bg));
  border: 1px solid hsl(var(--border-strong));
  color: hsl(var(--accent));
  cursor: pointer;
  font-size: 16px;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  padding: 0;
  display: grid;
  place-items: center;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}
.toggle-btn:hover { background: hsl(var(--accent) / 0.1); border-color: hsl(var(--accent) / 0.4); }

/* ===========================================================================
 * Chat (mock interview)
 * ========================================================================= */

.chat-log {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: var(--space-6) 0;
  max-height: 65vh;
  overflow-y: auto;
  padding: var(--space-2);
}
.chat-msg {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  max-width: 75%;
}
.chat-user {
  background: hsl(var(--accent) / 0.12);
  border-color: hsl(var(--accent) / 0.3);
  align-self: flex-end;
}
.chat-assistant {
  background: hsl(var(--bg-elevated));
  align-self: flex-start;
}
.chat-error { color: hsl(var(--danger)); }
.chat-role {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: hsl(var(--text-subtle));
  margin-bottom: var(--space-1);
  font-weight: 600;
}
.chat-body { white-space: pre-wrap; word-wrap: break-word; font-size: 14px; line-height: 1.55; }

.voice-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-3);
}
.voice-bar[hidden] { display: none; }
.voice-bar .btn svg { width: 14px; height: 14px; }
.voice-bar.voice-active .btn { border-color: hsl(var(--accent)); color: hsl(var(--accent-hover)); }
.voice-select {
  background: hsl(var(--bg-subtle));
  color: hsl(var(--text));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-sm);
  font-size: 12px;
  padding: 4px 8px;
  max-width: 220px;
}
.voice-select[hidden] { display: none; }
.voice-status { font-size: 13px; color: hsl(var(--text-muted)); }
.voice-bar.voice-active .voice-status { color: hsl(var(--accent-hover)); }

.chat-form { display: flex; gap: var(--space-2); margin-top: var(--space-3); }
.chat-form textarea {
  flex: 1;
  background: hsl(var(--bg-elevated));
  border: 1px solid hsl(var(--border-strong));
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-3);
  color: hsl(var(--text));
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  min-height: 60px;
}
.chat-form textarea:focus {
  outline: none;
  border-color: hsl(var(--accent));
  box-shadow: 0 0 0 3px hsl(var(--accent) / 0.18);
}
.chat-form button {
  background: hsl(var(--accent));
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 10px 18px;
  font-weight: 500;
  cursor: pointer;
  align-self: flex-end;
}
.chat-form button:hover { background: hsl(var(--accent-hover)); }
.chat-form button:disabled { opacity: 0.5; cursor: wait; }

/* ===========================================================================
 * Dashboard grid (prep view)
 * ========================================================================= */

.grid-2 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-4);
}
.grid-2 > .card { margin-top: 0; }
.grid-2 + .grid-2 { margin-top: var(--space-4); }

/* ===========================================================================
 * Responsive
 * ========================================================================= */

@media (max-width: 1024px) {
  .funnel { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
}
/* Mobile topbar + hamburger: hidden on desktop, where the sidebar is fixed. */
.topbar { display: none; }
.nav-toggle { display: none; }
.nav-backdrop { display: none; }

@media (max-width: 768px) {
  .app-shell { grid-template-columns: 1fr; }

  .topbar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    position: sticky;
    top: 0;
    z-index: 40;
    height: 52px;
    padding: 0 var(--space-4);
    background: hsl(var(--bg-elevated));
    border-bottom: 1px solid hsl(var(--border));
  }
  .topbar-title { font-weight: 600; letter-spacing: -0.01em; }
  .nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 36px;
    height: 36px;
    padding: 8px;
    background: none;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-sm);
    cursor: pointer;
  }
  .nav-toggle span {
    display: block;
    height: 2px;
    background: hsl(var(--text));
    border-radius: 2px;
  }

  /* Sidebar becomes an off-canvas drawer. */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 264px;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 45;
    background: hsl(220 30% 4% / 0.6);
  }
  .nav-backdrop[hidden] { display: none; }

  .main { padding: var(--space-5) var(--space-4) var(--space-10); }
  .funnel { grid-template-columns: 1fr; }
  .funnel-closed { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: stretch; }
  .item-nav { flex-direction: column; }
  .item-nav-link { max-width: 100%; }
}

/* ===========================================================================
 * Per-item user notes
 * ========================================================================= */

.notes-section { margin-top: var(--space-6); }
.notes-heading {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: hsl(var(--text-muted));
  margin: 0 0 var(--space-2);
}
.notes-textarea {
  width: 100%;
  min-height: 96px;
  padding: var(--space-4);
  background: hsl(var(--bg-elevated));
  color: hsl(var(--text));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.6;
  resize: vertical;
  transition: border-color 0.15s ease;
}
.notes-textarea::placeholder { color: hsl(var(--text-subtle)); }
.notes-textarea:focus {
  outline: none;
  border-color: hsl(var(--accent));
}
.notes-status {
  font-size: 12px;
  color: hsl(var(--text-muted));
  margin: var(--space-2) 0 0;
  min-height: 16px;
}

/* ===========================================================================
 * Card lists (quick reference + Q&A) with edit modal
 * ========================================================================= */

.card-list-section { margin-top: var(--space-6); }
.card-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}
.card-list-head .notes-heading { margin: 0; }
.card-list-actions { display: flex; align-items: center; gap: var(--space-2); }
.card-layout-toggle {
  background: none;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-sm);
  color: hsl(var(--text-muted));
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
}
.card-layout-toggle:hover { color: hsl(var(--text)); border-color: hsl(var(--border-strong)); }

/* Horizontal (default): a scrollable row. */
.card-list {
  display: flex;
  align-items: stretch;
  gap: var(--space-3);
  overflow-x: auto;
  padding-bottom: var(--space-3);
  scroll-snap-type: x proximity;
}
.card-list[data-layout="vertical"] {
  flex-direction: column;
  overflow-x: visible;
}
/* Friendly hint when a card list is empty. */
.card-list:empty::after {
  content: attr(data-empty);
  display: block;
  color: hsl(var(--text-subtle));
  font-size: 13px;
  padding: var(--space-3) 0;
}

.card-tile {
  flex: 0 0 240px;
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  scroll-snap-align: start;
  background: hsl(var(--bg-elevated));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.card-list[data-layout="vertical"] .card-tile { flex: 0 0 auto; width: 100%; }
.card-tile:hover { border-color: hsl(var(--border-strong)); }
.card-tile.dragging { opacity: 0.45; }
.card-drag {
  cursor: grab;
  color: hsl(var(--text-subtle));
  font-size: 16px;
  line-height: 1.3;
  user-select: none;
  flex-shrink: 0;
}
.card-drag:active { cursor: grabbing; }
.card-drag:hover { color: hsl(var(--text-muted)); }
.card-tile-body { min-width: 0; flex: 1; }
.card-tile-title {
  color: hsl(var(--text));
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  word-break: break-word;
}
.card-tile-title:empty::before {
  content: "Untitled";
  color: hsl(var(--text-subtle));
  font-weight: 400;
}
.card-tile-preview {
  margin-top: var(--space-2);
  color: hsl(var(--text-muted));
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-list[data-layout="vertical"] .card-tile-preview { -webkit-line-clamp: 8; }

/* Q&A reveal: blur the answer until the user reveals it. */
.card-reveal {
  flex-shrink: 0;
  align-self: flex-start;
  background: none;
  border: none;
  color: hsl(var(--accent));
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}
.card-reveal:hover { color: hsl(var(--accent-hover)); }
.card-list-section[data-reveal="true"] .card-tile:not(.revealed) .card-tile-preview {
  filter: blur(5px);
  user-select: none;
}

/* Shared edit modal. */
body.modal-open { overflow: hidden; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: hsl(220 30% 4% / 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  z-index: 50;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  background: hsl(var(--bg-elevated));
  border: 1px solid hsl(var(--border-strong));
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}
.modal-close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  background: none;
  border: none;
  color: hsl(var(--text-subtle));
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { color: hsl(var(--text)); }
.modal-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: hsl(var(--text-muted));
  margin: var(--space-3) 0 var(--space-1);
}
.modal-label:first-of-type { margin-top: 0; }
.modal-f1, .modal-f2 {
  width: 100%;
  background: hsl(var(--bg-subtle));
  color: hsl(var(--text));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.6;
  padding: var(--space-3);
}
.modal-f2 { resize: vertical; min-height: 160px; }
.modal-f1:focus, .modal-f2:focus { outline: none; border-color: hsl(var(--accent)); }
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-4);
}
.modal-status { font-size: 12px; color: hsl(var(--text-muted)); min-height: 16px; }
.modal-delete {
  background: none;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-sm);
  color: hsl(var(--text-muted));
  font-size: 12px;
  cursor: pointer;
  padding: 4px 10px;
}
.modal-delete:hover { color: hsl(0 70% 65%); border-color: hsl(0 70% 65% / 0.5); }

/* ===========================================================================
 * Topic chips (Notes home quick access)
 * ========================================================================= */

/* ===========================================================================
 * Section tab bar
 * ========================================================================= */
.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
}
.tab {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid hsl(var(--border-strong));
  background: hsl(var(--bg-elevated));
  color: hsl(var(--text-subtle));
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.12s ease, color 0.12s ease, background 0.12s ease;
}
.tab:hover {
  color: hsl(var(--text));
  border-color: hsl(var(--accent) / 0.5);
}
.tab.active {
  background: hsl(var(--accent));
  border-color: hsl(var(--accent));
  color: hsl(var(--bg));
}

.topic-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}
.topic-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid hsl(var(--border-strong));
  background: hsl(var(--bg-elevated));
  color: hsl(var(--text));
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.12s ease, color 0.12s ease;
}
.topic-chip:hover { color: hsl(var(--accent-hover)); border-color: hsl(var(--accent) / 0.5); }
.topic-chip-count {
  font-size: 11px;
  color: hsl(var(--text-subtle));
  background: hsl(var(--bg-subtle));
  border-radius: 999px;
  padding: 0 7px;
}

/* ===========================================================================
 * Sidebar keyboard hint
 * ========================================================================= */

.nav-kbd {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  color: hsl(var(--text-subtle));
  border: 1px solid hsl(var(--border));
  border-radius: 4px;
  padding: 1px 5px;
}

/* ===========================================================================
 * Prev / next item navigation
 * ========================================================================= */

.item-nav {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-8);
}
.item-nav-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  max-width: 48%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  background: hsl(var(--bg-elevated));
  box-shadow: var(--shadow-sm);
  transition: border-color 0.12s ease;
}
.item-nav-link:hover { border-color: hsl(var(--accent) / 0.5); }
.item-nav-link.next { text-align: right; }
.item-nav-dir { font-size: 12px; color: hsl(var(--text-subtle)); }
.item-nav-title { font-size: 14px; font-weight: 500; color: hsl(var(--text)); }

/* ===========================================================================
 * Command palette (Cmd/Ctrl-K)
 * ========================================================================= */

.cmdk-backdrop {
  position: fixed;
  inset: 0;
  background: hsl(220 30% 4% / 0.6);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  z-index: 60;
}
.cmdk-backdrop[hidden] { display: none; }
.cmdk-panel {
  width: 100%;
  max-width: 640px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: hsl(var(--bg-elevated));
  border: 1px solid hsl(var(--border-strong));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.cmdk-input {
  width: 100%;
  border: none;
  border-bottom: 1px solid hsl(var(--border));
  background: transparent;
  color: hsl(var(--text));
  font-family: inherit;
  font-size: 16px;
  padding: var(--space-4) var(--space-5);
}
.cmdk-input:focus { outline: none; }
.cmdk-input::placeholder { color: hsl(var(--text-subtle)); }
.cmdk-results {
  list-style: none;
  margin: 0;
  padding: var(--space-2);
  overflow-y: auto;
}
.cmdk-empty { padding: var(--space-4); color: hsl(var(--text-subtle)); font-size: 14px; }
.cmdk-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.cmdk-item.active { background: hsl(var(--accent) / 0.14); }
.cmdk-badge {
  flex-shrink: 0;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  width: 64px;
  text-align: center;
}
.cmdk-badge-topic { background: hsl(var(--accent) / 0.18); color: hsl(var(--accent-hover)); }
.cmdk-badge-section { background: hsl(263 60% 60% / 0.18); color: hsl(263 70% 78%); }
.cmdk-badge-item { background: hsl(var(--bg-subtle)); color: hsl(var(--text-muted)); }
.cmdk-title { flex-shrink: 0; max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.cmdk-sub { color: hsl(var(--text-subtle)); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-foot {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-2) var(--space-4);
  border-top: 1px solid hsl(var(--border));
  font-size: 11px;
  color: hsl(var(--text-subtle));
}
.cmdk-foot kbd {
  font-family: var(--font-mono);
  border: 1px solid hsl(var(--border));
  border-radius: 4px;
  padding: 0 4px;
  margin-right: 2px;
}

/* ===========================================================================
 * Content editor (live markdown preview)
 * ========================================================================= */

.editor-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: hsl(220 30% 4% / 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}
.editor-backdrop[hidden] { display: none; }
.editor-panel {
  width: 100%;
  max-width: 1100px;
  height: 85vh;
  display: flex;
  flex-direction: column;
  background: hsl(var(--bg-elevated));
  border: 1px solid hsl(var(--border-strong));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.editor-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid hsl(var(--border));
}
.editor-title {
  flex: 1;
  background: hsl(var(--bg-subtle));
  color: hsl(var(--text));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  padding: var(--space-2) var(--space-3);
}
.editor-title:focus { outline: none; border-color: hsl(var(--accent)); }
.editor-close {
  background: none; border: none; color: hsl(var(--text-subtle));
  font-size: 16px; cursor: pointer; line-height: 1;
}
.editor-close:hover { color: hsl(var(--text)); }
.editor-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 0;
}
.editor-md {
  border: none;
  border-right: 1px solid hsl(var(--border));
  background: hsl(var(--bg));
  color: hsl(var(--text));
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  padding: var(--space-4);
  resize: none;
}
.editor-md:focus { outline: none; }
.editor-preview {
  overflow-y: auto;
  padding: var(--space-4) var(--space-5);
}
.editor-foot {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid hsl(var(--border));
}
.editor-status { flex: 1; font-size: 12px; color: hsl(var(--text-muted)); }
@media (max-width: 768px) {
  .editor-body { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .editor-md { border-right: none; border-bottom: 1px solid hsl(var(--border)); }
}

/* ===========================================================================
 * AI Interview Copilot
 * ========================================================================= */

.copilot-shell {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
  align-items: start;
}
.copilot-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: hsl(var(--text-subtle));
  margin-bottom: var(--space-2);
}
.copilot-question-panel, .copilot-answer-panel {
  background: hsl(var(--bg-elevated));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}
.copilot-question {
  min-height: 80px;
  font-size: 16px;
  line-height: 1.6;
  color: hsl(var(--text));
  margin-bottom: var(--space-4);
  white-space: pre-wrap;
  word-break: break-word;
}
.copilot-answer {
  min-height: 120px;
  font-size: 15px;
  line-height: 1.7;
  color: hsl(var(--text));
  margin-bottom: var(--space-4);
  white-space: pre-wrap;
  word-break: break-word;
}
.copilot-placeholder { color: hsl(var(--text-subtle)); }
.copilot-controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.copilot-mic-status {
  font-size: 12px;
  color: hsl(var(--text-muted));
  margin-top: var(--space-2);
  min-height: 16px;
}
.copilot-hint {
  margin-top: var(--space-4);
  font-size: 12px;
  color: hsl(var(--text-subtle));
}
.copilot-manual {
  display: block;
  width: 100%;
  margin-top: var(--space-2);
  background: hsl(var(--bg-subtle));
  color: hsl(var(--text));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  padding: var(--space-2) var(--space-3);
  resize: vertical;
}
.copilot-manual:focus { outline: none; border-color: hsl(var(--accent)); }
.copilot-answer-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.copilot-answer-status {
  flex: 1;
  font-size: 12px;
  color: hsl(var(--text-muted));
  min-height: 16px;
}
@media (max-width: 768px) {
  .copilot-shell { grid-template-columns: 1fr; }
}
