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

/* ── Tokens ──
   Palette ported from the sibling HRMS (../ihrs-hrms): slate greys on a #f5f6f8
   ground, brand blue #1e5eff, white cards with slate-200 hairlines.

   Light is the default (that product is light-only), so it lives on bare `:root`.
   Dark is the opt-out: nav.js puts `.dark` on <html>. Theme-conditional rules
   elsewhere therefore read `:root:not(.dark)` for "light", never a `.light` class. */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --border-focus: rgba(30, 94, 255, 0.55);
  --border-hover: rgba(30, 94, 255, 0.35);
  --accent: #1e5eff;
  --accent-dim: rgba(30, 94, 255, 0.08);
  --accent-hover: #1749cc;
  --accent-fg: #ffffff;
  --accent-border: rgba(30, 94, 255, 0.25);
  --accent-dim-hover: rgba(30, 94, 255, 0.16);
  --text: #0f172a;
  --text-dim: #475569;
  --text-muted: #64748b;
  --success: #15803d;
  --success-bg: #dcfce7;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --radius: 12px;
  --radius-sm: 6px;
  --transition: 0.15s ease;
  /* Rail width — draggable, persisted by nav.js. The collapsed rail and the
     mobile rail are fixed 52px and override this. */
  --sidebar-w: 200px;
}

:root.dark {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #263449;
  --surface-3: #334155;
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.18);
  --border-focus: rgba(96, 165, 250, 0.6);
  --border-hover: rgba(96, 165, 250, 0.35);
  --accent: #60a5fa;
  --accent-dim: rgba(96, 165, 250, 0.14);
  --accent-hover: #3b82f6;
  --accent-fg: #0f172a;
  --accent-border: rgba(96, 165, 250, 0.32);
  --accent-dim-hover: rgba(96, 165, 250, 0.24);
  --text: #f1f5f9;
  --text-dim: #cbd5e1;
  --text-muted: #94a3b8;
  --success: #4ade80;
  --success-bg: rgba(74, 222, 128, 0.12);
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.12);
}

/* ── Candidate status colours ──
   Moved here from analytics.css so every token has one home. Each status keeps a
   distinct hue per theme; these are validated per surface, not flipped. */
:root {
  --status-approved: #34d399;
  --status-selected: #22c55e;
  --status-offer-accepted: #2dd4bf;
  --status-joined: #10b981;
  --status-interview: #38bdf8;
  --status-offer-awaited: #60a5fa;
  --status-offer-done: #818cf8;
  --status-rejected: #f87171;
  --status-rejected-client: #fb923c;
  --status-offer-rejected: #fb7185;
  --status-not-joined: #f472b6;
  --status-duplicate: #94a3b8;
  --status-sourced: #a5b4fc;
  --status-client-review: #7dd3fc;
  --status-invoicing: #fcd34d;
  --status-payment-received: #4ade80;
  --status-none: #64748b;
}

:root:not(.dark) {
  --status-approved: #059669;
  --status-selected: #16a34a;
  --status-offer-accepted: #0d9488;
  --status-joined: #047857;
  --status-interview: #0284c7;
  --status-offer-awaited: #2563eb;
  --status-offer-done: #4f46e5;
  --status-rejected: #dc2626;
  --status-rejected-client: #ea580c;
  --status-offer-rejected: #e11d48;
  --status-not-joined: #db2777;
  --status-duplicate: #64748b;
  --status-sourced: #6366f1;
  --status-client-review: #0891b2;
  --status-invoicing: #d97706;
  --status-payment-received: #15803d;
  --status-none: #475569;
}

/* ── Base ── */
html {
  scroll-behavior: smooth;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  font-weight: 400;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Loading bar ── */
@keyframes slide-right {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(300%);
  }
}

.loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--surface-2);
  z-index: 1000;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.2s;
}

.loading-bar.active {
  opacity: 1;
}

.loading-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 35%;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: slide-right 1.1s ease-in-out infinite;
}

/* ── Sidebar ──
   The sibling HRMS runs a dark slate rail against the light content area, in both
   of its themes. Rather than restate that on every descendant rule, the sidebar
   re-declares the palette tokens for its own subtree: custom properties inherit,
   so `.nav-link`, `.sidebar-footer`, `.sidebar-logout` and the rest resolve
   against these without any of them changing. Accent lifts to blue-400 because
   #1e5eff does not carry on a slate-900 ground. */
.sidebar {
  --surface: #0f172a;
  --surface-2: #1e293b;
  --surface-3: #334155;
  --border: #1e293b;
  --border-strong: #334155;
  --border-hover: rgba(96, 165, 250, 0.4);
  --text: #ffffff;
  --text-dim: #e2e8f0;
  --text-muted: #94a3b8;
  --accent: #60a5fa;
  --accent-dim: rgba(96, 165, 250, 0.16);

  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  transition: width 0.22s ease;
  overflow: hidden;
}

.sidebar.collapsed {
  width: 52px;
}

/* Drag handle on the rail's right edge. Injected by nav.js so the 16 pages that
   hand-roll the sidebar markup don't each need it. */
.sidebar-resizer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 5px;
  cursor: col-resize;
  background: transparent;
  border: 0;
  padding: 0;
  z-index: 1;
  transition: background var(--transition);
}

.sidebar-resizer:hover,
.sidebar-resizer:focus-visible,
body.sidebar-resizing .sidebar-resizer {
  background: var(--accent);
  outline: none;
}

/* Nothing to drag when the rail is icon-only. */
.sidebar.collapsed .sidebar-resizer {
  display: none;
}

/* While dragging: no width animation chasing the pointer, and no text selection. */
body.sidebar-resizing {
  cursor: col-resize;
  user-select: none;
}

body.sidebar-resizing .sidebar,
body.sidebar-resizing .main-content,
body.sidebar-resizing .nav-label,
body.sidebar-resizing .sidebar-wordmark {
  transition: none;
}

/* Sidebar header — brand + collapse button */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 0.85rem 0.75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-width: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  min-width: 0;
  overflow: hidden;
}

.sidebar-logo {
  display: none;
  height: 24px;
  width: auto;
  flex-shrink: 0;
  opacity: 0.9;
}

.sidebar-wordmark {
  display: flex;
  flex-direction: column;
  gap: 0.04rem;
  white-space: nowrap;
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.15s ease, max-width 0.22s ease;
  max-width: calc(var(--sidebar-w) - 80px);
}

.sidebar.collapsed .sidebar-wordmark {
  opacity: 0;
  max-width: 0;
}

.sidebar-title {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: -0.025em;
  color: var(--text);
  line-height: 1;
}

.sidebar-tagline {
  font-size: 0.52rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  line-height: 1;
}

.sidebar-toggle-btn {
  width: 22px;
  height: 22px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 2px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.sidebar-toggle-btn:hover {
  color: var(--text-dim);
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.sidebar.collapsed .sidebar-toggle-btn svg {
  transform: rotate(180deg);
}

/* Sidebar nav links */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem 0;
  scrollbar-width: none;
}

.sidebar-nav::-webkit-scrollbar {
  display: none;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.52rem 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  border-left: 2px solid transparent;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}

.nav-link svg {
  flex-shrink: 0;
}

.nav-link:hover {
  color: var(--text-dim);
  background: var(--surface-2);
}

.nav-link.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-left-color: var(--accent);
}

/* Collapsible nav group: clickable header + indented sub-links */
.nav-group-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.52rem 0.85rem;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  text-align: left;
  background: none;
  border: 0;
  border-left: 2px solid transparent;
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}

.nav-group-label:hover {
  color: var(--text-dim);
  background: var(--surface-2);
}

.nav-group-label svg {
  flex-shrink: 0;
}

.nav-caret {
  margin-left: auto;
  transition: transform 0.2s ease;
}

.nav-group.collapsed .nav-caret {
  transform: rotate(-90deg);
}

/* Hide children only when collapsed in the expanded sidebar; icon-only mode
   keeps them visible (the caret is hidden there, so there's no way to expand). */
.sidebar:not(.collapsed) .nav-group.collapsed .nav-group-children {
  display: none;
}

.sidebar.collapsed .nav-caret {
  display: none;
}

.nav-sublink {
  padding-left: 2.15rem;
  font-size: 0.78rem;
}

.sidebar.collapsed .nav-sublink {
  padding-left: 0.52rem;
}

.nav-label {
  overflow: hidden;
  opacity: 1;
  max-width: calc(var(--sidebar-w) - 80px);
  transition: opacity 0.15s ease, max-width 0.22s ease;
}

.sidebar.collapsed .nav-label {
  opacity: 0;
  max-width: 0;
}

.sidebar.collapsed .nav-link {
  justify-content: center;
  padding: 0.52rem;
}

/* Sidebar footer — user info, logout, theme */
.sidebar-footer {
  padding: 0.75rem 0.85rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex-shrink: 0;
  min-width: 0;
  overflow: hidden;
}

.user-info {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 1;
  transition: opacity 0.15s ease;
}

.sidebar.collapsed .user-info {
  opacity: 0;
  height: 0;
  margin: 0;
  padding: 0;
}

.sidebar-logout {
  background: var(--surface-2);
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 0.35rem 0.65rem;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background var(--transition), border-color var(--transition);
  opacity: 1;
  transition: opacity 0.15s ease, background var(--transition), border-color var(--transition);
}

.sidebar-logout:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
}

.sidebar.collapsed .sidebar-logout {
  opacity: 0;
  height: 0;
  overflow: hidden;
  padding: 0;
  border: none;
}

.sidebar-theme {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.theme-toggle {
  width: 26px;
  height: 26px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  transition: border-color var(--transition), background var(--transition);
  line-height: 1;
  flex-shrink: 0;
}

.theme-toggle::before {
  content: '☀';
}

:root:not(.dark) .theme-toggle::before {
  content: '☾';
}

.theme-toggle:hover {
  border-color: var(--border-hover);
  background: var(--surface-3);
}

.theme-toggle-label {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-muted);
  user-select: none;
  cursor: pointer;
  letter-spacing: 0.03em;
  white-space: nowrap;
  opacity: 1;
  transition: opacity 0.15s ease;
}

.sidebar.collapsed .theme-toggle-label {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

/* ── Main content area (offset by sidebar) ── */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  transition: margin-left 0.22s ease;
}

body.sidebar-collapsed .main-content {
  margin-left: 52px;
}

/* ── Layout ── */
.page-container {
  position: relative;
  z-index: 1;
  max-width: 940px;
  margin: 2.5rem auto;
  padding: 0 1.5rem 5rem;
}

/* ── Search Card ── */
.search-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ── Main search row ── */
.search-main {
  display: flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition);
}

.search-main:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.search-icon {
  padding: 0 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.search-main input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 0.85rem 0.75rem 0.85rem 0.25rem;
  font-size: 0.93rem;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  font-weight: 400;
  color: var(--text);
  outline: none;
}

.search-main input::placeholder {
  color: var(--text-muted);
}

/* ── Buttons ── */
.btn {
  padding: 0.75rem 1.6rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.78rem;
  font-weight: 700;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition), opacity var(--transition);
}

.btn-primary {
  padding: 0.55rem 1.25rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-family: inherit;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.btn-primary:hover {
  background: var(--accent-dim-hover);
  border-color: var(--accent);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ── Full-width search button ── */
.btn-search-full {
  width: 100%;
  padding: 1rem 1.5rem;
  font-size: 0.88rem;
  letter-spacing: 0.1em;
  border-radius: var(--radius);
}

/* ── (legacy .header-nav removed; sidebar styles above) ── */

/* ── Row / Field ── */
.row {
  display: flex;
  gap: 0.7rem;
  align-items: flex-end;
}

.row .field {
  flex: 1;
  min-width: 0;
}

.row .field.small {
  flex: 0 0 88px;
}

.field label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.label-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.65rem;
  opacity: 0.65;
}

.field input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.55rem 0.7rem;
  font-size: 0.85rem;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.field input::placeholder {
  color: var(--text-muted);
}

.field input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.6);
  cursor: pointer;
  opacity: 0.6;
}

:root:not(.dark) input[type="date"]::-webkit-calendar-picker-indicator {
  filter: none;
}

/* ── Filters toggle ── */
.filters-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  transition: color var(--transition);
  padding: 0.1rem 0;
}

.filters-toggle:hover {
  color: var(--text-dim);
}

.filters-toggle .chevron {
  transition: transform 0.22s ease;
}

.filters-toggle.open .chevron {
  transform: rotate(180deg);
}

.filter-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  display: none;
}

.filter-dot.visible {
  display: block;
  animation: blink 2s ease-in-out infinite;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

/* ── Divider ── */
.divider {
  height: 1px;
  background: var(--border);
}

/* ── Filters body ── */
.filters-body {
  display: none;
  flex-direction: column;
  gap: 0.85rem;
}

.filters-body.open {
  display: flex;
}

/* ── Tags ── */
.tags-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.4rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  border-radius: 2px;
  padding: 0.2rem 0.5rem;
  font-size: 0.73rem;
  font-weight: 500;
  color: var(--accent);
}

.tag button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--accent);
  opacity: 0.5;
  line-height: 1;
  display: flex;
  align-items: center;
  transition: opacity var(--transition);
}

.tag button:hover {
  opacity: 1;
}

/* ── Active filter chips ──
   Applied advanced filters stay visible after the panel collapses; each chip
   clears its own filter and re-runs the search. */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 1rem;
}

.active-filters:empty {
  display: none;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  font-family: inherit;
  font-size: 0.72rem;
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}

.filter-chip:hover {
  border-color: var(--border-hover);
  color: var(--text);
}

.filter-chip-label {
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.6rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.filter-chip-x {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1;
}

.filter-chip:hover .filter-chip-x {
  color: var(--accent);
}

/* ── Results toolbar — count on the left, ordering controls on the right ── */
.results-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 1.6rem 0 1rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--border);
}

.results-controls {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-left: auto;
}

.toolbar-field {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.toolbar-field span {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.toolbar-field select,
.toolbar-field input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.76rem;
  padding: 0.28rem 0.45rem;
}

.toolbar-field input {
  width: 4rem;
}

.toolbar-field select:focus,
.toolbar-field input:focus {
  outline: none;
  border-color: var(--border-hover);
}

/* ── Results meta ── */
.results-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 2rem 0 1.1rem;
}

.results-meta::before,
.results-meta::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.results-count {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Result card ── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 0.55rem;
  animation: fadeUp 0.32s ease both;
  transition: border-color var(--transition), box-shadow var(--transition);
  position: relative;
}

/* Amber left-border reveal on hover */
.result-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: var(--accent);
  transition: width 0.18s ease;
  z-index: 1;
}

.result-card:hover {
  border-color: var(--border-hover);
}

.result-card:hover::before {
  width: 2px;
}

/* ── Score strip (thin bar at top of card) ── */
.card-score-strip {
  height: 2px;
  background: var(--surface-2);
  position: relative;
  overflow: hidden;
}

.card-score-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: var(--accent);
  transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  transform-origin: left;
}

/* ── Card top ──
   The candidate identity block is the shared .pipe-card component (see
   candidate_card.css). Inside a result card it is chrome-less: the surrounding
   .result-card already owns the border, the score strip and the hover state. */
.result-card .pipe-card {
  background: none;
  border: none;
  border-radius: 0;
  margin: 0;
  padding: 1rem 1.15rem 0.75rem;
  cursor: default;
  align-items: flex-start;
}

.result-card .pipe-card:hover {
  background: none;
}

.result-card:hover .pipe-name {
  color: var(--accent);
}

/* Score badge — big % + label */
.score-badge {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.05rem;
  min-width: 3rem;
}

.score-pct {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -0.03em;
}

.score-lbl {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* PDF link */
.file-link {
  font-size: 0.7rem;
  font-weight: 600;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 0.3rem 0.65rem;
  transition: color var(--transition), border-color var(--transition);
}

.file-link:hover {
  color: var(--accent);
  border-color: var(--border-hover);
}

/* ── Result snippet ──
   The stretch of resume text that matched, so a card can be judged without
   opening the resume. Indented to line up under the avatar's text column. */
.result-snippet {
  padding: 0 1.15rem 0.7rem;
  padding-left: calc(1.15rem + 46px + 0.95rem);
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--text-dim);
}

.result-snippet mark {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 600;
  border-radius: 2px;
  padding: 0 0.12rem;
}

/* ── Candidate meta chips ── */
.candidate-meta {
  padding: 0 1.15rem 0.85rem;
  padding-left: calc(1.15rem + 46px + 0.95rem);
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 0.18rem 0.55rem;
  font-size: 0.71rem;
  color: var(--text-dim);
}

.meta-label {
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.62rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

/* ── Resume toggle ── */
.resume-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  padding: 0.6rem 1.25rem;
  border-top: 1px solid var(--border);
  transition: color var(--transition), background var(--transition);
}

.resume-toggle:hover {
  color: var(--text-dim);
  background: var(--surface-2);
}

.toggle-chevron {
  transition: transform 0.2s ease;
}

.resume-toggle.open .toggle-chevron {
  transform: rotate(180deg);
}

/* ── Resume body ── */
.resume-body {
  display: none;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.resume-body.open {
  display: block;
}

.resume-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  line-height: 1.8;
  color: var(--text-dim);
  max-height: 340px;
  overflow-y: auto;
  padding: 1rem 1.25rem;
}

.resume-text mark {
  background: var(--accent-border);
  color: var(--accent);
  border-radius: 1px;
  padding: 0 2px;
}

:root:not(.dark) .resume-text mark {
  background: rgba(194, 113, 12, 0.14);
  color: var(--accent-hover);
}

.resume-text::-webkit-scrollbar {
  width: 3px;
}

.resume-text::-webkit-scrollbar-track {
  background: transparent;
}

.resume-text::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* ── Resume file-preview toggle button ── */
.resume-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  padding: 0.3rem 0.65rem;
  border-radius: 2px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
  outline: none;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.resume-toggle-btn:hover {
  background: var(--accent-dim);
  border-color: var(--accent-dim-hover);
  color: var(--accent);
}

.resume-toggle-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent-dim-hover);
  color: var(--accent);
}

.resume-toggle-btn .chevron {
  display: inline-block;
  transition: transform 0.2s ease;
}

.resume-toggle-btn.active .chevron {
  transform: rotate(180deg);
}

/* ── Resume file-preview panel ── */
.resume-pdf-panel {
  display: none;
  border-top: 1px solid var(--border);
}

.resume-pdf-panel.open {
  display: block;
}

.resume-pdf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.75rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.resume-pdf-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.resume-pdf-open-link {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: opacity var(--transition);
}

.resume-pdf-open-link:hover {
  opacity: 0.75;
}

.resume-pdf-body {
  position: relative;
  min-height: 80px;
}

.resume-pdf-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  background: var(--surface-1);
}

.resume-pdf-panel iframe {
  display: none;
  width: 100%;
  height: 640px;
  border: none;
  background: var(--surface-1);
}

/* ── Spinner ── */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.spinner {
  display: inline-block;
  width: 11px;
  height: 11px;
  border: 2px solid rgba(0, 0, 0, 0.18);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.55s linear infinite;
  vertical-align: middle;
  margin-right: 0.4rem;
}

/* ── Error / Empty states ── */
.error-msg {
  margin-top: 1.5rem;
  padding: 0.85rem 1rem;
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.18);
  border-radius: var(--radius);
  font-size: 0.83rem;
}

.empty-state {
  margin-top: 4rem;
  text-align: center;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
  display: block;
  opacity: 0.25;
}

.empty-state p {
  font-size: 0.83rem;
  letter-spacing: 0.02em;
}

/* ── Scrollbars (global) ── */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* ── Responsive ── */
@media (max-width: 640px) {

  /* Force icon-only sidebar on mobile */
  .sidebar {
    width: 52px !important;
  }

  .sidebar-resizer {
    display: none;
  }

  .sidebar-wordmark,
  .nav-label,
  .theme-toggle-label,
  .user-info,
  .sidebar-logout {
    opacity: 0 !important;
    max-width: 0 !important;
    overflow: hidden !important;
    height: 0 !important;
    padding: 0 !important;
    border: none !important;
  }

  .nav-link {
    justify-content: center;
    padding: 0.52rem !important;
  }

  .main-content {
    margin-left: 52px !important;
  }

  .page-container {
    margin: 1.5rem auto;
    padding: 0 1rem 4rem;
  }

  .search-card {
    padding: 1.1rem 1.1rem;
  }

  .row {
    flex-wrap: wrap;
  }

  .row .field {
    min-width: calc(50% - 0.35rem);
  }

  .row .field.small {
    flex: 1;
    min-width: calc(50% - 0.35rem);
  }

  /* Reclaim the avatar's gutter — snippet and chips run full width on mobile. */
  .result-card .pipe-avatar {
    display: none;
  }

  .result-snippet,
  .candidate-meta {
    padding-left: 1.15rem;
  }

  .results-controls {
    margin-left: 0;
  }
}

/* ── Utility buttons ── */
.btn-secondary {
  background: var(--surface-2);
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 0.4rem 0.75rem;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: background var(--transition), border-color var(--transition);
}

.btn-secondary:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
}

/* ──────────────────────────────────────────────────────────────────────────
   Shared page components (promoted from per-page <style> blocks).
   Pages that need a different value override these in their own <style>;
   because the embedded block is loaded after this file, the override wins.
   ────────────────────────────────────────────────────────────────────────── */

/* ── Page header ── */
.page-header {
  margin-bottom: 1.75rem;
}

.page-title {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1;
  margin-bottom: 0.4rem;
}

.page-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ── Cards ── */
.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.card-title {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 1rem;
}

/* ── Form row ── */
.form-row {
  display: flex;
  gap: 0.85rem;
}

/* ── Feedback banner ── */
.feedback {
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  margin-bottom: 0.75rem;
  display: none;
}

.feedback.error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.18);
  display: block;
}

.feedback.success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.2);
  display: block;
}

/* ── Small / inline action buttons ── */
.btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.btn-ghost {
  background: none;
  color: var(--text-muted);
  border: 1px solid transparent;
  padding: 0.4rem 0.75rem;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  transition: color var(--transition), background var(--transition);
}

.btn-ghost:hover {
  color: var(--text-dim);
  background: var(--surface-2);
}

.btn-edit {
  background: var(--surface-2);
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 0.3rem 0.65rem;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition), border-color var(--transition);
}

.btn-edit:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.25);
  padding: 0.3rem 0.65rem;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition);
}

.btn-danger:hover {
  background: rgba(248, 113, 113, 0.2);
}

/* ── Boolean query tools ──
   Operator shortcuts under the search box plus the server's reading of the query,
   so the grouping a recruiter typed is visible before they run the search. */
.query-tools {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.5rem;
}

.op-btn {
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  border-radius: 2px;
  padding: 0.15rem 0.5rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  transition: background 0.15s ease;
}

.op-btn:hover {
  background: var(--accent-border);
}

.query-preview {
  margin-top: 0.4rem;
  font-size: 0.73rem;
  color: var(--text-muted);
}

.query-preview code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  color: var(--text-dim);
}

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

.query-hint {
  margin-top: 0.35rem;
  font-size: 0.71rem;
  color: var(--text-muted);
  opacity: 0.85;
}


/* ── Shiny animated "AI Generated" badge ──
 * Shared: the Candidate Pipeline cards and the Job View detail drawer both use it.
 * Page-specific tweaks (e.g. .pipe-match-row alignment) live in that page's CSS. */
.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.14rem 0.5rem 0.14rem 0.42rem;
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #fff;
  white-space: nowrap;
  vertical-align: middle;
  line-height: 1;
  background: linear-gradient(120deg, #7c3aed, #db2777, #f59e0b, #7c3aed);
  background-size: 250% 250%;
  animation: ai-flow 5s ease infinite;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.10), 0 2px 12px rgba(124, 58, 237, 0.35);
}

.ai-badge .ai-spark {
  flex-shrink: 0;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.6));
  transform-origin: center;
  animation: ai-twinkle 1.9s ease-in-out infinite;
}

@keyframes ai-flow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes ai-twinkle {
  0%, 100% { opacity: 0.6; transform: scale(0.8) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.15) rotate(18deg); }
}

/* ── "Search with AI criteria" button ──
 * Shared: the Job View drawer and the Search page's Job picker both run a Job's top
 * AI Search Criterion from it. Wears the .ai-badge gradient so the two read as one
 * feature. Width is left to the page — the drawer stretches it, the picker doesn't. */
.btn-ai-search {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.2rem;
  border: none;
  border-radius: var(--radius);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(120deg, #7c3aed, #db2777, #f59e0b, #7c3aed);
  background-size: 250% 250%;
  animation: ai-flow 5s ease infinite;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.10), 0 2px 12px rgba(124, 58, 237, 0.35);
  transition: box-shadow var(--transition), transform var(--transition);
}

.btn-ai-search:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18), 0 4px 18px rgba(124, 58, 237, 0.45);
}

.btn-ai-search .ai-spark {
  flex-shrink: 0;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.6));
}

/* Row-sized variant — fits a table cell (My Tasks) without shouting. Also used on
 * anchors, which need the underline off. */
.btn-ai-search.btn-ai-sm {
  gap: 0.35rem;
  padding: 0.3rem 0.6rem;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  border-radius: 3px;
  white-space: nowrap;
  text-decoration: none;
}

@media (prefers-reduced-motion: reduce) {
  .ai-badge, .ai-badge .ai-spark, .btn-ai-search { animation: none; }
  .btn-ai-search:hover { transform: none; }
}


/* ── Round level and status (ADR-0013) ──────────────────────────────────────
   Two axes on one round: which round it is (a chip before the name) and where
   it stands (a badge below). A round predating migration 037 has no level, so
   the chip is simply absent — never a placeholder. */

.iv-level {
  display: inline-block;
  margin-right: 0.45rem;
  padding: 0.05rem 0.35rem;
  border-radius: var(--radius-sm);
  background: var(--accent-dim);
  border: 1px solid var(--accent-dim-hover);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  vertical-align: 0.05em;
}

.iv-status {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
}

.iv-status.rs-round-clear {
  background-color: rgba(52, 211, 153, .12);
  border-color: rgba(52, 211, 153, .3);
  color: var(--success);
}

/* Both no-show kinds keep the danger look — the round did not happen either way;
   which side failed to appear is in the label, not the colour. */
.iv-status.rs-rejected,
.iv-status.rs-candidate-no-show-cns,
.iv-status.rs-panel-no-show-pns {
  background: var(--danger-bg);
  border-color: rgba(248, 113, 113, .3);
  color: var(--danger);
}

/* The three Link Sent outcomes share one look — they are the same moment in the
   round, differing only in how the candidate responded. */
.iv-status.rs-link-sent-crl,
.iv-status.rs-link-sent-clnr,
.iv-status.rs-link-sent-nr {
  background: var(--accent-dim);
  border-color: var(--accent-dim-hover);
  color: var(--accent);
}