/* BM admin — design tokens and the few components Tailwind should not own.
   Шрифты: Unbounded (только вордмарк и крупные числа), Golos Text (интерфейс),
   JetBrains Mono (коды). */
@import url('https://fonts.googleapis.com/css2?family=Golos+Text:wght@400;500;600;700&family=JetBrains+Mono:wght@400;600&family=Unbounded:wght@500;700&display=swap');

:root {
  --ink:        #1B1420;
  --ink-soft:   #6B6270;
  --canvas:     #F5F2F0;
  --surface:    #FFFFFF;
  --line:       #E4DEDA;
  --berry:      #B31D63;
  --berry-dark: #8E1550;
  --lightning:  #F5B301;
  --issued:     #1F7A5C;
  --transit:    #4F5BD5;
  --danger:     #C0392B;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: 'Golos Text', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.wordmark {
  font-family: 'Unbounded', system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -0.03em;
}

/* Крупные числа: остаток на складе, счётчики. Единственное место, где
   Unbounded появляется в интерфейсе — иначе он перетягивает внимание. */
.numeral {
  font-family: 'Unbounded', system-ui, sans-serif;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
}

.mono {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

/* --- supply rail ---------------------------------------------------------
   Подпись под спецификацией: партия физически едет из точки A в точку B.
   Три деления — три реальных состояния, не декорация. */
.rail {
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
}
.rail-node {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--line);
  flex: none;
}
.rail-node.is-done { background: var(--transit); }
.rail-node.is-final { background: var(--issued); }
.rail-track {
  height: 2px; flex: 1 1 auto;
  background: repeating-linear-gradient(90deg, var(--line) 0 6px, transparent 6px 10px);
}
.rail-track.is-done {
  background: var(--transit);
  opacity: .55;
}
.rail-label {
  font-size: 11px; color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: .07em;
}

/* --- status pills --------------------------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.pill-neutral { background: #EDE9E7; color: var(--ink-soft); }
.pill-transit { background: #E9EAFB; color: var(--transit); }
.pill-issued  { background: #E3F1EC; color: var(--issued); }
.pill-open    { background: #FBE9F1; color: var(--berry); }
.pill-danger  { background: #FBE7E4; color: var(--danger); }

.lightning-value {
  color: #8A6400;
  background: #FFF3D1;
  padding: 1px 8px;
  border-radius: 999px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* --- controls ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background-color .12s ease, border-color .12s ease, transform .06s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--berry); color: #fff; }
.btn-primary:hover { background: var(--berry-dark); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink-soft); }
.btn-quiet { background: transparent; color: var(--ink-soft); padding: 6px 10px; }
.btn-quiet:hover { color: var(--ink); }
.btn-accept { background: var(--issued); color: #fff; }
.btn-accept:hover { filter: brightness(1.08); }
.btn-sm { padding: 5px 11px; font-size: 13px; border-radius: 8px; }

.field {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink); font: inherit;
}
.field:focus-visible, .btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--berry); outline-offset: 2px;
}
.label {
  display: block; margin-bottom: 5px;
  font-size: 12px; font-weight: 600; color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: .05em;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; padding: 10px 14px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-soft); border-bottom: 1px solid var(--line);
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #FBF9F8; }

.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; border-radius: 10px;
  color: #C9BFCD; text-decoration: none; font-weight: 500;
}
.sidebar-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-link.is-active { background: var(--berry); color: #fff; }

/* Счётчик заявок в модерации: не отвлекает, но виден боковым зрением. */
.badge-count {
  min-width: 22px; padding: 1px 7px; border-radius: 999px;
  background: var(--berry); color: #fff;
  font-size: 12px; font-weight: 600; text-align: center;
}
.sidebar-link.is-active .badge-count { background: rgba(255,255,255,.24); }

.flash { padding: 11px 16px; border-radius: 12px; font-weight: 500; }
.flash-ok    { background: #E3F1EC; color: var(--issued); }
.flash-error { background: #FBE7E4; color: var(--danger); }

.empty {
  padding: 28px 20px; text-align: center; color: var(--ink-soft);
  border: 1px dashed var(--line); border-radius: 12px;
}

.low-stock { color: var(--danger); }

/* Спокойный индикатор автообновления вместо спиннера на весь экран. */
.htmx-indicator { opacity: 0; transition: opacity .2s ease; }
.htmx-request .htmx-indicator { opacity: 1; }

/* --- превью сториса ------------------------------------------------------
   Телефонная рамка поверх формы: контент-менеджер видит сторис глазами
   приложения ещё до публикации. Показ включает JS через style.display. */
.story-preview {
  position: fixed; inset: 0; z-index: 50;
  place-items: center;
  background: rgba(27, 20, 32, .72);
  padding: 24px;
}
.story-preview__phone {
  position: relative;
  width: min(300px, 78vw); aspect-ratio: 1080 / 2340; max-height: 88vh;
  border-radius: 28px; overflow: hidden;
  background: #000; color: #fff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .4);
}
.story-preview__media {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
}
.story-preview__empty {
  position: absolute; inset: 0;
  place-items: center; display: grid;
  color: rgba(255, 255, 255, .6); font-size: 13px;
}
.story-preview__caption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 24px 18px 22px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .78));
}
.story-preview__title { font-weight: 700; font-size: 17px; line-height: 1.3; }
.story-preview__desc { margin-top: 6px; font-size: 13px; opacity: .85; white-space: pre-wrap; }
.story-preview__close {
  position: absolute; top: 20px; right: 20px;
  width: 40px; height: 40px; border-radius: 50%;
  border: 0; cursor: pointer;
  background: rgba(255, 255, 255, .14); color: #fff; font-size: 15px;
}
.story-preview__close:hover { background: rgba(255, 255, 255, .26); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
