/* Shelfmark styles. Values come from tokens.css. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--color-bg); color: var(--color-text);
  font-family: var(--font-sans); font-size: var(--text-md); line-height: var(--leading-body);
  overflow-x: hidden;
}
body.locked { overflow: hidden; }
h1, h2, h3, p, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; }
button { font: inherit; color: inherit; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-weight: var(--weight-medium); }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { width: var(--icon); height: var(--icon); stroke-width: var(--icon-stroke); flex: none; }
:focus-visible { outline: var(--focus-ring) solid var(--color-focus); outline-offset: var(--line-bold); }
[hidden] { display: none !important; }

/* ---- top bar ---- */
.bar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: var(--space-2);
  min-height: calc(var(--touch) + var(--space-3)); padding: var(--space-1) var(--gutter);
  background: var(--color-bg); max-width: var(--page-max); margin: 0 auto;
}
.bar-back, .icon-btn {
  display: inline-grid; place-items: center; width: var(--touch); height: var(--touch); flex: none;
  border: 0; background: none; border-radius: var(--radius-pill); cursor: pointer; text-decoration: none;
  margin-left: calc(var(--space-3) * -1);
}
.icon-btn { margin-left: 0; }
.bar-back:hover, .icon-btn:hover { background: var(--color-sunk); }
.bar-title { font-size: var(--text-lg); font-weight: var(--weight-bold); letter-spacing: var(--tracking-tight); }
.bar-count { margin-left: auto; font-family: var(--font-num); color: var(--color-text-muted); font-size: var(--text-sm); }
.brand { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: var(--weight-black); font-size: var(--text-lg); letter-spacing: var(--tracking-tight); text-decoration: none; }
.brand-mark { display: inline-grid; grid-template-columns: repeat(2, var(--space-3)); gap: var(--line-bold); }
.brand-mark i { width: var(--space-3); height: var(--space-3); border-radius: var(--line-bold); background: var(--field); }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--touch); padding: 0 var(--space-5); border-radius: var(--radius-pill);
  font-weight: var(--weight-bold); font-size: var(--text-md); text-decoration: none; cursor: pointer;
  border: var(--line-bold) solid transparent; white-space: nowrap;
}
.btn-primary { background: var(--color-primary); color: var(--color-on-primary); }
.btn-primary:hover { background: var(--color-text-muted); }
.btn-ghost { background: transparent; border-color: var(--color-border-strong); color: var(--color-text); }
.btn-ghost:hover { background: var(--color-sunk); }
.btn-danger { background: transparent; border-color: var(--color-border-strong); color: var(--color-danger); }
.btn-wide { flex: 1; }
.link { border: 0; background: none; padding: 0 var(--space-2); min-height: var(--touch); font-weight: var(--weight-bold); text-decoration: underline; text-underline-offset: var(--underline-offset); cursor: pointer; }

/* ---- squares (the stickers) ---- */
.sq {
  display: grid; place-items: center; width: 100%; aspect-ratio: 1; border-radius: var(--radius-tile);
  background: var(--field); color: var(--glyph);
}
.sq .glyph { width: var(--glyph-size); height: var(--glyph-size); stroke-width: var(--glyph-stroke); }
.sq-off {
  color: var(--g-none-ink);
  background: repeating-linear-gradient(135deg, var(--g-none) 0 var(--hatch), var(--color-sunk) var(--hatch) var(--hatch-2));
}
.sq-sm { width: var(--tile-sm); border-radius: var(--radius-sm); }
.sq-sm .glyph { width: var(--icon); height: var(--icon); stroke-width: var(--icon-stroke); }
.sq-xs { width: var(--tile-xs); border-radius: var(--radius-sm); box-shadow: 0 0 0 var(--line-bold) var(--color-surface); }
.sq-xs .glyph { width: var(--icon-sm); height: var(--icon-sm); stroke-width: var(--icon-stroke); }
.sq-lg { width: var(--tile-lg); }
.sq-lg .glyph { width: var(--glyph-size-lg); height: var(--glyph-size-lg); }

/* ---- add page: tools ---- */
.tools { max-width: var(--page-max); margin: 0 auto; padding: 0 var(--gutter); }
.search {
  display: flex; align-items: center; gap: var(--space-2); min-height: var(--touch); padding: 0 var(--space-4);
  background: var(--color-surface); border: var(--line) solid var(--color-border); border-radius: var(--radius-pill);
  color: var(--color-text-muted);
}
.search:focus-within { border-color: var(--color-text); }
.search input { flex: 1; min-width: 0; border: 0; background: none; font: inherit; color: var(--color-text); min-height: var(--touch); }
.search input:focus { outline: none; }
.search input::placeholder { color: var(--color-text-muted); }
.chips {
  display: flex; gap: var(--space-2); overflow-x: auto; scrollbar-width: none;
  margin: var(--space-3) calc(var(--gutter) * -1) 0; padding: var(--space-1) var(--gutter);
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: var(--space-2); flex: none; min-height: var(--touch);
  padding: 0 var(--space-4); border-radius: var(--radius-pill); border: var(--line) solid var(--color-border-strong);
  background: transparent; font-size: var(--text-sm); font-weight: var(--weight-medium); cursor: pointer;
}
.chip .ic { width: var(--icon-sm); height: var(--icon-sm); }
.chip[aria-pressed="true"] { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-on-primary); }

/* ---- shelves ---- */
.shelves { max-width: var(--page-max); margin: 0 auto; padding: var(--space-6) var(--gutter) calc(var(--tray-h) + var(--space-7)); }
.shelf + .shelf { margin-top: var(--space-6); }
.shelf-h { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-3); font-size: var(--text-lg); font-weight: var(--weight-bold); letter-spacing: var(--tracking-tight); line-height: var(--leading-snug); }
.shelf-key { width: var(--space-4); height: var(--space-4); border-radius: var(--space-1); background: var(--field); flex: none; }
.shelf-n { margin-left: auto; font-family: var(--font-num); font-size: var(--text-sm); font-weight: var(--weight-regular); color: var(--color-text-muted); }
.results .shelf-h .link { margin-left: auto; font-size: var(--text-sm); }
.row {
  display: flex; gap: var(--space-3); overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
  margin: 0 calc(var(--gutter) * -1); padding: var(--space-1) var(--gutter) var(--space-2); scroll-padding: 0 var(--gutter);
}
.row::-webkit-scrollbar { display: none; }
.row > li { flex: none; width: var(--tile); scroll-snap-align: start; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--tile), 1fr)); gap: var(--space-5) var(--space-3); }
.none { display: grid; place-items: center; padding: var(--space-8) 0; color: var(--color-border-strong); }
.none .ic { width: var(--glyph-size); height: var(--glyph-size); stroke-width: var(--glyph-stroke); }

.tile {
  display: flex; flex-direction: column; gap: var(--space-2); width: 100%; padding: 0; border: 0; background: none;
  text-align: left; cursor: pointer; border-radius: var(--radius-tile);
}
.tile-face { position: relative; display: block; border-radius: var(--radius-tile); transition: transform var(--dur-fast) var(--ease); }
.tile:active .tile-face { transform: scale(var(--press)); }
.badge {
  position: absolute; top: var(--space-2); right: var(--space-2); display: grid; place-items: center;
  width: var(--tile-xs); height: var(--tile-xs); border-radius: var(--radius-pill);
  background: var(--color-surface); color: var(--color-text);
}
.badge .ic { width: var(--icon-sm); height: var(--icon-sm); stroke-width: var(--badge-stroke); }
.tile.is-picked .tile-face { box-shadow: 0 0 0 var(--focus-ring) var(--color-bg), 0 0 0 calc(var(--focus-ring) * 2) var(--color-text); }
.tile.is-picked .badge { background: var(--color-text); color: var(--color-on-primary); }
.tile.is-added .badge { background: var(--color-success-tint); color: var(--color-success); }
.tile.is-off .badge { background: var(--color-surface); color: var(--color-warning); }
.tile-title { font-size: var(--text-sm); font-weight: var(--weight-medium); line-height: var(--leading-snug); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tile.is-off .tile-title { color: var(--color-text-muted); }
.tile-note { font-size: var(--text-xs); font-weight: var(--weight-bold); color: var(--color-success); margin-top: calc(var(--space-1) * -1); }
.tile-note.tile-warn { color: var(--color-warning); }

/* ---- tray ---- */
.tray {
  position: fixed; z-index: 6; left: var(--gutter); right: var(--gutter); bottom: var(--gutter);
  max-width: var(--sheet-max); margin: 0 auto; min-height: var(--tray-h);
  display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
  background: var(--color-surface); border-radius: var(--radius-sheet); box-shadow: var(--shadow-tray);
  transition: transform var(--dur) var(--ease);
}
.tray.bump { transform: translateY(calc(var(--space-1) * -1)); }
.tray-open { display: flex; align-items: center; gap: var(--space-4); flex: 1; min-width: 0; min-height: var(--touch); border: 0; background: none; padding: 0; cursor: pointer; text-align: left; border-radius: var(--radius-sm); }
.stack { display: flex; padding-left: var(--space-2); }
.stack .sq-xs { margin-left: calc(var(--space-2) * -1); }
.tray-count { display: flex; align-items: baseline; gap: var(--space-2); }
.tray-count b { font-size: var(--text-xl); line-height: 1; }
.tray-count span { font-size: var(--text-sm); color: var(--color-text-muted); }
.tray.is-saved { justify-content: flex-start; }
.tray.is-saved .tray-count { flex: 1; }
.tray-ok { color: var(--color-success); display: grid; }
.tray-ok .ic { width: var(--tile-xs); height: var(--tile-xs); }

/* ---- sheets ---- */
.scrim { position: fixed; inset: 0; z-index: 7; background: var(--color-scrim); }
.sheet {
  position: fixed; z-index: 8; left: 0; right: 0; bottom: 0; max-width: var(--sheet-max); margin: 0 auto;
  max-height: 92vh; display: flex; flex-direction: column; background: var(--color-surface);
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0; box-shadow: var(--shadow-sheet);
  animation: rise var(--dur) var(--ease);
}
@keyframes rise { from { transform: translateY(var(--space-6)); opacity: 0; } }
.sheet-h { position: relative; display: flex; align-items: center; gap: var(--space-2); padding: var(--space-5) var(--space-3) var(--space-2) var(--gutter); }
.sheet-h h2 { flex: 1; font-size: var(--text-xl); font-weight: var(--weight-black); letter-spacing: var(--tracking-tight); }
.sheet-h h2 .num { color: var(--color-text-muted); font-weight: var(--weight-regular); }
.sheet-h h2:focus { outline: none; }
.grab { position: absolute; top: var(--space-2); left: 50%; width: var(--space-6); height: var(--space-1); margin-left: calc(var(--space-6) / -2); border-radius: var(--radius-pill); background: var(--color-border); }
.sheet-f { display: flex; gap: var(--space-3); padding: var(--space-3) var(--gutter) var(--space-4); border-top: var(--line) solid var(--color-border); background: var(--color-surface); }
.sheet-f .btn { min-height: calc(var(--touch) + var(--space-1)); }
.bk-list, .rv-list { overflow-y: auto; padding: 0 var(--gutter); flex: 1; }
.bk { display: flex; align-items: center; gap: var(--space-3); min-height: calc(var(--touch) + var(--space-4)); border-bottom: var(--line) solid var(--color-border); }
.bk:last-child { border-bottom: 0; }
.bk-t { flex: 1; font-weight: var(--weight-medium); line-height: var(--leading-snug); }

.rv { padding: var(--space-4) 0 var(--space-5); border-bottom: var(--line) solid var(--color-border); }
.rv:last-child { border-bottom: 0; }
.rv-top { display: flex; align-items: center; gap: var(--space-3); }
.rv-t { flex: 1; font-weight: var(--weight-bold); line-height: var(--leading-snug); }
.rv-fields { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); margin: var(--space-3) 0 0 calc(var(--tile-sm) + var(--space-3)); }
.rv-fields .fld:only-child { grid-column: 1 / -1; }
.fld { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.fld-l { font-size: var(--text-xs); font-weight: var(--weight-bold); color: var(--color-text-muted); }
.fld-box { display: flex; align-items: center; min-height: var(--touch); padding: 0 var(--space-3); border: var(--line) solid var(--color-border-strong); border-radius: var(--radius-sm); background: var(--color-bg); }
.fld-box:focus-within { border-color: var(--color-text); box-shadow: 0 0 0 var(--line) var(--color-text); }
.fld-box input { flex: 1; min-width: 0; width: 100%; border: 0; background: none; font-size: var(--text-md); color: var(--color-text); min-height: calc(var(--touch) - var(--line-bold)); padding: 0; }
.fld-box input:focus { outline: none; }
.fld-u { color: var(--color-text-muted); font-family: var(--font-num); padding: 0 var(--space-1); }
.rv-pv { margin: var(--space-3) 0 0 calc(var(--tile-sm) + var(--space-3)); }
.pv { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3); border-radius: var(--radius-sm); font-size: var(--text-sm); line-height: var(--leading-snug); }
.pv .ic { margin-top: var(--line-bold); }
.pv-site { display: block; font-size: var(--text-xs); font-weight: var(--weight-bold); color: var(--color-text-muted); margin-bottom: var(--line-bold); }
.pv-read { background: var(--color-success-tint); }
.pv-read .ic { color: var(--color-success); }
.pv-none { border: var(--line) dashed var(--color-border-strong); color: var(--color-text-muted); }
.pv-load { background: var(--color-sunk); color: var(--color-text-muted); align-items: center; }
.spin { animation: spin 900ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.refused { padding: 0 var(--gutter) var(--space-6); display: flex; flex-direction: column; gap: var(--space-3); }
.refused .sq-lg { margin-bottom: var(--space-3); }
.refused-tag { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: var(--weight-bold); color: var(--color-warning); }
.refused-t { font-size: var(--text-xl); font-weight: var(--weight-bold); line-height: var(--leading-tight); letter-spacing: var(--tracking-tight); }
.refused-why { color: var(--color-text-muted); }

/* ---- home ---- */
.home { max-width: var(--page-max); margin: 0 auto; padding: var(--space-5) var(--gutter) var(--space-8); }
.home-top { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.home-top h1 { font-size: var(--text-2xl); font-weight: var(--weight-black); line-height: var(--leading-tight); letter-spacing: var(--tracking-tight); }
.home-top h1 .num { font-size: var(--text-xl); color: var(--color-text-muted); font-weight: var(--weight-regular); }
.legend { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-top: var(--space-5); }
.legend .sq-xs { box-shadow: none; }
.w-sec { margin-top: var(--space-7); }
.w-sec h2 { font-size: var(--text-sm); font-weight: var(--weight-bold); color: var(--color-text-muted); margin-bottom: var(--space-2); }
.w-list { border-top: var(--line) solid var(--color-border); }
.w-row {
  display: grid; grid-template-columns: var(--tile-sm) 1fr auto; align-items: center; gap: var(--space-3);
  min-height: calc(var(--touch) + var(--space-6)); padding: var(--space-3) 0; border-bottom: var(--line) solid var(--color-border);
  text-decoration: none;
}
.w-row:hover .w-t { text-decoration: underline; text-underline-offset: var(--underline-offset); }
.w-t { font-weight: var(--weight-bold); line-height: var(--leading-snug); }
.w-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-3); margin-top: var(--space-1); font-size: var(--text-sm); }
.w-read { font-size: var(--text-sm); color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.w-side { display: flex; flex-direction: column; align-items: flex-end; gap: var(--space-1); }
.spark { width: var(--spark-w); height: var(--spark-h); display: block; }
.st { display: inline-flex; align-items: center; gap: var(--space-1); font-size: var(--text-xs); font-weight: var(--weight-bold); }
.st .ic { width: var(--icon-sm); height: var(--icon-sm); }
.st-watch { color: var(--color-text-muted); }
.st-match { color: var(--color-success); }
.st-pause { color: var(--color-text-muted); }
.st-block { color: var(--color-danger); }
.st-key { color: var(--color-warning); }
.w-row.is-new .w-t::after { content: "New"; margin-left: var(--space-2); padding: 0 var(--space-2); border-radius: var(--radius-pill); background: var(--color-text); color: var(--color-on-primary); font-size: var(--text-xs); vertical-align: middle; }

.empty { margin-top: var(--space-7); display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-5); }
.slots { display: grid; grid-template-columns: repeat(4, var(--tile-sm)); gap: var(--space-3); }
.slots i { aspect-ratio: 1; border-radius: var(--radius-sm); border: var(--line-bold) dashed var(--color-border-strong); }
.slots i:nth-child(1) { background: var(--g-travel); border-color: transparent; }
.slots i:nth-child(4) { background: var(--g-shopping); border-color: transparent; }
.slots i:nth-child(7) { background: var(--g-finance); border-color: transparent; }
.empty h2 { font-size: var(--text-xl); font-weight: var(--weight-black); letter-spacing: var(--tracking-tight); }

/* ---- watcher detail ---- */
.detail { max-width: var(--sheet-max); margin: 0 auto; padding: var(--space-4) var(--gutter) var(--space-8); }
.d-head { display: flex; gap: var(--space-4); align-items: flex-start; }
.d-head .sq { width: calc(var(--tile-sm) * 2); flex: none; }
.d-head .sq .glyph { width: var(--glyph-size); height: var(--glyph-size); }
.d-title { font-size: var(--text-xl); font-weight: var(--weight-black); line-height: var(--leading-tight); letter-spacing: var(--tracking-tight); }
.d-says { margin-top: var(--space-2); color: var(--color-text-muted); line-height: var(--leading-snug); }
.d-now { margin-top: var(--space-6); display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.d-read { font-size: var(--text-xl); line-height: var(--leading-tight); font-weight: var(--weight-black); letter-spacing: var(--tracking-tight); font-variant-numeric: tabular-nums; }
.d-sub { font-size: var(--text-sm); color: var(--color-text-muted); margin-top: var(--space-2); }
.d-chart { margin-top: var(--space-5); }
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.ch-line { fill: none; stroke: var(--color-text); stroke-width: var(--line-bold); }
.ch-pt { fill: var(--color-text); }
.ch-last { fill: var(--color-target); }
.ch-target { stroke: var(--color-target); stroke-width: var(--line-bold); stroke-dasharray: var(--dash); }
.ch-tlabel { fill: var(--color-target); font: var(--weight-bold) var(--text-xs) var(--font-sans); }
.ch-axis { fill: var(--color-text-muted); font: var(--text-xs) var(--font-num); }
.ch-val { fill: var(--color-text); font: var(--weight-medium) var(--text-md) var(--font-num); }
.ch-base { stroke: var(--color-border-strong); stroke-width: var(--line-bold); }
.ch-ev { fill: var(--color-target); }
.spark .ch-line { stroke-width: var(--spark-stroke); }
.spark .ch-target { stroke-width: var(--line); stroke-dasharray: var(--dash-sm); }
.banner { display: flex; gap: var(--space-3); align-items: center; margin-top: var(--space-5); padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); font-weight: var(--weight-medium); font-size: var(--text-sm); }
.banner-block { background: var(--color-danger-tint); color: var(--color-danger); }
.banner-key { background: var(--color-warning-tint); color: var(--color-warning); }
.banner-match { background: var(--color-success-tint); color: var(--color-success); }
.banner-muted { background: var(--color-sunk); color: var(--color-text-muted); }
.banner .btn { margin-left: auto; min-height: var(--touch); padding: 0 var(--space-4); font-size: var(--text-sm); }
.facts { margin-top: var(--space-6); display: grid; grid-template-columns: auto 1fr; gap: var(--space-3) var(--space-5); font-size: var(--text-sm); border-top: var(--line) solid var(--color-border); padding-top: var(--space-5); }
.facts dt { color: var(--color-text-muted); }
.facts dd { font-family: var(--font-num); overflow-wrap: anywhere; }
.d-actions { display: flex; gap: var(--space-3); margin-top: var(--space-6); flex-wrap: wrap; }

/* ---- alert ---- */
.alert-page { max-width: var(--page-max); margin: 0 auto; padding: var(--space-5) var(--gutter) var(--space-8); display: grid; gap: var(--space-7); }
.alert-page h2 { font-size: var(--text-sm); color: var(--color-text-muted); font-weight: var(--weight-bold); margin-bottom: var(--space-3); }
.lock { background: var(--color-sunk); border-radius: var(--radius-sheet); padding: var(--space-6) var(--space-3) var(--space-5); max-width: var(--sheet-max); }
.lock-time { text-align: center; font-family: var(--font-num); font-size: var(--text-3xl); line-height: 1; font-weight: var(--weight-regular); }
.lock-day { text-align: center; font-size: var(--text-sm); color: var(--color-text-muted); margin: var(--space-2) 0 var(--space-6); }
.notif { display: grid; grid-template-columns: var(--tile-xs) 1fr; gap: var(--space-3); padding: var(--space-3); background: var(--color-surface); border-radius: var(--radius-tile); text-decoration: none; }
.notif .sq-xs { box-shadow: none; }
.notif-top { display: flex; justify-content: space-between; font-size: var(--text-xs); color: var(--color-text-muted); }
.notif-t { font-weight: var(--weight-bold); line-height: var(--leading-snug); }
.notif-b { font-size: var(--text-sm); line-height: var(--leading-snug); }
.mail { max-width: var(--sheet-max); background: var(--color-surface); border: var(--line) solid var(--color-border); border-radius: var(--radius-tile); overflow: hidden; }
.mail-h { padding: var(--space-4); border-bottom: var(--line) solid var(--color-border); font-size: var(--text-sm); display: grid; gap: var(--space-1); }
.mail-h b { font-size: var(--text-md); }
.mail-h span { color: var(--color-text-muted); }
.mail-b { padding: var(--space-5) var(--space-4); display: grid; gap: var(--space-4); }
.mail-b .d-read { font-size: var(--text-2xl); }

@media (min-width: 900px) {

  .bar { padding-top: var(--space-3); }
  .shelves { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-7) var(--space-7); align-content: start; }
  .shelf + .shelf { margin-top: 0; }
  .results { grid-column: 1 / -1; }
  .row { flex-wrap: wrap; overflow: visible; margin: 0; padding: var(--space-1) 0 0; gap: var(--space-5) var(--space-3); }
  .chips { flex-wrap: wrap; overflow: visible; margin: var(--space-3) 0 0; padding: var(--space-1) 0; }
  .sheet { bottom: var(--space-5); border-radius: var(--radius-sheet); max-height: 86vh; }
  .alert-page { grid-template-columns: 1fr 1fr; align-items: start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---- round 2: categories, cards, add button, brand sticker ---- */
.brand-mark {
  position: relative; display: inline-block; width: var(--brand-size); height: var(--brand-size);
  border-radius: var(--brand-radius); background: var(--g-shopping);
  clip-path: polygon(0 0, 62% 0, 100% 38%, 100% 100%, 0 100%);
}
.brand-mark i { display: none; }
.brand-mark::after {
  content: ""; position: absolute; left: 62%; top: 0; width: 38%; height: 38%;
  background: var(--brand-fold); clip-path: polygon(0 0, 0 100%, 100% 100%);
}
.cat-h { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-2); }
.cat-h > a:first-child { display: inline-flex; align-items: center; gap: var(--space-3); min-height: var(--touch); font-size: var(--text-lg); font-weight: var(--weight-bold); color: var(--color-text); text-decoration: none; letter-spacing: var(--tracking-tight); }
.cat-h > a:first-child:hover { text-decoration: underline; text-underline-offset: var(--underline-offset); }
.see-all { margin-left: auto; display: inline-flex; align-items: center; gap: var(--space-1); min-height: var(--touch); min-width: var(--touch); justify-content: flex-end; font-size: var(--text-sm); font-weight: var(--weight-bold); color: var(--color-text); text-decoration: none; }
.w-sec .cat-h { font-size: var(--text-lg); color: var(--color-text); }
.w-state { display: block; margin-top: var(--line-bold); font-size: var(--text-sm); line-height: var(--leading-snug); font-variant-numeric: tabular-nums; }
.fab {
  position: fixed; z-index: 6; right: var(--gutter); bottom: var(--gutter); display: grid; place-items: center;
  width: var(--fab); height: var(--fab); border-radius: var(--radius-pill); background: var(--color-primary); color: var(--color-on-primary);
  box-shadow: var(--shadow-fab);
}
.fab .ic { width: var(--glyph-size-sm); height: var(--glyph-size-sm); stroke-width: var(--badge-stroke); }
.fab:hover { background: var(--color-text-muted); }
.page-home .home, .page-cat .home { padding-bottom: calc(var(--fab) + var(--space-7)); }
.cat .home-top h1 { display: flex; align-items: center; gap: var(--space-3); font-size: var(--text-xl); }
.cat-key { display: grid; place-items: center; width: var(--tile-sm); height: var(--tile-sm); border-radius: var(--radius-sm); background: var(--field); color: var(--glyph); flex: none; }
.cards { display: grid; gap: var(--space-3); margin-top: var(--space-6); }
.w-card {
  display: grid; grid-template-columns: var(--tile-md) 1fr; gap: var(--space-2) var(--space-4); padding: var(--space-3);
  background: var(--color-surface); border: var(--line) solid var(--color-border); border-radius: var(--radius-tile); text-decoration: none;
}
.w-card:hover { border-color: var(--color-border-strong); }
.w-card-body { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.w-card-spark { margin-top: var(--space-2); }
.w-card-foot { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding-top: var(--space-2); border-top: var(--line) solid var(--color-border); }
.w-since { font-size: var(--text-xs); color: var(--color-text-muted); font-family: var(--font-num); }
.sq-md { width: var(--tile-md); border-radius: var(--radius-sm); }
.sq-md .glyph { width: var(--glyph-size-sm); height: var(--glyph-size-sm); stroke-width: var(--glyph-stroke); }
@media (min-width: 900px) {
  #list { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--space-7); }
  .cards { grid-template-columns: 1fr 1fr; }
}

/* ---- round 3: edit a watcher ---- */
.edit { max-width: var(--sheet-max); margin: 0 auto; padding: var(--space-3) var(--gutter) 0; }
.e-head { display: flex; align-items: center; gap: var(--space-3); }
.e-title { font-size: var(--text-xl); font-weight: var(--weight-black); line-height: var(--leading-tight); letter-spacing: var(--tracking-tight); }
.e-sec { margin-top: var(--space-6); }
.e-h { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); font-weight: var(--weight-bold); color: var(--color-text-muted); padding-bottom: var(--space-2); border-bottom: var(--line) solid var(--color-border); }
.e-tag { margin-left: auto; display: inline-flex; align-items: center; gap: var(--space-1); font-size: var(--text-xs); color: var(--color-warning); }
.e-tag .ic { width: var(--icon-sm); height: var(--icon-sm); }
.e-field { padding: var(--space-4) 0; border-bottom: var(--line) solid var(--color-border); }
.e-field:last-child { border-bottom: 0; }
.e-l { font-weight: var(--weight-bold); margin-bottom: var(--space-3); }
.e-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.e-chips .chip .ic { width: var(--icon-sm); height: var(--icon-sm); }
.stepper { display: inline-flex; align-items: center; gap: var(--space-2); }
.step { display: grid; place-items: center; width: var(--touch); height: var(--touch); border-radius: var(--radius-pill); border: var(--line) solid var(--color-border-strong); background: var(--color-surface); cursor: pointer; }
.step:hover { background: var(--color-sunk); }
.step-v { display: inline-flex; align-items: baseline; gap: var(--space-1); min-width: calc(var(--touch) * 2); justify-content: center; }
.step-v input { width: calc(var(--touch) * 1.6); border: 0; background: none; text-align: center; font-size: var(--text-lg); color: var(--color-text); min-height: var(--touch); padding: 0; }
.step-v input:focus { outline: none; }
.stepper:focus-within .step-v { box-shadow: inset 0 calc(var(--line-bold) * -1) 0 var(--color-text); }
.e-pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.e-pair input, .e-one input { font-family: var(--font-num); }
.e-one { display: flex; margin-top: var(--space-3); }
.e-chips + .e-one[hidden] { display: none; }
.e-field > .e-one:first-of-type { margin-top: 0; }
.e-count { margin-top: var(--space-2); font-size: var(--text-sm); color: var(--color-text-muted); }
.e-foot {
  position: sticky; bottom: 0; margin: var(--space-6) calc(var(--gutter) * -1) 0; padding: var(--space-3) var(--gutter) var(--space-4);
  background: var(--color-bg); border-top: var(--line) solid var(--color-border); display: grid; gap: var(--space-2);
}
.e-sum { font-size: var(--text-sm); color: var(--color-text-muted); }
.e-btns { display: flex; gap: var(--space-3); }
.e-foot.is-confirm { background: var(--color-warning-tint); border-top-color: var(--color-warning); }
.e-confirm { display: flex; gap: var(--space-2); align-items: flex-start; color: var(--color-warning); }
.e-confirm b { color: var(--color-text); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.dt-saved { margin-top: var(--space-4); }
.rv-more { margin: var(--space-2) 0 0 calc(var(--tile-sm) + var(--space-3)); }
.rv-more .link { font-size: var(--text-sm); padding: 0; }
.rv-sched .e-field { padding: var(--space-3) 0; }
.rv-sched .e-l { font-size: var(--text-sm); margin-bottom: var(--space-2); }
.w-kick { font-size: var(--text-xs); font-weight: var(--weight-bold); color: var(--color-text-muted); margin-bottom: var(--line-bold); }
.e-one input[type="text"] { font-family: var(--font-sans); font-size: var(--text-md); }

/* ---- About control on a sticker, and the About sheet ---- */
.row > li, .grid > li { position: relative; }
.tile-over { position: absolute; left: 0; top: 0; width: 100%; aspect-ratio: 1; display: flex; align-items: flex-end; pointer-events: none; }
.tile .sq { padding-bottom: var(--space-5); }
.tile-info {
  pointer-events: auto; display: inline-flex; align-items: center; gap: var(--space-1); min-height: var(--touch); min-width: var(--touch);
  padding: 0 var(--space-3); border: 0; background: none; color: var(--glyph); font-size: var(--text-xs); font-weight: var(--weight-bold);
  cursor: pointer; border-radius: 0 var(--radius-sm) 0 var(--radius-tile);
}
.tile-info .ic { width: var(--icon-sm); height: var(--icon-sm); }
.tile-info:hover span { text-decoration: underline; text-underline-offset: var(--underline-offset); }
.tile.is-off + .tile-over .tile-info { color: var(--g-none-ink); }
.sheet-h-sp { flex: 1; }
.about { padding: 0 var(--gutter) var(--space-6); overflow-y: auto; display: flex; flex-direction: column; gap: var(--space-3); }
.sq-about { width: calc(var(--tile-sm) * 2); margin-bottom: var(--space-2); }
.sq-about .glyph { width: var(--glyph-size); height: var(--glyph-size); stroke-width: var(--glyph-stroke); }
.about-t { font-size: var(--text-xl); font-weight: var(--weight-black); letter-spacing: var(--tracking-tight); line-height: var(--leading-tight); }
.about-t:focus { outline: none; }
.about-p { font-size: var(--text-md); line-height: var(--leading-body); }
.about-h { margin-top: var(--space-3); font-size: var(--text-xs); font-weight: var(--weight-bold); color: var(--color-text-muted); }
.about-sites { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.site-chip { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--touch); padding: 0 var(--space-4) 0 var(--space-2); border: var(--line) solid var(--color-border-strong); border-radius: var(--radius-pill); font-size: var(--text-sm); font-weight: var(--weight-medium); }
.site-mark { display: grid; place-items: center; width: var(--tile-xs); height: var(--tile-xs); border-radius: var(--radius-pill); background: var(--field); color: var(--glyph); font-size: var(--text-sm); font-weight: var(--weight-black); }
@media (min-width: 900px) {
  .sheet.sheet-about { top: 50%; bottom: auto; translate: 0 -50%; max-width: calc(var(--sheet-max) - var(--space-7)); }
  .sheet-about .grab { display: none; }
  .sheet-about .sheet-f { border-radius: 0 0 var(--radius-sheet) var(--radius-sheet); }
}
