/* ── Design tokens ──────────────────────────────────────────────────────────
   Light is the default; dark mode is driven by the OS via prefers-color-scheme.
   Shared chrome (body, header, tables, cards, buttons, inputs, tabs) reads from
   these tokens, so every page inherits dark mode. Semantic pills (score / status
   / trust / freshness) keep their light tints and read as bright chips on dark.
   Palette is a signal/instrument-console take on "radar": teal accent + a
   monospace data face for scores, dates and comp, reserved for that role only. */
:root {
  --bg: #eef1f0;
  --surface: #ffffff;
  --surface-2: #f5f7f6;
  --surface-3: #e9edec;
  --ink: #10151a;
  --ink-2: #3d4750;
  --muted: #667179;
  --faint: #98a3a8;
  --line: #dde3e1;
  --line-2: #e7ebe9;
  --brand: #0c1614;
  --accent: #0d9488;
  --accent-soft: #d7f5ef;
  --good: #16a34a;
  --shadow: 0 1px 3px rgba(10,20,18,0.08);
  --shadow-lg: 0 10px 34px rgba(10,20,18,0.16);
  --radius: 8px;
  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #090b0c;
    --surface: #12171a;
    --surface-2: #0e1214;
    --surface-3: #1b2226;
    --ink: #e7f0ee;
    --ink-2: #b7c4c2;
    --muted: #7c8b89;
    --faint: #4f5c5b;
    --line: #212b2a;
    --line-2: #1a2222;
    --brand: #060908;
    --accent: #2dd4bf;
    --accent-soft: #123531;
    --good: #34d399;
    --shadow: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 34px rgba(0,0,0,0.55);
  }
}

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

body {
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
}

/* ── App header ───────────────────────────────────────────────────────────── */
header {
  background: var(--brand);
  color: #fff;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
header h1 { font-size: 1.15rem; font-weight: 650; letter-spacing: 0.02em; }
.brand { display: inline-flex; align-items: center; gap: 9px; }
.brand-blip {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); flex: none;
  box-shadow: 0 0 0 0 rgba(45,212,191,0.55);
  animation: blip-pulse 2.6s ease-out infinite;
}
@keyframes blip-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(45,212,191,0.55); }
  70%  { box-shadow: 0 0 0 7px rgba(45,212,191,0); }
  100% { box-shadow: 0 0 0 0 rgba(45,212,191,0); }
}
@media (prefers-reduced-motion: reduce) { .brand-blip { animation: none; } }
.signal-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: #4ecb8a; margin-right: 6px; vertical-align: middle;
}
.nav-primary { display: flex; gap: 2px; }
.nav-primary a {
  text-decoration: none;
  color: rgba(255,255,255,0.66);
  font-size: 13.5px;
  font-weight: 500;
  padding: 6px 11px;
  border-radius: 7px;
  transition: background 0.12s, color 0.12s;
}
.nav-primary a:hover { color: #fff; background: rgba(255,255,255,0.09); }
.nav-primary a.on { color: #fff; background: rgba(255,255,255,0.14); }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* "More" overflow dropdown — pure CSS via <details> */
.nav-more { position: relative; }
.nav-more > summary {
  list-style: none;
  cursor: pointer;
  color: rgba(255,255,255,0.66);
  font-size: 13.5px;
  font-weight: 500;
  padding: 6px 11px;
  border-radius: 7px;
}
.nav-more > summary::-webkit-details-marker { display: none; }
.nav-more > summary:hover, .nav-more[open] > summary { color: #fff; background: rgba(255,255,255,0.14); }
.nav-more-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 50;
  min-width: 190px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  display: flex;
  flex-direction: column;
}
.nav-more-menu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 13.5px;
  padding: 8px 10px;
  border-radius: 7px;
}
.nav-more-menu a:hover { background: var(--surface-3); }
header button.crawl-btn {
  background: transparent;
  color: rgba(255,255,255,0.82);
  border: 1px solid rgba(255,255,255,0.25);
  padding: 6px 13px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}
header button.crawl-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
header button.crawl-btn.htmx-request { opacity: 0.6; cursor: wait; }
.header-user { font-size: 13px; color: rgba(255,255,255,0.6); }
.logout-btn {
  font-size: 13px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 7px;
  padding: 5px 11px;
  cursor: pointer;
  color: rgba(255,255,255,0.82);
}
.logout-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.crawl-status { font-size: 12px; color: rgba(255,255,255,0.7); min-width: 10ch; }

main { padding: 22px 24px; max-width: 1280px; margin: 0 auto; }

/* Tabs */
.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  position: relative;
}
.tabs::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent 55%);
  background-size: 200% 100%;
  background-position: 100% 0;
  animation: sweep-in 1.1s ease-out 0.1s forwards;
}
@keyframes sweep-in { to { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .tabs::after { animation: none; background-position: 0 0; } }
.tab {
  text-decoration: none;
  color: var(--muted);
  padding: 9px 13px 11px;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  font-weight: 550;
  transition: color 0.1s;
}
.tab:hover { color: var(--ink); }
.tab.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
  font-weight: 650;
}
.badge {
  background: var(--surface-3);
  color: var(--muted);
  border-radius: 10px;
  font-size: 11px;
  padding: 1px 7px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.tab.active .badge { background: var(--accent-soft); color: var(--accent); }

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
thead th {
  background: var(--surface-2);
  text-align: left;
  padding: 11px 13px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--line-2);
  transition: background 0.1s;
}
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child { border-bottom: none; }
td { padding: 11px 13px; vertical-align: middle; color: var(--ink); }

td.company a { color: var(--ink); font-weight: 600; text-decoration: none; }
td.company a:hover { text-decoration: underline; }
.company-display { font-weight: 600; color: var(--ink); cursor: pointer; border-bottom: 1px dashed var(--faint); }
.company-display:hover { border-bottom-color: #666; }
.company-form { display: flex; gap: 4px; }
.company-form input { border: 1px solid #bbb; border-radius: 4px; padding: 2px 6px; font-size: 13px; font-weight: 600; width: 10ch; min-width: 8ch; max-width: 20ch; }
.company-form button { padding: 2px 6px; border: 1px solid #bbb; border-radius: 4px; cursor: pointer; background: #f0f0f0; }
td.rate { color: #2a7a2a; font-weight: 500; white-space: nowrap; font-family: var(--font-mono); font-size: 12.5px; }
td.location { color: #666; font-size: 12px; }
td.date { color: var(--muted); font-size: 11.5px; white-space: nowrap; font-family: var(--font-mono); }
td.score { text-align: center; white-space: nowrap; }
.score-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}
.score-high { background: #dcfce7; color: #166534; }
.score-mid  { background: #fef9c3; color: #854d0e; }
.score-low  { background: #fee2e2; color: #991b1b; }
td.effort { text-align: center; white-space: nowrap; }
.effort-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
}
/* Low effort = "quick win" — reuse the positive score color. */
.effort-low    { background: #dcfce7; color: #166534; }
.effort-medium { background: #fef9c3; color: #854d0e; }
.effort-high   { background: #fee2e2; color: #991b1b; }
td.fit { max-width: 240px; }
.fit-text { font-size: 12px; color: #555; cursor: help; }

/* Status row coloring */
tr.status-new { border-left: 3px solid #3b82f6; }
tr.status-interesting { border-left: 3px solid #f59e0b; }
tr.status-applied { border-left: 3px solid #10b981; }
tr.status-skipped { border-left: 3px solid #d1d5db; opacity: 0.6; }
tr.status-index_page { border-left: 3px solid #8b5cf6; opacity: 0.5; }
tr.status-low_match { border-left: 3px solid #e5e7eb; opacity: 0.4; }
tr.questions-row td { padding: 0; }
tr.questions-row:has(td:empty) { display: none; }

/* Status + Notes selects */
.status-select, .notes-select {
  font-size: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 3px 6px;
  cursor: pointer;
  background: #fff;
  max-width: 120px;
}

/* Notes */
.notes-cell { max-width: 140px; }

/* Delete button */
.delete-btn {
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 3px;
  transition: color 0.1s, background 0.1s;
}
.delete-btn:hover { color: #e53e3e; background: #fff0f0; }

.empty { color: #999; padding: 40px; text-align: center; }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 12px;
}
.page-btn {
  display: inline-block;
  padding: 5px 10px;
  font-size: 13px;
  border: 1px solid #ddd;
  border-radius: 4px;
  text-decoration: none;
  color: #1a1a2e;
  background: #fff;
  cursor: pointer;
}
.page-btn:hover { background: #f0f0f0; }
.page-btn.active { background: #1a1a2e; color: #fff; border-color: #1a1a2e; }
.page-ellipsis { padding: 5px 4px; color: #999; }
.page-info { margin-left: auto; font-size: 12px; color: #999; }

/* Sort toggle */
.sort-toggle {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: #999;
  margin-bottom: 8px;
}
.sort-toggle a {
  text-decoration: none;
  color: #555;
  cursor: pointer;
}
.sort-toggle a.active { color: #1a1a2e; font-weight: 600; text-decoration: underline; }

/* Filter bar (sort + remote + location) */
.filter-bar {
  display: flex;
  gap: 14px;
  align-items: center;
  font-size: 12px;
  color: #999;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.filter-field { display: flex; gap: 5px; align-items: center; }
.filter-field select {
  font-size: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 3px 6px;
  background: #fff;
  cursor: pointer;
}
.filter-field input[type="checkbox"] { cursor: pointer; }

/* Salary badge */
.salary-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  background: #e0e7ff;
  color: #3730a3;
  white-space: nowrap;
}

/* Remote tag */
.remote-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  background: #dcfce7;
  color: #166534;
  margin-right: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Materials button */
.materials-cell { width: 32px; text-align: center; }
.materials-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 2px 4px;
  border-radius: 3px;
  transition: background 0.1s;
}
.materials-btn:hover { background: #fef3c7; }

/* Questions panel */
.questions-panel {
  padding: 16px 20px;
  background: #fffbeb;
  border-top: 1px solid #fde68a;
}
.question-block { margin-bottom: 16px; }
.question-block:last-of-type { margin-bottom: 8px; }
.question-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #92400e;
  margin-bottom: 6px;
}
.question-answer {
  font-size: 13px;
  line-height: 1.6;
  color: #1a1a1a;
  white-space: pre-wrap;
}
.question-answer-regenerating {
  font-size: 12px;
  color: #92400e;
  font-style: italic;
}

/* Inline edit & action buttons per question block */
.question-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.question-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.qa-btn {
  font-size: 11px;
  color: #92400e;
  background: none;
  border: 1px solid #fde68a;
  border-radius: 4px;
  padding: 2px 6px;
  cursor: pointer;
  text-decoration: none;
}
.qa-btn:hover {
  background: #fde68a;
}
.qa-btn.qa-copy.copied {
  background: #dcfce7;
  color: #166534;
  border-color: #bbf7d0;
}
.question-block.editing .question-answer {
  display: none;
}
.question-block.editing .question-header {
  display: block;
}
.question-block form textarea {
  width: 100%;
  font-size: 13px;
  line-height: 1.5;
  padding: 8px;
  border: 1px solid #fde68a;
  border-radius: 4px;
  font-family: inherit;
  resize: vertical;
}
.edit-form-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.qa-save-btn,
.qa-cancel-btn {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid;
}
.qa-save-btn {
  background: #92400e;
  color: #fff;
  border-color: #92400e;
}
.qa-cancel-btn {
  background: #fff;
  color: #555;
  border-color: #ddd;
}
.bundle-btn {
  margin-left: 6px;
}
.questions-actions { margin-top: 8px; }
.regen-btn {
  font-size: 11px;
  color: #92400e;
  background: none;
  border: 1px solid #fde68a;
  border-radius: 4px;
  padding: 3px 8px;
  cursor: pointer;
}
.regen-btn:hover { background: #fde68a; }
.questions-pending {
  padding: 12px 20px;
  font-size: 12px;
  color: #92400e;
  background: #fffbeb;
  border-top: 1px solid #fde68a;
}
.questions-pending a { color: #92400e; margin-left: 8px; }

/* Application outcome (issue #16) */
.outcome-cell { white-space: nowrap; }
.outcome-wrap { display: inline-flex; align-items: center; gap: 3px; }
.outcome-select {
  font-size: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 3px 6px;
  cursor: pointer;
  background: #fff;
  max-width: 110px;
}
.outcome-select.outcome-pending { color: #6b7280; }
.outcome-select.outcome-replied { color: #1d4ed8; font-weight: 600; }
.outcome-select.outcome-interview { color: #7c3aed; font-weight: 600; }
.outcome-select.outcome-offer { background: #dcfce7; color: #166534; font-weight: 700; }
.outcome-select.outcome-rejected { color: #991b1b; }
.outcome-select.outcome-ghosted { color: #9ca3af; font-style: italic; }
.applied-date { display: block; font-size: 10px; color: #999; margin-top: 2px; }
.follow-up-tag { font-size: 12px; cursor: help; }

/* "Follow-up due" — an applied job still pending past the nudge window */
tr.follow-up-due { background: color-mix(in srgb, #f59e0b 12%, var(--surface)); }
tr.follow-up-due:hover { background: color-mix(in srgb, #f59e0b 20%, var(--surface)); }

/* Outcome filter chip row (applied tab) */
.outcome-chips {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.chip {
  text-decoration: none;
  font-size: 12px;
  color: #555;
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid #ddd;
  background: #fff;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.chip:hover { background: #f0f0f0; }
.chip.active { background: #1a1a2e; color: #fff; border-color: #1a1a2e; font-weight: 600; }

/* Application timeline (issue #16 Phase 3) */
tr.events-row td { padding: 0; }
tr.events-row:has(td:empty) { display: none; }

/* More like this — inline row expansion (issue #156 Phase 2) */
tr.similar-row td { padding: 0; }
tr.similar-row:has(td:empty) { display: none; }
tr.similar-row td > div { padding: 12px 20px; margin-bottom: 0 !important; background: #f8fafc; border-top: 1px solid #e2e8f0; }
.events-panel {
  padding: 12px 20px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}
.events-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  margin-bottom: 8px;
}
.events-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.event { display: flex; gap: 10px; align-items: baseline; font-size: 13px; }
.event-time { font-size: 11px; color: #94a3b8; white-space: nowrap; min-width: 92px; }
.event-label { color: #334155; }
.events-empty { font-size: 12px; color: #94a3b8; }
.outcome-text.outcome-offer { color: #166534; }
.outcome-text.outcome-interview { color: #7c3aed; }
.outcome-text.outcome-rejected { color: #991b1b; }
.outcome-text.outcome-ghosted { color: #9ca3af; }

/* One-click follow-up (issue #291) */
tr.followup-row td { padding: 0; }
tr.followup-row:has(td:empty) { display: none; }
.follow-up-panel { padding: 12px 20px; background: #f8fafc; border-top: 1px solid #e2e8f0; }
.follow-up-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #555; margin-bottom: 6px; }
.follow-up-answer { font-size: 13px; line-height: 1.6; color: #1a1a1a; white-space: pre-wrap; margin-bottom: 8px; }
.follow-up-pending, .follow-up-sent-note, .follow-up-blocked-note { font-size: 12px; color: #888; font-style: italic; }

/* Interview prep panel */
tr.prep-row td { padding: 0; }
tr.prep-row:has(td:empty) { display: none; }
.prep-panel {
  padding: 16px 20px;
  background: #eff6ff;
  border-top: 1px solid #bfdbfe;
}
.prep-block { margin-bottom: 16px; }
.prep-block:last-of-type { margin-bottom: 8px; }
.prep-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #1e40af;
  margin-bottom: 6px;
}
.prep-answer {
  font-size: 13px;
  line-height: 1.6;
  color: #1a1a1a;
  white-space: pre-wrap;
}
.prep-actions { margin-top: 8px; }
.prep-regen-btn {
  color: #1e40af;
  border-color: #bfdbfe;
}
.prep-regen-btn:hover { background: #bfdbfe; }
.prep-divider {
  margin: 16px 0 12px;
  border-top: 1px solid #bfdbfe;
  padding-top: 12px;
}
.prep-divider-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #1e40af;
  background: #eff6ff;
  padding: 0 6px;
  position: relative;
  top: -1px;
}
.prep-pending {
  padding: 12px 20px;
  font-size: 12px;
  color: #1e40af;
  background: #eff6ff;
  border-top: 1px solid #bfdbfe;
}
.prep-pending a { color: #1e40af; margin-left: 8px; }

/* Answer source badge */
.answer-source-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 6px;
  margin-left: 6px;
  vertical-align: middle;
}
.bank-badge {
  background: #dcfce7;
  color: #166534;
}
.manual-badge {
  background: #fef9c3;
  color: #854d0e;
}

/* Answer bank page */
.answer-bank-page { max-width: 1000px; }
.answer-bank-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
  gap: 16px;
}
.answer-bank-description {
  font-size: 13px;
  color: #555;
  margin-top: 4px;
  margin-bottom: 12px;
}
.answer-bank-table td { padding: 8px 12px; vertical-align: top; }
.bank-question { font-weight: 500; color: #1a1a2e; }
.bank-answer { color: #555; font-size: 13px; }
.bank-tags { font-size: 11px; color: #888; }
.bank-date { font-size: 11px; color: #999; white-space: nowrap; }
.bank-actions { white-space: nowrap; }
.btn-danger { color: #dc2626; border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; }

/* Pending review queue */
.pending-queue { margin-top: 24px; }
.pending-queue h3 { font-size: 14px; margin-bottom: 8px; color: #555; }

/* Answer bank form */
.answer-bank-form { max-width: 700px; }
.answer-bank-form h2 { margin-bottom: 16px; }
.form-grid { display: flex; flex-direction: column; gap: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; color: #555; }
.form-group textarea,
.form-group input[type="text"] {
  width: 100%;
  font-size: 13px;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: inherit;
}
.form-group small { font-size: 11px; color: #999; margin-top: 2px; }
.form-actions { display: flex; gap: 8px; margin-top: 8px; }
.btn {
  font-size: 13px;
  padding: 6px 16px;
  border-radius: 4px;
  border: 1px solid #ddd;
  background: #fff;
  color: #1a1a2e;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: #f0f0f0; }
.btn-primary {
  background: #1a1a2e;
  color: #fff;
  border-color: #1a1a2e;
}
.btn-primary:hover { background: #2a2a4e; }

/* Duplicate detection page */
.duplicate-card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  margin-bottom: 12px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.duplicate-card.dup-merged {
  border-color: #bbf7d0;
  background: #f0fdf4;
}
.duplicate-card.dup-ignored {
  border-color: #e5e7eb;
  background: #f9fafb;
}
.dup-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 13px;
}
.dup-score {
  font-weight: 700;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
}
.dup-score.score-high { background: #dcfce7; color: #166534; }
.dup-score.score-mid  { background: #fef9c3; color: #854d0e; }
.dup-score.score-low  { background: #fee2e2; color: #991b1b; }
.dup-reason {
  font-size: 11px;
  color: #888;
}
.dup-pair {
  display: flex;
  gap: 12px;
  align-items: stretch;
  margin-bottom: 12px;
}
.dup-job {
  flex: 1;
  padding: 10px;
  border-radius: 4px;
  border: 1px solid #eee;
  background: #fafafa;
}
.dup-job-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #999;
  margin-bottom: 4px;
}
.dup-company {
  font-weight: 600;
  color: #1a1a2e;
  font-size: 14px;
}
.dup-role {
  font-size: 13px;
  color: #555;
  margin-top: 2px;
}
.dup-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: 11px;
}
.dup-detail-link {
  display: inline-block;
  font-size: 11px;
  color: #1a1a2e;
  margin-top: 4px;
}
.dup-vs {
  display: flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #ccc;
  flex-shrink: 0;
}
.dup-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.dup-merge-btn {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid #166534;
  background: #166534;
  color: #fff;
}
.dup-merge-btn:hover { background: #15803d; }
.dup-ignore-btn {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid #ddd;
  background: #fff;
  color: #666;
}
.dup-ignore-btn:hover { background: #f0f0f0; }
.dup-result {
  font-size: 13px;
  font-weight: 500;
}

/* Offers comparison page */
.offers-table td { vertical-align: middle; }
td.annual-eq { font-size: 13px; }
.annual-eq-value { font-weight: 500; color: #2a7a2a; }
.rank-badge {
  display: inline-block;
  width: 24px;
  height: 24px;
  line-height: 24px;
  text-align: center;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
}
.rank-1 { background: #fef9c3; color: #854d0e; }
.rank-2 { background: #e0e7ff; color: #3730a3; }
.rank-3 { background: #f0f0f0; color: #666; }
.rank-badge:not(.rank-1):not(.rank-2):not(.rank-3) { background: #f5f5f5; color: #999; }

.neg-row td { padding: 0; }
.neg-row:has(td:empty) { display: none; }
.negotiation-panel {
  padding: 16px 20px;
  background: #fdf2f8;
  border-top: 1px solid #fbcfe8;
}
.negotiation-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9d174d;
  margin-bottom: 6px;
}
.negotiation-answer {
  font-size: 13px;
  line-height: 1.6;
  color: #1a1a1a;
  white-space: pre-wrap;
}
.negotiation-block { margin-bottom: 12px; }
.neg-generate-btn {
  font-size: 11px;
  color: #9d174d;
  background: none;
  border: 1px solid #fbcfe8;
  border-radius: 4px;
  padding: 2px 8px;
  cursor: pointer;
}
.neg-generate-btn:hover { background: #fbcfe8; }
.negotiation-cell { width: 80px; text-align: center; }


/* Status row coloring: stale & expired */
tr.status-stale { border-left: 3px solid #9ca3af; opacity: 0.7; }
tr.status-expired { border-left: 3px solid #ef4444; opacity: 0.5; }

/* Freshness badge */
.freshness-badge {
  display: inline-block;
  padding: 0 5px;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-left: 4px;
  vertical-align: middle;
}
.freshness-today      { background: #dcfce7; color: #166534; }
.freshness-this_week   { background: #dbeafe; color: #1d4ed8; }
.freshness-this_month  { background: #fef9c3; color: #854d0e; }
.freshness-stale       { background: #fee2e2; color: #991b1b; }

/* Trust signal badge (issue #324 Phase 1) */
.trust-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-left: 6px;
  cursor: help;
  vertical-align: middle;
}
.trust-warn  { background: #fef3c7; color: #92400e; }
.trust-block { background: #fee2e2; color: #991b1b; }

/* ── Unread triage (issue: unread triage state) ─────────────────────────── */

/* Unread badge in nav */
.unread-badge {
  background: #e53e3e;
  color: #fff;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  margin-left: 2px;
}

/* Unread dot in job rows */
.unread-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3b82f6;
  margin-left: 5px;
  vertical-align: middle;
}

/* Unread row styling */
tr.unread { background: var(--accent-soft); }
tr.unread:hover { background: var(--surface-3); }

/* Since-last-visit filter */
.since-filter {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  text-decoration: none;
  font-size: 12px;
}
.since-filter.active {
  background: #1a1a2e;
  color: #fff;
}

/* Review queue table */
.review-table tbody tr {
  cursor: pointer;
}
.review-row.focused {
  background: #fff9c0 !important;
  outline: 2px solid #f59e0b;
  outline-offset: -2px;
}

/* Review action buttons */
.review-actions { width: 100px; text-align: center; }
.review-btn-group { display: inline-flex; gap: 2px; }
.review-btn {
  background: none;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 3px 8px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  transition: background 0.1s, border-color 0.1s;
}
.review-btn:hover { background: #f0f0f0; }
.btn-interesting:hover { background: #fef3c7; border-color: #f59e0b; }
.btn-skip:hover { background: #f3f4f6; border-color: #d1d5db; }
.btn-apply:hover { background: #dcfce7; border-color: #10b981; }
.btn-read:hover { background: #e0e7ff; border-color: #6366f1; }

/* ═══════════════════════════════════════════════════════════════════════════
   Homepage redesign — page header, toolbar, popovers, filter drawer,
   consolidated job row (match meter, skill chips, hover actions).
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Page header row ──────────────────────────────────────────────────────── */
.page-top { display: flex; align-items: baseline; gap: 12px; margin: 4px 0 16px; flex-wrap: wrap; }
.page-top h1 { font-size: 1.4rem; font-weight: 680; letter-spacing: -0.01em; color: var(--ink); }
.page-top .sub { color: var(--muted); font-size: 13.5px; }
.page-top .spacer { margin-left: auto; }
.since-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 550; text-decoration: none;
  color: var(--accent); background: var(--accent-soft);
  padding: 5px 12px; border-radius: 999px;
}
.since-pill.on { color: #fff; background: var(--accent); }
.since-clear { font-size: 12px; color: var(--muted); text-decoration: underline; }

/* ── Toolbar (search + sort + filters + add + actions) ────────────────────── */
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 9px;
  padding: 0 11px; height: 36px;
}
.toolbar .search { flex: 1; min-width: 200px; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search svg { width: 15px; height: 15px; color: var(--faint); flex: none; }
.search input { border: 0; background: none; outline: none; color: var(--ink); font-size: 14px; width: 100%; font-family: inherit; }
.search input::placeholder { color: var(--faint); }
.search input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
.toolbar select {
  height: 36px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 9px; padding: 0 30px 0 11px; font-size: 13.5px; font-family: inherit; cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%239aa0b0' stroke-width='2'%3E%3Cpath d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.tool-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 13px;
  border-radius: 9px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); font-size: 13.5px; font-weight: 500; cursor: pointer; font-family: inherit;
  white-space: nowrap; flex: none;
}
.export-row { display: flex; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.export-btn.tool-btn.ghost {
  width: auto; height: 32px; padding: 0 11px; justify-content: flex-start;
  font-size: 12.5px; color: var(--muted); border: 1px solid var(--line);
}
.export-btn.tool-btn.ghost:hover { color: var(--ink); border-color: var(--faint); background: var(--surface-3); }
.tool-btn:hover { border-color: var(--faint); }
.tool-btn svg { width: 15px; height: 15px; }
.tool-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.tool-btn.primary:hover { filter: brightness(1.07); }
.tool-btn.ghost { border-color: transparent; background: transparent; color: var(--muted); width: 36px; justify-content: center; padding: 0; }
.tool-btn.ghost:hover { background: var(--surface-3); color: var(--ink); }
.tool-btn .count {
  font-size: 10px; font-weight: 700; color: #fff; background: var(--accent);
  border-radius: 999px; min-width: 16px; height: 16px; padding: 0 4px;
  display: inline-grid; place-items: center;
}

/* ── Popovers / dropdown menus (CSS-only via <details>) ───────────────────── */
.tool-pop { position: relative; }
.tool-pop > summary { list-style: none; }
.tool-pop > summary::-webkit-details-marker { display: none; }
.pop {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 40;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 14px; width: 320px;
  animation: pop-in 0.13s ease;
}
.pop.left { right: auto; left: 0; }
.pop.menu { width: 260px; padding: 6px; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } }
.pop h4 { margin: 0 0 10px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.pop .field { margin-bottom: 11px; }
.pop .field > label { display: block; font-size: 11.5px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.pop .field input, .pop .field select {
  width: 100%; height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px;
  background: var(--surface-2); color: var(--ink); font-size: 13.5px; font-family: inherit;
}
.pop .row2 { display: flex; gap: 8px; }
.pop .checks { display: grid; gap: 9px; margin: 4px 0 12px; }
.pop .checks label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.pop-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pop-foot .hint { font-size: 12px; color: var(--faint); }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  border: 0; background: none; padding: 9px 10px; border-radius: 8px;
  font-size: 13.5px; color: var(--ink); text-decoration: none; cursor: pointer; font-family: inherit;
}
.menu-item:hover { background: var(--surface-3); }
.menu-item svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.menu-item small { display: block; color: var(--faint); font-size: 11.5px; }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu-status { padding: 6px 10px 2px; font-size: 12px; color: var(--muted); }
.menu-status:empty { display: none; }
.add-ok { font-size: 12.5px; color: #166534; background: #dcfce7; border: 1px solid #bbf7d0; padding: 7px 10px; border-radius: 7px; margin-bottom: 10px; }

/* ── Compact filter bar + advanced drawer ─────────────────────────────────── */
.filter-bar {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  font-size: 12.5px; color: var(--muted); margin-bottom: 12px;
}
.filter-field { display: flex; gap: 5px; align-items: center; }
.filter-field input[type="text"], .filter-field input[type="number"],
.filter-field input[type="date"], .filter-field select {
  font-size: 13px; border: 1px solid var(--line); border-radius: 7px;
  padding: 4px 7px; background: var(--surface); color: var(--ink); font-family: inherit;
}
.filter-field input[type="checkbox"] { cursor: pointer; accent-color: var(--accent); }
.filter-adv { position: relative; }
.filter-adv > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 500; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 7px; padding: 5px 11px;
}
.filter-adv > summary::-webkit-details-marker { display: none; }
.filter-adv[open] > summary { border-color: var(--accent); color: var(--accent); }
.filter-adv-body {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(2, minmax(150px, 1fr)); gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 14px; min-width: 340px;
}
.filter-adv-body .filter-field { flex-direction: column; align-items: stretch; gap: 4px; }
.filter-adv-body .filter-field > span { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.filter-adv-body .filter-field.inline { flex-direction: row; align-items: center; }
.filter-adv-body .filter-field.span2 { grid-column: 1 / -1; }

/* ── Consolidated job row ─────────────────────────────────────────────────── */
/* Match cell: score number + meter + effort dot */
.match-cell { min-width: 118px; }
.match-line { display: flex; align-items: center; gap: 9px; }
.match-score {
  font-size: 15px; font-weight: 650; width: 26px; text-align: right;
  font-variant-numeric: tabular-nums; font-family: var(--font-mono);
}
.match-meter { width: 42px; height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.match-meter > i { display: block; height: 100%; border-radius: 999px; }
.match-high .match-meter > i { background: var(--good); }
.match-high .match-score { color: var(--good); }
.match-mid .match-meter > i { background: #d99215; }
.match-mid .match-score { color: #b45309; }
.match-low .match-meter > i { background: var(--faint); }
.match-low .match-score { color: var(--muted); }
.effort-dot {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--muted); margin-top: 3px; display: inline-block;
}
.effort-dot::before { content: "•"; margin-right: 3px; }
.effort-dot.effort-low::before { color: var(--good); }
.effort-dot.effort-medium::before { color: #d99215; }
.effort-dot.effort-high::before { color: var(--bad, #dc2626); }

/* Role / company two-line cell */
.role-cell { min-width: 220px; }
.role-cell .role-main { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.role-cell .role-main a,
.role-cell .role-main a:link,
.role-cell .role-main a:visited {
  color: var(--ink); font-weight: 600; text-decoration: none; font-size: 14px;
}
.role-cell .role-main a:hover { color: var(--accent); text-decoration: underline; }
.role-cell .role-sub { display: flex; align-items: center; gap: 7px; margin-top: 2px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.role-cell .company-display { border-bottom: 1px dashed var(--faint); }
.loc-chip { font-size: 11px; color: var(--ink-2); background: var(--surface-3); border-radius: 6px; padding: 1px 7px; }
.deadline-badge { font-size: 11px; font-weight: 600; border-radius: 6px; padding: 1px 6px; }
.deadline-badge.deadline-urgent { background: #fee2e2; color: #dc2626; }
.deadline-badge.deadline-soon { background: #fef3c7; color: #b45309; }
.deadline-badge.deadline-upcoming { background: #e0f2fe; color: #0369a1; }
.deadline-badge.deadline-none { background: var(--surface-3); color: var(--ink-2); }

/* Skill fit chips — one fixed-height tag row, never wraps; overflow shows as "+N" */
.skill-chips {
  display: flex; flex-wrap: nowrap; align-items: center; gap: 4px;
  max-width: 210px; overflow: hidden; white-space: nowrap;
}
.skill-chip {
  font-size: 11px; padding: 2px 7px; border-radius: 6px; font-weight: 550;
  background: #dcfce7; color: #166534; flex: none;
}
.skill-chip.gap { background: #fee2e2; color: #991b1b; }
.skill-more { font-size: 11px; color: var(--faint); flex: none; }

/* Row hover-action cluster */
.row-actions { display: inline-flex; gap: 3px; opacity: 0.35; transition: opacity 0.1s; }
tbody tr:hover .row-actions { opacity: 1; }
.row-actions .materials-btn, .row-actions .delete-btn {
  width: 28px; height: 28px; display: inline-grid; place-items: center;
  border-radius: 7px; border: 1px solid transparent;
}
.row-actions .materials-btn:hover { background: var(--surface-3); }

/* Match cell internal spacing */
.match-cell .effort-dot { margin-top: 4px; }
.match-cell .skill-chips { margin-top: 5px; }

/* Status cell: stack the status + skip-reason selects */
.status-cell { min-width: 128px; }
.status-cell .status-select, .status-cell .notes-select {
  display: block; width: 100%; max-width: none; margin-bottom: 4px;
  background: var(--surface); color: var(--ink); border-color: var(--line);
}
.status-cell .notes-select { margin-bottom: 0; font-size: 11.5px; color: var(--muted); }
.actions-cell { text-align: right; white-space: nowrap; }
.company-edit {
  background: none; border: none; cursor: pointer; color: var(--faint);
  font-size: 11px; padding: 0 2px;
}
.company-edit:hover { color: var(--ink); }
