/* Phone first. 390px design target. 44px minimum tap targets.
   System font stack only: it loads no files, so nothing is fetched from a CDN. */
:root {
  --tap: 44px;
  --pad: 16px;
  --ink: #1a1a1a;
  --muted: #5c5c5c;
  --line: #d8d8d8;
  --bg: #ffffff;
  --accent: #1f5c3a;
  --danger: #a01111;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

button {
  font: inherit;
  min-height: var(--tap);
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 10px 14px;
  cursor: pointer;
}

input, select {
  font: inherit;
  min-height: var(--tap);
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}

.bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: var(--pad);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
}
.bar h1 { font-size: 20px; margin: 0; flex: 1; }
.pad { padding: var(--pad); }

.banner {
  background: #fdf6e3;
  border: 1px solid #e6d9a8;
  border-radius: 10px;
  padding: 12px;
  margin: 0 0 var(--pad);
}

.empty { color: var(--muted); }

.lead { font-size: 18px; margin: 0 0 var(--pad); }

#clerk-signin { margin: var(--pad) 0; }

.cards { list-style: none; margin: 0 0 var(--pad); padding: 0; }
.cards li { margin-bottom: 10px; }
.card {
  width: 100%;
  text-align: left;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}
.card-name { font-size: 18px; font-weight: 600; }
.card-sub { font-size: 15px; color: var(--muted); }

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
button.big { width: 100%; min-height: 52px; font-size: 18px; }
button.danger { color: var(--danger); border-color: var(--danger); }

#toast {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  background: #1a1a1a;
  color: #fff;
  padding: 14px 16px;
  border-radius: 10px;
  z-index: 50;
  pointer-events: none;
}
#toast[hidden] { display: none; }

.question { font-size: 22px; margin: 0 0 var(--pad); }
.choices { display: flex; flex-direction: column; gap: 10px; }
.choice { min-height: 56px; font-size: 18px; text-align: left; }
.choice.chosen { border-color: var(--accent); border-width: 2px; font-weight: 600; }
.hint { color: var(--muted); font-size: 15px; margin: 8px 0 var(--pad); }

.section { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 16px; }
.section-head { margin-bottom: 8px; }
.section-head h2 { font-size: 19px; margin: 0 0 8px; }
.section-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.section-tools button { min-width: var(--tap); padding: 8px 12px; font-size: 15px; }
.section-tools button[disabled] { opacity: 0.35; }

.items { list-style: none; margin: 10px 0; padding: 0; }
.items li { margin-bottom: 6px; }
.item {
  width: 100%;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: var(--tap);
}
.item-main { display: flex; gap: 8px; align-items: baseline; }
.item-name { font-size: 17px; }
.qty { color: var(--muted); font-variant-numeric: tabular-nums; }
.item-note { font-size: 15px; color: var(--muted); }
.item-name, .item-note { overflow-wrap: anywhere; }

.add-gear { width: 100%; margin-top: 4px; border-style: dashed; }
.list-tools { display: flex; flex-direction: column; gap: 10px; margin: 28px 0 40px; }

#sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 20;
}
#sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  max-height: 92vh; overflow-y: auto;
  background: var(--bg);
  border-radius: 16px 16px 0 0;
  z-index: 30;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.2);
  padding-bottom: env(safe-area-inset-bottom);
}
#sheet-backdrop[hidden], #sheet[hidden] { display: none; }
.sheet-inner { padding: var(--pad); }
.sheet-inner h2 { font-size: 20px; margin: 0 0 12px; }
.sheet-inner label {
  display: block; font-weight: 600; margin: 14px 0 6px; font-size: 16px;
}

.stepper { display: flex; align-items: center; gap: 12px; }
.stepper button { width: 56px; min-height: 52px; font-size: 24px; }
.stepper output {
  font-size: 22px; min-width: 48px; text-align: center;
  font-variant-numeric: tabular-nums;
}

.weight-row { display: flex; gap: 10px; }
.weight-row input { flex: 1; }
.weight-row select { width: 96px; }

.toggle { display: flex; align-items: center; gap: 12px; min-height: var(--tap); }
.toggle input { width: 28px; height: 28px; min-height: 0; flex: none; }
.toggle span { font-weight: 400; }

.sheet-buttons { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }

.tabs {
  display: flex;
  gap: 8px;
  padding: 12px var(--pad);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 79px; /* sits directly under the sticky .bar */
  background: var(--bg);
  z-index: 4;  /* below .bar's 5, above content */
}
.tab { flex: 1; min-height: 52px; font-size: 18px; }
/* Words, not icons, and the active one is unmistakable. */
.tab.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}

.pack-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 60px;
  padding: 12px 14px;
  text-align: left;
}

/* The checkbox is drawn in CSS: no icon font, no SVG file, nothing fetched. */
.box {
  position: relative;
  flex: none;
  width: 30px;
  height: 30px;
  border: 2px solid var(--ink);
  border-radius: 6px;
}
.pack-row.packed .box {
  background: var(--accent);
  border-color: var(--accent);
}
.pack-row.packed .box::after {
  content: "";
  position: absolute;
  left: 9px;
  top: 3px;
  width: 8px;
  height: 16px;
  border: solid #fff;
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}

.pack-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
/* Checked rows stay exactly where they are — nothing sorts or moves. */
.pack-row.packed .item-name { text-decoration: line-through; color: var(--muted); }

.progress { margin: 0; color: var(--muted); font-size: 15px; }

.totals {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: var(--pad);
}
.total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 3px 0;
  font-size: 18px;
}
.total-row strong { font-variant-numeric: tabular-nums; }
.not-weighed { margin: 8px 0 0; color: var(--muted); font-size: 15px; }

.units { display: flex; gap: 8px; margin-top: 12px; }
.unit { flex: 1; min-height: var(--tap); font-size: 16px; }
.unit.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}

.section-total {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

/* Quiet row at the bottom of the lists screen: who is signed in, sync
   state, and Sign out. Deliberately understated — this is not a feature,
   it is bookkeeping. */
.account-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}
.account-email, .account-sync { overflow-wrap: anywhere; }
.account-row button { margin-left: auto; }

/* Delete my data sits on its own line under the account row, never beside
   Sign out: at 390px the two would end up a thumb-width apart, and only one
   of them can be undone by signing back in. */
.account-danger { margin: 14px 0 0; }

/* The conflict prompt (DESIGN.md 5.4). It sits above everything, including
   the Add Gear sheet, because a background push can 409 while that sheet is
   open. There is deliberately no backdrop-dismiss and no close button: the
   only two elements a tap can land on that do anything are the two choice
   buttons below. */
#conflict-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 40;
}
#conflict-modal {
  position: fixed;
  left: 12px;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--bg);
  border-radius: 16px;
  z-index: 41;
  box-shadow: 0 4px 28px rgba(0, 0, 0, 0.35);
}
#conflict-backdrop[hidden], #conflict-modal[hidden] { display: none; }

.conflict-inner { padding: 20px var(--pad); }
.conflict-inner h2 { font-size: 20px; margin: 0 0 10px; }
.conflict-inner p { margin: 0 0 var(--pad); }

.conflict-choice { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.conflict-choice button {
  min-height: 64px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  text-align: left;
}
.conflict-choice-label { font-size: 18px; font-weight: 700; }
.conflict-choice-detail { font-size: 14px; font-weight: 400; color: var(--muted); }
/* The primary (filled, green) button reads as distinct from the plain
   (outlined, white) one at a glance — the same visual language the app
   already uses for Save vs. Cancel in the Add Gear sheet. */
.conflict-choice button.primary .conflict-choice-detail { color: rgba(255, 255, 255, 0.85); }

/* Privacy and Terms, under the account row. Inline links, but still real
   tap targets: 44px minimum applies to anything you are meant to hit. */
.legal-links {
  display: flex;
  gap: 8px;
  margin: 4px 0 24px;
}
.legal-links a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 12px;
  color: var(--muted);
  font-size: 15px;
}

/* The paywall and read-only mode (DESIGN.md 5.2).

   Deliberately quiet. Nothing here flashes, counts down, or changes colour
   as a deadline approaches — honest copy with no dark patterns is a
   standing rule, and this is the screen where breaking it would be most
   tempting. The read-only banner reuses the same warm .banner the app
   already uses for ordinary information, because that is what it is. */
.banner.readonly p { margin: 0 0 12px; }
.banner.readonly button { width: 100%; }

/* The preview banner (?paywall=preview). Visually unlike everything else on
   purpose: it must be impossible to mistake for real account state. */
.banner.preview {
  background: #efeaf7;
  border-color: #bfaee0;
  color: var(--ink);
}

/* The trial notice sits in the ordinary muted hint style and collapses to
   nothing when empty, so an unstyled gap never appears where it will be. */
.trial-notice:empty { display: none; }

.price {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  margin: 0 0 var(--pad);
}
.price strong { font-size: 22px; }
.price span { color: var(--muted); font-size: 15px; }
