/* Local demo accounts: header avatar, account menu, sign-in sheet, #account page. Tokens from css/theme.css. */

/* ---------- avatar ---------- */
.acct-av {
  --av: var(--accent);
  display: inline-grid; place-items: center; flex: none;
  width: 30px; height: 30px; border-radius: 50%; overflow: hidden;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, #fff 35%, var(--av)), var(--av));
  color: #fff; font-weight: 800; font-size: .85rem; line-height: 1;
  box-shadow: 0 0 0 2px var(--card), 0 0 0 3.5px color-mix(in srgb, var(--av) 45%, transparent);
}
.acct-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.acct-av.guest { background: var(--acc2-bg); color: var(--accent-ink); box-shadow: 0 0 0 1px var(--line); }
.acct-av.guest svg { width: 70%; height: 70%; }
.acct-av.lg { width: 44px; height: 44px; font-size: 1.1rem; }
.acct-av.xl { width: 88px; height: 88px; font-size: 2.2rem; }

/* ---------- header button ---------- */
.top-btn.acct-btn { padding: 0 12px 0 6px; gap: 8px; position: relative; max-width: 180px; }
.acct-btn-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-plus-dot {
  font-size: .62rem; font-weight: 800; letter-spacing: .02em; padding: 2px 6px; border-radius: 999px;
  background: var(--cta); color: #fff;
}
@media (max-width: 520px) {
  .top-btn.acct-btn { padding: 0; width: 44px; justify-content: center; }
  .acct-plus-dot { position: absolute; right: -6px; bottom: -4px; padding: 1px 4px; font-size: .55rem; }
}

/* ---------- badges ---------- */
.acct-badge {
  display: inline-flex; align-items: center; min-height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: .72rem; font-weight: 800; letter-spacing: .02em; vertical-align: middle;
  background: var(--acc2-bg); color: var(--lav-ink); border: 1px solid var(--line);
}
.acct-badge.plus { background: var(--cta); color: #fff; border-color: transparent; box-shadow: var(--cta-glow); }
h1 > .acct-badge { font-size: .8rem; margin-left: 6px; }

.acct-demo-note { margin: 12px 0 0; font-size: .78rem; color: var(--mute); }
.acct-demo-note::before { content: "🔒 "; }

/* ---------- account menu (popover) ---------- */
.acct-menu {
  position: fixed; inset: auto; padding: 10px; border-radius: 20px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); box-shadow: var(--shadow);
  -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass);
}
.acct-menu-head { display: flex; gap: 12px; align-items: center; padding: 6px 6px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.acct-menu-name { margin: 0 0 4px; font-weight: 800; }
.acct-menu-item {
  display: flex; align-items: center; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: 12px;
  background: transparent; color: var(--ink); font: inherit; font-weight: 600; text-align: left; cursor: pointer;
}
.acct-menu-item:hover, .acct-menu-item:focus-visible { background: var(--soft); color: var(--accent-ink); }
.acct-menu .acct-demo-note { padding: 0 6px; }

/* ---------- sign-in sheet ---------- */
.acct-sheet {
  width: min(460px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto;
  padding: 20px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg); color: var(--ink); box-shadow: var(--shadow);
}
.acct-sheet::backdrop { background: rgba(20, 6, 22, .45); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.acct-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.acct-sheet-head h2 { margin: 0; }
.acct-close {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font-size: 1rem; cursor: pointer;
}
.acct-pick { list-style: none; padding: 0; margin: 14px 0 4px; display: grid; gap: 8px; }
.acct-pick-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 6px 12px;
  border-radius: 16px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; cursor: pointer; text-align: left;
}
.acct-pick-btn:hover, .acct-pick-btn:focus-visible { border-color: var(--accent); }
.acct-pick-btn[aria-current="true"] { background: var(--sel); border-color: var(--accent); }
.acct-pick-name { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- forms ---------- */
.acct-form { display: grid; gap: 6px; margin-top: 14px; }
.acct-form h3 { margin: 4px 0 4px; font-size: 1rem; }
.acct-form label, .acct-field label, .acct-field-label { font-weight: 700; font-size: .85rem; margin: 8px 0 2px; }
.acct-form input:not([type="radio"]), .acct-field select {
  min-height: 44px; padding: 0 14px; border-radius: 14px; border: 1.5px solid var(--line);
  background: var(--card); color: var(--ink); font: inherit; width: 100%; box-sizing: border-box;
}
.acct-form input:focus-visible, .acct-field select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.acct-form .btn { margin-top: 12px; justify-self: start; }
.acct-form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.acct-field { display: grid; }
.acct-err { color: var(--sig-many); margin: 4px 0 0; min-height: 1em; }

.acct-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
.acct-chip { position: relative; }
.acct-chip input, .acct-seg-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.acct-chip span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--chip-bg); cursor: pointer; font-weight: 600;
}
.acct-chip input:checked + span { background: var(--sel); border-color: var(--accent); color: var(--accent-ink); font-weight: 800; }
.acct-chip input:focus-visible + span, .acct-seg-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.acct-seg { display: inline-flex; padding: 3px; border-radius: 999px; border: 1px solid var(--line); background: var(--chip-bg); }
.acct-seg-opt span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 999px; cursor: pointer; font-weight: 600;
}
.acct-seg-opt input:checked + span { background: var(--cta); color: #fff; box-shadow: var(--cta-glow); }

.acct-switch {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 48px;
  padding: 0 4px; border: 0; border-bottom: 1px solid var(--hair); background: none; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-align: left;
}
.acct-switch-track { flex: none; width: 46px; height: 28px; border-radius: 999px; background: var(--line); position: relative; transition: background .2s; }
.acct-switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s;
}
.acct-switch[aria-checked="true"] .acct-switch-track { background: var(--accent-bg); }
.acct-switch[aria-checked="true"] .acct-switch-track::after { transform: translateX(18px); }
.acct-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* ---------- #account page ---------- */
.acct { display: grid; gap: 16px; }
.acct-head { display: flex; align-items: center; gap: 14px; }
.acct-head h1 { margin: 0; }
.acct-head p { margin: 4px 0 0; }
.acct-grid { display: grid; gap: 16px; }
.acct-nav {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: 0 -2px;
}
.acct-nav a {
  flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); font-weight: 600; text-decoration: none; font-size: .9rem;
  -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass);
}
.acct-nav a[aria-current="true"] { background: var(--sel); border-color: var(--accent); color: var(--accent-ink); }
.acct-main { display: grid; gap: 16px; min-width: 0; }
.acct-sec { scroll-margin-top: 72px; }
.acct-sec h2 { margin-top: 0; }
.acct-sec:focus { outline: none; }
.acct-sec:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.acct-guest { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.acct-guest > div { flex: 1 1 240px; }
.acct-guest p { margin-top: 0; max-width: 65ch; }
.acct-sec > p { max-width: 70ch; }
.acct-profile { display: grid; gap: 16px; }
.acct-photo { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.acct-photo-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.acct-photo .sr-only { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.acct-photo-actions .btn { min-height: 44px; cursor: pointer; }
.acct-photo:focus-within label.btn { outline: 2px solid var(--accent); outline-offset: 2px; }

.acct-tags { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.acct-tags .chip { cursor: default; }
.acct-sec button.chip { min-height: 44px; }

.acct-plan-card { padding: 16px; border-radius: 18px; border: 1px solid var(--line); background: var(--chip-bg); margin-bottom: 14px; }
.acct-plan-card.plus { background: var(--sel); border-color: var(--accent); }
.acct-plan-card p { margin: 4px 0; }
.acct-plan-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.acct-plan-name { font-size: 1.2rem; font-weight: 800; }
.acct-usage-title { font-weight: 700; margin-top: 12px !important; }
.acct-meter { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 6px 0 8px; }
.acct-meter span { display: block; height: 100%; border-radius: inherit; background: var(--cta); }

.acct-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.acct-plan { padding: 18px; border-radius: 20px; border: 1.5px solid var(--line); background: var(--chip-bg); display: flex; flex-direction: column; gap: 4px; }
.acct-plan.plus { border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: var(--sel); }
.acct-plan.current { box-shadow: 0 0 0 2px var(--accent); }
.acct-plan h3 { margin: 0; }
.acct-price { font-size: 1.8rem; font-weight: 800; margin: 4px 0 0; }
.acct-planned { margin: 0; font-weight: 700; color: var(--amber-ink); }
.acct-planned::before { content: "◷ "; }
.acct-feat { padding-left: 0; list-style: none; margin: 10px 0; display: grid; gap: 6px; flex: 1; align-content: start; }
.acct-feat li::before { content: "✓ "; color: var(--accent-ink); font-weight: 800; }
.acct-current { font-weight: 800; color: var(--accent-ink); margin: 0; }
.acct-plan .btn { align-self: flex-start; }

.acct-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn.danger { background: var(--sig-many); color: #fff; box-shadow: none; }
:root[data-theme="dark"] .btn.danger { color: #2a0f2c; }
.btn.danger-text { color: var(--sig-many); }
.acct-confirm { margin-top: 14px; padding: 14px; border-radius: 16px; border: 1.5px solid var(--sig-many); background: color-mix(in srgb, var(--sig-many) 8%, transparent); }
.acct-confirm[hidden] { display: none; }
.acct-confirm p { margin-top: 0; font-weight: 600; }

/* desktop: section nav left, content right */
@media (min-width: 900px) {
  .acct-grid { grid-template-columns: 220px minmax(0, 1fr); align-items: start; gap: 24px; }
  .acct-nav { flex-direction: column; overflow: visible; position: sticky; top: 16px; z-index: 2; margin: 0; }
  .acct-nav a { border-radius: 14px; }
}
