:root {
  color-scheme: dark;
  /* R18 palette — mint + lavender on deep slate. Warmer-cheerful
     than the prior violet-only scheme; calm-bright for long
     sessions. Light mode below carries the same vibe lighter. */
  --bg: #0f1115;
  --surface: #181b24;
  --surface-2: #212531;
  --surface-3: #2a2f3d;
  --border: #2a3040;
  --border-strong: #3a4254;
  --text: #e8eaee;
  --text-muted: #9ea4b5;
  /* --text-soft was #6c7587 — failed WCAG 1.4.3 (4.5:1) per
     axe-core 4.10 audit 2026-05-19: 3.0–3.3:1 against the surface
     palette. Bumped to #a0a6b6 to clear 4.5:1 (≈4.8:1 vs
     surface-2 #212531; higher against the deeper bg colors).
     Visual hierarchy preserved — text-soft is still distinct from
     text + text-muted, just lighter. See ACCESSIBILITY.md. */
  --text-soft: #a0a6b6;
  --accent: #5eead4;             /* mint primary */
  --accent-hover: #7ff0db;
  --accent-weak: rgba(94, 234, 212, 0.16);
  --accent-text: #2dd4bf;
  --accent-on: #0a1e1c;          /* text on filled accent */
  --accent-2: #c4b5fd;            /* lavender secondary */
  --accent-2-weak: rgba(196, 181, 253, 0.14);
  --accent-2-text: #c4b5fd;
  --success: #34d399;
  --success-weak: rgba(52, 211, 153, 0.16);
  --warn: #fbbf77;                /* peach for highlight / okay */
  --warn-weak: rgba(251, 191, 119, 0.18);
  --danger: #f87171;
  --danger-weak: rgba(239, 68, 68, 0.20);
  --focus-ring: rgba(94, 234, 212, 0.45);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.40);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.36), 0 1px 3px rgba(0, 0, 0, 0.22);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.50);
  --shadow-glow: 0 0 0 1px rgba(94, 234, 212, 0.20),
                 0 6px 24px rgba(94, 234, 212, 0.20);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --sidebar-width: 248px;
  --topbar-height: 64px;
  --content-max: 1280px;
  --font-stack: "Inter", "InterVariable", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "JetBrains Mono", "SF Mono", "Cascadia Mono", Menlo, Monaco, Consolas, monospace;
  /* Typography scale */
  --text-xxs: 11px;
  --text-xs: 12px;
  --text-sm: 13px;
  --text-md: 14px;
  --text-lg: 16px;
  --text-xl: 22px;
  --text-hero: 32px;
  /* Spacing — slightly more generous than before for a more modern feel. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 18px;
  --space-5: 28px;
  --space-6: 40px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f8faf9;
  --surface: #ffffff;
  --surface-2: #f1f4f3;
  --surface-3: #e7edec;
  --border: #d9e0de;
  --border-strong: #b5c0bd;
  --text: #14201d;
  --text-muted: #4a5853;
  /* --text-soft was #7a8783 — failed WCAG 1.4.3 (4.5:1) against
     the light-mode #f8faf9 bg (audit 2026-05-19, ratio 3.56:1).
     Darkened to #5a6863 to clear 4.5:1 (≈5.5:1 vs bg). Pairs
     with the dark-mode rebalance above. */
  --text-soft: #5a6863;
  /* --accent was #0d9488 — failed WCAG 1.4.3 (4.5:1) with white text
     at 3.74:1. Darkened to #0a766b (≈5.2:1 vs #fff) per axe-core
     light-mode audit 2026-05-19. The hover variant tracks. */
  --accent: #0a766b;              /* mint, AA-safe on white text */
  --accent-hover: #0d8a7e;
  --accent-weak: rgba(10, 118, 107, 0.10);
  --accent-text: #0a766b;
  --accent-on: #ffffff;
  --accent-2: #7c5cff;            /* lavender, darker */
  --accent-2-weak: rgba(124, 92, 255, 0.10);
  --accent-2-text: #6a48ea;
  --success: #15803d;
  --success-weak: rgba(21, 128, 61, 0.10);
  --warn: #c2410c;
  --warn-weak: rgba(194, 65, 12, 0.10);
  --danger: #b91c1c;
  --danger-weak: rgba(185, 28, 28, 0.10);
  --focus-ring: rgba(13, 148, 136, 0.30);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 6px 18px rgba(15, 23, 42, 0.09), 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 14px 42px rgba(15, 23, 42, 0.14);
  --shadow-glow: 0 0 0 1px rgba(13, 148, 136, 0.22),
                 0 6px 22px rgba(13, 148, 136, 0.20);
}

/* "System" theme is resolved client-side: app.js maps system → light/dark
   based on `prefers-color-scheme` and sets data-theme accordingly. */

/* Find me jobs — query + location + how-many + submit on one row */
.find-jobs-form {
  display: grid;
  grid-template-columns: 2fr 1fr 100px auto;
  gap: 12px;
  align-items: end;
}
@media (max-width: 768px) {
  .find-jobs-form { grid-template-columns: 1fr 1fr; }
  .find-jobs-query { grid-column: span 2; }
  .find-jobs-submit { grid-column: span 2; }
}

/* Find-jobs result rows: title + meta on the left, source tag on the right */
.find-jobs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.find-jobs-main { min-width: 0; flex: 1; }
.find-jobs-meta { margin: 2px 0 0; }
.find-jobs-source { flex: none; text-transform: uppercase; letter-spacing: 0.04em; font-size: var(--text-xxs); }
.find-jobs-row:hover { border-color: var(--border-strong); }

.find-jobs-results {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.find-jobs-row {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.12s ease, background 0.12s ease;
}

.find-jobs-title {
  color: var(--accent-text);
  font-weight: 600;
  text-decoration: none;
}

.find-jobs-title:hover {
  text-decoration: underline;
}

.attribution-row {
  margin-top: 12px;
  border-top: 1px dashed var(--border);
  padding-top: 8px;
}

.attribution-row a {
  color: var(--text-muted);
  margin: 0 4px;
}

.bookmarklet-link {
  cursor: grab;
  user-select: none;
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  box-shadow: 0 4px 12px color-mix(in oklab, var(--accent) 35%, transparent);
}
.bookmarklet-link:active { cursor: grabbing; }
.bookmarklet-link:hover { transform: translateY(-1px); }

.bookmarklet-steps {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: grid;
  gap: 16px;
}
.bookmarklet-steps li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  align-items: start;
}
.bookmarklet-steps .step-num {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-weak);
  color: var(--accent-text);
  font-weight: 600;
  font-size: var(--text-sm);
}
.bookmarklet-steps strong {
  display: block;
  font-weight: 600;
  font-size: var(--text-md);
  margin-bottom: 2px;
}
.bookmarklet-steps p { margin: 0 0 4px; }
.bookmarklet-steps kbd {
  font-family: var(--font-mono);
  font-size: var(--text-xxs);
  padding: 1px 6px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface-2);
}

.queue-source-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 6px 0 12px;
}

.queue-source-filters .chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: var(--text-xs);
  cursor: pointer;
  transition: background 0.15s;
}

.queue-source-filters .chip:hover {
  background: var(--surface);
}

.queue-source-filters .chip.active {
  background: var(--accent-weak);
  color: var(--accent-text);
  border-color: var(--accent);
}

.tag.source-tag {
  background: var(--surface-2);
  color: var(--text-muted);
}

.tag.source-also {
  background: transparent;
  border: 1px dashed var(--border-strong);
  cursor: pointer;
  font: inherit;
}
.tag.source-also[aria-expanded="true"] {
  background: var(--surface-2);
  border-style: solid;
}
.also-seen-panel {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-left: 2px solid var(--border-strong);
  background: var(--surface-2);
  border-radius: 4px;
}
.also-seen-panel ul { list-style: none; margin: 0; padding: 0; }
.also-seen-panel li { margin: 0.15rem 0; font-size: 0.9em; }
.also-seen-panel a { margin-right: 0.5rem; }

.persona-suggestion {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.6rem 0.75rem;
  margin: 0 0 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--accent-weak);
  border-radius: 6px;
}
.persona-suggestion span { flex: 1; }
.persona-suggestion .btn { white-space: nowrap; }

.wizard-dialog {
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 0;
  width: min(560px, 92vw);
  /* ``--surface-1`` was undefined and fell back to transparent, so the
     underlying view text bled through the modal. Use the defined token
     and pin a fallback so the dialog ALWAYS has a solid background. */
  background: var(--surface, #171924);
  color: var(--text-primary, #e6e7ed);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
}
.wizard-dialog::backdrop {
  /* Bump opacity so the page behind the modal is clearly de-emphasised. */
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(2px);
}
.wizard { padding: 1.25rem 1.5rem; }
.wizard-header h2 { margin: 0 0 0.25rem; }
.wizard-steps { list-style: none; padding: 0; margin: 1rem 0 0; }
.wizard-step { display: none; }
.wizard-step.active { display: block; }
.wizard-step h3 { margin: 0 0 0.25rem; font-size: 1rem; }
.wizard-step textarea, .wizard-step input, .wizard-step select {
  width: 100%; margin-top: 0.5rem;
}
.wizard-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1rem; }
.wizard-footer { display: flex; justify-content: flex-end; padding-top: 0.5rem; border-top: 1px solid var(--border-strong); margin-top: 1rem; }

.queue-bulk-bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; gap: 0.5rem; align-items: center;
  padding: 0.5rem 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--accent-weak);
  border-radius: 6px;
  margin-bottom: 0.5rem;
}
.queue-bulk-bar span { flex: 1; font-weight: 500; }
.queue-select { margin-right: 0.5rem; vertical-align: middle; }

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(124, 92, 255, 0.07), transparent 60%),
    radial-gradient(900px 500px at 90% 110%, rgba(180, 158, 255, 0.04), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-stack);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11", "calt", "kern";
  letter-spacing: -0.005em;
}

h1, h2, h3, h4 {
  letter-spacing: -0.018em;
  font-weight: 650;
}

strong { font-weight: 600; }

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: var(--accent);
  /* WCAG 1.4.1 Use of Color: in-prose links MUST be distinguishable
   * by more than color alone (W4 D16-17 a11y AAA-leaning pass).
   * Class-styled links (nav-item, btn, .job-link, .skip-link) keep
   * their own `text-decoration: none` overrides via specificity. */
  text-decoration: underline;
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.18em;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
}

.skip-link:focus {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 8px 12px;
  box-shadow: var(--shadow-md);
}

.muted {
  color: var(--text-muted);
}

.small {
  font-size: var(--text-xs);
}

.hint {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: var(--text-xs);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  font-size: var(--text-md);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease,
              box-shadow 0.15s ease, transform 0.08s ease;
}

.btn:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.btn:active { transform: translateY(1px); }
@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
  .btn:active { transform: none; }
}

.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.nav-item:focus-visible,
.company-item:focus-visible,
.settings-tab:focus-visible,
.segmented-btn:focus-visible,
.ai-mode:focus-visible,
.cmdk-launcher:focus-visible,
.collapsible-summary:focus-visible,
.cmdk-item:focus-visible,
a.bookmarklet-link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
  border-color: var(--accent);
}
/* Honour reduced-motion: skip subtle hover transforms when requested */
@media (prefers-reduced-motion: reduce) {
  .card:hover,
  .metric-card:hover,
  .imported-row:hover,
  .find-jobs-row:hover,
  .suggestion:hover,
  .saved-search-row:hover { transform: none; }
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.btn-primary {
  background: var(--accent);
  border-color: color-mix(in oklab, var(--accent) 70%, transparent);
  color: var(--accent-on);
  font-weight: 600;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.10) inset,
              0 6px 18px color-mix(in oklab, var(--accent) 30%, transparent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: color-mix(in oklab, var(--accent) 60%, transparent);
}
.btn-primary:active {
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.20) inset;
}

.btn-secondary {
  background: var(--accent-2-weak);
  border-color: color-mix(in oklab, var(--accent-2) 40%, transparent);
  color: var(--accent-2-text);
  font-weight: 600;
}
.btn-secondary:hover {
  background: color-mix(in oklab, var(--accent-2) 22%, transparent);
}

.btn-danger {
  background: var(--surface);
  border-color: #f0bdbd;
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger-weak);
  border-color: #e89191;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.btn-small {
  min-height: 30px;
  padding: 0 10px;
  font-size: var(--text-sm);
}

.btn svg {
  width: 16px;
  height: 16px;
}

/* Inputs */
input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
/* Native <select> needs extra right padding so its option text doesn't
   collide with the OS-rendered dropdown chevron. */
select {
  padding-right: 30px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'><path d='M1 1l5 5 5-5' stroke='%239aa1b5' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}
select::-ms-expand { display: none; }
input::placeholder,
textarea::placeholder {
  color: var(--text-soft);
}
input:hover:not(:focus),
select:hover:not(:focus),
textarea:hover:not(:focus) {
  border-color: color-mix(in oklab, var(--text-muted) 50%, var(--border-strong));
}

textarea {
  min-height: 80px;
  resize: vertical;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.field.inline {
  grid-template-columns: auto 90px;
  align-items: center;
  gap: 12px;
}

.field.inline span {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  color: var(--text);
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}

/* Checkboxes — single canonical size everywhere */
input[type="checkbox"],
input[type="radio"] {
  width: 16px;
  height: 16px;
  min-height: 16px;
  min-width: 16px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
  flex: none;
}
.check-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 16px;
}

.filter-input {
  margin: 0 0 12px;
}

/* Auth gate */
.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 48px 16px;
  position: relative;
  overflow: hidden;
}
.auth-gate::before {
  content: "";
  position: absolute;
  inset: -10% -10% auto auto;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--accent-weak), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.auth-card {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(124, 92, 255, 0.06);
  position: relative;
  z-index: 1;
}

/* phase2-backlog #35 (2026-05-22): unauthenticated mission block.
   Side-by-side with the auth-card on desktop, stacked on mobile.
   Visible only inside #authGate (which is hidden when the user
   is signed in), so this surface is purely for first-time
   visitors + NLnet reviewers. */
.auth-layout {
  display: grid;
  gap: 36px;
  align-items: center;
  max-width: 1080px;
  width: 100%;
  position: relative;
  z-index: 1;
}
@media (min-width: 900px) {
  .auth-layout {
    grid-template-columns: 1fr 440px;
    gap: 56px;
  }
}

.auth-mission {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 560px;
}
.auth-mission-tag {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: var(--text-xs, 12px);
  color: var(--text-muted);
  margin: 0;
}
.auth-mission-headline {
  font-size: clamp(28px, 4.2vw, 38px);
  line-height: 1.15;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}
.auth-mission-lead {
  font-size: var(--text-md, 16px);
  line-height: 1.55;
  color: var(--text-muted);
  margin: 0;
  max-width: 56ch;
}
.auth-mission-bullets {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.auth-mission-bullets li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 16px;
  position: relative;
  font-size: var(--text-sm, 14px);
  line-height: 1.5;
}
.auth-mission-bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent, #7c5cff);
}
.auth-mission-bullets strong {
  color: var(--text);
  font-weight: 600;
}
.auth-mission-bullets span {
  color: var(--text-muted);
}
.auth-mission-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 8px;
  font-size: var(--text-sm, 14px);
}
.auth-mission-link {
  color: var(--accent, #7c5cff);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
  transition: border-color 0.15s ease;
}
.auth-mission-link:hover,
.auth-mission-link:focus-visible {
  border-bottom-color: currentColor;
}
.auth-mission-foot {
  font-size: var(--text-xs, 12px);
  color: var(--text-muted);
  margin: 4px 0 0;
  font-style: italic;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.auth-brand h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.auth-brand p {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.brand-mark {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #9c7dff, #5b3dd9);
  color: #fff;
  box-shadow: 0 2px 8px rgba(91, 61, 217, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition: transform 0.15s ease;
}
.brand-mark svg {
  width: 22px;
  height: 22px;
  display: block;
}
.brand-mark:hover {
  transform: translateY(-1px);
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form + .auth-form {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.auth-form button {
  margin-top: 6px;
}

.auth-message {
  min-height: 18px;
  margin-top: 10px;
  color: var(--danger);
  font-size: var(--text-sm);
}

/* App shell */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

/* R18: persistent 3-column layout on desktop —
   [sidebar] [chat-dock] [main/canvas]. Chat is always visible as
   the primary input. Dock collapses on mobile (display:none) so the
   chat is reachable via the existing #view-assistant view. */
@media (min-width: 1100px) {
  .shell {
    grid-template-columns: var(--sidebar-width) 400px 1fr;
  }
}
@media (max-width: 1099px) {
  #chatDock { display: none !important; }
}

.chat-dock {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background:
    linear-gradient(180deg,
      color-mix(in oklab, var(--accent) 6%, var(--surface)),
      var(--surface) 30%);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  padding: 18px 16px 14px;
  gap: 12px;
}
.chat-dock[hidden] { display: none !important; }

.chat-dock-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.chat-dock-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: var(--text-lg);
}
.chat-dock-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 25%, transparent);
  animation: chat-dock-pulse 2.4s ease-in-out infinite;
}
@keyframes chat-dock-pulse {
  0%, 100% { opacity: 0.95; }
  50% { opacity: 0.55; }
}
@media (prefers-reduced-motion: reduce) {
  .chat-dock-pulse { animation: none; }
}

.chat-dock-actions {
  display: inline-flex;
  gap: 6px;
}

.chat-dock-transcript {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  scroll-behavior: smooth;
}

.chat-dock-form {
  display: flex;
  gap: 8px;
}
.chat-dock-form input {
  flex: 1;
  min-height: 42px;
  padding: 0 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: var(--text-md);
}
.chat-dock-form input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.chat-dock-form .btn-primary {
  min-height: 42px;
  padding: 0 14px;
}
.chat-dock-form .btn-primary svg {
  width: 18px;
  height: 18px;
}

.chat-dock-hint {
  margin: 0;
  min-height: 18px;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* R19: search-results canvas. */
.search-results-body {
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin-top: 14px;
}
.search-category {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.search-category-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
}
.search-category-heading h3 {
  margin: 0;
  font-size: var(--text-lg);
  color: var(--text);
}
.search-category-heading .count {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: 500;
}
.search-job-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 18px;
  padding: 14px 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color 0.18s ease, background 0.18s ease,
              transform 0.08s ease;
}
.search-job-card:hover {
  border-color: color-mix(in oklab, var(--accent) 30%, var(--border));
  background: color-mix(in oklab, var(--accent) 4%, var(--surface-2));
}
.search-job-card .job-title {
  grid-column: 1;
  grid-row: 1;
  font-weight: 600;
  font-size: var(--text-md);
  color: var(--text);
  margin: 0;
}
.search-job-card .job-meta {
  grid-column: 1;
  grid-row: 2;
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin: 0;
}
.search-job-card .job-actions {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  display: inline-flex;
  gap: 8px;
}
.search-job-card .job-link {
  color: var(--accent-text);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
}
.search-job-card .job-link:hover { text-decoration: underline; }

.chat-first-banner {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px 18px;
  margin: 0 0 22px;
  background: linear-gradient(135deg,
    color-mix(in oklab, var(--accent) 12%, var(--surface)),
    color-mix(in oklab, var(--accent-2) 10%, var(--surface)));
  border: 1px solid color-mix(in oklab, var(--accent) 28%, var(--border));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.chat-first-emoji {
  font-size: 22px;
  line-height: 1;
}
.chat-first-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: var(--text-md);
}
.chat-first-text strong {
  color: var(--text);
  font-weight: 700;
}
@media (max-width: 1099px) {
  /* On mobile/tablet the dock isn't visible — pivot the banner to
     direct the user at the Assistant nav item instead. */
  .chat-first-text strong::after {
    content: " (Assistant tab)";
    color: var(--text-muted);
    font-weight: 400;
    font-size: var(--text-sm);
  }
}

.sidebar {
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, color-mix(in oklab, var(--accent) 4%, var(--surface)), var(--surface) 30%);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px 16px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.sidebar-title strong {
  display: block;
  font-size: var(--text-md);
  font-weight: 600;
  letter-spacing: -0.005em;
}

.sidebar-title .muted {
  font-size: 11.5px;
  letter-spacing: 0.005em;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
  text-align: left;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease, transform 0.14s ease;
}

.nav-item svg {
  width: 17px;
  height: 17px;
  color: var(--text-soft);
  flex: none;
  transition: color 0.14s ease;
}

.nav-item span {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item:hover {
  background: color-mix(in oklab, var(--accent) 7%, transparent);
  color: var(--text);
}
.nav-item:hover svg { color: var(--text); }

.nav-item[aria-current="page"] {
  background: linear-gradient(180deg, color-mix(in oklab, var(--accent) 18%, transparent), color-mix(in oklab, var(--accent) 12%, transparent));
  color: var(--text);
  border-color: color-mix(in oklab, var(--accent) 35%, transparent);
  box-shadow:
    inset 2px 0 0 var(--accent),
    0 1px 0 color-mix(in oklab, var(--accent) 12%, transparent);
}

.nav-item[aria-current="page"] svg {
  color: var(--accent-text);
}

.nav-pill {
  flex: none;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: var(--text-xxs);
  font-weight: 600;
}

.nav-item[aria-current="page"] .nav-pill {
  background: rgba(37, 99, 235, 0.15);
  color: var(--accent-text);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}

.user-avatar {
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), color-mix(in oklab, var(--accent) 70%, #000));
  color: #fff;
  font-weight: 650;
  font-size: var(--text-sm);
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.user-info {
  display: grid;
  flex: 1;
  min-width: 0;
  gap: 1px;
}

.user-email {
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: var(--text-xxs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-soft);
}

/* Main content */
.main {
  min-width: 0;
  padding: 24px 28px 56px;
  max-width: var(--content-max);
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.topbar-title h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.01em;
}

.topbar-title p {
  margin: 4px 0 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 500;
}

.status-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--success) 22%, transparent);
}

.status-pill.busy::before {
  background: var(--warn);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--warn) 22%, transparent);
  animation: status-pulse 1.4s ease-in-out infinite;
}

.status-pill.error::before {
  background: var(--danger);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--danger) 22%, transparent);
}

.status-pill.busy {
  background: var(--surface);
  color: var(--warn);
  border-color: color-mix(in oklab, var(--warn) 35%, var(--border));
}

.status-pill.error {
  background: var(--surface);
  color: var(--danger);
  border-color: color-mix(in oklab, var(--danger) 35%, var(--border));
}

@keyframes status-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.25); }
}
@media (prefers-reduced-motion: reduce) {
  .status-pill.busy::before { animation: none; }
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 22px 24px 24px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s ease, box-shadow 0.18s ease,
              transform 0.18s ease;
}
.card:hover {
  border-color: color-mix(in oklab, var(--accent) 25%, var(--border));
  box-shadow: var(--shadow-md);
}

.card + .card {
  margin-top: 20px;
}

.card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.card-heading h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.005em;
}

.card-heading p {
  margin: 4px 0 0;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.action-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.card-section {
  margin-top: 18px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.card-section summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
  font-size: var(--text-md);
  list-style: none;
}

.card-section summary::-webkit-details-marker {
  display: none;
}

.card-section summary::after {
  content: "+";
  margin-left: 6px;
  color: var(--text-muted);
}

.card-section[open] summary::after {
  content: "−";
}

/* Hero card on Today */
.hero-card {
  background:
    radial-gradient(800px 200px at 100% 0%, var(--accent-weak), transparent 70%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 28px 22px;
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px 24px;
  box-shadow: var(--shadow-sm);
}
.hero-primary { display: grid; gap: 6px; }
.hero-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.005em;
}
.hero-number {
  font-size: 56px;
  line-height: 1;
  letter-spacing: -0.035em;
  font-weight: 700;
  background: linear-gradient(180deg, var(--text), color-mix(in oklab, var(--accent) 80%, var(--text)));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-hint { font-size: var(--text-sm); }
.hero-actions { align-self: end; }
.hero-secondary {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding-top: 16px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}
.hero-stat { display: grid; gap: 4px; }
.hero-stat-label {
  font-size: var(--text-xxs);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.hero-stat strong { font-size: 20px; font-weight: 600; letter-spacing: -0.015em; }
@media (max-width: 768px) {
  .hero-card { grid-template-columns: 1fr; padding: 22px 18px 18px; }
  .hero-number { font-size: 44px; }
  .hero-actions { justify-self: start; }
  .hero-actions .btn { width: 100%; }
  .hero-secondary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .hero-secondary { grid-template-columns: 1fr 1fr; }
}

/* Collapsible cards (using native <details>) */
.card.collapsible { padding: 0; }
.card.collapsible[open] { padding-bottom: 18px; }
.collapsible-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  user-select: none;
}
.collapsible-summary::-webkit-details-marker { display: none; }
.collapsible-summary h2 { margin: 0; font-size: 16px; }
.collapsible-summary p { margin: 2px 0 0; }
.collapsible-summary:hover { background: var(--surface-2); }
.collapsible-chevron {
  font-size: var(--text-md);
  color: var(--text-muted);
  transition: transform 0.2s ease;
}
details[open] .collapsible-chevron { transform: rotate(180deg); }
.card.collapsible[open] > :not(.collapsible-summary) {
  padding: 0 18px;
}

/* Metrics */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: grid;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.metric-card:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
}

.metric-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metric-card strong {
  font-size: 32px;
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1;
  background: linear-gradient(180deg, var(--text), color-mix(in oklab, var(--text) 70%, var(--text-muted)));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.metric-hint {
  font-size: var(--text-xs);
}

/* Next-step card */
.next-step .next-step-text {
  font-size: 16px;
  margin: 0;
}

/* Forms */
.form-grid,
.detail-form,
.provider-grid,
.suggest-inputs,
.account-grid,
.admin-create-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.suggest-inputs {
  margin-bottom: 12px;
  grid-template-columns: 2fr 1fr 1fr;
}

.account-grid {
  grid-template-columns: 1fr 1fr auto;
}

.admin-create-grid {
  grid-template-columns: 1fr 1fr auto auto;
}

.wide {
  grid-column: span 2;
}

/* Always span the entire grid row (column-count-agnostic). Use for
   textareas, full notes, or layout helpers that need their own row. */
.form-row-full {
  grid-column: 1 / -1;
}
#personaSuggestionHost:empty {
  display: none;
}

.detail-form .wide {
  grid-column: span 4;
}

.detail-actions {
  grid-column: span 4;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.schedule-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* Companies layout */
.companies-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 16px;
  align-items: stretch;
}

.watchlist {
  position: sticky;
  top: 24px;
  align-self: stretch;
  display: flex;
  flex-direction: column;
}
.watchlist .company-list {
  flex: 1;
  min-height: 240px;
}
.companies-layout .company-detail {
  align-self: stretch;
}
/* Tighter empty state for the Companies detail surface so the right
   card doesn't tower over the watchlist when nothing is selected. */
.company-detail #companyEmptyState.empty {
  padding: 20px 16px;
  margin: 0;
}

.company-list {
  display: grid;
  gap: 6px;
  max-height: 60vh;
  overflow-y: auto;
}

.company-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}

.company-item:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.company-item.active {
  background: var(--accent-weak);
  border-color: rgba(37, 99, 235, 0.35);
}

.company-status {
  display: block;
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--text-soft);
  flex: none;
}

.company-status.watching {
  background: var(--success);
}

.company-status.needs-setup {
  background: var(--warn);
}

.company-text {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.company-title {
  font-weight: 600;
  font-size: var(--text-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.company-meta {
  font-size: var(--text-xs);
}

/* AI Provider mode picker — three large radio cards */
.ai-modes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.ai-mode {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  display: grid;
  gap: 6px;
  transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}
.ai-mode:hover:not(:disabled) {
  border-color: var(--border-strong);
}
.ai-mode[aria-checked="true"] {
  border-color: var(--accent);
  background: var(--accent-weak);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--accent) 30%, transparent);
}
.ai-mode:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.ai-mode-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ai-mode-head strong { font-size: var(--text-md); font-weight: 600; }
.ai-mode p { margin: 0; font-size: 12.5px; line-height: 1.45; }

.ai-byok-pane {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.ai-byok-pane .btn { justify-self: start; }

.ai-advanced summary {
  cursor: pointer;
  color: var(--text-muted);
  font-size: var(--text-sm);
  padding: 8px 0;
  list-style: none;
}
.ai-advanced summary::-webkit-details-marker { display: none; }
.ai-advanced summary::before { content: "▸ "; transition: transform 0.2s; display: inline-block; }
.ai-advanced[open] summary::before { transform: rotate(90deg); }

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

/* View transition — subtle fade+slide when switching nav items */
.view {
  animation: view-enter 0.22s ease-out;
}
@keyframes view-enter {
  /* No opacity fade — even a transient fade-in dips text contrast
     below WCAG 1.4.3 (4.5:1) during the keyframe, which axe-core
     flags on every audit pass (2026-05-19 audit). The translateY
     slide-up alone preserves the visual transition without
     touching text contrast. */
  from { transform: translateY(4px); }
  to { transform: none; }
}
/* Respect users who prefer reduced motion — disable the view-enter
   slide entirely. WCAG 2.3.3 (animation-from-interactions) is met
   by either small/short animations OR a way to disable them. */
@media (prefers-reduced-motion: reduce) {
  .view {
    animation: none;
  }
}

/* List-item stagger — first ~10 items fade up with a small delay each */
.jobs-list .job-item,
.company-list .company-item,
.imported-list .imported-row {
  animation: list-row-enter 0.32s ease-out backwards;
}
.jobs-list .job-item:nth-child(1),
.company-list .company-item:nth-child(1),
.imported-list .imported-row:nth-child(1) { animation-delay: 0ms; }
.jobs-list .job-item:nth-child(2),
.company-list .company-item:nth-child(2),
.imported-list .imported-row:nth-child(2) { animation-delay: 30ms; }
.jobs-list .job-item:nth-child(3),
.company-list .company-item:nth-child(3),
.imported-list .imported-row:nth-child(3) { animation-delay: 60ms; }
.jobs-list .job-item:nth-child(4),
.company-list .company-item:nth-child(4),
.imported-list .imported-row:nth-child(4) { animation-delay: 90ms; }
.jobs-list .job-item:nth-child(5),
.company-list .company-item:nth-child(5),
.imported-list .imported-row:nth-child(5) { animation-delay: 120ms; }
.jobs-list .job-item:nth-child(6),
.company-list .company-item:nth-child(6),
.imported-list .imported-row:nth-child(6) { animation-delay: 150ms; }
.jobs-list .job-item:nth-child(7),
.company-list .company-item:nth-child(7),
.imported-list .imported-row:nth-child(7) { animation-delay: 180ms; }
.jobs-list .job-item:nth-child(8),
.company-list .company-item:nth-child(8),
.imported-list .imported-row:nth-child(8) { animation-delay: 210ms; }
.jobs-list .job-item:nth-child(n + 9),
.company-list .company-item:nth-child(n + 9),
.imported-list .imported-row:nth-child(n + 9) { animation-delay: 240ms; }

@keyframes list-row-enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .view,
  .jobs-list .job-item,
  .company-list .company-item,
  .imported-list .imported-row { animation: none; }
}

/* Inline form-status message — sits below a form, replaces toast for
   permanent results. .is-error → red, .is-success → green, default muted. */
.form-status {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 8px 0 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 20px;
}
.form-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-soft);
}
.form-status.is-saving::before { background: var(--accent); animation: form-status-pulse 1.2s ease-in-out infinite; }
.form-status.is-success { color: var(--success); }
.form-status.is-success::before { background: var(--success); }
.form-status.is-error { color: var(--danger); }
.form-status.is-error::before { background: var(--danger); }
@keyframes form-status-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.55; }
}

/* Application form: collapsible "extras" group */
.application-extras {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 10px 14px;
  background: var(--surface-2);
}
.application-extras summary {
  cursor: pointer;
  color: var(--text-muted);
  font-size: var(--text-sm);
  padding: 6px 0;
  list-style: none;
}
.application-extras summary::-webkit-details-marker { display: none; }
.application-extras summary::before { content: "▸ "; transition: transform 0.2s; display: inline-block; }
.application-extras[open] summary::before { transform: rotate(90deg); }
.application-extras .field { margin-top: 10px; }

/* Topbar cmd-K launcher button */
.cmdk-launcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--text-sm);
  transition: border-color 0.12s ease, color 0.12s ease;
}
.cmdk-launcher:hover {
  border-color: var(--border-strong);
  color: var(--text);
}
.cmdk-launcher svg { width: 14px; height: 14px; }
.cmdk-launcher-kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 5px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-soft);
}
@media (max-width: 480px) {
  .cmdk-launcher-text { display: none; }
  .cmdk-launcher-kbd { display: none; }
}

/* Command palette (cmd-K / ctrl-K) */
.cmdk-dialog {
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 0;
  width: min(620px, 92vw);
  max-height: 70vh;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  margin-top: 14vh;
}
.cmdk-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}
.cmdk { display: flex; flex-direction: column; max-height: inherit; }
.cmdk-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.cmdk-icon { width: 18px; height: 18px; color: var(--text-muted); flex: none; }
.cmdk-input-row input {
  flex: 1;
  border: 0;
  background: transparent;
  font-size: 16px;
  padding: 0;
  min-height: 0;
  outline: none;
}
.cmdk-input-row input:focus-visible { box-shadow: none; border: 0; }
.cmdk-kbd, .cmdk-foot kbd {
  font-family: var(--font-mono);
  font-size: var(--text-xxs);
  padding: 2px 6px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text-muted);
}
.cmdk-results {
  list-style: none;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  flex: 1;
}
.cmdk-section {
  padding: 8px 12px 4px;
  font-size: var(--text-xxs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-soft);
}
.cmdk-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: var(--text-md);
}
.cmdk-item .cmdk-item-meta {
  margin-left: auto;
  color: var(--text-soft);
  font-size: var(--text-xs);
}
.cmdk-item.active,
.cmdk-item:hover {
  background: var(--accent-weak);
  color: var(--accent-text);
}
.cmdk-item svg { width: 16px; height: 16px; color: currentColor; flex: none; opacity: 0.85; }
.cmdk-foot {
  display: flex;
  gap: 16px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.cmdk-foot span { display: inline-flex; align-items: center; gap: 4px; }
@media (max-width: 480px) {
  .cmdk-dialog { width: 100vw; max-width: 100vw; margin: 0; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .cmdk-foot { font-size: 10px; }
}

/* Settings tabs */
.settings-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.settings-tab {
  flex: 1;
  min-width: max-content;
  padding: 8px 14px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  border-radius: 7px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease;
}
.settings-tab[aria-selected="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.settings-tab:hover { color: var(--text); }

/* Friendlier queue-empty state */
.queue-empty {
  padding: 48px 32px;
  display: grid;
  gap: 12px;
  justify-items: center;
}
.queue-empty-icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-weak);
  color: var(--accent-text);
}
.queue-empty-icon svg { width: 32px; height: 32px; }
.queue-empty-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.queue-empty .btn { margin-top: 4px; }

/* "New since yesterday" pulse dot before the job title */
.fresh-dot {
  display: inline-block;
  vertical-align: middle;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 color-mix(in oklab, var(--accent) 60%, transparent);
  animation: fresh-pulse 2.4s ease-out infinite;
}
@keyframes fresh-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--accent) 60%, transparent); }
  70% { box-shadow: 0 0 0 8px color-mix(in oklab, var(--accent) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--accent) 0%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .fresh-dot { animation: none; }
}

/* Keyboard-focused queue row */
.job-item.kbd-focused {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-color: var(--accent);
}

/* Skeleton loaders — show while data is fetching, smoother than "Loading..." text */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 0%, color-mix(in oklab, var(--surface-2) 60%, var(--text-soft)) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
  display: block;
}
.skeleton-row {
  display: grid;
  gap: 8px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.skeleton-row .skeleton.title { height: 16px; width: 65%; }
.skeleton-row .skeleton.sub { height: 12px; width: 45%; }
.skeleton-row .skeleton.tag { height: 14px; width: 80px; border-radius: 999px; }
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
}

/* Empty state */
.empty {
  display: grid;
  gap: 10px;
  padding: 32px 24px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(400px 200px at 50% 0%, var(--accent-weak), transparent 80%),
    var(--surface-2);
  text-align: center;
  color: var(--text-muted);
  justify-items: center;
}
.empty-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-weak);
  color: var(--accent-text);
  margin-bottom: 4px;
}
.empty-icon svg { width: 26px; height: 26px; }
.empty .btn { margin-top: 4px; }

.empty p {
  margin: 0;
}

.empty .btn {
  justify-self: center;
}

/* Suggestion list — grid of curated companies / starter templates */
.suggestion-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.suggestion {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface);
  display: grid;
  gap: 4px;
  transition: border-color 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
}
.suggestion:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.suggestion strong {
  font-size: var(--text-md);
  font-weight: 600;
  letter-spacing: -0.005em;
}

.suggestion span {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.suggestion .btn {
  margin-top: 8px;
  justify-self: start;
}

.suggestion-score {
  display: inline-block;
  margin-top: 6px;
  font-size: var(--text-xxs);
  color: var(--accent-text);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.suggestion .btn {
  margin-top: 6px;
}

/* Jobs */
.jobs-list {
  display: grid;
  gap: 10px;
}

.job-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.job-main h3 {
  margin: 0 0 4px;
  font-size: 15px;
  letter-spacing: -0.005em;
}

.job-main .job-sub {
  margin: 0 0 8px;
  font-size: var(--text-sm);
}

.job-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.job-source {
  font-size: var(--text-xxs);
  font-weight: 600;
  color: var(--warn);
  background: var(--warn-weak);
  border-radius: 999px;
  padding: 2px 8px;
}

.confidence {
  font-size: var(--text-xxs);
  font-weight: 600;
  color: var(--success);
  background: var(--success-weak);
  border-radius: 999px;
  padding: 2px 8px;
}

.confidence.low {
  color: var(--warn);
  background: var(--warn-weak);
}

.confidence.bad {
  color: var(--danger);
  background: var(--danger-weak);
}

.job-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.job-actions .btn {
  min-width: 100px;
  justify-content: center;
}

.job-actions .brief-btn,
.job-actions .analyze-btn {
  display: none;
}

.job-item.imported .brief-btn,
.job-item.imported .analyze-btn {
  display: inline-flex;
}

.job-item.imported .import-btn {
  background: var(--success-weak);
  color: var(--success);
  border-color: #b6eccd;
}

/* Imported jobs short list */
.imported-list {
  display: grid;
  gap: 8px;
}

.imported-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.12s ease, background 0.12s ease;
}
.imported-row:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}
@media (max-width: 480px) {
  .imported-row {
    flex-direction: column;
    align-items: stretch;
  }
  .imported-row .action-group { display: flex; gap: 6px; }
  .imported-row .btn { flex: 1; }
}

.imported-row strong {
  display: block;
  font-size: var(--text-md);
}

.imported-row .muted {
  font-size: var(--text-xs);
}

/* Activity feed */
.activity-list {
  display: grid;
  gap: 8px;
}

.activity-item {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  font-size: var(--text-sm);
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.activity-item:hover {
  background: var(--surface-2);
  border-color: var(--border);
}

.activity-dot {
  width: 8px;
  height: 8px;
  margin: 0 auto;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--success) 22%, transparent);
}

.activity-item.warn .activity-dot {
  background: var(--warn);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--warn) 22%, transparent);
}

.activity-item.error .activity-dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--danger) 22%, transparent);
}

.activity-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-text strong { font-weight: 600; color: var(--text); }

.activity-time {
  font-size: var(--text-xs);
  white-space: nowrap;
}

/* Brief view */
.brief-textarea {
  width: 100%;
  min-height: 280px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.5;
}

.provider-summary {
  margin: 0;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  color: var(--text);
}

/* History */
.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.history-item strong {
  font-size: var(--text-md);
}

.history-item p {
  margin: 0;
  font-size: var(--text-sm);
}

.code-block {
  margin: 0;
  padding: 10px;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: var(--text-xs);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
  max-height: 240px;
  overflow-y: auto;
}

/* Admin users */
.admin-users-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.admin-user {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.admin-user.inactive {
  opacity: 0.7;
  background: var(--surface-2);
}

.admin-user-info strong {
  display: block;
  font-size: var(--text-md);
}

.admin-user-info span {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.admin-user-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-user-controls .pw-inline {
  display: flex;
  align-items: center;
  gap: 6px;
}

.admin-user-controls input {
  width: 160px;
  min-height: 32px;
}

.admin-user-controls select {
  width: 110px;
  min-height: 32px;
}

.admin-user-controls .btn {
  min-height: 32px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: var(--text-xxs);
  font-weight: 600;
  letter-spacing: 0.01em;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  line-height: 1.5;
}

.tag.admin {
  background: var(--accent-weak);
  color: var(--accent-text);
  border-color: rgba(37, 99, 235, 0.3);
}

.tag.inactive {
  background: var(--danger-weak);
  color: var(--danger);
  border-color: #f0bdbd;
}

.tag.you {
  background: var(--surface-2);
  color: var(--text);
  border-style: dashed;
}

/* Confirm dialog */
.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: grid;
  place-items: center;
  z-index: 60;
  padding: 16px;
}

.dialog {
  width: min(420px, 100%);
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 22px 22px 18px;
  box-shadow: var(--shadow-lg);
}

.dialog h2 {
  margin: 0 0 8px;
  font-size: 16px;
}

.dialog p {
  margin: 0 0 18px;
  color: var(--text-muted);
  font-size: var(--text-md);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Toast */
.toast-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 10px;
  z-index: 70;
  max-width: 380px;
}

.toast {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  padding: 11px 14px 11px 12px;
  font-size: var(--text-sm);
  box-shadow: var(--shadow-lg);
  display: grid;
  grid-template-columns: 6px 1fr;
  gap: 10px;
  align-items: center;
  animation: toast-enter 0.22s ease-out;
}
.toast::before {
  content: "";
  align-self: stretch;
  border-radius: 3px;
  background: var(--text-soft);
}

.toast.error::before { background: var(--danger); }
.toast.success::before { background: var(--success); }
.toast.info::before { background: var(--accent); }

.toast.error {
  border-color: color-mix(in oklab, var(--danger) 35%, var(--border));
  color: var(--text);
}
.toast.success {
  border-color: color-mix(in oklab, var(--success) 35%, var(--border));
  color: var(--text);
}
.toast.info {
  border-color: color-mix(in oklab, var(--accent) 30%, var(--border));
  color: var(--text);
}

@keyframes toast-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
}
@media (max-width: 480px) {
  .toast-root { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}

/* Scan result */
.scan-result {
  margin: 12px 0 0;
  font-size: var(--text-sm);
}

/* Manual HTML */
.manual-grid {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.manual-grid .btn {
  justify-self: start;
}

/* Segmented control — pill-style modern toggle */
.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  gap: 2px;
}

.segmented-btn {
  border: 0;
  background: transparent;
  padding: 5px 12px;
  font-size: var(--text-sm);
  /* Use --text (not --text-muted) for inactive tab labels — the
     active state is distinguished by background + bold, so the
     text colour can stay high-contrast for WCAG 1.4.3 (4.5:1) per
     axe-core 4.10 audit 2026-05-19. The earlier --text-muted color
     computed to ~3.0:1 against the surface palette. */
  color: var(--text);
  cursor: pointer;
  border-radius: 6px;
  font-weight: 500;
  transition: background 0.12s ease, color 0.12s ease;
}

.segmented-btn + .segmented-btn {
  border-left: 0;
}

.segmented-btn:hover {
  color: var(--text);
}

.segmented-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* Provider hint */
.provider-hint {
  margin: 12px 0 0;
}

/* Ops */
.ops-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Legal pages */
.legal-body {
  background: var(--bg);
}

.legal-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 24px 64px;
  display: grid;
  gap: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-top: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.legal-page header h1 {
  margin: 8px 0 4px;
  font-size: 24px;
  letter-spacing: -0.01em;
}

.legal-page section h2 {
  margin: 0 0 8px;
  font-size: 16px;
}

.legal-page p,
.legal-page li {
  font-size: var(--text-md);
  line-height: 1.55;
}

.legal-back {
  display: inline-block;
  margin-bottom: 16px;
  color: var(--accent-text);
  text-decoration: none;
  font-size: var(--text-sm);
}

.legal-back:hover {
  text-decoration: underline;
}

.retention-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.retention-table th,
.retention-table td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.retention-table thead th {
  background: var(--surface-2);
}

.legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.legal-links a {
  color: var(--accent-text);
}

.legal-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.legal-footer a {
  color: var(--accent-text);
}

.share-panel {
  margin-top: 24px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.share-panel h3 {
  margin: 0 0 4px;
  font-size: var(--text-md);
}
.share-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.share-url-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
  flex-wrap: wrap;
}
.share-url-row code {
  flex: 1 1 320px;
  padding: 6px 10px;
  background: var(--surface-2, var(--surface));
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  word-break: break-all;
}

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

.queue-empty-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 12px;
}

.reply-rate-card .reply-rate-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px;
}
.reply-rate-card .reply-rate-figure {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 96px;
}
.reply-rate-card .reply-rate-figure strong {
  font-size: 32px;
  letter-spacing: -0.02em;
  color: var(--accent-text);
}
.reply-rate-card #replyRateInsight {
  flex: 1 1 320px;
  margin: 0;
}

.skill-gaps-card .skill-gaps-list {
  list-style: decimal inside;
  padding: 0;
  margin: 8px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.skill-gaps-card .skill-gaps-list li {
  padding: 8px 12px;
  background: var(--surface-2, var(--surface));
  border: 1px solid var(--border);
  border-radius: 8px;
}
.skill-gaps-card .skill-gaps-headline {
  margin: 0;
}
.skill-gaps-card .skill-gaps-examples {
  margin: 4px 0 0;
}

.fit-gaps {
  list-style: disc inside;
  padding: 0;
  margin: 8px 0 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.fit-gaps li {
  margin: 2px 0;
}
.fit-gaps strong {
  color: var(--text);
}

.auth-consent {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.auth-consent-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.auth-consent-row a {
  color: var(--accent-text);
  margin-left: 4px;
}

.subscription-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.subscription-actions .btn {
  align-self: flex-start;
}

.signup-cta {
  margin-top: 32px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-align: center;
}
.signup-cta h2 {
  margin: 0 0 4px;
}
.signup-cta p {
  margin: 4px 0;
}

/* Auxiliary auth screens (forgot password / reset / invite accept) */
.auth-aux {
  max-width: 460px;
  margin: 64px auto;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.auth-aux h1 {
  margin: 0 0 8px;
  font-size: 20px;
}

.auth-aux p {
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: var(--text-md);
}

.auth-aux form {
  display: grid;
  gap: 14px;
}

.auth-aux .auth-meta {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.invite-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-weak);
  color: var(--accent-text);
  font-size: var(--text-xs);
  font-weight: 600;
}

.invitation-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.invitation-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.invitation-row strong {
  font-size: var(--text-sm);
}

.invitation-row .muted {
  font-size: var(--text-xs);
}

/* Readiness panel */
.readiness-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}

.readiness-list li {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 12px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
}

.readiness-list li:last-child {
  border-bottom: none;
}

.readiness-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: var(--text-xxs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.readiness-status.ok {
  background: var(--success-weak);
  color: var(--success);
}

.readiness-status.partial {
  background: var(--warn-weak);
  color: var(--warn);
}

.readiness-status.missing {
  background: var(--danger-weak);
  color: var(--danger);
}

.readiness-status.unknown {
  background: var(--surface-2);
  color: var(--text-muted);
}

/* Onboarding checklist */
.onboarding-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}

.onboarding-list li {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  align-items: center;
  font-size: var(--text-sm);
  padding: 6px 0;
}

.onboarding-list li.complete {
  color: var(--text-muted);
  text-decoration: line-through;
}

.onboarding-list li::before {
  content: "○";
  color: var(--text-muted);
  font-size: var(--text-md);
}

.onboarding-list li.complete::before {
  content: "✓";
  color: var(--success);
}

.saved-search-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.saved-search-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.12s ease, background 0.12s ease;
}
.saved-search-row:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}
@media (max-width: 480px) {
  .saved-search-row { flex-direction: column; align-items: stretch; }
  .saved-search-row .action-group { display: flex; gap: 6px; }
}

.application-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.application-grid .wide {
  grid-column: span 2;
}

.application-grid button[type="submit"] {
  grid-column: span 2;
  justify-self: start;
}

.workspace-picker {
  display: grid;
  gap: 6px;
  padding: 12px 12px 14px;
  margin: 8px -2px 4px;
  border-radius: 9px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.workspace-picker label.muted {
  font-size: var(--text-xxs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  color: var(--text-soft);
}

.workspace-select {
  width: 100%;
  min-height: 32px;
  padding: 4px 8px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
}

.cover-letter-toolbar,
.cv-upload-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

/* Phase 2 #80: section-aware cover-letter panel. */
.cover-letter-sections {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.cover-letter-sections > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-muted);
}
.cover-letter-section-grid {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}
.cover-letter-section h4 {
  margin: 0 0 6px;
  font-size: 0.95rem;
  color: var(--text);
}
.cover-letter-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.cover-letter-section-body {
  margin: 0;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  max-height: 240px;
  overflow-y: auto;
}
.cover-letter-citations {
  margin: 0;
  padding: 0;
  list-style: none;
}
.cover-letter-citation {
  padding: 6px 0;
  border-bottom: 1px dashed var(--border-subtle);
}
.cover-letter-citation:last-child {
  border-bottom: 0;
}
.cover-letter-citation summary {
  cursor: pointer;
  font-size: 0.9rem;
}
.cover-letter-citation-sources {
  margin: 6px 0 0;
  padding: 0 0 0 18px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cover-letter-citation-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
}
.cover-letter-citation-tag-cv {
  background: rgba(64, 156, 255, 0.18);
  color: var(--text);
}
.cover-letter-citation-tag-jd {
  background: rgba(120, 200, 120, 0.18);
  color: var(--text);
}
.cover-letter-citation-tag-inference {
  background: rgba(200, 160, 80, 0.18);
  color: var(--text);
}

/* Phase 2 #80 in-context-highlight: render the surrounding CV/JD
   context with the cited excerpt wrapped in <mark> for visual
   verification. "Excerpt not located" warning gets a subtle amber
   tone so the user can tell at a glance that this claim needs
   manual review. */
.cover-letter-citation-context {
  margin: 4px 0 4px 8px;
  padding: 6px 10px;
  border-left: 2px solid var(--border-subtle);
  background: var(--surface);
  font-size: 0.85rem;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.cover-letter-citation-context-match {
  background: rgba(255, 220, 80, 0.4);
  color: var(--text);
  font-weight: 600;
  padding: 0 2px;
  border-radius: 3px;
}
.cover-letter-citation-context-missing {
  display: block;
  color: rgba(220, 140, 40, 0.95);
  font-style: italic;
  font-family: inherit;
}

.application-history {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.application-history h3 {
  margin: 0 0 8px 0;
  font-size: var(--text-md);
  letter-spacing: -0.01em;
}

.application-history ol {
  list-style: decimal;
  padding-left: 18px;
  margin: 0;
}

.application-history li {
  padding: 4px 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.queue-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin-bottom: 12px;
}

.field.inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.job-card.highlighted {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.structured-fit {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.structured-fit strong { color: var(--text); }
.fit-meta { flex: 1; min-width: 0; }
.fit-meta .muted { margin: 0 0 2px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.fit-rec { margin: 0; color: var(--text); font-size: var(--text-md); }
.fit-ring {
  position: relative;
  width: 56px;
  height: 56px;
  flex: none;
  display: grid;
  place-items: center;
}
.fit-ring svg { width: 56px; height: 56px; }
.fit-ring-bg { stroke: var(--border-strong); stroke-width: 3; }
.fit-ring-fg { stroke-width: 3; stroke-linecap: round; transition: stroke-dasharray 0.4s ease; }
.fit-ring-good .fit-ring-fg { stroke: var(--success); }
.fit-ring-warn .fit-ring-fg { stroke: var(--warn); }
.fit-ring-low .fit-ring-fg  { stroke: var(--danger); }
.fit-ring-num {
  position: absolute;
  font-weight: 650;
  font-size: var(--text-lg);
  letter-spacing: -0.02em;
  color: var(--text);
}
.fit-ring-num span { font-size: 9px; vertical-align: super; margin-left: 1px; color: var(--text-muted); }
@media (max-width: 480px) {
  .structured-fit { flex-direction: column; align-items: flex-start; }
}

.support-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.support-grid .wide {
  grid-column: span 2;
}

.support-grid button[type="submit"] {
  grid-column: span 2;
  justify-self: start;
}

.ticket-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.ticket-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 12px;
}

.ticket-row strong {
  display: block;
}

.ticket-row .muted {
  font-size: var(--text-xs);
}

/* Responsive */
@media (max-width: 1024px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .companies-layout {
    grid-template-columns: 1fr;
  }
  .watchlist {
    position: static;
  }
  .form-grid,
  .provider-grid,
  .detail-form,
  .suggest-inputs,
  .account-grid,
  .admin-create-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .detail-form .wide,
  .detail-actions {
    grid-column: span 2;
  }
  .wide {
    grid-column: span 2;
  }
}

/* Application history vertical timeline. */
.timeline { list-style: none; margin: 0; padding: 0.5rem 0 0; }
.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  padding: 0.5rem 0;
  border-left: 0;
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-item:first-child::before { top: 12px; }
.timeline-item:last-child::before { bottom: calc(100% - 12px); }
.timeline-marker {
  position: relative;
  z-index: 1;
  width: 12px;
  height: 12px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface-1);
  box-shadow: 0 0 0 1px var(--border);
}
.timeline-body { display: flex; flex-direction: column; gap: 4px; }
.timeline-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.timeline-when { margin-left: auto; }
.timeline-note { margin: 2px 0 0; }
.status-pill { font-size: 0.8em; }
.status-pill.status-applied { background: var(--accent-weak); color: var(--accent-text); border-color: color-mix(in oklab, var(--accent) 35%, var(--border)); }
.status-pill.status-interview { background: var(--warn-weak); color: var(--warn); border-color: color-mix(in oklab, var(--warn) 35%, var(--border)); }
.status-pill.status-offer,
.status-pill.status-accepted { background: var(--success-weak); color: var(--success); border-color: color-mix(in oklab, var(--success) 35%, var(--border)); }
.status-pill.status-rejected { background: var(--danger-weak); color: var(--danger); border-color: color-mix(in oklab, var(--danger) 35%, var(--border)); }
.status-pill.status-archived { background: var(--surface-2); color: var(--text-muted); }

/* Audit log + AI consent banner — base layout used at all widths. */
.audit-log {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
  font-size: var(--text-sm);
}
.audit-log li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.audit-log li:last-child { border-bottom: 0; }
.audit-row {
  display: grid;
  grid-template-columns: 90px auto 1fr;
  gap: 12px;
  align-items: center;
}
.audit-when {
  font-size: var(--text-xs);
  text-align: right;
  white-space: nowrap;
}
.audit-kind {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--text-xxs);
}
.audit-kind-cv_uploaded,
.audit-kind-ai_consent_granted { background: color-mix(in oklab, var(--success) 18%, var(--surface-2)); color: var(--success); border-color: color-mix(in oklab, var(--success) 50%, transparent); }
.audit-kind-ai_consent_revoked,
.audit-kind-totp_disabled { background: color-mix(in oklab, var(--danger) 16%, var(--surface-2)); color: var(--danger); border-color: color-mix(in oklab, var(--danger) 50%, transparent); }
.audit-kind-totp_enabled,
.audit-kind-managed_ai_waitlist { background: color-mix(in oklab, var(--accent) 18%, var(--surface-2)); color: var(--accent-text); border-color: color-mix(in oklab, var(--accent) 50%, transparent); }
.audit-detail {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  word-break: break-all;
}
@media (max-width: 480px) {
  .audit-row { grid-template-columns: 1fr; gap: 4px; }
  .audit-when { text-align: left; }
}
.ai-consent-banner {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.6rem 0.75rem;
  margin: 0 0 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--accent-weak);
  border-radius: 6px;
}
.ai-consent-banner p { flex: 1; margin: 0; }
.ai-consent-banner .btn { white-space: nowrap; }
.totp-controls .totp-enroll {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.totp-controls code {
  background: var(--surface-2);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.95em;
  word-break: break-all;
}
@media (max-width: 768px) {
  :root {
    --sidebar-width: 0px;
  }
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: sticky;
    top: 0;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 10px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    z-index: 5;
  }
  .sidebar-header {
    border-bottom: 0;
    padding: 0 8px 0 0;
    margin: 0;
    flex: none;
  }
  .sidebar-header .sidebar-title {
    display: none;
  }
  .workspace-picker {
    display: none;
  }
  .nav {
    display: flex;
    flex-direction: row;
    gap: 4px;
    margin: 0;
    flex: 1;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .nav-item {
    padding: 6px 10px;
    border: 1px solid transparent;
    white-space: nowrap;
  }
  .nav-item span:not(.nav-pill) {
    display: none;
  }
  .nav-pill {
    margin-left: 4px;
  }
  .sidebar-footer {
    margin-top: 0;
    padding: 0 0 0 8px;
    border-top: 0;
    border-left: 1px solid var(--border);
    flex: none;
  }
  .user-row .user-info {
    display: none;
  }
  .main {
    padding: 16px;
  }
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .metric-grid {
    grid-template-columns: 1fr 1fr;
  }
  .form-grid,
  .provider-grid,
  .detail-form,
  .suggest-inputs,
  .account-grid,
  .admin-create-grid,
  .application-grid,
  .companies-layout {
    grid-template-columns: 1fr;
  }
  .application-grid button[type="submit"] {
    grid-column: span 1;
  }
  .wide,
  .detail-form .wide,
  .detail-actions {
    grid-column: span 1;
  }
  .schedule-row {
    align-items: flex-start;
  }
  .field.inline {
    grid-template-columns: 1fr;
  }
  .job-item {
    grid-template-columns: 1fr;
  }
  .job-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .admin-user {
    grid-template-columns: 1fr;
  }
  .admin-user-controls {
    width: 100%;
  }
  .admin-user-controls input,
  .admin-user-controls select {
    flex: 1;
    width: auto;
  }
}

@media (max-width: 480px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }
  .toast-root {
    left: 16px;
    right: 16px;
    max-width: none;
  }
  /* Cards: drop horizontal padding so content uses the full width. */
  .card {
    padding: 12px;
  }
  /* Wizard dialog: full-width on phones, smaller padding. */
  .wizard-dialog {
    width: 100vw;
    max-width: 100vw;
    border-radius: 0;
    border: 0;
    height: 100dvh;
    margin: 0;
  }
  .wizard {
    padding: 1rem;
  }
  .wizard-actions,
  .wizard-footer {
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .wizard-actions .btn,
  .wizard-footer .btn {
    width: 100%;
  }
  .wizard-step textarea,
  .wizard-step input,
  .wizard-step select {
    font-size: 16px; /* prevent iOS zoom-on-focus */
  }
  /* Bulk-action bar wraps to a column on phones. */
  .queue-bulk-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .queue-bulk-bar .btn { width: 100%; }
  /* Consent banner: stack the prompt + action. */
  .ai-consent-banner,
  .persona-suggestion {
    flex-direction: column;
    align-items: stretch;
  }
  .ai-consent-banner .btn,
  .persona-suggestion .btn { width: 100%; }
  /* Source filter chips strip — horizontal scroll on phones. */
  .queue-source-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  /* Audit log wraps long entries cleanly. */
  .audit-log li {
    word-break: break-word;
  }
  /* TOTP enrollment block: wider input + URL wraps. */
  .totp-enroll input { width: 100%; }
  .totp-enroll a { word-break: break-all; }
  /* Per-row checkbox sits left of title; widen tap target. */
  .queue-select { transform: scale(1.2); margin-right: 0.75rem; }
}

/* ============================================================
   Chat assistant — bubble + typing animation
   ============================================================ */
/* Transcript + input theme-aware shells. Previously these were
   inline-styled with hardcoded dark-mode hex values (`#13141c`
   background on the transcript, `#1c1c24` on the input) which broke
   light-mode contrast — the body text colour in light mode is dark
   while the transcript stayed dark, yielding ~1:1 contrast (axe-core
   light-mode audit 2026-05-19). Theming via CSS variables fixes it
   in both modes. */
.chat-transcript {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 280px;
  max-height: 520px;
  overflow-y: auto;
  font-size: 14px;
}
.chat-input {
  flex: 1;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.chat-bubble code {
  background: rgba(255,255,255,0.06);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.92em;
}
.chat-bubble strong { color: inherit; font-weight: 600; }
.chat-bubble-typing {
  font-size: 18px;
  letter-spacing: 4px;
  opacity: 0.7;
}
/* Loop 14.1 (2026-05-20): phase-aware narration bubble. Used when
 * typingLabelFor() resolves a specific label (search / tailor /
 * letter / consult / inspire / default "Thinking…"). Italic +
 * dimmed to signal "in-progress, not the real reply". Closes
 * Gate 6.6 ("every >=2s op narrates SOMETHING to the user during
 * the wait"). DE bundle wiring tracked in Phase 2 backlog #75. */
.chat-bubble-narration {
  opacity: 0.7;
  font-style: italic;
}
/* Loop 18 (2026-05-21): Gate 6.8 touch-target spec. Send button +
 * chat input must be >= 44x44px per Apple HIG + Material Design
 * tap-target guidance (avoids fat-finger misses on mobile + tablet).
 * Applied unconditionally (not media-scoped) because larger tap
 * targets are good UX on every screen — Fitts's law applies even
 * on desktop. Pre-fix the send button rendered at 38px tall on
 * all 3 Gate 6.8 viewports (320 / 375 / 768); now 44px+. */
#chatForm .btn,
#chatForm button[type="submit"] {
  min-height: 44px;
}
#chatInput {
  min-height: 44px;
}
.chat-bubble-typing .dot-1,
.chat-bubble-typing .dot-2,
.chat-bubble-typing .dot-3 {
  display: inline-block;
  animation: chat-typing-blink 1.2s infinite;
}
.chat-bubble-typing .dot-2 { animation-delay: 0.2s; }
.chat-bubble-typing .dot-3 { animation-delay: 0.4s; }
@keyframes chat-typing-blink {
  0%, 70%, 100% { opacity: 0.3; transform: translateY(0); }
  35%           { opacity: 1.0; transform: translateY(-2px); }
}

/* ============================================================
   Mobile / responsive — phone (390×844 reference)
   Round-15 add: chat + CV builder + first-run wizard
   ============================================================ */
@media (max-width: 640px) {
  /* Chat transcript: more compact bubbles, full-width input. */
  #chatTranscript {
    min-height: 200px !important;
    max-height: 50vh !important;
    padding: 10px !important;
  }
  #chatForm {
    flex-direction: column;
    gap: 6px !important;
  }
  #chatForm .btn { width: 100%; }
  #chatInput {
    font-size: 16px !important; /* prevent iOS zoom-on-focus */
  }

  /* CV builder: stack the two-column layout (sidebar+main). */
  .cv-builder-layout {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }
  .cv-builder-sidebar {
    flex-direction: row !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  .cv-builder-sidebar .btn { white-space: nowrap; font-size: 13px; }
  #cvBuilderPhotoPanel {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  #cvBuilderActions {
    flex-wrap: wrap;
  }
  #cvBuilderActions .btn { flex: 1 1 calc(50% - 4px); }

  /* First-run wizard: full-width on small screens; bigger tap targets. */
  .wizard-dialog {
    width: 96vw !important;
    margin: 6vh auto !important;
  }
  .wizard-step textarea,
  .wizard-step input { font-size: 16px; }
  .wizard-step .btn { min-height: 44px; }

  /* Sidebar nav: hide labels, show only icons on the narrowest phones.
     The user toggles via the menu button (already present). */
}

/* ============================================================
 * RTL scaffolding (4-week plan invariant 15)
 *
 * When the locale registry marks a locale as RTL (Arabic is the
 * Phase 1 case), the JS layer sets `html[dir="rtl"]`. These
 * overrides flip the layout-critical properties so the UI works
 * end-to-end in RTL from day one.
 *
 * Strategy: small, targeted overrides rather than a full logical-
 * property refactor of all 3700+ lines. As translator coverage
 * lands, individual components can opt into more refined RTL via
 * `[dir="rtl"]` selectors. The defaults here keep RTL functional
 * (readable, navigable, no broken alignment) even before any
 * locale-specific polish.
 *
 * Future work: convert margin-left / padding-left / left / right
 * to margin-inline-start / padding-inline-start / inset-inline-*
 * so the cascade auto-flips. That's a Phase 2 refactor scoped
 * separately. The block here is the bridge until that lands.
 */

html[dir="rtl"] {
  /* Default text-align flip for the document */
  text-align: right;
}

html[dir="rtl"] body,
html[dir="rtl"] .app-shell,
html[dir="rtl"] .panel,
html[dir="rtl"] .card,
html[dir="rtl"] .chat-message,
html[dir="rtl"] .job-card,
html[dir="rtl"] .company-card {
  text-align: right;
}

/* Flex direction: the sidebar nav lives on the right in RTL */
html[dir="rtl"] .app-shell {
  flex-direction: row-reverse;
}

/* Form inputs: align text right but keep number / tel / url
 * inputs LTR per Unicode bidi rules (numbers + URLs are
 * inherently LTR even in RTL UIs). */
html[dir="rtl"] input[type="text"],
html[dir="rtl"] input[type="search"],
html[dir="rtl"] input[type="email"],
html[dir="rtl"] input[type="password"],
html[dir="rtl"] textarea,
html[dir="rtl"] select {
  text-align: right;
  direction: rtl;
}
html[dir="rtl"] input[type="number"],
html[dir="rtl"] input[type="tel"],
html[dir="rtl"] input[type="url"],
html[dir="rtl"] code,
html[dir="rtl"] pre,
html[dir="rtl"] .audit-log-entry code,
html[dir="rtl"] .ai-prompt-block {
  direction: ltr;
  text-align: left;
}

/* Icons that face a direction (chevrons, arrows): mirror them */
html[dir="rtl"] .icon-chevron-right,
html[dir="rtl"] .icon-arrow-right,
html[dir="rtl"] .icon-back,
html[dir="rtl"] .icon-forward {
  transform: scaleX(-1);
}

/* Lists: bullet positioning works because list-style-position is
 * outside by default and the browser handles it; we only need to
 * shift the indent. */
html[dir="rtl"] ul,
html[dir="rtl"] ol {
  padding-right: 1.5em;
  padding-left: 0;
}

/* Notifications + toasts: anchor to the inline-start (left in
 * LTR, right in RTL) so they don't collide with the scroll edge */
html[dir="rtl"] .toast,
html[dir="rtl"] .notification {
  right: auto;
  left: 1rem;
}

/* Sidebar (#side-nav) lives on the right in RTL */
html[dir="rtl"] #side-nav,
html[dir="rtl"] .sidebar {
  border-left: 1px solid var(--border-color, #e0e0e0);
  border-right: none;
}

/* Tables: keep numeric columns LTR (numbers read left-to-right
 * universally), but flip header alignment to right */
html[dir="rtl"] table th,
html[dir="rtl"] table td {
  text-align: right;
}
html[dir="rtl"] table td.numeric,
html[dir="rtl"] table td.tabular,
html[dir="rtl"] table td[data-numeric="true"] {
  text-align: left;
  direction: ltr;
}

/* Funnel card (13-plan item 3/13) */
.funnel-card { display: flex; flex-direction: column; gap: 0.8rem; }
.funnel-stages {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.5rem;
  padding: 0;
  margin: 0;
  list-style: none;
}
.funnel-stage {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0.6rem 0.8rem;
  background: var(--surface-elev-1, rgba(255,255,255,0.04));
  border-radius: 8px;
  border: 1px solid var(--border-color, rgba(255,255,255,0.08));
}
.funnel-stage-count {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text, #e8e8f0);
}
.funnel-stage-label {
  font-size: 0.8rem;
  color: var(--text-muted, #a0a0b0);
}
.funnel-rates {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.4rem 1rem;
  margin: 0;
}
.funnel-rates dt {
  font-size: 0.8rem;
  color: var(--text-muted, #a0a0b0);
}
.funnel-rates dd {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}
html[dir="rtl"] .funnel-stage { align-items: flex-end; }
