/* Nodova pages (index.php, admin.php): the shared look. Apple-style: the system font, a translucent toolbar,
 * inset grouped surfaces, spring motion and a light appearance. Accents are blue, green, orange, red and teal only.
 * Page additions: pay.css (license page) and admin.css (admin). Behaviour: ui.js. */

:root {
    --bg: #f5f5f7; --surface: #fff; --surface-2: #fafafc; --seg-on: #fff;
    --nav-bg: rgba(245, 245, 247, .74); --alert-bg: rgba(248, 248, 250, .86); --toast-bg: rgba(29, 29, 31, .9);
    --fill: rgba(120, 120, 128, .12); --fill-2: rgba(120, 120, 128, .07); --fill-3: rgba(120, 120, 128, .2);
    --label: #1d1d1f; --label-2: #6e6e73; --label-3: #aeaeb2; --sep: rgba(0, 0, 0, .09);
    --blue: #0071e3; --blue-hover: #0077ed; --blue-ink: #0066cc; --blue-tint: rgba(0, 113, 227, .09); --blue-tint-2: rgba(0, 113, 227, .2);
    --green: #34c759; --green-ink: #1b8a38; --green-tint: rgba(52, 199, 89, .14);
    --orange: #ff9500; --orange-ink: #b25000; --orange-tint: rgba(255, 149, 0, .14);
    --red: #ff3b30; --red-ink: #d70015; --red-tint: rgba(255, 59, 48, .1);
    --teal: #0a9fb5; --graphite: #1d1d1f;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);
    --shadow: 0 1px 2px rgba(0, 0, 0, .03), 0 6px 20px rgba(0, 0, 0, .045);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, .04), 0 22px 50px rgba(0, 0, 0, .11);
    --r-xs: 8px; --r-sm: 12px; --r: 16px; --r-lg: 22px;
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI Variable Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
    --out: cubic-bezier(.22, 1, .36, 1); --spring: cubic-bezier(.34, 1.56, .64, 1); --soft: cubic-bezier(.34, 1.25, .64, 1); --ease: cubic-bezier(.4, 0, .2, 1);
    --nav-h: 52px;
    color-scheme: light;
}
/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--nav-h) + 16px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--label); font: 15px/1.47 var(--font); letter-spacing: -.009em; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; padding-bottom: max(64px, env(safe-area-inset-bottom)); }
h1, h2, h3, p, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--blue-tint-2); outline-offset: 2px; }
::selection { background: var(--blue-tint-2); }
.ic { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 16px; height: 16px; }
.ic.xs { width: 13px; height: 13px; stroke-width: 2.2; }
.ic.lg { width: 26px; height: 26px; stroke-width: 1.6; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12px; color: var(--label-2); word-break: break-all; }
.muted { color: var(--label-2); }
.link { color: var(--blue-ink); font-weight: 500; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- toolbar ---------- */
.nav { position: sticky; top: 0; z-index: 50; height: calc(var(--nav-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left)); display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; background: var(--nav-bg); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: .5px solid transparent; transition: border-color .3s var(--ease), background-color .3s var(--ease); }
.nav.scrolled { border-bottom-color: var(--sep); }
.nav-back { justify-self: start; display: inline-flex; align-items: center; gap: 1px; height: 36px; padding: 0 10px 0 2px; border-radius: 10px; color: var(--blue-ink); font-size: 17px; letter-spacing: -.02em; min-width: 0; transition: background-color .2s, opacity .2s; }
.nav-back span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-back:hover { background: var(--fill-2); }
.nav-back:active { opacity: .5; }
.nav-back .ic { width: 24px; height: 24px; stroke-width: 2.3; transition: transform .3s var(--spring); }
.nav-back:hover .ic { transform: translateX(-2px); }
.nav-title { justify-self: center; display: flex; align-items: center; gap: 8px; font: 600 16px/1.2 var(--display); letter-spacing: -.02em; white-space: nowrap; }
.nav-title img { height: 22px; width: auto; display: block; }
.nav-right { justify-self: end; display: flex; align-items: center; gap: 6px; }

/* ---------- page ---------- */
.container { width: min(1040px, calc(100% - 40px)); margin: 0 auto; padding-top: 28px; display: grid; gap: 48px; }
.container > * { min-width: 0; }
.block { display: grid; gap: 14px; min-width: 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 0 4px; }
.section-head h2 { font: 700 24px/1.15 var(--display); letter-spacing: -.026em; }
.section-head p { margin-top: 4px; color: var(--label-2); font-size: 14px; line-height: 1.4; }
.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.card-in { padding: clamp(18px, 3vw, 24px); }
.foot { padding: 0 6px; color: var(--label-2); font-size: 12.5px; }

/* ---------- buttons ---------- */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 18px; border: 0; border-radius: 999px; font-size: 15px; font-weight: 500; white-space: nowrap; color: var(--blue-ink); background: var(--blue-tint); user-select: none; -webkit-user-select: none; transition: transform .45s var(--spring), background-color .2s var(--ease), color .2s, box-shadow .25s, opacity .2s; }
.btn:hover { background: var(--blue-tint-2); }
.btn:active { transform: scale(.95); transition-duration: .1s; }
.btn .ic { width: 17px; height: 17px; stroke-width: 2; }
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-hover); box-shadow: 0 6px 18px rgba(0, 113, 227, .28); }
.btn.gold { background: #f56300; color: #fff; }
.btn.gold:hover { background: #e35b00; box-shadow: 0 6px 18px rgba(245, 99, 0, .28); }
.btn.dark { background: var(--graphite); color: #fff; }
.btn.dark:hover { background: #000; box-shadow: 0 6px 18px rgba(0, 0, 0, .22); }
.btn.ghost { background: var(--fill); color: var(--label); }
.btn.ghost:hover { background: var(--fill-3); }
.btn.plain { background: none; padding: 0 10px; }
.btn.plain:hover { background: var(--fill-2); }
.btn.danger { color: var(--red-ink); background: var(--red-tint); }
.btn.danger:hover { background: rgba(255, 59, 48, .18); }
.btn.sm { min-height: 32px; padding: 0 14px; font-size: 14px; }
.btn.sm .ic { width: 15px; height: 15px; }
.btn.lg { min-height: 50px; padding: 0 26px; font-size: 17px; }
.btn.block { width: 100%; }
.btn.icon { width: 36px; min-height: 36px; padding: 0; }
.btn.icon.sm { width: 32px; min-height: 32px; }
.btn.copied { color: var(--green-ink); background: var(--green-tint); }
.btn.primary.copied, .btn.gold.copied, .btn.dark.copied { color: #fff; background: var(--green); }
.btn.copied .ic { animation: pop .45s var(--spring); }
.btn[disabled], .btn.busy { opacity: .5; pointer-events: none; }
.btn.busy { opacity: .75; }
.press { transition: transform .45s var(--spring), background-color .2s var(--ease), color .2s, box-shadow .25s, opacity .2s; }
.press:active { transform: scale(.95); transition-duration: .1s; }
.spin { width: 15px; height: 15px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; display: inline-block; flex: 0 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- status: coloured text with a dot ---------- */
.state { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--label-2); white-space: nowrap; }
.state::before { content: ""; width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: currentColor; }
.state.blue { color: var(--blue-ink); }
.state.green { color: var(--green-ink); }
.state.orange { color: var(--orange-ink); }
.state.red { color: var(--red-ink); }
.state.live::before { animation: live 2.4s var(--ease) infinite; }
@keyframes live { 0% { box-shadow: 0 0 0 0 currentColor; } 70%, 100% { box-shadow: 0 0 0 6px transparent; } }

/* ---------- notices ---------- */
.notice { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 16px 18px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); color: var(--label-2); font-size: 14px; line-height: 1.45; animation: rise .6s var(--out) both; }
.notice b { color: var(--label); font-weight: 600; }
.notice > .ic { width: 28px; height: 28px; padding: 6px; margin-top: -3px; border-radius: 50%; background: var(--blue); color: #fff; stroke-width: 2.6; }
.notice.ok > .ic { background: var(--green); }
.notice.warn > .ic { background: var(--orange); }
.notice.err > .ic { background: var(--red); }
.notice.err { color: var(--red-ink); }
.notice .grow { flex: 1; min-width: 0; }
.notice .actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.notice .hint { display: block; margin-top: 2px; }
.notice.celebrate > .ic path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: draw .55s .25s var(--out) forwards; }
.notice.celebrate > .ic { animation: pop .5s var(--spring) both; }
.notice.leaving { animation: leave .35s var(--ease) forwards; }
.notice-x { flex: 0 0 auto; display: grid; place-items: center; width: 28px; height: 28px; margin: -4px -6px 0 0; border: 0; border-radius: 50%; background: none; color: var(--label-3); transition: background-color .2s, color .2s, transform .3s var(--spring); }
.notice-x:hover { background: var(--fill); color: var(--label-2); }
.notice-x:active { transform: scale(.88); }
.notice-x .ic { width: 15px; height: 15px; stroke-width: 2.2; }
#payStatus:empty { display: none; }

/* ---------- toasts ---------- */
.toasts { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 120; display: grid; justify-items: center; gap: 8px; width: min(460px, calc(100% - 24px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 100%; padding: 10px 18px 10px 11px; border-radius: 22px; background: var(--toast-bg); color: #fff; backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); box-shadow: 0 14px 36px rgba(0, 0, 0, .26); font-size: 14px; font-weight: 500; line-height: 1.32; animation: toastIn .55s var(--spring) both; }
.toast .ic { width: 22px; height: 22px; padding: 4px; border-radius: 50%; background: rgba(255, 255, 255, .2); stroke-width: 2.8; }
.toast.ok .ic { background: #30d158; }
.toast.err .ic { background: #ff453a; }
.toast.out { animation: toastOut .3s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(24px) scale(.9); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(12px) scale(.94); } }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--label-2); padding-left: 2px; }
.input { width: 100%; min-height: 44px; padding: 10px 14px; border: 0; border-radius: var(--r-sm); background: var(--fill-2); font-size: 16px; outline: none; -webkit-appearance: none; appearance: none; transition: background-color .2s, box-shadow .3s var(--out); }
.input::placeholder { color: var(--label-3); }
.input:hover { background: var(--fill); }
.input:focus { background: var(--surface); box-shadow: 0 0 0 4px var(--blue-tint-2), inset 0 0 0 1px var(--blue); }
.input:disabled { opacity: .45; }
.input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--label-3) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M8 8l8 8M16 8l-8 8'/%3E%3C/svg%3E") center / 10px no-repeat; cursor: pointer; }
select.input { padding-right: 34px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 14px; }

/* iOS switch: the knob stretches while pressed */
.switch { position: relative; width: 51px; height: 31px; flex: 0 0 auto; margin: 0; border-radius: 999px; background: var(--fill-3); cursor: pointer; -webkit-appearance: none; appearance: none; transition: background-color .3s var(--ease); }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 999px; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .15), 0 1px 1px rgba(0, 0, 0, .16); transition: left .4s var(--spring), width .25s var(--out); }
.switch:active::after { width: 33px; }
.switch:checked { background: var(--green); }
.switch:checked::after { left: 22px; }
.switch:checked:active::after { left: 16px; }
.switch:disabled { opacity: .55; cursor: default; }
.switch:disabled::after { width: 27px; }
.switch:checked:disabled::after { left: 22px; }

/* segmented control (radio buttons); ui.js adds the sliding thumb */
.seg { position: relative; display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 2px; border-radius: 10px; background: var(--fill); isolation: isolate; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; inset: 0; opacity: 0; margin: 0; pointer-events: none; }
.seg span { display: block; padding: 6px 16px; border-radius: 8px; font-size: 13.5px; font-weight: 600; text-align: center; white-space: nowrap; color: var(--label-2); transition: color .25s, transform .3s var(--spring); }
.seg label:active span { transform: scale(.95); }
.seg input:checked + span { color: var(--label); background: var(--seg-on); box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 1px 1px rgba(0, 0, 0, .04); }
.seg input:focus-visible + span { outline: 3px solid var(--blue-tint-2); }
.seg.ready input:checked + span { background: none; box-shadow: none; }
.seg-thumb { position: absolute; z-index: -1; top: 2px; bottom: 2px; left: 0; width: 0; border-radius: 8px; background: var(--seg-on); box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 1px 1px rgba(0, 0, 0, .04); }
.seg.live .seg-thumb { transition: transform .5s var(--soft), width .5s var(--soft); }

/* number stepper: − value + */
.stepper { display: inline-flex; align-items: center; padding: 3px; border-radius: var(--r-sm); background: var(--fill-2); transition: opacity .3s; }
.stepper button { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 9px; background: none; color: var(--label); touch-action: manipulation; transition: background-color .15s, transform .3s var(--spring); }
.stepper button:hover { background: var(--fill); }
.stepper button:active { transform: scale(.86); transition-duration: .08s; }
.stepper button .ic { width: 16px; height: 16px; stroke-width: 2.4; }
.stepper input { width: 70px; height: 36px; padding: 0; border: 0; background: none; text-align: center; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; outline: none; -moz-appearance: textfield; appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { color: var(--blue-ink); }
.stepper:has(input:disabled) { opacity: .4; pointer-events: none; }
.stepper .bump { animation: bump .3s var(--spring); }
.stepper.shake { animation: shake .35s var(--ease); }
@keyframes bump { 40% { transform: scale(1.22); } }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }

/* grouped rows: label on the left, control on the right */
.rows { display: grid; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 58px; padding: 10px 0; border-bottom: .5px solid var(--sep); }
.rows > :last-child, .rows > :last-child .row { border-bottom: 0; }
.row-label { min-width: 0; }
.row-label b { display: block; font-weight: 500; color: var(--label); }
.row-label span { display: block; color: var(--label-2); font-size: 13px; line-height: 1.35; }
.row.stack { flex-direction: column; align-items: stretch; gap: 8px; }
label.row { cursor: pointer; }
.collapse { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .45s var(--out), opacity .3s var(--ease); }
.collapse > div { min-height: 0; overflow: hidden; }
.collapse.shut { grid-template-rows: 0fr; opacity: 0; }

/* ---------- lists and folds ---------- */
details.fold { border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
details.fold summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 14px 18px; min-height: 58px; cursor: pointer; user-select: none; -webkit-user-select: none; transition: background-color .2s; }
details.fold summary::-webkit-details-marker { display: none; }
details.fold summary:hover { background: var(--fill-2); }
details.fold summary .grow { flex: 1; min-width: 0; }
details.fold summary b { display: block; font-weight: 600; }
details.fold summary .sub { display: block; color: var(--label-2); font-size: 13px; }
details.fold .chev { color: var(--label-3); transition: transform .4s var(--spring); }
details.fold[open]:not(.closing) .chev { transform: rotate(180deg); }
.fold-body { overflow: hidden; }
.list { border-top: .5px solid var(--sep); }
.li { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 18px; font-size: 14px; }
.li + .li::before { content: ""; position: absolute; top: 0; left: 18px; right: 0; height: .5px; background: var(--sep); }
.li .grow { flex: 1; min-width: 0; }
.li .t { display: block; font-weight: 500; color: var(--label); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .s { display: block; color: var(--label-2); font-size: 12.5px; }
.li .amt { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty { display: grid; justify-items: center; gap: 8px; padding: 40px 20px; text-align: center; color: var(--label-2); font-size: 14px; }
.empty .ic { width: 44px; height: 44px; padding: 11px; border-radius: 50%; background: var(--fill-2); color: var(--label-3); stroke-width: 1.8; }
.empty b { color: var(--label); font-weight: 600; font-size: 16px; }

/* ---------- tables (cards on phones) ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 760px; }
.tbl th { padding: 14px 14px 10px; border-bottom: .5px solid var(--sep); text-align: left; font-size: 12px; font-weight: 600; color: var(--label-2); white-space: nowrap; }
.tbl td { padding: 12px 14px; border-bottom: .5px solid var(--sep); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background-color .15s; animation: rowIn .45s var(--out) both; }
.tbl tbody tr:nth-child(2) { animation-delay: .03s; } .tbl tbody tr:nth-child(3) { animation-delay: .06s; }
.tbl tbody tr:nth-child(4) { animation-delay: .09s; } .tbl tbody tr:nth-child(5) { animation-delay: .12s; }
.tbl tbody tr:nth-child(6) { animation-delay: .15s; } .tbl tbody tr:nth-child(7) { animation-delay: .18s; }
.tbl tbody tr:nth-child(n+8) { animation-delay: .21s; }
@media (hover: hover) { .tbl tbody tr:hover { background: var(--fill-2); } }
.tbl tr[data-href] { cursor: pointer; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .sub { display: block; margin-top: 2px; color: var(--label-2); font-size: 12px; font-weight: 400; }
.tbl td.stack b { display: block; font-weight: 600; }
.tbl .muted { font-size: 13px; }
@keyframes rowIn { from { opacity: 0; transform: translateY(6px); } }

@media (max-width: 720px) {
    .table-wrap { overflow: visible; }
    table.tbl.cards, .tbl.cards tbody { display: block; min-width: 0; }
    .tbl.cards thead { display: none; }
    .tbl.cards tr { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 16px; padding: 16px 18px; }
    .tbl.cards tr + tr::before { content: ""; position: absolute; top: 0; left: 18px; right: 0; height: .5px; background: var(--sep); }
    .tbl.cards td { display: block; min-width: 0; padding: 0; border: 0; text-align: left !important; overflow-wrap: anywhere; }
    .tbl.cards td::before { content: attr(data-label); display: block; margin-bottom: 1px; font-size: 11.5px; font-weight: 600; color: var(--label-2); }
    .tbl.cards td.m-head { grid-column: 1; grid-row: 1; align-self: center; font-weight: 600; }
    .tbl.cards td.m-aside { grid-column: 2; grid-row: 1; justify-self: end; align-self: center; }
    .tbl.cards td.m-head::before, .tbl.cards td.m-aside::before { display: none; }
    .tbl.cards td.m-wide { grid-column: 1 / -1; }
    .tbl.cards td.m-hide { display: none; }
    .tbl.cards td:empty { display: none; }
}

/* ---------- alert dialog (ui.js) ---------- */
dialog.alert { width: min(300px, calc(100% - 48px)); padding: 0; border: 0; border-radius: 18px; background: var(--alert-bg); color: var(--label); backdrop-filter: saturate(180%) blur(30px); -webkit-backdrop-filter: saturate(180%) blur(30px); box-shadow: var(--shadow-lg); text-align: center; overflow: hidden; }
dialog.alert[open] { animation: alertIn .4s var(--spring); }
dialog.alert.closing { animation: alertOut .2s var(--ease) forwards; }
dialog.alert::backdrop { background: rgba(0, 0, 0, .3); animation: fadeIn .25s var(--ease); }
dialog.alert.closing::backdrop { animation: fadeOut .2s var(--ease) forwards; }
.alert-text { padding: 20px 18px 18px; }
.alert-text b { display: block; font-size: 16px; font-weight: 600; line-height: 1.3; }
.alert-text span { display: block; margin-top: 4px; font-size: 13.5px; color: var(--label-2); line-height: 1.35; }
.alert-actions { display: grid; grid-template-columns: 1fr 1fr; border-top: .5px solid var(--sep); }
.alert-actions button { min-height: 46px; border: 0; background: none; font-size: 16px; color: var(--blue-ink); transition: background-color .15s; }
.alert-actions button + button { border-left: .5px solid var(--sep); font-weight: 600; }
.alert-actions button:hover { background: var(--fill-2); }
.alert-actions button:active { background: var(--fill); }
.alert-actions button.danger { color: var(--red); }
@keyframes alertIn { from { opacity: 0; transform: scale(1.12); } }
@keyframes alertOut { to { opacity: 0; transform: scale(.96); } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }

/* ---------- sheet (ui.js: [data-sheet] opens, [data-close] closes); a bottom sheet on phones ---------- */
dialog.sheet { width: min(520px, calc(100% - 32px)); max-width: none; max-height: min(86dvh, 720px); padding: 0; border: 0; border-radius: 22px; background: var(--surface); color: var(--label); box-shadow: var(--shadow-lg); overflow: hidden; }
dialog.sheet[open] { display: flex; flex-direction: column; animation: sheetIn .5s var(--soft); }
dialog.sheet.closing { animation: sheetOut .25s var(--ease) forwards; }
dialog.sheet::backdrop { background: rgba(0, 0, 0, .28); animation: fadeIn .3s var(--ease); }
dialog.sheet.closing::backdrop { animation: fadeOut .25s var(--ease) forwards; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 20px 6px 24px; }
.sheet-head h2 { font: 700 22px/1.2 var(--display); letter-spacing: -.024em; }
.sheet-body { overflow: auto; overscroll-behavior: contain; padding: 4px 24px 26px; color: var(--label-2); font-size: 15px; line-height: 1.5; }
.sheet-grab { display: none; }
@keyframes sheetIn { from { opacity: 0; transform: translateY(24px) scale(.97); } }
@keyframes sheetOut { to { opacity: 0; transform: translateY(14px) scale(.98); } }
@keyframes sheetUp { from { transform: translateY(100%); } }
@keyframes sheetDown { to { transform: translateY(100%); } }

/* ---------- motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes pop { from { opacity: 0; transform: scale(.6); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes leave { to { opacity: 0; transform: scale(.97); } }
.rise { animation: rise .7s var(--out) both; animation-delay: calc(var(--i, 0) * 70ms); }
.rv-wait { opacity: 0; transform: translateY(22px); animation: none !important; }
.rv-in { animation: none !important; transition: opacity .8s var(--out), transform .8s var(--out) !important; transition-delay: calc(var(--i, 0) * 70ms) !important; }
.rv-done { animation: none !important; }

/* page-to-page cross-fade, and the admin tab thumb slides between tabs (Chrome, Edge, Safari 18+) */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: .18s var(--ease) both fadeOut; }
::view-transition-new(root) { animation: .28s var(--ease) both fadeIn; }

@media (max-width: 640px) {
    :root { --nav-h: 48px; }
    .container { width: calc(100% - 32px); padding-top: 18px; gap: 40px; }
    .nav-back span { display: none; }
    .nav-back { padding: 0 4px; }
    .section-head h2 { font-size: 22px; }
    .card-in { padding: 18px; }
    dialog.sheet { width: 100%; max-height: 90dvh; margin: auto 0 0; border-radius: 22px 22px 0 0; padding-bottom: env(safe-area-inset-bottom); }
    dialog.sheet[open] { animation: sheetUp .55s var(--out); }
    dialog.sheet.closing { animation: sheetDown .3s var(--ease) forwards; }
    .sheet-grab { display: block; width: 36px; height: 5px; margin: 8px auto -6px; border-radius: 3px; background: var(--fill-3); }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
    .rv-wait { opacity: 1; transform: none; }
    @view-transition { navigation: none; }
}
