/* ============================================
   JOBBORED — base styles
   Legacy token names below are ALIASES ONLY (UX01 C2, DS-01).
   Every value lives in tokens-v2.css; add new values there, never
   here. New CSS should use the --jb-* names directly.
   ============================================ */

:root {
  /* Surfaces */
  --bg: var(--jb-paper);
  --bg-raised: var(--jb-paper);
  --surface: var(--jb-surface);
  --surface-2: var(--jb-paper-2);
  --surface-hover: var(--jb-paper-2);
  --border: var(--jb-line-soft);
  --border-bright: var(--jb-line);
  --divider: var(--jb-line-soft);

  /* Accent — mint fill; text on it uses --jb-on-accent */
  --accent: var(--jb-mint);
  --accent-dim: var(--jb-mint-tint);
  --accent-hover: var(--jb-mint-hover);
  --accent-text: var(--jb-navy);

  /* Ink */
  --text: var(--jb-ink);
  --text-muted: var(--jb-ink-2);
  --text-faint: var(--jb-ink-3);
  --text-soft: var(--jb-ink-2);
  --text-inverse: var(--jb-ink-inverse);

  /* Priority */
  --hot-orange: var(--jb-amber);
  --hot-bg: var(--jb-warn-tint);
  --hot-border: var(--jb-amber-soft);
  --high-yellow: var(--jb-warn);
  --high-bg: var(--jb-yellow-soft);
  --high-border: var(--jb-yellow-tape);

  /* Stage rails */
  --stage-rail-new: var(--jb-stage-new);
  --stage-rail-researching: var(--jb-stage-researching);
  --stage-rail-applied: var(--jb-stage-applied);
  --stage-rail-phone-screen: var(--jb-stage-phone);
  --stage-rail-interviewing: var(--jb-stage-interviewing);
  --stage-rail-offer: var(--jb-stage-offer);
  --stage-rail-rejected: var(--jb-stage-rejected);
  --stage-rail-passed: var(--jb-stage-passed);
  --stage-rail-expired: var(--jb-stage-expired);

  /* Stage pills */
  --status-new-bg: var(--jb-info-bg);
  --status-new-text: var(--jb-navy);
  --status-researching-bg: var(--jb-violet-soft);
  --status-researching-text: var(--jb-violet-ink);
  --status-applied-bg: var(--jb-mint-tint);
  --status-applied-text: var(--jb-navy);
  --status-phone-bg: var(--jb-mint-tint);
  --status-phone-text: var(--jb-accent-ink);
  --status-interviewing-bg: var(--jb-ok-tint);
  --status-interviewing-text: var(--jb-ok);
  --status-offer-bg: var(--jb-mint-soft);
  --status-offer-text: var(--jb-accent-ink);
  --status-rejected-bg: var(--jb-err-tint);
  --status-rejected-text: var(--jb-err);
  --status-passed-bg: var(--jb-paper-3);
  --status-passed-text: var(--jb-ink-2);
  --status-expired-bg: var(--jb-paper-3);
  --status-expired-text: var(--jb-stage-expired);

  /* Fit */
  --fit-high: var(--jb-ok);
  --fit-mid: var(--jb-fit-mid);
  --fit-low: var(--jb-ink-3);

  /* Toasts (opaque tints — a toast sits over content) */
  --toast-success: var(--jb-ok);
  --toast-success-bg: var(--jb-ok-tint);
  --toast-error: var(--jb-err);
  --toast-error-bg: var(--jb-err-tint);
  --toast-info: var(--jb-info);
  --toast-info-bg: var(--jb-info-bg);

  /* Run / task status */
  --status-ok: var(--jb-ok);
  --status-ok-bg: var(--jb-ok-bg);
  --status-ok-border: color-mix(in srgb, var(--jb-ok) 32%, transparent);
  --status-warn: var(--jb-warn);
  --status-warn-bg: var(--jb-warn-bg);
  --status-warn-border: color-mix(in srgb, var(--jb-warn) 34%, transparent);
  --status-err: var(--jb-err);
  --status-err-bg: var(--jb-err-bg);
  --status-err-border: color-mix(in srgb, var(--jb-err) 32%, transparent);
  --status-info: var(--jb-info);
  --status-info-bg: var(--jb-info-bg);
  --status-info-border: color-mix(in srgb, var(--jb-info) 28%, transparent);
  --danger: var(--jb-err);

  /* Typography */
  --font-body: var(--jb-font-legacy-body);
  --font-mono: var(--jb-font-legacy-mono);

  /* Type scale */
  --text-xs: var(--jb-text-xs);
  --text-sm: var(--jb-text-sm);
  --text-base: var(--jb-text-base);
  --text-md: var(--jb-text-md);
  --text-lg: var(--jb-text-lg);
  --text-xl: var(--jb-text-xl);
  --text-2xl: var(--jb-text-2xl);

  /* Spacing (n × 4px) */
  --space-1: var(--jb-space-1);
  --space-2: var(--jb-space-2);
  --space-3: var(--jb-space-3);
  --space-4: var(--jb-space-4);
  --space-5: var(--jb-space-5);
  --space-6: var(--jb-space-6);
  --space-7: var(--jb-space-7);
  --space-8: var(--jb-space-8);
  --space-9: var(--jb-space-9);
  --space-10: var(--jb-space-10);
  --space-12: var(--jb-space-12);
  --space-14: var(--jb-space-14);
  --space-16: var(--jb-space-16);

  /* Radius */
  --radius-sm: var(--jb-radius-sm);
  --radius-md: var(--jb-radius-md);
  --radius-lg: var(--jb-radius-lg);
  --radius-xl: var(--jb-radius-lg);

  /* Shadows */
  --shadow-sm: var(--jb-shadow-sm);
  --shadow-md: var(--jb-shadow-md);
  --shadow-lg: var(--jb-shadow-lg);
  --shadow-hover: var(--jb-shadow-hover);

  /* Pipeline cards */
  --glass-bg: var(--jb-surface);
  --glass-bg-hover: var(--jb-paper-2);
  --glass-stroke: var(--jb-line-strong);
  --radius-card: var(--jb-radius-lg);
  --radius-soft: var(--jb-radius-md);

  /* Transitions */
  --ease: var(--jb-ease);
  --transition: var(--jb-transition-base);

  /* Dossier (Direction F) — aliases of the --jb-dossier-* primitives.
     role.css still redefines some of these locally (DS-02, after casefit). */
  --navy: var(--jb-dossier-navy);
  --navy-soft: var(--jb-dossier-navy-soft);
  --ink: var(--jb-dossier-ink);
  --ink-soft: var(--jb-dossier-ink-soft);
  --mute: var(--jb-dossier-mute);
  --parchment: var(--jb-parchment);
  --parchment-deep: var(--jb-parchment-deep);
  --workshop-bg: var(--jb-workshop-bg);
  --workshop-card: var(--jb-workshop-card);
  --border-strong: var(--jb-dossier-line);
  --mint: var(--jb-dossier-mint);
  --mint-deep: var(--jb-dossier-mint-deep);
  --amber: var(--jb-dossier-amber);
  --crimson: var(--jb-crimson);
  --shadow-soft: var(--jb-shadow-soft);
  --shadow-strong: var(--jb-shadow-strong);
  --serif: var(--jb-font-serif);
  --sans: var(--jb-font-dossier-sans);
  --mono: var(--jb-font-dossier-mono);
}

/* ============================================
   BASE RESET
   ============================================ */

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

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

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

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

::selection {
  background: rgba(89, 203, 137, 0.15);
  color: var(--text);
}

:focus-visible {
  outline: 2px solid var(--jb-focus-color);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes skeletonPulse {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 0.92;
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================
   SETUP SCREEN
   ============================================ */

.setup-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  background: var(--bg);
}

.setup-card {
  max-width: 520px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-lg);
  animation: fadeIn 400ms var(--ease) both;
}

.setup-logo {
  text-align: center;
  margin-bottom: var(--space-8);
}

.setup-logo svg,
.setup-logo__img {
  margin: 0 auto var(--space-4);
  display: block;
  max-width: min(200px, 88vw);
  height: auto;
}

.setup-logo h1 {
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: var(--space-1);
}

.setup-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.setup-steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}

.setup-step {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
}

.step-number {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: var(--text-sm);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.step-content h3 {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-1);
  line-height: 1.4;
}

.step-content p {
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: var(--space-2);
}

.setup-inline-hint {
  font-size: var(--text-xs);
  color: var(--text);
  line-height: 1.5;
  margin-bottom: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.step-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  transition: all var(--transition);
}

.step-link:hover {
  text-decoration: underline;
}

.step-code {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1px var(--space-2);
  color: var(--text-muted);
}

.setup-form-btn {
  margin-top: var(--space-2);
  margin-left: auto;
  margin-right: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--jb-on-accent);
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition:
    background var(--transition),
    filter var(--transition);
}

.setup-form-btn:hover {
  filter: brightness(1.06);
}

.setup-form-btn--secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.setup-form-btn--secondary:hover {
  background: var(--surface);
}

.setup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.setup-status {
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-align: center;
}

.setup-footer {
  text-align: center;
  font-size: var(--text-xs);
  color: var(--text-faint);
}

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

/* ============================================
   SKELETON LOADING
   ============================================ */

.skeleton {
  background: var(--surface-2);
  animation: skeletonPulse 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-heading {
  height: 1.25rem;
  width: 50%;
  margin-bottom: var(--space-3);
}

.skeleton-text {
  height: 0.875rem;
  margin-bottom: var(--space-2);
  width: 100%;
}

.skeleton-card {
  background: var(--glass-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--space-5);
  margin-bottom: var(--space-3);
  box-shadow: var(--shadow-sm);
}

/* ============================================
   TOP BAR
   ============================================ */

.top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  border-bottom: 1px solid var(--border);
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.logo-horizontal {
  display: block;
  height: 36px;
  width: auto;
  max-width: min(168px, 42vw);
  flex-shrink: 0;
}

.logo-text {
  font-size: var(--text-lg);
  font-weight: 800;
  letter-spacing: -0.06em;
  color: var(--text);
}

.logo-text--custom {
  margin: 0;
}

.logo-bored {
  font-weight: 400;
  font-style: italic;
  color: var(--accent);
}

.top-bar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  min-width: 0;
}

.top-bar-actions {
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 3px;
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.last-refresh {
  font-size: var(--text-xs);
  color: var(--text-faint);
  font-family: var(--font-mono);
}

.btn-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  transition: all var(--transition);
}

.btn-icon:hover {
  color: var(--accent);
  background: var(--accent-dim);
}

.btn-icon.loading svg {
  animation: spin 1s linear infinite;
}

.pulse-dot {
  display: none;
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.5s ease-in-out infinite;
}

.btn-icon.loading .pulse-dot {
  display: block;
}

/* ============================================
   AUTH SECTION
   ============================================ */

.auth-section {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.btn-google-signin {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 5px var(--space-3) 5px 5px;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

.btn-google-signin svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  padding: 1px;
}

.btn-google-signin:hover {
  border-color: var(--border-bright);
  box-shadow: var(--shadow-md);
  background: var(--surface-2);
}

.auth-user {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.auth-user-menu-wrap {
  position: relative;
}

.auth-menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  transition: box-shadow var(--transition);
}

.auth-menu-toggle:hover {
  box-shadow: 0 0 0 2px var(--border-bright);
}

.auth-menu-toggle:focus-visible {
  outline: 2px solid var(--jb-focus-color);
  outline-offset: 2px;
}

.auth-user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 1200;
  min-width: min(320px, calc(100vw - 2rem));
  max-width: 380px;
  max-height: min(70vh, 520px);
  overflow: auto;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.auth-user-menu__inner {
  padding: var(--space-4);
}

.auth-user-menu__title {
  margin: 0 0 var(--space-1);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text);
}

.auth-user-menu__lede {
  margin: 0 0 var(--space-3);
  font-size: var(--text-xs);
  line-height: 1.45;
  color: var(--text-muted);
}

.auth-user-menu__signout {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--divider);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition:
    color var(--transition),
    background var(--transition);
}

.auth-user-menu__signout:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.profile-settings--compact .profile-settings-group {
  margin-bottom: var(--space-2);
}

.profile-settings--compact .profile-btn-save {
  width: 100%;
  margin-top: var(--space-2);
}

.settings-setup-wizard-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.settings-setup-wizard-row__btn {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.settings-setup-wizard-row__hint {
  margin: 0;
}

.auth-avatar {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.auth-avatar__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.auth-avatar__img[hidden] {
  display: none !important;
}

.auth-avatar__fallback {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  background: linear-gradient(
    145deg,
    rgba(89, 203, 137, 0.2),
    var(--surface-2)
  );
}

.auth-avatar--show-fallback .auth-avatar__fallback {
  display: flex;
}

.btn-signout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  color: var(--text-faint);
  transition: all var(--transition);
}

.btn-signout:hover {
  color: var(--toast-error);
  background: var(--toast-error-bg);
}

/* ============================================
   MAIN LAYOUT
   ============================================ */

.main-content {
  display: block;
  padding: var(--space-5) var(--space-5) var(--space-8);
}

/* ============================================
   PIPELINE SECTION
   ============================================ */

.pipeline-section {
  min-width: 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.section-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.role-count {
  font-size: var(--text-xs);
  color: var(--text-faint);
  font-family: var(--font-mono);
  background: var(--surface-2);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
}

/* Filter Bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  align-items: center;
}

.filter-buttons {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
}

.filter-btn {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  transition: all var(--transition);
  white-space: nowrap;
}

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

.filter-btn.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: rgba(89, 203, 137, 0.3);
}

.filter-controls {
  display: flex;
  gap: var(--space-2);
  margin-left: auto;
}

/* ── URL paste hero card ──────────────────────────────────────────
   Prominent primary action placed above the Pipeline toolbar. Visual
   weight sits between the section header and the filter bar — a
   distinct surface with a subtle accent so "paste a URL" reads as
   first-class, not as an afterthought in the search/sort row. */
.ingest-url-hero {
  margin-bottom: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.06) 0%,
    rgba(139, 92, 246, 0.04) 100%
  );
  border: 1px solid rgba(59, 130, 246, 0.22);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}

.ingest-url-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    circle at 0% 0%,
    rgba(59, 130, 246, 0.08),
    transparent 60%
  );
}

.ingest-url-hero__body {
  position: relative;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  grid-template-areas:
    "copy copy"
    "form form"
    "foot foot";
  gap: var(--space-3);
  align-items: start;
}

@media (min-width: 900px) {
  .ingest-url-hero__body {
    grid-template-columns: 1fr;
    grid-template-areas:
      "copy"
      "form"
      "foot";
  }
}

.ingest-url-hero__copy {
  grid-area: copy;
}

.ingest-url-hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: var(--space-1);
}

.ingest-url-hero__icon {
  font-size: 1.05em;
}

.ingest-url-hero__title {
  margin: 0 0 var(--space-1) 0;
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.ingest-url-hero__subtitle {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--text-muted);
  max-width: 64ch;
}

.ingest-url-hero__form {
  grid-area: form;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: var(--space-2);
  margin: 0;
}

.ingest-url-hero__input {
  flex: 1 1 320px;
  min-width: 0;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  line-height: 1.3;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.ingest-url-hero__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow:
    0 0 0 3px rgba(59, 130, 246, 0.18),
    0 1px 2px rgba(15, 23, 42, 0.04);
}

.ingest-url-hero__input::placeholder {
  color: var(--text-faint);
}

.ingest-url-hero__submit {
  flex: 0 0 auto;
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--jb-on-accent);
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
  transition: transform var(--transition), box-shadow var(--transition),
    opacity var(--transition);
}

.ingest-url-hero__submit:hover:not([disabled]) {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(59, 130, 246, 0.28);
}

.ingest-url-hero__submit:active:not([disabled]) {
  transform: translateY(0);
}

.ingest-url-hero__submit[disabled] {
  opacity: 0.6;
  cursor: progress;
}

.ingest-url-hero__footnote {
  grid-area: foot;
  margin: 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.ingest-url-hero__manual-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ingest-url-hero__manual-link:hover {
  text-decoration: none;
}

.ingest-manual-slider {
  width: 100%;
  margin-bottom: var(--space-3);
}

#ingestManualUrl {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .ingest-url-hero {
    padding: var(--space-3) var(--space-4);
  }
  .ingest-url-hero__form {
    flex-direction: column;
    align-items: stretch;
  }
  .ingest-url-hero__submit {
    width: 100%;
  }
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: var(--space-2);
  color: var(--text-faint);
  pointer-events: none;
}

.search-input {
  padding: var(--space-1) var(--space-3) var(--space-1)
    calc(var(--space-2) + 20px);
  font-size: var(--text-xs);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  width: 200px;
  transition: all var(--transition);
}

.search-input::placeholder {
  color: var(--text-faint);
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(89, 203, 137, 0.1);
  outline: none;
}

.sort-select {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
}

.sort-select:hover {
  border-color: var(--border-bright);
}

.sort-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(89, 203, 137, 0.1);
  outline: none;
}

.sort-select option {
  background: var(--surface);
  color: var(--text);
}

/* ============================================
   CARD ACTIONS (Write-back)
   ============================================ */

.card-actions {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.card-actions--anon {
  margin-top: 0;
}

.card-actions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.status-field {
  width: 100%;
}

.field-label {
  display: block;
  font-size: var(--jb-type-label);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--jb-ink-2); /* 7.8:1 — AX-08 / SS-18 */
  margin-bottom: var(--space-1);
}

.status-select {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--glass-stroke);
  border-radius: var(--radius-soft);
  cursor: pointer;
  transition: all var(--transition);
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

.status-select:hover {
  border-color: var(--border-bright);
}

.status-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(89, 203, 137, 0.1);
  outline: none;
}

.status-select:disabled {
  opacity: 0.65;
  cursor: wait;
}

.card-actions__tools {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  margin-top: var(--space-3);
}

.followup-label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-muted);
  margin-right: var(--space-1);
}

/* Quick actions */
.quick-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  margin-top: var(--space-2);
}

/* Inline notes */
.notes-wrapper {
  margin-top: var(--space-2);
  width: 100%;
}

.notes-label {
  font-size: var(--text-xs);
  color: var(--text-faint);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-1);
}

.notes-textarea {
  width: 100%;
  min-height: 48px;
  max-height: 120px;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  line-height: 1.5;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--glass-stroke);
  border-radius: var(--radius-soft);
  resize: vertical;
  transition: all var(--transition);
}

.notes-textarea::placeholder {
  color: var(--text-faint);
}

.notes-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(89, 203, 137, 0.1);
  background: var(--surface);
}

.notes-textarea.saving {
  border-color: var(--border-bright);
  background: var(--surface-2);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.toast-container {
  position: fixed;
  bottom: var(--space-5);
  right: var(--space-5);
  z-index: var(--jb-z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

/* SIXBEATS2 NEW-13: the row wraps, and the message keeps a real width.
   `.toast-action-btn` is nowrap + no-shrink, so a long action label ("Copy
   bootstrap command") used to eat the row and squeeze a flex-basis-0
   message down to its min-content width — one word per line, 500px tall,
   over the sign-in gate. Wrapping lets the button drop to its own line
   instead of starving the sentence it belongs to. */
.toast {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  min-width: 240px;
  max-width: 420px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  font-weight: 500;
  animation: toastIn 300ms var(--ease) both;
  pointer-events: auto;
}

.toast.removing {
  animation: toastOut 200ms var(--ease) both;
}

.toast-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.toast-message {
  flex: 1 1 220px;
  min-width: 0;
  overflow-wrap: break-word;
}

.toast-close {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-sm);
  color: inherit;
  opacity: 0.5;
  cursor: pointer;
  transition: opacity var(--transition);
}

.toast-close:hover {
  opacity: 1;
}

.toast-action-btn {
  flex-shrink: 0;
  margin-left: auto;
  padding: var(--space-1) var(--space-3);
  border: 1px solid currentColor;
  border-radius: var(--radius-md);
  background: transparent;
  color: inherit;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  opacity: 0.85;
  white-space: nowrap;
}

.toast-action-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.12);
}

/* Toast variants */
.toast-success {
  background: var(--toast-success-bg);
  color: var(--toast-success);
  border: 1px solid #bbf7d0;
}

.toast-success .toast-icon {
  background: var(--toast-success);
  color: white;
}

.toast-error {
  background: var(--toast-error-bg);
  color: var(--toast-error);
  border: 1px solid #fecaca;
}

.toast-error .toast-icon {
  background: var(--toast-error);
  color: white;
}

.toast-info {
  background: var(--toast-info-bg);
  color: var(--toast-info);
  border: 1px solid rgba(89, 203, 137, 0.3);
}

.toast-info .toast-icon {
  background: var(--toast-info);
  color: white;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  box-shadow: var(--shadow-md);
}

/* Brief empty state (kept from legacy brief) */
.brief-empty {
  text-align: center;
  padding: var(--space-6) var(--space-4);
  color: var(--text-faint);
}

.brief-empty svg {
  margin: 0 auto var(--space-3);
  display: block;
}

.brief-empty p {
  font-size: var(--text-sm);
  max-width: 28ch;
  margin: 0 auto;
  line-height: 1.5;
}

/* ============================================
   EMPTY / ERROR STATE
   ============================================ */

.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-8);
  color: var(--text-faint);
}

.empty-state svg {
  margin: 0 auto var(--space-4);
  display: block;
}

.empty-state h3 {
  color: var(--text-muted);
  font-size: var(--text-base);
  margin-bottom: var(--space-2);
}

.empty-state p {
  font-size: var(--text-sm);
  max-width: 36ch;
  margin: 0 auto;
  line-height: 1.5;
}

.error-state {
  text-align: center;
  padding: var(--space-12) var(--space-8);
  color: var(--text-faint);
}

.error-state svg {
  margin: 0 auto var(--space-4);
  display: block;
  color: var(--hot-orange);
}

.error-state h3 {
  color: var(--text);
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.error-state p {
  font-size: var(--text-sm);
  max-width: 42ch;
  margin: 0 auto var(--space-5);
  line-height: 1.6;
  color: var(--text-muted);
}

.error-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
}

.error-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: all var(--transition);
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--surface);
}

.error-btn:hover {
  border-color: var(--border-bright);
  background: var(--surface-2);
  text-decoration: none;
}

.error-btn-primary {
  background: var(--accent);
  color: var(--jb-on-accent);
  border-color: var(--accent);
}

.error-btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--text-inverse);
}

/* ============================================
   FOOTER
   ============================================ */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-3) var(--space-4);
  padding: var(--space-6) var(--space-5);
  font-size: var(--text-xs);
  color: var(--text-faint);
  border-top: 1px solid var(--border);
}

.site-footer__legal {
  display: flex;
  gap: var(--space-4);
}

.site-legal-noscript {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-4);
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-sm);
  background: var(--bg);
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.site-footer a {
  color: var(--text-faint);
  transition: color var(--transition);
}

.site-footer a:hover {
  color: var(--accent);
}

/* ============================================
   RESPONSIVE
   ============================================ */

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

  .brief-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .command-strip {
    position: static;
    box-shadow: none;
  }
}

@media (max-width: 600px) {
  .brief-stats {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
  }

  .stat-card {
    padding: var(--space-3);
  }

  .stat-card__value {
    font-size: var(--text-xl);
  }

  .donut-layout {
    flex-direction: column;
  }
}

/* 960px — card actions wrap tighter on narrow screens */
@media (max-width: 960px) {
  .card-actions-row {
    gap: var(--space-1);
  }

  .card-action {
    min-height: 2.75rem; /* 44px touch target */
  }
}

@media (max-width: 768px) {
  .brief-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .main-content {
    padding: var(--space-3);
  }

  .command-strip {
    padding: var(--space-3);
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-controls {
    margin-left: 0;
  }

  .search-input {
    width: 100%;
  }

  .filter-buttons {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: var(--space-1);
    -webkit-overflow-scrolling: touch;
  }

  .job-card {
    padding: var(--space-3) var(--space-4);
  }

  .card-actions-row .card-action {
    font-size: 0.6875rem;
    padding: var(--space-1) var(--space-2);
  }

  .top-bar {
    padding: var(--space-2) var(--space-3);
  }

  .last-refresh {
    display: none;
  }

  .toast-container {
    left: var(--space-3);
    right: var(--space-3);
    bottom: var(--space-3);
  }

  .toast {
    min-width: auto;
    max-width: none;
  }
}

@media (max-width: 480px) {
  .logo-text {
    font-size: var(--text-base);
  }

  .logo-horizontal {
    height: 30px;
    max-width: 132px;
  }
}

/* Action meta row — applied date, follow-up date, mark applied button */
.action-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  margin-top: var(--space-2);
}

.action-meta {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.action-meta.overdue {
  color: var(--hot-orange);
}

.overdue-badge {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--hot-orange);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--glass-stroke);
  padding: 2px 6px;
  border-radius: var(--radius-soft);
}

.followup-input {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 2px 6px;
  border: 1px solid var(--glass-stroke);
  border-radius: var(--radius-soft);
  background: rgba(255, 255, 255, 0.55);
  color: var(--text);
  cursor: pointer;
}

.followup-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(89, 203, 137, 0.1);
}

.contact-status-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-top: var(--space-3);
  width: 100%;
}

@media (max-width: 520px) {
  .contact-status-row {
    grid-template-columns: 1fr;
  }
}

.contact-status-field .field-label {
  display: block;
  margin-bottom: var(--space-1);
}

.last-heard-input {
  width: 100%;
  box-sizing: border-box;
  font-size: var(--text-xs);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--glass-stroke);
  border-radius: var(--radius-soft);
  background: rgba(255, 255, 255, 0.55);
  color: var(--text);
}

.last-heard-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(89, 203, 137, 0.1);
}

.last-heard-input.saving {
  opacity: 0.65;
}

.response-select {
  width: 100%;
  box-sizing: border-box;
  font-size: var(--text-xs);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--glass-stroke);
  border-radius: var(--radius-soft);
  background: rgba(255, 255, 255, 0.55);
  color: var(--text);
  cursor: pointer;
}

.response-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(89, 203, 137, 0.1);
}

.response-select:disabled {
  opacity: 0.65;
  cursor: wait;
}

.meta-chip--heard {
  border-color: rgba(89, 203, 137, 0.35);
}

.meta-chip--reply {
  border-color: rgba(16, 185, 129, 0.4);
}
