/* =====================================================================
   SkyRush UI — shared components. Colours come from the theme file
   (user.css or admin.css), so the same markup gets two different looks.
   THAT'S ALL FUN — NOT REAL.
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
img, svg { display: block; }
table { border-collapse: collapse; }
[hidden] { display: none !important; }
.ic { width: 18px; height: 18px; flex: 0 0 auto; }
.ic-sm { width: 15px; height: 15px; flex: 0 0 auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

/* ---------- Helpers ---------- */
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.strong { color: var(--text-strong); font-weight: 600; }
.pos { color: var(--pos) !important; }
.neg { color: var(--neg) !important; }
.warn { color: var(--warn) !important; }
.small { font-size: 12px; }
.xs { font-size: 11px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack > * + * { margin-top: 16px; }
.stack-sm > * + * { margin-top: 8px; }
.grow { flex: 1 1 auto; min-width: 0; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; } .mt-8 { margin-top: 32px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* ---------- App shell: sidebar + content ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sb-w); flex: 0 0 var(--sb-w); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  overflow-y: auto; background: var(--sb-bg); color: var(--sb-text); border-right: 1px solid var(--sb-line); }
.sb-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 20px 20px 16px; }
.sb-close { display: none; width: 34px; height: 34px; border-radius: 9px; place-items: center; color: var(--sb-text); }
.sb-close:hover { background: var(--sb-hover); }
.sb-section { padding: 6px 12px; }
.sb-label { padding: 14px 12px 6px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--sb-faint); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .nav button { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: var(--r-sm);
  font-weight: 500; color: var(--sb-text); text-align: left; transition: background .15s, color .15s; }
.nav a:hover, .nav button:hover { background: var(--sb-hover); color: var(--sb-text-strong); }
.nav a.active { background: var(--sb-active); color: var(--sb-active-text); }
.nav .count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center;
  font-size: 11px; font-weight: 700; background: var(--accent); color: var(--on-accent); }
.sb-foot { margin-top: auto; padding: 16px 12px 20px; }
.shell-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--top-h); display: flex; align-items: center; gap: 12px; padding: 0 28px;
  background: var(--top-bg); border-bottom: 1px solid var(--line); backdrop-filter: saturate(140%) blur(10px); -webkit-backdrop-filter: saturate(140%) blur(10px); }
.topbar-title { font-weight: 600; color: var(--text-strong); font-size: 15px; }
.menu-btn { display: none; width: 40px; height: 40px; margin-left: -8px; border-radius: 10px; place-items: center; color: var(--text); }
.menu-btn:hover { background: var(--hover); }
.content { width: 100%; max-width: var(--content-w); margin: 0 auto; padding: 28px 28px 56px; }
.sb-backdrop { position: fixed; inset: 0; z-index: 45; background: rgba(8, 10, 16, .5); opacity: 0; pointer-events: none; transition: opacity .28s ease; }
.site-foot { padding: 0 28px 28px; text-align: center; font-size: 11px; color: var(--faint); letter-spacing: .02em; }

@media (max-width: 1023px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 50; height: 100%; width: min(290px, 86vw); flex-basis: auto;
    transform: translateX(-100%); transition: transform .3s cubic-bezier(.22, .8, .24, 1), visibility 0s linear .3s; visibility: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
  body.sb-open .sidebar { transform: none; visibility: visible; transition: transform .3s cubic-bezier(.22, .8, .24, 1), visibility 0s; }
  body.sb-open .sb-backdrop { opacity: 1; pointer-events: auto; }
  body.sb-open { overflow: hidden; }
  .sb-close, .menu-btn { display: inline-grid; }
  .topbar { padding: 0 16px; }
  .content { padding: 20px 16px 48px; }
  .site-foot { padding: 0 16px 24px; }
}
@media (prefers-reduced-motion: reduce) { .sidebar, .sb-backdrop, .modal-panel, .drawer-panel { transition: none !important; } }

/* ---------- Page head ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-head h1 { font-size: 24px; line-height: 1.25; font-weight: 700; color: var(--text-strong); letter-spacing: -.02em; }
.page-head p { margin-top: 4px; color: var(--muted); max-width: 640px; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.section-title { font-size: 15px; font-weight: 600; color: var(--text-strong); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { font-size: 15px; font-weight: 600; color: var(--text-strong); }
.card-head p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card-body { padding: 20px; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--line); }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) { .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-2.collapse-md { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .g-3, .g-2:not(.keep) { grid-template-columns: 1fr; } .g-4 { gap: 10px; } }

/* ---------- Stat tiles ---------- */
.stat { padding: 18px 20px; }
.stat-label { font-size: 12px; font-weight: 500; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat-value { margin-top: 6px; font-size: 24px; font-weight: 700; color: var(--text-strong); font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.2; overflow-wrap: anywhere; }
.stat-foot { margin-top: 4px; font-size: 12px; color: var(--muted); }
@media (max-width: 560px) { .stat { padding: 14px; } .stat-value { font-size: 19px; } }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--r-sm);
  font-weight: 600; font-size: 14px; line-height: 1; white-space: nowrap; border: 1px solid transparent; transition: background .15s, border-color .15s, color .15s, opacity .15s, transform .1s; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled, .btn.is-busy { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text-strong); border-color: var(--line-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--hover); }
.btn-ghost { color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: var(--hover); color: var(--text-strong); }
.btn-success { background: var(--pos-solid); color: #fff; }
.btn-success:hover:not(:disabled) { filter: brightness(1.06); }
.btn-danger { background: transparent; color: var(--neg); border-color: var(--neg-line); }
.btn-danger:hover:not(:disabled) { background: var(--neg-soft); }
.btn-danger-solid { background: var(--neg-solid); color: #fff; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: calc(var(--r-sm) - 2px); }
.btn-icon { width: 40px; padding: 0; }
.btn-sm.btn-icon { width: 32px; }
.btn-block { width: 100%; }
.btn .ic { width: 17px; height: 17px; }
.spin .ic, .ic.spin { animation: spin .8s linear infinite; }

/* ---------- Forms ---------- */
.field { display: block; }
.field + .field { margin-top: 16px; }
.field label, .label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: var(--text-strong); }
.field .hint { margin-top: 6px; font-size: 12px; color: var(--muted); }
.field .err { margin-top: 6px; font-size: 12px; color: var(--neg); }
.input, .field input, .field select, .field textarea { width: 100%; height: 42px; padding: 0 12px; border-radius: var(--r-sm); background: var(--input-bg);
  border: 1px solid var(--line-strong); color: var(--text-strong); outline: none; transition: border-color .15s, box-shadow .15s; }
.field textarea { height: auto; padding: 10px 12px; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring-soft); }
.field input[readonly] { color: var(--muted); cursor: not-allowed; }
.field input.is-invalid, .input.is-invalid { border-color: var(--neg); box-shadow: 0 0 0 3px var(--neg-soft); }
.input-wrap { position: relative; }
.input-wrap .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.input-wrap .input { padding-left: 38px; }
.input-wrap .suffix { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--muted); }
.pass-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 500; color: var(--muted); padding: 4px 6px; border-radius: 6px; }
.pass-toggle:hover { color: var(--text-strong); }
.form-error { margin-top: 12px; padding: 10px 12px; border-radius: var(--r-sm); font-size: 13px; color: var(--neg); background: var(--neg-soft); border: 1px solid var(--neg-line); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { height: 30px; padding: 0 12px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--line-strong); color: var(--text); background: var(--surface-2); }
.chip-btn:hover { border-color: var(--accent); color: var(--text-strong); }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--muted); cursor: pointer; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); }
.link { color: var(--accent-text); font-weight: 600; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; font-size: 13px; }
.table th { padding: 10px 16px; text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  background: var(--th-bg); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; color: var(--text); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover td, .table.hover tbody tr:hover td { background: var(--row-hover); }
.table td.num, .table th.num { text-align: right; }
.sub, .table .sub { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; font-family: var(--font); }
.table .empty-row td { padding: 40px 16px; text-align: center; color: var(--muted); white-space: normal; }
.table.compact td { padding: 9px 14px; } .table.compact th { padding: 9px 14px; }
/* Stack rows into cards on small screens */
@media (max-width: 720px) {
  .table.stack-sm thead { display: none; }
  .table.stack-sm, .table.stack-sm tbody, .table.stack-sm tr, .table.stack-sm td { display: block; width: 100%; }
  .table.stack-sm tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .table.stack-sm tbody tr:last-child { border-bottom: 0; }
  .table.stack-sm td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 5px 0; border: 0; white-space: normal; text-align: right; }
  .table.stack-sm td::before { content: attr(data-label); flex: 0 0 auto; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); text-align: left; }
  .table.stack-sm td.num { text-align: right; }
  .table.stack-sm td.actions { justify-content: flex-end; padding-top: 10px; }
  .table.stack-sm td.actions::before { display: none; }
  .table.stack-sm .empty-row td { display: block; text-align: center; }
  .table.stack-sm .empty-row td::before { display: none; }
}

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--neutral-soft); color: var(--muted); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.is-pending { background: var(--warn-soft); color: var(--warn); }
.badge.is-accepted, .badge.is-deposited, .badge.is-planted { background: var(--pos-soft); color: var(--pos); }
.badge.is-rejected { background: var(--neg-soft); color: var(--neg); }
.badge.is-pledged { background: var(--info-soft); color: var(--info); }

/* ---------- Tabs (segmented) ---------- */
.tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: calc(var(--r-sm) + 2px); background: var(--tabs-bg); border: 1px solid var(--line); max-width: 100%; overflow-x: auto; }
.tabs button { height: 32px; padding: 0 14px; border-radius: calc(var(--r-sm) - 1px); font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tabs button:hover { color: var(--text-strong); }
.tabs button.on { background: var(--surface); color: var(--text-strong); box-shadow: var(--shadow-sm); }
.tabs .n { font-size: 11px; font-weight: 700; color: var(--faint); font-family: var(--mono); }
.tabs button.on .n { color: var(--accent-text); }

/* ---------- Empty / loading ---------- */
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty .ic { width: 28px; height: 28px; margin: 0 auto 10px; color: var(--faint); }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; opacity: .8; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { display: inline-block; min-width: 48px; height: 1em; border-radius: 6px; background: var(--hover); vertical-align: middle; }

/* ---------- Modal + drawer ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; visibility: hidden; }
.modal.open { visibility: visible; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(8, 10, 16, .55); opacity: 0; transition: opacity .2s; }
.modal.open .modal-backdrop { opacity: 1; }
.modal-panel { position: relative; width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: 0 30px 80px rgba(0, 0, 0, .35); opacity: 0; transform: translateY(10px) scale(.98); transition: opacity .2s, transform .2s; }
.modal.open .modal-panel { opacity: 1; transform: none; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 20px 0; }
.modal-head h2 { font-size: 17px; font-weight: 700; color: var(--text-strong); }
.modal-head p { margin-top: 4px; font-size: 13px; color: var(--muted); }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 20px 20px; flex-wrap: wrap; }
.x-btn { width: 34px; height: 34px; margin: -6px -6px 0 0; border-radius: 9px; display: inline-grid; place-items: center; color: var(--muted); flex: 0 0 auto; }
.x-btn:hover { background: var(--hover); color: var(--text-strong); }
.drawer { position: fixed; inset: 0; z-index: 55; visibility: hidden; }
.drawer.open { visibility: visible; }
.drawer .modal-backdrop { transition: opacity .25s; }
.drawer.open .modal-backdrop { opacity: 1; }
.drawer-panel { position: absolute; right: 0; top: 0; height: 100%; width: min(480px, 100%); overflow-y: auto; background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: -20px 0 60px rgba(0, 0, 0, .2); transform: translateX(100%); transition: transform .3s cubic-bezier(.22, .8, .24, 1); display: flex; flex-direction: column; }
.drawer.open .drawer-panel { transform: none; }
.drawer-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.drawer-body { padding: 20px; flex: 1 1 auto; }
.drawer-foot { position: sticky; bottom: 0; padding: 16px 20px; background: var(--surface); border-top: 1px solid var(--line); display: flex; gap: 8px; }
.drawer-foot .btn { flex: 1 1 0; }
.kv { display: grid; grid-template-columns: minmax(110px, 40%) 1fr; }
.kv dt, .kv dd { margin: 0; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { color: var(--text-strong); text-align: right; overflow-wrap: anywhere; }
.kv > :nth-last-child(-n+2) { border-bottom: 0; }

/* ---------- Toast ---------- */
#toast { position: fixed; left: 50%; top: 16px; z-index: 80; transform: translate(-50%, -12px); opacity: 0; pointer-events: none; max-width: calc(100vw - 32px);
  padding: 11px 16px; border-radius: 12px; font-size: 13px; font-weight: 500; background: var(--toast-bg); color: var(--toast-text); box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
  display: flex; gap: 10px; align-items: center; transition: opacity .2s, transform .2s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--pos-solid); flex: 0 0 auto; }
#toast.error::before { background: var(--neg-solid); }

/* ---------- Switch ---------- */
.switch2 { position: relative; width: 44px; height: 26px; flex: 0 0 auto; display: inline-block; }
.switch2 input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch2 .track { position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); transition: .2s; }
.switch2 .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.switch2 input:checked + .track { background: var(--accent); }
.switch2 input:checked + .track::after { transform: translateX(18px); }

/* ---------- Brand + fun note ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.01em; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-bg); color: var(--brand-fg); }
.brand-mark svg { width: 18px; height: 18px; transform: rotate(-12deg); }
.brand small { display: block; font-size: 11px; font-weight: 500; letter-spacing: .02em; color: var(--sb-faint); }
.fun-pill { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em;
  color: var(--fun-text); background: var(--fun-bg); border: 1px solid var(--fun-line); white-space: nowrap; }

/* ---------- Live board (play + admin game) ---------- */
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pos-solid); display: inline-block; animation: livepulse 1.6s infinite; }
@keyframes livepulse { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .5); } 70% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }
.lb-table tr.win td { background: var(--pos-soft); color: var(--pos); }
.lb-table tr.win td:first-child { box-shadow: inset 3px 0 0 var(--pos-solid); }
.lb-table tr.lost td { color: var(--muted); }
.lb-table tr.me td { background: var(--accent-soft); }
.lb-table tr.flash td { animation: rowflash 1s ease; }
@keyframes rowflash { from { background: var(--hover); } }
.you-tag { margin-left: 4px; font-size: 9px; font-weight: 800; letter-spacing: .1em; color: var(--accent-text); }
.frame-card { overflow: hidden; border-radius: var(--r-lg); border: 1px solid var(--line); background: #0e2c4a; }
.frame-card iframe { display: block; width: 100%; height: 900px; border: 0; background: #08080b; }

@media (max-width: 520px) { .hide-xs { display: none !important; } .topbar .fun-pill { display: none; } }

/* ---------- Avatars (v3.5) — preset pictures or initials ---------- */
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; flex: 0 0 auto; overflow: hidden;
  font-weight: 700; font-size: 13px; line-height: 1; color: #fff; background: linear-gradient(135deg, #ff4d6d, #f59e0b); vertical-align: middle; }
.theme-admin .avatar { background: linear-gradient(135deg, #6366f1, #0ea5e9); }
.avatar.has-img { background: var(--surface-2); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.who-av { display: inline-flex; align-items: center; gap: 8px; min-width: 0; vertical-align: middle; }
.who-cell { display: inline-flex; align-items: center; gap: 10px; min-width: 0; text-align: left; vertical-align: middle; }
.who-cell .who-txt { min-width: 0; }

/* Avatar picker (profile page) */
.av-current { display: flex; align-items: center; gap: 16px; }
.av-current .avatar { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent); }
.av-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 10px; }
.av-opt { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px 8px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; transition: border-color .15s, transform .15s, background .15s; }
.av-opt:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.av-opt input { position: absolute; opacity: 0; pointer-events: none; }
.av-opt .avatar { width: 52px; height: 52px; font-size: 18px; }
.av-opt span.lbl { font-size: 11px; color: var(--muted); }
.av-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.av-opt:has(input:checked) span.lbl { color: var(--text-strong); font-weight: 600; }
.av-opt:has(input:focus-visible) { outline: 2px solid var(--ring); outline-offset: 2px; }
.av-opt .tick { position: absolute; top: 6px; right: 6px; width: 18px; height: 18px; border-radius: 50%; display: none; place-items: center;
  background: var(--accent); color: var(--on-accent); }
.av-opt:has(input:checked) .tick { display: grid; }
.av-opt .tick svg { width: 12px; height: 12px; }
@media (max-width: 520px) { .av-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; } .av-opt .avatar { width: 44px; height: 44px; } }
.top-avatar { margin-left: 10px; }

/* ---------- v3.6 Referral Rewards: shared bits ---------- */
.badge.is-completed, .badge.is-active { background: var(--pos-soft); color: var(--pos); }
.badge.is-qualified { background: var(--info-soft); color: var(--info); }
.badge.is-void, .badge.is-disabled { background: var(--neutral-soft); color: var(--muted); }
.badge .ic-sm { width: 13px; height: 13px; }
.bar { height: 8px; border-radius: 999px; background: var(--neutral-soft); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width .6s ease; }
@media (prefers-reduced-motion: reduce) { .bar > i { transition: none; } }
.mb-4 { margin-bottom: 16px; }

/* ---------- v4.1 Notification bell (player + admin) ---------- */
.nb { position: relative; }
.nb-btn { position: relative; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--muted); border: 1px solid var(--line); background: transparent; }
.nb-btn:hover, .nb.open .nb-btn { color: var(--text-strong); border-color: var(--line-strong, var(--line)); }
.nb-btn .ic { width: 20px; height: 20px; }
.nb-btn.has .ic { animation: nbRing 2.4s ease-in-out infinite; transform-origin: 50% 10%; }
@keyframes nbRing { 0%, 80%, 100% { transform: rotate(0); } 84% { transform: rotate(14deg); } 88% { transform: rotate(-12deg); } 92% { transform: rotate(8deg); } 96% { transform: rotate(-4deg); } }
.nb-count { position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; background: #ff2e63; color: #fff; font-size: 10.5px; font-weight: 800; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--bg, #fff); }
.nb-panel { position: absolute; right: 0; top: calc(100% + 10px); width: 370px; max-width: calc(100vw - 24px); z-index: 80; border-radius: 16px; overflow: hidden;
  background: var(--surface, #fff); border: 1px solid var(--line); box-shadow: 0 24px 60px -18px rgba(10, 14, 30, .35); }
.nb-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--line); color: var(--text-strong); }
.nb-all { font-size: 12px; font-weight: 700; color: var(--accent-text, #ff2e63); background: none; border: 0; cursor: pointer; }
.nb-list { max-height: 420px; overflow: auto; }
.nb-item { display: flex; gap: 11px; padding: 12px 16px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.nb-item:last-child { border-bottom: 0; }
.nb-item:hover { background: var(--row-hover, rgba(0,0,0,.03)); }
.nb-item.unread { background: color-mix(in srgb, #ff2e63 6%, transparent); }
.nb-item.unread .nb-txt b::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #ff2e63; margin-left: 6px; vertical-align: 2px; }
.nb-ic { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: rgba(90, 120, 255, .12); color: #5b74ff; }
.nb-ic.t-pos { background: rgba(31, 207, 127, .14); color: #12a866; }
.nb-ic.t-neg { background: rgba(255, 75, 105, .13); color: #e23d5c; }
.nb-txt { min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.nb-txt b { color: var(--text-strong); font-weight: 700; }
.nb-txt span { color: var(--muted); line-height: 1.4; }
.nb-txt small { color: var(--faint, var(--muted)); font-size: 11px; }
.nb-empty { padding: 26px 16px; text-align: center; color: var(--muted); font-size: 13px; }
@media (max-width: 640px) { .nb { position: static; } .nb-panel { position: fixed; left: 12px; right: 12px; top: 64px; width: auto; } }

/* v4.8 password strength meter */
.pw-meter { margin-top: 8px; }
.pw-bar { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.pw-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--neg-solid, #e5484d); transition: width .25s ease, background-color .25s ease; }
.pw-meter[data-lvl="1"] .pw-bar i { background: var(--warn, #f5a524); }
.pw-meter[data-lvl="2"] .pw-bar i { background: #8bc34a; }
.pw-meter[data-lvl="3"] .pw-bar i, .pw-meter[data-lvl="4"] .pw-bar i { background: var(--pos-solid, #22c55e); }
.pw-txt { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.pw-meter[data-lvl="0"] .pw-txt, .pw-meter[data-lvl="1"] .pw-txt { color: var(--neg, #e5484d); }
.pw-meter[data-lvl="3"] .pw-txt, .pw-meter[data-lvl="4"] .pw-txt { color: var(--pos, #22c55e); }
.weak-pw { margin-bottom: 16px; }

/* v4.9 Android app: no "install" prompts inside the app */
.in-app .install-tip { display: none !important; }
