/* ---------- база ---------- */
/* Палитра: золото #d2a052 на графите #131b21 */
:root {
  --bg:        #0c1216;
  --bg-2:      #131b21;
  --bg-3:      #1c2731;
  --line:      #232d35;
  --line-2:    #33414c;
  --fg:        #eaf0f4;
  --fg-dim:    #9aa8b4;
  --fg-faint:  #6b7c88;
  --accent:    #d2a052;
  --accent-2:  #e0b877;
  --green:     #3fb950;
  --red:       #f85149;
  --blue:      #4a9eff;
  --radius:    12px;
  --tap:       52px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

.loading { padding: 40px; color: var(--fg-faint); text-align: center; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); }

.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--fg-dim); }
.faint { color: var(--fg-faint); }
.green { color: var(--green); }
.red   { color: var(--red); }
/* Метка «есть ответ» на правке — золотом, чтобы находилась глазами сразу */
.badge.st-studio { border-color: var(--blue); color: var(--blue); }
.badge.st-answer { background: #2a2113; color: #e0b262; border-color: #4a3a1c; }
.gold  { color: var(--accent-2); }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.hidden { display: none !important; }

/* ---------- каркас ---------- */
.shell { min-height: 100dvh; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--bg-2); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
}
.brand { font-weight: 700; letter-spacing: .04em; color: var(--accent-2); font-size: 17px; white-space: nowrap; flex: 0 0 auto; }
.brand small { display: block; font-weight: 400; font-size: 11px; color: var(--fg-faint); letter-spacing: 0; }
.topbar .who { flex: 0 0 auto; }

.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.nav::-webkit-scrollbar { display: none; }
.nav button {
  background: none; border: 0; color: var(--fg-dim);
  padding: 9px 14px; border-radius: 9px; white-space: nowrap; font-weight: 500;
}
.nav button.on { background: var(--bg-3); color: var(--fg); }

.who { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--fg-dim); }

/* На телефоне и планшете вкладки в одну строку не помещаются: часть уезжала
   за край, и до «Смен», «Правок» и «Настроек» было не добраться. Переносим их
   под шапку и разрешаем несколько рядов. */
@media (max-width: 1100px) {
  .topbar { flex-wrap: wrap; row-gap: 8px; }
  .nav {
    order: 3; width: 100%; flex-wrap: wrap; overflow: visible;
    border-top: 1px solid var(--line); padding-top: 8px;
  }
  .nav button { padding: 9px 12px; }

  /* поля в строке не должны ужиматься до нечитаемых полосок —
     на узком экране они переносятся и занимают минимум 140 px */
  .row > .field { flex: 1 1 140px; min-width: 140px; }
  .row > .field input[type="date"] { min-width: 0; }

  /* переключатели (длительность, оплата) тоже переносим: иначе «4 часа»
     и «Поделить» уезжают за край экрана */
  .seg { flex-wrap: wrap; }
}

.page { padding: 16px; padding-bottom: max(28px, env(safe-area-inset-bottom)); flex: 1; }
/* Контент занимает всю ширину экрана с небольшими полями — колонка по центру не нужна */
.page.wide { width: 100%; max-width: none; margin: 0; }

/* ---------- элементы ---------- */
.card {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px;
}
.card + .card { margin-top: 12px; }
.card h3 { margin: 0 0 12px; font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--fg-dim); font-weight: 600; }

.row  { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.col  { display: flex; flex-direction: column; gap: 10px; }
.grid { display: grid; gap: 10px; }
/* Низ дашборда: у мастеров пять колонок и им нужно вдвое больше места, чем бару
   и расходам, иначе крайние столбцы уезжают в горизонтальную прокрутку. */
.dash-bottom { grid-template-columns: 1fr; }
@media (min-width: 1200px) { .dash-bottom { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); } }

.btn {
  background: var(--bg-3); border: 1px solid var(--line-2); color: var(--fg);
  padding: 0 16px; height: 42px; border-radius: 10px; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #16110a; font-weight: 700; }
.btn.danger  { border-color: #5a2b2b; color: #ff8b83; background: #241416; }
.btn.ghost   { background: none; border-color: var(--line); color: var(--fg-dim); }
.btn.big     { height: var(--tap); font-size: 16px; padding: 0 22px; }
.btn.sm      { height: 34px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn.block   { width: 100%; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { font-size: 12px; color: var(--fg-faint); text-transform: uppercase; letter-spacing: .05em; }
.input, select.input, textarea.input {
  background: var(--bg); border: 1px solid var(--line-2); color: var(--fg);
  height: 42px; padding: 0 12px; border-radius: 10px; width: 100%;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--fg-faint) 50%), linear-gradient(135deg, var(--fg-faint) 50%, transparent 50%); background-position: right 15px center, right 10px center; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--bg-3); border: 1px solid var(--line-2); color: var(--fg-dim);
}
.chip.cash { background: #10241a; border-color: #1f4a33; color: #58d68d; }
.chip.card { background: #101d2e; border-color: #1e3a5c; color: #6cb2f5; }
.chip.company { background: #14202e; border-color: #2a4a6b; color: #7fb3e8; }
.chip.bonus{ background: #2a2213; border-color: #55441f; color: var(--accent-2); }
.chip.open { background: #10241a; border-color: #1f4a33; color: #58d68d; }
.chip.closed { background: var(--bg-3); }

/* переключатель нал/карта */
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { background: none; border: 0; color: var(--fg-dim); padding: 0 16px; height: 36px; border-radius: 8px; font-weight: 600; }
.seg button.on { background: var(--bg-3); color: var(--fg); box-shadow: inset 0 0 0 1px var(--line-2); }
.seg button.on[data-v="cash"] { background: #10241a; color: #58d68d; }
.seg button.on[data-v="card"] { background: #101d2e; color: #6cb2f5; }
/* Переключатель во всю ширину: три равные кнопки — в них проще попасть пальцем */
.seg.wide { display: flex; }
.seg.wide button { flex: 1; height: 44px; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kpi { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi .k { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--fg-faint); }
.kpi .v { font-size: 23px; font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 12px; color: var(--fg-dim); margin-top: 2px; }
.kpi.accent .v { color: var(--accent-2); }
.kpi.good   .v { color: var(--green); }
.kpi.bad    .v { color: var(--red); }

/* ---------- таблицы ---------- */
.tw { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -14px; padding: 0 14px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-faint); font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }
tr.total td { font-weight: 700; border-top: 2px solid var(--line-2); background: var(--bg-3); }

/* зачёркнутая строка — как исправление в бумажном журнале */
tr.struck td { color: var(--fg-faint); text-decoration: line-through; text-decoration-color: var(--red); }
tr.struck td .chip { opacity: .5; text-decoration: none; }
.struck-note { text-decoration: none; display: inline-block; color: var(--red); font-size: 11px; margin-left: 6px; opacity: .85; }
.line.struck { text-decoration: line-through; text-decoration-color: var(--red); color: var(--fg-faint); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- гости ---------- */
.guests { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.guest {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; display: flex; flex-direction: column; gap: 9px; text-align: left; width: 100%;
}
.guest:active { border-color: var(--accent); }
.guest .gh { display: flex; align-items: center; gap: 8px; }
.guest .gno { font-size: 17px; font-weight: 700; }
.guest .gsum { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.guest .lines { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--fg-dim); }
.guest .line { display: flex; gap: 8px; }
.guest .line .l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guest .line .r { margin-left: auto; font-variant-numeric: tabular-nums; white-space: nowrap; }
.guest.add { align-items: center; justify-content: center; border-style: dashed; color: var(--fg-dim); min-height: 108px; font-size: 16px; font-weight: 600; }

/* ---------- плитки прайса ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 9px; }
.tile {
  background: var(--bg-3); border: 1px solid var(--line-2); border-radius: 11px;
  padding: 11px; min-height: var(--tap); text-align: left;
  display: flex; flex-direction: column; justify-content: center; gap: 3px;
}
.tile:active { border-color: var(--accent); background: #24313c; }
.tile .n { font-weight: 600; font-size: 14px; line-height: 1.25; }
.tile .p { font-size: 13px; color: var(--accent-2); font-variant-numeric: tabular-nums; }
.tile .note { font-size: 11px; color: var(--fg-faint); }
.tile.on { border-color: var(--accent); background: #241d10; }

/* Категории переносим на новую строку: в одну строку они не влезали и «Закуски»,
   «Кофе», «Кальяны» уезжали за край — администратор их просто не видел. */
.cats { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 8px; }
.cats::-webkit-scrollbar { display: none; }
.cats button { background: var(--bg-2); border: 1px solid var(--line); color: var(--fg-dim); height: 40px; padding: 0 14px; border-radius: 10px; white-space: nowrap; font-weight: 500; }
.cats button.on { background: var(--accent); border-color: var(--accent); color: #16110a; font-weight: 700; }

/* ---------- модалка ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center; z-index: 100;
}
@media (min-width: 700px) { .overlay { align-items: center; } }
.modal {
  background: var(--bg-2); border: 1px solid var(--line-2);
  border-radius: 16px 16px 0 0; width: 100%; max-width: 720px;
  max-height: 92dvh; display: flex; flex-direction: column;
}
@media (min-width: 700px) { .modal { border-radius: 16px; } }
.modal.wide { max-width: 1000px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 16px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: flex; gap: 10px; }
.x { margin-left: auto; background: none; border: 0; color: var(--fg-faint); font-size: 26px; line-height: 1; padding: 0 4px; }

/* ---------- тосты ---------- */
#toast-root { position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px; z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--bg-3); border: 1px solid var(--line-2); padding: 11px 18px; border-radius: 10px; font-weight: 500; box-shadow: 0 8px 28px rgba(0,0,0,.5); animation: pop .18s ease; }
.toast.err { border-color: #5a2b2b; color: #ff8b83; }
.toast.ok  { border-color: #1f4a33; color: #58d68d; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }

/* ---------- график ---------- */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 170px; padding-top: 10px; overflow-x: auto; }
.bars .b { flex: 1 1 22px; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; gap: 3px; min-width: 22px; max-width: 64px; }
.bars .b .stack { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; border-radius: 4px 4px 0 0; overflow: hidden; }
.bars .b .m { background: var(--accent); }
.bars .b .r { background: #4a6fa5; }
.bars .b .lb { font-size: 10px; color: var(--fg-faint); text-align: center; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--fg-dim); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- вход ---------- */
.login-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login { width: 100%; max-width: 340px; }
.login .brand { text-align: center; font-size: 26px; margin-bottom: 6px; }
.login .sub { text-align: center; color: var(--fg-faint); font-size: 13px; margin-bottom: 22px; }

.chip.split { border-color: var(--accent); color: var(--accent); }

.tile.wide { width: 100%; text-align: left; }

.update-bar {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; z-index: 200;
  background: var(--bg-2); border: 1px solid var(--accent); border-radius: 999px;
  padding: 8px 10px 8px 18px; box-shadow: 0 8px 24px rgba(0,0,0,.5); font-size: 14px;
}

/* ---------- правки по системе ---------- */
.edit.urgent { border-color: var(--red); }
.edit-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.edit-title { font-size: 15px; }
.edit-body { margin: 10px 0 0; white-space: pre-wrap; line-height: 1.5; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600;
  border: 1px solid var(--line-2); color: var(--fg-dim); white-space: nowrap;
}
.badge.st-new    { border-color: var(--blue);  color: var(--blue); }
.badge.st-work   { border-color: var(--accent); color: var(--accent); }
.badge.st-done   { border-color: var(--green); color: var(--green); }
.badge.st-urgent { border-color: var(--red);   color: var(--red); }

/* вложения */
.dropzone {
  display: flex; flex-direction: column; gap: 2px; align-items: center; text-align: center;
  padding: 14px; border: 1px dashed var(--line-2); border-radius: 12px;
  cursor: pointer; background: var(--bg-3); font-size: 13px;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); }
.dropzone .faint { font-size: 12px; }

.files-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.files-pick .chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-3); border: 1px solid var(--line-2); border-radius: 999px;
  padding: 4px 10px; font-size: 12px; text-decoration: none; color: var(--fg);
}
.files-pick .chip .x { background: none; border: 0; color: var(--fg-faint); font-size: 15px; line-height: 1; padding: 0; }
.files-pick .chip .x:hover { color: var(--red); }

.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 10px; }
.shots img {
  width: 100%; height: 130px; object-fit: cover; display: block;
  border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-3);
}

/* переписка по правке */
.thread { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.msg { background: var(--bg-3); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.msg.own { border-color: var(--line-2); }
.msg-head { display: flex; gap: 8px; align-items: baseline; font-size: 12px; margin-bottom: 4px; }
.msg p { margin: 0; white-space: pre-wrap; line-height: 1.45; }
.reply { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.reply-row { margin-top: 10px; }
.check { gap: 8px; font-size: 14px; cursor: pointer; }
.x-btn { color: var(--fg-faint); }
.x-btn:hover { color: var(--red); }
textarea.input { resize: vertical; min-height: 60px; font: inherit; }

/* ---------- печать отчёта ---------- */
@media print {
  .topbar, .nav, .btn, .modal-foot, .no-print { display: none !important; }
  html, body { background: #fff; color: #000; }
  .card { border-color: #ccc; background: #fff; }
  th, td { border-color: #ddd; }
}

/* ---- таблица смен: 16 граф, как в тетради владельца ---- */
/* Дата и админ примерзают к левому краю, иначе при прокрутке вправо
   непонятно, чья это строка */
table.sheet { font-size: 13px; }
table.sheet th, table.sheet td { padding: 8px 9px; }
table.sheet th:first-child, table.sheet td:first-child { position: sticky; left: 0; z-index: 2; }
table.sheet thead th:first-child { background: var(--bg-2); }
table.sheet tbody td:first-child { background: var(--bg); }
table.sheet tfoot td:first-child { background: var(--bg-3); }
table.sheet tbody tr:hover td { background: var(--bg-2); }
table.sheet tbody tr:hover td:first-child { background: var(--bg-2); }
td.nw, th.nw { white-space: nowrap; }
td.note { max-width: 200px; overflow: hidden; text-overflow: ellipsis; color: var(--fg-faint); font-size: 12px; }
.chip.tiny { font-size: 10px; padding: 1px 5px; margin-left: 6px; }

/* итоги месяца под таблицей */
.minis { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.mini {
  flex: 1 1 140px; background: var(--bg-3); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px;
}
.mini .v { font-size: 18px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* список устройств: точка «сейчас в системе» */
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line-2); flex: 0 0 auto; }
.dot.on { background: #58d68d; box-shadow: 0 0 0 3px rgba(88, 214, 141, .18); }

/* незаполненное, без чего система считает неверно */
.chip.warn { background: #2e2113; border-color: #6b4a1f; color: #e0a458; }
.needfill {
  background: #2318; border: 1px solid #6b4a1f; background-color: #221a10;
  border-radius: 10px; padding: 11px 13px; font-size: 13px; line-height: 1.45;
}
.needfill b { color: #e0a458; }

/* галочка с пояснением под ней (прайс-лист) */
label.check {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  margin-top: 12px; cursor: pointer;
}
label.check input[type="checkbox"] { width: 18px; height: 18px; flex: 0 0 auto; }
label.check .s { flex-basis: 100%; margin-left: 26px; }

/* Кнопка рядом с полем ввода.
   Поле — это подпись плюс input: всего ~64 px, а крупная кнопка 52 px.
   При выравнивании по центру она выпирала над строкой и казалась больше,
   чем надо. Равняем по низу и приводим к высоте поля ввода. */
.row:has(> .field) { align-items: flex-end; }
.row:has(> .field) > .btn.big { height: 42px; font-size: 15px; padding: 0 18px; }
.row:has(> .field) > .btn { align-self: flex-end; }

/* Форма ввода: поля одинаковой ширины, сами переносятся по месту.
   Раньше это был обычный ряд — на планшете пять полей и кнопка расползались
   в кашу разной ширины. */
.formgrid {
  display: grid; gap: 10px; align-items: end;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
.formgrid > .btn { height: 42px; }
/* Узкий экран: два поля в ряд, кнопка во всю ширину и крупная —
   её жмут пальцем, а не мышью */
@media (max-width: 760px) {
  .formgrid { grid-template-columns: 1fr 1fr; }
  .formgrid > .btn { grid-column: 1 / -1; height: var(--tap); font-size: 16px; }
}
@media (max-width: 420px) {
  .formgrid { grid-template-columns: 1fr; }
}

/* Сертификат: четыре поля сверху, снизу способ оплаты во всю строку и кнопка.
   Раньше пять полей и кнопка вставали лесенкой разной ширины. */
.formgrid.four { grid-template-columns: repeat(4, 1fr); }
.formgrid .wide { grid-column: span 3; }
.formgrid .seg { display: flex; width: 100%; }
.formgrid .seg button { flex: 1; padding: 0 8px; }
@media (max-width: 760px) {
  .formgrid.four { grid-template-columns: 1fr 1fr; }
  .formgrid .wide { grid-column: 1 / -1; }
}
@media (max-width: 420px) {
  .formgrid.four { grid-template-columns: 1fr; }
}

/* Зарплата — самая крупная статья: карточка на две ячейки и с разбивкой,
   чтобы было видно, из чего сложилась общая сумма. */
/* Разбивка внутри обычной карточки: подписи мелкие, суммы справа.
   Карточка не растягивается на две ячейки — иначе «Прибыль» уезжает
   на отдельную строку и в сетке остаётся дыра. */
.kpi .parts { margin-top: 6px; display: grid; gap: 1px; }
.kpi .part { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; line-height: 1.5; }
.kpi .part .n { color: var(--fg-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi .part .a { color: var(--fg-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* готовый текст отчёта — его копируют целиком */
textarea.report-text {
  height: auto; padding: 12px; font-family: ui-monospace, Consolas, monospace;
  font-size: 13px; line-height: 1.5; white-space: pre; overflow-x: auto;
}

/* карточка потерянного гостя — видно сразу, не вчитываясь */
.card.lost { border-color: #5a2b2b; background: #1a1113; }
.card.lost h3 { color: #ff8b83; }

/* строка потерянного гостя в отчёте — приглушённая, но читаемая */
tr.struck-soft td { opacity: .7; }

/* кнопка со значком: квадратная, значок по центру */
.icon-btn { width: 34px; padding: 0; flex: 0 0 auto; }
.icon-btn svg { display: block; }

/* «+ Гость» — единственный способ завести гостя, поэтому плитка заметная,
   а не бледная пунктирная рамка на фоне карточек */
.guest.add { border-color: var(--accent); color: var(--accent); }
.guest.add:hover { background: #21180b; }

/* Кнопка не переносится на вторую строку — она перестаёт читаться как кнопка.
   Если подпись длинная, её надо укоротить, а не ломать вёрстку. */
.btn { white-space: nowrap; }

/* Переключатель разделов внутри вкладки — как листы внизу таблицы */
.seg.subtabs { display: flex; flex-wrap: wrap; width: 100%; }
.seg.subtabs button { flex: 1 1 auto; min-width: 96px; }

/* Таблица «строка × дни»: колонок под месяц много, поэтому она узкая
   и прокручивается вбок, а название строки примерзает слева */
table.days { font-size: 12px; }
table.days th, table.days td { padding: 6px 8px; }
table.days th:first-child, table.days td:first-child {
  position: sticky; left: 0; z-index: 2; min-width: 150px; background: var(--bg);
}
table.days thead th:first-child { background: var(--bg-2); }
table.days tbody tr:hover td { background: var(--bg-2); }
table.days tbody tr:hover td:first-child { background: var(--bg-2); }
table.days th:last-child, table.days td:last-child { border-left: 1px solid var(--line-2); }

/* ---------- статистика управляющей ---------- */

/* Столбики по дням: своими руками, без библиотек. Провал в среду видно
   сразу, а в таблице на 31 колонку — нет. */
.chart {
  display: flex; align-items: flex-end; gap: 3px; height: 150px;
  padding: 10px 0 0; overflow-x: auto;
}
.chart .bar {
  flex: 1 1 0; min-width: 14px; height: 100%;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 4px;
}
.chart .fill {
  background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px;
  transition: opacity .15s;
}
.chart.gold .fill { background: var(--accent-2, var(--accent)); }
.chart .bar:hover .fill { opacity: .75; }
.chart .lbl { font-size: 10px; color: var(--fg-faint); text-align: center; }

/* Рейтинг: имя, полоса, число. Читается за секунду. */
.rank { display: flex; flex-direction: column; gap: 8px; }
.rank-row {
  display: grid; grid-template-columns: minmax(90px, 150px) 1fr auto auto;
  gap: 10px; align-items: center;
}
.rank-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-bar { background: var(--bg-3); border-radius: 6px; height: 22px; overflow: hidden; }
.rank-fill { background: var(--accent); height: 100%; border-radius: 6px; min-width: 3px; }
.rank-val { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 74px; text-align: right; }
.rank-pct { color: var(--fg-faint); font-size: 12px; min-width: 56px; text-align: right; }
@media (max-width: 620px) {
  .rank-row { grid-template-columns: 1fr auto; grid-template-areas: 'name val' 'bar bar'; }
  .rank-name { grid-area: name; }
  .rank-val { grid-area: val; }
  .rank-bar { grid-area: bar; height: 14px; }
  .rank-pct { display: none; }
}

/* пометка «акция» в прайс-листе */
.chip.tiny.gold { background: #2a2213; border-color: #55441f; color: var(--accent-2); }

/* Таблица по дням: без разделения дней это сплошное серое полотно.
   Чередуем подложку колонок, выделяем выходные и лучший день строки. */
table.days thead th { vertical-align: bottom; line-height: 1.15; }
table.days .dnum { font-size: 12px; color: var(--fg-dim); font-weight: 700; }
table.days .dwd { font-size: 9px; color: var(--fg-faint); text-transform: none; letter-spacing: 0; }
table.days td.alt, table.days th.alt { background: rgba(255, 255, 255, .022); }
table.days td.wknd, table.days th.wknd { background: rgba(224, 184, 119, .07); }
table.days th.wknd .dnum, table.days th.wknd .dwd { color: var(--accent-2); }
table.days td.best { color: var(--accent-2); font-weight: 700; }
table.days td.sum, table.days th.sum {
  background: var(--bg-3); border-left: 2px solid var(--line-2);
  position: sticky; right: 0; z-index: 1;
}
table.days td, table.days th { border-right: 1px solid rgba(255, 255, 255, .04); }
table.days tbody tr:hover td { background: var(--bg-2); }
table.days tbody tr:hover td.sum { background: var(--bg-3); }

/* правила округления: заголовок, примеры «было → стало», пояснение */
.rule { background: var(--bg-3); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.rule-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rule-ex { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.rule-ex .ex {
  display: flex; align-items: center; gap: 6px; font-size: 13px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px;
  font-variant-numeric: tabular-nums;
}
.rule-ex .was { color: var(--fg-faint); }
.rule-ex .arr { color: var(--fg-faint); }
.rule-ex .now { color: var(--accent-2); font-weight: 700; }

/* мелкие плитки — отметить гостей у звонка */
.tiles.small { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
.tiles.small .tile { min-height: 40px; padding: 6px; text-align: center; }
