/* ---------- Цвета и общие размеры ---------- */

:root {
  --brand: #c0392b;          /* красный пиццерии */
  --brand-dark: #a5301f;
  --brand-soft: #fdeeec;
  --bg: #f6f4f1;             /* тёплый светлый фон */
  --surface: #fff;
  --text: #1f2328;
  --muted: #6e6a66;
  --line: #efebe7;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(31, 20, 10, 0.04), 0 6px 20px rgba(31, 20, 10, 0.06);
  --shadow-lift: 0 2px 4px rgba(31, 20, 10, 0.06), 0 12px 32px rgba(31, 20, 10, 0.14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
}

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

main { max-width: 1100px; margin: 0 auto; padding: 24px 20px 48px; }

h1 { font-size: 26px; line-height: 1.2; margin: 0 0 16px; }
h2 { font-size: 17px; margin: 0 0 14px; }

.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.error { color: var(--brand); font-weight: 600; }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

/* ---------- Кнопки ---------- */

button {
  padding: 11px 18px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--brand);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}
button:hover:where(:not(.status-button)) { background: var(--brand-dark); }

button.link {
  padding: 0;
  font-weight: 400;
  color: inherit;
  background: none;
  text-decoration: underline;
}
form.inline { display: inline; }

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
  background: var(--bg);
  border-radius: 50%;
}
.icon-button:hover { background: var(--line); }
.icon-button[aria-pressed="true"] { background: var(--brand-soft); }

.button-soft {
  display: inline-block;
  padding: 10px 16px;
  font-weight: 600;
  text-decoration: none;
  background: var(--brand-soft);
  border-radius: 10px;
}

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- Шапка ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--line), 0 2px 12px rgba(31, 20, 10, 0.04);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.brand-logo {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  font-size: 20px;
  background: var(--brand);
  border-radius: 10px;
}
.brand-sub { color: var(--brand); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.who { display: flex; flex-direction: column; line-height: 1.2; text-align: right; }
.who-name { font-weight: 600; }
.who-role { font-size: 13px; color: var(--muted); }
.logout { color: var(--muted) !important; font-size: 14px; }

/* ---------- Вход и ошибки ---------- */

.login { max-width: 380px; margin: 48px auto; padding: 28px; }
.login h1 { font-size: 22px; }
.login label { display: block; margin-bottom: 14px; font-size: 14px; color: var(--muted); }
.login input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  font-size: 16px;   /* меньше 16px — iPhone приближает страницу при вводе */
  color: var(--text);
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 10px;
}
.login input:focus { background: #fff; border-color: var(--brand); outline: none; }
.login button { width: 100%; margin-top: 6px; }

/* ---------- Поиск и фильтр ---------- */

.offline {
  margin: 0 0 16px;
  padding: 12px 16px;
  color: #fff;
  background: #4b4744;
  border-radius: 10px;
}

.toolbar { display: flex; gap: 10px; margin-bottom: 18px; }

.search { position: relative; flex: 1; min-width: 0; }
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search input {
  width: 100%;
  height: 46px;
  padding: 0 44px;
  font-size: 16px;   /* меньше 16px — iPhone приближает страницу при вводе */
  color: var(--text);
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: 12px;
  box-shadow: var(--shadow);
  -webkit-appearance: none;
  appearance: none;
}
.search input:focus { border-color: var(--brand); outline: none; }
/* Свой крестик вместо встроенного в браузер — чтобы не было двух */
.search input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  color: var(--muted);
  background: none;
  border-radius: 50%;
}
.search-clear:hover { color: var(--text); background: var(--bg); }
.search-clear[hidden] { display: none; }

.filter { position: relative; flex: none; }
.filter-button {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 46px;
  padding: 0 16px;
  font-weight: 600;
  white-space: nowrap;
  list-style: none;
  cursor: pointer;
  user-select: none;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.filter-button::-webkit-details-marker { display: none; }
.filter-sep { color: var(--muted); font-weight: 400; }
.chevron { color: var(--muted); font-size: 13px; transition: transform 0.2s; }
.filter[open] .chevron { transform: rotate(180deg); }
.filter[open] .filter-button { box-shadow: 0 0 0 2px var(--brand), var(--shadow); }

/* Компьютер: выпадающий список под кнопкой */
.filter-backdrop { display: none; }
.filter[open] .filter-backdrop { display: block; position: fixed; inset: 0; z-index: 20; }
.filter-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 21;
  width: 250px;
  padding: 6px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
}
.sheet-handle, .sheet-title { display: none; }
.filter-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--text);
  text-decoration: none;
  border-radius: 10px;
}
.filter-item:hover { background: var(--bg); }
.filter-item.current { font-weight: 600; background: var(--brand-soft); }
.filter-item-title { flex: 1; }
.filter-count { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot-group { background: transparent; box-shadow: inset 0 0 0 2px #c9c3bd; }
/* Отделяем «Активные» и «Все» от отдельных статусов */
.filter-item:nth-of-type(2) { margin-bottom: 6px; }

/* ---------- Статусы ---------- */

.badge {
  display: inline-block;
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  border-radius: 999px;
}
.st-new       { color: #fff;    background: var(--brand); }
.st-accepted  { color: #1d4f91; background: #e3edfb; }
.st-cooking   { color: #8a4b00; background: #fff0d6; }
.st-on_way    { color: #5b2c86; background: #f0e6fb; }
.st-delivered { color: #1d6b35; background: #e1f4e6; }
.st-cancelled { color: #6e6a66; background: #ece9e6; }
.st-other     { color: #333;    background: #eee; }
.dot.st-new { background: var(--brand); }
.dot.st-accepted { background: #4f86d6; }
.dot.st-cooking { background: #f0a12b; }
.dot.st-on_way { background: #9a64d0; }
.dot.st-delivered { background: #3fa45f; }
.dot.st-cancelled { background: #b3ada7; }

/* ---------- Список заказов (компьютер — таблица) ---------- */

table.orders {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.orders th, .orders td { padding: 14px 18px; text-align: left; }
.orders th {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.orders td { border-bottom: 1px solid var(--line); }
.orders th.num, .orders td.num { text-align: right; }
.orders tbody tr { cursor: pointer; transition: background 0.3s; }
.orders tbody tr:hover { background: #fcf8f6; }
.orders tbody tr:last-child td { border-bottom: 0; }
.orders .o-num a { font-weight: 700; text-decoration: none; }
.orders .o-phone, .orders .o-when { white-space: nowrap; color: var(--muted); }
.orders .o-name { font-weight: 600; }
.orders .o-total { font-weight: 700; font-size: 17px; }

/* Новый заказ, пришедший при автопроверке */
.orders tbody tr.fresh, .orders tbody tr.fresh:hover { background: #fff4cc; }

.empty { padding: 40px 20px; text-align: center; }

.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
}
.pager a {
  padding: 9px 14px;
  font-weight: 600;
  text-decoration: none;
  background: var(--surface);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

/* ---------- Карточка заказа ---------- */

.back { display: inline-block; margin-bottom: 14px; font-weight: 600; text-decoration: none; }

.order-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 20px; }
.order-head h1 { margin: 0; }
.order-date { flex-basis: 100%; }

.order-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 20px;
  align-items: start;
}

table.items { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.items th, .items td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--line); }
.items th:first-child, .items td:first-child { padding-left: 0; }
.items th:last-child, .items td:last-child { padding-right: 0; }
.items th { font-size: 13px; font-weight: 600; color: var(--muted); }
.items th.num, .items td.num { text-align: right; }

.items-list { display: none; margin: 0 0 8px; padding: 0; list-style: none; }
.items-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

dl { margin: 0; }
dl.totals {
  display: grid;
  grid-template-columns: 1fr auto;
  row-gap: 6px;      /* без промежутка между колонками — линия над «Итого» сплошная */
  padding-top: 10px;
}
dl.totals dt { color: var(--muted); }
dl.totals dd { margin: 0; padding-left: 16px; text-align: right; white-space: nowrap; }
dl.totals .grand {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
}
dl.totals dt.grand { display: flex; align-items: flex-end; padding-bottom: 4px; font-size: 18px; }

dl.details { margin-bottom: 18px; }
dl.details dt { font-size: 13px; color: var(--muted); }
dl.details dd { margin: 2px 0 14px; overflow-wrap: anywhere; }

/* ---------- Плашки с результатом ---------- */

.flash {
  margin: 0 0 16px;
  padding: 12px 16px;
  font-weight: 600;
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.flash-success { color: #1d6b35; background: #e1f4e6; }
.flash-warning { color: #8a4b00; background: #fff0d6; }
.flash-error   { color: #fff;    background: var(--brand); }
.flash-info    { color: var(--text); background: var(--surface); }

/* ---------- Статус и история в карточке заказа ---------- */

.status-card { margin-bottom: 20px; }
h3 { font-size: 15px; margin: 22px 0 8px; }

.status-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.status-button {
  padding: 11px 16px;
  font-weight: 600;
  border-radius: 12px;
  transition: background 0.15s, box-shadow 0.15s;
}
/* Остальные статусы — серые; текущий — цветом статуса (классы .st-…) и обводкой */
.status-button:not(.current) { color: var(--text); background: var(--bg); }
.status-button:not(.current):hover { background: var(--line); }
.status-button.current { box-shadow: inset 0 0 0 2px currentColor; }
.status-form.sending .status-button { opacity: 0.55; cursor: progress; }
.status-form.sending .status-button.pressed { opacity: 1; }

.history { margin: 0; padding: 0; list-style: none; }
.history li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.history li:last-child { border-bottom: 0; }
.history-when { min-width: 88px; color: var(--muted); font-variant-numeric: tabular-nums; }
.not-notified {
  padding: 1px 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 999px;
}
.hint { margin: 10px 0 0; font-size: 13px; color: var(--muted); }

/* ---------- Меню в шапке (только у админа) ---------- */

.menu { display: flex; gap: 4px; margin: 0 auto 0 28px; }
.menu a {
  padding: 8px 14px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  border-radius: 10px;
}
.menu a:hover { color: var(--text); background: var(--bg); }
.menu a.current { color: var(--brand); background: var(--brand-soft); }

/* ---------- Статистика: период ---------- */

.period { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 8px; }
.segmented {
  display: flex;
  padding: 4px;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.segmented a {
  padding: 8px 14px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  border-radius: 9px;
}
.segmented a:hover { color: var(--text); }
.segmented a.current { color: #fff; background: var(--brand); }

.period-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.period-form label { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.period-form input {
  height: 42px;
  padding: 0 10px;
  font: inherit;
  font-size: 16px;   /* меньше 16px — iPhone приближает страницу при вводе */
  color: var(--text);
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.period-form.current input { border-color: var(--brand); }
.period-form button { height: 42px; padding: 0 16px; }
.period-caption { margin: 0 0 18px; font-size: 14px; }

/* ---------- Статистика: итоги ---------- */

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 20px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.tile-label { font-size: 14px; color: var(--muted); }
.tile-value { font-size: 28px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tiles + .hint { margin: 10px 0 20px; }
section.card + section.card, .hint + section.card { margin-top: 20px; }

/* ---------- Статистика: график ---------- */

.chart-scroll {
  overflow-x: auto;           /* много дней на узком экране — график листается вбок */
  padding: 30px 0 4px;        /* место для подсказки над самым высоким столбиком */
}
.chart { display: flex; gap: 4px; height: 220px; padding: 0 2px; }
.bar-col {
  display: flex;
  flex-direction: column;
  flex: 1 0 24px;
  min-width: 24px;
  outline: none;
  cursor: default;
}
.bar-track {
  position: relative;
  display: flex;
  align-items: flex-end;
  flex: 1;
  border-bottom: 1px solid var(--line);
}
.bar {
  position: relative;
  width: 100%;
  background: var(--brand);
  border-radius: 6px 6px 2px 2px;
  opacity: 0.85;
  transition: opacity 0.15s;
}
.bar.empty { background: none; }
.bar-col:hover .bar, .bar-col:focus .bar { opacity: 1; }
.bar-col:focus-visible .bar-track { box-shadow: 0 0 0 2px var(--brand); border-radius: 6px; }

/* Подсказка с суммой: при наведении мышью или после нажатия (фокус) */
.bar-tip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  z-index: 1;
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  color: #fff;
  background: var(--text);
  border-radius: 8px;
  transform: translateX(-50%);
  visibility: hidden;
  pointer-events: none;
}
.bar-col:first-child .bar-tip { left: 0; transform: none; }
.bar-col:last-child .bar-tip { left: auto; right: 0; transform: none; }
.bar-col:hover .bar-tip, .bar-col:focus .bar-tip { visibility: visible; }

.bar-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 34px;
  padding-top: 6px;
  font-size: 12px;
  line-height: 1.2;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.bar-label small { font-size: 11px; color: var(--brand); }

/* ---------- Статистика: таблицы ---------- */

.stat-table { width: 100%; border-collapse: collapse; }
.stat-table th, .stat-table td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--line); }
.stat-table th:first-child, .stat-table td:first-child { padding-left: 0; }
.stat-table th:last-child, .stat-table td:last-child { padding-right: 0; }
.stat-table th { font-size: 13px; font-weight: 600; color: var(--muted); }
.stat-table th.num, .stat-table td.num { text-align: right; }
.stat-table tbody tr:last-child td { border-bottom: 0; }
.stat-table tr.zero td { color: var(--muted); }
.stat-table .d-revenue, .stat-table .p-revenue, .stat-table .p-qty { font-weight: 700; }
.stat-table + .hint { margin-top: 12px; }

/* ---------- Сотрудники ---------- */

.button-quiet { color: var(--text); background: var(--bg); }
.button-quiet:hover:where(:not(:disabled)) { background: var(--line); }
.button-danger { color: var(--brand); background: var(--brand-soft); }
.button-danger:hover { color: #fff; background: var(--brand); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

select, .inline-form input {
  height: 42px;
  padding: 0 12px;
  font: inherit;
  font-size: 16px;   /* меньше 16px — iPhone приближает страницу при вводе */
  color: var(--text);
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 10px;
}
select:focus, .inline-form input:focus, .staff-form input:focus { border-color: var(--brand); outline: none; }

.add-staff { margin-bottom: 20px; padding: 0; }
.add-staff summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 22px;
  font-weight: 700;
  list-style: none;
  cursor: pointer;
}
.add-staff summary::-webkit-details-marker { display: none; }
.add-plus {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: #fff;
  background: var(--brand);
  border-radius: 8px;
}
.staff-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  padding: 0 22px 22px;
}
.staff-form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.staff-form input, .staff-form select {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 10px;
}
.staff-form button { justify-self: start; }

.staff-list { display: grid; gap: 14px; }
.staff-list .staff-card.card { margin-top: 0; }   /* отступ задаёт gap списка */
.staff-card.inactive { opacity: 0.75; }
.staff-card.inactive h2 { color: var(--muted); }
.staff-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.staff-head h2 { margin: 0; }
.staff-login { margin: 2px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.staff-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.role-admin    { color: #fff; background: var(--text); }
.role-operator { color: var(--text); background: var(--line); }

.staff-actions { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 16px; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { width: 170px; }
.inline-form button { height: 42px; padding: 0 14px; }

/* ---------- Подвал ---------- */

.footer { max-width: 1100px; margin: 0 auto; padding: 0 20px 32px; font-size: 14px; color: var(--muted); }

/* ---------- Телефон (уже 700 px) ---------- */

@media (max-width: 700px) {
  main { padding: 16px 14px 40px; }
  h1 { font-size: 22px; }
  .card { padding: 18px; }

  .topbar { padding: 8px 14px; }
  .brand-logo { width: 32px; height: 32px; font-size: 18px; }
  .brand-sub, .who-role { display: none; }

  /* Меню — второй строкой под логотипом, две кнопки на всю ширину */
  .topbar { flex-wrap: wrap; row-gap: 8px; }
  .menu { order: 3; flex-basis: 100%; margin: 0; }
  .menu a { flex: 1; padding: 8px 4px; text-align: center; }

  /* Сотрудники: формы во всю ширину */
  .staff-form { grid-template-columns: minmax(0, 1fr); padding: 0 18px 18px; }
  .staff-form button { justify-self: stretch; }
  .add-staff summary { padding: 16px 18px; }
  .staff-actions { flex-direction: column; gap: 10px; }
  .inline-form { width: 100%; }
  .inline-form input, .inline-form select { flex: 1; min-width: 0; width: auto; }
  .inline-form button { flex: none; }
  .inline-form input[name="active"] + button { flex: 1; }   /* «Отключить»/«Включить» — во всю ширину */

  /* Статистика */
  .period { align-items: stretch; }
  .segmented { width: 100%; }
  .segmented a { flex: 1; text-align: center; padding: 10px 6px; }
  .period-form { width: 100%; }
  .period-form label { flex: 1 1 130px; }
  .period-form input { flex: 1; min-width: 0; width: 100%; }
  .period-form button { flex: 1 1 100%; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 14px 16px; }
  .tile-value { font-size: 22px; }
  .chart { height: 180px; }

  /* Таблицы статистики — карточки: заголовок строки сверху, цифры подписаны */
  .stat-table thead { display: none; }
  .stat-table, .stat-table tbody { display: block; }
  .stat-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));   /* по две цифры в ряд: подписи не налезают */
    gap: 10px 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }
  .stat-table tbody tr:last-child { border-bottom: 0; }
  .stat-table td { padding: 0 !important; border: 0; }
  /* Подпись мелко над числом */
  .stat-table td.num { display: flex; flex-direction: column; gap: 1px; min-width: 0; text-align: left; }
  .stat-table td.num::before { content: attr(data-label); font-size: 12px; font-weight: 400; color: var(--muted); }
  .stat-table .d-date, .stat-table .p-name { grid-column: 1 / -1; font-weight: 700; color: var(--text); }
  .topbar-right { gap: 10px; }

  /* Фильтр — панель, выезжающая снизу */
  .filter-button { padding: 0 14px; }
  .filter[open] .filter-backdrop {
    background: rgba(20, 14, 10, 0.4);
    animation: fade-in 0.2s ease-out;
  }
  .filter-menu {
    position: fixed;
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: auto;
    max-height: 85vh;
    overflow-y: auto;
    padding: 8px 12px calc(16px + env(safe-area-inset-bottom));
    border-radius: 20px 20px 0 0;
    animation: slide-up 0.25s ease-out;
  }
  .sheet-handle {
    display: block;
    width: 40px;
    height: 4px;
    margin: 4px auto 10px;
    background: #d9d3cd;
    border-radius: 2px;
  }
  .sheet-title { display: block; margin: 0 12px 8px; font-weight: 700; font-size: 17px; }
  .filter-item { padding: 14px 12px; font-size: 17px; }

  /* Список — карточки друг под другом */
  table.orders, .orders tbody { display: block; background: none; box-shadow: none; overflow: visible; }
  .orders thead { display: none; }
  .orders tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "num    status"
      "name   total"
      "phone  when";
    gap: 6px 12px;
    margin-bottom: 12px;
    padding: 16px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }
  .orders tbody tr:hover { background: var(--surface); }
  .orders td { padding: 0; border: 0; }
  .orders .o-num    { grid-area: num; font-size: 17px; }
  .orders .o-status { grid-area: status; text-align: right; }
  .orders .o-name   { grid-area: name; overflow-wrap: anywhere; }
  .orders .o-total  { grid-area: total; font-size: 19px; }
  .orders .o-phone  { grid-area: phone; }
  .orders .o-when   { grid-area: when; text-align: right; }

  /* Карточка заказа: крупные кнопки статусов во всю ширину */
  .status-buttons { flex-direction: column; }
  .status-button { width: 100%; padding: 15px 16px; font-size: 17px; }
  .status-card { margin-bottom: 14px; }

  /* Карточка заказа: колонки друг под другом, позиции списком */
  .order-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  table.items { display: none; }
  .items-list { display: block; }
}

@keyframes slide-up { from { transform: translateY(100%); } }
@keyframes fade-in { from { opacity: 0; } }

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