/* Mobile-first field guide. Built for one-handed use outdoors: big targets, high contrast. */
:root {
  --bg: #f3f4f6; --card: #ffffff; --ink: #14181f; --muted: #5b6472; --line: #dfe3e8;
  --accent: #e8590c; --accent-ink: #ffffff; --ok: #1f8a4c; --warn: #b7791f; --warn-bg: #fff4dc;
  --bad: #c0392b; --bad-bg: #fde8e6; --prog: #2563eb; --chip: #eef0f3;
  --top: #14181f; --top-ink: #ffffff;
  --r: 14px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1015; --card: #171b22; --ink: #eef1f5; --muted: #9aa3b1; --line: #2a303a;
    --warn-bg: #3a2c10; --bad-bg: #3b1714; --chip: #232934; --top: #0d1015; --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1015; --card: #171b22; --ink: #eef1f5; --muted: #9aa3b1; --line: #2a303a;
  --warn-bg: #3a2c10; --bad-bg: #3b1714; --chip: #232934; --top: #0d1015; --shadow: none;
}
* { box-sizing: border-box; }
/* App shell: header / scrolling content / tab bar as grid rows filling the screen. Only <main> scrolls, so the
   tab bar can't drift when a page is shorter than the screen (iOS position:fixed bug in standalone mode). */
html { -webkit-text-size-adjust: 100%; height: 100%; overflow: hidden; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  height: 100%; height: 100dvh; overflow: hidden;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
}
a { color: inherit; }
button { font: inherit; color: inherit; }

.top {
  z-index: 5; display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--top); color: var(--top-ink);
}
.brand { font-weight: 700; text-decoration: none; font-size: 17px; }
.brand span { font-weight: 500; opacity: .7; }
.sync { display: flex; align-items: center; gap: 6px; background: none; border: 0; color: var(--top-ink);
  font-size: 13px; opacity: .9; padding: 6px 0 6px 8px; }
.sync i { width: 9px; height: 9px; border-radius: 50%; background: #888; display: inline-block; }
.sync.ok i { background: #3ddc84; } .sync.pending i { background: #f5b301; } .sync.off i { background: #ff5c5c; }

main { overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch;
  /* full-width scroll area, content column capped at 640px */
  padding: 12px max(16px, calc((100% - 640px) / 2)) 24px; }
h1 { font-size: 22px; margin: 6px 0 12px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 20px 4px 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.card { background: var(--card); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow);
  border: 1px solid var(--line); margin-bottom: 12px; }
.card.hero { border: 2px solid var(--accent); }
.eyebrow { font-size: 13px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .05em; }
.store-title { font-size: 24px; font-weight: 800; margin: 2px 0; line-height: 1.15; }
.store-title .num { color: var(--muted); font-weight: 700; }
.addr { color: var(--muted); margin: 2px 0 8px; }
.addr a { color: var(--ink); font-weight: 600; text-decoration: none; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.drive { font-weight: 600; }
/* IP-based (network) location: visibly an estimate */
.rough-box { border: 1.5px dashed var(--warn); background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 8px 10px; width: 100%; }
.rough-box .small { margin-top: 4px; color: var(--ink); opacity: .85; }
.drive.rough, .rough { color: var(--warn); font-style: italic; }

.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 3px 9px;
  border-radius: 999px; background: var(--chip); color: var(--muted); white-space: nowrap; }
.chip.todo::before, .chip.progress::before, .chip.complete::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.progress { color: var(--prog); } .chip.complete { color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); } .chip.bad { background: var(--bad-bg); color: var(--bad); }

.btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 12px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--chip); font-weight: 700; text-decoration: none;
  text-align: center; cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.full { grid-column: 1 / -1; }
.btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.alt-link { display: inline-block; margin-top: 8px; font-size: 14px; color: var(--muted); }

.banner { border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; font-weight: 600; }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.bad { background: var(--bad-bg); color: var(--bad); }
.banner.info { background: var(--chip); }
.banner a { font-weight: 700; }

.bar { height: 8px; border-radius: 99px; background: var(--chip); overflow: hidden; margin-top: 10px; }
.bar > i { display: block; height: 100%; background: var(--ok); border-radius: 99px; }

.then { display: flex; justify-content: space-between; align-items: center; gap: 8px; text-decoration: none; }

/* Install prompt */
.install { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--accent);
  border-radius: 12px; padding: 8px 8px 8px 12px; margin-bottom: 12px; font-size: 15px; }
.install span { flex: 1; }
.install svg { width: 18px; height: 18px; vertical-align: -3px; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.install .btn { min-height: 38px; padding: 6px 14px; }
.install .x { border: 0; background: none; font-size: 24px; line-height: 1; color: var(--muted); padding: 4px 8px; cursor: pointer; }

/* Store list */
.sorts { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.sorts button { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 14px;
  font-weight: 600; font-size: 14px; white-space: nowrap; cursor: pointer; }
.sorts button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.toggle { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); margin: 0 4px 10px; }
.toggle input { width: 20px; height: 20px; }
.list { display: grid; gap: 8px; }
.item { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: center; text-decoration: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-height: 64px; }
.item .date { text-align: center; line-height: 1.1; }
.item .date b { display: block; font-size: 18px; }
.item .date span { font-size: 11px; color: var(--muted); text-transform: uppercase; font-weight: 700; }
.item .name { font-weight: 700; }
.item .sub { font-size: 13px; color: var(--muted); }
.item .right { text-align: right; font-size: 13px; color: var(--muted); display: grid; gap: 4px; justify-items: end; }
.item.is-complete { opacity: .6; }
.item.is-next { border-color: var(--accent); border-width: 2px; }

/* Store page */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--chip); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: none; border-radius: 9px; min-height: 44px; font-weight: 700; font-size: 14px; cursor: pointer; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.seg button[data-s="progress"][aria-pressed="true"] { color: var(--prog); }
.seg button[data-s="complete"][aria-pressed="true"] { color: var(--ok); }
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { border-bottom: 1px solid var(--line); }
.checks li:last-child { border-bottom: 0; }
.checks label { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; padding: 12px 2px; cursor: pointer; }
.checks input { width: 24px; height: 24px; margin: 0; accent-color: var(--ok); }
.checks .done .t { color: var(--muted); text-decoration: line-through; }
.checks .by { display: block; font-size: 12px; color: var(--muted); text-decoration: none; }
.group-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; padding: 12px 2px 0; letter-spacing: .05em; }
textarea { width: 100%; min-height: 90px; border-radius: 12px; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); padding: 10px; font: inherit; }
.flag { border-left: 4px solid var(--warn); }

/* Contacts / info */
.contact .name { font-weight: 800; font-size: 18px; }
.phone-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.phone-row .btn { min-height: 44px; padding: 8px 14px; }
.ref li { margin: 4px 0; }
.ref ul, .ref ol { padding-left: 20px; margin: 6px 0; }

/* Login: one box per code digit */
.otp { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.otp input.digit { min-height: 60px; padding: 0; text-align: center; font-size: 28px; font-weight: 800;
  font-variant-numeric: tabular-nums; caret-color: var(--accent); }
.otp input.digit:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.otp.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
/* Login */
.login { max-width: 420px; margin: 8vh auto 0; }
.login label { display: block; font-weight: 700; margin: 14px 0 6px; }
.login input { width: 100%; min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); padding: 10px 12px; font: inherit; font-size: 17px; }
.err { color: var(--bad); font-weight: 600; min-height: 1.4em; margin-top: 10px; }

.tabs { z-index: 5; display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 8px; font-size: 12px;
  font-weight: 600; text-decoration: none; color: var(--muted); }
.tabs a svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabs a[aria-current="page"] { color: var(--accent); }
.hidden { display: none !important; }
