/* TaxiBook Center — dispatch sheet (Excel-precise, 2026) */
:root {
    --bg: #eef1f4;
    --surface: #ffffff;
    --ink: #1a1d21;
    --muted: #6b7280;
    --line: #d0d5dd;
    --line-soft: #e8ecf1;
    --header: #f3f4f6;
    --zebra: #fafbfc;
    --sel: #dceaf7;
    --sel-border: #2b6cb0;
    --accent: #FDB813;
    --accent-ink: #1a1d21;
    --ok: #15803d;
    --warn: #b45309;
    --danger: #b91c1c;
    --info: #1d4ed8;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
    --font: "IBM Plex Sans", "Segoe UI", sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, monospace;
    --row-h: 28px;
    --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
    width: 100%; height: 100%; overflow: hidden;
    background: var(--bg); color: var(--ink);
    font-family: var(--font); font-size: 13px; line-height: 1.35;
    -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
.hidden { display: none !important; }
.screen { width: 100%; height: 100%; }

/* ---------- Boot / Login ---------- */
.boot-screen, #login {
    display: flex; align-items: center; justify-content: center;
    background:
        radial-gradient(1200px 600px at 20% -10%, rgba(253,184,19,0.18), transparent 55%),
        radial-gradient(900px 500px at 90% 110%, rgba(43,108,176,0.10), transparent 50%),
        var(--bg);
}
.boot-card, .login-card {
    width: min(400px, calc(100vw - 32px));
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 28px 28px 24px;
}
.boot-brand, .login-brand {
    font-size: 22px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink);
}
.boot-brand span, .login-brand span, .toolbar-brand span { color: #b8860b; }
.boot-bar {
    margin: 18px 0 12px; height: 3px; background: var(--line-soft); border-radius: 99px; overflow: hidden;
}
.boot-bar i {
    display: block; height: 100%; width: 40%;
    background: var(--accent);
    animation: bootslide 1.1s ease-in-out infinite;
}
@keyframes bootslide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(280%); }
}
.boot-msg, .login-sub, .login-hint { color: var(--muted); font-size: 13px; }
.login-sub { margin: 6px 0 20px; }
.login-hint { margin-top: 14px; font-size: 12px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--muted); }
.field input, .search input {
    width: 100%; height: 38px; padding: 0 12px;
    border: 1px solid var(--line); border-radius: 8px;
    background: #fff; outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .search input:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(43,108,176,0.15);
}

.btn {
    display: inline-flex; align-items: center; justify-content: center;
    height: 36px; padding: 0 14px; border-radius: 8px;
    font-weight: 600; font-size: 13px;
    border: 1px solid transparent;
    transition: background .12s, border-color .12s, color .12s;
}
.btn-primary {
    width: 100%; background: var(--accent); color: var(--accent-ink); border-color: #e0a40f;
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost {
    background: #fff; border-color: var(--line); color: var(--ink); height: 30px; padding: 0 10px;
}
.btn-ghost:hover { background: var(--header); }
.btn-accent {
    background: var(--accent); color: var(--accent-ink); border-color: #e0a40f;
    height: 30px; padding: 0 12px; font-weight: 700;
}
.btn-accent:hover { filter: brightness(1.05); }
.err { color: var(--danger); min-height: 18px; margin-top: 8px; font-size: 12px; font-weight: 500; }

/* ---------- App shell ---------- */
#app {
    display: grid;
    grid-template-rows: 48px minmax(200px, 36vh) 1fr 34px;
    gap: 8px;
    padding: 8px;
    height: 100%;
}

.toolbar {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0 12px 0 14px;
    box-shadow: var(--shadow);
    border-top: 3px solid var(--accent);
}
.toolbar-brand { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; }
.toolbar-meta { display: flex; align-items: center; gap: 12px; }
.clock {
    font-family: var(--mono); font-variant-numeric: tabular-nums;
    font-weight: 500; color: var(--muted); font-size: 13px;
}
.user { font-weight: 600; color: var(--ink); font-size: 13px; }

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.panel-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, #fafbfc, #f3f4f6);
    flex-shrink: 0;
}
.panel-head h1 {
    font-size: 13px; font-weight: 700; letter-spacing: 0.01em;
    display: flex; align-items: center; gap: 8px;
}
.count {
    font-family: var(--mono); font-weight: 600; font-size: 11px;
    background: #eef2ff; color: var(--info);
    border: 1px solid #c7d2fe;
    border-radius: 999px; padding: 1px 8px;
}
.panel-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.map-body { position: relative; background: #1a1d21; }
#map { width: 100%; height: 100%; min-height: 160px; background: #1a1d21; }
.map-legend {
    display: flex; flex-wrap: wrap; gap: 10px 14px;
    font-size: 11px; color: var(--muted); font-weight: 500;
}
.map-legend .dot {
    display: inline-block; width: 9px; height: 9px; border-radius: 2px;
    margin-right: 5px; vertical-align: middle;
    border: 1px solid rgba(0,0,0,0.15);
}
.dot.unassigned { background: #ef4444; }
.dot.assigned { background: #22c55e; }
.dot.active { background: #eab308; }
.dot.selected { background: #3b82f6; }

.pin {
    width: 22px; height: 22px; border-radius: 4px;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.35);
    font-family: var(--mono); font-size: 10px; font-weight: 700;
    line-height: 18px; text-align: center; color: #fff;
}
.pin.unassigned { background: #ef4444; }
.pin.assigned { background: #16a34a; }
.pin.active { background: #ca8a04; }
.pin.selected { background: #2563eb; outline: 2px solid #1e3a8a; outline-offset: 1px; }

/* ---------- Excel-like sheet ---------- */
.sheet-head .sheet-tools { display: flex; align-items: center; gap: 10px; }
.search input { height: 30px; width: 240px; font-size: 12px; }
.chk {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; user-select: none;
}
.chk input { width: 14px; height: 14px; accent-color: var(--sel-border); }

.sheet-body { padding: 0; }
.sheet {
    flex: 1; min-height: 0; display: flex; flex-direction: column;
    border-top: 1px solid var(--line);
}
.sheet-header, .sheet-row {
    display: grid;
    grid-template-columns: 40px 118px 110px 100px 140px minmax(160px, 1.4fr) 140px 72px;
    align-items: center;
    height: var(--row-h);
    padding: 0 8px;
    gap: 0;
    white-space: nowrap;
    border-bottom: 1px solid var(--line-soft);
}
.sheet-header {
    position: sticky; top: 0; z-index: 2;
    background: var(--header);
    border-bottom: 1px solid var(--line);
    font-size: 11px; font-weight: 700; color: var(--muted);
    text-transform: uppercase; letter-spacing: 0.04em;
    user-select: none;
}
.sheet-header > span {
    padding: 0 6px;
    border-right: 1px solid var(--line);
}
.sheet-header > span:last-child { border-right: none; }

.sheet-rows {
    flex: 1; overflow: auto; outline: none; background: #fff;
}
.sheet-rows:focus { box-shadow: inset 0 0 0 2px rgba(43,108,176,0.25); }

.sheet-row {
    font-size: 12px;
    cursor: pointer;
    color: var(--ink);
}
.sheet-row > span {
    padding: 0 6px;
    border-right: 1px solid var(--line-soft);
    overflow: hidden; text-overflow: ellipsis;
    font-variant-numeric: tabular-nums;
}
.sheet-row > span:last-child { border-right: none; text-align: right; font-family: var(--mono); font-weight: 500; }
.sheet-row:nth-child(even) { background: var(--zebra); }
.sheet-row:hover { background: #f0f7fc; }
.sheet-row.selected {
    background: var(--sel) !important;
    box-shadow: inset 3px 0 0 var(--sel-border);
}
.sheet-row .c-idx, .sheet-row .c-hash, .sheet-row .c-when {
    font-family: var(--mono); font-size: 11px;
}
.sheet-row .c-hash { color: var(--info); font-weight: 500; }
.sheet-row.selected .c-hash { color: #1e40af; }
.sheet-row.needs-driver .c-driver { color: var(--danger); font-weight: 600; }
.sheet-row .c-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    height: 20px;
    padding: 0 7px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
    line-height: 1;
    background: #f3f4f6;
    color: #6b7280;
    border-color: #e5e7eb;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Status colors — fond + texte */
.st-creating { background: #e0f2fe; color: #0369a1; border-color: #bae6fd; }
.st-pending, .st-processing { background: #fef3c7; color: #b45309; border-color: #fde68a; }
.st-searching, .st-dispatching { background: #f3e8ff; color: #7c3aed; border-color: #e9d5ff; }
.st-booked { background: #dbeafe; color: #1d4ed8; border-color: #bfdbfe; }
.st-accepted, .st-confirmed { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.st-driver_arriving { background: #ffedd5; color: #c2410c; border-color: #fed7aa; }
.st-driver_arrived { background: #e0f2fe; color: #0284c7; border-color: #bae6fd; }
.st-onboard, .st-in_progress { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }
.st-awaiting_payment, .st-awaiting_prepayment, .st-processing_payment { background: #fef3c7; color: #b45309; border-color: #fde68a; }
.st-completed, .st-paid { background: #d1fae5; color: #047857; border-color: #a7f3d0; }
.st-cancelled, .st-cancelled_central, .st-failed, .st-expired, .st-error, .st-no_driver, .st-rejected {
    background: #fee2e2; color: #b91c1c; border-color: #fecaca;
}
.st-archived { background: #f3f4f6; color: #6b7280; border-color: #e5e7eb; }

.sheet-empty {
    display: flex; align-items: center; justify-content: center;
    height: 80px; color: var(--muted); font-size: 13px;
}

.helpbar {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    padding: 0 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--muted); font-size: 11px; font-weight: 500;
}
.helpbar kbd {
    display: inline-block;
    min-width: 18px; padding: 1px 5px;
    border: 1px solid var(--line); border-bottom-width: 2px;
    border-radius: 4px; background: #fff;
    font-family: var(--mono); font-size: 10px; font-weight: 600;
    color: var(--ink); text-align: center;
}

/* ---------- Modal ---------- */
.modal {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(15, 23, 42, 0.45);
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
}
.modal-card {
    width: min(680px, 100%);
    max-height: calc(100vh - 32px);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(15,23,42,0.2);
    display: flex; flex-direction: column; overflow: hidden;
}
.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, #fafbfc, #f3f4f6);
}
.modal-head h2 { font-size: 15px; font-weight: 700; }
.modal-body { padding: 14px 16px 16px; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.modal-ride {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
    padding: 10px 12px;
    font-family: var(--mono); font-size: 12px; line-height: 1.55;
    color: var(--ink); white-space: pre-wrap;
}
.driver-sheet { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; max-height: 280px; }
.driver-header, .driver-row {
    grid-template-columns: 36px 1.4fr 120px 90px 90px !important;
}
.driver-rows { max-height: 240px; }
.driver-row { cursor: pointer; }
.modal-actions { display: flex; justify-content: flex-end; }
.modal-actions .btn-primary { width: auto; min-width: 140px; }
.avail { color: var(--ok); font-weight: 600; }
.busy { color: var(--warn); font-weight: 600; }

/* ---------- Booking modal ---------- */
.booking-card { width: min(960px, 100%); }
.booking-body { gap: 12px; }
.bk-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.bk-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.bk-section {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fafbfc;
    padding: 10px 12px;
}
.bk-section-title {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.04em; color: var(--muted); margin-bottom: 8px;
}
.bk-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bk-seg {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
}
.bk-seg button {
    height: 34px; border-radius: 8px; border: 1px solid var(--line);
    background: #fff; font-size: 11px; font-weight: 600; color: var(--muted);
}
.bk-seg button.selected {
    background: #eff6ff; border-color: #93c5fd; color: #1d4ed8;
}
.bk-muted { font-size: 11px; color: var(--muted); margin-top: 6px; }
.bk-badge {
    display: inline-flex; margin-left: 6px; padding: 1px 6px;
    border-radius: 4px; background: #dcfce7; color: #15803d;
    border: 1px solid #bbf7d0; font-size: 10px; font-weight: 700;
}
.bk-pc {
    display: inline-flex; margin-left: 6px; padding: 1px 6px;
    border-radius: 4px; background: #dbeafe; color: #1d4ed8;
    border: 1px solid #bfdbfe; font-family: var(--mono); font-size: 10px; font-weight: 700;
}
.bk-check {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; font-weight: 600; cursor: pointer;
}
.bk-check input { width: 15px; height: 15px; accent-color: #1d4ed8; }
.bk-sugg {
    position: absolute; left: 0; right: 0; top: calc(100% + 2px); z-index: 20;
    background: #fff; border: 1px solid var(--line); border-radius: 8px;
    box-shadow: var(--shadow); max-height: 220px; overflow: auto;
}
.bk-sugg-item {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
    width: 100%; padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line-soft);
    font-size: 12px; color: var(--ink); background: #fff;
}
.bk-sugg-item:hover { background: #f0f7fc; }
.bk-sugg-item strong { font-size: 13px; }
.bk-sugg-item span { font-size: 11px; color: var(--muted); }
.bk-route-meta {
    margin-top: 6px; font-family: var(--mono); font-size: 12px;
    color: var(--info); font-weight: 600;
}
.bk-vehicles, .bk-options { display: flex; flex-direction: column; gap: 6px; }
.bk-vehicle, .bk-opt {
    display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center;
    width: 100%; padding: 8px 10px; border-radius: 8px;
    border: 1px solid var(--line); background: #fff; text-align: left;
}
.bk-opt { grid-template-columns: 1fr; }
.bk-vehicle.selected, .bk-opt.selected {
    border-color: #93c5fd; background: #eff6ff;
}
.bk-v-name, .bk-opt strong { font-weight: 700; font-size: 13px; }
.bk-v-cap, .bk-opt span { font-size: 11px; color: var(--muted); }
.bk-v-price { font-family: var(--mono); font-weight: 700; color: var(--ok); font-size: 13px; }
.booking-body textarea {
    width: 100%; min-height: 72px; padding: 8px 10px;
    border: 1px solid var(--line); border-radius: 8px; resize: vertical;
    font: inherit; background: #fff; outline: none;
}
.booking-body textarea:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(43,108,176,0.15);
}
.booking-actions { justify-content: flex-end; gap: 8px; margin-top: 4px; }
.bk-msg {
    padding: 8px 10px; border-radius: 8px; font-size: 12px; font-weight: 600;
}
.bk-msg.ok { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.bk-msg.err { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

.sheet-rows::-webkit-scrollbar { width: 10px; height: 10px; }
.sheet-rows::-webkit-scrollbar-track { background: #f1f5f9; }
.sheet-rows::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 6px; border: 2px solid #f1f5f9; }

@media (max-width: 960px) {
    #app { grid-template-rows: 48px minmax(150px, 28vh) 1fr 52px; }
    .sheet-header, .sheet-row {
        grid-template-columns: 32px 96px 90px 88px 110px minmax(120px, 1fr) 110px 60px;
        font-size: 11px;
    }
    .search input { width: 160px; }
    .helpbar { height: auto; min-height: 34px; padding: 6px 10px; }
    .bk-grid { grid-template-columns: 1fr; }
    .bk-seg { grid-template-columns: 1fr 1fr; }
}
