/* RareWatch account experience: profile page, list cards, stats page, edit profile and security dialogs.
   Base components (.btn, .tabs, .modal, .field, .poster, .tag, .chip) belong to style.css; only layout and component classes live here. */

:root { --acct-overlap: 56px; --acct-av: 112px; }

/* ---------- dialog bits shared by every account dialog ---------- */
.ac-dlg { display: grid; gap: var(--s-3); min-width: min(420px, 100%); }
.ac-dlg h2, .ed-head h2 { margin: 0; padding-right: var(--s-6); font: 650 var(--t-lg)/var(--lh-snug) var(--font-display); color: var(--text-strong); }
.ac-sub { margin: 0; color: var(--mute); font-size: var(--t-sm); line-height: var(--lh-body); }
.ac-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s-2); margin-top: var(--s-2); }
.ac-dlg .field { margin: 0; }
.linkbtn { display: inline; padding: 0; background: none; border: 0; color: var(--accent-hi); font: inherit; font-weight: 600; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }

/* ---------- popup menu ---------- */
.amenu { position: relative; display: inline-flex; }
.amenu.open { z-index: var(--z-pop); }
.amenu-pop { position: absolute; right: 0; top: calc(100% + var(--s-1)); z-index: var(--z-pop); min-width: 224px; display: flex; flex-direction: column; padding: var(--s-1);
  background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-3); }
.amenu-pop[hidden] { display: none; }
.amenu-pop.up { top: auto; bottom: calc(100% + var(--s-1)); }
.amenu-item { display: flex; align-items: center; gap: var(--s-3); min-height: var(--ctl); padding: 0 var(--s-3); background: none; border: 0; border-radius: var(--r-sm); color: var(--text); font-size: var(--t-sm); text-align: left; white-space: nowrap; cursor: pointer; }
.amenu-item:hover, .amenu-item:focus-visible { background: var(--hover); color: var(--text-strong); }
.amenu-item .ic { color: var(--mute); flex: none; }
.amenu-item.danger, .amenu-item.danger .ic { color: var(--bad); }

/* ---------- banner ---------- */
.acct .pbanner { position: relative; overflow: hidden; height: 180px; background:
  radial-gradient(70% 140% at 12% 0%, color-mix(in srgb, var(--profile-accent) 55%, transparent), transparent 70%),
  color-mix(in srgb, var(--profile-accent) 22%, var(--surface-1)); }
.acct .pbanner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 45%, var(--bg)); pointer-events: none; }
.acct .pbanner .bposter { position: absolute; inset: -30px; background-size: cover; background-position: center 25%; filter: blur(24px) saturate(1.2) brightness(.65); }
.acct .pbanner.b-aurora { background: radial-gradient(60% 140% at 15% 0%, color-mix(in srgb, var(--profile-accent) 60%, transparent), transparent 70%), radial-gradient(50% 120% at 85% 10%, hsl(190 90% 60% / .35), transparent 70%), radial-gradient(60% 120% at 50% 110%, hsl(265 80% 65% / .3), transparent 70%), color-mix(in srgb, var(--profile-accent) 16%, var(--surface-1)); }
.acct .pbanner.b-sunset { background: linear-gradient(115deg, hsl(280 60% 22%), hsl(325 70% 36%) 45%, hsl(28 95% 55%) 85%, hsl(44 100% 62%)); }
.acct .pbanner.b-ocean { background: linear-gradient(160deg, hsl(215 80% 14%), hsl(205 85% 30%) 60%, hsl(192 80% 38%)); }
.acct .pbanner.b-noir { background: linear-gradient(180deg, color-mix(in srgb, var(--text) 22%, var(--surface-2)), var(--surface-1)); }
.acct .pbanner.b-grid { background: linear-gradient(color-mix(in srgb, var(--text) 8%, transparent) 1px, transparent 1px) 0 0 / 32px 32px, linear-gradient(90deg, color-mix(in srgb, var(--text) 8%, transparent) 1px, transparent 1px) 0 0 / 32px 32px, radial-gradient(60% 140% at 20% 0%, color-mix(in srgb, var(--profile-accent) 50%, transparent), transparent 70%), var(--surface-1); }
.acct .pbanner.b-poster { background: var(--surface-2); }

/* ---------- profile header ---------- */
.acct .phead { position: relative; z-index: 1; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "av main actions" "stats stats stats";
  column-gap: var(--s-5); row-gap: var(--s-5); margin-top: calc(-1 * var(--acct-overlap)); align-items: start; }
.acct .phead .bigav { grid-area: av; width: var(--acct-av); height: var(--acct-av); border-radius: var(--r-xl); overflow: hidden; display: block; padding: 0; animation: none;
  background: var(--surface-2); color: var(--mute);
  box-shadow: 0 0 0 5px var(--bg), 0 0 0 7px color-mix(in srgb, var(--profile-accent) 65%, transparent); }
.acct .phead .bigav > svg { width: 100%; height: 100%; }
.acct .pmain { grid-area: main; min-width: 0; padding-top: calc(var(--acct-overlap) + var(--s-2)); }
.acct .pname { margin: 0; font: 800 var(--t-3xl)/var(--lh-tight) var(--font-display); font-stretch: 80%; letter-spacing: -.02em; color: var(--text-strong); overflow-wrap: anywhere; }
.acct .pmeta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1) var(--s-3); margin-top: var(--s-2); color: var(--mute); font-size: var(--t-base); }
.acct .pmeta .since { font-size: var(--t-sm); }
.acct .pmeta .since::before { content: ""; display: inline-block; width: 3px; height: 3px; margin-right: var(--s-3); vertical-align: middle; border-radius: 50%; background: var(--faint); }
.acct .bio { margin: var(--s-3) 0 0; max-width: 60ch; color: var(--text); font-size: var(--t-md); line-height: var(--lh-body); }
.acct .pmain .gchips { margin-top: var(--s-3); gap: var(--s-2); }
.acct .pactions { grid-area: actions; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s-2); padding-top: calc(var(--acct-overlap) + var(--s-2)); }
.acct .pstats { grid-area: stats; display: grid; grid-template-columns: repeat(5, max-content); justify-content: start; gap: var(--s-4) var(--s-7); padding-top: var(--s-5); border-top: 1px solid var(--line); }
.acct .pstat { display: block; padding: 0; background: none; border: 0; color: inherit; text-align: left; font: inherit; min-width: 0; }
.acct button.pstat { cursor: pointer; }
.acct .pstat b { display: block; font: 800 var(--t-xl)/1 var(--font-display); font-stretch: 80%; letter-spacing: -.02em; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.acct .pstat span { display: block; margin-top: var(--s-1); color: var(--mute); font-size: var(--t-sm); }
.acct button.pstat:hover span { color: var(--text-strong); text-decoration: underline; }

.acct-page > section, .acct-page > p.empty { margin-top: var(--section-gap); }
.acct-page > .phead + section, .acct-page > div:empty + section { margin-top: var(--section-gap); }
.acct-page { padding-bottom: var(--s-7); }

/* section headings: heading, quiet count, quiet action on the right */
.acct .sechead { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); min-height: var(--ctl-sm); margin: 0 0 var(--s-4); }
.acct .sechead h2.sec { margin: 0; font: 650 var(--t-lg)/var(--lh-snug) var(--font-display); color: var(--text-strong); text-transform: none; letter-spacing: 0; }
.acct .sechead h2.sec .cnt { margin-left: var(--s-2); color: var(--mute); font: 500 var(--t-base) var(--font-body); }
.acct .sechead .btn { flex: none; }

/* ---------- badges ---------- */
.badgerow { display: flex; gap: var(--s-2); overflow-x: auto; padding-bottom: var(--s-1); scrollbar-width: thin; }
.badge { flex: none; display: inline-flex; align-items: center; gap: var(--s-2); padding: var(--s-1) var(--s-3) var(--s-1) var(--s-1); border-radius: var(--r-pill); background: var(--surface-1); border: 1px solid var(--line); font-size: var(--t-sm); color: var(--text); }
.badge .bico { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-hi); flex: none; }
.badge.on { border-color: var(--accent-line); color: var(--text-strong); }
.badge.off { opacity: .6; }
.badge.off .bico { background: var(--hover); color: var(--mute); }
.badge .btxt { display: flex; flex-direction: column; line-height: var(--lh-snug); min-width: 0; }
.badge .btxt b { font-weight: 600; }
.badge .btxt small { color: var(--mute); font-size: var(--t-xs); font-weight: 400; }
.badge.big { border-radius: var(--r-lg); padding: var(--s-3); display: grid; grid-template-columns: auto 1fr; gap: var(--s-1) var(--s-3); align-items: center; }
.badge.big .bprog, .badge.big .bnum { grid-column: 2; }
.bprog { height: 5px; border-radius: var(--r-pill); background: var(--line-strong); overflow: hidden; }
.bprog i { display: block; height: 100%; background: var(--accent); }
.bnum { color: var(--mute); font-size: var(--t-xs); }
.badgegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s-2); max-height: 60vh; overflow: auto; }

/* ---------- top 4 ---------- */
.tgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 200px)); gap: var(--s-4); }
.tcell { position: relative; display: block; aspect-ratio: 2 / 3; padding: 0; border: 1px solid var(--line); border-radius: var(--r-poster); overflow: hidden; background: var(--surface-2); text-align: left; cursor: pointer; color: inherit; transition: border-color var(--fast); }
.tcell:hover, .tcell:focus-visible { border-color: var(--accent); }
.tcell .poster { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; }
.tn { position: absolute; top: var(--s-2); left: var(--s-2); z-index: 1; min-width: 24px; height: 24px; padding: 0 var(--s-1); border-radius: var(--r-xs); display: grid; place-items: center; background: var(--media-chip); color: var(--media-ink); font: 700 var(--t-sm) var(--font-display); }
.tcap { position: absolute; left: 0; right: 0; bottom: 0; padding: var(--s-6) var(--s-3) var(--s-3); background: var(--media-scrim); color: var(--media-ink); display: flex; flex-direction: column; gap: 2px; font-size: var(--t-sm); line-height: var(--lh-snug); }
.tcap b { font-weight: 650; }
.tcap small { color: var(--media-mute); }
.tcell.open { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-2); border: 2px dashed var(--line-strong); background: transparent; color: var(--mute); font-size: var(--t-sm); font-weight: 600; text-align: center; }
.tcell.open:hover, .tcell.open:focus-visible { border-color: var(--accent); color: var(--text-strong); }
.tcell.open .tn { background: var(--surface-2); color: var(--mute); }
.tslots { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-2); }
.tslot { position: relative; aspect-ratio: 2 / 3; border: 2px dashed var(--line-strong); border-radius: var(--r-poster); overflow: hidden; padding: 0; background: transparent; }
.tslot.full { border: 2px solid var(--accent); cursor: pointer; }
.tslot .poster { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; }
.tpick { max-height: 240px; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.trow { display: flex; justify-content: space-between; align-items: center; gap: var(--s-2); min-height: var(--ctl); text-align: left; padding: 0 var(--s-3); border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid transparent; color: var(--text); }
.trow:hover { background: var(--surface-3); }
.trow small { color: var(--mute); }
.trow.on { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- watching now, featured, activity ---------- */
.wstrip { display: flex; gap: var(--s-3); overflow-x: auto; padding-bottom: var(--s-1); scrollbar-width: thin; }
.wcard { display: flex; gap: var(--s-3); align-items: center; flex: none; width: 240px; padding: var(--s-2); border-radius: var(--r-lg); background: var(--surface-1); border: 1px solid var(--line); color: inherit; transition: border-color var(--fast); }
.wcard:hover { border-color: var(--line-strong); }
.wcard .poster { width: 44px; height: 66px; flex: none; border-radius: var(--r-xs); font-size: 8px; }
.wcard b { display: block; font-size: var(--t-base); color: var(--text-strong); }
.wcard small { color: var(--mute); }
.acct .featured { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s-4); }
.acct .fcard { position: relative; display: block; aspect-ratio: 16 / 9; padding: 0; overflow: hidden; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface-2); text-align: left; color: var(--media-ink); }
.acct .fcard .poster { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; background-position: center 20%; }
.acct .fcard .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: var(--s-6) var(--s-4) var(--s-3); background: var(--media-scrim); display: grid; gap: var(--s-1); }
.acct .fcard .cap b { font: 650 var(--t-md)/var(--lh-snug) var(--font-display); }
.actlist { display: flex; flex-direction: column; max-width: 760px; }
.actrow { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) 0; border-bottom: 1px solid var(--line); }
.actrow .aic { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-hi); flex: none; }
.actrow .atx { flex: 1; min-width: 0; overflow-wrap: anywhere; color: var(--text); }
.actrow .atx a { color: var(--text-strong); }
.actrow .atx small, .actrow .at { color: var(--mute); }
.actrow .at { flex: none; font-size: var(--t-xs); }

/* ---------- list: tabs, add bar, cards ---------- */
.acct .tab .n { margin-left: var(--s-2); color: var(--mute); font-weight: 400; }
.acct .ptools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s-3); margin: var(--s-5) 0; }
.acct .addbar { position: relative; flex: 1 1 320px; max-width: 560px; margin: 0; }
.acct .addbar label { display: block; margin-bottom: var(--s-2); color: var(--mute); font-size: var(--t-sm); }
.acct .addbar label b { color: var(--text-strong); font-weight: 650; }
.acct .addfield { position: relative; }
.acct .addfield > .ic { position: absolute; left: var(--s-3); top: 50%; transform: translateY(-50%); color: var(--mute); pointer-events: none; }
.acct .addfield input { width: 100%; padding-left: calc(var(--s-3) + 16px + var(--s-2)); }
.acct .results { position: absolute; z-index: var(--z-pop); left: 0; right: 0; top: calc(var(--ctl) + var(--s-1)); max-height: 360px; overflow: auto; background: var(--surface-1); border: 1px solid var(--line-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-3); }
.acct .results[hidden] { display: none; }
.acct .res { display: flex; gap: var(--s-3); align-items: center; width: 100%; padding: var(--s-2) var(--s-3); border: 0; background: none; text-align: left; color: var(--text); }
.acct .res:hover, .acct .res:focus-visible { background: var(--hover); }
.acct .res .poster { width: 36px; flex: none; border-radius: var(--r-xs); font-size: 7px; }
.acct .res small { display: block; color: var(--mute); }

.lgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: var(--s-6) var(--s-4); }
.lcard { position: relative; display: flex; flex-direction: column; gap: var(--s-3); min-width: 0; }
.lcover { position: relative; display: block; padding: 0; background: none; border: 0; text-align: left; border-radius: var(--r-poster); }
.lcover .poster { transition: box-shadow var(--fast); }
.lcover:hover .poster, .lcover:focus-visible .poster { box-shadow: 0 0 0 2px var(--accent); }
.lcover .ovt { position: absolute; top: var(--s-2); right: var(--s-2); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--media-chip); color: var(--star); }
.linfo { display: flex; flex-direction: column; gap: var(--s-1); min-width: 0; }
.ltitle { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; padding: 0; background: none; border: 0; text-align: left; font: 650 var(--t-base)/var(--lh-snug) var(--font-body); color: var(--text-strong); }
.ltitle:hover { text-decoration: underline; }
.lmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--s-2); color: var(--mute); font-size: var(--t-sm); }
.lmeta .tag { font-size: var(--t-xs); }
.lrate { display: inline-flex; align-items: center; gap: 3px; color: var(--text); }
.lrate .ic { color: var(--star); }
.lwhen { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--s-2); color: var(--mute); font-size: var(--t-sm); }
.lwhen .linkbtn { font-size: var(--t-sm); }
.lmine { display: flex; align-items: center; gap: var(--s-1); color: var(--good); font-size: var(--t-xs); }
.lact { display: flex; gap: var(--s-2); align-items: center; }
.lact > .btn.sm { flex: 1; min-width: 0; justify-content: center; }
.lact .amenu .btn { flex: none; }

/* ---------- edit profile ---------- */
.modal.ed-modal { display: flex; flex-direction: column; width: min(720px, 100%); max-width: 100%; max-height: min(92vh, 920px); padding: 0; overflow: hidden; background: var(--surface-1); }
.ed { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.ed-head { padding: var(--s-5) var(--s-5) var(--s-3); }
.ed-head p { margin: var(--s-1) 0 0; color: var(--mute); font-size: var(--t-sm); }
.ed-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 var(--s-5); }
.ed .err { padding: var(--s-2) var(--s-5) 0; min-height: 0; }
.ed-foot { display: flex; justify-content: flex-end; gap: var(--s-2); padding: var(--s-3) var(--s-5); background: var(--surface-1); border-top: 1px solid var(--line); padding-bottom: calc(var(--s-3) + env(safe-area-inset-bottom, 0px)); }
.ed-sec { display: grid; gap: var(--s-3); padding: var(--s-5) 0; border-top: 1px solid var(--line); }
.ed-sec:first-child { border-top: 0; padding-top: var(--s-2); }
.ed-sec > h3 { margin: 0; font: 650 var(--t-md)/var(--lh-snug) var(--font-display); color: var(--text-strong); }
.ed-sec h4 { margin: 0; font: 650 var(--t-base)/var(--lh-snug) var(--font-body); color: var(--text-strong); }
.ed-hint { margin: 0; color: var(--mute); font-size: var(--t-sm); line-height: var(--lh-body); }
.ed .field { margin: 0; display: grid; gap: var(--s-2); }
.ed .field > label { margin: 0; }
.ed .count { justify-self: end; color: var(--mute); font-size: var(--t-xs); }
.ed-sub { display: grid; gap: var(--s-2); margin-top: var(--s-2); }
.ed-checks { display: grid; gap: var(--s-2); }
.ed-check { display: flex; align-items: flex-start; gap: var(--s-3); padding: var(--s-3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); cursor: pointer; }
.ed-check input { margin-top: 3px; accent-color: var(--accent); flex: none; }
.ed-check span { display: grid; gap: 2px; }
.ed-check b { color: var(--text-strong); font-weight: 600; }
.ed-check small { color: var(--mute); font-size: var(--t-sm); line-height: var(--lh-snug); }
.ed-line { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); padding: var(--s-3) 0; border-top: 1px solid var(--line); }
.ed-line:first-of-type { border-top: 0; }
.ed-line > div, .ed-danger > div { display: grid; gap: 2px; min-width: 0; }
.ed-line b, .ed-danger b { color: var(--text-strong); font-weight: 600; }
.ed-line small, .ed-danger small { color: var(--mute); font-size: var(--t-sm); line-height: var(--lh-snug); }
.ed-line .btn, .ed-danger .btn { flex: none; }
.ed-danger { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); margin-top: var(--s-4); padding: var(--s-4); border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent); background: var(--bad-soft); border-radius: var(--r-lg); }
.ed .swatches { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.ed .sw { width: 36px; height: 36px; padding: 0; border-radius: var(--r-sm); border: 2px solid var(--line-strong); }
.ed .sw.on { border-color: var(--text-strong); box-shadow: 0 0 0 2px var(--surface-1), 0 0 0 4px var(--accent); }
.ed-custom { display: inline-flex; align-items: center; gap: var(--s-2); margin-left: var(--s-2); color: var(--mute); font-size: var(--t-sm); }
.ed-color { width: 36px; height: 36px; padding: 0; border: 2px solid var(--line-strong); border-radius: var(--r-sm); background: none; }
.bnpick { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: var(--s-2); }
.bnopt { position: relative; display: flex; align-items: flex-end; height: 60px; padding: var(--s-2); border: 2px solid transparent; border-radius: var(--r-md); overflow: hidden; text-align: left; font-size: var(--t-xs); font-weight: 600; background-size: cover; }
.bnopt span { padding: 1px var(--s-2); border-radius: var(--r-xs); background: var(--media-chip); color: var(--media-ink); }
.bnopt.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.bnopt.b-default { background: radial-gradient(70% 140% at 20% 0%, color-mix(in srgb, var(--profile-accent) 55%, transparent), transparent 70%), color-mix(in srgb, var(--profile-accent) 22%, var(--surface-2)); }
.bnopt.b-aurora { background: radial-gradient(60% 140% at 15% 0%, color-mix(in srgb, var(--profile-accent) 60%, transparent), transparent 70%), radial-gradient(50% 120% at 90% 10%, hsl(190 90% 60% / .4), transparent 70%), color-mix(in srgb, var(--profile-accent) 16%, var(--surface-2)); }
.bnopt.b-sunset { background: linear-gradient(115deg, hsl(280 60% 22%), hsl(325 70% 36%) 45%, hsl(28 95% 55%) 85%, hsl(44 100% 62%)); }
.bnopt.b-ocean { background: linear-gradient(160deg, hsl(215 80% 14%), hsl(205 85% 30%) 60%, hsl(192 80% 38%)); }
.bnopt.b-noir { background: linear-gradient(180deg, color-mix(in srgb, var(--text) 22%, var(--surface-2)), var(--surface-3)); }
.bnopt.b-grid { background: linear-gradient(color-mix(in srgb, var(--text) 10%, transparent) 1px, transparent 1px) 0 0 / 14px 14px, linear-gradient(90deg, color-mix(in srgb, var(--text) 10%, transparent) 1px, transparent 1px) 0 0 / 14px 14px, var(--surface-3); }
.bnopt.b-poster { background: linear-gradient(135deg, color-mix(in srgb, var(--profile-accent) 40%, var(--surface-3)), var(--surface-3)); }
.ed-themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: var(--s-2); }
.ed-theme { display: flex; align-items: center; gap: var(--s-2); min-height: var(--ctl); padding: 0 var(--s-3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); color: var(--text); font-size: var(--t-sm); font-weight: 600; text-align: left; }
.ed-theme.on { border-color: var(--accent); background: var(--accent-soft); }
.ed-theme .sws { display: inline-flex; }
.ed-theme .sws i { width: 12px; height: 18px; }
.ed-theme .sws i:first-child { border-radius: 4px 0 0 4px; } .ed-theme .sws i:last-child { border-radius: 0 4px 4px 0; }
/* avatar picker inside the dialog */
.ed .avpicker { padding: var(--s-4); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface-2); display: grid; gap: var(--s-3); }
.ed .avtop { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-4); margin: 0; }
.ed .avprev { width: 80px; height: 80px; border-radius: var(--r-xl); overflow: hidden; background: var(--surface-3); display: grid; place-items: center; }
.ed .avname { min-height: 20px; margin-bottom: var(--s-2); color: var(--text-strong); font: 650 var(--t-base) var(--font-display); }
.ed .avopt { border-radius: var(--r-md); background: var(--surface-3); border: 2px solid transparent; padding: 0; overflow: hidden; transition: border-color var(--fast); }
.ed .avopt:hover { transform: none; border-color: var(--line-strong); }
.ed .avopt.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.avactions { display: flex; flex-wrap: wrap; gap: var(--s-2); }

/* ---------- security dialog ---------- */
.sx-dlg { width: min(560px, 100%); min-width: 0; gap: var(--s-2); }
.sx-body { display: grid; }
.sx-sec { display: grid; gap: var(--s-3); padding: var(--s-5) 0; border-top: 1px solid var(--line); }
.sx-sec:first-child { border-top: 0; }
.sx-sec > h3 { margin: 0; font: 650 var(--t-md)/var(--lh-snug) var(--font-display); color: var(--text-strong); }
.sx-form { display: grid; gap: var(--s-3); }
.sx-form .field { margin: 0; display: grid; gap: var(--s-2); }
.sx-form .field > label { margin: 0; }
.sx-pw { display: flex; gap: var(--s-2); }
.sx-pw input { flex: 1; min-width: 0; }
.sx-meter { height: 4px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.sx-meter i { display: block; height: 100%; width: 0; background: var(--faint); transition: width var(--med) var(--ease), background var(--fast); }
.sx-meter i[data-s="1"] { background: var(--bad); } .sx-meter i[data-s="2"] { background: var(--warn); } .sx-meter i[data-s="3"], .sx-meter i[data-s="4"] { background: var(--good); }
.sx-hint { color: var(--mute); font-size: var(--t-xs); }
.sx-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); justify-content: flex-start; }
.sx-list { display: grid; gap: var(--s-2); margin: 0; padding: 0; list-style: none; }
.sx-sess { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.sx-sess.cur { border-color: var(--accent-line); }
.sx-ico { flex: none; color: var(--mute); display: grid; }
.sx-sess.cur .sx-ico { color: var(--accent-hi); }
.sx-txt { flex: 1; min-width: 0; display: grid; gap: 2px; }
.sx-txt b { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); color: var(--text-strong); font-weight: 600; overflow-wrap: anywhere; }
.sx-txt small { color: var(--mute); font-size: var(--t-sm); }
.sx-status { display: flex; align-items: center; gap: var(--s-2); margin: 0 0 var(--s-3); color: var(--text); }
.sx-status .ic { color: var(--accent-hi); }
.sx-code { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--field); }
.sx-code code { flex: 1; min-width: 0; font: 600 var(--t-md) ui-monospace, "Cascadia Mono", Menlo, monospace; letter-spacing: .06em; color: var(--text-strong); word-break: break-all; user-select: all; }
.sx-recovery { display: grid; gap: var(--s-2); justify-items: start; }
.sx-recovery .sx-code { justify-self: stretch; }

/* ---------- stats page ---------- */
.sx { display: grid; gap: var(--s-4); }
.sx-top { display: grid; gap: var(--s-3); }
.sx-yir, .sx-priv { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; padding: var(--s-4) var(--card-pad); background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r-lg); }
.sx-yir > div:first-child, .sx-priv > div:first-child { display: grid; gap: 2px; min-width: 0; }
.sx-yir b, .sx-priv b { font: 650 var(--t-md)/var(--lh-snug) var(--font-display); color: var(--text-strong); }
.sx-yir small, .sx-priv small { color: var(--mute); font-size: var(--t-sm); }
.sx-btns { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.sx-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); align-items: start; }
.sx-card { min-width: 0; padding: var(--card-pad); background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r-lg); }
.sx-card.wide { grid-column: 1 / -1; }
.sx-card > * + * { margin-top: var(--s-4); }
.sx-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-4); }
.sx-head h3 { margin: 0; font: 650 var(--t-lg)/var(--lh-snug) var(--font-display); color: var(--text-strong); }
.sx-head p { margin: var(--s-1) 0 0; color: var(--mute); font-size: var(--t-sm); max-width: 56ch; }
.sx-switch { flex: none; display: inline-flex; align-items: center; gap: var(--s-2); height: var(--ctl-sm); padding: 0 var(--s-3) 0 var(--s-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-pill); color: var(--mute); font-size: var(--t-sm); font-weight: 600; cursor: pointer; }
.sx-switch:hover { border-color: var(--line-strong); }
.sx-switch .track { position: relative; width: 30px; height: 18px; border-radius: var(--r-pill); background: var(--line-strong); transition: background var(--fast); }
.sx-switch .knob { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-strong); transition: transform var(--fast) var(--ease); }
.sx-switch.on { border-color: var(--accent-line); color: var(--text-strong); }
.sx-switch.on .track { background: var(--accent); }
.sx-switch.on .knob { transform: translateX(12px); background: var(--on-accent); }
.sx-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--s-3); }
.sx-tile { padding: var(--s-4); background: var(--surface-2); border-radius: var(--r-md); min-width: 0; }
.sx-tile b { display: block; font: 800 var(--t-2xl)/var(--lh-tight) var(--font-display); font-stretch: 80%; letter-spacing: -.02em; color: var(--text-strong); overflow-wrap: anywhere; }
.sx-tile span { display: block; margin-top: var(--s-1); color: var(--mute); font-size: var(--t-sm); }
.sx-tile small { display: block; margin-top: 2px; color: var(--faint); font-size: var(--t-xs); overflow-wrap: anywhere; }
.sx-hero { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-6); }
.sx-big b { display: block; font: 800 var(--t-3xl)/var(--lh-tight) var(--font-display); font-stretch: 80%; letter-spacing: -.02em; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.sx-big span { color: var(--mute); font-size: var(--t-sm); }
.sx-facts { display: grid; gap: var(--s-1); margin: 0; padding: 0; list-style: none; color: var(--text); font-size: var(--t-base); }
.sx-facts b { color: var(--text-strong); }
.sx-facts small { color: var(--mute); }
.sx-sub { margin: var(--s-5) 0 0; font: 650 var(--t-base)/var(--lh-snug) var(--font-display); color: var(--text-strong); }
.sx-note { margin: var(--s-3) 0 0; max-width: 70ch; color: var(--mute); font-size: var(--t-sm); line-height: var(--lh-body); }
.sx-taste { display: flex; align-items: center; gap: var(--s-2); color: var(--mute); font-size: var(--t-base); }
.sx-taste b { color: var(--text-strong); } .sx-taste .ic { color: var(--accent-hi); }
.sx-card .sbars { display: grid; gap: var(--s-1); }
.sx-card .sbar { display: grid; grid-template-columns: minmax(72px, 32%) minmax(0, 1fr) 28px 40px; align-items: center; gap: var(--s-3); padding: var(--s-1) 0; font-size: var(--t-sm); }
.sx-card .sbar .sl { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sx-card .sbar .sb { height: 8px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.sx-card .sbar .sb i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.sx-card .sbar b { text-align: right; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.sx-card .sbar small { color: var(--mute); text-align: right; }
.sx-months, .sx-week, .sx-dist { display: grid; gap: var(--s-1); padding-top: var(--s-5); }
.sx-months { grid-template-columns: repeat(12, minmax(0, 1fr)); height: 190px; }
.sx-week { grid-template-columns: repeat(7, minmax(0, 1fr)); height: 150px; }
.sx-dist { grid-template-columns: repeat(10, minmax(0, 1fr)); height: 150px; }
.sx-col { position: relative; display: grid; grid-template-rows: minmax(0, 1fr) auto; justify-items: center; align-items: end; gap: var(--s-1); height: 100%; border-radius: var(--r-xs); }
.sx-col i { position: relative; width: 100%; max-width: 36px; min-height: 2px; background: var(--accent); border-radius: var(--r-xs) var(--r-xs) 2px 2px; transition: background var(--fast); }
.sx-col:hover i, .sx-col:focus-visible i { background: var(--accent-hi); }
.sx-col span { color: var(--mute); font-size: var(--t-xs); line-height: 1.2; }
.sx-col::after { content: attr(data-tip); position: absolute; bottom: calc(100% - var(--s-4)); left: 50%; z-index: 3; transform: translateX(-50%); padding: var(--s-1) var(--s-2); white-space: nowrap; background: var(--surface-3); color: var(--text-strong); border: 1px solid var(--line-strong); border-radius: var(--r-sm); box-shadow: var(--shadow-2); font-size: var(--t-xs); opacity: 0; pointer-events: none; transition: opacity var(--fast); }
.sx-col:hover::after, .sx-col:focus-visible::after { opacity: 1; }
.sx-col:nth-child(-n+3)::after { left: 0; transform: none; }
.sx-col:nth-last-child(-n+3)::after { left: auto; right: 0; transform: none; }
.sx-card .strip6 { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.sx-card .sposter { position: relative; display: block; width: 64px; }
.sx-card .sposter .poster { border-radius: var(--r-xs); }
.sx-card .sposter b { position: absolute; right: 4px; bottom: 4px; padding: 0 5px; border-radius: var(--r-xs); background: var(--media-chip); color: var(--star); font-size: var(--t-xs); }
.sx-private { display: grid; justify-items: center; gap: var(--s-2); padding: var(--s-7) var(--s-4); text-align: center; color: var(--mute); background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r-lg); }
.sx-private h3 { margin: 0; font: 650 var(--t-lg) var(--font-display); color: var(--text-strong); }

/* ---------- phones ---------- */
@media (max-width: 900px) { .sx-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 700px) {
  :root { --acct-overlap: 44px; --acct-av: 88px; }
  .acct .pbanner { height: 120px; }
  .acct .phead { grid-template-columns: minmax(0, 1fr); grid-template-areas: "av" "main" "actions" "stats"; row-gap: var(--s-4); }
  .acct .pmain { padding-top: 0; }
  .acct .pactions { padding-top: 0; justify-content: flex-start; }
  .acct .pactions > .btn.primary { flex: 1 1 100%; justify-content: center; }
  .acct .pactions > .btn, .acct .pactions > .amenu, .acct .pactions > span { flex: 1 1 auto; }
  .acct .pactions > .amenu > .btn { width: 100%; justify-content: center; }
  .acct .pstats { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--s-2); padding-top: var(--s-4); }
  .acct .pstat b { font-size: var(--t-lg); }
  .acct .pstat span { font-size: var(--t-xs); }
  .tgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }
  .lgrid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s-5) var(--s-3); }
  .modal.ed-modal { width: 100%; max-height: 100dvh; border-radius: var(--r-xl) var(--r-xl) 0 0; }
  .ed-head, .ed-body, .ed-foot { padding-left: var(--s-4); padding-right: var(--s-4); }
  .ed .err { padding-left: var(--s-4); padding-right: var(--s-4); }
  .ed-line, .ed-danger { flex-wrap: wrap; }
  .sx-head { flex-wrap: wrap; }
  .sx-card .sbar { grid-template-columns: minmax(64px, 30%) minmax(0, 1fr) 24px 34px; gap: var(--s-2); }
  .sx-months { gap: 2px; }
  .sx-tile b { font-size: var(--t-xl); }
  .ac-dlg { min-width: 0; }
  .amenu-pop { min-width: 200px; }
}
@media (prefers-reduced-motion: reduce) { .sx-meter i, .sx-switch .knob, .sx-col::after { transition: none; } }
.sx-months i::before { content: attr(data-n); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); padding-bottom: 2px; color: var(--mute); font-size: var(--t-xs); font-style: normal; }
.ed .err:empty, .sx-form .err:empty, .ac-dlg .err:empty { display: none; }
