:root {
  color-scheme: light;
  --bg: #f4f4f2;
  --surface: #fcfcfb;
  --border: #e4e3df;
  --text: #0b0b0b;
  --text-2: #52514e;
  --accent: #2a78d6;
  --accent-ink: #ffffff;
  --on-tone: #ffffff;
  --danger: #c62f2e;
  --unread: #eef4fc;
  --s-new: #2a78d6;
  --s-delivery: #b26f00;
  --s-done: #1d7d33;
  --s-cancel: #8a8984;
  --s-completed: #0e7c86;
  --c-violet: #6250d6;
  --c-orange: #c24a17;
  --c-magenta: #c43d72;
  /* Шкала скруглений: крупные блоки → элементы управления → мелочи. */
  --radius-lg: 16px;
  --radius: 12px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --accent-wash: rgba(42, 120, 214, .10);
  --hover-wash: rgba(11, 11, 11, .05);
  /* графики: эталонная палитра, слот 1 */
  --series-1: #2a78d6;
  --c-grid: #e1e0d9;
  --c-baseline: #c3c2b7;
  --c-muted: #898781;
  --shadow: 0 1px 2px rgba(11, 11, 11, .04), 0 4px 16px rgba(11, 11, 11, .04);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211;
    --surface: #1a1a19;
    --border: #2f2f2d;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --accent: #3987e5;
    --danger: #e66767;
    --unread: #1d2a3a;
    --s-new: #6aa6ee;
    --s-delivery: #e0a43a;
    --s-done: #5cc274;
    --s-cancel: #9c9b95;
    --s-completed: #3cc0c8;
    --c-violet: #9085e9;
    --c-orange: #f08a5d;
    --c-magenta: #e87ba4;
    --on-tone: #141413;
    --accent-wash: rgba(57, 135, 229, .16);
    --hover-wash: rgba(255, 255, 255, .06);
    --series-1: #3987e5;
    --c-grid: #2c2c2a;
    --c-baseline: #383835;
    --c-muted: #898781;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211;
  --surface: #1a1a19;
  --border: #2f2f2d;
  --text: #f0efec;
  --text-2: #c3c2b7;
  --accent: #3987e5;
  --danger: #e66767;
  --unread: #1d2a3a;
  --s-new: #6aa6ee;
  --s-delivery: #e0a43a;
  --s-done: #5cc274;
  --s-cancel: #9c9b95;
  --s-completed: #3cc0c8;
  --c-violet: #9085e9;
  --c-orange: #f08a5d;
  --c-magenta: #e87ba4;
  --on-tone: #141413;
  --accent-wash: rgba(57, 135, 229, .16);
  --hover-wash: rgba(255, 255, 255, .06);
  --series-1: #3987e5;
  --c-grid: #2c2c2a;
  --c-baseline: #383835;
  --c-muted: #898781;
  --shadow: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }

.container { max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; }
.muted { color: var(--text-2); }
.small { font-size: .85rem; }

/* ---------- Шапка и меню ---------- */
/* У каждого раздела свой цвет (тот же, что на его странице). */
.tone-magenta { --tone: var(--c-magenta); }
.topbar {
  position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px;
  padding: 13px 16px 10px; background: var(--surface); border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .03);
}
.topbar::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--s-done), var(--c-orange), var(--s-completed), var(--c-violet), var(--c-magenta));
}
.brand { display: inline-flex; align-items: center; gap: 9px; }
.brand-logo, .login-logo { display: block; flex-shrink: 0; }
.lm-tile { fill: var(--text); }
.lm-h { stroke: var(--surface); }
.lm-dot { fill: var(--accent); }
.brand-text { font-weight: 800; font-size: 1.2rem; letter-spacing: -.03em; color: var(--text); }
.brand:hover { text-decoration: none; opacity: .85; }
.nav { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.nav-link {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 14px; white-space: nowrap;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-size: .93rem; font-weight: 500;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.nav-link::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tone); flex-shrink: 0; transition: background-color .15s ease; }
.nav-link:hover {
  border-color: color-mix(in srgb, var(--tone) 55%, var(--border)); color: var(--tone);
  background: color-mix(in srgb, var(--tone) 9%, var(--surface)); text-decoration: none;
}
.nav-link.active {
  background: var(--tone); border-color: var(--tone); color: var(--on-tone); font-weight: 600;
  box-shadow: 0 3px 10px color-mix(in srgb, var(--tone) 35%, transparent);
}
.nav-link.active::before { background: var(--on-tone); }
.nav-link:focus-visible, .brand:focus-visible { outline: 2px solid var(--tone, var(--accent)); outline-offset: 2px; }
.logout { display: flex; align-items: center; gap: 10px; margin: 0; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.user-name { font-weight: 600; font-size: .92rem; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-chip {
  padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; white-space: nowrap;
  color: var(--tone); background: color-mix(in srgb, var(--tone) 13%, transparent);
}
.role-admin { --tone: var(--c-violet); }
.role-manager { --tone: var(--accent); }
.role-courier { --tone: var(--s-delivery); }
.logout-btn { padding: 6px 14px; }
@media (max-width: 760px) {
  .nav { order: 3; flex-basis: 100%; }
  .logout { margin-left: auto; }
}

/* Переключатель темы: видна иконка текущего режима. */
.theme-icon { display: none; line-height: 0; }
:root:not([data-theme]) .theme-icon-auto,
:root[data-theme="light"] .theme-icon-light,
:root[data-theme="dark"] .theme-icon-dark { display: block; }
.theme-corner { position: fixed; top: 12px; right: 12px; }
.theme-corner .icon-btn { background: var(--surface); border: 1px solid var(--border); }

/* Иконочная кнопка (скачивание PNG в отчётах). */
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border-radius: var(--radius-sm);
  border: 0; background: transparent; color: var(--text-2); cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--hover-wash); color: var(--text); text-decoration: none; }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px; margin-bottom: 16px; min-width: 0; box-shadow: var(--shadow);
}
.narrow { max-width: 420px; margin: 40px auto; }

.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.page-head h1, .page-head h2 { margin: 0; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.inline-form label { flex: 1 1 160px; }
.inline-form .grow { flex: 3 1 240px; }

label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--text-2); }
label .optional { color: var(--c-muted); font-size: .8rem; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; width: 100%; min-width: 0;
}
input[type="checkbox"] { width: auto; }
textarea { resize: vertical; max-width: 100%; min-height: 64px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px 14px; margin: 0; }
legend { padding: 0 6px; color: var(--text-2); }

.btn {
  display: inline-block; font: inherit; cursor: pointer; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-ink); border-radius: var(--radius-sm); padding: 8px 16px; white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--accent); }
/* Мягкие цветные кнопки действий в таблицах: светлая подложка + насыщенный текст того же цвета. */
.btn-soft {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px;
  font: inherit; font-size: .86rem; font-weight: 600; line-height: 1.3; white-space: nowrap;
  border: 1px solid transparent; border-radius: var(--radius-sm); cursor: pointer;
  color: var(--tone); background: color-mix(in srgb, var(--tone) 12%, transparent);
  transition: background-color .15s ease, border-color .15s ease;
}
.btn-soft:hover { background: color-mix(in srgb, var(--tone) 20%, transparent); border-color: color-mix(in srgb, var(--tone) 35%, transparent); text-decoration: none; }
.btn-soft:focus-visible { outline: 2px solid var(--tone); outline-offset: 2px; }
.btn-soft .icon { flex-shrink: 0; }
.btn-soft-blue { --tone: var(--accent); }
.btn-soft-red { --tone: var(--danger); }
.btn-soft-green { --tone: var(--s-done); }
.row-actions .btn-soft { margin-block: -5px; }
.btn-sm { padding: 3px 10px; font-size: .85rem; line-height: 1.4; }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.actions form { margin: 0; }
/* Ячейка с действиями остаётся обычной ячейкой таблицы (flex на <td> ломает сетку). */
td.row-actions { text-align: right; white-space: nowrap; width: 1%; }
.row-actions > * { display: inline-block; vertical-align: middle; margin: 0; }
.row-actions > .btn-soft, .row-actions form > .btn-soft { display: inline-flex; }
.row-actions > * + * { margin-left: 8px; }
.row-actions .btn-sm { margin-block: -4px; }

.alert { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); padding: 10px 14px; border-radius: var(--radius); }
.empty { color: var(--text-2); padding: 12px 0; }

.table-wrap { overflow-x: auto; }
.container > .table-wrap {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); margin-bottom: 16px;
}
.container > .table-wrap thead th { background: color-mix(in srgb, var(--surface) 94%, var(--text)); }
.container > .table-wrap th:first-child, .container > .table-wrap td:first-child { padding-left: 16px; }
.container > .table-wrap th:last-child, .container > .table-wrap td:last-child { padding-right: 16px; }
.table-wrap tbody tr:last-child td { border-bottom: 0; }
.table-wrap tfoot tr:first-child > * { border-top: 1px solid var(--border); }
.table-wrap tfoot tr:last-child > * { border-bottom: 0; }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--text-2); font-weight: 600; font-size: .85rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.inactive td:not(.row-actions) { opacity: .55; }

/* Таблица заказов: фиксированная сетка колонок — длинный текст не раздвигает соседей. */
.orders-table { table-layout: fixed; min-width: 860px; }
.orders-table .c-id { width: 64px; }
.orders-table .c-created { width: 104px; }
.orders-table .c-client { width: 25%; }
.orders-table .c-delivery { width: 28%; }
.orders-table .c-status { width: 140px; }
.orders-table .c-total { width: 120px; }
.orders-table .c-actions { width: 134px; }
.orders-table td { overflow-wrap: anywhere; }
.orders-table td.row-actions { width: auto; }
/* Таблица «Доставлено за смену» у курьера: фиксированные колонки. */
.shift-table { table-layout: fixed; }
.shift-table .c-id { width: 72px; }
.shift-table .c-time { width: 76px; }
.shift-table .c-earned { width: 124px; }
.shift-table td { overflow-wrap: anywhere; }
@media (max-width: 520px) {
  .shift-table .c-id { width: 50px; }
  .shift-table .c-time { width: 54px; }
  .shift-table .c-earned { width: 92px; }
  .shift-table th, .shift-table td { padding-inline: 6px; }
}
/* Товары и регионы: фиксированные колонки. */
.catalog-table { table-layout: fixed; min-width: 760px; }
.catalog-table.has-desc { min-width: 920px; }
.catalog-table .c-price { width: 190px; }
.catalog-table.has-desc .c-name { width: 30%; }
.catalog-table.has-desc .c-price { width: 120px; }
.catalog-table .c-status { width: 120px; }
.catalog-table .c-actions { width: 268px; }
.catalog-table td { overflow-wrap: anywhere; }
.st-hidden { --tone: var(--c-muted); }
.clamp, .clamp-1 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.clamp { -webkit-line-clamp: 2; line-clamp: 2; }
.clamp-1 { -webkit-line-clamp: 1; line-clamp: 1; }
.badge { display: inline-block; font-size: .8rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid currentColor; vertical-align: middle; }
.status-new { color: var(--s-new); }
.status-in_delivery { color: var(--s-delivery); }
.status-delivered { color: var(--s-done); }
.status-completed { color: var(--s-completed); }
.status-cancelled { color: var(--danger); }
.badge { background: color-mix(in srgb, currentColor 10%, transparent); }

.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.filters a { padding: 4px 12px; border: 1px solid var(--border); border-radius: 999px; color: var(--text); background: var(--surface); }
.filters a.active { border-color: var(--accent); color: var(--accent); }
.pager { display: flex; gap: 16px; justify-content: center; margin-top: 16px; }

/* Выбор товара с поиском */
.combo { position: relative; min-width: 0; }
.combo-native { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.combo-list {
  position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; right: 0;
  max-height: 280px; overflow-y: auto; margin: 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .14);
}
.combo-option {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  padding: 8px 10px; border-radius: var(--radius-xs); cursor: pointer;
}
.combo-option:hover, .combo-option.is-active { background: var(--accent-wash); }
.combo-option[aria-selected="true"] { font-weight: 600; }
.combo-option mark { background: none; color: var(--accent); font-weight: 700; }
.combo-price { color: var(--text-2); font-size: .88rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.combo-empty { padding: 10px; color: var(--text-2); }

.form-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
dt { color: var(--text-2); }
dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- Заказы курьера ---------- */
/* Цвета смыслов: синий — свободные, оранжевый — в доставке, зелёный — деньги и выполненное. */
.tone-blue { --tone: var(--accent); }
.tone-amber { --tone: var(--s-delivery); }
.tone-green { --tone: var(--s-done); }

.stat-tone { position: relative; overflow: hidden; }
.stat-tone::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--tone); }
.stat-tone .stat-value { color: var(--tone); }

.ocols { align-items: start; }
.ocol-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.ocol-head h2 { margin: 0; flex: 1; }
.ocol-icon {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  color: var(--tone); background: color-mix(in srgb, var(--tone) 14%, transparent);
}
.ocol-count {
  display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 10px; border-radius: 999px;
  font-weight: 800; font-size: 1rem; color: var(--on-tone); background: var(--tone);
}
.ocol-empty { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--radius); color: var(--text-2); background: var(--hover-wash); }
.ocol-empty .icon { color: var(--tone); flex-shrink: 0; }
.ocol-empty p { margin: 0; }

.ocard {
  position: relative; padding: 14px 16px 14px 18px; margin-top: 10px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.ocard:first-of-type { margin-top: 0; }
.ocard::before {
  content: ""; position: absolute; left: -1px; top: 12px; bottom: 12px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--tone);
}
.ocard:hover { border-color: color-mix(in srgb, var(--tone) 40%, var(--border)); box-shadow: 0 4px 14px rgba(0, 0, 0, .06); }
.ocard-top { display: flex; align-items: baseline; gap: 10px; }
.ocard-title { font-weight: 700; font-size: 1.02rem; color: var(--text); }
.ocard-title:hover { color: var(--tone); text-decoration: none; }
.ocard-time { margin-left: auto; color: var(--c-muted); font-size: .82rem; white-space: nowrap; }
.ocard-line { display: flex; align-items: flex-start; gap: 4px 6px; margin: 7px 0 0; color: var(--text-2); font-size: .93rem; }
.ocard-line > .icon { flex-shrink: 0; margin-top: 3px; color: var(--c-muted); }
.ocard-line > span { flex: 1; overflow-wrap: anywhere; min-width: 0; }
.ocard-client { flex-wrap: wrap; align-items: center; }
.ocard-client > .ocard-who { flex: 0 1 auto; display: inline-flex; align-items: center; gap: 6px; }
.ocard-who .icon { color: var(--c-muted); flex-shrink: 0; }
.ocard-line b { color: var(--text); font-weight: 600; }
.ocard-phone {
  display: inline-flex; align-items: center; gap: 5px; margin-left: 4px; padding: 1px 10px; border-radius: 999px;
  font-weight: 600; color: var(--s-done); background: color-mix(in srgb, var(--s-done) 12%, transparent);
  white-space: nowrap;
}
.ocard-phone:hover { text-decoration: none; background: color-mix(in srgb, var(--s-done) 20%, transparent); }
.ocard-comment { margin: 8px 0 0; padding: 6px 10px; border-radius: var(--radius-xs); background: var(--hover-wash); color: var(--text-2); font-size: .88rem; font-style: italic; overflow-wrap: anywhere; }
.ocard-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.ocard-sums { display: flex; flex-direction: column; line-height: 1.25; }
.ocard-total { font-size: 1.15rem; font-weight: 800; }
.ocard-earn { font-size: .85rem; font-weight: 700; color: var(--s-done); }
.ocard-actions { display: flex; align-items: center; gap: 8px; }
.ocard-actions form { margin: 0; }
.ocard-actions .btn { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.btn-success { background: var(--s-done); border-color: var(--s-done); color: var(--on-tone); }

/* ---------- Уведомления курьера ---------- */
.notif-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.notif-header h2 { display: flex; align-items: center; gap: 8px; margin: 0; }
.notif-header h2 .icon { color: var(--accent); }
.notif-header form { margin: 0; }
.notif-count {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px;
  border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: .78rem; font-weight: 700;
}
.notif-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.notif {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: start;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); transition: border-color .15s ease, box-shadow .15s ease;
}
.notif:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); box-shadow: 0 4px 14px rgba(0, 0, 0, .06); }
.notif.is-unread { background: color-mix(in srgb, var(--accent) 6%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.notif.is-unread::before {
  content: ""; position: absolute; left: -1px; top: 12px; bottom: 12px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--accent);
}
.notif-icon {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent-wash); color: var(--accent); flex-shrink: 0;
}
.notif:not(.is-unread) .notif-icon { background: var(--hover-wash); color: var(--text-2); }
.notif-main { min-width: 0; }
.notif-top { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.notif-title { font-weight: 700; color: var(--text); }
.notif-title:hover { color: var(--accent); text-decoration: none; }
.notif-new {
  padding: 1px 8px; border-radius: 999px; font-size: .72rem; font-weight: 700; letter-spacing: .02em;
  text-transform: uppercase; color: var(--accent); background: var(--accent-wash);
}
.notif-time { margin-left: auto; color: var(--c-muted); font-size: .82rem; white-space: nowrap; }
.notif-place { display: flex; align-items: flex-start; gap: 6px; margin: 6px 0 0; color: var(--text-2); font-size: .92rem; }
.notif-place .icon { flex-shrink: 0; margin-top: 3px; color: var(--c-muted); }
.notif-place span { overflow-wrap: anywhere; }
.notif-items { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; padding: 0; }
.notif-items li {
  padding: 3px 10px; border-radius: 999px; font-size: .82rem; color: var(--text-2);
  background: var(--hover-wash); border: 1px solid var(--border);
}
.notif-items b { color: var(--text); font-weight: 600; }
.notif-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.notif-total { font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.notif-more { margin-top: 8px; }
.notif-more > summary {
  display: inline-flex; cursor: pointer; list-style: none; padding: 6px 14px; margin-bottom: 8px;
  border-radius: 999px; color: var(--accent); background: var(--accent-wash); font-weight: 600; font-size: .88rem;
}
.notif-more > summary::-webkit-details-marker { display: none; }
.notif-more[open] > summary { margin-bottom: 8px; }
.notif-empty { display: flex; align-items: center; gap: 14px; padding: 8px 0; color: var(--text-2); }
.notif-empty p { margin: 0; }
@media (max-width: 600px) {
  .notif { grid-template-columns: auto minmax(0, 1fr); }
  .notif-side { grid-column: 2; flex-direction: row; align-items: center; justify-content: space-between; }
  .notif-icon { width: 34px; height: 34px; }
}

/* Всплывающий баннер о новом заказе */
.live {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 12px 16px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface)); color: var(--text);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border)); border-radius: var(--radius-lg);
  box-shadow: 0 6px 20px rgba(42, 120, 214, .15); animation: live-in .3s ease-out;
}
.live-icon {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent); color: var(--accent-ink); animation: live-ring 1.2s ease-in-out 2;
}
.live-text { font-weight: 600; }
@keyframes live-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes live-ring { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-14deg); } 40% { transform: rotate(12deg); } 60% { transform: rotate(-8deg); } 80% { transform: rotate(4deg); } }
@media (prefers-reduced-motion: reduce) { .live, .live-icon { animation: none; } }

/* ---------- Отчёты ---------- */
.segmented {
  display: inline-flex; gap: 2px; padding: 3px; margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
}
.segmented { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented a { white-space: nowrap; padding: 5px 14px; border-radius: 999px; color: var(--text-2); font-size: .9rem; font-weight: 500; }
.segmented a:hover { color: var(--text); background: var(--hover-wash); text-decoration: none; }
.segmented a.active { background: var(--accent); color: var(--accent-ink); }

.report-filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.report-filters .segmented { margin-bottom: 12px; }
.report-note { margin: -2px 0 16px; color: var(--text-2); font-size: .88rem; }

.daily-table { max-height: 440px; overflow-y: auto; border-radius: var(--radius); }
.daily-table thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.daily-table tfoot th { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--c-baseline); }
.daily-table tr.is-empty td { color: var(--c-muted); }
tr.is-muted td { color: var(--c-muted); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); min-width: 0;
}
.stat-label { color: var(--text-2); font-size: .85rem; }
.stat-value { font-size: 1.45rem; font-weight: 600; letter-spacing: -.01em; overflow-wrap: anywhere; }
.stat-note { color: var(--c-muted); font-size: .78rem; }
.stat-hero .stat-value { font-size: 1.7rem; line-height: 1.25; }
@media (max-width: 520px) { .stat-hero { grid-column: 1 / -1; } }

.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.chart-grid .card { margin: 0; }
.chart-wide { grid-column: 1 / -1; }
@media (max-width: 760px) { .chart-grid { grid-template-columns: minmax(0, 1fr); } }

.chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.chart-head h2 { margin: 0; font-size: 1rem; }
.chart-sub { margin: 2px 0 0; color: var(--text-2); font-size: .85rem; }

.chart { position: relative; min-height: 120px; }
.chart-svg { display: block; overflow: visible; }
.chart-svg:focus { outline: none; }
.chart-svg:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: var(--radius-xs); }
.c-grid { stroke: var(--c-grid); stroke-width: 1; shape-rendering: crispEdges; }
.c-baseline { stroke: var(--c-baseline); stroke-width: 1; shape-rendering: crispEdges; }
.c-tick { fill: var(--c-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.c-label { fill: var(--text-2); font-size: 11.5px; font-weight: 600; }
.c-bar { fill: var(--series, var(--series-1)); transition: opacity .12s ease; }
.chart-svg:hover .c-bar:not(.is-active), .chart-svg:focus-visible .c-bar:not(.is-active) { opacity: .55; }
.c-line { fill: none; stroke: var(--series, var(--series-1)); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.c-area { fill: var(--series, var(--series-1)); fill-opacity: .10; }
.c-dot { fill: var(--series, var(--series-1)); stroke: var(--surface); stroke-width: 2; }
.c-cross { stroke: var(--c-baseline); stroke-width: 1; shape-rendering: crispEdges; pointer-events: none; }
.c-hit { fill: transparent; cursor: crosshair; }

.chart-tip {
  position: absolute; z-index: 2; pointer-events: none; transform: translate(-50%, -100%);
  display: flex; flex-direction: column; gap: 1px; white-space: nowrap;
  padding: 7px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); box-shadow: 0 6px 20px rgba(0, 0, 0, .14);
}
.chart-tip-value { font-size: .95rem; color: var(--text); }
.chart-tip-label { font-size: .8rem; color: var(--text-2); }
.chart-empty { display: grid; place-items: center; min-height: 120px; margin: 0; color: var(--text-2); }

.hbars { display: flex; flex-direction: column; gap: 6px; padding: 4px 0; }
.hbar {
  display: grid; grid-template-columns: minmax(80px, min(34%, 240px)) minmax(0, 1fr); align-items: center; gap: 12px;
  padding: 4px 6px; margin: 0 -6px; border-radius: var(--radius-xs); outline: none;
}
.hbar:hover, .hbar:focus-visible { background: var(--hover-wash); }
.hbar:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.hbar-label { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hbar-fill { display: block; height: 16px; border-radius: 0 4px 4px 0; background: var(--series, var(--series-1)); flex-shrink: 0; }
.hbar-value { font-size: .85rem; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }

.chart-table { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 8px; }
.chart-table summary { cursor: pointer; color: var(--text-2); font-size: .85rem; width: fit-content; }
.chart-table summary:hover { color: var(--text); }
.chart-table table { margin-top: 8px; font-size: .9rem; }
.chart-table th, .chart-table td { padding: 6px 8px; }

@media (max-width: 600px) {
  .user-name { display: none; }
}

/* ---------- Раздел «Заказы» ---------- */
/* Один цвет — один статус по всему сайту. */
.st-all { --tone: var(--accent); }
.st-new { --tone: var(--s-new); }
.st-in_delivery { --tone: var(--s-delivery); }
.st-delivered { --tone: var(--s-done); }
.st-completed { --tone: var(--s-completed); }
.st-cancelled { --tone: var(--danger); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--tone); flex-shrink: 0; }

.page-sub { margin: 4px 0 0; color: var(--text-2); font-size: .9rem; }
.page-head h1 { margin: 0; }

.stiles { display: grid; grid-template-columns: 1.5fr repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
@media (max-width: 920px) { .stiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } .stile.st-all { grid-column: 1 / -1; } }
@media (max-width: 480px) {
  .stiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .stile { padding: 10px 10px 9px; border-radius: var(--radius); }
  .stile-label { font-size: .74rem; gap: 5px; }
  .stile-value { font-size: 1.3rem; }
  .stile.st-all { flex-direction: row; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
}
.stile {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 2px; padding: 13px 15px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  color: var(--text); box-shadow: var(--shadow);
  transition: border-color .15s ease, transform .15s ease, background-color .15s ease;
}
.stile::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--tone); opacity: .85; }
.stile:hover { text-decoration: none; transform: translateY(-1px); border-color: color-mix(in srgb, var(--tone) 45%, var(--border)); }
.stile.is-active { background: color-mix(in srgb, var(--tone) 9%, var(--surface)); border-color: var(--tone); }
.stile.is-active::after { content: "✓"; position: absolute; top: 10px; right: 12px; font-size: .8rem; font-weight: 800; color: var(--tone); }
.stile-label { display: flex; align-items: center; gap: 7px; color: var(--text-2); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stile-value { font-size: 1.65rem; font-weight: 800; line-height: 1.15; color: var(--tone); }
.stile.st-all .stile-value { color: var(--text); }
.stile.is-zero .stile-value { color: var(--c-muted); }
.stile-note { font-size: .8rem; font-weight: 700; color: var(--s-done); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (prefers-reduced-motion: reduce) { .stile:hover { transform: none; } }

.orders-table tbody tr { transition: background-color .12s ease; }
.orders-table tbody tr:hover > td { background: var(--hover-wash); }
.orow > td:first-child { box-shadow: inset 4px 0 0 var(--tone); }
.oid { font-weight: 700; font-variant-numeric: tabular-nums; }
.otime { display: block; font-weight: 600; font-variant-numeric: tabular-nums; }
.oday { display: block; margin-top: 1px; font-size: .78rem; color: var(--c-muted); white-space: nowrap; }
.oclient, .odelivery { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.oclient-text { display: flex; flex-direction: column; min-width: 0; gap: 1px; }

.orders-table .avatar {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  font-weight: 800; font-size: .85rem; color: var(--tone); background: color-mix(in srgb, var(--tone) 15%, transparent);
}
.av-0 { --tone: #2a78d6; } .av-1 { --tone: #eb6834; } .av-2 { --tone: #12976a; }
.av-3 { --tone: #6250d6; } .av-4 { --tone: #d0457a; } .av-5 { --tone: #b26f00; }
.av-none { --tone: var(--c-muted); }

.odelivery-icon {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  color: var(--accent); background: var(--accent-wash);
}
.ocourier {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%; width: fit-content; margin-top: 4px; padding: 1px 8px;
  border-radius: 999px; font-size: .78rem; font-weight: 600;
  color: var(--s-delivery); background: color-mix(in srgb, var(--s-delivery) 13%, transparent);
}
.ocourier .icon { flex-shrink: 0; }
.opickup {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: .82rem; font-weight: 600; color: var(--s-completed); background: color-mix(in srgb, var(--s-completed) 12%, transparent);
}
.sbadge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px; white-space: nowrap;
  font-size: .8rem; font-weight: 700; color: var(--tone); background: color-mix(in srgb, var(--tone) 12%, transparent);
}
.ototal { display: block; font-weight: 800; }

.orders-empty { display: flex; align-items: center; gap: 14px; }
.orders-empty p { margin: 4px 0 0; }
.pager { align-items: center; }

/* ---------- Форма заказа ---------- */
.tone-violet { --tone: var(--c-violet); }
.tone-orange { --tone: var(--c-orange); }
.tone-teal { --tone: var(--s-completed); }
.btn-soft-orange { --tone: var(--c-orange); }

.oform { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
@media (max-width: 960px) { .oform { grid-template-columns: minmax(0, 1fr); } }
.oform-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.oform-main .card { margin: 0; }

.fsec { position: relative; overflow: visible; }
.fsec::before {
  content: ""; position: absolute; left: -1px; top: 18px; width: 4px; height: 34px;
  border-radius: 0 4px 4px 0; background: var(--tone);
}
.fsec-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.fsec-head > div { flex: 1; min-width: 0; }
.fsec-head h2 { margin: 0; font-size: 1.05rem; }
.fsec-head p { margin: 2px 0 0; color: var(--text-2); font-size: .85rem; }
.fsec-num {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  font-weight: 800; font-size: .95rem; color: var(--on-tone); background: var(--tone);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--tone) 35%, transparent);
}
.fsec-icon {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  color: var(--tone); background: color-mix(in srgb, var(--tone) 13%, transparent);
}
.fsec input:focus, .fsec select:focus, .fsec textarea:focus { outline-color: var(--tone); }

.input-icon { position: relative; display: block; }
.input-icon > .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--c-muted); pointer-events: none; }
.input-icon > input { padding-left: 38px; }

/* Строки товаров */
#items { counter-reset: item; display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.item-row {
  counter-increment: item;
  display: grid; grid-template-columns: 28px minmax(0, 1fr) 132px 112px 36px; gap: 10px; align-items: center;
  padding: 8px; border-radius: var(--radius); background: var(--hover-wash); border: 1px solid transparent;
  transition: border-color .15s ease;
}
.item-row:focus-within { border-color: color-mix(in srgb, var(--tone) 45%, var(--border)); }
.item-num {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  font-size: .8rem; font-weight: 800; color: var(--tone); background: color-mix(in srgb, var(--tone) 15%, transparent);
}
.item-num::before { content: counter(item); }
.item-row .combo-input { background: var(--surface); }
.qty { display: grid; grid-template-columns: 34px minmax(0, 1fr) 34px; align-items: center; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.qty input { border: 0; border-radius: 0; background: transparent; text-align: center; padding: 8px 2px; font-weight: 700; -moz-appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty input:focus { outline: none; }
.qty-btn {
  height: 100%; min-height: 36px; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-size: 1.15rem; font-weight: 700; color: var(--tone);
}
.qty-btn:hover { background: color-mix(in srgb, var(--tone) 12%, transparent); }
.line-total { text-align: right; font-weight: 700; color: var(--c-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.line-total.is-set { color: var(--text); }
.item-remove { color: var(--c-muted); font-size: .95rem; }
.item-remove:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.add-item { padding: 8px 14px; }
@media (max-width: 600px) {
  .item-row { grid-template-columns: 26px minmax(0, 1fr) minmax(0, 1fr) 36px; grid-template-areas: "num combo combo del" ". qty total total"; }
  .item-num { grid-area: num; } .item-row .combo { grid-area: combo; } .item-remove { grid-area: del; }
  .qty { grid-area: qty; max-width: 150px; } .line-total { grid-area: total; }
}

/* Самовывоз / Доставка */
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .mode-switch { grid-template-columns: 1fr; } }
.mode-opt {
  position: relative; display: flex; flex-direction: row; align-items: center; gap: 12px; padding: 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius); cursor: pointer; color: var(--text);
  background: var(--surface); transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.mode-opt input { position: absolute; opacity: 0; pointer-events: none; }
.mode-opt:hover { border-color: color-mix(in srgb, var(--tone) 50%, var(--border)); }
.mode-opt:has(input:checked) {
  border-color: var(--tone); background: color-mix(in srgb, var(--tone) 9%, var(--surface));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone) 15%, transparent);
}
.mode-opt:has(input:checked)::after {
  content: "✓"; position: absolute; top: 10px; right: 12px; display: grid; place-items: center;
  width: 20px; height: 20px; border-radius: 50%; font-size: .72rem; font-weight: 800; color: var(--on-tone); background: var(--tone);
}
.mode-opt:has(input:focus-visible) { outline: 2px solid var(--tone); outline-offset: 2px; }
.mode-icon {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  color: var(--tone); background: color-mix(in srgb, var(--tone) 14%, transparent);
}
.mode-text { display: flex; flex-direction: column; }
.mode-text b { font-size: 1rem; }
.mode-text small { color: var(--text-2); font-size: .82rem; }
.delivery-fields { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border); }

/* Чек справа */
.oform-side { position: sticky; top: 16px; }
@media (max-width: 960px) { .oform-side { position: static; } }
.osum { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.osum h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 1.05rem; }
.osum h2 .icon { color: var(--accent); }
.osum-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.osum-lines li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: baseline; font-size: .92rem; }
.osum-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.osum-qty { color: var(--c-orange); font-weight: 700; font-size: .85rem; }
.osum-sum { font-weight: 600; font-variant-numeric: tabular-nums; }
.osum-lines li.osum-empty { display: block; color: var(--c-muted); padding: 10px; text-align: center; border: 1px dashed var(--border); border-radius: var(--radius-sm); }
.osum-row { display: flex; justify-content: space-between; gap: 8px; padding-top: 10px; border-top: 1px dashed var(--border); color: var(--text-2); font-size: .92rem; }
.osum-row span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 600; }
.osum-total {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 12px 14px;
  border-radius: var(--radius); background: color-mix(in srgb, var(--s-done) 10%, var(--surface));
}
.osum-total span { color: var(--text-2); font-weight: 600; }
.osum-total strong { font-size: 1.6rem; font-weight: 800; color: var(--s-done); font-variant-numeric: tabular-nums; }
.btn-lg { display: inline-flex; justify-content: center; align-items: center; gap: 8px; width: 100%; padding: 12px 16px; font-size: 1rem; font-weight: 700; }

/* ---------- Товары и регионы ---------- */
.tone-muted { --tone: var(--c-muted); }
.btn-tone { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--tone); border-color: var(--tone); color: var(--on-tone); font-weight: 700; }
button.stile { font: inherit; text-align: left; cursor: pointer; }
.stile-static { cursor: default; }
.stile-static:hover { transform: none; border-color: var(--border); }
.stile-label .icon { color: var(--tone); flex-shrink: 0; }
.stile-note.muted-note { color: var(--c-muted); font-weight: 600; }
.cat-stiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 920px) { .cat-stiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .cat-stiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cat-stiles .stile.st-all { grid-column: auto; } }

.cat-add { margin-bottom: 16px; }
.cat-add-fields { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.cat-add-fields.has-desc { grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr) minmax(0, 1.4fr) auto; }
@media (max-width: 760px) { .cat-add-fields, .cat-add-fields.has-desc { grid-template-columns: minmax(0, 1fr); } }
.cat-add-fields .btn { height: 41px; }

.cat-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.search-box {
  position: relative; display: flex; align-items: center; flex: 1; max-width: 380px; color: var(--c-muted);
}
.search-box .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.search-box input { padding-left: 38px; background: var(--surface); border-radius: 999px; }

.cat-icon {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  color: var(--tone); background: color-mix(in srgb, var(--tone) 14%, transparent);
}
.cat-name { font-weight: 600; }
.cat-price { font-weight: 800; color: var(--s-done); font-variant-numeric: tabular-nums; }
tr.inactive .cat-price { color: var(--text-2); }
.catalog-table .cat-nothing td { text-align: center; color: var(--text-2); padding: 18px; }

.cat-edit { max-width: 560px; margin: 8px auto 0; }
.cat-edit .card { margin: 0; }
.back-link { display: inline-block; margin-bottom: 10px; color: var(--text-2); font-weight: 600; }
.back-link:hover { color: var(--accent); text-decoration: none; }

/* ---------- Отчёты ---------- */
.tone-red { --tone: var(--danger); }
.chart-card, .report-daily { position: relative; }
.chart-card .chart { --series: var(--tone); }
.chart-card::before, .report-daily::before {
  content: ""; position: absolute; left: -1px; top: 18px; width: 4px; height: 34px; border-radius: 0 4px 4px 0; background: var(--tone);
}
.chart-head { align-items: center; }
.chart-head-text { flex: 1; min-width: 0; }

.report-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; padding: 10px 14px; margin-bottom: 14px; }
.report-toolbar .segmented { margin: 0; }
.report-toolbar-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; max-width: 100%; }
.report-toolbar-label { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: .85rem; font-weight: 600; }
.report-toolbar-label .icon { color: var(--accent); }
.report-alert {
  display: flex; align-items: flex-start; gap: 10px; margin: 0 0 14px; padding: 10px 14px; border-radius: var(--radius);
  color: var(--text); background: color-mix(in srgb, var(--s-delivery) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--s-delivery) 35%, var(--border));
}
.report-alert .icon { color: var(--s-delivery); flex-shrink: 0; margin-top: 2px; }

.rstats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rstats .stat-hero { grid-column: auto; }
@media (max-width: 760px) {
  .rstats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rstats .stat-hero { grid-column: 1 / -1; }
  .rstat { padding-right: 14px; }
  .rstat .stat-label { padding-right: 34px; }
  .rstat .stat-value { font-size: 1.2rem; }
  .rstats .stat-hero .stat-value { font-size: 1.6rem; }
  .rstat-icon { width: 30px; height: 30px; right: 10px; }
}
@media (max-width: 420px) { .rstat .stat-value { font-size: 1.05rem; } }
@media (max-width: 350px) { .rstats { grid-template-columns: minmax(0, 1fr); } }
.rstat .stat-value { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rstat { padding-right: 52px; }
.rstat-icon {
  position: absolute; top: 14px; right: 12px; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  color: var(--tone); background: color-mix(in srgb, var(--tone) 14%, transparent);
}
.rstat.stat-hero { background: color-mix(in srgb, var(--tone) 7%, var(--surface)); }

.dot.tone-blue, .dot.tone-green, .dot.tone-amber { vertical-align: middle; margin-right: 2px; }
.v-blue, .v-green, .v-amber { font-weight: 700; font-variant-numeric: tabular-nums; }
.v-blue { color: var(--accent); }
.v-green { color: var(--s-done); }
.v-amber { color: var(--s-delivery); }
.daily-table tr.is-empty .v-blue, .daily-table tr.is-empty .v-green, .daily-table tr.is-empty .v-amber { color: var(--c-muted); font-weight: 400; }

/* Страница входа */
.login-card { margin-top: 56px; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 18px; text-align: center; }
.login-brand .login-logo { margin-bottom: 4px; }
.login-brand .brand-text { font-size: 1.75rem; }
.login-brand p { margin: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Живое обновление заказов ---------- */
.live-pill {
  display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; padding: 2px 10px; border-radius: 999px;
  vertical-align: middle; font-size: .74rem; font-weight: 600; letter-spacing: 0;
  color: var(--s-done); background: color-mix(in srgb, var(--s-done) 11%, transparent);
}
.live-pill[data-state="off"] { color: var(--c-muted); background: var(--hover-wash); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.live-pill[data-state="on"] .live-dot { animation: live-pulse 1.8s ease-in-out infinite; }
@keyframes live-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 55%, transparent); } 50% { box-shadow: 0 0 0 5px transparent; } }

tr.is-flash > td { animation: row-flash 2.2s ease-out; }
#order-live.is-flash .card { animation: card-flash 2.2s ease-out; }
@keyframes row-flash { 0%, 25% { background: color-mix(in srgb, var(--tone, var(--accent)) 18%, var(--surface)); } 100% { background: transparent; } }
@keyframes card-flash { 0%, 25% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); } 100% { box-shadow: var(--shadow); } }

.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: var(--radius);
  background: var(--surface); color: var(--text); font-weight: 600; font-size: .92rem;
  border: 1px solid color-mix(in srgb, var(--tone) 40%, var(--border));
  box-shadow: 0 10px 30px rgba(0, 0, 0, .16); animation: toast-in .25s ease-out;
  transition: opacity .3s ease, transform .3s ease;
}
.toast.is-leaving { opacity: 0; transform: translateY(6px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .live-pill .live-dot, tr.is-flash > td, #order-live.is-flash .card, .toast { animation: none; }
}

/* ---------- Подсказка постоянных клиентов ---------- */
.customer-option { align-items: center; }
.customer-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.customer-who b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customer-who small { color: var(--text-2); font-variant-numeric: tabular-nums; }
.customer-hint {
  display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 10px 12px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--tone) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--tone) 30%, var(--border));
  animation: toast-in .2s ease-out;
}
.customer-hint[hidden] { display: none; }
.customer-hint-icon {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  color: var(--tone); background: color-mix(in srgb, var(--tone) 15%, transparent);
}
.customer-hint-text { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.35; }
.customer-hint-text .small { overflow-wrap: anywhere; }
@media (max-width: 520px) { .customer-hint { flex-wrap: wrap; } .customer-hint [data-hint-address] { margin-left: 44px; } }
input.is-autofilled { animation: autofill-flash 1.4s ease-out; }
@keyframes autofill-flash { 0%, 30% { background: color-mix(in srgb, var(--tone, var(--accent)) 16%, var(--surface)); } 100% { background: var(--bg); } }
@media (prefers-reduced-motion: reduce) { .customer-hint, input.is-autofilled { animation: none; } }

/* ---------- Окно уведомлений ---------- */
body.modal-open { overflow: hidden; }
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(10, 10, 12, .45); backdrop-filter: blur(3px); animation: fade-in .2s ease-out; }
.modal-card {
  position: relative; width: min(440px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
  padding: 26px 24px 20px; border-radius: var(--radius-lg); background: var(--surface); color: var(--text);
  border: 1px solid var(--border); box-shadow: 0 24px 60px rgba(0, 0, 0, .3); text-align: center;
  animation: modal-in .22s ease-out;
}
.modal-card h2 { margin: 12px 0 6px; font-size: 1.25rem; }
.modal-card > p { margin: 0 0 16px; }
.modal-icon {
  display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%;
  color: var(--accent); background: var(--accent-wash);
}
.notify-opts { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.switch {
  display: flex; flex-direction: row; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); transition: border-color .15s ease;
}
.switch:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-ui {
  position: relative; flex-shrink: 0; width: 40px; height: 24px; border-radius: 999px;
  background: var(--c-baseline); transition: background-color .15s ease;
}
.switch-ui::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s ease;
}
.switch input:checked + .switch-ui { background: var(--accent); }
.switch input:checked + .switch-ui::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-text { display: flex; flex-direction: column; line-height: 1.3; }
.switch-text small { color: var(--text-2); font-size: .82rem; }
.notify-state { margin: 12px 0 0; padding: 10px 12px; border-radius: var(--radius-sm); font-size: .88rem; text-align: left; }
.notify-state[data-tone="ok"] { color: var(--s-done); background: color-mix(in srgb, var(--s-done) 11%, transparent); }
.notify-state[data-tone="warn"] { color: var(--text); background: color-mix(in srgb, var(--s-delivery) 14%, transparent); }
.modal-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 18px; }
.modal-actions-spacer { flex: 1; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .modal-backdrop, .modal-card { animation: none; } }

/* Колокольчик в шапке */
.notify-btn { position: relative; }
.notify-dot {
  position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%;
  border: 2px solid var(--surface); background: var(--c-muted);
}
.notify-btn[data-state="on"] .notify-dot { background: var(--s-done); }
