/* ════════════════════════════════════════════════════════════════
   Ясень.Полка — CRM мебельной фабрики «Ясень»
   Тёмная тёплая база, ясеневый (amber) акцент, зелёный — «готово»
   ════════════════════════════════════════════════════════════════ */

/* ── Шрифты: локальные woff2 (Manrope — текст, Bitter — заголовки) ── */
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url('/static/fonts/manrope-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url('/static/fonts/manrope-cyrillic-400-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url('/static/fonts/manrope-latin-500-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url('/static/fonts/manrope-cyrillic-500-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url('/static/fonts/manrope-latin-600-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url('/static/fonts/manrope-cyrillic-600-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url('/static/fonts/manrope-latin-700-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url('/static/fonts/manrope-cyrillic-700-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Bitter';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url('/static/fonts/bitter-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Bitter';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url('/static/fonts/bitter-cyrillic-400-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Bitter';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url('/static/fonts/bitter-latin-600-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Bitter';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url('/static/fonts/bitter-cyrillic-600-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Bitter';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url('/static/fonts/bitter-latin-700-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Bitter';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url('/static/fonts/bitter-cyrillic-700-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* ── Токены ── */
:root {
  --bg-page: #14100c;
  --bg-card: #211810;
  --bg-elevated: #2a1f14;
  --bg-input: #1a130d;
  --brand: #d69a4b;
  --brand-hover: #e3ab5e;
  --brand-soft: rgba(214, 154, 75, 0.14);
  --accent: #8fb573;
  --accent-soft: rgba(143, 181, 115, 0.14);
  --text-primary: #f5ecdf;
  --text-muted: #b7a894;
  --text-faint: #8a7c6b;
  --line: rgba(183, 168, 148, 0.16);
  --line-strong: rgba(183, 168, 148, 0.3);
  --danger: #e07856;
  --font-body: 'Manrope', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  --font-display: 'Bitter', Georgia, 'Times New Roman', serif;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow-card: 0 1px 0 rgba(255, 236, 200, 0.03) inset, 0 10px 30px -18px rgba(0, 0, 0, 0.8);
  --ease: cubic-bezier(0.25, 0.6, 0.3, 1);
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-primary);
  background:
    radial-gradient(1100px 500px at 12% -8%, rgba(214, 154, 75, 0.07), transparent 60%),
    radial-gradient(900px 420px at 108% 108%, rgba(143, 181, 115, 0.05), transparent 55%),
    var(--bg-page);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Тонкое «древесное» зерно поверх фона — инлайн SVG-шум */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

main { position: relative; z-index: 1; }

.ico {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--text-muted);
}
.ico-lg { width: 30px; height: 30px; color: var(--brand); }
.ico-xl { width: 44px; height: 44px; }

/* ── Кнопки ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: 600 14px/1.2 var(--font-body);
  letter-spacing: 0.01em;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease),
    color 0.15s var(--ease), transform 0.1s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #221407;
}
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-primary:disabled { cursor: default; }

.btn-ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--text-primary);
}
.btn-ghost:hover { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }

.btn-sm { padding: 7px 10px; }
.btn-block { width: 100%; padding: 12px 18px; font-size: 15px; }

/* Кнопка в режиме загрузки: тонкая «полоса-заготовка» */
.btn .btn-bar {
  position: absolute;
  inset: 0;
  width: 0%;
  background: rgba(34, 20, 7, 0.18);
  transition: width 0.2s var(--ease);
}
.btn[data-loading] .btn-bar { width: 100%; transition: width 0.45s linear infinite alternate; }
.btn[data-loading] .btn-label { opacity: 0.55; }
.btn[data-loading] .ico { opacity: 0.4; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.icon-btn:hover { background: var(--brand-soft); color: var(--brand); }
.icon-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

/* ── Поля форм ── */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.field .req { color: var(--brand); }
.field input,
.field textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-input);
  color: var(--text-primary);
  font: 500 15px/1.4 var(--font-body);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.field input::placeholder,
.field textarea::placeholder { color: var(--text-faint); }
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.field textarea { resize: vertical; min-height: 74px; }

.field.invalid input {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.field-error {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--brand);
}

.phone-row { display: flex; gap: 8px; align-items: stretch; }
.phone-row input { flex: 1; }

.form-error {
  margin: 0 0 14px;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  background: rgba(224, 120, 86, 0.12);
  border: 1px solid rgba(224, 120, 86, 0.35);
  color: #f0b39e;
  font-size: 14px;
}

/* ════════════ Вход: «табличка» на вход в мастерскую ════════════ */
.view-login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-plaque {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--brand);
  border-radius: 14px;
  padding: 36px 32px 28px;
  box-shadow: var(--shadow-card), 0 30px 80px -40px rgba(0, 0, 0, 0.9);
  animation: plaque-in 0.4s var(--ease) both;
}
@keyframes plaque-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border-radius: 16px;
  background: linear-gradient(160deg, var(--brand-soft), transparent 70%);
  border: 1px solid var(--line);
  color: var(--brand);
}
.brand-mark-sm {
  width: 44px;
  height: 44px;
  margin: 0;
  border-radius: 11px;
}
.brand-mark-sm .ico { width: 22px; height: 22px; }

.brand-title {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-align: center;
}
.brand-title .dot { color: var(--brand); }
.tagline {
  margin: 0 0 26px;
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
}
.login-note {
  margin: 18px 0 0;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-faint);
}

/* ════════════ Общий список ════════════ */
.view-list {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 20px 64px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 26px 0 20px;
}
.topbar-brand { display: flex; align-items: center; gap: 13px; }
.topbar-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.15;
}
.topbar-sub {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.user-chip {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-card);
}

/* Панель поиска — прилипает к шапке */
.list-tools {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  margin-bottom: 14px;
  background: color-mix(in srgb, var(--bg-page) 88%, transparent);
  backdrop-filter: none;
  border-bottom: 1px solid var(--line);
}
.search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1 1 260px;
  max-width: 360px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.search-box:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.search-box input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font: 500 14.5px/1.3 var(--font-body);
}
.search-box input:focus { outline: none; }
.search-box input::placeholder { color: var(--text-faint); }

/* Счётчики статусов: кромка + число + подпись, без «таблеток» */
.counters { display: flex; gap: 20px; margin-left: auto; }
.counter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  border-left: 3px solid var(--line);
  padding: 2px 0 2px 10px;
  transition: border-color 0.3s var(--ease);
}
.counter-num { font-size: 17px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.counter-label { font-size: 11.5px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-faint); }
.counter[data-status='new'] { border-color: var(--text-muted); }
.counter[data-status='in_progress'] { border-color: var(--brand); }
.counter[data-status='done'] { border-color: var(--accent); }

/* ── Карточки ── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px 15px 22px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: border-color 0.15s var(--ease), transform 0.15s var(--ease), background-color 0.15s var(--ease);
  animation: card-in 0.35s var(--ease) both;
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.card:hover { border-color: var(--line-strong); transform: translateY(-2px); background: var(--bg-elevated); }
.card:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Кромка-штабель статуса: слева, перекрашивается при смене статуса */
.card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--text-muted);
  transition: background-color 0.5s var(--ease);
}
.card[data-status='new']::before { background: var(--text-muted); }
.card[data-status='in_progress']::before { background: var(--brand); }
.card[data-status='done']::before { background: var(--accent); }

.card-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 17.5px;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.card-name mark {
  background: var(--brand-soft);
  color: var(--brand-hover);
  border-radius: 3px;
  padding: 0 1px;
}
.card-phone {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-size: 13.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.card-phone .ico { width: 14px; height: 14px; }
.card-req {
  margin: 2px 0 0;
  font-size: 13.5px;
  color: var(--text-primary);
  opacity: 0.82;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
}
.card-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}
.card[data-status='in_progress'] .card-status { color: var(--brand); }
.card[data-status='done'] .card-status { color: var(--accent); }
.card-status .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.card-updated {
  font-size: 12px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

/* Скелетоны карточек (loading) */
.skeleton-card {
  position: relative;
  padding: 16px 18px 18px 22px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 128px;
}
.skeleton-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--line-strong);
}
.sk-line {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--bg-elevated) 25%, #332618 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: sk-shimmer 1.3s linear infinite;
  margin-bottom: 12px;
}
.sk-line.w60 { width: 60%; }
.sk-line.w40 { width: 40%; height: 10px; }
.sk-line.w90 { width: 90%; height: 10px; }
@keyframes sk-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* Пустое состояние */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 64px 24px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--text-muted);
}
.empty-art { width: 120px; color: var(--text-faint); }
.empty p { margin: 0; font-size: 15px; max-width: 340px; }

/* Ошибка списка */
.list-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 24px;
  text-align: center;
  border: 1px solid rgba(224, 120, 86, 0.3);
  border-radius: var(--radius);
  background: rgba(224, 120, 86, 0.06);
}
.list-error p { margin: 0; font-size: 15px; }

/* Пагинация */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 26px;
}
.page-info {
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.pagination .btn:disabled { opacity: 0.35; cursor: default; }
.pagination .btn:disabled:hover { background: transparent; border-color: var(--line-strong); color: var(--text-primary); }

/* ════════════ Диалоги ════════════ */
.dialog {
  width: min(520px, calc(100vw - 32px));
  max-height: min(92dvh, 760px);
  padding: 0;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--line-strong);
  border-top: 3px solid var(--brand);
  border-radius: 14px;
  box-shadow: 0 40px 120px -30px rgba(0, 0, 0, 0.85);
}
.dialog::backdrop { background: rgba(10, 7, 4, 0.72); }
.dialog form { padding: 22px 24px 20px; overflow-y: auto; max-height: min(92dvh, 760px); }

.dlg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.dlg-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
}
.dlg-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}
.dlg-hint { margin: 0 0 4px; font-size: 13px; color: var(--text-faint); }
.dlg-note {
  padding: 18px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14.5px;
}
.save-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.save-hint { margin: 0; font-size: 12px; color: var(--text-faint); }

/* ── Шкала статуса «Новая → В работе → Готово» ── */
.status-scale {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  padding: 12px 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--line);
}
.scale-step {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text-faint);
  font: 600 13px/1.2 var(--font-body);
  cursor: pointer;
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease), background-color 0.25s var(--ease);
}
.scale-step:hover { color: var(--text-muted); background: var(--brand-soft); }
.scale-step:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.scale-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  background: transparent;
  transition: background-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.scale-line {
  flex: 1;
  height: 1.5px;
  min-width: 14px;
  background: var(--line-strong);
  transition: background-color 0.3s var(--ease);
}
/* активное звено заполнено, пролёт до него подсвечен */
.status-scale[data-active='new'] .scale-step[data-status='new'],
.status-scale[data-active='in_progress'] .scale-step[data-status='new'],
.status-scale[data-active='in_progress'] .scale-step[data-status='in_progress'],
.status-scale[data-active='done'] .scale-step[data-status='new'],
.status-scale[data-active='done'] .scale-step[data-status='in_progress'],
.status-scale[data-active='done'] .scale-step[data-status='done'] {
  color: var(--text-primary);
}
.status-scale[data-active='new'] .scale-step[data-status='new'],
.status-scale[data-active='in_progress'] .scale-step[data-status='in_progress'],
.status-scale[data-active='done'] .scale-step[data-status='done'] {
  color: var(--brand);
  border-color: rgba(214, 154, 75, 0.4);
  background: var(--brand-soft);
}
.status-scale[data-active='done'] .scale-step[data-status='done'] {
  color: var(--accent);
  border-color: rgba(143, 181, 115, 0.45);
  background: var(--accent-soft);
}
.status-scale[data-active='new'] .scale-step[data-status='new'] .scale-dot,
.status-scale[data-active='in_progress'] .scale-step[data-status='in_progress'] .scale-dot,
.status-scale[data-active='done'] .scale-step[data-status='done'] .scale-dot {
  background: currentColor;
  transform: scale(1.25);
}
.status-scale[data-active='in_progress'] .scale-line:first-of-type,
.status-scale[data-active='done'] .scale-line {
  background: var(--brand);
}
.status-scale[data-active='done'] .scale-line:last-of-type { background: var(--accent); }

.updated-note {
  margin: 8px 2px 14px;
  font-size: 12.5px;
  color: var(--accent);
}

/* ════════════ Подменка шрифта: скелетон до готовности ════════════
   Пока локальные woff2 не загрузились (мгновенно на self-host,
   но защита обязана быть), контент-блоки показываются как полосы —
   фолбэк-шрифт не виден, вёрстка не «прыгает». Снимается по
   document.fonts.ready или через 1500 мс. */
html.fonts-pending .view-login .login-plaque,
html.fonts-pending .view-list { opacity: 0; }
html.fonts-pending .view-login::after,
html.fonts-pending .view-list::after {
  content: '';
  position: absolute;
  inset: 12vh 8vw;
  border-radius: 14px;
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-elevated) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: sk-shimmer 1.3s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ════════════ Адаптив ════════════ */
@media (max-width: 640px) {
  .list-tools { flex-wrap: wrap; }
  .search-box { flex-basis: 100%; max-width: none; order: 1; }
  .counters { margin-left: 0; gap: 14px; }
  #new-record-btn { order: 2; margin-left: auto; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 14px; }
  .topbar-actions { width: 100%; justify-content: space-between; }
  .cards { grid-template-columns: 1fr; }
  .status-scale { flex-wrap: wrap; }
  .scale-line { min-width: 10px; }
  .dlg-foot { flex-direction: column-reverse; align-items: stretch; }
  .save-wrap { align-items: stretch; }
  .save-wrap .btn { width: 100%; }
}
