/* SPDX-License-Identifier: Apache-2.0 */
/* Copyright 2026 Aaron K. Clark */

:root {
  color-scheme: light dark;
  --font-ui: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  --font-scale: 1;
  --space-control: 0.72rem;
  --radius: 0.375rem;
  --focus: #0b63ce;
  --danger: #b42318;
  --danger-surface: #fff1f0;
  --success: #176b3a;
  --warning: #8a4b08;
}

html[data-text-size="125"] { --font-scale: 1.25; }
html[data-text-size="150"] { --font-scale: 1.5; }
html[data-density="compact"] { --space-control: 0.48rem; }

html,
html[data-color-mode="light"] {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-subtle: #eef2f5;
  --surface-selected: #e7f1fb;
  --border: #aab4bf;
  --border-strong: #66717d;
  --text: #17212b;
  --text-muted: #4d5a67;
  --accent: #075ea8;
  --accent-hover: #004b87;
  --accent-text: #ffffff;
  --status-bg: #e9edf1;
}

html[data-color-mode="dark"] {
  --bg: #171a1d;
  --surface: #22272b;
  --surface-subtle: #2b3136;
  --surface-selected: #173b59;
  --border: #7d8993;
  --border-strong: #c1c8ce;
  --text: #f4f6f8;
  --text-muted: #c3cbd2;
  --accent: #72b7f2;
  --accent-hover: #a5d2f7;
  --accent-text: #08131d;
  --status-bg: #343b41;
  --danger: #ffb4ab;
  --danger-surface: #5c1b17;
  --success: #8ed7aa;
  --warning: #ffc47b;
}

@media (prefers-color-scheme: dark) {
  html[data-color-mode="system"] {
    --bg: #171a1d;
    --surface: #22272b;
    --surface-subtle: #2b3136;
    --surface-selected: #173b59;
    --border: #7d8993;
    --border-strong: #c1c8ce;
    --text: #f4f6f8;
    --text-muted: #c3cbd2;
    --accent: #72b7f2;
    --accent-hover: #a5d2f7;
    --accent-text: #08131d;
    --status-bg: #343b41;
    --danger: #ffb4ab;
    --danger-surface: #5c1b17;
    --success: #8ed7aa;
    --warning: #ffc47b;
  }
}

html[data-contrast="high"] {
  --bg: Canvas;
  --surface: Canvas;
  --surface-subtle: Canvas;
  --surface-selected: Highlight;
  --border: CanvasText;
  --border-strong: CanvasText;
  --text: CanvasText;
  --text-muted: CanvasText;
  --accent: LinkText;
  --accent-hover: LinkText;
  --accent-text: Canvas;
  --status-bg: Canvas;
  --focus: Highlight;
}

@media (prefers-contrast: more) {
  html[data-contrast="system"] {
    --border: CanvasText;
    --border-strong: CanvasText;
    --text-muted: CanvasText;
  }
}

* { box-sizing: border-box; }
html { font-size: calc(100% * var(--font-scale)); }
body {
  margin: 0;
  min-width: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.5;
}
.font-body, .font-display { font-family: var(--font-ui) !important; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { touch-action: manipulation; }
a { color: var(--accent); text-decoration-thickness: 0.1em; text-underline-offset: 0.15em; }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { line-height: 1.25; margin-block: 0 0.75rem; letter-spacing: 0; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.65rem; }
h3 { font-size: 1.15rem; }
p { max-width: 70ch; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.skip-link {
  position: fixed;
  z-index: 1000;
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.65rem 0.9rem;
  background: var(--surface);
  border: 2px solid var(--border-strong);
  transform: translateY(-180%);
}
.skip-link:focus { transform: translateY(0); }

.app-shell { height: 100vh; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.app-header {
  min-height: 4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem clamp(1rem, 3vw, 2rem);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.wordmark { color: var(--text); font-size: 1.35rem; text-decoration: none; }
.wordmark strong { color: var(--accent); }
.header-actions { display: flex; align-items: center; gap: 0.5rem; }
/* The running build, next to the wordmark. margin-right:auto keeps it hugging the
   wordmark under the header's space-between, so the actions stay pinned right.
   --text-muted is the same token the other secondary header text uses, so it carries
   the same AA contrast in light, dark and forced-colors. */
.app-version {
  margin-right: auto;
  color: var(--text-muted);
  font-family: var(--font-mono, monospace);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.button,
.icon-button,
.seg button,
.tag-chip {
  min-height: 2.75rem;
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: var(--space-control) 0.9rem;
  cursor: pointer;
  font-weight: 650;
  line-height: 1.1;
}
.button-primary, .btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}
.button-primary:hover, .btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.button-secondary, .btn-ghost, .btn {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.button-secondary:hover, .btn-ghost:hover { border-color: var(--border-strong); background: var(--surface-subtle); }
.button-danger, .btn-danger { background: var(--danger-surface); color: var(--danger); border-color: var(--danger); }
.button:disabled, .btn:disabled { cursor: wait; opacity: 0.65; }
.icon-button { width: 2.75rem; padding: 0; background: var(--surface); color: var(--text); border-color: var(--border); }
.btn { min-height: 2.75rem; border-width: 2px; border-style: solid; border-radius: var(--radius); padding: var(--space-control) 0.9rem; cursor: pointer; font-weight: 650; }
.btn.btn-primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.btn-primary:hover { background: var(--accent-hover); color: var(--accent-text); border-color: var(--accent-hover); }
.btn.btn-danger { background: var(--danger-surface); color: var(--danger); border-color: var(--danger); }
.btn-xs { min-height: 2.75rem; padding: 0.4rem 0.65rem; }

.pipeline {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding: 0.65rem clamp(1rem, 3vw, 2rem);
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border);
}
.pipe-stat {
  min-height: 2.75rem;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.7rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.pipe-stat[aria-pressed="true"] { border: 3px solid var(--accent); background: var(--surface-selected); padding: calc(0.45rem - 2px) calc(0.7rem - 2px); }
.pipe-stat .n { font-weight: 750; }
.pipe-total { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.45rem; color: var(--text-muted); }

.workspace { min-height: 0; flex: 1; display: grid; grid-template-columns: minmax(18rem, 24rem) minmax(0, 1fr); overflow: hidden; }
.list-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--border); }
.list-tools { padding: 1rem; border-bottom: 1px solid var(--border); }
.list-heading-row { display: flex; justify-content: space-between; gap: 0.75rem; align-items: baseline; }
.result-count { color: var(--text-muted); white-space: nowrap; }
.search-field, .filter-row label { display: grid; gap: 0.3rem; color: var(--text); font-weight: 650; }
.search-field > span, .filter-row label > span, .field-label { font-size: 0.9rem; }
input, select, textarea, .field-input, .field-textarea, .title-input {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.6rem 0.7rem;
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
}
textarea, .field-textarea { min-height: 7rem; resize: vertical; line-height: 1.5; }
.title-input { font-size: 1.4rem; font-weight: 700; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--focus); }
[aria-invalid="true"] { border-color: var(--danger) !important; }
.field-error, .error-summary { color: var(--danger); font-weight: 650; }
.error-summary { padding: 0.8rem; border: 2px solid var(--danger); border-radius: var(--radius); background: var(--danger-surface); }
.field-help, .settings-help { color: var(--text-muted); font-size: 0.95rem; }
.filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-top: 0.8rem; }
/* Sort spans the lane/status pair: its option labels are far too long for a column. */
.filter-sort { grid-column: 1 / -1; }
.application-list { min-height: 0; overflow-y: auto; list-style: none; margin: 0; padding: 0.6rem; }
.application-list li + li { margin-top: 0.35rem; }
.application-card {
  width: 100%;
  min-height: 4.5rem;
  display: grid;
  gap: 0.25rem;
  padding: 0.7rem;
  text-align: left;
  color: var(--text);
  background: var(--surface);
  border: 2px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
}
.application-card:hover { background: var(--surface-subtle); border-color: var(--border); }
.application-card[aria-current="true"] { background: var(--surface-selected); border-color: var(--accent); }
.application-card-header { display: flex; justify-content: space-between; align-items: start; gap: 0.5rem; }
.ic-title { font-weight: 750; font-size: 1rem; }
.ic-meta, .ic-snippet { color: var(--text-muted); font-size: 0.9rem; }
.badge, .lane-pill, .score-chip {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  color: var(--text);
  background: var(--status-bg);
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.content-pane { min-width: 0; min-height: 0; padding: clamp(1rem, 4vw, 3rem); overflow-y: auto; scroll-padding-top: 1rem; }
.sheet { width: min(100%, 58rem); margin: 0 auto; }
.sheet-title { overflow-wrap: anywhere; }
.sheet-eyebrow { margin-bottom: 0.35rem; color: var(--text-muted); font-size: 0.9rem; font-weight: 650; }
.meta-row { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; margin-top: 1rem; padding-block: 0.8rem; border-block: 1px solid var(--border); }
.meta-row .label { font-weight: 700; }
.view-header { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }
.action-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 1rem; }
.action-row.end { justify-content: flex-end; }
.action-row.split { justify-content: space-between; }
.section-divider { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: grid; gap: 0.3rem; margin-top: 1rem; }
.mono { font-family: var(--font-mono); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.seg button { min-height: 2.75rem; color: var(--text); background: var(--surface); border: 0; border-radius: 0; }
.seg button[aria-selected="true"], .seg button.active { color: var(--accent-text); background: var(--accent); }
.prose-omi { max-width: 72ch; overflow-wrap: anywhere; }
.prose-omi img { max-width: 100%; height: auto; }
.prose-omi pre { max-width: 100%; padding: 0.8rem; overflow-x: auto; background: var(--surface-subtle); }
.prose-omi table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.prose-omi th, .prose-omi td { padding: 0.4rem; border: 1px solid var(--border); }
.empty { width: min(100%, 42rem); margin: 12vh auto 0; text-align: center; }
.empty-title { font-size: 1.4rem; font-weight: 700; }

.settings-tabs { display: flex; gap: 0.35rem; overflow-x: auto; padding-bottom: 0.6rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border); }
.settings-tabs button { flex: 0 0 auto; }
.settings-group { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.resume-upload { display: grid; grid-template-columns: minmax(0, 1fr) minmax(18rem, 0.85fr); gap: 1rem; align-items: end; padding-block: 1rem; border-block: 1px solid var(--border); }
.resume-upload h3 { margin: 0 0 0.25rem; font-size: 1.05rem; }
.resume-upload-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.5rem; align-items: center; }
.resume-preview-wrap h3 { margin: 0 0 0.5rem; font-size: 1.05rem; }
.resume-preview {
  max-height: 32rem;
  margin: 0;
  padding: 0.8rem;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  line-height: 1.5;
}
.resume-preview-empty { padding-block: 0.8rem; border-top: 1px solid var(--border); }
.preference-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.source-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.4rem; }
.source-row { min-height: 2.75rem; display: flex; align-items: center; gap: 0.6rem; }
.source-row input { width: 1.25rem; min-height: 1.25rem; height: 1.25rem; }
.board-list { display: grid; gap: 0.5rem; }
.board-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem; border: 1px solid var(--border); border-radius: var(--radius); }
.board-slug { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.board-add { display: grid; grid-template-columns: minmax(8rem, 0.6fr) minmax(10rem, 1fr) auto; gap: 0.5rem; }
.feed-add { display: grid; grid-template-columns: minmax(10rem, 1fr) auto; gap: 0.5rem; }

.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 1.25rem;
  max-width: calc(100vw - 2rem);
  padding: 0.7rem 1rem;
  color: var(--accent-text);
  background: var(--accent);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius);
  transform: translate(-50%, 150%);
  visibility: hidden;
}
.toast.show { transform: translate(-50%, 0); visibility: visible; }
.dialog { width: min(32rem, calc(100% - 2rem)); padding: 1.25rem; color: var(--text); background: var(--surface); border: 2px solid var(--border-strong); border-radius: var(--radius); }
.dialog::backdrop { background: rgb(0 0 0 / 65%); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1.25rem; }
/* The beta terms run longer than a confirm prompt, so this one is wider and its body
   scrolls rather than pushing the accept button off a short screen. */
.beta-dialog { width: min(40rem, calc(100% - 2rem)); }
.beta-body { max-height: min(60vh, 30rem); overflow-y: auto; }
.beta-body p, .beta-body li { line-height: 1.5; }
.beta-body ul { margin: 0.75rem 0 0; padding-left: 1.25rem; }
.beta-body li { margin-top: 0.6rem; }
/* Terms acceptance on the login form. */
.login-terms { display: flex; align-items: flex-start; gap: 0.55rem; margin-top: 0.9rem; line-height: 1.4; }
.login-terms input {
  /* The generic input rule above sizes text fields (width 100%, 2.75rem tall, padded);
     on the checkbox that swallowed the row and wrapped the label one word per line. */
  width: 1.25rem; height: 1.25rem; min-height: 1.25rem; padding: 0;
  margin: 0.15rem 0 0; flex: none; accent-color: var(--accent);
}
.login-terms > span { flex: 1 1 auto; min-width: 0; }
/* A button that reads as a link — keeps the Terms opener keyboard- and screen-reader
   correct without pretending an in-page dialog trigger is a navigation. */
.link-button {
  padding: 0; color: var(--accent); font: inherit; text-decoration: underline;
  background: none; border: none; cursor: pointer;
}
.confirm-phrase { display: block; margin-top: 1rem; }
.confirm-phrase .field-input { margin-top: 0.35rem; }
.login-overlay { position: fixed; z-index: 200; inset: 0; display: grid; place-items: center; padding: 1rem; background: var(--bg); }
.login-card { width: min(100%, 30rem); padding: 1.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.login-mark { font-size: 1.7rem; }
.login-input { margin-top: 0.5rem; }
.login-btn { width: 100%; margin-top: 1rem; }
.login-error { color: var(--danger); font-weight: 700; }
.login-note, .login-signup { color: var(--text-muted); }
.login-signup-head { font-weight: 750; }
.mobile-actions { display: none; }

@media (max-width: 767px) {
  body { padding-bottom: calc(3.75rem + env(safe-area-inset-bottom)); }
  .app-header { padding-top: max(0.6rem, env(safe-area-inset-top)); }
  .header-actions { display: none; }
  .pipeline { padding-inline: 0.75rem; }
  /* The shell is a fixed-height, overflow-hidden column; on a phone the workspace is a
     plain block inside it, so nothing between the shell and the list was a scroll
     container: the list was clipped and a swipe fell through to a document that cannot
     scroll, which Safari reads as pull-to-refresh (#201). The workspace scrolls, and the
     bounce at either end stays inside it. */
  .workspace { display: block; overflow-y: auto; overscroll-behavior-y: contain; }
  .list-pane { min-height: calc(100vh - 8rem); border-right: 0; }
  .content-pane { display: none; padding: 1rem; }
  body.m-detail .list-pane { display: none; }
  body.m-detail .content-pane { display: block; }
  .view-header { display: block; }
  .view-header .seg { margin-top: 0.8rem; }
  .form-grid, .form-grid.three, .preference-grid, .source-grid, .board-add, .feed-add, .resume-upload, .resume-upload-actions { grid-template-columns: 1fr; }
  .mobile-actions {
    position: fixed;
    z-index: 90;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface);
    border-top: 1px solid var(--border);
  }
  .mobile-actions button { min-height: 3.75rem; padding: 0.35rem; color: var(--text); background: var(--surface); border: 0; border-right: 1px solid var(--border); font-weight: 650; }
  .mobile-actions #m-list { display: none; }
  body.m-detail .mobile-actions #m-list { display: block; }
  body.m-detail .mobile-actions { grid-template-columns: 1.7fr repeat(3, 1fr); }
  .toast { bottom: calc(4.5rem + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: no-preference) {
  html:not([data-motion="reduce"]) .toast { transition: transform 120ms ease-out; }
}

html[data-motion="reduce"] *,
html[data-motion="reduce"] *::before,
html[data-motion="reduce"] *::after {
  scroll-behavior: auto !important;
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

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

@media (forced-colors: active) {
  .button, .btn, .icon-button, .application-card, .pipe-stat, input, select, textarea { forced-color-adjust: auto; }
  .application-card[aria-current="true"], .pipe-stat[aria-pressed="true"] { outline: 3px solid Highlight; outline-offset: -3px; }
}

/* ---- Editorial command-center visual system ----------------------------- */

:root {
  --font-ui: "Bricolage Grotesque", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-reading: "Newsreader", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --radius: 0.7rem;
  --radius-lg: 1rem;
  --radius-xl: 1.35rem;
  --shadow-sm: 0 1px 2px rgb(21 39 52 / 7%), 0 5px 18px rgb(21 39 52 / 4%);
  --shadow-md: 0 18px 48px rgb(21 39 52 / 10%), 0 3px 10px rgb(21 39 52 / 5%);
  --focus: #d97706;
}

html,
html[data-color-mode="light"] {
  --bg: #f3f6f8;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-subtle: #edf2f5;
  --surface-selected: #e6f3f6;
  --border: #d2dce3;
  --border-strong: #8797a4;
  --text: #14212c;
  --text-muted: #536473;
  --text-subtle: #5f6f7b;
  --accent: #086788;
  --accent-hover: #06536f;
  --accent-soft: #e2f2f5;
  --accent-text: #ffffff;
  --status-bg: #edf2f5;
  --danger: #b42318;
  --danger-surface: #fff0ee;
  --success: #167147;
  --warning: #9a5808;
}

html[data-color-mode="dark"] {
  --bg: #0d151b;
  --surface: #131d25;
  --surface-raised: #18242d;
  --surface-subtle: #1d2a33;
  --surface-selected: #143846;
  --border: #30424e;
  --border-strong: #718895;
  --text: #f2f6f7;
  --text-muted: #b8c4ca;
  --text-subtle: #91a1aa;
  --accent: #69c8df;
  --accent-hover: #91d8e9;
  --accent-soft: #14333f;
  --accent-text: #08212b;
  --status-bg: #22313b;
  --danger: #ffb4ab;
  --danger-surface: #491c1a;
  --success: #8dd9ad;
  --warning: #ffc16d;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 24%), 0 6px 20px rgb(0 0 0 / 12%);
  --shadow-md: 0 20px 54px rgb(0 0 0 / 28%), 0 3px 12px rgb(0 0 0 / 18%);
}

@media (prefers-color-scheme: dark) {
  html[data-color-mode="system"] {
    --bg: #0d151b;
    --surface: #131d25;
    --surface-raised: #18242d;
    --surface-subtle: #1d2a33;
    --surface-selected: #143846;
    --border: #30424e;
    --border-strong: #718895;
    --text: #f2f6f7;
    --text-muted: #b8c4ca;
    --text-subtle: #91a1aa;
    --accent: #69c8df;
    --accent-hover: #91d8e9;
    --accent-soft: #14333f;
    --accent-text: #08212b;
    --status-bg: #22313b;
    --danger: #ffb4ab;
    --danger-surface: #491c1a;
    --success: #8dd9ad;
    --warning: #ffc16d;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 24%), 0 6px 20px rgb(0 0 0 / 12%);
    --shadow-md: 0 20px 54px rgb(0 0 0 / 28%), 0 3px 12px rgb(0 0 0 / 18%);
  }
}

html[data-contrast="high"] {
  --surface-raised: Canvas;
  --accent-soft: Canvas;
  --text-subtle: CanvasText;
  --shadow-sm: none;
  --shadow-md: none;
}

body {
  background:
    radial-gradient(circle at 78% -10%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 34rem),
    var(--bg);
  letter-spacing: -0.006em;
}

.font-body { font-family: var(--font-ui) !important; }
.font-display,
h1,
h2,
h3,
.wordmark,
.sheet-title,
.ic-title {
  font-family: var(--font-display) !important;
}
h1 { font-size: clamp(1.4rem, 1.15rem + 0.7vw, 1.85rem); letter-spacing: -0.035em; }
h2 { font-size: clamp(1.8rem, 1.45rem + 1.1vw, 2.55rem); letter-spacing: -0.045em; }
h3 { font-size: 1.15rem; letter-spacing: -0.02em; }

.app-shell {
  height: 100vh;
  height: 100dvh;
}
.app-header {
  position: relative;
  z-index: 20;
  min-height: 4.75rem;
  padding: 0.65rem clamp(1rem, 2.8vw, 2.25rem);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-bottom-color: color-mix(in srgb, var(--border) 78%, transparent);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px);
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  color: var(--text);
}
.brand-mark {
  width: 2.45rem;
  height: 2.45rem;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: var(--accent-text);
  background: var(--accent);
  border-radius: 0.8rem;
  box-shadow: 0 7px 18px color-mix(in srgb, var(--accent) 24%, transparent);
}
.brand-mark svg {
  width: 1.6rem;
  height: 1.6rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.wordmark-copy { display: grid; line-height: 1; }
.wordmark-copy > span { font-size: 1.45rem; letter-spacing: -0.055em; }
.wordmark-copy strong { color: var(--accent); }
.wordmark-copy small {
  margin-top: 0.28rem;
  color: var(--text-subtle);
  font-family: var(--font-mono);
  font-size: 0.61rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.header-actions { gap: 0.65rem; }
.button,
.btn,
.icon-button,
.seg button,
.tag-chip {
  border-width: 1px;
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgb(255 255 255 / 8%);
}
.button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.48rem;
}
.button-icon,
.icon-button svg {
  width: 1.12rem;
  height: 1.12rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-button {
  border-color: var(--border);
  background: var(--surface-subtle);
}
.button-secondary,
.btn-ghost,
.btn {
  border-color: var(--border);
  background: color-mix(in srgb, var(--surface) 94%, var(--accent-soft));
}
.button-secondary:hover,
.btn-ghost:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: var(--accent-soft);
}
.button-primary,
.btn-primary,
.btn.btn-primary,
.btn-apply {
  color: var(--accent-text);
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 7px 18px color-mix(in srgb, var(--accent) 18%, transparent);
}
.button-primary:hover,
.btn-primary:hover,
.btn.btn-primary:hover,
.btn-apply:hover {
  color: var(--accent-text);
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.button-danger,
.btn-danger,
.btn.btn-danger { box-shadow: none; }
.button:active,
.btn:active,
.icon-button:active { transform: translateY(1px); }

.pipeline {
  position: relative;
  min-height: 3.7rem;
  align-items: center;
  gap: 0.3rem;
  padding: 0.5rem clamp(1rem, 2.8vw, 2.25rem);
  background: color-mix(in srgb, var(--surface-subtle) 78%, var(--surface));
  border-bottom-color: var(--border);
  scrollbar-width: thin;
}
.pipeline-label {
  flex: 0 0 auto;
  margin-right: 0.4rem;
  color: var(--text-subtle);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.pipe-stat {
  position: relative;
  min-height: 2.35rem;
  gap: 0.38rem;
  padding: 0.36rem 0.68rem;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  scroll-snap-align: start;
}
.pipe-stat:hover {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}
.pipe-stat[aria-pressed="true"] {
  padding: 0.36rem 0.68rem;
  color: var(--text);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 14%, transparent);
}
.pipe-stat .n {
  min-width: 1.2rem;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-align: center;
}
.pipe-total {
  margin-left: 0.35rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--border);
  font-size: 0.83rem;
}
.pipe-total .n { color: var(--text); font-family: var(--font-mono); font-weight: 700; }
.pipeline-empty { color: var(--text-muted); font-size: 0.9rem; }

.workspace { grid-template-columns: minmax(21rem, 23.5rem) minmax(0, 1fr); }
.list-pane {
  background: color-mix(in srgb, var(--surface) 94%, var(--surface-subtle));
  border-right-color: var(--border);
  box-shadow: 8px 0 28px rgb(20 36 48 / 3%);
}
.list-tools {
  padding: 1.15rem 1rem 1rem;
  background: color-mix(in srgb, var(--surface-subtle) 44%, var(--surface));
  border-bottom-color: var(--border);
}
.list-heading-row { align-items: center; }
.list-heading-row h1 { margin: 0; font-size: 1.35rem; }
.result-count {
  padding: 0.2rem 0.45rem;
  color: var(--text-subtle);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
}
.search-field { margin-top: 1rem; }
.search-control { position: relative; display: block; }
.search-control svg {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 0.78rem;
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: var(--text-subtle);
  stroke-width: 2;
  stroke-linecap: round;
  transform: translateY(-50%);
  pointer-events: none;
}
.search-control input { padding-left: 2.35rem; }
.search-control input::-webkit-search-cancel-button { cursor: pointer; }
.filter-row { gap: 0.65rem; margin-top: 0.7rem; }
.search-field > span,
.filter-row label > span,
.field-label {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.035em;
}
input,
select,
textarea,
.field-input,
.field-textarea,
.title-input {
  border-width: 1px;
  border-color: var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
  box-shadow: inset 0 1px 0 rgb(20 38 50 / 2%);
}
input:hover,
select:hover,
textarea:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}
.application-list {
  padding: 0.65rem;
  scrollbar-color: var(--border) transparent;
}
.application-list li + li { margin-top: 0.25rem; }
.application-card {
  position: relative;
  min-height: 5.8rem;
  grid-template-columns: 2.35rem minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: start;
  padding: 0.75rem 0.65rem;
  overflow: hidden;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0.9rem;
}
.application-card:hover {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.application-card[aria-current="true"] {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 38%, var(--border));
  box-shadow: inset 3px 0 0 var(--accent), var(--shadow-sm);
}
.company-mark {
  width: 2.3rem;
  height: 2.3rem;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 75%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  border-radius: 0.72rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}
.application-card[aria-current="true"] .company-mark {
  color: var(--accent-text);
  background: var(--accent);
  border-color: var(--accent);
}
.application-card-body {
  min-width: 0;
  display: grid;
  gap: 0.28rem;
}
.application-card-header { min-width: 0; align-items: center; }
.ic-title {
  min-width: 0;
  overflow: hidden;
  font-size: 0.97rem;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ic-role,
.ic-snippet {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ic-meta {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  overflow: hidden;
  color: var(--text-subtle);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-chevron {
  align-self: center;
  color: var(--text-subtle);
  font-size: 1.4rem;
  opacity: 0;
}
.application-card:hover .card-chevron,
.application-card[aria-current="true"] .card-chevron { opacity: 1; }
.empty-result {
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  text-align: center;
}

.badge,
.lane-pill,
.score-chip {
  padding: 0.18rem 0.48rem;
  border-color: color-mix(in srgb, currentColor 22%, var(--border));
  border-radius: 999px;
  font-size: 0.69rem;
  letter-spacing: 0.015em;
}
.lane-pill {
  color: var(--text-muted);
  background: var(--surface-subtle);
}
.score-chip {
  color: var(--success);
  background: color-mix(in srgb, var(--success) 10%, var(--surface));
}
.badge[data-status="lead"], .pipe-stat[data-status="lead"] { --stage: #2979b8; }
.badge[data-status="ready"], .pipe-stat[data-status="ready"] { --stage: #0f806d; }
.badge[data-status="applied"], .pipe-stat[data-status="applied"] { --stage: #7357b7; }
.badge[data-status="screen"], .pipe-stat[data-status="screen"] { --stage: #a3600a; }
.badge[data-status="onsite"], .pipe-stat[data-status="onsite"] { --stage: #b84916; }
.badge[data-status="offer"], .pipe-stat[data-status="offer"] { --stage: #237a43; }
.badge[data-status="rejected"], .pipe-stat[data-status="rejected"] { --stage: #ad3440; }
.badge[data-status="passed"], .pipe-stat[data-status="passed"] { --stage: #66737d; }
.badge[data-status] {
  color: color-mix(in srgb, var(--stage) 84%, var(--text));
  background: color-mix(in srgb, var(--stage) 11%, var(--surface));
  border-color: color-mix(in srgb, var(--stage) 28%, var(--border));
}
.pipe-stat[data-status] .n { color: var(--stage); }
html[data-color-mode="dark"] .badge[data-status],
html[data-color-mode="dark"] .pipe-stat[data-status] .n {
  color: color-mix(in srgb, var(--stage) 42%, #ffffff);
}
@media (prefers-color-scheme: dark) {
  html[data-color-mode="system"] .badge[data-status],
  html[data-color-mode="system"] .pipe-stat[data-status] .n {
    color: color-mix(in srgb, var(--stage) 42%, #ffffff);
  }
}

.content-pane {
  padding: clamp(1.25rem, 3vw, 2.75rem);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent-soft) 24%, transparent), transparent 28rem),
    var(--bg);
}
.sheet {
  width: min(100%, 68rem);
  padding: clamp(1.4rem, 3vw, 2.5rem);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}
.view-header { gap: 2rem; }
.view-heading { min-width: 0; }
.sheet-eyebrow {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.65rem;
}
.sheet-eyebrow .filename {
  min-width: 0;
  overflow: hidden;
  color: var(--text-subtle);
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sheet-title {
  margin-bottom: 0.3rem;
  font-size: clamp(2rem, 1.45rem + 1.7vw, 3.1rem);
  font-weight: 680;
}
.role-title {
  color: var(--text-muted);
  font-size: clamp(1.05rem, 0.98rem + 0.35vw, 1.28rem);
}
.seg {
  flex: 0 0 auto;
  padding: 0.22rem;
  background: var(--surface-subtle);
  border-color: var(--border);
  border-radius: 0.85rem;
}
.seg button {
  min-height: 2.35rem;
  padding: 0.5rem 0.72rem;
  border-radius: 0.62rem;
  font-size: 0.82rem;
}
.seg button[aria-selected="true"],
.seg button.active {
  color: var(--text);
  background: var(--surface-raised);
  box-shadow: var(--shadow-sm);
}
.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 1.65rem 0 0;
  padding: 0;
}
.meta-item {
  min-width: 0;
  padding: 0.72rem 0.8rem;
  background: color-mix(in srgb, var(--surface-subtle) 70%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--border) 74%, transparent);
  border-radius: 0.8rem;
}
.meta-item dt {
  margin-bottom: 0.23rem;
  color: var(--text-subtle);
  font-family: var(--font-mono);
  font-size: 0.61rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.meta-item dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
}
.score-value { color: var(--success); font-family: var(--font-mono); font-size: 1.15rem; font-weight: 700; }
.score-value small { margin-left: 0.1rem; color: var(--text-subtle); font-size: 0.62rem; }
.detail-links { margin-top: 1rem; }
.detail-section {
  margin-top: 1.8rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--border);
}
.section-heading { margin-bottom: 1rem; }
.section-heading h3,
.material-header h3 { margin: 0.1rem 0 0; font-size: 1.2rem; }
.section-kicker {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.prose-omi {
  color: var(--text);
  font-family: var(--font-reading);
  font-size: 1.08rem;
  line-height: 1.66;
}
.prose-omi h1,
.prose-omi h2,
.prose-omi h3 {
  margin-top: 1.3em;
  font-family: var(--font-display) !important;
}
.prose-omi > :first-child { margin-top: 0; }
.prose-omi > :last-child { margin-bottom: 0; }
.material-block {
  margin-top: 1.6rem;
  padding: 1.15rem 1.2rem;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent-soft) 88%, var(--surface)), var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border));
  border-radius: var(--radius-lg);
}
.material-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.material-header .field-help { max-width: 44rem; margin: 0.35rem 0 0; }
.material-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.45rem; }
.material-body {
  margin-top: 1rem;
  padding: 1rem;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-radius: 0.75rem;
}
.status-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.workflow-actions,
.danger-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
/* Agent verdict + settings (Settings · Agent, the Fit verdict block on the sheet). */
.verdict-list { margin: 0.35rem 0 0; padding-left: 1.25rem; list-style: disc; }
.agent-log { margin: 0.5rem 0 0; padding: 0; list-style: none; }
.agent-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 640px) { .agent-grid { grid-template-columns: 1fr; } }
.evidence-shot { max-width: 100%; border: 1px solid var(--rule); border-radius: var(--radius); margin-top: 0.5rem; }
.packet-q-flagged { border-left: 3px solid var(--danger); padding-left: 0.75rem; }
.packet-flag { color: var(--danger); }
.packet-excerpt { white-space: pre-wrap; font-size: 0.85rem; max-height: 20rem; overflow: auto; margin-top: 0.5rem; }
.link-status { display: inline-flex; padding: 0.4rem 0.6rem; border-radius: var(--radius); font-weight: 700; }
.link-status.ok { color: var(--success); background: color-mix(in srgb, var(--success) 10%, var(--surface)); }
.link-status.bad { color: var(--danger); background: var(--danger-surface); }

.empty {
  margin-top: 10vh;
  color: var(--text-muted);
}
.empty-illustration {
  width: 6rem;
  height: 6rem;
  display: grid;
  place-items: center;
  margin: 0 auto 1.25rem;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--border));
  border-radius: 2rem;
  transform: rotate(-2deg);
}
.empty-illustration svg {
  width: 4.4rem;
  height: 4.4rem;
  fill: var(--surface);
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.empty-title { color: var(--text); font-size: 1.7rem; }
.empty p { margin-inline: auto; }

.settings-shell { width: min(100%, 76rem); margin: 0 auto; }
.settings-header { margin-bottom: 1.4rem; }
.settings-header h1 { margin-bottom: 0.35rem; }
.settings-header p { margin: 0; color: var(--text-muted); }
.settings-layout {
  display: grid;
  grid-template-columns: 12.5rem minmax(0, 1fr);
  gap: 1.1rem;
  align-items: start;
}
.settings-tabs {
  position: sticky;
  top: 0;
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding: 0.5rem;
  overflow: visible;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.settings-tabs button {
  width: 100%;
  justify-content: flex-start;
  border-color: transparent;
  box-shadow: none;
}
.settings-tabs button[aria-selected="true"] {
  color: var(--text);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
  box-shadow: inset 3px 0 0 var(--accent);
}
#settings-body { min-width: 0; }
#settings-body .sheet { width: 100%; box-shadow: var(--shadow-sm); }

.toast {
  left: auto;
  right: 1.25rem;
  bottom: 1.25rem;
  padding: 0.8rem 1rem;
  background: var(--text);
  border: 1px solid color-mix(in srgb, var(--text) 72%, var(--surface));
  border-radius: 0.85rem;
  box-shadow: var(--shadow-md);
  transform: translate(0, 140%);
}
.toast.show { transform: translate(0, 0); }
.dialog {
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.login-overlay {
  background:
    radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 32rem),
    var(--bg);
}
.login-card {
  width: min(100%, 28rem);
  padding: clamp(1.6rem, 5vw, 2.2rem);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  box-shadow: var(--shadow-md);
}
.login-brand { display: flex; justify-content: center; margin-bottom: 0.9rem; }
.login-brand .brand-mark { width: 3rem; height: 3rem; }
.login-mark {
  margin-bottom: 0.2rem;
  font-size: 2.2rem;
  letter-spacing: -0.065em;
  text-align: center;
}
.login-mark strong { color: var(--accent); }
.login-sub { max-width: none; margin: 0 0 1.35rem; color: var(--text-muted); text-align: center; }
.login-signup-head {
  margin: 1.4rem 0 0.15rem;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.login-signup { margin-top: 0; }
.login-note { font-size: 0.9rem; }
.login-footer { margin: 1.25rem 0 0; padding-top: 1rem; border-top: 1px solid var(--border); text-align: center; }
.login-footer a { font-weight: 700; text-decoration: none; }

html[data-density="compact"] .application-card { min-height: 4.8rem; padding-block: 0.5rem; }
html[data-density="compact"] .sheet { padding: 1.3rem; }

@media (max-width: 1100px) and (min-width: 768px) {
  .workspace { grid-template-columns: minmax(18rem, 21rem) minmax(0, 1fr); }
  .meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-layout { grid-template-columns: 10.5rem minmax(0, 1fr); }
}

@media (max-width: 767px) {
  body { padding-bottom: calc(4.75rem + env(safe-area-inset-bottom)); }
  .app-header {
    min-height: 4.25rem;
    padding: max(0.55rem, env(safe-area-inset-top)) 1rem 0.55rem;
  }
  .brand-mark { width: 2.25rem; height: 2.25rem; border-radius: 0.7rem; }
  .wordmark-copy > span { font-size: 1.32rem; }
  .wordmark-copy small { display: none; }
  .pipeline {
    min-height: 3.4rem;
    padding-inline: 0.75rem;
    scroll-snap-type: x proximity;
  }
  .pipeline-label { margin-right: 0.2rem; }
  .pipe-stat { min-height: 2.2rem; }
  .pipe-total { padding-right: 0.75rem; }
  .list-pane { min-height: calc(100dvh - 7.65rem); }
  .list-tools { padding: 1rem 0.85rem 0.85rem; }
  .application-list { padding: 0.5rem; }
  .application-card { min-height: 5.5rem; padding: 0.7rem 0.55rem; }
  .content-pane {
    padding: 0.75rem 0.75rem calc(6.1rem + env(safe-area-inset-bottom));
    background: var(--bg);
  }
  .sheet {
    padding: 1.15rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-sm);
  }
  .view-header { display: grid; gap: 0.85rem; }
  .view-header .seg { width: max-content; margin-top: 0; }
  .sheet-eyebrow .filename { max-width: 16rem; }
  .sheet-title { font-size: clamp(1.9rem, 8vw, 2.35rem); }
  .meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 1.25rem; }
  .meta-item { padding: 0.65rem; }
  .meta-email dd { font-size: 0.82rem; }
  .detail-section { margin-top: 1.35rem; padding-top: 1.1rem; }
  .prose-omi { font-size: 1.03rem; }
  .material-block { margin-top: 1.25rem; padding: 1rem; }
  .material-header { display: grid; align-items: start; }
  .material-header > .btn { width: 100%; }
  .material-actions { justify-content: flex-start; }
  .material-body { padding: 0.8rem; }
  .status-actions { display: grid; align-items: stretch; }
  .workflow-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .workflow-actions [data-act="applied"],
  .workflow-actions [data-act="blacklist"] { grid-column: 1 / -1; }
  .danger-actions { padding-top: 0.8rem; border-top: 1px solid var(--border); }
  .danger-actions .btn { width: 100%; }
  .content-pane .grid-cols-2,
  .content-pane .grid-cols-3 { grid-template-columns: minmax(0, 1fr) !important; }
  .content-pane .flex:has(> #f-link) { flex-direction: column; }
  #f-autofill { width: 100%; }
  .settings-shell { width: 100%; }
  .settings-header { padding-inline: 0.3rem; }
  .settings-layout { display: block; }
  .settings-tabs {
    position: static;
    display: flex;
    gap: 0.3rem;
    margin-bottom: 0.8rem;
    padding: 0.3rem;
    overflow-x: auto;
    border-radius: 0.85rem;
    scroll-snap-type: x proximity;
  }
  .settings-tabs button {
    width: auto;
    flex: 0 0 auto;
    scroll-snap-align: start;
  }
  .settings-tabs button[aria-selected="true"] { box-shadow: inset 0 -3px 0 var(--accent); }
  #settings-body .sheet { border-radius: 1rem; }
  .mobile-actions {
    min-height: calc(4.65rem + env(safe-area-inset-bottom));
    box-shadow: 0 -10px 32px rgb(16 31 42 / 10%);
  }
  .mobile-actions button {
    min-height: 4.65rem;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 0.15rem;
    padding: 0.35rem 0.25rem;
    border-right-color: var(--border);
    font-size: 0.72rem;
  }
  .mobile-actions button svg {
    width: 1.3rem;
    height: 1.3rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  body.m-detail .mobile-actions { grid-template-columns: 1.45fr repeat(3, 1fr); }
  body.m-detail #m-list { color: var(--accent); background: var(--accent-soft); }
  .toast {
    right: 50%;
    bottom: calc(5.4rem + env(safe-area-inset-bottom));
    transform: translate(50%, 140%);
  }
  .toast.show { transform: translate(50%, 0); }
}

@media (max-width: 420px) {
  .filter-row { grid-template-columns: minmax(0, 1fr); }
  .application-card { grid-template-columns: 2.15rem minmax(0, 1fr); }
  .company-mark { width: 2.1rem; height: 2.1rem; }
  .card-chevron { display: none; }
  .sheet-eyebrow .filename { display: none; }
  .workflow-actions { grid-template-columns: minmax(0, 1fr); }
  .workflow-actions [data-act] { grid-column: 1; width: 100%; }
}

@media (max-width: 340px) {
  .meta-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: no-preference) {
  html:not([data-motion="reduce"]) .button,
  html:not([data-motion="reduce"]) .btn,
  html:not([data-motion="reduce"]) .icon-button,
  html:not([data-motion="reduce"]) .application-card,
  html:not([data-motion="reduce"]) .pipe-stat {
    transition: border-color 140ms ease, box-shadow 140ms ease, transform 100ms ease;
  }
}

@media (forced-colors: active) {
  body,
  .content-pane,
  .login-overlay,
  .material-block { background: Canvas; }
  .sheet,
  .settings-tabs,
  .login-card,
  .company-mark { box-shadow: none; }
  .brand-mark { color: Canvas; background: CanvasText; }
  .badge[data-status],
  .score-chip,
  .lane-pill { color: CanvasText; background: Canvas; border-color: CanvasText; }
}

/* ---- The Ready lane's bulk actions (#186) ------------------------------------ */
/* A checkbox beside each card while the status filter is Ready, and a toolbar above the
   list that acts on the selection in one request. The checkbox sits outside the card
   button (a button cannot contain another control) and gets the same hit target. */
.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-subtle);
}
.bulk-bar .bulk-count { font-weight: 650; color: var(--text); margin-inline-end: auto; }
.application-list-item.selectable {
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 1fr);
  align-items: center;
}
.card-select {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  min-height: 2.75rem;
  cursor: pointer;
}
.card-select input { width: 1.25rem; height: 1.25rem; margin: 0; accent-color: var(--accent); }
.evidence-needs { margin: 0.25rem 0 0 1rem; padding: 0; list-style: disc; }
