:root {
  --canvas: #000; --panel: #111; --chip: #141414; --stage: #171717; --raised: #1a1a1a;
  --edge: rgba(255,255,255,.1); --edge-solid: #1a1a1a; --hair: rgba(255,255,255,.06);
  --text: #fff; --nav: #ccc; --muted: #999; --blue: #0099ff;
  --ok: #3ecf8e; --warn: #f5b84b; --danger: #ff5c6c; --violet: #a78bfa;
  --display: "DM Sans", sans-serif;
  --font: "Inter", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--canvas); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 500; }
h1 { font-family: var(--display); font-size: 30px; letter-spacing: -0.03em; line-height: 1.1; }
h2 { font-family: var(--display); font-size: 20px; letter-spacing: -0.02em; }
h3 { font-size: 14px; color: var(--muted); font-weight: 400; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }
.num { font-feature-settings: "tnum"; }

/* Buttons + inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 8px; border: 0; font: inherit; font-size: 13px; cursor: pointer; text-decoration: none; white-space: nowrap; background: rgba(255,255,255,.1); color: #fff; }
.btn:hover { background: rgba(255,255,255,.15); }
.btn-primary { background: #fff; color: #000; } .btn-primary:hover { background: #e6e6e6; }
.btn-blue { background: var(--blue); color: #fff; } .btn-blue:hover { background: #1aa3ff; }
.btn-danger { background: rgba(255,92,108,.14); color: var(--danger); } .btn-danger:hover { background: rgba(255,92,108,.22); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: default; }
input, select, textarea {
  font: inherit; font-size: 14px; color: #fff; background: rgba(255,255,255,.07); border: 1px solid transparent; border-radius: 8px;
  padding: 7px 10px; min-height: 36px; width: 100%; color-scheme: dark;
}
select option { background: #111; }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,153,255,.18); }
input[type=checkbox] { width: auto; min-height: 0; accent-color: var(--blue); }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 700px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .g2.stack-sm, .g3, .g4 { grid-template-columns: 1fr; } }

/* Shell */
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.side { border-right: 1px solid var(--edge-solid); padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px 18px; font-size: 14px; }
.brand img { display: block; height: auto; }
.login .brand { flex-direction: column; align-items: flex-start; gap: 8px; padding-bottom: 10px; }
.side a.nav { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--nav); }
.side a.nav:hover { background: rgba(255,255,255,.06); color: #fff; }
.side a.nav.on { background: rgba(255,255,255,.1); color: #fff; }
.badge { background: var(--blue); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; min-width: 20px; text-align: center; }
.badge:empty { display: none; }
.side .bottom { margin-top: auto; display: grid; gap: 4px; }
main { padding: 28px 32px 80px; min-width: 0; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.top .actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: auto; flex-direction: row; padding: 6px; border-right: 0; border-top: 1px solid var(--edge-solid); background: #000; z-index: 20; overflow-x: auto; }
  .brand, .side .bottom { display: none; }
  .side a.nav { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 8px; flex: 1; min-width: 64px; justify-content: center; }
  main { padding: 18px 14px 90px; }
  h1 { font-size: 24px; }
}

/* Panels */
.panel { background: var(--panel); border: 1px solid var(--edge); border-radius: 14px; padding: 16px; }
.panel + .panel { margin-top: 12px; }
.panel h2 { margin-bottom: 12px; }
.cols { display: grid; gap: 12px; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1000px) { .cols { grid-template-columns: 1fr; } }
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px; background: var(--edge-solid); border: 1px solid var(--edge); border-radius: 14px; overflow: hidden; margin-bottom: 12px; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 520px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { background: #000; padding: 16px; }
.kpi .v { font-family: var(--display); font-size: 30px; letter-spacing: -0.03em; line-height: 1; margin-top: 8px; font-feature-settings: "tnum"; }
.kpi .v.blue { color: var(--blue); }
.kpi .l { color: var(--muted); font-size: 12px; }
.bar { height: 8px; border-radius: 4px; background: var(--chip); overflow: hidden; margin: 6px 0 2px; }
.bar > i { display: block; height: 100%; background: var(--blue); border-radius: 4px; }
.util-row { padding: 8px 0; border-bottom: 1px solid var(--edge-solid); }
.util-row:last-child { border-bottom: 0; }

/* Lists */
.list { display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: 56px 130px minmax(120px, 1fr) minmax(130px, 1.2fr) 110px 100px; gap: 10px; align-items: center; padding: 11px 12px; border-bottom: 1px solid var(--edge-solid); text-decoration: none; }
.row:hover { background: rgba(255,255,255,.04); }
.row.head { color: var(--muted); font-size: 12px; }
.row.head:hover { background: none; }
.row .id { color: var(--muted); font-feature-settings: "tnum"; }
.row .money { text-align: right; font-feature-settings: "tnum"; }
.table { border: 1px solid var(--edge); border-radius: 14px; overflow: hidden; background: #000; }
.table .row:last-child { border-bottom: 0; }
@media (max-width: 860px) {
  .row { grid-template-columns: 1fr auto; gap: 4px 10px; }
  .row.head { display: none; }
  .row > :nth-child(1) { order: 1; } .row > :nth-child(2) { order: 2; justify-self: end; }
  .row > :nth-child(3) { order: 3; } .row > :nth-child(5) { order: 4; text-align: right; }
  .row > :nth-child(4) { order: 5; grid-column: 1 / -1; } .row > :nth-child(6) { order: 6; grid-column: 1 / -1; text-align: left; }
}
.mini { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--edge-solid); text-decoration: none; }
.mini:last-child { border-bottom: 0; }
.mini:hover .t { color: var(--blue); }
.empty { color: var(--muted); padding: 14px 0; }

/* Status pills */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; background: var(--chip); color: var(--nav); white-space: nowrap; }
.pill::before { content: none; }
.s-new { color: #4cc3ff; background: rgba(0,153,255,.14); }
.s-pending { color: var(--warn); background: rgba(245,184,75,.12); }
.s-confirmed { color: #5eead4; background: rgba(94,234,212,.1); }
.s-paid { color: var(--ok); background: rgba(62,207,142,.12); }
.s-delivered { color: var(--violet); background: rgba(167,139,250,.13); }
.s-returned { color: #ddd; background: rgba(255,255,255,.08); }
.s-completed { color: var(--muted); background: rgba(255,255,255,.05); }
.s-cancelled { color: var(--danger); background: rgba(255,92,108,.1); }
.u-active { color: var(--ok); background: rgba(62,207,142,.1); }
.u-maintenance { color: var(--warn); background: rgba(245,184,75,.12); }
.u-unavailable, .u-sold { color: var(--muted); }

/* Filters */
.filters { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.filters input { flex: 1 1 220px; }
.filters select { flex: 0 1 190px; }

/* Booking detail */
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 8px 12px; align-items: center; }
.kv > span:nth-child(odd) { color: var(--muted); font-size: 12px; }
.contact-links { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.status-steps { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.events { list-style: none; padding: 0; margin: 0; }
.events li { padding: 8px 0; border-bottom: 1px solid var(--edge-solid); display: grid; grid-template-columns: 120px 1fr; gap: 10px; }
.events li:last-child { border-bottom: 0; }
.events time { color: var(--muted); font-size: 12px; font-feature-settings: "tnum"; }
.savebar { position: sticky; bottom: 0; background: linear-gradient(180deg, rgba(0,0,0,0), #000 30%); padding: 18px 0 6px; display: flex; gap: 8px; justify-content: flex-end; z-index: 5; }
@media (max-width: 860px) { .savebar { bottom: 58px; } }
.total-line { display: flex; justify-content: space-between; align-items: baseline; padding-top: 10px; margin-top: 4px; border-top: 1px solid var(--edge-solid); }
.total-line b { font-family: var(--display); font-size: 26px; font-weight: 500; letter-spacing: -0.03em; }

/* Calendar timeline */
.cal-nav { display: flex; gap: 8px; align-items: center; }
.timeline-wrap { overflow-x: auto; border: 1px solid var(--edge); border-radius: 14px; background: #000; }
.timeline { display: grid; position: relative; min-width: max-content; }
.tl-label { position: sticky; left: 0; z-index: 2; background: #000; border-right: 1px solid var(--edge-solid); border-bottom: 1px solid var(--edge-solid); padding: 0 10px; display: flex; flex-direction: column; justify-content: center; font-size: 12px; min-height: 40px; }
.tl-label .m { color: var(--muted); font-size: 11px; }
.tl-day { border-bottom: 1px solid var(--edge-solid); border-right: 1px solid var(--hair); text-align: center; font-size: 11px; color: var(--muted); padding: 6px 0; font-feature-settings: "tnum"; }
.tl-day.we { background: rgba(255,255,255,.025); }
.tl-day.today { color: #fff; background: rgba(0,153,255,.12); }
.tl-cell { border-bottom: 1px solid var(--edge-solid); border-right: 1px solid var(--hair); min-height: 40px; }
.tl-cell.we { background: rgba(255,255,255,.025); }
.tl-group { position: sticky; left: 0; padding: 10px 10px 6px; font-size: 12px; color: var(--blue); border-bottom: 1px solid var(--edge-solid); background: #000; }
.tl-bar { z-index: 1; margin: 7px 2px; border-radius: 6px; padding: 0 8px; font-size: 11px; display: flex; align-items: center; overflow: hidden; white-space: nowrap; text-decoration: none; min-height: 26px; border: 1px solid transparent; }
.tl-bar:hover { border-color: rgba(255,255,255,.4); }
.tl-bar.block { background: repeating-linear-gradient(45deg, rgba(255,92,108,.18) 0 6px, rgba(255,92,108,.08) 6px 12px); color: var(--danger); }
.legend { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* Fleet + customers */
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--edge); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.card .head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats div { background: var(--chip); border-radius: 8px; padding: 8px; }
.stats b { display: block; font-weight: 500; font-size: 15px; font-feature-settings: "tnum"; }
.stats span { color: var(--muted); font-size: 11px; }
.crow { grid-template-columns: minmax(140px, 1.3fr) minmax(130px, 1fr) 90px 110px 100px; }
@media (max-width: 860px) { .crow > :nth-child(3) { display: none; } }

/* Dialog */
dialog { background: var(--panel); color: #fff; border: 1px solid var(--edge); border-radius: 16px; padding: 20px; width: min(560px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(0,0,0,.7); }
dialog h2 { margin-bottom: 14px; }
dialog .foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 16px; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login form { width: min(360px, 100%); display: grid; gap: 12px; }
.login .err { color: var(--danger); font-size: 13px; min-height: 18px; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #fff; color: #000; padding: 10px 16px; border-radius: 10px; font-size: 13px; z-index: 100; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.toast.err { background: var(--danger); color: #fff; }
@media (max-width: 860px) { .toast { bottom: 80px; } }
.section-gap { margin-top: 24px; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.right { margin-left: auto; }

/* traffic sources */
.src-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.src-table th { text-align: left; font-weight: 500; color: var(--muted); padding: 8px 6px; border-bottom: 1px solid var(--edge-solid); }
.src-table td { padding: 9px 6px; border-bottom: 1px solid var(--edge-solid); vertical-align: top; }
.src-table tr:last-child td { border-bottom: 0; }
.src-table .num { text-align: right; font-feature-settings: "tnum"; white-space: nowrap; }
.src-table a { color: inherit; }
.seg { display: inline-flex; gap: 4px; }
.seg .btn.on { background: var(--text); color: var(--canvas); }
.attr { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.attr b { font-weight: 500; }
