/*
 * styles.css — VisaMatch AI design system
 *
 * A note on the stack. The PRD names TailwindCSS; this is a hand-written
 * stylesheet instead, for the reasons the same PRD gives for choosing vanilla
 * JS: performance, simplicity, fewer dependencies, zero cost. Tailwind here
 * would mean either a build step (contradicting "no framework") or the Play
 * CDN, which ships a ~400KB runtime compiler and would blow the <2s first-load
 * budget on its own. What follows is the same utility-plus-component model,
 * precompiled by hand: ~15KB, no build, no runtime.
 *
 * Design language: Linear / Vercel / Stripe — restrained palette, one accent,
 * real hierarchy from spacing and weight rather than colour.
 */

/* ==========================================================================
   1. Tokens
   ========================================================================== */

:root {
  /* Neutrals — the entire UI is built from these. */
  --bg: #fbfbfa;
  --bg-subtle: #f4f4f2;
  --surface: #ffffff;
  --surface-hover: #f8f8f7;
  --border: #e6e6e3;
  --border-strong: #d4d4d0;

  --text: #1a1a18;
  --text-secondary: #5c5c57;
  --text-muted: #8a8a83;

  /* One accent. Used for primary actions and focus only. */
  --accent: #2b6cb0;
  --accent-hover: #245a94;
  --accent-subtle: #eef4fb;
  --accent-border: #c5daf0;

  /* Semantic — score zones and status. */
  --success: #1f7a4d;
  --success-subtle: #e9f5ee;
  --warning: #9a6212;
  --warning-subtle: #fdf3e3;
  --danger: #b0322a;
  --danger-subtle: #fbeceb;
  --info: #2b6cb0;
  --info-subtle: #eef4fb;

  --radius-sm: 5px;
  --radius: 8px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.04);
  --shadow: 0 1px 3px rgb(0 0 0 / 0.06), 0 1px 2px rgb(0 0 0 / 0.04);
  --shadow-lg: 0 12px 32px -8px rgb(0 0 0 / 0.14), 0 4px 12px -4px rgb(0 0 0 / 0.06);

  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter,
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --sidebar-width: 232px;
  --header-height: 60px;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131315;
    --bg-subtle: #1a1a1d;
    --surface: #1c1c1f;
    --surface-hover: #232327;
    --border: #2c2c31;
    --border-strong: #3a3a40;

    --text: #ececed;
    --text-secondary: #a4a4ad;
    --text-muted: #71717a;

    --accent: #6ea8e8;
    --accent-hover: #86b8ee;
    --accent-subtle: #17253a;
    --accent-border: #2b4a72;

    --success: #55c48a;
    --success-subtle: #14301f;
    --warning: #e0a84a;
    --warning-subtle: #33260f;
    --danger: #ef7a72;
    --danger-subtle: #351a19;
    --info: #6ea8e8;
    --info-subtle: #17253a;

    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.3);
    --shadow: 0 1px 3px rgb(0 0 0 / 0.4);
    --shadow-lg: 0 12px 32px -8px rgb(0 0 0 / 0.6);
  }
}

/* ==========================================================================
   2. Reset
   ========================================================================== */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

::selection {
  background: var(--accent-subtle);
  color: var(--text);
}

/* ==========================================================================
   3. Typography
   ========================================================================== */

h1,
h2,
h3,
h4 {
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.011em;
}

h1 {
  font-size: 22px;
}
h2 {
  font-size: 17px;
}
h3 {
  font-size: 15px;
}
h4 {
  font-size: 13px;
}

.text-secondary {
  color: var(--text-secondary);
}
.text-muted {
  color: var(--text-muted);
}
.text-sm {
  font-size: 13px;
}
.text-xs {
  font-size: 12px;
}
.text-mono {
  font-family: var(--font-mono);
  font-size: 12px;
}
.font-medium {
  font-weight: 500;
}
.font-semibold {
  font-weight: 600;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==========================================================================
   4. Layout utilities
   ========================================================================== */

.stack {
  display: flex;
  flex-direction: column;
}
.row {
  display: flex;
  align-items: center;
}
.row-start {
  display: flex;
  align-items: flex-start;
}
.between {
  justify-content: space-between;
}
.center {
  justify-content: center;
  align-items: center;
}
.wrap {
  flex-wrap: wrap;
}
.grow {
  flex: 1;
  min-width: 0;
}
.shrink-0 {
  flex-shrink: 0;
}

.gap-1 {
  gap: 4px;
}
.gap-2 {
  gap: 8px;
}
.gap-3 {
  gap: 12px;
}
.gap-4 {
  gap: 16px;
}
.gap-5 {
  gap: 20px;
}
.gap-6 {
  gap: 24px;
}

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }

.grid {
  display: grid;
  gap: 16px;
}
.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   5. App shell
   ========================================================================== */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-subtle);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px 18px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
}

.brand-mark {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), #4a90d9);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
}

.nav-item:hover {
  background: var(--surface-hover);
  color: var(--text);
  text-decoration: none;
}

.nav-item.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.75;
}

.nav-section {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 16px 10px 6px;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--header-height);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  gap: 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.content {
  padding: 28px;
  max-width: 1240px;
  width: 100%;
  flex: 1;
}

/* ==========================================================================
   6. Cards & surfaces
   ========================================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.card-compact {
  padding: 14px;
}

.card-interactive {
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease),
    transform 0.15s var(--ease);
}

.card-interactive:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.divider {
  height: 1px;
  background: var(--border);
  border: none;
  margin: 16px 0;
}

/* Stat tile — the dashboard KPI row. */
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-value {
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

.stat-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ==========================================================================
   7. Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s var(--ease), border-color 0.12s var(--ease),
    opacity 0.12s var(--ease);
}

.btn:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--text-muted);
  text-decoration: none;
}

.btn:active:not(:disabled) {
  transform: translateY(0.5px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

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

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: transparent;
  color: var(--text);
}

.btn-danger {
  color: var(--danger);
  border-color: var(--border-strong);
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-subtle);
  border-color: var(--danger);
}

.btn-sm {
  padding: 4px 9px;
  font-size: 12px;
}

.btn-lg {
  padding: 10px 18px;
  font-size: 14px;
}

.btn-block {
  width: 100%;
}

.btn svg {
  width: 14px;
  height: 14px;
}

/* Loading state: the label is replaced by a spinner, width preserved. */
.btn[data-loading="true"] {
  color: transparent !important;
  position: relative;
  pointer-events: none;
}

.btn[data-loading="true"]::after {
  content: "";
  position: absolute;
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  color: var(--text);
}

.btn-primary[data-loading="true"]::after {
  color: #fff;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   8. Forms
   ========================================================================== */

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
}

.hint {
  font-size: 12px;
  color: var(--text-muted);
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  transition: border-color 0.12s var(--ease), box-shadow 0.12s var(--ease);
}

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

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.6;
}

.textarea-mono {
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8a83' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  padding-right: 28px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13.5px;
}

.checkbox input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Drag & drop CV upload target. */
.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-subtle);
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

/* ==========================================================================
   9. Badges, pills, chips
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 550;
  line-height: 1.6;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.badge-success {
  background: var(--success-subtle);
  color: var(--success);
  border-color: transparent;
}
.badge-warning {
  background: var(--warning-subtle);
  color: var(--warning);
  border-color: transparent;
}
.badge-danger {
  background: var(--danger-subtle);
  color: var(--danger);
  border-color: transparent;
}
.badge-info {
  background: var(--info-subtle);
  color: var(--info);
  border-color: transparent;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
}

.chip-removable button {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  line-height: 1;
  font-size: 14px;
}

.chip-removable button:hover {
  color: var(--danger);
}

/* ==========================================================================
   10. Score visualisation
   ========================================================================== */

/*
 * Score zones per spec §10, file 4:
 *   90+   Excellent · 70-90 Good · 50-70 Possible · <50 Weak
 * Colour is never the only signal — the number and label always accompany it.
 */

.score {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.score-lg {
  font-size: 24px;
}
.score-md {
  font-size: 17px;
}
.score-sm {
  font-size: 14px;
}

.score-suffix {
  font-size: 0.62em;
  font-weight: 500;
  color: var(--text-muted);
}

.score-excellent {
  color: var(--success);
}
.score-good {
  color: var(--info);
}
.score-possible {
  color: var(--warning);
}
.score-weak {
  color: var(--danger);
}

.meter {
  height: 6px;
  border-radius: 999px;
  background: var(--bg-subtle);
  overflow: hidden;
  border: 1px solid var(--border);
}

.meter-fill {
  height: 100%;
  border-radius: 999px;
  background: currentColor;
  transition: width 0.5s var(--ease);
}

.meter-row {
  display: grid;
  grid-template-columns: 130px 1fr 42px;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
}

.meter-row .meter-label {
  color: var(--text-secondary);
}

.meter-row .meter-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 550;
}

/* Circular score gauge, drawn with a conic gradient. */
.gauge {
  --value: 0;
  --size: 76px;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(
    currentColor calc(var(--value) * 1%),
    var(--bg-subtle) 0
  );
  position: relative;
  flex-shrink: 0;
}

.gauge::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: var(--surface);
}

.gauge-inner {
  position: relative;
  text-align: center;
  line-height: 1.15;
}

.gauge-value {
  font-size: 19px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.gauge-label {
  font-size: 9.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* ==========================================================================
   11. Job card
   ========================================================================== */

.job-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.job-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.job-logo {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.job-logo-fallback {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.job-title {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.008em;
}

.job-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.job-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.job-scores {
  display: flex;
  gap: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.job-score-item {
  flex: 1;
  min-width: 0;
}

.job-score-item .stat-label {
  font-size: 10.5px;
}

.job-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ==========================================================================
   12. Kanban board
   ========================================================================== */

.kanban {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(248px, 1fr);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
  align-items: start;
}

.kanban-column {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  min-height: 120px;
}

.kanban-column.dragover {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.kanban-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px 10px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.kanban-count {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 7px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 11px;
  margin-bottom: 8px;
  cursor: grab;
  transition: border-color 0.12s var(--ease), box-shadow 0.12s var(--ease);
}

.kanban-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.kanban-card:active {
  cursor: grabbing;
}

.kanban-card.dragging {
  opacity: 0.45;
}

/* ==========================================================================
   13. Tabs
   ========================================================================== */

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}

.tab {
  padding: 8px 13px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.12s var(--ease), border-color 0.12s var(--ease);
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* ==========================================================================
   14. Toast
   ========================================================================== */

.toast-stack {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
  max-width: min(400px, calc(100vw - 40px));
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: toast-in 0.2s var(--ease);
}

.toast-success {
  border-left-color: var(--success);
}
.toast-error {
  border-left-color: var(--danger);
}
.toast-info {
  border-left-color: var(--info);
}

.toast-close {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  line-height: 1;
  font-size: 16px;
  flex-shrink: 0;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ==========================================================================
   15. Modal
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 0.45);
  backdrop-filter: blur(2px);
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
  animation: fade-in 0.15s var(--ease);
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 720px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  animation: modal-in 0.18s var(--ease);
}

.modal-sm {
  max-width: 440px;
}
.modal-lg {
  max-width: 1000px;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(8px);
  }
}

/* ==========================================================================
   16. States: empty, loading, error
   ========================================================================== */

.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}

.empty-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 14px;
  opacity: 0.3;
}

.empty h3 {
  color: var(--text);
  margin-bottom: 5px;
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-subtle) 25%,
    var(--surface-hover) 50%,
    var(--bg-subtle) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

.skeleton-text {
  height: 11px;
  margin-bottom: 7px;
}

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  display: flex;
  gap: 9px;
  align-items: flex-start;
  border: 1px solid;
}

.alert-info {
  background: var(--info-subtle);
  border-color: var(--accent-border);
  color: var(--text);
}
.alert-warning {
  background: var(--warning-subtle);
  border-color: transparent;
  color: var(--text);
}
.alert-danger {
  background: var(--danger-subtle);
  border-color: transparent;
  color: var(--text);
}
.alert-success {
  background: var(--success-subtle);
  border-color: transparent;
  color: var(--text);
}

/* ==========================================================================
   17. Diff view (Resume Lab)
   ========================================================================== */

.diff {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.diff-pane {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.diff-head {
  padding: 9px 13px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.diff-body {
  padding: 13px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-y: auto;
  max-height: 460px;
  background: var(--surface);
}

.change-row {
  border-left: 2px solid var(--accent);
  padding: 8px 0 8px 12px;
  margin-bottom: 12px;
}

.change-before {
  color: var(--danger);
  text-decoration: line-through;
  opacity: 0.75;
}

.change-after {
  color: var(--success);
}

/* ==========================================================================
   18. Login
   ========================================================================== */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 50% -10%, var(--accent-subtle), transparent 70%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-lg);
}

/* ==========================================================================
   19. Table
   ========================================================================== */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.table tr:last-child td {
  border-bottom: none;
}

.table-hover tbody tr:hover {
  background: var(--surface-hover);
}

/* Horizontal scroll container — tables and wide content must scroll
   themselves, never the page body. */
.scroll-x {
  overflow-x: auto;
  max-width: 100%;
}

/* ==========================================================================
   20. Sparkline / bar chart
   ========================================================================== */

.bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 90px;
}

.bar {
  flex: 1;
  min-width: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
  opacity: 0.8;
  transition: opacity 0.12s var(--ease);
  min-height: 2px;
}

.bar:hover {
  opacity: 1;
}

.funnel-step {
  display: grid;
  grid-template-columns: 110px 1fr 70px;
  align-items: center;
  gap: 12px;
  padding: 7px 0;
}

.funnel-bar {
  height: 24px;
  background: var(--accent-subtle);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
}

.funnel-fill {
  height: 100%;
  background: var(--accent);
  opacity: 0.75;
  transition: width 0.5s var(--ease);
}

/* ==========================================================================
   21. Responsive
   ========================================================================== */

@media (max-width: 1080px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .diff {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 0.2s var(--ease);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    transform: none;
  }

  .sidebar-scrim {
    position: fixed;
    inset: 0;
    background: rgb(0 0 0 / 0.4);
    z-index: 50;
  }

  .menu-toggle {
    display: inline-flex !important;
  }

  .content,
  .topbar {
    padding-left: 16px;
    padding-right: 16px;
  }

  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .meter-row {
    grid-template-columns: 100px 1fr 38px;
  }
}

@media (max-width: 560px) {
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .job-scores {
    flex-wrap: wrap;
    gap: 10px;
  }

  .job-score-item {
    flex-basis: 45%;
  }
}

.menu-toggle {
  display: none;
}

/* Screen-reader-only text — labels for icon-only controls. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media print {
  .sidebar,
  .topbar,
  .job-actions,
  .toast-stack {
    display: none !important;
  }
  .app {
    grid-template-columns: 1fr;
  }
  .content {
    padding: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
