/* ============================================================
   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, 20, 19, 0.6);
}
:root[data-theme='dark'] .tabbar { border: 1px solid var(--pine-line); }
.tabbar button {
  min-height: 58px;
  border-radius: 22px;
  color: #ECEBE6;
  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, 20, 19, 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 #3D3C38;
  background: var(--gold);
  color: #141413;
  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: #ECEBE6;
  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(--gold);
  color: #141413;
  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(--gold);
  box-shadow: 0 0 0 2px var(--raised), 0 0 0 3px var(--ink);
}
.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: #141413; }
.card--gold .btn--dark { background: #141413; 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: #141413; }
.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: #141413; }
.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: #141413; }
.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: #141413;
  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: #141413; border-color: #141413; 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: #141413; }

.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(8, 8, 7, 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: #141413;
  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 #34332F; }
.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; }

/* ============================================================
   BLACK FRIDAY ON FROST
   The pieces this variant adds, built from Frost's own parts:
   the sticker "deal score" card, the receipt game-plan card, the
   returns rows, the by-store view and the three-price item sheet.
   ============================================================ */

/* the sticker card: Frost's accent card, in price-sticker yellow */
.card--deal { background: var(--gold); color: var(--on-gold); }
.card--deal .of, .card--deal .card-foot { color: var(--gold-ink); }
.card--deal :focus-visible { outline-color: #141413; }
.tile--white { background: #fff; color: #141413; }
.tag--ink { background: #141413; color: #fff; }
.card--deal .cap--kept { background: #141413; }
.card--deal .cap--arrived { background: #fff; box-shadow: inset 0 0 0 1.5px #141413; }
.card--deal .cap--bought { background: var(--gold-ink); }
.card--deal .cap--watch { border: 1.5px dashed var(--gold-dash); }
.lg--kept { background: #141413; }
.lg--arrived { background: #fff; box-shadow: inset 0 0 0 1.5px #141413; }
.lg--bought { background: var(--gold-ink); }
.lg--watch { border: 1.5px dashed var(--gold-dash); }
.card--deal .counts span { color: var(--gold-ink); }
.card--deal .counts b { color: #141413; }
.card--deal .card-foot { display: flex; gap: 8px; align-items: flex-start; }
.card--deal .card-foot svg { width: 16px; height: 16px; flex: none; margin-top: 1px; color: #141413; }
.card--deal .card-foot b { color: #141413; }
.card--deal .btn--dark { background: #141413; color: #fff; margin-top: 12px; }

/* the receipt card: the game plan, standing where Frost has its bauble */
.card--receipt { background: var(--raised); color: var(--ink); }
.card--receipt .btn--dark { background: var(--primary); color: var(--on-primary); }
.receipt-art {
  position: absolute;
  right: -12px; top: 10px;
  width: 92px; height: 123px;
  transform: rotate(8deg);
  pointer-events: none;
}
.card--receipt .next-job small.late { color: var(--red-ink); }
.card--receipt .tick { color: var(--ink); }

/* store chips carry a count of what is still being watched */
.cchip-n {
  min-width: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--gold); color: var(--on-gold);
  font-size: 12px; font-weight: 600; text-align: center;
}

/* return rows on the dashboard */
.rrows { display: flex; flex-direction: column; margin-top: 10px; }
.rrow {
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-height: 56px; padding: 6px 0;
  text-align: left; border-bottom: 1px solid var(--line);
}
.rrow:last-child { border-bottom: 0; }
.rrow-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.rrow-text b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rrow-text small { font-size: 13px; color: var(--ink-2); }

/* item cards: the Black Friday facts under the name */
.gift-name small { display: block; }
.gift-name .flag {
  display: inline-flex; align-items: center; gap: 3px;
  margin-left: 6px; padding: 1px 8px 1px 6px; border-radius: 999px;
  background: var(--gold); color: var(--on-gold);
  font-size: 11px; font-weight: 600; vertical-align: 1px;
}
.gift-name .flag svg { width: 11px; height: 11px; }
.gift-name .ret.soon { color: var(--red-ink); font-weight: 600; }
.gift-name .ret.closed { text-decoration: line-through; }
.gift-price.is-over b { color: var(--red-ink); }
.gift-price.is-over small { color: var(--red-ink); font-weight: 600; }
button.tile--st { cursor: pointer; }
.tile--st[data-s='bought'] { background: var(--gold); color: var(--on-gold); }
.tile--st[data-s='wrapped'] { background: var(--raised); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.tile--st[data-s='given'] { background: var(--primary); color: var(--on-primary); }
/* the last step is the sticker, not red: red only means over */
.seg--4 .seg-b:last-child[aria-pressed='true'] { background: var(--gold); color: var(--on-gold); }

/* the by-store view */
.storegroup { display: flex; flex-direction: column; gap: 12px; }
.store-head { display: flex; align-items: center; gap: 12px; }
.store-head h2 { flex: 1 1 auto; min-width: 0; font-size: 24px; letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 420px) {
  .store-head { flex-wrap: wrap; row-gap: 8px; }
  .store-head h2 { flex-basis: calc(100% - 60px); }
  .store-head .pill { margin-left: 56px; }
}
.hint { display: flex; gap: 8px; align-items: flex-start; color: var(--ink-2); font-size: 13px; }
.hint svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }

/* the item sheet: three prices in a row, and a live deal check */
.pricetrio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.pricetrio label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dealcheck {
  margin-top: 10px; padding: 10px 14px; border-radius: 16px;
  background: var(--card); font-size: 14px; color: var(--ink-2);
}
.dealcheck b.over { color: var(--red-ink); }
.dealcheck b.under { color: var(--ink); }
.dealcheck[hidden] { display: none; }
.confirm-warn--soft { background: var(--card); color: var(--ink); }
.confirm-warn--soft svg { color: var(--gold-deep); }
.sheet .chips .chip svg, .sheet .pchip svg { width: 15px; height: 15px; }

/* the narrowest phones: four status steps and five tabs still fit
   without cutting their words */
@media (max-width: 380px) {
  .seg-b { font-size: 12px; padding: 0 2px; }
  .seg { gap: 4px; }
}
@media (max-width: 360px) {
  .tabbar { gap: 2px; padding: 6px; }
  .tabbar button { font-size: 10px; }
}
