/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

:root {
  --brand:       #2563eb;
  --brand-light: #eff6ff;
  --brand-hover: #1d4ed8;
  --surface:     #ffffff;
  --bg:          #f1f5f9;
  --border:      #e2e8f0;
  --text:        #0f172a;
  --muted:       #64748b;
  --light:       #94a3b8;
  --green:       #16a34a;
  --amber:       #d97706;
  --radius:      12px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08);
  --shadow-md:   0 4px 16px rgba(0,0,0,.10);
  --t:           .17s ease;
}

html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header / Tabs ───────────────────────────────────────── */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 2rem;
}
.logo {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--brand);
  white-space: nowrap;
}

.tabs { display: flex; gap: .1rem; }
.tab {
  padding: .45rem .95rem;
  border-radius: 8px;
  border: none;
  background: none;
  font-size: .875rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .4rem;
  transition: background var(--t), color var(--t);
}
.tab:hover  { background: var(--brand-light); color: var(--brand); }
.tab.active { background: var(--brand-light); color: var(--brand); }
.tab-badge {
  background: var(--brand);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  padding: .1rem .4rem;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}

/* ── Enrich progress pill ─────────────────────────────────── */
.enrich-pill {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .45rem;
  background: #fef9c3;
  border: 1px solid #fde68a;
  border-radius: 999px;
  padding: .28rem .8rem .28rem .6rem;
  font-size: .78rem;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background .3s, border-color .3s;
}
.enrich-pill-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  color: #d97706;
}
.enrich-pill-icon .icon-done { display: none; }
.enrich-pill--done .enrich-pill-icon .icon-enriching { display: none; }
.enrich-pill--done .enrich-pill-icon .icon-done { display: block; }
@keyframes _ep-pulse {
  0%,100% { opacity: 1; }
  50%      { opacity: .5; }
}
.enrich-pill:not(.enrich-pill--done) .enrich-pill-icon {
  animation: _ep-pulse 1.4s ease-in-out infinite;
}
.enrich-pill-label {
  display: flex;
  align-items: center;
  gap: .35rem;
  color: #92400e;
  font-weight: 600;
}
.enrich-pill-count {
  color: #78350f;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  font-size: .74rem;
}
.enrich-pill-bar-wrap {
  width: 56px;
  height: 4px;
  background: #fde68a;
  border-radius: 999px;
  overflow: hidden;
}
.enrich-pill-bar {
  height: 100%;
  background: #d97706;
  border-radius: 999px;
  transition: width .6s ease;
}
.enrich-pill--done {
  background: #f0fdf4;
  border-color: #86efac;
}
.enrich-pill--done .enrich-pill-icon { color: #16a34a; }
.enrich-pill--done .enrich-pill-label { color: #166534; }
.enrich-pill--done .enrich-pill-count { color: #15803d; }
.enrich-pill--done .enrich-pill-bar-wrap { background: #bbf7d0; }
.enrich-pill--done .enrich-pill-bar { background: #16a34a; }

/* ── Hero ────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 60%, #38bdf8 100%);
  padding: 2.5rem 1.5rem 2rem;
  text-align: center;
  color: #fff;
}
.hero-title {
  font-size: clamp(1.5rem, 4vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: .4rem;
}
.hero-sub { font-size: .95rem; opacity: .85; margin-bottom: 1.5rem; }

/* Search bar */
.search-bar {
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  background: var(--surface);
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  padding: .3rem .3rem .3rem 1rem;
  gap: .2rem;
}
.search-icon { flex-shrink: 0; color: var(--muted); }
.search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: .93rem;
  color: var(--text);
  background: transparent;
  min-width: 0;
  padding: .25rem 0;
  /* Ensure UTF-8 characters render correctly */
  font-family: inherit;
}
.location-input { flex: 0 0 150px; }
.search-input::placeholder { color: var(--light); }
.search-divider { width: 1px; height: 22px; background: var(--border); flex-shrink: 0; margin: 0 .2rem; }
.search-btn {
  flex-shrink: 0;
  background: var(--brand);
  color: #fff;
  border: none;
  padding: .55rem 1.3rem;
  border-radius: 999px;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t);
}
.search-btn:hover { background: var(--brand-hover); }

/* ── AI mode toggle button ─────────────────────────────── */
.ai-mode-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .38rem .75rem;
  border-radius: 999px;
  border: 1.5px solid var(--brand);
  background: transparent;
  color: var(--brand);
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, color .15s;
  font-family: inherit;
  white-space: nowrap;
}
.ai-mode-btn:hover { background: #ede9fe; }
.ai-mode-btn.active {
  background: var(--brand);
  color: #fff;
}
.search-bar.ai-mode {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(109,40,217,.15);
}

/* Hero actions */
.hero-actions {
  margin-top: .9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .9rem;
  flex-wrap: wrap;
}
.fetch-btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  background: rgba(255,255,255,.15);
  border: 1.5px solid rgba(255,255,255,.4);
  color: #fff;
  padding: .5rem 1.15rem;
  border-radius: 999px;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t), border-color var(--t);
  backdrop-filter: blur(4px);
}
.fetch-btn:hover:not(:disabled) { background: rgba(255,255,255,.25); border-color: rgba(255,255,255,.7); }
.fetch-btn:disabled { opacity: .6; cursor: not-allowed; }
.fetch-btn-sm {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  background: var(--brand);
  color: #fff;
  border: none;
  padding: .5rem 1.15rem;
  border-radius: 999px;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: .75rem;
  transition: background var(--t);
}
.fetch-btn-sm:hover { background: var(--brand-hover); }
.fetch-status { font-size: .83rem; color: rgba(255,255,255,.85); max-width: 380px; }
.fetch-status--success { color: #86efac; }
.fetch-status--warn    { color: #fcd34d; }

/* ── Fetch banner ─────────────────────────────────────────── */
.fetch-banner { background: var(--brand); color: #fff; }
.fetch-banner-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: .6rem 1.5rem;
  display: flex;
  align-items: center;
  gap: .7rem;
  font-size: .875rem;
}
.spinner {
  width: 15px; height: 15px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
.btn-spinner {
  display: inline-block;
  width: 13px; height: 13px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
.banner-cancel {
  margin-left: auto;
  background: rgba(255,255,255,.2);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  padding: .22rem .65rem;
  border-radius: 6px;
  font-size: .78rem;
  cursor: pointer;
}
.banner-cancel:hover { background: rgba(255,255,255,.3); }

/* ── Page headers (Saved, Companies) ─────────────────────── */
.page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1.5rem 1.5rem 1.25rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}
.page-title { font-size: 1.4rem; font-weight: 700; }
.page-sub   { font-size: .875rem; color: var(--muted); margin-top: .2rem; }

/* ── Layout ──────────────────────────────────────────────── */
.layout {
  flex: 1;
  max-width: 1200px;
  margin: 1.75rem auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 1.5rem;
  align-items: start;
}
.layout .full-width { grid-column: 1 / -1; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  position: sticky;
  top: 68px;
}
.filter-title {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: .5rem;
}
.filter-group { display: flex; flex-direction: column; gap: .35rem; }
.filter-option {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-size: .85rem;
  color: var(--text);
  cursor: pointer;
}
.filter-option input[type="checkbox"] { accent-color: var(--brand); }

.sidebar-footer {
  margin-top: auto;
  padding-top: .75rem;
  border-top: 1px solid var(--border);
}
.data-actions {
  display: flex;
  gap: .5rem;
  margin-top: 1rem;
}
.clear-all-btn {
  flex: 1;
  padding: .45rem .75rem;
  border: 1.5px solid #fca5a5;
  border-radius: 8px;
  background: transparent;
  color: #dc2626;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t), border-color var(--t), color var(--t);
}
.clear-all-btn:hover {
  background: #fef2f2;
  border-color: #ef4444;
}
.clear-ai-cache-btn {
  flex: 1;
  padding: .45rem .75rem;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t), border-color var(--t), color var(--t);
}
.clear-ai-cache-btn:hover {
  background: #f9fafb;
  border-color: #9ca3af;
  color: var(--text);
}

/* ── Results header ──────────────────────────────────────── */
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .9rem;
  flex-wrap: wrap;
  gap: .5rem;
}
.results-count { font-size: .85rem; color: var(--muted); }
.results-controls { display: flex; align-items: center; gap: .75rem; }
.page-size-label {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .82rem;
  color: var(--muted);
}
.sort-select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .3rem .65rem;
  font-size: .83rem;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  outline: none;
}

/* ── Mode toggle ──────────────────────────────────────────── */
.mode-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.mode-btn {
  background: var(--surface);
  border: none;
  padding: .3rem .7rem;
  font-size: .8rem;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.mode-btn:first-child { border-right: 1px solid var(--border); }
.mode-btn.active {
  background: var(--brand);
  color: #fff;
}
.mode-btn:hover:not(.active) { background: var(--bg); }

/* ── Pagination bar ───────────────────────────────────────── */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.25rem 0 .5rem;
  flex-wrap: wrap;
}
.pg-btn {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .45rem 1rem;
  font-size: .85rem;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background .15s;
}
.pg-btn:hover:not(:disabled) { background: var(--bg); }
.pg-btn:disabled { opacity: .4; cursor: default; }
.pg-info {
  font-size: .84rem;
  color: var(--muted);
  text-align: center;
}

/* ── Infinite scroll sentinel + load-more indicator ──────── */
.scroll-sentinel { height: 1px; }
.load-more-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  padding: 1.25rem;
  font-size: .85rem;
  color: var(--muted);
}
.spinner-sm {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}

/* ── Job list ─────────────────────────────────────────────── */
.job-list { display: flex; flex-direction: column; gap: .9rem; }

/* ── Job card ─────────────────────────────────────────────── */
.job-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.35rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  transition: box-shadow var(--t), border-color var(--t), transform var(--t);
}
.job-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #c7d7f8;
  transform: translateY(-1px);
}
.job-logo {
  width: 46px; height: 46px;
  border-radius: 10px;
  background: var(--brand-light);
  color: var(--brand);
  font-size: 1rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--border);
  /* Ensure UTF-8 initials render fine */
  font-family: inherit;
}
.job-body { flex: 1; min-width: 0; }
.job-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  margin-bottom: .3rem;
}
.job-title {
  font-size: .97rem;
  font-weight: 700;
  flex: 1;
  word-break: break-word;
  overflow-wrap: break-word;
}
.job-title a { color: inherit; text-decoration: none; }
.job-title a:hover { color: var(--brand); text-decoration: underline; }

/* Save button */
.save-btn {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--light);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: color var(--t), background var(--t), border-color var(--t);
}
.save-btn:hover         { color: var(--brand); border-color: #bfdbfe; background: var(--brand-light); }
.save-btn.saved         { color: var(--brand); background: var(--brand-light); border-color: #bfdbfe; }

/* Top-right row: fetched timestamp + save btn inline */
.job-top-right {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: .45rem;
  flex-shrink: 0;
}

/* Meta row */
.job-meta {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .55rem;
  flex-wrap: wrap;
}
.job-company { font-size: .85rem; font-weight: 600; color: var(--brand); }
.job-location, .job-date {
  font-size: .78rem; color: var(--muted);
  display: flex; align-items: center; gap: .22rem;
}
.job-source {
  font-size: .72rem; font-weight: 600;
  padding: .15rem .55rem;
  border-radius: 999px;
  background: #f0fdf4; color: #16a34a;
}

/* Tags */
.job-tags { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: .55rem; }
.tag {
  font-size: .71rem; font-weight: 500;
  padding: .18rem .5rem;
  border-radius: 6px;
  background: var(--bg); color: var(--muted);
  border: 1px solid var(--border);
}
.tag-clickable {
  cursor: pointer;
  transition: background var(--t), color var(--t), border-color var(--t);
}
.tag-clickable:hover { background: var(--brand-light); color: var(--brand); border-color: #bfdbfe; }
.tag-ai {
  background: #f5f3ff;
  color: #7c3aed;
  border-color: #ddd6fe;
}

/* Footer row */
.job-footer {
  margin-top: .7rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.view-btn {
  background: var(--brand); color: #fff;
  border: none; padding: .42rem 1rem;
  border-radius: 8px; font-size: .83rem; font-weight: 600;
  cursor: pointer; text-decoration: none; display: inline-block;
  transition: background var(--t);
  white-space: nowrap;
}
.view-btn:hover:not([disabled]) { background: var(--brand-hover); }
.view-btn[disabled] { opacity: .4; cursor: not-allowed; background: var(--light); }

/* ── Load More bar ───────────────────────────────────────── */
.load-more-bar {
  display: flex;
  justify-content: center;
  padding: 1.25rem 0 .5rem;
}
.load-more-btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--brand);
  padding: .55rem 1.4rem;
  border-radius: 999px;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t), border-color var(--t), box-shadow var(--t);
}
.load-more-btn:hover:not(:disabled) {
  background: var(--brand-light);
  border-color: #bfdbfe;
  box-shadow: var(--shadow-sm);
}
.load-more-btn:disabled { opacity: .6; cursor: not-allowed; }

/* ── Fetched timestamps ──────────────────────────────────── */
.job-fetched {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .72rem;
  color: var(--muted);
  opacity: .8;
}
.listing-fetched {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  font-size: .72rem;
  color: var(--muted);
  opacity: .75;
}

/* ── Sources badge ───────────────────────────────────────── */
.sources-badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .72rem;
  font-weight: 600;
  padding: .15rem .55rem;
  border-radius: 999px;
  background: var(--brand-light);
  color: var(--brand);
  border: 1px solid #bfdbfe;
  cursor: pointer;
  transition: background var(--t), border-color var(--t);
  white-space: nowrap;
}
.sources-badge:hover { background: #dbeafe; border-color: #93c5fd; }
.sources-badge .expand-chevron {
  transition: transform var(--t);
}
.sources-badge.expanded .expand-chevron {
  transform: rotate(180deg);
}

/* ── Listings panel ──────────────────────────────────────── */
.listings-panel {
  margin: .55rem 0 .35rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
}
.listings-panel-inner {
  padding: .35rem 0;
}
.listing-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .45rem .85rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.listing-row:last-child { border-bottom: none; }
.listing-source-wrap {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}
.listing-source {
  font-size: .78rem;
  font-weight: 700;
  color: var(--green);
  background: #f0fdf4;
  padding: .1rem .45rem;
  border-radius: 999px;
  white-space: nowrap;
}
.listing-location {
  font-size: .75rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: .2rem;
}
.listing-date {
  font-size: .73rem;
  color: var(--light);
}
.listing-link {
  font-size: .78rem;
  font-weight: 600;
  color: var(--brand);
  text-decoration: none;
  white-space: nowrap;
  padding: .2rem .55rem;
  border-radius: 6px;
  border: 1px solid #bfdbfe;
  background: var(--brand-light);
  transition: background var(--t);
}
.listing-link:hover { background: #dbeafe; }

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 3.5rem 1rem; color: var(--muted);
}
.empty-state svg { margin: 0 auto 1rem; display: block; color: var(--light); }
.empty-state p { font-size: .95rem; }
.loading-msg { color: var(--muted); font-size: .9rem; padding: 1rem 0; }

/* ── Companies grid ──────────────────────────────────────── */
.companies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.company-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  display: flex;
  align-items: center;
  gap: .85rem;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: box-shadow var(--t), border-color var(--t), transform var(--t);
}
.company-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #c7d7f8;
  transform: translateY(-1px);
}
.company-logo {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--brand-light);
  color: var(--brand);
  font-size: 1rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.company-info { flex: 1; min-width: 0; }
.company-name { font-size: .9rem; font-weight: 700; color: var(--text); }
.company-meta { font-size: .78rem; color: var(--muted); margin-top: .1rem; }
.company-arrow { color: var(--light); flex-shrink: 0; }

/* Company drilldown */
.company-drilldown { margin-top: .5rem; }
.drilldown-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: .4rem .85rem;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--t), border-color var(--t);
}
.back-btn:hover { color: var(--brand); border-color: #bfdbfe; }
.drilldown-title { font-size: 1.15rem; font-weight: 700; }

/* ── Footer ──────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 1.25rem;
  font-size: .78rem;
  color: var(--light);
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: auto;
}

/* ── Filter Bar ───────────────────────────────────────── */
.filter-bar-wrap {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .75rem 1.5rem;
  max-width: 100%;
}
.filter-bar {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.filter-section {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  min-width: 0;
}
.filter-section--tags { flex: 1 1 220px; }
.filter-section--actions {
  justify-content: flex-end;
  align-self: flex-end;
  padding-bottom: .15rem;
}
.filter-section-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}
.filter-select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .35rem .65rem;
  font-size: .83rem;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  outline: none;
  min-width: 130px;
}
.filter-select:focus { border-color: var(--brand); }

/* Tag input row */
.tag-input-row {
  display: flex;
  gap: .35rem;
  align-items: center;
}
.tag-text-input {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .35rem .65rem;
  font-size: .83rem;
  color: var(--text);
  background: var(--surface);
  outline: none;
  min-width: 0;
  flex: 1;
}
.tag-text-input:focus { border-color: var(--brand); }
.tag-text-input::placeholder { color: var(--light); }
.tag-mode-btn {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .35rem .6rem;
  font-size: .73rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--t), color var(--t), border-color var(--t);
  flex-shrink: 0;
}
.tag-mode-btn[data-mode="and"] {
  background: var(--brand-light);
  color: var(--brand);
  border-color: #bfdbfe;
}
.tag-mode-btn:hover { background: var(--bg); }

/* Tag chips (selected filter tags) */
.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  min-height: .5rem;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .72rem;
  font-weight: 600;
  padding: .2rem .5rem .2rem .6rem;
  border-radius: 999px;
  background: var(--brand-light);
  color: var(--brand);
  border: 1px solid #bfdbfe;
}
.chip-remove {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--brand);
  font-size: .85rem;
  line-height: 1;
  display: flex;
  align-items: center;
  opacity: .7;
  transition: opacity var(--t);
}
.chip-remove:hover { opacity: 1; }

/* Clear filters button */
.filter-clear-btn {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: .35rem .75rem;
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
  transition: color var(--t), border-color var(--t), background var(--t);
  white-space: nowrap;
}
.filter-clear-btn:hover {
  color: #dc2626;
  border-color: #fca5a5;
  background: #fef2f2;
}

/* Active filter summary */
.filter-summary {
  max-width: 1200px;
  margin: .45rem auto 0;
  font-size: .78rem;
  color: var(--muted);
  padding: 0 .1rem;
}

/* Clear filters link in empty state */
.clear-filters-link {
  display: inline-block;
  margin-top: .5rem;
  font-size: .83rem;
  color: var(--brand);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

/* ── Layout without sidebar ───────────────────────────── */
.layout--no-sidebar {
  grid-template-columns: 1fr;
}

/* ── Data actions ──────────────────────────────────────── */
.data-actions {
  display: flex;
  gap: .5rem;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* ── Smart search bar ────────────────────────────────────── */
.smart-search-bar {
  max-width: 700px;
  margin: .65rem auto 0;
  display: flex;
  align-items: center;
  background: rgba(255,255,255,.12);
  border: 1.5px solid rgba(255,255,255,.3);
  border-radius: 999px;
  padding: .38rem .38rem .38rem 1rem;
  gap: .45rem;
  backdrop-filter: blur(4px);
  transition: background .2s, border-color .2s;
}
.smart-search-bar:focus-within {
  background: rgba(255,255,255,.2);
  border-color: rgba(255,255,255,.6);
}
.smart-search-icon { flex-shrink: 0; color: rgba(255,255,255,.75); }
.smart-search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: .875rem;
  color: #fff;
  min-width: 0;
  padding: .2rem 0;
  font-family: inherit;
}
.smart-search-input::placeholder { color: rgba(255,255,255,.55); }

.smart-search-btn {
  flex-shrink: 0;
  overflow: hidden;
  max-width: 0;
  opacity: 0;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: #fff;
  color: #6d28d9;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: max-width .2s ease, opacity .2s ease, padding .2s ease;
  font-family: inherit;
}
.smart-search-bar.has-value .smart-search-btn {
  max-width: 90px;
  opacity: 1;
  padding: .3rem .85rem;
}
.smart-search-btn:hover { background: #ede9fe; }

/* ── AI summary on card ──────────────────────────────────── */
.job-ai-summary {
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.45;
  margin-bottom: .45rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

/* ── Smart search reason ─────────────────────────────────── */
.job-smart-reason {
  font-size: .78rem;
  color: #7c3aed;
  line-height: 1.4;
  margin-bottom: .4rem;
  display: flex;
  align-items: flex-start;
  gap: .3rem;
}
.smart-reason-icon {
  flex-shrink: 0;
  font-size: .72rem;
  opacity: .75;
  margin-top: .05rem;
}

/* ── Smart Search badge ──────────────────────────────────── */
.smart-search-badge {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  padding: .15rem .45rem;
  border-radius: 20px;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .02em;
  background: #ede9fe;
  color: #6d28d9;
  border: 1px solid #c4b5fd;
  white-space: nowrap;
}

.smart-score-badge {
  display: inline-flex;
  align-items: center;
  padding: .15rem .45rem;
  border-radius: 20px;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .02em;
  background: #f5f3ff;
  color: #7c3aed;
  border: 1px solid #ddd6fe;
  white-space: nowrap;
}

/* ── AI salary in meta row (low-prominence, shown only when present) ─── */
.job-ai-salary {
  display: inline-flex;
  align-items: center;
  gap: .22rem;
  font-size: .75rem;
  color: var(--muted);
  font-weight: 400;
  opacity: .85;
}

/* ── AI tags overflow pill ───────────────────────────────── */
.tag-ai-more {
  background: #ede9fe;
  color: #6d28d9;
  border-color: #c4b5fd;
  cursor: default;
  font-style: italic;
}

/* ── Match score badge ───────────────────────────────────── */
.match-score {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 700;
  padding: .1rem .45rem;
  letter-spacing: .02em;
  margin-right: .25rem;
  white-space: nowrap;
  border: 1px solid transparent;
}
.match-score--green {
  background: #f0fdf4;
  color: #16a34a;
  border-color: #86efac;
}
.match-score--yellow {
  background: #fffbeb;
  color: #d97706;
  border-color: #fde68a;
}
.match-score--grey {
  background: #f8fafc;
  color: var(--muted);
  border-color: var(--border);
}

/* ── Dev queue panel ─────────────────────────────────────── */
.dev-panel {
  position: fixed;
  z-index: 50;
  max-width: 420px;
  padding: 0;
  font-family: ui-monospace, 'Cascadia Code', monospace;
  font-size: .78rem;
}
.dev-panel:empty { display: none; }
.dev-panel-inner {
  background: #0f172a;
  color: #94a3b8;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  border: 1px solid #1e293b;
}
.dev-panel[hidden] { display: none; }
.dev-panel-title {
  font-weight: 700;
  color: #e2e8f0;
  margin-bottom: .6rem;
  font-size: .82rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.dev-panel-stats {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin-bottom: .75rem;
}
.dev-stat {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .15rem .55rem;
  border-radius: 6px;
  font-size: .75rem;
  font-weight: 600;
}
.dev-stat--pending    { background: #1e293b; color: #fbbf24; }
.dev-stat--processing { background: #1e293b; color: #60a5fa; }
.dev-stat--done       { background: #1e293b; color: #4ade80; }
.dev-stat--failed     { background: #1e293b; color: #fb923c; }
.dev-stat--perm       { background: #1e293b; color: #f87171; }
.dev-failure-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: .5rem;
  font-size: .74rem;
}
.dev-failure-table th {
  color: #64748b;
  text-align: left;
  padding: .25rem .5rem;
  border-bottom: 1px solid #1e293b;
  font-weight: 600;
  text-transform: uppercase;
  font-size: .68rem;
  letter-spacing: .04em;
}
.dev-cell {
  padding: .2rem .5rem;
  vertical-align: top;
  border-bottom: 1px solid #1e293b;
  color: #cbd5e1;
}
.dev-cell--reason { color: #f87171; max-width: 300px; word-break: break-word; }
.dev-failure-row:last-child .dev-cell { border-bottom: none; }
.dev-panel-updated {
  color: #475569;
  font-size: .68rem;
  margin-top: .5rem;
  text-align: right;
}

/* ── Site Footer ─────────────────────────────────────────── */
.site-footer {
  background: #0f172a;
  color: #94a3b8;
  border-top: 1px solid #1e293b;
  margin-top: auto;
}
.site-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: .82rem;
}
.site-footer-copy {
  white-space: nowrap;
  color: #64748b;
}
.site-footer-links {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.site-footer-links a {
  color: #94a3b8;
  text-decoration: none;
  transition: color .15s;
}
.site-footer-links a:hover {
  color: #e2e8f0;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; margin-top: 1rem; }
  .header-inner { gap: 1rem; }
  .location-input { flex: 1; }
  .search-divider { display: none; }
  .filter-bar { gap: .75rem; }
  .filter-section--tags { flex-basis: 100%; }
}
/* ── Application Generator ───────────────────────────────── */

.gen-app-btn {
  padding: .35rem .85rem;
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  background: #eef2ff;
  color: #4338ca;
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
  margin-left: .6rem;
}
.gen-app-btn:hover:not([disabled]) {
  background: #e0e7ff;
  border-color: #818cf8;
}
.app-action-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.app-btn-icon {
  font-size: .95em;
  line-height: 1;
}
.gen-app-btn:disabled {
  opacity: .6;
  cursor: not-allowed;
}
.gen-app-btn--loading {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}
.gen-spinner {
  width: 11px;
  height: 11px;
  border: 2px solid #a5b4fc;
  border-top-color: #4338ca;
  border-radius: 50%;
  animation: gen-spin .6s linear infinite;
  flex-shrink: 0;
}
@keyframes gen-spin {
  to { transform: rotate(360deg); }
}

.app-saved-badge {
  display: inline-flex;
  align-items: center;
  padding: .15rem .55rem;
  background: #dcfce7;
  color: #16a34a;
  border-radius: 99px;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .02em;
}

.gen-app-error {
  color: #dc2626;
  font-size: .78rem;
  margin: .35rem 0 0;
  padding: 0;
}
.gen-app-notice {
  color: #6b7280;
  font-size: .76rem;
  margin: .35rem 0 0;
  font-style: italic;
}

/* ── In-card application editor ─────────────────────────── */

.app-section {
  margin-top: 1rem;
  border-top: 1px solid var(--border);
  padding-top: .9rem;
}
.app-section-body {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.app-section--collapsed .app-section-body {
  display: none;
}
.app-section--collapsed .app-section-header {
  margin-bottom: 0;
}

.app-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .5rem;
  gap: .5rem;
  flex-wrap: wrap;
}

.app-section-title {
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.app-section-actions {
  display: flex;
  gap: .4rem;
}

.app-action-btn {
  padding: .25rem .65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
  font-size: .78rem;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.app-action-btn:hover {
  background: var(--light);
  border-color: #94a3b8;
}
.app-save-btn {
  background: #4f46e5;
  color: #ffffff;
  border-color: #4338ca;
  font-weight: 600;
  padding: .28rem .85rem;
}
.app-save-btn:hover {
  background: #4338ca;
  border-color: #3730a3;
}

.app-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: .65rem .8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafafa;
  color: var(--text);
  font-size: .85rem;
  line-height: 1.6;
  resize: vertical;
  font-family: inherit;
  transition: border-color .15s;
}
.app-textarea:focus {
  outline: none;
  border-color: var(--brand);
}
.app-textarea--readonly {
  background: #f1f5f9;
  color: var(--muted);
  resize: none;
  cursor: default;
}

.app-version-details {
  margin-top: .6rem;
}
.app-version-summary {
  font-size: .78rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  padding: .2rem 0;
}
.app-version-list {
  list-style: none;
  padding: .4rem 0 0 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.app-version-item {
  display: flex;
}
.app-version-load {
  background: none;
  border: none;
  padding: .2rem .4rem;
  font-size: .78rem;
  color: var(--brand);
  cursor: pointer;
  text-align: left;
  border-radius: 4px;
  transition: background .12s;
}
.app-version-load:hover {
  background: var(--brand-light);
}

/* ── Application modal ───────────────────────────────────── */

.app-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.app-modal {
  background: #ffffff;
  border-radius: 16px;
  padding: 1.75rem;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 24px 80px rgba(0,0,0,.35);
}

.app-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: .2rem .4rem;
  border-radius: 6px;
  transition: background .12s, color .12s;
}
.app-modal-close:hover { background: var(--light); color: var(--text); }

.app-modal-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 1.1rem;
  padding-right: 2rem;
}

.app-modal-section-label {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin-bottom: .4rem;
}

.app-modal-draft {
  margin-bottom: 1.1rem;
}

.app-modal-questions {
  display: flex;
  flex-direction: column;
  gap: .85rem;
  margin-bottom: 1.1rem;
}

.app-modal-question {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.app-modal-q-label {
  font-size: .85rem;
  font-weight: 500;
  color: var(--text);
}

.app-modal-q-input {
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .88rem;
  color: var(--text);
  background: var(--bg);
  transition: border-color .15s;
  font-family: inherit;
}
.app-modal-q-input:focus {
  outline: none;
  border-color: var(--brand);
}

.app-modal-submit {
  width: 100%;
  padding: .65rem;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.app-modal-submit:hover:not([disabled]) { background: var(--brand-hover); }
.app-modal-submit:disabled { opacity: .6; cursor: not-allowed; }

.app-modal-status {
  margin-top: .75rem;
  font-size: .82rem;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 480px) {
  .tabs .tab { padding: .4rem .6rem; font-size: .8rem; }
  .search-bar { flex-wrap: wrap; border-radius: 14px; padding: .5rem .75rem; }
  .search-btn { width: 100%; border-radius: 8px; }
  .companies-grid { grid-template-columns: 1fr; }
  .filter-bar-wrap { padding: .65rem 1rem; }
}
