/*!
 * POPNIX Account app: the page's own layout and components (prefix acc-). The shared kit (common/popnix kit.css,
 * prefix px-) gives the base, top bar, segmented control, buttons, fields, tags and skeletons; tokens.css gives every
 * colour. Rules (themes/popnix/DESIGN.md): tokens only (raw colour lives only in the boarding pass art), no gradient
 * on a control, no coloured glow, no coloured bars (grey hairlines only), one night deck per page (the boarding pass on
 * Overview), transform/opacity motion only, every animation stops under prefers-reduced-motion.
 *
 *   1 shell ........ .acc-app · .acc-topbar · .acc-shell · .acc-nav (left column, a scrolling segmented strip on phones)
 *   2 page ......... .acc-head · .acc-h1 · .acc-panel · .acc-rows/.acc-row · .acc-kv (label, value, action)
 *   3 states ....... skeleton sizes · .acc-empty (art + title + one action) · .acc-art (empty-state SVG classes)
 *   4 pass ......... .acc-pass: the boarding pass (night deck, perforated stub, stamps, barcode, one sheen)
 *   5 overlays ..... .acc-dialog (own Promise confirm, typed confirm) · .acc-toasts
 *   6 motion ....... view entrance, pass entrance, reduced motion
 */

/* ===================================================================================================== 1. shell */
.acc-app {
    --acc-max: 1100px;
    --acc-gutter: 28px;
    --acc-top-h: 64px;
    --acc-nav-w: 212px;
    --acc-glass: color-mix(in srgb, var(--px-surface) 86%, transparent);
    background: var(--px-bg);
}
.acc-skip {
    position: fixed; left: 12px; top: -60px; z-index: 80; padding: .55rem 1rem; border-radius: var(--px-r-md);
    background: var(--px-text); color: var(--px-surface); font-weight: 500; transition: top .2s var(--px-ease);
}
.acc-skip:focus { top: 12px; color: var(--px-surface); text-decoration: none; }

/* top bar: the kit's .px-top, sticky on a glass strip, aligned with the content column */
.acc-topbar {
    position: sticky; top: 0; z-index: 40; height: var(--acc-top-h);
    background: var(--acc-glass); -webkit-backdrop-filter: blur(16px) saturate(170%); backdrop-filter: blur(16px) saturate(170%);
    border-bottom: 1px solid var(--px-border);
}
.acc-topbar > .px-top { height: 100%; max-width: calc(var(--acc-max) + 2 * var(--acc-gutter)); margin: 0 auto; padding: 0 var(--acc-gutter); gap: 12px; }
.acc-topbar .px-brand { font-size: 1.1rem; }
.acc-topbar .px-tools { gap: 8px; min-width: 0; }
.acc-staff-badge {
    display: inline-flex; align-items: center; height: 20px; padding: 0 .45rem; margin-left: .15rem; border-radius: var(--px-r-sm);
    background: var(--px-accent); color: var(--px-night-0); font-size: .7rem; font-weight: 700; letter-spacing: .08em; line-height: 1;
}
.acc-back {
    display: inline-flex; align-items: center; gap: .45rem; height: 34px; max-width: 220px; padding: 0 12px 0 10px; border-radius: var(--px-r-pill);
    border: 1px solid var(--px-border); background: var(--px-surface); color: var(--px-text-2); font-size: .88rem; font-weight: 500; white-space: nowrap;
    transition: border-color var(--px-dur-micro) var(--px-ease), color var(--px-dur-micro) var(--px-ease);
}
.acc-back:hover { color: var(--px-text); border-color: var(--px-border-strong); text-decoration: none; }
.acc-back > span { overflow: hidden; text-overflow: ellipsis; }
.acc-signout .acc-i { color: var(--px-muted); }

.acc-shell {
    max-width: calc(var(--acc-max) + 2 * var(--acc-gutter)); margin: 0 auto; padding: 28px var(--acc-gutter) 96px;
    display: grid; grid-template-columns: var(--acc-nav-w) minmax(0, 1fr); gap: 36px; align-items: start;
}
.acc-main { min-width: 0; outline: none; }

/* section nav: a quiet column of links, the current one raised in ink (never a coloured bar) */
.acc-nav { position: sticky; top: calc(var(--acc-top-h) + 24px); }
.acc-nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.acc-nav-link {
    display: flex; align-items: center; gap: .7rem; min-height: 42px; padding: 5px 10px; border-radius: var(--px-r-md);
    color: var(--px-text-2); font-weight: 500; font-size: .98rem; line-height: 1.25;
    transition: background-color var(--px-dur-micro) var(--px-ease), color var(--px-dur-micro) var(--px-ease);
}
.acc-nav-link:hover { background: var(--px-hover); color: var(--px-text); text-decoration: none; }
.acc-nav-link:active { transform: scale(.985); }
.acc-nav-link[aria-current="page"] { background: var(--px-press); color: var(--px-text); font-weight: 700; }
.acc-nav-icon {
    width: 30px; height: 30px; flex: 0 0 30px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center;
    color: var(--px-muted); font-size: 1rem; transition: color var(--px-dur-micro) var(--px-ease);
}
.acc-nav-link:hover .acc-nav-icon { color: var(--px-text-2); }
.acc-nav-link[aria-current="page"] .acc-nav-icon { color: var(--px-accent-text); --fa-secondary-opacity: .45; }
.acc-nav-sep { height: 1px; margin: 10px 10px; background: var(--px-border); }

/* ====================================================================================================== 2. page */
.acc-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-height: 2.6rem; margin: 0 0 18px; }
.acc-h1 { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 1.6rem; line-height: 1.2; text-wrap: balance; outline: none; }
html[lang="en"] .acc-h1 { letter-spacing: -.01em; }
.acc-h1 > .acc-count { margin-left: .2rem; font-size: .62em; vertical-align: .12em; letter-spacing: 0; }
.acc-remove:hover { color: var(--px-crit-text); border-color: color-mix(in srgb, var(--px-crit) 45%, transparent); }
.acc-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.acc-panel {
    position: relative; min-width: 0; overflow: hidden; background: var(--px-surface);
    border: 1px solid var(--px-border); border-radius: var(--px-r-lg); box-shadow: var(--px-shadow-sm);
}
.acc-panel + .acc-panel, .acc-pass-wrap + .acc-panel { margin-top: 16px; }
.acc-panel-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 56px; padding: 11px 18px; border-bottom: 1px solid var(--px-border); }
.acc-panel-icon { flex: none; color: var(--px-muted); font-size: .95rem; }
.acc-panel-title { display: flex; align-items: center; gap: .5rem; margin: 0; font-size: 1.04rem; font-weight: 700; line-height: 1.3; }
.acc-count { color: var(--px-muted); font-size: .86rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.acc-panel-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.acc-rows { list-style: none; margin: 0; padding: 0; }
.acc-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; min-height: 62px; padding: 12px 18px; }
.acc-row + .acc-row { border-top: 1px solid var(--px-border); }
.acc-row-icon {
    width: 36px; height: 36px; flex: 0 0 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
    background: var(--px-surface-3); color: var(--px-text-2); font-size: 1rem; --fa-secondary-opacity: .4;
}
.acc-row-icon.is-accent { background: var(--px-accent-soft); color: var(--px-accent-text); }
.acc-row-icon.is-ok { background: var(--px-ok-soft); color: var(--px-ok-text); }
.acc-row-icon.is-warn { background: var(--px-warn-soft); color: var(--px-warn-text); }
.acc-row-icon.is-crit { background: var(--px-crit-soft); color: var(--px-crit-text); }
.acc-row-icon.is-brand { background: var(--px-surface); box-shadow: inset 0 0 0 1px var(--px-border-strong); }
.acc-row-icon > svg { width: 18px; height: 18px; }
.acc-row-icon.is-letter { font-weight: 700; font-size: .95rem; background: var(--px-accent-soft); color: var(--px-accent-text); }
.acc-row-main { flex: 1 1 140px; min-width: 0; }
.acc-row-title { display: flex; align-items: center; flex-wrap: wrap; gap: .3rem .55rem; color: var(--px-text); font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.acc-row-sub { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem .9rem; margin-top: 3px; color: var(--px-muted); font-size: .86rem; line-height: 1.45; }
.acc-meta { display: inline-flex; align-items: center; gap: .35rem; min-width: 0; overflow-wrap: anywhere; }
.acc-meta > .acc-i { color: var(--px-faint); font-size: .9em; }
.acc-ip { color: var(--px-text-2); font-weight: 500; font-variant-numeric: tabular-nums; }
.acc-row-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.acc-row-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.acc-row .px-tag { height: 22px; font-size: .8rem; }
.acc-app .px-tag > svg { width: 12px; height: 12px; flex: none; }

/* key / value rows (Profile): the label, the data, one action */
.acc-kv { display: grid; grid-template-columns: 168px minmax(0, 1fr) auto; align-items: center; gap: 6px 16px; min-height: 62px; padding: 12px 18px; }
.acc-kv + .acc-kv { border-top: 1px solid var(--px-border); }
.acc-kv-label { display: flex; align-items: center; gap: .55rem; color: var(--px-muted); font-size: .93rem; font-weight: 500; }
.acc-kv-label > .acc-i { color: var(--px-faint); }
.acc-kv-value { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem .6rem; min-width: 0; color: var(--px-text); font-weight: 500; overflow-wrap: anywhere; }
.acc-kv-value.is-empty { color: var(--px-faint); }
.acc-kv-actions { display: flex; align-items: center; gap: 6px; justify-self: end; }
.acc-kv.is-editing { align-items: start; }
.acc-kv.is-editing .acc-kv-label { padding-top: .7rem; }
.acc-edit { grid-column: 2 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.acc-edit .px-field { margin-bottom: .8rem; }
.acc-edit .px-input { min-height: var(--px-control-h-sm); padding-block: .35rem; font-size: .95rem; }
.acc-edit-actions { grid-column: 1 / -1; display: flex; gap: 8px; }

/* ===================================================================================================== 3. states */
.acc-skel-title { width: 160px; height: 1.6rem; border-radius: var(--px-r-sm); }
.acc-skel-icon { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 10px; }
.acc-skel-btn { width: 84px; height: var(--px-control-h-sm); border-radius: var(--px-r-md); margin-left: auto; }
.acc-skel-w30 { width: 30%; } .acc-skel-w45 { width: 45%; } .acc-skel-w60 { width: 60%; }
.acc-rows[aria-hidden="true"] .acc-row-main .px-skel-line:first-child { height: .9rem; }

.acc-empty { display: flex; flex-direction: column; align-items: center; padding: 22px 18px 26px; text-align: center; }
.acc-empty-art { width: 128px; height: 84px; margin-bottom: 10px; }
.acc-empty-art > svg { display: block; width: 100%; height: 100%; overflow: visible; }
.acc-empty-title { margin: 0 0 .9rem; color: var(--px-text); font-size: 1.04rem; font-weight: 700; text-wrap: balance; }
.acc-empty-title:last-child { margin-bottom: 0; }
.acc-empty.is-page { padding: 44px 20px 48px; }
/* inside a list panel: one row (art, title, the action) so an empty list stays as dense as a full one */
.acc-empty.is-row { flex-direction: row; flex-wrap: wrap; gap: 10px 16px; padding: 12px 18px; text-align: left; }
.acc-empty.is-row .acc-empty-art { flex: none; width: 66px; height: 43px; margin: 0; }
.acc-empty.is-row .acc-empty-title { flex: 1 1 160px; margin: 0; font-size: 1rem; }
.acc-empty.is-page .acc-empty-art { width: 176px; height: 116px; }

/* empty-state art: flat line drawings coloured from the tokens, so they follow the theme */
.acc-art .a-fill { fill: var(--px-surface-3); }
.acc-art .a-card { fill: var(--px-surface); stroke: var(--px-border-strong); stroke-width: 1.5; }
.acc-art .a-line { fill: none; stroke: var(--px-border-strong); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.acc-art .a-faint { fill: var(--px-border); }
.acc-art .a-split { stroke: var(--px-border-strong); stroke-width: 1; }
.acc-art .a-acc { fill: var(--px-accent); }
.acc-art .a-acc-line { fill: none; stroke: var(--px-accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.acc-art .a-soft { fill: var(--px-accent-soft); }
.acc-art .a-ok { fill: var(--px-ok-soft); stroke: var(--px-ok); stroke-width: 2; }
.acc-art .a-ok-line { fill: none; stroke: var(--px-ok-text); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.acc-art .a-warn { fill: var(--px-warn-soft); stroke: var(--px-warn); stroke-width: 2; }
.acc-art .a-warn-ink { fill: var(--px-warn-text); }

/* ====================================================================================================== 4. pass */
/* The boarding pass: Overview's one night deck (theme-invariant, so its colours are the art's own). A perforated stub
   on the right (below on phones) holds the sessions count and a barcode drawn from the account id; the notches are cut
   with a mask, the elevation is a drop-shadow on the wrapper (a mask clips box-shadow). */
.acc-pass-wrap { margin: 0; filter: drop-shadow(0 16px 26px color-mix(in srgb, var(--px-night-0) 26%, transparent)); }
.acc-pass {
    --stub-w: 216px;
    --stub-h: 88px;
    --notch: 12px;
    --pass-accent: #1a62d5;          /* POP cobalt, theme-invariant on the night */
    --pass-on-accent: #ffffff;
    --pass-perf: rgba(233, 238, 246, .24);
    --ink-totp: var(--px-night-led);
    --ink-passkey: var(--px-night-sodium);
    --ink-google: #8ab4f8;
    --ink-mobile: #6cc8ee;
    --ink-microsoft: #e9eef6;
    position: relative; isolation: isolate; overflow: hidden;
    display: grid; grid-template-columns: minmax(0, 1fr) var(--stub-w); min-height: 236px;
    border-radius: var(--px-r-xl); color: var(--px-night-text);
    box-shadow: inset 0 0 0 1px rgba(233, 238, 246, .08), inset 0 1px 0 rgba(233, 238, 246, .06);
    background:
        radial-gradient(rgba(170, 190, 220, .07) 1px, transparent 1.2px) 0 0 / 22px 22px,
        radial-gradient(900px 380px at 18% -30%, rgba(150, 175, 215, .11), transparent 62%),
        linear-gradient(180deg, var(--px-night-2) 0%, var(--px-night-1) 62%, var(--px-night-0) 100%);
    -webkit-mask:
        radial-gradient(circle var(--notch) at calc(100% - var(--stub-w)) 0, #0000 98%, #000) 0 0 / 100% 51% no-repeat,
        radial-gradient(circle var(--notch) at calc(100% - var(--stub-w)) 100%, #0000 98%, #000) 0 100% / 100% 51% no-repeat;
    mask:
        radial-gradient(circle var(--notch) at calc(100% - var(--stub-w)) 0, #0000 98%, #000) 0 0 / 100% 51% no-repeat,
        radial-gradient(circle var(--notch) at calc(100% - var(--stub-w)) 100%, #0000 98%, #000) 0 100% / 100% 51% no-repeat;
}
.px-staff .acc-pass { --pass-accent: #d97706; --pass-on-accent: #05080d; }
.acc-pass a { color: inherit; }
.acc-pass-main { position: relative; z-index: 1; min-width: 0; padding: 22px 28px 24px; display: flex; flex-direction: column; }
.acc-pass-top { display: flex; align-items: center; gap: .55rem; margin-bottom: 20px; color: var(--px-night-muted); font-size: .84rem; font-weight: 500; line-height: 1; }
.acc-pass-top img { width: 20px; height: 20px; border-radius: 5px; }
.acc-pass-top b { color: var(--px-night-text); font-weight: 700; }
.acc-pass-tag { margin-left: auto; padding: .28rem .5rem; border-radius: var(--px-r-sm); background: var(--pass-accent); color: var(--pass-on-accent); font-size: .7rem; font-weight: 700; letter-spacing: .08em; }
.acc-pass-who { display: flex; align-items: center; gap: 16px; min-width: 0; }
.acc-pass-avatar {
    width: 58px; height: 58px; flex: 0 0 58px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    background: var(--pass-accent); color: var(--pass-on-accent); font-size: 1.32rem; font-weight: 700; line-height: 1; letter-spacing: .02em;
    box-shadow: 0 0 0 4px rgba(233, 238, 246, .07);
}
.acc-pass-id { min-width: 0; }
.acc-pass-label { display: block; color: var(--px-night-muted); font-size: .72rem; font-weight: 500; line-height: 1.3; text-transform: uppercase; }
html[lang="en"] .acc-pass-label { letter-spacing: .14em; }
.acc-pass-name { margin: 3px 0 2px; color: var(--px-night-text); font-size: 1.6rem; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.acc-pass-email { display: block; color: var(--px-night-muted); font-size: .96rem; overflow-wrap: anywhere; }
.acc-stamps { list-style: none; display: flex; flex-wrap: wrap; gap: 10px 12px; margin: auto 0 0; padding: 22px 0 0; }
.acc-stamp {
    --ink: var(--px-night-muted);
    display: inline-flex; align-items: center; gap: .42rem; height: 30px; padding: 0 .7rem 0 .55rem;
    border: 1.5px solid currentColor; border-radius: 7px; color: var(--ink);
    font-size: .76rem; font-weight: 700; letter-spacing: .09em; line-height: 1; text-transform: uppercase; white-space: nowrap;
    transform: rotate(var(--tilt, 0deg));
}
.acc-stamp.is-on { box-shadow: inset 0 0 0 2px var(--px-night-1), inset 0 0 0 3px color-mix(in srgb, currentColor 45%, transparent); }
.acc-stamp.is-off { --tilt: 0deg; border-style: dashed; color: var(--px-night-muted); opacity: .58; }
.acc-stamp .acc-i { font-size: .95em; --fa-secondary-opacity: .45; }
.acc-stamp > svg { width: 14px; height: 14px; }
.acc-stamp[data-k="totp"] { --ink: var(--ink-totp); }
.acc-stamp[data-k="passkey"] { --ink: var(--ink-passkey); }
.acc-stamp[data-k="google"] { --ink: var(--ink-google); }
.acc-stamp[data-k="mobile"] { --ink: var(--ink-mobile); }
.acc-stamp[data-k="microsoft"] { --ink: var(--ink-microsoft); }
.acc-stamp.is-on:nth-child(1) { --tilt: -3deg; }
.acc-stamp.is-on:nth-child(2) { --tilt: 2deg; }
.acc-stamp.is-on:nth-child(3) { --tilt: -1.5deg; }
.acc-stamp.is-on:nth-child(4) { --tilt: 2.5deg; }

.acc-pass-stub { position: relative; z-index: 1; display: flex; flex-direction: column; padding: 22px 24px 20px 26px; }
.acc-pass-stub::before {   /* the perforation: a column of holes, neutral, between the notches */
    content: ""; position: absolute; left: -1px; top: calc(var(--notch) + 8px); bottom: calc(var(--notch) + 8px); width: 2px;
    background: radial-gradient(circle, var(--pass-perf) 1px, transparent 1.4px) 0 0 / 2px 9px repeat-y;
}
.acc-pass-count { display: block; margin-top: 4px; color: var(--px-night-text); font-size: 2.9rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.acc-pass-count:hover { text-decoration: none; opacity: .86; }
.acc-pass-code { display: block; margin-top: auto; padding-top: 18px; color: var(--px-night-text); opacity: .7; }
.acc-pass-code > svg { display: block; width: 100%; height: 46px; }

/* loading pass: the same frame, night-tinted skeleton blocks */
.acc-pass .px-skel { background: rgba(233, 238, 246, .08); }
.acc-pass .acc-pass-avatar.px-skel { box-shadow: none; }

/* the one wow: the pass rises, one sheen crosses it, the stamps land (once per page load; still under reduced motion) */
.acc-pass::after {
    content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
    background: linear-gradient(105deg, transparent 36%, rgba(233, 238, 246, .06) 45%, rgba(233, 238, 246, .13) 50%, rgba(233, 238, 246, .06) 55%, transparent 64%);
    transform: translateX(120%);
}
.acc-pass-wrap.is-entering { animation: px-rise .55s var(--px-ease) backwards; }
.acc-pass-wrap.is-entering .acc-pass::after { animation: acc-sheen 1.25s var(--px-ease-io) .4s backwards; }
.acc-pass-wrap.is-entering .acc-stamp.is-on { animation: acc-stamp-in .5s var(--px-ease) backwards; }
.acc-pass-wrap.is-entering .acc-stamp:nth-child(1) { animation-delay: .55s; }
.acc-pass-wrap.is-entering .acc-stamp:nth-child(2) { animation-delay: .65s; }
.acc-pass-wrap.is-entering .acc-stamp:nth-child(3) { animation-delay: .75s; }
.acc-pass-wrap.is-entering .acc-stamp:nth-child(4) { animation-delay: .85s; }
@keyframes acc-sheen { from { transform: translateX(-120%); } to { transform: translateX(120%); } }
@keyframes acc-stamp-in {
    0% { opacity: 0; transform: rotate(var(--tilt)) scale(1.45); }
    55% { opacity: 1; transform: rotate(var(--tilt)) scale(.95); }
    100% { opacity: 1; transform: rotate(var(--tilt)) scale(1); }
}

/* ================================================================================================== 5. overlays */
.acc-dialog { width: min(460px, calc(100vw - 32px)); max-width: none; padding: 0; border: 0; background: transparent; color: var(--px-text-2); overflow: visible; }
.acc-dialog::backdrop { background: color-mix(in srgb, var(--px-night-0) 46%, transparent); }
.acc-dialog-card {
    padding: 26px 26px 22px; border: 1px solid var(--px-border); border-radius: var(--px-r-xl);
    background: var(--px-surface); box-shadow: var(--px-shadow-lg); text-align: center;
}
.acc-dialog[open] .acc-dialog-card { animation: acc-dlg-in .32s var(--px-ease) backwards; }
.acc-dialog.is-leaving .acc-dialog-card { animation: acc-dlg-out .16s var(--px-ease) forwards; }
.acc-dialog-art {
    width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: var(--px-accent-soft); color: var(--px-accent-text); font-size: 1.45rem; --fa-secondary-opacity: .4;
}
.acc-dialog-art.is-danger { background: var(--px-crit-soft); color: var(--px-crit-text); }
.acc-dialog-title { margin: 0 0 .45rem; color: var(--px-text); font-size: 1.25rem; line-height: 1.3; text-wrap: balance; overflow-wrap: anywhere; }
.acc-dialog-text { margin: 0; color: var(--px-text-2); line-height: 1.55; overflow-wrap: anywhere; }
.acc-dialog-type { margin-top: 16px; text-align: left; }
.acc-dialog-type .px-label > span b { color: var(--px-text); user-select: all; }
.acc-dialog-type .px-field { margin: 0; }
.acc-dialog-actions { display: flex; gap: 10px; margin-top: 20px; }
.acc-dialog-actions > .px-btn { flex: 1 1 0; }
@keyframes acc-dlg-in { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes acc-dlg-out { to { opacity: 0; transform: translateY(6px) scale(.98); } }

.acc-toasts {
    position: fixed; z-index: 60; top: calc(var(--acc-top-h) + 12px); right: 18px; width: min(380px, calc(100vw - 24px));
    display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.acc-toast {
    --tt: var(--px-info-text);
    display: flex; align-items: flex-start; gap: 10px; padding: 11px 10px 11px 14px; pointer-events: auto;
    border: 1px solid var(--px-border); border-radius: var(--px-r-lg); background: var(--px-surface); box-shadow: var(--px-shadow-lg);
    color: var(--px-text); font-size: .95rem; line-height: 1.45; animation: acc-toast-in .42s var(--px-ease) backwards;
}
.acc-toast.is-ok { --tt: var(--px-ok-text); }
.acc-toast.is-warn { --tt: var(--px-warn-text); }
.acc-toast.is-error { --tt: var(--px-crit-text); }
.acc-toast.is-leaving { animation: acc-toast-out .26s var(--px-ease) forwards; }
.acc-toast-icon { flex: none; padding-top: 3px; color: var(--tt); font-size: 1.05rem; --fa-secondary-opacity: .35; }
.acc-toast-text { flex: 1 1 auto; min-width: 0; padding-top: 1px; overflow-wrap: anywhere; }
.acc-toast-close {
    flex: none; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--px-muted);
    display: inline-flex; align-items: center; justify-content: center; font-size: .8rem;
}
.acc-toast-close:hover { background: var(--px-hover); color: var(--px-text); }
@keyframes acc-toast-in { from { opacity: 0; transform: translateX(22px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes acc-toast-out { to { opacity: 0; transform: translateX(22px) scale(.98); } }

/* ==================================================================================================== 6. motion */
.acc-view > * { animation: px-rise var(--px-dur-in) var(--px-ease) backwards; }
.acc-view > :nth-child(2) { animation-delay: .04s; }
.acc-view > :nth-child(3) { animation-delay: .08s; }
.acc-view > :nth-child(4) { animation-delay: .12s; }
.acc-view > :nth-child(n+5) { animation-delay: .16s; }
.acc-view.is-still > * { animation: none; }

@media (prefers-reduced-motion: reduce) {
    .acc-view > *, .acc-pass-wrap.is-entering, .acc-pass-wrap.is-entering .acc-stamp.is-on,
    .acc-dialog[open] .acc-dialog-card, .acc-dialog.is-leaving .acc-dialog-card, .acc-toast, .acc-toast.is-leaving { animation: none !important; }
    .acc-pass::after { display: none; }
    .acc-nav-link:active { transform: none; }
}

/* ================================================================================================ responsive */
@media (max-width: 991.98px) {
    .acc-app { --acc-gutter: 20px; --acc-top-h: 60px; }
    .acc-shell { display: block; padding-top: 0; }
    /* the nav becomes a segmented strip under the top bar; it scrolls sideways inside itself, never the page */
    .acc-nav {
        position: sticky; top: var(--acc-top-h); z-index: 30; margin: 0 calc(-1 * var(--acc-gutter)) 18px; padding: 10px var(--acc-gutter);
        background: var(--acc-glass); -webkit-backdrop-filter: blur(16px) saturate(170%); backdrop-filter: blur(16px) saturate(170%);
        border-bottom: 1px solid var(--px-border);
    }
    .acc-nav-list {
        flex-direction: row; gap: 2px; padding: 3px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
        background: var(--px-surface-3); border: 1px solid var(--px-border); border-radius: var(--px-r-md);
    }
    .acc-nav-list::-webkit-scrollbar { display: none; }
    .acc-nav-list > li { flex: none; }
    .acc-nav-link { min-height: 34px; padding: 0 12px; gap: .4rem; border-radius: calc(var(--px-r-md) - 3px); color: var(--px-muted); font-size: .9rem; white-space: nowrap; }
    .acc-nav-link:hover { background: transparent; }
    .acc-nav-link[aria-current="page"] { background: var(--px-surface); color: var(--px-text); box-shadow: var(--px-shadow-xs), 0 0 0 1px var(--px-border); }
    .acc-nav-icon { width: auto; height: auto; flex: none; font-size: .9rem; }
    .acc-nav-sep { display: none; }
}
@media (max-width: 767.98px) {
    .acc-pass { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto var(--stub-h);
        -webkit-mask:
            radial-gradient(circle var(--notch) at 0 calc(100% - var(--stub-h)), #0000 98%, #000) 0 0 / 51% 100% no-repeat,
            radial-gradient(circle var(--notch) at 100% calc(100% - var(--stub-h)), #0000 98%, #000) 100% 0 / 51% 100% no-repeat;
        mask:
            radial-gradient(circle var(--notch) at 0 calc(100% - var(--stub-h)), #0000 98%, #000) 0 0 / 51% 100% no-repeat,
            radial-gradient(circle var(--notch) at 100% calc(100% - var(--stub-h)), #0000 98%, #000) 100% 0 / 51% 100% no-repeat;
    }
    .acc-pass-main { padding: 20px 20px 22px; }
    .acc-pass-stub { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; align-content: center; column-gap: 22px; padding: 12px 20px; }
    .acc-pass-stub::before { left: calc(var(--notch) + 8px); right: calc(var(--notch) + 8px); top: -1px; bottom: auto; width: auto; height: 2px;
        background: radial-gradient(circle, var(--pass-perf) 1px, transparent 1.4px) 0 0 / 9px 2px repeat-x; }
    .acc-pass-stub .acc-pass-label { grid-column: 1; grid-row: 1; }
    .acc-pass-count { grid-column: 1; grid-row: 2; font-size: 2.2rem; }
    .acc-pass-code { grid-column: 2; grid-row: 1 / 3; align-self: center; margin: 0; padding: 0; }
    .acc-pass-code > svg { height: 40px; }
    .acc-pass-name { font-size: 1.38rem; }
    .acc-pass-avatar { width: 50px; height: 50px; flex-basis: 50px; font-size: 1.15rem; }
    .acc-kv { grid-template-columns: minmax(0, 1fr) auto; }
    .acc-kv-label { grid-column: 1 / -1; }
    .acc-kv.is-editing .acc-kv-label { padding-top: 0; }
    .acc-edit { grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 575.98px) {
    .acc-app { --acc-gutter: 16px; --acc-top-h: 58px; }
    .acc-topbar > .px-top { gap: 8px; }
    .acc-topbar .px-brand { font-size: 1rem; gap: .5rem; }
    .acc-topbar .px-brand img { width: 30px; height: 30px; }
    .acc-topbar .px-tools { gap: 6px; }
    .acc-topbar .px-seg > button { min-width: 34px; padding: 0 8px; }
    .acc-signout > span, .acc-back > span { display: none; }
    .acc-signout { width: 36px; min-height: 36px; padding: 0; }
    .acc-back { width: 34px; padding: 0; justify-content: center; }
    .acc-shell { padding-bottom: 72px; }
    .acc-h1 { font-size: 1.42rem; }
    .acc-row, .acc-kv { padding: 12px 14px; }
    .acc-panel-head { padding: 10px 14px; }
    .acc-toasts { top: auto; bottom: calc(16px + env(safe-area-inset-bottom)); left: 12px; right: 12px; width: auto; }
    .acc-dialog-card { padding: 22px 18px 18px; }
}
@media (max-width: 379.98px) {
    .acc-topbar .px-brand span { display: none; }
}
