/* EnergyHub Academy – mobile first, light and dark */
:root {
  --bg: #f7f6f2; --surface: #ffffff; --ink: #1d2320; --muted: #5d6762; --line: #dedbd2;
  --brand: #0f5132; --brand-ink: #ffffff; --sun: #f2a516; --sun-soft: #fdf1d6;
  --ok: #1f7a4a; --ok-soft: #e3f3ea; --warn: #9a4b00; --warn-soft: #fdecd9;
  --wa: #1f8f4e; --radius: 12px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121614; --surface: #1b211e; --ink: #e8ece9; --muted: #9aa5a0; --line: #2d3531;
    --brand: #3fb47a; --brand-ink: #08130d; --sun: #f5b63c; --sun-soft: #3a2f17;
    --ok: #5fd096; --ok-soft: #173326; --warn: #ffb36b; --warn-soft: #3a2614; --wa: #35c46f;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); }
h1 { font-size: 1.7rem; line-height: 1.2; margin: .4em 0 .4em; }
h2 { font-size: 1.25rem; margin: 1.6em 0 .5em; }
h3 { font-size: 1.05rem; margin: 1.2em 0 .3em; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 680px; }
.wrap.wide { max-width: 1280px; }
main.wrap { padding-top: 8px; padding-bottom: 48px; min-height: 70vh; }

/* header & footer */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-size: 1.05rem; }
.top nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.top nav a { text-decoration: none; color: var(--muted); font-weight: 500; }
.top nav a[aria-current] { color: var(--ink); }
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.lang a { padding: 2px 9px; font-size: .85rem; }
.lang a[aria-current] { background: var(--brand); color: var(--brand-ink) !important; }
.foot { border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; padding: 18px 0 28px; }
.foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.foot a { color: var(--muted); }

/* building blocks */
.card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); color: inherit; text-decoration: none; }
a.card:hover { border-color: var(--brand); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; min-height: 44px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn.small { padding: 4px 12px; min-height: 32px; font-size: .9rem; }
.link { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; text-decoration: underline; }
form.inline { display: inline; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.note { background: var(--sun-soft); border-radius: var(--radius); padding: 12px 14px; }
.note.ok { background: var(--ok-soft); }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.note ul { margin: 0; padding-left: 18px; }
.small { font-size: .88rem; }
.muted { color: var(--muted); }
.pre { white-space: pre-line; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-block; font-size: .78rem; padding: 2px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.chip.lv3 { background: var(--sun-soft); border-color: transparent; }
.mode { font-size: .75rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
.m-platform { background: var(--ok-soft); color: var(--ok); }
.m-hybrid { background: var(--sun-soft); color: var(--warn); }
.m-in_person { background: var(--warn-soft); color: var(--warn); }
progress { width: 100%; height: 8px; accent-color: var(--brand); }
meter { width: 70px; }
.crumbs { margin: 6px 0 0; font-size: .9rem; color: var(--muted); }
.crumbs a { color: var(--muted); }

/* landing */
.hero { padding: 28px 0 8px; }
.hero h1 { font-size: clamp(1.8rem, 6vw, 2.6rem); max-width: 18ch; }
.eyebrow { color: var(--warn); font-weight: 600; letter-spacing: .04em; margin: 0; }
.lead { font-size: 1.08rem; color: var(--muted); max-width: 62ch; }
.tracks { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-top: 18px; }
.tracks > h2 { grid-column: 1 / -1; margin-bottom: 0; }
.tracks h2, .tracks h3 { margin-top: 0; }
.lessons-mini { list-style: none; padding: 0; margin: 0; font-size: .92rem; }
.lessons-mini li { padding: 4px 0; border-top: 1px solid var(--line); }
.how ol { padding-left: 20px; }
.track-card p { color: var(--muted); margin: 0 0 12px; }

/* home */
.wa-banner { display: flex; flex-direction: column; background: var(--wa); color: #fff; text-decoration: none;
  border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; }
.wa-banner span { opacity: .9; font-size: .92rem; }
.news-item h3 { margin-top: 0; }
.news .card { margin-bottom: 10px; }

/* track & lesson */
.lesson-list { list-style: none; padding: 0; display: grid; gap: 10px; }
.lesson-list a { display: flex; gap: 14px; padding: 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); color: inherit; text-decoration: none; }
.lesson-list a:hover { border-color: var(--brand); }
.lesson-list .num { flex: 0 0 32px; height: 32px; border-radius: 50%; background: var(--bg); border: 1px solid var(--line);
  display: grid; place-items: center; font-weight: 700; }
.lesson-list .is-done .num { background: var(--ok); color: #fff; border-color: var(--ok); }
.lesson-list .body { display: flex; flex-direction: column; gap: 3px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--muted); font-size: .88rem; }
.prose { max-width: 70ch; }
.lesson { margin-top: 10px; }
.lesson h2 { border-top: 1px solid var(--line); padding-top: 1em; }
.lesson table, .prose table { border-collapse: collapse; width: 100%; font-size: .93rem; display: block; overflow-x: auto; }
.lesson th, .lesson td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.lesson code { background: var(--bg); padding: 1px 5px; border-radius: 4px; }
.lesson .formula { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--surface); border-left: 4px solid var(--sun);
  padding: 10px 14px; border-radius: 6px; overflow-x: auto; }
.admonition { border-radius: var(--radius); padding: 10px 14px; margin: 1em 0; background: var(--sun-soft); }
.admonition.danger, .admonition.warning { background: var(--warn-soft); }
.admonition.tip { background: var(--ok-soft); }
.admonition-title { font-weight: 700; margin: 0 0 4px; }
.lesson img { max-width: 100%; height: auto; border-radius: 8px; }
.quiz { margin-top: 28px; }
.quiz .q { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.quiz .check { padding: 6px 0; }
.quiz legend { font-weight: 600; margin-bottom: 6px; }
.done-form { margin-top: 24px; }
.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 32px; font-size: .95rem; }

/* forms */
.form { display: grid; gap: 14px; }
.form fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 0; background: var(--surface); }
.form legend { font-weight: 700; padding: 0 6px; }
.form label { display: grid; gap: 4px; font-weight: 500; }
.form .check, label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 6px 0; }
.check input { margin-top: 4px; width: 20px; height: 20px; flex: 0 0 auto; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px; min-height: 44px; width: 100%; }
textarea { min-height: 80px; }
input[type=radio], input[type=checkbox] { width: 20px; height: 20px; min-height: 0; padding: 0; accent-color: var(--brand); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
input.code { font-size: 1.6rem; letter-spacing: .3em; text-align: center; }
.row { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .row { grid-template-columns: 1fr 1fr; } }
.skillgroup { margin: 12px 0 6px; }
.skill { display: grid; gap: 6px; padding: 8px 0; border-top: 1px solid var(--line); }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.seg label { display: block; position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg span { display: block; text-align: center; font-size: .78rem; line-height: 1.2; padding: 8px 4px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--bg); font-weight: 500; }
.seg input:checked + span { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.seg input:focus-visible + span { outline: 2px solid var(--sun); }
@media (min-width: 720px) { .skill { grid-template-columns: 220px 1fr; align-items: center; } }

/* calculator */
.calc { display: grid; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.calc .row { grid-template-columns: 1fr; }
@media (min-width: 480px) { .calc .row { grid-template-columns: 1fr 1fr; } }
.calc output { display: block; font-size: 1.25rem; font-weight: 700; }
.calc .res { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.calc .res div { background: var(--sun-soft); border-radius: 8px; padding: 10px; }
.calc .res span { font-size: .8rem; color: var(--muted); }

/* directory */
.dir-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.dir { display: flex; flex-direction: column; gap: 2px; }

/* admin */
.stats { display: flex; gap: 10px; flex-wrap: wrap; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 14px; color: var(--ink); text-decoration: none; }
.stat b { font-size: 1.3rem; margin-right: 4px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.filters input, .filters select { width: auto; flex: 1 1 150px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table.members { border-collapse: collapse; width: 100%; font-size: .9rem; }
.members th, .members td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.members th { font-size: .8rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.members td progress { width: 64px; }
.status { font-size: .78rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--bg); text-transform: uppercase; letter-spacing: .03em; }
.s-pending { background: var(--sun-soft); color: var(--warn); }
.s-member { background: var(--ok-soft); color: var(--ok); }
.s-rejected { background: var(--warn-soft); color: var(--warn); }
.member-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; align-items: flex-start; }
.member-head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.member-head blockquote { margin: 8px 0; padding: 8px 12px; border-left: 3px solid var(--line); color: var(--muted); }
.member-head .actions select { width: auto; min-height: 32px; padding: 4px 8px; }
.grid2 { display: grid; gap: 14px; grid-template-columns: 1fr; margin: 14px 0; }
@media (min-width: 900px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.grid2 h2, .card > h2 { margin-top: 0; }
.skills-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.skills-table td, .skills-table th { padding: 5px 4px; border-bottom: 1px solid var(--line); text-align: left; }
.skills-table tr.group th { padding-top: 12px; color: var(--muted); font-size: .8rem; text-transform: uppercase; }
.progress-list { list-style: none; padding: 0; margin: 0; }
.progress-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; padding: 6px 0; border-top: 1px solid var(--line); font-size: .92rem; }
.progress-list .is-done { color: var(--ok); }
.signoff input { width: 160px; min-height: 32px; padding: 4px 8px; display: inline-block; }
.admin-news .card { margin-top: 10px; }
.danger { margin-top: 24px; color: var(--muted); }
.danger .form { max-width: 420px; margin-top: 8px; }
