/* Counter Booking - theme on top of Bootstrap 5.3
 * Direction: Malaysian highway signage. Highway green, Barlow (road-sign lettering),
 * the black number plate as the one distinctive element. Everything else stays quiet.
 */

/* ---------- Fonts (self-hosted) ---------- */
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("vendor/fonts/barlow-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url("vendor/fonts/barlow-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url("vendor/fonts/barlow-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 700; font-display: swap; src: url("vendor/fonts/barlow-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 500; font-display: swap; src: url("vendor/fonts/barlow-semi-condensed-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 600; font-display: swap; src: url("vendor/fonts/barlow-semi-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 700; font-display: swap; src: url("vendor/fonts/barlow-semi-condensed-latin-700-normal.woff2") format("woff2"); }

/* ---------- Tokens ---------- */
:root {
    --ink: #17202a;          /* text, plate, nav */
    --ink-soft: #2a3642;
    --paper: #f3f5f1;        /* page background */
    --surface: #ffffff;
    --line: #dde2da;
    --muted: #5d6b66;
    --hwy: #0b6e4f;          /* highway-sign green: primary actions */
    --hwy-dark: #08583f;
    --hwy-tint: #e3f1ea;
    --amber: #e9a23b;        /* in progress / attention */
    --amber-tint: #fcf1dd;
    --brick: #b4412a;        /* overdue / no-show / destructive */
    --brick-tint: #f8e6e1;
    --radius: 10px;
    --radius-sm: 6px;
    --tabbar-h: 64px;

    --bs-body-font-family: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --bs-body-font-size: 1rem;
    --bs-body-color: var(--ink);
    --bs-body-bg: var(--paper);
    --bs-secondary-color: var(--muted);
    --bs-border-color: var(--line);
    --bs-border-radius: var(--radius-sm);
    --bs-border-radius-lg: var(--radius);
    --bs-link-color: var(--hwy);
    --bs-link-color-rgb: 11, 110, 79;
    --bs-link-hover-color: var(--hwy-dark);
    --bs-link-hover-color-rgb: 8, 88, 63;
    --bs-primary: var(--hwy);
    --bs-primary-rgb: 11, 110, 79;
    --bs-success: var(--hwy);
    --bs-success-rgb: 11, 110, 79;
    --bs-danger: var(--brick);
    --bs-danger-rgb: 180, 65, 42;
    --bs-warning: var(--amber);
    --bs-warning-rgb: 233, 162, 59;
    --bs-focus-ring-color: rgba(11, 110, 79, .3);
}

body {
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "tnum" 1; /* aligned digits for times, prices, mileage */
}

h1, h2, h3, .page-title, .display-num {
    font-family: "Barlow Semi Condensed", "Barlow", sans-serif;
    letter-spacing: .1px;
}

.page-title {
    font-size: 1.6rem;
    font-weight: 600;
    line-height: 1.15;
    margin: 0;
}

.section-title {
    font-family: "Barlow Semi Condensed", "Barlow", sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 .5rem;
}

.text-body-secondary { color: var(--muted) !important; }

:focus-visible { outline: 3px solid rgba(11, 110, 79, .45); outline-offset: 2px; }

/* ---------- Buttons ---------- */
.btn {
    --bs-btn-font-weight: 600;
    --bs-btn-border-radius: var(--radius-sm);
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
}
.btn-sm { min-height: 36px; --bs-btn-font-weight: 500; }
.btn-lg { min-height: 54px; }
.btn i { line-height: 1; }

.btn-primary, .btn-success {
    --bs-btn-bg: var(--hwy);
    --bs-btn-border-color: var(--hwy);
    --bs-btn-hover-bg: var(--hwy-dark);
    --bs-btn-hover-border-color: var(--hwy-dark);
    --bs-btn-active-bg: var(--hwy-dark);
    --bs-btn-active-border-color: var(--hwy-dark);
    --bs-btn-disabled-bg: var(--hwy);
    --bs-btn-disabled-border-color: var(--hwy);
}
.btn-outline-primary {
    --bs-btn-color: var(--hwy);
    --bs-btn-border-color: var(--hwy);
    --bs-btn-hover-bg: var(--hwy);
    --bs-btn-hover-border-color: var(--hwy);
    --bs-btn-active-bg: var(--hwy-dark);
    --bs-btn-active-border-color: var(--hwy-dark);
}
.btn-dark {
    --bs-btn-bg: var(--ink);
    --bs-btn-border-color: var(--ink);
}
.btn-outline-secondary {
    --bs-btn-color: var(--ink);
    --bs-btn-border-color: var(--line);
    --bs-btn-bg: var(--surface);
    --bs-btn-hover-bg: var(--paper);
    --bs-btn-hover-color: var(--ink);
    --bs-btn-hover-border-color: #c6cdc3;
    --bs-btn-active-bg: var(--line);
    --bs-btn-active-color: var(--ink);
}
.btn-danger {
    --bs-btn-bg: var(--brick);
    --bs-btn-border-color: var(--brick);
    --bs-btn-hover-bg: #983622;
    --bs-btn-hover-border-color: #983622;
}
.btn-outline-danger {
    --bs-btn-color: var(--brick);
    --bs-btn-border-color: var(--brick);
    --bs-btn-hover-bg: var(--brick);
    --bs-btn-hover-border-color: var(--brick);
}
.btn-whatsapp {
    --bs-btn-color: #fff;
    --bs-btn-bg: #1f9d55;
    --bs-btn-border-color: #1f9d55;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #187d44;
    --bs-btn-hover-border-color: #187d44;
}

/* Filter chips */
.chips { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
    flex: 0 0 auto;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    border-radius: 999px;
    padding: .35rem .9rem;
    font-weight: 500;
    text-decoration: none;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
}
.chip:hover { border-color: #c6cdc3; color: var(--ink); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- Forms ---------- */
.form-control, .form-select {
    min-height: 46px;
    border-color: #cfd6cc;
    background-color: var(--surface);
}
.form-control:focus, .form-select:focus {
    border-color: var(--hwy);
    box-shadow: 0 0 0 .2rem rgba(11, 110, 79, .18);
}
.form-label { font-weight: 500; margin-bottom: .3rem; }
.form-check-input:checked { background-color: var(--hwy); border-color: var(--hwy); }
.btn-check:checked + .btn-outline-primary { background: var(--hwy); border-color: var(--hwy); color: #fff; }
.optional { color: var(--muted); font-weight: 400; }

@media (max-width: 576px) {
    .form-control, .form-select { font-size: 16px; } /* stops iOS zoom */
}

/* ---------- Surfaces ---------- */
.card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: none;
    background: var(--surface);
}
.list-group { --bs-list-group-border-color: var(--line); border-radius: var(--radius); }
.list-group-item-action:hover { background: #f8faf7; }
.alert { border-radius: var(--radius); border: 0; }
.alert-success { background: var(--hwy-tint); color: var(--hwy-dark); }
.alert-warning { background: var(--amber-tint); color: #6b4708; }
.alert-danger { background: var(--brick-tint); color: #7a2a1a; }
.alert-info { background: #e6eef5; color: #1d3a55; }

/* ---------- Number plate (the signature element) ---------- */
.plate {
    display: inline-block;
    font-family: "Barlow Semi Condensed", "Barlow", sans-serif;
    font-weight: 700;
    background: var(--ink);
    color: #fff;
    border-radius: 4px;
    padding: 0 .5em;
    font-size: .88rem;
    line-height: 1.55;
    letter-spacing: .06em;
    white-space: nowrap;
    box-shadow: inset 0 0 0 1.5px #5a6670;
}
.plate-lg { font-size: 1.15rem; padding: .05em .6em; }

/* ---------- Status ---------- */
.status {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .8rem;
    font-weight: 600;
    border-radius: 999px;
    padding: .15rem .6rem;
    white-space: nowrap;
}
.status::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; }
.st-confirmed { background: #e6eef5; color: #1d4f7a; }
.st-ongoing   { background: var(--amber-tint); color: #8a5a0a; }
.st-completed { background: var(--hwy-tint); color: var(--hwy-dark); }
.st-cancelled { background: #eceeea; color: var(--muted); }
.st-no_show   { background: var(--brick-tint); color: var(--brick); }
.st-overdue   { background: var(--brick); color: #fff; }

.pay { font-size: .8rem; font-weight: 600; white-space: nowrap; }
.pay-paid { color: var(--hwy); }
.pay-unpaid { color: var(--brick); }

/* ---------- Booking rows ---------- */
.booking-row {
    display: block;
    padding: .85rem 1rem .85rem 1.1rem;
    border-left: 4px solid transparent !important;
    color: var(--ink);
    text-decoration: none;
}
.booking-row.bs-confirmed { border-left-color: #6b93b8 !important; }
.booking-row.bs-ongoing   { border-left-color: var(--amber) !important; }
.booking-row.bs-completed { border-left-color: var(--hwy) !important; }
.booking-row.bs-cancelled { border-left-color: #c9cfc6 !important; }
.booking-row.bs-no_show   { border-left-color: var(--brick) !important; }
.booking-row.is-overdue   { background: #fdf6f4; }
.booking-row .when {
    font-family: "Barlow Semi Condensed", "Barlow", sans-serif;
    font-weight: 600;
    font-size: 1.05rem;
}
.booking-row .who { font-weight: 600; }
.booking-row .ref { color: var(--muted); font-weight: 500; }

/* ---------- Detail pages ---------- */
.kv small { display: block; color: var(--muted); font-size: .82rem; }
.kv-value { font-weight: 500; }

.quote-row { display: flex; justify-content: space-between; gap: 1rem; padding: 3px 0; }
.quote-total { border-top: 1px solid var(--line); margin-top: .35rem; padding-top: .45rem; font-weight: 700; font-size: 1.1rem; }

/* Status progress on the booking page */
.steps { display: flex; gap: 4px; }
.steps .step { flex: 1; }
.steps .bar { height: 6px; border-radius: 3px; background: var(--line); }
.steps .step.done .bar { background: var(--hwy); }
.steps .step.now .bar { background: var(--amber); }
.steps .label { font-size: .8rem; color: var(--muted); margin-top: .3rem; }
.steps .step.done .label, .steps .step.now .label { color: var(--ink); font-weight: 600; }

/* Big trip times on the booking page */
.trip { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .75rem; }
.trip .t { font-family: "Barlow Semi Condensed", "Barlow", sans-serif; font-size: 1.45rem; font-weight: 600; line-height: 1.1; }
.trip .d { color: var(--muted); font-size: .9rem; }
.trip .arrow { color: var(--muted); font-size: 1.3rem; }
.trip .end { text-align: right; }

/* Dashboard numbers */
.stat { padding: .9rem 1rem; display: block; color: var(--ink); text-decoration: none; height: 100%; }
.stat .display-num { font-size: 2rem; font-weight: 700; line-height: 1; }
.stat .display-num small { font-size: 1rem; color: var(--muted); font-weight: 500; }
.stat .lbl { color: var(--muted); font-size: .9rem; margin-top: .25rem; }
.stat.alert-stat .display-num { color: var(--brick); }

/* Empty states */
.empty { text-align: center; padding: 1.75rem 1rem; color: var(--muted); }
.empty i { font-size: 1.8rem; display: block; margin-bottom: .35rem; color: #a9b3ad; }
.empty .btn { margin-top: .75rem; }

/* Cars */
.car-photo { height: 160px; object-fit: cover; border-top-left-radius: var(--radius); border-top-right-radius: var(--radius); }
.car-photo-empty { background: #e9ece6; color: #9aa59e; }
.car-thumb { width: 64px; height: 44px; object-fit: cover; border-radius: var(--radius-sm); flex: 0 0 auto; }
.car-thumb-empty { background: #e9ece6; color: #9aa59e; display: flex; align-items: center; justify-content: center; }

/* Customer search */
.search-results { max-height: 300px; overflow-y: auto; }

/* Rating */
.rating-input input { position: absolute; opacity: 0; pointer-events: none; }
.rating-input label { font-size: 2rem; color: #cfd6cc; cursor: pointer; padding: 0 3px; }
.rating-input label.on { color: var(--amber); }
.rating-input input:focus-visible + label { outline: 3px solid rgba(11, 110, 79, .45); border-radius: 4px; }

.min-w-0 { min-width: 0; }

/* ---------- App shell ---------- */
.app-container { max-width: 960px; }

.topbar {
    background: var(--ink);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 1030;
    padding-top: env(safe-area-inset-top);
}
.topbar .inner { height: 56px; display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.brand {
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: .5rem;
    font-family: "Barlow Semi Condensed", "Barlow", sans-serif;
    font-weight: 600;
    font-size: 1.2rem;
    min-width: 0;
}
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-mark {
    width: 30px; height: 30px; flex: 0 0 auto;
    border-radius: 6px;
    background: var(--hwy);
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .85);
}
.brand-mark i { font-size: 1rem; }
.topbar .btn { min-height: 38px; }

/* Bottom tab bar (phones/tablets) */
.tabbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 1030;
    background: var(--surface);
    border-top: 1px solid var(--line);
    display: flex;
    padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a, .tabbar button {
    flex: 1;
    height: var(--tabbar-h);
    border: 0;
    background: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: .74rem;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
}
.tabbar i { font-size: 1.3rem; }
.tabbar .active { color: var(--hwy); }
.tabbar .active i { transform: translateY(-1px); }
body.has-tabbar main { padding-bottom: calc(var(--tabbar-h) + 1.5rem + env(safe-area-inset-bottom)) !important; }

/* Sidebar (desktop) */
.sidebar {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: 240px;
    background: var(--ink);
    color: #fff;
    flex-direction: column;
    padding: 1rem .75rem;
    z-index: 1030;
}
.sidebar .brand { padding: .25rem .5rem 1rem; }
.nav-link-app {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .6rem .75rem;
    border-radius: var(--radius-sm);
    color: #c9d1d8;
    text-decoration: none;
    font-weight: 500;
}
.nav-link-app:hover { background: var(--ink-soft); color: #fff; }
.nav-link-app.active { background: var(--hwy); color: #fff; }
.nav-link-app i { font-size: 1.1rem; width: 1.2rem; text-align: center; }
.nav-sep { height: 1px; background: #2f3b47; margin: .6rem .5rem; }
.sidebar .who { padding: .5rem .75rem; font-size: .9rem; color: #c9d1d8; }
.sidebar .who strong { color: #fff; display: block; }

@media (min-width: 992px) {
    body.has-sidebar .page-wrap { margin-left: 240px; }
    body.has-sidebar main { padding-top: 1.75rem !important; }
}

/* Offcanvas "More" menu */
.offcanvas .nav-link-app { color: var(--ink); padding: .8rem .75rem; }
.offcanvas .nav-link-app:hover { background: var(--paper); color: var(--ink); }
.offcanvas .nav-link-app.active { background: var(--hwy-tint); color: var(--hwy-dark); }

/* Sticky action bar (booking form) */
.action-bar {
    position: sticky;
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    z-index: 1020;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: .65rem .75rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    box-shadow: 0 -6px 18px rgba(23, 32, 42, .08);
}
.action-bar .total { font-family: "Barlow Semi Condensed", "Barlow", sans-serif; font-weight: 700; font-size: 1.35rem; line-height: 1; }
.action-bar .total-lbl { font-size: .8rem; color: var(--muted); }
.action-bar .btn { flex: 1; }
@media (min-width: 992px) {
    .action-bar { bottom: 1rem; }
}

/* Login */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; background: var(--ink); }
.auth-card { width: 100%; max-width: 380px; }
.auth-card .brand { color: var(--ink); justify-content: center; font-size: 1.5rem; }

/* Flash fade-out */
.alert.fade-out { transition: opacity .4s ease; opacity: 0; }

/* Busy button */
.btn.is-busy { pointer-events: none; opacity: .75; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

.chips.chips-wrap { flex-wrap: wrap; overflow: visible; }
.sidebar .who span { display: block; }

/* ---------- Menu fixes (v1.2) ---------- */
/* Sidebar scrolls on short screens instead of cutting off the bottom links. */
.sidebar { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #3a4652 transparent; }
.sidebar .brand { flex: 0 0 auto; }
.sidebar > .btn { flex: 0 0 auto; }
.nav-group { font-size: .78rem; font-weight: 600; color: #8b97a2; padding: .9rem .75rem .25rem; }
.offcanvas .nav-group { color: var(--muted); padding-top: .75rem; }
.offcanvas .nav-sep { background: var(--line); margin: .5rem 0; }
@media (max-height: 760px) {
    .sidebar { padding-top: .75rem; padding-bottom: .75rem; }
    .sidebar .brand { padding-bottom: .6rem; }
    .sidebar .nav-link-app { padding-top: .45rem; padding-bottom: .45rem; }
    .sidebar .nav-group { padding-top: .6rem; }
}
/* Phone "More" sheet: fits its content, never taller than most of the screen, scrolls inside. */
.more-sheet.offcanvas-bottom { height: auto; max-height: 85vh; max-height: 85dvh; }
.more-sheet .offcanvas-body { overflow-y: auto; padding-bottom: calc(1.5rem + env(safe-area-inset-bottom)) !important; }
.more-sheet .nav-link-app { padding-top: .6rem; padding-bottom: .6rem; }
.more-sheet .offcanvas-header { padding-bottom: .25rem !important; }

/* ---------- Distance (v1.3) ---------- */
.dist-bar { height: 8px; border-radius: 4px; background: #e9ece6; overflow: hidden; margin: .25rem 0 .9rem; }
.dist-bar > div { height: 100%; border-radius: 4px; background: var(--hwy); }
.dist-bar.over > div { background: var(--brick); }
.dist-line { font-size: .82rem; color: var(--muted); }
.dist-line .over { color: var(--brick); font-weight: 600; }

/* ---------- Terms of use (v1.3) ---------- */
.terms-wrap { max-width: 760px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
body.has-sidebar .terms-wrap { padding-top: 0; }
.terms-head { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.25rem; }
.terms-head .brand-mark { width: 40px; height: 40px; }
.terms-head .brand-mark i { color: #fff; font-size: 1.25rem; }
.terms h2 { font-family: "Barlow Semi Condensed", "Barlow", sans-serif; font-size: 1.25rem; font-weight: 600; margin: 1.75rem 0 .5rem; scroll-margin-top: 80px; }
.terms p, .terms li { line-height: 1.6; max-width: 68ch; }
.terms ul { padding-left: 1.25rem; }
.terms li + li { margin-top: .3rem; }
.terms .price-table { max-width: 520px; }
.terms .price-table td, .terms .price-table th { padding: .45rem .75rem; }
.terms-summary { background: var(--hwy-tint); border-radius: var(--radius); padding: 1rem 1.25rem; }
.terms-summary ul { margin: 0; }
.terms-toc { columns: 2; column-gap: 1.5rem; padding-left: 1.25rem; font-size: .95rem; }
.terms-toc li { break-inside: avoid; }
@media (max-width: 576px) { .terms-toc { columns: 1; } }
@media print {
    .terms-wrap { padding: 0; }
    .no-print, .sidebar, .topbar, .tabbar { display: none !important; }
    body.has-sidebar .page-wrap { margin-left: 0 !important; }
}
/* Terms editor */
.sec-card .sec-tools .btn { min-height: 36px; }
.sec-card textarea { font-family: inherit; min-height: 140px; }

/* ---------- Availability: right now + timeline (v1.4) ---------- */
.now-row { display: flex; gap: .75rem; align-items: flex-start; padding: .7rem 1rem; }
.now-dot { width: .7rem; height: .7rem; border-radius: 50%; margin-top: .45rem; flex: 0 0 auto; background: var(--muted); }
.now-head { font-weight: 600; line-height: 1.3; margin-top: .1rem; }
.tone-free .now-dot, .tone-short .now-dot { background: var(--hwy); }
.tone-free .now-head, .tone-short .now-head { color: var(--hwy-dark); }
.tone-out .now-dot, .tone-wait .now-dot { background: var(--amber); }
.tone-out .now-head, .tone-wait .now-head { color: #8a5a0a; }
.tone-late .now-dot { background: var(--brick); }
.tone-late .now-head { color: var(--brick); }
.tone-maint .now-dot { background: #9aa59e; }

.tl-scroll {
    --tl-label: 92px;
    --tl-row: 46px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overscroll-behavior-x: contain;
}
.tl { width: max-content; min-width: 100%; }
.tl-v-day  .tl-track { width: 960px; }    /* 40px per hour */
.tl-v-3d   .tl-track { width: 1008px; }   /* 14px per hour */
.tl-v-week .tl-track { width: 1008px; }   /*  6px per hour */
.tl-row { display: flex; height: var(--tl-row); border-bottom: 1px solid var(--line); }
.tl-body .tl-row:last-of-type { border-bottom: 0; }
.tl-label {
    position: sticky; left: 0; z-index: 5;
    width: var(--tl-label); flex: 0 0 var(--tl-label);
    background: var(--surface);
    border-right: 1px solid var(--line);
    padding: .3rem .6rem;
    display: flex; flex-direction: column; justify-content: center;
    line-height: 1.15; font-size: .9rem;
}
.tl-plate { font-size: .72rem; color: var(--muted); font-weight: 600; letter-spacing: .04em; white-space: nowrap; }
.tl-track { position: relative; flex: 0 0 auto; }

/* Header: day names on top, hour ticks underneath */
.tl-head { height: 44px; background: #f8faf7; }
.tl-head .tl-label { background: #f8faf7; }
.tl-day { position: absolute; top: 0; height: 22px; border-left: 1px solid #c6cdc3; }
.tl-day span { display: inline-block; position: sticky; left: calc(var(--tl-label) + 6px); padding: 0 6px; font-size: .78rem; font-weight: 600; white-space: nowrap; line-height: 22px; }
.tl-tick { position: absolute; bottom: 3px; transform: translateX(3px); font-size: .7rem; color: var(--muted); white-space: nowrap; }

.tl-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: #edf0ea; }
.tl-grid.major { background: #c6cdc3; }

.tl-block, .tl-gap {
    position: absolute; top: 6px; bottom: 6px;
    border-radius: 5px;
    display: flex; align-items: center;
    overflow: hidden; overflow: clip; /* clip keeps the sticky label working */
    white-space: nowrap;
    text-decoration: none;
    font-size: .76rem; font-weight: 600;
}
/* Labels stay readable when the start of a long block is scrolled out of view. */
.tl-block span, .tl-gap span { position: sticky; left: calc(var(--tl-label) + 2px); padding: 0 6px; overflow: hidden; text-overflow: ellipsis; }
.tl-block { z-index: 2; border-left: 3px solid; }
.tl-block.booked { background: #dbe7f2; color: #1d4f7a; border-color: #1d4f7a; }
.tl-block.out    { background: #f9e3bb; color: #6b4708; border-color: var(--amber); }
.tl-block.late   { background: var(--brick); color: #fff; border-color: #7a2a1a;
                   background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.16) 0 6px, transparent 6px 12px); }
.tl-block.done   { background: #eceeea; color: var(--muted); border-color: #c6cdc3; font-weight: 500; }
.tl-block.waiting { outline: 2px dashed var(--amber); outline-offset: -2px; }
.tl-block.at-risk { box-shadow: 0 0 0 2px var(--brick); }
.tl-block:hover { filter: brightness(.96); }
.tl-block:focus-visible, .tl-gap:focus-visible { outline: 3px solid var(--bs-focus-ring-color); outline-offset: 1px; }

.tl-gap { z-index: 1; color: var(--hwy-dark); font-weight: 500; }
.tl-gap span { opacity: .75; }
.tl-gap:hover, .tl-gap:active { background: var(--hwy-tint); box-shadow: inset 0 0 0 1px rgba(11,110,79,.35); }
.tl-gap:hover span { opacity: 1; }

.tl-track.is-maint {
    background-image: repeating-linear-gradient(135deg, #eceeea 0 8px, #f6f7f4 8px 16px);
}
.tl-maint-label { position: sticky; left: calc(var(--tl-label) + 8px); top: 0; display: inline-flex; align-items: center; gap: .3rem; height: 100%; padding: 0 8px; font-size: .78rem; color: var(--muted); font-weight: 600; z-index: 1; }

.tl-body { position: relative; }
.tl-overlay { position: absolute; top: 0; bottom: 0; left: var(--tl-label); right: 0; pointer-events: none; z-index: 3; }
.tl-past { position: absolute; top: 0; bottom: 0; left: 0; background: rgba(23, 32, 42, .045); }
.tl-band { position: absolute; top: 0; bottom: 0; background: rgba(11, 110, 79, .08); border-left: 2px solid var(--hwy); border-right: 2px solid var(--hwy); }
.tl-now { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--brick); }
.tl-now span { position: absolute; top: 2px; left: 4px; font-size: .65rem; font-weight: 700; color: var(--brick); background: rgba(255,255,255,.85); border-radius: 3px; padding: 0 3px; }

.tl-legend { display: flex; flex-wrap: wrap; gap: .35rem 1rem; font-size: .8rem; color: var(--muted); }
.tl-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.tl-legend .lg { width: 14px; height: 10px; border-radius: 3px; display: inline-block; border-left: 3px solid; }
.tl-legend .lg.booked { background: #dbe7f2; border-color: #1d4f7a; }
.tl-legend .lg.out { background: #f9e3bb; border-color: var(--amber); }
.tl-legend .lg.late { background: var(--brick); border-color: #7a2a1a; }
.tl-legend .lg.done { background: #eceeea; border-color: #c6cdc3; }
.tl-legend .lg.free { background: var(--hwy-tint); border: 1px solid rgba(11,110,79,.35); }
.tl-legend .lg.band { background: rgba(11,110,79,.08); border: 2px solid var(--hwy); border-top: 0; border-bottom: 0; }
.tl-day.is-today span { color: var(--hwy-dark); }
.tl-date { width: auto; max-width: 160px; }
.now-details > summary { list-style: none; cursor: pointer; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem 2.4rem .7rem 1rem; position: relative; }
.now-details > summary::-webkit-details-marker { display: none; }
.now-details > summary::after { content: "\F282"; font-family: "bootstrap-icons"; position: absolute; right: 1rem; top: .8rem; color: var(--muted); transition: transform .15s; }
.now-details[open] > summary::after { transform: rotate(180deg); }
.now-details > summary:focus-visible { outline: 3px solid var(--bs-focus-ring-color); }
.now-counts { display: flex; flex-wrap: wrap; gap: .3rem .9rem; margin-top: .3rem; font-size: .85rem; font-weight: 600; }
.now-counts .nc::before { content: ""; display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; margin-right: .35rem; background: #9aa59e; }
.now-counts .nc-free { color: var(--hwy-dark); } .now-counts .nc-free::before { background: var(--hwy); }
.now-counts .nc-out, .now-counts .nc-waiting { color: #8a5a0a; } .now-counts .nc-out::before, .now-counts .nc-waiting::before { background: var(--amber); }
.now-counts .nc-overdue { color: var(--brick); } .now-counts .nc-overdue::before { background: var(--brick); }
.now-counts .nc-in-maintenance { color: var(--muted); }

/* ---------- Customers (v1.5) ---------- */
.chip .chip-n { margin-left: .4rem; font-size: .78rem; font-weight: 600; color: var(--muted); }
.chip.active .chip-n { color: rgba(255,255,255,.75); }
.chip.chip-warn:not(.active) .chip-n { color: var(--brick); }
.cust-meta { font-size: .85rem; color: var(--muted); margin-top: .2rem; }
.st-flag { background: #fff; color: var(--brick); box-shadow: inset 0 0 0 1px var(--brick); white-space: normal; }
.st-flag::before { display: none; }
.cust-notes { background: #fffbea; border-color: #f0e2b0; }

/* ---------- Issue tags (v1.6) ---------- */
.tag-input .chip { gap: .35rem; cursor: pointer; user-select: none; }
.tag-input .chip i { color: var(--muted); }
.tag-input .btn-check:checked + .chip.tag-bad { background: var(--brick); border-color: var(--brick); color: #fff; }
.tag-input .btn-check:checked + .chip.tag-good { background: var(--hwy); border-color: var(--hwy); color: #fff; }
.tag-input .btn-check:checked + .chip i { color: inherit; }
.tag-input .btn-check:focus-visible + .chip { outline: 3px solid var(--bs-focus-ring-color); outline-offset: 1px; }
.tag-badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; font-weight: 600; border-radius: 999px; padding: .15rem .6rem; white-space: nowrap; }
.tag-badge.tag-bad { background: var(--brick-tint); color: var(--brick); }
.tag-badge.tag-good { background: var(--hwy-tint); color: var(--hwy-dark); }
.tag-badge .n { font-weight: 700; }

/* Chips in two rows (v1.6.1) */
.tag-row + .tag-row { margin-top: .5rem; }
.tag-row-title { font-size: .78rem; color: var(--muted); margin-bottom: .25rem; }
.tag-input .chip .tag-w { font-size: .72rem; font-weight: 600; margin-left: .15rem; opacity: .7; }

/* ---------- Customer page (v1.6.2) ---------- */
.cust-head { border-top: 4px solid var(--line); }
.cust-head .avatar { width: 52px; height: 52px; border-radius: 50%; flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
    font-family: "Barlow Semi Condensed", "Barlow", sans-serif; font-weight: 700; font-size: 1.25rem; background: #e9ece6; color: var(--ink); }
.cust-head .verdict { display: flex; gap: .7rem; align-items: center; padding: .65rem .85rem; border-radius: var(--radius-sm); background: #f1f3ef; }
.cust-head .verdict > i { font-size: 1.35rem; }
.cust-head.v-risk  { border-top-color: var(--brick); }
.cust-head.v-risk .verdict { background: var(--brick-tint); color: #7a2a1a; }
.cust-head.v-risk .avatar { background: var(--brick-tint); color: var(--brick); }
.cust-head.v-great { border-top-color: var(--hwy); }
.cust-head.v-great .verdict { background: var(--hwy-tint); color: var(--hwy-dark); }
.cust-head.v-great .avatar { background: var(--hwy-tint); color: var(--hwy-dark); }
.cust-head.v-good .verdict { background: #eef3f8; color: #1d4f7a; }
.cust-head .big-rating { font-family: "Barlow Semi Condensed", "Barlow", sans-serif; font-size: 2.2rem; font-weight: 700; line-height: 1; min-width: 2.2ch; }
.attn .list-group-item { display: flex; gap: .65rem; align-items: center; padding: .7rem 1rem; }
.attn .list-group-item > i:first-child { font-size: 1.15rem; flex: 0 0 auto; }
.attn-bad  { border-left: 4px solid var(--brick) !important; } .attn-bad > i:first-child { color: var(--brick); }
.attn-warn { border-left: 4px solid var(--amber) !important; } .attn-warn > i:first-child { color: #8a5a0a; }
.attn-info { border-left: 4px solid #1d4f7a !important; } .attn-info > i:first-child { color: #1d4f7a; }
.tile { padding: .8rem 1rem; height: 100%; }
.tile .v { font-family: "Barlow Semi Condensed", "Barlow", sans-serif; font-size: 1.45rem; font-weight: 700; line-height: 1.1; }
.tile .l { font-size: .85rem; color: var(--muted); }
.tile .s { font-size: .78rem; color: var(--muted); margin-top: .15rem; }
.admin-box { background: #f8faf7; border-style: dashed; }
.track-title { font-weight: 600; margin-bottom: .4rem; }
.track-title.good { color: var(--hwy-dark); }
.track-title.bad { color: var(--brick); }
.track { list-style: none; padding: 0; margin: 0; }
.track li { display: flex; align-items: center; gap: .55rem; padding: .35rem 0; border-bottom: 1px dashed var(--line); }
.track li:last-child { border-bottom: 0; }
.track li i { color: var(--muted); width: 1.1rem; text-align: center; }
.track li span { flex: 1; }
.feedback .fst-italic { color: var(--ink-soft); }

/* ---------- v1.7: public booking, menu badge, automation ---------- */
.nav-badge { margin-left: auto; background: var(--brick); color: #fff; border-radius: 999px; font-size: .72rem; font-weight: 700; padding: .05rem .5rem; line-height: 1.5; }
.pub-wrap { max-width: 640px; margin: 0 auto; padding: 1rem 1rem 3rem; }
.pub-brand { display: flex; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.pub-brand .brand-mark { width: 40px; height: 40px; }
.pub-brand .brand-mark i { color: #fff; font-size: 1.2rem; }
.pub-qr { width: 180px; height: 180px; object-fit: contain; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.review-box { border-left: 4px solid var(--amber) !important; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .4rem; }
.photo-grid a { display: block; aspect-ratio: 4 / 3; border-radius: var(--radius-sm); overflow: hidden; background: #e9ece6; }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; }
.charge-row { display: flex; gap: .75rem; align-items: flex-start; padding: .6rem 0; border-bottom: 1px dashed var(--line); }
.charge-row:last-child { border-bottom: 0; }
.charge-row .amt { font-weight: 600; white-space: nowrap; }
.charge-row.waived .amt { text-decoration: line-through; color: var(--muted); }
.doc-thumb { display: block; width: 100%; max-height: 220px; object-fit: contain; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #f8faf7; }
@media print {
    .agreement { font-size: 11pt; }
    .agreement .card { border: 0; }
}

/* v1.8 customer accounts */
.link-box { word-break: break-all; }

/* v1.8 customer pages: header, account tabs, booking flow, forms */
.pub-home { display: flex; align-items: center; gap: .75rem; color: inherit; text-decoration: none; min-height: 44px; }
.pub-home:hover { color: inherit; }
.pub-brand .btn { min-height: 36px; }
.pub-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: .25rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .25rem; margin: -.25rem 0 1rem; }
.pub-tab-form { display: contents; }
.pub-tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem; min-height: 52px; padding: .35rem .25rem; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); font-size: .8rem; font-weight: 600; text-decoration: none; }
.pub-tab i { font-size: 1.15rem; }
.pub-tab:hover { color: var(--ink); background: var(--paper); }
.pub-tab.active { color: var(--hwy); background: var(--hwy-tint); }
@media (max-width: 991.98px) {
    /* On phones the account tabs sit at the bottom, within thumb reach. */
    .pub-tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; margin: 0; border-radius: 0; border-width: 1px 0 0; padding: .25rem .25rem calc(.25rem + env(safe-area-inset-bottom)); box-shadow: 0 -4px 16px rgba(23, 32, 42, .06); }
    .pub-wrap:has(.pub-tabs) { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
    .pub-wrap:has(.pub-tabs) ~ .pub-footer { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
}
.trip-summary .btn-link { font-weight: 600; }
.pay-options { display: grid; gap: .5rem; }
.pay-option { display: flex; gap: .75rem; align-items: flex-start; padding: .75rem .9rem; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface); }
.pay-option .form-check-input { margin-top: .2rem; flex: 0 0 auto; }
.pay-option span { display: flex; flex-direction: column; }
.pay-option small { color: var(--muted); }
.pay-option:has(input:checked) { border-color: var(--hwy); background: var(--hwy-tint); }
.pay-option:has(input:focus-visible) { outline: 2px solid var(--hwy); outline-offset: 2px; }
.file-preview { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.file-preview-item { display: flex; align-items: center; gap: .5rem; max-width: 100%; padding: .25rem .5rem .25rem .25rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.file-preview-item img { width: 44px; height: 44px; object-fit: cover; border-radius: 4px; }
.file-preview-item i { font-size: 1.6rem; color: var(--brick); padding: 0 .4rem; }
.file-preview-item small { color: var(--muted); overflow-wrap: anywhere; }
.pw-toggle { min-width: 44px; }
.next-card { border-left: 4px solid var(--hwy); transition: box-shadow .15s ease; }
.next-card:hover { box-shadow: 0 4px 16px rgba(23, 32, 42, .08); }
.next-card.is-late { border-left-color: var(--brick); }
.next-when { font-family: "Barlow Semi Condensed", var(--bs-body-font-family); font-size: 1.6rem; font-weight: 700; line-height: 1.15; margin-top: .25rem; }
.next-card.is-late .next-when { color: var(--brick); }
.pub-footer { max-width: 640px; margin: 0 auto; padding: 1rem 1rem 2rem; text-align: center; font-size: .85rem; color: var(--muted); }
.pub-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem 1rem; margin-bottom: .35rem; }
.pub-footer a { color: var(--muted); }
.form-control.is-invalid, .form-select.is-invalid { background-image: none; padding-right: .75rem; }
@media (prefers-reduced-motion: reduce) { .next-card { transition: none; } }
.btn-link .optional { text-decoration: none; }
