/* Based design tokens: cobalt for the brand, signal orange for the dot and the blank. */
@font-face {
  font-family: "Based Mark";
  src: url("wordmark.woff2") format("woff2");
  font-weight: 800;
  font-display: swap;
}
:root {
  --bg: #F1F3F8;
  --surface: #FFFFFF;
  --ink: #0E1433;
  --muted: #58607D;
  --line: #D4D9E8;
  --pine: #2438E8;        /* primary (name kept from the first build) */
  --pine-dark: #1A2AB8;
  --pine-soft: #E2E6FF;
  --signal: #FF5B33;
  --ok: #0C8A5E;
  --ok-dark: #08603F;
  --ok-soft: #DBF3E8;
  --gold: #D98E1B;
  --gold-soft: #FCF0D9;
  --red: #C2402E;
  --red-soft: #FBE6E2;
  --blue: #0B7FAB;
  --blue-soft: #DDF1F8;
  --wa: #1DA851;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", sans-serif;
  --mark: "Based Mark", var(--font);
  --shadow: 0 1px 2px rgba(14, 20, 51, .06), 0 6px 20px rgba(14, 20, 51, .06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 16px; line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
a { color: var(--pine); }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.app { max-width: 540px; margin: 0 auto; min-height: 100vh; padding: 0 16px 120px; }
.app.wide { max-width: 1180px; }

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0 10px; }
.mark { font-family: var(--mark); font-weight: 800; font-size: 30px; letter-spacing: -0.04em; line-height: 1; color: var(--ink); text-decoration: none; }
.mark i { font-style: normal; color: var(--signal); }
.brand { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.townchip { font-size: 13px; font-weight: 700; text-transform: lowercase; background: var(--pine-soft); color: var(--pine-dark); border-radius: 999px; padding: 4px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-bottom: 2px solid var(--signal); }
.mark small { font-family: var(--font); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-left: 8px; }
.lang { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 14px; font-size: 14px; font-weight: 600; cursor: pointer; min-height: 38px; }
.back { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 8px 0; font-weight: 600; color: var(--pine); cursor: pointer; min-height: 44px; }

.ribbon { background: var(--gold-soft); color: #7A4C05; border: 1px solid #F1D49B; border-radius: 10px; padding: 8px 12px; font-size: 13.5px; margin-bottom: 12px; }

/* Home */
.hero { padding: 10px 0 18px; }
.hero h1 { font-size: 30px; line-height: 1.15; letter-spacing: -0.02em; font-weight: 800; text-wrap: balance; }
.hero p { color: var(--muted); margin-top: 8px; font-size: 16px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  display: flex; flex-direction: column; gap: 10px; align-items: flex-start; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 14px; cursor: pointer; box-shadow: var(--shadow); min-height: 132px;
}
.tile:active { transform: scale(.985); }
.tile .ico { width: 46px; height: 46px; border-radius: 12px; background: var(--pine-soft); color: var(--pine); display: grid; place-items: center; }
.tile .ico svg { width: 26px; height: 26px; }
.tile b { font-size: 18px; display: block; line-height: 1.2; }
.tile span { color: var(--muted); font-size: 13.5px; line-height: 1.35; }

.section { margin-top: 26px; }
.section > h2 { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-bottom: 10px; }
.steps { display: grid; gap: 10px; counter-reset: s; padding: 0; margin: 0; list-style: none; }
.steps li { counter-increment: s; display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.steps li::before { content: counter(s); flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--pine); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.promise { background: var(--ink); color: #E8EBFA; border-radius: var(--radius); padding: 16px; font-size: 15px; }
.promise b { color: #F6C36B; }

/* Cards and lists */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.card h3 { font-size: 17px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.num { font-variant-numeric: tabular-nums; }
.stack { display: grid; gap: 12px; }
.listbtn { display: flex; width: 100%; text-align: left; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; }

/* Forms */
.title { font-size: 24px; font-weight: 800; letter-spacing: -0.01em; margin: 4px 0 4px; }
.group { margin-top: 22px; }
.group > h2 { font-size: 17px; margin-bottom: 10px; }
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field label, .lbl { font-size: 14px; font-weight: 600; }
.field .hint { font-size: 13px; color: var(--muted); }
input[type=text], input[type=tel], input[type=number], input[type=date], input[type=time], input[type=password], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface);
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--pine); outline: none; box-shadow: 0 0 0 3px var(--pine-soft); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px 12px; cursor: pointer;
  font-size: 14.5px; min-height: 44px; display: inline-flex; align-items: center; gap: 8px; text-align: left; line-height: 1.25;
}
.chip small { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.chip[aria-pressed=true] { border-color: var(--pine); background: var(--pine-soft); color: var(--pine-dark); font-weight: 600; }
.chip[aria-pressed=true] small { color: var(--pine-dark); }
.chip:disabled { opacity: .45; cursor: not-allowed; }
.chip.block { display: flex; width: 100%; justify-content: space-between; }
.note { background: var(--pine-soft); border-radius: 12px; padding: 12px 14px; font-size: 14px; color: var(--pine-dark); }
.note.gold { background: var(--gold-soft); color: #6B4304; }
.err { background: var(--red-soft); color: #8A2414; border-radius: 12px; padding: 12px 14px; font-size: 14.5px; margin-top: 12px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 18px;
  border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 700; cursor: pointer; text-decoration: none; color: var(--ink);
}
.btn.primary { background: var(--pine); border-color: var(--pine); color: #fff; }
.btn.primary:active { background: var(--pine-dark); }
.btn.wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn.danger { color: var(--red); border-color: #EBC2BA; }
.btn.block { display: flex; width: 100%; }
.btn.sm { min-height: 38px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.btn:disabled { opacity: .55; cursor: wait; }
.btnrow { display: flex; flex-wrap: wrap; gap: 8px; }

.bar {
  position: fixed; left: 0; right: 0; bottom: 0; background: rgba(241, 243, 248, .94); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); z-index: 20;
}
.bar > div { max-width: 540px; margin: 0 auto; display: flex; gap: 10px; align-items: center; }
.bar .sum { flex: 1; min-width: 0; font-size: 14px; }
.bar .sum b { display: block; font-size: 17px; }

/* Status */
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 10px; font-size: 12.5px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-new { background: var(--gold-soft); color: #8A5A06; }
.st-confirmed { background: var(--blue-soft); color: var(--blue); }
.st-assigned { background: #EFE7FA; color: #6B3FA8; }
.st-accepted, .st-on_the_way, .st-in_progress { background: var(--ok-soft); color: var(--ok-dark); }
.st-done { background: #E7EBE9; color: #3B4A44; }
.st-cancelled { background: var(--red-soft); color: #8A2414; }

.bigstatus { text-align: center; padding: 8px 0 4px; }
.bigstatus .code { font-size: 13px; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.bigstatus h1 { font-size: 26px; margin-top: 6px; letter-spacing: -0.01em; }
.bigstatus p { color: var(--muted); margin-top: 4px; }
.track { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.track li { display: grid; grid-template-columns: 22px 1fr; gap: 12px; padding-bottom: 14px; position: relative; color: var(--muted); }
.track li::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); margin: 4px 0 0 3px; z-index: 1; }
.track li::after { content: ""; position: absolute; left: 10px; top: 18px; bottom: -4px; width: 2px; background: var(--line); }
.track li:last-child { padding-bottom: 0; }
.track li:last-child::after { display: none; }
.track li.on { color: var(--ink); font-weight: 600; }
.track li.on::before { background: var(--pine); border-color: var(--pine); }
.track li.on::after { background: var(--pine); }
.track li.now::after { background: var(--line); }
.track li time { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.stars { display: flex; gap: 6px; justify-content: center; }
.stars button { width: 48px; height: 48px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); font-size: 24px; cursor: pointer; color: #C9D3CE; }
.stars button.on { color: var(--gold); border-color: var(--gold); background: var(--gold-soft); }

/* Food */
.rest { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.dot { display: inline-block; width: 12px; height: 12px; border: 1.5px solid #2E8B57; border-radius: 3px; position: relative; flex: none; }
.dot::after { content: ""; position: absolute; inset: 2px; border-radius: 50%; background: #2E8B57; }
.dot.nv { border-color: #B23B2B; }
.dot.nv::after { background: #B23B2B; }
.menu { list-style: none; margin: 0; padding: 0; }
.menu li { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.menu li:last-child { border-bottom: 0; }
.menu .nm { flex: 1; min-width: 0; }
.qty { display: inline-flex; align-items: center; border: 1.5px solid var(--pine); border-radius: 10px; overflow: hidden; }
.qty button { width: 40px; height: 40px; border: 0; background: var(--surface); color: var(--pine); font-size: 20px; font-weight: 700; cursor: pointer; }
.qty span { min-width: 26px; text-align: center; font-weight: 700; }
.addbtn { border: 1.5px solid var(--pine); color: var(--pine); background: var(--surface); border-radius: 10px; min-width: 76px; height: 40px; font-weight: 700; cursor: pointer; }

/* Toast and modal */
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14.5px; z-index: 60; max-width: calc(100% - 32px); text-align: center; }
.modal { position: fixed; inset: 0; background: rgba(14, 20, 51, .5); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal > div { background: var(--surface); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px)); }
.modal h3 { font-size: 19px; margin-bottom: 12px; }
@media (min-width: 700px) { .modal { align-items: center; } .modal > div { border-radius: 18px; } }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--pine); animation: spin .8s linear infinite; margin: 60px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
.foot { margin-top: 34px; color: var(--muted); font-size: 13px; text-align: center; }

/* ---------- Dispatch board ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 6px 0 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 14px; font-weight: 700; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected=true] { color: var(--pine); border-bottom-color: var(--pine); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.stat b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat span { font-size: 12.5px; color: var(--muted); }
.stat.alert { border-color: var(--gold); background: var(--gold-soft); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.filters .chip { min-height: 38px; padding: 6px 12px; border-radius: 999px; }
.filters select { width: auto; min-height: 38px; padding: 6px 10px; }
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; align-items: start; }
.req { background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.req.s-new { border-left-color: var(--gold); }
.req.s-confirmed { border-left-color: var(--blue); }
.req.s-assigned { border-left-color: #8B5FD0; }
.req.s-accepted, .req.s-on_the_way, .req.s-in_progress { border-left-color: var(--ok); }
.req.late { box-shadow: 0 0 0 2px var(--red) inset; }
.req .hd { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.req .hd b { font-size: 15px; }
.req .when { font-weight: 700; margin-top: 6px; }
.req .when em { font-style: normal; font-weight: 600; font-size: 13px; padding: 2px 8px; border-radius: 999px; background: var(--ok-soft); color: var(--ok-dark); margin-left: 6px; }
.req .when em.bad { background: var(--red-soft); color: #8A2414; }
.req .who { margin-top: 4px; font-size: 14.5px; }
.req .what { margin-top: 6px; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.req .acts { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.req details { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 8px; }
.req summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--pine); }
.log { list-style: none; padding: 0; margin: 8px 0 0; font-size: 13px; color: var(--muted); display: grid; gap: 3px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tbl th { text-align: left; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl input, .tbl select { min-height: 40px; padding: 6px 8px; border-radius: 8px; }
.tblwrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.check { display: grid; gap: 8px; list-style: none; padding: 0; margin: 10px 0 0; }
.check li { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; }
.check li::before { content: "○"; color: var(--muted); font-weight: 700; }
.check li.ok::before { content: "✓"; color: var(--ok); }
.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--pine-soft); color: var(--pine-dark); margin: 0 4px 4px 0; }
.tag.off { background: #E7EBE9; color: #55635D; }
.tag.warn { background: var(--gold-soft); color: #8A5A06; }
.login { max-width: 400px; margin: 8vh auto 0; }
.sw { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14.5px; }
.sw input { width: 20px; height: 20px; accent-color: var(--pine); }
@media (max-width: 420px) { .hero h1 { font-size: 26px; } .tile { min-height: 124px; padding: 14px 12px; } }

.bv { display: flex; flex-direction: column; }
@media (max-width: 700px) { .bv .stats { order: 9; margin-top: 18px; } }
