:root {
  --ink: #14171c;
  --ink-2: #3b4250;
  --muted: #6b7280;
  --line: #e4e6eb;
  --bg: #f5f6f8;
  --card: #ffffff;
  --brand: #f05a1a;
  --brand-ink: #ffffff;
  --brand-soft: #fff1ea;
  --ok: #16803c;
  --ok-soft: #e8f6ee;
  --warn: #a15c00;
  --warn-soft: #fff6e0;
  --bad: #c02626;
  --bad-soft: #fdecec;
  --sos: #d11a2a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 23, 28, .06), 0 4px 16px rgba(20, 23, 28, .06);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #eef0f3; --ink-2: #c3c8d1; --muted: #8b93a1; --line: #2a2f38;
    --bg: #0f1216; --card: #171b21; --brand-soft: #3a1d10;
    --ok-soft: #12301e; --warn-soft: #33270c; --bad-soft: #3a1414;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); }
body { min-height: 100vh; line-height: 1.45; font-size: 15px; }
a { color: var(--brand); }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; }
h1 { font-size: 1.45rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .6em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* shells */
.phone { max-width: 480px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.wide { max-width: 1200px; margin: 0 auto; padding: 0 16px 48px; }
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; background: #14171c; color: #fff; border-bottom: 1px solid var(--line);
}
.topbar .logo { font-weight: 800; letter-spacing: -.02em; font-size: 1.05rem; }
.topbar .logo b { color: var(--brand); }
.topbar .logo .sub { color: #c9ced6; font-weight: 600; margin-left: 4px; }
.topbar .spacer { flex: 1; }
.topbar button.link { color: #cfd3da; }
main.screen { padding: 16px; flex: 1; }

/* cards & lists */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 12px; }
.card.tap { cursor: pointer; }
.card.tap:hover { border-color: var(--brand); }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.section-title { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; }

/* forms */
label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: 4px; color: var(--ink-2); }
input, select, textarea {
  width: 100%; font: inherit; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
textarea { min-height: 80px; resize: vertical; }
.field { margin-bottom: 12px; }

/* buttons */
button { font: inherit; cursor: pointer; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 16px; border-radius: 10px; border: 1px solid transparent; font-weight: 700;
  background: var(--brand); color: var(--brand-ink); text-decoration: none;
}
.btn:hover { filter: brightness(1.05); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ok { background: var(--ok); }
.btn.bad { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn.dark { background: var(--ink); color: var(--bg); }
.btn.sm { padding: 7px 11px; font-size: .85rem; }
button.link { background: none; border: 0; padding: 0; color: var(--brand); font-weight: 600; }

.sos {
  display: block; width: 100%; text-align: left; border: 0; border-radius: var(--radius);
  padding: 18px; background: var(--sos); color: #fff; box-shadow: var(--shadow);
}
.sos strong { display: block; font-size: 1.15rem; }

/* choice tiles */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
  text-align: left; padding: 14px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--card); color: var(--ink);
}
.tile.on { border-color: var(--brand); background: var(--brand-soft); }
.tile strong { display: block; }

/* status pills */
.pill { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.pill.requested { background: var(--warn-soft); color: var(--warn); }
.pill.assigned, .pill.on_the_way, .pill.arrived { background: var(--brand-soft); color: var(--brand); }
.pill.quoted { background: #e8efff; color: #2346b8; }
.pill.approved { background: var(--ok-soft); color: var(--ok); }
.pill.completed { background: var(--ok); color: #fff; }
.pill.cancelled, .pill.declined { background: var(--line); color: var(--muted); }
.pill.sos { background: var(--sos); color: #fff; }
.pill.verified { background: var(--ok-soft); color: var(--ok); }

/* progress */
.progress { display: flex; gap: 4px; margin: 10px 0 4px; }
.progress span { flex: 1; height: 5px; border-radius: 4px; background: var(--line); }
.progress span.done { background: var(--brand); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 12px 18px; }
.timeline li::before { content: ""; position: absolute; left: 3px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.timeline li::after { content: ""; position: absolute; left: 6.5px; top: 16px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }

/* bill */
.bill { width: 100%; border-collapse: collapse; }
.bill td { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.bill td:last-child { text-align: right; white-space: nowrap; }
.bill tr.total td { border-bottom: 0; font-weight: 800; font-size: 1.05rem; padding-top: 10px; }
.tag { font-size: .7rem; color: var(--muted); text-transform: uppercase; margin-left: 6px; }

/* tables (admin) */
.table { width: 100%; border-collapse: collapse; background: var(--card); }
.table th, .table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); font-size: .88rem; vertical-align: top; }
.table th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 16px 0; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.kpi .v { font-size: 1.5rem; font-weight: 800; }
.kpi .k { font-size: .78rem; color: var(--muted); }
.tabs { display: flex; gap: 6px; margin: 8px 0 12px; flex-wrap: wrap; }
.tabs button { padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-weight: 600; font-size: .85rem; }
.tabs button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* toast */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; display: none;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; max-width: 90vw; }
#toast.bad { background: var(--bad); color: #fff; }

.empty { text-align: center; padding: 28px 12px; color: var(--muted); }
.mech { display: flex; gap: 12px; align-items: center; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 800; flex: none; }

/* landing */
.hero { padding: 40px 16px 24px; max-width: 900px; margin: 0 auto; }
.hero h1 { font-size: 2.5rem; letter-spacing: -.02em; }
.entry h2 { font-size: 1.35rem; }
.entry { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; max-width: 900px; margin: 0 auto; padding: 0 16px 40px; }
.entry a { text-decoration: none; color: inherit; }
