/* ========================================================================
   HR ассистент — единый CSS.
   Один файл, без билда. Светлая тема.
   Структура: токены → reset → layout → typography → компоненты → утилиты.
   ======================================================================== */

/* ── Дизайн-токены ──────────────────────────────────────────────────────── */
:root {
  /* Поверхности и текст */
  --bg: #ffffff;
  --body-bg: #f5f5f5;
  --card: #ffffff;
  --muted-bg: #f0f0f0;
  --muted-bg-2: #f5f5f5;
  --border: #e6e6e6;
  --border-strong: #cccccc;
  --text: #000000e5;
  --text-muted: #0000008c;
  --text-faint: #00000059;

  /* Акценты (бренд: чёрный, как в lookfeel light) */
  --primary: #000000;
  --primary-hover: #333333;
  --primary-fg: #fffffff2;

  /* Статусы */
  --success: #3fd070;
  --success-text: #b02826; /* placeholder, override below */
  --info: #385ee0;
  --warning: #f88a32;
  --danger: #dc2626;
  --danger-hover: #b02826;

  --success-bg: #e2f8eb;
  --success-fg: #2db85a;
  --info-bg: #ebf1ff;
  --info-fg: #385ee0;
  --warning-bg: #fff0e6;
  --warning-fg: #e87f1e;
  --danger-bg: #fceae7;
  --danger-fg: #dc2626;

  /* Типографика */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  /* Размеры */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-pill: 9999px;

  /* Тени */
  --shadow-sm: 0 1px 2px #0000000d;
  --shadow: 0 2px 8px #0000000d, 0 1px 2px #0000001a;

  /* Расстояния */
  --gap-xs: 4px;
  --gap-sm: 8px;
  --gap: 12px;
  --gap-md: 16px;
  --gap-lg: 24px;
  --gap-xl: 32px;
}

/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--body-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.2px;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--text); }
button { font: inherit; cursor: pointer; background: none; border: 0; padding: 0; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--border); margin: 0; }

h1, h2, h3, h4, p { margin: 0; }

code { font-family: var(--font-mono); font-size: 0.92em; }

/* ── Layout ────────────────────────────────────────────────────────────── */
.container { width: 100%; margin-inline: auto; padding-inline: 24px; }
.container-sm { max-width: 480px; }
.container-md { max-width: 720px; }
.container-lg { max-width: 960px; }
.container-xl { max-width: 1200px; }

main.page { padding-block: 32px; }

.stack { display: flex; flex-direction: column; gap: var(--gap-md); }
.stack-sm { display: flex; flex-direction: column; gap: var(--gap-sm); }
.stack-lg { display: flex; flex-direction: column; gap: var(--gap-lg); }
.stack-xl { display: flex; flex-direction: column; gap: var(--gap-xl); }

.row { display: flex; align-items: center; gap: var(--gap); }
.row-end { display: flex; align-items: flex-end; gap: var(--gap); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--gap-md); }
.row-end-between { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--gap-md); }
.row-wrap { flex-wrap: wrap; }

.grow { flex: 1; min-width: 0; }
.shrink-0 { flex-shrink: 0; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap-md); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap-md); }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--gap-md); }

/* Заголовок карточки вакансии: ровно 2 строки → одинаковая высота карточек по всем рядам. */
.vac-title-clamp {
  font-size: 15px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(2 * 1.3em);
  word-break: break-word;
}
@media (max-width: 720px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ── Типографика ──────────────────────────────────────────────────────── */
h1, .h1 { font-size: 24px; font-weight: 600; line-height: 1.2; letter-spacing: -0.5px; }
h2, .h2 { font-size: 18px; font-weight: 600; line-height: 1.3; letter-spacing: -0.3px; }
h3, .h3 { font-size: 16px; font-weight: 600; line-height: 1.4; }

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.mono  { font-family: var(--font-mono); }
.text-xs { font-size: 12px; }
.text-sm { font-size: 13px; }
.text-base { font-size: 14px; }
.text-lg { font-size: 16px; }
.bold { font-weight: 600; }
.medium { font-weight: 500; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.nowrap { white-space: nowrap; }

/* Заголовок секции (h1 или h2) с описанием снизу */
.page-header { display: flex; flex-direction: column; gap: 4px; }
.page-header > p { color: var(--text-muted); font-size: 13px; }

/* Компактный тулбар страницы: слева мета (счётчик/фильтры), справа действия.
   Имя страницы даёт активный пункт навигации, поэтому H1 здесь не дублируется
   визуально — он остаётся в DOM как .sr-only для скринридеров. */
.page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-md);
  flex-wrap: wrap;
  min-height: 36px;
}
.page-meta { font-size: 13px; color: var(--text-muted); }

.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;
}

/* ── Шапка приложения ─────────────────────────────────────────────────── */
.app-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.app-header .container {
  display: flex; align-items: center; justify-content: space-between;
  padding-block: 14px;
  gap: var(--gap-md);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; letter-spacing: -0.3px; }
.brand-mark {
  display: inline-block;
  width: 24px; height: 24px;
  background: url("/favicon.svg") center / contain no-repeat;
  flex-shrink: 0;
}
.app-nav { display: flex; align-items: center; gap: 16px; }
.nav-link { font-size: 13px; font-weight: 500; color: var(--text-muted); transition: color 120ms; }
.nav-link:hover { color: var(--text); }
.nav-link.active { color: var(--text); }
.user-meta { display: flex; align-items: center; gap: 10px; }
.user-meta .login { color: var(--text-muted); font-size: 13px; }

/* ── Кнопки ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  background: var(--bg);
  color: var(--text);
  transition: background 120ms, border-color 120ms, color 120ms, opacity 120ms;
  white-space: nowrap;
  user-select: none;
}
.btn:disabled, .btn[disabled] { opacity: 0.55; pointer-events: none; }
.btn:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }

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

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover:not(:disabled) { background: var(--muted-bg); }

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

.btn-ghost { background: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--muted-bg); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.btn-icon > svg { display: block; }
.btn-icon:hover:not(:disabled) { background: var(--muted-bg); color: var(--text); }
.btn-icon.danger:hover:not(:disabled) { color: var(--danger); background: var(--danger-bg); }

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

/* ── Карточки ─────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.card.card-tight { padding: 14px; }
.card-link {
  display: block;
  text-decoration: none;
  transition: background 120ms, border-color 120ms;
}
.card-link:hover { background: var(--muted-bg-2); }

.card-header { padding-bottom: 12px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.card-footer {
  background: var(--muted-bg-2);
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  margin: 20px -20px -20px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--gap-sm);
}
.card-footer.between { justify-content: space-between; }

/* ── Формы ────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-hint { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.label {
  font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
  user-select: none;
}

.input, .textarea, .select {
  display: block;
  width: 100%;
  font-size: 13px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  outline: none;
  transition: border-color 120ms, box-shadow 120ms;
  color: var(--text);
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--text-muted);
  box-shadow: 0 0 0 3px #00000010;
}
.input:disabled, .textarea:disabled, .select:disabled {
  background: var(--muted-bg-2);
  color: var(--text-muted);
  cursor: not-allowed;
}
.input { height: 36px; }
.textarea { padding: 8px 12px; resize: vertical; min-height: 80px; }
.select { height: 36px; appearance: auto; }

.input-file {
  font-size: 13px;
  padding: 4px 0;
}
.input-file::file-selector-button {
  margin-right: 12px;
  border: 0;
  background: var(--muted-bg);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.input-file::file-selector-button:hover { background: var(--border); }

/* ── Бейджи ───────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  height: 22px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--radius-pill);
  background: var(--muted-bg);
  color: var(--text-muted);
  letter-spacing: 0;
  white-space: nowrap;
}
.badge-success { background: var(--success-bg); color: var(--success-fg); }
.badge-info    { background: var(--info-bg);    color: var(--info-fg); }
.badge-warning { background: var(--warning-bg); color: var(--warning-fg); }
.badge-error   { background: var(--danger-bg); color: var(--danger-fg); }
.badge-muted   { background: var(--muted-bg);   color: var(--text-muted); }

/* ── Аккордеон-секция (эталоны и т.п.) ───────────────────────────────── */
.collapsible {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.collapsible > summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  user-select: none;
}
.collapsible > summary::-webkit-details-marker { display: none; }
.collapsible > summary::after {
  content: "";
  width: 10px; height: 10px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg);
  transition: transform .15s ease;
}
.collapsible[open] > summary::after { transform: rotate(-135deg); }
.collapsible > .collapsible-body { padding: 4px 16px 16px; }

/* ── Алерты ───────────────────────────────────────────────────────────── */
.alert {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
}
.alert-error   { background: var(--danger-bg);  border-color: #f3a39a; color: var(--danger-fg); }
.alert-warning { background: var(--warning-bg); border-color: #ffbc85; color: var(--warning-fg); }
.alert-info    { background: var(--info-bg);    border-color: #a6b8ff; color: var(--info-fg); }

/* ── Таблицы ──────────────────────────────────────────────────────────── */
.table-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: auto;
}
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left;
  font-weight: 500;
  color: var(--text-muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--muted-bg-2);
  white-space: nowrap;
}
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--muted-bg-2); }
.table .col-actions { text-align: right; white-space: nowrap; }
/* Действия на строке появляются только при наведении / фокусе. */
.table tbody tr .row-action { opacity: 0; transition: opacity 120ms; }
.table tbody tr:hover .row-action,
.table tbody tr:focus-within .row-action { opacity: 1; }
.table .col-id { width: 64px; color: var(--text-muted); font-family: var(--font-mono); font-size: 12px; }

.empty-state {
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.empty-state.dashed {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: transparent;
}

/* ── Табы ─────────────────────────────────────────────────────────────── */
.tabs {
  display: inline-flex;
  background: var(--muted-bg);
  border-radius: var(--radius);
  padding: 3px;
  gap: 2px;
}
.tab {
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: 6px;
  transition: background 120ms, color 120ms;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--bg); color: var(--text); box-shadow: var(--shadow-sm); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Диалог ───────────────────────────────────────────────────────────── */
dialog.dialog {
  border: 0;
  padding: 0;
  border-radius: var(--radius-lg);
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow);
  width: min(92vw, 480px);
  max-height: 85vh;

  /* Плавное появление/исчезание. `allow-discrete` позволяет анимировать
     дискретные свойства display и overlay при переходе [open] ↔ :not([open]).
     `@starting-style` задаёт «откуда» появляется при открытии. */
  opacity: 1;
  transform: translateY(0) scale(1);
  transition:
    opacity 140ms ease,
    transform 160ms cubic-bezier(0.2, 0.7, 0.2, 1),
    overlay 160ms ease allow-discrete,
    display 160ms ease allow-discrete;
}
dialog.dialog:not([open]) {
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
}
@starting-style {
  dialog.dialog[open] {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
}
dialog.dialog.dialog-wide { width: min(92vw, 680px); }
dialog.dialog::backdrop {
  background: #00000066;
  backdrop-filter: blur(2px);
  transition:
    opacity 140ms ease,
    backdrop-filter 140ms ease,
    overlay 140ms ease allow-discrete,
    display 140ms ease allow-discrete;
}
dialog.dialog:not([open])::backdrop { opacity: 0; backdrop-filter: blur(0); }
@starting-style {
  dialog.dialog[open]::backdrop { opacity: 0; backdrop-filter: blur(0); }
}

@media (prefers-reduced-motion: reduce) {
  dialog.dialog,
  dialog.dialog::backdrop { transition: none; }
  dialog.dialog:not([open]) { transform: none; }
}
.dialog-content { padding: 20px; display: flex; flex-direction: column; gap: var(--gap); }
.dialog-title { font-size: 16px; font-weight: 600; }
.dialog-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.dialog-footer {
  background: var(--muted-bg-2);
  margin: 8px -20px -20px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--gap-sm);
}
.dialog-footer.between { justify-content: space-between; }

/* ── Тосты ────────────────────────────────────────────────────────────── */
.toast-slot {
  position: fixed;
  right: 16px; bottom: 16px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 100;
}
.toast {
  min-width: 240px;
  max-width: 360px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 13px;
  color: var(--text);
}
.toast.toast-success { background: var(--success-bg); border-color: #8fe6b0; color: var(--success-fg); }
.toast.toast-error   { background: var(--danger-bg);  border-color: #f3a39a; color: var(--danger-fg); }

/* ── Хлебные крошки ───────────────────────────────────────────────────── */
.crumbs {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 6px; padding: 0; margin: 0; list-style: none;
  font-size: 13px;
  color: var(--text-muted);
}
.crumbs a { color: var(--text-muted); }
.crumbs a:hover { color: var(--text); }
.crumbs .current { color: var(--text); }
.crumbs .sep { color: var(--text-faint); display: inline-flex; align-items: center; }
.crumbs .sep svg { width: 14px; height: 14px; }

/* ── Спиннер ──────────────────────────────────────────────────────────── */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid #0000001a;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
.spinner.spinner-lg { width: 28px; height: 28px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Дропзона (загрузка PDF) ──────────────────────────────────────────── */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--gap-sm);
  padding: 40px 20px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg);
  cursor: pointer;
  text-align: center;
  font-size: 13px;
  transition: background 120ms, border-color 120ms;
}
.dropzone:hover { background: var(--muted-bg-2); }
.dropzone.over { border-color: var(--primary); background: var(--muted-bg); }
.dropzone .icon-box {
  width: 40px; height: 40px;
  border-radius: var(--radius);
  background: var(--muted-bg);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}
.dropzone .icon-box svg { width: 20px; height: 20px; }

/* ── Аватар-кружок (инициалы) ─────────────────────────────────────────── */
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--muted-bg);
  color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 500;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

/* ── Карточка вакансии в списке ───────────────────────────────────────── */
/* Кнопка удаления — видна только при наведении/фокусе. На тач-устройствах
   (нет hover) — всегда видна, иначе её было бы невозможно достать. */
.vac-card .vac-del-btn { transition: opacity 120ms ease; }
@media (hover: hover) {
  .vac-card .vac-del-btn { opacity: 0; }
  .vac-card:hover .vac-del-btn,
  .vac-card:focus-within .vac-del-btn { opacity: 1; }
}

/* ── Прогресс-бар (балл) ──────────────────────────────────────────────── */
.score-bar {
  width: 128px; height: 6px;
  background: var(--muted-bg);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-left: auto;
  margin-top: 4px;
}
.score-bar > .fill { height: 100%; background: var(--success); border-radius: inherit; }
.score-bar > .fill.warn { background: var(--warning); }
.score-bar > .fill.bad  { background: var(--danger); }

.score { font-size: 22px; font-weight: 600; line-height: 1; letter-spacing: -0.5px; }

/* ── Прогресс-бар (анализ резюме) ─────────────────────────────────────── */
.progress-card { display: flex; flex-direction: column; gap: 12px; }
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--muted-bg);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.progress-bar > .fill {
  height: 100%;
  width: 0;
  background: var(--primary);
  border-radius: inherit;
  transition: width 200ms ease;
}

/* ── Чипы (значения критериев) ────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  font-size: 12px;
  font-weight: 500;
  user-select: none;
}
.chip[draggable="true"] { cursor: grab; }
.chip.dragging { opacity: 0.4; }
.chip.drop-target { outline: 2px dashed var(--primary); outline-offset: 2px; }
.chip .grip svg { width: 12px; height: 12px; color: var(--text-faint); }
.chip .x {
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}
.chip .x:hover { color: var(--danger); }

/* ── Утилиты ──────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.relative { position: relative; }
.center { display: flex; align-items: center; justify-content: center; }
.center-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.gap-sm { gap: var(--gap-sm); }
.gap-md { gap: var(--gap-md); }
.gap-lg { gap: var(--gap-lg); }
.text-right { text-align: right; }
.ml-auto { margin-left: auto; }
.w-full { width: 100%; }

/* Отзывчивость: на маленьких экранах шапка переносится */
@media (max-width: 720px) {
  .app-header .container { flex-wrap: wrap; }
  .app-nav { width: 100%; overflow-x: auto; }
}
