.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    border: 1px solid var(--line-strong);
    border-radius: var(--pill);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease);
}
.btn:hover { border-color: var(--ink-muted); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.42; cursor: default; transform: none; }

.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }

.btn--danger { border-color: var(--danger); color: var(--danger); }
.btn--danger:hover { background: var(--danger); color: var(--on-accent); }

.btn--ghost { border-color: transparent; background: transparent; }
.btn--ghost:hover { background: var(--surface-sunken); border-color: transparent; }

.btn--sm { padding: 5px 13px; font-size: 12px; }
.btn--icon { gap: 0; padding-left: 9px; padding-right: 9px; }
.btn--icon::before { content: "\200B"; }
.btn--icon svg { width: 16px; height: 16px; }
.btn--block { width: 100%; }

.refresh__icon { display: inline-flex; }
.refresh__label { position: relative; display: inline-block; }
.refresh__line {
    position: absolute;
    left: 12%;
    right: 12%;
    bottom: -3px;
    height: 2px;
    border-radius: 1px;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.2s var(--ease);
}
.refresh__line::before,
.refresh__line::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 1px;
    background: currentColor;
}
.refresh__line::before { opacity: 0.22; }
.refresh__line::after { transform: translateX(-90%); }
.refresh--busy:disabled { opacity: 1; color: var(--ink); }
.refresh--busy .refresh__icon { animation: refresh-spin 1.1s linear infinite; }
.refresh--busy .refresh__text {
    background: linear-gradient(to right, var(--ink-muted) 35%, var(--ink) 50%, var(--ink-muted) 65%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: refresh-shine 1.6s cubic-bezier(0.1, 0.6, 0.9, 0.4) infinite;
}
.refresh--busy .refresh__line { opacity: 1; }
.refresh--busy .refresh__line::after { animation: refresh-wobble 1.6s cubic-bezier(0.5, 0.8, 0.5, 0.2) infinite; }
@keyframes refresh-spin { to { transform: rotate(360deg); } }
@keyframes refresh-shine {
    from { background-position: 102% 0; }
    to { background-position: -2% 0; }
}
@keyframes refresh-wobble {
    0% { transform: translateX(-90%); }
    50% { transform: translateX(90%); }
    100% { transform: translateX(-90%); }
}

.field { display: block; margin-bottom: 14px; }
.field__label {
    display: block;
    margin-bottom: 5px;
    color: var(--ink-muted);
    font-size: 12px;
    font-family: var(--font-display);
    font-weight: 400;
    letter-spacing: 0.01em;
}

.input {
    width: 100%;
    padding: 11px 18px;
    font-size: 16px;
    border: 1px solid var(--line-strong);
    border-radius: var(--pill);
    background: var(--surface);
    color: var(--ink);
    font-family: var(--font-body);
    outline: none;
    transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.input::placeholder { color: var(--ink-muted); opacity: 0.75; }
textarea.input { display: block; min-height: 72px; border-radius: var(--radius-md); line-height: 1.45; font-family: inherit; resize: vertical; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 999px; background: var(--line-strong); background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--ink-muted); }
::-webkit-resizer { background: transparent; }
@supports not selector(::-webkit-scrollbar) {
    * { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 22px 24px;
    margin-bottom: 16px;
}
.card__head { margin-bottom: 14px; }
.card__head p { color: var(--ink-muted); margin: 4px 0 0; }
.card--narrow { max-width: 460px; }

.dialog {
    width: min(520px, calc(100% - 32px));
    max-height: calc(100% - 32px);
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-pop);
}
.dialog::backdrop { background: var(--scrim); backdrop-filter: blur(4px); }
.dialog__body { padding: 22px 24px; }
.steps {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 0 0 20px;
    padding: 0;
    list-style: none;
}
.step { display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; }
.step__mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--surface-sunken);
    font-family: var(--font-mono);
    font-size: 13px;
}
.step__mark--done { border-color: transparent; background: var(--ok-soft); color: var(--ok); }
.step__mark svg { width: 16px; height: 16px; }
.step__title { font-weight: 600; }
.step__text { margin: 2px 0 8px; font-size: 14px; color: var(--ink-muted); }
.step__body > .muted { margin: 0; font-size: 13px; }
.step .row--grow { max-width: 360px; }
.dialog__hint { margin: -8px 0 12px; font-size: 13px; }

.seg {
    position: relative;
    display: inline-block;
    padding: 4px;
    border-radius: var(--pill);
    background: var(--surface-sunken);
    border: 1px solid var(--line);
}
.seg__thumb {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    border-radius: var(--pill);
    background: var(--accent);
    box-shadow: var(--shadow-card);
    transition: transform 0.34s var(--ease), width 0.34s var(--ease);
    will-change: transform, width;
}
.seg__row { display: flex; }
.seg--equal .seg__row { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
.seg__row--on {
    position: absolute;
    top: 4px;
    left: 4px;
    right: 4px;
    bottom: 4px;
    color: var(--on-accent);
    pointer-events: none;
    clip-path: inset(0 100% 0 0 round 999px);
    transition: clip-path 0.34s var(--ease);
    will-change: clip-path;
}
.seg__opt {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 22px;
    border: none;
    background: none;
    border-radius: var(--pill);
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    color: inherit;
    white-space: nowrap;
    cursor: pointer;
}
.seg__row .seg__opt { color: var(--ink-muted); }
.seg__row--on .seg__opt { color: var(--on-accent); cursor: default; }



.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    flex: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--lg { width: 60px; height: 60px; font-size: 20px; }
.avatar--xl { width: 76px; height: 76px; font-size: 24px; }
.avatar--xs { width: 22px; height: 22px; font-size: 10px; margin-right: 8px; }
/* Слой должен быть непрозрачным: иначе сквозь него видно аватарку нижнего. */
.seg__row--on .avatar--xs { background: var(--on-accent); color: var(--accent-strong); }

.tag {
    display: inline-block;
    padding: 3px 12px;
    border-radius: var(--pill);
    background: var(--surface-sunken);
    color: var(--ink-muted);
    font-size: 12px;
    white-space: nowrap;
}
.tag--pending { background: var(--warn-soft); color: var(--warn); }
.tag--approved { background: var(--ok-soft); color: var(--ok); }
.tag--rejected { background: var(--danger-soft); color: var(--danger); }

.badge {
    display: inline-block;
    min-width: 18px;
    margin-left: 7px;
    padding: 0 6px;
    border-radius: var(--pill);
    background: var(--danger);
    color: var(--on-accent);
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
}
.badge[hidden] { display: none; }

.notice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    font-size: 13px;
}
.notice--error { background: var(--danger-soft); color: var(--danger); }
.notice--ok { background: var(--ok-soft); color: var(--ok); }
.notice--warn { background: var(--warn-soft); color: var(--warn); }

.toasts {
    position: fixed;
    right: 20px;
    bottom: calc(20px + env(safe-area-inset-bottom));
    z-index: 40;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    max-width: min(420px, calc(100vw - 40px));
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-float);
    font-size: 13px;
    line-height: 1.35;
    cursor: pointer;
    pointer-events: auto;
    animation: toast-in 0.3s var(--ease);
}
.toast--ok { background: var(--ok-soft); color: var(--ok); }
.toast--error { background: var(--danger-soft); color: var(--danger); }
.toast--warn { background: var(--warn-soft); color: var(--warn); }
.toast__icon { display: inline-flex; flex: none; }
.toast__icon svg { width: 16px; height: 16px; }
.toast--bump { animation: toast-bump 0.28s var(--ease); }
.toast--leaving { opacity: 0; transform: translateY(6px); transition: opacity 0.2s var(--ease), transform 0.2s var(--ease); }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}
@keyframes toast-bump {
    0% { transform: scale(1); }
    40% { transform: scale(1.04); }
    100% { transform: scale(1); }
}

.float {
    position: fixed;
    left: 20px;
    bottom: calc(20px + env(safe-area-inset-bottom));
    z-index: 30;
    opacity: 0;
    visibility: hidden;
    transform: translateY(18px) scale(0.94);
    transition: opacity 0.24s var(--ease), transform 0.24s var(--ease), visibility 0s 0.24s;
}
.float--shown {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity 0.34s var(--ease), transform 0.34s cubic-bezier(0.2, 0.9, 0.3, 1.15), visibility 0s;
}
.float__btn {
    padding: 11px 20px 11px 16px;
    border-color: var(--tab-bg);
    background: var(--tab-bg);
    color: var(--tab-ink);
    box-shadow: var(--shadow-float);
}
.float__btn:hover { border-color: var(--tab-bg); background: var(--tab-bg); opacity: 0.9; }
.float__btn svg { width: 16px; height: 16px; }

.mode-bar {
    position: fixed;
    left: 20px;
    right: 20px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    z-index: 35;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    max-width: var(--page-max);
    margin: 0 auto;
    padding: 12px 18px;
    border: 1px solid var(--warn);
    border-radius: var(--radius-md);
    background: var(--warn-soft);
    color: var(--warn);
    box-shadow: var(--shadow-float);
    font-size: 13px;
    line-height: 1.4;
}
.mode-bar__icon { display: inline-flex; flex: none; margin-top: 1px; }
.mode-bar__icon svg { width: 18px; height: 18px; }
.mode-bar__text { display: flex; flex-direction: column; gap: 2px; }
.mode-bar__text strong { font-family: var(--font-display); font-size: 13px; font-weight: 600; }
body.has-mode-bar .page {
    padding-bottom: calc(40px + env(safe-area-inset-bottom) + var(--mode-bar-h, 0px));
}
body.has-mode-bar .float,
body.has-mode-bar .toasts {
    bottom: calc(20px + env(safe-area-inset-bottom) + var(--mode-bar-h, 0px));
}

@media (max-width: 780px) {
    .toasts {
        left: 12px;
        right: 12px;
        bottom: calc(18px + env(safe-area-inset-bottom));
        align-items: stretch;
        max-width: none;
    }
    body:has(.float--shown) .toasts { bottom: calc(76px + env(safe-area-inset-bottom)); }
    .float { left: 12px; bottom: calc(18px + env(safe-area-inset-bottom)); }

    .mode-bar { left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); padding: 11px 14px; }
    body.has-mode-bar .page {
        padding-bottom: calc(32px + env(safe-area-inset-bottom) + var(--mode-bar-h, 0px));
    }
    body.has-mode-bar .float,
    body.has-mode-bar .toasts {
        bottom: calc(14px + env(safe-area-inset-bottom) + var(--mode-bar-h, 0px));
    }
    body.has-mode-bar:has(.float--shown) .toasts {
        bottom: calc(72px + env(safe-area-inset-bottom) + var(--mode-bar-h, 0px));
    }
}

.table-scroll { overflow-x: auto; margin: 0 -24px; padding: 0 24px; }
.table { width: 100%; border-collapse: collapse; min-width: 520px; }
.table--tight { min-width: 0; }

.panel {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: var(--surface-sunken);
}
.panel + .toolbar, .panel + .table-scroll { margin-top: 14px; }
.panel__title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
}
.panel__title svg { width: 16px; height: 16px; color: var(--accent-strong); }
.tile__value--text { font-family: var(--font-body); }
.panel__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 12px; }
.panel .field { margin-bottom: 12px; }
.panel .input { background: var(--surface); }
.table__panel td { padding: 4px 0 12px; }
.table tr.is-open td { border-bottom: none; }
.toggles { display: flex; flex-direction: column; gap: 10px; margin: 2px 0 16px; }
.toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}
.toggle input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}
.toggle__track {
    position: relative;
    flex: none;
    width: 40px;
    height: 24px;
    border-radius: var(--pill);
    background: var(--line-strong);
    transition: background-color 0.24s var(--ease);
}
.toggle__track::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: var(--shadow-card);
    transition: transform 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}
.toggle input:checked + .toggle__track { background: var(--accent); }
.toggle input:checked + .toggle__track::before { transform: translateX(16px); }
.toggle:has(input:focus-visible) .toggle__track { outline: 2px solid var(--accent); outline-offset: 3px; }
.toggle__label { line-height: 1.35; }
@media (prefers-reduced-motion: reduce) {
    .toggle__track, .toggle__track::before { transition: none; }
}
.input--date { width: auto; min-width: 150px; padding-top: 7px; padding-bottom: 7px; }
.own-grid { display: grid; gap: 16px; align-items: start; }
.own-grid__col { min-width: 0; }
.own-grid > .card { min-width: 0; }
.ledger td { font-size: 13px; vertical-align: top; }
.ledger__who, .ledger__reason { font-size: 12px; margin-top: 2px; }
.ledger__when { white-space: nowrap; }
.ledger__reason { max-width: 260px; }
.ledger__delta.is-in { color: var(--ok); font-weight: 600; }
.ledger__delta.is-out { color: var(--danger); font-weight: 600; }
.stock td.name, .ledger td.name, .ledger td.num, .stock td.num { white-space: nowrap; }
@media (max-width: 780px) { .stock td.name, .ledger td.name { white-space: normal; } }

/* Переключатель дня кассы. */
.daytools { display: flex; align-items: center; gap: 8px; }
.daypick {
    display: inline-flex;
    align-items: stretch;
    flex: none;
    border: 1px solid var(--line-strong);
    border-radius: var(--pill);
    background: var(--surface);
    overflow: hidden;
}
.daypick__arrow {
    display: inline-flex;
    align-items: center;
    padding: 0 9px;
    border: 0;
    background: transparent;
    color: var(--ink-muted);
    cursor: pointer;
    transition: background-color 0.18s var(--ease), color 0.18s var(--ease);
}
.daypick__arrow:hover { background: var(--surface-sunken); color: var(--ink); }
.daypick__arrow svg { width: 14px; height: 14px; }
.daypick__label {
    position: relative;
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    width: 214px;
    justify-content: center;
    padding: 5px 10px;
    white-space: nowrap;
    overflow: hidden;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    cursor: pointer;
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 500;
    line-height: normal;
}
.daypick__label:hover { background: var(--surface-sunken); }
.daypick__name { font-weight: 600; }
.daypick__date { color: var(--ink-muted); }
.daypick__input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}
.daypick:has(.daypick__input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 780px) {
    .daytools { flex-wrap: wrap; width: 100%; }
    .daypick { order: 1; flex: 1 0 100%; }
    .daypick__label { width: auto; flex: 1; }
    .daytools__today, .daytools__refresh { order: 2; flex: 1; }
}

/* Рабочий стол кассы: записи дня — колонка сбоку, которая не уезжает при прокрутке. */
.desk { display: grid; gap: 12px; align-items: start; }
.desk__side, .desk__main { min-width: 0; }
.desk__side > .card { margin-bottom: 0; }
.entry--next { border-color: var(--accent); background: var(--accent-soft); }
@media (min-width: 1000px) {
    .desk { grid-template-columns: minmax(280px, 330px) minmax(0, 1fr); }
    .desk__side--end { grid-column: 2; }
    .desk__side {
        position: sticky;
        top: calc(var(--nav-height) + 26px);
        max-height: calc(100vh - var(--nav-height) - 44px - var(--mode-bar-h, 0px));
        overflow: auto;
    }
    .desk__side--end { position: static; max-height: none; }
}
@media (min-width: 1400px) {
    .desk { grid-template-columns: minmax(280px, 330px) minmax(0, 1fr) minmax(280px, 340px); }
    .desk__side--end {
        grid-column: auto;
        position: sticky;
        top: calc(var(--nav-height) + 26px);
        max-height: calc(100vh - var(--nav-height) - 44px - var(--mode-bar-h, 0px));
    }
}

/* Режим «Новая CRM»: плотнее и во всю ширину монитора на всех экранах одинаково. */
.is-own .topbar__inner, .is-own .notice-bar, .is-own .page, .is-own .profile-grid { max-width: none; }
.is-own .page { padding-top: 14px; }
.is-own .card { padding: 16px 18px; margin-bottom: 12px; border-radius: var(--radius-md); }
.is-own .card__head { margin-bottom: 10px; }
.is-own .toolbar--bar { margin-bottom: 12px; }
.is-own .tiles { gap: 8px; }
.is-own .tile { padding: 10px 12px; }
.is-own .entries { gap: 8px; margin-top: 10px; }
.is-own .entry { padding: 10px 12px; }
.is-own .empty { padding: 14px 12px; }
.is-own .own-grid { gap: 12px; }
.is-own .own-grid > .card, .is-own .own-grid__col > .card:last-child { margin-bottom: 0; }
.is-own .table th, .is-own .table td { padding: 8px 10px; }
.is-own .mode-bar { padding: 9px 14px; }
.is-own .mode-bar__text { flex-direction: row; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
@media (min-width: 900px) {
    .is-own .own-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.subhead {
    margin: 18px 0 6px;
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
}
.stack .line:first-child { padding-top: 4px; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.table tr:last-child td { border-bottom: none; }
.table th {
    color: var(--ink-muted);
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 400;
}
.table td.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 0.94em; }
.table td.actions { text-align: right; white-space: nowrap; }
.table td.actions .btn + .btn { margin-left: 6px; }

@media (max-width: 780px) {
    .table--stack { min-width: 0; }
    .table--stack thead { display: none; }
    .table--stack, .table--stack tbody, .table--stack tr, .table--stack td { display: block; width: 100%; }
    .table--stack tr {
        border: 1px solid var(--line);
        border-radius: var(--radius-md);
        padding: 12px 14px;
        margin-bottom: 10px;
    }
    .table--stack tr:last-child { margin-bottom: 0; }
    .table--stack td { border: none; padding: 2px 0; }
    .table--stack td[data-label]::before {
        content: attr(data-label) ": ";
        color: var(--ink-muted);
        font-family: var(--font-body);
        font-size: 12px;
    }
    .table--stack td.name { font-family: var(--font-display); font-weight: 500; margin-bottom: 4px; }
    .table--stack td.name::before { content: none; }
    .table--stack td.actions {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
        margin-top: 10px;
        text-align: left;
    }
    .table--stack td.actions .btn { flex: 1; }
    .table--stack td.actions .btn + .btn { margin-left: 0; }
}

.pager { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.pager__info { color: var(--ink-muted); font-family: var(--font-mono); font-size: 12px; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar__spacer { margin-left: auto; }

.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.theme-switch {
    font-size: 13px;
    position: relative;
    display: inline-block;
    width: 4em;
    height: 2.2em;
    border-radius: var(--pill);
    box-shadow: var(--shadow-card);
    flex: none;
}
.theme-switch input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}
.theme-switch:has(input:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: var(--pill);
}
.theme-switch__slider {
    position: absolute;
    inset: 0;
    cursor: pointer;
    border-radius: var(--pill);
    background: #2a2f36;
    overflow: hidden;
    transition: background-color 0.4s var(--ease);
}
.theme-switch__slider::before {
    position: absolute;
    content: "";
    height: 1.2em;
    width: 1.2em;
    left: 0.5em;
    bottom: 0.5em;
    border-radius: 50%;
    box-shadow: inset 8px -4px 0 0 #f4f6f8;
    transition: transform 0.4s cubic-bezier(0.81, -0.04, 0.38, 1.5),
                box-shadow 0.4s var(--ease);
}
.theme-switch input:checked + .theme-switch__slider { background: #4aa3ff; }
.theme-switch input:checked + .theme-switch__slider::before {
    transform: translateX(1.8em);
    box-shadow: inset 15px -4px 0 15px #ffcf48;
}
.theme-switch__star {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #fff;
    transition: opacity 0.4s var(--ease);
}
.theme-switch__star:nth-of-type(1) { left: 2.5em; top: 0.5em; }
.theme-switch__star:nth-of-type(2) { left: 2.2em; top: 1.2em; }
.theme-switch__star:nth-of-type(3) { left: 3em; top: 0.9em; }
.theme-switch input:checked ~ .theme-switch__slider .theme-switch__star { opacity: 0; }
.theme-switch__cloud {
    position: absolute;
    width: 3.5em;
    bottom: -1.4em;
    left: -1.1em;
    opacity: 0;
    transition: opacity 0.4s var(--ease);
}
.theme-switch input:checked ~ .theme-switch__slider .theme-switch__cloud { opacity: 1; }

/* Стол склада и админки: главное слева, журнал или настройки — колонкой справа, которая не уезжает. */
.desk__main > .card:last-child { margin-bottom: 0; }
@media (min-width: 1000px) {
    .desk--end { grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); }
    .desk--end .desk__side--end {
        grid-column: auto;
        position: sticky;
        top: calc(var(--nav-height) + 26px);
        max-height: calc(100vh - var(--nav-height) - 44px - var(--mode-bar-h, 0px));
        overflow: auto;
    }
}
.daytools .refresh { border-color: var(--line-strong); background: var(--surface); }
.daytools .refresh:hover { border-color: var(--ink-muted); }

/* Период: быстрые кнопки и две даты. */
.period { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; margin-bottom: 12px; }
.period .chips { margin-top: 0; }
.period__dates { display: inline-flex; align-items: center; gap: 6px; }
.chip--tap.is-on { background: var(--tab-bg); color: var(--tab-ink); border-color: var(--tab-bg); }

/* Подвкладки админки и экран отчётов: меню разделов слева, отчёт справа. */
.subtabs { margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.subtabs::-webkit-scrollbar { display: none; }
.seg--sub { background: var(--surface); }
.seg--sub .seg__row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(128px, 1fr); }
.reports { display: grid; gap: 16px; align-items: start; }
.reports__nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.reports__nav::-webkit-scrollbar { display: none; }
.reports__link {
    padding: 9px 14px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--ink-muted);
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.18s var(--ease), color 0.18s var(--ease);
}
.reports__link:hover { background: var(--surface); color: var(--ink); }
.reports__link[aria-current="page"] { background: var(--tab-bg); color: var(--tab-ink); }
.reports__body { margin-bottom: 0; min-width: 0; }
@media (min-width: 900px) {
    .reports { grid-template-columns: 200px minmax(0, 1fr); }
    .reports__nav { flex-direction: column; position: sticky; top: calc(var(--nav-height) + 26px); overflow: visible; }
}
.filters { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 14px; }
.filters .chips { margin-top: 0; }
.filters .input { width: auto; padding-top: 8px; padding-bottom: 8px; }
.filters .input--search { min-width: 180px; }
.filters__gap { width: 4px; }
.table--fit { width: auto; min-width: 0; }
.table--fit th, .table--fit td { white-space: nowrap; }
.table--fit td.name { white-space: normal; min-width: 180px; max-width: 360px; }
.totals-grid { display: grid; gap: 0 32px; }
@media (min-width: 900px) { .totals-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.station-screen { display: grid; gap: 16px; align-items: start; }
.station-screen > .card { margin-bottom: 0; min-width: 0; }
@media (min-width: 1000px) { .station-screen { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 780px) {
    .table--fit.table--stack { width: 100%; }
    .table--fit.table--stack td.name { max-width: none; }
    .reports__link { flex: none; }
    .period__dates { width: 100%; }
    .period__dates .input { flex: 1; min-width: 0; }
}

/* Полоса управления над таблицей: всё в одну линию, действия справа. */
.strip { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; margin-bottom: 14px; }
.strip .period { margin-bottom: 0; }
.strip .input { width: auto; padding-top: 8px; padding-bottom: 8px; }
.strip .input--search { min-width: 180px; }
.invoice > .input { width: 100%; margin-top: 10px; }
.invoice .picks { margin-top: 6px; }
.invoice__line .line__tools { flex: none; }
.invoice__num { width: 110px; padding: 6px 10px; }
.filters__csv { margin-left: auto; }
.row--wrap { flex-wrap: wrap; }
.refund .pays { margin: 12px 0; }
.refund > .input { width: 100%; }
@media (max-width: 780px) {
    .invoice__line { flex-wrap: wrap; }
    .invoice__line .line__tools { width: 100%; }
    .invoice__num { flex: 1; width: auto; }
}
.strip > .input:first-child { flex: 1; min-width: 200px; max-width: 360px; }
.strip__end { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.card__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.panel__actions { display: flex; justify-content: flex-end; gap: 10px; }
.btn--md { padding: 7px 15px; font-size: 13px; }
@media (max-width: 780px) {
    .strip > .input:first-child { max-width: none; flex-basis: 100%; }
    .strip__end { width: 100%; margin-left: 0; }
    .strip__end .btn { flex: 1; }
    .card__actions .btn, .panel__actions .btn { flex: 1; }
}
.archive th, .archive td { font-size: 13px; }
.archive td.name { min-width: 150px; white-space: normal; }
.archive__meta { font-size: 12px; margin-top: 2px; }
.archive td.num.is-null { color: var(--ink-muted); }
.archive td.is-neg { color: var(--danger); }
.archive tfoot td { font-weight: 600; border-top: 1px solid var(--line-strong); border-bottom: none; }
.archive tfoot td.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 0.94em; text-align: right; }
@media (max-width: 780px) {
    .archive tfoot { display: block; }
    .archive tfoot tr { display: block; border: 1px solid var(--line-strong); border-radius: var(--radius-md); padding: 12px 14px; margin-top: 10px; }
    .archive tfoot td { display: block; width: 100%; border: none; padding: 2px 0; text-align: left; }
    .archive tfoot td[data-label]::before { content: attr(data-label) ": "; color: var(--ink-muted); font-family: var(--font-body); font-weight: 400; font-size: 12px; }
    .archive tfoot td:empty { display: none; }
}

/* Правила станции и посты. */
.subhead--first { margin-top: 0; }
.rules { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.rules .input { padding: 8px 14px; }
.rules__window { flex-wrap: nowrap; }
.rules__window .input { flex: 1; min-width: 0; width: auto; }
.posts { display: flex; flex-direction: column; }
.post { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line); }
.post__name { flex: 1 1 160px; min-width: 0; display: flex; align-items: center; gap: 10px; font-size: 14px; }
.post__actions { margin-left: auto; }
.post--off .post__name { color: var(--ink-muted); }
.post__actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.post .input { flex: 1; width: auto; padding: 8px 14px; }
.post--new { border-bottom: none; padding-bottom: 0; }

.station-screen__side { display: grid; gap: 16px; align-content: start; min-width: 0; }
.station-screen__side > .card { margin-bottom: 0; min-width: 0; }
.cashiers { display: flex; flex-direction: column; }
.cashier { display: grid; grid-template-columns: minmax(120px, 0.8fr) minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cashier:last-child { border-bottom: none; padding-bottom: 0; }
.cashier--off { opacity: 0.6; }
.cashier__who { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; font-size: 14px; }
.cashier__login { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cashier .input { padding: 8px 14px; }
.tag--warn { background: var(--warn-soft); color: var(--warn); }
@media (max-width: 780px) {
    .cashier { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .cashier__who { grid-column: 1 / -1; }
    .cashier .post__actions { grid-column: 1 / -1; }
}
.stock td.actions .btn + .btn { margin-left: 6px; }
.mirror-note { display: flex; gap: 8px; align-items: flex-start; margin: -4px 0 12px; }
.pending { border-color: var(--warn); }
.pending__icon { display: inline-flex; vertical-align: -2px; margin-right: 6px; color: var(--warn); }
.pending__icon svg { width: 16px; height: 16px; }
.reconcile__section { margin-top: 12px; }
.reconcile__section .subhead { margin-bottom: 2px; }
.reconcile__row { align-items: center; }
.reconcile__row .line__tools { width: auto; flex: none; }
@media (max-width: 780px) {
    .reconcile__row { flex-wrap: wrap; }
    .reconcile__row .line__tools { width: 100%; }
}
.entry__action { align-self: flex-start; margin-top: 2px; }
.entry__actions { margin-top: 4px; }
.booking .input { padding: 8px 12px; }
.booking .row--grow { flex-wrap: wrap; }
.booking .row--grow > .input { flex: 1 1 110px; min-width: 0; }
.booking > .input { width: 100%; }
button.entry__title.tap-value { font-family: inherit; font-weight: inherit; }
.entry--tap { width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.line__tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.qty { display: inline-flex; align-items: center; gap: 6px; }
.qty__value { min-width: 24px; text-align: center; }
.line__discount-field { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.line__discount-input { width: 64px; padding: 5px 10px; font-size: 16px; }
.daytools__new { flex: none; }
@media (max-width: 780px) {
    .daytools__new { order: 0; flex: 1 0 100%; }
    .line:has(> .line__tools) { flex-wrap: wrap; }
    .line:has(> .line__tools) .line__main { flex: 1 1 60%; }
    .line__tools { width: 100%; justify-content: space-between; }
}
.mirror-note svg { width: 16px; height: 16px; flex: none; margin-top: 1px; color: var(--warn); }
@media (max-width: 780px) {
    .rules { grid-template-columns: minmax(0, 1fr); }
    .post { flex-wrap: wrap; }
    .post__actions { width: 100%; }
    .post__actions .btn { flex: 1; }
}

/* Подсказка по пробегу в карточке продажи. */
.mileage-hint { margin: 8px 0 0; font-size: 12px; line-height: 1.4; }
.mileage-hint__cashback { color: var(--ink); }
.mileage-hint--ok { color: var(--ok); }
.mileage-hint--warn { color: var(--warn); }
.editable__extra { display: block; font-size: 12px; margin-top: 2px; }

.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.staffcard__name { font-weight: 600; }
.person__login { font-size: 12px; }
.person .tag { align-self: flex-start; margin-top: 2px; font-size: 11px; padding: 2px 8px; }
.staff-card .panel__grid + .panel__grid { margin-top: 0; }
.field--wide { grid-column: 1 / -1; }
.staff-table td.actions { white-space: normal; }
.staff-table td.actions > * { margin: 3px 0 3px 6px; }
.staff-table td.mono { white-space: nowrap; }
.staff-table .staffcard__name { white-space: nowrap; }

.sheet { position: fixed; inset: 0; z-index: 40; }
.sheet__scrim {
    position: absolute;
    inset: 0;
    background: var(--scrim);
    opacity: 0;
    transition: opacity 0.26s var(--ease);
}
.sheet__panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    width: min(540px, 100vw);
    background: var(--bg);
    box-shadow: var(--shadow-stack);
    transform: translateX(100%);
    transition: transform 0.26s var(--ease);
}
.sheet--open .sheet__scrim { opacity: 1; }
.sheet--open .sheet__panel { transform: none; }
.sheet__grip { display: none; }
.sheet__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 18px 12px;
}
.sheet__heading { display: flex; align-items: center; gap: 12px; min-width: 0; }
.sheet__titles { min-width: 0; }
.sheet__title { margin: 0; font-family: var(--font-display); font-size: 18px; font-weight: 600; word-break: break-word; }
.sheet__sub { margin: 2px 0 0; font-size: 13px; }
.sheet__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
}
.sheet__close:hover { border-color: var(--line-strong); }
.sheet__body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 18px 18px;
}
.sheet__body > .card, .sheet__body > section { margin-bottom: 12px; }
.sheet__body > .card:last-child { margin-bottom: 0; }
.sheet__foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--surface);
}
.sheet__foot .btn--link { margin-right: auto; }
.has-sheet { overflow: hidden; }

@media (max-width: 780px) {
    .sheet__panel {
        top: auto;
        left: 0;
        width: 100%;
        max-height: 90dvh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        transform: translateY(100%);
    }
    .sheet__grip {
        display: block;
        width: 40px;
        height: 5px;
        margin: 8px auto 0;
        border-radius: var(--pill);
        background: var(--line-strong);
    }
    .sheet__head { padding: 10px 16px 10px; }
    .sheet__body { padding: 0 12px calc(16px + env(safe-area-inset-bottom)); }
    .sheet__foot { padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
    .sheet__foot .btn { flex: 1; }
    .sheet__foot .btn--link { flex: 0 0 100%; order: 9; margin: 0; justify-content: center; }
}

.btn--link {
    border-color: transparent;
    background: none;
    color: var(--ink-muted);
    box-shadow: none;
}
.btn--link:hover { color: var(--danger); background: var(--danger-soft); border-color: transparent; }

.strip__search { flex: 1; min-width: 200px; max-width: 360px; }
.row--tap { cursor: pointer; }
.row--tap:hover td { background: var(--surface-sunken); }
.row__go { display: inline-flex; color: var(--ink-muted); }
@media (max-width: 780px) {
    .strip__search { max-width: none; flex-basis: 100%; }
    .table--stack tr.row--tap { position: relative; }
    .table--stack td.actions { margin-top: 8px; }
    .table--stack td.actions .row__go { position: absolute; top: 14px; right: 14px; }
}

.fold { border-top: 1px solid var(--line); }
.fold__head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    list-style: none;
    cursor: pointer;
}
.fold__head::-webkit-details-marker { display: none; }
.fold__title { font-family: var(--font-display); font-size: 14px; font-weight: 600; }
.fold__sum { flex: 1; min-width: 0; font-size: 13px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fold__chev { display: inline-flex; color: var(--ink-muted); transition: transform 0.2s var(--ease); }
.fold[open] > .fold__head .fold__chev { transform: rotate(90deg); }
.fold__body { padding: 0 0 14px; }
.fold__body > .btn { margin-top: 10px; }
.fold--card {
    padding: 4px 18px;
    border: 0;
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-card);
}
.fold--card > .card { margin: 0 -18px 4px; box-shadow: none; }

.station-save {
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 -18px -16px;
    padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    background: var(--surface);
    font-size: 13px;
}
.station-save--dirty { background: var(--warn-soft); }
.station-save--dirty .muted { color: var(--warn); }

.post--tap {
    width: 100%;
    border-left: 0;
    border-right: 0;
    border-top: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.post--tap:hover { background: var(--surface-sunken); }
.post--new .btn { flex: none; }
@media (max-width: 780px) {
    .station-save { margin: 0 -16px -18px; padding-left: 16px; padding-right: 16px; }
    .fold--card { padding: 4px 16px; }
    .post--new { flex-wrap: nowrap; }
}
.station-save:not(.station-save--dirty) { display: none; }
@media (max-width: 780px) {
    .seg--sub { display: block; width: 100%; }
    .seg--sub .seg__row { grid-auto-columns: 1fr; }
    .seg--sub .seg__opt { padding-left: 12px; padding-right: 12px; }
    .post--new .input { min-width: 0; }
}

.posts { display: flex; flex-direction: column; gap: 6px; }
.post--tap {
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    transition: border-color 0.18s var(--ease), background-color 0.18s var(--ease);
}
.post--tap:last-child { border-bottom: 1px solid var(--line); }
.post--tap:hover { border-color: var(--line-strong); background: var(--surface-sunken); }
.post--new { margin-top: 10px; padding-top: 0; border-bottom: 0; }
.row--tap:hover td { background: var(--surface-sunken); }
.row--tap td:first-child { border-top-left-radius: var(--radius-sm); border-bottom-left-radius: var(--radius-sm); }
.row--tap td:last-child { border-top-right-radius: var(--radius-sm); border-bottom-right-radius: var(--radius-sm); }
.row--tap:hover td { border-bottom-color: transparent; }
@media (max-width: 780px) {
    .table--stack tr.row--tap:hover td { background: none; }
    .table--stack tr.row--tap:hover { background: var(--surface-sunken); }
    .table--stack tr.row--tap { position: relative; }
    .staff-table td.actions .row__go { position: absolute; top: 14px; right: 14px; }
}
@media (hover: none) {
    .row--tap:hover td, .table--stack tr.row--tap:hover, .post--tap:hover { background: none; }
    .row--tap:active td, .table--stack tr.row--tap:active, .post--tap:active { background: var(--surface-sunken); }
}
@media (max-width: 780px) {
    .table--stack.stock tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; }
    .table--stack.stock td { width: auto; }
    .table--stack.stock td.name { order: -1; flex: 1 1 100%; padding-right: 24px; font-size: 15px; }
    .table--stack.stock td.num { text-align: left; }
    .table--stack.stock td.actions { flex: 1 1 100%; }
    .table--stack.stock td.actions .row__go { top: 16px; }
}
@media (max-width: 780px) {
    .is-own .table--stack.stock td { padding: 0; }
    .is-own .table--stack.stock tr { gap: 6px 16px; padding: 12px 14px; }
    .is-own .table--stack.stock td.actions { margin-top: 6px; }
}

.dropdown { position: relative; min-width: 0; }
.dropdown__native { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dropdown__button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    text-align: left;
    cursor: pointer;
}
.dropdown__button:disabled { opacity: 0.55; cursor: default; }
.dropdown__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown__chev { display: inline-flex; flex: none; color: var(--ink-muted); transform: rotate(90deg); transition: transform 0.2s var(--ease); }
.dropdown__button[aria-expanded="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dropdown__button[aria-expanded="true"] .dropdown__chev { transform: rotate(-90deg); }
.dropdown__menu {
    position: fixed;
    z-index: 60;
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 320px;
    max-width: calc(100vw - 16px);
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-pop);
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
    transform-origin: top center;
    transition: opacity 0.16s ease, transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.dropdown__menu--up { transform-origin: bottom center; transform: translateY(6px) scale(0.98); }
.dropdown__menu--open { opacity: 1; transform: none; }
.dropdown__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--ink);
    font: inherit;
    font-size: 15px;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
    outline: none;
}
.dropdown__item:hover, .dropdown__item:focus-visible { background: var(--surface-sunken); }
.dropdown__item--on { color: var(--accent-strong); font-weight: 600; }
.dropdown__tick { display: inline-flex; color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .dropdown__menu, .dropdown__chev { transition: none; } }

/* Панель листается только вверх-вниз: ничего в ней не шире экрана. */
.sheet__body { overflow-x: hidden; touch-action: pan-y; }
.sheet__body .card { min-width: 0; max-width: 100%; }
.sheet__body .input { min-width: 0; max-width: 100%; }
.sheet__body .panel__grid { grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); }
/* iPhone рисует поле даты своей шириной и высотой — приводим к обычному полю. */
input.input[type="date"], input.input[type="time"] {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    min-height: 46px;
    text-align: left;
}
input.input[type="date"]::-webkit-date-and-time-value, input.input[type="time"]::-webkit-date-and-time-value { text-align: left; }
.sheet__panel { overscroll-behavior: contain; }

.import-actions { flex-wrap: wrap; align-items: center; }
.import-actions .btn--primary { margin-left: auto; }
@media (max-width: 780px) {
    .card__actions { flex-wrap: wrap; }
    .card__actions .btn { white-space: nowrap; }
    .import-actions { flex-direction: column-reverse; align-items: stretch; gap: 6px; }
    .import-actions .btn { flex: none; width: 100%; justify-content: center; }
    .import-actions .btn--primary { margin-left: 0; padding-top: 12px; padding-bottom: 12px; }
    .import-card .line__sum { white-space: normal; text-align: right; }
}

.audit { display: flex; flex-direction: column; gap: 20px; max-width: 980px; }
.audit__day { display: flex; flex-direction: column; gap: 8px; }
.audit__date { margin: 0 0 2px; font-family: var(--font-display); font-size: 13px; font-weight: 600; color: var(--ink-muted); text-transform: capitalize; }

.audit-sale { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); overflow: hidden; }
.audit-sale--failed { border-color: var(--danger); }
.audit-sale__head {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto 20px;
    gap: 12px;
    align-items: center;
    width: 100%;
    padding: 12px 14px;
    border: 0;
    background: none;
    color: var(--ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.audit-sale__head:hover { background: var(--surface-sunken); }
.audit-sale__icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-strong); }
.audit-sale--failed .audit-sale__icon { background: var(--danger-soft); color: var(--danger); }
.audit-sale__main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.audit-sale__title { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: 14px; }
.audit-sale__client { color: var(--ink-muted); font-size: 13px; }
.audit-sale__meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 12px; color: var(--ink-muted); }
.audit-sale__status { padding: 2px 8px; border-radius: var(--pill); font-weight: 600; }
.audit-sale__status--ok { background: var(--ok-soft); color: var(--ok); }
.audit-sale__status--warn { background: var(--warn-soft); color: var(--warn); }
.audit-sale__status--muted { background: var(--surface-sunken); color: var(--ink-muted); }
.audit-sale__status--bad { background: var(--danger-soft); color: var(--danger); }
.audit-sale__sum { font-size: 15px; white-space: nowrap; }
.audit-sale__chev { display: grid; place-items: center; color: var(--ink-muted); transition: transform .2s var(--ease); }
.audit-sale--open .audit-sale__chev { transform: rotate(180deg); }
.audit-sale__steps { list-style: none; margin: 0; padding: 4px 14px 12px 60px; border-top: 1px solid var(--line); display: flex; flex-direction: column; }
.audit-sale__steps[hidden] { display: none; }
.audit-step { display: grid; grid-template-columns: 64px 20px minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 6px 0; font-size: 13px; line-height: 1.45; }
.audit-step + .audit-step { border-top: 1px dashed var(--line); }
.audit-step__time { color: var(--ink-muted); font-size: 12px; }
.audit-step__icon { display: grid; place-items: center; align-self: center; color: var(--ink-muted); }
.audit-step__icon svg { width: 14px; height: 14px; }
.audit-step--added .audit-step__icon { color: var(--ok); }
.audit-step--closed .audit-step__icon { color: var(--accent-strong); }
.audit-step--cancelled .audit-step__icon { color: var(--danger); }
.audit-step--closed .audit-step__text { font-weight: 600; }
.audit-step--failed .audit-step__icon,
.audit-step--failed .audit-step__text { color: var(--danger); }
.audit-step--removed .audit-step__text { color: var(--ink-muted); }
.audit-step__text { word-break: break-word; }
.audit-step__who { color: var(--ink-muted); }
.audit-sale__open { padding-top: 10px; }
.audit-sale__open .btn { display: inline-flex; gap: 6px; text-decoration: none; }

.audit-person { padding: 10px 14px; border-radius: var(--radius-md); background: var(--surface-sunken); display: flex; flex-direction: column; gap: 2px; }
.audit-person__head { display: flex; align-items: center; font-size: 13px; margin-bottom: 4px; }
.audit-line { display: grid; grid-template-columns: 64px 20px minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 4px 0; font-size: 13px; line-height: 1.45; }
.audit-line__time { color: var(--ink-muted); font-size: 12px; }
.audit-line__icon { display: grid; place-items: center; align-self: center; color: var(--ink-muted); }
.audit-line__icon svg { width: 14px; height: 14px; }
.audit-line__text { word-break: break-word; }
.audit-line--failed .audit-line__icon,
.audit-line--failed .audit-line__text { color: var(--danger); }

@media (max-width: 780px) {
    .audit-sale__head { grid-template-columns: minmax(0, 1fr) auto 16px; padding: 12px; gap: 10px; }
    .audit-sale__icon { display: none; }
    .audit-sale__steps { padding: 4px 12px 12px; }
    .audit-step, .audit-line { grid-template-columns: 16px minmax(0, 1fr); gap: 4px 8px; }
    .audit-step__time, .audit-line__time { grid-column: 2; grid-row: 1; }
    .audit-step__icon, .audit-line__icon { grid-row: 1 / span 2; align-self: start; padding-top: 2px; }
    .audit-step__text, .audit-line__text { grid-column: 2; }
    .audit-person { padding: 10px 12px; }
}

/* Отчёты на телефоне: вместо ленты разделов, которую не видно, что листать, — одна кнопка с текущим разделом и списком в панели. */
.reports__pick { display: none; }
@media (max-width: 899px) {
    .reports__nav { display: none; }
    .reports__body > .card__head { display: none; }
    .reports__pick {
        display: flex; align-items: center; gap: 12px; width: 100%;
        padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-md);
        background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; font: inherit;
        box-shadow: var(--shadow-card);
    }
    .reports__pick-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
    .reports__pick-label { font-family: var(--font-display); font-size: 17px; font-weight: 600; }
    .reports__pick-hint { font-size: 13px; line-height: 1.35; }
    .reports__pick-more {
        display: inline-flex; align-items: center; gap: 4px; flex: none;
        padding: 6px 8px 6px 12px; border-radius: var(--pill); background: var(--surface-sunken);
        font-size: 12px; color: var(--ink-muted); white-space: nowrap;
    }
    .reports__pick-more svg { width: 16px; height: 16px; }
}
.pick-list { display: flex; flex-direction: column; gap: 4px; }
.pick-list__item {
    display: flex; align-items: center; gap: 12px; width: 100%;
    padding: 12px 14px; border: 0; border-radius: var(--radius-sm);
    background: transparent; color: var(--ink); text-align: left; font: inherit; cursor: pointer;
}
.pick-list__item:hover { background: var(--surface-sunken); }
.pick-list__item.is-on { background: var(--accent-soft); }
.pick-list__text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.pick-list__label { font-family: var(--font-display); font-size: 15px; font-weight: 600; }
.pick-list__hint { font-size: 13px; line-height: 1.35; }
.pick-list__check { color: var(--accent); flex: none; }
.pick-list__check svg { width: 20px; height: 20px; }

/* Итоги: цифры в сетке, а не в предложениях. Смелость — в полосах долей с процентами на самой полосе. */
.sum { display: grid; gap: 14px; }
.sum__top, .sum__pair { display: grid; gap: 14px; align-items: start; }
@media (min-width: 1000px) {
    .sum__top { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: stretch; }
    .sum__pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.sum-card, .sum-hero { border-radius: var(--radius-md); background: var(--surface-sunken); padding: 20px; min-width: 0; }
.sum-card__title { margin: 0 0 14px; font-family: var(--font-display); font-size: 14px; font-weight: 600; }
.sum-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px 20px; flex-wrap: wrap; margin-bottom: 16px; }
.sum-card__head .sum-card__title { margin: 0; }

.sum-hero { display: flex; flex-direction: column; gap: 22px; background: var(--accent-soft); }
.sum-hero__main { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.sum-hero__now { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sum-hero__label { font-size: 14px; color: var(--accent-strong); }
.sum-hero__value { font-family: var(--font-display); font-size: clamp(34px, 6vw, 52px); font-weight: 600; line-height: 1; letter-spacing: -0.03em; color: var(--accent-strong); white-space: nowrap; }
.sum-compare { display: flex; align-items: center; gap: 12px; }
.sum-compare__badge { display: inline-flex; align-items: center; gap: 2px; padding: 6px 12px 6px 8px; border-radius: var(--pill); background: var(--surface); font-family: var(--font-display); font-size: 15px; font-weight: 600; }
.sum-compare__badge svg { width: 18px; height: 18px; stroke-width: 2.4; }
.sum-compare--up .sum-compare__badge { color: var(--ok); }
.sum-compare--down .sum-compare__badge { color: var(--danger); }
.sum-compare--flat .sum-compare__badge { color: var(--ink-muted); padding-left: 12px; }
.sum-compare__was { display: flex; flex-direction: column; gap: 2px; }
.sum-compare__when { font-size: 12px; color: var(--ink-muted); }
.sum-compare__sum { font-family: var(--font-mono); font-size: 15px; color: var(--ink); }
.sum-compare__none { font-size: 14px; color: var(--ink); }
.sum-hero__facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: auto; border-top: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.sum-fact { display: flex; flex-direction: column; gap: 3px; padding: 14px 12px 0 0; min-width: 0; }
.sum-fact + .sum-fact { padding-left: 14px; border-left: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.sum-fact strong { font-family: var(--font-mono); font-size: 18px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.sum-fact span { font-size: 13px; color: var(--ink-muted); }

.sum-card--bars { display: flex; flex-direction: column; gap: 22px; }
.sum-card--bars .sum-card__title { margin-bottom: 10px; }
.tone-a { --tone: var(--accent); --tone-ink: var(--on-accent); }
.tone-b { --tone: var(--ink); --tone-ink: var(--surface); }
.tone-c { --tone: var(--warn); --tone-ink: var(--on-accent); }
.tone-d { --tone: var(--line-strong); --tone-ink: var(--ink); }
.tone-e { --tone: var(--ink-muted); --tone-ink: var(--surface); }
.tone-f { --tone: var(--danger); --tone-ink: var(--on-accent); }
.bar__track { display: flex; gap: 4px; height: 44px; }
.bar__part {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    flex-basis: 0; min-width: 10px; padding: 0 14px; overflow: hidden; container-type: inline-size;
    background: var(--tone); color: var(--tone-ink); border-radius: 10px;
    font-size: 14px; white-space: nowrap;
}
.bar__part:first-child { border-radius: 14px 6px 6px 14px; }
.bar__part:last-child { border-radius: 6px 14px 14px 6px; }
.bar__part:only-child { border-radius: 14px; }
.bar__pct { font-family: var(--font-display); font-weight: 600; font-size: 15px; }
.bar__part:has(.bar__pct:only-child) { justify-content: center; padding: 0 6px; }
.bar__name { overflow: hidden; text-overflow: ellipsis; }
@container (max-width: 150px) { .bar__name { display: none; } .bar__pct { margin: 0 auto; } }
.bar__legend { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 10px; }
.bar__key { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-muted); }
.bar__dot { width: 8px; height: 8px; border-radius: 3px; background: var(--tone); }
.bar__sum { font-family: var(--font-mono); color: var(--ink); }
.sum-kept { display: flex; flex-wrap: wrap; gap: 8px; }
.sum-kept__item { display: flex; align-items: baseline; gap: 8px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface); font-size: 13px; color: var(--ink-muted); }
.sum-kept__item strong { font-family: var(--font-mono); font-weight: 600; color: var(--ink); }
button.bar__part { border: 0; margin: 0; font-family: inherit; cursor: pointer; transition: filter 0.15s var(--ease), transform 0.15s var(--ease); }
button.bar__part:hover { filter: brightness(1.12); transform: translateY(-1px); }
button.bar__part:active { transform: translateY(0); }
button.bar__part:focus-visible, button.bar__key:focus-visible, button.sum-kept__item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.bar__key { border: 0; margin: 0; padding: 2px 0; background: none; font-family: inherit; cursor: pointer; border-radius: 6px; }
button.bar__key:hover .bar__label { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
button.sum-kept__item { border: 0; margin: 0; font-family: inherit; cursor: pointer; transition: background-color 0.15s var(--ease); }
button.sum-kept__item:hover { background: var(--surface-sunken); }
@media (hover: none) { button.bar__part:hover { filter: none; transform: none; } }

.part-checks .check { border-radius: 0; }
.part-checks .check:last-child { border-bottom: 0; }
.part-count { padding: 0 4px 8px; font-size: 13px; border-bottom: 1px solid var(--line); }
.part-title { margin: 0 0 4px; font-family: var(--font-display); font-size: 14px; font-weight: 600; }
.part-muted .calc__sum { color: var(--ink-muted); }
.top__name--wrap { white-space: normal; }
.calc { display: flex; flex-direction: column; }
.calc__row {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px;
    width: 100%; padding: 11px 4px; margin: 0; border: 0; border-bottom: 1px solid var(--line);
    background: none; color: inherit; font-family: inherit; font-size: 14px; text-align: left;
}
.calc__row--go { grid-template-columns: minmax(0, 1fr) auto 18px; cursor: pointer; }
.calc__row--go:hover { background: var(--surface-sunken); }
.calc__row--go:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.calc__label { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.calc__hint { font-size: 12px; color: var(--ink-muted); }
.calc__sum { font-family: var(--font-mono); font-size: 15px; white-space: nowrap; }
.calc__sum--none { font-family: inherit; font-size: 13px; color: var(--warn); }
.calc__go { display: grid; place-items: center; color: var(--ink-muted); }
.calc__go svg { width: 16px; height: 16px; }
.calc__row--total { border-bottom: 0; padding-top: 14px; font-weight: 600; }
.calc__row--total .calc__sum { font-size: 17px; font-weight: 600; }

.day-readout { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.day-readout__label { font-size: 12px; color: var(--ink-muted); }
.day-readout__row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.day-readout__date { font-size: 14px; }
.day-readout__sum { font-family: var(--font-mono); font-size: 16px; font-weight: 600; }
.day-readout__count { font-size: 13px; color: var(--ink-muted); }
.chart { display: grid; grid-template-columns: repeat(var(--days), minmax(0, 1fr)); gap: 3px; height: 170px; align-items: end; }
.chart__col { display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; height: 100%; padding: 0; border: 0; background: none; cursor: pointer; min-width: 0; }
.chart__col:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.chart__bar { display: block; border-radius: 5px 5px 2px 2px; background: color-mix(in srgb, var(--accent) 40%, transparent); transition: background-color 0.15s var(--ease); }
.chart__col.is-zero .chart__bar { background: var(--line); }
.chart__col:hover .chart__bar { background: color-mix(in srgb, var(--accent) 65%, transparent); }
.chart__col.is-on .chart__bar { background: var(--accent); }
.chart__label { height: 14px; font-size: 11px; color: var(--ink-muted); text-align: center; font-family: var(--font-mono); }
.chart__col.is-on .chart__label { color: var(--ink); }

.people { display: flex; flex-direction: column; }
.people__row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px 20px; padding: 12px 0; border-top: 1px solid var(--line); }
.people__row:first-child { border-top: 0; padding-top: 0; }
.people__name { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people__stats { display: flex; gap: 18px; }
.people__stat { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.people__stat strong { font-family: var(--font-mono); font-size: 13px; font-weight: 500; }
.people__stat span { font-size: 11px; color: var(--ink-muted); }
.people__sum { font-family: var(--font-mono); font-size: 15px; font-weight: 600; text-align: right; min-width: 92px; }

.top { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.top__row { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.top__row:first-child { border-top: 0; padding-top: 0; }
.top__place { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; background: var(--surface); font-family: var(--font-mono); font-size: 12px; color: var(--ink-muted); }
.top__row:first-child .top__place { background: var(--accent); color: var(--on-accent); }
.top__name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top__qty { font-size: 12px; color: var(--ink-muted); white-space: nowrap; }
.top__sum { font-family: var(--font-mono); font-size: 14px; font-weight: 600; min-width: 80px; text-align: right; }

@media (max-width: 780px) {
    .sum-card, .sum-hero { padding: 16px; }
    .sum-hero { gap: 18px; }
    .sum-fact strong { font-size: 16px; }
    .bar__track { height: 40px; }
    .day-readout { align-items: flex-start; text-align: left; }
    .day-readout__row { justify-content: flex-start; }
    .chart { height: 140px; gap: 2px; }
    .people__row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name sum" "stats stats"; gap: 8px 12px; }
    .people__name { grid-area: name; }
    .people__sum { grid-area: sum; min-width: 0; }
    .people__stats { grid-area: stats; gap: 22px; }
    .people__stat { align-items: flex-start; }
    .top__row { grid-template-columns: 24px minmax(0, 1fr) auto; grid-template-areas: "place name sum" "place qty sum"; gap: 2px 12px; }
    .top__place { grid-area: place; }
    .top__name { grid-area: name; }
    .top__qty { grid-area: qty; }
    .top__sum { grid-area: sum; min-width: 0; }
}

.costs { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 14px; }
.costs__row { display: grid; grid-template-columns: minmax(0, 1fr) 150px auto; gap: 8px; width: 100%; align-items: center; }
@media (max-width: 780px) { .costs__row { grid-template-columns: minmax(0, 1fr) 110px auto; } }

.sum-hero--loss { background: var(--danger-soft); }
.sum-hero--loss .sum-hero__label, .sum-hero--loss .sum-hero__value { color: var(--danger); }
.sum-note { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--ink); font-size: 13px; line-height: 1.45; }
.sum-note svg { flex: none; width: 18px; height: 18px; color: var(--warn); margin-top: 1px; }

/* Продажи: переключатель вида, сводка, лента чеков по дням, позиции, динамика. */
.viewtabs { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: var(--radius-sm); background: var(--surface-sunken); }
.viewtabs__tab { padding: 7px 12px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-muted); font: inherit; font-size: 14px; cursor: pointer; white-space: nowrap; }
.viewtabs__tab:hover { color: var(--ink); }
.viewtabs__tab.is-on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-card); }
.viewtabs__tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.sales-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); border-radius: var(--radius-md); background: var(--surface-sunken); padding: 4px 20px 16px; }
.sales-strip .sum-fact + .sum-fact { border-left-color: var(--line); }
.sales-strip .sum-fact:first-child strong { color: var(--accent-strong); }

.feed { display: flex; flex-direction: column; gap: 18px; }
.feed__head { display: flex; align-items: baseline; gap: 12px; padding: 0 4px 8px; border-bottom: 1px solid var(--line); }
.feed__date { margin: 0; flex: 1; font-family: var(--font-display); font-size: 14px; font-weight: 600; }
.feed__date::first-letter { text-transform: uppercase; }
.feed__count { font-size: 13px; color: var(--ink-muted); }
.feed__total { font-family: var(--font-mono); font-size: 15px; }
.check { display: grid; grid-template-columns: 48px minmax(0, 1fr) 130px 110px; align-items: center; gap: 14px; padding: 11px 4px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; border-radius: 10px; }
.check:hover { background: var(--surface-sunken); }
.check:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.check__time { font-family: var(--font-mono); font-size: 13px; color: var(--ink-muted); }
.check__main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.check__title { display: flex; gap: 10px; align-items: baseline; min-width: 0; }
.check__no { font-family: var(--font-mono); font-size: 12px; color: var(--ink-muted); flex: none; }
.check__client { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check__sub { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink-muted); }
.check__plate { font-family: var(--font-mono); color: var(--ink); }
.check__pay { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-muted); }
.check__pay svg { width: 16px; height: 16px; }
.check__pay--cash svg { color: var(--accent); }
.check__money { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.check__sum { font-family: var(--font-mono); font-size: 15px; }
.check__kept { font-size: 12px; color: var(--warn); }

.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.block-head .sum-card__title { margin: 0; }
.block-head__sum { font-family: var(--font-mono); font-size: 15px; }

.trend { display: flex; flex-direction: column; }
.trend__row { display: grid; grid-template-columns: minmax(120px, 180px) minmax(0, 1fr) 80px 110px; align-items: center; gap: 14px; padding: 9px 0; border-top: 1px solid var(--line); }
.trend__row:first-child { border-top: 0; padding-top: 0; }
.trend__label { font-size: 14px; }
.trend__track { height: 10px; border-radius: var(--pill); background: var(--line); overflow: hidden; }
.trend__fill { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.trend__count { font-size: 13px; color: var(--ink-muted); text-align: right; }
.trend__sum { font-family: var(--font-mono); font-size: 14px; text-align: right; }

@media (max-width: 780px) {
    .viewtabs { display: flex; width: 100%; }
    .viewtabs__tab { flex: 1 1 auto; }
    .sales-strip { grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); padding: 2px 14px 14px; }
    .sales-strip .sum-fact strong { font-size: 15px; }
    .sales-strip .sum-fact + .sum-fact { padding-left: 10px; }
    .check { grid-template-columns: 42px minmax(0, 1fr) auto; grid-template-areas: "time main money" "time pay money"; gap: 4px 12px; }
    .check__time { grid-area: time; align-self: start; padding-top: 2px; }
    .check__main { grid-area: main; }
    .check__pay { grid-area: pay; }
    .check__money { grid-area: money; }
    .check__pay-name { display: none; }
    .trend__row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label sum" "track track" "count count"; gap: 6px 12px; }
    .trend__label { grid-area: label; }
    .trend__sum { grid-area: sum; }
    .trend__track { grid-area: track; }
    .trend__count { grid-area: count; text-align: left; font-size: 12px; }
}

/* Свой календарь периода: полоса от первого до последнего дня. */
.rp-trigger {
    display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px 0 14px;
    border: 1px solid var(--line-strong); border-radius: var(--pill); background: var(--surface);
    color: var(--ink); font: inherit; font-size: 16px; cursor: pointer; white-space: nowrap;
}
.rp-trigger:hover { border-color: var(--ink-muted); }
.rp-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rp-trigger[aria-expanded="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.rp-trigger__icon svg, .rp-trigger__chev svg { width: 18px; height: 18px; display: block; }
.rp-trigger__icon { color: var(--accent); }
.rp-trigger__chev { color: var(--ink-muted); transition: transform 0.18s var(--ease); }
.rp-trigger[aria-expanded="true"] .rp-trigger__chev { transform: rotate(180deg); }

.rp { position: absolute; inset: 0 auto auto 0; z-index: 60; }
.rp__panel {
    position: absolute; display: flex; gap: 6px; padding: 12px; width: max-content; max-width: calc(100vw - 32px);
    border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-pop);
    opacity: 0; transform: translateY(-6px); transition: opacity 0.16s var(--ease), transform 0.16s var(--ease);
}
.rp--open .rp__panel { opacity: 1; transform: none; }
.rp__presets { display: flex; flex-direction: column; gap: 2px; padding-right: 12px; margin-right: 6px; border-right: 1px solid var(--line); min-width: 132px; }
.rp__preset { padding: 8px 10px; border: 0; border-radius: 10px; background: none; color: var(--ink); font: inherit; font-size: 14px; text-align: left; cursor: pointer; white-space: nowrap; }
.rp__preset:hover { background: var(--surface-sunken); }
.rp__preset.is-on { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.rp__preset:focus-visible, .rp__arrow:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.rp__body { display: flex; flex-direction: column; gap: 6px; }
.rp__nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rp__hint { font-size: 13px; color: var(--ink-muted); }
.rp__arrow { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 10px; background: none; color: var(--ink); cursor: pointer; }
.rp__arrow:hover:not(:disabled) { background: var(--surface-sunken); }
.rp__arrow:disabled { opacity: 0.3; cursor: default; }
.rp__arrow svg { width: 18px; height: 18px; }
.rp__months { display: flex; gap: 22px; }
.rp__month { width: 266px; }
.rp__title { margin: 0 0 6px 6px; font-family: var(--font-display); font-size: 14px; font-weight: 600; }
.rp__title::first-letter { text-transform: uppercase; }
.rp__grid { display: grid; grid-template-columns: repeat(7, 38px); row-gap: 2px; }
.rp__wd { height: 26px; display: grid; place-items: center; font-size: 11px; color: var(--ink-muted); }
.rp__cell { position: relative; height: 38px; padding: 0; border: 0; background: none; color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; }
.rp__cell--pad { cursor: default; }
.rp__num { position: relative; z-index: 1; display: grid; place-items: center; width: 34px; height: 34px; margin: 2px; border-radius: 50%; transition: background-color 0.12s var(--ease); }
.rp__cell:hover:not(:disabled) .rp__num { background: var(--surface-sunken); }
.rp__cell:focus-visible { outline: none; }
.rp__cell:focus-visible .rp__num { box-shadow: 0 0 0 2px var(--accent); }
.rp__cell:disabled { color: var(--line-strong); cursor: default; }
.rp__cell.is-today .rp__num { box-shadow: inset 0 0 0 1px var(--line-strong); }
.rp__cell.is-in::before { content: ""; position: absolute; inset: 4px 0; background: var(--accent-soft); }
.rp__cell.is-in.is-row-start::before, .rp__cell.is-lo::before { left: 4px; border-top-left-radius: 17px; border-bottom-left-radius: 17px; }
.rp__cell.is-in.is-row-end::before, .rp__cell.is-hi::before { right: 4px; border-top-right-radius: 17px; border-bottom-right-radius: 17px; }
.rp__cell.is-in .rp__num { color: var(--accent-strong); }
.rp__cell.is-lo .rp__num, .rp__cell.is-hi .rp__num { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.rp__cell.is-lo:hover .rp__num, .rp__cell.is-hi:hover .rp__num { background: var(--accent-strong); }

.rp--sheet { position: fixed; inset: 0; }
.rp__scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity 0.2s var(--ease); }
.rp--sheet.rp--open .rp__scrim { opacity: 1; }
.rp--sheet .rp__panel {
    left: 0; right: 0; bottom: 0; top: auto; width: auto; max-width: none; flex-direction: column; gap: 12px;
    padding: 8px 16px calc(18px + env(safe-area-inset-bottom)); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transform: translateY(100%); opacity: 1; transition: transform 0.24s var(--ease);
}
.rp--sheet.rp--open .rp__panel { transform: none; }
.rp__grip { width: 40px; height: 4px; margin: 2px auto 4px; border-radius: 2px; background: var(--line-strong); }
.rp--sheet .rp__presets { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 0 0 2px; margin: 0; border: 0; min-width: 0; gap: 6px; }
.rp--sheet .rp__presets::-webkit-scrollbar { display: none; }
.rp--sheet .rp__preset { flex: none; padding: 8px 12px; background: var(--surface-sunken); border-radius: var(--pill); }
.rp--sheet .rp__month { width: 100%; }
.rp--sheet .rp__grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.rp--sheet .rp__cell { height: 44px; }
.rp--sheet .rp__num { width: 40px; height: 40px; margin: 2px auto; }
.rp--sheet .rp__cell.is-in.is-row-start::before, .rp--sheet .rp__cell.is-lo::before { left: calc(50% - 20px); }
.rp--sheet .rp__cell.is-in.is-row-end::before, .rp--sheet .rp__cell.is-hi::before { right: calc(50% - 20px); }
.rp--sheet .rp__cell.is-lo.is-hi::before { display: none; }
.rp__cell.is-lo.is-hi::before { display: none; }
@media (prefers-reduced-motion: reduce) { .rp__panel, .rp__scrim, .rp-trigger__chev { transition: none; } }
@media (max-width: 780px) {
    .filters .period__quick { display: none; }
    .filters .rp-trigger { width: 100%; justify-content: flex-start; }
    .filters .rp-trigger__text { flex: 1; text-align: left; }
    .filters .input--search { flex: 1; min-width: 0; }
    .filters .filters__gap { display: none; }
    .filters__csv { margin-left: 0; }
}

/* Разделы отчётов: подсветка сводки, метки, строки без ссылки, прибавки и убавки. */
.sum-fact--accent strong { color: var(--accent-strong); }
.sum-fact--bad strong { color: var(--danger); }
.sum-fact--warn strong { color: var(--warn); }
.sales-strip .sum-fact:first-child:not(.sum-fact--accent) strong { color: var(--ink); }
.rtag { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: var(--pill); background: var(--surface-sunken); color: var(--ink-muted); font-size: 12px; white-space: nowrap; }
.rtag--ok { background: var(--ok-soft); color: var(--ok); }
.rtag--warn { background: var(--warn-soft); color: var(--warn); }
.rtag--bad { background: var(--danger-soft); color: var(--danger); }
.check--plain { grid-template-columns: 48px minmax(0, 1fr) auto; }
div.check--plain:hover { background: none; }
.check__note { font-size: 12px; color: var(--ink-muted); white-space: nowrap; }
.is-plus { color: var(--ok); }
.is-minus { color: var(--danger); }
.check__sum.is-minus, .feed__total.is-minus { color: var(--danger); }

.people-cards { display: grid; gap: 14px; }
@media (min-width: 1000px) { .people-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.staffcard__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.staffcard__name { margin: 0; font-family: var(--font-display); font-size: 16px; font-weight: 600; }
.staffcard__sum { font-family: var(--font-mono); font-size: 18px; color: var(--accent-strong); }
.staffcard__stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px 16px; margin: 0; }
.staffcard__stat { display: flex; flex-direction: column; gap: 2px; padding-top: 10px; border-top: 1px solid var(--line); }
.staffcard__stat dt { font-size: 12px; color: var(--ink-muted); }
.staffcard__stat dd { margin: 0; font-family: var(--font-mono); font-size: 15px; }
.wcard { display: flex; flex-direction: column; gap: 14px; }
.wcard .staffcard__head { margin-bottom: 0; }
.wcard .muted--hint { margin: 0; }
.wcard__stats { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
.wcard__block { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
.wcard__sub { margin: 0; font-size: 12px; font-weight: 500; color: var(--ink-muted); }
.wcard .trend__row { grid-template-columns: minmax(120px, 170px) minmax(0, 1fr) 80px 40px; }
.wcard--none { background: transparent; border: 1px dashed var(--line-strong); }
.wcard--none .staffcard__sum { color: var(--ink-muted); }
.wcard--none .btn { align-self: flex-start; }
@media (max-width: 780px) { .wmatrix { display: none; } }
@media (max-width: 780px) { .wcard .trend__row { grid-template-columns: minmax(0, 1fr) auto; } }
.staffcard__stat--warn dd { color: var(--warn); }
.staffcard__stat--bad dd { color: var(--danger); }

.trend__row--pair { grid-template-columns: minmax(120px, 180px) minmax(0, 1fr) 140px; }
.trend__pair { display: flex; flex-direction: column; gap: 4px; }
.trend__pair .trend__track { height: 7px; }
.trend__fill--minus { background: var(--danger); }
.trend__sums { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-family: var(--font-mono); font-size: 13px; }

.ledger-list { display: flex; flex-direction: column; gap: 12px; }
.ledger__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.ledger__date { margin: 0; font-family: var(--font-display); font-size: 14px; font-weight: 600; }
.ledger__date::first-letter { text-transform: uppercase; }
.ledger__row { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.ledger__block { display: flex; flex-direction: column; gap: 10px; }
.ledger__block + .ledger__block { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.ledger__title { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; }
.ledger__part { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ledger__label { font-size: 12px; color: var(--ink-muted); }
.ledger__value { font-family: var(--font-mono); font-size: 15px; white-space: nowrap; }
.ledger__part--result .ledger__value { font-weight: 600; }
.ledger__note { margin: 10px 0 0; font-size: 12px; color: var(--ink-muted); }
@media (max-width: 780px) {
    .check--plain { grid-template-columns: 42px minmax(0, 1fr) auto; grid-template-areas: "time main money"; }
    .trend__row--pair { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label sums" "pair pair"; }
    .trend__row--pair .trend__label { grid-area: label; }
    .trend__pair { grid-area: pair; }
    .trend__sums { grid-area: sums; }
    .ledger__row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .staffcard__stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 780px) {
    .sales-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
    .sales-strip .sum-fact, .sales-strip .sum-fact + .sum-fact { border-left: 0; padding-left: 0; }
    .sales-strip:has(.sum-fact:nth-child(3):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 780px) { .check__client { white-space: normal; } }

.dossier__photo { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.dossier__photo-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.dossier__pick { cursor: pointer; }
.dossier__docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.dossier__doc { margin: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.dossier__img { display: block; aspect-ratio: 4 / 3; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-sunken); }
.dossier__img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.dossier__caption { display: flex; align-items: flex-start; gap: 6px; font-size: 13px; line-height: 1.35; }
.dossier__caption span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.dossier__drop { display: inline-flex; flex: none; padding: 2px; border: 0; border-radius: 6px; background: none; color: var(--ink-muted); cursor: pointer; }
.dossier__drop:hover { color: var(--danger); background: var(--danger-soft); }
.dossier__drop svg { width: 16px; height: 16px; }
.dossier__add { margin-top: 16px; }
.dossier__add .input { flex: 1; min-width: 180px; }

.seg--stock .seg__row { grid-auto-columns: minmax(104px, 1fr); }
.stock__meta { margin-top: 2px; font-family: var(--font-body); font-size: 12px; font-weight: 400; white-space: normal; }
.stock__liters { font-size: 12px; }
.stock__reserved { font-size: 11px; color: var(--warn); }
.stock-note { margin: 0 0 10px; font-size: 12px; }
.stock-filter { width: auto; min-width: 150px; max-width: 220px; }
.stock-totals { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 0 0 12px; padding: 12px 14px; border-radius: var(--radius-md); background: var(--surface-sunken); }
.stock-totals__cell { display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.stock-totals__cell strong { font-size: 16px; color: var(--ink); }
.stock-old { margin: 0 0 10px; font-size: 13px; }
.stock-old--run { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius-md); background: var(--accent-soft); color: var(--accent-strong); }
.stock-old__dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: stock-pulse 1s var(--ease) infinite alternate; }
@keyframes stock-pulse { from { opacity: 0.3; } to { opacity: 1; } }
.th-sort { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.th-sort--on { color: var(--accent-strong); }
.th-sort__dir { font-size: 11px; }
.stock--full td.num, .stock--full th.num { text-align: right; }
.field__hint { display: block; margin-top: 4px; font-size: 11px; }
.sheet-form__wide, .item-form__wide { grid-column: 1 / -1; }
.item-form__group + .item-form__group { margin-top: 6px; }
.item-form__group .subhead { margin: 10px 0 6px; }

.doc__bar { margin-bottom: 14px; }
.doc__bar .page__title { margin: 0; }
.doc { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
.doc > .card { margin-bottom: 0; }
.doc__fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.doc__wide { grid-column: 1 / -1; }
.doc__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.doc__actions .btn { flex: 1; }
.doc__hint { margin: 8px 0 0; font-size: 12px; }
.doc__facts { margin-top: 14px; }
.doc__import { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.doc__upload { position: relative; overflow: hidden; cursor: pointer; }
.doc__file { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 16px; }
.doc__foot { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.doc__lines .input[type="search"] { margin-bottom: 10px; }
.doc__lines .picks { margin-bottom: 12px; }
.doc__num { width: 96px; padding: 6px 8px; text-align: right; }
.doc-table td.name { white-space: normal; min-width: 220px; }
.doc-table td.num { white-space: nowrap; }
.doc-table th.num { text-align: right; }
.strip__end .btn { white-space: nowrap; }
@media (max-width: 900px) {
    .doc { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 780px) {
    .stock-filter { flex: 1 1 140px; max-width: none; }
    .doc__fields { grid-template-columns: minmax(0, 1fr); }
    .table--stack.doc-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; position: relative; }
    .table--stack.doc-table td { width: auto; }
    .table--stack.doc-table td.name { grid-column: 1 / -1; min-width: 0; padding-right: 36px; }
    .table--stack.doc-table td.num { display: flex; flex-direction: column; align-items: stretch; text-align: left; }
    .table--stack.doc-table td.num::before { margin-bottom: 4px; }
    .table--stack.doc-table td.actions { position: absolute; top: 8px; right: 8px; width: auto; margin: 0; }
    .table--stack.doc-table .doc__num { width: 100%; text-align: left; }
}

.print-doc { display: none; }
@media print {
    body.is-printing > *:not(.print-doc) { display: none !important; }
    body.is-printing .print-doc { display: block; color: #000; font: 12px/1.4 sans-serif; }
    .print-doc h1 { font-size: 18px; margin: 0 0 6px; }
    .print-doc table { width: 100%; border-collapse: collapse; margin-top: 10px; }
    .print-doc th, .print-doc td { border: 1px solid #999; padding: 4px 6px; text-align: left; }
    .print-doc tfoot td { font-weight: 700; }
    .print-doc__sign { margin-top: 36px; }
}
.stock th.num { text-align: right; }

.cashback {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--line-strong);
    background: var(--surface-sunken);
    color: var(--ink-muted);
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.cashback--mid { border-color: transparent; background: var(--accent-soft); color: var(--accent-strong); }
.cashback--high { border: 2px solid var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.cashback--max { border-color: transparent; background: var(--accent); color: var(--on-accent); }
