:root {
  color-scheme: light;
  --canvas: #f5f7fb;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --ink: #172033;
  --ink-strong: #0d1424;
  --muted: #697386;
  --muted-strong: #4c5870;
  --line: #dfe4ec;
  --line-strong: #cdd5df;
  --rail: #101828;
  --rail-muted: #98a2b3;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eaf1ff;
  --success: #117a56;
  --success-soft: #e7f7f0;
  --warning: #a15c07;
  --warning-soft: #fff4db;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 12px 30px rgba(16, 24, 40, 0.07);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --rail-width: 238px;
  --tap: 44px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { min-width: 320px; background: var(--canvas); }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-dark); }
a:hover { color: var(--primary); }

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

button,
.button,
.button-link {
  display: inline-flex;
  min-height: var(--tap);
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 750;
  line-height: 1.2;
  text-decoration: none;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

button:hover,
.button:hover,
.button-link:hover {
  background: var(--primary-dark);
  color: #fff;
  box-shadow: 0 5px 14px rgba(37, 99, 235, 0.18);
}

button:active,
.button:active,
.button-link:active { transform: translateY(1px); }

button:focus-visible,
.button:focus-visible,
.button-link:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.24);
  outline-offset: 2px;
}

button:disabled {
  background: #aeb8c8;
  box-shadow: none;
  cursor: not-allowed;
}

button.is-working { opacity: 0.78; pointer-events: none; }
button.is-working::after {
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 999px;
  content: "";
  animation: cb-spin 700ms linear infinite;
}

button.confirm-armed,
button.confirm-armed:hover {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
  box-shadow: none;
}

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

button.ghost,
.button.ghost,
.button-link.ghost {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

button.ghost:hover,
.button.ghost:hover,
.button-link.ghost:hover {
  border-color: #a9b5c7;
  background: var(--surface-subtle);
  color: var(--ink-strong);
  box-shadow: var(--shadow-sm);
}

button.compact,
.button-link.compact {
  min-height: 34px;
  padding: 6px 9px;
  font-size: 12px;
}

button.selected {
  border-color: #9bb7f8;
  background: var(--primary-soft);
  color: var(--primary-dark);
}

button.danger {
  border-color: #f0b9b4;
  background: var(--danger-soft);
  color: var(--danger);
}

button.danger:hover { background: #ffe0dc; color: #8f1b13; }

input,
textarea,
select {
  width: 100%;
  min-height: var(--tap);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: inset 0 1px 1px rgba(16, 24, 40, 0.02);
}

input::placeholder,
textarea::placeholder { color: #697386; }

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 700;
}

label small { color: var(--muted); font-weight: 500; }

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { color: var(--ink-strong); letter-spacing: -0.025em; }
h1 { margin-bottom: 5px; font-size: clamp(28px, 3vw, 38px); line-height: 1.1; }
h2 { margin-bottom: 5px; font-size: 19px; line-height: 1.25; }
h3 { margin-bottom: 4px; font-size: 16px; }
p { margin-bottom: 0; }
code { border-radius: 5px; padding: 2px 5px; background: #eef1f6; font-size: 0.88em; }

.muted { color: var(--muted); }
.error { color: var(--danger); }

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: var(--rail-width) minmax(0, 1fr);
}

.app-rail {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  overflow-y: auto;
  padding: 20px 14px 16px;
  background: var(--rail);
  color: #fff;
}

.rail-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 6px 26px;
  color: #fff;
  text-decoration: none;
}

.rail-brand:hover { color: #fff; }
.rail-brand > span:last-child { display: grid; }
.rail-brand strong { font-size: 15px; letter-spacing: -0.01em; }
.rail-brand small { color: var(--rail-muted); font-size: 11px; }

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(145deg, #3b82f6, #2563eb);
  color: #fff;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.04em;
  box-shadow: 0 7px 18px rgba(37, 99, 235, 0.28);
}

.rail-nav { display: grid; gap: 24px; }
.rail-group { display: grid; gap: 4px; }
.rail-group-label {
  padding: 0 10px 7px;
  color: #a8b1c1;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.rail-link {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  border-radius: 9px;
  padding: 9px 10px;
  color: #b9c1cf;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}

.rail-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.rail-link.active { background: rgba(59,130,246,0.18); color: #fff; }
.rail-link.active .rail-icon { color: #79a7ff; }
.rail-icon { width: 20px; color: #7f8a9e; font-size: 18px; text-align: center; }
.rail-icon svg { display: block; width: 19px; height: 19px; margin: 0 auto; }

.rail-footer {
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding: 18px 5px 0;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.rail-health {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 7px;
  color: var(--rail-muted);
  font-size: 12px;
}

.health-dot { width: 8px; height: 8px; border-radius: 50%; background: #32d583; box-shadow: 0 0 0 3px rgba(50,213,131,0.12); }
.rail-logout { width: 100%; justify-content: flex-start; border: 0; background: transparent; color: #b9c1cf; box-shadow: none; }
.rail-logout:hover { background: rgba(255,255,255,0.06); color: #fff; box-shadow: none; }

.app-workspace { min-width: 0; }
.mobile-appbar, .mobile-dock { display: none; }

.content-frame {
  width: min(100%, 1480px);
  margin: 0 auto;
  padding: 36px clamp(22px, 3vw, 48px) 60px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.page-head > div:first-child { max-width: 780px; }
.page-head p { color: var(--muted); font-size: 15px; }
.page-head > form, .page-head > .button-link { flex: 0 0 auto; }
.page-eyebrow { display: block; margin-bottom: 6px; color: var(--primary); font-size: 11px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }

.panel,
.surface {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panel:hover { border-color: #d4dbe6; }
.compact-panel { padding: 15px 17px; }
.panel-head,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-head h2, .section-head h2 { margin-bottom: 0; }
.panel-head a { font-size: 13px; font-weight: 750; text-decoration: none; }
.list-context { margin-bottom: 7px; }

.notice {
  margin: 0 0 18px;
  border: 1px solid #d7deea;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: #f7f9fc;
  color: var(--muted-strong);
  font-weight: 650;
}
.notice.ok { border-color: #b8e4d2; background: var(--success-soft); color: var(--success); }
.notice.warn { border-color: #efd89f; background: var(--warning-soft); color: var(--warning); }
.notice.error { border-color: #f1b7b2; background: var(--danger-soft); color: var(--danger); }

.toast-region {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 40;
  display: grid;
  width: min(400px, calc(100vw - 40px));
  gap: 10px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  animation: cb-toast-in 180ms ease;
}
.toast-ok { border-left-color: var(--success); }
.toast-warn { border-left-color: var(--warning); }
.toast-error { border-left-color: var(--danger); }
.toast-body { flex: 1 1 auto; min-width: 0; font-size: 14px; font-weight: 650; }
.toast-body .inline-notice-form { margin: 6px 0 0; }
.toast-action {
  min-height: 34px;
  border-color: var(--line-strong);
  padding: 6px 11px;
  background: var(--surface);
  color: var(--primary-dark);
  box-shadow: var(--shadow-sm);
  font-size: 12px;
}
.toast-action:hover { background: var(--primary-soft); color: var(--primary-dark); box-shadow: var(--shadow-sm); }
.toast-close {
  min-height: 30px;
  min-width: 30px;
  border: 0;
  padding: 4px 8px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  font-size: 16px;
}
.toast-close:hover { background: var(--surface-subtle); color: var(--ink-strong); box-shadow: none; }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: opacity 160ms ease, transform 160ms ease; }

@keyframes cb-toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

.empty-state { padding: 42px 22px; text-align: center; }
.empty-state h2 { margin-bottom: 6px; }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; margin-top: 18px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat {
  position: relative;
  display: grid;
  min-height: 116px;
  align-content: space-between;
  gap: 5px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 17px 18px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.stat::before { position: absolute; inset: 0 auto 0 0; width: 3px; background: #b9cdfb; content: ""; }
.stat span, .stat small { color: var(--muted); }
.stat span { font-size: 12px; font-weight: 750; letter-spacing: 0.025em; text-transform: uppercase; }
.stat strong { font-size: 31px; line-height: 1; letter-spacing: -0.04em; }
.stat small { font-size: 12px; }
.resume-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.model-name { font-size: 16px !important; overflow-wrap: anywhere; }

.grid.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.55fr);
  gap: 18px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.summary-card {
  position: relative;
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}
.summary-card::after {
  position: absolute;
  top: 15px;
  right: 16px;
  color: var(--muted);
  content: "→";
  font-size: 13px;
  transition: color 140ms ease, transform 140ms ease;
}
.summary-card:hover { border-color: #a9c0f8; color: var(--ink); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.summary-card:hover::after { color: var(--primary); transform: translateX(2px); }
.summary-label { padding-right: 20px; color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: 0.025em; text-transform: uppercase; }
.summary-card strong { color: var(--ink-strong); font-size: 30px; line-height: 1; letter-spacing: -0.04em; }
.summary-card small { color: var(--muted); font-size: 12px; }

.scan-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-color: #bcd0fb;
  background: linear-gradient(100deg, #fff 20%, #edf3ff 100%);
}

.run-progress progress { display: block; width: 100%; height: 12px; margin: 15px 0; accent-color: var(--primary); }
.run-events { max-height: 14rem; margin: 12px 0 0; overflow-y: auto; padding-left: 1.35rem; color: var(--muted); }
.run-events li + li { margin-top: 7px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.inline-form { display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)) auto; gap: 10px; align-items: end; }
.import-form { display: grid; gap: 16px; }
.import-actions, .row-actions, .search-actions, .match-actions, .status-form, .form-actions, .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.opportunity-filters { display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)); gap: 12px; align-items: end; }
.filter-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.actions { align-items: end; }
.form-actions { justify-content: flex-end; margin-top: 17px; }
.checkbox { display: flex; min-height: var(--tap); align-items: center; gap: 9px; }
.checkbox input, .review-confirmation input { width: auto; min-height: 0; }
.inline-notice-form { display: inline-flex; margin-left: 8px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: 0.045em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfe; }
.table-scroll { width: 100%; overflow-x: auto; }

.record-list { display: grid; gap: 10px; }
.opportunity-card {
  display: grid;
  grid-template-columns: minmax(250px, 1.8fr) minmax(155px, 0.8fr) minmax(150px, 0.7fr) minmax(230px, 1fr);
  grid-template-areas: "primary fit meta actions";
  gap: 18px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 17px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.opportunity-card:hover { border-color: #c7d2e3; box-shadow: 0 8px 22px rgba(16,24,40,0.05); }
.opportunity-card.is-dismissed { background: #fbfaf8; opacity: 0.8; }
.opportunity-primary { grid-area: primary; min-width: 0; }
.opportunity-primary h3 { margin: 7px 0 5px; font-size: 16px; }
.opportunity-primary h3 a { color: var(--ink-strong); text-decoration: none; }
.opportunity-primary h3 a:hover { color: var(--primary); }
.opportunity-company { color: var(--muted-strong); font-size: 13px; }
.attribute-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.attribute-chips span { border: 1px solid var(--line); border-radius: 999px; padding: 4px 8px; background: var(--surface-subtle); color: var(--muted-strong); font-size: 11px; font-weight: 700; }
.opportunity-fit { grid-area: fit; }
.opportunity-meta { display: grid; grid-area: meta; align-content: start; gap: 2px; color: var(--ink); font-size: 12px; }
.meta-row { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 0; }
.meta-row + .meta-row { border-top: 1px dashed #edf0f5; }
.meta-label { flex: 0 0 auto; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
.meta-row time, .meta-row .status { flex: 0 0 auto; }
.opportunity-actions { display: grid; grid-area: actions; gap: 9px; justify-items: stretch; }
.opportunity-actions > .button-link { width: 100%; }
.opportunity-actions .status-form {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  grid-template-columns: repeat(3, 1fr);
  box-shadow: var(--shadow-sm);
}
.opportunity-actions .status-form button {
  min-height: 38px;
  border: 0;
  border-radius: 0;
  padding: 7px 9px;
  background: transparent;
  color: var(--muted-strong);
  box-shadow: none;
  font-size: 12px;
}
.opportunity-actions .status-form button + button { border-left: 1px solid var(--line); }
.opportunity-actions .status-form button:hover { background: var(--surface-subtle); color: var(--ink-strong); box-shadow: none; }
.opportunity-actions .status-form button.selected { background: var(--primary-soft); color: var(--primary-dark); font-weight: 800; }
.secondary-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.secondary-actions > * { flex: 1 1 calc(50% - 7px); }
.secondary-actions button, .secondary-actions .button-link { width: 100%; }
.opportunity-card.is-busy { opacity: 0.65; pointer-events: none; }

.source-label,
.status,
.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 3px 8px;
  background: #eef1f6;
  color: var(--muted-strong);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}
.status.ok, .badge.success { background: var(--success-soft); color: var(--success); }
.status.warn { background: var(--warning-soft); color: var(--warning); }
.status.error { background: var(--danger-soft); color: var(--danger); }
.status.stage-new { background: #eef1f6; color: #475467; }
.status.stage-saved { background: var(--primary-soft); color: var(--primary-dark); }
.status.stage-applied { background: var(--success-soft); color: var(--success); }
.fit-score { display: inline-grid; width: 48px; height: 48px; place-items: center; border-radius: 13px; background: #eef1f6; color: var(--muted-strong); font-size: 18px; font-weight: 850; }
.fit-score.tier-strong, .fit-score.tier-good { background: var(--success-soft); color: var(--success); }
.fit-score.tier-stretch { background: var(--warning-soft); color: var(--warning); }
.fit-score.tier-low { background: var(--danger-soft); color: var(--danger); }
.fit-cell > strong, .fit-cell > small, .opportunity-fit > strong, .opportunity-fit > small { display: block; margin-top: 4px; }
.fit-cell > small, .opportunity-fit > small { color: var(--muted); font-size: 11px; }
.fit-details, .error-details { margin-top: 8px; max-width: 440px; color: var(--muted); font-size: 12px; }
.fit-details summary, .error-details summary { color: var(--primary-dark); cursor: pointer; font-weight: 750; }
.fit-details p, .fit-details ul, .error-details ul { margin: 7px 0; }
.fit-details ul, .error-details ul { padding-left: 18px; }
.fit-error { display: block; margin-top: 5px; color: var(--warning); overflow-wrap: anywhere; }
.match-reason { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }

.filter-tabs { display: flex; gap: 7px; margin: 0 0 13px; overflow-x: auto; padding: 1px 1px 4px; scrollbar-width: none; }
.filter-tabs::-webkit-scrollbar { display: none; }
.filter-tabs a { display: inline-flex; min-height: 36px; flex: 0 0 auto; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 999px; padding: 7px 11px; background: var(--surface); color: var(--muted-strong); font-size: 12px; font-weight: 750; text-decoration: none; }
.filter-tabs a.active, .filter-tabs a:hover { border-color: #a9c0f8; background: var(--primary-soft); color: var(--primary-dark); }
.filter-tabs span { font-size: 10px; }
.fit-dot { display: inline-block; width: 8px; height: 8px; flex: 0 0 auto; border-radius: 999px; background: #c3ccd9; }
.fit-dot.tier-strong, .fit-dot.tier-good { background: var(--success); }
.fit-dot.tier-stretch { background: var(--warning); }
.fit-dot.tier-low { background: var(--danger); }
.fit-tabs { margin-top: -5px; }
.match-controls { display: grid; grid-template-columns: minmax(240px, 1fr) 190px auto; gap: 10px; align-items: end; }
.match-controls .search-actions { display: flex; gap: 8px; }

.match-list { display: grid; list-style: none; padding: 0; margin: 0; }
.match-list li { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.match-list li:last-child { border-bottom: 0; }
.match-list div { display: grid; gap: 2px; min-width: 0; }
.match-list strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match-list span { color: var(--muted); }

.pagination { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin: 18px 0 0; }
.pagination a:last-child { justify-self: end; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chips span { border: 1px solid #cbdafc; border-radius: 999px; padding: 5px 9px; background: var(--primary-soft); color: var(--primary-dark); font-size: 11px; font-weight: 750; }

.filter-bar { display: grid; grid-template-columns: minmax(200px, 1.5fr) repeat(4, minmax(125px, 0.7fr)) 150px auto; gap: 9px; align-items: end; margin: 15px 0 18px; }
.row-card { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; background: var(--surface-subtle); }
.match-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); padding: 17px 2px; }
.match-card h3 { margin: 6px 0 3px; }
.match-card .actions { flex: 0 0 auto; }

.upload-form { display: grid; grid-template-columns: minmax(280px, 1fr) auto; gap: 12px; align-items: end; }
.resume-text-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.resume-editor textarea { min-height: 500px; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 12px; line-height: 1.55; }
.warning-panel { border-color: #ead394; background: #fffaf0; }
.danger-panel { display: flex; align-items: center; justify-content: space-between; gap: 18px; border-color: #f0c5c1; background: #fffbfa; }
.review-confirmation { display: flex; align-items: flex-start; gap: 9px; margin-top: 16px; }
.change-notes { display: grid; gap: 10px; margin-top: 14px; }
.change-notes article { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; background: var(--surface-subtle); }
.change-notes p { margin: 5px 0; }
.setting-card { margin-top: 14px; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--surface-subtle); }
.setting-card form { margin-top: 12px; }
.settings-tabs { position: sticky; top: 14px; z-index: 8; width: fit-content; max-width: 100%; border: 1px solid var(--line); border-radius: 999px; padding: 5px; background: rgba(255,255,255,.94); box-shadow: var(--shadow-sm); backdrop-filter: blur(12px); }
.settings-tabs a { border: 0; background: transparent; }
.settings-section { scroll-margin-top: 82px; }
.settings-section-head { grid-column: 1 / -1; margin-bottom: 2px; }
.settings-section-head p { margin-top: 3px; }
.advanced-fields { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-subtle); }
.advanced-fields > summary, .settings-disclosure > summary { display: flex; min-height: var(--tap); align-items: center; padding: 10px 12px; color: var(--muted-strong); cursor: pointer; font-size: 13px; font-weight: 750; }
.advanced-fields-grid, .advanced-options { display: grid; gap: 12px; border-top: 1px solid var(--line); padding: 12px; }
.form-grid > .advanced-fields { grid-column: 1 / -1; }
.settings-advanced { grid-column: 1 / -1; }
.settings-disclosure { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-subtle); }
.settings-disclosure > form, .settings-disclosure > p, .settings-disclosure > .error { margin: 0; border-top: 1px solid var(--line); padding: 14px; }
.setting-card.settings-disclosure { padding: 0; }
.setting-card.settings-disclosure > p, .setting-card.settings-disclosure > form { margin: 0; border-top: 1px solid var(--line); padding: 12px 14px; }

.import-table td:first-child, .import-table th:first-child { width: 42px; }
.import-table td { max-width: 340px; }
.import-table td a { overflow-wrap: anywhere; }

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 20px;
  background: radial-gradient(circle at 20% 10%, #dbe7ff 0, transparent 34%), linear-gradient(145deg, #f8fafc, #eef2f8);
}
.login-panel { width: min(410px, 100%); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 30px; background: var(--surface); box-shadow: var(--shadow-md); }
.login-panel::before { display: grid; width: 46px; height: 46px; place-items: center; margin-bottom: 20px; border-radius: 13px; background: linear-gradient(145deg, #3b82f6, #2563eb); color: white; content: "CB"; font-size: 13px; font-weight: 850; box-shadow: 0 8px 18px rgba(37,99,235,.22); }
.login-panel form { display: grid; gap: 14px; margin-top: 20px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

@media (max-width: 1180px) {
  :root { --rail-width: 210px; }
  .opportunity-card { grid-template-columns: minmax(230px, 1.4fr) 125px minmax(150px, .7fr); grid-template-areas: "primary fit meta" "primary actions actions"; }
  .opportunity-actions { grid-template-columns: minmax(200px, 1fr) minmax(280px, 1.4fr); align-items: start; }
  .filter-bar { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
}

@media (max-width: 960px) {
  .stats-grid, .resume-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.dashboard-grid { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid, .inline-form, .resume-text-grid { grid-template-columns: 1fr; }
  .opportunity-card { grid-template-columns: minmax(0, 1fr) 120px; grid-template-areas: "primary fit" "meta meta" "actions actions"; }
  .opportunity-actions { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  :root { --radius: 11px; }
  body { font-size: 14px; }
  .app-shell { display: block; }
  .app-rail { display: none; }
  .app-workspace { min-height: 100vh; }

  .mobile-appbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    min-height: 58px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--line);
    padding: 9px 16px;
    background: rgba(255,255,255,0.94);
    backdrop-filter: blur(16px);
  }
  .mobile-brand { display: flex; align-items: center; gap: 9px; color: var(--ink-strong); text-decoration: none; }
  .mobile-brand .brand-mark { width: 32px; height: 32px; border-radius: 9px; }
  .mobile-more { position: relative; }
  .mobile-more > summary { display: grid; min-height: 38px; place-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 0 11px; color: var(--muted-strong); cursor: pointer; font-size: 12px; font-weight: 750; list-style: none; }
  .mobile-more > summary::-webkit-details-marker { display: none; }
  .mobile-more nav { position: absolute; top: 46px; right: 0; display: grid; width: 210px; gap: 3px; border: 1px solid var(--line); border-radius: 12px; padding: 8px; background: var(--surface); box-shadow: var(--shadow-md); }
  .mobile-more nav a { min-height: 42px; border-radius: 7px; padding: 10px; color: var(--ink); font-weight: 650; text-decoration: none; }
  .mobile-more nav a:hover { background: var(--surface-subtle); }
  .mobile-more nav button { width: 100%; }

  .mobile-dock {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 25;
    display: grid;
    min-height: 66px;
    grid-template-columns: repeat(4, 1fr);
    border-top: 1px solid var(--line);
    padding: 6px 8px calc(5px + env(safe-area-inset-bottom));
    background: rgba(255,255,255,0.96);
    box-shadow: 0 -8px 24px rgba(16,24,40,0.07);
    backdrop-filter: blur(16px);
  }
  .mobile-dock a { display: grid; min-height: 50px; place-items: center; align-content: center; gap: 1px; border-radius: 9px; color: var(--muted); text-decoration: none; }
  .mobile-dock a > span { font-size: 20px; line-height: 1; }
  .mobile-dock a > span svg { display: block; width: 21px; height: 21px; }
  .mobile-dock a small { font-size: 10px; font-weight: 750; }
  .mobile-dock a.active { background: var(--primary-soft); color: var(--primary-dark); }

  .content-frame { width: 100%; padding: 24px 13px calc(88px + env(safe-area-inset-bottom)); }
  h1 { font-size: 28px; }
  .page-head { align-items: stretch; flex-direction: column; gap: 15px; margin-bottom: 19px; }
  .page-head > form, .page-head > .button-link, .page-head button { width: 100%; }
  .panel { margin-bottom: 13px; padding: 16px; }
  .panel-head, .section-head { align-items: flex-start; }
  .stats-grid, .resume-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .stat { min-height: 102px; padding: 14px; }
  .stat strong { font-size: 26px; }
  .stat span { font-size: 10px; }

  .match-controls, .upload-form, .filter-bar, .opportunity-filters { grid-template-columns: 1fr; }
  .search-actions > *, .upload-form button { flex: 1; }
  .filter-tabs { margin-right: -13px; padding-right: 13px; }
  .filter-tabs a { min-height: 40px; }

  .toast-region { top: 66px; right: 12px; bottom: auto; left: 12px; width: auto; }

  .opportunity-card { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "primary fit" "meta meta" "actions actions"; gap: 13px; padding: 15px; }
  .opportunity-primary h3 { font-size: 16px; }
  .opportunity-meta { grid-template-columns: 1fr; gap: 0; border-top: 1px solid var(--line); padding-top: 6px; }
  .opportunity-actions { border-top: 1px solid var(--line); padding-top: 12px; }
  .opportunity-actions button, .opportunity-actions .button-link { min-height: var(--tap); }
  .opportunity-actions .status-form button { min-height: 40px; }
  .fit-score { width: 44px; height: 44px; border-radius: 12px; }

  .match-list li { align-items: flex-start; }
  .match-list strong { white-space: normal; }
  .match-list .button-link { min-height: 38px; }
  .scan-banner, .danger-panel, .match-card { align-items: stretch; flex-direction: column; }
  .danger-panel button, .match-card .actions, .match-card .actions > * { width: 100%; }
  .resume-editor textarea { min-height: 360px; }
  .form-actions { align-items: stretch; flex-direction: column; }
  .form-actions > * { width: 100%; }

  .responsive-table, .responsive-table thead, .responsive-table tbody, .responsive-table tr, .responsive-table td { display: block; width: 100%; }
  .responsive-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  .responsive-table tbody { display: grid; gap: 10px; }
  .responsive-table tr { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px 12px; background: var(--surface); }
  .responsive-table td { display: grid; grid-template-columns: minmax(86px, .45fr) minmax(0, 1fr); gap: 10px; border: 0; border-bottom: 1px solid #edf0f5; padding: 9px 0; overflow-wrap: anywhere; }
  .responsive-table td:last-child { border-bottom: 0; }
  .responsive-table td::before { color: var(--muted); content: attr(data-label); font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
  .responsive-table td[data-label=""]::before { display: none; }
  .responsive-table td[data-label=""] { grid-template-columns: 1fr; }
  .responsive-table .row-actions { display: grid; grid-template-columns: repeat(2, 1fr); }
  .responsive-table .row-actions button { width: 100%; }

  .login-panel { padding: 24px; }
  .settings-tabs { top: 66px; }
  .settings-section { scroll-margin-top: 128px; }
}

@media (max-width: 420px) {
  .stats-grid, .resume-stats { grid-template-columns: 1fr 1fr; }
  .wide-stat { grid-column: 1 / -1; }
  .opportunity-meta { grid-template-columns: 1fr; }
}

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