/* Bookiverse — account, dashboard and admin pages
   Follows the site identity: deep navy surfaces, gold accent, Fredoka One + Nunito (Cairo in Arabic). */

:root {
  --bg-0: #0d041f;
  --bg-1: #0f0524;
  --bg-2: #1a1a2e;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.07);
  --surface-solid: #171131;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --gold: #FFD700;
  --gold-soft: #ffe680;
  --gold-deep: #e6b800;
  --gold-wash: rgba(255, 215, 0, 0.08);
  --gold-line: rgba(255, 215, 0, 0.32);
  --ink: #f2f0f7;
  --ink-2: #b9b7c9;
  --ink-3: #8e8ba5;
  --good: #5ee39a;
  --bad: #ff8a95;
  --radius-lg: 22px;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-head: 'Fredoka One', 'Nunito', sans-serif;
  --ease: cubic-bezier(.25, .8, .25, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; background: #14102a; }
body {
  min-height: 100vh; display: flex; flex-direction: column;
  font-family: var(--font); color: var(--ink); line-height: 1.6;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(255, 215, 0, 0.07), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(120, 90, 255, 0.10), transparent 60%),
    linear-gradient(160deg, var(--bg-1) 0%, var(--bg-2) 100%);
}
html[dir="rtl"] body { font-family: 'Cairo', var(--font); }
html[dir="rtl"] .h-display, html[dir="rtl"] .logo, html[dir="rtl"] h1, html[dir="rtl"] h2 { font-family: 'Cairo', var(--font); font-weight: 700; }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- header */
.site-header { background: rgba(13, 4, 31, 0.86); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 50; }
.site-header .wrap { display: flex; align-items: center; gap: 18px; min-height: 68px; }
.logo { font-family: var(--font-head); font-size: 1.85rem; color: var(--gold); letter-spacing: .01em; text-shadow: 0 0 18px rgba(255, 215, 0, .25); }
.logo:hover { text-decoration: none; }
.nav { display: flex; gap: 4px; margin-inline-start: auto; align-items: center; flex-wrap: wrap; }
.nav a, .nav button {
  color: var(--ink-2); font-weight: 700; font-size: .88rem; padding: 8px 14px; border-radius: 999px;
  background: none; border: 1px solid transparent; cursor: pointer; transition: all .2s var(--ease); white-space: nowrap;
}
.nav a:hover, .nav button:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.nav .lang { border-color: var(--gold-line); color: var(--gold); }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* ---------------------------------------------------------------- common UI */
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: .74rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.eyebrow::before { content: ""; width: 18px; height: 1px; background: var(--gold); opacity: .7; }
.h-display { font-family: var(--font-head); font-weight: 400; letter-spacing: .005em; line-height: 1.15; }
.muted { color: var(--ink-2); }
.subtle { color: var(--ink-3); font-size: .88rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 48px; padding: 0 24px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 800; font-size: .96rem; cursor: pointer; transition: transform .15s var(--ease), background .2s, border-color .2s, box-shadow .2s;
  text-decoration: none !important; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { color: #1a1206; background: linear-gradient(180deg, var(--gold-soft), var(--gold) 45%, var(--gold-deep)); box-shadow: 0 8px 24px rgba(255, 215, 0, .18), inset 0 1px 0 rgba(255, 255, 255, .5); }
.btn-primary:hover { box-shadow: 0 10px 30px rgba(255, 215, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .5); }
.btn-primary[disabled] { opacity: .6; cursor: progress; }
.btn-ghost { color: var(--ink); background: var(--surface); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--gold-line); background: var(--surface-2); }
.btn-quiet { min-height: 40px; padding: 0 16px; font-size: .88rem; color: var(--ink-2); background: none; border-color: var(--line); }
.btn-quiet:hover { color: var(--ink); border-color: var(--line-strong); }
.btn-danger { color: var(--bad); background: none; border-color: rgba(255, 138, 149, .35); }
.btn-danger:hover { background: rgba(255, 138, 149, .08); }
.btn-block { width: 100%; }
.btn svg { width: 18px; height: 18px; flex: none; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(26, 18, 6, .25); border-top-color: #1a1206; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: grid; gap: 7px; margin-bottom: 16px; }
.field label, .field .label { font-size: .84rem; font-weight: 700; color: var(--ink-2); }
.input-wrap { position: relative; }
.input {
  width: 100%; height: 50px; padding: 0 16px; border-radius: 13px;
  background: rgba(8, 3, 22, .55); border: 1px solid var(--line-strong); color: var(--ink);
  font-size: 1rem; transition: border-color .2s, box-shadow .2s, background .2s;
}
.input::placeholder { color: #6f6c88; }
.input:hover { border-color: rgba(255, 255, 255, .24); }
.input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(255, 215, 0, .12); background: rgba(8, 3, 22, .75); }
.input[aria-invalid="true"] { border-color: var(--bad); }
.input-wrap .reveal { position: absolute; inset-inline-end: 8px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border-radius: 10px; border: 0; background: none; color: var(--ink-3); cursor: pointer; display: grid; place-items: center; }
.input-wrap .reveal:hover { color: var(--ink); background: var(--surface-2); }
.input-wrap .reveal svg { width: 19px; height: 19px; }
.hint { font-size: .8rem; color: var(--ink-3); }
.check { display: flex; gap: 11px; align-items: flex-start; font-size: .88rem; color: var(--ink-2); cursor: pointer; }
.check input { appearance: none; width: 20px; height: 20px; flex: none; margin-top: 2px; border-radius: 6px; border: 1px solid var(--line-strong); background: rgba(8, 3, 22, .55); display: grid; place-items: center; cursor: pointer; }
.check input:checked { background: var(--gold); border-color: var(--gold); }
.check input:checked::after { content: ""; width: 10px; height: 6px; border: 2.5px solid #1a1206; border-top: 0; border-inline-end: 0; transform: translateY(-1px) rotate(-45deg); }

.alert { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: 13px; font-size: .9rem; margin-bottom: 18px; line-height: 1.55; }
.alert svg { width: 19px; height: 19px; flex: none; margin-top: 2px; }
.alert-error { background: rgba(255, 138, 149, .09); border: 1px solid rgba(255, 138, 149, .32); color: #ffd3d8; }
.alert-ok { background: rgba(94, 227, 154, .08); border: 1px solid rgba(94, 227, 154, .3); color: #cdf7de; }
.alert-gold { background: var(--gold-wash); border: 1px solid var(--gold-line); color: var(--ink); }
.alert-gold svg { color: var(--gold); }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 5px; gap: 4px; border-radius: 999px; background: rgba(8, 3, 22, .55); border: 1px solid var(--line); }
.seg button { height: 42px; border-radius: 999px; border: 0; background: none; color: var(--ink-2); font-weight: 800; font-size: .92rem; cursor: pointer; transition: all .2s var(--ease); }
.seg button[aria-selected="true"] { background: var(--surface-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--gold-line); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 999px; font-size: .78rem; font-weight: 800; letter-spacing: .02em; border: 1px solid var(--line-strong); color: var(--ink-2); white-space: nowrap; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-gold { color: var(--gold); border-color: var(--gold-line); background: var(--gold-wash); }
.pill-good { color: var(--good); border-color: rgba(94, 227, 154, .35); background: rgba(94, 227, 154, .07); }
.pill-warn { color: #ffc56b; border-color: rgba(255, 197, 107, .35); background: rgba(255, 197, 107, .07); }

.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .9rem; color: #1a1206; background: linear-gradient(135deg, var(--gold-soft), var(--gold) 55%, var(--gold-deep)); flex: none; }
.avatar.alt1 { background: linear-gradient(135deg, #b8d7ff, #7fb7ff); }
.avatar.alt2 { background: linear-gradient(135deg, #c9f5dc, #6fdca0); }
.avatar.alt3 { background: linear-gradient(135deg, #ffd1e8, #ff9cc8); }
.avatar.alt4 { background: linear-gradient(135deg, #e3d4ff, #b294ff); }

.modal-back { position: fixed; inset: 0; z-index: 100; background: rgba(5, 2, 14, .66); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 20px; animation: fade .2s ease; }
.modal { width: 100%; max-width: 440px; padding: 30px; border-radius: var(--radius-lg); background: linear-gradient(180deg, #1c1638, #150f2d); border: 1px solid var(--line-strong); box-shadow: var(--shadow); animation: rise .25s var(--ease); }
.modal h3 { font-family: var(--font-head); font-weight: 400; font-size: 1.4rem; margin-bottom: 6px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.site-footer { margin-top: auto; border-top: 1px solid var(--line); padding: 26px 0; color: var(--ink-3); font-size: .84rem; }
.site-footer .wrap { display: flex; gap: 16px; justify-content: space-between; flex-wrap: wrap; }
.site-footer a { color: var(--ink-2); }

/* ================================================================ ACCOUNT PAGE */
.auth-main { flex: 1; display: grid; place-items: center; padding: 48px 0 64px; }
.auth-shell { display: grid; grid-template-columns: 1.02fr 1fr; width: 100%; max-width: 1080px; border-radius: 28px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); background: rgba(12, 6, 30, .6); }
.brand-panel { position: relative; padding: 52px 48px; display: flex; flex-direction: column; gap: 26px; overflow: hidden;
  background:
    radial-gradient(520px 320px at 20% 0%, rgba(255, 215, 0, .16), transparent 65%),
    radial-gradient(420px 420px at 100% 100%, rgba(127, 183, 255, .12), transparent 60%),
    linear-gradient(170deg, #1a1240 0%, #120b2c 60%, #0e0824 100%);
  border-inline-end: 1px solid var(--line); }
.brand-panel .stars { position: absolute; inset: 0; opacity: .55; pointer-events: none; }
.brand-panel > * { position: relative; }
.brand-panel h1 { font-size: clamp(2rem, 3.1vw, 2.6rem); }
.brand-panel h1 em { font-style: normal; color: var(--gold); }
.brand-panel .lead { color: var(--ink-2); font-size: 1.02rem; max-width: 40ch; }
.feature-list { list-style: none; display: grid; gap: 16px; margin-top: 4px; }
.feature-list li { display: grid; grid-template-columns: 42px 1fr; gap: 14px; align-items: start; }
.feature-list .ico { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; color: var(--gold); background: var(--gold-wash); border: 1px solid var(--gold-line); }
.feature-list .ico svg { width: 20px; height: 20px; }
.feature-list b { display: block; font-size: .96rem; }
.feature-list span { color: var(--ink-3); font-size: .88rem; }
.brand-foot { margin-top: auto; padding-top: 20px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: .86rem; }
.brand-foot b { color: var(--ink-2); }

.auth-card { padding: 48px 46px; display: flex; flex-direction: column; justify-content: center; }
.auth-card h2 { font-size: 1.75rem; margin: 10px 0 6px; }
.auth-card .intro { color: var(--ink-2); margin-bottom: 24px; font-size: .96rem; }
.auth-card .seg { margin-bottom: 26px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.linkish { background: none; border: 0; color: var(--gold); font-weight: 700; cursor: pointer; font-size: .86rem; padding: 2px 0; }
.linkish:hover { text-decoration: underline; text-underline-offset: 3px; }
.types { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.type-opt { position: relative; }
.type-opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.type-opt span { display: grid; justify-items: center; gap: 6px; padding: 12px 4px 10px; border-radius: 13px; border: 1px solid var(--line-strong); background: rgba(8, 3, 22, .45); color: var(--ink-2); font-size: .8rem; font-weight: 800; transition: all .2s var(--ease); }
.type-opt span svg { width: 22px; height: 22px; }
.type-opt input:checked + span { border-color: var(--gold); color: var(--ink); background: var(--gold-wash); box-shadow: 0 0 0 3px rgba(255, 215, 0, .1); }
.type-opt input:checked + span svg { color: var(--gold); }
.type-opt input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }
.after-form { margin-top: 18px; text-align: center; color: var(--ink-3); font-size: .86rem; }

/* profile picker */
.profiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; margin: 8px 0 24px; }
.profile-tile { display: grid; justify-items: center; gap: 10px; padding: 22px 10px 18px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; transition: all .2s var(--ease); color: var(--ink); }
.profile-tile:hover { border-color: var(--gold-line); transform: translateY(-3px); background: var(--surface-2); }
.profile-tile .avatar { width: 64px; height: 64px; font-size: 1.35rem; }
.profile-tile .name { font-weight: 800; font-size: .95rem; text-align: center; overflow-wrap: anywhere; }
.profile-tile .meta { font-size: .76rem; color: var(--ink-3); display: flex; align-items: center; gap: 5px; }
.profile-tile .meta svg { width: 12px; height: 12px; }

/* PIN pad */
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 20px 0 22px; }
.pin-dots i { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--line-strong); transition: all .15s; }
.pin-dots i.on { background: var(--gold); border-color: var(--gold); }
.pin-dots.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.pin-pad { display: grid; grid-template-columns: repeat(3, 72px); gap: 12px; justify-content: center; direction: ltr; }
.pin-pad button { height: 60px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); font-size: 1.35rem; font-weight: 800; cursor: pointer; transition: background .15s; }
.pin-pad button:hover { background: var(--surface-2); border-color: var(--line-strong); }
.pin-pad button.ghost { background: none; border-color: transparent; font-size: .85rem; color: var(--ink-2); }

/* ================================================================ DASHBOARD */
.dash-main { padding: 36px 0 64px; }
.dash-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.dash-top h1 { font-size: clamp(1.9rem, 3vw, 2.5rem); margin-top: 8px; }
.dash-top .date { color: var(--ink-3); font-size: .92rem; margin-top: 4px; }
.dash-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.switcher { position: relative; }
.switcher-btn { display: inline-flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px 0 5px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line-strong); cursor: pointer; font-weight: 800; transition: border-color .2s; }
.switcher-btn:hover { border-color: var(--gold-line); }
.switcher-btn .avatar { width: 38px; height: 38px; }
.switcher-btn svg.chev { width: 16px; height: 16px; color: var(--ink-3); }
.menu { position: absolute; inset-inline-end: 0; top: calc(100% + 8px); min-width: 250px; padding: 8px; border-radius: 16px; background: #1b1537; border: 1px solid var(--line-strong); box-shadow: var(--shadow); z-index: 40; }
.menu button, .menu a { display: flex; width: 100%; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 11px; background: none; border: 0; color: var(--ink); font-weight: 700; font-size: .92rem; cursor: pointer; text-align: start; }
.menu button:hover, .menu a:hover { background: var(--surface-2); text-decoration: none; }
.menu .avatar { width: 32px; height: 32px; font-size: .78rem; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.menu .current { margin-inline-start: auto; color: var(--gold); }

.banner { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 16px 20px; margin-bottom: 22px; border-radius: var(--radius); }

.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 20px 20px 18px; display: grid; gap: 6px; position: relative; overflow: hidden; }
.kpi .k-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; font-size: .76rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); display: flex; align-items: center; gap: 8px; }
.kpi .k-label svg { width: 16px; height: 16px; color: var(--gold); }
.kpi .k-value { font-family: var(--font-head); font-size: 2.2rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .k-value small { font-family: var(--font); font-size: .95rem; font-weight: 700; color: var(--ink-2); margin-inline-start: 4px; }
.kpi .k-foot { font-size: .82rem; color: var(--ink-3); }

.grid-2 { display: grid; grid-template-columns: 1.55fr 1fr; gap: 18px; margin-bottom: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 18px; }
.panel { padding: 24px 24px 22px; display: flex; flex-direction: column; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.panel-head h2 { font-family: var(--font); font-weight: 800; font-size: 1.04rem; }
.panel-head .subtle { font-size: .82rem; }

/* column chart */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: rgba(255, 255, 255, .07); stroke-width: 1; }
.chart .axis-text { fill: var(--ink-3); font-size: 11px; font-family: var(--font); }
.chart .bar { fill: var(--gold); transition: opacity .15s; }
.chart .bar.today { fill: var(--gold-soft); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart .bar.hover { opacity: .78; }
.tooltip { position: absolute; pointer-events: none; z-index: 5; padding: 9px 12px; border-radius: 10px; background: #231c44; border: 1px solid var(--line-strong); box-shadow: 0 10px 24px rgba(0, 0, 0, .35); font-size: .82rem; white-space: nowrap; transform: translate(-50%, -100%); margin-top: -10px; }
.tooltip b { display: block; font-size: .88rem; }
.tooltip span { color: var(--ink-2); }

/* horizontal bars */
.hbars { display: grid; gap: 12px; }
.hbar { display: grid; grid-template-columns: 58px 1fr 44px; align-items: center; gap: 12px; font-size: .88rem; }
.hbar .lab { font-weight: 800; color: var(--ink-2); }
.hbar .track { height: 12px; border-radius: 999px; background: rgba(255, 255, 255, .06); overflow: hidden; }
.hbar .fill { display: block; height: 100%; border-radius: 999px; background: var(--gold); min-width: 0; transition: width .6s var(--ease); }
.hbar .val { text-align: end; font-weight: 800; font-variant-numeric: tabular-nums; }
.hbar.wide { grid-template-columns: minmax(96px, 150px) 1fr 58px; }

/* placement */
.placement { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center; }
.cefr-badge { width: 108px; height: 108px; border-radius: 50%; display: grid; place-items: center; align-content: center; border: 2px solid var(--gold); background: radial-gradient(circle at 30% 25%, rgba(255, 215, 0, .18), rgba(255, 215, 0, .03)); box-shadow: 0 0 0 8px rgba(255, 215, 0, .05); }
.cefr-badge small { font-size: .68rem; font-weight: 800; letter-spacing: .16em; color: var(--ink-3); }
.cefr-badge b { font-family: var(--font-head); font-weight: 400; font-size: 2.3rem; line-height: 1; color: var(--gold); }
.facts { display: grid; gap: 4px; font-size: .9rem; color: var(--ink-2); }
.facts b { color: var(--ink); }

/* vocab meters */
.meters { display: grid; gap: 14px; }
.meter-row { display: grid; gap: 6px; }
.meter-row .top { display: flex; justify-content: space-between; font-size: .86rem; }
.meter-row .top b { font-weight: 800; }
.meter-row .top span { color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* table */
.table-wrap { overflow-x: auto; margin: 0 -8px; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th { text-align: start; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 800; padding: 10px 8px; border-bottom: 1px solid var(--line); }
table.data td { padding: 13px 8px; border-bottom: 1px solid rgba(255, 255, 255, .05); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num { text-align: end; font-variant-numeric: tabular-nums; font-weight: 800; }
table.data .act { display: flex; align-items: center; gap: 12px; min-width: 220px; }
table.data .act i { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--gold-wash); color: var(--gold); border: 1px solid var(--gold-line); font-style: normal; }
table.data .act i svg { width: 17px; height: 17px; }
table.data .act small { display: block; color: var(--ink-3); font-size: .78rem; }

.empty { display: grid; place-items: center; text-align: center; gap: 10px; padding: 28px 12px; color: var(--ink-3); font-size: .9rem; flex: 1; }
.empty svg { width: 34px; height: 34px; color: rgba(255, 215, 0, .5); }
.empty a { font-weight: 800; }

/* settings */
.settings { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.setting-list { display: grid; gap: 4px; }
.setting { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid rgba(255, 255, 255, .05); }
.setting:last-child { border-bottom: 0; }
.setting b { display: block; font-size: .94rem; }
.setting span { color: var(--ink-3); font-size: .84rem; }
.kid { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, .05); }
.kid:last-child { border-bottom: 0; }
.kid .grow { flex: 1; min-width: 0; }
.kid .grow b { display: block; }
.kid .grow span { font-size: .8rem; color: var(--ink-3); }

.skeleton { background: linear-gradient(90deg, rgba(255, 255, 255, .04), rgba(255, 255, 255, .09), rgba(255, 255, 255, .04)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ================================================================ responsive */
@media (max-width: 1080px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .kpis .kpi:nth-child(4) { grid-column: span 1; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; max-width: 560px; }
  .brand-panel { padding: 34px 30px; border-inline-end: 0; border-bottom: 1px solid var(--line); }
  .brand-panel .feature-list, .brand-panel .brand-foot { display: none; }
  .auth-card { padding: 34px 30px 38px; }
  .grid-2, .settings { grid-template-columns: 1fr; }
  .nav a.opt { display: none; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .auth-main { padding: 20px 0 40px; }
  .auth-shell { border-radius: 22px; }
  .brand-panel { padding: 26px 22px; }
  .auth-card { padding: 26px 20px 30px; }
  .types { grid-template-columns: repeat(2, 1fr); }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpis .kpi:last-child { grid-column: 1 / -1; }
  .kpi .k-value { font-size: 1.8rem; }
  .grid-3 { grid-template-columns: 1fr; }
  .placement { grid-template-columns: 1fr; justify-items: start; }
  .logo { font-size: 1.5rem; }
  .nav a:not(.keep) { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---------------------------------------------------------------- classes (Teacher tier) */
.code-input { text-transform: uppercase; letter-spacing: .28em; font-weight: 800; font-variant-numeric: tabular-nums; }
.code-input::placeholder { letter-spacing: normal; text-transform: none; font-weight: 400; }
.class-found { display: block; margin-top: 6px; font-weight: 700; }
.class-found.good { color: var(--good); }
.class-found.bad { color: var(--bad); }
.btn-sm { min-height: 38px; padding: 0 16px; font-size: .86rem; }

/* ---------------------------------------------------------------- teacher page */
.empty .spinner { width: 28px; height: 28px; border-color: rgba(255, 215, 0, .2); border-top-color: var(--gold); }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: .86rem; font-weight: 800; color: var(--ink-2); margin-bottom: 4px; }
.back-link:hover { color: var(--gold); text-decoration: none; }

.class-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; margin-bottom: 20px; }
.class-card { display: flex; flex-direction: column; gap: 14px; padding: 22px 22px 20px; color: var(--ink); text-align: start; font: inherit;
  transition: border-color .2s var(--ease), transform .2s var(--ease), background .2s; min-height: 210px; }
a.class-card:hover, button.class-card:hover { border-color: var(--gold-line); background: var(--surface-2); transform: translateY(-2px); text-decoration: none; }
.class-card .cc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.class-card h2 { font-family: var(--font); font-weight: 800; font-size: 1.14rem; line-height: 1.3; overflow-wrap: anywhere; }
.class-card .cc-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.5rem; font-weight: 700; letter-spacing: .22em; color: var(--gold); }
.class-card .cc-meter { display: grid; gap: 8px; margin-top: auto; }
.class-card .cc-meter .top { display: flex; justify-content: space-between; gap: 8px; font-size: .82rem; color: var(--ink-3); }
.class-card .cc-meter .top span:first-child { color: var(--ink-2); font-weight: 800; }
.class-card .track { display: block; height: 8px; border-radius: 999px; background: rgba(255, 255, 255, .06); overflow: hidden; }
.class-card .fill { display: block; height: 100%; border-radius: 999px; background: var(--gold); }
.class-card .cc-open { font-size: .86rem; font-weight: 800; color: var(--gold); }
.add-card { align-items: center; justify-content: center; text-align: center; border-style: dashed; border-color: var(--line-strong); background: transparent; cursor: pointer; }
.add-card .plus { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 1.6rem; font-weight: 800; color: var(--gold); background: var(--gold-wash); border: 1px solid var(--gold-line); }
.add-card .plus svg { width: 20px; height: 20px; }
.add-card b { font-size: 1.02rem; }
.add-card span:last-child { color: var(--ink-3); font-size: .86rem; max-width: 260px; }
.add-card.is-full { cursor: default; opacity: .85; }
.how-note { max-width: 760px; line-height: 1.7; }

.class-head { display: grid; grid-template-columns: minmax(300px, 1fr) 2fr; gap: 18px; margin-bottom: 18px; }
.code-card { padding: 22px; display: grid; gap: 12px; align-content: start; }
.code-card .k-label { font-size: .76rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.code-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.class-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 2.2rem; letter-spacing: .24em; color: var(--gold); line-height: 1.1; }
.code-card .subtle { line-height: 1.6; }
.code-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.code-actions .subtle { width: 100%; }
.class-kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }

.switch { display: inline-flex; align-items: center; gap: 10px; font-size: .86rem; font-weight: 700; color: var(--ink-2); cursor: pointer; margin-inline-start: auto; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 42px; height: 24px; border-radius: 999px; background: rgba(255, 255, 255, .12); position: relative; transition: background .2s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); }
.switch input:checked + .track { background: var(--good); }
.switch input:checked + .track::after { transform: translateX(18px); }
html[dir="rtl"] .switch input:checked + .track::after { transform: translateX(-18px); }
.switch input:focus-visible + .track { outline: 3px solid var(--gold); outline-offset: 2px; }
.switch input:disabled + .track { opacity: .5; }

table.data.students .avatar { width: 34px; height: 34px; font-size: .78rem; }
table.data.students .act { min-width: 190px; }
table.data th .sort { background: none; border: 0; padding: 0; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
table.data th .sort:hover { color: var(--ink); }
table.data td.row-actions { text-align: end; white-space: nowrap; }
table.data td.row-actions .btn { min-height: 34px; padding: 0 12px; font-size: .82rem; margin-inline-start: 6px; }
.danger-zone { padding: 6px 24px; }
.danger-zone .setting { border: 0; }
.input-wrap .reveal.gen { width: auto; padding: 0 10px; font-size: .78rem; font-weight: 800; color: var(--gold); }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
html[dir="rtl"] select.input { background-position: 20px 50%, 15px 50%; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 120; max-width: min(560px, calc(100vw - 32px));
  padding: 13px 20px; border-radius: 14px; background: #221b44; border: 1px solid var(--gold-line); color: var(--ink); font-weight: 700; font-size: .9rem;
  box-shadow: var(--shadow); animation: rise .25s var(--ease); text-align: center; }

@media (max-width: 900px) {
  .class-head { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .class-code { font-size: 1.8rem; }
  .class-kpis { gap: 10px; }
  .switch { margin-inline-start: 0; }
}
select.input:focus { background-color: rgba(8, 3, 22, .75); background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); }
@media (max-width: 640px) {
  .class-kpis .kpi .k-label { white-space: normal; }
  table.data.students thead { display: none; }
  table.data.students, table.data.students tbody { display: block; }
  table.data.students tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 10px; padding: 16px 8px; border-bottom: 1px solid rgba(255, 255, 255, .06); }
  table.data.students td { padding: 0; border: 0; text-align: start; font-size: .9rem; }
  table.data.students td:first-child, table.data.students td.row-actions { grid-column: 1 / -1; }
  table.data.students td[data-l]::before { content: attr(data-l); display: block; font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 2px; }
  html[dir="rtl"] table.data.students td[data-l]::before { letter-spacing: 0; }
  table.data.students td.row-actions { text-align: start; display: flex; gap: 8px; }
  table.data.students td.row-actions .btn { margin: 0; flex: 1; }
}

/* ---------------------------------------------------------------- organisation page */
.kpi .k-meter .track { display: block; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .07); overflow: hidden; margin: 2px 0 2px; }
.kpi .k-meter .fill { display: block; height: 100%; border-radius: 999px; background: var(--gold); }
.role-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.role-opts .type-opt span { justify-items: start; text-align: start; padding: 12px 14px; gap: 3px; }
.role-opts .type-opt small { font-weight: 600; color: var(--ink-3); font-size: .76rem; line-height: 1.45; }
.linkish.small { font-size: .78rem; margin-inline-start: 6px; }
code.code-sm { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .14em; color: var(--gold); font-weight: 700; }
.danger-details { margin: 6px 0 4px; border-top: 1px solid var(--line); padding-top: 12px; }
.danger-details summary { cursor: pointer; color: var(--bad); font-weight: 800; font-size: .88rem; }
.panel-head .btn { align-self: center; }
@media (max-width: 640px) {
  .role-opts { grid-template-columns: 1fr; }
  table.data.staff thead, table.data.classes thead { display: none; }
  table.data.staff, table.data.staff tbody, table.data.classes, table.data.classes tbody { display: block; }
  table.data.staff tr, table.data.classes tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 10px; padding: 16px 8px; border-bottom: 1px solid rgba(255, 255, 255, .06); }
  table.data.staff td, table.data.classes td { padding: 0; border: 0; text-align: start; font-size: .9rem; }
  table.data.staff td:first-child, table.data.classes td:first-child,
  table.data.staff td.row-actions, table.data.classes td.row-actions { grid-column: 1 / -1; }
  table.data.staff td[data-l]::before, table.data.classes td[data-l]::before { content: attr(data-l); display: block; font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 2px; }
  table.data.staff td.row-actions, table.data.classes td.row-actions { text-align: start; display: flex; }
  table.data.staff td.row-actions .btn, table.data.classes td.row-actions .btn { flex: 1; margin: 0; }
}
#stats.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.kpi { align-content: start; }
