/* Shared design system for passenger, driver and admin apps. Brand color is injected as --brand from /api/config. */
:root {
  --brand: #0f9d8a;
  --brand-ink: #ffffff;
  --brand-soft: color-mix(in srgb, var(--brand) 14%, transparent);
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --ink: #111827;
  --ink-2: #4b5563;
  --ink-3: #8a94a3;
  --line: #e3e7ec;
  --danger: #d92d20;
  --warn: #f59e0b;
  --ok: #12a150;
  --radius: 16px;
  --shadow: 0 8px 28px rgba(15, 23, 42, 0.14);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116; --surface: #171b22; --surface-2: #20252e; --ink: #f1f4f8; --ink-2: #b4bcc8;
    --ink-3: #7c8696; --line: #2a303a; --shadow: 0 8px 28px rgba(0, 0, 0, 0.5); color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 16px; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
a { color: var(--brand); }
[hidden] { display: none !important; }

/* ---- controls */
.btn {
  appearance: none; border: 0; border-radius: 14px; padding: 14px 18px; font-weight: 650; cursor: pointer;
  background: var(--surface-2); color: var(--ink); min-height: 48px; display: inline-flex; align-items: center;
  justify-content: center; gap: 8px; transition: transform .06s ease, opacity .15s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.danger { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.btn.solid-danger { background: var(--danger); color: #fff; }
.btn.block { width: 100%; }
.btn.small { padding: 8px 12px; min-height: 36px; border-radius: 10px; font-size: 14px; }
.btn.ghost { background: transparent; }
.input, select.input, textarea.input {
  width: 100%; padding: 13px 14px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--surface); outline: none; min-height: 48px;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 5px; font-weight: 600; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 13px; }
.bold { font-weight: 700; }
.center { text-align: center; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface-2);
  font-size: 14px; font-weight: 600; cursor: pointer; border: 1.5px solid transparent;
}
.chip.active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--ink-2); }
.badge.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.badge.warn { background: color-mix(in srgb, var(--warn) 20%, transparent); color: #b45309; }
.badge.bad { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.card { background: var(--surface); border-radius: var(--radius); padding: 14px; border: 1px solid var(--line); }
.hr { height: 1px; background: var(--line); margin: 12px 0; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 800; flex: none; }

/* ---- toast & modal */
#toast-root { position: fixed; left: 0; right: 0; top: 12px; z-index: 3000; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { background: #111827; color: #fff; padding: 11px 16px; border-radius: 12px; max-width: min(92vw, 420px); box-shadow: var(--shadow); font-size: 15px; animation: pop .2s ease; }
.toast.bad { background: var(--danger); }
.toast.ok { background: var(--ok); }
@keyframes pop { from { transform: translateY(-8px); opacity: 0; } }
.modal-back { position: fixed; inset: 0; background: rgba(8, 12, 20, 0.5); z-index: 2000; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); width: min(100%, 520px); max-height: 90vh; overflow: auto; border-radius: 22px 22px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); animation: rise .2s ease; }
@keyframes rise { from { transform: translateY(30px); opacity: .6; } }
@media (min-width: 700px) { .modal-back { align-items: center; } .modal { border-radius: 22px; } }
.modal h3 { font-size: 20px; margin-bottom: 12px; }
.modal .actions { display: flex; gap: 10px; margin-top: 16px; }
.modal .actions .btn { flex: 1; }

/* ---- stars */
.stars { display: inline-flex; gap: 4px; }
.stars button { background: none; border: 0; font-size: 34px; padding: 0 2px; cursor: pointer; color: var(--line); line-height: 1; }
.stars button.on { color: #f5b301; }
.star-text { color: #f5b301; font-weight: 700; }

/* ---- map pins */
.leaflet-container { font-family: var(--font); background: var(--surface-2); }
.pin { background: none; border: 0; }
.pin span { display: block; width: 26px; height: 26px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--brand); border: 3px solid #fff; box-shadow: 0 3px 8px rgba(0,0,0,.35); margin: 0 auto; }
.pin.dest span { background: #111827; }
.pin.stop span { background: #8b5cf6; }
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: #2563eb; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(37, 99, 235, .22); }
.car { transition: transform .4s linear; }
.car svg { display: block; filter: drop-shadow(0 2px 3px rgba(0,0,0,.4)); }
.zone-label { background: rgba(0,0,0,.65); color: #fff; border: 0; border-radius: 8px; padding: 2px 7px; font-weight: 700; }

/* ---- generic page chrome for admin-like layouts */
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--surface-2); }

.safe-bottom { padding-bottom: env(safe-area-inset-bottom); }
