:root {
  color-scheme: light;
  --ink: #172626;
  --muted: #687878;
  --line: #dbe4e3;
  --surface: #ffffff;
  --page: #f3f6f6;
  --teal: #087e78;
  --teal-dark: #066660;
  --teal-soft: #e4f5f2;
  --green: #147a4a;
  --green-soft: #e4f4e9;
  --amber: #9a5b07;
  --amber-soft: #fff2d7;
  --red: #a63c36;
  --red-soft: #fbe9e7;
  --shadow: 0 14px 40px rgba(22, 47, 47, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); font-size: 14px; }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.topbar {
  height: 70px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand-lockup { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 8px; background: var(--teal); color: white; font-weight: 800; font-size: 13px; }
.brand-lockup strong, .brand-lockup small { display: block; }
.brand-lockup strong { font-size: 15px; line-height: 1.3; }
.brand-lockup small { color: var(--muted); font-size: 12px; margin-top: 1px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.live-state { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; margin-right: 8px; white-space: nowrap; }
.live-state i, .status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: #a3b1b0; }
.live-state.connected { color: var(--green); }
.live-state.connected i { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.live-state.disconnected { color: var(--amber); }
.live-state.disconnected i { background: var(--amber); }
.button { min-height: 36px; border: 1px solid var(--line); border-radius: 6px; padding: 0 12px; color: var(--ink); background: var(--surface); font-weight: 600; }
.button:hover { background: #f5f8f8; border-color: #bdcdcb; }
.button-primary { color: white; background: var(--teal); border-color: var(--teal); }
.button-primary:hover { color: white; background: var(--teal-dark); }
.button-quiet { min-width: 68px; }

.page-content { max-width: 1680px; margin: 0 auto; padding: 25px 32px 40px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); background: var(--surface); border-radius: 8px; margin-bottom: 25px; }
.metric { min-height: 86px; padding: 17px 20px; border-right: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; gap: 5px; }
.metric:last-child { border-right: 0; }
.metric span { color: var(--muted); font-size: 12px; font-weight: 600; }
.metric strong { font-size: 25px; line-height: 1; font-variant-numeric: tabular-nums; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr) 292px; gap: 24px; align-items: start; }
.trips-section, .fleet-section { min-width: 0; }
.section-heading { min-height: 48px; margin-bottom: 16px; display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.section-heading h1, .section-heading h2 { font-size: 22px; margin: 2px 0 0; line-height: 1.2; }
.eyebrow { color: var(--teal); font-size: 10px; line-height: 1; font-weight: 800; letter-spacing: 0; }
.updated-at { color: var(--muted); font-size: 11px; white-space: nowrap; padding-bottom: 3px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.filter-tabs { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--line); background: #eaf0ef; border-radius: 7px; }
.filter-tab { border: 0; background: transparent; color: #536463; border-radius: 5px; padding: 7px 12px; font-size: 12px; font-weight: 650; }
.filter-tab:hover { color: var(--ink); }
.filter-tab.active { color: var(--teal-dark); background: white; box-shadow: 0 1px 3px rgba(20, 50, 50, .12); }
.search-box { width: min(330px, 42%); display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--muted); }
.search-box:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(8, 126, 120, .12); }
.search-box span { font-size: 21px; line-height: 1; }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 12px; }
.search-box input::placeholder { color: #8a9998; }
.table-frame { overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.trips-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.trips-table th { padding: 11px 10px; background: #f7f9f9; color: #647372; font-size: 10px; text-align: left; text-transform: uppercase; font-weight: 750; border-bottom: 1px solid var(--line); }
.trips-table td { padding: 12px 10px; border-bottom: 1px solid #e8eeee; vertical-align: top; font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.trips-table tbody tr:last-child td { border-bottom: 0; }
.trips-table tbody tr:hover { background: #fbfdfd; }
.trips-table th:nth-child(1) { width: 13%; }
.trips-table th:nth-child(2) { width: 14%; }
.trips-table th:nth-child(3) { width: 27%; }
.trips-table th:nth-child(4) { width: 8%; }
.trips-table th:nth-child(5) { width: 11%; }
.trips-table th:nth-child(6) { width: 17%; }
.trips-table th:nth-child(7) { width: 10%; }
.folio { display: block; font-weight: 750; color: var(--ink); }
.subline { display: block; color: var(--muted); font-size: 10px; margin-top: 3px; }
.customer-phone { color: var(--ink); text-decoration: none; font-weight: 650; white-space: nowrap; }
.customer-phone:hover { color: var(--teal-dark); text-decoration: underline; }
.destination { font-weight: 650; color: var(--ink); }
.coords-link { color: var(--teal-dark); text-decoration: none; font-variant-numeric: tabular-nums; }
.coords-link:hover { text-decoration: underline; }
.unavailable { color: #7c8b8a; }
.taxi-number { display: inline-block; min-width: 38px; padding: 3px 6px; border-radius: 4px; background: var(--teal-soft); color: var(--teal-dark); font-weight: 750; text-align: center; font-variant-numeric: tabular-nums; }
.status-badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 4px; padding: 4px 6px; font-size: 10px; font-weight: 750; white-space: nowrap; }
.status-badge::before { content: ""; width: 6px; height: 6px; display: inline-block; border-radius: 50%; background: currentColor; }
.status-assigned, .status-arriving { color: var(--green); background: var(--green-soft); }
.status-new { color: var(--amber); background: var(--amber-soft); }
.status-finished { color: #657372; background: #edf1f1; }
.status-other { color: #5e5796; background: #efedfb; }
.source-label { color: #425352; font-weight: 600; }
.consent-label { display: block; color: var(--muted); font-size: 10px; margin-top: 4px; }
.table-footer { display: flex; justify-content: space-between; padding: 10px 2px; color: var(--muted); font-size: 11px; }
.empty-state { padding: 36px 16px; text-align: center; color: var(--muted); }
.load-error { padding: 11px 14px; margin: -9px 0 18px; color: #8c4510; background: var(--amber-soft); border: 1px solid #f2d8a4; border-radius: 6px; }

.fleet-section { border-left: 1px solid var(--line); padding-left: 20px; }
.fleet-heading { margin-bottom: 11px; }
.fleet-heading h2 { font-size: 20px; }
.fleet-total { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; background: var(--teal-soft); color: var(--teal-dark); font-weight: 750; font-size: 12px; }
.fleet-summary { display: flex; gap: 15px; align-items: center; padding: 10px 0 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.fleet-summary span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.fleet-summary b { color: var(--ink); font-variant-numeric: tabular-nums; }
.status-dot.available { background: var(--green); }
.status-dot.busy { background: #cf8b18; }
.status-dot.maintenance { background: #899695; }
.fleet-list { list-style: none; padding: 0; margin: 0; }
.fleet-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 49px; border-bottom: 1px solid #e7eeee; }
.fleet-id { display: flex; align-items: center; gap: 10px; }
.fleet-id .taxi-number { background: #f0f4f4; color: var(--ink); }
.fleet-state { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; text-align: right; }
.fleet-state.is-available { color: var(--green); }
.fleet-state.is-busy { color: var(--amber); }
.fleet-time { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; }

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--page); }
.login-panel { width: min(100%, 390px); padding: 30px; background: white; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.login-panel h1 { margin: 30px 0 22px; font-size: 22px; }
.login-panel label { display: block; margin: 15px 0 6px; font-size: 12px; font-weight: 700; }
.login-panel input { width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 5px; padding: 0 11px; outline: 0; }
.login-panel input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(8, 126, 120, .12); }
.login-button { width: 100%; margin-top: 22px; min-height: 42px; }
.form-error { margin: 13px 0 0; color: var(--red); font-size: 12px; }

@media (max-width: 1200px) {
  .page-content { padding-inline: 22px; }
  .topbar { padding-inline: 22px; }
  .workspace-grid { grid-template-columns: minmax(0, 1fr) 260px; gap: 18px; }
  .fleet-section { padding-left: 16px; }
  .trips-table th, .trips-table td { padding-inline: 8px; }
  .trips-table th:nth-child(6) { width: 15%; }
  .trips-table th:nth-child(7) { width: 9%; }
}
@media (max-width: 960px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .fleet-section { border-left: 0; border-top: 1px solid var(--line); padding: 20px 0 0; }
  .fleet-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; }
}
@media (max-width: 700px) {
  .topbar { height: 62px; padding-inline: 14px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-lockup small { display: none; }
  .topbar-actions { gap: 6px; }
  .live-state { margin-right: 3px; font-size: 0; gap: 0; }
  .live-state i { width: 9px; height: 9px; }
  .button { min-height: 34px; padding-inline: 9px; font-size: 11px; }
  .page-content { padding: 16px 12px 28px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 22px; }
  .metric { min-height: 72px; padding: 13px 14px; }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .metric strong { font-size: 22px; }
  .section-heading h1, .section-heading h2 { font-size: 20px; }
  .toolbar { align-items: stretch; flex-direction: column; gap: 9px; }
  .filter-tabs { align-self: flex-start; }
  .search-box { width: 100%; }
  .table-frame { overflow: visible; border: 0; background: transparent; }
  .trips-table, .trips-table tbody { display: block; width: 100%; }
  .trips-table thead { display: none; }
  .trips-table tbody { display: grid; gap: 9px; }
  .trips-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); background: white; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
  .trips-table td { min-width: 0; display: block; padding: 10px 11px; border-bottom: 1px solid #edf1f1; font-size: 12px; }
  .trips-table td::before { display: block; margin-bottom: 4px; content: attr(data-label); color: var(--muted); font-size: 9px; line-height: 1.2; text-transform: uppercase; font-weight: 750; }
  .trips-table td:nth-child(3) { grid-column: 1 / -1; }
  .trips-table td:nth-child(6) { border-bottom: 0; }
  .trips-table td:nth-child(7) { border-bottom: 0; }
  .fleet-list { grid-template-columns: 1fr; }
  .updated-at { font-size: 10px; }
}
