/* Light theme only — the owner wants the panel bright even when Windows is in dark mode. */
:root {
  color-scheme: light;
  --bg: #f4f5f7; --card: #fff; --ink: #1d1d1f; --muted: #646a73; --line: #e2e5ea; --hover: #f7f8fa;
  --brand: #e85d04; --rapido: #ffc72c; --ok: #1e8e3e; --warn: #b26a00; --bad: #c62828;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.35 "Segoe UI", system-ui, Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-weight: 400; }
.error { color: var(--bad); min-height: 1.2em; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); text-align: center; display: grid; gap: 10px; }
.logo { font-size: 40px; }
.login h1 { margin: 0; font-size: 22px; }

/* Header */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 6px 14px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; font-size: 16px; }
.devices { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.dev { display: flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); font-size: 13px; background: var(--hover); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--bad); flex: none; }
.dot.ok { background: var(--ok); } .dot.busy { background: var(--warn); }
.conn { color: var(--bad); font-size: 16px; } .conn.on { color: var(--ok); }

/* Three columns that use the whole screen height */
.grid { display: grid; grid-template-columns: 340px minmax(380px, 1fr) 360px; gap: 10px; padding: 10px; height: calc(100vh - 44px); }
@media (max-width: 1100px) { .grid { grid-template-columns: 1fr; height: auto; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; min-height: 0; }
.card > form, .card > .list { min-height: 0; }
.card h2 { margin: 0 0 8px; font-size: 15px; display: flex; align-items: center; gap: 6px; }
#addCard { overflow: auto; }

.lbl { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin: 7px 0 3px; }
input, textarea { width: 100%; padding: 7px 9px; border-radius: 7px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; }
textarea { resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
.row { display: flex; gap: 6px; margin-top: 10px; }
.row .btn.primary { flex: 1; }

.btn { border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 6px 11px; border-radius: 7px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { filter: brightness(.95); }
.btn.rapido { background: var(--rapido); border-color: #e9b21a; color: #111; }
.btn.rapido:hover { filter: brightness(.96); }
.btn.danger { color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--hover); color: var(--ink); }
.btn.big { padding: 10px 14px; font-size: 15px; }
#resolveBtn { margin-top: 6px; width: 100%; }

.loc { margin-top: 6px; font-weight: 600; min-height: 1.1em; font-size: 13px; }
.loc.ok { color: var(--ok); } .loc.bad { color: var(--bad); }
.loc a { color: inherit; }

.send-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.search { margin-bottom: 6px; }

/* Lists fill the column and scroll inside it */
.list { flex: 1; overflow: auto; display: flex; flex-direction: column; margin: 0 -12px -10px; border-top: 1px solid var(--line); }

/* Customer rows: compact, one block per customer */
.crow { display: grid; grid-template-columns: minmax(150px, 34%) 1fr auto; gap: 0 10px; padding: 5px 12px; border-bottom: 1px solid var(--line); align-items: center; }
.crow:hover { background: var(--hover); }
.crow.fresh { background: #fff6e8; box-shadow: inset 3px 0 0 var(--brand); }
.crow .name { font-weight: 700; font-size: 14px; }
.crow .name .muted { font-weight: 400; font-size: 13px; }
.crow .addrs { min-width: 0; display: flex; flex-direction: column; }
.crow .actions { display: flex; gap: 4px; flex-wrap: nowrap; justify-content: flex-end; }
.crow .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crow .name .ph { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
@media (max-width: 1400px) { .crow { grid-template-columns: minmax(130px, 30%) 1fr; } .crow .actions { grid-column: 1 / -1; justify-content: flex-start; margin-top: 3px; } }
.crow .actions .btn { padding: 4px 9px; font-size: 13px; }
.addrline { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.addrline b { color: var(--ink); font-weight: 600; }
.sub { color: var(--muted); font-size: 12.5px; }
.nolocation { color: var(--bad); font-size: 12.5px; font-weight: 600; }
.empty { padding: 14px 12px; }

/* Orders */
.job { padding: 8px 12px; border-bottom: 1px solid var(--line); border-left: 4px solid var(--line); display: grid; gap: 2px; }
.job .name { font-weight: 700; }
.job .name .muted { font-size: 12.5px; }
.job.st-at_fare { border-left-color: var(--rapido); background: #fff8e1; }
.job.st-booked { border-left-color: var(--ok); }
.job.st-failed, .job.st-cancelled { border-left-color: var(--bad); }
.job.st-cancelled { opacity: .6; }
.job .status { font-weight: 600; font-size: 13px; }
.job .fare { font-size: 18px; font-weight: 800; }
.job .actions { display: flex; gap: 6px; margin-top: 4px; }
.job .bookbtn { font-size: 15px; padding: 7px 16px; }

.toast { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); background: #222; color: #fff; padding: 9px 16px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; z-index: 20; }
.toast.show { opacity: 1; }

/* Address editor */
.addr { border: 1px solid var(--line); border-radius: 8px; padding: 2px 10px 10px; margin-top: 10px; }
.addr legend { font-weight: 700; font-size: 13px; padding: 0 4px; }
.addr-mode { display: grid; gap: 4px; margin: 4px 0; }
.addr-mode label { display: flex; gap: 6px; align-items: center; font-weight: 600; font-size: 13px; }
.addr-mode input[type=radio] { width: auto; }
.hint { color: var(--warn); font-size: 12.5px; font-weight: 600; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.chip { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 13px; cursor: pointer; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chips input { flex: 1; min-width: 100px; padding: 4px 8px; }
details { margin-top: 8px; }
summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13px; }
.existing { display: grid; gap: 4px; margin-top: 8px; }
.existing .ex { border: 1px dashed var(--line); border-radius: 7px; padding: 3px 6px 3px 9px; display: flex; gap: 4px; align-items: center; }
.existing .ex .grow { flex: 1; min-width: 0; }
.existing .ex.editing { border-style: solid; border-color: var(--brand); }
.existing .btn { padding: 2px 7px; }

/* "Which address?" picker */
.picker { border: none; border-radius: 12px; padding: 16px; width: min(440px, calc(100vw - 32px)); background: var(--card); color: var(--ink); box-shadow: 0 10px 40px rgba(0,0,0,.2); }
.picker::backdrop { background: rgba(0,0,0,.35); }
.picker h2 { margin: 0 0 10px; font-size: 16px; }
.picker-list { display: grid; gap: 6px; }
.picker-list label { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--line); border-radius: 8px; padding: 8px; cursor: pointer; }
.picker-list input { width: auto; margin-top: 3px; }
.picker-list label:has(input:checked) { border-color: var(--brand); background: #fff6e8; }
.picker-list .addrline { white-space: normal; }

/* Who pays the rider — asked on every send */
.pay-q { margin: 14px 0 6px; font-size: 14px; }
.pay-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pay-choice label { display: flex; gap: 8px; align-items: flex-start; border: 2px solid var(--line); border-radius: 8px; padding: 8px; cursor: pointer; }
.pay-choice input { width: auto; margin-top: 3px; }
.pay-choice label:has(input:checked) { border-color: var(--brand); background: #fff6e8; }
.pay-choice.need { animation: shake .3s; }
.pay-choice.need label { border-color: var(--bad); }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* Today's Rapido spend */
.today { display: grid; grid-template-columns: repeat(auto-fill, minmax(95px, 1fr)); gap: 6px; margin-bottom: 8px; }
.today .t { background: var(--hover); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.today .t b { display: block; font-size: 17px; }
.today .t span { font-size: 12px; color: var(--muted); }
.today .t.main { background: #fff6e8; border-color: #ffd7b0; }
.job .pay { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 13px; margin-top: 2px; }
.job .pay input { width: auto; padding: 3px 6px; font-size: 13px; }
.job .pay .amt { width: 70px; }
.job .pay .who { width: 130px; }
.tag { font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--hover); border: 1px solid var(--line); }
.tag.k { background: #fff1e0; border-color: #ffd7b0; }
.tag.c { background: #e8f3ff; border-color: #bcdcff; }
.row .btn.rapido { flex: 1; }
.dev-choice { display: grid; gap: 6px; margin-top: 10px; }
.dev-choice:empty { display: none; }
.dev-choice label { display: flex; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; cursor: pointer; }
.dev-choice input { width: auto; }
.dev-choice label:has(input:checked) { border-color: var(--brand); background: #fff6e8; }
.opt-block { margin-top: 10px; }
#phonePick:empty { display: none; }
#phonePick .pay-choice { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.pay-choice label { padding: 6px 8px; }
.diag-btn { float: right; padding: 2px 8px; font-size: 12px; }
dialog.diag { width: min(900px, 96vw); }
.diag-item { display: block; width: 100%; text-align: left; padding: 6px 8px; border: 1px solid #e3e3e3; border-radius: 6px; background: #fff; margin: 4px 0; cursor: pointer; font: inherit; }
.diag-item:hover { background: #fff8e1; }
.diag-grid { display: grid; grid-template-columns: 240px 1fr; gap: 12px; align-items: start; }
.diag-grid img { width: 100%; border: 1px solid #ddd; border-radius: 6px; }
.diag pre { max-height: 260px; overflow: auto; background: #f6f6f6; padding: 6px; font-size: 11px; white-space: pre-wrap; word-break: break-all; margin: 4px 0 10px; }
@media (max-width: 700px) { .diag-grid { grid-template-columns: 1fr; } }
.job .pay .paid-by { display: inline-flex; gap: 8px; align-items: center; }
.job .pay .paid-by label { display: inline-flex; gap: 3px; align-items: center; border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; cursor: pointer; }
.job .pay .paid-by label:has(input:checked) { border-color: var(--brand); background: #fff6e8; font-weight: 600; }
