:root {
    --bg: #f3f5f8;
    --card: #fff;
    --ink: #1c2430;
    --muted: #667085;
    --line: #e4e7ec;
    --accent: #1f6feb;
    --accent-soft: #e8f0fe;
    --ok: #067647;
    --ok-bg: #ecfdf3;
    --err: #b42318;
    --err-bg: #fef3f2;
    --shadow: 0 8px 24px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: "Segoe UI", system-ui, sans-serif;
    background: var(--bg);
    color: var(--ink);
    min-height: 100vh;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #0f172a;
    color: #fff;
    padding: 12px 20px;
    position: sticky;
    top: 0;
    z-index: 20;
}
.brand { font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.menu-btn {
    display: none;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 10px;
    background: #1e293b;
    padding: 10px 11px;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
}
.menu-btn span {
    display: block;
    height: 2px;
    background: #fff;
    border-radius: 2px;
}
.topnav { display: flex; gap: 8px; flex: 1; }
.topnav a {
    color: #cbd5e1;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 8px;
    white-space: nowrap;
}
.topnav a.active, .topnav a:hover { background: #1e293b; color: #fff; }
.who { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.who span { white-space: nowrap; }
.who small { color: #94a3b8; }
.who a { color: #93c5fd; text-decoration: none; white-space: nowrap; }

.wrap { max-width: 1280px; margin: 0 auto; padding: 24px; }
.wrap.wide { max-width: none; padding: 16px 12px 32px; }

.people-banner {
    background: #fff3bf;
    border: 2px solid #f59f00;
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 16px;
    line-height: 1.5;
}

.legend-box {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 22px;
    margin-top: 14px;
    font-size: 13px;
    align-items: center;
}
.legend-box .swatch {
    display: inline-block;
    width: 22px;
    height: 14px;
    border: 1px solid #666;
    vertical-align: middle;
    margin-right: 6px;
}
.legend-box .swatch.cell-1 { background: #ffe566; }       /* Д — жёлтый */
.legend-box .swatch.cell-2 { background: #2196f3; }       /* Н — синий */
.legend-box .swatch.cell-V { background: #e53935; }       /* В — красный */
.legend-box .swatch.cell-R { background: #26a69a; }       /* Р — бирюзовый */
.legend-box .swatch.cell-TRAIN { background: #43a047; }   /* С — зелёный */
.legend-box .swatch.cell-FINE { background: #8e24aa; }    /* Ш — фиолетовый */
.legend-box .swatch.cell-A { background: #ffd700; }       /* А — золотой */
.legend-box .swatch.cell-O { background: #ff9800; }       /* О — оранжевый */
.legend-box .swatch.cell-BONUS { background: #00e5ff; }
.legend-box .swatch.cell-NOSHOW { background: #111; }

.sheet-scroll {
    overflow: auto;
    background: #fff;
    border: 1px solid #9aa0a6;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.swipe-hint {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 13px;
}
table.sheet {
    border-collapse: collapse;
    width: max-content;
    min-width: 100%;
    font-size: 13px;
    background: #fff;
}
table.sheet th,
table.sheet td {
    border: 1px solid #8a8a8a;
    text-align: center;
    padding: 0;
    min-width: 38px;
    height: 34px;
    white-space: nowrap;
    vertical-align: middle;
}
table.sheet thead th {
    background: #f5f5f5;
    font-weight: 700;
    padding: 4px 2px;
    line-height: 1.15;
}
table.sheet thead th.wday {
    font-weight: 600;
    font-size: 11px;
    text-transform: capitalize;
    color: #333;
    padding-bottom: 6px;
}
table.sheet thead th.weekend {
    background: #fff0f0;
    color: #c62828;
}
table.sheet .name-col {
    position: sticky;
    left: 0;
    z-index: 2;
    min-width: 170px;
    max-width: 220px;
    text-align: left;
    padding: 6px 10px;
    background: #fff;
    font-weight: 600;
    box-shadow: 2px 0 0 rgba(0,0,0,.06);
}
table.sheet thead .name-col {
    z-index: 3;
    background: #f5f5f5;
}
table.sheet tbody tr:nth-child(even) .name-col {
    background: #f7f9fc;
}
table.sheet tbody tr:nth-child(even) td.mark-cell {
    background: #fafbfd;
}
table.sheet td.mark-cell.we {
    background: #fff8f8;
}
table.sheet tbody tr:nth-child(even) td.mark-cell.we {
    background: #fff3f3;
}

.mark-cell { padding: 0 !important; }
table.sheet select.mark-select {
    display: block;
    width: 100%;
    min-width: 38px;
    height: 34px;
    margin: 0;
    border: 0;
    border-radius: 0;
    padding: 0;
    background: transparent;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    text-align-last: center;
    cursor: pointer;
    appearance: auto;
    -webkit-appearance: menulist;
}
table.sheet select.mark-select:focus {
    outline: 2px solid #1f6feb;
    outline-offset: -2px;
}
/* Подсветка отметок графика */
table.sheet select.mark-select.cell-1,
.mark-view.cell-1 { background: #ffe566; color: #5d4e00; }          /* Д жёлтый */
table.sheet select.mark-select.cell-2,
.mark-view.cell-2 { background: #2196f3; color: #fff; }             /* Н синий */
table.sheet select.mark-select.cell-V,
.mark-view.cell-V { background: #e53935; color: #fff; }             /* В красный */
table.sheet select.mark-select.cell-R,
.mark-view.cell-R { background: #26a69a; color: #fff; }             /* Р рабочий офис */
table.sheet select.mark-select.cell-TRAIN,
.mark-view.cell-TRAIN { background: #43a047; color: #fff; }         /* С зелёный */
table.sheet select.mark-select.cell-FINE,
.mark-view.cell-FINE { background: #8e24aa; color: #fff; }          /* Ш фиолетовый */
table.sheet select.mark-select.cell-A,
.mark-view.cell-A { background: #ffd700; color: #5d4e00; }          /* А золотой */
table.sheet select.mark-select.cell-O,
.mark-view.cell-O { background: #ff9800; color: #fff; }             /* О оранжевый */
table.sheet select.mark-select.cell-BONUS,
.mark-view.cell-BONUS { background: #00e5ff; color: #004d57; }
table.sheet select.mark-select.cell-NOSHOW,
.mark-view.cell-NOSHOW { background: #111; color: #fff; }
.mark-view {
    display: block;
    min-height: 34px;
    line-height: 34px;
    font-weight: 700;
}
.cell-empty { background: transparent; }

.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.alert.err { background: var(--err-bg); color: var(--err); }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 20px;
}

h1 { font-size: 24px; margin: 0 0 16px; }
h2 { font-size: 18px; margin: 0 0 12px; }

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}
.toolbar .spacer { flex: 1; }

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input, select, textarea, button {
    font: inherit;
}
input[type="text"], input[type="password"], input[type="date"], input[type="time"], input[type="tel"], select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
}
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 12px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 10px;
    padding: 10px 14px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    text-decoration: none;
}
.btn.secondary { background: #e2e8f0; color: var(--ink); }
.btn.danger { background: #b42318; }
.btn.ghost { background: transparent; color: var(--accent); padding: 4px 8px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-weight: 600; }

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(160deg, #0f172a, #1e3a5f);
}
.login-box { width: min(420px, 92vw); }
.login-box h1 { color: var(--ink); }
.hint { color: var(--muted); font-size: 13px; margin-top: 16px; line-height: 1.5; }

.calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}
.dow, .day {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    min-height: 120px;
    padding: 8px;
}
.dow {
    min-height: auto;
    background: transparent;
    border: 0;
    font-size: 12px;
    color: var(--muted);
    font-weight: 600;
    text-align: center;
}
.day.empty { background: transparent; border: 0; }
.day .num { font-weight: 700; margin-bottom: 6px; display: flex; justify-content: space-between; }
.day.today { outline: 2px solid var(--accent); }
.shift {
    font-size: 12px;
    background: var(--accent-soft);
    color: #163a8a;
    border-radius: 8px;
    padding: 4px 6px;
    margin-bottom: 4px;
    cursor: pointer;
}
.shift .who { display: block; font-weight: 600; color: inherit; font-size: 12px; }
.badge {
    display: inline-block;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 600;
}
.badge.create { background: #ecfdf3; color: #067647; }
.badge.update { background: #eff8ff; color: #175cd3; }
.badge.delete { background: #fef3f2; color: #b42318; }

.modal-bg {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, .45);
    display: none;
    place-items: center;
    padding: 16px;
}
.modal-bg.open { display: grid; }
.modal { width: min(480px, 100%); }

@media (max-width: 900px) {
    .topbar { flex-wrap: wrap; }
}

.table-responsive { overflow: auto; -webkit-overflow-scrolling: touch; }
.btn { min-height: 40px; }

@media (min-width: 1100px) {
    .swipe-hint { display: none !important; }
}

@media (max-width: 1099px) {
    .swipe-hint { display: block; }
    .wrap { padding: 16px; }
    .wrap.wide { padding: 12px; }
    .toolbar h1 { font-size: 20px; margin: 0; }
    table.sheet th, table.sheet td {
        height: 34px;
        min-width: 34px;
    }
    table.sheet .name-col { min-width: 120px; left: 0; }
    table.sheet .mark-select { height: 34px; }
}

@media (max-width: 768px) {
    .menu-btn { display: flex; }
    .topbar {
        flex-wrap: wrap;
        padding: 10px 12px;
        gap: 8px;
    }
    .brand { flex: 1; }
    .topnav {
        display: none;
        flex-basis: 100%;
        flex-direction: column;
        gap: 4px;
        padding-top: 8px;
    }
    body.nav-open .topnav { display: flex; }
    .who {
        width: 100%;
        justify-content: space-between;
        font-size: 13px;
        padding-top: 4px;
    }
    .who small { display: none; }
    .wrap { padding: 12px; }
    .wrap.wide { padding: 8px; }
    h1 { font-size: 20px; }
    .card { padding: 14px; border-radius: 12px; }
    .row { grid-template-columns: 1fr; }
    .toolbar { gap: 8px; }
    .toolbar .spacer { display: none; }
    .toolbar .btn { flex: 1; }
    .login-page { padding: 16px; }
    .login-box { width: 100%; }
    table.sheet .name-col {
        min-width: 120px;
        max-width: none;
        overflow: visible;
        font-size: 13px;
    }
    table.sheet th, table.sheet td {
        min-width: 40px;
        font-size: 12px;
    }
    table.sheet select.mark-select { min-height: 36px; height: 36px; }
    input[type="text"], input[type="password"], input[type="date"], input[type="time"], input[type="tel"], select, textarea {
        font-size: 16px;
        min-height: 44px;
    }
    table.sheet select {
        min-height: 36px;
    }
    .legend-box { font-size: 12px; gap: 10px 14px; }
}

@media (max-width: 480px) {
    .brand { font-size: 15px; }
    table.sheet .name-col,
    table.sheet thead .name-col {
        min-width: 78px;
        max-width: 78px;
    }
}

.inline-pass { display: flex; gap: 8px; align-items: center; }
.inline-pass input { min-width: 140px; }

.formula-note {
    color: var(--muted);
    font-size: 13px;
    margin: 0 0 12px;
    line-height: 1.45;
}
.workers-hint {
    font-size: 11px;
    color: #667085;
    margin-top: 4px;
    line-height: 1.3;
    white-space: normal;
    max-width: 220px;
}

table.seller-bonus {
    min-width: 900px;
    font-size: 12px;
}
table.seller-bonus thead th.wholesale-head {
    background: #ffe08a;
}
table.seller-bonus .col-seller-bonus {
    background: #00ffff;
    min-width: 64px;
}
table.seller-bonus .col-day-total {
    background: #d9ead3;
    font-weight: 700;
    min-width: 70px;
}
table.seller-bonus tfoot .col-seller-bonus,
table.seller-bonus tfoot .col-day-total {
    background: #ffff00;
}
table.seller-bonus input[type="text"] {
    min-width: 90px;
    font-size: 12px;
    padding: 4px 6px;
}

.seller-bonus-board { display: grid; gap: 14px; }
.seller-emp-card {
    background: #fff;
    border: 1px solid #d0d5dd;
    border-radius: 12px;
    padding: 12px;
}
.seller-emp-card h2 {
    margin: 0 0 10px;
    font-size: 17px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: baseline;
}
.seller-emp-card .seller-rate {
    font-size: 12px;
    color: #667085;
    font-weight: 600;
}
.day-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.bonus-day-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 72px;
    border: 1px solid #c5c9d1;
    border-radius: 8px;
    padding: 4px 3px 6px;
    background: #eef6ff;
    font-size: 11px;
}
.bonus-day-box.weekend { background: #ffe4e4; }
.bonus-day-box .d { font-weight: 700; font-size: 14px; line-height: 1.1; }
.bonus-day-box .w { color: #555; margin-bottom: 4px; }
.bonus-day-box.weekend .w { color: #b42318; font-weight: 700; }
.bonus-day-input,
.bonus-day-val {
    width: 64px;
    min-height: 30px;
    border: 1px solid #98a2b3;
    border-radius: 6px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    background: #fff;
    padding: 2px 2px;
}
.bonus-day-val {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #344054;
}
.bonus-day-bonus {
    margin-top: 3px;
    min-height: 14px;
    font-size: 11px;
    font-weight: 700;
    color: #0f766e;
}
.seller-card-total {
    margin-top: 10px;
    font-size: 13px;
    color: #344054;
}
.seller-card-total .col-seller-bonus-text { color: #0f766e; }

.checkpoint-strip, .present-strip {
    margin: 10px 0 14px;
    overflow-x: auto;
}
.checkpoint-label {
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 6px;
    color: #334155;
}
.checkpoint-box { background: #fff8e1; border-color: #ffe082; width: 84px; }
.checkpoint-box .bonus-day-input,
.checkpoint-box .bonus-day-val {
    width: 76px;
    font-size: 12px;
    background: #fffde7;
}
.checkpoint-box .bonus-day-input.is-on {
    background: #ffd54f;
    font-weight: 700;
}
.present-box {
    background: #f1f5f9;
    min-height: 64px;
    justify-content: flex-start;
}
.present-line {
    display: block;
    font-size: 11px;
    line-height: 1.25;
    color: #475569;
}
.bonus-day-box.mark-O { outline: 2px solid #26a69a; }
.cp-share {
    display: block;
    color: #b45309;
    font-weight: 700;
    font-size: 10px;
}
.seller-pool-note {
    margin: 4px 0 0;
    font-size: 14px;
    color: #344054;
}

@media (max-width: 600px) {
    .bonus-day-box { width: 64px; }
    .bonus-day-input, .bonus-day-val { width: 56px; font-size: 11px; }
}

.filter-bar .row > div { min-width: 140px; }
.report-box h2 { margin-bottom: 12px; }
.report-totals {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.report-pill {
    background: #f8fafc;
    border: 1px solid #d0d5dd;
    border-radius: 12px;
    padding: 12px 16px;
    min-width: 160px;
}
.report-pill span {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 4px;
}
.report-pill b {
    font-size: 20px;
}
table.report-sellers {
    min-width: 480px;
}
table.report-sellers .col-seller-bonus { background: #00ffff; }

table.personal-cal {
    min-width: 480px;
    width: 100%;
}
table.personal-cal .wday-inline {
    margin-left: 8px;
    font-size: 12px;
    color: #555;
    font-weight: 600;
}
table.personal-cal .wday-inline.weekend { color: #c62828; }
table.personal-cal tr.weekend-row td { background: #fff8f8; }
table.personal-cal .hint-cell {
    text-align: left;
    color: #667085;
    font-size: 12px;
    padding: 4px 10px;
}
table.personal-cal tfoot td { background: #fff3bf; }

/* Личный календарь продавца (как Google Calendar) */
.cal-month-title {
    font-weight: 700;
    font-size: 18px;
    min-width: 160px;
    text-align: center;
}
.gcal {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.gcal-head {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #f8fafc;
    border-bottom: 1px solid var(--line);
}
.gcal-dow {
    text-align: center;
    padding: 10px 4px;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.gcal-dow.weekend { color: #c62828; }
.gcal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}
.gcal-day {
    min-height: 96px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: 6px;
    background: #fff;
}
.gcal-day:nth-child(7n) { border-right: 0; }
.gcal-day.empty { background: #fafbfc; }
.gcal-day.weekend { background: #fff8f8; }
.gcal-day.today { background: #f0f7ff; }
.gcal-num {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 4px;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}
.gcal-num.is-today {
    background: #1a73e8;
    color: #fff;
}
.gcal-event {
    border-radius: 6px;
    padding: 4px 6px;
    font-size: 12px;
    line-height: 1.25;
    font-weight: 700;
    overflow: hidden;
}
.gcal-event-label { display: block; }
.gcal-event-time {
    display: block;
    font-size: 10px;
    font-weight: 600;
    opacity: 0.9;
    margin-top: 1px;
}
.gcal-event.cell-1 { background: #ffe566; color: #5d4e00; }
.gcal-event.cell-2 { background: #2196f3; color: #fff; }
.gcal-event.cell-V { background: #e53935; color: #fff; }
.gcal-event.cell-R { background: #26a69a; color: #fff; }
.gcal-event.cell-TRAIN { background: #43a047; color: #fff; }
.gcal-event.cell-FINE { background: #8e24aa; color: #fff; }
.gcal-event.cell-A { background: #ffd700; color: #5d4e00; }
.gcal-event.cell-O { background: #ff9800; color: #fff; }
.gcal-event.cell-BONUS { background: #00e5ff; color: #004d57; }
.gcal-event.cell-NOSHOW { background: #111; color: #fff; }

.gcal-bonus {
    margin-top: 4px;
    font-size: 12px;
    font-weight: 800;
    color: #1b5e20;
    background: #e8f5e9;
    border-radius: 6px;
    padding: 3px 6px;
    display: inline-block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gcal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin: 12px 0 20px;
    font-size: 13px;
    color: var(--muted);
}
.gcal-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.gcal-legend-total {
    margin-left: auto;
    color: var(--ink);
}
.gcal-legend-total b {
    color: #1b5e20;
}
.gcal-legend .swatch {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    display: inline-block;
    border: 1px solid rgba(0,0,0,.08);
}
.gcal-legend .swatch.cell-1 { background: #ffe566; }
.gcal-legend .swatch.cell-2 { background: #2196f3; }
.gcal-legend .swatch.cell-V { background: #e53935; }
.gcal-legend .swatch.cell-R { background: #26a69a; }
.gcal-legend .swatch.cell-TRAIN { background: #43a047; }
.gcal-legend .swatch.cell-FINE { background: #8e24aa; }
.gcal-legend .swatch.cell-A { background: #ffd700; }
.gcal-legend .swatch.cell-O { background: #ff9800; }
.gcal-legend .swatch.cell-NOSHOW { background: #111; }
.gcal-legend .swatch.cell-BONUS { background: #00e5ff; }

.my-bonus h2 {
    margin: 8px 0 6px;
    font-size: 20px;
}
.my-bonus-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 4px;
}
.my-stat {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
}
.my-stat.accent {
    background: #fff8e1;
    border-color: #ffe082;
}
.my-stat-label {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 4px;
}
.my-stat-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--ink);
}
.my-bonus-table { width: 100%; }
.my-bonus-table th, .my-bonus-table td {
    padding: 10px 12px;
}
.my-bonus-table tfoot td { background: #fff3bf; }
.my-bonus-table .wday-inline {
    margin-left: 6px;
    font-size: 12px;
    color: #667085;
}
.my-bonus-table tr.weekend-row td { background: #fff8f8; }
.mark-chip {
    display: inline-block;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 700;
}
.mark-chip.cell-1 { background: #ffe566; color: #5d4e00; }
.mark-chip.cell-2 { background: #2196f3; color: #fff; }
.mark-chip.cell-V { background: #e53935; color: #fff; }
.mark-chip.cell-TRAIN { background: #43a047; color: #fff; }
.mark-chip.cell-FINE { background: #8e24aa; color: #fff; }
.mark-chip.cell-A { background: #ffd700; color: #5d4e00; }
.mark-chip.cell-O { background: #ff9800; color: #fff; }
.mark-chip.cell-BONUS { background: #00e5ff; color: #004d57; }
.mark-chip.cell-NOSHOW { background: #111; color: #fff; }

@media (max-width: 700px) {
    .gcal-day { min-height: 72px; padding: 4px; }
    .gcal-event { font-size: 11px; padding: 3px 4px; }
    .gcal-event-time { display: none; }
    .gcal-num { width: 22px; height: 22px; font-size: 12px; }
    .cal-month-title { font-size: 16px; min-width: 120px; }
}
table.bonus-sheet {
    border-collapse: collapse;
    width: 100%;
    min-width: 640px;
    background: #fff;
    font-size: 14px;
}
table.bonus-sheet th, table.bonus-sheet td {
    border: 1px solid #222;
    padding: 6px 8px;
    text-align: center;
}
table.bonus-sheet thead th {
    background: #dbe4ee;
    font-weight: 700;
    color: #111;
}
table.bonus-sheet .date-col { text-align: left; white-space: nowrap; width: 120px; }
table.bonus-sheet .col-general { background: #d9d9d9; }
table.bonus-sheet .col-admin { background: #00ffff; }
table.bonus-sheet tfoot .total-bonus td,
table.bonus-sheet tfoot .total-bonus .col-general,
table.bonus-sheet tfoot .total-bonus .col-admin { background: #ffff00; font-weight: 700; }
table.bonus-sheet input[type="text"],
table.bonus-sheet input[type="number"] {
    width: 100%;
    border: 0;
    border-radius: 0;
    padding: 6px 4px;
    background: transparent;
    text-align: right;
    min-height: 32px;
}

/* ===== Tasks ===== */
.btn.success { background: #12b76a; color: #fff; }
.btn.success:hover { background: #039855; }
.btn.active-status { background: #1f6feb; color: #fff; border-color: #1f6feb; }

.task-filters { margin-bottom: 16px; }
.task-filters-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    align-items: end;
}
.task-filters-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.task-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.task-status.st-new { background: #e4e7ec; color: #344054; }
.task-status.st-assigned { background: #dbeafe; color: #1d4ed8; }
.task-status.st-work { background: #ccfbf1; color: #0f766e; }
.task-status.st-wait { background: #fef3c7; color: #b45309; }
.task-status.st-decided { background: #ede9fe; color: #6d28d9; }
.task-status.st-done { background: #d1fadf; color: #067647; }
.task-status.st-closed { background: #111827; color: #fff; }

.verify-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 8px;
}

.overdue-flag { display: block; color: #b42318; font-size: 12px; margin-top: 4px; }

.task-list { display: grid; gap: 12px; }
.task-card {
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 4px 14px rgba(16,24,40,.04);
}
.task-card.is-overdue {
    background: #fff5f5;
    border-left: 4px solid #b42318;
}
.task-card-top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.task-id { color: #667085; font-weight: 700; }
.task-title { color: #175cd3; font-weight: 700; text-decoration: none; font-size: 16px; }
.task-title:hover { text-decoration: underline; }
.task-preview { margin: 6px 0 0; color: #667085; font-size: 13px; }
.task-meta {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 12px;
    font-size: 13px;
}
.meta-label { display: block; color: #98a2b3; font-size: 11px; margin-bottom: 2px; }
.task-card-actions { margin-top: 12px; }

.desktop-only-tasks { display: none; }
table.tasks-table { width: 100%; border-collapse: collapse; }
table.tasks-table th, table.tasks-table td {
    border-bottom: 1px solid #e4e7ec;
    padding: 10px 8px;
    text-align: left;
    vertical-align: top;
    font-size: 14px;
}
table.tasks-table tr.is-overdue td { background: #fff5f5; }
table.tasks-table tr.is-overdue td:first-child { box-shadow: inset 4px 0 0 #b42318; }
table.tasks-table a { color: #175cd3; font-weight: 600; text-decoration: none; }

.task-form-wrap { max-width: 720px; margin: 0 auto; }
.task-form-card h1 { margin-bottom: 16px; }
.task-form-card label { margin-top: 12px; }
.task-form-card textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }

.task-detail {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}
.task-detail.is-overdue > .task-main > .card:first-child {
    border-left: 4px solid #b42318;
    background: #fffafa;
}
.task-detail-head {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}
.task-detail-head h1 { margin: 0; font-size: 22px; line-height: 1.3; }
.task-desc {
    background: #f8fafc;
    border: 1px solid #e4e7ec;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
    white-space: pre-wrap;
}
.deadline-row, .inline-form, .add-observer {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
}
.deadline-row label, .inline-form label, .add-observer label { margin: 0; }
.deadline-row input[type="date"], .inline-form select, .add-observer select {
    width: auto;
    min-width: 160px;
}
.task-people-line { margin-top: 14px; font-size: 14px; }
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
}
.task-comments { display: grid; gap: 12px; margin-bottom: 14px; }
.task-comment {
    border: 1px solid #e4e7ec;
    border-radius: 10px;
    padding: 10px 12px;
    background: #fafbfc;
}
.task-comment-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
    color: #667085;
    margin-bottom: 6px;
}
.comment-form textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
}
.task-attachments, .task-comment { display: flex; flex-wrap: wrap; gap: 8px; }
.task-comment { display: block; }
.task-thumb {
    display: inline-block;
    width: 96px;
    height: 96px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #d0d5dd;
}
.task-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.task-views, .observer-list { list-style: none; padding: 0; margin: 0 0 12px; }
.task-views li, .observer-list li {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid #eef2f6;
    font-size: 13px;
}
.muted.small { font-size: 12px; }
.task-side .card h2 { font-size: 16px; }

@media (min-width: 900px) {
    .task-list { display: none; }
    .desktop-only-tasks { display: block; }
    .task-meta { grid-template-columns: repeat(3, 1fr); }
    .task-detail {
        grid-template-columns: minmax(0, 1.7fr) minmax(260px, 0.9fr);
        align-items: start;
    }
}

@media (max-width: 899px) {
    .desktop-only-tasks { display: none !important; }
    .task-list { display: grid; }
    .task-detail-head h1 { font-size: 18px; }
    .tasks-toolbar { gap: 8px; }
}

.name-col .point-tag {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #667085;
    margin-top: 2px;
}
.adj-chip {
    display: inline-block;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 700;
}
.adj-chip.adj-premium { background: #e8f5e9; color: #1b5e20; }
.adj-chip.adj-deduction { background: #ffebee; color: #b71c1c; }
.adj-chip.adj-debt { background: #ffedd5; color: #9a3412; }
.adj-plus { color: #1b5e20; font-weight: 700; }
.adj-minus { color: #b71c1c; font-weight: 700; }

table.payroll-sheet {
    border-collapse: separate;
    border-spacing: 0;
    width: max-content;
    min-width: 100%;
    background: #fff;
    font-size: 13px;
}
table.payroll-sheet th, table.payroll-sheet td {
    border: 1px solid #222;
    border-top-width: 0;
    border-left-width: 0;
    padding: 4px 8px;
    text-align: center;
    vertical-align: middle;
}
table.payroll-sheet tr > *:first-child {
    border-left-width: 1px;
}
table.payroll-sheet thead tr > * {
    border-top-width: 1px;
}
table.payroll-sheet thead th {
    background: #dbe4ee;
    font-weight: 700;
    white-space: nowrap;
}
table.payroll-sheet .name-col {
    text-align: left;
    min-width: 160px;
    max-width: 220px;
    position: sticky;
    left: 0;
    background: #fff;
    z-index: 1;
    border-right: 2px solid #222;
    box-shadow: 4px 0 0 rgba(0, 0, 0, 0.06);
}
table.payroll-sheet thead .name-col { background: #dbe4ee; z-index: 2; }
table.payroll-sheet tfoot .name-col { background: #fff59d; }
table.payroll-sheet .col-acc { background: #e0f7fa; }
table.payroll-sheet .col-ded { background: #ffe0b2; }
table.payroll-sheet .col-total {
    background: #c8e6c9;
    font-weight: 700;
    white-space: nowrap;
    min-width: 110px;
    padding-left: 10px;
    padding-right: 10px;
}
table.payroll-sheet tfoot td { background: #fff59d; font-weight: 700; }
table.payroll-sheet tfoot .col-total {
    white-space: nowrap;
    min-width: 110px;
}
table.payroll-sheet .col-money,
table.payroll-sheet td.col-acc,
table.payroll-sheet th.col-acc {
    white-space: nowrap;
    min-width: 88px;
}
table.payroll-sheet input[type="text"],
table.payroll-sheet input[type="number"] {
    width: 100%;
    min-width: 72px;
    border: 0;
    background: transparent;
    text-align: right;
    padding: 4px 2px;
    font-size: 13px;
}
table.sheet td.mark-cell.locked {
    opacity: 0.85;
    background: #f3f4f6;
}

/* График: чекпоинт, итог дней, вышло груз/ост */
table.schedule-sheet .days-total-col,
table.schedule-sheet .days-total-cell {
    min-width: 48px !important;
    width: 52px;
    background: #fff8e1 !important;
    font-weight: 800;
    position: sticky;
    right: 0;
    z-index: 2;
    border-left: 2px solid #f0c14b;
}
table.schedule-sheet thead .days-total-col {
    background: #ffe082 !important;
    z-index: 3;
}
table.schedule-sheet .checkpoint-row th {
    padding: 4px 2px !important;
    height: auto;
    background: #fffde7;
}
table.schedule-sheet .checkpoint-cell.weekend { background: #ffe8e8; }
.checkpoint-mark-input {
    width: 100%;
    min-width: 42px;
    max-width: 56px;
    height: 28px;
    text-align: center;
    border: 1px solid #f0c14b;
    border-radius: 6px;
    background: #fff;
    font-weight: 700;
    font-size: 11px;
    color: #b45309;
    padding: 0 2px;
}
.checkpoint-mark-input.is-on,
.checkpoint-flag.is-on {
    background: #ffd54f;
    color: #5d4e00;
}
.checkpoint-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 28px;
    padding: 0 3px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 10px;
}
table.schedule-sheet tfoot .present-foot-row td {
    background: #f1f5f9;
    padding: 4px 2px !important;
    height: auto;
    vertical-align: middle;
    font-size: 10px;
    line-height: 1.2;
}
table.schedule-sheet tfoot .present-foot-cell.we { background: #ffe8e8; }
table.schedule-sheet tfoot .name-col {
    background: #e2e8f0 !important;
    font-weight: 700;
    font-size: 12px;
    text-align: left;
    padding: 6px 8px !important;
}
.pf-line {
    display: block;
    white-space: nowrap;
    color: #475569;
}
.pf-line b { color: #0f172a; }

.schedule-autosave-bar {
    align-items: center;
    gap: 12px;
}
.autosave-status {
    font-size: 13px;
    color: #64748b;
}
.autosave-status.is-saving { color: #b45309; }
.autosave-status.is-ok { color: #15803d; }
.autosave-status.is-err { color: #b91c1c; font-weight: 600; }
.mark-select.is-saving { outline: 2px solid #fbbf24; }

.fired-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 4px;
    background: #dc2626;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    vertical-align: middle;
    text-transform: lowercase;
}
.warn-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 4px;
    background: #d97706;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    vertical-align: middle;
}
tr.row-no-manager td {
    background: #fffbeb;
}
tr.row-fired td.name-col,
td.name-col.fired {
    color: #b91c1c !important;
    background: #fef2f2 !important;
}
tr.row-fired td {
    background: #fff5f5;
}
table.schedule-sheet tr.row-fired td.name-col {
    background: #fecaca !important;
    color: #991b1b !important;
}
table.schedule-sheet tr.row-fired td.mark-cell.fired-cell {
    opacity: 0.85;
}
table.card tr.row-fired td,
.card table tr.row-fired td {
    color: #b91c1c;
    background: #fef2f2;
}
