:root {
  --ink: #0d0f14;
  --ink-soft: #40454f;
  --muted: #6b7280;
  --muted-light: #9ca3af;
  --border: #e5e7eb;
  --border-soft: #eef0f3;
  --bg: #ffffff;
  --bg-subtle: #fafafb;
  --accent: #2952cc;
  --accent-soft: #eef2ff;
  --maroon: #7a1f2e;
  --maroon-dark: #5e1723;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(13, 15, 20, 0.04);
  --shadow-md: 0 2px 8px rgba(13, 15, 20, 0.06);
}

* { box-sizing: border-box; }

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

code {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.85em;
}

/* ---------- Top nav ---------- */

.topnav {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  z-index: 10;
}

.topnav-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.brand-mark {
  color: var(--accent);
  font-size: 0.85rem;
}

.brand-link {
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}
.brand-link:hover { color: var(--ink); }
.brand-link .arrow { display: inline-block; }

.topnav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ---------- Accounts: auth widget, modal, save-search, applied toggle ---------- */

.auth-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 11px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.auth-btn:hover { border-color: var(--accent); color: var(--accent); }
.auth-btn-primary { background: var(--ink); border-color: var(--ink); color: white; }
.auth-btn-primary:hover { background: var(--accent); border-color: var(--accent); color: white; }

.auth-email {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 15, 20, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-overlay.hidden { display: none; }

.modal-box {
  position: relative;
  background: var(--bg);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 28px;
  width: 100%;
  max-width: 420px;
  max-height: 80vh;
  overflow-y: auto;
}
.modal-box.modal-wide { max-width: 640px; }

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  border: none;
  background: none;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--muted-light);
  cursor: pointer;
  padding: 4px;
}
.modal-close:hover { color: var(--ink); }

.modal-title {
  margin: 0 0 16px;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.modal-content label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.modal-content label + label { margin-top: 12px; }
.modal-content input[type="email"],
.modal-content input[type="password"],
.modal-content input[type="text"] {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--ink);
  background: var(--bg-subtle);
}
.modal-content input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg);
}
.modal-content .btn-primary { margin-top: 16px; width: 100%; padding: 10px; }

.modal-subtitle {
  margin: -8px 0 16px;
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.4;
}

#turnstile-widget { margin-top: 14px; }

.modal-forgot {
  margin: 8px 0 0;
  text-align: right;
}
.modal-forgot a { font-size: 0.8rem; color: var(--muted); text-decoration: none; }
.modal-forgot a:hover { color: var(--accent); text-decoration: underline; }

.auth-success {
  margin-top: 10px;
  font-size: 0.82rem;
  color: #1e7e34;
}

/* ---------- Auth modal (login / signup / password reset) ----------
   A visually distinct treatment from the plain utility modals (saved
   searches, applied jobs) -- this is the one modal a first-time visitor
   forms an impression of the whole site from, so it gets a branded dark
   header instead of reusing the generic .modal-title look. */

.modal-box.modal-auth {
  padding: 0;
  overflow: hidden;
  max-width: 400px;
}

.modal-box.modal-auth .modal-close {
  color: rgba(255, 255, 255, 0.6);
}
.modal-box.modal-auth .modal-close:hover { color: white; }

.modal-auth-header {
  padding: 30px 28px 22px;
  background: linear-gradient(135deg, var(--ink) 0%, #1c2540 100%);
}

.modal-auth-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 16px;
}
.modal-auth-brand .brand-mark { color: #8aa5ff; font-size: 0.85rem; }

.modal-auth-header h2 {
  margin: 0;
  font-size: 1.32rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: white;
}
.modal-auth-header p {
  margin: 7px 0 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.68);
}

.modal-auth-body { padding: 24px 28px 28px; }
.modal-auth-body label { margin-top: 0; }
.modal-auth-body .input-icon-group + label { margin-top: 14px; }

.input-icon-group { position: relative; }
.input-icon-group svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-light);
  pointer-events: none;
}
.input-icon-group input {
  padding-left: 36px !important;
}

.modal-box.modal-auth .btn-primary {
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}
.modal-box.modal-auth .modal-switch {
  padding-top: 14px;
  margin-top: 18px;
  border-top: 1px solid var(--border-soft);
  text-align: center;
}

.auth-error {
  margin-top: 10px;
  font-size: 0.82rem;
  color: #b3261e;
  min-height: 0;
}

.modal-switch {
  margin: 16px 0 0;
  font-size: 0.83rem;
  color: var(--muted);
  text-align: center;
}
.modal-switch a { color: var(--accent); text-decoration: none; font-weight: 600; }
.modal-switch a:hover { text-decoration: underline; }

.save-search-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
}
.save-search-btn:hover { border-color: var(--accent); color: var(--accent); }
.save-search-btn.hidden { display: none; }

.save-search-inline {
  display: flex;
  gap: 6px;
  align-items: center;
  flex: 1 1 220px;
  /* Flex items default to min-width: auto, which refuses to shrink below
     the content's natural width -- combined with the nowrap Save/Cancel
     buttons below, that was pushing this whole group past the right edge
     of .filters-row instead of shrinking or wrapping. min-width: 0 lets it
     actually shrink with its flex-basis; flex-wrap is a fallback so if it
     still doesn't fit (very narrow viewports), the buttons drop to their
     own line instead of overflowing. */
  min-width: 0;
  flex-wrap: wrap;
}
.save-search-inline input {
  flex: 1 1 120px;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  font-family: inherit;
  font-size: 0.82rem;
}

.saved-search-row, .applied-job-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
}
.saved-search-row:last-child, .applied-job-row:last-child { border-bottom: none; }

.saved-search-name, .applied-job-title {
  flex: 1;
  min-width: 0;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.applied-job-title a { color: var(--ink); text-decoration: none; }
.applied-job-title a:hover { color: var(--accent); }

.applied-job-meta {
  font-size: 0.76rem;
  color: var(--muted);
  white-space: nowrap;
}

.row-action-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 6px;
  padding: 4px 9px;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
}
.row-action-btn:hover { border-color: var(--accent); color: var(--accent); }
.row-action-btn.danger:hover { border-color: #b3261e; color: #b3261e; }

.delisted-tag {
  font-size: 0.7rem;
  color: var(--muted-light);
  font-style: italic;
}

.empty-modal-state {
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
  padding: 20px 0;
}

.applied-toggle {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 6px;
  padding: 3px 9px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.applied-toggle:hover { border-color: var(--accent); color: var(--accent); }
.applied-toggle.is-applied {
  background: #eafaf0;
  border-color: #bfe8cf;
  color: #0f7a3d;
}
.applied-toggle.is-applied:hover { border-color: #b3261e; color: #b3261e; }

/* ---------- Hero ---------- */

.hero {
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}

.hero-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 56px 24px 44px;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  max-width: 640px;
}

.tagline {
  margin: 0;
  font-size: 1rem;
  color: var(--muted);
  max-width: 560px;
  font-weight: 400;
}

/* ---------- Main / search panel ---------- */

main {
  max-width: 1360px;
  margin: 0 auto;
  padding: 32px 24px 60px;
}

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

.query-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.query-input-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.query-icon {
  position: absolute;
  left: 13px;
  color: var(--muted-light);
  font-size: 0.95rem;
  pointer-events: none;
}

#q {
  width: 100%;
  padding: 11px 82px 11px 36px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.86rem;
  color: var(--ink);
  background: var(--bg-subtle);
  transition: border-color 0.12s, background 0.12s;
}
#q:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg);
}
#q::placeholder { color: var(--muted-light); }

#syntax-help-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 5px;
  cursor: pointer;
  font-family: inherit;
}
#syntax-help-btn:hover { border-color: var(--accent); color: var(--accent); }

.syntax-help {
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  padding: 10px 12px;
  line-height: 1.65;
}
.syntax-help.hidden { display: none; }

.btn-primary {
  background: var(--ink);
  color: white;
  border: none;
  border-radius: 7px;
  padding: 0 22px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s;
}
.btn-primary:hover { background: var(--accent); }

.filters-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.filters-row input[type="text"],
.filters-row select {
  flex: 1;
  min-width: 150px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-family: inherit;
  font-size: 0.84rem;
  background: var(--bg);
  color: var(--ink-soft);
}
.filters-row input[type="text"]:focus,
.filters-row select:focus {
  outline: none;
  border-color: var(--accent);
}

.location-select {
  position: relative;
  flex: 1;
  min-width: 180px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg);
}
.location-select:focus-within { border-color: var(--accent); }

.location-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.location-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 5px;
  padding: 3px 5px 3px 9px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.location-chip button {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--accent);
  font-size: 0.9rem;
  line-height: 1;
  padding: 2px 3px;
}
.location-chip button:hover { color: var(--ink); }

/* Canonical "Remote (US)" / "Remote (Canada)" etc. group chips — visually
   distinct from plain scraped-location text chips since one deselect toggles
   dozens of underlying raw location strings at once. */
.location-chip-group {
  background: var(--ink);
  color: var(--bg);
}
.location-chip-group button { color: var(--bg); }
.location-chip-group button:hover { color: var(--accent-soft); }

#location-input {
  flex: 1;
  min-width: 90px;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.84rem;
  color: var(--ink-soft);
  padding: 4px 2px;
}

.location-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  box-shadow: var(--shadow-md);
  max-height: 220px;
  overflow-y: auto;
  z-index: 20;
}
.location-dropdown.hidden { display: none; }

.location-option {
  padding: 8px 12px;
  font-size: 0.83rem;
  color: var(--ink-soft);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.location-option:hover, .location-option.active { background: var(--bg-subtle); color: var(--ink); }
.location-option .count { color: var(--muted-light); font-size: 0.76rem; }
.location-option-empty { padding: 10px 12px; font-size: 0.8rem; color: var(--muted-light); }

.location-option-group { font-weight: 600; }
.location-option-group::before { content: "★ "; color: var(--accent); }

/* ---------- Salary / YOE dual-range sliders ---------- */

.range-filters-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.range-filter {
  flex: 1;
  min-width: 220px;
}

.range-filter-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}

.range-filter-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.range-filter-value {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.range-filter-hint {
  display: block;
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--muted-light);
}

.range-slider {
  position: relative;
  height: 16px;
  display: flex;
  align-items: center;
}

.range-slider-track {
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 999px;
  background: var(--border);
}

.range-slider-fill {
  position: absolute;
  height: 4px;
  border-radius: 999px;
  background: var(--accent);
}

.range-slider-thumb {
  position: absolute;
  top: 50%;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  transform: translate(-50%, -50%);
  cursor: grab;
  touch-action: none;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.12s, border-color 0.12s;
}
.range-slider-thumb:hover { box-shadow: var(--shadow-md); }
.range-slider-thumb:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.range-slider-thumb.dragging {
  cursor: grabbing;
  border-color: var(--ink);
}

.resume-dropzone {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px dashed var(--border);
  border-radius: 7px;
  padding: 9px 13px;
  font-size: 0.82rem;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.resume-dropzone:hover,
.resume-dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.resume-dropzone strong { color: var(--ink); }

.resume-icon {
  color: var(--accent);
  font-weight: 700;
}

.resume-status {
  display: block;
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--muted);
}
.resume-status.error { color: #b3261e; }
.resume-status.ok { color: #146c43; }

.resume-suggestion-btn {
  display: inline-block;
  margin: 2px 4px 0 0;
  padding: 2px 8px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.resume-suggestion-btn:hover { background: var(--accent); color: var(--bg); }

/* ---------- Results ---------- */

.results-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 4px 2px 10px;
}

.status-line {
  font-size: 0.83rem;
  color: var(--muted);
  font-weight: 500;
}

.sort-hint {
  font-size: 0.78rem;
  color: var(--muted-light);
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}
@media (max-width: 1280px) { .results-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 1040px) { .results-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px)  { .results-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px)  { .results-grid { grid-template-columns: 1fr; } }

.job-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  background: var(--bg);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.job-card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); }

.job-card-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.job-logo-wrap {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  overflow: hidden;
  background: var(--bg-subtle);
  border: 1px solid var(--border-soft);
}

.job-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.job-logo-fallback {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.76rem;
  font-weight: 700;
}

.job-header-text { min-width: 0; flex: 1; }

.job-title {
  margin: 0 0 2px;
  font-size: 0.87rem;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.job-title a {
  color: var(--ink);
  text-decoration: none;
}
.job-title a:hover { color: var(--accent); }

.job-sub {
  font-size: 0.76rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.job-blurb {
  font-size: 0.78rem;
  color: var(--ink-soft);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.yoe-badge {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
  margin-right: 2px;
  vertical-align: 1px;
}

.job-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
}
.tools-icon { font-size: 0.75rem; opacity: 0.6; margin-right: 1px; }
.tool-chip {
  display: inline-block;
  background: var(--bg-subtle);
  color: var(--muted);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}

.job-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: auto;
  padding-top: 4px;
}

.job-posted {
  font-size: 0.72rem;
  color: var(--muted-light);
  width: 100%;
}

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 5px;
  padding: 3px 7px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.tag-source { background: var(--accent-soft); color: var(--accent); }
.tag-department { background: #eefaf3; color: #147a4d; }
.tag-commitment { background: #fdf5e9; color: #9a6a15; }
.tag-salary { background: #f2effc; color: #5b3ec8; cursor: help; }

.match-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 5px;
  padding: 3px 7px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: help;
}
.match-best { background: #eafaf0; color: #0f7a3d; }
.match-good { background: #fdf7e6; color: #96700f; }
.match-poor { background: #f3f4f6; color: var(--muted); }

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 56px 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

.pagination button {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 16px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--ink-soft);
  transition: border-color 0.12s;
}
.pagination button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pagination button:disabled { opacity: 0.35; cursor: default; }
.pagination .page-indicator {
  font-size: 0.8rem;
  color: var(--muted);
}

.page-numbers {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-num {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--ink-soft);
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.page-num:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.page-num.active {
  background: var(--ink);
  border-color: var(--ink);
  color: white;
  cursor: default;
}

.page-ellipsis {
  color: var(--muted-light);
  font-size: 0.83rem;
  padding: 0 2px;
}

/* ---------- Footer ---------- */

footer {
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
}

.footer-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 24px;
  text-align: center;
}

.footer-about {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 14px;
}

.footer-status {
  font-size: 0.78rem;
  color: var(--muted-light);
  margin: 0 0 10px;
}

.footer-byline {
  font-size: 0.83rem;
  color: var(--ink-soft);
  margin: 0;
}
.footer-byline a {
  color: var(--accent);
  text-decoration: none;
}
.footer-byline a:hover { text-decoration: underline; }

@media (max-width: 600px) {
  .query-row { flex-direction: column; }
}

/* ---------- Top nav links (FAQ / Contact) ---------- */

.nav-links {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-right: 4px;
  border-right: 1px solid var(--border);
}
.nav-links a {
  font-size: 0.83rem;
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 600;
}
.nav-links a:hover { color: var(--accent); }

/* ---------- Contact modal ---------- */

.modal-content textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--bg-subtle);
  resize: vertical;
}
.modal-content textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg);
}
.modal-plain-text {
  font-size: 0.9rem;
  color: var(--ink-soft);
  line-height: 1.6;
}
.modal-plain-text a { color: var(--accent); }

/* ---------- FAQ accordion ---------- */

.faq-list { display: flex; flex-direction: column; gap: 8px; }
.faq-item {
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  overflow: hidden;
}
.faq-question {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--bg-subtle);
  border: none;
  padding: 12px 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
}
.faq-question:hover { color: var(--accent); }
.faq-caret {
  color: var(--muted);
  transition: transform 0.15s;
  flex-shrink: 0;
}
.faq-question.faq-open .faq-caret { transform: rotate(180deg); }
.faq-answer {
  padding: 12px 14px 14px;
  font-size: 0.85rem;
  color: var(--ink-soft);
  line-height: 1.6;
  border-top: 1px solid var(--border-soft);
}

/* ---------- AI Search button (circular, stacked above Search) ---------- */

.search-btn-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.ai-search-circle {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--maroon);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s, transform 0.1s;
}
.ai-search-circle:hover { background: var(--maroon-dark); }
.ai-search-circle:active { transform: scale(0.94); }

/* .btn-primary normally gets its height from stretching against
   .query-row's other flex item (the input) -- see the base .btn-primary
   rule's zero vertical padding. Now that it's nested one level deeper
   inside .search-btn-stack (a column flex container, so no stretch
   reaches it), it needs an explicit height to match instead of
   collapsing to just its text's line-height. */
.search-btn-stack .btn-primary {
  height: 44px;
}

/* ---------- AI Search modal (guided decision-tree wizard) ---------- */

.assistant-messages {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 2px;
  margin-bottom: 4px;
}

.assistant-msg {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.5;
  white-space: pre-wrap;
}
.assistant-msg-assistant {
  align-self: flex-start;
  background: var(--bg-subtle);
  border: 1px solid var(--border-soft);
  color: var(--ink);
  border-bottom-left-radius: 3px;
}
.assistant-msg-user {
  align-self: flex-end;
  background: var(--accent);
  color: white;
  border-bottom-right-radius: 3px;
}

.assistant-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0 12px;
}

.assistant-chip {
  background: var(--bg);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 14px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.assistant-chip:hover { background: var(--accent); color: white; }

.wizard-inline-select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 8px;
  font-family: inherit;
  font-size: 0.82rem;
  background: var(--bg-subtle);
  color: var(--ink);
  margin-bottom: 6px;
}

.assistant-form {
  display: flex;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
}
.assistant-form input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.85rem;
  background: var(--bg-subtle);
}
.assistant-form input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg);
}
.assistant-form input:disabled { color: var(--muted-light); cursor: default; }
.assistant-form button {
  width: 34px;
  flex-shrink: 0;
  border: none;
  border-radius: 7px;
  background: var(--ink);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.assistant-form button:hover { background: var(--accent); }
