/* Where Is My Ride design system */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@500;600;700&family=Inter:wght@400;500;600&display=swap');

:root {
  --bg: #0B0D10; --panel: #13161B; --panel-2: #1A1E25; --panel-3: #222731; --line: #262B33; --line-2: #313743;
  --text: #F2F3F5; --muted: #8B93A1; --dim: #5C6470;
  --accent: #E2B563; --accent-2: #F0CC85; --accent-ink: #1A1406;
  --good: #4AD48B; --warn: #F2B84B; --bad: #F26D6D; --info: #6FA8FF;
  --radius: 14px; --radius-sm: 10px;
  --font-display: 'Sora', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --shadow: 0 14px 40px rgba(0,0,0,.45);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 700; } h2 { font-size: 18px; font-weight: 600; } h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
.small { font-size: 12.5px; color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.brand { font-family: var(--font-display); font-weight: 700; letter-spacing: .22em; font-size: 12px; color: var(--muted); text-transform: uppercase; }
.brand b { color: var(--accent); }

label { display: block; font-size: 11.5px; color: var(--muted); margin: 12px 0 5px; text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
input, select, textarea {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: var(--radius-sm); padding: 11px 12px; font: inherit; outline: none; transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--dim); }
input[type="checkbox"] { width: auto; accent-color: var(--accent); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
textarea { min-height: 80px; resize: vertical; }
.check { display: flex; align-items: center; gap: 9px; margin-top: 12px; font-size: 14px; color: var(--text); text-transform: none; letter-spacing: 0; font-weight: 500; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 12px; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); padding: 9px 14px; font: inherit; font-weight: 600; font-size: 13.5px;
  cursor: pointer; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap;
}
.btn:hover { background: var(--panel-3); border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--panel-2); }
.btn.danger { color: var(--bad); border-color: rgba(242,109,109,.35); }
.btn.danger:hover { background: rgba(242,109,109,.1); }
.btn.good { color: var(--good); border-color: rgba(74,212,139,.35); }
.btn.big { width: 100%; padding: 15px 18px; font-size: 16px; border-radius: 13px; }
.btn.sm { padding: 6px 10px; font-size: 12.5px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* status pills */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--line-2); color: var(--muted); background: var(--panel-2); white-space: nowrap; }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.s-scheduled { color: var(--muted); }
.pill.s-assigned { color: var(--info); border-color: rgba(111,168,255,.35); }
.pill.s-confirmed { color: var(--info); border-color: rgba(111,168,255,.35); }
.pill.s-enroute { color: var(--accent); border-color: rgba(226,181,99,.4); }
.pill.s-arrived { color: var(--accent-2); border-color: rgba(226,181,99,.4); }
.pill.s-onboard { color: var(--good); border-color: rgba(74,212,139,.35); }
.pill.s-completed { color: var(--good); border-color: rgba(74,212,139,.35); opacity: .8; }
.pill.s-cancelled, .pill.s-declined { color: var(--bad); border-color: rgba(242,109,109,.35); }
.pill.delayed { color: var(--bad); border-color: var(--bad); }
.pill.live { color: var(--good); border-color: rgba(74,212,139,.35); }
.pill.live::before { box-shadow: 0 0 8px rgba(74,212,139,.8); }
.pill.off { color: var(--muted); }
.pill.warn { color: var(--warn); border-color: rgba(242,184,75,.4); }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; font-weight: 600; padding: 10px 10px; border-bottom: 1px solid var(--line); }
th[data-k] { cursor: pointer; user-select: none; } th[data-k]:hover { color: var(--text); }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255,255,255,.015); }
.table-wrap { overflow-x: auto; }
td select, td input { padding: 7px 10px; font-size: 13px; }

/* toasts */
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, 92vw); }
.toast { background: var(--panel-2); border: 1px solid var(--line-2); border-left: 3px solid var(--accent); color: var(--text); padding: 11px 14px; border-radius: 10px; font-size: 13.5px; box-shadow: var(--shadow); animation: toast-in .2s ease; }
.toast.warn { border-left-color: var(--warn); } .toast.bad { border-left-color: var(--bad); } .toast.good { border-left-color: var(--good); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* modals */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center; z-index: 1000; padding: 16px; }
.modal-back.on { display: flex; }
.modal { background: var(--panel); border: 1px solid var(--line-2); border-radius: 18px; width: 560px; max-width: 100%; max-height: 92vh; overflow: auto; padding: 22px 24px; box-shadow: var(--shadow); }
.modal h2 { margin-bottom: 4px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* map markers */
.leaflet-container { background: #0B0D10; font: inherit; }
.leaflet-tile-pane .dark-tiles { filter: invert(1) hue-rotate(180deg) brightness(.72) contrast(.92) saturate(.35); }
.leaflet-popup-content-wrapper { background: var(--panel-2); color: var(--text); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow); font-size: 13px; }
.leaflet-popup-tip { background: var(--panel-2); }
.leaflet-control-attribution { background: rgba(11,13,16,.7) !important; color: var(--dim) !important; font-size: 10px; }
.leaflet-control-attribution a { color: var(--muted); }
.leaflet-bar a { background: var(--panel-2); color: var(--text); border-bottom-color: var(--line); }
.veh-marker { position: relative; }
.veh-marker .dot { position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--accent); border: 2px solid #1A1406; box-shadow: 0 0 0 2px rgba(226,181,99,.35); }
.veh-marker .pulse { position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; background: rgba(226,181,99,.25); animation: pulse 1.8s ease-out infinite; }
.veh-marker.stale .dot { background: var(--muted); box-shadow: none; } .veh-marker.stale .pulse { display: none; }
.veh-marker .tag { position: absolute; left: 14px; top: -9px; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--text); font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 6px; white-space: nowrap; }
@keyframes pulse { 0% { transform: scale(.4); opacity: .9; } 100% { transform: scale(1.4); opacity: 0; } }
.pin-marker .pin { width: 14px; height: 14px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--info); border: 2px solid #0B0D10; box-shadow: 0 0 0 2px rgba(111,168,255,.3); }
.pin-marker.dest .pin { background: var(--good); box-shadow: 0 0 0 2px rgba(74,212,139,.3); }
.pin-marker.venue .pin { background: var(--accent); box-shadow: 0 0 0 2px rgba(226,181,99,.3); }

/* misc */
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile .n { font-family: var(--font-display); font-size: 28px; font-weight: 700; line-height: 1.1; }
.tile .k { font-size: 11.5px; color: var(--muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .06em; }
.tile.alert { border-color: rgba(242,109,109,.45); } .tile.alert .n { color: var(--bad); }
.tile.accent .n { color: var(--accent); }
.avatar { width: 42px; height: 42px; border-radius: 50%; flex: none; background: var(--panel-2); border: 1px solid var(--line-2); display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--accent); background-size: cover; background-position: center; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13.5px; }
.kv .k { color: var(--muted); }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 10px; font-size: 13px; word-break: break-all; }
.tabs { display: flex; gap: 4px; background: var(--panel-2); padding: 4px; border-radius: 12px; }
.tabs button { flex: 1; background: transparent; border: 0; color: var(--muted); font: inherit; font-weight: 600; font-size: 13px; padding: 8px; border-radius: 9px; cursor: pointer; }
.tabs button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; color: var(--muted); padding: 50px 20px; }
.empty h2 { color: var(--text); margin-bottom: 6px; }
.bar { height: 8px; background: var(--panel-2); border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 5px; border: 2px solid var(--bg); }
