/* ===========================================================================
   Админ-панель — единая дизайн-система.
   Монохромная тёмная тема: чёрный фон, белый текст, цвет только в статусах.
   Все страницы используют эти классы и не заводят собственных стилей.
   =========================================================================== */
:root {
  /* поверхности: от самой глубокой к самой светлой */
  --bg: #17171b;
  --sidebar: #1c1c21;
  --surface: #202026;
  --surface-2: #26262d;
  --surface-3: #2e2e36;
  --surface-4: #383842;

  --border: #32323b;
  --border-strong: #41414d;

  --text: #f4f4f6;
  --text-2: #bcbcc6;
  --muted: #8b8b96;

  /* «акцент» в монохромной теме — это белый */
  --accent: #ffffff;
  --accent-ink: #17171b;
  --accent-soft: rgba(255, 255, 255, 0.08);

  /* цвет — только для статусов и опасных действий */
  --green: #5ee08f;
  --green-soft: rgba(94, 224, 143, 0.14);
  --amber: #fbc44b;
  --amber-soft: rgba(251, 196, 75, 0.14);
  --red: #ff8a8a;
  --red-soft: rgba(255, 138, 138, 0.14);

  --radius: 10px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  --t: 140ms cubic-bezier(.4, 0, .2, 1);

  --sidebar-w: 240px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 "Inter", "SF Pro Display", -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; }
::selection { background: rgba(255, 255, 255, .16); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-4); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #4d4d59; background-clip: content-box; }

/* ============================================================ раскладка === */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 18px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 18px;
}
.brand .mark {
  width: 30px; height: 30px;
  flex: 0 0 30px;
  border-radius: 9px;
  background: var(--text);
  color: var(--accent-ink);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700; letter-spacing: -.02em;
}
.brand .title { font-size: 14px; font-weight: 600; letter-spacing: -.01em; line-height: 1.2; }
.brand .ver { font-size: 11px; color: var(--muted); letter-spacing: .02em; }

.nav-group {
  margin: 14px 0 4px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .09em;
}

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13.5px;
  background: transparent;
  transition: background var(--t), color var(--t);
}
.nav-item svg { width: 17px; height: 17px; flex: 0 0 17px; opacity: .6; transition: opacity var(--t); }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item:hover svg { opacity: .9; }
.nav-item.active { background: var(--surface-3); color: var(--text); font-weight: 500; }
.nav-item.active svg { opacity: 1; }
.nav-item .badge { margin-left: auto; }

.sidebar-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); }
.sidebar-footer .who { padding: 4px 10px 8px; color: var(--muted); font-size: 11.5px; }
.sidebar-footer .who b { color: var(--text); display: block; font-size: 13px; font-weight: 500; }

.sidebar-toggle {
  display: none;
  position: fixed; top: 12px; left: 12px; z-index: 60;
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}
.sidebar-toggle svg { width: 18px; height: 18px; }
.scrim { display: none; position: fixed; inset: 0; background: rgba(10, 10, 13, .6); z-index: 39; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 20px 30px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(23, 23, 27, .86);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 30;
}
.topbar h1 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.022em; }
.topbar .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.topbar .spacer { flex: 1; }

.content { padding: 24px 30px 64px; }

/* =============================================================== блоки === */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card + .card { margin-top: 16px; }
.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.card-head h2 { margin: 0; font-size: 13.5px; font-weight: 600; letter-spacing: -.01em; }
.card-head .spacer { flex: 1; }
.card-body { padding: 18px; }

.metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  transition: border-color var(--t);
}
.metric:hover { border-color: var(--border-strong); }
.metric .label { color: var(--text-2); font-size: 11.5px; font-weight: 500; letter-spacing: .01em; }
.metric .value { font-size: 26px; font-weight: 600; margin-top: 8px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.metric .hint { color: var(--muted); font-size: 11.5px; margin-top: 4px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }

/* ============================================================== таблицы === */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left;
  padding: 11px 16px;
  color: var(--text-2);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .07em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surface-2);
}
tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--t); }
tbody tr:hover { background: var(--surface-2); }
tbody tr.clickable { cursor: pointer; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.mono, .mono { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: var(--text-2); }
td.actions { text-align: right; white-space: nowrap; }

.empty { padding: 52px 20px; text-align: center; color: var(--muted); font-size: 13px; }

/* ============================================================= элементы === */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.5;
  background: var(--surface-3);
  color: var(--text-2);
  white-space: nowrap;
}
/* точка-индикатор — только у цветных статусов, у нейтральных подписей её нет */
.badge.green::before, .badge.red::before, .badge.amber::before {
  content: "";
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor;
  opacity: .9;
}
.badge.plain::before { display: none; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.blue { background: var(--accent-soft); color: var(--text); }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tab {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  transition: var(--t);
}
.tab:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); }
.tab.active { background: var(--text); border-color: var(--text); color: var(--accent-ink); font-weight: 500; }
.tab .count { opacity: .55; margin-left: 5px; font-variant-numeric: tabular-nums; }

/* =============================================================== кнопки === */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: var(--t);
  font-size: 13px;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); border-color: #4e4e5b; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn svg { width: 15px; height: 15px; opacity: .8; }

/* primary — единственный светлый элемент интерфейса */
.btn.primary { background: var(--text); border-color: var(--text); color: var(--accent-ink); font-weight: 500; }
.btn.primary:hover { background: #fff; border-color: #fff; }
.btn.primary svg { opacity: 1; }

.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); border-color: transparent; }

.btn.danger { background: transparent; border-color: rgba(255, 138, 138, .3); color: var(--red); }
.btn.danger:hover { background: var(--red-soft); border-color: rgba(255, 138, 138, .55); }

.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn.sm svg { width: 14px; height: 14px; }

.icon-btn {
  width: 30px; height: 30px;
  display: inline-grid; place-items: center;
  border-radius: var(--radius-xs);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: var(--t);
}
.icon-btn:hover { background: var(--surface-3); border-color: var(--border-strong); color: var(--text); }
.icon-btn.danger:hover { background: var(--red-soft); border-color: rgba(255, 138, 138, .3); color: var(--red); }
.icon-btn.success:hover { background: var(--green-soft); border-color: rgba(94, 224, 143, .3); color: var(--green); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn + .icon-btn { margin-left: 4px; }

/* подсказка при наведении на иконку без подписи */
.tip {
  position: fixed;
  z-index: 300;
  padding: 5px 9px;
  border-radius: var(--radius-xs);
  background: var(--surface-4);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 11.5px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity var(--t), transform var(--t);
}
.tip.show { opacity: 1; transform: none; }

/* ================================================================ формы === */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; color: var(--text-2); font-size: 12px; font-weight: 500; margin-bottom: 6px; }
label.field small { color: var(--muted); font-weight: 400; }

input[type="text"], input[type="password"], input[type="number"], input[type="search"],
input[type="datetime-local"], input[type="date"], input[type="url"], select, textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  outline: none;
  /* именно background-color: анимация всего background дёргает фоновую стрелку селекта */
  transition: border-color var(--t), box-shadow var(--t), background-color var(--t);
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:hover, select:hover, textarea:hover { border-color: #4e4e5b; }
input:focus, select:focus, textarea:focus {
  border-color: #6b6b7a;
  background-color: var(--surface-3);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .05);
}
textarea { resize: vertical; min-height: 92px; font-family: inherit; line-height: 1.5; }

select {
  appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b8b96' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 15px;
}
select option { background: var(--surface-2); color: var(--text); }

input[type="search"] {
  padding-left: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b8b96' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.2-3.2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 10px center;
  background-size: 15px;
}
input[type="search"]::-webkit-search-cancel-button { filter: invert(.6); }

input[type="file"] {
  width: 100%;
  color: var(--text-2);
  font-size: 12.5px;
  padding: 8px 10px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
}
input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 5px 11px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-strong);
  background: var(--surface-3);
  color: var(--text);
  font-size: 12.5px;
  cursor: pointer;
}
input[type="file"]::file-selector-button:hover { background: var(--surface-4); }
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(.55); cursor: pointer; }

.check { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 12px; cursor: pointer; }
.check input { margin: 2px 0 0; accent-color: #ffffff; width: 15px; height: 15px; flex: 0 0 15px; }
.check span { font-size: 13px; }
.check small { display: block; color: var(--muted); font-size: 12px; }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 160px; }

.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.filters input[type="search"], .filters select { max-width: 260px; }

/* диапазон дат в строке фильтров */
.filters .range { display: flex; align-items: center; gap: 8px; }
.filters .range > span { color: var(--muted); font-size: 12.5px; }
.filters .range input { width: 190px; }

/* ============================================================ пагинация === */
.pagination { display: flex; gap: 5px; align-items: center; justify-content: center; padding: 16px; }
.pagination a, .pagination span {
  min-width: 32px; height: 32px;
  display: inline-grid; place-items: center;
  padding: 0 10px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  transition: var(--t);
}
.pagination span { color: var(--muted); opacity: .5; border-color: transparent; }
.pagination a:hover { background: var(--surface-3); color: var(--text); border-color: var(--border-strong); }
.pagination .current { background: var(--text); border-color: var(--text); color: var(--accent-ink); opacity: 1; font-weight: 500; }

/* ============================================================== модалки === */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(10, 10, 13, .72);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center; justify-content: center;
  padding: 24px;
  z-index: 100;
  animation: fade var(--t) ease-out;
}
.modal-backdrop.open { display: flex; }
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow);
  width: min(560px, 100%);
  max-height: 88vh;
  display: flex; flex-direction: column;
  animation: pop 160ms cubic-bezier(.4, 0, .2, 1);
}
.modal.wide { width: min(880px, 100%); }
@keyframes pop { from { transform: translateY(10px) scale(.99); opacity: 0; } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 14.5px; font-weight: 600; letter-spacing: -.01em; }
.modal-head .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.modal-head .spacer { flex: 1; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end; align-items: center;
  background: var(--surface-2);
}
.modal-foot .spacer { flex: 1; }

/* ============================================================ переписка === */
.chat { display: flex; flex-direction: column; gap: 12px; max-height: 46vh; overflow-y: auto; padding-right: 6px; }
.msg {
  max-width: 76%;
  padding: 10px 13px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.msg.admin {
  align-self: flex-end;
  background: var(--surface-4);
  border-color: var(--border-strong);
}
.msg .meta { font-size: 11px; color: var(--muted); margin-bottom: 5px; display: flex; gap: 8px; align-items: center; }
.msg .meta b { color: var(--text-2); font-weight: 500; }
.msg .text { white-space: pre-wrap; word-break: break-word; font-size: 13px; }
.msg img, .msg video { max-width: 100%; border-radius: 8px; margin-top: 8px; display: block; }
.msg .attach { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; color: var(--text); font-size: 12.5px; text-decoration: underline; text-underline-offset: 3px; }

/* ============================== кнопка с удержанием (закрытие тикета) ===== */
.hold-btn {
  position: relative;
  overflow: hidden;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 138, 138, .3);
  background: transparent;
  color: var(--red);
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  transition: border-color var(--t);
}
.hold-btn:hover { border-color: rgba(255, 138, 138, .55); }
.hold-btn .fill {
  position: absolute; inset: 0;
  width: 0;
  background: var(--red-soft);
  transition: width 0s linear;
  pointer-events: none;
}
.hold-btn.holding .fill { width: 100%; transition: width 3s linear; }
.hold-btn span, .hold-btn svg { position: relative; z-index: 1; }
.hold-btn svg { width: 15px; height: 15px; }

/* =============================================================== прочее === */
.chart { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding: 10px 4px 0; }
.chart .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; height: 100%; }
.chart .bar .fill { width: 100%; border-radius: 4px 4px 2px 2px; background: var(--surface-4); min-height: 2px; transition: background var(--t), height .3s; }
.chart .bar .lb { font-size: 10.5px; color: var(--muted); }
.chart .bar:hover .fill { background: var(--text); }

/* двухколоночная раскладка «список слева — содержимое справа» (/goods) */
.split { display: grid; grid-template-columns: 260px 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

.cat-row { display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-bottom: 1px solid var(--border); }
.cat-row:last-child { border-bottom: none; }
.cat-link {
  flex: 1;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  color: var(--text-2);
  font-size: 13px;
  transition: var(--t);
}
.cat-link:hover { background: var(--surface-2); color: var(--text); }
.cat-link.active { background: var(--surface-3); color: var(--text); font-weight: 500; }

.cat-row[draggable="true"] { cursor: grab; }
.cat-row.dragging { opacity: .45; background: var(--surface-2); }
.drag-handle {
  display: inline-grid; place-items: center;
  width: 18px; height: 24px;
  color: var(--muted);
  flex: 0 0 18px;
}
.drag-handle svg { width: 15px; height: 15px; }
.cat-row:hover .drag-handle { color: var(--text-2); }

/* круглая кнопка удаления с удержанием — внизу справа */
.hold-fab {
  position: fixed;
  right: 26px; bottom: 26px;
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 138, 138, .35);
  background: var(--surface-2);
  color: var(--red);
  cursor: pointer;
  user-select: none;
  z-index: 50;
  box-shadow: var(--shadow);
  transition: border-color var(--t), background var(--t);
}
.hold-fab:hover { border-color: rgba(255, 138, 138, .6); background: var(--surface-3); }
.hold-fab svg:not(.ring) { width: 19px; height: 19px; position: relative; z-index: 1; }
.hold-fab .ring { position: absolute; inset: -1px; width: 48px; height: 48px; transform: rotate(-90deg); }
.hold-fab .ring circle { fill: none; stroke-width: 2; }
.hold-fab .ring .track { stroke: transparent; }
.hold-fab .ring .bar {
  stroke: var(--red);
  stroke-linecap: round;
  stroke-dasharray: 126;
  stroke-dashoffset: 126;
  transition: stroke-dashoffset 0s linear;
}
.hold-fab.holding .ring .bar { stroke-dashoffset: 0; transition: stroke-dashoffset 10s linear; }
.hold-fab.holding { background: var(--red-soft); }

/* вертикальные отступы между самостоятельными блоками страницы */
.section { margin-top: 16px; }
.section-b { margin-bottom: 16px; }

/* короткое подтверждение прямо на странице (например, «Настройки сохранены») */
.notice {
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(94, 224, 143, .3);
  background: var(--green-soft);
  color: var(--green);
  font-size: 13px;
}
.actions-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.list-inline { display: flex; flex-wrap: wrap; gap: 8px; }
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; }
@media (max-width: 640px) { .perm-grid { grid-template-columns: 1fr; } }

.note { color: var(--muted); font-size: 12.5px; }
.hr { height: 1px; background: var(--border); margin: 18px 0; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-amber { color: var(--amber); }
.text-muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* ================================================================= вход === */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(360px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 30px;
  box-shadow: var(--shadow);
}
.login-card .mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--text);
  color: var(--accent-ink);
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
  margin-bottom: 18px;
}
.login-card h1 { margin: 0 0 4px; font-size: 19px; font-weight: 600; letter-spacing: -.02em; }
.login-card p { margin: 0 0 24px; color: var(--muted); font-size: 12.5px; }
.login-error { background: var(--red-soft); color: var(--red); padding: 9px 12px; border-radius: var(--radius-sm); font-size: 12.5px; margin-bottom: 14px; }

/* ============================== индикатор перехода между разделами ======== */
.route-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0;
  background: var(--text);
  opacity: 0;
  z-index: 400;
  pointer-events: none;
  transition: width 260ms ease-out, opacity 160ms;
}
.route-progress.busy { width: 92%; opacity: .9; transition: width 900ms cubic-bezier(.2, .9, .3, 1); }
.route-progress.done { width: 100%; opacity: 0; transition: width 140ms ease-out, opacity 260ms 140ms; }

/* уходящий раздел притухает, новый мягко проявляется */
#page-content { transition: opacity 120ms ease-out; }
#page-content.is-leaving { opacity: .4; }
#page-content.page-enter { animation: page-in 200ms cubic-bezier(.2, .7, .3, 1); }
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } }

@media (prefers-reduced-motion: reduce) {
  #page-content, #page-content.page-enter { animation: none; transition: none; }
}

/* ================================================================ тосты === */
.toast {
  position: fixed; right: 22px; bottom: 22px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 13px;
  opacity: 0; transform: translateY(10px);
  transition: opacity var(--t), transform var(--t);
  z-index: 200;
}
.toast.show { opacity: 1; transform: none; }
.toast.error { border-color: rgba(255, 138, 138, .4); color: var(--red); }

/* ========================================================== адаптивность === */
@media (max-width: 1000px) {
  :root { --sidebar-w: 208px; }
  .content { padding: 20px 18px 56px; }
  .topbar { padding: 16px 18px; }
}

@media (max-width: 760px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    transform: translateX(-100%);
    transition: transform var(--t);
    box-shadow: var(--shadow);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; }
  .sidebar-toggle { display: flex; }
  .topbar { padding-left: 60px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .modal-backdrop { padding: 12px; }
}

@media (max-width: 480px) {
  .metrics { grid-template-columns: 1fr; }
  .filters > * { width: 100%; max-width: none; }
}
