/* Gifts — light, calm, Apple-like. One accent per occasion (set on :root by the app). */
:root {
  color-scheme: light;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Inter, system-ui, sans-serif;
  --rounded: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --bg: #F2F2F7;
  --surface: #FFFFFF;
  --label: #111114;
  --label-2: #636368;            /* secondary text, AA on white and on --bg */
  --label-3: #767679;            /* tertiary text, AA on white */
  --label-4: rgba(60, 60, 67, .3);/* placeholders, disabled, chevrons */
  --separator: rgba(60, 60, 67, .16);
  --fill: rgba(120, 120, 128, .12);
  --fill-2: rgba(120, 120, 128, .07);
  --accent: #C8372D;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --red: #D70015;
  --ring: #8E8E93;
  --radius-card: 12px; --radius-thumb: 8px; --radius-sheet: 14px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --side: 16px;
  --nav-h: 44px;
  --tool-h: 50px;
  --bar-bg: rgba(246, 246, 249, .8);
  --ease: cubic-bezier(.32, .72, 0, 1);
}
@media (min-width: 428px) { :root { --side: 20px; } }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body {
  font: 17px/22px var(--font); letter-spacing: -.41px; color: var(--label);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; -webkit-text-size-adjust: 100%;
  overscroll-behavior: none; touch-action: manipulation;
}
button, input, textarea, select { font: inherit; letter-spacing: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-align: inherit; }
button:disabled { cursor: default; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
.ic { width: 22px; height: 22px; flex: none; display: block; }
:focus { outline: none; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.input:focus-visible, .search-input:focus-visible, .code-input:focus-visible, .select:focus-visible { outline: none; }
.form-row:has(.select:focus-visible) { box-shadow: inset 0 0 0 2px var(--accent); }
.row:focus-visible, .form-row:focus-visible, .gift-main:focus-visible { outline-offset: -3px; }
[hidden] { display: none !important; }

#app { position: fixed; inset: 0; overflow: hidden; height: 100dvh; }

/* ---------- panes, bars ---------- */
.shell { position: absolute; inset: 0; }
.pane { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--bg); overflow: hidden;
  transition: transform .35s var(--ease); }
.detail-pane { transform: translateX(100%); box-shadow: 0 0 0 .5px var(--separator), -8px 0 28px rgba(0, 0, 0, .07); }
.shell.detail-open .detail-pane { transform: none; }
.shell.detail-open .home-pane { transform: translateX(-28%); }
.home-pane::after { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, 0); pointer-events: none; transition: background .35s var(--ease); z-index: 9; }
.shell.detail-open .home-pane::after { background: rgba(0, 0, 0, .05); }

.navbar { position: absolute; top: 0; left: 0; right: 0; z-index: 6; height: calc(var(--nav-h) + var(--sat)); padding: var(--sat) calc(8px + var(--sar)) 0 calc(8px + var(--sal));
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  background: rgba(242, 242, 247, 0); transition: background .25s, box-shadow .25s; }
.navbar.scrolled { background: var(--bar-bg); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); box-shadow: 0 .5px 0 var(--separator); }
.nav-left { display: flex; align-items: center; min-width: 0; }
.nav-right { display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding-right: 8px; }
.nav-title { font-weight: 600; font-size: 17px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 56vw;
  opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .2s; }
.navbar.scrolled .nav-title { opacity: 1; transform: none; }

.scroller { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain;
  padding: calc(var(--nav-h) + var(--sat)) calc(var(--side) + var(--sar)) calc(var(--tool-h) + var(--sab) + 32px) calc(var(--side) + var(--sal)); }
.content { max-width: 720px; margin: 0 auto; }
.toolbar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; height: calc(var(--tool-h) + var(--sab));
  padding: 0 calc(var(--side) + var(--sar)) var(--sab) calc(var(--side) + var(--sal));
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bar-bg); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); box-shadow: 0 -.5px 0 var(--separator); }
.toolbar.is-empty { display: none; }
.tool-btn { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; color: var(--accent); font-size: 17px; }
.tool-btn.strong { font-weight: 600; }
.tool-plus.ic { width: 24px; height: 24px; }

.back-btn { display: inline-flex; align-items: center; gap: 1px; min-height: 44px; padding-right: 8px; color: var(--accent); font-size: 17px; white-space: nowrap; overflow: hidden; }
.back-btn span { overflow: hidden; text-overflow: ellipsis; }
.back-chev.ic { width: 24px; height: 24px; stroke-width: 2.3; margin-left: -2px; }
.round-btn { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--fill); color: var(--accent); position: relative; }
.round-btn::before { content: ""; position: absolute; inset: -6px; }
.round-btn .ic { width: 20px; height: 20px; }
.round-btn.me { background: linear-gradient(180deg, #A9AEBA, #858A96); color: #fff; font-size: 15px; font-weight: 600; letter-spacing: 0; }
.round-btn.plain { background: none; width: 44px; height: 44px; }
.round-btn.plain .ic { width: 26px; height: 26px; }

.offline-banner { position: fixed; z-index: 40; left: 50%; top: calc(var(--sat) + 6px); transform: translate(-50%, -160%); padding: 6px 14px; border-radius: 99px;
  background: rgba(44, 44, 46, .92); color: #fff; font-size: 13px; line-height: 18px; letter-spacing: -.08px; font-weight: 500; white-space: nowrap;
  transition: transform .35s var(--ease); pointer-events: none; }
.is-offline .offline-banner { transform: translate(-50%, 0); }

/* ---------- titles ---------- */
.large-title { display: flex; align-items: center; gap: 6px; margin: 2px 0 0; font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: .37px; text-align: left; color: var(--label); max-width: 100%; }
.large-title.switcher { cursor: pointer; }
.lt-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lt-chev.ic { width: 22px; height: 22px; color: var(--accent); stroke-width: 2.3; margin-top: 4px; transition: transform .2s; }
.switcher:active .lt-chev { transform: translateY(2px); }
.title-lock .ic { width: 22px; height: 22px; color: var(--label-2); margin-top: 4px; }
.subtitle { margin: 2px 0 0; color: var(--label-2); font-size: 15px; line-height: 20px; letter-spacing: -.24px; font-variant-numeric: tabular-nums; }

/* ---------- search ---------- */
.search-wrap { display: flex; align-items: center; gap: 0; margin: 14px 0 18px; }
.search { flex: 1; display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 8px; border-radius: 10px; background: rgba(118, 118, 128, .12); color: var(--label-2); }
.search-ic.ic { width: 18px; height: 18px; stroke-width: 2; }
.search-input { flex: 1; min-width: 0; height: 36px; border: 0; background: none; font-size: 17px; color: var(--label); -webkit-appearance: none; appearance: none; padding: 0; }
.search-input::placeholder { color: var(--label-2); }
.search-input::-webkit-search-cancel-button { display: none; }
.search-clear { display: grid; place-items: center; width: 28px; height: 36px; color: #A3A3A8; }
.search-clear .ic { width: 17px; height: 17px; }
.search-cancel { color: var(--accent); font-size: 17px; max-width: 0; overflow: hidden; opacity: 0; white-space: nowrap; transition: max-width .3s var(--ease), opacity .2s, padding .3s var(--ease); min-height: 36px; }
.search-wrap.active .search-cancel { max-width: 80px; opacity: 1; padding-left: 12px; }

/* ---------- tiles ---------- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; gap: 8px 6px; padding: 10px 12px 9px 11px; border-radius: var(--radius-card); background: var(--surface);
  min-height: 82px; transition: transform .15s, background .15s; }
.tile:active { transform: scale(.98); background: #F7F7F9; }
.tile-glyph { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.tile-glyph .ic { width: 19px; height: 19px; stroke-width: 1.8; }
.tile-num { justify-self: end; align-self: start; font: 700 28px/34px var(--rounded); letter-spacing: 0; font-variant-numeric: tabular-nums; color: var(--label); margin-top: -2px; white-space: nowrap; }
.tile-num.long { font-size: 22px; line-height: 34px; }
.tile-label { grid-column: 1 / -1; font-size: 15px; line-height: 20px; font-weight: 600; color: var(--label-2); letter-spacing: -.24px; }
.progress-line { margin: 14px 4px 0; display: grid; gap: 7px; font-size: 13px; line-height: 18px; color: var(--label-2); letter-spacing: -.08px; font-variant-numeric: tabular-nums; }
.bar { display: block; position: relative; height: 4px; border-radius: 2px; background: rgba(120, 120, 128, .16); overflow: hidden; }
.bar-fill { position: absolute; inset: 0 auto 0 0; border-radius: 2px; background: var(--accent); transition: width .5s var(--ease); }
.bar-mark { position: absolute; top: -1px; bottom: -1px; width: 2px; margin-left: -1px; background: var(--label-2); border-radius: 1px; }

/* ---------- groups and rows ---------- */
.group { margin-top: 28px; }
.group:first-child { margin-top: 8px; }
.group-head { display: flex; align-items: center; gap: 6px; padding: 0 4px 8px; font-size: 20px; line-height: 25px; font-weight: 700; letter-spacing: .38px; color: var(--label); }
.group.form .group-head, .sheet .group-head { font-size: 13px; line-height: 18px; font-weight: 400; letter-spacing: -.08px; color: var(--label-2); padding: 0 16px 6px; text-transform: none; }
.group-head .ic { width: 18px; height: 18px; color: var(--label-2); }
.head-lock { display: inline-flex; align-items: center; gap: 6px; }
.head-link { display: inline-flex; align-items: center; gap: 4px; color: inherit; }
.head-chev.ic { width: 18px; height: 18px; color: var(--label-4); stroke-width: 2.2; }
.group-body { background: var(--surface); border-radius: var(--radius-card); overflow: hidden; }
.group-foot { padding: 7px 16px 0; font-size: 13px; line-height: 18px; color: var(--label-2); letter-spacing: -.08px; }
.group.form { margin-top: 22px; }
.group.form:first-child { margin-top: 6px; }
.people-group.private .group-head { color: var(--label); }

.rows { margin: 0; padding: 0; }
.row { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 16px; background: var(--surface); text-align: left; color: var(--label); }
.row + .row::before, .form-row + .form-row::before, .rows > .row + .row::before { content: ""; z-index: 2; position: absolute; top: 0; right: 0; left: var(--inset, 16px); height: .5px; background: var(--separator); }
@media (max-resolution: 1dppx) { .row + .row::before, .form-row + .form-row::before { height: 1px; } }
a.row:active, button.row:active, .gift-main:active { background-color: #E5E5EA; }
.row-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.row-text { flex: 1; min-width: 0; display: grid; padding: 10px 0; }
.row-text .row-title { flex: none; }
.row-sub { font-size: 15px; line-height: 20px; color: var(--label-2); letter-spacing: -.24px; font-variant-numeric: tabular-nums; }
.row-detail { color: var(--label-2); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 17px; }
.chev.ic { width: 15px; height: 15px; color: var(--label-4); stroke-width: 2.4; margin-left: -4px; }
.row-check.ic { width: 20px; height: 20px; color: var(--accent); stroke-width: 2.2; }
.inline-lock.ic { width: 15px; height: 15px; color: var(--label-2); }
.row-glyph.ic { width: 22px; height: 22px; color: var(--accent); }

.person-row { --inset: 62px; min-height: 52px; }
.person-row.selected { background: #E9E9EE; }
.done-check { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff; }
.done-check .ic { width: 13px; height: 13px; stroke-width: 2.6; }

.avatar { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(180deg, #A9AEBA, #858A96);
  color: #fff; font-size: 15px; font-weight: 600; letter-spacing: 0; line-height: 1; user-select: none; }
.avatar.sm { width: 28px; height: 28px; font-size: 13px; }
.avatar.md { width: 40px; height: 40px; font-size: 17px; }
.avatar.xl { width: 72px; height: 72px; font-size: 32px; }

/* ---------- gift rows and marks ---------- */
.gift-row { display: block; padding: 0; overflow: hidden; --inset: 58px; }
.row-inner { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; padding: 0 14px 0 6px; background: var(--surface); transition: transform .3s var(--ease); }
.gift-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; padding: 11px 0; text-align: left; border-radius: 0; }
.gift-title { font-size: 17px; line-height: 22px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.gift-meta { font-size: 15px; line-height: 20px; color: var(--label-2); letter-spacing: -.24px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gift-bought { font-size: 13px; line-height: 18px; color: var(--label-3); letter-spacing: -.08px; }
.swipe-actions { position: absolute; inset: 0 0 0 auto; display: flex; z-index: 0; }
.swipe-delete { width: 88px; height: 100%; background: var(--red); color: #fff; font-weight: 500; text-align: center; font-size: 15px; }
.thumb { flex: none; width: 48px; height: 48px; border-radius: var(--radius-thumb); overflow: hidden; background: var(--fill-2); display: grid; place-items: center; margin: 8px 0; box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .06); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.no-pic .ic { width: 22px; height: 22px; color: #AEAEB2; stroke-width: 1.5; }

.mark { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; }
.mark svg { width: 24px; height: 24px; overflow: visible; }
.mark.static { width: 32px; height: 32px; }
.mark.static svg { width: 20px; height: 20px; }
.m-ring { fill: none; stroke: var(--ring); stroke-width: 1.5; transition: stroke .2s; }
.is-ordered .m-ring, .is-delivered .m-ring { stroke: var(--accent); stroke-width: 1.8; }
.m-dot, .m-fill { fill: var(--accent); transform-box: fill-box; transform-origin: center; }
.m-dot { transform: scale(0); transition: transform .42s cubic-bezier(.3, 1.8, .45, 1); }
.is-ordered .m-dot { transform: scale(1); }
.m-fill { opacity: 0; transform: scale(.35); transition: transform .42s cubic-bezier(.3, 1.7, .45, 1), opacity .12s; }
.is-delivered .m-fill { opacity: 1; transform: scale(1); }
.m-tick { fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 17; stroke-dashoffset: 17; transition: stroke-dashoffset .28s .1s ease-out; }
.is-delivered .m-tick { stroke-dashoffset: 0; }
.mark:active svg { transform: scale(.9); transition: transform .1s; }

/* ---------- person page ---------- */
.budget { display: grid; gap: 6px; width: 100%; margin: 12px 0 0; padding: 0 2px; text-align: left; font-size: 13px; line-height: 18px; color: var(--label-2); font-variant-numeric: tabular-nums; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
.pill { display: inline-flex; align-items: center; height: 34px; border-radius: 17px; background: var(--surface); font-size: 15px; letter-spacing: -.24px; font-weight: 500; box-shadow: 0 0 0 .5px rgba(0, 0, 0, .04); }
.pill.add { gap: 4px; padding: 0 14px 0 10px; color: var(--accent); }
.pill-ic.ic { width: 15px; height: 15px; stroke-width: 2.1; }
.pill-main { display: inline-flex; align-items: center; gap: 5px; height: 100%; padding: 0 10px 0 14px; color: var(--label); max-width: 62vw; }
.pill-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill-main .ic { color: var(--label-2); }
.pill-more { display: grid; place-items: center; height: 100%; padding: 0 10px 0 8px; border-left: .5px solid var(--separator); color: var(--label-2); border-radius: 0 17px 17px 0; }
.pill-more .ic { width: 15px; height: 15px; stroke-width: 2.2; }
.note-card { display: block; width: 100%; margin: 14px 0 0; padding: 12px 16px; border-radius: var(--radius-card); background: rgba(120, 120, 128, .08); color: var(--label-2);
  font-size: 15px; line-height: 20px; letter-spacing: -.24px; white-space: pre-wrap; text-align: left; }
.filter-wrap { margin: 20px 0 0; }
.group.gifts { margin-top: 12px; }
.filter-empty { padding: 28px 0; text-align: center; color: var(--label-2); font-size: 15px; }
.spent-total { margin: 6px 0 0; font: 700 40px/46px var(--rounded); letter-spacing: 0; font-variant-numeric: tabular-nums; }
.spent-row { --inset: 62px; padding-top: 10px; padding-bottom: 10px; }
.spent-main { flex: 1; min-width: 0; display: grid; gap: 6px; }
.spent-top { display: flex; align-items: baseline; gap: 8px; }
.row-amount { font-variant-numeric: tabular-nums; color: var(--label); }

/* ---------- segmented ---------- */
.segmented { position: relative; display: grid; grid-template-columns: repeat(var(--n), 1fr); padding: 2px; border-radius: 9px; background: rgba(118, 118, 128, .12); isolation: isolate; }
.seg-thumb { position: absolute; z-index: -1; top: 2px; bottom: 2px; left: 2px; width: calc((100% - 4px) / var(--n)); border-radius: 7px; background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 3px 1px rgba(0, 0, 0, .04), 0 0 0 .5px rgba(0, 0, 0, .04); transform: translateX(calc(var(--i) * 100%)); transition: transform .32s var(--ease); }
.seg { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 32px; padding: 0 4px; font-size: 13px; line-height: 18px; font-weight: 500; letter-spacing: -.08px; color: var(--label); white-space: nowrap; border-radius: 7px; }
.seg.on { font-weight: 600; }
.seg-count { color: var(--label-2); font-weight: 500; font-variant-numeric: tabular-nums; }
.segmented.small { width: 200px; }
.form-block { margin-top: 22px; }
.bought-by { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; padding: 0 4px 0 16px; }
.bought-by .row-label { color: var(--label-2); font-size: 15px; }

/* ---------- forms ---------- */
.form-row { position: relative; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 16px; background: var(--surface); width: 100%; text-align: left; }
.row-label { flex: none; color: var(--label); }
.row-label.grow { flex: 1; }
.input { flex: 1; min-width: 0; border: 0; background: none; padding: 11px 0; font-size: 17px; line-height: 22px; color: var(--label); border-radius: 0; -webkit-appearance: none; appearance: none; resize: none; }
.input::placeholder { color: rgba(60, 60, 67, .36); }
.input.right { text-align: right; }
.input.num { text-align: right; font-variant-numeric: tabular-nums; width: calc(var(--len, 4) * 1ch + 4px); max-width: 10em; flex: none; }
textarea.input { display: block; min-height: 44px; overflow: auto; }
textarea.input.big { min-height: 150px; }
.title-input { font-weight: 500; }
.money-input { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; color: var(--label-2); }
.money-input.bad .input { color: var(--red); }
.select-row { cursor: pointer; }
.select { flex: 1; min-width: 0; border: 0; background: none; -webkit-appearance: none; appearance: none; text-align: right; text-align-last: right; direction: ltr; color: var(--label-2); font-size: 17px; padding: 11px 0; cursor: pointer; }
.bday { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.bday .select { flex: none; }
.input.year { width: 3.4em; flex: none; text-align: right; color: var(--label-2); }
.action-row { color: var(--accent); gap: 12px; }
.action-row.center { justify-content: center; }
.action-row .chev.ic { margin-left: auto; color: var(--accent); width: 17px; height: 17px; stroke-width: 2; }
.action-row.destructive, .menu-item.destructive, .alert-btn.destructive { color: var(--red); }
.action-row:disabled { color: var(--label-4); }
.form-error { margin: 10px 16px 0; color: var(--red); font-size: 13px; line-height: 18px; }
.sheet-lead { margin: 6px 4px 0; color: var(--label-2); font-size: 15px; line-height: 20px; letter-spacing: -.24px; }
.text-btn { color: var(--accent); font-size: 17px; min-height: 44px; padding: 0 4px; }
.text-btn:disabled { color: var(--label-3); }
.text-btn.center { display: block; margin: 18px auto 0; }
.pill-btn { flex: none; height: 30px; padding: 0 12px; border-radius: 15px; background: var(--fill); color: var(--accent); font-size: 15px; font-weight: 600; letter-spacing: -.24px; }
.filled-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 22px; border-radius: 22px; background: var(--accent); color: #fff; font-weight: 600; margin-top: 18px; }
.check-row { gap: 12px; --inset: 56px; }
.tick { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--ring); display: grid; place-items: center; color: #fff; flex: none; transition: background .15s, border-color .15s; }
.tick .ic { width: 13px; height: 13px; stroke-width: 2.8; opacity: 0; transition: opacity .15s; }
.tick.on { background: var(--accent); border-color: var(--accent); }
.tick.on .ic { opacity: 1; }
.check-row .avatar { margin-left: -2px; }

.switch { -webkit-appearance: none; appearance: none; flex: none; position: relative; width: 51px; height: 31px; border-radius: 16px; background: rgba(120, 120, 128, .16); cursor: pointer; transition: background .25s; margin: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .15), 0 3px 1px rgba(0, 0, 0, .06); transition: transform .28s var(--ease); }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(20px); }

.stepper { display: inline-flex; align-items: center; gap: 2px; margin-left: auto; background: var(--fill); border-radius: 9px; padding: 2px; }
.step { width: 40px; height: 30px; display: grid; place-items: center; border-radius: 7px; color: var(--label); }
.step:disabled { color: var(--label-4); }
.step .ic { width: 17px; height: 17px; stroke-width: 2.1; }
.minus { width: 13px; height: 2.1px; border-radius: 1px; background: currentColor; }
.step-val { min-width: 26px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 500; }

.link-row .row-glyph.ic { color: var(--label-2); width: 20px; height: 20px; }
.link-card { display: flex; align-items: center; gap: 12px; padding: 8px 16px 12px; background: var(--surface); min-height: 44px; }
.link-card.loading { color: var(--label-2); font-size: 15px; gap: 10px; padding: 4px 16px 12px; }
.link-card .thumb { margin: 0; width: 56px; height: 56px; }
.link-card-text { display: grid; min-width: 0; gap: 2px; }
.link-card-title { font-size: 15px; line-height: 20px; font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.link-card-meta { font-size: 13px; line-height: 18px; color: var(--label-2); font-variant-numeric: tabular-nums; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(120, 120, 128, .25); border-top-color: var(--label-2); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.preview-row { gap: 4px; padding-left: 6px; --inset: 42px; }
.preview-row .gift-main { padding: 9px 0; }
.preview-row.muted .gift-title { color: var(--label-2); }
.preview-row.muted { padding-left: 16px; --inset: 16px; }
.group.tight .group-head { padding-bottom: 6px; }

.occ-row { gap: 14px; --inset: 60px; }
.occ-glyph { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--occ) 12%, transparent); color: var(--occ); flex: none; }
.occ-glyph .ic { width: 19px; height: 19px; }
.row-plus.ic { width: 24px; height: 24px; margin-right: 0; color: var(--accent); }
.disclosure { width: 100%; cursor: pointer; }
.disclosure .count { color: var(--label-2); font-weight: 400; font-size: 15px; }
.disc-chev.ic { width: 16px; height: 16px; margin-left: auto; color: var(--accent); stroke-width: 2.3; transition: transform .25s var(--ease); }
.disclosure[aria-expanded="true"] .disc-chev { transform: rotate(90deg); }

.person-head { display: grid; place-items: center; margin: 4px 0 0; }
.me-card { display: flex; align-items: center; gap: 16px; padding: 14px 16px; margin-top: 6px; border-radius: var(--radius-card); background: var(--surface); }
.me-card .avatar.xl { width: 60px; height: 60px; font-size: 26px; }
.me-name { font-size: 22px; line-height: 28px; font-weight: 700; letter-spacing: .35px; }
.me-sub { color: var(--label-2); font-size: 15px; }
.pair-panel { padding: 6px 16px 16px; background: var(--surface); text-align: center; }
.pair-code { font: 600 44px/52px var(--rounded); letter-spacing: .12em; font-variant-numeric: tabular-nums; color: var(--label); }
.pair-code .gap { display: inline-block; width: .35em; }
.pair-panel p { color: var(--label-2); font-size: 13px; line-height: 18px; max-width: 34em; margin: 4px auto 0; }
.a2hs { padding: 14px 16px 16px; }
.a2hs ol { display: grid; gap: 12px; }
.a2hs li { display: flex; align-items: center; gap: 12px; font-size: 15px; line-height: 20px; }
.a2hs-art { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: var(--fill-2); color: #0A7AFF; flex: none; box-shadow: inset 0 0 0 .5px var(--separator); }
.a2hs-art .ic { width: 21px; height: 21px; }
.a2hs p { margin-top: 12px; color: var(--label-2); font-size: 13px; line-height: 18px; }
.fine { text-align: center; color: var(--label-2); font-size: 12px; margin-top: 24px; }
.done-panel { text-align: center; padding: 40px 0 20px; }
.done-badge { margin: 0 auto 14px; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; }
.done-badge .ic { width: 30px; height: 30px; }
.done-panel h3 { font-size: 22px; line-height: 28px; }
.done-panel p { color: var(--label-2); margin-top: 6px; font-size: 15px; }

/* ---------- empty and search results ---------- */
.empty { text-align: center; padding: 64px 24px 24px; display: grid; justify-items: center; }
.empty-glyph { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--fill-2); color: #8E8E93; margin-bottom: 16px; }
.empty-glyph .ic { width: 32px; height: 32px; stroke-width: 1.5; }
.empty h3 { font-size: 20px; line-height: 25px; font-weight: 600; letter-spacing: .38px; }
.empty p { margin-top: 6px; max-width: 290px; color: var(--label-2); font-size: 15px; line-height: 20px; letter-spacing: -.24px; }
.search-results .group:first-child { margin-top: 0; }
.no-results { text-align: center; padding: 48px 16px; color: var(--label-2); font-size: 15px; }
.nr-title { color: var(--label); font-size: 20px; font-weight: 600; margin-bottom: 4px; }

/* ---------- sheets ---------- */
#layer { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
#layer > * { pointer-events: auto; }
.sheet-root { position: fixed; left: 0; right: 0; top: var(--vvtop, 0px); height: var(--vvh, 100dvh); }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0); transition: background .42s var(--ease); }
.sheet-root.in .sheet-backdrop { background: rgba(0, 0, 0, .22); }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; max-height: calc(100% - var(--sat) - 10px); min-height: 40%;
  background: var(--bg); border-radius: var(--radius-sheet) var(--radius-sheet) 0 0; box-shadow: 0 -1px 0 rgba(0, 0, 0, .02), 0 -10px 40px rgba(0, 0, 0, .08);
  transform: translateY(105%); transition: transform .42s var(--ease), filter .42s var(--ease); will-change: transform; }
.sheet-root.in .sheet { transform: none; }
.sheet.gift-sheet { height: calc(100% - var(--sat) - 10px); }
.sheet-root.in .sheet.stacked { transform: scale(.94) translateY(-6px); filter: brightness(.97); }
.grabber { flex: none; width: 36px; height: 5px; border-radius: 3px; background: rgba(60, 60, 67, .3); margin: 6px auto 0; }
.sheet-header { flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; min-height: 46px; padding: 0 8px; touch-action: none; }
.sheet-left, .sheet-right { display: flex; min-width: 0; }
.sheet-right { justify-content: flex-end; }
.sheet-left > div, .sheet-right > div { display: contents; }
.sheet-title { font-size: 17px; line-height: 22px; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-btn { min-height: 44px; padding: 0 8px; color: var(--accent); font-size: 17px; white-space: nowrap; }
.bar-btn.strong { font-weight: 600; }
.bar-btn:disabled { color: var(--label-4); }
.sheet-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 4px calc(var(--side) + var(--sar)) calc(28px + var(--sab)) calc(var(--side) + var(--sal)); }
.sheet .group:first-child { margin-top: 6px; }
.sheet .group-body { border-radius: 10px; }

/* action sheets, menus, alerts */
.menu-root { position: fixed; inset: 0; }
.menu-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0); transition: background .3s var(--ease); }
.menu-root.in .menu-backdrop { background: rgba(0, 0, 0, .22); }
.menu-root.is-popover.in .menu-backdrop { background: rgba(0, 0, 0, .02); }
.action-sheet { position: absolute; left: 8px; right: 8px; bottom: calc(8px + var(--sab)); max-width: 520px; margin: 0 auto; display: grid; gap: 8px;
  transform: translateY(calc(100% + 20px)); transition: transform .36s var(--ease); }
.menu-root.in .action-sheet { transform: none; }
.menu-group { border-radius: 14px; overflow: hidden; background: rgba(250, 250, 252, .92); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%); }
.menu-head { padding: 14px 16px; text-align: center; box-shadow: inset 0 -.5px 0 var(--separator); }
.menu-title { font-size: 13px; font-weight: 600; color: var(--label-2); }
.menu-msg { font-size: 13px; color: var(--label-2); margin-top: 2px; }
.menu-item { position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 57px; padding: 0 16px; font-size: 20px; color: var(--accent); }
.menu-item + .menu-item::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: .5px; background: var(--separator); }
.action-sheet .menu-item .ic { display: none; }
.menu-item:active, .menu-cancel:active { background: rgba(0, 0, 0, .05); }
.menu-item:disabled { color: var(--label-4); }
.menu-cancel { min-height: 57px; border-radius: 14px; background: #fff; color: var(--accent); font-size: 20px; font-weight: 600; text-align: center; }
.popover { position: absolute; width: 260px; transform: scale(.92); opacity: 0; transform-origin: top left; transition: transform .2s var(--ease), opacity .15s; }
.menu-root.in .popover { transform: none; opacity: 1; }
.popover .menu-group { box-shadow: 0 10px 40px rgba(0, 0, 0, .16), 0 0 0 .5px rgba(0, 0, 0, .06); border-radius: 12px; }
.popover .menu-item { justify-content: space-between; min-height: 44px; font-size: 15px; color: var(--label); letter-spacing: -.24px; }
.popover .menu-item .ic { width: 18px; height: 18px; color: var(--label-2); }
.popover .menu-item.destructive, .popover .menu-item.destructive .ic { color: var(--red); }
.popover .menu-item:hover { background: rgba(0, 0, 0, .04); }
.alert-root { display: grid; place-items: center; }
.alert { position: relative; width: 270px; border-radius: 14px; overflow: hidden; background: rgba(250, 250, 252, .94); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
  transform: scale(1.12); opacity: 0; transition: transform .25s var(--ease), opacity .2s; box-shadow: 0 10px 40px rgba(0, 0, 0, .12); }
.alert-root.in .alert { transform: none; opacity: 1; }
.alert-text { padding: 19px 16px 18px; text-align: center; }
.alert-title { font-size: 17px; line-height: 22px; font-weight: 600; }
.alert-msg { font-size: 13px; line-height: 18px; margin-top: 3px; color: var(--label); letter-spacing: -.08px; }
.alert-btns { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; box-shadow: inset 0 .5px 0 var(--separator); }
.alert-btns.stack { grid-auto-flow: row; }
.alert-btn { min-height: 44px; color: var(--accent); font-size: 17px; text-align: center; }
.alert-btn + .alert-btn { box-shadow: inset .5px 0 0 var(--separator); }
.alert-btns.stack .alert-btn + .alert-btn { box-shadow: inset 0 .5px 0 var(--separator); }
.alert-btn.strong { font-weight: 600; }
.alert-btn:active { background: rgba(0, 0, 0, .05); }

.toast { position: fixed; z-index: 60; left: 50%; bottom: calc(var(--tool-h) + var(--sab) + 14px); transform: translate(-50%, 20px); opacity: 0; display: flex; align-items: center; gap: 4px;
  max-width: calc(100vw - 32px); padding: 4px 6px 4px 18px; min-height: 48px; border-radius: 16px; background: rgba(36, 36, 38, .94); color: #fff; font-size: 15px; letter-spacing: -.24px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .18); transition: transform .35s var(--ease), opacity .25s; -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.toast.in { transform: translate(-50%, 0); opacity: 1; }
.toast-text { padding: 10px 0; }
.toast-btn { min-height: 40px; padding: 0 12px; margin-left: 8px; border-radius: 11px; color: #fff; font-weight: 600; background: rgba(255, 255, 255, .12); }
.has-sheet .toast { bottom: calc(var(--sab) + 18px); }

/* ---------- sign in ---------- */
.signin-root { position: absolute; inset: 0; overflow-y: auto; background: var(--bg); }
.signin { position: relative; min-height: 100%; max-width: 400px; margin: 0 auto; display: flex; flex-direction: column; align-items: stretch;
  padding: calc(var(--sat) + max(9vh, 48px)) calc(var(--side) + 8px) calc(var(--sab) + 32px); text-align: center; }
.si-head { display: grid; justify-items: center; }
.si-icon { width: 72px; height: 72px; border-radius: 16px; box-shadow: 0 4px 14px rgba(0, 0, 0, .08); }
.si-title { margin-top: 18px; font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: .37px; }
.si-sub { margin-top: 4px; color: var(--label-2); }
.si-users { display: grid; gap: 12px; margin-top: 44px; }
.si-user { display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 0 16px; border-radius: 14px; background: var(--surface); font-size: 17px; font-weight: 600; text-align: left;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .03); transition: transform .15s, background .15s; }
.si-user:active { transform: scale(.985); background: #F7F7F9; }
.si-name { flex: 1; }
.si-foot { margin-top: 18px; color: var(--label-2); font-size: 13px; line-height: 18px; }
.signin > .text-btn { margin: 8px auto 0; font-size: 15px; }
.si-back { position: absolute; top: calc(var(--sat) + 4px); left: 8px; }
.code-step .si-head .si-icon { width: 56px; height: 56px; border-radius: 13px; }
.code-step .si-title { font-size: 28px; line-height: 34px; margin-top: 12px; }
.si-code { margin-top: 32px; display: grid; justify-items: center; }
.si-who { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; }
.si-who .avatar { width: 32px; height: 32px; font-size: 14px; }
.si-prompt { margin-top: 16px; color: var(--label-2); font-variant-numeric: tabular-nums; }
.code-box { width: 100%; margin-top: 14px; }
.code-input { width: 100%; height: 68px; border: 0; border-radius: 14px; background: var(--surface); text-align: center; font: 600 34px/1 var(--rounded); letter-spacing: .42em; text-indent: .42em;
  font-variant-numeric: tabular-nums; caret-color: var(--accent); box-shadow: 0 1px 2px rgba(0, 0, 0, .03); }
.code-input:focus { box-shadow: 0 0 0 2px var(--accent); }
.code-input:disabled { color: var(--label-2); }
.si-error { margin-top: 12px; color: var(--red); font-size: 15px; line-height: 20px; }
.si-actions { display: grid; gap: 0; margin-top: 18px; }
.si-actions .text-btn { font-size: 15px; }
.si-help { margin-top: 6px; padding: 14px 16px; border-radius: 12px; background: rgba(120, 120, 128, .08); color: var(--label-2); font-size: 15px; line-height: 20px; text-align: left; }

/* ---------- Mac and wide screens ---------- */
@media (min-width: 960px) {
  :root { --side: 20px; --tool-h: 52px; }
  .wide .home-pane { right: auto; width: 340px; transform: none !important; background: #EBEBF0; box-shadow: .5px 0 0 var(--separator); z-index: 2; }
  .wide .home-pane::after { display: none; }
  .wide .home-pane .navbar.scrolled, .wide .home-pane .toolbar { background: rgba(235, 235, 240, .82); }
  .wide .detail-pane { left: 340px; transform: none !important; box-shadow: none; }
  .wide .home-pane .scroller { padding-left: 16px; padding-right: 16px; }
  .wide .home-pane .large-title { font-size: 28px; line-height: 34px; }
  .wide .tile { min-height: 76px; }
  .wide .tile-num { font-size: 24px; }
  .wide .nav-title { max-width: 40vw; }
  .wide .content { padding-top: 8px; }
  .wide .detail-pane .content { padding-top: 18px; }
  .wide .person-row:hover:not(.selected), .wide .gift-main:hover { background-color: #F7F7F9; }
  .wide .tile:hover { background: #FBFBFC; }
  .sheet-root { display: grid; place-items: center; }
  .sheet { position: relative; left: auto; right: auto; bottom: auto; width: min(560px, calc(100vw - 48px)); max-height: min(780px, calc(100% - 64px)); min-height: 0;
    border-radius: 14px; transform: translateY(16px) scale(.97); opacity: 0; box-shadow: 0 20px 70px rgba(0, 0, 0, .2), 0 0 0 .5px rgba(0, 0, 0, .06);
    transition: transform .3s var(--ease), opacity .2s; }
  .sheet.gift-sheet { height: min(760px, calc(100% - 64px)); }
  .sheet-root.in .sheet { transform: none; opacity: 1; }
  .sheet-root.in .sheet.stacked { transform: scale(.96); }
  .grabber { display: none; }
  .sheet-header { min-height: 54px; padding: 4px 10px 0; }
  .toast { bottom: 28px; }
  .menu-group .menu-item { cursor: default; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; transition-delay: 0s !important; }
}
