/* ══════════════════════════════════════════════════════════
   JobHunt — Main Stylesheet
   Light / dark mode via [data-theme="dark"] on <html>
   ══════════════════════════════════════════════════════════ */

/* ── CSS Variables ──────────────────────────────────────── */
:root {
  --bg:           #f8fafc;
  --surface:      #ffffff;
  --surface-alt:  #f1f5f9;
  --border:       #e2e8f0;
  --text:         #0f172a;
  --text-muted:   #64748b;
  --primary:      #3b82f6;
  --primary-dark: #2563eb;
  --danger:       #ef4444;
  --danger-dark:  #dc2626;
  --success:      #10b981;
  --amber:        #f59e0b;
  --purple:       #8b5cf6;
  --nav-bg:       #1e293b;
  --nav-text:     #cbd5e1;
  --nav-active:   #ffffff;
  --shadow:       0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:    0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
  --radius:       8px;
  --radius-sm:    4px;
}

[data-theme="dark"] {
  --bg:           #0f172a;
  --surface:      #1e293b;
  --surface-alt:  #334155;
  --border:       #334155;
  --text:         #f1f5f9;
  --text-muted:   #94a3b8;
  --nav-bg:       #0f172a;
  --shadow:       0 1px 3px rgba(0,0,0,.4);
  --shadow-md:    0 4px 6px rgba(0,0,0,.4);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:           #0f172a;
    --surface:      #1e293b;
    --surface-alt:  #334155;
    --border:       #334155;
    --text:         #f1f5f9;
    --text-muted:   #94a3b8;
    --nav-bg:       #0f172a;
    --shadow:       0 1px 3px rgba(0,0,0,.4);
    --shadow-md:    0 4px 6px rgba(0,0,0,.4);
  }
}

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

html { font-size: 15px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ─────────────────────────────────────────────── */
.app-layout { display: flex; flex-direction: column; min-height: 100vh; }
.main-content { flex: 1; padding: 24px 0 48px; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ── Navigation ─────────────────────────────────────────── */
.navbar {
  background: var(--nav-bg);
  padding: 0 20px;
  display: flex;
  align-items: center;
  height: 52px;
  gap: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(255,255,255,.05);
}

.nav-brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  margin-right: 28px;
  letter-spacing: -.3px;
  text-decoration: none;
}
.nav-brand:hover { text-decoration: none; }

.nav-links { display: flex; align-items: center; gap: 4px; flex: 1; }

.nav-link {
  color: var(--nav-text);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  transition: color .15s, background .15s;
  text-decoration: none;
}
.nav-link:hover { color: var(--nav-active); background: rgba(255,255,255,.07); text-decoration: none; }
.nav-link.active { color: var(--nav-active); background: rgba(255,255,255,.1); }

.nav-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.theme-btn {
  background: none;
  border: 1px solid rgba(255,255,255,.2);
  color: var(--nav-text);
  border-radius: var(--radius-sm);
  width: 32px; height: 32px;
  cursor: pointer;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.theme-btn:hover { background: rgba(255,255,255,.1); }

/* User dropdown */
.user-menu { position: relative; }

.user-btn {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  color: var(--nav-active);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: .85rem;
  cursor: pointer;
  transition: background .15s;
}
.user-btn:hover { background: rgba(255,255,255,.18); }

.user-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 160px;
  z-index: 200;
  overflow: hidden;
}
.user-dropdown.open { display: block; }

.user-dropdown a, .user-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 14px;
  font-size: .875rem;
  color: var(--text);
  background: none;
  border: none;
  cursor: pointer;
  transition: background .12s;
  text-decoration: none;
}
.user-dropdown a:hover, .user-dropdown button:hover {
  background: var(--surface-alt);
  text-decoration: none;
}
.user-dropdown hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

/* ── Page Header ─────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.page-header h2 { font-size: 1.4rem; font-weight: 700; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card-title { font-size: 1rem; font-weight: 600; margin-bottom: 14px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background .15s, opacity .15s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { text-decoration: none; opacity: .9; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary  { background: var(--primary);  color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger   { background: var(--danger);   color: #fff; }
.btn-danger:hover { background: var(--danger-dark); }
.btn-ghost {
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--border); }

.btn-sm  { padding: 4px 10px; font-size: .8rem; }
.btn-xs  { padding: 2px 7px;  font-size: .75rem; }
.btn-full { width: 100%; justify-content: center; }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: 5px; color: var(--text); }

.form-input {
  width: 100%;
  padding: 8px 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: .9rem;
  transition: border-color .15s;
}
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.form-input:disabled { opacity: .55; cursor: not-allowed; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

.form-actions { display: flex; gap: 8px; margin-top: 16px; }

select.form-input { cursor: pointer; }
textarea.form-input { resize: vertical; min-height: 80px; }

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  margin-bottom: 16px;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
[data-theme="dark"] .alert-success { background: #064e3b; color: #a7f3d0; border-color: #065f46; }
[data-theme="dark"] .alert-error   { background: #7f1d1d; color: #fca5a5; border-color: #991b1b; }

/* ── Chips / Pills ───────────────────────────────────────── */
.chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 500;
}
.chip-green  { background: #d1fae5; color: #065f46; }
.chip-blue   { background: #dbeafe; color: #1e40af; }
.chip-amber  { background: #fef3c7; color: #92400e; }
.chip-gray   { background: var(--surface-alt); color: var(--text-muted); border: 1px solid var(--border); }
.chip-red    { background: #fee2e2; color: #991b1b; }

[data-theme="dark"] .chip-green  { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .chip-blue   { background: #1e3a8a; color: #93c5fd; }
[data-theme="dark"] .chip-amber  { background: #78350f; color: #fcd34d; }
[data-theme="dark"] .chip-red    { background: #7f1d1d; color: #fca5a5; }

/* Score badges */
.score-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  font-weight: 700;
}
.score-badge.green  { background: #d1fae5; color: #065f46; }
.score-badge.blue   { background: #dbeafe; color: #1e40af; }
.score-badge.amber  { background: #fef3c7; color: #92400e; }
.score-badge.gray   { background: var(--surface-alt); color: var(--text-muted); }

[data-theme="dark"] .score-badge.green  { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .score-badge.blue   { background: #1e3a8a; color: #93c5fd; }
[data-theme="dark"] .score-badge.amber  { background: #78350f; color: #fcd34d; }

/* Easy apply badge */
.easy-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 600;
  background: #dbeafe;
  color: #1e40af;
}
[data-theme="dark"] .easy-badge { background: #1e3a8a; color: #93c5fd; }

/* Remote badge */
.remote-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 600;
  background: #d1fae5;
  color: #065f46;
}

/* New dot */
.new-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--primary);
  margin-right: 5px;
  vertical-align: middle;
}

/* New badge */
.new-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: .8rem;
  font-weight: 700;
  background: var(--primary);
  color: #fff;
  margin-right: 6px;
}

/* Red flag pill */
.rf-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 600;
  background: #fee2e2;
  color: #991b1b;
  margin-right: 4px;
}
[data-theme="dark"] .rf-pill { background: #7f1d1d; color: #fca5a5; }

/* Keyword pills */
.kw-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: .75rem;
  background: var(--surface-alt);
  color: var(--text-muted);
  border: 1px solid var(--border);
  margin: 2px;
}
.kw-pill.green  { background: #d1fae5; color: #065f46; border-color: #6ee7b7; }
.kw-pill.red    { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.kw-pill.blue   { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }
.kw-pill.purple { background: #ede9fe; color: #5b21b6; border-color: #c4b5fd; }

[data-theme="dark"] .kw-pill.green  { background: #064e3b; color: #6ee7b7; border-color: #065f46; }
[data-theme="dark"] .kw-pill.red    { background: #7f1d1d; color: #fca5a5; border-color: #991b1b; }
[data-theme="dark"] .kw-pill.blue   { background: #1e3a8a; color: #93c5fd; border-color: #1e40af; }
[data-theme="dark"] .kw-pill.purple { background: #4c1d95; color: #c4b5fd; border-color: #5b21b6; }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }

.jobs-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: .875rem;
}
.jobs-table th {
  background: var(--surface-alt);
  padding: 10px 12px;
  text-align: left;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.jobs-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.jobs-table tbody tr:last-child td { border-bottom: none; }
.jobs-table tbody tr:hover { background: var(--surface-alt); }
.job-row { cursor: pointer; }

.loading-row { text-align: center; color: var(--text-muted); padding: 32px !important; }
.kw-cell { max-width: 200px; }

/* ── Status select ───────────────────────────────────────── */
.status-select {
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: .8rem;
  cursor: pointer;
}

/* ── Pagination ──────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
}
.page-info { color: var(--text-muted); font-size: .85rem; min-width: 90px; text-align: center; }

/* ── Stats row ───────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 800px) { .stats-row { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 500px) { .stats-row { grid-template-columns: 1fr 1fr; } }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-card.green  { border-top: 3px solid var(--success); }
.stat-card.blue   { border-top: 3px solid var(--primary); }
.stat-card.amber  { border-top: 3px solid var(--amber); }
.stat-card.purple { border-top: 3px solid var(--purple); }

.stat-value { font-size: 1.9rem; font-weight: 800; color: var(--text); line-height: 1; }
.stat-value-sm { font-size: 1.3rem; font-weight: 700; color: var(--text); }
.stat-label { font-size: .78rem; color: var(--text-muted); margin-top: 4px; }

/* ── Dashboard ───────────────────────────────────────────── */
.welcome-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.welcome-title { font-size: 1.25rem; font-weight: 700; }
.welcome-sub { color: var(--text-muted); font-size: .9rem; margin-top: 4px; }
.welcome-actions { display: flex; gap: 8px; }

.profile-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.pill-label { font-size: .8rem; color: var(--text-muted); }
.pill {
  padding: 4px 12px;
  border-radius: 99px;
  font-size: .8rem;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  color: var(--text-muted);
  transition: all .15s;
}
.pill.active, .pill:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
}
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label { font-size: .78rem; color: var(--text-muted); }
.filter-group input[type="text"],
.filter-group select { padding: 5px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-size: .85rem; }
.filter-group input[type="range"] { width: 120px; }

/* ── Job Detail ──────────────────────────────────────────── */
.back-link { margin-bottom: 14px; font-size: .875rem; }
.back-link a { color: var(--text-muted); }

.job-detail-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) { .job-detail-grid { grid-template-columns: 1fr; } }

.job-left { min-width: 0; }

.job-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.job-header-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.job-title-large { font-size: 1.4rem; font-weight: 700; line-height: 1.3; margin-bottom: 6px; }
.job-company-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.job-company { font-weight: 600; font-size: 1rem; }
.salary-text { color: var(--success); font-weight: 600; }
.job-meta-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.job-actions-row { display: flex; gap: 8px; flex-wrap: wrap; }

.notes-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.notes-textarea {
  width: 100%;
  min-height: 80px;
  padding: 8px 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: .875rem;
  resize: vertical;
  font-family: inherit;
}

.jd-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.section-title { font-size: .95rem; font-weight: 600; margin-bottom: 12px; }
.jd-body {
  font-size: .875rem;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 500px;
  overflow-y: auto;
}

/* Job right panel */
.job-right { display: flex; flex-direction: column; gap: 16px; }

/* ATS Ring */
.ats-ring-wrap {
  position: relative;
  width: 160px;
  height: 160px;
  margin: 0 auto 14px;
}
.ats-score-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 800;
}
.no-cv-msg { text-align: center; padding: 12px 0; }
.no-cv-msg p { color: var(--text-muted); margin-bottom: 10px; }

.kw-section { margin-top: 12px; }
.kw-group { margin-bottom: 10px; }
.kw-label { font-size: .78rem; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; }
.kw-list { display: flex; flex-wrap: wrap; gap: 4px; }

.suggestions-list { padding-left: 16px; font-size: .82rem; color: var(--text-muted); margin-top: 4px; }
.suggestions-list li { margin-bottom: 4px; }

/* Tailor card */
.tailor-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  color: var(--text-muted);
  font-size: .875rem;
}

.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.tailor-result { padding-top: 10px; }
.score-improvement {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 1.1rem;
  font-weight: 700;
}
.score-before { color: var(--text-muted); }
.score-arrow  { color: var(--text-muted); }
.score-after  { color: var(--success); }

.changes-list { margin-bottom: 12px; }
.change-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: .82rem;
  overflow: hidden;
}
.change-item summary {
  padding: 7px 10px;
  cursor: pointer;
  background: var(--surface-alt);
  font-weight: 500;
  list-style: none;
  user-select: none;
}
.change-item summary::-webkit-details-marker { display: none; }
.change-item[open] summary { border-bottom: 1px solid var(--border); }
.change-body { padding: 8px 10px; }
.change-original { margin-bottom: 6px; color: var(--text-muted); }
.change-modified { color: var(--text); }

.download-row { display: flex; gap: 8px; }

.version-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: .85rem;
}
.version-row:last-child { border-bottom: none; }
.version-badge {
  background: var(--primary);
  color: #fff;
  padding: 1px 7px;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 700;
}
.version-scores { flex: 1; color: var(--text-muted); }
.version-dl { display: flex; gap: 4px; }

/* ── Search Profiles ─────────────────────────────────────── */
.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.profile-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.profile-name { font-weight: 700; font-size: 1rem; margin-right: 8px; }
.profile-actions { display: flex; gap: 6px; flex-shrink: 0; }

.profile-card-body { font-size: .85rem; }
.profile-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  margin-bottom: 8px;
}
.detail-label { font-size: .75rem; font-weight: 600; color: var(--text-muted); display: block; margin-bottom: 3px; }
.profile-meta { font-size: .8rem; color: var(--text-muted); }

/* Tag input widget */
.tag-input-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  min-height: 38px;
  cursor: text;
  align-items: center;
}
.tag-input-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.tag-input-field {
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: .875rem;
  min-width: 80px;
  flex: 1;
}
.tag { display: inline-flex; align-items: center; gap: 3px; }
.tag-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  font-size: 1rem;
  line-height: 1;
  padding: 0 1px;
  opacity: .7;
}
.tag-remove:hover { opacity: 1; }

.checkbox-group { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: .875rem; }
.checkbox-group label { display: flex; align-items: center; gap: 4px; cursor: pointer; }

.toggle { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 99px;
  cursor: pointer;
  transition: background .2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── CV Library ──────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab {
  padding: 9px 18px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted);
  transition: color .15s, border-color .15s;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab:hover { color: var(--text); }

/* Upload area */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.upload-area:hover, .upload-area.drag-over {
  border-color: var(--primary);
  background: rgba(59,130,246,.04);
}
.upload-icon { font-size: 2.5rem; margin-bottom: 8px; }
.upload-text { font-size: .9rem; color: var(--text-muted); line-height: 1.5; }

.upload-progress { padding: 12px 0; }
.progress-bar { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; margin-bottom: 6px; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 99px; width: 100%; animation: progress-pulse 1.2s ease-in-out infinite; }
@keyframes progress-pulse { 0%,100% { opacity: .6; } 50% { opacity: 1; } }

/* CV Cards (master) */
.cv-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  gap: 12px;
}
.cv-card-left { display: flex; align-items: center; gap: 12px; }
.cv-icon { font-size: 1.8rem; }
.cv-name { font-weight: 600; margin-bottom: 2px; }
.cv-card-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* Tailored CV grid */
.tailored-stats { display: flex; gap: 12px; margin-bottom: 14px; font-size: .875rem; }
.tailored-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }

.tailored-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  font-size: .875rem;
}
.tailored-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.tailored-job-title { font-weight: 600; margin-bottom: 2px; }
.ats-improvement { display: flex; align-items: center; gap: 6px; margin: 8px 0; font-size: .9rem; }
.improvement-delta { color: var(--success); font-weight: 700; font-size: .8rem; }
.tailored-card-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

/* ── Admin ───────────────────────────────────────────────── */
.admin-token-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  text-align: center;
}
@media (max-width: 700px) { .admin-token-grid { grid-template-columns: repeat(3, 1fr); } }

/* ── Login page ──────────────────────────────────────────── */
.login-body {
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.login-wrap { width: 100%; max-width: 400px; padding: 20px; }
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-md);
}
.login-logo { font-size: 2.5rem; text-align: center; margin-bottom: 8px; }
.login-title { font-size: 1.4rem; font-weight: 800; text-align: center; margin-bottom: 4px; }
.login-sub { font-size: .875rem; color: var(--text-muted); text-align: center; margin-bottom: 20px; }
.login-form { margin-top: 20px; }

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: .9rem;
}
.empty-state p { margin-bottom: 12px; }

/* ── Misc helpers ────────────────────────────────────────── */
.muted-text  { color: var(--text-muted); }
.small-text  { font-size: .8rem; }
.inline-link { font-size: .8rem; color: var(--primary); }

/* ── Toast ───────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  z-index: 9999;
  box-shadow: var(--shadow-md);
  transition: opacity .3s, transform .3s;
  pointer-events: none;
}
.toast-ok    { background: #1e293b; color: #f1f5f9; }
.toast-error { background: #991b1b; color: #fff; }
[data-theme="dark"] .toast-ok { background: #f1f5f9; color: #0f172a; }

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
