/* assets/css/style.css */
:root {
    --font-sans: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-display: 'Sora', 'Rajdhani', 'Segoe UI', sans-serif;
    --font-utility: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
    --bg: #eef2f9;
    --bg-soft: #f8faff;
    --surface: #ffffff;
    --surface-strong: #f6f9ff;
    --ink: #182235;
    --ink-muted: #5f6c86;
    --line: #d9e1ef;
    --line-strong: #c4d0e5;
    --brand: #2f5dbe;
    --brand-strong: #21479a;
    --accent: #10b981;
    --accent-strong: #047857;
    --danger: #dc2626;
    --danger-strong: #b91c1c;
    --warning: #ca8a04;
    --warning-strong: #a16207;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-soft: 0 8px 20px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 14px 30px rgba(15, 23, 42, 0.12);
    --shadow-strong: 0 24px 48px rgba(15, 23, 42, 0.2);
    --login-night: #0a1631;
    --login-route: #173b7a;
    --login-signal: #4b8cff;
    --login-fog: #eaf2ff;
    --login-amber: #ffb347;
    --login-line: #c8d7f2;
}

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

html,
body {
    height: 100%;
}

body {
    font-family: var(--font-sans);
    background: linear-gradient(180deg, #f6f8fd 0%, var(--bg) 100%);
    color: var(--ink);
}

.app-layout {
    display: grid;
    grid-template-rows: 84px 1fr;
    height: 100vh;
}

.top-menu {
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 18px;
}

.main-workspace {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    background: transparent;
}

.workspace-grid {
    padding: 20px;
    overflow: auto;
    background-color: var(--bg-soft);
}

.calendar-topbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.calendar-brand-title {
    font-size: 1.2rem;
    margin-right: 8px;
    color: #1c2d52;
}

.calendar-month-toolbar,
.calendar-picker-toolbar {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #f2f6ff;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
}

.calendar-month-nav-btn,
.calendar-today-btn {
    border: 1px solid transparent;
    border-radius: 999px;
    min-width: 34px;
    height: 32px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.15s ease;
}

.calendar-month-nav-btn {
    background: #fff;
    color: #1f365f;
    border-color: #d2dcf0;
}

.calendar-month-nav-btn:hover,
.calendar-today-btn:hover {
    transform: translateY(-1px);
}

.calendar-current-month-label {
    min-width: 165px;
    text-align: center;
    font-size: 0.92rem;
    color: #24375d;
    font-weight: 700;
}

.calendar-range-toolbar {
    gap: 6px;
}

.calendar-range-btn {
    border: 1px solid #ccd8ef;
    border-radius: 999px;
    background: #ffffff;
    color: #1e3359;
    font-size: 0.8rem;
    font-weight: 700;
    min-height: 30px;
    padding: 0 10px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.calendar-range-btn:hover {
    transform: translateY(-1px);
}

.calendar-range-btn.is-active {
    border-color: #8cb0f7;
    background: #dbeafe;
    color: #12387b;
}

.calendar-today-btn {
    padding: 0 12px;
    background: linear-gradient(180deg, var(--brand) 0%, var(--brand-strong) 100%);
    color: #fff;
}

.top-actions-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.top-actions-divider {
    width: 1px;
    height: 30px;
    background: var(--line);
    margin: 0 4px;
}

.top-action-btn {
    border: 1px solid transparent;
    border-radius: 999px;
    font-weight: 700;
    text-decoration: none;
    font-size: 0.88rem;
    line-height: 1;
    padding: 10px 14px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.top-action-btn:hover {
    transform: translateY(-1px);
}

.top-action-btn-config {
    background: #1f365f;
    color: #fff;
}

.top-action-btn-backup {
    background: #f59e0b;
    color: #fff;
}

.top-action-btn-report {
    background: #34d399;
    color: #1d3d35;
}

.top-action-btn-logout {
    background: #ef4444;
    color: #fff;
}

.driver-week-workspace {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 16px;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 16px;
}

.drivers-pane {
    background: linear-gradient(180deg, #233759 0%, #1a2741 100%);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    color: #f2f5ff;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.drivers-pane-head-band {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 52px;
    padding: 0 14px;
    border-bottom: 1px solid rgba(174, 194, 229, 0.22);
    background: rgba(12, 24, 46, 0.55);
    position: relative;
    z-index: 3;
    flex-shrink: 0;
}

.drivers-pane-head-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.drivers-status-info {
    position: relative;
}

.drivers-status-info-btn {
    border: 1px solid rgba(174, 194, 229, 0.35);
    border-radius: 999px;
    width: 30px;
    height: 30px;
    padding: 0;
    margin: 0;
    background: rgba(18, 36, 68, 0.72);
    color: #dbe6ff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
    flex-shrink: 0;
}

.drivers-status-info-btn:hover,
.drivers-status-info-btn:focus-visible {
    background: rgba(28, 52, 92, 0.88);
    border-color: rgba(190, 210, 245, 0.55);
    outline: none;
}

.drivers-status-info-btn:focus-visible {
    box-shadow: 0 0 0 2px rgba(126, 167, 255, 0.45);
}

.drivers-status-info-icon {
    font-size: 0.92rem;
    font-weight: 800;
    font-style: italic;
    font-family: Georgia, 'Times New Roman', serif;
    line-height: 1;
}

.drivers-status-tooltip {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 220px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(174, 194, 229, 0.28);
    background: rgba(12, 24, 46, 0.96);
    box-shadow: 0 14px 28px rgba(8, 16, 32, 0.35);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
    pointer-events: none;
    z-index: 30;
}

.drivers-status-tooltip::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 11px;
    width: 10px;
    height: 10px;
    background: rgba(12, 24, 46, 0.96);
    border-top: 1px solid rgba(174, 194, 229, 0.28);
    border-left: 1px solid rgba(174, 194, 229, 0.28);
    transform: rotate(45deg);
}

.drivers-status-info:hover .drivers-status-tooltip,
.drivers-status-info:focus-within .drivers-status-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.drivers-status-tooltip-title {
    color: #9fb2d7;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-size: 0.72rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.drivers-status-tooltip-item {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #dbe6ff;
    font-size: 0.8rem;
    margin-bottom: 6px;
}

.drivers-status-tooltip-item:last-child {
    margin-bottom: 0;
}

.drivers-pane-head-title {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #dbe6ff;
    line-height: 1;
}

.drivers-create-route-btn {
    border: none;
    border-radius: 999px;
    width: 30px;
    height: 30px;
    padding: 0;
    margin: 0;
    background: linear-gradient(180deg, #54e4a5 0%, #20b77a 100%);
    color: #0b2c1f;
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(25, 150, 101, 0.35);
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.drivers-create-route-btn:disabled {
    opacity: 0.5;
    box-shadow: none;
    cursor: not-allowed;
}

.drivers-create-route-btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.drivers-pane-list {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 0;
    overscroll-behavior: contain;
    direction: rtl;
}

.drivers-pane-list > * {
    direction: ltr;
}

.drivers-pane-empty {
    color: #c5d0ea;
    font-size: 0.86rem;
    padding: 12px 4px;
}

.driver-pane-item {
    width: 100%;
    border: none;
    border-bottom: 2px solid rgba(134, 159, 206, 0.38);
    background: rgba(10, 22, 43, 0.45);
    border-radius: 0;
    color: #edf3ff;
    text-align: left;
    padding: 10px 12px 9px;
    margin: 0;
    min-height: 86px;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.driver-pane-item:last-child {
    border-bottom: none;
}

.driver-pane-item:nth-child(even) {
    background: rgba(14, 28, 52, 0.52);
}

.driver-pane-item:hover {
    background: rgba(22, 40, 72, 0.62);
}

.driver-pane-item.is-selected {
    background: rgba(31, 61, 112, 0.68);
    box-shadow: inset 4px 0 0 #7ea7ff, inset 0 0 0 1px rgba(129, 170, 255, 0.4);
}

.driver-pane-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.driver-pane-name {
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.2;
}

.driver-pane-meta {
    display: block;
    margin-top: 8px;
    color: #b2c3e6;
    font-size: 0.76rem;
    line-height: 1.2;
}

.driver-pane-status {
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
}

.driver-pane-status.is-on-route {
    background: rgba(16, 185, 129, 0.2);
    color: #86efac;
}

.driver-pane-status.is-start-today {
    background: rgba(59, 130, 246, 0.24);
    color: #bfdbfe;
}

.driver-pane-status.is-end-today {
    background: rgba(251, 146, 60, 0.25);
    color: #fdba74;
}

.driver-pane-status.is-idle {
    background: rgba(148, 163, 184, 0.2);
    color: #cbd5e1;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
}

.status-dot.dot-on-route {
    background: #22c55e;
}

.status-dot.dot-start-today {
    background: #3b82f6;
}

.status-dot.dot-end-today {
    background: #f97316;
}

.status-dot.dot-idle {
    background: #94a3b8;
}

.driver-week-main-panel {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    min-height: 0;
    height: 100%;
}

.driver-week-grid {
    width: 100%;
    height: 100%;
    min-height: 0;
    position: relative;
}

.driver-week-grid.is-loading::after {
    content: 'Ładowanie harmonogramu...';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #32486f;
    font-weight: 700;
    z-index: 20;
}

.driver-week-empty {
    padding: 14px;
    color: #475569;
    font-size: 0.92rem;
}

.driver-week-grid-shell {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100%;
    min-height: 0;
}

.driver-week-grid-head {
    overflow: hidden;
    min-height: 52px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8faff;
}

.driver-week-grid-head-track {
    display: grid;
    grid-template-columns: repeat(var(--day-columns), minmax(210px, 1fr));
    min-width: max-content;
    min-height: 100%;
    height: 100%;
}

.driver-week-day-head {
    border-right: 1px solid #e2e8f0;
    padding: 8px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 52px;
    height: 100%;
}

.driver-week-day-head:last-child {
    border-right: none;
}

.driver-week-day-head.is-today {
    background: #dbeafe;
}

.driver-week-day-name {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #334155;
    font-weight: 700;
}

.driver-week-day-date {
    font-size: 0.85rem;
    color: #1e293b;
    font-weight: 700;
}

.driver-week-grid-body {
    overflow: auto;
    min-height: 0;
    position: relative;
    overscroll-behavior: contain;
}

.driver-week-row {
    min-height: 86px;
    flex-shrink: 0;
}

.driver-week-row-track {
    display: grid;
    grid-template-columns: repeat(var(--day-columns), minmax(210px, 1fr));
    min-width: max-content;
    min-height: 86px;
    border-bottom: 2px solid #cbd5e1;
    background: #ffffff;
}

.driver-week-row:nth-child(even) .driver-week-row-track {
    background: #f8fafc;
}

.driver-week-row:last-child .driver-week-row-track {
    border-bottom: none;
}

.driver-week-row.is-selected .driver-week-row-track {
    background: #f1f7ff;
    box-shadow: inset 0 0 0 1px rgba(129, 170, 255, 0.35);
}

.driver-week-cell {
    border-right: 1px solid #edf2f8;
    padding: 7px 7px 6px;
    min-height: 86px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    transition: background 0.12s ease;
}

.driver-week-cell:last-child {
    border-right: none;
}

.driver-week-cell:hover {
    background: #f8fafc;
}

.driver-week-cell.is-today {
    background: #eff6ff;
}

.driver-week-row.is-selected .driver-week-cell {
    background: #f1f7ff;
}

.driver-week-row.is-selected .driver-week-cell.is-today {
    background: #e3efff;
}

.driver-week-row.is-selected .driver-week-cell:hover {
    background: #e8f2ff;
}

.driver-week-cell-empty-hint {
    margin-top: auto;
    font-size: 0.72rem;
    color: #94a3b8;
    opacity: 0;
    transition: opacity 0.12s ease;
    user-select: none;
}

.driver-week-cell:hover .driver-week-cell-empty-hint {
    opacity: 1;
}

.field-checkbox-row {
    margin-top: 10px;
}

.field-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #334155;
    cursor: pointer;
    user-select: none;
}

.field-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
}

.route-card {
    position: relative;
    border: 1px solid #c6dafd;
    border-radius: 8px;
    background: linear-gradient(180deg, #e0ecff 0%, #d5e6ff 100%);
    box-shadow: 0 3px 10px rgba(30, 64, 175, 0.2);
    text-align: left;
    padding: 5px 7px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    cursor: pointer;
}

.route-card-main {
    font-size: 0.75rem;
    color: #1d4ed8;
    font-weight: 700;
    line-height: 1.25;
}

.route-card-city,
.route-card-meta {
    font-size: 0.7rem;
    color: #334155;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.route-card.is-user-informed {
    border-color: #86efac;
    background: linear-gradient(180deg, #dcfce7 0%, #bbf7d0 100%);
    box-shadow: 0 3px 10px rgba(22, 163, 74, 0.2);
}

.route-card.is-user-informed .route-card-main {
    color: #15803d;
}

.route-card.is-locked {
    opacity: 0.82;
    filter: grayscale(0.2);
}

.route-lock-badge {
    position: absolute;
    right: 4px;
    top: -7px;
    background: #dc2626;
    color: #fff;
    border-radius: 999px;
    padding: 1px 7px;
    font-size: 0.64rem;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.35);
}

.schedule-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.schedule-table th,
.schedule-table td {
    border: 1px solid var(--line);
    padding: 12px;
    text-align: center;
}

.schedule-cell {
    cursor: pointer;
    transition: background 0.15s;
}

.schedule-cell:hover {
    background-color: #f1f2f6;
}

.cell-locked-me {
    background-color: #e3f2fd !important;
    border: 2px solid #2196f3 !important;
}

.cell-locked-other {
    background-color: #ffebee !important;
    border: 1px solid #ef5350 !important;
    cursor: not-allowed;
}

.cell-disabled {
    background-color: #f1f2f6;
    color: #a4b0be;
    cursor: not-allowed;
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(11, 21, 39, 0.55);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.modal-shell {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-strong);
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(180deg, #28477f 0%, #1d3561 100%);
    color: #fff;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
}

.modal-title {
    margin: 0;
    font-size: 1.08rem;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.modal-toolbar {
    background: #eef3fb;
    border-bottom: 1px solid var(--line);
    padding: 12px 18px;
}

.btn {
    border: 1px solid transparent;
    border-radius: 10px;
    font-weight: 700;
    padding: 8px 14px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(180deg, var(--brand) 0%, var(--brand-strong) 100%);
    color: #fff;
}

.btn-accent {
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
    color: #fff;
}

.btn-warning {
    background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
}

.btn-danger {
    background: linear-gradient(180deg, var(--danger) 0%, var(--danger-strong) 100%);
    color: #fff;
}

.btn-secondary {
    background: #6b7a94;
    color: #fff;
}

.btn-ghost {
    background: transparent;
    border-color: var(--line);
    color: var(--ink);
}

.btn-sm {
    padding: 5px 9px;
    font-size: 0.8rem;
    border-radius: 8px;
}

.field-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.82rem;
    font-weight: 700;
    color: #4f5f7b;
}

.field-control {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    padding: 9px 11px;
    background: #fff;
    color: var(--ink);
    font-size: 0.9rem;
}

.field-control:focus {
    outline: none;
    border-color: #7ba1ec;
    box-shadow: 0 0 0 3px rgba(81, 124, 214, 0.16);
}

.route-modal-shell {
    width: min(1300px, 100%);
    max-height: 95vh;
    display: flex;
    flex-direction: column;
}

.route-modal-layout {
    display: flex;
    align-items: stretch;
    width: 100%;
    min-height: 700px;
}

.route-form {
    width: 700px;
    max-width: 700px;
    max-height: 700px;
    overflow-y: auto;
    padding: 18px;
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #fbfdff;
}

.route-driver-banner {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
    background: #eef3ff;
    border: 1px solid #d8e3ff;
    border-radius: 10px;
}

.route-driver-banner-label {
    color: #5a6f96;
    font-size: 0.84rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.route-driver-banner-name {
    color: #1a3560;
    font-size: 1.05rem;
    font-weight: 700;
}

.field-grid-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.route-section-separator {
    border: 0;
    border-top: 1px solid var(--line);
}

.route-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.route-section-title {
    color: #22365f;
    font-size: 0.96rem;
}

.route-points-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.route-point-row {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    border-radius: 10px;
    padding: 8px 10px;
    border: 1px solid transparent;
}

.route-point-row.start-point {
    background: #fff3ca;
    border-color: #f1dd8b;
}

.route-point-row.via-point {
    background: #eef3ff;
    border-color: #d8e3ff;
}

.route-point-row.end-point {
    background: #ffe5dc;
    border-color: #ffc8b5;
}

.route-point-label {
    width: 58px;
    flex-shrink: 0;
    font-weight: 700;
    font-size: 0.8rem;
    color: #33415f;
}

.route-point-country,
.route-point-postal,
.route-point-city,
.route-point-desc {
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 0.86rem;
}

.route-point-country {
    width: 56px;
    text-transform: uppercase;
    text-align: center;
}

.route-point-postal {
    width: 140px;
    flex-shrink: 0;
}

.route-point-city {
    width: 240px;
    flex-shrink: 0;
}

.route-point-desc {
    min-width: 80px;
    flex: 1;
}

.route-point-remove {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 2px;
    margin-left: 2px;
}

.route-form-actions {
    margin-top: auto;
    padding-top: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.route-form-actions .btn-danger {
    margin-right: auto;
}

.route-delete-btn {
    display: none;
}

#routeMap {
    width: 600px;
    min-width: 420px;
    min-height: 700px;
    background: #edf3ff;
}

.config-modal-shell {
    width: min(940px, 100%);
    height: min(720px, 92vh);
    display: grid;
    grid-template-rows: 64px 56px 1fr;
}

.config-tab-strip {
    background: #eff4fb;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 8px 18px 0;
}

.tab-btn {
    border: 1px solid var(--line);
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    background: #dfe8f7;
    color: #31456d;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 0.9rem;
}

.tab-btn.active {
    background: #fff !important;
    font-weight: 700 !important;
}

.config-modal-content {
    padding: 18px;
    overflow-y: auto;
    background: #fbfdff;
}

.config-tab-content {
    display: none;
}

.resource-tab-heading {
    margin-bottom: 12px;
    color: #2d4068;
}

.resource-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.resource-form .field-control {
    flex: 1;
    min-width: 170px;
}

.resource-form .field-control.fixed-width {
    max-width: 180px;
}

.resource-list {
    margin-top: 16px;
    min-height: 200px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
}

.resource-table,
.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.report-table-scroll {
    width: 100%;
    overflow-x: auto;
}

.resource-table th,
.resource-table td,
.report-table th,
.report-table td {
    border: 1px solid #d1dced;
    padding: 9px 10px;
}

.resource-table th {
    background: #edf3fe;
    color: #2d416b;
    text-align: left;
}

.resource-table-row.is-inactive {
    opacity: 0.6;
    background: #f8f9fd;
}

.resource-id-cell {
    width: 52px;
    color: var(--ink-muted);
}

.resource-status-cell {
    width: 110px;
}

.resource-actions-cell {
    width: 190px;
    text-align: center;
}

.resource-table td.resource-actions-cell {
    display: flex;
    gap: 6px;
    justify-content: center;
    align-items: center;
}

.resource-inline-input {
    width: 92%;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    padding: 5px 7px;
}

.resource-inline-select {
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    padding: 5px 7px;
}

.resource-inline-password {
    width: 92%;
    margin-top: 4px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    padding: 5px 7px;
    font-size: 0.75rem;
}

.reports-modal-shell {
    width: min(1040px, 100%);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
}

.reports-toolbar {
    background: #eff4fc;
    border-bottom: 1px solid var(--line);
    padding: 14px 18px;
    display: flex;
    gap: 14px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.report-filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.report-filter-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #4e617f;
}

.report-print-area {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    background: #fff;
}

.report-placeholder {
    text-align: center;
    color: #74839f;
    padding-top: 50px;
    font-style: italic;
}

.report-summary {
    margin-bottom: 18px;
    border-bottom: 2px solid #2f466d;
    padding-bottom: 10px;
}

.report-summary h2 {
    margin: 0;
    font-size: 1.25rem;
    color: #24385f;
}

.report-summary p {
    margin-top: 6px;
    font-size: 0.86rem;
    color: #657895;
}

.report-table th {
    background: #2f466d;
    color: #fff;
    text-align: left;
}

.report-table td.mono {
    text-align: center;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.84rem;
    color: #2f466d;
}

.report-table td.km {
    text-align: right;
    color: #1d4ed8;
    font-weight: 700;
}

.report-table.report-table-detailed {
    table-layout: fixed;
    min-width: 1260px;
}

.report-table.report-table-detailed td {
    vertical-align: top;
    white-space: normal;
    overflow-wrap: anywhere;
}

.report-table.report-table-detailed td.date-cell {
    white-space: nowrap;
}

.report-table.report-table-detailed td.route-cell {
    min-width: 240px;
}

.report-row-alt {
    background: #f4f7fe;
}

.inline-message {
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.86rem;
    border: 1px solid;
}

.inline-message-centered {
    text-align: center;
}

.inline-message-info {
    background: #e8f2ff;
    border-color: #bfdbfe;
    color: #1e3a8a;
}

.inline-message-warning {
    background: #fff7e6;
    border-color: #fcd34d;
    color: #92400e;
}

.inline-message-error {
    background: #ffe7e7;
    border-color: #fca5a5;
    color: #991b1b;
}

.inline-message-success {
    background: #e7f9f0;
    border-color: #86efac;
    color: #166534;
}

.lock-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #ef4444;
    color: #fff;
    font-size: 0.68rem;
    padding: 2px 6px;
    border-radius: 999px;
    font-weight: 700;
    z-index: 10;
    pointer-events: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.app-toast-container {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 5000;
    pointer-events: none;
}

.app-toast {
    min-width: 240px;
    max-width: 380px;
    border-radius: 10px;
    padding: 11px 14px;
    color: #f8fafc;
    font-size: 0.86rem;
    font-weight: 600;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.25);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    text-align: center;
}

.app-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.app-toast-info {
    background: #0f766e;
}

.app-toast-warning {
    background: #a16207;
}

.app-toast-error {
    background: #b91c1c;
}

.app-toast-success {
    background: #166534;
}

.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 15, 30, 0.6);
    z-index: 6000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.confirm-panel {
    width: min(420px, 100%);
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-strong);
    overflow: hidden;
}

.confirm-header {
    padding: 14px 16px;
    background: #f1f5ff;
    border-bottom: 1px solid var(--line);
    color: #1f365f;
    font-weight: 700;
}

.confirm-body {
    padding: 16px;
    color: #27344f;
    line-height: 1.45;
}

.confirm-actions {
    border-top: 1px solid var(--line);
    padding: 12px 16px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.login-page {
    min-height: 100vh;
    margin: 0;
    padding: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #e8f0fc 0%, #dce7f7 100%);
}

.login-shell {
    width: min(1160px, 100%);
    min-height: min(760px, calc(100vh - 56px));
    position: relative;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--login-line);
    box-shadow:
        0 18px 40px rgba(12, 23, 46, 0.16),
        0 1px 0 rgba(255, 255, 255, 0.65) inset;
    background: #fff;
    display: grid;
    grid-template-columns: minmax(470px, 1.05fr) minmax(380px, 0.95fr);
}

.login-shell::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(51.2%);
    width: 1px;
    background: linear-gradient(180deg, rgba(129, 157, 214, 0) 0%, rgba(129, 157, 214, 0.38) 18%, rgba(129, 157, 214, 0.38) 82%, rgba(129, 157, 214, 0) 100%);
    pointer-events: none;
    z-index: 2;
}

.login-hero {
    position: relative;
    overflow: hidden;
    padding: 44px 44px 36px;
    background: linear-gradient(160deg, #0f1f3b 0%, #16325e 100%);
    color: #f8fbff;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.login-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(200, 215, 242, 0.06) 1px, transparent 1px),
        linear-gradient(180deg, rgba(200, 215, 242, 0.05) 1px, transparent 1px);
    background-size: 42px 42px;
    opacity: 0.22;
    pointer-events: none;
}

.login-hero::after {
    content: none;
}

.login-hero > * {
    position: relative;
    z-index: 1;
}

.login-brand-row {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 2px;
}

.login-brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.26);
    background: linear-gradient(155deg, #335f9c 0%, #20457f 100%);
    box-shadow: none;
}

.login-brand-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.login-brand-name {
    font-family: var(--font-display);
    font-size: 1.04rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.login-brand-tagline {
    color: #b5c8eb;
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.login-hero-title {
    max-width: 16ch;
    font-family: var(--font-display);
    font-size: clamp(2.05rem, 2.7vw, 2.65rem);
    line-height: 1.08;
    font-weight: 700;
}

.login-hero-lead {
    max-width: 52ch;
    color: #d4e1f9;
    font-size: 0.95rem;
    line-height: 1.62;
}

.login-value-list {
    margin-top: 2px;
    list-style: none;
    display: grid;
    gap: 11px;
}

.login-value-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: #d7e6ff;
    font-size: 0.91rem;
    line-height: 1.54;
}

.login-value-list li::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 999px;
    margin-top: 7px;
    flex-shrink: 0;
    background: #7ea2dd;
    box-shadow: none;
}

.login-metrics {
    margin-top: 8px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.login-metric {
    border-radius: 13px;
    border: 1px solid rgba(200, 215, 242, 0.2);
    background: rgba(10, 22, 45, 0.34);
    padding: 13px 12px 12px;
    transition: border-color 0.18s ease, background 0.18s ease;
}

.login-metric:hover {
    border-color: rgba(200, 215, 242, 0.34);
    background: rgba(10, 22, 45, 0.42);
}

.login-metric-value {
    font-family: var(--font-utility);
    color: #f4f8ff;
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.login-metric-label {
    margin-top: 6px;
    color: #b4c5e3;
    font-size: 0.73rem;
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.login-trust-note {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid rgba(200, 215, 242, 0.16);
    color: #b4c6e7;
    font-size: 0.82rem;
    line-height: 1.5;
    letter-spacing: 0.02em;
}

.login-route-strip {
    position: relative;
    height: 50px;
    margin-top: 2px;
}

.login-route-strip::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 3px;
    transform: translateY(-50%);
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(126, 162, 221, 0.3) 0%, rgba(126, 162, 221, 0.65) 100%);
}

.login-route-dot {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    border-radius: 999px;
    border: 2px solid #102245;
    background: #dbe9ff;
}

.login-route-dot.dot-start {
    left: 0;
}

.login-route-dot.dot-mid {
    left: 52%;
}

.login-route-dot.dot-end {
    left: 100%;
    background: #a8c0e6;
}

.login-route-pulse {
    position: absolute;
    top: 50%;
    left: 0;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(168, 192, 230, 0.86) 0%, rgba(168, 192, 230, 0.06) 72%);
    box-shadow: none;
    transform: translate(-50%, -50%);
    animation: routePulse 6s linear infinite;
}

.login-auth-panel {
    position: relative;
    background: linear-gradient(180deg, #f7faff 0%, #edf2fb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 36px;
}

.login-auth-panel::before {
    content: '';
    position: absolute;
    inset: 14px 14px auto;
    height: 1px;
    background: linear-gradient(90deg, rgba(159, 182, 226, 0) 0%, rgba(159, 182, 226, 0.55) 50%, rgba(159, 182, 226, 0) 100%);
    pointer-events: none;
}

.login-card {
    width: min(440px, 100%);
    border-radius: 14px;
    border: 1px solid #d8e2f4;
    background: #ffffff;
    box-shadow:
        0 10px 24px rgba(13, 31, 66, 0.1),
        0 1px 0 rgba(255, 255, 255, 0.95) inset;
    padding: 34px 32px;
    backdrop-filter: none;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.login-card:focus-within {
    transform: none;
    box-shadow: 0 12px 26px rgba(13, 31, 66, 0.13);
}

.login-kicker {
    color: #536588;
    font-family: var(--font-utility);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.login-title {
    margin-top: 8px;
    color: #173564;
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 2.1vw, 1.84rem);
    line-height: 1.15;
    font-weight: 700;
}

.login-subtitle {
    margin-top: 11px;
    color: #546786;
    font-size: 0.9rem;
    line-height: 1.58;
}

.login-form {
    margin-top: 22px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.login-page .form-group label {
    display: block;
    margin-bottom: 6px;
    color: #3f5479;
    font-size: 0.87rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.login-page .input-control {
    width: 100%;
    min-height: 44px;
    padding: 11px 12px;
    border: 1px solid #c8d8f2;
    border-radius: 11px;
    background: #ffffff;
    color: #1c2f52;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-page .input-control:hover {
    border-color: #b5c8eb;
}

.login-page .input-control:focus,
.login-page .input-control:focus-visible {
    outline: none;
    border-color: var(--login-signal);
    box-shadow: 0 0 0 4px rgba(75, 140, 255, 0.2);
}

.login-btn {
    margin-top: 4px;
    width: 100%;
    border: none;
    border-radius: 11px;
    min-height: 46px;
    padding: 12px;
    font-weight: 700;
    font-size: 0.96rem;
    letter-spacing: 0.01em;
    background: linear-gradient(180deg, #315ea8 0%, #2a4f8b 100%);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(35, 73, 149, 0.2);
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.login-btn:hover {
    transform: none;
    box-shadow: 0 8px 16px rgba(35, 73, 149, 0.22);
    filter: none;
}

.login-btn:active {
    box-shadow: 0 4px 10px rgba(35, 73, 149, 0.2);
}

.login-btn:focus-visible {
    outline: 3px solid rgba(255, 179, 71, 0.7);
    outline-offset: 2px;
}

.error-msg {
    display: none;
    margin-top: 8px;
}

.error-msg:not(:empty) {
    display: block;
}

@keyframes routePulse {
    0% {
        left: 0;
        opacity: 0;
    }
    12% {
        opacity: 1;
    }
    88% {
        opacity: 1;
    }
    100% {
        left: 100%;
        opacity: 0;
    }
}

@media (max-width: 1080px) {
    .login-page {
        padding: 20px;
    }

    .login-shell {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .login-shell::before {
        display: none;
    }

    .login-hero {
        padding: 34px 30px 28px;
    }

    .login-auth-panel {
        padding: 28px;
    }
}

@media (max-width: 720px) {
    .login-page {
        padding: 12px;
    }

    .login-hero {
        padding: 24px 20px;
        gap: 14px;
    }

    .login-hero-title {
        max-width: none;
        font-size: 1.8rem;
    }

    .login-metrics {
        grid-template-columns: 1fr;
    }

    .login-route-strip {
        height: 38px;
    }

    .login-auth-panel {
        padding: 14px;
    }

    .login-auth-panel::before {
        inset: 8px 10px auto;
    }

    .login-card {
        padding: 24px 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-card,
    .login-metric,
    .login-btn,
    .login-page .input-control {
        transition: none;
    }

    .login-route-pulse {
        animation: none;
        opacity: 0.75;
        left: 100%;
    }
}

@media (max-width: 1280px) {
    .top-menu {
        height: auto;
        min-height: 84px;
        padding: 8px 14px;
    }

    .route-modal-layout {
        flex-direction: column;
    }

    .route-form {
        width: 100%;
        max-width: none;
        max-height: 54vh;
        border-right: none;
        border-bottom: 1px solid var(--line);
    }

    #routeMap {
        width: 100%;
        min-height: 360px;
    }
}

@media (max-width: 800px) {
    .driver-week-workspace {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(180px, 32vh) minmax(0, 1fr);
    }

    .drivers-pane,
    .driver-week-main-panel {
        min-height: 0;
    }
}
