/* ============================================================
   JobBot V2 — Design System
   ============================================================ */

:root {
  /* Colors */
  --color-bg: #f3f5f9;
  --color-surface: #ffffff;
  --color-border: #e5e7eb;
  --color-border-strong: #d1d5db;

  --color-text: #1f2937;
  --color-text-secondary: #4b5563;
  --color-text-muted: #6b7280;
  --color-text-heading: #111827;

  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-primary-light: #eff6ff;

  --color-success: #22c55e;
  --color-success-bg: #f0fdf4;
  --color-success-border: #86efac;
  --color-success-text: #14532d;

  --color-warning: #f59e0b;
  --color-warning-bg: #fffbeb;
  --color-warning-border: #fcd34d;

  --color-danger: #dc2626;
  --color-danger-hover: #b91c1c;
  --color-danger-bg: #fef2f2;
  --color-danger-border: #fca5a5;
  --color-danger-text: #7f1d1d;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;

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

  --text-xs: 12px;
  --text-sm: 13px;
  --text-base: 14px;
  --text-md: 15px;
  --text-lg: 18px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --text-3xl: 30px;
  --text-4xl: 36px;

  --leading-none: 1;
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 12px;
  --radius-full: 999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(16, 24, 40, 0.06), 0 2px 4px -2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(16, 24, 40, 0.08), 0 4px 6px -4px rgba(16, 24, 40, 0.04);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;

  /* Layout */
  --sidebar-width: 260px;
}

/* ============================================================
   Base & Reset
   ============================================================ */

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  background: var(--color-bg);
  color: var(--color-text);
}

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-primary);
  color: #fff;
  padding: 8px 16px;
  text-decoration: none;
  border-radius: 0 0 var(--radius-md) 0;
  z-index: 10000;
  font-weight: 600;
  transition: top var(--transition-fast);
}
.skip-link:focus {
  top: 0;
}

/* ============================================================
   Layout
   ============================================================ */

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

/* ============================================================
   Sidebar
   ============================================================ */

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

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}

.sidebar-brand h1 {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text-heading);
  line-height: var(--leading-tight);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
}

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

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--color-text-secondary);
  text-decoration: none;
  padding: 10px var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: var(--text-md);
  font-weight: 500;
  transition: all var(--transition-fast);
}

.nav-link .icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke-width: 2;
}

.nav-link:hover {
  background: #f3f4f6;
  color: var(--color-text);
}

.nav-link:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
  background: var(--color-primary-light);
}

.nav-link.active {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-color: #bfdbfe;
  font-weight: 600;
}

/* ============================================================
   Content Area
   ============================================================ */

.content {
  padding: var(--space-6);
  max-width: 1400px;
}

.content > h2:first-child {
  margin-top: 0;
  margin-bottom: var(--space-4);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-text-heading);
  line-height: var(--leading-tight);
}

/* ============================================================
   Breadcrumbs
   ============================================================ */

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  flex-wrap: wrap;
}

.breadcrumbs a {
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

.breadcrumbs span[aria-current="page"] {
  color: var(--color-text-muted);
  font-weight: 500;
}

.breadcrumbs .icon-xs {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--color-text-muted);
}

/* ============================================================
   Flash Messages
   ============================================================ */

.flash-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.flash {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  border: 1px solid;
  font-size: var(--text-md);
  font-weight: 500;
  animation: flashIn var(--transition-slow) ease;
}

@keyframes flashIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.flash-success {
  background: var(--color-success-bg);
  border-color: var(--color-success-border);
  color: var(--color-success-text);
}

.flash-error,
.flash-danger {
  background: var(--color-danger-bg);
  border-color: var(--color-danger-border);
  color: var(--color-danger-text);
}

.flash-warning {
  background: var(--color-warning-bg);
  border-color: var(--color-warning-border);
  color: #78350f;
}

.flash-info {
  background: var(--color-primary-light);
  border-color: #bfdbfe;
  color: #1e3a8a;
}

.flash-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.flash-close {
  margin-left: auto;
  background: transparent;
  border: none;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  padding: 0;
  width: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--transition-fast);
}

.flash-close:hover {
  opacity: 1;
}

.icon-sm {
  width: 16px;
  height: 16px;
}

/* ============================================================
   Cards
   ============================================================ */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-fast);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card > h3:first-child,
.card > h4:first-child {
  margin-top: 0;
  margin-bottom: var(--space-3);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text-heading);
  line-height: var(--leading-tight);
}

.cards-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* ============================================================
   Grid layouts
   ============================================================ */

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: var(--space-3);
}

.dashboard-metrics {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
}

/* ============================================================
   Dashboard
   ============================================================ */

.dashboard-hero h2 {
  margin-top: 0;
  margin-bottom: var(--space-2);
  font-size: var(--text-xl);
  font-weight: 600;
}

.dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  margin-top: var(--space-3);
}

.dashboard-actions form {
  margin: 0;
}

.dashboard-actions form button {
  margin: 0;
  width: auto;
}

.secondary-link {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid #cbd5e1;
}

.metric-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.metric-card h3 {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.metric-value {
  margin: 0;
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--color-text-heading);
  line-height: var(--leading-tight);
}

/* ============================================================
   Pipeline
   ============================================================ */

.pipeline-line {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.pipeline-node {
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  transition: all var(--transition-base);
}

.pipeline-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: #cbd5e1;
  transition: background var(--transition-base);
}

.pipeline-text {
  font-weight: 600;
  color: #0f172a;
  font-size: var(--text-md);
}

.pipeline-state {
  color: #64748b;
  font-size: var(--text-xs);
}

.pipeline-node.done {
  border-color: var(--color-success-border);
  background: var(--color-success-bg);
}

.pipeline-node.done .pipeline-dot {
  background: var(--color-success);
}

.pipeline-node.current {
  border-color: #93c5fd;
  background: #eff6ff;
}

.pipeline-node.current .pipeline-dot {
  background: var(--color-primary);
}

.pipeline-node.failed {
  border-color: var(--color-danger-border);
  background: var(--color-danger-bg);
}

.pipeline-node.failed .pipeline-dot {
  background: #ef4444;
}

.pipeline-event {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  padding: var(--space-3);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
  transition: box-shadow var(--transition-fast);
}

.pipeline-event:hover {
  box-shadow: var(--shadow-sm);
}

.pipeline-event-title {
  font-size: var(--text-md);
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.pipeline-event-main .hint {
  margin: 0;
}

.pipeline-event-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

/* ============================================================
   Vacancy & Application Cards
   ============================================================ */

.vacancy-card h3,
.app-card h3 {
  margin: 0 0 var(--space-1);
  font-size: var(--text-lg);
  font-weight: 600;
}

.vacancy-card h3 a {
  color: var(--color-text-heading);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.vacancy-card h3 a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.vacancy-card-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-3);
  align-items: flex-start;
}

.vacancy-card-verdicts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  justify-content: flex-end;
}

.vacancy-card-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.vacancy-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
  align-items: center;
}

.vacancy-card-actions form {
  margin: 0;
}

.vacancy-card-actions form button {
  margin: 0;
  width: auto;
}

/* Vacancy list toolbar, sort chips, collapsible filters */
.vacancy-page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.vacancy-page-head h2 {
  margin: 0 0 var(--space-1);
}

.vacancy-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.vacancy-toolbar {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.vacancy-sort-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.vacancy-sort-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  flex-shrink: 0;
}

.sort-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.sort-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: #f9fafb;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.sort-chip:hover {
  border-color: var(--color-border-strong);
  background: #f3f4f6;
  color: var(--color-text-heading);
}

.sort-chip.is-active {
  border-color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 12%, white);
  color: var(--color-primary);
  font-weight: 600;
}

.vacancy-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
}

.vacancy-filters-panel {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-3);
}

.vacancy-filters-summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  user-select: none;
}

.vacancy-filters-summary::-webkit-details-marker {
  display: none;
}

.filter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: 700;
}

.filter-chevron {
  margin-left: auto;
  transition: transform var(--transition-fast);
}

.vacancy-filters-panel[open] .filter-chevron {
  transform: rotate(180deg);
}

.vacancy-filters-form {
  margin-top: var(--space-4);
}

.vacancy-filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-3);
}

.vacancy-filters-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  margin-top: var(--space-4);
}

.score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 148px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: #f3f4f6;
  border: 1px solid var(--color-border);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.score-pill-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.score-pill-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-secondary);
}

.score-tier-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.score-pill-value {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1;
  color: var(--color-text-heading);
}

.score-pill .score-max {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.score-pill.score-high {
  background: #d1fae5;
  border: 2px solid #10b981;
  border-left-width: 4px;
  color: #047857;
}

.score-pill.score-high .score-pill-value,
.score-pill.score-high .score-tier-label {
  color: #047857;
}

.score-pill.score-medium {
  background: #fef3c7;
  border: 2px solid #f59e0b;
  border-left-width: 4px;
  color: #b45309;
}

.score-pill.score-medium .score-pill-value,
.score-pill.score-medium .score-tier-label {
  color: #b45309;
}

.score-pill.score-low {
  background: #fee2e2;
  border: 2px solid #ef4444;
  border-left-width: 4px;
  color: #b91c1c;
}

.score-pill.score-low .score-pill-value,
.score-pill.score-low .score-tier-label {
  color: #b91c1c;
}

.score-pill.score-none {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.vacancy-card.verdict-apply {
  border-left: 4px solid #10b981;
  box-shadow: inset 4px 0 0 #10b981;
}

.vacancy-card.verdict-consider {
  border-left: 4px solid #f59e0b;
  box-shadow: inset 4px 0 0 #f59e0b;
}

.vacancy-card.verdict-skip {
  border-left: 4px solid #cbd5e1;
  opacity: 0.88;
}

.verdict-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  padding: 6px 12px;
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: var(--leading-none);
  white-space: nowrap;
}

.verdict-badge.verdict-apply {
  background: #d1fae5;
  border-color: #6ee7b7;
  color: #065f46;
}

.verdict-badge.verdict-consider {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}

.verdict-badge.verdict-skip {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #64748b;
}

.verdict-badge.verdict-pending {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #64748b;
}

.vacancy-verdict-banner {
  display: flex;
  align-items: center;
  margin-bottom: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
}

.vacancy-verdict-banner.verdict-apply {
  background: linear-gradient(90deg, #ecfdf5 0%, #f0fdf4 100%);
  border: 1px solid #6ee7b7;
}

.vacancy-verdict-banner.verdict-consider {
  background: linear-gradient(90deg, #fffbeb 0%, #fefce8 100%);
  border: 1px solid #fcd34d;
}

.vacancy-verdict-banner.verdict-skip {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.vacancy-score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-3);
}

.score-panel {
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: #f8fafc;
}

.score-panel.score-high {
  background: #ecfdf5;
  border-color: #6ee7b7;
}

.score-panel.score-medium {
  background: #fffbeb;
  border-color: #fcd34d;
}

.score-panel.score-low {
  background: #fef2f2;
  border-color: #fca5a5;
}

.score-panel-title {
  margin: 0 0 4px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
}

.score-panel-value {
  margin: 0;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.1;
}

.score-panel-tier {
  margin: 6px 0 0;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.score-panel.score-high .score-panel-tier,
.score-panel.score-high .score-panel-value {
  color: #047857;
}

.score-panel.score-medium .score-panel-tier,
.score-panel.score-medium .score-panel-value {
  color: #b45309;
}

.score-panel.score-low .score-panel-tier,
.score-panel.score-low .score-panel-value {
  color: #b91c1c;
}

.score-panel-reason {
  margin-top: var(--space-2);
  margin-bottom: 0;
}

.platform-chip {
  background: #fff;
}

.score-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  margin: var(--space-2) 0 0;
}

.score-legend-item {
  min-width: auto;
  padding: 4px 10px;
  font-size: var(--text-xs);
  font-weight: 600;
}

.telegram-channel-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px dashed var(--color-border);
}

.vacancy-card.user-rejected {
  opacity: 0.72;
}

.vacancy-card.user-applied {
  box-shadow: inset 0 0 0 1px #6ee7b7;
}

.user-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: var(--radius-full);
  border: 1px solid #cbd5e1;
  padding: 4px 10px;
  font-size: var(--text-xs);
  font-weight: 700;
  background: #f8fafc;
  color: #475569;
}

.user-status-badge.applied {
  background: #dbeafe;
  border-color: #60a5fa;
  color: #1d4ed8;
}

.user-status-badge.rejected {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #64748b;
}

.user-status-badge.saved {
  background: #e0e7ff;
  border-color: #818cf8;
  color: #4338ca;
}

.vacancy-status-block {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.vacancy-status-badge-inline {
  margin-right: var(--space-1);
}

.similar-vacancy-hint {
  color: var(--color-warning, #b45309);
}

.user-status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.user-status-actions form {
  margin: 0;
}

.user-status-actions [data-vacancy-status-btn] {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Доступно к нажатию — яркая (primary) */
.user-status-actions [data-vacancy-status-btn]:not([data-status-reset]) {
  background: var(--color-primary) !important;
  border-color: var(--color-primary) !important;
  color: #fff !important;
}

.user-status-actions [data-vacancy-status-btn]:not([data-status-reset]):hover {
  background: var(--color-primary-hover) !important;
  border-color: var(--color-primary-hover) !important;
}

/* Уже выбрано — серая */
.user-status-actions[data-active-status="applied"] [data-status-value="applied"],
.user-status-actions[data-active-status="rejected"] [data-status-value="rejected"],
.user-status-actions[data-active-status="saved"] [data-status-value="saved"] {
  background: var(--color-surface) !important;
  border-color: #cbd5e1 !important;
  color: var(--color-text) !important;
}

.user-status-actions[data-active-status="applied"] [data-status-value="applied"]:hover,
.user-status-actions[data-active-status="rejected"] [data-status-value="rejected"]:hover,
.user-status-actions[data-active-status="saved"] [data-status-value="saved"]:hover {
  background: #f8fafc !important;
  border-color: var(--color-border-strong) !important;
}

.user-status-actions[data-busy] [data-vacancy-status-btn] {
  pointer-events: none;
  opacity: 0.85;
}

.pagination-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin: 0;
}

/* ============================================================
   Progress Stepper
   ============================================================ */

.progress-stepper {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
  flex-wrap: wrap;
}

.progress-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #6b7280;
  font-size: var(--text-xs);
  font-weight: 600;
}

.progress-step::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: #d1d5db;
  border: 1px solid #cbd5e1;
}

.progress-step:not(:last-child)::after {
  content: "";
  width: 22px;
  height: 2px;
  margin-left: 2px;
  background: #e5e7eb;
  border-radius: var(--radius-full);
}

.progress-step.done {
  color: #166534;
}

.progress-step.done::before {
  background: var(--color-success);
  border-color: var(--color-success);
}

.progress-step.done:not(:last-child)::after {
  background: var(--color-success-border);
}

.progress-step.failed {
  color: #991b1b;
}

.progress-step.failed::before {
  background: #ef4444;
  border-color: #ef4444;
}

/* ============================================================
   Profile Editor
   ============================================================ */

.profile-editor {
  margin-top: var(--space-3);
  padding: var(--space-3);
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  background: #f8fafc;
}

/* ============================================================
   Resume Option
   ============================================================ */

.resume-option {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  margin-bottom: var(--space-2);
  background: var(--color-surface);
  transition: border-color var(--transition-fast);
}

.resume-option:hover {
  border-color: var(--color-border-strong);
}

.resume-option input[type="checkbox"] {
  width: auto;
  margin: 2px 0 0;
}

.resume-option small {
  display: block;
  color: var(--color-text-muted);
}

/* ============================================================
   Status Chips
   ============================================================ */

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  border-radius: var(--radius-full);
  border: 1px solid #d1d5db;
  padding: 4px 10px;
  font-size: var(--text-xs);
  background: #f8fafc;
  color: #334155;
  font-weight: 500;
  line-height: var(--leading-none);
}

.status-chip.success {
  background: var(--color-success-bg);
  border-color: var(--color-success-border);
  color: var(--color-success-text);
}

.status-chip.progress {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e3a8a;
}

.status-chip.danger {
  background: var(--color-danger-bg);
  border-color: var(--color-danger-border);
  color: var(--color-danger-text);
}

/* ============================================================
   Forms
   ============================================================ */

label {
  display: block;
  font-weight: 500;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-1);
}

input, textarea, select {
  width: 100%;
  margin-top: 0;
  margin-bottom: var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid #cbd5e1;
  background: var(--color-surface);
  color: #111827;
  padding: 10px;
  font-family: inherit;
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

input:read-only,
textarea:read-only {
  background: #f8fafc;
  color: var(--color-text-muted);
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  margin: 0;
}

input[type="file"] {
  padding: 8px;
}

/* Field groups */
.field-group {
  margin-bottom: var(--space-4);
}

.field-group-inline {
  display: flex;
  gap: var(--space-3);
  align-items: flex-end;
}

.field-group-inline > * {
  flex: 1;
}

.field-hint {
  margin-top: -var(--space-2);
  margin-bottom: var(--space-3);
}

/* ============================================================
   Buttons
   ============================================================ */

button, .button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  cursor: pointer;
  background: var(--color-primary);
  border: 1px solid var(--color-primary);
  color: #ffffff;
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: 500;
  line-height: var(--leading-normal);
  text-decoration: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

button:hover, .button-link:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

button:focus-visible, .button-link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

button:active, .button-link:active {
  transform: translateY(0);
}

button.secondary, .button-link.secondary-link {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: #cbd5e1;
}

button.secondary:hover, .button-link.secondary-link:hover {
  background: #f8fafc;
  border-color: var(--color-border-strong);
}

button.danger {
  background: var(--color-danger);
  border-color: var(--color-danger);
}

button.danger:hover {
  background: var(--color-danger-hover);
  border-color: var(--color-danger-hover);
}

button:disabled, button[aria-disabled="true"] {
  cursor: not-allowed;
  background: #9ca3af;
  border-color: #9ca3af;
  opacity: 0.7;
  transform: none !important;
  box-shadow: none !important;
}

/* Loading state */
button.is-loading {
  position: relative;
  color: transparent !important;
}

button.is-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

button.secondary.is-loading::after {
  border-color: rgba(0,0,0,0.1);
  border-top-color: var(--color-text);
}

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

/* Inline button groups */
.inline {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.inline input {
  margin: 0;
}

.inline button,
.inline select {
  width: auto;
  margin: 0;
}

/* ============================================================
   Bubbles / Tags
   ============================================================ */

.bubbles {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.bubble {
  display: inline-block;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  border-radius: var(--radius-full);
  padding: 6px 12px;
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

/* ============================================================
   Tables
   ============================================================ */

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

th, td {
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-3);
  text-align: left;
  vertical-align: top;
}

th {
  font-weight: 600;
  color: var(--color-text-secondary);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.025em;
  background: #f9fafb;
}

tbody tr {
  transition: background var(--transition-fast);
}

tbody tr:hover {
  background: #f8fafc;
}

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

/* Responsive table → cards on mobile */
@media (max-width: 640px) {
  .table-wrapper {
    border: none;
    background: transparent;
  }

  .table-responsive thead {
    display: none;
  }

  .table-responsive tbody,
  .table-responsive tr,
  .table-responsive td {
    display: block;
    width: 100%;
  }

  .table-responsive tr {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-3);
    margin-bottom: var(--space-3);
    box-shadow: var(--shadow-sm);
  }

  .table-responsive td {
    border: none;
    padding: var(--space-1) 0;
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
  }

  .table-responsive td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: var(--text-xs);
    text-transform: uppercase;
    flex-shrink: 0;
  }

  .table-responsive td:last-child {
    border-top: 1px solid var(--color-border);
    margin-top: var(--space-2);
    padding-top: var(--space-2);
  }
}

/* ============================================================
   Empty States
   ============================================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-10) var(--space-4);
  gap: var(--space-3);
}

.empty-state .icon-lg {
  width: 48px;
  height: 48px;
  color: var(--color-text-muted);
  stroke-width: 1.5;
}

.empty-state h3 {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text-heading);
}

.empty-state p {
  margin: 0;
  color: var(--color-text-muted);
  max-width: 400px;
}

/* ============================================================
   Hints & Typography
   ============================================================ */

.hint {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
}

p, ul, ol {
  max-width: 65ch;
}

h1, h2, h3, h4 {
  color: var(--color-text-heading);
  line-height: var(--leading-tight);
  margin-top: var(--space-5);
  margin-bottom: var(--space-3);
}

h1 { font-size: var(--text-3xl); font-weight: 700; }
h2 { font-size: var(--text-2xl); font-weight: 600; }
h3 { font-size: var(--text-xl); font-weight: 600; }
h4 { font-size: var(--text-lg); font-weight: 600; }

/* ============================================================
   Fieldsets & Details (accordions)
   ============================================================ */

fieldset {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
  background: var(--color-surface);
}

legend {
  font-weight: 600;
  color: var(--color-text-heading);
  padding: 0 var(--space-2);
}

details {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
  background: var(--color-surface);
}

details summary {
  font-weight: 600;
  cursor: pointer;
  color: var(--color-text-heading);
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

details summary::-webkit-details-marker {
  display: none;
}

details summary::before {
  content: "▸";
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  transition: transform var(--transition-fast);
  display: inline-block;
}

details[open] summary::before {
  transform: rotate(90deg);
}

details[open] summary {
  margin-bottom: var(--space-3);
}

/* ============================================================
   Platform Grid
   ============================================================ */

.platform-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}

.source-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.platform-filters {
  margin-top: var(--space-3);
}

.platform-filters legend {
  margin-bottom: var(--space-2);
}

.platform-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: #f9fafb;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.platform-item:hover {
  border-color: var(--color-border-strong);
  background: #f3f4f6;
}

.platform-item input[type="checkbox"] {
  width: auto;
  margin: 0;
}

/* ============================================================
   Chips Editor
   ============================================================ */

.chips-editor {
  margin-bottom: var(--space-3);
}

.chips-editor .inline {
  margin-bottom: var(--space-2);
}

.chips-editor input {
  margin-bottom: 0;
  flex: 1;
}

.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.editable-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-full);
  padding: 5px 10px;
  background: #f8fafc;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.chip-remove {
  border: none;
  background: transparent;
  color: #6b7280;
  width: auto;
  margin: 0;
  padding: 0 0 0 4px;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: color var(--transition-fast);
}

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

/* ============================================================
   Wizard
   ============================================================ */

.stepper {
  display: flex;
  gap: var(--space-3);
  margin: var(--space-3) 0 var(--space-4);
  flex-wrap: wrap;
}

.step-link {
  text-decoration: none;
  color: var(--color-text);
  border: 1px solid #d1d5db;
  background: var(--color-surface);
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.step-link:hover {
  border-color: var(--color-border-strong);
  background: #f8fafc;
}

.step-link.active {
  background: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
}

.wizard-progress-wrap {
  margin-top: var(--space-3);
}

.wizard-progress-bar {
  width: 100%;
  height: 10px;
  border-radius: var(--radius-full);
  background: #e2e8f0;
  overflow: hidden;
}

.wizard-progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #22c55e);
  transition: width 0.35s ease;
}

/* ============================================================
   Login
   ============================================================ */

.login {
  max-width: 420px;
  margin: 80px auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-lg);
}

.login h1 {
  margin-top: 0;
  margin-bottom: var(--space-4);
  font-size: var(--text-2xl);
}

/* ============================================================
   Readonly blocks
   ============================================================ */

.readonly-block {
  width: 100%;
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  background: var(--color-surface);
  color: #334155;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
}

/* ============================================================
   Modal / Confirm Dialog
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: var(--space-4);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}

.modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

body.modal-open {
  overflow: hidden;
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  max-width: 480px;
  width: 100%;
  padding: var(--space-6);
  transform: scale(0.96);
  transition: transform var(--transition-base);
}

.modal-overlay.is-open .modal {
  transform: scale(1);
}

.modal-title {
  margin: 0 0 var(--space-3);
  font-size: var(--text-xl);
  font-weight: 600;
}

.modal-body {
  margin-bottom: var(--space-5);
  color: var(--color-text-secondary);
}

.source-pill.is-empty span em {
  opacity: 0.55;
}

.modal-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
}

/* ============================================================
   Utilities
   ============================================================ */

.is-hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-right {
  text-align: right;
}

.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }

/* ============================================================
   HTMX indicators
   ============================================================ */

.htmx-indicator {
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  opacity: 1;
}

/* ============================================================
   Responsive
   ============================================================ */

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

  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: var(--space-3);
  }

  .sidebar-brand {
    width: 100%;
    margin-bottom: 0;
    padding-bottom: var(--space-2);
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    flex: 1;
  }

  .sidebar-footer {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
  }

  .nav-link {
    padding: 8px var(--space-3);
    font-size: var(--text-sm);
  }

  .nav-link .icon {
    width: 16px;
    height: 16px;
  }

  .nav-link span {
    display: none;
  }

  .content {
    padding: var(--space-4);
  }

  .grid,
  .dashboard-metrics,
  .pipeline-line,
  .platform-grid,
  .source-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .pipeline-event {
    flex-direction: column;
    align-items: flex-start;
  }

  .pipeline-event-meta {
    align-items: flex-start;
    width: 100%;
  }
}

@media (max-width: 640px) {
  .vacancy-page-head {
    flex-direction: column;
  }

  .vacancy-toolbar-actions {
    width: 100%;
  }

  .vacancy-toolbar-actions form,
  .vacancy-toolbar-actions button {
    flex: 1;
  }

  .sort-chips {
    width: 100%;
  }

  .sort-chip {
    flex: 1 1 auto;
    justify-content: center;
    text-align: center;
  }

  .vacancy-card-head {
    flex-direction: column;
    gap: var(--space-2);
  }

  .vacancy-card-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .vacancy-card-actions form,
  .vacancy-card-actions a {
    width: 100%;
  }

  .vacancy-card-actions button,
  .vacancy-card-actions .button-link {
    width: 100%;
    justify-content: center;
  }

  .field-group-inline {
    flex-direction: column;
    align-items: stretch;
  }
}
