/* Taxi Green driver app.
   Ported from the single-page app's inline <style>. Two knots are untangled
   here: the original declared :root twice (the later block quietly overrode
   --green-primary and --danger-red, so the values below are the ones actually
   rendering today), and #nav-instruction-box twice (the transparent outlined
   version won). Both are stated once. */

:root {
    --green-primary: #28a745;
    --green-light: #22c55e;
    --green-dark: #14532d;
    --green-bg: #f0fdf4;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --danger-red: #dc3545;
    --warning-amber: #f59e0b;
    --driver-blue: #2563eb;
    --taxi-led-green: #00ff00;
    --border-color: #dee2e6;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8fafc;
}

/* ---- Shell ---------------------------------------------------------- */

#app-container {
    display: flex;
    flex-direction: row;
    height: 100dvh;
    width: 100vw;
    overflow: hidden;
    position: relative;
}

#panel {
    width: 420px;
    height: 100%;
    background: #fff;
    box-shadow: 4px 0 15px rgba(0, 0, 0, .1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

#map {
    flex: 1;
    height: 100%;
    width: 100%;
    z-index: 1;
}

/* The map with its overlays: the speedometer, the turn card, the time left,
   the voice switch and the camera button are placed against this. */
#map-area {
    flex: 1;
    position: relative;
    height: 100%;
    min-width: 0;
}

body.admin-mode #map-area { display: none !important; }

body.meter-active #map-area {
    position: fixed;
    top: var(--meter-head-height, 240px);
    left: 0;
    width: 100vw;
    height: calc(100dvh - var(--meter-head-height, 240px));
    z-index: 1;
}

.header {
    background: #0f172a;
    padding: 15px 20px;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    border-bottom: 4px solid var(--green-light);
}

.header h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--green-light);
    cursor: pointer;
    user-select: none;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px;
    background: #fff;
}

/* ---- Buttons -------------------------------------------------------- */

.btn-top-orders {
    background: #334155;
    color: #fff;
    border: 2px solid #475569;
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: 800;
    cursor: pointer;
    text-transform: uppercase;
    font-size: 12px;
    transition: all .3s;
}

.btn-top-orders.alert {
    animation: alert-blink .5s infinite;
    border-color: transparent;
}

@keyframes alert-blink {
    0%, 100% { background-color: var(--danger-red); color: #fff; }
    50% { background-color: var(--green-light); color: #fff; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .5; }
}

.top-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.btn-taximeter {
    flex: 2;
    background: var(--warning-amber);
    color: #000;
    border: 2px solid #b45309;
    border-radius: 8px;
    font-weight: 900;
    font-size: 14px;
    padding: 12px 10px;
    cursor: pointer;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(245, 158, 11, .2);
}

.btn-logout {
    flex: 1;
    background: #cbd5e1;
    color: var(--text-dark);
    border: none;
    border-radius: 8px;
    font-weight: 700;
    padding: 12px 10px;
    cursor: pointer;
    font-size: 13px;
    text-transform: uppercase;
}

.btn-action {
    width: 100%;
    padding: 12px;
    background: var(--driver-blue);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    margin-top: 10px;
}

.btn-calc, .btn-dispatch, .btn-stop-nav, .btn-nav-dropoff,
.btn-arrived, .btn-waiting, .btn-onway, .btn-finish {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 800;
    font-size: 16px;
    text-transform: uppercase;
    margin-bottom: 10px;
    color: #fff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, .2);
}

.btn-calc { background: var(--text-dark); }
.btn-calc:hover { background: #000; }
.btn-dispatch { background: var(--green-primary); }
.btn-dispatch:hover { background: var(--green-dark); }
.btn-stop-nav { background: var(--danger-red); }
.btn-nav-dropoff { background: var(--driver-blue); }
.btn-arrived { background: var(--warning-amber); color: #000; }

.btn-waiting {
    background: #e2e8f0;
    color: var(--text-muted);
    border: 2px dashed #cbd5e1;
    box-shadow: none;
    cursor: default;
}

/* The two calls to action the driver must not miss are the ones that pulse. */
.btn-onway {
    background: var(--green-primary);
    font-weight: 900;
    font-size: 15px;
    animation: pulse 1.2s infinite;
}

.btn-finish {
    background: var(--danger-red);
    font-weight: 900;
    font-size: 15px;
    animation: pulse 1.2s infinite;
}

.btn-add {
    background: none;
    border: 2px dashed #cbd5e1;
    color: var(--text-muted);
    width: 100%;
    padding: 8px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 15px;
}

.btn-edit {
    flex: 1;
    background: #64748b;
    color: #fff;
    border: none;
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.btn-delete {
    background: var(--danger-red);
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.btn-ghost {
    width: 100%;
    margin-bottom: 15px;
    background: #e2e8f0;
    color: #333;
    border: none;
    border-radius: 8px;
    padding: 12px;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    font-size: 13px;
}

/* ---- Forms ---------------------------------------------------------- */

label {
    font-weight: 700;
    font-size: 13px;
    color: var(--text-dark);
    display: block;
    margin-bottom: 4px;
    text-transform: uppercase;
}

input[type=text], input[type=password], input[type=number], input[type=date], select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    background: #fff;
    color: var(--text-dark);
}

input:focus, select:focus {
    border-color: var(--driver-blue);
}

.login-group {
    margin-bottom: 15px;
    text-align: left;
}

/* What was wrong with this field, right under it. */
.field-error {
    margin: 4px 0 0;
    color: var(--danger-red);
    font-size: 13px;
    font-weight: 700;
}

.input-row {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    position: relative;
}

.input-wrapper {
    flex: 1;
    position: relative;
}

.btn-map-pick {
    background: #f1f5f9;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 0 12px;
    cursor: pointer;
    font-size: 16px;
}

.btn-map-pick.active {
    background: var(--danger-red);
    color: #fff;
    border-color: #dc2626;
    animation: pulse 1.2s infinite;
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 0 0 8px 8px;
    max-height: 150px;
    overflow-y: auto;
    z-index: 9999;
    box-shadow: 0 4px 6px rgba(0, 0, 0, .1);
}

.autocomplete-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
}

.autocomplete-item:hover {
    background-color: var(--green-bg);
    color: var(--green-primary);
    font-weight: 600;
}

.mode-toggle {
    display: flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 8px;
    margin-bottom: 15px;
    gap: 4px;
    border: 1px solid #e2e8f0;
}

/* Inactive reads red and active reads green, so the current tariff is
   unmistakable at a glance from the driving seat. */
.btn-mode {
    flex: 1;
    background: var(--danger-red);
    border: none;
    color: #fff;
    padding: 10px 5px;
    font-weight: 900;
    font-size: 13px;
    border-radius: 6px;
    cursor: pointer;
    transition: all .2s;
    text-transform: uppercase;
    opacity: .7;
}

.btn-mode.active {
    background: var(--green-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, .3);
    opacity: 1;
}

.action-section {
    padding-top: 10px;
    border-top: 2px solid #e2e8f0;
    margin-top: 5px;
}

#results-box {
    margin-top: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.res-text {
    font-size: 12px;
    color: var(--text-dark);
    margin: 0;
    font-weight: 600;
    line-height: 1.5;
}

.res-val {
    font-size: 24px;
    font-weight: 900;
    color: var(--text-dark);
}

/* ---- Vehicle bar ---------------------------------------------------- */

.vehicle-bar {
    display: flex;
    background: #e2e8f0;
    padding: 6px 10px;
    align-items: center;
    justify-content: space-between;
    border-radius: 6px;
    margin-bottom: 15px;
    border: 1px solid #cbd5e1;
    gap: 8px;
}

.vehicle-bar .driver {
    color: var(--driver-blue);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
}

.vehicle-number {
    background: var(--green-light);
    border: 2px solid var(--green-dark);
    color: #000;
    font-weight: 900;
    font-size: 12px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* A miniature Czech number plate, EU band and all. */
.plate {
    display: flex;
    align-items: stretch;
    border: 1px solid #64748b;
    border-radius: 4px;
    overflow: hidden;
    height: 22px;
    background: #fff;
}

/* The band carries its own "EU" line: it is decoration that never changes, so
   it belongs here rather than in an element the renderer has to keep alive. */
.plate .eu {
    background: #039;
    width: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1;
    color: #fff;
    font-size: 7px;
    font-weight: 700;
}

.plate .eu::before {
    content: 'EU';
    color: #ff0;
    font-size: 6px;
    font-weight: 400;
}

.plate .number {
    padding: 0 6px;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 900;
    font-size: 12px;
    line-height: 22px;
    color: #000;
    letter-spacing: .5px;
    text-transform: uppercase;
}

.vehicle-picker {
    background: #f8fafc;
    padding: 15px;
    border-radius: 8px;
    border: 2px dashed #94a3b8;
    margin-bottom: 15px;
    text-align: center;
}

/* ---- Orders --------------------------------------------------------- */

.order-card {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all .2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .05);
    border: 1px solid #cbd5e1;
}

.order-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, .1);
}

.order-card.locked {
    opacity: .6;
    cursor: not-allowed;
}

.order-card-title {
    font-weight: 900;
    font-size: 15px;
    color: var(--text-dark);
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.order-card-detail {
    font-size: 13px;
    margin-bottom: 4px;
}

.order-box {
    background: #f8fafc;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #e2e8f0;
}

.call-link {
    margin-left: 8px;
    color: #fff;
    background: var(--driver-blue);
    font-weight: 700;
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 13px;
    display: inline-block;
}

.assigned-note {
    background: #e0f2fe;
    color: var(--driver-blue);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #bae6fd;
    margin-bottom: 15px;
    font-weight: 700;
    text-align: center;
    white-space: pre-line;
}

/* ---- Taximeter ------------------------------------------------------ */

.tariff-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.btn-tariff {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 900;
    text-transform: uppercase;
    cursor: pointer;
    color: #fff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, .2);
}

.tariff-outside { background: var(--green-primary); }
.tariff-city { background: var(--driver-blue); }
.tariff-tour { background: var(--warning-amber); color: #000; }

/* Styled as a physical meter: a dark case around glowing LED panels. */
.taximeter-hardware {
    background: #111;
    border: 4px solid #333;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 10px;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, .8), 0 4px 15px rgba(0, 0, 0, .3);
}

.taxi-led-box, .taxi-led-col {
    background: #001a00;
    border: 2px solid #004d00;
    border-radius: 6px;
}

.taxi-led-box {
    padding: 15px;
    margin-bottom: 10px;
    text-align: right;
}

.taxi-led-label {
    color: #00b300;
    font-size: 13px;
    text-transform: uppercase;
    text-align: left;
    font-weight: 700;
    margin-bottom: 5px;
}

.taxi-led-text {
    font-family: 'Courier New', Courier, monospace;
    color: var(--taxi-led-green);
    font-size: 52px;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 0 15px var(--taxi-led-green);
    margin-top: 5px;
}

.taxi-led-row {
    display: flex;
    gap: 8px;
    justify-content: space-between;
}

.taxi-led-col {
    flex: 1;
    padding: 10px 5px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.taxi-led-label-small {
    color: #00b300;
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 6px;
    line-height: 1.1;
    height: 22px;
}

.taxi-led-val-small {
    font-family: 'Courier New', Courier, monospace;
    color: var(--taxi-led-green);
    font-size: 18px;
    font-weight: 900;
    text-shadow: 0 0 8px var(--taxi-led-green);
}

.taxi-led-subval {
    color: #0c0;
    font-size: 12px;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 700;
    margin-top: 4px;
}

.taxi-active-target {
    background: var(--green-primary);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-weight: 700;
    font-size: 15px;
    text-align: center;
    color: #fff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, .3);
}

.taxi-controls {
    display: flex;
    gap: 10px;
}

.taxi-controls button {
    flex: 1;
    border: none;
    padding: 15px;
    border-radius: 8px;
    font-weight: 900;
    font-size: 13px;
    text-transform: uppercase;
    cursor: pointer;
    color: #fff;
}

.btn-stop-taxi { background: var(--danger-red); flex: 2; }
.btn-new-fare { background: #94a3b8; }
.btn-resume-fare { background: var(--driver-blue); }
.btn-print { background: #64748b; }

/* While the meter runs it takes over the screen: the panel gives way to the
   LED head-unit at the top and a full-width map below it. */
body.meter-active #panel,
body.meter-active .leaflet-control-zoom {
    display: none !important;
}

body.meter-active #meter-head {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 0 auto 0;
    width: 100vw;
    z-index: 9999;
    background: #111;
    box-shadow: 0 4px 15px rgba(0, 0, 0, .5);
    max-height: 60vh;
    overflow-y: auto;
    padding: 10px;
}

body.meter-active #map {
    position: fixed !important;
    top: var(--meter-head-height, 240px);
    left: 0;
    width: 100vw !important;
    height: calc(100dvh - var(--meter-head-height, 240px)) !important;
    z-index: 1 !important;
}

#meter-head { display: none; }

/* ---- Navigation overlay --------------------------------------------- */

/* Outlined white text rather than a panel: it stays legible over any tiles
   without hiding the road underneath. */
#nav-instruction-box {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    z-index: 9999;
    color: #fff;
    font-weight: 900;
    font-size: 20px;
    text-shadow: -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000,
        0 4px 10px rgba(0, 0, 0, .8);
    pointer-events: none;
}

#nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
}

#speedometer {
    position: absolute;
    top: 90px;
    left: 15px;
    width: 65px;
    height: 65px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, .4);
    border: 3px solid #fff;
    z-index: 1000;
    transition: background-color .3s ease;
    color: #fff;
}

#speedometer .value { font-size: 20px; font-weight: 900; line-height: 1.1; }
#speedometer .unit { font-size: 10px; font-weight: 700; opacity: .9; }

#speedometer.flash { animation: flash-red .4s infinite alternate; }

@keyframes flash-red {
    0% { background-color: #ef4444; transform: scale(1); }
    100% { background-color: #7f1d1d; transform: scale(1.1); }
}

/* ---- Map markers ---------------------------------------------------- */

.tg-map-icon, .tg-driver-marker, .tg-other-marker {
    background: none;
    border: none;
}

.tg-car {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tg-car-labelled { flex-direction: column; }

.tg-car-rot {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .4s ease-out;
}

.tg-car-name {
    background: rgba(0, 0, 0, .8);
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: -2px;
    white-space: nowrap;
    font-weight: 700;
    border: 1px solid #333;
}

/* ---- Admin ---------------------------------------------------------- */

.admin-title {
    font-weight: 800;
    font-size: 14px;
    color: var(--text-dark);
    text-transform: uppercase;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 5px;
    margin: 15px 0 12px;
    letter-spacing: .5px;
}

.driver-item {
    background: #f8fafc;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    border: 1px solid #e2e8f0;
}

.driver-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    gap: 8px;
}

.driver-actions {
    display: flex;
    gap: 8px;
}

.admin-filters {
    display: flex;
    gap: 10px;
    align-items: center;
    background: #f8fafc;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.admin-filters input {
    width: auto;
    padding: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 13px;
}

.admin-filters label {
    margin: 0;
    text-transform: none;
    font-size: 12px;
}

.btn-filter-reset {
    background: #64748b;
    color: #fff;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    font-size: 13px;
}

.admin-table-container {
    overflow-x: auto;
    margin-top: 15px;
}

.admin-table-container table {
    width: 100%;
    border-collapse: collapse;
    font-family: sans-serif;
    font-size: 13px;
}

.admin-table-container th,
.admin-table-container td {
    border: 1px solid var(--border-color);
    padding: 10px;
    text-align: left;
    vertical-align: top;
}

.admin-table-container th {
    background-color: #f8f9fa;
    font-weight: 700;
}

.admin-link {
    color: #0056b3;
    text-decoration: none;
    font-weight: 700;
}

.status-pill {
    font-size: 10px;
    padding: 2px 6px;
    color: #fff;
    border-radius: 4px;
    display: inline-block;
    font-weight: 700;
}

/* Admin tables need the width, so they take the whole window and drop the map. */
body.admin-mode #panel {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
}

body.admin-mode #map {
    display: none !important;
}

body.admin-mode #app-container {
    display: block !important;
    overflow-y: auto !important;
}

/* ---- Messages ------------------------------------------------------- */

.toast {
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
}

.toast.info { background: #e0f2fe; color: #075985; border: 1px solid #bae6fd; }
.toast.error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

.toast button {
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 900;
    color: inherit;
    font-size: 16px;
    line-height: 1;
}

.dev-badge {
    background: var(--warning-amber);
    color: #000;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 1px;
    padding: 4px 8px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
}

/* The password-free way in, on the login screen of a development build. */
.dev-login {
    margin-top: 25px;
    padding: 12px;
    border: 2px dashed var(--warning-amber);
    border-radius: 8px;
    background: #fffbeb;
}

.dev-login strong {
    display: block;
    font-size: 13px;
    color: #92400e;
}

.dev-login select {
    margin-top: 8px;
}

.dev-login .btn-action {
    margin-top: 8px;
}

body.dark-mode .dev-login {
    background: #422006;
}

body.dark-mode .dev-login strong {
    color: #fde68a;
}

/* Development-build notice above the admin screens. Deliberately loud: the
   password was skipped, and the tables below are live production data. */
.dev-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    background: #fef3c7;
    border: 2px solid var(--warning-amber);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 15px;
}

.dev-banner-text strong,
.dev-banner.compact strong {
    display: block;
    font-size: 13px;
    color: #92400e;
}

.dev-banner-note {
    font-size: 11px;
    color: #92400e;
    margin-top: 2px;
    line-height: 1.3;
}

.dev-banner .btn-edit {
    flex: none;
    padding: 8px 12px;
}

/* No unlock button — this one is a statement of fact, not an offer. With
   nothing to hold off to the side, the flex row buys nothing and the heading
   and the note stack on their own. */
.dev-banner.compact {
    border-style: dashed;
    display: block;
}

body.dark-mode .dev-banner {
    background: #422006;
}

body.dark-mode .dev-banner-text strong,
body.dark-mode .dev-banner.compact strong,
body.dark-mode .dev-banner-note {
    color: #fde68a;
}

/* ---- Receipt -------------------------------------------------------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .7);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
    padding: 20px 0;
}

.modal-content {
    background: #fff;
    padding: 25px;
    border-radius: 8px;
    width: 95%;
    max-width: 900px;
    font-family: 'Courier New', Courier, monospace;
    box-shadow: 0 10px 25px rgba(0, 0, 0, .3);
    color: #000;
}

.modal-content p { margin: 6px 0; font-size: 14px; color: #000; }

.receipt-top {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: space-between;
}

.receipt-body { flex: 1; min-width: 300px; max-width: 400px; }
.receipt-map-wrap { flex: 1; min-width: 300px; display: flex; flex-direction: column; }

#receipt-map {
    width: 100%;
    height: 350px;
    border: 1px solid #000;
    flex-grow: 1;
}

.receipt-issuer {
    text-align: center;
    font-size: 13px;
    margin-bottom: 10px;
    border-bottom: 1px solid #000;
    padding-bottom: 10px;
}

.receipt-table { width: 100%; font-size: 13px; border-collapse: collapse; }
.receipt-table td { padding: 3px 0; }
.receipt-table td:last-child { text-align: right; }

.receipt-total {
    text-align: center;
    margin-top: 15px;
    border-top: 2px solid #000;
    padding-top: 10px;
    font-size: 18px;
}

.receipt-order-details {
    margin-top: 25px;
    border-top: 2px solid #000;
    padding-top: 15px;
}

.modal-btn {
    background: var(--green-primary);
    color: #fff;
    padding: 12px;
    border: none;
    flex: 1;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
}

.modal-btn.blue { background: var(--driver-blue); }

.receipt-actions { display: flex; gap: 8px; margin-top: 25px; }

/* ---- Small shared utilities ----------------------------------------- */

.screen-title {
    font-size: 18px;
    color: var(--green-dark);
    margin: 0 0 15px;
}

.muted { color: var(--text-muted); }
.small { font-size: 11px; }
.italic { font-style: italic; }
.centered { text-align: center; }
.strong-dark { font-weight: 700; color: var(--text-dark); }
.hint { margin: -4px 0 18px; line-height: 1.3; }
.price, .price-cell { color: var(--green-primary); font-weight: 900; }
.cancelled { color: var(--danger-red); font-weight: 700; }
.th-sub { font-weight: 400; font-size: 11px; }

.warn {
    font-size: 11px;
    color: var(--danger-red);
    margin-bottom: 10px;
    font-weight: 700;
}

.warn-label { color: var(--danger-red); }

.form-row { margin-bottom: 15px; }
.form-row label { font-size: 11px; margin-bottom: 2px; }

hr.dashed {
    border: none;
    border-top: 1px dashed #000;
    margin: 10px 0;
}

/* Button colour variants, so the markup names an intent rather than a hex. */
.btn-action.grey { background: #64748b; }
.btn-action.slate { background: #475569; }
.btn-action.violet { background: #7c3aed; }
.btn-action.green { background: var(--green-primary); }
.btn-action.amber-dark { background: var(--warning-amber); color: #000; }
.btn-action.big { font-size: 15px; padding: 16px; }

.btn-dispatch.amber { background: var(--warning-amber); color: #000; }
.btn-dispatch.grey { background: #64748b; }
.btn-dispatch.red { background: var(--danger-red); }

.btn-edit.green-btn { background: #16a34a; }
.btn-edit.amber-btn { background: var(--warning-amber); color: #000; }
.btn-edit.slate-btn { background: #475569; }
.btn-edit.dark-btn { background: #0f172a; }
.btn-edit.small-btn { flex: none; padding: 4px 8px; margin-top: 6px; }

.btn-delete.outline {
    background: #fff;
    border: 1px solid var(--danger-red);
    color: var(--danger-red);
    padding: 6px 12px;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 15px;
    padding: 2px 4px;
}

/* ---- Screen-specific tweaks ----------------------------------------- */

.picker-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.picker-actions .btn-logout { flex: 1; }
.btn-dispatch.confirm { flex: 2; margin-bottom: 0; }

/* The model takes the slack between the name and the plate itself; it used to
   sit with the number in a .vehicle-id box that did nothing else. */
.vehicle-model {
    flex: 1;
    font-weight: 700;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dark-toggle { background: #334155 !important; color: #fff !important; }

.waypoint-row {
    display: flex;
    gap: 6px;
    align-items: flex-start;
}

.waypoint-row > :first-child { flex: 1; }

.btn-remove-wp {
    background: var(--danger-red);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0 12px;
    height: 42px;
    cursor: pointer;
    font-weight: 700;
}

.order-status {
    font-weight: 900;
    font-size: 11px;
    text-transform: uppercase;
    white-space: nowrap;
}

.order-driver { color: var(--driver-blue); font-weight: 800; margin-top: 5px; }
.pickup-text { color: var(--driver-blue); font-weight: 600; }
.dropoff-text { color: var(--green-primary); font-weight: 600; }
.order-summary { font-size: 13px; margin-bottom: 8px; line-height: 1.4; }

.detail-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.detail-actions .btn-dispatch { margin-bottom: 0; }

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

.driver-item.amber-edge { border-left: 4px solid var(--warning-amber); }

.plate-chip {
    background: #e2e8f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-weight: 700;
    font-size: 12px;
    display: inline-block;
    margin-top: 4px;
}

/* ---- Changelog ------------------------------------------------------ */

.changelog-entry {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 10px;
}

.changelog-version {
    font-weight: 800;
    font-size: 15px;
    color: var(--text-dark);
}

.changelog-version span {
    font-weight: 400;
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 6px;
}

.changelog-entry ul {
    margin: 8px 0 0;
    padding-left: 18px;
}

.changelog-entry li {
    font-size: 13px;
    line-height: 1.45;
    margin-bottom: 4px;
}

/* ⚙️ Nastavení: one card per payment detail, as the phone's settings draw it. */
.settings-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 10px;
}

.settings-label {
    font-weight: 800;
    font-size: 12px;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.settings-value {
    font-family: monospace;
    font-size: 15px;
    color: var(--text-dark);
    margin-bottom: 8px;
}

/* The gear in the header: an icon, so neither the capitals nor the padding the
   worded buttons beside it need. */
.btn-top-orders.btn-settings {
    padding: 6px 10px;
    font-size: 15px;
    text-transform: none;
}

.admin-title.row-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    border-bottom: none;
}

.receipt-buttons {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
}

.edit-col { background: #fffbeb; }

.meter-label { font-size: 15px; color: var(--green-dark); text-transform: none; }

.taxi-led-text .unit { font-size: 24px; }

.nav-glyph { filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .8)); }
.nav-flag { font-size: 38px; text-shadow: 0 4px 6px rgba(0, 0, 0, .8); }

/* ---- Modals --------------------------------------------------------- */

.modal-content.narrow { max-width: 400px; }
.modal-content.sans { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }

.modal-title {
    margin-top: 0;
    color: var(--text-dark);
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 10px;
}

.modal-content.sans input { margin-bottom: 15px; }

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions .btn-dispatch,
.modal-actions .btn-ghost {
    flex: 1;
    margin-bottom: 0;
}

.btn-ghost.close { margin-bottom: 0; }

.receipt-title { text-align: center; margin: 0 0 5px; }
.receipt-datetime { text-align: center; font-size: 13px; margin-bottom: 5px; }

.receipt-order-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 13px;
}

.receipt-order-grid > div { flex: 1; min-width: 250px; }

/* The day/night control is dark navy between the amber meter button and the
   pale sign-out one, as the original draws it — the same fill in both looks,
   because this is the button that changes the look. */
.top-buttons .dark-toggle {
    background: var(--header-bg, #0f172a) !important;
    color: #fff !important;
}

/* ---- Ported from the phone ------------------------------------------ */

/* The header carries Vozy beside Objednávky. */
.header-buttons { display: flex; gap: 6px; align-items: center; }

/* Address suggestions: what names the place in bold, what locates it under it,
   and how far away it is on the right — the list is in that order. */
.autocomplete-list { max-height: 320px; }
.place-row { display: flex; align-items: center; gap: 8px; }
.place-words { flex: 1; min-width: 0; }
.place-head { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.place-detail { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.place-away { font-size: 12px; font-weight: 700; color: var(--text-muted); white-space: nowrap; }

/* The tick: the words stand for a place on the map. ➤ while it is driven to. */
.btn-found {
    background: none;
    border: none;
    color: var(--green-primary);
    font-size: 20px;
    font-weight: 900;
    cursor: pointer;
    padding: 0 4px;
}

.btn-found.navigating { color: var(--driver-blue); }

.place-menu {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 10000;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 6px 10px 10px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .2);
    width: min(320px, 100%);
}

.place-menu .btn-action { margin-top: 6px; padding: 9px; font-size: 12px; }
.place-menu .btn-ghost { margin: 6px 0 0; padding: 8px; }
.place-menu-title { font-size: 12px; font-weight: 700; color: var(--text-muted); padding-top: 4px; }

/* The fare in hand: who, and the number written on the button. */
.ride-card {
    display: flex;
    gap: 10px;
    align-items: center;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 12px;
}

.ride-card-words { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.ride-card-name { color: var(--driver-blue); font-size: 14px; }

.ride-card-call {
    background: var(--green-primary);
    color: #fff;
    text-decoration: none;
    font-weight: 800;
    font-size: 12px;
    text-align: center;
    border-radius: 8px;
    padding: 6px 10px;
    line-height: 1.3;
}

.stop-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 700;
    color: #000;
}

.stop-card .btn-edit { flex: none; padding: 6px 10px; }

/* The button that ends the ride and the figure it will be filed at, one row. */
.action-with-price { display: flex; gap: 8px; align-items: stretch; }
.action-with-price > :first-child { flex: 1; }

.btn-price {
    background: #475569;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0 12px;
    margin-bottom: 10px;
    font-weight: 800;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}

#results-box { cursor: default; user-select: none; }

/* The ways round, as one switch: the half in force green. */
.way-toggle {
    display: flex;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    overflow: hidden;
    margin-top: 8px;
}

.btn-way {
    flex: 1;
    border: none;
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 800;
    font-size: 14px;
    padding: 6px 8px;
    cursor: pointer;
}

.btn-way.active { background: var(--green-primary); color: #fff; }
.way-mark { font-size: 19px; vertical-align: middle; }

/* Navigation chrome over the map. */
#nav-then { font-size: 15px; opacity: .9; margin-top: 2px; }

#nav-voice, #camera-mode {
    position: absolute;
    z-index: 1000;
    border: 2px solid #fff;
    border-radius: 22px;
    background: rgba(15, 23, 42, .85);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .35);
}

#nav-voice { top: 90px; right: 15px; width: 46px; height: 46px; font-size: 20px; }
#nav-voice.on { background: var(--green-primary); }

#camera-mode { bottom: 30px; left: 15px; padding: 8px 14px; font-size: 13px; }
#camera-mode.active { background: var(--driver-blue); }

#nav-eta {
    position: absolute;
    top: 165px;
    left: 15px;
    z-index: 1000;
    background: rgba(15, 23, 42, .85);
    color: #fff;
    border-radius: 10px;
    padding: 6px 10px;
    text-align: center;
    min-width: 65px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .35);
}

#nav-eta .eta-min { font-size: 19px; font-weight: 800; line-height: 1.1; }
#nav-eta .eta-min span { font-size: 12px; font-weight: 700; opacity: .85; margin-left: 3px; }
#nav-eta .eta-rest { font-size: 11.5px; font-weight: 600; opacity: .8; margin-top: 1px; }

.nav-roundabout { position: relative; display: inline-flex; }

.nav-exit {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 3px #1e40af, 0 0 3px #1e40af;
}

/* The waiting customer, alive and able to move. */
.tg-live {
    font-size: 26px;
    text-align: center;
    border-radius: 50%;
    animation: live-halo 1.6s infinite;
}

@keyframes live-halo {
    0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, .6); }
    70% { box-shadow: 0 0 0 14px rgba(37, 99, 235, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

.closure-sign { background: none; border: none; cursor: pointer; }

.action-sheet .btn-action { margin-top: 8px; }
.action-sheet .btn-ghost { margin: 12px 0 0; }
.action-sheet .btn-dispatch { margin-top: 10px; }

/* The price's own menu: amounts read as they are written — "312 Kč", not the
   "312 KČ" the other sheets' capitals would make of it. */
.price-sheet .btn-action { text-transform: none; font-size: 15px; }
.price-sheet .btn-action:disabled { opacity: .45; cursor: default; }

/* The amount, the driver's to change: one row, the figure large enough to read
   back to the passenger before a code is made from it. */
.price-amount { display: flex; align-items: center; gap: 8px; margin: 4px 0 6px; font-weight: 700; }
.price-amount input[type=text] { flex: 1; font-size: 20px; font-weight: 700; text-align: right; }

/* Two taps on UJETO, or on the calculator's VZDÁLENOST: přistavení, the ride
   and the way back priced apart, over a small map of them. */
.split-map { width: 100%; height: 240px; border: 1px solid var(--border-color); border-radius: 6px; margin-top: 8px; }
.split-lines { width: 100%; border-collapse: collapse; margin-top: 8px; }
.split-lines td { padding: 6px 0; border-top: 1px solid var(--border-color); vertical-align: top; }
.split-lines .amount { text-align: right; white-space: nowrap; font-weight: 700; padding-left: 12px; }
.split-lines tr.total td { font-size: 18px; }
.taxi-led-col:first-child { cursor: pointer; }
#results-box .res-distance { cursor: pointer; }

/* A payment QR over the screen. Black on white in either look — a camera reads
   a dark code on a light ground — so the card is not a .modal-content, whose
   night rules would reach it; centred by its margins, which unlike centring
   the overlay's items still scrolls to its top on a short screen; nothing to
   press: a click anywhere closes it. */
.qr-overlay { background: rgba(0, 0, 0, .6); cursor: pointer; }
.price-overlay:focus, .qr-overlay:focus { outline: none; }

.qr-card {
    margin: auto;
    background: #fff;
    color: #0f172a;
    border-radius: 12px;
    padding: 16px;
    width: min(360px, calc(100vw - 32px));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    box-shadow: 0 10px 25px rgba(0, 0, 0, .3);
}

.qr-title { font-size: 16px; font-weight: 700; }
.qr-amount { font-size: 32px; font-weight: 700; line-height: 1.1; }

/* Drawn at whole modules, so the camera gets square edges, not a blur. */
.qr-code { width: min(280px, 100%); aspect-ratio: 1; image-rendering: pixelated; }

.qr-payee { font-size: 14px; font-weight: 700; }
.qr-account { font-size: 13px; font-family: 'Courier New', Courier, monospace; white-space: pre-line; }
.qr-note { font-size: 13px; color: #475569; }
.qr-hint { font-size: 12px; color: #475569; }
.qr-close { margin-top: 6px; }

/* Two taps on the meter's reading open its menu; a double click must not
   select the digits instead. */
.taxi-led-box { user-select: none; }
.date-time-row { display: flex; gap: 8px; margin-bottom: 10px; }
.date-time-row input { flex: 1; }
input[type=time] {
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
}

/* Vozy: the table under the map, sorted nearest first. */
.fleet-head { display: flex; gap: 8px; align-items: flex-start; }
.fleet-head .btn-ghost { flex: 1; }
.fleet-head .btn-filter-reset { padding: 12px; }

.fleet-table { margin-top: 8px; }

.fleet-row {
    display: grid;
    grid-template-columns: 34px 1fr auto auto;
    gap: 10px;
    align-items: center;
    padding: 9px 4px;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-dark);
}

.fleet-row.selected { background: #eff6ff; }
.fleet-header { cursor: default; border-bottom: 2px solid #cbd5e1; font-size: 12px; font-weight: 700; color: var(--text-muted); }
.fleet-name { display: flex; flex-direction: column; min-width: 0; }
.fleet-name b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fleet-me { font-weight: 800; color: var(--driver-blue); }
.right { text-align: right; }

.fleet-badge {
    width: 26px;
    height: 26px;
    border-radius: 13px;
    color: #fff;
    font-weight: 800;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fleet-card { display: flex; gap: 10px; align-items: flex-start; }
.fleet-card-text { flex: 1; white-space: pre-line; font-size: 13px; line-height: 1.4; color: var(--text-dark); }
.fleet-call { flex: none; text-decoration: none; padding: 8px 12px; font-size: 12px; }

/* Ceník: one row per price, Kč and €. */
.tariff-grid {
    display: grid;
    grid-template-columns: 1fr 90px 90px;
    gap: 8px 10px;
    align-items: center;
    margin: 12px 0;
}

.tariff-head { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }
.tariff-label { font-size: 13px; color: var(--text-dark); }
.pre-line { white-space: pre-line; }

/* Planned rides: violet as planned, red once their time has come. */
.order-card.planned { background: #f3e8ff; border: 1px solid #7c3aed; border-left: 6px solid #7c3aed; }
.order-card.planned .order-status { color: #7c3aed; }
.order-card.planned.due { background: #fee2e2; border-color: #dc2626; }
.order-card.planned.due .order-status { color: #dc2626; }
.planned-card { background: #f3e8ff; border-color: #c4b5fd; }
.planned-card .ride-card-name { color: #6d28d9; }
.place-section { font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--text-muted); padding: 8px 10px 2px; }
.place-row .btn-edit, .place-row .btn-delete { flex: none; padding: 4px 8px; font-size: 13px; }
.handoff-list .btn-action { margin-top: 6px; }
.check-row { display: flex; align-items: center; gap: 8px; text-transform: none; margin: 8px 0; }
.check-row input { width: auto; }
.plan-form select { margin-bottom: 10px; }

.beacon-note { margin-top: 24px; }
.beacon-note .admin-title { margin-top: 0; }
.driver-phone { margin: 4px 0; }

/* The date filter: one line saying what it is, the choice opened from it. */
.date-filter { position: relative; }

.date-filter-panel {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 10000;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 10px;
    width: 280px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .2);
}

.date-filter-panel .btn-action { margin-top: 6px; padding: 9px; }
.date-filter-panel .btn-ghost { margin: 10px 0 0; }
.date-filter-panel label { display: block; margin-top: 6px; }
.date-filter-title { font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--text-muted); margin-top: 8px; }

/* ---- Dark mode ------------------------------------------------------ */

body.dark-mode {
    background-color: #0f172a !important;
    --text-dark: #f8fafc;
    --text-muted: #94a3b8;
}

body.dark-mode #panel,
body.dark-mode .panel-content,
body.dark-mode .header {
    background: #1e293b !important;
}

body.dark-mode input,
body.dark-mode select,
body.dark-mode .autocomplete-list,
body.dark-mode .autocomplete-item {
    background-color: #0f172a !important;
    color: #f8fafc !important;
    border-color: #334155 !important;
}

body.dark-mode .autocomplete-item:hover { background-color: #334155 !important; }

body.dark-mode .driver-item,
body.dark-mode #results-box,
body.dark-mode .vehicle-picker,
body.dark-mode .order-box,
body.dark-mode .changelog-entry,
body.dark-mode .settings-item,
body.dark-mode .mode-toggle {
    background-color: #0f172a !important;
    border-color: #334155 !important;
}

body.dark-mode .changelog-entry,
body.dark-mode .changelog-version { color: #f8fafc; }

body.dark-mode .place-menu,
body.dark-mode .date-filter-panel,
body.dark-mode .ride-card,
body.dark-mode .btn-way {
    background-color: #0f172a !important;
    border-color: #334155 !important;
    color: #f8fafc;
}

body.dark-mode .btn-way.active { background-color: var(--green-primary) !important; color: #fff; }
body.dark-mode .fleet-row.selected { background: #1e3a5f; }
body.dark-mode .fleet-row,
body.dark-mode .fleet-header { border-color: #334155; }

body.dark-mode label { color: #cbd5e1 !important; }

body.dark-mode .res-text,
body.dark-mode .res-val,
body.dark-mode h2,
body.dark-mode h3 {
    color: #f8fafc !important;
}

/* The calculate button is near-black by day, which vanishes at night. */
body.dark-mode .btn-calc {
    background-color: #334155 !important;
    border: 1px solid #475569 !important;
}

body.dark-mode .btn-calc:hover { background-color: #475569 !important; }

/* Order cards keep their light backgrounds: the status colour is the point. */
body.dark-mode .order-card .order-card-title,
body.dark-mode .order-card .order-card-detail {
    color: #0f172a !important;
}

body.dark-mode .admin-table-container th,
body.dark-mode .admin-table-container td,
body.dark-mode .admin-table-container tr {
    background-color: #1e293b !important;
    color: #f8fafc !important;
    border-color: #334155 !important;
}

body.dark-mode .admin-table-container thead tr { background-color: #0f172a !important; }
body.dark-mode .admin-table-container td span { color: #cbd5e1 !important; }

body.dark-mode .admin-table-container td a,
body.dark-mode .admin-link {
    color: #38bdf8 !important;
}

/* Invert the tiles rather than ship a second tile set. */
body.dark-mode .leaflet-tile,
body.dark-mode .leaflet-control-zoom-in,
body.dark-mode .leaflet-control-zoom-out,
body.dark-mode .leaflet-control-attribution {
    filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%);
}

body.dark-mode .leaflet-container { background: #0f172a !important; }

/* The receipt is a paper document — it stays light in both themes. */
body.dark-mode .modal-content,
body.dark-mode .modal-content * {
    color: #000 !important;
}

/* ---- Phones --------------------------------------------------------- */

@media only screen and (max-width: 768px) {
    html, body {
        height: auto;
        min-height: 100vh;
        overflow-x: hidden;
        overflow-y: auto;
        width: 100%;
    }

    #app-container {
        display: block;
        height: auto;
        min-height: 100vh;
    }

    #panel {
        width: 100%;
        height: auto;
        position: relative;
        z-index: 1000;
        box-shadow: 0 4px 15px rgba(0, 0, 0, .1);
    }

    #map {
        width: 100%;
        height: 50vh;
        min-height: 350px;
    }

    #map-area { height: auto; }

    body.admin-mode #panel {
        width: 100vw !important;
        max-width: 100vw !important;
        height: auto !important;
        min-height: 100vh;
    }

    .receipt-body, .receipt-map-wrap { max-width: 100%; }
}

/* ---- Print ---------------------------------------------------------- */

@media print {
    @page {
        margin: 0;
        size: auto;
    }

    body > *:not(.modal-overlay) { display: none !important; }

    html, body {
        background: #fff !important;
        margin: 0 !important;
        padding: 0 !important;
        color: #000 !important;
        height: auto !important;
        overflow: visible !important;
    }

    .modal-overlay {
        display: block !important;
        position: relative !important;
        inset: auto !important;
        background: #fff !important;
        padding: 0 !important;
        overflow: visible !important;
    }

    .modal-content {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        overflow: visible !important;
    }

    /* Thermal printers substitute a font that mangles Czech diacritics; forcing
       a known face keeps ěščřžýáíé readable on the till roll. */
    .modal-content * {
        visibility: visible !important;
        color: #000 !important;
        font-family: Arial, Helvetica, sans-serif !important;
    }

    /* One column on a 5.6 cm roll. */
    .receipt-top { display: block !important; }
    .receipt-body, .receipt-map-wrap { max-width: 100% !important; width: 100% !important; }

    .receipt-actions { display: none !important; }

    .leaflet-control-container { display: none !important; }

    /* Greyscale with extra contrast prints far better than colour tiles. */
    .leaflet-tile-pane {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        filter: grayscale(100%) contrast(150%) !important;
    }

    #receipt-map {
        border: 2px solid #000 !important;
        height: 180px !important;
        width: 100% !important;
        margin: 10px 0 15px !important;
    }
}
