/* ============================================================
   Design tokens + базовые компоненты
   Единая система для витрины и админки.
   ============================================================ */

:root {
  --ac: #005A9C;
  --ac-soft: color-mix(in oklab, var(--ac) 12%, transparent);
  --ac-line: color-mix(in oklab, var(--ac) 40%, transparent);

  --pg: #EDEEEA;
  --tx: #10131A;
  --ln: #10131A;
  --cd: #FFFFFF;
  --cd2: #F7F8F5;
  --mut: #565B61;
  --mut2: #6B7075;
  --st1: #F4F5F2;
  --st2: #EDEEEA;
  --navbg: rgba(255, 255, 255, .82);

  --ink-08: rgba(16, 19, 26, .08);
  --ink-14: rgba(16, 19, 26, .14);
  --ink-22: rgba(16, 19, 26, .22);

  /* смягчённые «брутальные» тени */
  --sh-card: 3px 3px 0 var(--ink-14), 0 10px 26px var(--ink-08);
  --sh-card-hover: 5px 6px 0 var(--ink-22), 0 18px 40px color-mix(in oklab, var(--ac) 16%, transparent);
  --sh-pop: 4px 4px 0 var(--ink-22), 0 22px 60px rgba(10, 13, 20, .25);
  --sh-btn: 3px 3px 0 var(--ln);
  --sh-btn-hover: 5px 5px 0 var(--ln);

  /* Единая шкала скруглений. Всё интерактивное (кнопки, поля, чипы, тоглы,
     табы) = --r-btn. Контейнеры (карточки, панели, модалки, чат) = --r-card.
     --r-pill только для того, что должно быть капсулой (навбар, бейдж, FAB). */
  --r-btn: 12px;
  --r-card: 16px;
  --r-chip: 9px;
  --r-pill: 999px;

  --f-display: 'Pirata One', serif;
  --f-head: 'Unbounded', sans-serif;
  --f-body: 'Golos Text', sans-serif;
  --f-mono: 'JetBrains Mono', monospace;

  --ok: #0B7A4B;
  --err: #C0392B;
  --warn: #FFD400;
  /* статусные цвета для текста поверх тем-зависимых (белых) поверхностей */
  --ok-fg: var(--ok);
  --err-fg: var(--err);
}

[data-theme="dark"] {
  --pg: #0B0E15;
  --tx: #EFF1F4;
  --ln: #262B35;
  --cd: #141922;
  --cd2: #0F131B;
  --mut: #A6ACB5;
  --mut2: #7C828B;
  --st1: #171C26;
  --st2: #12161F;
  --navbg: rgba(17, 21, 30, .82);

  --ink-08: rgba(0, 0, 0, .35);
  --ink-14: rgba(0, 0, 0, .45);
  --ink-22: rgba(0, 0, 0, .6);

  --sh-btn: 3px 3px 0 rgba(0, 0, 0, .55);
  --sh-btn-hover: 5px 5px 0 rgba(0, 0, 0, .55);
  /* в тёмной теме нужны более светлые оттенки, иначе тёмно-зелёный/красный тонут в фоне */
  --ok-fg: #6FCF97;
  --err-fg: #E86A5E;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--pg);
  color: var(--tx);
  font-family: var(--f-body);
  overflow-x: hidden;
  transition: background .3s ease, color .3s ease;
}
a { color: var(--ac); text-decoration: none; }
a:hover { filter: brightness(1.15); }
::selection { background: color-mix(in oklab, var(--ac) 25%, transparent); }
::-webkit-scrollbar { width: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ac); border-radius: 8px; border: 2px solid var(--pg); }

/* ---------- типографика ---------- */
.h-display { font-family: var(--f-display); line-height: .95; }
.h1 { font-family: var(--f-head); font-weight: 900; font-size: clamp(22px, 3.4vw, 34px); margin: 0; letter-spacing: .01em; }
.h2 { font-family: var(--f-head); font-weight: 800; font-size: 17px; margin: 0; }
.mono { font-family: var(--f-mono); }
.k-label { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .14em; color: var(--mut2); text-transform: uppercase; }
.muted { color: var(--mut); }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 13px 24px; border: 2px solid var(--ln); border-radius: var(--r-btn);
  background: var(--cd); color: var(--tx);
  font-family: var(--f-head); font-weight: 700; font-size: 12.5px; letter-spacing: .04em;
  cursor: pointer; white-space: nowrap; user-select: none;
  box-shadow: var(--sh-btn);
  transition: transform .13s ease, box-shadow .13s ease, background .15s ease, filter .15s ease;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: var(--sh-btn-hover); }
.btn:active { transform: translate(0, 0); box-shadow: 1px 1px 0 var(--ln); }
.btn:focus-visible, .inp:focus-visible { outline: 3px solid var(--ac-line); outline-offset: 2px; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: var(--sh-btn); }

.btn-primary { background: var(--ac); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; box-shadow: none; }
.btn-ghost:hover { background: rgba(127, 127, 127, .12); transform: none; box-shadow: none; }
.btn-dark { background: #171A20; color: #F2F3F0; border-color: #171A20; }
.btn-sm { padding: 8px 14px; font-size: 11px; box-shadow: 2px 2px 0 var(--ln); }
.btn-sm:hover { box-shadow: 3px 3px 0 var(--ln); }
.btn-danger { background: var(--err); color: #fff; }
.btn-pill { border-radius: var(--r-pill); }
.btn-icon {
  width: 36px; height: 36px; padding: 0; border-radius: 50%; flex-shrink: 0;
  display: inline-grid; place-items: center; box-shadow: none;
}
.btn-icon:hover { transform: none; box-shadow: none; background: rgba(127, 127, 127, .14); }

/* ---------- поля ввода ---------- */
.inp, .sel, textarea.inp {
  width: 100%; padding: 12px 14px;
  border: 2px solid var(--ln); border-radius: var(--r-btn);
  background: var(--cd2); color: var(--tx);
  font-family: var(--f-mono); font-size: 13px; outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.inp::placeholder { color: var(--mut2); }
.inp:focus, .sel:focus, textarea.inp:focus {
  border-color: var(--ac);
  box-shadow: 0 0 0 3px var(--ac-soft);
}
textarea.inp { font-family: var(--f-body); font-size: 14px; resize: vertical; min-height: 90px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.fld-hint { font-size: 11px; color: var(--mut2); margin-top: 4px; line-height: 1.4; }
.sel { appearance: none; cursor: pointer; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236B7075' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}

/* ---------- карточки ---------- */
.card {
  border: 2px solid var(--ln); border-radius: var(--r-card);
  background: var(--cd); box-shadow: var(--sh-card);
}
.card-hover { transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.card-hover:hover { transform: translateY(-4px); box-shadow: var(--sh-card-hover); border-color: color-mix(in oklab, var(--ac) 45%, var(--ln)); }
.card-pad { padding: 20px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--f-mono); font-size: 10px; letter-spacing: .12em;
  border: 1.5px solid currentColor; border-radius: var(--r-chip); padding: 3px 9px;
  text-transform: uppercase;
}
.chip-solid { color: #fff; border: 2px solid var(--ln); border-radius: var(--r-chip); text-shadow: 0 1px 0 rgba(0,0,0,.3); }

/* ---------- модалки и тосты ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center;
  background: rgba(8, 10, 16, .55); backdrop-filter: blur(3px); padding: 18px;
  animation: fadeIn .2s ease both;
}
.modal {
  border: 2px solid var(--ln); border-radius: var(--r-card);
  background: var(--cd); box-shadow: var(--sh-pop);
  max-width: 560px; width: 100%; max-height: 88vh; overflow-y: auto; padding: 26px;
  animation: fadeUp .25s ease both;
}
.toasts { position: fixed; left: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  border: 2px solid var(--ln); border-radius: var(--r-btn); background: var(--cd); color: var(--tx);
  box-shadow: var(--sh-card); padding: 11px 16px;
  font-family: var(--f-mono); font-size: 11.5px; letter-spacing: .05em;
  animation: toastIn .25s ease both; max-width: min(420px, 80vw);
}
.toast.err { border-color: var(--err); color: var(--err); }

/* ---------- утилиты ---------- */
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.hide { display: none !important; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastIn { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: translateX(0); } }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes hueSlide { from { background-position: 0% 0; } to { background-position: 300% 0; } }
@keyframes pulseRing {
  0% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--ac) 45%, transparent); }
  70% { box-shadow: 0 0 0 14px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@keyframes bobX { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(7px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
