/* ─────────────────────────────────────────────
   workivo · дизайн-система
   Токены, типографика, базовые компоненты
   ───────────────────────────────────────────── */

:root {
  /* палитра */
  --bg: #f4f6f9;
  --bg-soft: #eef1f6;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --ink: #0e1420;
  --ink-2: #47506180;
  --muted: #5c6575;            /* ~5.9:1 на белом: подписи читаются, а не угадываются */
  --muted-2: #6b7484;          /* был #98a1b0 (2.6:1) — им написаны даты, подписи и юр. текст; теперь ~4.7:1 */
  --line: #e6e9ef;
  --line-2: #eff1f5;

  --accent: #1a6bff;
  --accent-hover: #0f57e0;
  --accent-soft: #eaf1ff;
  --accent-soft-2: #dbe7ff;
  --accent-ink: #ffffff;

  --success: #0f9d58;
  --success-soft: #e6f6ee;
  --warning: #e08a1e;
  --warning-soft: #fdf2e2;
  --danger: #e0413f;
  --danger-soft: #fdeceb;
  --violet: #7c5cff;
  --violet-soft: #f0ecff;

  /* геометрия */
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 28px;
  --r-full: 999px;

  --shadow-xs: 0 1px 2px rgba(14, 20, 32, .05);
  --shadow-sm: 0 2px 8px -2px rgba(14, 20, 32, .08);
  --shadow-md: 0 10px 30px -18px rgba(14, 20, 32, .35);
  --shadow-lg: 0 28px 70px -40px rgba(14, 20, 32, .55);
  --shadow-accent: 0 12px 28px -14px rgba(26, 107, 255, .65);

  --ease: cubic-bezier(.22, .61, .36, 1);
  --fast: .16s var(--ease);
  --normal: .28s var(--ease);

  --header-h: 72px;
  --container: 1180px;
  --font: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }
/* атрибут hidden должен побеждать любые классы вроде .field { display:flex } */
[hidden] { display: none !important; }
* { -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.025em; line-height: 1.12; }
h1 { font-size: clamp(34px, 6vw, 68px); letter-spacing: -.04em; }
h2 { font-size: clamp(24px, 3.2vw, 36px); letter-spacing: -.032em; }
h3 { font-size: 19px; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
ul { margin: 0; padding: 0; list-style: none; }

::selection { background: var(--accent-soft-2); color: var(--ink); }

/* скроллбар */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d7dbe3; border-radius: 99px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #c3c9d4; }
::-webkit-scrollbar-track { background: transparent; }

/* ── типографские утилиты ── */
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.bold { font-weight: 600; }
.accent { color: var(--accent); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.col { display: flex; flex-direction: column; }
.wrap { flex-wrap: wrap; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; }
.gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; } .gap-24 { gap: 24px; }
.grow { flex: 1; }
.hidden { display: none !important; }

/* ─────────────── кнопки ─────────────── */
.btn {
  --btn-bg: var(--surface);
  --btn-ink: var(--ink);
  --btn-border: var(--line);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border: 1px solid var(--btn-border);
  border-radius: var(--r-full);
  background: var(--btn-bg);
  color: var(--btn-ink);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -.01em;
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--fast), background var(--fast), border-color var(--fast), box-shadow var(--fast), color var(--fast), opacity var(--fast);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.985); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn[disabled], .btn.is-loading { pointer-events: none; opacity: .6; }

.btn-primary { --btn-bg: var(--accent); --btn-ink: var(--accent-ink); --btn-border: transparent; box-shadow: var(--shadow-accent); }
.btn-primary:hover { --btn-bg: var(--accent-hover); }
.btn-ghost { --btn-bg: transparent; --btn-border: transparent; }
.btn-ghost:hover { --btn-bg: var(--bg-soft); }
.btn-soft { --btn-bg: var(--accent-soft); --btn-ink: var(--accent); --btn-border: transparent; }
.btn-soft:hover { --btn-bg: var(--accent-soft-2); }
.btn-outline { --btn-bg: var(--surface); }
.btn-outline:hover { --btn-border: #d3d9e4; box-shadow: var(--shadow-sm); }
.btn-danger { --btn-bg: var(--danger-soft); --btn-ink: var(--danger); --btn-border: transparent; }
.btn-dark { --btn-bg: var(--ink); --btn-ink: #fff; --btn-border: transparent; }
.btn-dark:hover { --btn-bg: #1e2634; }

.btn-lg { height: 54px; padding: 0 28px; font-size: 16px; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13.5px; }
.btn-xs { height: 30px; padding: 0 11px; font-size: 12.5px; gap: 5px; }
.btn-block { width: 100%; }
.btn-icon { width: 44px; padding: 0; }
.btn-icon.btn-sm { width: 36px; }

.btn.is-loading::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn.is-loading > * { opacity: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--r-full);
  border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); cursor: pointer;
  transition: all var(--fast);
}
.icon-btn:hover { color: var(--ink); border-color: #d3d9e4; transform: translateY(-1px); }
.icon-btn.is-active { color: var(--accent); background: var(--accent-soft); border-color: transparent; }

.link { color: var(--accent); font-weight: 600; cursor: pointer; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
/* кнопка, оформленная ссылкой: без серого фона и рамки браузера */
button.link { background: none; border: 0; padding: 0; font-family: inherit; }

/* ─────────────── формы ─────────────── */
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label, .label { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.hint { font-size: 12.5px; color: var(--muted); }

.input, .select, .textarea {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 14.5px;
  transition: border-color var(--fast), box-shadow var(--fast), background var(--fast);
}
.textarea { height: auto; min-height: 110px; padding: 12px 14px; resize: vertical; line-height: 1.55; }
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input:hover, .select:hover, .textarea:hover { border-color: #d3d9e4; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(26, 107, 255, .12);
}
.input.is-error, .textarea.is-error { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(224, 65, 63, .1); }
.error-text { font-size: 12.5px; color: var(--danger); }

.select {
  appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236a7383' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 13px center;
  cursor: pointer;
}

.input-icon { position: relative; }
.input-icon .input { padding-left: 42px; }
.input-icon > svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted-2); pointer-events: none; }

/* переключатели-чипы */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  background: var(--surface);
  font-size: 13.5px; font-weight: 500; color: var(--ink);
  cursor: pointer;
  transition: all var(--fast);
  user-select: none;
}
.chip:hover { border-color: #cdd4e0; transform: translateY(-1px); }
.chip.is-active { background: var(--accent); border-color: transparent; color: #fff; box-shadow: var(--shadow-accent); }
.chip-static { cursor: default; background: var(--surface-2); border-color: transparent; color: var(--muted); }
.chip-static:hover { transform: none; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch__track {
  width: 44px; height: 26px; border-radius: 99px; background: #d7dce5;
  position: relative; transition: background var(--normal); flex: none;
}
.switch__track::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: var(--shadow-xs); transition: transform var(--normal);
}
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }

.checkbox { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }

.segmented {
  display: inline-flex;
  padding: 4px;
  background: var(--bg-soft);
  border-radius: var(--r-full);
  gap: 2px;
}
.segmented button {
  height: 38px; padding: 0 20px;
  border: 0; border-radius: var(--r-full);
  background: transparent; color: var(--muted);
  font-size: 14.5px; font-weight: 600; cursor: pointer;
  transition: all var(--fast);
}
.segmented button:hover { color: var(--ink); }
.segmented button.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ─────────────── карточки и бейджи ─────────────── */
.card {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px;
  transition: transform var(--normal), box-shadow var(--normal), border-color var(--normal);
}
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: #dfe4ec; }
.card-flat { border-radius: var(--r-md); box-shadow: none; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 9px;
  border-radius: var(--r-xs);
  font-size: 12px; font-weight: 600; letter-spacing: -.01em;
  background: var(--surface-2); color: var(--muted);
}
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-violet { background: var(--violet-soft); color: var(--violet); }
.badge-dark { background: #eceef2; color: #384252; }

.match-badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 10px;
  border-radius: var(--r-full);
  font-size: 12.5px; font-weight: 700;
  background: var(--success-soft); color: var(--success);
}
.match-badge.is-mid { background: var(--accent-soft); color: var(--accent); }
.match-badge.is-low { background: var(--surface-2); color: var(--muted); }

.dot-sep { color: var(--muted-2); }

/* аватары */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  flex: none;
  width: 44px; height: 44px;
  border-radius: 14px;
  color: #fff; font-weight: 700; font-size: 15px; letter-spacing: -.02em;
  background: var(--accent);
  overflow: hidden;
}
.avatar-round { border-radius: 50%; }
/* фото заполняет аватарку целиком и обрезается по её скруглению */
.avatar__img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.avatar-sm { width: 36px; height: 36px; border-radius: 11px; font-size: 13px; }
.avatar-lg { width: 64px; height: 64px; border-radius: 20px; font-size: 21px; }
.avatar-xl { width: 92px; height: 92px; border-radius: 28px; font-size: 30px; }

/* ─────────────── скелетоны ─────────────── */
.skeleton {
  position: relative;
  overflow: hidden;
  background: #e9ecf2;
  border-radius: var(--r-sm);
}
.skeleton::after {
  content: '';
  position: absolute; inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .75), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }
.sk-line { height: 12px; border-radius: 99px; }
.sk-title { height: 20px; width: 60%; border-radius: 8px; }
.sk-card { height: 190px; border-radius: var(--r-lg); }

/* ─────────────── тосты ─────────────── */
.toasts {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 200;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 11px;
  min-width: 280px; max-width: 380px;
  padding: 14px 16px;
  background: var(--ink); color: #fff;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  pointer-events: auto;
  animation: toastIn .32s var(--ease);
}
.toast.is-out { animation: toastOut .25s var(--ease) forwards; }
.toast__icon { flex: none; margin-top: 1px; }
.toast__body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.toast__title { display: block; font-weight: 600; }
.toast__text { display: block; opacity: .78; font-size: 13px; line-height: 1.45; }
.toast-success .toast__icon { color: #5ee2a0; }
.toast-error .toast__icon { color: #ff8b88; }
.toast-info .toast__icon { color: #8ab6ff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

/* ─────────────── модальные окна ─────────────── */
.modal-root {
  position: fixed; inset: 0; z-index: 150;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(12, 17, 26, .45);
  backdrop-filter: blur(4px);
  animation: fadeIn .2s var(--ease);
}
.modal {
  position: relative;
  width: min(520px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: 26px;
  animation: modalIn .3s var(--ease);
}
.modal-wide { width: min(760px, 100%); }
.modal__close { position: absolute; top: 16px; right: 16px; }
.modal__title { font-size: 22px; font-weight: 700; letter-spacing: -.03em; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(18px) scale(.97); } }

/* ─────────────── пустые состояния ─────────────── */
.empty {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: 8px;
  padding: 56px 24px;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--r-lg);
}
.empty__icon {
  width: 62px; height: 62px; border-radius: 20px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
  margin-bottom: 6px;
}
.empty__title { font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.empty__text { color: var(--muted); font-size: 14px; max-width: 380px; }

/* ─────────────── прогресс ─────────────── */
.progress { height: 6px; border-radius: 99px; background: var(--bg-soft); overflow: hidden; }
.progress__bar { height: 100%; border-radius: 99px; background: var(--accent); transition: width .5s var(--ease); }
.progress__bar.is-success { background: var(--success); }

/* появление элементов */
.fade-up { animation: fadeUp .5s var(--ease) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::after, *::before { animation-duration: .01ms !important; transition-duration: .01ms !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;
}
