/* ============================================================
   Veyro - arkusz stylów
   Kierunek: luxury / refined dark. Paleta: czerń + metaliczne złoto.
   Restyling pod ciemny motyw - nazwy klas bez zmian.
   ============================================================ */

/* --- Czcionki ------------------------------------------------ */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&display=swap');

/* --- Zmienne ------------------------------------------------- */
:root {
    /* tła - od najciemniejszego do najjaśniejszego */
    --ink:         #0f0f0f;   /* najgłębsza czerń - tło strony */
    --ink-soft:    #1a1a1a;   /* karty, panele */
    --surface:     #1a1a1a;   /* alias dla kart (zgodność z klasami) */
    --surface-2:   #232323;   /* elementy wyżej: nagłówki tabel, pola */
    --bg:          #0f0f0f;   /* tło strony */
    --line:        #2e2e2e;   /* obramowania */
    --line-soft:   #262626;   /* delikatniejsze linie */

    /* akcent - metaliczne złoto */
    --accent:      #d4af37;
    --accent-dark: #b8962e;
    --accent-soft: #f4d06f;   /* jaśniejsze złoto - hover, akcenty */
    --accent-ink:  #0f0f0f;   /* tekst na złotym tle */
    --accent-glow: rgba(212,175,55,.22);

    /* tekst */
    --text:        #f0f0f0;   /* tekst główny */
    --text-soft:   #b0b0b0;   /* tekst drugorzędny */
    --text-faint:  #6f6f6f;   /* tekst wygaszony */
    --text-invert: #f0f0f0;   /* tekst na ciemnym (alias) */

    /* stany */
    --ok:          #3ecf7d;
    --ok-bg:       rgba(62,207,125,.13);
    --warn:        #e0a13a;
    --warn-bg:     rgba(224,161,58,.14);
    --error:       #e5484d;
    --error-bg:    rgba(229,72,77,.14);

    /* kształt i cień */
    --radius:      12px;
    --radius-sm:   8px;
    --shadow:      0 1px 2px rgba(0,0,0,.4),
                   0 8px 24px rgba(0,0,0,.35);
    --shadow-lg:   0 18px 50px rgba(0,0,0,.6);

    /* czcionki */
    --font-display: 'Montserrat', system-ui, sans-serif;
    --font-body:    'Montserrat', system-ui, sans-serif;
}

/* --- Reset --------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    color: var(--text);
    background: var(--bg);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-family: var(--font-display);
    line-height: 1.2;
    margin: 0 0 .5em;
    color: var(--text);
}

a { color: inherit; }

/* pasek przewijania w klimacie motywu */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb {
    background: var(--line);
    border-radius: 10px;
    border: 2px solid var(--ink);
}
::-webkit-scrollbar-thumb:hover { background: #3a3a3a; }

/* ============================================================
   EKRAN LOGOWANIA
   ============================================================ */
.auth-body {
    min-height: 100vh;
    display: flex;
    /* atmosfera: głęboka czerń z promieniem złota od góry */
    background:
        radial-gradient(900px 520px at 50% -12%,
            var(--accent-glow), transparent 62%),
        var(--ink);
}

.auth-wrap {
    margin: auto;
    width: 100%;
    max-width: 400px;
    padding: 24px;
}

.auth-card {
    background: var(--ink-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 36px 32px 28px;
}

.auth-card__head {
    text-align: center;
    margin-bottom: 24px;
}

.auth-card__logo {
    font-size: 40px;
    display: block;
    line-height: 1;
}

.auth-card__title {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -.02em;
    margin: 10px 0 2px;
    /* metaliczny połysk na tytule */
    background: linear-gradient(180deg, var(--accent-soft), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.auth-card__sub {
    margin: 0;
    color: var(--text-soft);
    font-size: 14px;
}

.auth-card__foot {
    margin: 20px 0 0;
    text-align: center;
    font-size: 12.5px;
    color: var(--text-faint);
}

/* --- Weryfikacja dwuetapowa (2FA) --- */
.auth-wrap:has(.auth-card--wide) { max-width: 540px; }
.auth-card__foot a { color: var(--accent); }
.auth-card__note {
    margin: 20px 0 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
    color: var(--text-soft);
}
.auth-card__note a { display: block; margin-top: 6px; color: var(--accent); font-weight: 700; }
.form__input--code {
    font-size: 22px;
    letter-spacing: .25em;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.setup-steps {
    margin: 0 0 20px;
    padding-left: 20px;
    color: var(--text-soft);
    line-height: 1.6;
}
.setup-steps li + li { margin-top: 10px; }
.qr {
    width: 200px;
    max-width: 100%;
    margin: 12px auto;
    padding: 8px;
    background: #fff;       /* QR musi mieć jasne tło do skanowania */
    border-radius: 8px;
}
.qr svg { display: block; width: 100%; height: auto; }
.secret-key {
    display: block;
    margin-top: 6px;
    padding: 8px 10px;
    font-size: 15px;
    letter-spacing: .08em;
    word-break: break-all;
    background: var(--ink);
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    user-select: all;
}
.recovery-codes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 8px;
    margin: 16px 0 20px;
    padding: 0;
    list-style: none;
}
.recovery-codes code {
    display: block;
    padding: 8px;
    text-align: center;
    font-size: 15px;
    background: var(--ink);
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    user-select: all;
}

/* ============================================================
   FORMULARZE
   ============================================================ */
.form__group {
    margin-bottom: 16px;
}

.form__label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-soft);
    margin-bottom: 6px;
}

.form__input {
    width: 100%;
    padding: 11px 13px;
    font-family: inherit;
    font-size: 15px;
    color: var(--text);
    background: var(--surface-2);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    transition: border-color .15s, box-shadow .15s;
}

.form__input::placeholder { color: var(--text-faint); }

.form__input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ============================================================
   PRZYCISKI
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-family: var(--font-display);
    font-size: 14.5px;
    font-weight: 700;
    padding: 11px 18px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform .08s, background .15s, box-shadow .15s, color .15s;
}

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

.btn--primary {
    background: linear-gradient(180deg, var(--accent-soft), var(--accent));
    color: var(--accent-ink);
}
.btn--primary:hover {
    background: linear-gradient(180deg, var(--accent), var(--accent-dark));
    box-shadow: 0 4px 16px var(--accent-glow);
}

.btn--block {
    width: 100%;
    margin-top: 4px;
}

/* ============================================================
   KOMUNIKATY
   ============================================================ */
.alert {
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    margin-bottom: 18px;
    border-left: 4px solid;
}

.alert--error {
    background: var(--error-bg);
    border-color: var(--error);
    color: #f3a3a5;
}

.alert--success {
    background: var(--ok-bg);
    border-color: var(--ok);
    color: #8fe3b3;
}

.alert--warn {
    background: var(--warn-bg);
    border-color: var(--warn);
    color: #f0c27a;
}

/* ============================================================
   UKŁAD PANELI - nagłówek, treść, stopka
   ============================================================ */
.app-body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 62px;
    background: var(--ink-soft);
    color: var(--text);
    border-bottom: 1px solid var(--line);
    /* subtelna złota linia akcentu pod paskiem */
    box-shadow: 0 1px 0 var(--accent-glow);
}

.topbar__brand {
    display: flex;
    align-items: center;
    gap: 9px;
}

.topbar__logo { font-size: 22px; }

.topbar__name {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 18px;
    letter-spacing: -.01em;
    color: var(--accent);
}

.topbar__user {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 13.5px;
}

.topbar__role {
    background: linear-gradient(180deg, var(--accent-soft), var(--accent));
    color: var(--accent-ink);
    font-weight: 700;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 3px 9px;
    border-radius: 100px;
}

.topbar__person { color: var(--text); }

.topbar__logout {
    color: var(--text-faint);
    text-decoration: none;
    font-weight: 600;
}
.topbar__logout:hover { color: var(--accent); }

/* Wylogowanie to formularz POST - przycisk wygląda jak dotychczasowy link. */
.logout-form { display: contents; }
button.topbar__logout,
button.menu__item {
    background: none;
    border: 0;
    font: inherit;
    cursor: pointer;
    text-align: left;
}
button.topbar__logout { padding: 0; }
button.menu__item { width: 100%; }

.content {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 24px;
}

.footer {
    text-align: center;
    padding: 18px;
    color: var(--text-faint);
}

/* ============================================================
   KARTY - uniwersalny kontener treści paneli
   ============================================================ */
.card {
    background: var(--ink-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
}

/* ============================================================
   NAGŁÓWEK STRONY (panele)
   ============================================================ */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.page-head__title {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -.02em;
    margin: 0;
}

.page-head__sub {
    margin: 4px 0 0;
    color: var(--text-soft);
    font-size: 14px;
}

/* ============================================================
   KARTY - warianty
   ============================================================ */
.card--flush { padding: 0; overflow: hidden; }

.form-card { max-width: 720px; }

/* ============================================================
   TABELA
   ============================================================ */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table thead th {
    text-align: left;
    font-family: var(--font-display);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-soft);
    background: var(--surface-2);
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
}

.table tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: rgba(255,255,255,.03); }

.table__row--inactive { opacity: .5; }

.table__hint {
    display: block;
    font-size: 12px;
    color: var(--text-faint);
    margin-top: 1px;
}

.table__muted { color: var(--text-faint); }

.table__empty {
    text-align: center;
    padding: 32px;
    color: var(--text-faint);
}

.table__actions-col { width: 1%; white-space: nowrap; }

.table__actions {
    display: flex;
    gap: 6px;
    white-space: nowrap;
}

.table code {
    font-size: 12.5px;
    background: var(--surface-2);
    color: var(--accent-soft);
    padding: 2px 6px;
    border-radius: 4px;
}

.inline-form { display: inline; margin: 0; }
.radio-inline { display: flex; gap: 18px; margin-bottom: 8px; }
.form__input--sm { width: auto; padding: 6px 8px; font-size: 13px; }

/* ============================================================
   TAGI I KROPKI STATUSU
   ============================================================ */
.tag {
    display: inline-block;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .02em;
    padding: 3px 9px;
    border-radius: 100px;
}

.tag--role-admin      { background: rgba(155,125,255,.16); color: #b9a3ff; }
.tag--role-dispatcher { background: rgba(90,160,240,.16);  color: #8fc0f5; }
.tag--role-driver     { background: var(--accent-glow);    color: var(--accent-soft); }

.tag--ok  { background: var(--ok-bg);  color: var(--ok); }
.tag--off { background: rgba(255,255,255,.08); color: var(--text-faint); }
.tag--error { background: var(--error-bg); color: var(--error); }

.dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: middle;
}

.dot--offline   { background: #5a5a5a; }
.dot--available { background: var(--ok);   box-shadow: 0 0 6px var(--ok); }
.dot--busy      { background: var(--warn); box-shadow: 0 0 6px var(--warn); }

/* ============================================================
   FORMULARZE - rozbudowa
   ============================================================ */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 18px;
}

.form__group--wide { grid-column: 1 / -1; }

.form__select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%23b0b0b0' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
    padding-right: 34px;
}

.form__select option {
    background: var(--surface-2);
    color: var(--text);
}

.form__input--err {
    border-color: var(--error);
}
.form__input--err:focus {
    box-shadow: 0 0 0 3px var(--error-bg);
}

.form__error {
    display: block;
    color: #f3a3a5;
    font-size: 12.5px;
    margin-top: 4px;
}

.form__hint {
    display: block;
    color: var(--text-faint);
    font-size: 12px;
    margin-top: 4px;
}
.form__hint[hidden] { display: none; }

.form__optional {
    color: var(--text-faint);
    font-weight: 400;
}

.form-section {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 14px 18px 4px;
    margin: 8px 0 4px;
}

.form-section__title {
    font-family: var(--font-display);
    font-size: 12.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--accent);
    padding: 0 6px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

/* ============================================================
   PRZYCISKI - warianty
   ============================================================ */
.btn--sm {
    font-size: 12.5px;
    padding: 6px 11px;
}

.btn--ghost {
    background: transparent;
    color: var(--text-soft);
    border: 1.5px solid var(--line);
}
.btn--ghost:hover {
    background: var(--surface-2);
    color: var(--text);
    border-color: #3a3a3a;
}

.btn--ok {
    background: var(--ok);
    color: #08130c;
}
.btn--ok:hover { background: #34b86d; }

.btn--danger {
    background: var(--error);
    color: #fff;
}
.btn--danger:hover { background: #cf3b40; }

/* ============================================================
   RESPONSYWNOŚĆ
   ============================================================ */
@media (max-width: 680px) {
    .form-grid { grid-template-columns: 1fr; }
    .page-head { flex-direction: column; align-items: stretch; }
    .table { font-size: 13px; }
    .table thead th,
    .table tbody td { padding: 10px 11px; }
    .radio-group { grid-template-columns: 1fr; }
}

/* ============================================================
   TEXTAREA
   ============================================================ */
.form__textarea {
    resize: vertical;
    min-height: 70px;
    font-family: inherit;
    line-height: 1.5;
}

/* ============================================================
   RADIO-KARTY (wybór trybu przydzielenia)
   ============================================================ */
.radio-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.radio-card {
    display: flex;
    gap: 10px;
    padding: 13px 14px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.radio-card:hover { border-color: var(--accent-dark); }

.radio-card:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.radio-card input {
    margin: 2px 0 0;
    accent-color: var(--accent);
}

.radio-card__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.radio-card__body strong {
    font-family: var(--font-display);
    font-size: 14px;
}

.radio-card__body span {
    font-size: 12.5px;
    color: var(--text-soft);
    line-height: 1.4;
}

/* ============================================================
   PANEL KIEROWCY
   ============================================================ */
.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.status-bar__current {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-bar__label {
    display: block;
    font-size: 12px;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.status-bar__value {
    font-family: var(--font-display);
    font-size: 17px;
}

.status-bar__hint {
    font-size: 12.5px;
    color: var(--text-faint);
}

.dot--lg { width: 13px; height: 13px; margin-right: 0; }

/* --- Sekcje pulpitu --- */
.section { margin-bottom: 28px; }

.section__title {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
}

.section__count {
    background: linear-gradient(180deg, var(--accent-soft), var(--accent));
    color: var(--accent-ink);
    font-size: 12px;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 100px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.empty-state {
    color: var(--text-faint);
    font-size: 14px;
    text-align: center;
    padding: 26px;
}

/* --- Lista i karty kursów --- */
.order-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 14px;
}

.order-card {
    background: var(--ink-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.order-card--active {
    border-left: 3px solid var(--accent);
    box-shadow: var(--shadow), inset 0 0 0 1px var(--accent-glow);
}

.order-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.order-card__id {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 13.5px;
    color: var(--text-soft);
}

/* --- Trasa: punkt odbioru i celu --- */
.order-card__route {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.route-point {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-size: 14px;
    line-height: 1.4;
}

.route-point__marker {
    flex: none;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    margin-top: 3px;
    border: 2.5px solid;
}

.route-point__marker--from {
    border-color: var(--ok);
    background: var(--ink-soft);
}
.route-point__marker--to {
    border-color: var(--error);
    background: var(--error);
}

.order-card__meta {
    margin: 0;
    font-size: 13px;
    color: var(--text-soft);
}

.order-card__notes {
    margin: 0;
    font-size: 13px;
    color: var(--text-soft);
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    padding: 8px 11px;
}

.order-card__actions {
    display: flex;
    gap: 8px;
    margin-top: 2px;
}

@media (max-width: 560px) {
    .status-bar { flex-direction: column; align-items: stretch; }
    .order-list { grid-template-columns: 1fr; }
}

/* ============================================================
   MAPA DYSPOZYTORA
   ============================================================ */
.page-head__actions {
    display: flex;
    gap: 9px;
}

.map-toolbar {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    background: var(--ink-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 11px 16px;
    margin-bottom: 12px;
    font-size: 13.5px;
}

.map-toolbar__legend {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-left: auto;
    color: var(--text-soft);
    font-size: 12.5px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}
.legend-dot--available { background: var(--ok); }
.legend-dot--busy      { background: var(--warn); margin-left: 8px; }

/* Płótno mapy */
.map-canvas {
    height: 600px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    overflow: hidden;
    z-index: 0;
}

/* Marker pojazdu na mapie */
.car-marker__dot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid var(--ink-soft);
    box-shadow: 0 2px 8px rgba(0,0,0,.6);
    font-size: 16px;
}

/* Leaflet na ciemnym tle - dopasowanie kontrolek i dymków */
.leaflet-container { background: #1a1a1a; }
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    background: var(--surface-2);
    color: var(--text);
    box-shadow: var(--shadow);
}
.leaflet-bar a {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--line);
}
.leaflet-bar a:hover { background: #3a3a3a; }

/* ============================================================
   WSKAŹNIK POŁĄCZENIA WEBSOCKET
   ============================================================ */
.ws-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 100px;
}

.ws-indicator::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.ws-indicator--connecting { background: var(--warn-bg); color: var(--warn); }
.ws-indicator--online     { background: var(--ok-bg);   color: var(--ok); }
.ws-indicator--offline    { background: var(--error-bg); color: #f3a3a5; }

@media (max-width: 560px) {
    .map-canvas { height: 420px; }
    .map-toolbar__legend { margin-left: 0; }
    .page-head__actions { flex-direction: column; }
}

/* ============================================================
   UKŁAD Z SIDEBAREM (panel administratora)
   ============================================================ */
.layout-with-sidebar {
    display: flex;
    flex: 1;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
}

.content--with-sidebar {
    max-width: none;
    margin: 0;
    flex: 1;
    min-width: 0;
}

/* --- Sidebar --- */
.sidebar {
    flex: none;
    width: 220px;
    padding: 22px 14px;
    border-right: 1px solid var(--line);
}

.sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sidebar__link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 13px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-soft);
    font-size: 14px;
    font-weight: 600;
    transition: background .14s, color .14s;
}

.sidebar__link:hover {
    background: var(--surface-2);
    color: var(--text);
}

.sidebar__link--active {
    background: var(--accent-glow);
    color: var(--accent-soft);
}

.sidebar__icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

/* ============================================================
   KAFELKI STATYSTYK (dashboard)
   ============================================================ */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.stat-card {
    position: relative;
    background: var(--ink-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 18px 16px;
    overflow: hidden;
}

/* złoty akcent na górnej krawędzi kafelka */
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-soft));
}

.stat-card__label {
    display: block;
    font-size: 12.5px;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: .03em;
    margin-bottom: 8px;
}

.stat-card__value {
    display: block;
    font-family: var(--font-display);
    font-size: 34px;
    font-weight: 800;
    line-height: 1;
    color: var(--text);
}

.stat-card__value--sm { font-size: 24px; }

/* Dodatkowa wartość pod główną (np. średnia z całego okresu). */
.stat-card__hint {
    display: block;
    margin-top: 6px;
    font-size: 12.5px;
    color: var(--text-soft);
}

.stat-card__icon {
    position: absolute;
    right: 14px;
    bottom: 12px;
    font-size: 26px;
    opacity: .25;
}

/* ============================================================
   WYKRESY (dashboard)
   ============================================================ */
.chart-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 14px;
}

.chart-card__title {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 14px;
    color: var(--text);
}

@media (max-width: 900px) {
    .stat-grid  { grid-template-columns: repeat(2, 1fr); }
    .chart-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
    .layout-with-sidebar { flex-direction: column; }
    .sidebar {
        width: auto;
        border-right: none;
        border-bottom: 1px solid var(--line);
        padding: 12px 14px;
    }
    .sidebar__nav { flex-direction: row; flex-wrap: wrap; }
    .stat-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   SYSTEM ALARMOWY SOS
   ============================================================ */

/* --- Baner alarmowy u dyspozytora --- */
.sos-banner {
    background: linear-gradient(180deg, #2a0d0e, #1f0a0b);
    border-bottom: 2px solid var(--error);
    padding: 12px 24px;
    animation: sos-flash 1.1s ease-in-out infinite;
}

@keyframes sos-flash {
    0%, 100% { box-shadow: inset 0 0 0 rgba(229,72,77,0); }
    50%      { box-shadow: inset 0 0 40px rgba(229,72,77,.4); }
}

.sos-banner__head {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 8px;
}

.sos-banner__icon { font-size: 18px; }

.sos-banner__title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 14px;
    letter-spacing: .08em;
    color: #ff6b6e;
}

.sos-banner__list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sos-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: rgba(0,0,0,.35);
    border: 1px solid rgba(229,72,77,.4);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
}

.sos-row__info {
    font-size: 13.5px;
    color: var(--text);
}

.sos-row__map {
    color: var(--accent-soft);
    text-decoration: underline;
}

.sos-row__noloc {
    color: var(--text-faint);
}

/* --- Przycisk SOS u kierowcy --- */
.sos-button {
    display: block;
    width: 100%;
    margin-bottom: 24px;
    padding: 18px 20px;
    border: 2px solid var(--error);
    border-radius: var(--radius);
    background: linear-gradient(180deg, #e5484d, #c5383c);
    color: #fff;
    cursor: pointer;
    text-align: center;
    font-family: var(--font-display);
    transition: transform .08s, filter .15s;
}

.sos-button:hover { filter: brightness(1.08); }
.sos-button:active { transform: scale(.99); }

.sos-button__label {
    display: block;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: .06em;
}

.sos-button__hint {
    display: block;
    font-size: 12.5px;
    font-weight: 500;
    opacity: .9;
    margin-top: 4px;
}

/* Stan po wysłaniu alarmu - przycisk wyciszony, nieaktywny. */
.sos-button--sent {
    background: var(--surface-2);
    border-color: var(--warn);
    color: var(--warn);
    cursor: default;
}
.sos-button--sent:hover { filter: none; }
.sos-button--sent .sos-button__hint { color: var(--text-soft); }

/* Alarm niepotwierdzony przez serwer - ponawiany automatycznie. */
.sos-button--failed,
.sos-button--failed:disabled {
    background: var(--error);
    border-color: var(--error);
    color: #fff;
    cursor: progress;
    animation: sos-pulse 1s ease-in-out infinite;
}

/* --- Pulsujący marker kierowcy w alarmie (mapa) --- */
.car-marker__dot--sos {
    border-color: var(--error);
    animation: sos-pulse 1s ease-in-out infinite;
}

@keyframes sos-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(229,72,77,.7); }
    50%      { box-shadow: 0 0 0 12px rgba(229,72,77,0); }
}

/* ============================================================
   ETAP 4 - chipy danych kursu i pole kwoty
   ============================================================ */

/* Chipy: typ pojazdu / forma płatności na karcie kursu. */
.order-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
}

.chip {
    display: inline-block;
    font-size: 11.5px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 100px;
    border: 1px solid var(--line);
    color: var(--text-soft);
    background: var(--surface-2);
}

.chip--vehicle {
    border-color: rgba(212,175,55,.4);
    color: var(--accent-soft);
}

.chip--pay {
    border-color: rgba(90,160,240,.35);
    color: #8fc0f5;
}

/* Pole kwoty końcowej przy zakończeniu kursu. */
.order-card__complete {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.price-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.price-field__label {
    font-size: 11px;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: .03em;
}

.price-field__input {
    width: 110px;
    padding: 7px 10px;
    font-size: 14px;
}

/* Cena na listach (gdy dojdzie do widoków). */
.order-price {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--accent-soft);
}

/* ============================================================
   ETAP 4b - podgląd licznika trasy na karcie kursu
   ============================================================ */
.meter {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.meter__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.meter__label {
    font-size: 12.5px;
    color: var(--text-soft);
}

.meter__value {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
}

.meter__value--price {
    color: var(--accent-soft);
    font-size: 16px;
}

.meter__hint {
    font-size: 11px;
    color: var(--text-faint);
    line-height: 1.3;
    margin-top: 2px;
}

/* ============================================================
   ETAP 5 - archiwum kursów (filtry + tabela)
   ============================================================ */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 14px;
}

.filter-bar__field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 160px;
}

.filter-bar__actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

/* Pozioma przewijalność tabeli na wąskich ekranach. */
.table-scroll {
    overflow-x: auto;
}

.archive-route {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.archive-route__arrow {
    color: var(--accent);
    font-weight: 700;
}

@media (max-width: 680px) {
    .filter-bar__field { min-width: 0; flex: 1 1 100%; }
    .filter-bar__actions { margin-left: 0; flex: 1 1 100%; }
}

/* ============================================================
   ETAP 6 - przebudowa panelu kierowcy
   ============================================================ */

/* Zapas miejsca na dolny pasek (by tresc nie chowala sie pod nim). */
.app-body { padding-bottom: 72px; }

/* --- Dolny pasek nawigacji --- */
.bottombar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 50;
    display: flex;
    background: var(--ink-soft);
    border-top: 1px solid var(--line);
    box-shadow: 0 -2px 12px rgba(0,0,0,.4);
}

.bottombar__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 9px 4px;
    text-decoration: none;
    color: var(--text-faint);
    font-size: 11px;
    font-weight: 600;
    transition: color .15s;
}

.bottombar__item--active { color: var(--accent); }
.bottombar__item--disabled { opacity: .4; }

.bottombar__icon { font-size: 20px; line-height: 1; }

/* --- Karta aktywnego kursu jako link --- */
.order-card--link {
    text-decoration: none;
    color: inherit;
    transition: border-color .15s, transform .08s;
}
.order-card--link:hover { border-color: var(--accent-dark); }
.order-card--link:active { transform: scale(.995); }

.order-card__open {
    align-self: flex-end;
    color: var(--accent-soft);
    font-weight: 700;
    font-size: 13px;
}

/* --- Strona kursu (trip) --- */
.trip {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.trip__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.trip__id {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--text-soft);
}

/* Wielka cena - widoczna dla klienta */
.trip__meter {
    background: linear-gradient(180deg, var(--ink-soft), #141414);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px 20px;
    text-align: center;
}

.trip__price {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
}

.trip__price-value {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 64px;
    line-height: 1;
    color: var(--accent-soft);
    letter-spacing: -.02em;
}

.trip__price-cur {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 28px;
    color: var(--accent);
}

.trip__sub {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 12px;
    font-size: 15px;
    color: var(--text-soft);
}

.trip__dist span, .trip__idle span {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--text);
}

.trip__route {
    background: var(--ink-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.trip__back {
    text-align: center;
    color: var(--text-faint);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    padding: 6px;
}
.trip__back:hover { color: var(--accent); }

/* --- Kafelki opcji --- */
.tiles {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 92px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--ink-soft);
    color: var(--text);
    text-decoration: none;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 13.5px;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, transform .08s, background .15s;
}
.tile:hover { border-color: var(--accent-dark); }
.tile:active { transform: scale(.97); }

.tile__icon { font-size: 26px; line-height: 1; }

.tile--primary { background: linear-gradient(180deg, var(--accent-soft), var(--accent)); color: var(--accent-ink); border: none; }
.tile--ok { border-color: var(--ok); color: var(--ok); }
.tile--warn { border-color: var(--warn); color: var(--warn); }
.tile--danger { border-color: var(--error); color: #f3a3a5; }
.tile--sos-sent { background: var(--surface-2); border-color: var(--warn); color: var(--warn); }

.tile--disabled { opacity: .4; cursor: default; }
.tile--disabled:hover { border-color: var(--line); }

.tile-form { display: contents; }

/* --- Modale (dialog) --- */
.modal {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--ink-soft);
    color: var(--text);
    max-width: 420px;
    width: calc(100% - 36px);
    padding: 0;
    box-shadow: var(--shadow-lg);
}
.modal::backdrop { background: rgba(0,0,0,.6); }

.modal__form { padding: 22px; display: flex; flex-direction: column; gap: 10px; }

.modal__title {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 800;
    margin: 0;
}

.modal__text { margin: 0 0 4px; font-size: 14px; color: var(--text-soft); }
.modal__text--faint { color: var(--text-faint); font-size: 12.5px; }

.modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
}

/* --- Profil klienta (definicje) --- */
.client-info { margin: 4px 0; display: grid; grid-template-columns: 1fr; gap: 2px; }
.client-info dt {
    font-size: 12px;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: .03em;
    margin-top: 10px;
}
.client-info dd { margin: 0; font-size: 15px; color: var(--text); }

/* Tag statusu "przerwany" (aborted) - w archiwum admina */
.tag--status-aborted { background: rgba(229,72,77,.14); color: #f3a3a5; }

@media (max-width: 380px) {
    .tiles { grid-template-columns: 1fr; }
    .trip__price-value { font-size: 52px; }
}

/* ============================================================
   ETAP 7 - toast powiadomienia dla dyspozytora
   ============================================================ */
.toast-stack {
    position: fixed;
    top: 76px;
    right: 22px;
    z-index: 60;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: calc(100% - 44px);
    width: 340px;
    pointer-events: none;
}

.toast {
    background: var(--ink-soft);
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 13.5px;
    color: var(--text);
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateX(20px);
    transition: opacity .25s, transform .25s;
    pointer-events: auto;
}

.toast--in {
    opacity: 1;
    transform: translateX(0);
}

/* ============================================================
   ETAP 8 - telefony dyspozytora (panel admina + lista u kierowcy)
   ============================================================ */

/* Edycja inline w wierszu tabeli (etykieta/numer). */
.form__input--inline {
    padding: 6px 9px;
    font-size: 13px;
    background: var(--ink);
    min-width: 140px;
}

.inline-edit { display: contents; }

.table__row--inactive { opacity: .55; }

/* Tag "wyłączony". */
.tag--off {
    background: var(--surface-2);
    color: var(--text-faint);
    border: 1px solid var(--line);
}

/* Lista numerów w dialogu wyboru u kierowcy. */
.phone-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.phone-list__item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--ink);
    color: var(--text);
    text-decoration: none;
    transition: border-color .15s, background .15s;
}

.phone-list__item:hover {
    border-color: var(--accent-dark);
    background: var(--surface-2);
}

.phone-list__label {
    font-weight: 700;
    font-size: 14px;
}

.phone-list__number {
    font-family: var(--font-display);
    color: var(--accent-soft);
    font-size: 16px;
    letter-spacing: .02em;
}

/* ============================================================
   NAWIGACJA cz.2 - mapa z trasą na stronie kursu kierowcy
   ============================================================ */
.trip__nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.navmap {
    width: 100%;
    height: 280px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--ink);
    overflow: hidden;
    /* Leaflet potrzebuje konkretnej wysokości - nie auto */
    z-index: 0;
}

.nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 0 4px;
    min-height: 18px;
}

.nav-summary {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--accent-soft);
    font-size: 14px;
}

.nav-status {
    color: var(--text-faint);
    font-size: 12.5px;
    display: none; /* JS pokazuje, gdy jest komunikat */
}

/* Lekkie dopasowanie kontrolek Leafleta do ciemnego motywu */
.leaflet-control-attribution {
    background: rgba(15,15,15,.7) !important;
    color: var(--text-faint) !important;
    font-size: 10px !important;
}
.leaflet-control-attribution a { color: var(--accent-soft) !important; }

@media (max-width: 380px) {
    .navmap { height: 220px; }
}

/* ============================================================
   ŚLAD GPS cz.2 - mapa trasy w archiwum admina
   ============================================================ */
.trace-map {
    width: 100%;
    height: 520px;
    border-radius: var(--radius);
    background: var(--ink);
    overflow: hidden;
    z-index: 0;
}

.trace-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.trace-summary__col {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.trace-summary__col strong {
    font-size: 14px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
}

.trace-summary__label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--text-faint);
    font-weight: 600;
}

@media (max-width: 680px) {
    .trace-map { height: 360px; }
}

/* ============================================================
   MAPA W FORMULARZU - pozycje kierowców do przydzielenia
   ============================================================ */
.form-map-wrap {
    margin-top: 16px;
    padding: 16px;
    background: var(--ink-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.form-map-wrap__head {
    margin-bottom: 12px;
}

.form-map-wrap__title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.form-map-wrap__sub {
    margin: 4px 0 0;
    color: var(--text-faint);
    font-size: 12.5px;
}

.form-map {
    width: 100%;
    height: 420px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--ink);
    overflow: hidden;
    z-index: 0;
}

/* Pinezka odbioru/celu - własna ikona Leafleta. */
.form-map__pin {
    border-radius: 50%;
    border: 3px solid #0f0f0f;
    box-shadow: 0 0 0 2px rgba(255,255,255,.4);
}
.form-map__pin--pickup {
    background: #d4af37;
}
.form-map__pin--dest {
    background: #e5484d;
}

@media (max-width: 680px) {
    .form-map { height: 320px; }
}

/* ============================================================
   POWIADOMIENIA KIEROWCY - toasty o nowych kursach
   ============================================================ */
/* Stos toastów u kierowcy - na dole, nad paskiem nawigacji. */
.toast-stack--driver {
    top: auto;
    bottom: 84px;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
}

/* Klikalny toast (link) - powiadomienie o kursie. */
.toast--tap {
    display: block;
    text-decoration: none;
    cursor: pointer;
    font-weight: 600;
    border-left-width: 4px;
}
.toast--tap:active { transform: scale(.99); }

/* Nowe zlecenie na giełdzie - akcent złoty (neutralny). */
.toast--new {
    border-left-color: var(--accent);
}

/* Przydzielony kurs - akcent zielony (mocniejszy sygnał). */
.toast--assigned {
    border-left-color: var(--ok);
    background: linear-gradient(180deg, var(--ink-soft), rgba(62,207,125,.08));
}

/* Kurs anulowany przez dyspozytora - akcent czerwony. */
.toast--cancelled {
    border-left-color: var(--error);
}

/* ============================================================
   STATYSTYKI - wiersz zbiorczy "Razem"
   ============================================================ */
.table__total td {
    border-top: 2px solid var(--line);
    background: var(--ink-soft);
    font-size: 14px;
}
.table__total strong {
    color: var(--text);
}

/* ============================================================
   KONTO KIEROWCY - link "Moje konto" na pulpicie
   ============================================================ */
.account-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    margin-bottom: 16px;
    background: var(--ink-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    transition: border-color .15s, transform .08s;
}
.account-link:hover { border-color: var(--accent-dark); }
.account-link:active { transform: scale(.995); }

.account-link__icon { font-size: 20px; }
.account-link__text { flex: 1; font-weight: 600; font-size: 14px; }
.account-link__arrow { color: var(--accent-soft); font-weight: 700; }

/* ============================================================
   MENU ROZWIJANE KIEROWCY (hamburger)
   ============================================================ */
.menu {
    position: relative;
    display: inline-flex;
}

/* Przycisk z trzema paskami. */
.menu__toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 40px;
    height: 40px;
    padding: 0 9px;
    background: var(--ink-soft);
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.menu__toggle:hover { border-color: var(--accent-dark); }

.menu__bar {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--accent-soft);
    border-radius: 2px;
    transition: transform .2s, opacity .2s;
}

/* Animacja w "X" po otwarciu. */
.menu--open .menu__bar:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}
.menu--open .menu__bar:nth-child(2) {
    opacity: 0;
}
.menu--open .menu__bar:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* Rozwijana lista. */
.menu__dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--ink-soft);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0,0,0,.45);
    padding: 6px;
    z-index: 50;
    animation: menu-drop .14s ease-out;
}
@keyframes menu-drop {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.menu__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: background .12s;
}
.menu__item:hover { background: rgba(212,175,55,.10); }
.menu__item--danger { color: #f08a8d; }
.menu__item--danger:hover { background: rgba(229,72,77,.12); }

.menu__icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

/* Rola jako mała plakietka obok hamburgera - oszczędza miejsce na mobile. */
.topbar__role--badge {
    padding: 3px 8px;
    background: rgba(212,175,55,.14);
    border-radius: 999px;
    font-size: 11px;
}

/* ============================================================
   MAPA KIEROWCY - swobodny podgląd okolicy
   ============================================================ */
.drivermap-wrap {
    position: relative;
    padding: 0;
    overflow: hidden;
}

.drivermap {
    width: 100%;
    height: 70vh;
    min-height: 360px;
    background: var(--ink);
    z-index: 0;
}

/* Przycisk "Moja pozycja" - nakładka na mapę. */
.drivermap-locate {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 500;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 14px;
    background: var(--ink-soft);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text);
    font-weight: 600;
    font-size: 13.5px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,0,0,.4);
    transition: border-color .15s, transform .08s;
}
.drivermap-locate:hover { border-color: var(--accent-dark); }
.drivermap-locate:active { transform: scale(.97); }
.drivermap-locate__icon { color: var(--accent-soft); font-size: 16px; }

.drivermap-status {
    margin-top: 10px;
    padding: 10px 14px;
    background: var(--ink-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--text-faint);
    font-size: 13px;
}


/* ============================================================
   WIADOMOŚCI - wyszukiwarka, lista rozmów (nowy wygląd)
   ============================================================ */
.msg-search {
    position: relative;
    margin-bottom: 16px;
}
.msg-search__icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    opacity: .5;
    font-size: 15px;
}
.msg-search__input {
    width: 100%;
    padding: 13px 16px 13px 44px;
    background: var(--ink-soft);
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}
.msg-search__input:focus { outline: none; border-color: var(--accent-dark); }

.convo-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin: 0 0 10px 2px;
}

.convo-list { list-style: none; margin: 0; padding: 0; }
.convo-list li { border-bottom: 1px solid var(--line); }
.convo-list li:last-child { border-bottom: none; }

.convo {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 14px 16px;
    text-decoration: none;
    color: var(--text);
    transition: background .12s;
}
.convo:hover { background: rgba(212,175,55,.06); }

.convo__avatar {
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--ink);
    border: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    color: var(--accent-soft);
}
.convo__main { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.convo__top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}
.convo__name {
    font-weight: 700;
    font-size: 14.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.convo__time { flex-shrink: 0; font-size: 11.5px; color: var(--text-faint); }
.convo__role { font-size: 12px; color: var(--text-faint); }
.convo__preview {
    font-size: 13px;
    color: var(--text-soft, #b8b8b8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.convo--unread .convo__name { color: var(--accent-soft); }
.convo--unread .convo__preview { color: var(--text); font-weight: 500; }
.convo--unread .convo__avatar { border-color: var(--accent-dark); }

.convo__badge {
    flex-shrink: 0;
    align-self: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 11px;
    background: var(--accent);
    color: #1a1a1a;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.convo-empty-search {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-faint);
    font-size: 13.5px;
}

/* Ramka ogłoszeń na liście wiadomości. */
.announce-box {
    display: flex;
    gap: 14px;
    padding: 16px;
    margin-bottom: 20px;
    background: linear-gradient(180deg, var(--ink-soft), rgba(212,175,55,.05));
    border: 1px solid var(--accent-dark);
    border-radius: var(--radius);
}
.announce-box__icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}
.announce-box__main { flex: 1; min-width: 0; }
.announce-box__title {
    font-weight: 700;
    color: var(--accent-soft);
    font-size: 15px;
    margin-bottom: 6px;
}
.announce-box__list { list-style: none; margin: 0; padding: 0; }
.announce-box__list li {
    margin-bottom: 8px;
    padding-left: 14px;
    position: relative;
}
.announce-box__list li:last-child { margin-bottom: 0; }
.announce-box__list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--accent);
}
.announce-box__text { display: block; font-size: 14px; color: var(--text); }
.announce-box__meta { display: block; font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }

/* ============================================================
   WIADOMOŚCI - rozmowa (nowy wygląd)
   ============================================================ */
.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 0 16px;
}
.chat-header__back {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--ink-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-soft);
    text-decoration: none;
    font-size: 18px;
}
.chat-header__avatar {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--ink-soft);
    border: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: var(--accent-soft);
}
.chat-header__name { font-weight: 700; font-size: 18px; color: var(--text); }
.chat-header__role { font-size: 13px; color: var(--text-faint); }

.chat {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 260px);
    min-height: 340px;
    background: var(--ink-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}
.chat__thread {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.chat__empty { color: var(--text-faint); text-align: center; margin: auto; }

/* Separator daty. */
.chat-date {
    text-align: center;
    margin: 12px 0 8px;
}
.chat-date span {
    display: inline-block;
    padding: 3px 12px;
    background: var(--ink);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 11.5px;
    color: var(--text-faint);
}

/* Wiersz wiadomości (avatar + dymek). */
.chat-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 4px;
}
.chat-row--mine { justify-content: flex-end; }
.chat-row--theirs { justify-content: flex-start; }
.chat-row__avatar {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--ink);
    border: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 11px;
    color: var(--accent-soft);
}

.chat-bubble {
    max-width: 74%;
    padding: 9px 13px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.chat-bubble__body { white-space: pre-wrap; }
.chat-bubble__meta {
    display: flex;
    align-items: center;
    gap: 5px;
    align-self: flex-end;
}
.chat-bubble__time { font-size: 10.5px; opacity: .6; }
.chat-bubble__ticks { font-size: 10.5px; opacity: .6; }
.chat-bubble__ticks--read { color: #4aa3ff; opacity: 1; }

.chat-bubble--mine {
    background: linear-gradient(180deg, var(--accent), var(--accent-dark));
    color: #1a1a1a;
    border-bottom-right-radius: 5px;
}
.chat-bubble--mine .chat-bubble__time,
.chat-bubble--mine .chat-bubble__ticks { color: #1a1a1a; opacity: .7; }
.chat-bubble--theirs {
    background: var(--ink);
    border: 1px solid var(--line);
    color: var(--text);
    border-bottom-left-radius: 5px;
}

.chat__form {
    display: flex;
    gap: 10px;
    padding: 12px;
    border-top: 1px solid var(--line);
    background: var(--ink);
    align-items: center;
}
.chat__input {
    flex: 1;
    padding: 12px 16px;
    background: var(--ink-soft);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}
.chat__input:focus { outline: none; border-color: var(--accent-dark); }
.chat__send {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(180deg, var(--accent), var(--accent-dark));
    color: #1a1a1a;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .08s;
}
.chat__send:active { transform: scale(.94); }


/* ============================================================
   OGŁOSZENIA - lista (panel admina i sekcja w wiadomościach)
   ============================================================ */
.announce-list {
    list-style: none;
    margin: 0;
    padding: 8px;
}
.announce-item {
    padding: 12px 14px;
    margin-bottom: 8px;
    background: linear-gradient(180deg, var(--ink), rgba(212,175,55,.06));
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent);
    border-radius: 10px;
}
.announce-item:last-child { margin-bottom: 0; }
.announce-item__body {
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}
.announce-item__time {
    margin-top: 6px;
    font-size: 11.5px;
    color: var(--text-faint);
}

/* ============================================================
   WIADOMOŚCI - liczniki w menu (przywrócone z Porcji 2)
   ============================================================ */
.toast--msg { border-left-color: var(--accent); }

.menu__count {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--accent);
    color: #1a1a1a;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.topbar__msglink {
    position: relative;
    text-decoration: none;
    font-size: 18px;
    line-height: 1;
}
.topbar__msgbadge {
    position: absolute;
    top: -7px;
    right: -9px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--accent);
    color: #1a1a1a;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =============================================================
   Etap 6: strefy, dokumenty, opinie, strony klienta
   ============================================================= */
.tag--warn { background: var(--warn-bg); color: var(--warn); }
.tag--err  { background: var(--error-bg); color: #f3a3a5; }
.form__check { display: flex; align-items: center; gap: 8px; color: var(--text-soft); font-size: 14px; cursor: pointer; }
.form__check input { width: 18px; height: 18px; accent-color: var(--accent); }
.form__sep { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.form__fieldset { border: 1px solid var(--line-soft); border-radius: 10px; padding: 10px 14px; margin: 0 0 12px; }
.alert__list { margin: 8px 0; padding-left: 18px; }
.stars { color: var(--accent); letter-spacing: 1px; }

.zone-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.zone-card__title { margin: 0 0 10px; font-size: 16px; }
.zone-card__list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.zone-card__list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.zone-card__list .inline-form { margin-left: auto; }

.public-body { align-items: flex-start; }
.public-wrap { width: 100%; max-width: 560px; margin: 0 auto; padding: 24px 16px 40px; }
.public-brand { font-size: 20px; font-weight: 700; color: var(--accent); margin-bottom: 14px; display: flex; gap: 8px; align-items: center; }
.public-card { padding: 20px; }
.public-title { margin: 0 0 12px; font-size: 22px; }
.public-route, .public-driver { color: var(--text-soft); margin: 0 0 12px; }
/* Licznik kursu na stronie śledzenia (w trakcie kursu). */
.public-meter {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 12px; margin: 0 0 12px; border: 2px solid var(--accent); border-radius: 12px;
}
.public-meter[hidden] { display: none; }
.public-meter__label { color: var(--text-faint, var(--text-soft)); font-size: .8rem; font-weight: 700; text-transform: uppercase; }
.public-meter__price { font-size: 2.4rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.public-meter__meta { color: var(--text-soft); }
.public-map { height: 320px; margin-bottom: 14px; border-radius: 12px; }
.public-quote { background: var(--accent-glow); color: var(--accent-soft); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; font-size: 14px; }
.public-thanks { text-align: center; color: var(--text-soft); }
.public-rate { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.btn--block { width: 100%; justify-content: center; margin-bottom: 10px; }
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.rate-stars { display: flex; flex-direction: row-reverse; justify-content: center; gap: 6px; }
.rate-stars input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rate-stars label { font-size: 38px; color: var(--line); cursor: pointer; transition: color .15s; }
.rate-stars input:checked ~ label,
.rate-stars label:hover,
.rate-stars label:hover ~ label { color: var(--accent); }
.rate-stars input:focus-visible + label { outline: 2px solid var(--accent); border-radius: 4px; }
.filter-bar__field[hidden] { display: none; }
.form__input[type=color] { width: 72px; height: 44px; padding: 4px; cursor: pointer; }
.tag--nowrap { white-space: nowrap; }

/* Etap 7: marka korporacji */
.topbar__img { width: 30px; height: 30px; object-fit: contain; border-radius: 6px; }
.public-brand__img { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; }
.auth-card__img { width: 72px; height: 72px; object-fit: contain; border-radius: 14px; margin-bottom: 8px; }
.company-logo { max-width: 160px; max-height: 160px; border-radius: 12px; background: var(--surface-2); padding: 8px; }
.public-foot { text-align: center; font-size: 13px; margin-top: 18px; }
.public-foot a { color: var(--text-soft); }
.public-text h2 { font-size: 16px; margin: 18px 0 6px; color: var(--accent-soft); }
.public-text p, .public-text li { color: var(--text-soft); font-size: 14px; line-height: 1.55; }
.plan-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }

/* Etap 8: asystent AI, alarmy, koszty */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; border-bottom: 1px solid var(--line); }
.tabs__item { padding: 8px 14px; color: var(--text-soft); border-bottom: 2px solid transparent; font-size: 14px; }
.tabs__item--active { color: var(--accent); border-bottom-color: var(--accent); }
.meter { height: 8px; background: var(--surface-2); border-radius: 4px; margin-top: 8px; overflow: hidden; }
.meter__bar { height: 100%; background: var(--accent); }
.ai-report h2 { font-size: 15px; margin: 18px 0 8px; color: var(--accent-soft); }
.ai-summary { font-size: 16px; line-height: 1.55; color: var(--text); }
.ai-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.ai-list { margin: 0; padding-left: 18px; color: var(--text-soft); line-height: 1.55; }
.ai-reco { border-left: 3px solid var(--accent); padding: 4px 0 4px 12px; margin-bottom: 10px; }
.ai-reco p { margin: 4px 0 0; color: var(--text-soft); }
.ai-answer p, .ai-answer li { line-height: 1.6; }
.md-h { font-size: 15px; margin: 14px 0 6px; }
.md-table { margin: 8px 0; }

/* ============================================================
   Dolny pasek paneli administratora i dyspozytora (telefon)
   _partials/mobile_nav.php; na komputerze ukryty (boczne menu).
   ============================================================ */
.bottombar--panel { display: none; }
button.bottombar__item {
    background: none;
    border: 0;
    font: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}
.bottombar__icon { position: relative; }
.bottombar__badge {
    position: absolute;
    top: -6px;
    right: -12px;
    min-width: 16px;
    padding: 0 4px;
    border-radius: 100px;
    background: var(--accent);
    color: var(--accent-ink);
    font-size: 10px;
    font-weight: 800;
    line-height: 16px;
    text-align: center;
}
.bottombar__badge--alert { background: var(--error); color: #fff; }

/* "Więcej" - arkusz wysuwany od dołu. */
.sheet {
    margin: auto auto 0;
    width: 100%;
    max-width: 520px;
    max-height: 82vh;
    padding: 0 0 12px;
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 16px 16px 0 0;
    background: var(--ink-soft);
    color: var(--text);
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
}
.sheet::backdrop { background: rgba(0,0,0,.6); }
.sheet__head {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 10px;
    background: var(--ink-soft);
}
.sheet__title { font-family: var(--font-display); font-weight: 800; font-size: 17px; }
.sheet__close {
    background: none;
    border: 0;
    color: var(--text-faint);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 6px;
}
.sheet__group { border-top: 1px solid var(--line); }
.sheet__summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    cursor: pointer;
    color: var(--text-faint);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.sheet__summary::-webkit-details-marker { display: none; }
.sheet__summary::after { content: '▾'; font-size: 13px; transition: transform .15s; }
.sheet__group:not([open]) .sheet__summary::after { transform: rotate(-90deg); }
.sheet__list { display: flex; flex-direction: column; padding: 0 8px 6px; }
.sheet__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 10px;
    color: var(--text);
    text-decoration: none;
    font-size: 15px;
    background: none;
    border: 0;
    font-family: inherit;
    width: 100%;
    text-align: left;
    cursor: pointer;
}
.sheet__link:hover { background: var(--ink); }
.sheet__link--active { background: var(--accent-glow); color: var(--accent); }
.sheet__link--danger { color: var(--text-faint); }
.sheet__icon { width: 22px; text-align: center; }
.sheet__logout { border-top: 1px solid var(--line); margin-top: 4px; padding: 6px 8px 0; }

@media (max-width: 680px) {
    .has-panel-bar .bottombar--panel { display: flex; }
    /* Menu jest na pasku i w "Więcej" - treść od razu pod nagłówkiem. */
    .has-panel-bar .layout-with-sidebar > .sidebar { display: none; }
    .has-panel-bar .topbar { padding: 0 14px; }
    .has-panel-bar .topbar__person,
    .has-panel-bar .topbar__msglink,
    .has-panel-bar .topbar .logout-form { display: none; }
}

/* --- Klienci: edycja w wierszu ---------------------------------- */
.row-edit > summary { list-style: none; cursor: pointer; display: inline-flex; }
.row-edit > summary::-webkit-details-marker { display: none; }
.row-edit[open] { min-width: 260px; }
.row-edit__form { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }

/* =============================================================
   Veyro - wygląd platformy (Centrala: body.theme-veyro).
   Korporacje zachowują swój kolor (Firma i wygląd, Brand::cssVars).
   ============================================================= */
.theme-veyro {
    --ink:         #070b16;
    --ink-soft:    #0e1526;
    --surface:     #0e1526;
    --surface-2:   #142038;
    --bg:          #070b16;
    --line:        #1e2a44;
    --line-soft:   #18233a;
    --accent:      #1ec8ff;
    --accent-dark: #0a8fd6;
    --accent-soft: #7fe3ff;
    --accent-ink:  #04101f;
    --accent-glow: rgba(30,200,255,.22);
    --text:        #eaf2ff;
    --text-soft:   #a6b4cc;
    --text-faint:  #5f6f8a;
    background: radial-gradient(1200px 600px at 80% -10%, rgba(30,120,255,.18), transparent 60%), var(--bg);
}
.veyro-wordmark {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: .32em;
    color: #fff;
}
.topbar__name.veyro-wordmark { font-size: 17px; }
.veyro-head { text-align: center; }
.veyro-head__mark { width: 72px; height: 72px; display: block; margin: 0 auto 10px; }
.veyro-head .auth-card__title { font-size: 30px; margin: 0; }
.veyro-tagline {
    margin: 6px 0 14px;
    font-size: 10.5px;
    letter-spacing: .38em;
    text-transform: uppercase;
    color: var(--text-soft);
}
