/* ===== Личный кабинет: светлая и тёмная тема, жёлто-оранжевые акценты ===== */
:root {
    --y1: #FFD300;
    --y2: #FF8400;
    --grad: linear-gradient(135deg, var(--y1) 0%, var(--y2) 100%);
    --grad-2: linear-gradient(135deg, #FFB800 0%, #FF6A00 100%);
    --grad-3: linear-gradient(135deg, #FFE24D 0%, #FFA000 100%);
    --grad-4: linear-gradient(135deg, #FF9F1C 0%, #FF5C00 100%);
    --on-grad: #2b1a00;          /* тёмный текст на жёлтом — белый там не читается */

    --bg: #f6f4ef;
    --card: #ffffff;
    --text: #26221c;
    --muted: #7d766b;
    --line: #ebe7df;
    --soft: #faf8f3;
    --hover: #fdf6e8;
    --input: #ffffff;
    --accent: #FF8400;
    --accent-text: #b25a00;      /* оранжевый для текста: #FF8400 на белом слишком бледный */
    --accent-soft: #fff2dc;
    --shadow: 0 1px 3px rgba(40, 30, 10, .08);

    --good-bg: #e7f5e8; --good: #2e7d32;
    --warn-bg: #fff1dc; --warn: #b85600;
    --bad-bg:  #fdeaea; --bad:  #c62828;
    --chip: #f0ede7;   --chip-text: #5b554b;

    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #121212;
    --card: #1c1c1c;
    --text: #efece6;
    --muted: #a39d93;
    --line: #2c2a27;
    --soft: #232220;
    --hover: #2a2620;
    --input: #161616;
    --accent-text: #FFB547;
    --accent-soft: #3a2a10;
    --shadow: 0 1px 3px rgba(0, 0, 0, .5);

    --good-bg: rgba(76, 175, 80, .16); --good: #86d98a;
    --warn-bg: rgba(255, 152, 0, .16); --warn: #ffb65c;
    --bad-bg:  rgba(244, 67, 54, .16); --bad:  #ff8f86;
    --chip: #2b2926;  --chip-text: #cfc8bd;

    color-scheme: dark;
}

/* Без JS тема берётся из настроек системы */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --bg: #121212; --card: #1c1c1c; --text: #efece6; --muted: #a39d93;
        --line: #2c2a27; --soft: #232220; --hover: #2a2620; --input: #161616;
        --accent-text: #FFB547; --accent-soft: #3a2a10; --shadow: 0 1px 3px rgba(0,0,0,.5);
        --good-bg: rgba(76,175,80,.16); --good: #86d98a;
        --warn-bg: rgba(255,152,0,.16); --warn: #ffb65c;
        --bad-bg: rgba(244,67,54,.16); --bad: #ff8f86;
        --chip: #2b2926; --chip-text: #cfc8bd;
        color-scheme: dark;
    }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-text-size-adjust: 100%;
    transition: background .2s, color .2s;
}

a { color: var(--accent-text); }
button, input, select, textarea { font: inherit; color: inherit; }

/* ===== шапка ===== */
.navbar {
    background: var(--grad);
    color: var(--on-grad);
    padding: 12px 20px;
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
    position: sticky; top: 0; z-index: 100;
}
.navbar-title { display: inline-flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; color: var(--on-grad); text-decoration: none; white-space: nowrap; }
.navbar-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.nav-btn {
    background: rgba(255, 255, 255, .35);
    color: var(--on-grad); border: 0; border-radius: 16px;
    padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer;
    text-decoration: none; white-space: nowrap; line-height: 1.3;
    display: inline-flex; align-items: center; gap: 6px;
}
.nav-btn:hover { background: rgba(255, 255, 255, .55); }
.nav-btn.active { background: rgba(43, 26, 0, .85); color: #FFD300; }
.inline { display: inline; }

.container { max-width: 1200px; margin: 0 auto; padding: 20px; }

/* ===== сообщения ===== */
.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; line-height: 1.45; }
.flash.ok { background: var(--good-bg); color: var(--good); }
.flash.error { background: var(--bad-bg); color: var(--bad); }
.flash.info { background: var(--accent-soft); color: var(--accent-text); }

/* ===== профиль ===== */
.header {
    background: var(--card); border-radius: 14px; padding: 24px;
    margin-bottom: 20px; box-shadow: var(--shadow);
}
.header-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.header-user { display: flex; align-items: center; gap: 16px; min-width: 0; }
.header-avatar {
    width: 72px; height: 72px; flex: none; border-radius: 50%;
    background: var(--grad); color: var(--on-grad);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 28px;
    box-shadow: 0 4px 14px rgba(255, 132, 0, .35);
}
.header-info { min-width: 0; }
.header-info h1 { font-size: 24px; margin-bottom: 4px; overflow-wrap: anywhere; }
.header-info p { color: var(--muted); font-size: 14px; }
.header-status { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.status-badge {
    background: var(--chip); color: var(--chip-text);
    padding: 8px 14px; border-radius: 20px; font-size: 13px; font-weight: 500; white-space: nowrap;
}
.status-badge.active { background: var(--good-bg); color: var(--good); }

.live-strip {
    margin-top: 16px; padding: 12px 14px;
    background: var(--good-bg); color: var(--good);
    border-radius: 10px; font-size: 14px;
    display: flex; flex-wrap: wrap; gap: 6px 18px;
}
.live-strip b { color: inherit; filter: brightness(.85); }
[data-theme="dark"] .live-strip b { filter: brightness(1.15); }

.admin-strip {
    margin-top: 16px; padding: 10px 14px; border-radius: 10px;
    background: var(--accent-soft); color: var(--accent-text); font-size: 13px;
    display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center;
}

.fired-strip {
    margin-top: 16px; padding: 10px 14px; border-radius: 10px;
    background: var(--bad-bg); color: var(--bad); font-size: 13px;
    display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between;
}
.fire-edit > summary { background: var(--bad-bg); color: var(--bad); }
.fired-list > summary { cursor: pointer; list-style: none; margin-bottom: 0; }
.fired-list > summary::-webkit-details-marker { display: none; }
.fired-list > summary::after { content: "показать"; font-size: 12px; font-weight: 600; color: var(--accent-text); }
.fired-list[open] > summary { margin-bottom: 14px; }
.fired-list[open] > summary::after { content: "скрыть"; }
.table-note { margin-top: 12px; }

.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 16px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line);
}
.stats-grid.flat { margin-top: 0; padding-top: 0; border-top: 0; }
.stat-card {
    background: var(--grad); color: var(--on-grad);
    padding: 16px; border-radius: 12px; text-align: center;
}
.stat-card.secondary { background: var(--grad-2); }
.stat-card.tertiary  { background: var(--grad-3); }
.stat-card.quaternary { background: var(--grad-4); }
.stat-value { font-size: 26px; font-weight: 800; margin-bottom: 4px; white-space: nowrap; }
.stat-label { font-size: 12px; font-weight: 600; opacity: .85; }
.stat-sub { font-size: 12px; opacity: .75; margin-top: 6px; }

/* ===== карточки ===== */
.content { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.card { background: var(--card); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card.spaced { margin-bottom: 20px; }
.card-title {
    font-size: 16px; font-weight: 700; margin-bottom: 16px;
    display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
}
.card-title small { font-weight: 400; color: var(--muted); font-size: 12px; }
.chart-container { position: relative; height: 280px; }
.page-title { font-size: 22px; font-weight: 700; margin-bottom: 16px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ===== вкладки ===== */
.tabs { display: flex; border-bottom: 2px solid var(--line); margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
    padding: 12px 16px; font-size: 14px; font-weight: 500; color: var(--muted);
    text-decoration: none; white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.tab.active { color: var(--accent-text); border-bottom-color: var(--accent); }

.period-summary {
    display: flex; flex-wrap: wrap; gap: 6px 18px;
    padding: 10px 12px; background: var(--soft); border-radius: 10px;
    font-size: 13px; color: var(--muted); margin-bottom: 12px;
}
.period-summary b { color: var(--text); }

/* ===== таблицы ===== */
.table { width: 100%; border-collapse: collapse; }
.table th {
    background: var(--soft); padding: 12px; text-align: left;
    font-weight: 600; font-size: 13px; color: var(--muted);
    border-bottom: 2px solid var(--line); white-space: nowrap;
}
.table td { padding: 12px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: top; }
.table tr:hover td { background: var(--hover); }
.table tr.voided td { color: var(--muted); }
.table tr.voided .money { text-decoration: line-through; }
.table tr.dim td { opacity: .55; }
.num { text-align: right; white-space: nowrap; }
.table th.num { text-align: right; }
.shift-date { font-weight: 600; color: var(--text); }
.shift-sub, .shift-time { color: var(--muted); font-size: 12px; }
.pill { display: inline-block; background: var(--chip); color: var(--chip-text); padding: 3px 9px; border-radius: 6px; font-weight: 600; }
.route-pill { background: var(--accent-soft); color: var(--accent-text); }
.note { display: block; font-size: 11px; color: var(--warn); margin-top: 4px; }
.badge {
    display: inline-block; padding: 3px 9px; border-radius: 12px;
    font-size: 11px; font-weight: 600; background: var(--chip); color: var(--chip-text); white-space: nowrap;
}
.badge.live, .badge.ok { background: var(--good-bg); color: var(--good); }
.badge.done { background: var(--chip); color: var(--chip-text); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.void, .badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.admin { background: var(--grad); color: var(--on-grad); }
.estimate { color: var(--muted); font-weight: 400; font-size: 11px; }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person a { color: var(--text); font-weight: 600; text-decoration: none; }
.person a:hover { color: var(--accent-text); }
.mini-avatar {
    width: 32px; height: 32px; flex: none; border-radius: 50%;
    background: var(--grad); color: var(--on-grad);
    display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #3cc152; margin-right: 6px; }

.pagination {
    display: flex; justify-content: center; gap: 6px; flex-wrap: wrap;
    margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line);
}
.pagination a, .pagination span {
    padding: 6px 12px; border: 1px solid var(--line); background: var(--card);
    border-radius: 8px; font-size: 13px; text-decoration: none; color: var(--text);
    min-width: 36px; text-align: center;
}
.pagination a:hover { border-color: var(--accent); color: var(--accent-text); }
.pagination .active { background: var(--grad); color: var(--on-grad); border-color: transparent; font-weight: 700; }
.pagination .disabled { opacity: .4; }

.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-state-icon { font-size: 44px; margin-bottom: 10px; }

/* ===== штрафы ===== */
.fine-list { list-style: none; }
.fine-list li {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px;
}
.fine-list li:last-child { border-bottom: 0; }
.fine-list li.voided { color: var(--muted); }
.fine-list li.voided .fine-amount { text-decoration: line-through; color: var(--muted); }
.fine-amount { color: var(--bad); font-weight: 700; white-space: nowrap; }
.fine-meta { color: var(--muted); font-size: 12px; }

/* ===== фильтры над таблицами ===== */
.filters { margin-bottom: 14px; }
.filters .form-row + .form-row { margin-top: 10px; }
.filters .field > span { font-size: 12px; margin-bottom: 4px; }
.form-row .field.narrow-date { flex: 0 1 170px; }
.filter-actions { padding-bottom: 1px; }
.fine-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 12px; }
.chip-link {
    display: inline-block; padding: 4px 10px; border-radius: 12px; font-size: 12px; font-weight: 600;
    background: var(--chip); color: var(--text); text-decoration: none; white-space: nowrap;
}
.chip-link:hover { background: var(--accent-soft); color: var(--accent-text); }
.page-lead { margin: -8px 0 16px; max-width: 820px; line-height: 1.5; }
.inline-hint { display: inline !important; font-weight: 400; color: var(--muted); margin-left: 4px; }
.text-bad { color: var(--bad); }
.badge.tiny { font-size: 10px; padding: 1px 6px; margin-left: 4px; vertical-align: 1px; }
.table td.only-mobile { display: none; }
.audit-table td a { color: var(--text); font-weight: 600; text-decoration: none; }
.audit-table td a:hover { color: var(--accent-text); }

/* ===== рейтинг ===== */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.chip-link.on { background: var(--grad); color: var(--on-grad); }
.my-rank-main { display: flex; align-items: center; gap: 16px; }
.my-rank-title { font-size: 17px; font-weight: 700; margin-bottom: 2px; }
.my-rank-hint { margin-top: 8px; font-size: 13px; padding: 7px 10px; border-radius: 8px;
                background: var(--accent-soft); color: var(--accent-text); display: inline-block; }
.my-rank-hint.good { background: var(--good-bg); color: var(--good); }
.place, .place-big {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    border-radius: 50%; font-weight: 800; background: var(--chip); color: var(--chip-text);
}
.place { width: 30px; height: 30px; font-size: 14px; }
.place-big { width: 58px; height: 58px; font-size: 24px; }
.place-1 { background: linear-gradient(135deg, #FFD54A, #F2A900); color: #3a2600; }
.place-2 { background: linear-gradient(135deg, #E4E7EB, #AEB5BD); color: #2b2f33; }
.place-3 { background: linear-gradient(135deg, #F0B98A, #C77A3E); color: #3a1f08; }
.rating-table td { vertical-align: middle; }
.rating-table .name-cell { font-weight: 600; }
.rating-table .name-cell a { color: var(--text); text-decoration: none; }
.rating-table .name-cell a:hover { color: var(--accent-text); }
.rating-table tr.me td { background: var(--accent-soft); }
.coef { display: flex; align-items: center; gap: 10px; min-width: 140px; }
.coef b { min-width: 42px; font-size: 15px; }
.coef-bar { flex: 1; height: 8px; border-radius: 4px; background: var(--soft); overflow: hidden; max-width: 260px; }
.coef-bar span { display: block; height: 100%; border-radius: 4px; background: var(--grad); }
.dim-table td { color: var(--muted); }
.rating-banner {
    display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap;
    text-decoration: none; color: var(--text);
}
.rating-banner:hover { filter: brightness(.98); }
.rating-banner .go { font-size: 13px; font-weight: 700; color: var(--accent-text); white-space: nowrap; }

/* ===== формы и кнопки ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    background: var(--grad); color: var(--on-grad); border: 0;
    padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 700;
    cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(1px); }
.btn.block { width: 100%; }
.btn:disabled, .input:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn.ghost { background: var(--chip); color: var(--text); font-weight: 600; }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { background: var(--bad-bg); color: var(--bad); font-weight: 600; }
.btn.small { padding: 6px 10px; font-size: 12px; border-radius: 8px; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field small { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 400; }
.input {
    width: 100%; padding: 11px 12px; border-radius: 10px;
    border: 1px solid var(--line); background: var(--input); color: var(--text);
    font-size: 15px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 132, 0, .2); }
.input.sm { padding: 7px 9px; font-size: 14px; border-radius: 8px; }
select.input { appearance: auto; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.form-row .field { flex: 1 1 160px; margin-bottom: 0; }
.form-row .field.narrow { flex: 0 1 120px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* раскрывающаяся правка в строке */
details.edit > summary {
    list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
    font-size: 12px; font-weight: 600; color: var(--accent-text);
    padding: 5px 9px; border-radius: 8px; background: var(--accent-soft); white-space: nowrap;
}
details.edit > summary::-webkit-details-marker { display: none; }
details.edit[open] > summary { margin-bottom: 8px; }
.edit-box {
    background: var(--soft); border: 1px solid var(--line); border-radius: 10px;
    padding: 12px; min-width: 240px;
}
.edit-box .form-row { margin-bottom: 8px; }
.edit-box .field > span { font-size: 12px; margin-bottom: 4px; }
.field > span.stepper, .stepper { display: flex; flex-wrap: nowrap; align-items: stretch; margin: 0; }
.stepper button {
    width: 34px; border: 1px solid var(--line); background: var(--chip); color: var(--text);
    cursor: pointer; font-size: 16px; font-weight: 700;
}
.stepper button:first-child { border-radius: 8px 0 0 8px; border-right: 0; }
.stepper button:last-child { border-radius: 0 8px 8px 0; border-left: 0; }
.stepper .input { border-radius: 0; text-align: center; min-width: 0; width: 70px; -moz-appearance: textfield; }
.stepper .input::-webkit-outer-spin-button, .stepper .input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.reveal {
    border: 2px dashed var(--accent); background: var(--accent-soft); color: var(--text);
    padding: 16px; border-radius: 12px; margin-bottom: 16px;
}
.reveal code {
    font-size: 20px; font-weight: 800; letter-spacing: 1px; background: var(--card);
    padding: 4px 10px; border-radius: 8px; display: inline-block; margin: 4px 0; user-select: all;
}
.search { max-width: 320px; margin-bottom: 12px; }

/* ===== вход ===== */
.auth-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 16px; background: var(--grad); position: relative;
}
.auth-card {
    background: var(--card); color: var(--text); border-radius: 18px;
    padding: 30px 26px; width: 100%; max-width: 400px;
    box-shadow: 0 24px 60px rgba(80, 40, 0, .35);
}
.auth-logo {
    width: 64px; height: 64px; border-radius: 18px; background: var(--grad);
    display: flex; align-items: center; justify-content: center; font-size: 32px;
    margin: 0 auto 14px; box-shadow: 0 6px 18px rgba(255, 132, 0, .35);
}
.auth-card h1 { font-size: 22px; text-align: center; margin-bottom: 6px; }
.auth-card .lead { color: var(--muted); font-size: 14px; text-align: center; margin-bottom: 22px; line-height: 1.45; }
.auth-card .hint { color: var(--muted); font-size: 12px; text-align: center; margin-top: 16px; line-height: 1.5; }
.auth-card code { background: var(--chip); padding: 2px 6px; border-radius: 4px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 44px; }
.pw-eye {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    border: 0; background: none; cursor: pointer; padding: 6px; color: var(--muted);
    display: flex; align-items: center; justify-content: center; border-radius: 8px;
}
/* пароль скрыт — серый глаз, показан — оранжевый */
.pw-eye { transition: color .15s, background .15s; }
.pw-eye:hover { color: var(--text); }
.pw-eye.on, .pw-eye.on:hover { color: var(--accent); background: var(--accent-soft); }
.alert { background: var(--bad-bg); color: var(--bad); padding: 10px 12px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; line-height: 1.45; }
.alert.info { background: var(--accent-soft); color: var(--accent-text); }

.footer-note { text-align: center; color: var(--muted); font-size: 12px; padding: 8px 0 24px; }

/* ===== роли и автобусы ===== */
.badge.role-trainee { background: #e6efff; color: #2957b8; }
.badge.role-driver { background: var(--accent-soft); color: var(--accent-text); }
[data-theme="dark"] .badge.role-trainee { background: rgba(90, 140, 255, .18); color: #9ab8ff; }
.header-info h1 .badge { vertical-align: middle; font-size: 12px; }
.crumbs { margin-bottom: 12px; }
.crumbs .back {
    display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
    font-weight: 600; font-size: 14px; color: var(--accent-text);
    background: var(--accent-soft); padding: 8px 14px; border-radius: 10px;
}
.crumbs .back:hover { filter: brightness(1.05); }
.role-explain { display: grid; gap: 10px; font-size: 14px; line-height: 1.5; }
.bus-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.bus-tools .search { margin-bottom: 0; flex: 1 1 220px; }
.bus-group { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 12px; margin-bottom: 12px; }
.bus-group legend { padding: 0 6px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.check input, .bus-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.bus-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.bus-check {
    display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none;
    border: 1px solid var(--line); background: var(--soft); border-radius: 10px;
    padding: 8px 12px; font-weight: 600; font-size: 14px; transition: background .15s, border-color .15s;
}
.bus-check:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.bus-check.gone span { text-decoration: line-through; opacity: .7; }
.bus-chip { background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 14px; }
.save-bar {
    position: sticky; bottom: 0; z-index: 5; margin: 8px -20px -20px; padding: 14px 20px;
    background: var(--card); border-top: 1px solid var(--line); border-radius: 0 0 14px 14px;
    display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
}

/* ===== банковский счёт ===== */
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .5px; }
.stat-link { text-decoration: none; display: block; transition: transform .15s, box-shadow .15s; }
.stat-link:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(255, 132, 0, .3); }
.stat-value.bank-value {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 24px; letter-spacing: 2px; line-height: 1.3;
    white-space: normal; overflow-wrap: anywhere;
}
.bank-now { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.bank-number {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 24px; font-weight: 800; letter-spacing: 1.5px; overflow-wrap: anywhere;
}
.bank-number.sm { font-size: 15px; letter-spacing: 1px; }
.bank-new { color: var(--accent-text); font-size: 15px; }
.bank-pending {
    background: var(--warn-bg); color: var(--text); border-radius: 12px;
    padding: 12px 14px; margin-bottom: 14px; display: grid; gap: 10px; font-size: 14px; line-height: 1.5;
}
.bank-pending .input.sm { width: 220px; max-width: 100%; }
.bank-form p { margin-top: 10px; line-height: 1.5; }
.bank-input { letter-spacing: 3px; font-size: 18px; max-width: 220px; }
.digits-left { font-variant-numeric: tabular-nums; }
.digits-left.ok { color: var(--good); font-weight: 600; }
.bank-history { margin-top: 14px; font-size: 13px; }
.bank-history summary { cursor: pointer; color: var(--accent-text); font-weight: 600; }
.bank-history ul { list-style: none; margin-top: 8px; display: grid; gap: 6px; }
.bank-history li { padding: 8px 10px; background: var(--soft); border-radius: 8px; overflow-wrap: anywhere; }
.count {
    display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px;
    background: #e53935; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.notice-link { display: block; text-decoration: none; }
.notice-link:hover { filter: brightness(.97); }

/* ===== колокольчик ===== */
.bell-wrap { position: relative; }
.nav-btn.bell { position: relative; padding: 6px 10px; }
.bell-count { position: absolute; top: -6px; right: -6px; margin: 0; box-shadow: 0 0 0 2px #FFB000; }
.notice-panel {
    position: absolute; right: 0; top: calc(100% + 12px); z-index: 300;
    width: 380px; max-height: min(70vh, 560px); overflow-y: auto; overscroll-behavior: contain;
    background: var(--card); color: var(--text); border: 1px solid var(--line);
    border-radius: 14px; box-shadow: 0 18px 44px rgba(0, 0, 0, .28); text-align: left;
}
.notice-panel[hidden] { display: none; }
.np-head {
    position: sticky; top: 0; background: var(--card); z-index: 1;
    padding: 14px 16px 10px; font-weight: 700; font-size: 15px; border-bottom: 1px solid var(--line);
}
.np-section {
    padding: 10px 16px 6px; font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .6px; color: var(--muted);
}
.np-task { padding: 10px 16px 12px; border-bottom: 1px solid var(--line); display: grid; gap: 8px;
           background: var(--warn-bg); font-size: 13px; line-height: 1.45; }
.np-new { color: var(--accent-text); }
.np-item {
    display: flex; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line);
    text-decoration: none; color: var(--text); font-size: 13px; line-height: 1.4;
}
.np-item:hover { background: var(--hover); }
.np-item.unread { background: var(--accent-soft); }
.np-item.unread .np-text { font-weight: 600; }
.np-icon { flex: none; width: 22px; text-align: center; }
.np-text { min-width: 0; overflow-wrap: anywhere; }
.np-when { display: block; color: var(--muted); font-size: 11px; font-weight: 400; margin-top: 2px; }
.np-go { flex: none; align-self: center; font-size: 12px; font-weight: 700; color: var(--accent-text); }
.np-review { background: var(--warn-bg); }
.np-todo.urgent { background: var(--bad-bg); }
.np-reason { display: block; font-size: 12px; color: var(--bad); margin-top: 2px; }
.np-more { display: block; padding: 10px 16px; font-size: 13px; font-weight: 600; text-decoration: none;
           border-bottom: 1px solid var(--line); }
.np-empty { padding: 22px 16px; text-align: center; color: var(--muted); font-size: 13px; }

/* ===== меню пользователя ===== */
.user-menu { position: relative; }
.user-btn .lbl { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: middle; }
.user-dropdown {
    position: absolute; right: 0; top: calc(100% + 12px); z-index: 300;
    width: 250px; max-height: calc(100vh - 80px); overflow-y: auto; overscroll-behavior: contain;
    background: var(--card); color: var(--text); border: 1px solid var(--line);
    border-radius: 14px; box-shadow: 0 18px 44px rgba(0, 0, 0, .28); text-align: left;
}
.user-dropdown[hidden] { display: none; }
.user-dropdown form { display: block; }
.ud-item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 10px 16px; border: 0; background: none; cursor: pointer;
    text-decoration: none; color: var(--text); font-size: 13px; font-weight: 500; text-align: left;
}
.ud-item svg { flex: none; }
.ud-item:hover { background: var(--hover); }
.ud-item.active { color: var(--accent-text); font-weight: 700; }
.ud-sub { padding-left: 16px; }
.ud-section {
    padding: 10px 16px 4px; font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .6px; color: var(--muted);
}
.ud-divider { height: 1px; background: var(--line); margin: 4px 0; }
.ud-logout { color: var(--bad); }

/* ===== отчёты ===== */
tr.clickable { cursor: pointer; }
.report-btn {
    display: inline-block; padding: 5px 10px; border-radius: 8px; font-size: 12px; font-weight: 700;
    text-decoration: none; white-space: nowrap; background: var(--chip); color: var(--chip-text);
}
.report-btn.warn { background: var(--grad); color: var(--on-grad); }
.report-btn.bad { background: var(--bad-bg); color: var(--bad); }
.report-btn.ok { background: var(--good-bg); color: var(--good); }
.report-btn.void { background: var(--chip); color: var(--muted); }
.report-btn:hover { filter: brightness(1.05); }
.report-deadline { display: block; margin-top: 3px; }
.report-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.report-summary.todo { border: 2px solid var(--accent); }

.report-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.report-shift { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.report-shift a { color: var(--text); }
.report-status { text-align: right; }
.err-list { margin: 6px 0 0 18px; }
.crumbs-row { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

.laps-table { width: 100%; max-width: 560px; border-collapse: separate; border-spacing: 0 6px; }
.laps-table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 0 6px; }
.laps-table td { padding: 0 6px; vertical-align: middle; }
.laps-table .input.sm { width: 100%; min-width: 0; }
.laps-table td:first-child { width: 42%; }
.laps-table .lap-no { font-weight: 800; font-size: 16px; text-align: center; width: 60px; color: var(--accent-text); }
.laps-table.readonly td { padding: 8px 6px; background: var(--soft); }
.laps-table.readonly td:first-child { border-radius: 8px 0 0 8px; }
.laps-table.readonly td:last-child { border-radius: 0 8px 8px 0; }
.laps-table tfoot td { font-weight: 700; background: none !important; }
.lap-del { border: 0; background: var(--chip); color: var(--muted); width: 34px; height: 34px; border-radius: 8px; cursor: pointer; }
.lap-del:hover { background: var(--bad-bg); color: var(--bad); }
.laps-foot { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 6px; }

.dropzone {
    display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; cursor: pointer;
    border: 2px dashed var(--line); border-radius: 14px; padding: 22px 16px; background: var(--soft);
    transition: border-color .15s, background .15s; margin-top: 8px;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 10px; }
.shots.big { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.shot {
    position: relative; display: block; border-radius: 10px; overflow: hidden; background: #000;
    aspect-ratio: 16 / 9; border: 1px solid var(--line); cursor: pointer;
}
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
a.shot:hover img { transform: scale(1.04); }
.shot-bar {
    position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 8px; font-size: 11px; color: #fff;
    background: linear-gradient(transparent, rgba(0, 0, 0, .75)); display: flex; gap: 6px; align-items: center;
}
.shot-x {
    position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; border: 0;
    background: rgba(0, 0, 0, .65); color: #fff; cursor: pointer; font-size: 13px;
}
#shots-info.over { color: var(--bad); font-weight: 700; }

.kind-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 14px; }
.kind-tab {
    display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none;
    border: 1px solid var(--line); background: var(--soft); border-radius: 10px;
    padding: 10px 16px; font-weight: 600; font-size: 14px; transition: background .15s, border-color .15s;
}
.kind-tab input { width: 16px; height: 16px; accent-color: var(--accent); }
.kind-tab:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.video-embed {
    position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden;
    background: #000; margin-top: 10px; border: 1px solid var(--line);
}
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.upload-progress { margin: 12px 0; }
.upload-progress .bar { height: 8px; border-radius: 4px; background: var(--chip); overflow: hidden; margin-bottom: 6px; }
.upload-progress .bar span { display: block; height: 100%; width: 0; background: var(--grad); transition: width .2s; }

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.cmp-col { background: var(--soft); border-radius: 12px; padding: 12px 14px; }
.cmp-title { font-weight: 700; margin-bottom: 8px; }
.cmp-row { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; font-size: 14px; border-bottom: 1px dashed var(--line); }
.cmp-row:last-child { border-bottom: 0; }
.cmp-row span { color: var(--muted); }
.cmp-row.diff-row b { color: var(--bad); }
.cmp-row.diff-row b::after { content: " ≠"; }
.cmp-comment { margin-top: 8px; font-size: 13px; }
.diff { color: var(--bad); font-weight: 700; font-size: 12px; }
.review-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.review-grid > div > .card:last-child { margin-bottom: 20px; }
.decision .btn.danger { background: var(--bad-bg); color: var(--bad); }

.lightbox {
    position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, .92);
    display: flex; align-items: center; justify-content: center;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 94vw; max-height: 84vh; object-fit: contain; border-radius: 6px; }
.lightbox button {
    position: absolute; border: 0; background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer;
    width: 48px; height: 48px; border-radius: 50%; font-size: 26px; line-height: 1;
}
.lightbox button:hover { background: rgba(255, 255, 255, .25); }
.lb-x { top: 14px; right: 14px; font-size: 18px !important; }
.lb-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 14px; top: 50%; transform: translateY(-50%); }
.lb-bar { position: absolute; bottom: 14px; left: 0; right: 0; display: flex; justify-content: center; gap: 18px; color: #ddd; font-size: 14px; }
.lb-bar a { color: #FFD300; }

.name-edit { margin-top: 8px; }
.name-edit .edit-box { max-width: 420px; }
.name-edit .edit-box p { margin-top: 8px; }

.no-report { cursor: help; }
.no-report .why { display: none; }
.reports-start { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
@media (max-width: 640px) {
    /* на телефоне наведения нет — пишем причину прямо в карточке смены */
    .no-report .why { display: block; margin-top: 2px; font-size: 11px; }
}

/* ===== переключатель темы — круглая кнопка в левом нижнем углу ===== */
.theme-fab {
    position: fixed; z-index: 200;
    left: max(16px, env(safe-area-inset-left));
    bottom: max(16px, env(safe-area-inset-bottom));
    width: 52px; height: 52px; border-radius: 50%;
    background: var(--card); border: 2px solid var(--accent); color: var(--accent-text);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
    line-height: 1; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform .15s, box-shadow .15s;
    -webkit-tap-highlight-color: transparent;
}
.theme-fab:hover { transform: scale(1.08); box-shadow: 0 8px 22px rgba(0, 0, 0, .3); }
.theme-fab:active { transform: scale(.95); }
/* чтобы кнопка не закрывала низ страницы */
.footer-note { padding-bottom: 80px; }

/* ================= планшеты и телефоны ================= */
@media (max-width: 1024px) { .content { grid-template-columns: 1fr; } .review-grid { grid-template-columns: 1fr; } }

@media (max-width: 768px) {
    .container { padding: 12px; }
    .navbar { padding: 10px 12px; }
    .navbar-title { font-size: 16px; }
    .header { padding: 16px; margin-bottom: 14px; }
    .header-avatar { width: 58px; height: 58px; font-size: 22px; }
    .header-info h1 { font-size: 20px; }
    .header-info p { font-size: 12px; }
    .header-status { width: 100%; }
    .status-badge { flex: 1; text-align: center; font-size: 12px; padding: 7px 10px; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; padding-top: 14px; }
    .stats-grid.flat { margin-top: 0; padding-top: 0; }
    .stat-card { padding: 12px 8px; }
    .stat-value { font-size: 20px; }
    .stat-label, .stat-sub { font-size: 11px; }
    .content { gap: 14px; margin-bottom: 14px; }
    .card { padding: 16px; }
    .card.spaced { margin-bottom: 14px; }
    .card-title { font-size: 15px; margin-bottom: 12px; }
    .chart-container { height: 230px; }
    .page-title { font-size: 19px; }
}

@media (max-width: 640px) {
    .nav-btn .lbl { display: none; }
    .notice-panel, .user-dropdown { position: fixed; left: 8px; right: 8px; top: 58px; width: auto; max-height: calc(100vh - 70px); }
    .compare { grid-template-columns: 1fr; }
    .report-status { text-align: left; }
    .laps-table .lap-no { width: 40px; }
    .shots, .shots.big { grid-template-columns: repeat(2, 1fr); }
    .lightbox .lb-prev, .lightbox .lb-next { top: auto; bottom: 50px; transform: none; }
    .nav-btn { padding: 6px 10px; }

    /* таблицы превращаются в карточки */
    .table thead { display: none; }
    .table, .table tbody { display: block; }
    .table tbody tr {
        display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px;
        background: var(--soft); border: 1px solid var(--line);
        border-radius: 12px; padding: 12px; margin-bottom: 10px;
    }
    .table tr:hover td { background: transparent; }
    .table td { display: block; padding: 0; border: 0; min-width: 0; text-align: left; }
    .table td::before {
        content: attr(data-label); display: block; font-size: 11px;
        color: var(--muted); margin-bottom: 2px; font-weight: 400;
    }
    .table td.nolabel::before { display: none; }
    .table td.only-mobile { display: block; }
    /* рейтинг: место и имя в одну строку, под ними коэффициент и три цифры */
    .rating-table tbody tr { grid-template-columns: 34px 1fr 1fr 1fr; align-items: center; }
    .rating-table td.name-cell { grid-column: 2 / -1; }
    .rating-table td.full { grid-column: 1 / -1; }
    .rating-table:not(.dim-table) td[data-label="Кругов"] { grid-column: 1 / 3; }
    .rating-table.dim-table tbody tr { grid-template-columns: 1fr 1fr 1fr; }
    .rating-table tbody tr.me { background: var(--accent-soft); border-color: var(--accent); }
    .rating-table tr.me td { background: transparent; }
    .table td.hide-mobile { display: none; }
    .table td.full { grid-column: 1 / -1; }
    .table td.head { font-size: 15px; }
    .table td.end { justify-self: end; }
    .table td.sep { padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-top: -6px; color: var(--text); }
    .num { text-align: left; }

    /* смены: дата ··· статус / время / 2×2 цифры / правка */
    .shifts td[data-label="Дата"] { order: 1; }
    .shifts td[data-label="Статус"] { order: 2; }
    .shifts td[data-label="Время"] { order: 3; }
    .shifts td[data-label="Время"] br { display: none; }
    .shifts td[data-label="Время"] .shift-time::before { content: " · "; }
    .shifts td[data-label="Маршрут"] { order: 4; }
    .shifts td[data-label="Кругов"] { order: 5; }
    .shifts td[data-label="Пассажиры"] { order: 6; font-weight: 600; }
    .shifts td[data-label="Заработок"] { order: 7; }
    .shifts td[data-label="Заработок"] br { display: none; }
    .shifts td[data-label="Заработок"] .estimate { display: block; }
    .shifts td[data-label="Отчёт"] { order: 8; }
    .shifts td[data-label="Правка"] { order: 9; }
    .edit-box { min-width: 0; }

    .pagination a, .pagination span { padding: 8px 12px; }
    .save-bar { margin: 8px -16px -16px; padding: 12px 16px 12px 80px; }
    .save-bar .muted { display: none; }
    .form-row .field, .form-row .field.narrow { flex: 1 1 100%; }
    .form-row .btn { width: 100%; }
    .form-row .field.narrow-date { flex: 1 1 calc(50% - 5px); }
    .filters .filter-actions { width: 100%; flex-wrap: nowrap; }
    .filters .filter-actions .btn { flex: 1; padding: 9px 12px; font-size: 13px; }
}

/* Шапка с колокольчиком и меню пользователя не влезает рядом с надписью
   на 390–400 px — оставляем только иконку */
@media (max-width: 400px) {
    .navbar-title .lbl { display: none; }
    .navbar { padding: 10px 10px; }
    .navbar-right { gap: 6px; }
}

@media (max-width: 380px) {
    .stats-grid { grid-template-columns: 1fr; }
    .stat-value { font-size: 22px; }
    .header-avatar { width: 48px; height: 48px; font-size: 18px; }
    .header-info h1 { font-size: 18px; }
    .navbar-title .lbl { display: none; }
}

/* ===== приложение и уведомления ===== */
.alert.good { background: var(--good-bg); color: var(--good); }
.app-hero { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.app-hero img { border-radius: 16px; flex: none; box-shadow: 0 4px 12px rgba(0, 0, 0, .15); }
.app-hero p { margin-top: 4px; line-height: 1.45; }
.steps { padding-left: 20px; display: grid; gap: 8px; font-size: 14px; line-height: 1.45; margin-bottom: 8px; }
.step-icon { display: inline-flex; vertical-align: -3px; color: #1a7cf5; }
.push-status { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.45; margin-bottom: 14px; }
.push-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; background: var(--muted); }
.push-dot.on { background: #3cc152; box-shadow: 0 0 0 4px rgba(60, 193, 82, .18); }
.push-dot.off { background: var(--muted); }
.push-dot.wait { background: var(--accent); }
.push-actions { margin-bottom: 10px; }
.push-note { line-height: 1.45; }
.plain-list { padding-left: 18px; display: grid; gap: 6px; font-size: 14px; line-height: 1.45; margin-bottom: 12px; }
.device-list { list-style: none; margin-bottom: 10px; }
.device-list li {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.device-list li:last-child { border-bottom: 0; }
.device-list .muted.small { margin-top: 2px; }
/* атрибут hidden должен прятать и кнопки, у которых свой display */
[hidden] { display: none !important; }
