/* ============================================================
   WMS · ЕФП-ПАРТС — UI v2 «Operations Minimal»
   Источник правды: дизайн-система. Никаких inline-style в шаблонах.
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  /* Surfaces */
  --bg: #FAFAFA;
  --surface: #FFFFFF;
  --surface-2: #F4F4F5;
  --surface-3: #E4E4E7;
  --border: #E4E4E7;
  --border-strong: #D4D4D8;
  --overlay: rgba(24, 24, 27, .45);

  /* Text */
  --text: #18181B;
  --text-2: #52525B;
  --text-3: #71717A;
  --text-4: #A1A1AA;

  /* Brand */
  --brand: #2563EB;
  --brand-hover: #1D4ED8;
  --brand-active: #1E40AF;
  --brand-soft: #EFF6FF;
  --brand-ring: rgba(37, 99, 235, .18);

  /* Semantic */
  --success: #16A34A;
  --success-soft: #DCFCE7;
  --warning: #D97706;
  --warning-soft: #FEF3C7;
  --danger: #DC2626;
  --danger-soft: #FEE2E2;
  --info: #0891B2;
  --info-soft: #CFFAFE;
  --neutral: #71717A;
  --neutral-soft: #F4F4F5;

  /* Radii */
  --r-sm: 4px;
  --r: 6px;
  --r-md: 8px;
  --r-lg: 12px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(24, 24, 27, .04);
  --shadow-sm: 0 1px 2px rgba(24, 24, 27, .04), 0 1px 3px rgba(24, 24, 27, .06);
  --shadow-md: 0 4px 12px rgba(24, 24, 27, .08);
  --shadow-lg: 0 12px 32px rgba(24, 24, 27, .12);

  /* Layout */
  --sidebar-w: 240px;
  --sidebar-w-collapsed: 64px;
  --topbar-h: 56px;

  /* Motion */
  --t-fast: 120ms ease;
  --t: 160ms ease;

  /* Compatibility shims (старый код использовал эти переменные) */
  --glass: var(--surface);
  --glass2: var(--surface);
  --stroke: var(--border);
  --muted: var(--text-3);
  --hint: var(--text-3);
  --shadow: var(--shadow-sm);
  --accent: var(--brand);
  --accent2: var(--info);
  --bg0: var(--bg);
  --bg1: var(--bg);
  --radius: var(--r-md);
  --blur: 0;
}

/* Dark theme — опциональный, по нажатию #theme-toggle */
:root[data-theme="dark"] {
  --bg: #0A0A0B;
  --surface: #131316;
  --surface-2: #1C1C20;
  --surface-3: #2A2A30;
  --border: #27272A;
  --border-strong: #3F3F46;

  --text: #FAFAFA;
  --text-2: #D4D4D8;
  --text-3: #A1A1AA;
  --text-4: #71717A;

  --brand-soft: rgba(37, 99, 235, .16);
  --success-soft: rgba(22, 163, 74, .18);
  --warning-soft: rgba(217, 119, 6, .20);
  --danger-soft: rgba(220, 38, 38, .18);
  --info-soft: rgba(8, 145, 178, .18);
  --neutral-soft: rgba(161, 161, 170, .14);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4), 0 1px 3px rgba(0, 0, 0, .5);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .5);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .6);
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Ubuntu, Cantarell, 'Noto Sans', sans-serif;
  font-size: 14px;
  line-height: 20px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  color: var(--brand-hover);
}

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

button {
  font-family: inherit;
}

.num,
table td,
table th {
  font-variant-numeric: tabular-nums;
}

/* Старые декоративные блобы из base.html — обнуляем (их можно не удалять из шаблона) */
.bg,
.bg__blob,
.bg__grid {
  display: none !important;
}

/* ---------- App shell ---------- */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas:
    "sidebar topbar"
    "sidebar main";
  min-height: 100vh;
  transition: grid-template-columns var(--t);
}

.app-shell[data-sidebar="collapsed"] {
  grid-template-columns: var(--sidebar-w-collapsed) 1fr;
}

/* ---------- Sidebar ---------- */
.sidebar {
  grid-area: sidebar;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--topbar-h);
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-decoration: none;
}

.sidebar__brand:hover {
  color: var(--text);
}

.sidebar__logo {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: var(--r);
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .5px;
}

.sidebar__brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.sidebar__brand-text small {
  color: var(--text-3);
  font-size: 11px;
  font-weight: 500;
}

.sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar__group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar__group+.sidebar__group {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.sidebar__group-title {
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-4);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--r);
  color: var(--text-2);
  font-weight: 500;
  font-size: 13px;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  text-decoration: none;
  transition: background-color .2s ease, color .2s ease,
    border-color .2s ease, box-shadow .2s ease;
}

.sidebar__link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.sidebar__link[aria-current="page"] {
  background: var(--brand-soft);
  color: var(--brand);
}

.sidebar__link[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 2px;
  border-radius: 2px;
  background: var(--brand);
}

.sidebar__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke-width: 1.75;
}

.sidebar__label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__footer {
  padding: 8px;
  border-top: 1px solid var(--border);
}

.sidebar__collapse {
  width: 100%;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  background: transparent;
  color: var(--text-3);
  border-radius: var(--r);
  cursor: pointer;
  font-size: 12px;
}

.sidebar__collapse:hover {
  background: var(--surface-2);
  color: var(--text);
}

.app-shell[data-sidebar="collapsed"] .sidebar__brand-text,
.app-shell[data-sidebar="collapsed"] .sidebar__label,
.app-shell[data-sidebar="collapsed"] .sidebar__group-title,
.app-shell[data-sidebar="collapsed"] .sidebar__collapse-text {
  display: none;
}

.app-shell[data-sidebar="collapsed"] .sidebar__brand {
  justify-content: center;
  padding: 0;
}

.app-shell[data-sidebar="collapsed"] .sidebar__link {
  justify-content: center;
  padding: 0;
}

.app-shell[data-sidebar="collapsed"] .sidebar__group+.sidebar__group {
  padding-top: 8px;
  margin-top: 8px;
}

/* ---------- Topbar ---------- */
.topbar {
  grid-area: topbar;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar__search {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.topbar__search input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 36px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--r);
  color: var(--text);
  font-size: 13px;
  transition: background var(--t-fast), border-color var(--t-fast);
}

.topbar__search input::placeholder {
  color: var(--text-4);
}

.topbar__search input:hover {
  background: var(--surface-3);
}

.topbar__search input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.topbar__search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-3);
  pointer-events: none;
}

.topbar__search kbd {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-family: inherit;
  font-size: 11px;
  color: var(--text-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 2px 6px;
}

.topbar__spacer {
  flex: 1;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar__icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--r);
  color: var(--text-2);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background var(--t-fast), color var(--t-fast);
}

.topbar__icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.topbar__icon-btn svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.75;
}

.topbar__bell {
  position: relative;
}

.topbar__bell-count {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--danger, #dc2626);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 0 0 2px var(--surface);
}

.topbar__user {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 8px 0 4px;
  border-radius: var(--r);
  color: var(--text);
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: background var(--t-fast);
  text-decoration: none;
  font-size: 13px;
}

.topbar__user:hover {
  background: var(--surface-2);
  color: var(--text);
}

.topbar__avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
}

.topbar__user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  align-items: flex-start;
}

.topbar__user-name {
  line-height: 1.2;
}

.topbar__user-role {
  font-size: 11px;
  color: var(--text-3);
}

/* ---------- Main ---------- */
.main {
  grid-area: main;
  padding: 24px;
  min-width: 0;
}

.page {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.page__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page__title {
  font-size: 22px;
  line-height: 28px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.page__subtitle {
  color: var(--text-3);
  margin: 4px 0 0;
  font-size: 13px;
}

.page__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-3);
}

.breadcrumbs a {
  color: var(--text-3);
}

.breadcrumbs a:hover {
  color: var(--text);
}

.breadcrumbs__sep {
  color: var(--text-4);
}

.breadcrumbs__current {
  color: var(--text);
  font-weight: 500;
}

/* Старая ширина-контейнер от nav.html (для шаблонов, не отрефакторенных). */
.container {
  width: 100%;
}

main.container {
  padding: 0;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xs);
  color: var(--text);
}

.card--glass {
  /* legacy alias, теперь обычная карточка */
  background: var(--surface);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 1px solid var(--border);
}

.card--lg {
  padding: 20px;
}

.card__header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.card__header:last-child {
  border-bottom: none;
}

.card__body {
  padding: 16px 20px;
}

.card__footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- Typography ---------- */
.h1 {
  font-size: 28px;
  line-height: 36px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.h2 {
  font-size: 22px;
  line-height: 28px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.h3 {
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.lead {
  font-size: 14px;
  color: var(--text-3);
  margin: 0;
}

.muted {
  color: var(--text-3);
  margin: 0;
}

.hint {
  color: var(--text-3);
  font-size: 12px;
}

.text-success {
  color: var(--success);
}

.text-warning {
  color: var(--warning);
}

.text-danger {
  color: var(--danger);
}

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  --btn-bd: var(--border);
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--btn-bd);
  background: var(--btn-bg);
  color: var(--btn-fg);
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
  white-space: nowrap;
}

.btn:hover {
  background: var(--surface-2);
}

.btn:active {
  background: var(--surface-3);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-ring);
  border-color: var(--brand);
}

.btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.75;
}

.btn[disabled],
.btn--disabled {
  opacity: .55;
  pointer-events: none;
}

.btn--primary {
  --btn-bg: var(--brand);
  --btn-fg: #fff;
  --btn-bd: var(--brand);
}

.btn--primary:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
}

.btn--primary:active {
  background: var(--brand-active);
  border-color: var(--brand-active);
}

.btn--ghost {
  --btn-bg: transparent;
  --btn-bd: transparent;
  --btn-fg: var(--text-2);
}

.btn--ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn--danger {
  --btn-bg: var(--danger);
  --btn-fg: #fff;
  --btn-bd: var(--danger);
}

.btn--danger:hover {
  background: #B91C1C;
  border-color: #B91C1C;
}

.btn--sm {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.btn--lg {
  height: 40px;
  padding: 0 18px;
  font-size: 14px;
}

.btn--icon {
  width: 36px;
  padding: 0;
}

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

.btn--active {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
}

/* ---------- Forms ---------- */
.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field__label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
}

.field__hint {
  font-size: 12px;
  color: var(--text-3);
}

.field__error {
  font-size: 12px;
  color: var(--danger);
}

.form input,
.form select,
.form textarea,
.form__input,
.input,
.card input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not(.input-glass):not(.select-glass):not(.dashboard-role-switch__select),
.card select:not(.select-glass):not(.dashboard-role-switch__select),
.card textarea {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.form textarea,
.card textarea {
  height: auto;
  min-height: 80px;
  padding: 8px 12px;
}

.form input::placeholder,
.form textarea::placeholder,
.input::placeholder {
  color: var(--text-4);
}

.form input:hover,
.form select:hover,
.form textarea:hover,
.input:hover {
  border-color: var(--text-4);
}

.form input:focus,
.form select:focus,
.form textarea:focus,
.input:focus,
.form__input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.form input[type="file"],
.card input[type="file"] {
  height: auto;
  min-height: 42px;
  padding: 6px;
  cursor: pointer;
  color: var(--text-2);
}

.form input[type="file"]::file-selector-button,
.card input[type="file"]::file-selector-button {
  height: 30px;
  margin-right: 10px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}

.form input[type="file"]::file-selector-button:hover,
.card input[type="file"]::file-selector-button:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
}

.file-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.file-picker:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.file-picker__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.file-picker__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform var(--t-fast);
}

.file-picker__button:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
}

.file-picker__button:active {
  transform: translateY(1px);
}

.file-picker__name {
  min-width: 0;
  overflow: hidden;
  color: var(--text-3);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-picker__name.is-selected {
  color: var(--text);
  font-weight: 600;
}

.card textarea.backup-upload-comment {
  min-height: 100px;
  resize: none;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--brand);
  width: 16px;
  height: 16px;
}

/* Sticky form footer */
.form-footer {
  position: sticky;
  bottom: 0;
  margin-top: 16px;
  padding: 12px 20px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--r-md) var(--r-md);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  z-index: 5;
}

.form-footer__left {
  margin-right: auto;
  display: flex;
  gap: 8px;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  background: var(--neutral-soft);
  color: var(--neutral);
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.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--info {
  background: var(--info-soft);
  color: var(--info);
}

.badge--neutral {
  background: var(--neutral-soft);
  color: var(--neutral);
}

.badge--plain::before {
  display: none;
}

/* ---------- KPI ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.kpi__label {
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 6px;
}

.kpi__icon {
  width: 16px;
  height: 16px;
  stroke-width: 1.75;
  color: var(--text-3);
}

.kpi__value {
  font-size: 28px;
  line-height: 32px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.kpi__delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
}

.kpi__delta--up {
  color: var(--success);
}

.kpi__delta--down {
  color: var(--danger);
}

.kpi__delta--flat {
  color: var(--text-3);
}

.kpi--accent {
  border-color: var(--brand);
}

/* ---------- Data table ---------- */
.data-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.data-table__toolbar {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  align-items: center;
}

.data-table__toolbar .field {
  flex: 0 0 auto;
  min-width: 200px;
}

.data-table__toolbar-spacer {
  flex: 1;
}

.data-table__density {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}

.data-table__density button {
  height: 32px;
  padding: 0 10px;
  background: var(--surface);
  border: none;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
}

.data-table__density button+button {
  border-left: 1px solid var(--border);
}

.data-table__density button[aria-pressed="true"] {
  background: var(--surface-2);
  color: var(--text);
}

.data-table__scroll {
  overflow: auto;
  max-height: 70vh;
}

.data-table__table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.data-table__table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  padding: 10px 14px;
  white-space: nowrap;
}

.data-table__table tbody td {
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  color: var(--text);
  vertical-align: middle;
}

.data-table[data-density="compact"] .data-table__table tbody td,
.data-table[data-density="compact"] .data-table__table thead th {
  padding: 6px 14px;
}

.data-table[data-density="comfortable"] .data-table__table tbody td {
  padding: 14px 14px;
}

.data-table__table tbody tr:hover td {
  background: var(--surface-2);
}

.data-table__table tbody tr:last-child td {
  border-bottom: none;
}

.data-table__num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-table__actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.users-table__actions-heading,
.users-table__actions-cell {
  text-align: center;
}

.users-table__actions-heading {
  min-width: 300px;
}

.users-table__actions-grid {
  display: grid;
  grid-template-columns: 82px 82px 118px;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.users-table__action,
.users-table__action-form {
  width: 100%;
}

.users-table__action {
  display: inline-flex;
  justify-content: center;
  text-align: center;
}

.users-table__action--empty {
  visibility: hidden;
  pointer-events: none;
}

.data-table__sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 0;
}

.data-table__sort:hover {
  color: var(--text);
}

.data-table__empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-3);
}

.data-table__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-3);
  flex-wrap: wrap;
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.tabs__item {
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  text-decoration: none;
}

.tabs__item:hover {
  color: var(--text);
}

.tabs__item[aria-current="page"],
.tabs__item--active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

/* ---------- Toasts (messages) ---------- */
.toast {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--neutral);
  border-radius: var(--r);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}

.toast--success {
  border-left-color: var(--success);
}

.toast--info {
  border-left-color: var(--info);
}

.toast--warning {
  border-left-color: var(--warning);
}

.toast--danger,
.toast--error {
  border-left-color: var(--danger);
}

.toast__title {
  font-weight: 500;
  color: var(--text);
}

/* ---------- KV / pillbar (legacy compat) ---------- */
.kv {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 14px;
}

.kv__k {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 4px;
}

.kv__v {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

.pillbar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pill {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-2);
}

/* ---------- Layout helpers ---------- */
.grid {
  display: grid;
  gap: 16px;
}

.grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid--center {
  min-height: calc(100vh - 130px);
  place-items: center;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stack--sm {
  gap: 8px;
}

.stack--lg {
  gap: 20px;
}

.row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.row--between {
  justify-content: space-between;
}

.row--wrap {
  flex-wrap: wrap;
}

.row--end {
  justify-content: flex-end;
}

/* Spacing utilities (8-pt) */
.mt-1 {
  margin-top: 4px;
}

.mb-1 {
  margin-bottom: 4px;
}

.mt-2 {
  margin-top: 8px;
}

.mb-2 {
  margin-bottom: 8px;
}

.mt-3 {
  margin-top: 12px;
}

.mb-3 {
  margin-bottom: 12px;
}

.mt-4 {
  margin-top: 16px;
}

.mb-4 {
  margin-bottom: 16px;
}

.mt-5 {
  margin-top: 24px;
}

.mb-5 {
  margin-bottom: 24px;
}

.mt-6 {
  margin-top: 32px;
}

.mb-6 {
  margin-bottom: 32px;
}

.gap-1 {
  gap: 4px
}

.gap-2 {
  gap: 8px
}

.gap-3 {
  gap: 12px
}

.gap-4 {
  gap: 16px
}

.gap-5 {
  gap: 24px
}

.flex-1 {
  flex: 1;
}

.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

/* ---------- Storage cells (legacy) ---------- */
.storage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
}

.storage-cell {
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 8px 10px;
  box-shadow: var(--shadow-xs);
}

.storage-cell__code {
  font-weight: 600;
  font-size: 12px;
}

.storage-cell__meta {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-3);
}

/* ---------- Modal (с blur только тут) ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: min(560px, 100%);
  max-height: 90vh;
  overflow: auto;
}

/* ---------- Auth (login centered card) ---------- */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
}

.auth-card__logo {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  margin-bottom: 16px;
}

.auth-hint-modal {
  max-width: 480px;
  position: relative;
  overflow: hidden;
}

.auth-hint-modal__body {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 16px;
  padding: 28px;
}

.auth-hint-modal__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 20px;
  font-weight: 800;
  font-family: Georgia, "Times New Roman", serif;
}

.auth-hint-modal__eyebrow {
  margin: 0 0 4px;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.auth-hint-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text-2);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.auth-hint-modal__close:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft);
}

.auth-credentials {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.auth-credentials__row {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 10px;
  align-items: center;
}

.auth-credentials__label {
  color: var(--text-3);
  font-size: 13px;
  font-weight: 600;
}

.auth-credentials__value {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

@media (max-width: 520px) {
  .auth-hint-modal__body {
    grid-template-columns: 1fr;
  }

  .auth-credentials__row {
    grid-template-columns: 1fr;
  }
}

/* ───────────────────────────────────────────────────────────────────────
   Pager — пагинация в стиле сайта.
   Структура:  [счётчик]   [«на странице: 10»]                  [‹‹ ‹ 2/5 › ››]

   Использует flex-wrap. На широком — три блока в линию,
   на узком — info+size слипаются, nav уходит на новую строку и центрируется.
─────────────────────────────────────────────────────────────────────── */
.pager {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 12px 0;
  font-size: 13px;
  color: var(--text-2);
}

/* Слева — счётчик «Показано 1–25 из 234» */
.pager__info {
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex: 0 1 auto;        /* НЕ растягиваем — занимает по содержимому */
  min-width: 0;
}
.pager__info b {
  color: var(--text);
  font-weight: 600;
}

/* Селектор размера страницы — рядом с info */
.pager__size {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.pager__size-form { display: inline-flex; margin: 0; }

.pager__size-label {
  color: var(--text-3);
  font-size: 13px;
  white-space: nowrap;
}

.pager__size-select {
  height: 28px;
  padding: 0 22px 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background-color: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%2371717A' d='M0 0l5 6 5-6z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color .15s, box-shadow .15s;
}
.pager__size-select:hover  { border-color: var(--brand); }
.pager__size-select:focus  { border-color: var(--brand); outline: none;
                             box-shadow: 0 0 0 3px var(--brand-ring); }

/* Навигация (стрелки + текущая страница) — компактный блок */
.pager__nav {
  display: inline-flex;
  flex-wrap: nowrap;          /* ВАЖНО: стрелки не должны разваливаться */
  align-items: center;
  gap: 4px;
  margin-left: auto;
  white-space: nowrap;
}

/* Кнопка-стрелка: квадратная, 28x28, иконка по центру */
.pager__btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text-2);
  text-decoration: none;
  cursor: pointer;
  flex: 0 0 auto;             /* фиксированный размер, не сжимать */
  transition: border-color .12s, background-color .12s, color .12s;
}
.pager__btn:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft);
}
.pager__btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-ring);
}
.pager__btn--disabled,
.pager__btn--disabled:hover {
  color: var(--text-4);
  border-color: var(--border);
  background: var(--surface-2);
  cursor: not-allowed;
}

/* Pill с текущей страницей: «2 / 5» */
.pager__current {
  min-width: 48px;
  height: 28px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand);
  color: #fff;
  border-radius: 999px;
  font-weight: 600;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex: 0 0 auto;
  margin: 0 2px;
}
.pager__current-of {
  font-weight: 500;
  opacity: .85;
  margin-left: 2px;
}

/* На узких контейнерах — info+size прижимаются влево, nav уходит вниз */
@media (max-width: 540px) {
  .pager { justify-content: center; }
  .pager__nav { margin: 0 auto; }
}

/* ──── Интеграция pager в data-table__footer ──────────────────────────
   У data-table__footer есть свой левый счётчик «Показано X–Y из Z»,
   поэтому внутри него скрываем дубликат и убираем верхний padding.
─────────────────────────────────────────────────────────────────────── */
.data-table__footer .pager {
  padding: 0;
  flex-wrap: nowrap;
  gap: 8px 12px;
}
.data-table__footer .pager__info {
  display: none;            /* уже есть в левой колонке футера */
}
/* Второй div в data-table__footer (тот, где pager) — растягиваем,
   чтобы pager не зажимался в узкую колонку. */
.data-table__footer > div:last-child {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  justify-content: flex-end;
}

/* ---------- Progress bar ---------- */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-bar__fill {
  height: 100%;
  background: var(--brand);
  border-radius: 999px;
  transition: width .3s ease;
}

.progress-bar__fill--success {
  background: var(--success);
}

.progress-bar__fill--warning {
  background: var(--warning);
}

.progress-bar__fill--danger {
  background: var(--danger);
}

.progress-bar__text {
  font-size: 11px;
  color: var(--text-4);
  margin-top: 4px;
  text-align: right;
}

/* ---------- Counter ---------- */
.counter {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  margin: 4px 0;
  font-variant-numeric: tabular-nums;
}

.counter--pending {
  color: var(--warning);
}

.counter--in-progress {
  color: var(--brand);
}

.counter--completed {
  color: var(--success);
}

.counter--danger {
  color: var(--danger);
}

/* ---------- Responsive ---------- */
@media (max-width: 1023px) {
  .app-shell {
    grid-template-columns: var(--sidebar-w-collapsed) 1fr;
  }

  .app-shell .sidebar__brand-text,
  .app-shell .sidebar__label,
  .app-shell .sidebar__group-title,
  .app-shell .sidebar__collapse-text {
    display: none;
  }

  .app-shell .sidebar__brand,
  .app-shell .sidebar__link {
    justify-content: center;
    padding: 0;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid--3,
  .grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 720px) {
  :root {
    --sidebar-w-collapsed: 56px;
  }

  .topbar {
    padding: 0 16px;
  }

  .topbar__search {
    max-width: none;
  }

  .topbar__user-meta {
    display: none;
  }

  .main {
    padding: 16px;
  }

  .kpi-grid,
  .grid--2,
  .grid--3,
  .grid--4 {
    grid-template-columns: 1fr;
  }

  .data-table__scroll {
    max-height: 60vh;
  }
}

/* ============================================================
   Универсальный popover-меню (используется .export-menu и т.п.)
   Темы — через CSS-переменные. Никаких захардкоженных цветов.
   ============================================================ */
.menu-pop {
  position: relative;
  display: inline-block;
}

.menu-pop__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 50;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: 0 8px 24px var(--overlay, rgba(0, 0, 0, .18));
  min-width: 180px;
  padding: 4px;
  display: none;
  transition: opacity .15s ease, transform .15s ease;
}

.menu-pop.is-open .menu-pop__panel {
  display: block;
}

.menu-pop__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--text);
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  transition: background-color .15s ease, color .15s ease;
}

.menu-pop__item:hover,
.menu-pop__item:focus {
  background: var(--surface-2);
  color: var(--text);
  outline: none;
}

/* ============================================================
   Сортировка в заголовках таблиц
   ============================================================ */
.data-table__table th.is-sortable a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  text-decoration: none;
  font-weight: inherit;
  transition: color .15s ease;
}

.data-table__table th.is-sortable a:hover {
  color: var(--brand);
}

.data-table__sort-arrow {
  display: inline-block;
  font-size: 10px;
  line-height: 1;
  width: 12px;
  color: var(--text-4);
  transition: color .15s ease;
}

.data-table__table th.is-sorted-asc .data-table__sort-arrow,
.data-table__table th.is-sorted-desc .data-table__sort-arrow {
  color: var(--brand);
}

/* ============================================================
   Sidebar — единый transition для смены темы
   ============================================================ */
.sidebar,
.sidebar__brand,
.sidebar__group-title,
.sidebar__footer,
.sidebar__collapse {
  transition: background-color .2s ease, color .2s ease,
    border-color .2s ease;
}

/* ============================================================
   Тёмная тема: тонкая стилизация scrollbar и нативных дропдаунов
   ============================================================ */

/* Цвет курсора-каретки и выделения для dark/light */
:root[data-theme="dark"] body {
  color-scheme: dark;
}

:root:not([data-theme="dark"]) body {
  color-scheme: light;
}

/* Scrollbar (WebKit) — для всех элементов с прокруткой */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--surface);
  border-left: 1px solid var(--border);
}

::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: 6px;
  border: 2px solid var(--surface);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-4);
}

::-webkit-scrollbar-corner {
  background: var(--surface);
}

/* Sidebar nav: уже-чем-у-обычного scrollbar чтобы не «торчал» в тёмной теме */
.sidebar__nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar__nav::-webkit-scrollbar-track {
  background: transparent;
  border: none;
}

.sidebar__nav::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border: none;
  border-radius: 3px;
}

.sidebar__nav::-webkit-scrollbar-thumb:hover {
  background: var(--text-4);
}

/* Firefox */
* {
  scrollbar-color: var(--surface-3) var(--surface);
  scrollbar-width: thin;
}

/* Native <select> и <option> — наследуют тему через color-scheme,
   но добавляем явные правила для совместимости */
select,
.input,
.field input,
.field select,
.field textarea {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}

select:focus,
.input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand);
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-ring);
}

/* В тёмной теме: native <option> в открытом списке (Chrome/Edge) */
:root[data-theme="dark"] select option {
  background: var(--surface);
  color: var(--text);
}

/* Кастомный селект «Режим просмотра» (dashboard role-switch) — выровнять с темой */
.dashboard-role-switch__select,
select.warehouse-switcher {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

:root[data-theme="dark"] .dashboard-role-switch__select option,
:root[data-theme="dark"] select.warehouse-switcher option {
  background: var(--surface);
  color: var(--text);
}

/* Sidebar в тёмной теме — поверхность sidebar__nav должна совпадать с .sidebar */
.sidebar,
.sidebar__nav,
.sidebar__brand,
.sidebar__footer {
  background: var(--surface);
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
/* ── Receiving ↔ 3D-склад: помощник выбора стеллажа ── */
.rcv-3d-helper { font-size: 12px; }
.rcv-3d-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.rcv-3d-group__head {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 4px 8px 2px;
}
.rcv-3d-item {
  display: grid;
  grid-template-columns: 80px 1fr 80px 44px;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: var(--text);
}
.rcv-3d-item:hover { background: var(--brand-soft); border-color: var(--brand); }
.rcv-3d-item.is-active { background: var(--brand); color: #fff; }
.rcv-3d-item__code { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 600; font-size: 12px; }
.rcv-3d-item__loc { font-size: 11px; color: var(--text-3); }
.rcv-3d-item.is-active .rcv-3d-item__loc { color: rgba(255,255,255,.85); }
.rcv-3d-item__bar {
  height: 6px; background: var(--surface-2); border-radius: 4px; overflow: hidden;
  position: relative;
}
.rcv-3d-item__bar i { display: block; height: 100%; transition: width .2s ease; }
.rcv-3d-item__pct { font-size: 11px; font-weight: 700; text-align: right; }
.rcv-line-3d-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}

/* ============================================================
   Страницы ошибок: 403 / 404
   ============================================================ */

/* Центрирующая обёртка */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 62vh;
  text-align: center;
  padding: 56px 24px 48px;
  gap: 0;
}

/* ── Иконка ─────────────────────────────────────────────── */
.error-page__icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  flex-shrink: 0;
}

.error-page__icon--danger {
  background: var(--danger-soft);
  border: 1.5px solid var(--danger);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--danger) 10%, transparent);
}
.error-page__icon--danger svg { stroke: var(--danger); }

.error-page__icon--brand {
  background: var(--brand-soft);
  border: 1.5px solid var(--brand);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--brand) 10%, transparent);
}
.error-page__icon--brand svg { stroke: var(--brand); }

/* ── Большой код ошибки — один раз, с градиентом ────────── */
.error-page__code {
  font-size: 96px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -4px;
  font-variant-numeric: tabular-nums;
  margin-bottom: 12px;
  /* Градиентный текст */
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.error-page__code--danger {
  background-image: linear-gradient(135deg, var(--danger) 0%, #f87171 100%);
}

.error-page__code--brand {
  background-image: linear-gradient(135deg, var(--brand) 0%, #60a5fa 100%);
}

/* ── Заголовок ──────────────────────────────────────────── */
.error-page__title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 10px;
  line-height: 1.3;
}

/* ── Описание ───────────────────────────────────────────── */
.error-page__desc {
  font-size: 14px;
  color: var(--text-2);
  max-width: 440px;
  line-height: 1.7;
  margin: 0 0 28px;
}

/* Путь (монospace inline) */
.error-page__path {
  display: inline;
  font-size: 12px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 1px 6px;
  color: var(--text-2);
  word-break: break-all;
}

/* ── Блок «кто вошёл» ───────────────────────────────────── */
.error-page__role-hint {
  display: inline-flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0 0 28px;
  padding: 12px 16px;
  background: var(--warning-soft);
  border: 1px solid var(--warning);
  border-radius: var(--r-md);
  font-size: 13px;
  color: var(--text-2);
  max-width: 460px;
  text-align: left;
}

.error-page__role-hint svg {
  flex-shrink: 0;
  color: var(--warning);
  margin-top: 1px;
}

/* ── Кнопки ─────────────────────────────────────────────── */
.error-page__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ── Быстрые ссылки ─────────────────────────────────────── */
.error-page__shortcuts {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  width: 100%;
  max-width: 480px;
}

.error-page__shortcuts-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.error-page__shortcuts-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ── Адаптив ─────────────────────────────────────────────── */
@media (max-width: 480px) {
  .error-page__code  { font-size: 72px; letter-spacing: -2px; }
  .error-page__title { font-size: 19px; }
}
