/* twomarmots groceries — app layout on top of tokens.css + marmots.css (the design system). */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0; text-wrap: balance; }
h1 { font-size: 30px; line-height: 38px; }
h3 { font-size: 18px; line-height: 26px; font-weight: 500; }
button { font-family: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden { display: none !important; }

/* masthead extras */
.tm-wordmark small { font-family: var(--font-body); font-weight: 700; font-size: 14px; color: var(--ink-muted); margin-left: var(--space-2); letter-spacing: 0; }
.tm-masthead .linkbtn { font-size: 14px; }

/* page */
.page { max-width: var(--page-max); margin: 0 auto; padding: var(--space-7) var(--space-5) var(--space-8); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-5); }
.page-head p { margin: var(--space-1) 0 0; color: var(--ink-muted); }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--space-6); align-items: start; }
.side { display: flex; flex-direction: column; gap: var(--space-5); }
.side .tm-btn { width: 100%; justify-content: center; }
.stack-6 > * + * { margin-top: var(--space-6); }

/* store tabs sit on top of the list box */
.list-wrap .tm-tabs { padding: 0 var(--space-4); overflow-x: auto; scrollbar-width: none; }
.list-wrap .tm-box { border-top-left-radius: 0; }
.tm-tab .count { font-weight: 600; color: var(--ink-muted); margin-left: var(--space-1); }

/* quick add */
.quick-add { display: grid; grid-template-columns: minmax(0, 1fr) 180px auto; gap: var(--space-3); align-items: end; padding-bottom: var(--space-5); border-bottom: 1px solid var(--line); margin-bottom: var(--space-2); }
.quick-add .tm-field { gap: var(--space-1); }
.quick-add select.tm-input { padding-right: var(--space-2); }
.quick-add .tm-btn { height: 42px; }

/* sections on the list */
.section { padding-top: var(--space-4); }
.section h3 { display: flex; align-items: baseline; gap: var(--space-2); padding: 0 var(--space-2); }
.section h3 .n { font-family: var(--font-body); font-size: 14px; font-weight: 700; color: var(--ink-muted); }
.empty-sections { margin: var(--space-5) var(--space-2) 0; font-size: 14px; color: var(--ink-muted); }
.tm-item { align-items: center; }
.tm-item .tm-check { margin: 0; }
.item-note { color: var(--ink-muted); }
.flag { display: inline-flex; align-items: center; gap: var(--space-1); margin-top: 2px; font-size: 13px; line-height: 20px; font-weight: 700; color: var(--ink); background: var(--stone); border-radius: var(--radius-pill); padding: 0 var(--space-2); }
.item-actions { display: flex; align-items: center; gap: var(--space-3); flex: none; }
.item-actions .tm-link { font-size: 14px; color: var(--ink-muted); }
.item-actions .tm-link:hover { color: var(--link); }
.edit-row { list-style: none; padding: var(--space-3); margin: var(--space-2) 0; background: var(--surface-sunk); border-radius: var(--radius-md); display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.edit-row .full { grid-column: 1 / -1; }
.edit-row .tm-row { grid-column: 1 / -1; }
.list-foot { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-4); padding: var(--space-3) var(--space-2) 0; border-top: 1px solid var(--line); font-size: 14px; color: var(--ink-muted); }

/* side boxes */
.shop-box p { margin: 0 0 var(--space-4); color: var(--ink-muted); }
.missing-list { list-style: none; margin: 0; padding: 0; font-size: 15px; }
.missing-list li { padding: var(--space-2) 0; border-bottom: 1px solid var(--line); }
.missing-list li:last-child { border-bottom: 0; }
.missing-list small { display: block; color: var(--ink-muted); font-size: 13px; line-height: 18px; }
.legend { display: flex; flex-direction: column; gap: var(--space-2); }

/* phone dock (list view) */
.dock { display: none; }

/* sign in */
.signin { max-width: 420px; margin: 0 auto; padding: var(--space-8) var(--space-5); text-align: center; display: flex; flex-direction: column; align-items: center; gap: var(--space-5); }
.signin .tm-photo-frame img { width: 280px; height: 190px; }
.signin p { margin: 0; color: var(--ink-muted); }
.who-pick { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); width: 100%; }
.who-pick button { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); font: 700 16px/22px var(--font-body); color: var(--ink); cursor: pointer; box-shadow: none; }
.who-pick button[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); }
.who-pick .tm-owner-dot { width: 40px; height: 40px; font-size: 18px; }
.signin form { width: 100%; text-align: left; display: flex; flex-direction: column; gap: var(--space-4); }
.signin .tm-btn { justify-content: center; }

/* stores editor */
.store-card .tm-box-body { display: flex; flex-direction: column; gap: var(--space-3); }
.sec-list { list-style: none; margin: 0; padding: 0; }
.sec-list li { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-2); border-bottom: 1px solid var(--line); }
.sec-list li:last-child { border-bottom: 0; }
.sec-list .pos { width: 24px; color: var(--ink-muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.sec-list .name { flex: 1; min-width: 0; }
.sec-list .tm-input { min-height: 36px; padding: var(--space-1) var(--space-2); }
.icon-btn { width: 36px; height: 36px; border-radius: var(--radius-pill); border: 1px solid var(--line); background: var(--surface); color: var(--ink-muted); cursor: pointer; display: grid; place-content: center; font-size: 15px; line-height: 1; flex: none; }
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.icon-btn[disabled] { opacity: 1; color: var(--line); cursor: default; border-color: var(--line); }
.inline-form { display: flex; gap: var(--space-2); align-items: center; }
.inline-form .tm-input { flex: 1; }
.store-meta { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; font-size: 14px; color: var(--ink-muted); }
.pill-default { font-size: 12px; font-weight: 700; color: var(--brand); background: var(--brand-soft); border-radius: var(--radius-pill); padding: 0 var(--space-2); line-height: 20px; }

/* trips */
.trip { padding: var(--space-4) 0; border-bottom: 1px solid var(--line); }
.trip:last-child { border-bottom: 0; }
.trip h3 { font-size: 17px; }
.trip .meta { font-size: 14px; color: var(--ink-muted); }
.trip p { margin: var(--space-1) 0 0; font-size: 15px; }
.trip b { font-weight: 700; }

/* ---------- shopping mode ---------- */
body.shopping { background: var(--surface); }
.shop { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; max-width: 720px; margin: 0 auto; background: var(--surface); }
.shop-top { position: sticky; top: 0; z-index: 2; background: var(--surface); border-bottom: 1px solid var(--line); padding: var(--space-3) var(--space-4) 0; }
.shop-top .row1 { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.shop-top .where { font-size: 14px; color: var(--ink-muted); line-height: 20px; }
.shop-top .where b { color: var(--ink); }
.shop-top .tm-progress { margin-top: var(--space-2); }
.chips { display: flex; gap: var(--space-2); overflow-x: auto; padding: var(--space-3) 0; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: var(--space-1); height: 36px; padding: 0 var(--space-3); border-radius: var(--radius-pill); border: 1px solid var(--line); background: var(--surface-sunk); font: 700 14px/20px var(--font-body); color: var(--ink-muted); cursor: pointer; }
.chip[aria-current="true"] { background: var(--brand); border-color: var(--brand-press); color: var(--on-brand); }
.chip.clear { color: var(--brand); }
.chip.clear[aria-current="true"] { color: var(--on-brand); }
.shop-body { flex: 1; padding: var(--space-5) var(--space-4) var(--space-8); }
.shop-body h1 { font-size: 34px; line-height: 40px; margin-bottom: var(--space-1); }
.shop-body .sub { color: var(--ink-muted); margin: 0 0 var(--space-4); }
.big-list { list-style: none; margin: 0; padding: 0; }
.big-item { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); }
.big-tap { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--space-4); min-height: 72px; padding: var(--space-3) var(--space-2); background: none; border: 0; text-align: left; cursor: pointer; color: var(--ink); font: 400 19px/26px var(--font-body); -webkit-tap-highlight-color: transparent; }
.big-tap:active { background: var(--surface-hover); }
.big-box { flex: none; width: 36px; height: 36px; border-radius: var(--radius-md); border: 2px solid var(--line-strong); background: var(--surface); box-shadow: var(--shadow-inset); display: grid; place-content: center; }
.big-item.got .big-box { background: var(--brand); border-color: var(--brand-press); box-shadow: none; }
.big-item.got .big-box::after { content: ""; width: 16px; height: 9px; border-left: 3px solid var(--on-brand); border-bottom: 3px solid var(--on-brand); transform: translateY(-2px) rotate(-45deg); }
.big-item.got .big-name { color: var(--ink-muted); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.big-text { min-width: 0; }
.big-name { display: block; font-weight: 700; }
.big-note { display: block; font-size: 15px; line-height: 22px; color: var(--ink-muted); }
.big-item.missing .big-box { border-style: dashed; background: var(--stone); border-color: var(--ink); }
.big-item.missing .big-name { color: var(--ink); }
.miss-btn { flex: none; align-self: center; min-height: 44px; margin-left: var(--space-2); padding: 0 var(--space-3); border-radius: var(--radius-pill); border: 1px solid var(--line); background: var(--surface); color: var(--ink-muted); font: 700 14px/18px var(--font-body); cursor: pointer; }
.big-item.missing .miss-btn { background: var(--stone); border-color: var(--stone); color: var(--ink); }
.shop-dock { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: var(--space-3) var(--space-4) calc(var(--space-3) + env(safe-area-inset-bottom)); display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.shop-dock .tm-btn { height: 56px; font-size: 17px; justify-content: center; width: 100%; }
.shop-dock .tm-btn span.lbl { overflow: hidden; text-overflow: ellipsis; }
.section-done { margin-top: var(--space-5); text-align: center; color: var(--brand); font-weight: 700; }
.shop .tm-add-link { margin-top: var(--space-3); }

/* finish */
.finish h2 { font-size: 20px; line-height: 28px; margin: var(--space-5) 0 var(--space-2); }
.finish ul { margin: 0; padding-left: var(--space-5); }
.finish .choice { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-3); }
.radio { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-md); cursor: pointer; }
.radio input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--brand); }
.radio:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.radio small { display: block; color: var(--ink-muted); font-size: 14px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(var(--space-5) + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20; max-width: min(520px, calc(100vw - 32px)); box-shadow: var(--shadow-pop); }
.offline { font-size: 13px; color: var(--ink); font-weight: 700; }

/* ---------- phone ---------- */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .side { order: 2; }
}
@media (max-width: 640px) {
  .page { padding: var(--space-5) var(--space-4) calc(96px + env(safe-area-inset-bottom)); }
  .tm-masthead-inner { flex-wrap: wrap; gap: var(--space-2) var(--space-4); padding: var(--space-3) var(--space-4); }
  .tm-nav { order: 3; flex-basis: 100%; gap: var(--space-5); }
  .tm-masthead-aside { margin-left: auto; }
  .quick-add { grid-template-columns: 1fr 1fr; }
  .quick-add .tm-field:first-child { grid-column: 1 / -1; }
  .quick-add .tm-btn { height: 42px; justify-content: center; }
  .list-wrap .tm-box-body { padding: var(--space-4) var(--space-3); }
  .tm-item { padding: var(--space-3) var(--space-1); min-height: 56px; }
  .tm-check { width: 26px; height: 26px; }
  .side .shop-box { display: none; }
  .dock { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; padding: var(--space-3) var(--space-4) calc(var(--space-3) + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
  .dock .tm-btn { width: 100%; justify-content: center; }
  .edit-row { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 26px; line-height: 32px; }
}

/* profile pictures: round photo with a ring in the person's colour */
.avatar { display: inline-block; flex: none; width: var(--s); height: var(--s); border-radius: var(--radius-pill); padding: 2px; background: var(--owner-a); }
.avatar.b { background: var(--owner-b); }
.avatar img { display: block; width: 100%; height: 100%; border-radius: var(--radius-pill); object-fit: cover; border: 2px solid var(--surface); }
.avatar .tm-owner-dot { width: 100%; height: 100%; }
.legend .tm-owner { gap: var(--space-3); }
.legend .tm-owner .tm-owner-sm, .legend .tm-owner > .tm-owner { order: 3; }

/* rotating marmot photos */
.rotator { display: block; width: 100%; }
.rotator .tm-photo-frame { display: block; }
.marmot-rotator { position: relative; display: block; aspect-ratio: 1 / 1; overflow: hidden; border-radius: calc(var(--radius-xl) - 4px); background: var(--photo-bg); }
.marmot-rotator img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 1.4s ease; border-radius: 0; }
.marmot-rotator img.on { opacity: 1; }
.rotator.small { width: 160px; margin: 0 auto; }
@media (prefers-reduced-motion: reduce) { .marmot-rotator img { transition: none; } }
@media (max-width: 860px) { .side-photo { display: none; } }

/* fixes after the first look */
a.tm-btn { text-decoration: none; }
.flag { display: inline-block; border-radius: var(--radius-md); padding: 0 var(--space-2); }
.trip .meta { font-family: var(--font-body); font-weight: 400; font-size: 14px; }
.shop .tm-add-form { flex-direction: row; align-items: center; }
.shop .tm-add-form .tm-input { flex: 1; }
@media (max-width: 640px) {
  .tm-masthead-aside .me-name { display: none; }
  .tm-masthead-inner { flex-wrap: wrap; }
  .tm-wordmark { flex: 1; }
}
.head-photo { display: none; }
@media (max-width: 860px) {
  .page-head { flex-wrap: nowrap; align-items: center; }
  .head-photo { display: block; width: 76px; flex: none; }
  .head-photo .tm-photo-frame { padding: 3px; border-radius: var(--radius-lg); }
  .head-photo .marmot-rotator { border-radius: calc(var(--radius-lg) - 3px); }
}

/* store picker (start shopping) */
.start-list { display: flex; flex-direction: column; gap: var(--space-3); max-width: var(--measure); }
.start-store { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; align-items: center; column-gap: var(--space-4); text-align: left; min-height: 72px; padding: var(--space-4) var(--space-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: none; cursor: pointer; font-family: var(--font-body); color: var(--ink); }
.start-store:hover { border-color: var(--line-strong); }
.start-store .nm { font: 600 20px/28px var(--font-display); }
.start-store .tm-muted { grid-row: 2; font-size: 14px; }
.start-store [aria-hidden] { grid-row: 1 / 3; grid-column: 2; font-size: 26px; color: var(--ink-muted); }
.shop-box .tm-btn + .tm-btn { margin-top: var(--space-2); }
.dock .tm-btn + .tm-btn { margin-top: var(--space-2); }
.signin-label { margin: 0 0 var(--space-1); font: 700 14px/20px var(--font-body); color: var(--ink-muted); }
.side .inline-form .tm-btn { width: auto; flex: none; }
.side .inline-form .tm-input { min-width: 0; }
.side .sec-list li { gap: var(--space-1); padding: var(--space-1) 0; }
.side .sec-list .pos { width: 20px; }
.side .icon-btn { width: 30px; height: 30px; font-size: 14px; }
.sec-name { text-align: left; background: none; border: 0; padding: var(--space-1) 0; font: inherit; color: var(--ink); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sec-name:hover { color: var(--link); text-decoration: underline; }
.store-list .store-name { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; min-width: 0; }
.make-usual { font-size: 13px; color: var(--ink-muted); }
.side .sec-list .name { min-width: 0; }

/* ---------- typographic finish (v2: cranberry, Fraunces + Figtree) ---------- */
h1 { font-size: 34px; line-height: 40px; }
h3 { font-family: var(--font-body); }
.tm-wordmark small { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 18px; letter-spacing: 0; color: var(--ink-muted); margin-left: 6px; font-variation-settings: "SOFT" 100, "WONK" 1; }
.page-head p { font-size: 15px; font-variant-numeric: tabular-nums; }
/* section labels: tracked capitals over a hairline */
.section { padding-top: var(--space-5); }
.section h3 { font: 600 12px/16px var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); padding: 0 var(--space-2) var(--space-2); border-bottom: 1px solid var(--ink); margin-bottom: 0; display: flex; justify-content: space-between; }
.section h3 .n { font: 500 12px/16px var(--font-body); letter-spacing: 0; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.tm-item-title { font-size: 16px; }
.item-note { color: var(--ink-muted); }
.item-actions .tm-link { text-decoration-color: transparent; }
.item-actions .tm-link:hover { text-decoration-color: currentColor; color: var(--link); }
.flag { color: var(--ink); background: var(--stone); font-weight: 600; font-size: 13px; }
.quick-add { border-bottom: 0; padding-bottom: var(--space-2); }
.quick-add .tm-btn { height: 44px; }
.list-foot { border-top: 1px solid var(--line); }
.shop-box p { color: var(--ink-muted); }
.missing-list li { font-weight: 500; }
.legend .tm-help { margin-top: var(--space-1); }
.pill-default { color: var(--brand); background: var(--brand-soft); font-weight: 600; letter-spacing: 0.02em; }
.trip h3 { font-family: var(--font-display); font-weight: 560; font-size: 18px; letter-spacing: -0.005em; }
.who-pick button { border-radius: var(--radius-lg); font-weight: 600; box-shadow: none; }
.who-pick button[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); }
.signin h1 { font-size: 30px; line-height: 36px; font-variation-settings: "SOFT" 100, "WONK" 0; letter-spacing: -0.02em; }
.signin-label { text-transform: uppercase; letter-spacing: 0.08em; font-size: 12px; }
.start-store .nm { font-family: var(--font-display); font-weight: 560; font-size: 21px; letter-spacing: -0.01em; }
.start-store { box-shadow: none; }
.start-store:hover { border-color: var(--ink); }
.icon-btn { border-color: var(--line); color: var(--ink); }
.icon-btn:hover { border-color: var(--ink); }
.sec-list li { border-bottom-color: var(--line); }
/* shopping mode */
.shop-body h1 { font-size: 40px; line-height: 44px; letter-spacing: -0.02em; }
.shop-top .where b { font-weight: 650; }
.chip { font-weight: 600; background: var(--surface); }
.chip span { font-variant-numeric: tabular-nums; color: inherit; opacity: 0.75; }
.chip[aria-current="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.chip.clear { color: var(--ink-muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.chip.clear[aria-current="true"] { color: var(--surface); }
.big-name { font-weight: 600; font-size: 19px; }
.big-box { border: 2px solid var(--ink); border-radius: var(--radius-md); box-shadow: none; }
.big-item.got .big-box { background: var(--brand); border-color: var(--brand); }
.big-item.missing .big-box { border-color: var(--ink); background: var(--stone); }
.big-item.missing .big-name { color: var(--ink); }
.miss-btn { font-weight: 600; border-color: var(--line-strong); color: var(--ink); }
.big-item.missing .miss-btn { background: var(--stone); border-color: var(--stone); color: var(--ink); }
.section-done { color: var(--brand); font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 18px; }
.finish h2 { font-size: 20px; }
.radio:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.radio input { accent-color: var(--brand); }
code { font: 500 13px/1 ui-monospace, "SF Mono", Menlo, monospace; background: var(--surface-sunk); padding: 2px 5px; border-radius: 4px; }
.big-item.missing .big-box { border-style: dashed; border-color: var(--ink-muted); background: var(--stone); }
.big-item.missing .big-name { color: var(--ink); }
.big-item.missing .big-note { color: var(--ink); }

/* v3: navy secondary, no yellow */
.chip[aria-current="true"] { background: var(--navy); border-color: var(--navy); color: var(--on-brand); }
.chip.clear[aria-current="true"] { color: var(--on-brand); }
.big-item.missing .big-box { background: var(--stone); border-color: var(--ink-muted); }
.big-item.missing .miss-btn { background: var(--stone); border-color: var(--stone); color: var(--ink); }
.flag { background: var(--stone); color: var(--ink); }
.offline { color: var(--navy); }
.tm-nav a[aria-current="page"] { border-bottom-color: var(--brand); }

/* rolled forward: subtitle + history */
.rolled { display: block; font: italic 400 14px/20px var(--font-display); color: var(--ink-muted); font-variation-settings: "SOFT" 100; }
.big-note.rolled { font-size: 15px; }
.item-history h4 { margin: var(--space-2) 0 var(--space-2); display: flex; gap: var(--space-2); align-items: baseline; flex-wrap: wrap; }
.item-history h4 .tm-muted { text-transform: none; letter-spacing: 0; font: italic 400 14px/20px var(--font-display); }
.history { list-style: none; margin: 0; padding: 0 0 0 var(--space-4); border-left: 1px solid var(--line-strong); }
.history li { position: relative; display: grid; grid-template-columns: 64px 1fr; gap: var(--space-3); padding: var(--space-1) 0; font-size: 14px; line-height: 20px; }
.history li::before { content: ""; position: absolute; left: calc(-1 * var(--space-4) - 4px); top: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--ink-muted); }
.history li:first-child::before { background: var(--ink); border-color: var(--ink); }
.history .h-when { color: var(--ink-muted); font-variant-numeric: tabular-nums; }

/* ---------- depth (Web 2.0 layer, app parts) ---------- */
.list-wrap > .tm-box, .side .tm-box:not(.tm-box-sunk) { box-shadow: var(--shadow-box); }
.chip { background: var(--sheen); box-shadow: var(--shadow-button); }
.chip[aria-current="true"] { background: var(--gloss), var(--navy); box-shadow: var(--shadow-button-fill); text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3); }
.icon-btn { background: var(--sheen); box-shadow: var(--shadow-button); }
.icon-btn:active { box-shadow: var(--shadow-pressed); }
.icon-btn[disabled] { background: var(--surface); box-shadow: none; }
.miss-btn { background: var(--sheen); box-shadow: var(--shadow-button); }
.miss-btn:active { box-shadow: var(--shadow-pressed); }
.big-box { box-shadow: var(--shadow-inset); background: var(--surface); }
.big-item.got .big-box { background: var(--gloss), var(--brand); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 1px 2px rgba(40, 10, 20, 0.3); }
.big-item.missing .big-box { box-shadow: var(--shadow-inset); }
.big-item.missing .miss-btn { box-shadow: var(--shadow-inset); }
.shop-top { background: var(--sheen); box-shadow: 0 1px 2px rgba(60, 40, 30, 0.06); }
.shop-dock, .dock { background: linear-gradient(to bottom, #fbf9f7, #f1ece7); box-shadow: inset 0 1px 0 #ffffff, 0 -1px 3px rgba(60, 40, 30, 0.06); }
.start-store { background: var(--sheen); box-shadow: var(--shadow-box); }
.start-store:active { box-shadow: var(--shadow-pressed); }
.who-pick button { background: var(--sheen); box-shadow: var(--shadow-box); }
.who-pick button[aria-pressed="true"] { background: linear-gradient(to bottom, #fbf1f4, var(--brand-soft)); box-shadow: inset 0 1px 2px rgba(138, 21, 56, 0.12); }
.avatar { background-image: var(--gloss); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18); }
.avatar.a { background-color: var(--owner-a); } .avatar.b { background-color: var(--owner-b); }
.flag { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 0 0 1px rgba(60, 40, 30, 0.06); }
.pill-default { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 0 0 1px rgba(138, 21, 56, 0.12); }
.edit-row { box-shadow: var(--shadow-inset); }
.radio { background: var(--sheen); box-shadow: var(--shadow-button); }
.radio:has(input:checked) { background: var(--brand-soft); box-shadow: inset 0 1px 2px rgba(138, 21, 56, 0.12); }
.tm-masthead + .page .page-head h1, .shop-body h1 { text-shadow: 0 1px 0 #ffffff; }

/* backups */
.backup-list { list-style: none; margin: 0; padding: 0; }
.backup-list li { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; padding: var(--space-2) 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.backup-list li:last-child { border-bottom: 0; }
.bk-tier { font: 600 11px/18px var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--navy); background: var(--navy-soft); border-radius: var(--radius-pill); padding: 0 var(--space-2); min-width: 64px; text-align: center; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7); }
.bk-when { flex: 1; font-variant-numeric: tabular-nums; }
.bk-size { font-variant-numeric: tabular-nums; }
.bk-confirm { display: inline-flex; gap: var(--space-2); align-items: center; }
/* trips: details + habits */
.trip-more { margin-top: var(--space-2); }
.trip-more summary { cursor: pointer; color: var(--link); font-size: 14px; }
.trip-log { list-style: none; margin: 0; padding: 0; }
.trip-log li { display: grid; grid-template-columns: 72px 1fr; gap: var(--space-3); font-size: 14px; line-height: 20px; padding: 2px 0; }
.habits dl { display: grid; grid-template-columns: auto 1fr; gap: var(--space-1) var(--space-4); margin: 0; font-size: 15px; }
.habits dt { color: var(--ink-muted); }
.habits dd { margin: 0; }
.rank { list-style: none; margin: 0; padding: 0; counter-reset: r; }
.rank li { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px solid var(--line); font-size: 15px; counter-increment: r; }
.rank li:last-child { border-bottom: 0; }
.rank li span:first-child::before { content: counter(r) "  "; color: var(--ink-muted); font-variant-numeric: tabular-nums; display: inline-block; width: 22px; }

/* ---------- quantities ---------- */
.quick-add { grid-template-columns: 80px 112px minmax(0, 1fr) auto; }
.quick-add .tm-field:first-child { grid-column: 1 / -1; }
.qa-hint { font-weight: 400; color: var(--ink-muted); letter-spacing: 0; text-transform: none; }
.item-qty, .big-qty { font-variant-numeric: tabular-nums lining-nums; color: var(--brand); font-weight: 600; white-space: nowrap; }
.item-qty { margin-left: var(--space-1); }
.big-qty { margin-left: var(--space-2); font-size: 0.86em; }
.big-item.got .big-qty { color: var(--ink-muted); }
.qty-pair { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: var(--space-2); }

/* ---------- paste a list ---------- */
.paste { margin: 0 0 var(--space-4); padding-bottom: var(--space-4); border-bottom: 1px solid var(--line); }
.paste summary { cursor: pointer; color: var(--navy, var(--ink)); font-size: 14px; width: max-content; }
.paste summary::marker { color: var(--ink-muted); }
.paste-form { display: grid; gap: var(--space-2); margin-top: var(--space-3); }
.paste-form textarea { resize: vertical; min-height: 112px; font: inherit; }

/* ---------- fixed header, content scrolls ---------- */
.tm-masthead { position: sticky; top: 0; z-index: 30; box-shadow: 0 1px 0 var(--line), 0 6px 18px -12px rgba(17, 17, 17, .25); }
.shop-top { position: sticky; top: 0; z-index: 30; }
@media (min-width: 641px) {
  .page-head { position: sticky; top: var(--mast-h, 0px); z-index: 20; background: var(--page); box-shadow: 0 0 0 100vmax var(--page); clip-path: inset(0 -100vmax); padding-top: var(--space-3); padding-bottom: var(--space-3); margin-top: calc(-1 * var(--space-3)); }
}

/* ---------- local search ---------- */
.filter { margin: 0 0 var(--space-3); }
.list-filter { width: 100%; padding-left: 36px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236b6560' stroke-width='1.6' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 3.5 3.5'/%3E%3C/svg%3E") 12px 50% / 16px no-repeat; }
.filter-none { margin: var(--space-3) 0 0; }
[data-filter-scope] [hidden], .section[hidden], .filter-none[hidden] { display: none !important; }

/* ---------- Items and Units pages ---------- */
.usual-list, .unit-list, .tidy-list { list-style: none; margin: 0; padding: 0; }
.usual-list li { display: grid; grid-template-columns: minmax(0, 1fr) 168px 96px 120px auto; align-items: center; gap: var(--space-2); padding: var(--space-2) 0; border-bottom: 1px solid var(--line); }
.usual-list li:last-child, .unit-list li:last-child { border-bottom: 0; }
.usual-list .tm-input { min-height: 36px; padding: var(--space-1) var(--space-2); }
.usual-list .pill-default { margin-left: var(--space-1); }
.u-name { min-width: 0; overflow-wrap: anywhere; }
.u-how { font-size: 13px; font-variant-numeric: tabular-nums; }
.u-acts { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-3); }
.save-item { display: grid; grid-template-columns: minmax(0, 1fr) 168px 96px auto; gap: var(--space-2); margin-bottom: var(--space-4); padding-bottom: var(--space-4); border-bottom: 1px solid var(--line); }
.unit-list li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; align-items: center; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--line); }
.unit-form { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); padding: var(--space-2) 0; }
.unit-form .full { grid-column: 1 / -1; }
.unit-list li:has(.unit-form) { display: block; }
.unit-add { display: grid; grid-template-columns: 1fr 1fr auto; gap: var(--space-2); margin-bottom: var(--space-4); padding-bottom: var(--space-4); border-bottom: 1px solid var(--line); }
.tidy-list li { padding: var(--space-2) 0; border-bottom: 1px solid var(--line); }
.tidy-list label { display: flex; gap: var(--space-2); align-items: baseline; }
.tidy { display: grid; gap: var(--space-3); }

@media (max-width: 860px) {
  .usual-list li { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 96px; }
  .usual-list .u-name { grid-column: 1 / -1; }
  .usual-list .u-acts { grid-column: 1 / -1; justify-content: flex-start; }
  .save-item { grid-template-columns: minmax(0, 1fr) 96px auto; }
  .save-item .tm-input:first-child { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .quick-add { grid-template-columns: 72px 104px minmax(0, 1fr); }
  .quick-add .tm-btn { grid-column: 1 / -1; justify-content: center; }
  .tm-nav { overflow-x: auto; scrollbar-width: none; gap: var(--space-4); }
  .tm-nav::-webkit-scrollbar { display: none; }
  .tm-nav a { flex: none; }
  .usual-list li { grid-template-columns: minmax(0, 1fr) 96px; row-gap: var(--space-1); }
  .usual-list .u-how { grid-column: 1; }
  .usual-list .u-acts { grid-column: 2; justify-content: flex-end; }
  .unit-list li { grid-template-columns: minmax(0, 1fr) auto; }
  .unit-list .u-how { grid-column: 1 / -1; grid-row: 2; }
  .unit-add { grid-template-columns: 1fr 1fr; }
  .unit-add .tm-btn { grid-column: 1 / -1; }
}
