/* Leo's mini app, after Muse's look: dark rounded cards, one blue main button per card, quiet text for the
   rest. One 4/8px spacing scale; 16px card padding, 12px between cards. Every text colour passes WCAG AA
   on the surface it sits on (ratios noted). No gradients, no images but Amazon's product photos. */
:root {
  --bg: #161618;
  --card: #232326;
  --raise: #2e2e33; /* chips, tags, small buttons */
  --line: rgba(255, 255, 255, 0.08);
  --photo: #ffffff;
  --fg: #f2f2f4;
  --mut: #a1a1a9; /* 6.1:1 on --card, 5.4:1 on --raise */
  --pri: #0a6fd8; /* white text on it: 5.2:1 */
  --link: #6cb2ff; /* 7.1:1 on --card */
  --prime: #3cc4f0;
  --warn: #f5b84a;
  --ok: #3ccf6e;
  color-scheme: dark;
}
:root.light {
  --bg: #f2f2f6;
  --card: #ffffff;
  --raise: #ececf1;
  --line: rgba(0, 0, 0, 0.08);
  --fg: #111114;
  --mut: #62626b; /* 6.0:1 on --card, 5.1:1 on --raise */
  --link: #0a64c4; /* 5.8:1 on --card */
  --prime: #00668f;
  --warn: #8a5a00;
  color-scheme: light;
}

* { box-sizing: border-box; }
::selection { background: var(--pri); color: #ffffff; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body {
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 16px calc(24px + env(safe-area-inset-bottom));
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
}
p, h1, h2, dl, dd { margin: 0; }

/* ---- header: "● Leo · Amazon · toothpaste" ---- */
.top { display: flex; justify-content: center; margin-bottom: 16px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--mut);
  font-size: 14px;
  line-height: 20px;
  white-space: nowrap;
  overflow: hidden;
}
.pill b { color: var(--fg); font-weight: 600; }
.pill .src { color: var(--fg); }
.pill .h { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.sub { margin: -4px 0 4px; color: var(--mut); font-size: 14px; text-align: center; }

/* ---- cards ---- */
#app { display: grid; gap: 12px; }
.card { padding: 16px; border: 1px solid var(--line); border-radius: 20px; background: var(--card); }
.photo {
  display: grid;
  place-items: center;
  width: min(100%, 152px);
  aspect-ratio: 1;
  margin: 0 auto 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--photo);
  overflow: hidden;
}
.photo img { width: 88%; height: 88%; object-fit: contain; }
.title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
}
.price { margin-top: 8px; font-size: 24px; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.meta { margin-top: 4px; color: var(--mut); font-size: 14px; line-height: 1.45; }
.meta .prime { color: var(--prime); font-weight: 600; }
.meta.warn { color: var(--warn); }
.state { margin-top: 8px; color: var(--mut); font-size: 14px; }
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--raise);
  color: var(--fg);
  font-size: 13px;
  font-weight: 600;
  line-height: 20px;
}

/* ---- buttons: one blue main button per card; the rest is quiet ---- */
button { border: 0; font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { transition: background-color 0.15s ease-out, opacity 0.15s ease-out; }
button:active { opacity: 0.72; }
@media (prefers-reduced-motion: reduce) { button { transition: none; } }
button:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.pri {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--pri);
  color: #ffffff;
  font-size: 17px;
  font-weight: 600;
}
.pri:disabled { background: var(--raise); color: var(--mut); cursor: default; }
.quiet {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 4px;
  padding: 10px 16px;
  background: none;
  color: var(--link);
  font-size: 16px;
  font-weight: 600;
}
.product .pri + .quiet { margin-top: 4px; }
.product .meta + .quiet, .product .state + .quiet, .product .title + .quiet { margin-top: 8px; }
.quiet.plain { color: var(--fg); font-weight: 500; }

/* ---- trains: large depart → arrive, price and tag on top ---- */
.train .head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; }
.train .price { margin: 0; font-size: 20px; }
.times { margin-top: 8px; font-size: 26px; font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.times .arrow { margin: 0 8px; color: var(--mut); font-weight: 400; }
.ticket { margin-top: 8px; font-size: 15px; font-weight: 500; }

/* ---- times: chips by day; times and approvals: one action bar pinned to the bottom ---- */
.day-label { margin-bottom: 12px; font-size: 16px; font-weight: 600; }
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.chip {
  min-height: 44px;
  border-radius: 12px;
  background: var(--raise);
  color: var(--fg);
  font-size: 16px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.chip[aria-pressed="true"] { background: var(--pri); color: #ffffff; font-weight: 600; }
.bar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 12px max(16px, calc((100% - 528px) / 2)) calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.bar .pri { margin-top: 0; }
.bar .fine { margin: 0 0 8px; }
.bar .quiet { margin-top: 4px; }
body.layout-s { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
body.layout-g { padding-bottom: calc(200px + env(safe-area-inset-bottom)); }

/* ---- reminders: a checklist ---- */
.list { padding: 4px 16px; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.check { flex: none; width: 20px; height: 20px; border: 2px solid var(--mut); border-radius: 50%; }
.what { flex: 1; min-width: 0; }
.what .text { font-size: 16px; line-height: 1.4; }
.what .when { margin-top: 2px; color: var(--mut); font-size: 14px; }
.mini {
  position: relative;
  flex: none;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--raise);
  color: var(--fg);
  font-size: 14px;
  font-weight: 600;
}
.mini::before { content: ""; position: absolute; inset: -6px -4px; } /* a 44px tap target around the small pill */

/* ---- approval: a Muse-like sheet ---- */
.sheet { padding: 20px 16px 12px; }
.sheet .tag { margin-bottom: 12px; }
.ask { margin-bottom: 16px; font-size: 21px; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
.sheet .photo { width: min(100%, 128px); }
.rows { display: grid; grid-template-columns: auto 1fr; }
.rows dt, .rows dd { padding: 10px 0; border-top: 1px solid var(--line); font-size: 15px; line-height: 1.4; }
.rows dt:first-of-type, .rows dd:first-of-type { border-top: 0; }
.rows dt { padding-right: 16px; color: var(--mut); }
.rows dd { text-align: right; }
.rows dt.wide { grid-column: 1 / -1; padding-bottom: 2px; }
.rows dd.wide { grid-column: 1 / -1; padding-top: 0; border-top: 0; text-align: left; }
.rows .v { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.sum { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.sum .k { font-size: 15px; font-weight: 600; }
.sum .total { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.sheet .sum { margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.lines { margin-top: 12px; }
.lines p { margin-top: 4px; color: var(--mut); font-size: 14px; line-height: 1.45; }
.lines.text p { color: var(--fg); font-size: 15px; }
.fine { margin-top: 12px; color: var(--mut); font-size: 13px; text-align: center; }
.sheet .pri + .quiet { margin-top: 4px; }
.ended { text-align: center; }

.note { margin-top: 24px; color: var(--mut); font-size: 15px; text-align: center; }
