/* ============================================================
   Learnery app styles. Self hosted type, no external CDN.
   ============================================================ */
@font-face { font-family: 'Inter'; src: url('../fonts/inter.woff2') format('woff2');
    font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Bricolage'; src: url('../fonts/bricolage.woff2') format('woff2');
    font-weight: 400 800; font-style: normal; font-display: swap; }
:root {
    --ink: #0f1729; --ink-soft: #414b63; --muted: #8791a6;
    --bg: #f7f8fc; --panel: #ffffff; --line: #e7eaf3;
    --brand: #4711ac; --brand-dark: #37108a; --brand-bright: #5f22cf; --brand-soft: #efe9fb;
    --accent: #f59e0b; --accent-soft: #fef4e3;
    --ok: #138a54; --ok-soft: #e4f6ec; --warn: #9a6300; --warn-soft: #fdf1dc;
    --err: #c22f3f; --err-soft: #fde8ea;
    --radius: 14px; --shadow: 0 1px 2px rgba(15, 23, 41, .06), 0 1px 3px rgba(15, 23, 41, .05);
    --shadow-lg: 0 18px 48px rgba(30, 12, 64, .14);
    --font: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: 'Bricolage', 'Inter', system-ui, -apple-system, "Segoe UI", sans-serif;
    --ease: cubic-bezier(.22, 1, .36, 1);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 15.5px;
       line-height: 1.55; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -.02em; }
h1 { font-size: 1.65rem; margin: .2em 0 .35em; line-height: 1.2; }
h2 { font-size: 1.2rem; margin: .2em 0 .5em; }
h3 { font-size: 1.02rem; margin: .2em 0 .4em; }
p { margin: .4em 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); } .small { font-size: .86em; }
.mono { font-family: Consolas, "Courier New", monospace; font-size: .9em; }
.nowrap { white-space: nowrap; }
img { max-width: 100%; }

/* ---------- buttons / chips / badges ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
       border: 1px solid transparent; border-radius: 10px; padding: 9px 18px; font-size: .95rem;
       font-weight: 600; cursor: pointer; text-decoration: none !important; transition: .15s; background: none; color: var(--ink); }
.btn { transition: transform .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease), border-color .15s; }
.btn--primary { background: linear-gradient(180deg, var(--brand-bright), var(--brand)); color: #fff; box-shadow: 0 6px 16px rgba(71, 17, 172, .26); }
.btn--primary:hover { background: linear-gradient(180deg, var(--brand), var(--brand-dark)); transform: translateY(-1px); box-shadow: 0 12px 24px rgba(71, 17, 172, .34); }
.btn--soft { background: var(--brand-soft); color: var(--brand-dark); }
.btn--soft:hover { background: #e4d9f7; }
.btn--ghost { border-color: var(--line); background: var(--panel); }
.btn--ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn--google { width: 100%; border: 1px solid var(--line); background: #fff; margin-bottom: 4px; }
.btn--google:hover { border-color: var(--brand); }
.btn--block { width: 100%; }
.btn--sm { padding: 5px 12px; font-size: .85rem; }
.btn--lg { padding: 13px 26px; font-size: 1.05rem; }
.btn:disabled, .btn.is-disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn.is-loading { opacity: .6; pointer-events: none; }
.chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); background: var(--panel);
        border-radius: 999px; padding: 4px 13px; font-size: .84rem; cursor: pointer; color: var(--ink-soft); transition: .15s; text-decoration: none !important; }
.chip:hover, .chip.is-active { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.badge { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: .78rem; font-weight: 600;
         background: var(--brand-soft); color: var(--brand-dark); }
.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--off { background: #eceff4; color: var(--muted); }

/* ---------- alerts ---------- */
.alert { border-radius: 10px; padding: 10px 14px; margin: 10px 0; font-size: .92rem; }
.alert--ok { background: var(--ok-soft); color: var(--ok); }
.alert--error { background: var(--err-soft); color: var(--err); }
.alert--warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- topbar / layout ---------- */
.topbar { display: flex; align-items: center; gap: 22px; background: var(--panel); border-bottom: 1px solid var(--line);
          padding: 0 22px; height: 58px; position: sticky; top: 0; z-index: 50; }
.topbar__brand { font-weight: 800; font-size: 1.1rem; color: var(--ink); text-decoration: none !important; display: flex; align-items: center; gap: 8px; }
.topbar__logo { font-size: 1.3rem; }
/* brand logo lockup */
.brand-lockup { display: inline-flex; align-items: center; gap: 9px; }
.brand-mark { display: block; flex: 0 0 auto; }
.brand-word { font-weight: 800; font-size: 1.18rem; letter-spacing: -.02em; color: var(--ink); }
.minimal-top .brand-word, .land-nav .brand-word { color: var(--ink); }
.topbar__nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.topbar__nav a { padding: 7px 13px; border-radius: 8px; color: var(--ink-soft); font-weight: 600; font-size: .92rem; white-space: nowrap; }
.topbar__nav a:hover { background: var(--bg); text-decoration: none; }
.topbar__nav a.is-active { background: var(--brand-soft); color: var(--brand-dark); }
.topbar__right { display: flex; align-items: center; gap: 12px; }
.topbar__user { color: var(--muted); font-size: .88rem; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lang-switch a { padding: 3px 7px; border-radius: 6px; font-size: .82rem; font-weight: 700; color: var(--muted); }
.lang-switch a.is-active { background: var(--brand-soft); color: var(--brand-dark); }
/* language dropdown (native <details>) */
.langdrop { position: relative; display: inline-block; }
.langdrop > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 11px; border: 1px solid var(--line); border-radius: 8px; font-size: .82rem; font-weight: 700;
    color: var(--ink-soft); background: var(--panel); user-select: none; white-space: nowrap; }
.langdrop > summary::-webkit-details-marker { display: none; }
.langdrop > summary::after { content: "▾"; font-size: .75em; color: var(--muted); margin-left: 1px; }
.langdrop[open] > summary { border-color: var(--brand); color: var(--brand); }
.langdrop__globe { font-size: 1em; }
.langdrop__menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 168px; background: var(--panel);
    border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(20, 32, 58, .16); overflow: hidden; z-index: 90; }
.langdrop__menu a { display: block; padding: 10px 15px; color: var(--ink); font-size: .9rem; font-weight: 500; }
.langdrop__menu a:hover { background: var(--bg); text-decoration: none; }
.langdrop__menu a.is-active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; }
.langdrop__menu a { display: flex; align-items: center; gap: 10px; }
.langflag { width: 20px; height: 14px; border-radius: 2px; object-fit: cover; vertical-align: middle; box-shadow: 0 0 0 1px rgba(0,0,0,.1); flex: 0 0 auto; }

/* ---------- language picker modal (first visit) ---------- */
.langmodal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px;
    background: rgba(15,23,41,.55); backdrop-filter: blur(5px); animation: lm-fade .25s ease; }
.langmodal__card { background: var(--panel); border-radius: 18px; box-shadow: 0 24px 64px rgba(0,0,0,.34); padding: 28px; max-width: 480px; width: 100%; }
.langmodal__title { font-size: 1.15rem; font-weight: 800; text-align: center; margin-bottom: 20px; display: flex; gap: 8px; justify-content: center; align-items: center; }
.langmodal__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.langmodal__opt { display: flex; align-items: center; gap: 12px; padding: 12px 15px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); font-weight: 600; transition: .15s; }
.langmodal__opt:hover { border-color: var(--brand); background: var(--brand-soft); text-decoration: none; transform: translateY(-1px); }
.langmodal__opt.is-active { border-color: var(--brand); }
.langmodal__opt img { width: 30px; height: 21px; border-radius: 3px; object-fit: cover; box-shadow: 0 0 0 1px rgba(0,0,0,.1); flex: 0 0 auto; }
@keyframes lm-fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- loading + motion ---------- */
.pageloader { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 1200; pointer-events: none; }
.pageloader__bar { height: 100%; width: 0; border-radius: 0 3px 3px 0;
    background: linear-gradient(90deg, var(--brand), var(--brand-bright), var(--accent));
    box-shadow: 0 0 14px rgba(95, 34, 207, .55); transition: width .35s var(--ease), opacity .45s ease .15s; }
.reveal { opacity: 0; transform: translateY(28px) scale(.99); transition: opacity .7s var(--ease), transform .7s var(--ease); will-change: opacity, transform; }
.reveal.is-visible { opacity: 1; transform: none; }
.reveal-stagger > * { opacity: 0; transform: translateY(22px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal-stagger.is-visible > * { opacity: 1; transform: none; }
.reveal-stagger.is-visible > *:nth-child(1) { transition-delay: .04s; }
.reveal-stagger.is-visible > *:nth-child(2) { transition-delay: .11s; }
.reveal-stagger.is-visible > *:nth-child(3) { transition-delay: .18s; }
.reveal-stagger.is-visible > *:nth-child(4) { transition-delay: .25s; }
.reveal-stagger.is-visible > *:nth-child(5) { transition-delay: .32s; }
.reveal-stagger.is-visible > *:nth-child(6) { transition-delay: .39s; }
@keyframes rise-in { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
@keyframes float-y { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@media (prefers-reduced-motion: reduce) {
    .reveal, .reveal-stagger > * { opacity: 1 !important; transform: none !important; transition: none !important; }
    .pageloader { display: none; }
    .langmodal { animation: none; }
    [style*="float-y"], .hero__visual { animation: none !important; }
}
.app-main { max-width: 1160px; margin: 0 auto; padding: 26px 20px 60px; }
.impersonation-bar { background: var(--warn); color: #fff; text-align: center; padding: 6px; font-size: .88rem; font-weight: 600; }

/* ---------- minimal layout (auth) ---------- */
.minimal-body { background: linear-gradient(160deg, #f1ecfb 0%, #faf9fe 100%); min-height: 100vh; }
.minimal-top { display: flex; justify-content: space-between; align-items: center; padding: 18px 26px; }
.minimal-main { display: flex; justify-content: center; padding: 4vh 16px 60px; }
.auth-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
             padding: 34px; width: 100%; max-width: 420px; }
.auth-card--wide { max-width: 560px; }
.auth-card h1 { font-size: 1.35rem; margin-top: 0; }
.auth-card label { display: block; margin: 13px 0; font-size: .9rem; font-weight: 600; color: var(--ink-soft); }
.auth-card input, .auth-card select, .form-grid input, .form-grid select {
    width: 100%; margin-top: 5px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
    font-size: .96rem; font-family: inherit; background: #fff; color: var(--ink); }
.auth-card input:focus, .auth-card select:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.auth-sep { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .82rem; margin: 14px 0; }
.auth-sep::before, .auth-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-links { text-align: center; font-size: .9rem; margin-top: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
.form-grid label { display: block; margin: 9px 0; font-size: .9rem; font-weight: 600; color: var(--ink-soft); }
.form-grid label:first-child { grid-column: span 2; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 34px; }
.card--center { text-align: center; max-width: 480px; margin: 0 auto; }
.card__emoji { font-size: 3rem; margin-bottom: 8px; }

/* ---------- panels / KPIs / tables ---------- */
.page-head { margin-bottom: 18px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
         padding: 20px 22px; margin-bottom: 18px; }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
       padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.kpi__num { font-size: 1.55rem; font-weight: 800; }
.kpi__label { color: var(--muted); font-size: .85rem; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em;
            border-bottom: 2px solid var(--line); padding: 8px 10px; }
.table td { border-bottom: 1px solid var(--line); padding: 9px 10px; vertical-align: middle; }
.table--mini td { padding: 5px 8px; }
.table td.num, .table td.pct { text-align: right; font-variant-numeric: tabular-nums; }
.table td.pct { color: var(--muted); width: 50px; }
.table-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- bar chart (CSS-only, syncflow style) ---------- */
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 170px; padding-top: 10px; }
.bar-chart--wide { gap: 2px; }
.bar-chart__col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; }
.bar-chart__bar { width: 100%; max-width: 46px; background: linear-gradient(180deg, var(--brand) 0%, var(--brand-bright) 100%);
                  border-radius: 6px 6px 0 0; transition: .3s; }
.bar-chart__col:hover .bar-chart__bar { background: var(--brand-dark); }
.bar-chart__x { font-size: .72rem; color: var(--muted); margin-top: 6px; white-space: nowrap; }
.bar-chart__v { font-size: .8rem; font-weight: 700; }

/* ---------- progress ---------- */
.progressbar { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.progressbar__fill { height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-bright)); border-radius: 999px; transition: width .4s; }

/* ---------- learner home ---------- */
.learn-hero { display: flex; justify-content: space-between; align-items: center; gap: 24px; background: var(--panel);
              border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 26px 30px; margin-bottom: 22px; flex-wrap: wrap; }
.learn-hero > div:first-child { flex: 1; min-width: 260px; }
.steps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.step-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.step-card.is-locked { opacity: .62; }
.step-card.is-complete { border-color: #bfe6d0; }
.step-card__head { display: flex; gap: 13px; align-items: flex-start; margin-bottom: 10px; }
.step-card__num { flex: 0 0 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark);
                  display: flex; align-items: center; justify-content: center; font-weight: 800; }
.step-card.is-complete .step-card__num { background: var(--ok-soft); color: var(--ok); }
.step-card__lock { margin-left: auto; }
.lesson-list { list-style: none; margin: 0; padding: 0; }
.lesson-item a, .lesson-item__locked { display: flex; gap: 9px; align-items: center; padding: 7px 9px; border-radius: 8px; color: var(--ink-soft); }
.lesson-item a:hover { background: var(--bg); text-decoration: none; }
.lesson-item.is-done .lesson-item__title { color: var(--ok); }
.lesson-item__meta { margin-left: auto; color: var(--muted); font-size: .8rem; }
.lesson-item__locked { color: var(--muted); }

/* ---------- lesson player ---------- */
.player { display: grid; grid-template-columns: 290px 1fr; gap: 22px; align-items: start; }
.player__sidebar { position: sticky; top: 76px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
                   box-shadow: var(--shadow); padding: 14px; max-height: calc(100vh - 100px); overflow-y: auto; }
.player__back { display: block; font-size: .88rem; margin-bottom: 10px; font-weight: 600; }
.curr-step { border-top: 1px solid var(--line); padding: 9px 2px; }
.curr-step:first-of-type { border-top: 0; }
.curr-step__title { display: flex; gap: 9px; align-items: center; font-weight: 700; font-size: .9rem; }
.curr-step__num { flex: 0 0 24px; height: 24px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark);
                  display: flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 800; }
.curr-step.is-locked { opacity: .55; }
.curr-step ul { list-style: none; margin: 7px 0 0; padding: 0 0 0 32px; }
.curr-step li { margin: 3px 0; font-size: .87rem; }
.curr-step li a { color: var(--ink-soft); display: block; padding: 3px 7px; border-radius: 6px; }
.curr-step li a:hover { background: var(--bg); text-decoration: none; }
.curr-step li.is-current > a { background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; }
.curr-step li span { color: var(--muted); }
.player__main { min-width: 0; }
.player__head { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
                padding: 22px 26px; margin-bottom: 16px; }
.audio-bar { display: flex; align-items: center; gap: 14px; background: var(--brand-soft); border-radius: 10px;
             padding: 9px 15px; margin-top: 13px; flex-wrap: wrap; font-size: .9rem; font-weight: 600; color: var(--brand-dark); }
.audio-bar audio { height: 36px; flex: 1; min-width: 220px; }
.block { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
         padding: 22px 26px; margin-bottom: 16px; position: relative; }
.block.is-done { border-left: 4px solid var(--ok); }
.block__label { margin-top: 0; }
.block__tools { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.block__done-row { margin-top: 14px; }
.rich h3, .rich h4 { margin: 1em 0 .3em; }
.rich ul { padding-left: 22px; }
.rich .example { background: var(--bg); border-left: 3px solid var(--brand); border-radius: 8px; padding: 10px 14px; margin: 10px 0; }
.rich .tip { background: var(--warn-soft); border-radius: 8px; padding: 10px 14px; margin: 10px 0; }
.rich .recipe { background: #101a33; color: #dfe7f7; border-radius: 10px; padding: 13px 16px; margin: 12px 0;
                font-family: Consolas, "Courier New", monospace; font-size: .88em; white-space: pre-wrap; position: relative; cursor: copy; }
.rich .recipe::before { content: "📋 prompt"; position: absolute; top: -9px; left: 12px; background: var(--brand);
                        color: #fff; border-radius: 999px; padding: 1px 10px; font-size: .72rem; font-family: inherit; }
.rich .recipe.is-copied::after { content: "✓ copied"; position: absolute; top: 8px; right: 12px; color: #7ee2a8; font-size: .8rem; }
.rich .takeaways { background: var(--ok-soft); border-radius: 10px; padding: 12px 18px; margin: 14px 0 4px; }
.rich .takeaways h4 { margin: 0 0 6px; color: var(--ok); }
.rich .takeaways ul { margin: 0; }
.tutor-note { background: var(--brand-soft); border-radius: 10px; padding: 12px 16px; margin-top: 12px; font-size: .93rem; white-space: pre-wrap; }
.mcq { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.mcq__opt { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px;
            padding: 10px 14px; cursor: pointer; transition: .15s; }
.mcq__opt:hover { border-color: var(--brand); }
.mcq__opt input { margin-top: 3px; }
.chat-goal { background: var(--warn-soft); border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; font-size: .92rem; }
.chat__log { display: flex; flex-direction: column; gap: 8px; max-height: 340px; overflow-y: auto; padding: 6px 2px; }
.chat__msg { max-width: 82%; border-radius: 14px; padding: 9px 14px; font-size: .93rem; white-space: pre-wrap; }
.chat__msg--me { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.chat__msg--them { align-self: flex-start; background: var(--bg); border-bottom-left-radius: 4px; }
.chat__msg--typing { color: var(--muted); }
.chat__controls { display: flex; gap: 9px; margin-top: 11px; }
.chat__input { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 10px 13px; font-size: .95rem; font-family: inherit; }
.chat__meta { display: flex; justify-content: space-between; align-items: center; margin-top: 9px; font-size: .84rem; color: var(--muted); }
.lab-task { margin-bottom: 12px; }
.lab-rubric { background: var(--bg); border-radius: 10px; padding: 12px 16px; margin-bottom: 12px; font-size: .9rem; }
.lab-rubric ul { margin: 6px 0 0; padding-left: 20px; }
.lab__input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: .95rem;
              font-family: inherit; margin-bottom: 10px; resize: vertical; }
.lab__result { margin-top: 14px; }
.lab-scores { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.lab-score { border-radius: 999px; padding: 3px 12px; font-size: .82rem; font-weight: 700; }
.lab-score--0 { background: var(--err-soft); color: var(--err); }
.lab-score--1 { background: var(--warn-soft); color: var(--warn); }
.lab-score--2 { background: var(--ok-soft); color: var(--ok); }
.lab-output { background: var(--bg); border: 1px dashed var(--line); border-radius: 10px; padding: 14px 16px;
              margin-top: 10px; white-space: pre-wrap; font-size: .93rem; }
.player__nav { display: flex; justify-content: space-between; margin-top: 22px; }
.spinner { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%;
           animation: spin .8s linear infinite; margin: 8px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- completion / certificate ---------- */
.complete-wrap { max-width: 720px; margin: 0 auto; }
.complete-ask { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
                padding: 36px; text-align: center; }
.complete-ask textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
                         font-size: 1rem; font-family: inherit; margin: 16px 0; resize: vertical; }
.complete-guide { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 34px; }
.guide-text { background: var(--brand-soft); border-radius: 12px; padding: 20px 24px; margin: 16px 0; }
.complete-cert { text-align: center; margin-top: 24px; }
.cert-page { max-width: 860px; margin: 0 auto; }
.cert { background: #fff; border-radius: 6px; box-shadow: var(--shadow); }
.cert__border { border: 3px double var(--brand); margin: 14px; padding: 44px 40px; text-align: center; }
.cert__brand { font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--brand-dark); margin-bottom: 22px; }
.cert__title { font-size: 1.9rem; margin: 0 0 14px; }
.cert__text { font-size: 1.05rem; }
.cert__steps { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 22px 0; }
.cert__step { background: var(--ok-soft); color: var(--ok); border-radius: 999px; padding: 4px 14px; font-size: .84rem; font-weight: 600; }
.cert__meta { display: flex; justify-content: space-around; margin-top: 26px; color: var(--ink-soft); font-size: .92rem; flex-wrap: wrap; gap: 8px; }
.cert__verify { color: var(--muted); font-size: .82rem; margin-top: 18px; }
.cert-actions { display: flex; gap: 12px; justify-content: center; margin: 22px 0; }
@media print {
    body { background: #fff; }
    .topbar, .cert-actions, .no-print, .impersonation-bar { display: none !important; }
    .app-main { padding: 0; max-width: none; }
    .cert { box-shadow: none; }
}

/* ---------- org admin ---------- */
.invite-forms { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.invite-form { display: flex; flex-direction: column; gap: 9px; }
.invite-form input, .invite-form select, .invite-form textarea, .sa-search input, .sa-inline-form input, .sa-inline-form select,
.checkout label input { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-size: .94rem; font-family: inherit; }
.invite-link input { width: 100%; margin-top: 8px; font-family: Consolas, monospace; font-size: .82rem; }
.checkout__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.checkout label { display: block; margin: 10px 0; font-weight: 600; font-size: .92rem; color: var(--ink-soft); }
.checkout label input { width: 100%; margin-top: 5px; }
.coupon-row { display: flex; gap: 8px; margin-top: 5px; }
.coupon-row input { flex: 1; text-transform: uppercase; }
.checkout__summary { background: var(--bg); border-radius: 12px; padding: 20px 22px; }
.sumline { display: flex; justify-content: space-between; padding: 7px 0; font-size: .95rem; }
.sumline--discount { color: var(--ok); }
.sumline--total { border-top: 2px solid var(--line); margin-top: 8px; padding-top: 12px; font-size: 1.15rem; font-weight: 800; }
.checkout__summary .btn { margin-top: 14px; }
.checkout-mock-summary { font-size: 1.1rem; margin: 16px 0; }
.quote-list { list-style: none; padding: 0; }
.quote-list li { border-left: 3px solid var(--brand-soft); padding: 7px 14px; margin: 7px 0; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
    .player { grid-template-columns: 1fr; }
    .player__sidebar { position: static; max-height: none; order: 2; }
    .invite-forms, .checkout__grid, .form-grid { grid-template-columns: 1fr; }
    .form-grid label:first-child { grid-column: span 1; }
    .topbar { padding: 0 12px; gap: 10px; }
    .topbar__user { display: none; }
    .app-main { padding: 18px 12px 50px; }
}
