/* Components for the checklist app. All colours / shapes come from tokens.css. */

/* ------------------------------------------------------------ base */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; background: var(--paper); }
body {
  margin: 0; background: var(--paper); color: var(--text);
  font: 500 var(--fs)/1.4 var(--font);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }
input, select, button, textarea { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 3px solid var(--purple); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.app { max-width: 1240px; margin: 0 auto; padding: calc(14px + var(--safe-t)) 16px calc(56px + var(--safe-b)); }
@media (min-width: 720px) { .app { padding: calc(22px + var(--safe-t)) 32px 72px; } }
.loading { color: var(--muted); font-weight: 600; text-align: center; padding: 40px 0; }

.icon { display: inline-flex; width: 1.25em; height: 1.25em; flex: none; }
.icon svg { width: 100%; height: 100%; }

/* ------------------------------------------------------------ top bar */
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; min-height: 50px; }
.topbar nav { display: flex; gap: 10px; margin-left: auto; flex: none; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font-size: 22px; font-weight: 800; letter-spacing: -.02em; min-width: 0; }
.brand .tile { width: 46px; height: 46px; box-shadow: var(--sh-sm); }
.brand .word { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb { display: flex; flex-direction: column; min-width: 0; }
.crumb small { font-size: 12px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.crumb strong { font-size: 21px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------ buttons */
.btn, .sq {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--surface); color: var(--text);
  border: var(--bw) solid var(--ink); box-shadow: var(--sh);
  font-weight: 700; cursor: pointer; text-decoration: none; touch-action: manipulation; user-select: none;
  transition: transform var(--t-press) var(--ease-out), box-shadow var(--t-press) var(--ease-out), background-color var(--t-ui) ease;
}
.btn { min-height: 48px; padding: 0 16px; border-radius: var(--r-btn); }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: 14px; border-width: var(--bw-sm); border-radius: 9px; box-shadow: var(--sh-sm); }
.btn.big { min-height: 58px; font-size: var(--fs-lg); font-weight: 800; padding: 0 22px; }
.btn.block { width: 100%; }
.btn.yellow, .sq.yellow { background: var(--yellow); color: var(--on-color); }
.btn.green { background: var(--green); color: var(--on-color); }
.btn.danger, .sq.danger { color: var(--red); }
.btn.ghost { box-shadow: none; border-style: dashed; background: transparent; }
.btn .icon { width: 20px; height: 20px; }
.btn.sm .icon { width: 17px; height: 17px; }

.sq { width: 50px; height: 50px; padding: 0; border-radius: 13px; flex: none; }
.sq .icon { width: 24px; height: 24px; }
.sq.sm { width: 38px; height: 38px; border-radius: 10px; border-width: var(--bw-sm); box-shadow: var(--sh-sm); }
.sq.sm .icon { width: 18px; height: 18px; }

@media (hover: hover) and (pointer: fine) {
  .btn:hover:not(:disabled), .sq:hover:not(:disabled) { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--shadow); }
  .btn.sm:hover:not(:disabled), .sq.sm:hover:not(:disabled) { box-shadow: 3px 3px 0 var(--shadow); }
  .btn.ghost:hover:not(:disabled) { box-shadow: none; transform: none; background: var(--sunk); }
}
.btn:active:not(:disabled), .sq:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--shadow); }
.btn.sm:active:not(:disabled), .sq.sm:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--shadow); }
.btn.ghost:active:not(:disabled) { transform: scale(.98); box-shadow: none; }
.btn:disabled, .sq:disabled { opacity: .5; cursor: default; }
.btn.busy { cursor: progress; opacity: .75; }

.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.end { justify-content: flex-end; }
.grow { flex: 1 1 auto; }

/* ------------------------------------------------------------ cards */
.card {
  position: relative; background: var(--surface);
  border: var(--bw) solid var(--ink); border-radius: var(--r); box-shadow: var(--sh-lg);
  padding: 16px;
}
.tile {
  display: inline-grid; place-items: center; flex: none; width: 52px; height: 52px;
  background: var(--tile, var(--gray)); color: var(--on-color);
  border: var(--bw) solid var(--ink); border-radius: 11px;
}
.tile .icon { width: 26px; height: 26px; }
.c0 { --tab: var(--pink); --tile: var(--pink); --soft: var(--pink-soft); }
.c1 { --tab: var(--purple); --tile: var(--purple); --soft: var(--purple-soft); }
.c2 { --tab: var(--yellow); --tile: var(--yellow); --soft: var(--yellow-soft); }
.c3 { --tab: var(--green); --tile: var(--green); --soft: var(--green-soft); }
.c4 { --tab: var(--lime); --tile: var(--lime); --soft: var(--green-soft); }
.c5 { --tab: var(--peach); --tile: var(--peach); --soft: var(--yellow-soft); }

/* folder-tab card: a coloured tab peeking out above the top-left corner */
.folders { isolation: isolate; }
.folder { margin-top: 20px; }
.folder::before {
  content: ""; position: absolute; z-index: -1; left: 10px; top: -17px; width: 46%; height: 30px;
  background: var(--tab, var(--gray)); border: var(--bw) solid var(--ink); border-radius: 9px 14px 0 0;
}

/* Yellow banner with the pink circle + purple slab, as on Split Bill and the game. */
.banner {
  position: relative; overflow: hidden; isolation: isolate;
  background: var(--yellow); color: var(--on-color); padding: 22px 20px;
}
.banner::before {
  content: ""; position: absolute; z-index: -1; width: 150px; height: 150px; border-radius: 50%;
  border: var(--bw) solid var(--ink); background: var(--pink); right: -55px; top: -70px;
}
.banner::after {
  content: ""; position: absolute; z-index: -1; width: 210px; height: 110px;
  border: var(--bw) solid var(--ink); background: var(--purple); right: -80px; bottom: -75px; transform: rotate(-14deg);
}
.banner .btn, .banner .sq { color: var(--text); }
.banner .btn.yellow { color: var(--on-color); }
@media (min-width: 720px) {
  .banner { padding: 30px 34px; }
  .banner::before { width: 240px; height: 240px; right: -80px; top: -130px; }
  .banner::after { width: 360px; height: 160px; right: -140px; bottom: -115px; }
}

.hero { font-size: var(--fs-hero); line-height: .98; font-weight: 800; letter-spacing: -.035em; margin: 0; }
.sub { margin: 12px 0 0; font-weight: 700; font-size: 18px; }
.section { display: flex; align-items: center; gap: 10px; font-size: var(--fs-h2); font-weight: 800; letter-spacing: -.01em; margin: 30px 0 14px; }
.section .count { font-size: 14px; font-weight: 700; color: var(--muted); }
.hint { color: var(--muted); font-size: 14px; font-weight: 600; margin: 0; }
.status { min-height: 1.3em; margin: 0; font-size: 15px; font-weight: 700; color: var(--bad); }
.status:empty { min-height: 0; }

/* empty states */
.empty {
  display: grid; justify-items: center; gap: 12px; text-align: center; padding: 30px 18px;
  background: var(--surface); border: var(--bw) dashed var(--ink); border-radius: var(--r);
}
.empty .tile { width: 60px; height: 60px; box-shadow: var(--sh-sm); }
.empty h3 { margin: 4px 0 0; font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.empty p { margin: 0; color: var(--muted); font-weight: 600; max-width: 36ch; }

/* ------------------------------------------------------------ fields */
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
label.field .lbl-row { display: flex; justify-content: space-between; gap: 8px; }
label.field .lbl-row .num { color: var(--text); }
.input, textarea.input {
  width: 100%; min-width: 0; min-height: 50px; padding: 0 13px;
  background: var(--surface); color: var(--text);
  border: var(--bw-sm) solid var(--ink); border-radius: var(--r-sm);
  font-size: 16px; font-weight: 600;   /* 16px stops iOS from zooming in */
  transition: box-shadow var(--t-press) var(--ease-out);
}
textarea.input { padding: 12px 13px; min-height: 168px; resize: vertical; line-height: 1.5; }
.input::placeholder { color: var(--muted); font-weight: 500; opacity: .8; }
.input:focus { outline: none; box-shadow: 3px 3px 0 var(--purple); }
.input[aria-invalid="true"] { box-shadow: 3px 3px 0 var(--red); }
.pw { display: flex; gap: 8px; align-items: center; }
.pw .input { flex: 1; }
.stack { display: grid; gap: 14px; }

/* ------------------------------------------------------------ login / unlock */
.login-wrap { display: grid; gap: 22px; max-width: 980px; margin: 0 auto; }
@media (min-width: 860px) { .login-wrap { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: stretch; margin-top: 4vh; } }
.login-banner { display: flex; flex-direction: column; justify-content: center; min-height: 210px; }
.login-card { display: grid; gap: 16px; align-content: center; padding: 22px; }
.login-card .btn { margin-top: 4px; }

/* ------------------------------------------------------------ home: folder cards */
.home-banner { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px; }
.grid-folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 26px 18px; margin-top: 36px; }
.fcard { display: flex; flex-direction: column; gap: 14px; min-height: 160px; transition: transform var(--t-press) var(--ease-out), box-shadow var(--t-press) var(--ease-out); }
.fcard .top { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.fcard .name { margin-top: auto; font-size: 21px; font-weight: 800; letter-spacing: -.015em; line-height: 1.15; overflow-wrap: anywhere; }
.fcard .meta { font-size: 14px; color: var(--muted); font-weight: 600; margin-top: -8px; }
/* the whole card is the link; the settings button sits above it */
.fcard .open { position: absolute; inset: 0; border-radius: var(--r); z-index: 1; }
.fcard .open:focus-visible { outline-offset: 4px; }
.fcard .sq { position: relative; z-index: 2; }
@media (hover: hover) and (pointer: fine) { .fcard:has(.open:hover) { transform: translate(-1px, -1px); box-shadow: 7px 7px 0 var(--shadow); } }
.fcard:has(.open:active) { transform: translate(3px, 3px); box-shadow: 3px 3px 0 var(--shadow); }

/* ------------------------------------------------------------ folder view */
.seg {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0; padding: 4px; margin-bottom: 18px;
  background: var(--sunk); border: var(--bw) solid var(--ink); border-radius: 14px; max-width: 460px;
}
.seg button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px;
  background: transparent; border: var(--bw-sm) solid transparent; border-radius: 10px; font-weight: 800; cursor: pointer;
  color: var(--muted); transition: background-color var(--t-ui) ease, color var(--t-ui) ease;
}
.seg button[aria-selected="true"] { background: var(--surface); color: var(--text); border-color: var(--ink); box-shadow: var(--sh-sm); }
.seg .count { font-size: 13px; padding: 1px 7px; border-radius: 999px; background: var(--paper); border: var(--bw-sm) solid var(--ink); color: var(--text); }

.layout-tasks { display: grid; gap: 16px; }
@media (min-width: 900px) {
  .layout-tasks { grid-template-columns: 280px minmax(0, 1fr); gap: 28px; align-items: start; }
}

/* task switcher: horizontal chips on phones, a side list on wide screens */
.tasknav {
  position: sticky; top: 0; z-index: 5; margin: 0 -16px; padding: 8px 16px 12px;
  background: var(--paper);
  display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity;
  overscroll-behavior-x: contain;
}
.tasknav::-webkit-scrollbar { display: none; }
.tchip {
  flex: none; scroll-snap-align: start; display: grid; gap: 6px; text-align: left; min-width: 132px; max-width: 220px;
  padding: 10px 12px; background: var(--surface); color: var(--text);
  border: var(--bw-sm) solid var(--ink); border-radius: 12px; box-shadow: var(--sh-sm); cursor: pointer;
  transition: transform var(--t-press) var(--ease-out), box-shadow var(--t-press) var(--ease-out), background-color var(--t-ui) ease;
}
.tchip:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--shadow); }
.tchip .t { font-weight: 800; font-size: 15px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tchip .p { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--muted); }
.tchip .n { flex: none; }
.tchip[aria-current="true"] { background: var(--yellow); color: var(--on-color); }
.tchip[aria-current="true"] .p { color: var(--on-color); }
.tchip.complete .n::after { content: " ✓"; }
.tchip.add { min-width: 0; display: inline-flex; align-items: center; gap: 6px; border-style: dashed; box-shadow: none; background: transparent; font-weight: 800; }
.tasknav .lead { display: none; }
@media (min-width: 900px) {
  .tasknav {
    position: sticky; top: 20px; margin: 0; padding: 14px; flex-direction: column; overflow: visible;
    background: var(--surface); border: var(--bw) solid var(--ink); border-radius: var(--r); box-shadow: var(--sh-lg);
    max-height: calc(100vh - 40px); overflow-y: auto;
  }
  .tasknav .lead { display: block; font-size: 13px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin: 2px 2px 0; }
  .tchip { max-width: none; min-width: 0; }
  @media (hover: hover) and (pointer: fine) { .tchip:not([aria-current="true"]):hover { background: var(--sunk); } }
}

/* progress bars: scaleX on the fill (composited, cheap) */
.bar { position: relative; height: 12px; flex: 1; min-width: 40px; border: var(--bw-sm) solid var(--ink); border-radius: 999px; background: var(--surface); overflow: hidden; }
.bar > i { position: absolute; inset: 0; background: var(--green); transform-origin: left; transform: scaleX(var(--p, 0)); transition: transform 260ms var(--ease-out); }
.bar.thin { height: 8px; border-width: 1.5px; }
.tchip[aria-current="true"] .bar { background: var(--yellow-soft); }

.task-head { display: grid; gap: 14px; }
.task-head .top { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.task-head h2 { margin: 0; font-size: clamp(26px, 6.5vw, 40px); font-weight: 800; letter-spacing: -.03em; line-height: 1.05; overflow-wrap: anywhere; }
.task-head .total { display: flex; align-items: baseline; gap: 12px; font-weight: 800; }
.task-head .total .big { font-size: 30px; letter-spacing: -.02em; line-height: 1; }
.task-head .bar.main { flex: none; width: 100%; height: 16px; border-width: var(--bw); background: #fff; }
.task-head .label { font-size: 15px; font-weight: 800; }
.task-head h2 { padding-right: 4px; }
@media (min-width: 720px) { .task-head .bar.main { width: calc(100% - 120px); } }  /* keep clear of the purple slab */

.groups-grid { display: grid; gap: 18px; margin-top: 20px; }
@media (min-width: 1180px) { .groups-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }

.gcard { padding: 0; overflow: hidden; }
.gcard .ghead { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; padding: 14px 14px 12px; border-bottom: var(--bw) solid var(--ink); background: var(--soft, var(--sunk)); }
.gcard .gname { font-size: 19px; font-weight: 800; letter-spacing: -.01em; overflow-wrap: anywhere; }
.gcard .gcount { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 800; padding: 2px 9px; border-radius: 999px; background: var(--surface); border: var(--bw-sm) solid var(--ink); transition: background-color var(--t-ui) ease; }
.gcard.complete .gcount { background: var(--green); color: var(--on-color); }
.gcard .ghead .bar { grid-column: 1 / -1; }
.gcard .gtitle { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }

.members { list-style: none; margin: 0; padding: 6px; }
.member {
  display: flex; align-items: center; gap: 14px; min-height: 54px; padding: 8px 10px; border-radius: 10px;
  cursor: pointer; user-select: none; font-weight: 600; font-size: 17px;
  transition: background-color 150ms ease;
}
.member + .member { margin-top: 2px; }
.member input { position: absolute; opacity: 0; pointer-events: none; }
.member .box {
  display: grid; place-items: center; flex: none; width: 30px; height: 30px;
  border: var(--bw) solid var(--ink); border-radius: 8px; background: var(--surface); color: var(--on-color);
  box-shadow: var(--sh-sm); transition: background-color 120ms ease, transform var(--t-press) var(--ease-out), box-shadow var(--t-press) var(--ease-out);
}
.member .box .icon { width: 20px; height: 20px; opacity: 0; transform: scale(.6); transition: opacity 140ms ease, transform 180ms var(--ease-out); }
.member .nm { min-width: 0; overflow-wrap: anywhere; transition: color 150ms ease; }
.member:active .box { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--shadow); }
.member:has(input:checked) { background: var(--green-soft); }
.member:has(input:checked) .box { background: var(--green); }
.member:has(input:checked) .box .icon { opacity: 1; transform: scale(1); }
.member:has(input:checked) .nm { color: var(--muted); }
.member:has(input:focus-visible) { outline: 3px solid var(--purple); outline-offset: -3px; }
@media (hover: hover) and (pointer: fine) { .member:hover:not(:has(input:checked)) { background: var(--sunk); } }
.gempty { padding: 14px 16px 16px; color: var(--muted); font-weight: 600; font-size: 15px; }

/* a name that just moved between "to do" and "done" slides in softly */
.members li.arrive { animation: arrive 260ms var(--ease-out); }
@keyframes arrive { from { opacity: 0; transform: translateY(-6px); } }

/* everyone in the group is ticked */
.gall { display: flex; align-items: center; gap: 10px; margin: 0; padding: 16px; font-weight: 700; color: var(--good); }
.gall .icon { width: 22px; height: 22px; }

/* ticked people, folded into one row at the bottom of the group */
.done-fold { border-top: var(--bw-sm) dashed color-mix(in srgb, var(--ink) 35%, transparent); }
.done-fold summary {
  display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 16px;
  list-style: none; cursor: pointer; user-select: none; font-weight: 700; color: var(--muted);
}
.done-fold summary::-webkit-details-marker { display: none; }
.done-fold .dbox {
  display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 7px;
  background: var(--green); color: var(--on-color); border: var(--bw-sm) solid var(--ink);
}
.done-fold .dbox .icon { width: 17px; height: 17px; }
.done-fold .dlabel { flex: none; color: var(--text); font-weight: 800; }
.done-fold .dnames { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }
.done-fold .chev { width: 20px; height: 20px; transition: transform 180ms var(--ease-out); }
.done-fold[open] .chev { transform: rotate(180deg); }
.done-fold[open] .dnames { visibility: hidden; }
.done-fold summary:focus-visible { outline: 3px solid var(--purple); outline-offset: -3px; }
@media (hover: hover) and (pointer: fine) { .done-fold summary:hover { background: var(--sunk); } }
.done-fold .members { padding-top: 0; }

/* ------------------------------------------------------------ groups tab */
.layout-groups { display: grid; gap: 22px; }
@media (min-width: 980px) {
  .layout-groups { grid-template-columns: 400px minmax(0, 1fr); gap: 32px; align-items: start; }
  .layout-groups > .side { position: sticky; top: 20px; }
}
.gform { display: grid; gap: 14px; }
.gform h2 { margin: 0; font-size: var(--fs-h2); font-weight: 800; letter-spacing: -.01em; }
.glist { display: grid; gap: 22px; }
.gitem .gi-head { display: flex; align-items: center; gap: 12px; }
.gitem .gi-head .grow { min-width: 0; }
.gitem .gi-name { font-size: 19px; font-weight: 800; overflow-wrap: anywhere; }
.gitem .gi-meta { font-size: 14px; color: var(--muted); font-weight: 600; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.pill { display: inline-flex; align-items: center; padding: 3px 10px; border: var(--bw-sm) solid var(--ink); border-radius: 999px; background: var(--sunk); font-size: 14px; font-weight: 600; }
.pill.more { background: var(--surface); font-weight: 800; }
.gitem.editing { box-shadow: 6px 6px 0 var(--purple); }

/* ------------------------------------------------------------ dialog */
.dlg {
  width: min(460px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; margin: auto;
  background: var(--surface); color: var(--text);
  border: var(--bw) solid var(--ink); border-radius: var(--r); box-shadow: var(--sh-lg);
  opacity: 1; transform: none;
  transition: opacity 180ms var(--ease-out), transform 200ms var(--ease-out), overlay 200ms allow-discrete, display 200ms allow-discrete;
}
.dlg:not([open]) { opacity: 0; transform: translateY(8px) scale(.98); transition-duration: 120ms; }
@starting-style { .dlg[open] { opacity: 0; transform: translateY(8px) scale(.98); } }
.dlg::backdrop { background: rgb(18 18 18 / .45); transition: background-color 180ms ease, overlay 200ms allow-discrete, display 200ms allow-discrete; }
@starting-style { .dlg[open]::backdrop { background: rgb(18 18 18 / 0); } }
.dlg form, .dlg .body { display: grid; gap: 16px; padding: 20px; }
.dlg h2 { margin: 0; font-size: 23px; font-weight: 800; letter-spacing: -.02em; padding-right: 44px; overflow-wrap: anywhere; }
.dlg .close { position: absolute; right: 12px; top: 12px; }
.dlg .msg { margin: 0; font-weight: 600; color: var(--muted); }
.dlg .divider { border: 0; border-top: 2px dashed color-mix(in srgb, var(--ink) 30%, transparent); margin: 2px 0; }
.dlg .acts { display: flex; flex-wrap: wrap-reverse; gap: 10px; justify-content: flex-end; }
.dlg .acts .btn { flex: 1 1 140px; }
.linkbox { display: flex; gap: 8px; align-items: center; }
.linkbox .input { flex: 1; font-size: 14px; font-weight: 600; min-height: 46px; }

/* phones: dialogs become bottom sheets (easier to reach) */
@media (max-width: 600px) {
  .dlg { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 18px 18px 0 0; border-bottom: 0; box-shadow: 0 -4px 0 var(--shadow); padding-bottom: var(--safe-b); }
  .dlg:not([open]) { transform: translateY(100%); opacity: 1; transition-duration: 160ms; }
  @starting-style { .dlg[open] { transform: translateY(100%); opacity: 1; } }
  .dlg { transition: transform 260ms var(--ease-out), overlay 260ms allow-discrete, display 260ms allow-discrete; }
}

/* ------------------------------------------------------------ toasts */
.toasts { position: fixed; left: 0; right: 0; bottom: calc(16px + var(--safe-b)); z-index: 50; display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 460px;
  padding: 11px 14px; background: var(--surface); color: var(--text); font-weight: 700; font-size: 15px;
  border: var(--bw) solid var(--ink); border-radius: 12px; box-shadow: var(--sh);
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
}
@starting-style { .toast { opacity: 0; transform: translateY(10px); } }
.toast.out { opacity: 0; transform: translateY(6px); transition-duration: 140ms; }
.toast.error { background: var(--pink-soft); }
.toast.error .icon { color: var(--red); }
.toast.ok .icon { color: var(--good); }
.toast button { margin-left: 4px; }

/* ------------------------------------------------------------ misc */
.saving { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; opacity: .75; }
.footer-note { margin-top: 40px; text-align: center; font-size: 13px; color: var(--muted); font-weight: 600; }
.footer-note a { text-underline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
  .member .box .icon, .bar > i, .toast { transition: opacity 120ms ease !important; }
}
