/* Where's My Stuff app. Built for gloves, glare and dark Conex boxes:
   big targets, high contrast, one loud color (hi-vis orange) used only for action. */

@font-face {
  font-family: 'Big Shoulders Display';
  src: url('/fonts/big-shoulders-display-var.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  src: url('/fonts/atkinson-next-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  src: url('/fonts/atkinson-next-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --ink: #13233a;
  --ink-2: #3d4f68;
  --ink-3: #66768c;
  --bg: #e9edf1;
  --card: #ffffff;
  --line: #c9d2dc;
  --line-2: #dfe5eb;
  --hivis: #f26a1b;
  --hivis-press: #d9580e;
  --on-hivis: #13233a;
  --tape: #d6dce3;
  --tape-edge: #b9c2cc;
  --caution: #ffd23f;
  --marker: #c8102e;
  --ok: #1f7a4d;
  --buried: #6b7a8f;
  --focus: #1b6fe0;
  --shadow: 0 1px 0 rgba(19, 35, 58, 0.08);
  --display: 'Big Shoulders Display', 'Arial Narrow', 'Roboto Condensed', sans-serif;
  --ui: 'Atkinson Hyperlegible Next', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 18px;
  --tabbar-h: 68px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --ink: #e8eef6;
    --ink-2: #b9c6d6;
    --ink-3: #8c9bb0;
    --bg: #0e1726;
    --card: #16233a;
    --line: #2a3b55;
    --line-2: #22324a;
    --tape: #3a4a62;
    --tape-edge: #4c5e79;
    --buried: #8c9bb0;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --ink: #e8eef6;
  --ink-2: #b9c6d6;
  --ink-3: #8c9bb0;
  --bg: #0e1726;
  --card: #16233a;
  --line: #2a3b55;
  --line-2: #22324a;
  --tape: #3a4a62;
  --tape-edge: #4c5e79;
  --buried: #8c9bb0;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 17px;
  line-height: 1.45;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(env(safe-area-inset-top) + 10px) 14px 10px;
  background: #13233a;
  color: #fff;
  border-bottom: 3px solid var(--hivis);
}
.top .site-switch {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 0;
  color: #fff;
  padding: 6px 0;
  text-align: left;
  cursor: pointer;
}
.top .site-name {
  font-family: var(--display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.01em;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top .site-sub { font-size: 13px; opacity: 0.75; }
.top .chev { opacity: 0.8; flex: none; }
.icon-btn {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.icon-btn svg { width: 22px; height: 22px; }
.outbox-pill {
  flex: none;
  font-size: 13px;
  font-weight: 700;
  background: var(--caution);
  color: #13233a;
  border-radius: 999px;
  padding: 6px 10px;
  border: 0;
}

main {
  padding: 16px 14px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 28px);
  max-width: 760px;
  margin: 0 auto;
}
main.bare { padding-bottom: 40px; }

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid;
  grid-template-columns: 1fr 1fr 1.15fr 1fr 1fr;
  align-items: center;
  background: var(--card);
  border-top: 1px solid var(--line);
}
.tabbar a {
  display: grid;
  justify-items: center;
  gap: 2px;
  text-decoration: none;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 0;
}
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a[aria-current='page'] { color: var(--ink); }
.tabbar .snap-tab {
  justify-self: center;
  width: 72px;
  height: 72px;
  margin-top: -26px;
  border-radius: 50%;
  border: 4px solid var(--bg);
  background: var(--hivis);
  color: var(--on-hivis);
  display: grid;
  place-items: center;
  box-shadow: 0 6px 16px rgba(242, 106, 27, 0.35);
  cursor: pointer;
}
.tabbar .snap-tab:active { background: var(--hivis-press); }
.tabbar .snap-tab svg { width: 32px; height: 32px; }

/* ---------- type ---------- */
h1, h2, h3 { font-family: var(--display); line-height: 1.05; margin: 0; letter-spacing: 0.005em; }
h1 { font-size: 34px; font-weight: 800; }
h2 { font-size: 26px; font-weight: 800; }
h3 { font-size: 21px; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--ink-3); }
.small { font-size: 14px; }
.stack > * + * { margin-top: 12px; }
.stack-lg > * + * { margin-top: 22px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 26px 0 10px; }
.section-title h2 { font-size: 24px; }

/* ---------- the tape tag (spot labels) ---------- */
.tag {
  display: inline-block;
  font-family: var(--display);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--tape);
  padding: 3px 12px 2px;
  line-height: 1.2;
  white-space: nowrap;
  transform: rotate(-1.2deg);
  clip-path: polygon(0 8%, 4% 0, 7% 9%, 11% 0, 89% 0, 93% 9%, 96% 0, 100% 10%, 100% 92%, 96% 100%, 93% 91%, 89% 100%, 11% 100%, 7% 90%, 4% 100%, 0 91%);
}
.tag.big { font-size: 34px; padding: 6px 22px 4px; transform: rotate(-1.6deg); }
.tag.none { background: transparent; color: var(--ink-3); clip-path: none; transform: none; border: 2px dashed var(--line); font-size: 15px; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 12px 20px;
  border-radius: var(--r-md);
  border: 2px solid var(--ink);
  background: var(--card);
  color: var(--ink);
  font-weight: 700;
  font-size: 17px;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
}
.btn svg { width: 22px; height: 22px; flex: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--hivis); border-color: var(--hivis); color: var(--on-hivis); }
.btn.primary:active { background: var(--hivis-press); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: var(--card); }
.btn.ghost { border-color: transparent; background: transparent; text-decoration: underline; text-underline-offset: 3px; min-height: 44px; padding: 8px 10px; }
.btn.danger { border-color: var(--marker); color: var(--marker); }
.btn.block { width: 100%; }
.btn.huge { min-height: 64px; font-size: 20px; border-radius: var(--r-lg); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.field { display: block; }
.field > span { display: block; font-weight: 700; font-size: 15px; margin-bottom: 6px; }
label.field > small { display: block; color: var(--ink-3); font-size: 14px; margin-top: 4px; }
input[type='text'], input[type='email'], input[type='password'], input[type='tel'], input[type='search'], input[type='time'], select, textarea {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: var(--r-md);
  background: var(--card);
  font-size: 17px;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); outline: none; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 16px; cursor: pointer; }
.check input { width: 24px; height: 24px; margin: 1px 0 0; accent-color: var(--hivis); flex: none; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 2px solid var(--ink); border-radius: var(--r-md); overflow: hidden; }
.seg button { border: 0; background: var(--card); min-height: 48px; font-weight: 700; cursor: pointer; }
.seg button[aria-pressed='true'] { background: var(--ink); color: var(--card); }

/* ---------- find ---------- */
.ask-box { position: relative; }
.ask-box input {
  min-height: 64px;
  font-size: 20px;
  padding: 14px 64px 14px 18px;
  border: 3px solid var(--ink);
  border-radius: var(--r-lg);
}
.ask-box button {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 0;
  background: var(--ink);
  color: var(--card);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.answer {
  background: var(--card);
  border-left: 6px solid var(--hivis);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  font-size: 18px;
  box-shadow: var(--shadow);
}
.answer.none { border-left-color: var(--line); }
.answer .via { display: block; margin-top: 8px; font-size: 13px; color: var(--ink-3); }

.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick button {
  border: 2px solid var(--line);
  background: var(--card);
  border-radius: var(--r-md);
  min-height: 84px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}
.quick button svg { width: 28px; height: 28px; }

/* ---------- lists ---------- */
.list { display: grid; gap: 10px; }
.card {
  background: var(--card);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
}
.item {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 12px;
  padding: 10px;
  text-decoration: none;
  align-items: start;
}
.item .thumb, .thumb {
  width: 76px;
  height: 76px;
  border-radius: var(--r-sm);
  object-fit: cover;
  background: var(--line-2);
}
.item .name { font-weight: 700; line-height: 1.25; }
.item .meta { font-size: 14px; color: var(--ink-3); margin-top: 4px; }
.item .where { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 999px;
  padding: 3px 10px;
  background: var(--line-2);
  color: var(--ink-2);
}
.chip.buried { background: transparent; border: 1px dashed var(--buried); color: var(--buried); }
.chip.low { background: var(--caution); color: #13233a; }
.chip.ok { background: transparent; border: 1px solid var(--ok); color: var(--ok); }
.chip.warn { background: transparent; border: 1px solid var(--marker); color: var(--marker); }

.spot-card { display: grid; grid-template-columns: 1fr 96px; gap: 12px; padding: 14px; text-decoration: none; align-items: center; }
.spot-card .thumb { width: 96px; height: 72px; }
.spot-card .counts { font-size: 14px; color: var(--ink-3); margin-top: 8px; }

.feed-entry { display: grid; grid-template-columns: 40px 1fr; gap: 12px; padding: 12px; align-items: start; }
.feed-entry .ico { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--line-2); color: var(--ink-2); }
.feed-entry .ico svg { width: 22px; height: 22px; }
.feed-entry.low .ico { background: var(--caution); color: #13233a; }
.feed-entry.snap .ico { background: var(--ink); color: var(--card); }
.feed-entry .photo-row { display: flex; gap: 10px; margin-top: 8px; align-items: center; }
.feed-entry .photo-row img { width: 112px; height: 84px; object-fit: cover; border-radius: var(--r-sm); }

.empty {
  border: 2px dashed var(--line);
  border-radius: var(--r-md);
  padding: 22px 18px;
  text-align: center;
  color: var(--ink-2);
}
.empty h3 { margin-bottom: 6px; color: var(--ink); }

.banner {
  display: flex;
  gap: 12px;
  align-items: center;
  border-radius: var(--r-md);
  padding: 12px 14px;
  background: var(--card);
  border: 2px solid var(--line);
  font-size: 15px;
}
.banner.caution { background: var(--caution); border-color: var(--caution); color: #13233a; }
.banner.alert { border-color: var(--marker); }
.banner .grow b { display: block; }

/* ---------- spot detail ---------- */
.spot-head { padding: 6px 0 2px; }
.layers { display: grid; grid-auto-flow: column; grid-auto-columns: 160px; gap: 10px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.layers a { scroll-snap-align: start; text-decoration: none; }
.layers img { width: 160px; height: 120px; object-fit: cover; border-radius: var(--r-sm); }
.layers .when { font-size: 13px; color: var(--ink-3); margin-top: 4px; }

/* ---------- sheets / modals ---------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(10, 17, 29, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet {
  width: 100%;
  max-width: 640px;
  max-height: 92dvh;
  overflow-y: auto;
  background: var(--bg);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  animation: rise 0.18s ease-out;
}
@media (min-width: 700px) {
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: var(--r-lg); }
}
@keyframes rise { from { transform: translateY(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.sheet-head .close { border: 0; background: var(--line-2); width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
.sheet-head .close svg { width: 22px; height: 22px; color: var(--ink); }

.spot-pick { display: flex; flex-wrap: wrap; gap: 10px; }
.spot-pick button {
  border: 2px solid var(--line);
  background: var(--card);
  border-radius: var(--r-sm);
  min-height: 48px;
  padding: 6px 14px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.spot-pick button[aria-pressed='true'] { border-color: var(--ink); background: var(--tape); box-shadow: inset 0 0 0 2px var(--ink); }
.previews { display: flex; gap: 8px; overflow-x: auto; }
.previews img { width: 96px; height: 96px; object-fit: cover; border-radius: var(--r-sm); flex: none; }

.toast-wrap { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px); z-index: 60; display: grid; justify-items: center; pointer-events: none; padding: 0 14px; }
.toast { pointer-events: auto; background: var(--ink); color: var(--card); padding: 12px 16px; border-radius: var(--r-md); font-weight: 700; max-width: 520px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); }
.toast.error { background: var(--marker); color: #fff; }

.viewer { position: fixed; inset: 0; z-index: 70; background: #05090f; display: grid; grid-template-rows: auto 1fr auto; color: #fff; }
.viewer header { display: flex; justify-content: space-between; align-items: center; padding: calc(env(safe-area-inset-top) + 8px) 12px 8px; gap: 10px; }
.viewer .img-wrap { overflow: auto; display: grid; place-items: center; touch-action: pinch-zoom; }
.viewer img { max-height: 100%; max-width: 100%; object-fit: contain; }
.viewer footer { padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); font-size: 15px; background: rgba(255, 255, 255, 0.06); }

/* ---------- tables (owner / admin) ---------- */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 15px; background: var(--card); }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
th { font-size: 13px; color: var(--ink-3); font-weight: 700; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.kpi { background: var(--card); border-radius: var(--r-md); padding: 12px; border: 1px solid var(--line-2); }
.kpi b { display: block; font-family: var(--display); font-size: 32px; font-weight: 800; line-height: 1; }
.kpi span { font-size: 13px; color: var(--ink-3); }
.check-row { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 14px; font-weight: 700; margin-top: 2px; }
.dot.ok { background: var(--ok); }
.dot.no { background: var(--marker); }
.dot.opt { background: var(--buried); }

/* ---------- auth / onboarding ---------- */
.auth { max-width: 460px; margin: 0 auto; }
.brandmark { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brandmark img { width: 44px; height: 44px; }
.brandmark b { font-family: var(--display); font-size: 26px; font-weight: 800; line-height: 1; }
.steps { display: flex; gap: 6px; }
.steps i { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.steps i.on { background: var(--hivis); }
.qr-box { background: #fff; border-radius: var(--r-md); padding: 12px; width: 220px; max-width: 100%; }
.qr-box svg { display: block; width: 100%; height: auto; }
.linkbox { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; background: var(--card); border: 2px dashed var(--line); border-radius: var(--r-sm); padding: 10px 12px; word-break: break-all; }

.loading { display: grid; place-items: center; padding: 48px 0; color: var(--ink-3); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--hivis); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

.fab-help {
  position: fixed;
  right: 12px;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 14px);
  z-index: 25;
  border: 2px solid var(--ink);
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  min-height: 44px;
  padding: 6px 14px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: var(--shadow);
}
body.no-tabbar .fab-help { bottom: calc(env(safe-area-inset-bottom) + 14px); }

/* Default icon size. :where() keeps specificity at zero so component rules override it. */
:where(span[aria-hidden="true"]) > svg { width: 22px; height: 22px; display: block; }
