/* Оттепель v0.32 — поверх style.css, v030.css, v031.css.
   «Сегодня», график и показатели в Статистике, шапка карточки Табеля.
   Правила те же: один цвет — один смысл (медовый — только деньги, зелёный — в порядке, красный — нужна реакция),
   «в темпе / отстаём» — словом и значком, не только цветом; нажимаемое от 44 px, текст не меньше 11 px. */

.ico.sm { width: 14px; height: 14px; stroke-width: 2.4; flex: none; }
.s-muted { color: var(--ink-muted); }
.ok-text { color: var(--green); }
.up { color: var(--green); font-weight: 700; }
.dn { color: var(--danger); font-weight: 700; }

/* Плашки состояния: слово + значок */
.tpill { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; padding: 4px 9px; border-radius: 20px; white-space: nowrap; background: var(--surface-alt); color: var(--ink-muted); }
.tpill.ok { background: var(--green-bg); color: var(--green); }
.tpill.bad { background: var(--danger-bg); color: var(--danger); }
.tpill.gd { background: var(--gold-bg); color: var(--gold); }
.tpill.no { background: var(--surface-alt); color: var(--ink-muted); }

/* ---------- Сегодня ---------- */
.td-plan { padding: 12px 16px; display: grid; gap: 8px; }
.td-plan-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.td-plan-name { font-size: 16px; font-weight: 600; }
.td-plan-name small { font-size: 13px; font-weight: 400; color: var(--ink-muted); }
.td-plan-foot { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 14px; color: var(--ink-muted); }
.td-plan-foot b { color: var(--ink); }
.td-head { display: flex; justify-content: space-between; align-items: center; padding: 0 4px; }
.td-head .group-title { padding: 0; }
.td-link { min-height: 44px; padding: 0 4px 0 12px; border: 0; background: none; color: var(--accent); font-size: 15px; font-weight: 600; }
.td-row { display: flex; gap: 12px; align-items: flex-start; min-height: 56px; padding: 10px 16px; }
.td-lab { width: 58px; flex: none; font-size: 15px; color: var(--ink-muted); padding-top: 4px; }
.td-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-s { display: inline-flex; align-items: center; font-size: 15px; padding: 4px 10px; border-radius: 10px; background: var(--surface-alt); color: var(--ink); }
.chip-s.gold { background: var(--gold-bg); color: var(--gold); font-weight: 600; }
.s-vac { font-size: 15px; color: var(--ink); padding-top: 4px; }
.td-empty { margin: 0; border-radius: 0; }
.td-ev { width: 100%; display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border: 0; background: var(--surface); color: inherit; text-align: left; font: inherit; min-height: 64px; }
.td-ev:active { background: var(--surface-alt); }
.td-ev.now { background: var(--accent-soft); }
.td-evd { width: 46px; flex: none; display: flex; flex-direction: column; align-items: center; border-radius: 10px; background: var(--surface-alt); padding: 6px 0; line-height: 1.1; }
.td-evd b { font-size: 20px; }
.td-evd small { font-size: 12px; color: var(--ink-muted); }
.td-ev.now .td-evd { background: var(--accent); color: var(--on-accent); }
.td-ev.now .td-evd small { color: var(--on-accent); }
.td-evt { flex: 1; min-width: 0; display: grid; gap: 2px; }
.td-evn { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.td-evm { font-size: 14px; color: var(--ink-muted); }
.td-evp { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }

/* ---------- Статистика: график по дням ---------- */
.box-s { background: var(--surface); border-radius: 14px; padding: 14px 16px; display: grid; gap: 10px; box-shadow: var(--shadow); }
.box-s.kvs { gap: 2px; }
.dc-cap { display: flex; justify-content: flex-end; font-size: 13px; }
.dc { display: flex; gap: 6px; }
.dc-y { display: flex; flex-direction: column; justify-content: space-between; height: 130px; width: 28px; font-size: 12px; color: var(--ink-muted); text-align: right; flex: none; }
.dc-plot { position: relative; flex: 1; min-width: 0; height: 130px; display: flex; align-items: flex-end; gap: 3px; border-bottom: 1px solid var(--hatch-line, var(--border)); }
/* Столбики не светлее #4F8E99 (контраст с фоном не ниже 3,7:1): без прозрачности; в светлой теме последний день — чуть насыщеннее */
:root { --bar: #3D7C88; --bar-last: #1C6875; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bar: #4F8E99; --bar-last: #4F8E99; } }
:root[data-theme="dark"] { --bar: #4F8E99; --bar-last: #4F8E99; }
.db { flex: 1; min-width: 0; border-radius: 3px 3px 0 0; background: var(--bar); }
.db.last { background: var(--bar-last); }
.db.missing { background: transparent; box-shadow: inset 0 0 0 1px var(--danger); opacity: 1; }
.db.pending { background: transparent; box-shadow: inset 0 0 0 1px var(--border); opacity: 1; }
.dc-need { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--accent); pointer-events: none; }
.dc-need span { position: absolute; right: 0; bottom: 2px; font-size: 12px; font-weight: 700; color: var(--accent); background: var(--surface); padding: 0 4px; }
.dc-x { display: flex; justify-content: space-between; padding-left: 34px; font-size: 12px; color: var(--ink-muted); margin-top: -4px; }
.dc-box { display: flex; gap: 10px; align-items: flex-start; border-radius: 10px; padding: 10px 12px; font-size: 15px; line-height: 1.4; }
.dc-box .ico { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.dc-box.ok { background: var(--green-bg); }
.dc-box.ok .ico, .dc-box.ok b:first-child { color: var(--green); }
.dc-box.bad { background: var(--danger-bg); }
.dc-box.bad .ico, .dc-box.bad b:first-child { color: var(--danger); }
.dc-box.no { background: var(--surface-alt); }

/* v0.34.4: график «по этажам» — этаж 1 над нулём, этаж 2 под нулём; серый — обычный день, зелёный — выше 100 тыс. на этаже.
   Серый и зелёный не светлее #4F8E99 по яркости (тест tests/design-rules.test.js). */
:root { --bar-grey: #5C6B73; --bar-hi: #2E8B57; --bar-shop: #2F6DA3; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bar-grey: #8C9BA3; --bar-hi: #3FA36A; --bar-shop: #6FA8DC; } }
:root[data-theme="dark"] { --bar-grey: #8C9BA3; --bar-hi: #3FA36A; --bar-shop: #6FA8DC; }
.dc-heads { display: grid; gap: 2px; font-size: 14px; margin-bottom: 18px; }
.dc-heads b { font-variant-numeric: tabular-nums; }
.dc-y.fl { position: relative; height: 260px; width: 40px; display: block; }
.dc-y.fl span { position: absolute; right: 0; transform: translateY(50%); line-height: 1; }
.dc-plot.fl { position: relative; flex: 1; min-width: 0; height: 260px; border-bottom: 0; }
.dc-plot.fl .dzero { position: absolute; left: 0; right: 0; bottom: 50%; border-top: 1px solid var(--hatch-line, var(--border)); }
.dc-plot.fl .dlim { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--ink-muted); pointer-events: none; }
.dcols { position: absolute; inset: 0; display: flex; gap: 3px; }
.dcol { position: relative; flex: 1; min-width: 0; }
.dup, .ddn { position: absolute; left: 0; right: 0; display: flex; }
.dup { top: 0; bottom: 50%; align-items: flex-end; }
.ddn { top: 50%; bottom: 0; align-items: flex-start; }
.dc-plot.fl .db { position: relative; background: var(--bar-grey); border-radius: 3px 3px 0 0; }
.dc-plot.fl .ddn .db { border-radius: 0 0 3px 3px; }
.dc-plot.fl .db.hi { background: var(--bar-hi); }
/* v0.34.6: график магазина по дням — один столбик на день, оба этажа */
.chart-seg { margin-bottom: 4px; }
.dc-plot.shop { position: relative; flex: 1; min-width: 0; height: 260px; margin-bottom: 18px; border-bottom: 1px solid var(--hatch-line, var(--border)); }
.dc-plot.shop .dcols { position: absolute; inset: 0; display: flex; gap: 3px; }
.dc-plot.shop .dcol { position: relative; flex: 1; min-width: 0; }
.dc-plot.shop .sbar { position: absolute; left: 0; right: 0; bottom: 0; background: var(--bar-shop); border-radius: 3px 3px 0 0; }
.dc-plot.shop .dnum { top: auto; bottom: -18px; transform: translateX(-50%); }
.dc-plot.fl .db.stub { position: absolute; left: 0; right: 0; bottom: 50%; height: 6%; background: transparent; border-radius: 0; box-shadow: inset 0 0 0 1px var(--border); }
.dc-plot.fl .db.missing.stub { box-shadow: inset 0 0 0 1px var(--danger); }
.dnum { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 11px; line-height: 1; color: var(--ink-muted); background: var(--surface); padding: 0 1px; z-index: 1; }
.dv { position: absolute; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 700; line-height: 1; color: var(--bar-hi); white-space: nowrap; }
.dv.up { bottom: 100%; margin-bottom: 2px; }
.dv.dn { top: 100%; margin-top: 2px; }

/* ---------- Статистика: дни недели ---------- */
.wd-row { display: flex; align-items: center; gap: 10px; min-height: 30px; font-size: 15px; }
.wd-l { width: 24px; color: var(--ink-muted); }
.wd-bar { flex: 1; height: 8px; background: var(--surface-alt); border-radius: 4px; overflow: hidden; }
.wd-bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.wd-v { width: 64px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Табель: шапка карточки — всего с премиями, под ним из чего сложилось ---------- */
.ts-sum { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.ts-split { font-size: 13px; color: var(--ink-muted); font-variant-numeric: tabular-nums; text-align: right; font-weight: 400; }

@media (prefers-contrast: more) {
  .db.pending { box-shadow: inset 0 0 0 1px var(--ink-muted); }
}

/* ---------- v0.33.2: свёрнутые блоки Статистики («Сравнение», «По дням недели», «Скидки и категории») ---------- */
details.fold > summary.fold-head { list-style: none; display: flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
details.fold > summary.fold-head::-webkit-details-marker { display: none; }
.fold-hint { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fold-chev { margin-left: auto; flex: none; width: 18px; height: 18px; transition: transform .2s; }
details.fold[open] > summary .fold-chev { transform: rotate(180deg); }
details.fold[open] > summary .fold-hint { display: none; }
@media (prefers-reduced-motion: reduce) { .fold-chev { transition: none; } }
