/* =====================================================================
   TRAINGH - University-style learning portal
   ===================================================================== */
:root {
  --navy: #0b2a6f;
  --navy-2: #0a2360;
  --navy-3: #071a49;
  --ink: #14213d;
  --orange: #ee7b1c;
  --orange-2: #d9680d;
  --gold: #c9a227;
  --bg: #f4f6fa;
  --card: #ffffff;
  --line: #e2e7f0;
  --muted: #5b6780;
  --soft: #eef2f9;
  --green: #15803d;
  --green-bg: #e8f6ee;
  --red: #b91c1c;
  --red-bg: #fdecec;
  --amber: #b45309;
  --amber-bg: #fff4e0;
  --blue-bg: #e9effc;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 33, 77, .06), 0 4px 16px rgba(16, 33, 77, .06);
  --shadow-lg: 0 10px 40px rgba(10, 30, 80, .16);
  --serif: Georgia, Cambria, "Times New Roman", serif;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--sans); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--serif); color: var(--navy-3); margin: 0 0 .5em; line-height: 1.2; font-weight: 700; }
h1 { font-size: 2.1rem; } h2 { font-size: 1.55rem; } h3 { font-size: 1.18rem; } h4 { font-size: 1rem; }
p { margin: 0 0 1em; }
img { max-width: 100%; }
small, .small { font-size: .85rem; }
.muted { color: var(--muted); }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } h1 { font-size: 1.7rem; } }

/* ---------- animations ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
.page-enter { animation: fadeUp .38s var(--ease) both; }
.stagger > * { animation: fadeUp .45s var(--ease) both; }
.stagger > *:nth-child(2) { animation-delay: .04s; } .stagger > *:nth-child(3) { animation-delay: .08s; }
.stagger > *:nth-child(4) { animation-delay: .12s; } .stagger > *:nth-child(5) { animation-delay: .16s; }
.stagger > *:nth-child(6) { animation-delay: .2s; } .stagger > *:nth-child(7) { animation-delay: .24s; }
.stagger > *:nth-child(8) { animation-delay: .28s; } .stagger > *:nth-child(n+9) { animation-delay: .3s; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 8px;
  padding: 10px 18px; font: 600 .95rem var(--sans); cursor: pointer; transition: background .18s, box-shadow .18s, transform .08s, color .18s;
  background: var(--navy); color: #fff; text-decoration: none !important; white-space: nowrap; }
.btn:hover { background: var(--navy-2); box-shadow: 0 4px 14px rgba(11, 42, 111, .25); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn.orange { background: var(--orange); } .btn.orange:hover { background: var(--orange-2); box-shadow: 0 4px 14px rgba(238, 123, 28, .3); }
.btn.green { background: var(--green); } .btn.green:hover { background: #116632; }
.btn.red { background: var(--red); } .btn.red:hover { background: #961616; }
.btn.ghost { background: #fff; color: var(--navy); border-color: var(--line); }
.btn.ghost:hover { background: var(--soft); box-shadow: none; }
.btn.light { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .35); }
.btn.light:hover { background: rgba(255, 255, 255, .22); }
.btn.sm { padding: 6px 12px; font-size: .85rem; }
.btn.lg { padding: 13px 26px; font-size: 1.02rem; }
.btn.block { width: 100%; }
.btn .spin { width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.btn.ghost .spin { border-color: rgba(11, 42, 111, .25); border-top-color: var(--navy); }
.linkbtn { background: none; border: 0; color: var(--navy); cursor: pointer; padding: 0; font: inherit; font-weight: 600; }
.linkbtn:hover { text-decoration: underline; }

label.f { display: block; margin-bottom: 14px; }
label.f > span { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 5px; color: #24324f; }
label.f > span em { color: var(--red); font-style: normal; }
label.f .hint { font-weight: 400; color: var(--muted); font-size: .8rem; margin-top: 4px; display: block; }
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid #cdd5e3; border-radius: 8px; font: inherit; color: var(--ink);
  background: #fff; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(11, 42, 111, .12); }
input[type=checkbox], input[type=radio] { width: auto; }
textarea { min-height: 90px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; }
.check input { margin-top: 4px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 8px 14px; cursor: pointer; font: 600 .87rem var(--sans); color: var(--muted); transition: background .15s, color .15s; }
.seg button.on { background: var(--navy); color: #fff; }
.seg button:not(.on):hover { background: var(--soft); }

/* ---------- cards, badges, tables ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.card.flat { box-shadow: none; }
.card h3 { margin-bottom: .35em; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h3 { margin: 0; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; letter-spacing: .02em; background: var(--soft); color: var(--navy); white-space: nowrap; }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.orange { background: #fff0e3; color: var(--orange-2); }
.badge.gray { background: #eef0f4; color: #556; }
.notice { border-radius: 10px; padding: 14px 16px; border: 1px solid; display: flex; gap: 12px; align-items: flex-start; }
.notice.info { background: var(--blue-bg); border-color: #c9d6f5; }
.notice.warn { background: var(--amber-bg); border-color: #f5d9a8; }
.notice.ok { background: var(--green-bg); border-color: #bfe4cd; }
.notice.err { background: var(--red-bg); border-color: #f5c2c2; }
.notice .ico { flex: none; margin-top: 2px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table.t { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.t th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: #f8f9fc; padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 11px 12px; border-bottom: 1px solid #eef1f6; vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr { transition: background .12s; }
table.t tbody tr:hover { background: #fafbfe; }
table.t tr.click { cursor: pointer; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty .ico { width: 44px; height: 44px; color: #b7c1d6; margin-bottom: 8px; }
.skeleton { background: linear-gradient(90deg, #edf0f6 0, #f6f8fb 40%, #edf0f6 80%); background-size: 800px 100%; animation: shimmer 1.2s infinite linear; border-radius: 8px; }
.sk-line { height: 14px; margin: 10px 0; }
.sk-card { height: 110px; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 14px; font-size: .92rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 600; word-break: break-word; }
.copy-box { display: flex; border: 1px dashed #b9c5dd; border-radius: 8px; overflow: hidden; background: #f8faff; }
.copy-box input { border: 0; background: none; font-weight: 600; color: var(--navy); }
.copy-box button { border: 0; border-left: 1px dashed #b9c5dd; background: #fff; padding: 0 16px; font-weight: 700; color: var(--navy); cursor: pointer; }

/* progress */
.bar { height: 8px; background: #e7ebf3; border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--navy), #2a56c6); border-radius: 99px; width: 0; transition: width .9s var(--ease); }
.bar.orange > i { background: linear-gradient(90deg, var(--orange-2), #f59e0b); }
.bar.green > i { background: linear-gradient(90deg, #15803d, #22c55e); }
.ring { --p: 0; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--orange) calc(var(--p) * 1%), #e7ebf3 0); transition: --p 1s; }
.ring > span { width: 50px; height: 50px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-weight: 800; font-size: .85rem; color: var(--navy); }

/* ---------- icons ---------- */
.ico { width: 18px; height: 18px; display: inline-block; vertical-align: middle; flex: none; }
.ico.lg { width: 24px; height: 24px; }

/* ---------- PUBLIC SITE ---------- */
.topbar { background: var(--navy-3); color: #c9d4ee; font-size: .82rem; }
.topbar .wrap { display: flex; justify-content: space-between; gap: 10px; padding: 7px 20px; flex-wrap: wrap; }
.topbar a { color: #fff; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.site-nav { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; transition: box-shadow .2s; }
.site-nav.scrolled { box-shadow: 0 2px 16px rgba(10, 30, 80, .08); }
.site-nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 72px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none !important; }
.brand img { height: 46px; width: auto; }
.brand .bt { display: flex; flex-direction: column; line-height: 1.1; }
.brand .bt b { font-family: var(--serif); font-size: 1.25rem; color: var(--navy); letter-spacing: .02em; }
.brand .bt small { color: var(--muted); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.nav-links { display: flex; gap: 6px; align-items: center; }
.nav-links a.nl { padding: 8px 12px; border-radius: 7px; color: #2a3757; font-weight: 600; font-size: .93rem; }
.nav-links a.nl:hover { background: var(--soft); text-decoration: none; }
.menu-btn { display: none; background: none; border: 0; cursor: pointer; padding: 6px; }
@media (max-width: 860px) {
  .nav-links { display: none; position: absolute; top: 72px; left: 0; right: 0; background: #fff; flex-direction: column; align-items: stretch; padding: 12px 20px 18px; border-bottom: 1px solid var(--line); box-shadow: var(--shadow-lg); }
  .nav-links.open { display: flex; animation: fadeIn .2s; }
  .menu-btn { display: block; }
}
.hero { position: relative; color: #fff; overflow: hidden;
  background: radial-gradient(1200px 500px at 85% -10%, rgba(238, 123, 28, .28), transparent 60%), linear-gradient(135deg, #071a49 0%, #0b2a6f 55%, #12358a 100%); }
.hero::after { content: ""; position: absolute; inset: 0; opacity: .07;
  background-image: linear-gradient(rgba(255,255,255,.6) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.6) 1px, transparent 1px); background-size: 46px 46px; pointer-events: none; }
.hero .wrap { position: relative; z-index: 1; display: grid; grid-template-columns: 1.15fr .85fr; gap: 40px; padding-top: 72px; padding-bottom: 84px; align-items: center; }
.hero h1 { color: #fff; font-size: 2.75rem; margin-bottom: 16px; }
.hero h1 span { color: #ffb36b; }
.hero p.lead { font-size: 1.13rem; color: #d6def3; max-width: 560px; }
.hero .kicker { display: inline-flex; gap: 8px; align-items: center; padding: 6px 14px; border: 1px solid rgba(255,255,255,.25); border-radius: 99px; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 18px; color: #ffd7b0; }
.hero-card { background: rgba(255,255,255,.98); color: var(--ink); border-radius: 14px; padding: 26px; box-shadow: var(--shadow-lg); animation: pop .6s var(--ease) .15s both; }
.hero-card .price { font-family: var(--serif); font-size: 2.6rem; color: var(--navy); font-weight: 700; }
.hero-card ul { padding: 0; margin: 14px 0 20px; list-style: none; }
.hero-card li { display: flex; gap: 10px; padding: 6px 0; font-size: .95rem; }
.hero-card li .ico { color: var(--green); margin-top: 3px; }
.hero-stats { display: flex; gap: 30px; margin-top: 30px; flex-wrap: wrap; }
.hero-stats div b { display: block; font-family: var(--serif); font-size: 1.7rem; color: #fff; }
.hero-stats div span { font-size: .82rem; color: #b8c4e2; text-transform: uppercase; letter-spacing: .06em; }
@media (max-width: 900px) { .hero .wrap { grid-template-columns: 1fr; padding-top: 44px; padding-bottom: 54px; } .hero h1 { font-size: 2rem; } }
.section { padding: 70px 0; }
.section.alt { background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-title { text-align: center; max-width: 720px; margin: 0 auto 40px; }
.section-title .eyebrow { color: var(--orange-2); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; font-size: .78rem; display: block; margin-bottom: 8px; }
.section-title p { color: var(--muted); font-size: 1.04rem; }
.course-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; transition: transform .25s var(--ease), box-shadow .25s var(--ease); box-shadow: var(--shadow); }
.course-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.course-card .cover { height: 112px; position: relative; display: flex; align-items: flex-end; padding: 14px 16px; color: #fff; overflow: hidden; }
.course-card .cover::before { content: ""; position: absolute; inset: 0; background: radial-gradient(260px 120px at 100% 0, rgba(255,255,255,.22), transparent 60%); }
.course-card .cover .big-ico { position: absolute; right: 14px; top: 14px; width: 54px; height: 54px; opacity: .9; }
.course-card .cover .cat { position: relative; font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; background: rgba(0,0,0,.22); padding: 4px 10px; border-radius: 99px; }
.course-card .body { padding: 16px 18px 18px; flex: 1; display: flex; flex-direction: column; }
.course-card h3 { font-size: 1.08rem; margin-bottom: 6px; }
.course-card p { color: var(--muted); font-size: .9rem; flex: 1; }
.course-card .meta { display: flex; gap: 14px; font-size: .8rem; color: var(--muted); margin-top: 6px; }
.feature { display: flex; gap: 16px; align-items: flex-start; }
.feature .fi { flex: none; width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--blue-bg); color: var(--navy); }
.feature .fi.o { background: #fff0e3; color: var(--orange-2); }
.feature h4 { margin-bottom: 4px; }
.feature p { color: var(--muted); font-size: .92rem; margin: 0; }
.steps { counter-reset: s; }
.step { position: relative; padding-left: 58px; }
.step::before { counter-increment: s; content: counter(s); position: absolute; left: 0; top: 0; width: 40px; height: 40px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-family: var(--serif); font-weight: 700; font-size: 1.1rem; }
.faq details { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 0 18px; margin-bottom: 10px; transition: box-shadow .2s; }
.faq details[open] { box-shadow: var(--shadow); }
.faq summary { cursor: pointer; padding: 15px 0; font-weight: 700; color: var(--navy-3); list-style: none; display: flex; justify-content: space-between; }
.faq summary::after { content: "+"; font-size: 1.3rem; color: var(--orange); transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { color: var(--muted); }
.cta-band { background: linear-gradient(120deg, var(--orange-2), var(--orange)); color: #fff; border-radius: 16px; padding: 36px; display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.cta-band h2 { color: #fff; margin: 0 0 4px; }
.footer { background: var(--navy-3); color: #b8c4e2; padding: 50px 0 24px; font-size: .9rem; margin-top: 0; }
.footer h4 { color: #fff; font-family: var(--sans); font-size: .85rem; letter-spacing: .1em; text-transform: uppercase; }
.footer a { color: #dfe6f7; }
.footer .credit { border-top: 1px solid rgba(255,255,255,.12); margin-top: 30px; padding-top: 18px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: .82rem; }

/* auth pages */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { background: linear-gradient(160deg, #071a49, #0b2a6f 60%, #163c96); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side::after { content: ""; position: absolute; width: 520px; height: 520px; right: -200px; bottom: -200px; border-radius: 50%; border: 60px solid rgba(238,123,28,.18); }
.auth-side h2 { color: #fff; font-size: 2rem; }
.auth-side p { color: #c9d4ee; }
.auth-side .brand-w { background: #fff; display: inline-flex; padding: 10px 14px; border-radius: 10px; }
.auth-side .brand-w img { height: 44px; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--bg); }
.auth-box { width: 100%; max-width: 520px; animation: fadeUp .45s var(--ease) both; }
.auth-box.wide { max-width: 720px; }
.auth-box .card { padding: 28px; }
.form-section { font-family: var(--serif); color: var(--navy); font-size: 1.02rem; border-bottom: 2px solid var(--soft); padding-bottom: 6px; margin: 18px 0 14px; display: flex; gap: 8px; align-items: center; }
.form-section b { background: var(--navy); color: #fff; width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; font-family: var(--sans); font-size: .78rem; }
@media (max-width: 900px) { .auth-shell { grid-template-columns: 1fr; } .auth-side { display: none; } }

/* ---------- PORTAL (student + admin) ---------- */
.portal { display: grid; grid-template-columns: 258px 1fr; min-height: 100vh; }
.side { background: var(--navy-3); color: #c4cfea; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; z-index: 50; }
.side .side-brand { padding: 18px 18px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.side .side-brand .logo-chip { background: #fff; border-radius: 9px; padding: 6px 10px; display: inline-flex; }
.side .side-brand .logo-chip img { height: 42px; }
.side .side-brand .who { margin-top: 12px; font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: #8ea0cc; }
.side nav { padding: 12px 10px; flex: 1; }
.side .grp { font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: #7385b3; padding: 14px 12px 6px; }
.side a.si { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 8px; color: #cfd8ef; font-size: .92rem; font-weight: 500; transition: background .15s, color .15s; position: relative; text-decoration: none; }
.side a.si:hover { background: rgba(255,255,255,.06); color: #fff; }
.side a.si.on { background: rgba(255,255,255,.1); color: #fff; font-weight: 700; }
.side a.si.on::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--orange); }
.side a.si .count { margin-left: auto; background: var(--orange); color: #fff; font-size: .7rem; font-weight: 800; padding: 1px 7px; border-radius: 99px; }
.side .side-foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: .75rem; color: #7d8db6; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { height: 64px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 26px; position: sticky; top: 0; z-index: 30; gap: 12px; }
.top .crumb { font-family: var(--serif); font-size: 1.15rem; color: var(--navy-3); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .me { display: flex; align-items: center; gap: 12px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--navy), #2a56c6); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .85rem; flex: none; }
.avatar.o { background: linear-gradient(135deg, var(--orange-2), #f59e0b); }
.content { padding: 26px; max-width: 1280px; width: 100%; }
.page-title { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title h1 { font-size: 1.65rem; margin: 0; }
.page-title p { margin: 4px 0 0; color: var(--muted); }
.side-toggle { display: none; background: none; border: 0; cursor: pointer; padding: 6px; }
.scrim { display: none; }
@media (max-width: 960px) {
  .portal { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; transform: translateX(-100%); transition: transform .28s var(--ease); }
  .side.open { transform: none; box-shadow: var(--shadow-lg); }
  .scrim.open { display: block; position: fixed; inset: 0; background: rgba(6, 18, 50, .45); z-index: 45; animation: fadeIn .2s; }
  .side-toggle { display: block; }
  .content { padding: 18px 14px; }
  .top { padding: 0 14px; }
}
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat .lbl { font-size: .76rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.stat .val { font-family: var(--serif); font-size: 1.75rem; font-weight: 700; color: var(--navy-3); margin-top: 4px; }
.stat .sub { font-size: .8rem; color: var(--muted); }
.stat .si-ico { position: absolute; right: 14px; top: 14px; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--blue-bg); color: var(--navy); }
.stat.o .si-ico { background: #fff0e3; color: var(--orange-2); }
.stat.g .si-ico { background: var(--green-bg); color: var(--green); }
.stat.r .si-ico { background: var(--red-bg); color: var(--red); }
.stat.click { cursor: pointer; transition: transform .2s var(--ease), box-shadow .2s; }
.stat.click:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.welcome { background: linear-gradient(120deg, #071a49, #0b2a6f 60%, #1d47a8); color: #fff; border-radius: 14px; padding: 26px 28px; position: relative; overflow: hidden; }
.welcome::after { content: ""; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%; border: 40px solid rgba(238,123,28,.25); }
.welcome h2 { color: #fff; margin-bottom: 6px; position: relative; z-index: 1; }
.welcome p { color: #cfd9f2; margin: 0; position: relative; z-index: 1; }
.welcome .row { position: relative; z-index: 1; }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 10px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.chart .col i { width: 100%; max-width: 28px; background: linear-gradient(180deg, #2a56c6, var(--navy)); border-radius: 5px 5px 2px 2px; min-height: 2px; transform-origin: bottom; animation: grow .8s var(--ease) both; }
.chart.o .col i { background: linear-gradient(180deg, #f59e0b, var(--orange-2)); }
.chart .col span { font-size: .65rem; color: var(--muted); white-space: nowrap; }
.chart .col b { font-size: .65rem; color: var(--navy); }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* lessons / player */
.learn { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .learn { grid-template-columns: 1fr; } }
.player { position: relative; background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 16 / 9; box-shadow: var(--shadow-lg); user-select: none; }
.player video { width: 100%; height: 100%; display: block; background: #000; }
.player .wm { position: absolute; color: rgba(255,255,255,.38); font-size: 13px; font-weight: 700; pointer-events: none; text-shadow: 0 1px 2px rgba(0,0,0,.6); transition: top 1.5s ease, left 1.5s ease; white-space: nowrap; z-index: 3; }
.player .ovl { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; text-align: center; padding: 20px; background: rgba(4,12,35,.75); z-index: 4; }
.lesson-list { max-height: calc(100vh - 140px); overflow-y: auto; padding: 0; }
.lesson-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-bottom: 1px solid #eef1f6; cursor: pointer; transition: background .15s; }
.lesson-item:hover { background: #f7f9fd; }
.lesson-item.on { background: var(--blue-bg); }
.lesson-item .num { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #c9d3e6; display: grid; place-items: center; font-size: .78rem; font-weight: 700; color: var(--muted); flex: none; }
.lesson-item.done .num { background: var(--green); border-color: var(--green); color: #fff; }
.lesson-item .lt { font-weight: 600; font-size: .9rem; line-height: 1.3; }
.lesson-item .ld { font-size: .78rem; color: var(--muted); }

/* modal & toast */
.modal-back { position: fixed; inset: 0; background: rgba(6, 18, 50, .5); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; overflow-y: auto; animation: fadeIn .18s; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 560px; box-shadow: var(--shadow-lg); animation: pop .25s var(--ease); }
.modal.wide { max-width: 820px; } .modal.xwide { max-width: 1100px; }
.modal-h { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.modal-h h3 { margin: 0; }
.modal-b { padding: 22px; }
.modal-f { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; background: #fafbfd; border-radius: 0 0 14px 14px; flex-wrap: wrap; }
.x { background: none; border: 0; cursor: pointer; color: var(--muted); padding: 4px; border-radius: 6px; }
.x:hover { background: var(--soft); }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
.toast { background: #fff; border-left: 4px solid var(--navy); box-shadow: var(--shadow-lg); padding: 12px 16px; border-radius: 8px; font-size: .92rem; animation: fadeUp .3s var(--ease); display: flex; gap: 10px; align-items: flex-start; }
.toast.ok { border-color: var(--green); } .toast.err { border-color: var(--red); } .toast.warn { border-color: var(--orange); }
.loader { display: grid; place-items: center; padding: 60px; }
.loader i { width: 34px; height: 34px; border: 3px solid #dbe2ef; border-top-color: var(--navy); border-radius: 50%; animation: spin .8s linear infinite; }
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: #fff; z-index: 300; transition: opacity .3s; }
.boot img { width: 170px; animation: pulse 1.4s infinite; }

/* certificate preview frame */
.cert-frame { background: #e9edf5; border-radius: 12px; padding: 18px; overflow: auto; }
.cert-scale { transform-origin: top left; }

/* live classroom */
.live { position: fixed; inset: 0; background: #0b1020; color: #e6ebf7; display: grid; grid-template-rows: 56px 1fr 72px; z-index: 80; }
.live-top { display: flex; align-items: center; justify-content: space-between; padding: 0 16px; background: #0f1630; border-bottom: 1px solid #1d2647; gap: 10px; }
.live-top .title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #ef4444; display: inline-block; animation: pulse 1.2s infinite; margin-right: 6px; }
.live-body { display: grid; grid-template-columns: 1fr 340px; min-height: 0; }
.live-stage { position: relative; min-height: 0; display: flex; flex-direction: column; padding: 12px; gap: 10px; }
.live-main { flex: 1; min-height: 0; background: #060a17; border-radius: 12px; position: relative; overflow: hidden; display: grid; place-items: center; }
.live-main video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.live-main canvas { background: #fff; max-width: 100%; max-height: 100%; touch-action: none; border-radius: 6px; }
.live-main img.slide { max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; }
.live-pip { position: absolute; right: 12px; bottom: 12px; width: 220px; aspect-ratio: 16/9; border-radius: 10px; overflow: hidden; border: 2px solid #2a3560; background: #000; z-index: 2; }
.live-pip video { width: 100%; height: 100%; object-fit: cover; }
.live-strip { display: flex; gap: 8px; overflow-x: auto; min-height: 0; }
.tile { position: relative; width: 170px; aspect-ratio: 16/9; background: #151d3b; border-radius: 9px; overflow: hidden; flex: none; display: grid; place-items: center; }
.tile video { width: 100%; height: 100%; object-fit: cover; }
.tile .nm { position: absolute; left: 6px; bottom: 5px; font-size: .72rem; background: rgba(0,0,0,.55); padding: 2px 7px; border-radius: 5px; }
.tile .av { width: 46px; height: 46px; border-radius: 50%; background: #2a3a78; display: grid; place-items: center; font-weight: 800; }
.live-side { background: #0f1630; border-left: 1px solid #1d2647; display: flex; flex-direction: column; min-height: 0; }
.live-tabs { display: flex; border-bottom: 1px solid #1d2647; }
.live-tabs button { flex: 1; background: none; border: 0; color: #9aa7cc; padding: 12px 6px; font: 600 .82rem var(--sans); cursor: pointer; border-bottom: 2px solid transparent; }
.live-tabs button.on { color: #fff; border-color: var(--orange); }
.live-panel { flex: 1; overflow-y: auto; padding: 12px; min-height: 0; }
.msg { margin-bottom: 10px; animation: fadeUp .2s; }
.msg .who { font-size: .75rem; color: #8fa0cf; } .msg .who b { color: #e6ebf7; }
.msg .who .h { background: var(--orange); color: #fff; padding: 0 6px; border-radius: 4px; font-size: .65rem; margin-left: 4px; }
.msg .tx { background: #18214a; padding: 7px 10px; border-radius: 8px; font-size: .9rem; margin-top: 2px; word-wrap: break-word; }
.msg.q .tx { border-left: 3px solid var(--orange); }
.live-input { padding: 10px; border-top: 1px solid #1d2647; display: flex; gap: 6px; }
.live-input input { background: #151d3b; border-color: #26305a; color: #fff; }
.live-bar { background: #0f1630; border-top: 1px solid #1d2647; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 0 12px; flex-wrap: nowrap; overflow-x: auto; }
.lb { background: #1b2550; border: 0; color: #fff; border-radius: 12px; min-width: 60px; height: 52px; padding: 0 12px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font: 600 .68rem var(--sans); transition: background .15s; }
.lb:hover { background: #26336c; }
.lb.on { background: var(--orange); }
.lb.off { background: #3a1d28; color: #ffb4b4; }
.lb.end { background: #b91c1c; }
.person { display: flex; align-items: center; gap: 8px; padding: 7px 4px; border-bottom: 1px solid #1a2246; font-size: .88rem; }
.person .pn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person button { background: #1f2a5a; color: #fff; border: 0; border-radius: 6px; padding: 3px 8px; font-size: .72rem; cursor: pointer; }
.wb-tools { position: absolute; left: 12px; top: 12px; display: flex; gap: 6px; z-index: 3; background: rgba(15,22,48,.9); padding: 6px; border-radius: 10px; flex-wrap: wrap; }
.wb-tools button { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.wb-tools button.on { border-color: #fff; }
.wb-tools .tbtn { width: auto; border-radius: 6px; padding: 0 10px; background: #1f2a5a; color: #fff; font-size: .75rem; }
@media (max-width: 900px) { .live-body { grid-template-columns: 1fr; grid-template-rows: 1fr 260px; } .live-side { border-left: 0; border-top: 1px solid #1d2647; } .live-pip { width: 130px; } }

#print-area { display: none; }
@media print {
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; }
  #print-area .cert { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { size: A4 landscape; margin: 0; }
}
