/* График выездов — Trezo light (scoped to .graph-page) */
.graph-page {
    --gr-bg: #f0f2f5;
    --gr-card: #ffffff;
    --gr-surface: #f8fafc;
    --gr-border: #e7ebf3;
    --gr-text: #23272e;
    --gr-muted: #64748b;
    --gr-accent: #605dff;
    --gr-accent-hover: #4f4ae8;
    --gr-success: #198754;
    --gr-radius: 12px;
    --gr-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
    --gr-input-bg: #ffffff;
    --gr-head-gradient: linear-gradient(135deg, #605dff 0%, #3b82f6 100%);

    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    color: var(--gr-text);
    background: var(--gr-bg);
    border-radius: var(--gr-radius);
    padding: 20px 20px 32px;
    margin-top: 8px;
    margin-bottom: 24px;
}

.graph-page .material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    vertical-align: middle;
    font-size: 20px;
    line-height: 1;
}

/* ——— Compact collapsible filter ——— */
.trezo-filter {
    background: var(--gr-card);
    border: 1px solid var(--gr-border);
    border-radius: var(--gr-radius);
    margin-bottom: 16px;
    box-shadow: var(--gr-shadow);
    overflow: hidden;
}

.trezo-filter__bar {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 6px 10px 6px 6px;
}

.trezo-filter__toggle {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    color: var(--gr-muted);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.trezo-filter__toggle:hover,
.trezo-filter__toggle:focus {
    background: var(--gr-bg);
    color: var(--gr-accent);
    text-decoration: none;
}

.trezo-filter__summary {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: inherit;
    padding: 4px 0;
}

.trezo-filter__summary:hover,
.trezo-filter__summary:focus {
    text-decoration: none;
    color: inherit;
}

.trezo-filter__chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--gr-text);
    background: var(--gr-surface);
    border: 1px solid var(--gr-border);
    border-radius: 999px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.trezo-filter__chip .material-symbols-outlined {
    font-size: 16px;
    color: var(--gr-accent);
    flex-shrink: 0;
}

.trezo-filter__actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.trezo-filter__body {
    border-top: 1px solid var(--gr-border);
    padding: 12px 14px 14px;
    background: var(--gr-surface);
}

.trezo-filter__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px 12px;
    align-items: end;
}

.trezo-filter__field .form-group {
    margin-bottom: 0;
}

.trezo-filter__field .control-label {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gr-muted);
}

.trezo-filter__field .form-control {
    height: 36px;
    padding: 6px 10px;
    font-size: 13px;
    color: var(--gr-text);
    background: var(--gr-input-bg);
    border: 1px solid var(--gr-border);
    border-radius: 8px;
    box-shadow: none;
}

.trezo-filter__field .form-control:focus {
    border-color: var(--gr-accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(96, 93, 255, 0.2);
}

.trezo-filter__field--wide {
    grid-column: span 2;
}

.trezo-filter__field--check {
    display: flex;
    align-items: flex-end;
    padding-bottom: 2px;
}

.trezo-filter__field--check .checkbox {
    margin: 0;
}

.trezo-filter__field--check .checkbox label {
    font-size: 13px;
    color: var(--gr-text);
    font-weight: 500;
    padding-left: 4px;
}

.trezo-filter__field--check input[type="checkbox"] {
    margin-top: 0;
}

.trezo-filter__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--gr-border);
}

.trezo-filter__presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.trezo-filter__field .help-block {
    margin: 4px 0 0;
    font-size: 11px;
    color: #dc3545;
}

/* Buttons */
.gr-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.gr-btn:hover,
.gr-btn:focus {
    text-decoration: none;
}

.gr-btn--primary {
    color: #fff;
    background: var(--gr-accent);
    border-color: var(--gr-accent);
}

.gr-btn--primary:hover,
.gr-btn--primary:focus {
    color: #fff;
    background: var(--gr-accent-hover);
    border-color: var(--gr-accent-hover);
}

.gr-btn--icon {
    width: 36px;
    height: 36px;
    padding: 0;
    color: var(--gr-muted);
    background: transparent;
    border-color: transparent;
}

.gr-btn--icon:hover,
.gr-btn--icon:focus {
    color: var(--gr-text);
    background: rgba(15, 23, 42, 0.06);
}

.gr-btn--accent {
    color: var(--gr-accent);
}

.gr-pill {
    display: inline-block;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--gr-muted);
    background: var(--gr-input-bg);
    border: 1px solid var(--gr-border);
    border-radius: 999px;
    text-decoration: none;
    transition: color 0.15s, border-color 0.15s;
}

.gr-pill:hover,
.gr-pill:focus {
    color: var(--gr-accent);
    border-color: var(--gr-accent);
    text-decoration: none;
}

.gr-dropdown {
    background: var(--gr-card);
    border: 1px solid var(--gr-border);
    border-radius: 8px;
    box-shadow: var(--gr-shadow);
    min-width: 160px;
}

.gr-dropdown > li > a {
    color: var(--gr-text);
    font-size: 13px;
    padding: 8px 14px;
}

.gr-dropdown > li > a:hover,
.gr-dropdown > li > a:focus {
    background: var(--gr-surface);
    color: var(--gr-accent);
}

/* Page head */
.gr-page-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
}

.gr-page-head__icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(96, 93, 255, 0.15);
    border-radius: 12px;
    color: var(--gr-accent);
}

.gr-page-head__icon .material-symbols-outlined {
    font-size: 28px;
}

.gr-page-head h1 {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 700;
    color: var(--gr-text);
    line-height: 1.25;
}

.gr-page-head p {
    margin: 0;
    font-size: 13px;
    color: var(--gr-muted);
}

.gr-page-head__hint {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    opacity: 0.85;
}

/* Stats */
.gr-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.gr-stats__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--gr-card);
    border: 1px solid var(--gr-border);
    border-radius: var(--gr-radius);
    box-shadow: var(--gr-shadow);
}

.gr-stats__icon {
    font-size: 28px !important;
    color: var(--gr-accent);
    opacity: 0.9;
}

.gr-stats__item strong {
    display: block;
    font-size: 20px;
    line-height: 1.2;
    color: var(--gr-text);
}

.gr-stats__item span {
    font-size: 12px;
    color: var(--gr-muted);
}

/* Day cards & tables (Trezo tables) */
.gr-card.graph-day {
    margin-bottom: 20px;
    background: var(--gr-card);
    border: 1px solid var(--gr-border);
    border-radius: var(--gr-radius);
    overflow: hidden;
    box-shadow: var(--gr-shadow);
}

.graph-day__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    background: var(--gr-head-gradient);
    border-bottom: 1px solid var(--gr-border);
    color: #fff;
}

.graph-day__date {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
}

.graph-day__meta {
    margin: 4px 0 0;
    font-size: 12px;
    opacity: 0.92;
}

.graph-day__badge {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.graph-day__pto {
    padding: 10px 18px;
    background: var(--gr-surface);
    border-bottom: 1px solid var(--gr-border);
    font-size: 13px;
    color: var(--gr-muted);
}

.graph-day__pto a {
    color: var(--gr-accent);
}

.graph-table {
    margin: 0;
    font-size: 13px;
    color: var(--gr-text);
    background: transparent;
    border: none;
}

.graph-table > thead > tr > th {
    background: var(--gr-surface);
    border-bottom: 1px solid var(--gr-border);
    border-top: none;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gr-muted);
    white-space: nowrap;
    padding: 10px 12px;
}

.graph-table > tbody > tr > td {
    border-top: 1px solid var(--gr-border);
    padding: 10px 12px;
    vertical-align: middle;
}

.graph-table > tbody > tr:nth-of-type(odd) {
    background: #f8fafc;
}

.graph-table > tbody > tr:hover {
    background: rgba(96, 93, 255, 0.08);
}

.graph-table .col-time {
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    color: var(--gr-accent);
}

.graph-table .col-plate {
    font-weight: 600;
    white-space: nowrap;
    color: var(--gr-text);
}

.graph-table a {
    color: var(--gr-accent);
}

.graph-empty {
    text-align: center;
    padding: 40px 24px;
    background: var(--gr-card);
    border: 1px dashed var(--gr-border);
    border-radius: var(--gr-radius);
    color: var(--gr-muted);
}

.graph-page .text-muted {
    color: var(--gr-muted) !important;
}

/* Responsive */
@media (max-width: 991px) {
    .trezo-filter__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .trezo-filter__field--wide {
        grid-column: span 2;
    }

    .gr-stats {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767px) {
    .graph-page {
        padding: 14px 12px 24px;
        border-radius: 0;
        margin-left: -15px;
        margin-right: -15px;
    }

    .trezo-filter__bar {
        flex-wrap: wrap;
        padding: 8px;
    }

    .trezo-filter__summary {
        order: 3;
        width: 100%;
        flex-basis: 100%;
    }

    .trezo-filter__chip {
        max-width: 100%;
    }

    .trezo-filter__grid {
        grid-template-columns: 1fr;
    }

    .trezo-filter__field--wide {
        grid-column: span 1;
    }

    .gr-page-head {
        flex-direction: column;
    }

    .gr-page-head h1 {
        font-size: 18px;
    }

    .graph-table {
        font-size: 12px;
    }

    .graph-day__head {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ——— Тёмная схема сайта (color 7) ——— */
body.color-scheme-7 .graph-page {
    --gr-bg: #111827;
    --gr-card: #151c2c;
    --gr-surface: #0f172a;
    --gr-border: rgba(148, 163, 184, 0.2);
    --gr-text: #e2e8f0;
    --gr-muted: #94a3b8;
    --gr-accent: #38bdf8;
    --gr-accent-hover: #0284c7;
    --gr-success: #4ade80;
    --gr-shadow: 0 10px 32px rgba(0, 0, 0, 0.4);
    --gr-input-bg: #0f172a;
    --gr-head-gradient: linear-gradient(
        135deg,
        rgba(56, 189, 248, 0.45) 0%,
        rgba(14, 116, 144, 0.55) 100%
    );
}

body.color-scheme-7 .graph-page .gr-page-head__icon {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
}

body.color-scheme-7 .graph-page .trezo-filter__field .form-control:focus {
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.28);
}

body.color-scheme-7 .graph-page .gr-btn--icon:hover,
body.color-scheme-7 .graph-page .gr-btn--icon:focus {
    color: #f1f5f9;
    background: rgba(255, 255, 255, 0.08);
}

body.color-scheme-7 .graph-page .graph-day__head {
    border-bottom-color: rgba(148, 163, 184, 0.12);
    color: #f8fafc;
}

body.color-scheme-7 .graph-page .graph-day__pto a {
    color: #7dd3fc;
}

body.color-scheme-7 .graph-page .graph-table > tbody > tr:nth-of-type(odd) {
    background: rgba(15, 23, 42, 0.65);
}

body.color-scheme-7 .graph-page .graph-table > tbody > tr:hover {
    background: rgba(56, 189, 248, 0.12);
}

body.color-scheme-7 .graph-page .graph-table .col-time {
    color: #7dd3fc;
}

body.color-scheme-7 .graph-page .graph-empty {
    border-color: rgba(148, 163, 184, 0.25);
}

body.color-scheme-7 .graph-page .trezo-filter__field .help-block {
    color: #f87171;
}

@media print {
    .no-print,
    .navbar,
    #cookieConsent,
    .trezo-filter,
    footer#footer {
        display: none !important;
    }

    body {
        padding-top: 0 !important;
        background: #fff !important;
    }

    .graph-page {
        padding: 0;
        margin: 0;
        background: #fff;
        color: #000;
        border-radius: 0;
    }

    .gr-page-head h1 {
        font-size: 18px;
        color: #000;
    }

    .gr-stats__item {
        border: 1px solid #ccc;
        box-shadow: none;
        color: #000;
    }

    .gr-stats__item strong,
    .gr-stats__icon {
        color: #000;
    }

    .gr-card.graph-day {
        break-inside: avoid;
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #999;
        margin-bottom: 16px;
        background: #fff;
    }

    .graph-day__head {
        background: #333 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .graph-table {
        color: #000;
    }

    .graph-table > thead > tr > th {
        background: #eee;
        color: #333;
    }

    .graph-table > tbody > tr > td {
        border-color: #ccc;
    }

    a[href]:after {
        content: none !important;
    }
}
