/* Shared layout polish for all role zone pages */
.app {
    min-height: 100vh;
}

.main-content {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: linear-gradient(180deg, #f7f9fc 0%, #f2f6fb 100%);
}

.page-content {
    flex: 1;
    width: min(1280px, 100%);
    margin: 0 auto;
    padding: clamp(16px, 2.2vw, 28px);
}

.main-header {
    background: #ffffff;
    border: 1px solid #e3e8f3;
    border-radius: 14px;
    padding: clamp(12px, 1.6vw, 18px) clamp(14px, 2vw, 24px);
    box-shadow: 0 10px 24px rgba(17, 40, 86, 0.08);
    margin-bottom: 14px;
}

.main-header__title {
    font-size: clamp(1.1rem, 1.25rem + 0.4vw, 1.6rem);
    font-weight: 800;
    color: #15284d;
    letter-spacing: -0.02em;
}

.main-header__user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #d7e1f7;
    background: #f2f6ff;
}

.main-header__user-name {
    font-weight: 600;
    color: #223d72;
}

.dashboard-card,
.form-card,
.table-container,
.chart-card {
    background: #ffffff;
    border: 1px solid #e4e9f4;
    border-radius: 14px;
    box-shadow: 0 10px 26px rgba(19, 39, 80, 0.08);
}

.btn {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(39, 74, 153, 0.16);
}

.zone-footer {
    margin-top: auto;
    padding: 16px 24px;
    border-top: 1px solid var(--color-border, #e5e7eb);
    background: var(--color-bg-primary, #ffffff);
}

.zone-footer__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--color-text-secondary, #6b7280);
    font-size: 14px;
}

.zone-footer__nav {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.zone-footer__link {
    color: var(--color-text-secondary, #6b7280);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.zone-footer__link:hover {
    color: var(--color-primary-600, #2563eb);
}

@media (max-width: 768px) {
    .page-content {
        padding: 14px;
    }

    .main-header {
        border-radius: 12px;
        padding: 12px 14px;
    }

    .zone-footer {
        padding: 14px 16px;
    }

    .zone-footer__inner {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ============================================================
   OVLÁDACIE PRVKY A RIADKY NASTAVENÍ (vsetky zóny)
   ============================================================
   Deklarácie `.form-*` a `.settings-item` sú zámerne prebraté
   byte-identicky z zones/user/user.css. Zóny manager a super-admin
   si ich definujú rovnako, takže doplnenie sem nemení ich vzhľad;
   doteraz chýbali len v zónach driver, dispatcher a admin.
   Premenné --zone-* pochádzajú z landing-zone-theme.css, ktorý je
   na každej zónovej stránke načítaný, takže sa vyhodnotia korektne. */

.form-input,
.form-select,
.form-textarea,
.main-content .form-control {
    width: 100%;
    min-height: 36px;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--zone-border, #e1e8f5);
    border-radius: 9px;
    background: #fff;
    color: var(--zone-text, #1d2636);
    font: inherit;
    font-size: 0.8rem;
    line-height: 1.4;
}

.form-textarea {
    min-height: 74px;
    resize: vertical;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus,
.main-content .form-control:focus {
    border-color: #8fadf8;
    outline: 3px solid rgba(53, 99, 233, 0.13);
    outline-offset: 1px;
}

.main-content .form-control:disabled {
    background: #f5f7fa;
    color: var(--zone-muted, #637089);
    cursor: not-allowed;
}

.form-hint {
    color: var(--zone-muted, #637089);
    font-size: 0.72rem;
    line-height: 1.5;
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-width: 0;
    padding: 11px 0;
    border-bottom: 1px solid var(--zone-border, #e1e8f5);
}

.settings-item:last-child {
    border-bottom: 0;
}

.settings-item__info {
    display: grid;
    flex: 1 1 auto;
    gap: 2px;
    min-width: 0;
}

.settings-item__label {
    color: var(--zone-text, #1d2636);
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.35;
}

.settings-item__description {
    max-width: 62ch;
    color: var(--zone-muted, #637089);
    font-size: 0.74rem;
    line-height: 1.5;
}

.settings-item__control {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
}

.settings-item__control .form-input,
.settings-item__control .form-select,
.settings-item__control .form-control {
    min-width: 165px;
    cursor: pointer;
}

/*
 * Prepínač na prepnutie -.checked. Vstup ostáva v DOM a je vizuálne
 * skrytý, aby zostal dostupný pre čítačky obrazovky a klávesnicu
 * (medzerník prepína, Enter odosiela formulár).
 */
.settings-switch {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
    width: 48px;
    height: 26px;
    cursor: pointer;
}

.settings-switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.settings-switch__track {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 13px;
    background: #d3dae7;
    transition: background 0.2s ease;
}

.settings-switch__track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
    transition: transform 0.2s ease;
}

.settings-switch input:checked + .settings-switch__track {
    background: var(--zone-primary, #3563e9);
}

.settings-switch input:checked + .settings-switch__track::after {
    transform: translateX(22px);
}

.settings-switch input:focus-visible + .settings-switch__track {
    outline: 3px solid rgba(53, 99, 233, 0.35);
    outline-offset: 2px;
}

.settings-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
}

/* ============================================================
   ROZLOŽENIE GRAFOV A ROZKLADOVYCH RIADKOV
   ============================================================
   Triedy `.table`, `.table--compact`, `.table--striped` a
   `.table--hover` používa 18 existujúcich zónových stránok, ale
   nemajú v žiadnom CSS definíciu. Opraviť ich globálne by zmenilo
   vzhľad tých stránok, preto nové stránky používajú vlastné
   prefixované triedy a tie zostávajú nedotknuté. */

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 12px;
}

/*
 * <canvas> je nahraditeľný prvok: Chart.js mu pri vykreslení nastaví šírku
 * rovnú šírke kontajnera. Táto hodnota sa stáva jeho vstavanou šírkou, teda
 * min-content mriežky, a graf vytlačí celú kartu za hranicu obrazovky.
 * Obmedzením na šírku kontajnera sa karta môže zmenšiť späť.
 */
.chart-card canvas {
    max-width: 100%;
}

.stats-table__scroll {
    margin: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.76rem;
    text-align: left;
}

.stats-table caption {
    margin-bottom: 8px;
    color: var(--zone-muted, #637089);
    font-size: 0.72rem;
    line-height: 1.5;
    text-align: left;
}

.stats-table th,
.stats-table td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--zone-border, #e1e8f5);
    white-space: nowrap;
}

.stats-table thead th {
    color: var(--zone-muted, #637089);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.stats-table tbody th {
    color: var(--zone-text, #1d2636);
    font-weight: 600;
    white-space: normal;
}

.stats-table td {
    color: var(--zone-muted, #637089);
    font-variant-numeric: tabular-nums;
}

.stats-table tbody tr:last-child th,
.stats-table tbody tr:last-child td {
    border-bottom: 0;
}

.stats-table tbody tr:hover {
    background: var(--zone-soft-blue, #ecf2ff);
}

.settings-saved {
    color: #15803d;
    font-size: 0.74rem;
    font-weight: 700;
}

/*
 * Prepínač má pevnú šírku, preto musí zostať vpravo. Do 560 px by riadok
 * nastavenia s dlhým popiskom pretlačil ovládanie na ďalší riadok.
 */
@media (max-width: 560px) {
    .settings-item {
        align-items: flex-start;
        flex-direction: column;
    }

    .settings-item__control {
        width: 100%;
    }

    .settings-item__control .form-input,
    .settings-item__control .form-select,
    .settings-item__control .form-control {
        width: 100%;
        min-width: 0;
    }
}
