:root {
  --bg: #000000;
  --card: #1C1C1E;
  --card-2: #2C2C2E;
  --text: #FFFFFF;
  --muted: #8E8E93;
  --line: #38383A;
  --accent: #FFFFFF;
  --green: #30D158;
  --red: #FF453A;
  --orange: #FF9F0A;
  /* Предупреждения и проблемы: насыщенный красный фон, белый текст (все предупреждения панели). */
  --alert: #D70015;
  --alert-fg: #FFFFFF;
  --radius: 24px;
  color-scheme: dark;
}

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

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 48px max(16px, env(safe-area-inset-left));
  display: grid;
  gap: 16px;
}
.wrap > * { min-width: 0; }
.wrap.narrow { max-width: 420px; padding-top: 12vh; }

h1 { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; margin: 4px 0 16px; }
.top h1 { margin-bottom: 0; }
.eyebrow { margin: 0; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; }
.card-title { font-size: 20px; font-weight: 600; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 1.45; }
.error { color: var(--red); margin: 0; }
code { background: var(--card-2); padding: 2px 6px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }

.card { background: var(--card); border-radius: var(--radius); padding: 20px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }

.status-row { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.dot-on { background: var(--green); box-shadow: 0 0 10px rgba(48, 209, 88, .6); }
.dot-err { background: var(--red); }
.dot-wait { background: var(--alert); }
.dot-off { background: var(--muted); }

.meta { margin: 12px 0 16px; }
.meta dt { color: var(--muted); font-size: 13px; }
.meta dd { margin: 2px 0 0; font-size: 15px; }

.btn {
  appearance: none; border: 0; cursor: pointer; font: inherit; font-size: 15px; font-weight: 600;
  color: var(--text); background: var(--card-2); border-radius: 999px; padding: 12px 20px; min-height: 44px;
  transition: opacity .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--accent); color: #000; }
.btn-ghost { background: transparent; color: var(--muted); padding: 10px 12px; }
.btn-small { padding: 8px 14px; min-height: 36px; font-size: 13px; white-space: nowrap; }
.btn:focus-visible, input:focus-visible { outline: 2px solid #0A84FF; outline-offset: 2px; }

label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
input {
  font: inherit; font-size: 16px; color: var(--text); background: var(--card-2); border: 0;
  border-radius: 14px; padding: 12px 14px; min-height: 44px; width: 100%; min-width: 0;
}
.stack { display: grid; gap: 16px; }
.period { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; margin-bottom: 12px; }

.notice { border-radius: var(--radius); padding: 16px 20px; font-size: 15px; line-height: 1.45; }
.notice-warn, .notice-error { background: var(--alert); color: var(--alert-fg); }

/* Быстрые периоды */
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -20px 14px; padding: 0 20px 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; appearance: none; border: 0; cursor: pointer; font: inherit; font-size: 14px; font-weight: 500;
  color: var(--text); background: var(--card-2); border-radius: 999px; padding: 9px 14px; min-height: 38px;
}
.chip.active { background: var(--accent); color: #000; }

/* Показатели */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--card); border-radius: var(--radius); padding: 18px; min-width: 0; }
.kpi h3 { margin: 0 0 8px; font-size: 14px; font-weight: 500; color: var(--muted); }
.kpi-value { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi-note { margin: 6px 0 0; font-size: 12px; line-height: 1.35; color: var(--muted); }
.kpi-wide { grid-column: span 2; }
.kpi-wide .kpi-value { font-size: 36px; }
.neg { color: var(--red); }

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

.card-warn { background: var(--alert); color: var(--alert-fg); }
.warn-list { margin: 0; padding-left: 18px; color: var(--alert-fg); line-height: 1.45; font-size: 14px; }
.warn-list li + li { margin-top: 6px; }
/* Предупреждение внутри обычного (тёмного) блока — красная плашка с белым текстом. */
.warn-text { background: var(--alert); color: var(--alert-fg); border-radius: 6px; padding: 0 6px; }
dd.warn-text { justify-self: end; }
.strong { font-weight: 700; }

.rows { display: grid; grid-template-columns: 1fr auto; gap: 10px 12px; margin: 0 0 12px; font-size: 15px; }
.rows dt { color: var(--muted); }
.rows dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.rows dt:has(+ dd.strong) { color: var(--text); font-weight: 700; }

.code { font-weight: 600; letter-spacing: .02em; }

/* Заказы */
.search { margin: 4px 0 12px; }
.orders-list { display: grid; gap: 8px; }
.order { background: var(--card-2); border-radius: 18px; }
.order summary {
  list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 14px 16px; min-height: 52px; font-size: 16px;
}
.order summary::-webkit-details-marker { display: none; }
.order summary::after { content: '›'; color: var(--muted); font-size: 22px; line-height: 1; transition: transform .2s; }
.order[open] summary::after { transform: rotate(90deg); }
.order-no { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.order-sum { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.order-body { padding: 0 16px 16px; display: grid; gap: 8px; font-size: 14px; }
.kv { display: flex; justify-content: space-between; gap: 12px; }
.kv > span:last-child { text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.items { list-style: none; margin: 4px 0; padding: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.item { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; }
.item + .item { border-top: 1px solid var(--line); }
.item-name, .item-nums { display: grid; gap: 3px; }
.item-nums { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.diag {
  margin: 14px 0 0; padding: 14px; background: #111113; border-radius: 16px; font-size: 12px; line-height: 1.45;
  white-space: pre-wrap; overflow-wrap: anywhere; max-height: 60vh; overflow: auto;
}

summary:focus-visible, .notice-btn:focus-visible { outline: 2px solid #0A84FF; outline-offset: 2px; }

.notice-btn {
  appearance: none; border: 0; font: inherit; width: 100%; text-align: left; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 12px; font-weight: 600;
}
.notice-btn::after { content: '›'; font-size: 22px; line-height: 1; transition: transform .2s; }
.notice-btn[aria-expanded="true"]::after { transform: rotate(90deg); }

.group-name { overflow-wrap: anywhere; font-weight: 600; }

/* Промокоды */
.disc-head, .disc-row summary {
  display: grid; grid-template-columns: minmax(0, 1fr) 64px 110px; gap: 10px; align-items: center;
}
.disc-head { color: var(--muted); font-size: 13px; padding: 6px 0; }
.disc-head .num, .disc-row summary .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.disc-list { display: grid; }
.disc-row { border-top: 1px solid var(--line); }
.disc-row summary { list-style: none; cursor: pointer; padding: 10px 0; min-height: 44px; font-size: 15px; }
.disc-row summary::-webkit-details-marker { display: none; }
.disc-row summary > span:first-child { overflow-wrap: anywhere; }
.disc-row summary > span:first-child::before { content: '›'; display: inline-block; margin-right: 8px; color: var(--muted); transition: transform .2s; }
.disc-row[open] summary > span:first-child::before { transform: rotate(90deg); }
.disc-body { display: grid; gap: 10px; padding: 4px 0 12px 16px; font-size: 14px; }
.disc-entry { display: grid; gap: 2px; }
.disc-entry .small { overflow-wrap: anywhere; }
.disc-total { border-top: 2px solid var(--line); color: var(--text); font-weight: 700; font-size: 15px; padding-top: 10px; }

/* Вкладки */
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; background: var(--card); border-radius: 999px; }
.tab {
  appearance: none; border: 0; font: inherit; font-size: 15px; font-weight: 600; color: var(--muted);
  background: transparent; border-radius: 999px; padding: 10px 12px; min-height: 42px; cursor: pointer;
}
.tab[aria-selected="true"] { background: var(--accent); color: #000; }
.tab:focus-visible { outline: 2px solid #0A84FF; outline-offset: 2px; }
.tab-panel { display: grid; gap: 16px; min-width: 0; }
.tab-panel > * { min-width: 0; }

.badge {
  display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
  background: var(--alert); color: var(--alert-fg); vertical-align: middle;
}
.badge-muted { background: var(--card-2); color: var(--muted); }

/* Месяц учёта */
.month-nav { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px; }
.btn-icon { padding: 0; width: 44px; font-size: 24px; line-height: 1; }
.month-label { position: relative; display: block; text-align: center; color: var(--text); cursor: pointer; }
.month-title { font-size: 22px; font-weight: 700; }
.month-label input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.switch-row { display: flex; align-items: center; gap: 10px; margin: 14px 0 8px; color: var(--text); font-size: 15px; }
.switch-row input { width: 22px; height: 22px; min-height: 0; accent-color: var(--green); }

.kpi-list .rows { margin: 0; font-size: 14px; }

/* Форма расходов месяца */
select {
  font: inherit; font-size: 16px; color: var(--text); background: var(--card-2); border: 0; border-radius: 14px;
  padding: 12px 14px; min-height: 44px; width: 100%; min-width: 0;
}
.month-pick { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 8px; }
.x-form { display: grid; gap: 22px; }
.x-sec { border: 0; margin: 0; padding: 0; min-width: 0; }
.x-sec-title { padding: 0 0 10px; font-size: 15px; font-weight: 700; letter-spacing: .04em; color: var(--text); }
.x-row { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 6px 16px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.x-name { color: var(--text); font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.x-field { display: grid; gap: 4px; }
.x-input { position: relative; }
.x-input input { width: 100%; padding-right: 50px; text-align: right; font-variant-numeric: tabular-nums; }
.x-input input::placeholder { color: var(--muted); opacity: .6; }
.x-input input[aria-invalid="true"] { outline: 2px solid var(--red); }
.x-cur { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 14px; pointer-events: none; }
.x-err { color: var(--red); }
.x-sec-total {
  display: flex; justify-content: space-between; gap: 12px; padding: 12px 0 0; border-top: 1px solid var(--line);
  font-weight: 700; font-variant-numeric: tabular-nums;
}
.lines-total {
  display: flex; justify-content: space-between; gap: 12px; padding: 14px 0 4px; margin: 8px 0 12px;
  border-top: 2px solid var(--line); font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums;
}
/* Расходы из Google Таблицы — только просмотр */
.x-list { display: grid; gap: 22px; }
.x-view .x-name { display: grid; gap: 2px; }
.x-view .x-amt { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; justify-self: end; }
/* Чистая прибыль — ярко-зелёная и жирная, отрицательная — красная */
.net-value { color: #39FF14; font-weight: 800; }
.net-value.neg { color: var(--red); }
.net-value.net-empty { color: var(--muted); font-weight: 700; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }

/* Диалоги (на iPhone — лист снизу) */
dialog.sheet {
  width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; border: 0;
  border-radius: var(--radius); padding: 20px; background: var(--card); color: var(--text);
}
dialog.sheet::backdrop { background: rgba(0, 0, 0, .7); }

/* Компактная строка под показателями (фактическая стоимость заказа) */
.kpi-line { background: var(--card); border-radius: 18px; padding: 10px 16px; }
.kpi-line-main { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 15px; }
.kpi-line-main strong { font-size: 18px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi-line p { margin: 2px 0 0; }

/* Компактный выбор периода «Продаж»: ‹ Месяц год ›, по нажатию — месяц, год и быстрые периоды. */
.period-card { padding: 12px 14px; }
.period-card .report-meta { margin-top: 6px; }
.period-card .about { margin-top: 2px; }
.period-title {
  appearance: none; border: 0; background: none; color: var(--text); font: inherit; font-size: 20px; font-weight: 700;
  min-height: 44px; cursor: pointer; border-radius: 14px; padding: 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.period-title::after { content: ' ▾'; color: var(--muted); font-size: 14px; }
.period-title[aria-expanded="true"]::after { content: ' ▴'; }
.period-title:focus-visible { outline: 2px solid #0A84FF; outline-offset: 2px; }
.period-picker { display: grid; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.period-picker .chips { margin: 0; }
.period-picker .period { margin: 0; }

/* Сворачиваемые блоки «Продаж»: свёрнуты по умолчанию, вся строка заголовка — кнопка. */
.fold-card { padding: 0; }
.fold-card > .fold > summary { padding: 18px 20px; min-height: 60px; }
.fold-card > .fold[open] { padding: 0 20px 20px; }
.fold-card > .fold[open] > summary { margin: 0 -20px 4px; }
.fold > summary {
  list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 32px;
}
.fold > summary .card-title { font-size: 18px; }
/* Индикатор проблемы в заголовке обычного блока. */
.flag {
  flex: none; min-width: 24px; padding: 2px 8px; border-radius: 999px; text-align: center;
  font-size: 13px; font-weight: 700; background: var(--alert); color: var(--alert-fg);
}
/* Блок-предупреждение: красный фон, белые заголовок, счётчик, стрелка и содержимое. */
.card-alert { background: var(--alert); color: var(--alert-fg); }
.card-alert .card-title, .card-alert .fold > summary .card-title::before, .card-alert .muted { color: var(--alert-fg); }
.card-alert .alert-count {
  flex: none; min-width: 28px; padding: 2px 10px; border-radius: 999px; border: 2px solid var(--alert-fg);
  color: var(--alert-fg); font-weight: 700; text-align: center; font-variant-numeric: tabular-nums;
}
.card-alert .order { background: rgba(0, 0, 0, .22); color: var(--alert-fg); }
.card-alert .order summary::after { color: var(--alert-fg); }
.card-alert .warn-text { background: none; padding: 0; font-weight: 600; }
.card-alert .kv span { color: var(--alert-fg); }
/* Справка «О расчёте» под строкой актуальности. */
.about { margin-top: 8px; }
.about > summary { cursor: pointer; color: var(--muted); font-size: 13px; list-style: none; display: inline-flex; gap: 6px; align-items: center; min-height: 32px; }
.about > summary::-webkit-details-marker { display: none; }
.about > summary::before { content: '›'; transition: transform .2s; }
.about[open] > summary::before { transform: rotate(90deg); }
.about p { margin: 4px 0 0; }
.about-notes { margin: 8px 0 0; padding-left: 18px; line-height: 1.45; }
.about-notes li + li { margin-top: 6px; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary .card-title { margin: 0; }
.fold > summary .card-title::before { content: '›'; display: inline-block; margin-right: 10px; color: var(--muted); transition: transform .2s; }
.fold[open] > summary .card-title::before { transform: rotate(90deg); }
.fold[open] > summary { margin-bottom: 12px; }
.search-card { padding: 12px; }
.search-card .search { margin: 0; }
.top-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.chips-inline { margin: 0; padding: 0; flex-wrap: wrap; overflow: visible; }
.top-controls select { width: auto; }
.table-scroll { overflow-x: auto; margin-bottom: 10px; }
.top-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.top-table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 6px 4px; }
.top-table td { padding: 9px 4px; border-top: 1px solid var(--line); vertical-align: top; }
.top-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.top-name { overflow-wrap: anywhere; }

/* Новые и повторные клиенты */
.cust-table td:first-child { white-space: nowrap; }
.cust-table tbody tr:last-child td { font-weight: 700; border-top: 2px solid var(--line); }
.cust-card .rows { margin: 10px 0 0; }

/* Строки списков (используются в «Сверке дня») */
.unsold-row { display: grid; gap: 3px; padding: 11px 0; border-top: 1px solid var(--line); }
.unsold-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 4px 10px; }
.unsold-name { flex: 1 1 160px; font-weight: 600; overflow-wrap: anywhere; }
.sub-fold { margin-top: 14px; padding-top: 12px; border-top: 2px solid var(--line); }
.sub-fold > summary .card-title { font-size: 17px; }

/* Сверка дня */
#audit-form { margin-bottom: 12px; }
.audit-out .rows { margin-top: 4px; }
.audit-h { font-size: 15px; margin: 16px 0 4px; }
.ok-text { color: var(--green); }

@media (max-width: 960px) {
  .grid-2 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* iPhone */
@media (max-width: 720px) {
  .x-row { grid-template-columns: minmax(0, 1fr) 150px; gap: 6px 10px; }
  .x-name { font-size: 14px; }
  h1 { font-size: 30px; }
  .card { padding: 18px; }
  .fold-card { padding: 0; }
  .fold-card > .fold > summary { padding: 16px 18px; }
  .fold-card > .fold[open] { padding: 0 18px 18px; }
  .fold-card > .fold[open] > summary { margin: 0 -18px 4px; }
  .chips { margin: 0 -18px 14px; padding: 0 18px 2px; }
  .period { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .period .btn { grid-column: 1 / -1; }
  .kpi { padding: 16px; }
  .kpi-value { font-size: clamp(14px, 4.3vw, 22px); white-space: nowrap; overflow-wrap: normal; }
  .kpi-wide .kpi-value { font-size: 34px; }
  .item { flex-direction: column; gap: 4px; }
  .item-nums { text-align: left; }
  .disc-head, .disc-row summary { grid-template-columns: minmax(0, 1fr) 44px 96px; gap: 8px; }
  .filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .top-table { font-size: 13px; }
  .top-table th, .top-table td { padding-left: 2px; padding-right: 2px; }
  .top-table .num { padding-left: 7px; }
  .top-controls select { width: 100%; }
  .filters .search { grid-column: 1 / -1; }
  .pay { flex-direction: column; align-items: stretch; }
  .pay-actions .btn { flex: 1; }
  dialog.sheet { margin: auto auto 0; width: 100vw; max-width: 100vw; border-radius: 24px 24px 0 0; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
}

/* Загрузка отчёта «Продажи»: прогресс первой загрузки и дата сохранённого расчёта. */
.notice-info { background: rgba(10, 132, 255, .14); color: #64D2FF; }
.notice-info p { margin: 0 0 6px; }
.notice-info progress { width: 100%; height: 6px; accent-color: #0A84FF; }
.report-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }

/* Исправление себестоимости по справочнику (сентябрь–октябрь 2026) */
.fix-count { background: var(--line); color: var(--text); }
.fix-months { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin: 12px 0; }
.fix-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.fix-actions .btn { text-decoration: none; display: inline-flex; align-items: center; }
.fix-text { color: #0A84FF; }
.fix-line { margin: 0 0 12px; }
.link-btn { background: none; border: 0; padding: 0; color: #0A84FF; font: inherit; cursor: pointer; text-decoration: underline; }
label.btn { display: inline-flex; align-items: center; cursor: pointer; }
.inv-badge { margin-left: 8px; font-size: 11px; background: var(--line); color: var(--text); }

/* Документы для сборки */
.pk-files { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 8px; }
.pk-files a { color: #0A84FF; word-break: break-word; }

/* Наклейки NIIMBOT */
.lb-list { display: grid; gap: 8px; margin: 10px 0; }
.lb-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) 78px; gap: 6px 10px; align-items: start; padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, .05); }
.lb-row.off { opacity: .45; }
.lb-row input[type=checkbox] { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--green); }
.lb-main { display: grid; gap: 4px; min-width: 0; }
.lb-meta { font-size: 12px; color: var(--muted); }
.lb-text { display: grid; grid-template-columns: 1fr; gap: 6px; }
@media (min-width: 720px) { .lb-text { grid-template-columns: 2fr 3fr; } }
.lb-text input, .lb-count input { width: 100%; min-height: 34px; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--text); font: inherit; font-size: 14px; }
.lb-text input.aroma { font-weight: 700; }
.lb-count { display: grid; gap: 2px; text-align: right; font-size: 12px; color: var(--muted); }
.lb-count input { text-align: right; }
.lb-noloc { color: #fff; background: var(--alert); border-radius: 6px; padding: 0 6px; }
.lb-save { justify-self: start; }
.lb-counter { margin-top: 10px; }
.lb-row.lb-needs-fix { box-shadow: inset 0 0 0 2px var(--alert); }
.lb-text input.lb-missing { border-color: var(--alert); }
.lb-preview-box { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 4px; min-width: 0; }
.lb-preview { width: 150px; max-width: 100%; height: auto; aspect-ratio: 3 / 2; flex: none; }

/* Наклейки для разлива */
.pr-search input { width: 100%; min-height: 40px; padding: 6px 12px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--text); font: inherit; font-size: 15px; }
.pr-results { list-style: none; padding: 0; margin: 6px 0; display: grid; gap: 4px; max-height: 320px; overflow-y: auto; }
.pr-results li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 10px; background: rgba(255, 255, 255, .05); }
.pr-results .pr-name { min-width: 0; overflow-wrap: anywhere; }
.pr-name b { font-weight: 700; }
.pr-list { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; }
.pr-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, .05); }
.pr-qty { display: flex; align-items: center; gap: 4px; }
.pr-qty input { width: 64px; min-height: 36px; padding: 4px 6px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--text); font: inherit; font-size: 15px; text-align: center; }
.pr-qty .btn-small { min-width: 36px; padding: 6px 10px; }
.pr-del { grid-column: 1 / -1; justify-self: start; }
@media (min-width: 720px) { .pr-item { grid-template-columns: minmax(0, 1fr) auto auto; } .pr-del { grid-column: auto; justify-self: end; } }
.pr-preview-title { font-size: 15px; margin: 14px 0 6px; }
.pr-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pr-preview figure { margin: 0; display: grid; gap: 2px; justify-items: center; }
.pr-preview .lb-preview { width: 100%; }
.pr-preview figcaption { font-size: 12px; color: var(--muted); }

/* Документы для сборки: два варианта PDF — на телефоне друг под другом, на компьютере рядом */
.pk-docs { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 10px 0; }
@media (min-width: 720px) { .pk-docs { grid-template-columns: 1fr 1fr; } }
.pk-doc { display: grid; gap: 6px; align-content: start; padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, .05); min-width: 0; }
.pk-doc-title { margin: 0; font-size: 15px; }
.pk-doc-name { margin: 0; word-break: break-word; }
.pk-doc-actions { margin: 0; }
.pk-doc-actions a.btn { text-decoration: none; }

/* ---------- Склад / Остатки ---------- */
.wh-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 12px 0; }
@media (min-width: 720px) { .wh-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.wh-tile { display: grid; gap: 2px; padding: 12px 14px; border-radius: 16px; background: rgba(255, 255, 255, .06); min-width: 0; }
.wh-tile-label { font-size: 12px; color: var(--muted); }
.wh-tile-value { font-size: clamp(15px, 4.4vw, 20px); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wh-tile-sub { font-size: 12px; color: var(--muted); }
.wh-tile.qty .wh-tile-value { color: #64D2FF; }
.wh-tile.money .wh-tile-value { color: var(--green); }
.wh-tile.total { background: rgba(48, 209, 88, .14); }
.wh-tile.warn { background: rgba(255, 159, 10, .16); cursor: pointer; }
.wh-tile.warn .wh-tile-value { color: var(--orange); }
.wh-actions { margin-top: 4px; }
.wh-seg { display: flex; gap: 4px; padding: 4px; background: var(--card); border-radius: 999px; overflow-x: auto; scrollbar-width: none; }
.wh-seg::-webkit-scrollbar { display: none; }
.wh-seg button { flex: 1 0 auto; border: 0; border-radius: 999px; padding: 9px 14px; background: transparent; color: var(--text); font: inherit; font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.wh-seg button[aria-selected="true"] { background: var(--accent); color: #000; }
.wh-toolbar { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 8px; }
@media (min-width: 720px) { .wh-toolbar { grid-template-columns: 1fr auto auto; align-items: center; } }
.wh-toolbar input[type=search], .wh-toolbar select, .wh-sheet input[type=search], .wh-field input, .wh-field textarea { width: 100%; min-height: 40px; padding: 6px 12px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--text); font: inherit; font-size: 15px; box-sizing: border-box; }
.wh-toolbar select { width: auto; }
.wh-check { display: flex; align-items: center; gap: 8px; font-size: 14px; white-space: nowrap; }
.wh-check input { width: 20px; height: 20px; min-height: 0; margin: 0; padding: 0; flex: none; accent-color: var(--orange); }
.wh-table-wrap { overflow-x: auto; }
.wh-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.wh-table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line); }
.wh-table td { padding: 9px 8px; border-bottom: 1px solid rgba(255, 255, 255, .06); vertical-align: top; }
.wh-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wh-table tfoot td { font-weight: 700; border-top: 2px solid var(--line); border-bottom: 0; padding-top: 12px; }
.wh-qty { color: #64D2FF; }
.wh-sum { color: var(--green); }
.wh-loc { display: inline-block; padding: 1px 7px; border-radius: 6px; background: rgba(100, 210, 255, .14); color: #64D2FF; font-weight: 700; font-size: 13px; }
.wh-missing { color: var(--orange); font-weight: 600; }
.wh-noprice-row td:first-child { box-shadow: inset 3px 0 0 var(--orange); }
.wh-pop { color: var(--muted); font-size: 12px; }
@media (max-width: 719px) {
  .wh-table thead { display: none; }
  .wh-table, .wh-table tbody, .wh-table tfoot, .wh-table tr, .wh-table td { display: block; }
  .wh-table tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .wh-table tbody td { border: 0; padding: 0; }
  .wh-table tbody td.wh-name { grid-column: 1 / -1; font-weight: 600; font-size: 15px; }
  .wh-table tbody td[data-label]:not(.wh-name)::before { content: attr(data-label) ": "; color: var(--muted); font-size: 12px; font-weight: 400; }
  .wh-table tbody td.num { text-align: left; white-space: normal; }
  .wh-table tfoot tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
  .wh-table tfoot td { border: 0; padding: 0; }
  .wh-table tfoot td:first-child { grid-column: 1 / -1; }
  .wh-table tfoot td:empty { display: none; }
  .wh-table tfoot td.num { font-size: 17px; text-align: left; }
}
.wh-pgroup { margin-top: 14px; }
.wh-pgroup-title { display: flex; align-items: center; gap: 8px; font-size: 17px; margin: 0; }
.wh-count { font-size: 13px; padding: 1px 9px; border-radius: 999px; background: rgba(255, 255, 255, .12); }
.wh-urgent .wh-pgroup-title { color: var(--red); }
.wh-plan .wh-pgroup-title { color: var(--orange); }
.wh-pcards { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 8px; }
@media (min-width: 720px) { .wh-pcards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.wh-pcard { padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, .05); display: grid; gap: 6px; min-width: 0; }
.wh-urgent .wh-pcard { box-shadow: inset 3px 0 0 var(--red); }
.wh-pcard.wh-zero { background: rgba(255, 69, 58, .12); }
.wh-pname { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; justify-content: space-between; }
.wh-pstats { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0; font-size: 14px; }
.wh-pstats dt { color: var(--muted); }
.wh-pstats dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.wh-buy { font-weight: 700; color: var(--green); }
.wh-red { color: var(--red); font-weight: 700; }
.wh-green { color: var(--green); }
.wh-hlist { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; }
.wh-hrow { padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .05); display: grid; gap: 2px; }
.wh-struct { margin-top: 12px; }
.wh-struct h3 { font-size: 15px; margin: 0 0 4px; }
.wh-struct-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.wh-struct-table th, .wh-struct-table td { text-align: left; padding: 6px; border-bottom: 1px solid rgba(255, 255, 255, .08); vertical-align: top; }
body.wh-modal-open { overflow: hidden; }
.wh-modal { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .6); display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 720px) { .wh-modal { align-items: center; } }
.wh-sheet { width: min(720px, 100%); max-height: 92vh; overflow-y: auto; background: var(--card); border-radius: 22px 22px 0 0; padding: 16px; display: grid; gap: 10px; box-sizing: border-box; }
@media (min-width: 720px) { .wh-sheet { border-radius: 22px; } }
.wh-sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.wh-op-results { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; max-height: 240px; overflow-y: auto; }
.wh-pick { width: 100%; text-align: left; border: 0; border-radius: 10px; padding: 8px 10px; background: rgba(255, 255, 255, .06); color: var(--text); font: inherit; cursor: pointer; }
.wh-pick-name { font-weight: 600; }
.wh-op-lines { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.wh-op-line { padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, .05); display: grid; gap: 6px; }
.wh-op-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.wh-op-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wh-field { display: grid; gap: 3px; font-size: 12px; color: var(--muted); }
.wh-field input, .wh-field textarea { color: var(--text); }
.wh-op-calc { margin: 0; }
.wh-op-totals { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .08); font-size: 14px; }
.wh-op-totals strong { font-variant-numeric: tabular-nums; }
.wh-mode-test { padding: 8px 12px; border-radius: 12px; background: rgba(100, 210, 255, .14); color: #64D2FF; }
.wh-test-badge { display: inline-block; margin-right: 6px; padding: 0 6px; border-radius: 6px; background: rgba(100, 210, 255, .2); color: #64D2FF; font-size: 11px; font-weight: 700; }
.wh-diag { margin-top: 10px; }
.wh-diag summary { cursor: pointer; }
.wh-raw td { white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }

/* Действительные заказы и сверка «До / После» */
.k-counts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
@media (min-width: 720px) { .k-counts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.k-count { display: grid; gap: 2px; padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, .05); min-width: 0; }
.k-count strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.kpi-check { margin-top: 10px; }
.kpi-check summary { cursor: pointer; font-weight: 600; }
.kpi-check-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 6px; }
.kpi-check-table th, .kpi-check-table td { text-align: left; padding: 6px; border-bottom: 1px solid rgba(255, 255, 255, .08); font-variant-numeric: tabular-nums; }
.kpi-check-table td { white-space: nowrap; }

/* Компактная главная: KPI сверху, сервисные блоки — в сворачиваемом «Инструменты». */
.kpis { gap: 10px; }
.kpi { padding: 14px 16px; }
.kpi h3 { margin-bottom: 4px; }
.kpi-note { margin-top: 4px; }
.kpi-wide .kpi-value { font-size: 32px; }
.tools-card { margin-top: 4px; }
.tools-sub { margin-right: auto; margin-left: 4px; }
.tools-alert { display: none; }
.tools-card:has(.tools-body .alert-count:not([hidden]):not(:empty), .tools-body .flag:not([hidden]), .tools-body .notice-error:not([hidden])) > .fold > summary .tools-alert { display: inline-block; }
.tools-card:has(.tools-body .alert-count:not([hidden]):not(:empty), .tools-body .flag:not([hidden])) > .fold > summary .tools-sub { display: none; }
.tools-body { display: grid; gap: 10px; }
.tools-body > .card { background: transparent; border: 1px solid var(--line); }
.tools-card > .fold:focus-within { outline: none; }
@media (max-width: 720px) {
  .tools-sub { display: none; }
  .kpi { padding: 12px 14px; }
  .kpi-wide .kpi-value { font-size: 28px; }
}

/* Наклейки — объединённые: заметное ×N, не перекрывает название. */
.lbm-head { margin: 12px 0 2px; font-size: 14px; color: var(--muted); font-weight: 600; }
.lbm-badge { display: inline-block; min-width: 38px; padding: 1px 10px; border-radius: 999px; background: var(--green); color: #fff; font-size: 16px; font-weight: 700; text-align: center; }

/* Продажи: три основных показателя, ниже — продажи, себестоимость и расходы. */
.sales-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.sales-kpis .kpi { padding: 18px; min-height: 154px; }
.sales-kpis .kpi h3 { min-height: 36px; line-height: 1.25; margin-bottom: 8px; }
.sales-kpis .kpi-value { font-size: 28px; line-height: 1.2; }
.sales-kpis .kpi-note { margin-top: 8px; }
.sales-kpis .kpi-sales .kpi-note { margin-top: 4px; font-size: 11px; line-height: 1.3; }
.sales-kpis .kpi-sales .kpi-note span { display: block; overflow-wrap: anywhere; }
.sales-kpis .kpi-net { background: linear-gradient(135deg, rgba(48, 209, 88, .14), transparent), var(--card); }
.sales-kpis .kpi-net .kpi-value { font-size: 32px; }
.sales-kpis .kpi-net .badge { display: inline-block; margin-top: 8px; }
.sales-kpis .kpi-sales h3 { color: var(--text); text-decoration: underline; text-decoration-color: var(--green); text-underline-offset: 5px; text-decoration-thickness: 2px; }
@media (max-width: 720px) {
  .sales-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .sales-kpis .kpi { padding: 14px; min-height: 134px; }
  .sales-kpis .kpi h3 { min-height: 36px; font-size: 13px; }
  .sales-kpis .kpi-value { font-size: clamp(15px, 4.3vw, 23px); white-space: nowrap; }
  .sales-kpis .kpi-net, .sales-kpis .kpi-sales { grid-column: 1 / -1; }
  .sales-kpis .kpi-net h3, .sales-kpis .kpi-sales h3 { min-height: 0; }
  .sales-kpis .kpi-net .kpi-value { font-size: clamp(28px, 8.3vw, 38px); }
  .sales-kpis .kpi-sales .kpi-value { font-size: clamp(24px, 7vw, 32px); }
}
@media (max-width: 359px) {
  .sales-kpis { grid-template-columns: minmax(0, 1fr); }
  .sales-kpis .kpi { min-height: 118px; }
  .sales-kpis .kpi h3 { min-height: 0; }
  .sales-kpis .kpi-value { font-size: clamp(20px, 7vw, 26px); }
}

/* Компактная шапка периода (mobile first): статус и «Обновить» в одной строке с «О расчёте». */
.period-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; align-items: center; padding: 6px 12px; }
.period-card > .month-nav, .period-card > .period-picker, .period-card > .about[open] { grid-column: 1 / -1; }
.period-card .month-nav { grid-template-columns: 40px 1fr 40px; gap: 4px; }
.period-card .btn-icon { width: 40px; min-height: 40px; height: 40px; }
.period-card .period-title { min-height: 40px; font-size: 19px; }
.period-card .report-meta { margin-top: 0; gap: 6px; flex-wrap: nowrap; min-width: 0; grid-row: 2; grid-column: 1; }
.period-card .report-meta #report-updated { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.period-card .report-meta .btn { min-height: 32px; padding: 0 12px; flex: none; }
.period-card .about { margin-top: 0; grid-row: 2; grid-column: 2; }
.period-card .about[open] { grid-row: 3; }
.sales-kpis .kpi:has(#k-cost), .sales-kpis .kpi:has(#k-expenses) { min-height: 0; }
.sales-kpis .kpi:has(#k-cost) h3, .sales-kpis .kpi:has(#k-expenses) h3 { min-height: 0; }
@media (max-width: 720px) {
  .sales-kpis .kpi:has(#k-cost), .sales-kpis .kpi:has(#k-expenses) { padding: 10px 14px; min-height: 0; }
}

/* Мобильная сборка: белый экран, тёмно-синяя шапка, мягкие серые карточки. */
body.ps-open { overflow: hidden; }
.ps-screen { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: #fff; color: #16263d; --ps-blue: #1d5fd1; --ps-green: #1f9d55; }
.ps-screen[hidden] { display: none; }
.ps-head { background: #1b2c45; color: #fff; padding: calc(8px + env(safe-area-inset-top)) 12px 8px; flex: none; }
.ps-head-row { display: flex; align-items: center; gap: 8px; }
.ps-title { margin: 0; font-size: 17px; flex: none; outline: none; }
.ps-save { flex: 1; min-width: 0; font-size: 12px; color: #c3cede; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-save-error { color: #ffb4bf; font-weight: 700; white-space: normal; }
.ps-save-saved { color: #9be3b4; }
.ps-hbtn { min-height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid #4a5b75; background: transparent; color: #fff; font: inherit; font-size: 13px; }
.ps-meta { margin: 4px 0 6px; font-size: 13px; color: #c3cede; }
.ps-bar { height: 4px; border-radius: 2px; background: #3a4c66; overflow: hidden; }
.ps-bar span { display: block; height: 100%; width: 0; background: #4cd08a; transition: width .2s; }
.ps-archive { flex: none; max-height: 40vh; overflow: auto; padding: 8px 12px; background: #f1f5f9; border-bottom: 1px solid #d8dee6; }
.ps-arch { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; }
.ps-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 8px 10px calc(16px + env(safe-area-inset-bottom)); background: #fff; }
.ps-foot { flex: none; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid #d8dee6; background: #fff; }
.ps-finish { width: 100%; min-height: 48px; background: #1b2c45; color: #fff; font-weight: 700; }
.ps-h { margin: 14px 2px 6px; font-size: 15px; color: #1b2c45; }
.ps-legend { margin: 4px 2px; font-size: 13px; color: #5b6b80; }
.ps-legend ul { margin: 4px 0 0; padding-left: 18px; columns: 2; }
.ps-row { margin: 0 0 16px; padding: 12px; border-radius: 14px; background: #f3f5f8; border: 1px solid #c3ccd8; box-shadow: 0 2px 0 #dfe5ed; }
.ps-row.picked { background: #e3f6e9; border: 2px solid #8fd6a8; padding: 11px; box-shadow: 0 2px 0 #c9ead3; }
.ps-row.needfix { box-shadow: inset 0 0 0 2px #e0a800; }
.ps-nums { display: grid; grid-template-columns: 1.55fr .9fr .9fr 1.05fr; gap: 6px; }
.ps-f { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; min-height: 68px; padding: 6px 2px; border-radius: 10px; background: #fff; border: 1px solid #e1e6ee; }
.ps-cap { font-size: 10px; color: #7a8798; text-transform: uppercase; letter-spacing: .02em; }
.ps-val { font-size: 22px; line-height: 1.15; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ps-cell { background: #eef4ff; border-color: #c4d6f7; }
.ps-cell .ps-val { color: var(--ps-blue); font-size: 24px; letter-spacing: -.01em; }
.ps-cell.ps-none .ps-val { color: #8a5200; font-size: 15px; }
.ps-struck .ps-val { text-decoration: line-through; opacity: .6; }
.ps-basket .ps-val { color: var(--ps-blue); font-size: 30px; }
.ps-qty .ps-val { color: #16263d; }
.ps-qty.many { background: #fde8ec; border-color: #f2b8c3; }
.ps-qty.many .ps-val { color: #c0182f; font-size: 34px; font-weight: 900; }
@media (max-width: 340px) { .ps-val { font-size: 19px; } .ps-cell .ps-val { font-size: 20px; } .ps-basket .ps-val { font-size: 25px; } .ps-qty.many .ps-val { font-size: 28px; } }
.ps-aroma { display: grid; margin: 8px 2px 6px; }
.ps-brand { font-size: 12px; color: #6b7a8e; }
.ps-name { font-size: 18px; line-height: 1.2; overflow-wrap: anywhere; }
.ps-note { margin: 0 2px 6px; font-size: 12px; color: #8a5200; }
.ps-warn { color: #b00020; font-weight: 700; }
.ps-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.ps-check { flex: 1 1 130px; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 12px; border-radius: 12px; border: 2px solid #cfd6df; background: #fff; color: #16263d; font: inherit; font-size: 16px; font-weight: 600; text-align: left; }
.ps-box { flex: none; width: 30px; height: 30px; border-radius: 8px; border: 2px solid #9aa6b5; display: grid; place-items: center; font-size: 20px; line-height: 1; color: #fff; }
.ps-check.on { border-color: var(--ps-green); }
.ps-check.on .ps-box { background: var(--ps-green); border-color: var(--ps-green); }
.ps-check.ps-label.on { border-color: var(--ps-blue); }
.ps-check.ps-label.on .ps-box { background: var(--ps-blue); border-color: var(--ps-blue); }
.ps-nocell, .ps-undo { flex: 1 1 130px; min-height: 52px; border-radius: 12px; border: 2px solid #e5b8a0; background: #fff4ec; color: #8a3b00; font: inherit; font-size: 15px; font-weight: 600; }
.ps-undo { border-color: #cfd6df; background: #fff; color: #16263d; }
.ps-check:focus-visible, .ps-nocell:focus-visible, .ps-undo:focus-visible, .ps-hbtn:focus-visible { outline: 3px solid #0A84FF; outline-offset: 2px; }
.ps-labelbar { margin: 10px 0 24px; padding: 10px; border-radius: 12px; background: #f3f5f8; display: grid; gap: 8px; }
.ps-count { margin: 0; font-weight: 700; }
.ps-labelbtns { display: flex; gap: 8px; }
.ps-genlabels { min-height: 48px; }
.ps-banner { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
@media (min-width: 720px) { .ps-body { max-width: 760px; width: 100%; margin: 0 auto; } }

/* ---------- Рост до 820 000 zł ---------- */
.gr-months { display: flex; align-items: center; gap: 8px; }
.gr-month { min-width: 110px; text-align: center; }
.gr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 12px 0; }
.gr-kpi { background: var(--card-2); border-radius: 16px; padding: 14px; min-width: 0; }
.gr-kpi-label { margin: 0 0 4px; font-size: 12px; color: var(--muted); }
.gr-kpi-value { margin: 0; font-size: 24px; font-weight: 700; line-height: 1.15; word-break: break-word; }
.gr-kpi-sub { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.gr-kpi.gr-hero { grid-column: 1 / -1; }
.gr-hero .gr-kpi-value { font-size: 34px; }
.gr-bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin-top: 8px; }
.gr-bar span { display: block; height: 100%; background: var(--green); }
.gr-warnings { display: grid; gap: 8px; }
.gr-warn { margin: 0; padding: 10px 14px; border-radius: 14px; background: rgba(255, 159, 10, .14); color: var(--orange); font-size: 14px; }
.gr-warn.info { background: var(--card-2); color: var(--muted); }
.gr-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.gr-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.gr-table th, .gr-table td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.gr-table th:first-child, .gr-table td:first-child { text-align: left; }
.gr-table th { color: var(--muted); font-weight: 500; font-size: 12px; }
.gr-form { display: grid; gap: 12px; max-width: 420px; margin: 12px 0; }
.gr-form label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.gr-off { opacity: .7; }
.mk-sources { display: grid; gap: 14px; margin: 16px 0; }
.mk-source { padding: 16px; background: var(--card-2); border: 1px solid var(--line); border-radius: 16px; min-width: 0; }
.mk-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.mk-heading h3 { font-size: 17px; margin: 0; }
.mk-badge { font-size: 12px; border-radius: 20px; padding: 5px 9px; background: var(--card); color: var(--muted); }
.mk-connected { color: #188c50; }
.mk-error { color: #d94848; }
.mk-syncing { color: #3c86e7; }
.mk-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 14px; margin: 14px 0; }
.mk-metrics > div { display: grid; gap: 4px; }
.mk-metrics strong { font-size: 21px; overflow-wrap: anywhere; }
.mk-report { margin: 12px 0; }
.mk-report summary, .mk-setup summary { cursor: pointer; padding: 8px 0; font-weight: 600; }
.mk-source td:first-child, .mk-source th:first-child { white-space: normal; overflow-wrap: anywhere; min-width: 140px; max-width: 240px; }
.mk-setup { border-top: 1px solid var(--line); padding-top: 10px; }
#mk-google-email { overflow-wrap: anywhere; }
#mk-form input { width: 100%; min-width: 0; }
@media (max-width: 480px) { .gr-hero .gr-kpi-value { font-size: 28px; } }
.gr-kpi-value.gr-nodata { font-size: 16px; font-weight: 500; color: var(--muted); }

/* Przelewy24 — сводка по отчётам (вкладка «Сверка платежей») */
.p24s-sub { font-size: 17px; font-weight: 600; margin: 18px 0 10px; }
.p24s-alert { margin: 10px 0 0; padding: 12px 16px; font-size: 14px; }
.p24s-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.p24s-kpis .kpi { background: var(--card-2); }
.p24s-kpis .kpi-main { outline: 2px solid var(--green); outline-offset: -2px; }
/* «Не оплачено» — справочный показатель: в итоги не входит, поэтому оформлен отдельно от остальных. */
.p24s-kpis .kpi-aside { background: transparent; outline: 1px dashed var(--line); outline-offset: -1px; }
.p24s-kpis .kpi-aside .kpi-value { color: var(--muted); }
.p24s-table .p24s-aside { color: var(--muted); border-left: 1px dashed var(--line); padding-left: 12px; }
.p24s-notes { margin: 10px 0 0; padding-left: 18px; color: var(--muted); display: grid; gap: 4px; overflow-wrap: anywhere; }
.p24s-notes:empty { display: none; }
.p24s-notes .p24s-warn { color: var(--text); }
.p24s-open { margin: 4px 0; }
.p24s-month { margin: 22px 0 8px; }
.p24s-month-title { margin: 0; text-align: center; }
.p24s-table tbody tr { cursor: pointer; }
.p24s-table tbody tr:hover td, .p24s-table tbody tr:focus-visible td { background: var(--card-2); }
.p24s-table tbody tr:focus-visible { outline: 2px solid #0A84FF; outline-offset: -2px; }
.p24s-table tbody tr.selected td { background: var(--card-2); font-weight: 600; }
.p24s-table tfoot td { font-weight: 700; border-top: 2px solid var(--line); }
.p24s-raw-table th, .p24s-raw-table td { white-space: nowrap; padding-right: 14px; }
@media (max-width: 720px) {
  .p24s-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .p24s-opt { display: none; }
  /* Пять колонок должны помещаться на экране телефона без прокрутки. */
  .p24s-table { font-size: 12px; }
  .p24s-table th { font-size: 11px; }
  .p24s-table th, .p24s-table td { padding-left: 1px; padding-right: 1px; }
  .p24s-table .num { padding-left: 5px; }
}
