/* ============================================================
   Odav Koduleht — дизайн-система кабинета
   Цвета с odavkoduleht.ee: ink #0c1322, brand #2d6bff.
   ============================================================ */

/* Шрифты: display — Unbounded, текст — Manrope. Кириллица включена
   (Google Fonts отдаёт cyrillic/cyrillic-ext сабсеты по unicode-range). */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&family=Unbounded:wght@500;700;800&display=swap&subset=cyrillic,cyrillic-ext,latin,latin-ext');

/* ---------- 1. Токены ---------- */
:root {
  --bg: #F6F8FB;
  --surface: #FFFFFF;
  --ink: #0C1322;
  --muted: #5B677C;
  --line: #E3E8F0;
  --accent: #2D6BFF;
  --accent-ink: #FFFFFF;
  --accent-2: #1D52D6;
  --dark: #0C1322;
  --dark-surface: #2A3346;
  --danger: #E5533C;
  --ok: #2F9E6A;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 40px rgba(24, 32, 56, .08);

  --font-display: 'Unbounded', 'Trebuchet MS', system-ui, sans-serif;
  --font-text: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --shadow-sm: 0 2px 10px rgba(24, 32, 56, .06);
  --shadow-lg: 0 30px 80px rgba(18, 22, 42, .18);
  --ring: 0 0 0 3px rgba(32, 112, 248, .32);
  --t: .15s ease;
}

/* ---------- 2. База ---------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 1.55;
  font-weight: 450;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -.02em;
  margin: 0 0 .5em;
  text-wrap: balance;
}
h1 { font-size: clamp(32px, 6vw, 58px); font-weight: 800; }
h2 { font-size: clamp(26px, 4.2vw, 40px); }
h3 { font-size: clamp(18px, 2.4vw, 23px); }
h4 { font-size: 17px; font-weight: 500; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }

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

hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }

code, pre, kbd {
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
  font-size: .92em;
}

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

/* Единые фокус-стили: видимы только при клавиатурной навигации */
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Скрытая, но доступная скринридерам подпись */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---------- 3. Логотип Odav Koduleht ---------- */
.logo {
  display: inline-flex;
  align-items: center;
  height: 28px;
  text-decoration: none;
  line-height: 0;
}
.logo img {
  height: 32px;
  width: auto;
  max-width: min(196px, 58vw);
  display: block;
}
.logo--lg { height: 36px; }
.logo--lg img { height: 36px; max-width: min(280px, 70vw); }
.logo--mark img { height: 32px; width: 32px; max-width: none; }

/* ---------- 4. Кнопки ---------- */
.btn {
  --btn-bg: var(--accent);
  --btn-ink: var(--accent-ink);
  --btn-line: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  min-height: 46px;
  border: 1px solid var(--btn-line);
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-ink);
  font-family: var(--font-text);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.01em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform var(--t), background var(--t), border-color var(--t), box-shadow var(--t), color var(--t), opacity var(--t);
  -webkit-user-select: none;
  user-select: none;
}
.btn:hover { background: color-mix(in srgb, var(--btn-bg) 88%, var(--ink)); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Призрачная — контур на светлом */
.btn--ghost {
  --btn-bg: transparent;
  --btn-ink: var(--ink);
  --btn-line: var(--line);
}
.btn--ghost:hover { background: rgba(24, 32, 56, .05); border-color: var(--ink); }

/* Тёмная — navy */
.btn--dark {
  --btn-bg: var(--dark);
  --btn-ink: #F4F6FC;
}
.btn--dark:hover { background: var(--dark-surface); }
.btn--dark:focus-visible { outline-color: var(--accent); }

/* Компактная */
.btn--sm {
  padding: 8px 14px;
  min-height: 36px;
  font-size: 13.5px;
  gap: 6px;
}

.btn--block { display: flex; width: 100%; }

.btn[disabled],
.btn[aria-disabled='true'],
.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  filter: grayscale(.35);
}
.btn[disabled]:hover,
.btn:disabled:hover { background: var(--btn-bg); border-color: var(--btn-line); }

/* ---------- 5. Поля ввода ---------- */
.input {
  display: block;
  width: 100%;
  padding: 11px 14px;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 15px;
  line-height: 1.4;
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
  appearance: none;
}
.input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.input:hover { border-color: color-mix(in srgb, var(--line) 40%, var(--muted)); }
.input:focus,
.input:focus-visible {
  outline: none;
  border-color: var(--ink);
  box-shadow: var(--ring);
}
.input[disabled], .input:disabled { background: #EEEFF5; color: var(--muted); cursor: not-allowed; }
.input[aria-invalid='true'], .input.is-error { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(229, 83, 60, .18); }

textarea.input { min-height: 108px; resize: vertical; padding-top: 12px; }
select.input {
  padding-right: 38px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1.5 6 6.5l5-5' fill='none' stroke='%236C7466' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

/* Поле = подпись + контрол колонкой */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label,
.field > .field__label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--muted);
}
.field__hint { font-size: 12.5px; color: var(--muted); }
.field__error { font-size: 13px; font-weight: 600; color: var(--danger); }

/* ---------- 6. Карточка ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
}
.card--pad-lg { padding: 30px; }
.card--flat { box-shadow: none; }
.card--hover:hover { border-color: color-mix(in srgb, var(--ink) 22%, var(--line)); box-shadow: var(--shadow); }
.card--dark {
  background: var(--dark-surface);
  border-color: rgba(255, 255, 255, .1);
  color: #EEF1F8;
}
.card--dark .muted { color: #A8B0C4; }

/* ---------- 7. Чипсы ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--t), border-color var(--t), color var(--t), transform var(--t);
  -webkit-user-select: none;
  user-select: none;
}
.chip:hover { border-color: var(--ink); }
.chip:active { transform: translateY(1px); }
.chip--active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.chip--active:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
.chip--static { cursor: default; }
.chip--static:hover { border-color: var(--line); }

/* ---------- 8. Бейджи ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #EEEFF5;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .01em;
  line-height: 1.6;
  white-space: nowrap;
}
.badge--ok {
  background: color-mix(in srgb, var(--ok) 14%, var(--surface));
  border-color: color-mix(in srgb, var(--ok) 35%, transparent);
  color: color-mix(in srgb, var(--ok) 78%, var(--ink));
}
.badge--warn {
  background: color-mix(in srgb, #E9A93C 18%, var(--surface));
  border-color: color-mix(in srgb, #E9A93C 42%, transparent);
  color: #8A5A05;
}
.badge--danger {
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
  color: color-mix(in srgb, var(--danger) 82%, var(--ink));
}

/* ---------- 9. Таблица ---------- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  background: var(--surface);
}
.table th,
.table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.table th {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  background: #F5F6FA;
  white-space: nowrap;
}
.table tbody tr { transition: background var(--t); }
.table tbody tr:hover { background: #F5F6FA; }
.table tbody tr:last-child td { border-bottom: 0; }
.table--card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

/* ---------- 10. Вкладки ---------- */
.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #EEEFF5;
}
.tab {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 8px 18px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: background var(--t), color var(--t), box-shadow var(--t);
  white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab--active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* ---------- 11. Тост ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 9999;
  max-width: min(92vw, 460px);
  padding: 13px 20px;
  border-radius: 999px;
  background: var(--dark);
  color: #F4F6FC;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: toast-in .22s ease both;
}
.toast--error { background: var(--danger); color: #fff; }
.toast--ok { background: var(--ok); color: #fff; }
.toast[hidden] { display: none; }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 14px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- 12. Пустое состояние ---------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 56px 24px;
  border: 1px dashed color-mix(in srgb, var(--muted) 45%, var(--line));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  text-align: center;
}
.empty h3 { margin: 0; font-size: 20px; }
.empty p { margin: 0; max-width: 46ch; color: var(--muted); }
.empty .btn { margin-top: 8px; }

/* ---------- 13. Утилиты ---------- */
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }
.row--top { align-items: flex-start; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack--lg { gap: 20px; }
.muted { color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.container { width: 100%; max-width: 1120px; margin-inline: auto; padding-inline: 22px; }
.spacer { flex: 1 1 auto; }
.nowrap { white-space: nowrap; }
.tnum { font-variant-numeric: tabular-nums; }
.hidden, [hidden] { display: none !important; }

/* ---------- 14. Адаптив (от 360px) ---------- */
@media (max-width: 860px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  body { font-size: 15.5px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .card { padding: 18px; }
  .card--pad-lg { padding: 22px; }
  .container { padding-inline: 16px; }
  .toast { bottom: 16px; max-width: calc(100vw - 24px); }
  .table th, .table td { padding: 10px 11px; }
}
@media (max-width: 380px) {
  .btn { padding: 11px 16px; font-size: 14.5px; }
  .container { padding-inline: 13px; }
}

/* Переключатель ET / RU / EN — лендинг, вход, юридические страницы */
.lang-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  flex: none;
  background: var(--surface);
}
.lang-switch button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  padding: 6px 9px;
  cursor: pointer;
}
.lang-switch button.on { background: var(--ink); color: #fff; }
.lang-switch button:hover:not(.on) { color: var(--ink); }

/* Уважаем системную настройку «меньше движения» */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
