:root {
  --bg: #08090d;
  --bg2: #0c1220;
  --bg3: #141b2e;
  --border: rgba(255,255,255,.08);
  --border2: rgba(255,255,255,.12);
  --text: #e6e8ef;
  --text2: #c8ccd8;
  --muted: #8891a4;
  --accent: #f87820;
  --orange: #f87820;
  --green: #76b900;
  --red: #e6462c;
  --violet: #7c3aed;
  --radius: 14px;
  --shadow: 0 8px 28px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
html, body { margin:0; padding:0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; line-height: 1.55; }
a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 22px; }

.header { border-bottom: 1px solid var(--border); background: rgba(8,9,13,.85); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; font-size: 1.05em; }
.brand img { height: 26px; }
.brand small { color: var(--muted); font-weight: 500; margin-left: 4px; font-size: .75em; }
.header nav { display: flex; gap: 14px; align-items: center; font-size: .9em; }
.header nav a { color: var(--text2); }
.header nav a:hover { color: var(--orange); text-decoration: none; }
.header .user { display: flex; align-items: center; gap: 10px; }
.header .user-avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, var(--orange), var(--violet)); display: inline-flex; align-items: center; justify-content: center; color: white; font-weight: 700; font-size: .8em; }

.btn { display: inline-block; padding: 10px 22px; border-radius: 999px; font-weight: 600; font-size: .95em; border: 1px solid transparent; cursor: pointer; text-decoration: none; transition: all .15s; }
.btn.primary { background: var(--orange); color: #000; }
.btn.primary:hover { background: #ffa14d; text-decoration: none; }
.btn.secondary { background: transparent; color: var(--text); border-color: var(--border2); }
.btn.secondary:hover { background: rgba(255,255,255,.05); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--muted); border-color: transparent; padding: 6px 12px; font-size: .85em; }
.btn.ghost:hover { color: var(--orange); }

.card { background: rgba(12,18,32,.82); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }

.kicker { color: var(--orange); font-weight: 800; letter-spacing: .15em; text-transform: uppercase; font-size: 11px; }
.page-title { font-size: 2em; margin: 8px 0 6px; line-height: 1.1; }

.muted { color: var(--muted); }

/* Auth forms */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.auth-card { max-width: 440px; width: 100%; }
.auth-card h1 { font-size: 1.6em; margin: 0 0 6px; }
.auth-card .sub { color: var(--muted); margin: 0 0 20px; font-size: .95em; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .82em; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.field input, .field select { width: 100%; padding: 10px 12px; background: var(--bg2); border: 1px solid var(--border2); border-radius: 8px; color: var(--text); font-size: .95em; font-family: inherit; }
.field input:focus, .field select:focus { outline: none; border-color: var(--orange); }
.err { background: rgba(230,70,44,.1); border: 1px solid rgba(230,70,44,.3); color: #ff7e65; padding: 10px 12px; border-radius: 8px; font-size: .88em; margin-bottom: 14px; display: none; }
.err.show { display: block; }
.auth-footer { margin-top: 18px; font-size: .9em; color: var(--muted); text-align: center; }

/* Dashboard */
.hero-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
@media (max-width: 720px) { .hero-stats { grid-template-columns: repeat(2, 1fr); } }
.stat-card { background: rgba(12,18,32,.6); border: 1px solid var(--border); border-radius: 10px; padding: 14px; text-align: center; }
.stat-card .val { font-size: 1.6em; font-weight: 800; color: var(--orange); }
.stat-card .lbl { font-size: .75em; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; margin-top: 4px; }

.progress-bar { height: 10px; background: var(--bg2); border-radius: 999px; overflow: hidden; margin: 12px 0; }
.progress-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--orange), var(--violet)); border-radius: 999px; transition: width .3s; }

.module-card { margin-bottom: 14px; }
.module-card .module-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.module-card .module-title { font-size: 1.1em; font-weight: 700; }
.module-card .module-meta { font-size: .85em; color: var(--muted); }
.module-card .module-desc { color: var(--muted); margin: 6px 0 12px; font-size: .92em; }
.lesson-list { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.lesson-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; text-decoration: none; color: var(--text2); transition: all .15s; }
.lesson-row:hover { background: var(--bg3); color: var(--text); text-decoration: none; border-color: var(--border2); }
.lesson-row .check { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border2); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: .7em; color: transparent; }
.lesson-row.done .check { border-color: var(--green); background: var(--green); color: #000; }
.lesson-row .lesson-title { flex: 1; font-size: .92em; }
.lesson-row .lesson-time { font-size: .78em; color: var(--muted); }

/* Lesson viewer */
.lesson-wrap { max-width: 760px; margin: 0 auto; padding: 40px 22px; }
.lesson-breadcrumb { font-size: .85em; color: var(--muted); margin-bottom: 8px; }
.lesson-breadcrumb a { color: var(--muted); }
.lesson-content { font-size: 1.02em; line-height: 1.75; }
.lesson-content h1 { font-size: 1.8em; margin-top: 0; }
.lesson-content h2 { font-size: 1.35em; margin-top: 1.6em; color: var(--orange); }
.lesson-content h3 { font-size: 1.1em; margin-top: 1.4em; }
.lesson-content code { background: var(--bg2); padding: 2px 7px; border-radius: 4px; font-size: .88em; color: #4af; }
.lesson-content pre { background: var(--bg2); padding: 14px 16px; border-radius: 8px; overflow-x: auto; }
.lesson-content pre code { background: transparent; padding: 0; }
.lesson-content blockquote { border-left: 3px solid var(--orange); margin-left: 0; padding: 4px 16px; color: var(--muted); }
.lesson-content ul, .lesson-content ol { padding-left: 22px; }
.lesson-content li { margin-bottom: 4px; }
.lesson-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); flex-wrap: wrap; }

/* Certificate */
.cert-wrap { max-width: 820px; margin: 40px auto; padding: 0 22px; }
.cert-page { background: linear-gradient(135deg, #0a1024, #0c0c1a); border: 2px solid var(--orange); border-radius: 18px; padding: 60px 50px; text-align: center; box-shadow: 0 30px 80px rgba(248,120,32,.15); }
.cert-page .cert-kicker { color: var(--orange); letter-spacing: .35em; font-size: .82em; font-weight: 800; text-transform: uppercase; }
.cert-page h1 { font-size: 2em; margin: 18px 0; font-weight: 900; }
.cert-page .cert-to { font-size: 1em; color: var(--muted); margin: 24px 0 8px; }
.cert-page .cert-name { font-size: 2.4em; font-weight: 800; background: linear-gradient(90deg, var(--orange), var(--violet)); -webkit-background-clip: text; background-clip: text; color: transparent; margin: 4px 0 20px; padding: 4px 0; }
.cert-page .cert-body { color: var(--text2); font-size: 1em; max-width: 560px; margin: 0 auto; line-height: 1.6; }
.cert-meta { display: flex; justify-content: space-around; margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--border); flex-wrap: wrap; gap: 20px; }
.cert-meta > div { text-align: center; }
.cert-meta .meta-lbl { font-size: .72em; color: var(--muted); text-transform: uppercase; letter-spacing: .15em; }
.cert-meta .meta-val { font-size: .95em; color: var(--text); font-weight: 700; font-family: monospace; margin-top: 4px; }

.toast { position: fixed; top: 20px; right: 20px; background: #0c1220; border: 1px solid var(--border2); border-radius: 8px; padding: 10px 16px; font-size: .9em; box-shadow: 0 8px 28px rgba(0,0,0,.5); z-index: 100; max-width: 320px; }
.toast.success { border-color: var(--green); }
.toast.error { border-color: var(--red); color: #ff7e65; }
