:root {
  --bg: #1b2a4a;
  --bg2: #16223d;
  --card: #22345a;
  --line: #3a4f7a;
  --text: #e8eefc;
  --muted: #9fb0d4;
  --blue: #5cc8ff;
  --blue-fill: rgba(92, 200, 255, 0.55);
  --pink: #e05aa8;
  --gold: #e8bf55;
  --green: #5fc27a;
  --warn: #ff9a8a;
  --bronze: #c98b54;
  --silver: #c9d3e3;
  --goldlvl: #f2c94c;
  --platinum: #9ff0ff;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(ellipse at top, #24386a 0%, var(--bg) 55%, var(--bg2) 100%) fixed;
  background-color: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.4;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

.app {
  max-width: 980px;
  margin: 0 auto;
  padding: 12px 16px calc(96px + env(safe-area-inset-bottom));
}
.loading { color: var(--muted); text-align: center; margin-top: 30vh; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: rgba(22, 34, 61, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.brand { font-weight: 800; font-size: 22px; letter-spacing: 1px; color: var(--blue); }
.brand span { color: var(--text); font-weight: 600; }
.who { flex: 1; color: var(--muted); font-size: 14px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-btn { background: none; border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 6px 10px; font-size: 14px; cursor: pointer; }

/* bottom tabs */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; justify-content: center;
  background: rgba(22, 34, 61, 0.96);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; max-width: 160px;
  text-align: center; padding: 10px 4px 12px;
  color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 600;
}
.tabbar a .ic { display: block; font-size: 22px; line-height: 1.2; }
.tabbar a.active { color: var(--blue); }

/* headings */
h1.title { font-family: Georgia, "Times New Roman", serif; font-size: 26px; letter-spacing: 1px; margin: 12px 0 2px; text-transform: uppercase; }
h1.title .dot { color: var(--muted); padding: 0 6px; }
.subnote { color: var(--warn); font-size: 13px; margin: 0 0 14px; }
h2 { font-size: 20px; margin: 26px 0 10px; color: var(--text); }
.muted { color: var(--muted); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  margin: 10px 0;
}
.notice {
  background: rgba(255, 154, 138, 0.12);
  border: 1px dashed var(--warn);
  color: var(--warn);
  border-radius: 12px; padding: 10px 14px; font-size: 15px; margin: 10px 0;
}

/* home layout */
.home-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 860px) {
  .home-grid { grid-template-columns: 1fr 1fr; align-items: start; }
}

/* stat rings */
.rings { display: flex; justify-content: space-between; gap: 8px; margin: 6px 0 10px; }
.ring { flex: 1; text-align: center; }
.ring svg { width: 100%; max-width: 120px; height: auto; display: block; margin: 0 auto; }
.ring .val { font-size: 22px; font-weight: 800; fill: #fff; }
.ring .lbl { font-size: 13px; font-weight: 600; margin-top: 4px; }
.c-pink { color: var(--pink); stroke: var(--pink); }
.c-gold { color: var(--gold); stroke: var(--gold); }
.c-green { color: var(--green); stroke: var(--green); }

/* level */
.level { display: flex; align-items: center; gap: 14px; }
.level-badge {
  width: 64px; height: 64px; flex: none;
  display: flex; align-items: center; justify-content: center;
  clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
  font-weight: 900; font-size: 26px; color: #1b2a4a;
}
.lvl-Junior { background: var(--bronze); }
.lvl-Senior { background: var(--silver); }
.lvl-Expert { background: var(--goldlvl); }
.lvl-Master { background: var(--platinum); }
.level-info { flex: 1; }
.level-name { font-size: 20px; font-weight: 800; }
.bar { height: 12px; border-radius: 6px; background: #13203a; overflow: hidden; margin-top: 6px; border: 1px solid var(--line); }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, #3aa8e8, var(--blue)); box-shadow: 0 0 8px var(--blue); }
.bar.done > i { background: linear-gradient(90deg, #3fae63, var(--green)); box-shadow: 0 0 8px var(--green); }

/* stats list */
.stats { display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; margin: 0; }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; font-weight: 600; }

/* badges */
.shelf { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(92, 200, 255, 0.12); border: 1px solid rgba(92, 200, 255, 0.45);
  font-size: 14px; font-weight: 600;
}
.badge::before { content: "★"; color: var(--gold); }

/* radar */
.radar-wrap { text-align: center; }
.radar { width: 100%; max-width: 440px; height: auto; display: block; margin: 0 auto; overflow: visible; }
.radar .grid { fill: none; stroke: var(--line); stroke-width: 1; }
.radar .axis { stroke: var(--line); stroke-width: 1; }
.radar .now { fill: var(--blue-fill); stroke: #fff; stroke-width: 2; filter: url(#glow); }
.radar .prev { fill: none; stroke: #c7dcff; stroke-width: 1.5; stroke-dasharray: 5 4; opacity: 0.85; }
.radar .pt { fill: #fff; }
.radar .lab { fill: var(--text); font-size: 13px; font-weight: 600; }
.radar .score { fill: var(--blue); font-size: 13px; font-weight: 700; }
.legend { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* courses */
.course { padding: 12px 0; border-bottom: 1px solid var(--line); }
.course:last-child { border-bottom: none; }
.course-top { display: flex; justify-content: space-between; gap: 10px; }
.course-title { font-weight: 600; }
.quiz { font-size: 14px; color: var(--muted); white-space: nowrap; }
.quiz b { color: var(--green); }

.kit { display: block; text-decoration: none; color: var(--text); }
.kit .kit-title { font-weight: 700; color: var(--blue); }
.kit .kit-desc { color: var(--muted); font-size: 14px; }

/* HR */
.leave-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.leave-card { text-align: center; }
.leave-card .big { font-size: 34px; font-weight: 800; color: var(--blue); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
td.num, th.num { text-align: right; }
.st-Pending { color: var(--gold); }
.st-Approved { color: var(--green); }

/* people lists */
.person-row {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; color: var(--text);
}
.person-row .mini-badge {
  width: 40px; height: 40px; flex: none; display: flex; align-items: center; justify-content: center;
  clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
  font-weight: 900; color: #1b2a4a; background: var(--muted);
}
.person-row .pr-main { flex: 1; }
.person-row .pr-name { font-weight: 700; }
.person-row .pr-sub { font-size: 14px; color: var(--muted); }
.person-row .pr-score { font-size: 20px; font-weight: 800; color: var(--blue); }
.back { display: inline-block; margin: 10px 0 0; color: var(--blue); text-decoration: none; font-weight: 600; }
.section-sep { border: none; border-top: 2px solid var(--line); margin: 28px 0 0; }

/* login */
.login { max-width: 380px; margin: 12vh auto 0; text-align: center; }
.login .logo { font-size: 46px; font-weight: 900; color: var(--blue); letter-spacing: 2px; }
.login .logo span { color: var(--text); font-weight: 600; }
.login p { color: var(--muted); }
.login form { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.login input {
  font-size: 20px; padding: 14px; border-radius: 12px;
  border: 1px solid var(--line); background: #13203a; color: var(--text);
  text-align: center;
}
.login input.code { letter-spacing: 8px; font-weight: 700; }
.btn {
  font-size: 18px; font-weight: 700; padding: 14px; border: none; border-radius: 12px;
  background: linear-gradient(90deg, #3aa8e8, var(--blue)); color: #0d1830; cursor: pointer;
}
.btn:disabled { opacity: 0.6; }
.msg { min-height: 1.4em; font-size: 15px; }
.login .btn-ghost { font-size: 15px; padding: 10px; }
.login .btn-ghost:disabled { border-color: var(--line); color: var(--muted); cursor: default; }
.msg.err { color: var(--warn); }
.demo-note { color: var(--gold) !important; font-weight: 600; }
.demo-list { text-align: left; font-size: 14px; margin-top: 18px; }
.demo-list a { color: var(--blue); }

/* OZ Academy: course cards, lesson pages, quiz */
a.course-card { display: block; text-decoration: none; color: var(--text); }
.course-card .course-title { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.course-card .quiz { white-space: normal; margin-top: 8px; }
.quiz b.notyet { color: var(--gold); }
.course-meta { color: var(--muted); font-size: 14px; margin: 4px 0; }
.small { font-size: 14px; }
h1.course-h { text-transform: none; letter-spacing: 0; font-size: 24px; line-height: 1.25; }
.draft-badge {
  display: inline-block; margin: 4px 0; padding: 3px 10px; border-radius: 6px;
  background: rgba(255, 154, 138, 0.15); border: 1px solid var(--warn); color: var(--warn);
  font-size: 12px; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase;
}
.btn-row { display: flex; gap: 10px; margin: 14px 0 4px; }
.btn-row .btn { flex: 1; text-align: center; text-decoration: none; display: block; }
.btn-ghost { background: none; border: 1px solid var(--blue); color: var(--blue); }
.lesson-row { display: flex; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.lesson-row:last-child { border-bottom: none; }
.tick { flex: none; width: 22px; text-align: center; color: var(--muted); font-weight: 800; }
.tick.done { color: var(--green); }

.lesson { font-size: 18px; line-height: 1.6; overflow-wrap: break-word; }
.lesson h1 { font-size: 23px; line-height: 1.25; margin: 4px 0 12px; }
.lesson h2 { font-size: 20px; margin: 22px 0 8px; }
.lesson h3 { font-size: 18px; margin: 22px 0 8px; color: var(--blue); }
.lesson h4 { font-size: 17px; margin: 16px 0 6px; }
.lesson p { margin: 0 0 12px; }
.lesson ul, .lesson ol { margin: 0 0 12px; padding-left: 24px; }
.lesson li { margin-bottom: 6px; }
.lesson li > ul, .lesson li > ol { margin: 6px 0 0; }
.lesson strong { color: #fff; }
.lesson a { color: var(--blue); }
.lesson code, .lesson pre { background: #13203a; border-radius: 6px; padding: 1px 5px; font-size: 15px; }
.lesson pre { padding: 10px; overflow-x: auto; }
.lesson blockquote {
  margin: 0 0 12px; padding: 10px 14px; border-left: 4px solid var(--blue);
  background: rgba(92, 200, 255, 0.08); border-radius: 0 10px 10px 0;
}
.lesson blockquote p:last-child { margin-bottom: 0; }
.lesson hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }
.table-scroll { overflow-x: auto; margin: 0 -6px 12px; }
.lesson table { font-size: 15px; line-height: 1.4; min-width: 460px; }
.lesson th, .lesson td { vertical-align: top; }

.question .prompt { font-size: 19px; font-weight: 600; margin: 4px 0 12px; }
.critical-tag { display: inline-block; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; color: var(--gold); border: 1px solid var(--gold); border-radius: 6px; padding: 2px 8px; margin-bottom: 6px; }
.opt {
  display: flex; gap: 12px; align-items: flex-start; padding: 13px 12px; margin: 8px 0;
  border: 1px solid var(--line); border-radius: 12px; background: #1c2c4f; cursor: pointer;
}
.opt input { flex: none; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--blue); }
.opt-correct { border-color: var(--green); background: rgba(95, 194, 122, 0.16); }
.opt-wrong { border-color: var(--warn); background: rgba(255, 154, 138, 0.14); }
.question .btn { width: 100%; margin-top: 8px; }
.feedback { border-radius: 12px; padding: 12px 14px; margin-top: 10px; }
.feedback.good { background: rgba(95, 194, 122, 0.14); border: 1px solid var(--green); }
.feedback.bad { background: rgba(255, 154, 138, 0.12); border: 1px solid var(--warn); }
.result { text-align: center; }
.result-score { font-size: 56px; font-weight: 900; line-height: 1.1; }
.result-word { font-size: 20px; font-weight: 800; letter-spacing: 1px; margin-bottom: 8px; }
.result.pass .result-score, .result.pass .result-word { color: var(--green); }
.result.fail .result-score, .result.fail .result-word { color: var(--gold); }
.bad-text { color: var(--warn); font-weight: 600; }

/* session 4: Active / Left marker, Deactivate, skill sign-off */
.mark { flex: none; padding: 3px 10px; border-radius: 6px; font-size: 12px; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase; }
.mark-active { color: var(--green); border: 1px solid var(--green); background: rgba(95, 194, 122, 0.14); }
.mark-left { color: var(--warn); border: 1px solid var(--warn); background: rgba(255, 154, 138, 0.15); }
.admin-row { display: flex; align-items: center; gap: 10px; }
.admin-row .person-row { flex: 1; min-width: 0; }
.btn-danger { flex: none; border-color: var(--warn); color: var(--warn); font-size: 14px; padding: 8px 10px; }
.skill-row input:disabled { opacity: 0.6; }
.audit-list { list-style: none; margin: 0; padding: 0; }
.audit-row { display: flex; flex-wrap: wrap; gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.audit-time { color: var(--muted); white-space: nowrap; }
.audit-what { flex: 1 1 100%; word-break: break-word; }
