/* ============================================================
   FROST — app (v2)
   Phone first. The pine rail and the frosted frame arrive at 960px.
   ============================================================ */

input, select, textarea { font-size: 16px; } /* never under 16px: iOS zooms */

/* ---------- frame + shell ---------- */
.frame { min-height: 100vh; min-height: 100dvh; }
.shell { position: relative; }
.rail { display: none; }
.main { min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 4px;
  max-width: 1180px;
  margin: 0 auto;
}
.topbar .spacer { flex: 1 1 auto; }

.view {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 14px 16px calc(112px + env(safe-area-inset-bottom));
  max-width: 1180px;
  margin: 0 auto;
}

.tabbar {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  max-width: 560px;
  margin: 0 auto;
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  padding: 8px;
  background: var(--pine);
  border-radius: 30px;
  box-shadow: 0 16px 30px -14px rgba(20, 35, 28, 0.6);
}
:root[data-theme='dark'] .tabbar { border: 1px solid var(--pine-line); }
.tabbar button {
  min-height: 58px;
  border-radius: 22px;
  color: #E7EBE8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 500;
  min-width: 0;
}
.tabbar button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabbar svg { width: 21px; height: 21px; }
.tabbar button[aria-current='page'] { background: var(--pine-2); color: #fff; }
.tabbar :focus-visible { outline-color: var(--gold); outline-offset: -3px; }

@media (min-width: 960px) {
  .frame {
    background: var(--frame);
    padding: 32px 28px;
  }
  .shell {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--bg);
    border-radius: var(--r-shell);
    padding: 20px;
    display: flex;
    gap: 28px;
    box-shadow: 0 40px 80px -40px rgba(20, 35, 28, 0.45);
  }
  .rail {
    flex: 0 0 96px;
    align-self: flex-start;
    position: sticky;
    top: 52px;
    height: calc(100vh - 104px);
    height: calc(100dvh - 104px);
    min-height: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 0;
    background: var(--pine);
    border-radius: 32px;
  }
  :root[data-theme='dark'] .rail { border: 1px solid var(--pine-line); }
  .topbar, .tabbar { display: none; }
  .main { flex: 1 1 auto; padding: 16px 8px 8px 0; }
  .view { padding: 0; max-width: none; gap: 20px; }
}

/* ---------- rail ---------- */
.rail-logo {
  width: 60px; height: 60px;
  border-radius: 999px;
  border: 3px solid #5E6B63;
  background: #F5F4F0;
  color: var(--red);
  display: grid; place-items: center;
  margin-bottom: 26px;
  flex: none;
}
.rail-logo svg { width: 26px; height: 26px; stroke-width: 2; }
.rail-btn {
  position: relative;
  width: 64px; height: 64px;
  border-radius: 22px;
  color: #E7EBE8;
  display: grid; place-items: center;
  flex: none;
  transition: background var(--fast) var(--ease);
}
.rail-btn svg { width: 22px; height: 22px; }
.rail-btn[aria-current='page'],
.rail-btn[aria-pressed='true'] { background: var(--pine-2); color: #fff; }
.rail-gap { flex: 1 1 auto; }
.rail-year {
  width: 60px; height: 60px;
  margin-top: 8px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  flex: none;
}
.rail :focus-visible { outline-color: var(--gold); }
@media (hover: hover) {
  .rail-btn:hover { background: color-mix(in srgb, var(--pine-2) 70%, transparent); }
}
@media (min-width: 960px) and (max-height: 760px) {
  .rail { gap: 4px; padding: 14px 0; min-height: 0; }
  .rail-logo { margin-bottom: 10px; width: 52px; height: 52px; }
  .rail-btn { width: 56px; height: 52px; }
}

/* stale-backup dot */
.is-stale::after {
  content: '';
  position: absolute;
  top: 9px; right: 9px;
  width: 9px; height: 9px;
  border-radius: 999px;
  background: var(--red);
  box-shadow: 0 0 0 2px var(--raised);
}
.rail .is-stale::after { box-shadow: 0 0 0 2px var(--pine); }

/* ---------- top bar (phones, tablets) ---------- */
.logo-btn {
  width: 48px; height: 48px;
  border-radius: 999px;
  background: var(--pine);
  color: var(--gold);
  display: grid; place-items: center;
  flex: none;
}
.logo-btn svg { width: 21px; height: 21px; stroke-width: 2; }
.yearbtn {
  min-height: 48px;
  padding: 0 14px 0 16px;
  border-radius: 999px;
  background: var(--raised);
  font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
}
.yearbtn svg { width: 15px; height: 15px; }

/* ---------- circle buttons ---------- */
.circle {
  position: relative;
  width: 48px; height: 48px;
  border-radius: 999px;
  background: var(--raised);
  color: var(--ink);
  display: inline-grid; place-items: center;
  flex: none;
  text-decoration: none;
}
.circle svg { width: 20px; height: 20px; }
.circle[aria-pressed='true'], .circle[aria-current='page'] { background: var(--primary); color: var(--on-primary); }
.circle--ghost { background: transparent; width: 44px; height: 44px; }
.circle--lg { width: 56px; height: 56px; }
.circle--lg svg { width: 22px; height: 22px; }
@media (min-width: 960px) { .circle--lg { width: 72px; height: 72px; } }
.card--pine .circle--ghost, .card--red .circle--ghost { color: inherit; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 22px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  background: var(--raised);
  color: var(--ink);
  text-decoration: none;
  transition: transform var(--fast) var(--ease), background var(--fast) var(--ease);
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:active { transform: scale(0.98); }
.btn--dark, .btn.primary { background: var(--primary); color: var(--on-primary); }
.btn--light { background: var(--raised); color: var(--ink); }
.card--pine .btn--light, .card--red .btn--light { background: #fff; color: #14231C; }
.card--gold .btn--dark { background: #14231C; color: #fff; }
.btn--lg { min-height: 56px; font-size: 16px; }
@media (min-width: 960px) { .btn--lg { min-height: 72px; padding: 0 30px; font-size: 18px; } }
.btn--sm { min-height: 44px; padding: 0 16px; font-size: 14px; }
.btn--full, .btn.full { width: 100%; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red-ink); }
.btn.danger-fill { background: var(--red); color: #fff; }
.btn:disabled { opacity: 0.6; cursor: default; }

/* ---------- headline ---------- */
.dash-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 16px 20px;
}
.dash-head .headline { flex: 1 1 520px; }
.headline {
  font-size: clamp(36px, 5.2vw, 66px);
  line-height: 1.07;
  font-weight: 500;
  letter-spacing: -0.04em;
  overflow-wrap: anywhere;
}
.headline--md { font-size: clamp(34px, 4.4vw, 54px); }
.hchip {
  display: inline-flex;
  vertical-align: middle;
  align-items: center;
  justify-content: center;
  width: 1.18em;
  height: 0.73em;
  margin: -0.14em 0.04em 0;
  border-radius: 999px;
  background: var(--raised);
  color: var(--ink);
}
.hchip svg { width: 0.36em; height: 0.36em; stroke-width: 1.8; }
.hchip--gold { background: var(--gold); color: var(--on-gold); }
.hchip--red { background: var(--red); color: #fff; }
.hchip--text { font-size: 0.3em; width: 3.9em; height: 2.45em; margin: -0.4em 0.14em 0; font-weight: 600; letter-spacing: 0; }
.head-actions { display: flex; align-items: center; gap: 12px; }
@media (max-width: 599px) {
  .hl-br { display: none; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1 1 auto; }
}

/* ---------- pills: person chips, filters, picks ---------- */
.pchips { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 599px) {
  .pchips {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin: 0 -16px;
    padding: 2px 16px;
    scrollbar-width: none;
  }
  .pchips::-webkit-scrollbar { display: none; }
  .pchips > * { flex: none; }
}
.pchip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--raised);
  color: var(--ink);
  font-size: 15px;
  white-space: nowrap;
}
@media (min-width: 960px) { .pchips .pchip { min-height: 56px; padding: 0 22px; font-size: 16px; } }
.pchip svg { width: 16px; height: 16px; }
.pchip .dot { width: 8px; height: 8px; border-radius: 999px; background: var(--red); }
.pchip--on, .pchip[aria-pressed='true'], .pchip[aria-checked='true'] { background: var(--primary); color: var(--on-primary); }
.pchip--add { background: transparent; border: 1.5px dashed var(--dash); }
.pchip--add[aria-checked='true'] { border-style: solid; border-color: var(--primary); }
.pchip--new { width: 48px; padding: 0; justify-content: center; background: transparent; border: 1.5px dashed var(--dash); }
@media (min-width: 960px) { .pchips .pchip--new { width: 56px; } }
.pchip-n {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--sunk);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}
.pchip[aria-pressed='true'] .pchip-n { background: var(--pine-2); color: #fff; }
:root[data-theme='dark'] .pchip[aria-pressed='true'] .pchip-n { background: var(--card); color: var(--ink); }
.chipset { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chipset--center { justify-content: center; }
.filters { margin-top: 0; }
@media (max-width: 599px) {
  .filters { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 2px 16px; scrollbar-width: none; }
  .filters > * { flex: none; }
}

/* legacy chips inside sheets */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--raised);
  border: 1.5px solid var(--line);
  font-size: 14px;
}
.chip[aria-pressed='true'] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.chips.datechips { margin-top: 10px; }

/* ---------- card ---------- */
.row3, .row2 { display: flex; flex-wrap: wrap; gap: 16px; }
.row3 > .card { flex: 1 1 280px; }
.row2 { align-items: flex-start; }
.card--wide { flex: 999 1 560px; }
.side { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 959px) { .side { flex-basis: 100%; } }

.card {
  min-width: 0;
  background: var(--card);
  border-radius: var(--r-card);
  padding: 22px 24px 24px;
}
.card--pine { background: var(--pine); color: var(--on-dark); }
:root[data-theme='dark'] .card--pine { border: 1px solid var(--pine-line); }
.card--red { background: var(--red); color: #fff; }
.card--gold { background: var(--gold); color: var(--on-gold); }
.card--pine :focus-visible, .card--red :focus-visible { outline-color: var(--gold); }
@media (max-width: 599px) {
  .card { padding: 18px 18px 20px; border-radius: 30px; }
}

.card-head { display: flex; align-items: center; gap: 14px; }
.card-head h2 { flex: 1 1 auto; font-size: 18px; letter-spacing: -0.01em; }
.card-head .h-lg { font-size: 30px; letter-spacing: -0.03em; }
@media (max-width: 599px) { .card-head .h-lg { font-size: 24px; } .card-head { gap: 10px; flex-wrap: wrap; } }
.card-head .circle--ghost { margin: -6px -10px -6px 0; }
.card-sub { margin-top: 12px; }

.tile {
  width: 52px; height: 52px;
  flex: none;
  border-radius: var(--r-tile);
  background: var(--raised);
  color: var(--ink);
  display: inline-grid; place-items: center;
}
.tile svg { width: 22px; height: 22px; }
.tile--red { background: var(--red); color: #fff; }
.tile--white { background: #fff; color: var(--red); }
.tile--pine { background: var(--pine-2); color: #fff; }
@media (max-width: 599px) {
  .tile { width: 44px; height: 44px; border-radius: 14px; }
  .tile svg { width: 20px; height: 20px; }
}

.count {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--pine-2);
  font-size: 13px;
  font-weight: 600;
}

.bigfig { display: flex; align-items: flex-end; gap: 10px; margin-top: 20px; }
.fig { font-size: 72px; line-height: 0.9; font-weight: 300; letter-spacing: -0.045em; }
@media (max-width: 599px) { .fig { font-size: 60px; } }
.fig-side { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding-bottom: 6px; }
.of { font-size: 16px; color: var(--ink-2); }
.card--red .of { color: var(--red-soft); }
.tag {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.tag--gold { background: var(--gold); color: var(--on-gold); }
.tag--white { background: #fff; color: #14231C; }
.tag--red { background: var(--red); color: #fff; }
.tag--btn { background: var(--primary); color: var(--on-primary); padding: 0 14px; min-height: 36px; }

/* capsules */
.caps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  margin-top: 14px;
}
.cap { width: 8px; height: 44px; border-radius: 999px; flex: none; }
@media (max-width: 599px) { .cap { width: 7px; height: 40px; } }
.cap--spent { background: var(--ink); }
.cap--tobuy { background: var(--gold-deep); }
.cap--over { background: var(--red); }
.cap--spare, .cap--empty { border: 1.5px dashed var(--dash); }
.cap-line { width: 2px; height: 56px; background: var(--ink); flex: none; }
.card--red .cap--given { background: #14231C; }
.card--red .cap--wrapped { background: #fff; }
.card--red .cap--bought { background: var(--gold); }
.card--red .cap--idea { border: 1.5px dashed var(--red-dash); }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--ink-2);
}
.legend > span { display: inline-flex; align-items: center; }
.lg { display: inline-block; width: 8px; height: 8px; border-radius: 999px; margin-right: 6px; flex: none; }
.lg--spent { background: var(--ink); }
.lg--tobuy { background: var(--gold-deep); }
.lg--over { background: var(--red); }
.lg--spare { border: 1.5px dashed var(--ink-2); }
.lg--tick { width: 2px; height: 12px; border-radius: 0; background: var(--ink); }
.lg--given { background: #14231C; }
.lg--wrapped { background: #fff; }
.lg--bought { background: var(--gold); }
.lg--idea { border: 1.5px dashed var(--red-dash); }

.counts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 12px;
}
.counts span { display: flex; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--red-soft); }
.counts b { flex: 1 0 100%; font-size: 22px; font-weight: 400; color: #fff; }

.card-foot { margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.card--red .card-foot { color: var(--red-soft); }
.card--pine .card-foot { color: var(--on-dark-2); }
.card--red .btn { margin-top: 12px; }
.card-empty { margin-top: 12px; }
.card-empty p { color: var(--ink-2); font-size: 14px; }
.card-empty .btn { margin-top: 12px; }

/* ---------- needs a look ---------- */
.nrows { margin-top: 10px; }
.nrow {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  padding: 6px 0;
  text-align: left;
  border-bottom: 1px solid var(--pine-line);
}
.nrow:last-child { border-bottom: 0; }
.nrow-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.nrow-text b { font-weight: 500; }
.nrow-text small { font-size: 13px; color: var(--on-dark-2); overflow: hidden; text-overflow: ellipsis; }
.nrow--more { color: var(--on-dark-2); }
.nrow--more svg { width: 16px; height: 16px; }
.needs-empty { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.needs-empty p { color: var(--on-dark-2); font-size: 14px; }

/* ---------- pills ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  flex: none;
}
.pill--over { background: var(--red); color: #fff; }
.pill--ok { background: var(--raised); color: var(--ink); }
.pill--plain { background: var(--sunk); color: var(--ink); font-weight: 500; }
.pill--soft { background: var(--pine-2); color: #fff; }
.pill--sunk {
  background: var(--sunk);
  color: var(--ink);
  font-size: 15px;
  font-weight: 400;
  min-height: 44px;
  padding: 0 16px;
}
@media (max-width: 599px) { .pill--sunk { font-size: 14px; min-height: 38px; padding: 0 13px; } }

/* ---------- people rows + slim bars ---------- */
.prows { margin-top: 6px; }
.prow {
  display: grid;
  grid-template-columns: 44px minmax(0, 160px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 68px;
  padding: 10px 0;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.prow:last-child { border-bottom: 0; }
.avatar {
  width: 44px; height: 44px;
  border-radius: 999px;
  background: var(--raised);
  display: inline-grid; place-items: center;
  font-weight: 600;
  font-size: 15px;
}
.prow-name { display: flex; flex-direction: column; min-width: 0; }
.prow-name b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow-name small { font-size: 13px; color: var(--ink-2); }
.prow .pill { justify-self: end; }
.prow--hidden { opacity: 0.75; }
.prow--hidden .btn { justify-self: end; grid-column: 3 / -1; }
@media (max-width: 699px) {
  .prow {
    grid-template-columns: 36px minmax(0, 1fr) auto;
    gap: 6px 10px;
  }
  .prow .avatar { width: 36px; height: 36px; font-size: 14px; }
  .prow .bar { grid-column: 1 / -1; grid-row: 2; margin-top: 6px; }
  .prow--hidden .btn { grid-column: 1 / -1; justify-self: start; }
}

.bar {
  position: relative;
  display: flex;
  height: 6px;
  border-radius: 999px;
  background: var(--line);
}
.bar i { display: block; height: 100%; }
.bar i:first-of-type { border-top-left-radius: 999px; border-bottom-left-radius: 999px; }
.bar i:last-of-type { border-top-right-radius: 999px; border-bottom-right-radius: 999px; }
.bar-s { background: var(--ink); }
.bar-t { background: var(--gold-deep); }
.bar-o { background: var(--red); }
.bar-tick {
  position: absolute;
  top: -6px;
  width: 2px; height: 18px;
  margin-left: -1px;
  background: var(--ink);
}

.linkrow {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  color: var(--ink-2);
  font-size: 14px;
  text-align: left;
}
.linkrow svg { width: 16px; height: 16px; }

/* ---------- spending rows ---------- */
.srows { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.srow { display: block; width: 100%; text-align: left; padding: 8px 0; min-height: 48px; }
.srow-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 15px; }
.srow .bar { margin-top: 8px; }

/* ---------- cards ---------- */
.ratio { font-size: 15px; color: var(--ink-2); white-space: nowrap; }
.ratio b { font-size: 30px; font-weight: 300; letter-spacing: -0.03em; color: var(--ink); margin-right: 4px; }
.cchip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1.5px dashed var(--dash);
  font-size: 14px;
}
.cchip svg { width: 14px; height: 14px; stroke-width: 2.4; }
.cchip.is-sent { background: var(--primary); color: var(--on-primary); border: 1.5px solid var(--primary); }

/* ---------- checklist card ---------- */
.checkcard { position: relative; overflow: hidden; min-height: 230px; }
.bauble {
  position: absolute;
  right: -34px; top: -20px;
  width: 150px; height: 180px;
  color: #14231C;
  pointer-events: none;
}
.checkcard-body { position: relative; }
.checkcard h2 { font-size: 24px; line-height: 1.15; letter-spacing: -0.02em; max-width: calc(100% - 112px); }
.checkcard p { margin-top: 8px; font-size: 14px; max-width: calc(100% - 112px); }
.checkcard .btn { margin-top: 18px; }
.checkcard .kicker { margin: 0; font-size: 13px; font-weight: 600; }
.next-job { display: flex; align-items: center; gap: 10px; margin-top: 10px; max-width: calc(100% - 96px); }
.next-job b { display: block; font-size: 17px; font-weight: 500; }
.next-job small { display: block; font-size: 13px; }
.next-job small.late { color: #7A1219; font-weight: 600; }

/* ---------- ticks ---------- */
.tickbtn {
  width: 44px; height: 44px;
  flex: none;
  display: inline-grid; place-items: center;
}
.tick {
  width: 28px; height: 28px;
  border: 2px solid currentColor;
  border-radius: 9px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: background var(--fast) var(--ease);
}
.tick.on { background: var(--primary); border-color: var(--primary); stroke: var(--on-primary); }
.card--gold .tick.on { background: #14231C; border-color: #14231C; stroke: #fff; }

/* ---------- list rows (cards, checklist) ---------- */
.lrows { display: flex; flex-direction: column; }
.lrow {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  border-bottom: 1px solid var(--line);
}
.lrow:last-child { border-bottom: 0; }
.lrow-body { flex: 1 1 auto; min-width: 0; text-align: left; display: flex; flex-direction: column; padding: 8px 0; min-height: 48px; justify-content: center; }
.lrow-body b { font-weight: 500; }
.lrow-body small { font-size: 13px; color: var(--ink-2); }
.lrow-body small.late { color: var(--red-ink); font-weight: 600; }
.lrow-body small.soon { color: var(--ink); font-weight: 600; }
.lrow.is-done .lrow-body b { text-decoration: line-through; color: var(--ink-2); }

/* ---------- add forms ---------- */
.addform {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-top: 16px;
  padding: 12px;
  border-radius: 24px;
  background: var(--sunk);
}
.card > .addform:first-child { margin-top: 0; }
.af-field { flex: 1 1 120px; display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.af-field > span { padding-left: 6px; }
.af-field--grow { flex: 2 1 200px; }
.af-field--date { flex: 1 1 190px; }
.af-field input { border-color: transparent; }
.addform .btn { flex: none; min-height: 48px; }
@media (max-width: 599px) { .addform .btn { flex: 1 1 100%; } }

/* ---------- page header ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.page-head .spacer { flex: 1 1 auto; }
.page-title { font-size: clamp(34px, 4vw, 48px); letter-spacing: -0.035em; }

/* ---------- person / category page ---------- */
.detail-top { display: flex; flex-wrap: wrap; gap: 16px; }
.detail-top > .card { flex: 1 1 320px; }
.nudge h2 { font-size: 22px; line-height: 1.2; letter-spacing: -0.02em; }
.nudge p { margin-top: 8px; color: var(--on-dark-2); }
.nudge .btn { margin-top: 18px; }

.gifts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 16px; }
.gift {
  position: relative;
  background: var(--card);
  border-radius: 30px;
  padding: 16px 16px 18px;
  overflow: hidden;
}
.gift-top { display: flex; align-items: center; gap: 12px; }
.tile--st { width: 44px; height: 44px; border-radius: 14px; }
.tile--st svg { width: 20px; height: 20px; }
.tile--st[data-s='bought'] { background: var(--gold); color: var(--on-gold); }
.tile--st[data-s='wrapped'] { color: var(--red); }
.tile--st[data-s='given'] { background: var(--primary); color: var(--on-primary); }
.gift-name { flex: 1 1 auto; min-width: 0; text-align: left; display: flex; flex-direction: column; min-height: 44px; justify-content: center; }
.gift-name b { font-size: 18px; font-weight: 500; overflow-wrap: anywhere; }
.gift-name small { font-size: 13px; color: var(--ink-2); }
.gift-price { text-align: right; flex: none; }
.gift-price b { display: block; font-size: 26px; font-weight: 300; letter-spacing: -0.03em; line-height: 1; }
.gift-price small { font-size: 12px; color: var(--ink-2); }
.gift.is-returned .gift-name b { text-decoration: line-through; color: var(--ink-2); }

.seg { display: grid; gap: 6px; margin-top: 14px; }
.seg--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.seg--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.seg-b {
  min-height: 48px;
  border-radius: 999px;
  border: 1.5px dashed var(--dash);
  font-size: 13px;
  color: var(--ink);
  padding: 0 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.seg-b.is-past { border: 1.5px solid transparent; background: var(--past); }
.seg-b[aria-pressed='true'] { border: 1.5px solid transparent; background: var(--primary); color: var(--on-primary); font-weight: 500; }
.seg--4 .seg-b:last-child[aria-pressed='true'] { background: var(--red); color: #fff; }

/* ---------- empty states ---------- */
.card.empty { text-align: center; padding: 30px 24px; }
.card.empty h2 { font-size: 26px; margin-top: 10px; }
.card.empty p { color: var(--ink-2); max-width: 48ch; margin: 8px auto 0; }
.art { display: block; width: 168px; height: 124px; margin: 0 auto; }

.rollover h2 { font-size: 26px; }
.rollover p { color: var(--on-dark-2); margin: 6px 0 16px; }

/* ---------- settings ---------- */
.set-head { font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 4px; }
.set-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: 0; }
.set-row--boxed { background: var(--card); border-radius: 20px; padding: 14px 16px; border: 0; margin-top: 16px; }
.set-text { flex: 1 1 260px; display: flex; flex-direction: column; gap: 2px; }
.set-label { font-weight: 500; }
.set-desc { font-size: 13px; color: var(--ink-2); }
.set-control { flex: none; }
.set-control select { width: auto; min-width: 150px; }
.set-note { color: var(--ink-2); font-size: 14px; margin: 6px 0 14px; }
.colophon { text-align: center; color: var(--ink-2); font-size: 13px; padding: 4px 0 8px; }

.switch {
  position: relative;
  width: 52px; height: 32px;
  border-radius: 999px;
  background: var(--line);
  transition: background var(--fast) var(--ease);
}
.switch::before { content: ''; position: absolute; inset: -7px -4px; }
.switch i {
  position: absolute;
  top: 3px; left: 3px;
  width: 26px; height: 26px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform var(--fast) var(--ease);
}
.switch[aria-checked='true'] { background: var(--primary); }
.switch[aria-checked='true'] i { transform: translateX(20px); }
:root[data-theme='dark'] .switch[aria-checked='true'] i { background: #14231C; }

.drows { display: flex; flex-direction: column; gap: 8px; }
.drow {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 64px;
  padding: 10px 14px;
  border-radius: 22px;
  background: var(--raised);
  text-align: left;
}
.sheet .drow { background: var(--card); }
.drow .tile { width: 44px; height: 44px; border-radius: 14px; background: var(--sunk); }
.sheet .drow .tile { background: var(--raised); }
.drow .tile svg { width: 20px; height: 20px; }
.drow-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.drow-text b { font-weight: 500; }
.drow-text small { font-size: 13px; color: var(--ink-2); }
.drow > svg { width: 18px; height: 18px; color: var(--ink-2); flex: none; }
.drow[aria-current='true'] { background: var(--primary); color: var(--on-primary); }
.drow[aria-current='true'] small, .drow[aria-current='true'] > svg { color: inherit; opacity: 0.75; }

/* ---------- date field ---------- */
.datefield {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 14px;
  background: var(--raised);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  color: var(--ink-2);
  font-size: 16px;
  font-weight: 400;
  cursor: pointer;
}
.af-field .datefield { border-color: transparent; }
.datefield input[type='date'] {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  border: 0;
  margin: 0;
  padding: 0;
}
.datefield.is-set { color: var(--ink); }
.df-icon { display: inline-grid; place-items: center; }
.df-icon svg { width: 18px; height: 18px; }
.datefield:focus-within { border-color: var(--ink); }

/* ---------- sheets ---------- */
dialog.sheet {
  border: 0;
  padding: 0;
  color: var(--ink);
  background: var(--bg);
  width: 100%;
  max-width: 100%;
  max-height: 92dvh;
  margin: auto 0 0;
  border-radius: 30px 30px 0 0;
  overflow: auto;
  overscroll-behavior: contain;
}
dialog.sheet::backdrop { background: rgba(10, 18, 14, 0.5); }
@media (min-width: 640px) {
  dialog.sheet { margin: auto; max-width: 520px; border-radius: 32px; max-height: 88vh; }
}
.sheet-inner { padding: 26px 22px calc(22px + env(safe-area-inset-bottom)); }
.sheet h3 { font-size: 26px; font-weight: 500; letter-spacing: -0.03em; }
.sheet .lede { color: var(--ink-2); margin-top: 6px; }
.field { margin-top: 16px; }
.field label, .flabel { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field-pair { display: flex; gap: 10px; }
.field-pair > .field { flex: 1 1 0; min-width: 0; }
.field-err { color: var(--red-ink); font-size: 13px; margin-top: 6px; }
input[aria-invalid] { border-color: var(--red) !important; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; justify-content: flex-end; }
.sheet-actions .btn { flex: 1 1 auto; }
.menu-head { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); margin: 18px 0 8px; }
.confirm-warn {
  display: flex; gap: 10px; align-items: flex-start;
  margin-top: 14px; padding: 12px 14px;
  border-radius: 16px;
  background: var(--warn-bg); color: var(--warn-ink);
  font-size: 14px;
}
.confirm-warn svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.confirm-mark { width: 52px; height: 52px; border-radius: 16px; background: var(--red); color: #fff; display: grid; place-items: center; margin-bottom: 14px; }
.confirm-mark svg { width: 24px; height: 24px; }
.sheet input[type='text'][readonly] { margin-top: 10px; }

/* ---------- toasts ---------- */
.toasts {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(104px + env(safe-area-inset-bottom));
  z-index: 1000;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 0 16px;
  pointer-events: none;
}
@media (min-width: 960px) { .toasts { bottom: 28px; } }
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 12px;
  max-width: min(520px, 100%);
  padding: 12px 12px 12px 18px;
  border-radius: 20px;
  background: #14231C;
  color: #fff;
  font-size: 14px;
  box-shadow: 0 16px 30px -12px rgba(0, 0, 0, 0.5);
  animation: toast-in 260ms var(--ease) both;
}
:root[data-theme='dark'] .toast { border: 1px solid #2C4236; }
.toast.warn { background: var(--red); }
.toast .btn.ghost { min-height: 36px !important; padding: 0 14px; color: #fff; border: 1.5px solid rgba(255, 255, 255, 0.55); background: transparent; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- motion ---------- */
.boot .reveal { animation: rise 520ms var(--ease) both; animation-delay: var(--d, 0ms); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.sweep::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--gold) 45%, transparent) 50%, transparent 70%);
  animation: sweep 520ms var(--ease) both;
  pointer-events: none;
}
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.settle { animation: settle 420ms var(--ease); display: inline-block; }
@keyframes settle { 40% { transform: scale(1.08); } }
.shake { animation: shake 420ms var(--ease); }
@keyframes shake { 20%, 60% { transform: translateX(-3px); } 40%, 80% { transform: translateX(3px); } }
#snow { position: fixed; inset: 0; pointer-events: none; z-index: 2000; }

#printsheet { display: none; }

.page-head .pill--sunk { background: var(--raised); }

/* the smallest phones (iPhone SE 1st gen, small Androids) */
@media (max-width: 374px) {
  .topbar { gap: 5px; padding-left: 12px; padding-right: 12px; }
  .topbar .circle, .logo-btn { width: 44px; height: 44px; }
  .yearbtn { min-height: 44px; padding: 0 10px 0 12px; }
  .view { padding-left: 12px; padding-right: 12px; }
  .pchips, .filters { margin: 0 -12px; padding: 2px 12px; }
  .card { padding: 16px 14px 18px; }
}

.pchip--new.pchip--label { width: auto; padding: 0 20px; }

/* ---- 2.0.1: long names never push past the edge ----
   Names may be up to 120 characters, task text 200. At 320px a long
   card name, job or shop ran off the card and was clipped. */
.cchip { max-width: 100%; text-align: left; overflow-wrap: anywhere; }
.next-job > span { min-width: 0; }
.next-job b, .lrow-body b, .lrow-body small, .nudge h2, .sheet h3,
.gift-name small, .nrow-text b, .prow-name small { overflow-wrap: anywhere; }
.lrow-body { min-width: 0; }
.bigfig { flex-wrap: wrap; row-gap: 6px; }
.sugg-head { margin-top: 18px; font-size: 13px; color: var(--ink-2); }
.sugg-head + .chipset { margin-top: 8px; }

/* "Wrapped" was cut to "Wrapp…" on the smallest phones */
@media (max-width: 374px) {
  .seg { gap: 4px; }
  .seg-b { font-size: 12px; padding: 0 2px; letter-spacing: -0.01em; }
}

/* ============================================================
   2.0.2
   ============================================================ */

/* ---- light rail in light mode ----
   The pine rail was the darkest thing on a light page. In light mode
   it is now a frosted panel; at night it stays pine. */
:root:not([data-theme='dark']) .rail { background: var(--card); }
:root:not([data-theme='dark']) .rail-btn { color: var(--ink-2); }
:root:not([data-theme='dark']) .rail-btn[aria-current='page'],
:root:not([data-theme='dark']) .rail-btn[aria-pressed='true'] { background: var(--primary); color: var(--on-primary); }
:root:not([data-theme='dark']) .rail-logo { border-color: var(--line); background: var(--raised); }
:root:not([data-theme='dark']) .rail .is-stale::after { box-shadow: 0 0 0 2px var(--card); }
:root:not([data-theme='dark']) .rail :focus-visible { outline-color: var(--ink); }
@media (hover: hover) {
  :root:not([data-theme='dark']) .rail-btn:not([aria-current='page']):not([aria-pressed='true']):hover { background: var(--raised); color: var(--ink); }
}

/* ---- sheets stand off the page at night ----
   In dark mode the sheet was the page colour, so it vanished into it. */
:root[data-theme='dark'] dialog.sheet {
  background: var(--raised);
  box-shadow: 0 0 0 1px var(--line), 0 -20px 60px rgba(0, 0, 0, 0.55);
}
:root[data-theme='dark'] dialog.sheet::backdrop { background: rgba(0, 0, 0, 0.72); }
:root[data-theme='dark'] .sheet .drow { background: var(--card); }
:root[data-theme='dark'] .sheet .drow .tile { background: var(--raised); }
/* fields and chips sit a step darker than the raised sheet */
:root[data-theme='dark'] .sheet input:not([type='date']),
:root[data-theme='dark'] .sheet textarea,
:root[data-theme='dark'] .sheet select,
:root[data-theme='dark'] .sheet .datefield,
:root[data-theme='dark'] .sheet .pchip:not([aria-checked='true']):not(.pchip--add),
:root[data-theme='dark'] .sheet .chip:not([aria-pressed='true']),
:root[data-theme='dark'] .sheet .btn--light,
:root[data-theme='dark'] .sheet .btn:not(.btn--dark):not(.primary):not(.danger-fill):not(.ghost) { background: var(--card); }
:root[data-theme='dark'] .sheet .drow[aria-current='true'] { background: var(--primary); }

/* ---- phone header: print joins the round buttons up top, and
   "Add a gift" becomes a full-width gold bar, squarer than the pill
   chips under it so the two never read as one row of tabs ---- */
@media (max-width: 959px) { .head-print { display: none; } }
@media (max-width: 599px) {
  .btn--add {
    width: 100%;
    min-height: 56px;
    border-radius: 18px;
    background: var(--gold);
    color: var(--on-gold);
    font-weight: 600;
    box-shadow: inset 0 -2px 0 rgba(20, 35, 28, 0.12);
  }
  :root[data-theme='dark'] .btn--add { background: var(--gold); color: #14231C; }
}
/* four round buttons now share the bar with the logo and the year */
@media (max-width: 599px) {
  .topbar { gap: 6px; }
  .topbar .circle, .topbar .logo-btn { width: 44px; height: 44px; }
  .topbar .yearbtn { min-height: 44px; padding: 0 10px 0 14px; }
}
@media (max-width: 374px) { .topbar .logo-btn { display: none; } }

/* ---- the overview's view switch ---- */
.dash-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.dash-bar .pchips { flex: 1 1 400px; min-width: 0; }
.viewswitch {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  border-radius: 999px;
  background: var(--card);
  flex: none;
}
.viewswitch button {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 16px;
  border-radius: 999px;
  font-size: 14px; font-weight: 500;
  color: var(--ink-2);
}
.viewswitch svg { width: 17px; height: 17px; }
.viewswitch [aria-pressed='true'] { background: var(--raised); color: var(--ink); box-shadow: 0 1px 3px rgba(20, 35, 28, 0.12); }
@media (min-width: 960px) { .viewswitch button { min-height: 48px; } }
@media (max-width: 599px) {
  .dash-bar { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 12px; }
  .dash-bar .pchips { flex: none; }
  .viewswitch { display: flex; }
  .viewswitch button { flex: 1 1 0; justify-content: center; }
}

/* ---- backup reminder ---- */
.backupbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px;
  padding: 14px 16px;
  border-radius: var(--r-card-sm);
  background: color-mix(in srgb, var(--gold) 22%, var(--bg));
  border: 1.5px solid var(--gold-deep);
}
.backupbar .tile--gold { background: var(--gold); color: var(--on-gold); }
.backupbar p { flex: 1 1 260px; display: flex; flex-direction: column; font-size: 14px; }
.backupbar p b { font-weight: 600; font-size: 15px; }
.backupbar p span { color: var(--ink-2); }
.backupbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 599px) { .backupbar-actions { width: 100%; } .backupbar-actions .btn { flex: 1 1 auto; } }
:root[data-theme='dark'] .backupbar { background: color-mix(in srgb, var(--gold) 12%, var(--bg)); }
.is-stale::after { animation: stale-pulse 2.4s var(--ease) 3; }
@keyframes stale-pulse { 50% { transform: scale(1.5); } }
@media (prefers-reduced-motion: reduce) { .is-stale::after { animation: none; } }

/* ---- the table view ---- */
.tcard { padding-bottom: 20px; }
.tcard .card-head { flex-wrap: wrap; }
.t-note { font-size: 13px; }
.t-wrap { margin-top: 12px; overflow-x: auto; }
.otable { width: 100%; border-collapse: collapse; font-size: 14px; }
.otable th, .otable td { text-align: left; vertical-align: middle; padding: 10px 10px; border-bottom: 1px solid var(--line); }
.otable thead th { font-size: 12px; font-weight: 600; color: var(--ink-2); padding-top: 4px; white-space: nowrap; }
.otable tbody th { font-weight: 500; }
.otable .t-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.otable tfoot th, .otable tfoot td { border-bottom: 0; font-weight: 600; padding-top: 14px; }
.t-name { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; text-align: left; font-weight: 500; }
.t-name .avatar { width: 34px; height: 34px; font-size: 12px; flex: none; }
.t-giftcell { min-width: 220px; }
.t-gifts { display: flex; flex-wrap: wrap; gap: 6px; }
.t-gift {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--raised); font-size: 13px;
}
.t-gift i { width: 8px; height: 8px; border-radius: 999px; flex: none; }
.t-gift[data-s='idea'] i, .lg--tidea { border: 1.5px dashed var(--dash); }
.t-gift[data-s='bought'] i, .lg--tbought { background: var(--gold-deep); }
.t-gift[data-s='wrapped'] i, .lg--twrapped { background: var(--red); }
.t-gift[data-s='given'] i, .lg--tgiven { background: var(--ink); }
.t-gift[data-s='returned'] { text-decoration: line-through; color: var(--ink-2); }
.t-muted { color: var(--ink-2); font-size: 13px; }
.t-prog { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.t-prog b { font-weight: 600; }
.t-bar { width: 56px; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.t-bar i { display: block; height: 100%; background: var(--ink); border-radius: inherit; }
.t-card {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 12px; border-radius: 999px;
  border: 1.5px dashed var(--dash); font-size: 13px; white-space: nowrap;
}
.t-card svg { width: 14px; height: 14px; stroke-width: 2.4; }
.t-card.is-sent { background: var(--primary); color: var(--on-primary); border: 1.5px solid var(--primary); }
.tcard .legend { margin-top: 14px; }
@media (max-width: 759px) {
  /* each row becomes a block: name and what's left on top, the gifts,
     then the numbers as labelled pairs */
  .t-wrap { overflow: visible; }
  .otable, .otable tbody, .otable tfoot, .otable tr { display: block; }
  .otable thead { display: none; }
  .otable tr { padding: 12px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 10px; align-items: center; }
  .otable th, .otable td { border: 0; padding: 0; }
  .otable tbody th, .otable tfoot th { grid-column: 1 / 4; grid-row: 1; }
  .otable .t-left { grid-column: 4; grid-row: 1; justify-self: end; }
  .otable .t-left::before { display: none !important; }
  .otable .t-giftcell { grid-column: 1 / -1; min-width: 0; }
  .otable .t-c { font-size: 13px; }
  .otable .t-cardcell { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; }
  .otable .t-cardcell::before { margin: 0; }
  .otable .t-cardcell:has(.t-nocard) { display: none; }
  .otable .t-totleft { grid-column: 1 / -1; }
  .otable .t-totleft::before { display: none !important; }
  .t-bar { width: 40px; }
  .otable td[data-label]:not([data-label=''])::before {
    content: attr(data-label); display: block; font-size: 11px; font-weight: 600; color: var(--ink-2); text-align: left;
  }
  .otable .t-giftcell::before { display: none !important; }
  .otable .t-num { text-align: left; }
  .otable td:empty { display: none; }
  .otable tfoot tr { border-bottom: 0; }
}

/* ---- checklist card: the next job sat on a tall line ---- */
.next-job { align-items: flex-start; }
.next-job > span { padding-top: 6px; }
.next-job { max-width: calc(100% - 84px); }
.next-job b {
  font-size: 15px; line-height: 1.25;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.next-job small { margin-top: 2px; line-height: 1.3; }

/* long currency names must not push the settings row past a 320px phone */
.set-control { min-width: 0; max-width: 60%; }
.set-control select { max-width: 100%; text-overflow: ellipsis; }
@media (max-width: 400px) { .set-control select { min-width: 0; width: 100%; } }

/* ============================================================
   2.0.3
   ============================================================ */

/* The page width no longer changes when one screen needs a scrollbar
   and the next doesn't: that was the whole app shifting sideways. */
html { scrollbar-gutter: stable; }

/* ---- rail on short screens: everything stays inside the bar ---- */
@media (min-width: 960px) {
  .rail { overflow-y: auto; overflow-x: hidden; scrollbar-width: none; }
  .rail::-webkit-scrollbar { display: none; }
}
@media (min-width: 960px) and (max-height: 680px) {
  .rail { gap: 2px; padding: 10px 0; }
  .rail-logo { width: 44px; height: 44px; margin-bottom: 6px; border-width: 2px; }
  .rail-logo svg { width: 21px; height: 21px; }
  .rail-btn { width: 52px; height: 44px; border-radius: 16px; }
  .rail-btn svg { width: 20px; height: 20px; }
  .rail-year { width: 46px; height: 46px; margin-top: 4px; font-size: 14px; }
  .rail .is-stale::after { top: 6px; right: 10px; }
}
@media (min-width: 960px) and (max-height: 580px) {
  .rail-btn { height: 38px; }
  .rail-logo { width: 38px; height: 38px; }
  .rail-year { width: 40px; height: 40px; font-size: 13px; }
}

/* ---- a person's page: back arrow and title share a row ---- */
.detail-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px 16px;
}
.detail-head .headline { margin: 0; }
.detail-back { margin-top: calc((1.05 * clamp(34px, 4.4vw, 54px) - 48px) / 2); }
.detail-actions { display: flex; align-items: center; gap: 10px; }
@media (max-width: 759px) {
  .detail-head { grid-template-columns: auto minmax(0, 1fr); }
  .detail-actions { grid-column: 1 / -1; }
  .detail-actions .btn { flex: 1 1 auto; }
}

/* ---- a person's card ---- */
.pcard { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding-top: 18px; padding-bottom: 18px; }
.pcard-text { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; }
.pcard-text b { font-weight: 500; font-size: 17px; }
.pcard-text small { font-size: 13px; color: var(--ink-2); }
.t-card--add { color: var(--ink-2); }

/* ---- last year against this year ---- */
.compare { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); display: grid; gap: 10px; font-size: 14px; }
.compare dt { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.compare dd { margin: 2px 0 0; }
.compare dd b { font-weight: 600; }
.compare-note { color: var(--ink-2); }

/* ---- needs a look: the to-do row ---- */
.pill--todo { background: var(--gold); color: var(--on-gold); gap: 4px; }
.pill--todo svg { width: 14px; height: 14px; stroke-width: 2.4; }

/* ---- still to do ---- */
.page-lede { color: var(--ink-2); font-size: 15px; margin-top: -6px; }
.todo-sec .card-head h2 { flex: 1 1 auto; }
.lrow.todo .avatar { width: 40px; height: 40px; font-size: 13px; }
.lrow.todo .lrow-body small .sensitive { display: inline-block; }
.todo-go { flex: none; }
@media (max-width: 599px) { .lrow.todo .tickbtn ~ .todo-go { display: none; } }

/* ---- table: column lines as well as row lines ---- */
@media (min-width: 760px) {
  .otable th + th, .otable th + td, .otable td + td { border-left: 1px solid var(--line); }
  .otable thead th { padding-top: 8px; padding-bottom: 10px; }
}

/* ---- hiding amounts: blur grows with the type, so the big figures
   are as unreadable as the small ones ---- */
.blurred .fig.sensitive,
.blurred .fig .sensitive,
.blurred .headline .sensitive { filter: blur(0.3em); }

/* ---- hover and press ------------------------------------------------
   Every control answers the pointer in a way that reads against its OWN
   fill, so it works on any card and in both themes:
     light fills (white pills, raised buttons)  a ring drawn inside
     dark fills (primary, selected)              a lighter or darker wash
     see-through controls and rows               a wash behind them
     dashed controls                             the dash turns solid
   Pressing adds a deeper wash and a slight squeeze. No drop shadows.
   Rows wash edge to edge of their card, within their own height.
   ------------------------------------------------------------------- */
:root {
  --t-hov: 120ms;
  --hov: rgba(20, 35, 28, 0.07);
  --press: rgba(20, 35, 28, 0.14);
  --ring: rgba(20, 35, 28, 0.5);
  --hov-prim: rgba(255, 255, 255, 0.16);
  --press-prim: rgba(255, 255, 255, 0.28);
  --cx: 24px;
}
:root[data-theme='dark'] {
  --hov: rgba(255, 255, 255, 0.08);
  --press: rgba(255, 255, 255, 0.15);
  --ring: rgba(238, 242, 238, 0.55);
  --hov-prim: rgba(20, 35, 28, 0.12);
  --press-prim: rgba(20, 35, 28, 0.24);
}
/* surfaces that stay dark in both themes */
.card--pine, .card--red, .tabbar, .rail-year {
  --hov: rgba(255, 255, 255, 0.1);
  --press: rgba(255, 255, 255, 0.18);
  --ring: rgba(255, 255, 255, 0.7);
}
:root:not([data-theme='dark']) .rail { --hov: rgba(20, 35, 28, 0.07); --press: rgba(20, 35, 28, 0.14); }
:root[data-theme='dark'] .rail { --hov: rgba(255, 255, 255, 0.1); --press: rgba(255, 255, 255, 0.18); }
/* fixed white and fixed gold fills take an ink ring and wash */
.card--pine .btn--light, .card--red .btn--light, .needs-todo, .card--gold, .btn--add {
  --ring: rgba(20, 35, 28, 0.55); --hov: rgba(20, 35, 28, 0.08); --press: rgba(20, 35, 28, 0.16);
}
.card--gold .btn--dark { --hov-prim: rgba(255, 255, 255, 0.16); --press-prim: rgba(255, 255, 255, 0.28); }
@media (max-width: 599px) { .card { --cx: 18px; } }
@media (max-width: 374px) { .card { --cx: 14px; } }

.btn, .circle, .pchip, .cchip, .chip, .t-card, .tag--btn, .seg-b, .yearbtn, .logo-btn, .rail-logo, .rail-year, .rail-btn,
.viewswitch button, .tabbar button, .drow, .linkrow, .linkbtn, .switch, .df-btn, .cal-day, .needs-todo, select, .gift {
  transition: background-color var(--t-hov) ease, box-shadow var(--t-hov) ease, transform var(--t-hov) ease,
    color var(--t-hov) ease, border-color var(--t-hov) ease, opacity var(--t-hov) ease;
}
.viewswitch [aria-pressed='true'] { box-shadow: none; }
.switch i { box-shadow: none; }

/* pressed: squeeze, everywhere a finger or a mouse can press */
.btn:not(:disabled):active, .circle:active, .pchip:active, .cchip:active, .chip:active, .t-card:active,
.seg-b:active, .yearbtn:active, .viewswitch button:active, .tag--btn:active, .needs-todo:active,
.cal-day:active, .drow:active, .rail-btn:active, .tabbar button:active { transform: scale(0.97); }

/* rows: an edge-to-edge wash inside the row's own height */
.prow, .nrow, .srow, .lrow, .t-row { position: relative; isolation: isolate; }
.prow::after, .nrow::after, .srow::after, .lrow::after {
  content: ''; position: absolute; z-index: -1; pointer-events: none;
  top: 0; bottom: 0; left: calc(-1 * var(--cx)); right: calc(-1 * var(--cx));
  background: var(--hov); opacity: 0; transition: opacity var(--t-hov) ease;
}
.sheet .lrow::after { left: -22px; right: -22px; }
.prow:active::after, .nrow:active::after, .srow:active::after,
.lrow:has(> .lrow-body:active)::after { opacity: 1; background: var(--press); }

/* ticks: the mark shows faintly on hover, the box fills when done */
.tick:not(.on) { stroke: transparent; transition: stroke var(--t-hov) ease, background-color var(--t-hov) ease, border-color var(--t-hov) ease; }
.tickbtn:active .tick:not(.on) { background: var(--primary); border-color: var(--primary); stroke: var(--on-primary); }
.card--gold .tickbtn:active .tick:not(.on) { background: #14231C; border-color: #14231C; stroke: #fff; }

/* a gift card says it opens: the whole card rings, the name underlines */
.gift-name b { text-decoration: underline 1.5px transparent; text-underline-offset: 4px; transition: text-decoration-color var(--t-hov) ease; }
.gift-hint { display: inline-flex; align-items: center; gap: 5px; }
.gift-hint svg { width: 13px; height: 13px; }
.hint-mouse { display: none; }
@media (hover: hover) and (pointer: fine) { .hint-touch { display: none; } .hint-mouse { display: inline; } }
.gift:has(.gift-name:active) { box-shadow: inset 0 0 0 1.5px var(--ring), inset 0 0 0 999px var(--hov); }

@media (hover: hover) and (pointer: fine) {
  /* light fills: a ring inside the control */
  .btn:not(.btn--dark):not(.primary):not(.danger-fill):not(.ghost):not(:disabled):hover,
  .circle:not(.circle--ghost):not([aria-pressed='true']):not([aria-current='page']):hover,
  .pchip:not(.pchip--on):not(.pchip--add):not(.pchip--new):not([aria-pressed='true']):not([aria-checked='true']):hover,
  .chip:not([aria-pressed='true']):hover, .yearbtn:hover, .tag--btn:hover, .drow:not([aria-current='true']):hover,
  .df-btn:hover {
    box-shadow: inset 0 0 0 1.5px var(--ring);
  }
  .btn:not(.btn--dark):not(.primary):not(.danger-fill):not(.ghost):not(:disabled):active,
  .circle:not(.circle--ghost):not([aria-pressed='true']):active,
  .pchip:not(.pchip--on):not([aria-pressed='true']):active, .chip:not([aria-pressed='true']):active,
  .yearbtn:active, .tag--btn:active, .drow:not([aria-current='true']):active, .df-btn:active {
    box-shadow: inset 0 0 0 1.5px var(--ring), inset 0 0 0 999px var(--hov);
  }
  /* dark and selected fills: a wash */
  .btn--dark:not(:disabled):hover, .btn.primary:not(:disabled):hover, .btn.danger-fill:hover,
  .pchip--on:hover, .pchip[aria-pressed='true']:hover, .pchip[aria-checked='true']:hover, .chip[aria-pressed='true']:hover,
  .circle[aria-pressed='true']:hover, .circle[aria-current='page']:hover, .drow[aria-current='true']:hover,
  .seg-b[aria-pressed='true']:hover, .seg-b.is-past:hover, .t-card.is-sent:hover, .cchip.is-sent:hover,
  .cal-day[aria-pressed='true']:hover, .rail-btn[aria-current='page']:hover, .rail-btn[aria-pressed='true']:hover {
    box-shadow: inset 0 0 0 999px var(--hov-prim);
  }
  .btn--dark:not(:disabled):active, .btn.primary:not(:disabled):active, .pchip--on:active,
  .seg-b[aria-pressed='true']:active, .cal-day[aria-pressed='true']:active { box-shadow: inset 0 0 0 999px var(--press-prim); }
  .btn--add:hover, .needs-todo:hover { box-shadow: inset 0 0 0 999px var(--hov); }
  .btn--add:active, .needs-todo:active { box-shadow: inset 0 0 0 999px var(--press); }
  /* see-through controls: a wash */
  .circle--ghost:hover, .btn.ghost:hover, .viewswitch button:not([aria-pressed='true']):hover, .linkrow:hover,
  .cal-day:not([aria-pressed='true']):hover, .rail-btn:not([aria-current='page']):not([aria-pressed='true']):hover,
  .tabbar button:not([aria-current='page']):hover { background-color: var(--hov); box-shadow: none; }
  .circle--ghost:active, .btn.ghost:active, .viewswitch button:not([aria-pressed='true']):active, .linkrow:active,
  .cal-day:not([aria-pressed='true']):active, .rail-btn:active, .tabbar button:active { background-color: var(--press); }
  /* dashed controls: the dash turns solid */
  .pchip--add:hover, .pchip--new:hover, .cchip:not(.is-sent):hover, .t-card:not(.is-sent):hover,
  .seg-b:not([aria-pressed='true']):not(.is-past):hover {
    border-style: solid; border-color: var(--ink); background-color: var(--hov);
  }
  .card--pine .cchip:not(.is-sent):hover { border-color: #fff; }
  .rail-year:hover { box-shadow: inset 0 0 0 999px var(--hov); }
  .logo-btn:hover, .rail-logo:hover { transform: scale(1.06); }
  .switch:hover { box-shadow: 0 0 0 4px var(--hov); }
  select:hover { border-color: var(--ink-2); }
  .linkbtn:hover { color: var(--ink); }

  .prow:hover::after, .nrow:hover::after, .srow:hover::after, .lrow:has(> .lrow-body:hover)::after { opacity: 1; }
  .otable tbody tr:has(.t-name:hover) > * { background-color: var(--hov); }

  .gift:has(.gift-name:hover) { box-shadow: inset 0 0 0 1.5px var(--ring); }
  .gift-name:hover b { text-decoration-color: currentColor; }

  .tickbtn:hover .tick:not(.on) { stroke: var(--ink-2); border-color: var(--ink); }
  .card--gold .tickbtn:hover .tick:not(.on) { stroke: rgba(20, 35, 28, 0.55); }
  .tickbtn:hover .tick.on { box-shadow: inset 0 0 0 999px var(--hov-prim); }
}

/* ---- moving between screens and opening sheets: quick, small ---- */
.view-in > * { animation: view-in 240ms var(--ease) both; }
.view-in > :nth-child(2) { animation-delay: 25ms; }
.view-in > :nth-child(3) { animation-delay: 50ms; }
.view-in > :nth-child(n + 4) { animation-delay: 75ms; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } }
dialog.sheet[open] { animation: sheet-in 220ms var(--ease) both; }
dialog.sheet[open]::backdrop { animation: fade-in 220ms ease both; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(14px) scale(0.985); } }
@keyframes fade-in { from { opacity: 0; } }

/* ---- footer: who made it, and the terms ---- */
.appfoot {
  max-width: 1400px;
  margin: 0 auto;
  padding: 8px 20px calc(112px + env(safe-area-inset-bottom));
  text-align: center;
  font-size: 12px;
  line-height: 1.5;
  color: color-mix(in srgb, var(--ink) 72%, transparent);
}
.appfoot p + p { margin-top: 2px; }
.view { padding-bottom: 24px; }
@media (min-width: 960px) {
  .view { padding-bottom: 0; }
  .appfoot { padding: 18px 28px 0; color: color-mix(in srgb, var(--ink) 80%, transparent); }
}
.linkbtn { font: inherit; color: inherit; text-decoration: underline; text-underline-offset: 2px; display: inline-block; min-height: 44px; padding: 0 6px; margin: -14px -6px; vertical-align: middle; }
.terms p { margin-top: 12px; font-size: 15px; line-height: 1.45; }
.terms b { font-weight: 600; }

/* ---- date field + the app's own calendar ---- */
.datefield { padding: 0; }
.datefield .df-native { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; inset: auto; }
.df-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; min-height: 45px; padding: 0 14px;
  border-radius: 13px; color: inherit; font: inherit; text-align: left;
}
.df-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.sheet--cal .sheet-inner { padding-top: 22px; }
.cal { margin-top: 10px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.cal-title { font-size: 17px; font-weight: 600; }
.cal-next svg { transform: scaleX(-1); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-wd { text-align: center; font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 4px 0; }
.cal-day {
  aspect-ratio: 1; min-height: 40px; border-radius: 999px;
  display: grid; place-items: center;
  font-size: 15px; font-variant-numeric: tabular-nums; color: var(--ink);
  transition: background-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.cal-day.is-today { box-shadow: inset 0 0 0 1.5px var(--ink); font-weight: 600; }
.cal-day[aria-pressed='true'] { background: var(--primary); color: var(--on-primary); box-shadow: none; }
.cal-day:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 1px; }
@media (hover: hover) and (pointer: fine) {
  .cal-day:not([aria-pressed='true']):hover { background: var(--hov); }
  .df-btn:hover { box-shadow: inset 0 0 0 999px var(--hov); }
}
.sheet--cal .sheet-actions .btn { flex: 1 1 auto; }
@media (min-width: 960px) {
  /* the buttons give up height before anything falls out of the bar */
  .rail { min-height: 0; }
  .rail-btn { flex: 0 1 64px; height: auto; min-height: 36px; }
  .rail-gap { min-height: 8px; }
}
@media (min-width: 960px) and (max-height: 680px) { .rail-btn { flex-basis: 44px; } }
@media (min-width: 640px) { .cal-day { aspect-ratio: auto; height: 46px; } }

/* ============================================================
   2.0.3, round 4
   ============================================================ */

/* ---- people tabs on the left, the view toggle on the right ---- */
.dash-bar { flex-wrap: nowrap; align-items: center; }
.dash-bar .pchips { flex: 1 1 auto; min-width: 0; }
.dash-bar--table { justify-content: flex-end; }
.viewswitch { margin-left: auto; align-items: center; }
.vs-label { font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 0 6px 0 12px; }
.viewswitch button { width: 44px; padding: 0; justify-content: center; }
.viewswitch svg { width: 19px; height: 19px; }
@media (min-width: 960px) { .viewswitch button { width: 52px; } }
@media (max-width: 599px) {
  .dash-bar { flex-direction: row; align-items: center; gap: 8px; }
  .dash-bar .pchips { flex: 1 1 auto; margin-right: 0; padding-right: 8px; }
  .viewswitch { display: inline-flex; flex: none; }
  .viewswitch button { flex: none; width: 44px; min-height: 44px; }
  .vs-label { display: none; }
}

/* ---- a person's tab on the overview ---- */
.dash-panel { display: flex; flex-direction: column; gap: inherit; }
.view > .dash-panel { gap: 16px; }
@media (min-width: 960px) { .view > .dash-panel { gap: 20px; } }
.headline--sm { font-size: clamp(28px, 3.2vw, 40px); }
.detail-head--embedded { grid-template-columns: minmax(0, 1fr) auto; margin-top: 4px; }
@media (max-width: 759px) {
  /* the edit button stays beside the name instead of taking a row */
  .detail-head--embedded { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .detail-head--embedded .detail-actions { grid-column: 2; grid-row: 1; }
}

/* ---- needs a look: the way into everything still to do ---- */
.needs-todo {
  display: flex; align-items: center; gap: 12px;
  width: 100%; margin-top: 14px; padding: 12px 14px 12px 18px;
  border-radius: 20px; text-align: left;
  background: var(--gold); color: var(--on-gold);
}
.needs-todo-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.needs-todo-text b { font-weight: 600; }
.needs-todo-text small { font-size: 13px; opacity: 0.8; }
.needs-todo-n {
  display: inline-flex; align-items: center; gap: 2px; flex: none;
  min-height: 36px; padding: 0 8px 0 14px; border-radius: 999px;
  background: #14231C; color: #fff; font-weight: 600; font-size: 15px;
}
.needs-todo-n svg { width: 16px; height: 16px; stroke-width: 2.4; }


/* ============================================================
   2.0.3, round 5
   ============================================================ */

/* ---- icons: one line weight at every size ----
   The glyphs were drawn on a 24-unit grid and scaled, so a 14px icon
   drew a hairline and a 26px one a heavy line. Strokes are now set in
   screen pixels, the same weight wherever an icon appears. */
svg[viewBox='0 0 24 24'] :is(path, circle, rect, ellipse, line, polyline) { vector-effect: non-scaling-stroke; }
svg[viewBox='0 0 24 24'] { stroke-width: 1.6px; }
.rail-logo svg, .logo-btn svg { stroke-width: 1.9px; }
.hchip svg { stroke-width: 1.8px; }
.cchip svg, .t-card svg, .pill--todo svg, .needs-todo-n svg, .gift-hint svg { stroke-width: 1.8px; }
.btn--lg svg, .circle--lg svg { stroke-width: 1.7px; }

/* ---- person headline: plain words, the over amount in red ---- */
.over-ink { color: var(--red-ink); }

/* ---- calendar: compact, always six weeks tall ---- */
@media (min-width: 640px) { dialog.sheet--cal { max-width: 400px; } }
.sheet--cal .sheet-inner { padding: 20px 20px calc(18px + env(safe-area-inset-bottom)); }
.sheet--cal h3 { font-size: 22px; }
.cal { margin-top: 6px; }
.cal-head { margin-bottom: 4px; }
.cal-title { font-size: 16px; }
.cal-grid { gap: 2px; }
.cal-wd { padding: 2px 0 4px; font-size: 11px; }
.cal-day, .cal-pad { height: 40px; min-height: 0; aspect-ratio: auto; }
.cal-day { font-size: 14px; }
@media (min-width: 640px) { .cal-day, .cal-pad { height: 42px; } }
.sheet--cal .sheet-actions { margin-top: 12px; }
.sheet--cal .sheet-actions .btn { min-height: 46px; }

/* ---- still to do: the instruction sits under each heading ---- */
.todo-title { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.todo-title small { font-size: 13px; color: var(--ink-2); }
@media (hover: hover) and (pointer: fine) {
  .viewswitch button[aria-pressed='true']:hover { box-shadow: inset 0 0 0 1.5px var(--ring); }
  .tickbtn:hover .tick:not(.on) { background: var(--hov); }
  .linkbtn:hover { text-decoration-thickness: 2px; }
}
.pchips-tabs { display: contents; }
.cal-day--out { color: var(--ink-2); font-size: 13px; }
.todo-sec .card-head { flex-wrap: nowrap; align-items: flex-start; }
.todo-sec .card-head .ratio { padding-top: 4px; }
.pchip--new svg { width: 18px; height: 18px; }

/* ============================================================
   2.0.3, round 6
   ============================================================ */
/* ---- budget card: the total against what's been given out, and what
   was paid, split into gifts and spending ---- */
.alloc { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-2); }
.alloc b { color: var(--ink); font-weight: 600; }
.alloc--over > span:first-child { color: var(--red-ink); }
.alloc--over > span:first-child b { color: var(--red-ink); }
.alloc .linkbtn { margin: -14px 0; color: var(--ink); font-weight: 500; }
.compare { gap: 12px; }
.cmp-row dt { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.cmp-row dd { margin: 3px 0 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.cmp-total { font-size: 14px; color: var(--ink-2); }
.cmp-total b { font-size: 18px; font-weight: 600; color: var(--ink); margin-right: 2px; }
.cmp-parts { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px 0; font-size: 13px; color: var(--ink-2); }
.cmp-parts > span { display: inline-flex; align-items: center; gap: 5px; }
.cmp-parts > span + span::before { content: ''; width: 1px; height: 12px; background: var(--line); margin: 0 10px; }
.cmp-parts b { color: var(--ink); font-weight: 600; }
.lg--gift { width: 8px; height: 8px; border-radius: 999px; background: var(--red); display: inline-block; }
.lg--spend { width: 8px; height: 8px; border-radius: 999px; background: var(--gold-deep); display: inline-block; }
.compare-note { font-weight: 400; }

/* ---- sharing: two kinds of link, clearly apart ---- */
.share-opt { margin-top: 16px; padding: 16px; border-radius: 22px; background: var(--card); }
.share-k { display: flex; flex-direction: column; gap: 3px; font-size: 14px; }
.share-k b { font-size: 16px; font-weight: 600; }
.share-k span { color: var(--ink-2); }
.share-acts { margin-top: 12px; justify-content: flex-start; }
.share-acts .btn { flex: 0 1 auto; }
@media (max-width: 599px) { .share-acts .btn { flex: 1 1 100%; } }
.share-opt [data-slot] > * { margin-top: 10px; }
:root[data-theme='dark'] .sheet .share-opt { background: var(--card); }

/* ---- view only: someone else's list ---- */
.viewbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px;
  padding: 14px 16px; border-radius: var(--r-card-sm);
  background: color-mix(in srgb, var(--gold) 22%, var(--bg));
}
:root[data-theme='dark'] .viewbar { background: color-mix(in srgb, var(--gold) 12%, var(--bg)); }
.viewbar .tile--gold { background: var(--gold); color: var(--on-gold); }
.viewbar p { flex: 1 1 260px; display: flex; flex-direction: column; font-size: 14px; }
.viewbar p b { font-weight: 600; font-size: 15px; }
.viewbar p span { color: var(--ink-2); }
@media (max-width: 599px) { .viewbar .btn { flex: 1 1 100%; } }
body.viewonly :is(.btn--add, .addform, .pchip--new, [data-act="add-person"], [data-act="edit-group"], [data-act="set-total"],
  [data-act="add-group-card"], [data-act="raise-budget"], .backupbar, [data-act="data-sheet"], [data-act="year-sheet"],
  [data-act="settings"], .sugg-head, .sugg-head + .chipset, [data-act="quick-task"], [data-act="quick-person"],
  [data-act="quick-category"], .circle[data-act="open-task"], [data-act="remove-card"], .rollover, .gift-hint, .alloc .linkbtn,
  .todo-go, .addform + .chipset) { display: none !important; }
body.viewonly :is(.tickbtn, .seg-b, .t-card, .cchip, .gift-name, .lrow-body[data-act="open-task"]) { pointer-events: none; }
body.viewonly .head-actions:empty { display: none; }
.viewbar { border: 1.5px solid var(--gold-deep); }

/* ---- phones: popups float in the middle, never under the keyboard ----
   They used to sit on the bottom edge, so the on-screen keyboard covered
   the very field being typed in. Now they are inset from the edges and
   centred in the part of the screen the keyboard leaves visible (--kb
   is its height, measured by the page). */
@media (max-width: 639px) {
  dialog.sheet {
    position: fixed;
    inset: 0 0 var(--kb, 0px) 0;
    margin: auto;
    width: calc(100% - 32px);
    max-width: 440px;
    max-height: calc(var(--vvh, 100dvh) - 32px);
    border-radius: 26px;
  }
  dialog.sheet .sheet-inner { padding: 22px 18px 18px; }
  dialog.sheet h3 { font-size: 23px; }
}

/* ---- phones: finer dashes ---- */
@media (max-width: 599px) {
  .pchip--add, .pchip--new, .cchip, .seg-b, .t-card, .cap--spare, .cap--empty { border-width: 1px; }
  .seg-b.is-past, .seg-b[aria-pressed='true'] { border-width: 1px; }
  .card--red .cap--idea { border-width: 1px; }
}

/* ---- year sheet and start-a-year sheet ---- */
.sheet .lede + .drows { margin-top: 16px; }
.startmode .drow[aria-checked='true'] { box-shadow: inset 0 0 0 1.5px var(--ink); }
.startmode .drow:disabled { opacity: 0.5; }
.radio { width: 20px; height: 20px; flex: none; border-radius: 999px; border: 1.5px solid var(--ink-2); transition: border-width var(--t-hov) ease, border-color var(--t-hov) ease; }
[aria-checked='true'] > .radio { border: 6px solid var(--ink); }
.carry { margin-top: 18px; }
.carry .flabel { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }
.pchip[role='checkbox'] svg { display: none; width: 15px; height: 15px; }
.pchip[role='checkbox'][aria-checked='true'] svg { display: inline; }
.pchip-n { font-size: 12px; opacity: 0.75; }
@media (hover: hover) and (pointer: fine) {
  .alloc .linkbtn:hover, .linkbtn:hover { text-decoration-thickness: 2px; background: var(--hov); border-radius: 6px; }
}

/* ---- budget card, dashboard-simple: three figures in a row ---- */
.card-head .head-btn { margin-left: auto; min-height: 44px; padding: 0 14px; font-size: 13px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 8px; margin-top: 16px; }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 16px; background: var(--raised); min-width: 0; }
.kpi span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.kpi b { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alloc-warn { margin-top: 10px; font-size: 13px; color: var(--red-ink); }
.alloc-warn b { font-weight: 600; }

/* ============================================================
   2.1.0: activation, backup and devices
   ============================================================ */

/* ---- the activation screen covers the app until the device is set up ---- */
body.gated .frame, body.gated .tabbar { visibility: hidden; }
body.gated { overflow: hidden; }
.gate {
  position: fixed; left: 0; right: 0;
  top: var(--vvt, 0px);
  height: var(--vvh, 100dvh);
  z-index: 80;
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center;
  padding: calc(20px + env(safe-area-inset-top)) 16px calc(20px + env(safe-area-inset-bottom));
}
@media (min-width: 640px) { .gate { background: var(--frame); justify-content: center; padding: 32px 16px; } }
.gate-card {
  width: 100%; max-width: 460px; margin: auto 0;
  display: flex; flex-direction: column; gap: 16px;
}
@media (min-width: 640px) {
  .gate-card { background: var(--bg); border-radius: var(--r-card); padding: 32px 30px 28px; }
}
.gate-card--wide { max-width: 640px; }
.gate-brand { display: flex; align-items: center; gap: 12px; }
.gate-logo {
  width: 52px; height: 52px; flex: none; border-radius: 999px;
  display: grid; place-items: center;
  background: var(--pine); color: var(--gold);
}
.gate-logo svg { width: 24px; height: 24px; stroke-width: 1.9px; }
.gate-title { font-size: clamp(24px, 6vw, 30px); font-weight: 500; letter-spacing: -0.03em; line-height: 1.1; text-wrap: balance; }
.gate-h2 { font-size: 22px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.2; text-wrap: balance; }
.gate-lede { color: var(--ink-2); font-size: 15px; line-height: 1.45; }
.gfield { display: flex; flex-direction: column; gap: 6px; }
.gfield label { font-size: 14px; font-weight: 600; }
.gfield input { min-height: 52px; }
.gfield input[aria-invalid='true'] { border-color: var(--red-ink); }
.ghelp { font-size: 13px; color: var(--ink-2); }
.gerr { font-size: 14px; color: var(--red-ink); font-weight: 500; }
.gate-find { align-self: flex-start; font-size: 14px; min-height: 36px; margin: 0; padding: 0; }
.gate-consent { font-size: 13px; color: var(--ink-2); }
.gate-consent .linkbtn { margin: 0; padding: 0; min-height: 0; vertical-align: baseline; }
.gate-actions {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  /* the button stays in view above a phone's keyboard */
  position: sticky; bottom: calc(-20px - env(safe-area-inset-bottom));
  padding: 12px 0 calc(8px + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, transparent, var(--bg) 18px);
}
.gate-actions .linkbtn { margin: 0; font-size: 14px; text-align: center; }
.gate-later { align-self: center; font-size: 14px; margin: 0; }
.gate-back { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; margin: 0; }
.gate-back svg { width: 16px; height: 16px; }
.gnote { padding: 12px 14px; border-radius: 16px; font-size: 14px; line-height: 1.45; background: var(--card); }
.gnote--err { background: var(--warn-bg); color: var(--warn-ink); }
.gnote-opts { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.gnote-opts span::before { content: '·'; margin-right: 6px; }
.gate-card--welcome { align-items: center; text-align: center; margin: auto; }
.gate-card--welcome .gate-logo--done { width: 64px; height: 64px; background: var(--gold); color: var(--on-gold); }
.gate-card--welcome .gate-logo--done svg { width: 28px; height: 28px; stroke-width: 2.2px; }
.gate-card--welcome > * { animation: rise 520ms var(--ease) both; }
.gate-card--welcome > :nth-child(2) { animation-delay: 80ms; }
.gate-card--welcome > :nth-child(3) { animation-delay: 160ms; }

/* "where do I find this?" */
.findpanel { display: grid; gap: 12px; margin-top: 4px; padding: 14px; border-radius: 18px; background: var(--card); }
.findstep { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; align-items: center; font-size: 13px; line-height: 1.4; color: var(--ink-2); }
.findstep b { color: var(--ink); }
.findart { border-radius: 12px; background: var(--raised); padding: 9px; display: flex; flex-direction: column; gap: 5px; font-size: 9px; line-height: 1.25; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); }
.fa-from { font-weight: 700; color: var(--ink); }
.fa-subj b, .fa-item b { color: var(--ink); background: color-mix(in srgb, var(--gold) 30%, transparent); border-radius: 3px; padding: 0 2px; }
.fa-line { height: 4px; border-radius: 4px; background: var(--line); }
.fa-line--s { width: 60%; }
.fa-tab { font-weight: 700; color: var(--ink); }
.fa-tab i { font-style: normal; color: var(--ink-2); }
.fa-item { display: flex; gap: 6px; align-items: center; }
.fa-item i { width: 18px; height: 18px; border-radius: 4px; background: var(--card); flex: none; }
.fa-item span { display: flex; flex-direction: column; }
@media (max-width: 374px) { .findstep { grid-template-columns: 1fr; } }

/* ---- backup status pill ---- */
.syncpill {
  display: inline-flex; align-items: center; gap: 7px; flex: 0 1 auto; min-width: 0;
  min-height: 36px; padding: 0 12px 0 10px; border-radius: 999px;
  background: var(--raised); color: var(--ink); font-size: 13px; font-weight: 500; white-space: nowrap;
}
.syncpill .sp-short { display: none; }
@media (max-width: 459px) { .syncpill .sp-long { display: none; } .syncpill .sp-short { display: inline; } }
@media (max-width: 374px) { .syncpill { padding: 0; width: 36px; justify-content: center; } .syncpill .sp-short { display: none; } }
.sp-dot { width: 8px; height: 8px; border-radius: 999px; flex: none; background: var(--ink); }
[data-state='saved'] .sp-dot, [data-state='saved'] > .sp-dot { background: var(--pine-2); box-shadow: 0 0 0 2px color-mix(in srgb, var(--pine-2) 25%, transparent); }
:root[data-theme='dark'] [data-state='saved'] .sp-dot { background: #9FD3B1; }
[data-state='saving'] .sp-dot { background: var(--gold-deep); animation: sp-pulse 1.2s ease-in-out infinite; }
[data-state='offline'] .sp-dot, [data-state='off'] .sp-dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink-2); }
[data-state='paused'] .sp-dot { background: var(--red); }
@keyframes sp-pulse { 50% { opacity: 0.35; } }
.rail-sync { position: relative; }
.rail-sync .sp-dot { position: absolute; top: 9px; right: 11px; }
.rail-sync[data-state='saved'] .sp-dot { display: none; }
.sync-state { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 16px; }

/* ---- add a device ---- */
.pair { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 14px; text-align: center; }
.pair-code { font-size: 40px; font-weight: 600; letter-spacing: 0.14em; font-variant-numeric: tabular-nums; }
.pair-code span { margin-left: 0.28em; }
.pair-qr { width: 184px; height: 184px; border-radius: 14px; background: #fff; }
.pair-meta { font-size: 13px; color: var(--ink-2); }
.sharemenu .drow:disabled { opacity: 0.55; cursor: default; }

/* ---- settings: your account ---- */
.set-sub { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); }
.set-count { font-weight: 500; }
.devrows { display: flex; flex-direction: column; }
.devrow { display: flex; align-items: center; gap: 12px; min-height: 60px; border-bottom: 1px solid var(--line); }
.devrow:last-child { border-bottom: 0; }
.devrow .tile { width: 40px; height: 40px; }
.devrow-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.devrow-text b { font-weight: 500; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.devrow-text small { font-size: 13px; color: var(--ink-2); }
.set-gap { margin-top: 10px; }
.btn-danger-text { color: var(--red-ink); }
.del-list { margin: 6px 0 10px 18px; color: var(--ink-2); font-size: 15px; line-height: 1.6; }

/* ---- privacy notice ---- */
.privacy h2, .gate-card--wide h2 { font-size: 17px; font-weight: 600; margin-top: 18px; }
.privacy p, .privacy li, .gate-card--wide p, .gate-card--wide li { font-size: 15px; line-height: 1.55; max-width: 65ch; }
.privacy ul, .gate-card--wide ul { margin: 6px 0 0 18px; }
.pv-lede { color: var(--ink-2); }
.draft-flag {
  align-self: flex-start; display: inline-block; padding: 4px 12px; border-radius: 999px;
  background: var(--gold); color: var(--on-gold); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  margin-bottom: 10px;
}
@media (hover: hover) and (pointer: fine) {
  .syncpill:hover { box-shadow: inset 0 0 0 1.5px var(--ring); }
}
.syncpill:active { transform: scale(0.97); }
/* phones: the status pill takes the logo's place in the top bar (the
   tab bar already leads to the overview) */
@media (max-width: 599px) {
  .topbar:has(.syncpill) .logo-btn { display: none; }
}
.syncpill { flex: none; min-height: 44px; }
@media (max-width: 374px) {
  .syncpill { width: 44px; }
  /* the narrowest phones: print stays in the backup and share menu */
  .topbar:has(.syncpill) [data-act="print"] { display: none; }
}
