/* ===================== Akili theme (GrowthEngine design language) =====================
   Brand Orange #F26B1D · Green #1E9E5A · glassmorphism · Plus Jakarta Sans · dark + light
*/
:root {
    --brand: #F26B1D;
    --brand-2: #FF8A3D;
    --brand-deep: #C9530E;
    --green: #1E9E5A;
    --green-2: #34C77B;
    --danger: #E5484D;
    --danger-2: #FF6B6B;
    --amber: #F5A623;

    --radius: 10px;
    --radius-sm: 7px;
    --radius-pill: 999px;
    --maxw: 980px;
    --nav-h: 54px;

    --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --ease: cubic-bezier(.22,1,.36,1);
    --shadow-soft: 0 10px 30px -12px rgba(0,0,0,.45);
    --shadow-lift: 0 18px 45px -15px rgba(0,0,0,.55);
}

/* Light is the default theme (applies when no data-theme attribute is set). */
:root, [data-theme="light"] {
    --bg: #F6F7F9;
    --bg-grad-1: #FFF3EA;
    --bg-grad-2: #F1F3F6;
    --surface: rgba(255,255,255,.82);
    --surface-solid: #FFFFFF;
    --surface-2: rgba(17,17,17,.03);
    --border: rgba(17,17,17,.08);
    --border-strong: rgba(17,17,17,.14);
    --text: #14151A;
    --text-dim: #565A63;
    --text-faint: #8A8F98;
    --brand-on: #FFFFFF;
    --glass-blur: 16px;
    color-scheme: light;
}

[data-theme="dark"] {
    --bg: #0E0F12;
    --bg-grad-1: #16110C;
    --bg-grad-2: #0B0C0F;
    --surface: rgba(28,29,34,.72);
    --surface-solid: #1A1B20;
    --surface-2: rgba(255,255,255,.04);
    --border: rgba(255,255,255,.08);
    --border-strong: rgba(255,255,255,.14);
    --text: #F4F5F7;
    --text-dim: #A7ABB4;
    --text-faint: #6E727B;
    --brand-on: #1A1206;
    --glass-blur: 18px;
    color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 13px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}
body::before {
    content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background:
        radial-gradient(120% 80% at 85% -10%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 60%),
        radial-gradient(90% 60% at -10% 0%, color-mix(in srgb, var(--green) 12%, transparent), transparent 55%),
        linear-gradient(var(--bg-grad-1), var(--bg-grad-2));
}

h1, h2, h3 { color: var(--text); margin-top: 0; letter-spacing: -.2px; }
h1 { font-size: 1.15rem; margin-bottom: 4px; }
h2 { font-size: .92rem; }
p { margin: 4px 0 8px; }
a { color: var(--brand-2); text-decoration: none; }

.centered-loader, .auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; }

/* ---------- App shell ---------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.app-topbar {
    height: 46px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 14px;
    background: var(--surface);
    -webkit-backdrop-filter: blur(var(--glass-blur)); backdrop-filter: blur(var(--glass-blur));
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 20;
}
.brand { font-size: 1.05rem; font-weight: 800; color: var(--text); letter-spacing: -.5px; }
.brand span { color: var(--brand-2); }

.credit-pill {
    display: inline-flex; align-items: center; gap: 6px;
    background: color-mix(in srgb, var(--amber) 16%, transparent);
    border: 1px solid color-mix(in srgb, var(--amber) 35%, transparent);
    color: var(--amber); font-weight: 700; font-size: .78rem;
    padding: 3px 10px; border-radius: var(--radius-pill);
}
.credit-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); }

.topbar-right { display: inline-flex; align-items: center; gap: 8px; }
.theme-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; padding: 0; font-size: .82rem; line-height: 1;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius-pill); cursor: pointer;
    transition: border-color .15s var(--ease), background .15s var(--ease);
}
.theme-toggle:hover { border-color: var(--border-strong); }

/* ---------- Enterprise portal ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin-bottom: 12px; }
.stat-card { padding: 8px 10px; margin: 0; }
.inline-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.input-sm { padding: 3px 6px; font-size: .78rem; height: auto; }
.btn-xs { padding: 3px 8px; font-size: .72rem; }
.etable { width: 100%; border-collapse: collapse; font-size: .8rem; }
.etable th { text-align: left; font-weight: 600; color: var(--text-dim); font-size: .72rem; padding: 4px 8px; border-bottom: 1px solid var(--border); }
.etable td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.etable tr:last-child td { border-bottom: none; }

/* ============ Guided lesson prototype (/try-lesson) ============ */
.tl-shell { max-width: 560px; margin: 0 auto; padding: 6px 2px 80px; }
.tl-top { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.tl-x { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border);
    background: var(--surface-2); color: var(--text-dim); cursor: pointer; font-size: .8rem; }
.tl-progress { flex: 1; display: flex; gap: 5px; }
.tl-seg { flex: 1; height: 6px; border-radius: 999px; background: var(--surface-2);
    border: 1px solid var(--border); transition: background .4s var(--ease); }
.tl-seg.on { background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-color: transparent; }
.tl-chip { font-size: .68rem; font-weight: 700; color: var(--brand-2);
    background: color-mix(in srgb, var(--brand) 12%, transparent); padding: 3px 9px; border-radius: 999px; }

.tl-card-wrap { position: relative; }
.tl-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
    padding: 26px 22px; box-shadow: var(--shadow-soft);
    -webkit-backdrop-filter: blur(var(--glass-blur)); backdrop-filter: blur(var(--glass-blur));
    text-align: center;
}
@keyframes tlIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.tl-in { animation: tlIn .45s var(--ease) both; }

.tl-emoji { font-size: 2.6rem; line-height: 1; margin-bottom: 10px; }
.tl-h { font-size: 1.5rem; font-weight: 800; letter-spacing: -.5px; margin: 0 0 8px; }
.tl-h2 { font-size: 1.2rem; font-weight: 800; letter-spacing: -.3px; margin: 2px 0 14px; }
.tl-lead { font-size: .96rem; color: var(--text-dim); line-height: 1.55; margin: 0 auto 22px; max-width: 420px; }
.tl-kicker { font-size: .7rem; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--brand-2); margin-bottom: 4px; }

.tl-points { display: grid; gap: 10px; text-align: left; margin: 4px 0 20px; }
.tl-point { display: flex; align-items: center; gap: 12px; background: var(--surface-2);
    border: 1px solid var(--border); border-radius: 12px; padding: 11px 14px; }
.tl-point .tl-ic { font-size: 1.4rem; }
.tl-point b { display: block; font-size: .92rem; }
.tl-point small { color: var(--text-faint); font-size: .76rem; }

.tl-ba { text-align: left; border-radius: 12px; padding: 13px 15px; border: 1px solid var(--border); }
.tl-ba-tag { font-size: .68rem; font-weight: 800; letter-spacing: .5px; margin-bottom: 5px; }
.tl-ba-text { font-size: .9rem; line-height: 1.5; }
.tl-bad { background: color-mix(in srgb, var(--danger) 9%, transparent); border-color: color-mix(in srgb, var(--danger) 28%, transparent); }
.tl-bad .tl-ba-tag { color: var(--danger-2); }
.tl-good { background: color-mix(in srgb, var(--green) 10%, transparent); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.tl-good .tl-ba-tag { color: var(--green-2); }
.tl-arrow { font-size: 1.3rem; color: var(--brand-2); margin: 6px 0; }
.tl-tags { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 14px 0 20px; }
.tl-tag { font-size: .72rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; color: var(--text-dim); }

.tl-textarea { width: 100%; background: var(--surface-2); border: 1px solid var(--border-strong);
    border-radius: 12px; padding: 12px 14px; color: var(--text); font-family: var(--font); font-size: .92rem;
    line-height: 1.5; resize: vertical; }
.tl-textarea:focus { outline: none; border-color: var(--brand); }
.tl-lesson-body { font-size: .95rem; line-height: 1.65; color: var(--text); }
.tl-lesson-body b { color: var(--brand-2); }

/* deep-dive "full guide" + self-check quiz (Phase 2) */
.tl-fullguide { background: none; border: none; color: var(--brand-2); font-weight: 700; font-size: .85rem; cursor: pointer; padding: 10px 0 0; font-family: inherit; }
.tl-doc { text-align: left; margin-top: 12px; padding: 14px 15px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; font-size: .88rem; line-height: 1.65; color: var(--text); }
.tl-doc h3 { font-size: .98rem; margin: 14px 0 6px; }
.tl-doc h4 { font-size: .9rem; margin: 12px 0 5px; color: var(--brand-2); }
.tl-doc p { margin: 0 0 8px; }
.tl-doc ul { margin: 0 0 8px; padding-left: 18px; }
.tl-doc li { margin-bottom: 3px; }
.tl-doc b { color: var(--text); }
.tl-quiz { text-align: left; margin-top: 14px; }
.tl-quiz-q { font-weight: 700; font-size: .88rem; margin: 12px 0 8px; }
.tl-quiz-opt { display: block; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; margin-bottom: 6px; font-size: .84rem; color: var(--text); cursor: pointer; font-family: inherit; transition: all .12s var(--ease); }
.tl-quiz-opt:hover:not(:disabled) { border-color: var(--brand); }
.tl-quiz-opt:disabled { cursor: default; }
.tl-quiz-opt.correct { background: color-mix(in srgb, var(--green) 12%, transparent); border-color: var(--green-2); color: #0f6e3c; font-weight: 600; }
.tl-quiz-opt.wrong { background: color-mix(in srgb, var(--danger) 10%, transparent); border-color: var(--danger-2); color: #A32D2D; }
.tl-quiz-why { font-size: .8rem; color: var(--text-dim); margin: 2px 0 8px; padding-left: 2px; }
.tl-task { text-align: left; font-size: .92rem; line-height: 1.5; background: var(--surface-2);
    border: 1px solid var(--border); border-left: 3px solid var(--brand); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.tl-hint { text-align: left; font-size: .82rem; color: var(--text-dim); background: color-mix(in srgb, var(--amber) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--amber) 28%, transparent); border-radius: 10px; padding: 10px 13px; margin-top: 10px; }

.tl-row { display: flex; gap: 10px; margin-top: 20px; }
.tl-btn { flex: 1; background: linear-gradient(90deg, var(--brand), var(--brand-2)); color: var(--brand-on);
    border: none; border-radius: 12px; padding: 12px 18px; font-weight: 800; font-size: .95rem; cursor: pointer;
    box-shadow: 0 8px 20px -8px var(--brand); transition: transform .12s var(--ease), filter .15s; }
.tl-btn:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.04); }
.tl-btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.tl-btn-ghost { background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--border);
    border-radius: 12px; padding: 12px 16px; font-weight: 700; font-size: .9rem; cursor: pointer; }
.tl-btn-ghost:disabled { opacity: .4; }

/* grading "alive" state */
.tl-grading { margin-top: 18px; text-align: center; }
.tl-dots { display: inline-flex; gap: 6px; margin-bottom: 8px; }
.tl-dots span { width: 9px; height: 9px; border-radius: 50%; background: var(--brand-2); animation: tlBounce 1s infinite ease-in-out; }
.tl-dots span:nth-child(2) { animation-delay: .15s; } .tl-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes tlBounce { 0%,80%,100% { transform: scale(.6); opacity: .5; } 40% { transform: scale(1); opacity: 1; } }
.tl-grading-msg { font-size: .85rem; color: var(--text-dim); margin-bottom: 14px; }
.tl-skel { height: 12px; border-radius: 6px; margin: 8px 0; background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2));
    background-size: 200% 100%; animation: tlShimmer 1.2s infinite; }
.tl-skel.short { width: 60%; margin-inline: auto; }
@keyframes tlShimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* result */
.tl-score { display: flex; align-items: center; gap: 16px; justify-content: center; margin-bottom: 16px; }
.tl-ring { width: 92px; height: 92px; transform: rotate(-90deg); }
.tl-ring-bg { fill: none; stroke: var(--surface-2); stroke-width: 9; }
.tl-ring-fg { fill: none; stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset 1s var(--ease); }
.tl-ring-num { transform: rotate(90deg); transform-origin: 50px 50px; font-size: 26px; font-weight: 800; fill: var(--text); text-anchor: middle; }
.tl-verdict { text-align: left; }
.tl-verdict-h { font-size: 1.15rem; font-weight: 800; }
.tl-feedback { text-align: left; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 13px 15px; }
.tl-fb-label { font-size: .68rem; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: var(--brand-2); margin-bottom: 5px; }
.tl-fb-body { font-size: .9rem; line-height: 1.55; color: var(--text); }
.tl-reveal { background: none; border: none; color: var(--brand-2); font-weight: 700; font-size: .85rem; cursor: pointer; margin-top: 12px; }

/* celebrate */
.tl-celebrate { position: relative; overflow: hidden; }
.tl-check { width: 64px; height: 64px; margin: 0 auto 8px; border-radius: 50%; background: linear-gradient(135deg, var(--green), var(--green-2));
    color: #fff; font-size: 2rem; display: flex; align-items: center; justify-content: center; animation: tlPop .5s var(--ease) both; }
@keyframes tlPop { 0% { transform: scale(0); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }
.tl-xp { display: inline-block; font-weight: 800; color: var(--green-2); background: color-mix(in srgb, var(--green) 12%, transparent);
    border-radius: 999px; padding: 4px 12px; font-size: .82rem; margin-bottom: 18px; }
.tl-levelbar { text-align: left; margin-bottom: 18px; }
.tl-levelbar-head { display: flex; justify-content: space-between; font-size: .82rem; font-weight: 700; margin-bottom: 5px; }
.tl-levelbar-head .val { color: var(--brand-2); }
.tl-recap { text-align: left; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 13px 16px; }
.tl-recap-h { font-size: .7rem; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: var(--text-faint); margin-bottom: 8px; }
.tl-recap ul { margin: 0; padding-left: 2px; list-style: none; }
.tl-recap li { font-size: .88rem; line-height: 1.7; }
.tl-confetti { position: absolute; inset: 0; pointer-events: none; }
.tl-confetti i { position: absolute; top: -10px; left: calc(50% + (var(--n) - 7) * 7%); width: 8px; height: 8px;
    background: hsl(calc(var(--n) * 50), 80%, 60%); opacity: .9; border-radius: 2px;
    animation: tlFall 1.5s var(--ease) calc(var(--n) * .06s) forwards; }
@keyframes tlFall { to { transform: translateY(360px) rotate(540deg); opacity: 0; } }

/* warm-up choices */
.tl-opt { display: block; width: 100%; text-align: left; background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 12px; padding: 12px 14px; margin-bottom: 9px; font-size: .9rem; font-weight: 600; color: var(--text);
    cursor: pointer; font-family: inherit; transition: all .15s var(--ease); }
.tl-opt:hover { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, transparent); }
.tl-opt.sel { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, transparent); }

/* coach dialogue */
.tl-dialog { text-align: left; display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }

/* profession chip */
.tl-prof { display: inline-flex; align-items: center; gap: 5px; font-size: .7rem; font-weight: 700; color: var(--green-2);
    background: color-mix(in srgb, var(--green) 12%, transparent); border: 1px solid color-mix(in srgb, var(--green) 25%, transparent);
    padding: 3px 9px; border-radius: 999px; margin-bottom: 10px; }

/* evaluation dimensions */
.tl-dims { text-align: left; margin: 12px 0 4px; }
.tl-dimrow { margin-bottom: 8px; }
.tl-dimhead { display: flex; justify-content: space-between; font-size: .76rem; margin-bottom: 4px; }
.tl-dimhead .v { color: var(--brand-2); font-weight: 700; }

/* mastery meter */
.tl-mastery { text-align: left; margin: 10px 0 12px; }
.tl-mastery-head { display: flex; justify-content: space-between; font-size: .78rem; font-weight: 700; margin-bottom: 5px; }
.tl-mastery-head .need { color: var(--danger-2); }
.tl-mbar { position: relative; height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.tl-mbar > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--amber), var(--danger)); transition: width .6s var(--ease); }
.tl-gate { position: absolute; top: -3px; height: 14px; width: 2px; background: var(--green-2); }

/* escalating scaffold */
.tl-scaf { text-align: left; background: color-mix(in srgb, var(--amber) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--amber) 28%, transparent); border-radius: 10px;
    padding: 11px 13px; margin: 4px 0 12px; font-size: .85rem; line-height: 1.5; color: var(--text); }
.tl-scaf code { font-family: inherit; font-weight: 700; color: var(--brand-2); }
.tl-atag { font-size: .72rem; color: var(--text-faint); font-weight: 700; margin-bottom: 10px; text-align: left; }

/* soft escape + nudge */
.tl-escape { display: block; width: 100%; text-align: center; background: none; border: none; color: var(--text-faint);
    font-size: .78rem; font-weight: 600; margin-top: 12px; cursor: pointer; font-family: inherit; text-decoration: underline; }
.tl-escape:hover { color: var(--text-dim); }
.tl-nudge { text-align: left; font-size: .82rem; line-height: 1.5; color: var(--text-dim); background: var(--surface-2);
    border: 1px solid var(--border); border-left: 3px solid var(--amber); border-radius: 10px; padding: 10px 13px; margin-top: 10px; }

/* next-step cards */
.tl-next { display: block; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; padding: 11px 14px; margin-bottom: 8px; cursor: pointer; font-family: inherit; transition: all .15s var(--ease); }
.tl-next:hover { border-color: var(--brand); }
.tl-next b { font-size: .85rem; color: var(--text); }
.tl-next small { display: block; color: var(--text-faint); font-size: .74rem; margin-top: 1px; }
.tl-next.prim { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, transparent); }
.tl-next-h { font-size: .7rem; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; color: var(--text-faint); text-align: left; margin: 4px 0 8px; }

/* in-lesson coach orb */
.tl-orb { position: fixed; right: 16px; bottom: calc(var(--nav-h) + 14px); width: 50px; height: 50px; border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--brand-deep)); color: #fff; font-size: 1.3rem;
    display: flex; align-items: center; justify-content: center; cursor: pointer; border: none;
    box-shadow: 0 10px 24px -8px var(--brand); z-index: 40; animation: tlPulse 2.4s infinite; }
@keyframes tlPulse { 0%,100% { box-shadow: 0 10px 24px -8px var(--brand); } 50% { box-shadow: 0 10px 30px -6px var(--brand), 0 0 0 8px color-mix(in srgb, var(--brand) 12%, transparent); } }
.tl-cpop { position: fixed; right: 16px; bottom: calc(var(--nav-h) + 74px); width: 244px; background: var(--surface-solid);
    border: 1px solid var(--border); border-radius: 16px; padding: 13px; box-shadow: var(--shadow-lift); z-index: 41;
    animation: tlIn .25s var(--ease) both; }
.tl-cpop-h { font-size: .82rem; font-weight: 700; color: var(--text); margin-bottom: 4px; display: flex; align-items: center; gap: 7px; }
.tl-cpop-sub { font-size: .72rem; color: var(--text-faint); margin-bottom: 9px; }
.tl-cact { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.tl-cact button { font-size: .74rem; font-weight: 600; padding: 9px 6px; border-radius: 10px; border: 1px solid var(--border);
    background: var(--surface-2); color: var(--text); cursor: pointer; font-family: inherit; transition: all .15s var(--ease); }
.tl-cact button:hover { border-color: var(--brand); color: var(--brand-2); }

@media (min-width: 768px) {
    .tl-orb { bottom: 22px; }
    .tl-cpop { bottom: 82px; }
}

/* ============ AI Draft Desk ============ */
.dd-shell { max-width: 620px; margin: 0 auto; }
.dd-safe { font-size: .78rem; color: var(--text-dim); background: color-mix(in srgb, var(--green) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--green) 22%, transparent); border-radius: 10px; padding: 9px 12px; margin-bottom: 14px; }
.dd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.dd-task { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 13px 12px; cursor: pointer;
    text-align: left; font-family: inherit; transition: all .15s var(--ease); }
.dd-task:hover { border-color: var(--brand); transform: translateY(-1px); box-shadow: var(--shadow-soft); }
.dd-task .ic { font-size: 1.3rem; line-height: 1; }
.dd-task b { display: block; font-size: .85rem; margin-top: 7px; color: var(--text); }
.dd-task small { color: var(--text-faint); font-size: .72rem; }
.dd-pill { display: inline-flex; align-items: center; gap: 5px; font-size: .68rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.dd-pill .d { width: 7px; height: 7px; border-radius: 50%; }
.dd-pill.review { background: color-mix(in srgb, #378ADD 14%, transparent); color: #2C6FB0; } .dd-pill.review .d { background: #378ADD; }
.dd-pill.approved { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--green-2); } .dd-pill.approved .d { background: var(--green-2); }
.dd-canvas { width: 100%; background: var(--surface-solid); border: 1px solid var(--border); border-radius: 12px; padding: 13px 14px;
    font-family: inherit; font-size: .9rem; line-height: 1.6; color: var(--text); resize: vertical; box-shadow: var(--shadow-soft); }
.dd-canvas:focus { outline: none; border-color: var(--brand); }
.dd-coach { margin-top: 11px; background: color-mix(in srgb, var(--brand) 5%, transparent); border: 1px solid color-mix(in srgb, var(--brand) 18%, transparent);
    border-radius: 12px; padding: 12px 13px; text-align: left; }
.dd-coach-h { font-size: .76rem; font-weight: 800; color: var(--brand-2); margin-bottom: 8px; }
.dd-coach-row { font-size: .8rem; line-height: 1.45; margin-bottom: 6px; }
.dd-coach-row:last-child { margin-bottom: 0; }
.dd-coach-row b { color: var(--brand-2); }
.dd-wkhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.dd-gate-opt { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; background: var(--surface);
    border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 9px; cursor: pointer; font-family: inherit; transition: all .15s var(--ease); }
.dd-gate-opt .ic { font-size: 1.15rem; }
.dd-gate-opt b { font-size: .85rem; display: block; color: var(--text); } .dd-gate-opt small { font-size: .72rem; color: var(--text-faint); }
.dd-gate-opt:hover { border-color: var(--brand); }
.dd-gate-opt.approve:hover { border-color: var(--green-2); }
.dd-gate-opt.reject:hover { border-color: var(--danger-2); }
.dd-exp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.dd-exp { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 13px 8px; cursor: pointer;
    font-family: inherit; transition: all .15s var(--ease); text-align: center; }
.dd-exp:hover { border-color: var(--brand); }
.dd-exp .ic { font-size: 1.2rem; line-height: 1; } .dd-exp b { display: block; font-size: .76rem; margin-top: 5px; color: var(--text); }
.dd-exp.soon { opacity: .5; cursor: default; }
.dd-exp.soon:hover { border-color: var(--border); }
.dd-back { background: none; border: none; color: var(--brand-2); font-size: .8rem; font-weight: 700; cursor: pointer;
    font-family: inherit; padding: 0; margin-bottom: 10px; }
.dd-gen-note { text-align: center; font-size: .74rem; color: var(--text-faint); margin-top: 9px; }

.app-body { flex: 1; display: flex; }
.app-content {
    flex: 1; padding: 14px;
    padding-bottom: calc(var(--nav-h) + 14px);
    max-width: var(--maxw); margin: 0 auto; width: 100%;
}

/* ---------- Navigation (mobile = bottom bar) ---------- */
.app-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: var(--nav-h);
    display: flex; justify-content: space-around; align-items: stretch;
    background: var(--surface);
    -webkit-backdrop-filter: blur(var(--glass-blur)); backdrop-filter: blur(var(--glass-blur));
    border-top: 1px solid var(--border);
    z-index: 30;
}
.app-nav .nav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    background: none; border: none; cursor: pointer;
    color: var(--text-faint); font-size: .62rem; font-weight: 600; text-decoration: none;
    transition: color .2s var(--ease);
}
.app-nav .nav-item .ico { font-size: 1.05rem; line-height: 1; }
.app-nav .nav-item.active { color: var(--brand-2); }

/* ---------- Desktop (>= 768px): left sidebar ---------- */
@media (min-width: 768px) {
    .app-nav {
        position: sticky; top: 46px; left: 0; bottom: auto;
        height: calc(100vh - 46px); width: 188px;
        flex-direction: column; justify-content: flex-start; gap: 2px;
        border-top: none; border-right: 1px solid var(--border); padding: 12px 8px;
    }
    .app-nav .nav-item {
        flex: none; flex-direction: row; justify-content: flex-start; gap: 10px;
        padding: 8px 11px; border-radius: var(--radius-sm); font-size: .82rem;
    }
    .app-nav .nav-item .ico { font-size: 1rem; }
    .app-nav .nav-item.active { background: var(--surface-2); color: var(--brand-2); }
    .app-nav .signout { margin-top: auto; }
    .app-content { padding: 18px 22px; padding-bottom: 22px; }
}

/* ---------- Cards & UI primitives ---------- */
.card {
    background: var(--surface);
    -webkit-backdrop-filter: blur(var(--glass-blur)); backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border);
    border-radius: var(--radius); padding: 13px 14px; margin-bottom: 10px;
    box-shadow: var(--shadow-soft);
}
.card h2 { font-size: .9rem; margin-bottom: 8px; }
.muted { color: var(--text-dim); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    background: linear-gradient(135deg, var(--brand-2), var(--brand-deep));
    color: #fff; font-weight: 700;
    border: none; border-radius: var(--radius-sm); padding: 7px 13px; cursor: pointer; font-size: .82rem;
    font-family: inherit;
    box-shadow: 0 8px 18px -10px color-mix(in srgb, var(--brand) 70%, transparent);
    transition: transform .15s var(--ease), filter .15s;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 10px; font-size: .76rem; }
.btn-green { background: linear-gradient(135deg, var(--green-2), var(--green)); color: #06281A; box-shadow: 0 8px 18px -10px color-mix(in srgb, var(--green) 60%, transparent); }
.btn-ghost { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); box-shadow: none; }

.field { margin-bottom: 10px; }
.field label { display: block; font-size: .76rem; color: var(--text-dim); margin-bottom: 4px; font-weight: 600; }
.input, textarea.input {
    width: 100%; background: var(--surface-2); border: 1px solid var(--border);
    color: var(--text); border-radius: var(--radius-sm); padding: 8px 11px; font-size: .85rem; font-family: inherit;
}
.input:focus, textarea.input:focus { outline: none; border-color: var(--brand); }
.input::placeholder { color: var(--text-faint); }

.error-text { color: var(--danger-2); font-size: .8rem; margin-top: 6px; }

/* ---------- Auth pages ---------- */
.auth-card {
    width: 100%; max-width: 340px; margin: 16px;
    background: var(--surface);
    -webkit-backdrop-filter: blur(var(--glass-blur)); backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border);
    border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-lift);
}
.auth-card .brand-lg { font-size: 1.4rem; font-weight: 800; text-align: center; margin-bottom: 2px; }
.auth-card .brand-lg span { color: var(--brand-2); }
.auth-card .tagline { text-align: center; color: var(--text-dim); margin-bottom: 16px; font-size: .8rem; }
.auth-switch { text-align: center; margin-top: 12px; font-size: .8rem; color: var(--text-dim); }

/* ---------- Competency bars ---------- */
.skill-row { margin-bottom: 9px; }
.skill-row .skill-head { display: flex; justify-content: space-between; font-size: .78rem; margin-bottom: 4px; }
.skill-row .skill-head .val { color: var(--brand-2); font-weight: 700; }
.bar { height: 6px; background: var(--surface-2); border-radius: var(--radius-pill); overflow: hidden; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-deep), var(--brand-2)); border-radius: var(--radius-pill); transition: width .4s var(--ease); }

.level-badge {
    display: inline-block; padding: 3px 11px; border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--green) 18%, transparent); color: var(--green-2); font-weight: 700; font-size: .72rem;
}

/* ---------- Chat / coach ---------- */
.chat-log { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.bubble { padding: 8px 11px; border-radius: 10px; max-width: 88%; line-height: 1.4; white-space: pre-wrap; font-size: .85rem; }
.bubble.user { align-self: flex-end; background: linear-gradient(135deg, var(--brand-2), var(--brand-deep)); color: #fff; border-bottom-right-radius: 4px; }
.bubble.ai { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-input { display: flex; gap: 8px; }
.chat-input .input { flex: 1; }

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
    background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
    border-radius: var(--radius-pill); padding: 5px 11px; font-size: .78rem; font-family: inherit;
    cursor: pointer; transition: all .15s var(--ease);
}
.chip:hover { border-color: var(--border-strong); }
.chip.sel { background: var(--brand); border-color: var(--brand); color: var(--brand-on); font-weight: 700; }

.bundle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.bundle { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 10px; text-align: center; position: relative; }
.bundle-featured { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, var(--surface-2)); }
.bundle-tag { position: absolute; top: -1px; right: -1px; background: var(--brand); color: var(--brand-on); font-size: .64rem; font-weight: 700; padding: 2px 7px; border-radius: 0 var(--radius-sm) 0 var(--radius-sm); letter-spacing: .03em; text-transform: uppercase; }
.bundle-price { font-size: .72rem; color: var(--text-dim); margin-bottom: 2px; font-weight: 600; }
.bundle-credits { font-size: 1.25rem; font-weight: 800; color: var(--brand-2); line-height: 1.1; }
.bundle-credits span { font-size: .65rem; font-weight: 500; color: var(--text-dim); }
.bundle-name { font-size: .72rem; font-weight: 600; color: var(--text-2); margin: 2px 0 3px; }
.bundle-hint { font-size: .67rem; color: var(--text-dim); min-height: 2.2em; line-height: 1.3; }
.credit-table { display: flex; flex-direction: column; gap: 4px; }
.ct-row { display: flex; justify-content: space-between; align-items: center; font-size: .76rem; padding: 4px 6px; border-radius: 4px; background: var(--surface-2); }
.ct-cost { font-weight: 700; color: var(--amber); font-size: .72rem; }

/* ===================== Blazor defaults ===================== */
.loading-progress { position: fixed; display: block; width: 8rem; height: 8rem; top: calc(50% - 4rem); left: calc(50% - 4rem); }
.loading-progress circle { fill: none; stroke: var(--surface-2); stroke-width: 0.6rem; transform-origin: 50% 50%; transform: rotate(-90deg); }
.loading-progress circle:last-child { stroke: var(--brand); stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%; transition: stroke-dasharray 0.05s ease-in-out; }
.loading-progress-text { position: absolute; text-align: center; font-weight: bold; inset: calc(50% - 0.8rem) 0 auto 0.2rem; color: var(--text-dim); }
.loading-progress-text:after { content: var(--blazor-load-percentage-text, "Loading"); }

#blazor-error-ui { color: #1a1a1a; background: lightyellow; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,0.2); display: none; left: 0; padding: 0.6rem 1.25rem 0.7rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }
