:root {
  --green: #03573a;
  --green-deep: #024630;
  --green-card: #0a6646;
  --yellow: #fcc23f;
  --yellow-dark: #e9ad22;
  --ink: #0b3424;
  --paper: #ffffff;
  --paper-soft: #f3f7f4;
  --muted: #5f7a6d;
  --line: #dfe8e2;
  --red: #c2412d;
  --radius: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--green);
  color: var(--ink);
  font: 500 16px/1.6 "Montserrat", -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--green); }

/* ---------- header ---------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1040px;
  margin: 0 auto;
  padding: 18px 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-weight: 900;
  letter-spacing: .02em;
  text-transform: uppercase;
  font-size: 15px;
}
.brand img { width: 38px; height: 38px; }
.navlink {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  padding: 8px 14px;
  border: 2px solid rgba(255, 255, 255, .25);
  border-radius: 999px;
}
.navlink:hover { border-color: var(--yellow); color: var(--yellow); }

.wrap { max-width: 1040px; margin: 0 auto; padding: 8px 20px 90px; }
.wrap.read { max-width: 820px; }

/* ---------- type ---------- */
.display {
  color: #fff;
  font-weight: 900;
  text-transform: uppercase;
  line-height: 1.08;
  font-size: clamp(28px, 5vw, 46px);
  margin: 10px 0 14px;
}
.pill {
  display: inline-block;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 900;
  text-transform: uppercase;
  border-radius: 12px;
  padding: 4px 14px;
  font-size: 14px;
  letter-spacing: .02em;
}
.lead { color: rgba(255, 255, 255, .8); margin: 0; }
.small { font-size: 13px; }
.muted { color: var(--muted); }

.flash {
  background: #fff2f0;
  color: var(--red);
  font-weight: 600;
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
}

/* ---------- buttons & forms ---------- */
.btn {
  font: inherit;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .02em;
  font-size: 14px;
  padding: 13px 22px;
  border: 0;
  border-radius: 14px;
  background: var(--yellow);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: transform .08s, background .15s;
}
.btn:hover { background: var(--yellow-dark); }
.btn:active { transform: scale(.98); }
.btn.ghost { background: transparent; color: var(--green); box-shadow: inset 0 0 0 2px var(--green); }
.btn.ghost:hover { background: var(--paper-soft); }
.btn.on-green.ghost { color: #fff; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .5); }
.btn.danger { background: transparent; color: var(--red); box-shadow: inset 0 0 0 2px var(--red); }
.btn.small { padding: 6px 10px; font-size: 11px; border-radius: 10px; }

input, select, textarea {
  font: inherit;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); }
textarea { width: 100%; font-size: 14px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; }
.row input { flex: 1 1 180px; }

/* ---------- cards ---------- */
.card {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 26px;
  margin-bottom: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .12);
}
.card h1, .card h2 { font-weight: 900; text-transform: uppercase; line-height: 1.15; }
.card h1 { font-size: 24px; margin: 0 0 12px; }
.card h2 { font-size: 18px; margin: 0 0 14px; }
.card.highlight { box-shadow: inset 0 0 0 3px var(--yellow), 0 10px 30px rgba(0, 0, 0, .12); }

/* ---------- login ---------- */
.login { max-width: 420px; margin: 6vh auto 0; text-align: center; }
.login .logo-big { width: 96px; height: 96px; }
.login .card { text-align: left; }
.login input[name=code] { text-align: center; font-weight: 800; letter-spacing: .15em; font-size: 20px; text-transform: uppercase; }

/* ---------- dashboard ---------- */
.hello { margin-bottom: 30px; }
.progress {
  height: 12px;
  background: rgba(255, 255, 255, .15);
  border-radius: 99px;
  overflow: hidden;
  margin: 18px 0 8px;
  max-width: 460px;
}
.bar { height: 100%; background: var(--yellow); border-radius: 99px; }
.progress-label { color: rgba(255, 255, 255, .75); font-weight: 700; font-size: 13px; }

.section-title {
  color: var(--yellow);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 14px;
  margin: 34px 0 14px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}
.tile {
  position: relative;
  display: block;
  background: var(--green-deep);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: #fff;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}
.tile:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(0, 0, 0, .28); }
.tile img.cover { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.tile .done-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 900;
}

/* generated cover in the same style as the real ones */
.gen-cover {
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  gap: 6%;
  padding: 0 7%;
  background: var(--green);
  color: #fff;
}
.gen-cover img { width: 26%; flex: none; }
.gen-cover .pill { font-size: clamp(12px, 1.6vw, 16px); margin-bottom: 8px; }
.gen-cover .t {
  font-weight: 900;
  text-transform: uppercase;
  line-height: 1.08;
  font-size: clamp(14px, 1.7vw, 18px);
}
.page-hero .gen-cover .pill { font-size: clamp(14px, 3vw, 26px); }
.page-hero .gen-cover .t { font-size: clamp(18px, 3.4vw, 32px); }

/* ---------- lesson page ---------- */
.page-hero {
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 22px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
}
.page-hero img.cover { display: block; width: 100%; }

.prose { font-size: 16.5px; }
.prose h2 {
  font-size: 19px;
  color: var(--green);
  margin: 30px 0 12px;
}
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-weight: 800; font-size: 16px; }
.prose strong { font-weight: 800; }
.prose table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14.5px; display: block; overflow-x: auto; margin: 16px 0; }
.prose th, .prose td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.prose th { background: var(--green); color: #fff; font-weight: 800; }
.prose th:first-child { border-top-left-radius: 12px; }
.prose th:last-child { border-top-right-radius: 12px; }
.prose tr:nth-child(even) td { background: var(--paper-soft); }
.prose blockquote {
  margin: 18px 0;
  padding: 14px 18px;
  background: #fff8e6;
  border-left: 5px solid var(--yellow);
  border-radius: 0 12px 12px 0;
}
.prose blockquote p { margin: 0; }
.prose pre { background: var(--paper-soft); padding: 14px; border-radius: 12px; overflow-x: auto; white-space: pre-wrap; font-size: 14px; }
.prose code { background: var(--paper-soft); padding: 2px 6px; border-radius: 6px; font-size: .92em; }
.prose hr { border: 0; height: 2px; background: var(--line); margin: 28px 0; }
.prose li { margin: 4px 0; }
.prose li.check { list-style: none; margin-left: -1.3em; }
.prose img { max-width: 100%; border-radius: 12px; }

.done-form { text-align: center; margin: 6px 0 26px; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pager a {
  display: block;
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--green-deep);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
}
.pager a:hover { background: var(--green-card); }
.pager .next { text-align: right; grid-column: 2; }
.pager small { display: block; color: var(--yellow); font-weight: 900; text-transform: uppercase; font-size: 11px; letter-spacing: .06em; }

/* ---------- expired ---------- */
.center { text-align: center; }

/* ---------- admin ---------- */
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th { text-align: left; font-size: 12px; text-transform: uppercase; color: var(--muted); padding: 8px; }
.admin-table td { padding: 10px 8px; border-top: 1px solid var(--line); vertical-align: top; }
.admin-table tr.inactive td { opacity: .5; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.actions form { display: flex; gap: 4px; }
.actions select { padding: 5px 8px; font-size: 12px; border-radius: 8px; }
.code { font-family: ui-monospace, Menlo, monospace; font-weight: 800; letter-spacing: .06em; }
.code.big { font-size: 22px; background: var(--paper-soft); padding: 4px 10px; border-radius: 10px; }
.tag { background: #fff2f0; color: var(--red); font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 6px; text-transform: uppercase; }

/* ---------- student ID ---------- */
.student-id {
  position: fixed;
  right: 12px;
  bottom: 10px;
  font: 700 11px ui-monospace, Menlo, monospace;
  color: rgba(255, 255, 255, .45);
  background: rgba(0, 0, 0, .15);
  padding: 3px 8px;
  border-radius: 8px;
  pointer-events: none;
  user-select: none;
  z-index: 10;
}

@media (max-width: 600px) {
  .card { padding: 18px; }
  .prose { font-size: 15.5px; }
  .grid { grid-template-columns: 1fr; }
  .brand span { display: none; }
}

/* ======================================================================
   v2: shared helpers
   ====================================================================== */
.inline { display: inline; }
.flash.ok { background: #e8f6ee; color: var(--green); }
.lead-link { color: var(--yellow); }
.back { display: inline-block; color: rgba(255, 255, 255, .8); text-decoration: none; font-weight: 700; font-size: 14px; margin-bottom: 14px; }
.back:hover { color: var(--yellow); }
.back.dark { color: var(--muted); }
.back.dark:hover { color: var(--green); }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: 6px 0; }
.link-btn { background: none; border: 0; color: var(--red); cursor: pointer; font-weight: 800; font-size: 16px; padding: 0 6px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.check-label { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-weight: 600; font-size: 14px; }
.check-label input { width: 18px; height: 18px; accent-color: var(--green); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; align-items: end; }
.form-grid .wide { grid-column: 1 / -1; }
.inline-fields { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-fields .grow { flex: 1 1 260px; }
.days-input { width: 120px; }
.topnav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.topnav a { color: rgba(255, 255, 255, .8); text-decoration: none; font-weight: 700; font-size: 14px; padding: 8px 12px; border-radius: 999px; }
.topnav a.on, .topnav a:hover { background: rgba(255, 255, 255, .12); color: #fff; }
button.navlink { background: transparent; font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; }

/* dashboard extras (student) */
.dash-row { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 8px; }
.continue, .mini-stat {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--yellow); color: var(--ink); text-decoration: none;
  border-radius: var(--radius); padding: 20px 22px; position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .15);
}
.continue small, .mini-stat small { font-weight: 800; text-transform: uppercase; font-size: 12px; letter-spacing: .06em; opacity: .75; }
.continue b { font-weight: 900; font-size: 19px; line-height: 1.25; padding-right: 40px; }
.continue .arrow { position: absolute; right: 22px; top: 50%; transform: translateY(-50%); font-size: 28px; font-weight: 900; }
.continue.done { background: var(--green-deep); color: #fff; }
.mini-stat { background: var(--green-deep); color: #fff; }
.mini-stat b { font-size: 26px; font-weight: 900; color: var(--yellow); }
.mini-stat span { font-size: 13px; opacity: .8; }

.news-list { display: flex; flex-direction: column; gap: 12px; }
.news-item { background: var(--paper); border-radius: var(--radius); padding: 18px 22px; }
.news-item.pinned { box-shadow: inset 4px 0 0 var(--yellow); }
.news-item h3 { margin: 2px 0 6px; font-weight: 900; font-size: 17px; }
.news-meta { font-size: 12px; color: var(--muted); font-weight: 700; }
.small-prose { font-size: 15px; }
.small-prose p:last-child { margin-bottom: 0; }
.more-link { color: var(--yellow); font-weight: 800; text-decoration: none; font-size: 14px; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin: 18px 0 22px; }
.stat { background: var(--paper); border-radius: var(--radius); padding: 16px 18px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 2px; }
.stat small { font-size: 12px; font-weight: 800; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }
.stat b { font-size: 26px; font-weight: 900; color: var(--green); }
.stat span { font-size: 12px; color: var(--muted); }
a.stat:hover { box-shadow: inset 0 0 0 2px var(--yellow); }

.tracker-list { display: flex; flex-direction: column; gap: 8px; }
.tracker-item { display: flex; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: 14px; background: var(--paper-soft); color: var(--ink); text-decoration: none; border-left: 5px solid var(--yellow); }
.tracker-item:hover { background: #e8f1ec; }
.tracker-item.status-done { border-left-color: var(--green); }
.tracker-item.status-failed { border-left-color: #b7c2bc; opacity: .75; }
.tracker-item.overdue { border-left-color: var(--red); }
.tracker-item .money { text-align: right; white-space: nowrap; }
.tracker-item .money b { display: block; font-weight: 900; color: var(--green); }

.checked { display: inline-block; background: #e8f6ee; color: var(--green); font-weight: 700; font-size: 13px; padding: 4px 10px; border-radius: 8px; margin: 0 0 14px; }
.preview-bar { background: var(--yellow); color: var(--ink); padding: 10px 16px; border-radius: 12px; margin-bottom: 16px; font-size: 14px; }
.preview-bar a { color: var(--ink); font-weight: 800; margin-left: 8px; }

/* ======================================================================
   v2: admin
   ====================================================================== */
.admin-body { background: #eef3f0; }
.admin-body .login .display, .admin-body .error .display { color: var(--green); }
.side {
  position: fixed; inset: 0 auto 0 0; width: 250px;
  background: var(--green); color: #fff;
  display: flex; flex-direction: column; padding: 18px 14px; z-index: 30;
}
.side .brand { margin: 0 6px 22px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a { color: rgba(255, 255, 255, .85); text-decoration: none; font-weight: 700; font-size: 14.5px; padding: 10px 12px; border-radius: 12px; }
.side-nav a:hover { background: rgba(255, 255, 255, .08); }
.side-nav a.on { background: var(--yellow); color: var(--ink); }
.side-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 6px 0; border-top: 1px solid rgba(255, 255, 255, .15); }
.side-foot .me { color: #fff; text-decoration: none; display: flex; flex-direction: column; font-size: 14px; }
.side-foot .me small { color: rgba(255, 255, 255, .6); font-size: 12px; }
.admin-top { display: none; }
.admin-main { margin-left: 250px; padding: 26px 30px 80px; max-width: 1180px; }
.admin-main.wide { max-width: 1300px; }
.admin-main .card { box-shadow: 0 2px 10px rgba(3, 87, 58, .07); }
.admin-h1 { font-weight: 900; text-transform: uppercase; font-size: 26px; margin: 0 0 6px; color: var(--ink); display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.admin-body .lead { color: var(--muted); margin-bottom: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.card h3 { font-size: 14px; text-transform: uppercase; font-weight: 900; margin: 20px 0 8px; }
.narrow-card { max-width: 520px; }
.muted-card { opacity: .6; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.two-col .card { margin-bottom: 0; }
.two-col + .two-col, .two-col + .card { margin-top: 20px; }
.id-chip { font-size: 12px; font-weight: 800; background: var(--paper-soft); color: var(--muted); padding: 3px 9px; border-radius: 8px; text-transform: none; }
.status { font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 8px; text-transform: uppercase; }
.status.ok { background: #e8f6ee; color: var(--green); }
.status.off { background: #fff2f0; color: var(--red); }
.facts { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 0; font-size: 14.5px; }
.facts dt { color: var(--muted); font-weight: 700; }
.facts dd { margin: 0; }
.code.reveal { cursor: pointer; border-bottom: 1px dashed var(--muted); }
.danger-zone { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 8px; }
.filters input[name=q] { flex: 1 1 260px; }
.click-row { cursor: pointer; }
.click-row:hover td { background: var(--paper-soft); }
.paging { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.paging a { padding: 6px 12px; border-radius: 10px; background: var(--paper-soft); color: var(--ink); text-decoration: none; font-weight: 700; font-size: 13px; }
.paging a.on { background: var(--green); color: #fff; }
.progress-list li { font-size: 14px; padding: 4px 0; color: var(--muted); }
.progress-list li.done { color: var(--ink); }
.progress-list li span:first-child { display: inline-block; width: 18px; color: var(--green); font-weight: 900; }
.notes li { border-top: 1px solid var(--line); padding: 10px 0; }
.log li { font-size: 14px; border-top: 1px solid var(--line); }

.page-rows { list-style: none; padding: 0; margin: 0; }
.page-rows li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.page-rows li.hidden-page .page-link { opacity: .55; }
.page-link { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; }
.page-link:hover b { color: var(--green); text-decoration: underline; }
.row-actions { display: flex; gap: 6px; flex: none; }
.pill.sm { font-size: 11px; padding: 2px 8px; border-radius: 8px; }
.section-name { font-weight: 900; text-transform: uppercase; font-size: 15px; }

/* editor */
.editor .card { margin-bottom: 16px; }
.big-check { align-self: center; }
.cover-edit { display: grid; grid-template-columns: 320px 1fr; gap: 20px; align-items: center; }
.cover-preview { pointer-events: none; }
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.toolbar button, .upload-btn {
  font: inherit; font-size: 13px; font-weight: 700; color: var(--ink);
  background: var(--paper-soft); border: 1px solid var(--line); border-radius: 10px;
  padding: 6px 12px; cursor: pointer; flex-direction: row;
}
.toolbar button:hover, .upload-btn:hover { border-color: var(--green); }
.help-link { margin-left: auto; align-self: center; font-size: 13px; font-weight: 700; }
.md-input { width: 100%; min-height: 520px; font: 14.5px/1.6 ui-monospace, Menlo, monospace; resize: vertical; }
.preview-pane { min-height: 520px; border: 2px dashed var(--line); border-radius: 12px; padding: 20px; }
.tabs { display: flex; background: var(--paper-soft); border-radius: 12px; padding: 4px; }
.tab { font: inherit; font-weight: 800; font-size: 13px; border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; cursor: pointer; color: var(--muted); }
.tab.on { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, .08); }
.md-help { margin-top: 12px; font-size: 14px; }
.md-help summary { cursor: pointer; font-weight: 700; color: var(--green); }
.sticky-save {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  background: var(--green); padding: 12px 16px; border-radius: 16px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, .12);
}
.save-meta { color: rgba(255, 255, 255, .7); }

@media (max-width: 900px) {
  .side { transform: translateX(-100%); transition: transform .2s; }
  .menu-toggle:checked ~ .side { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }
  .admin-top { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 20; background: var(--green); color: #fff; padding: 12px 16px; }
  .burger { font-size: 22px; cursor: pointer; color: #fff; }
  .admin-title { font-weight: 900; text-transform: uppercase; font-size: 14px; }
  .admin-main { margin-left: 0; padding: 18px 14px 80px; }
  .two-col, .dash-row, .cover-edit { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 110px 1fr; }
}
@media (max-width: 600px) {
  .topnav a { padding: 6px 8px; font-size: 13px; }
  .top { flex-wrap: wrap; }
}
@media (max-width: 600px) {
  .stat-row { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat { padding: 12px; }
  .stat b { font-size: 18px; }
  .stat small { font-size: 10px; }
  .continue b { font-size: 16px; }
}

/* in-page confirm dialog (native confirm() is blocked in Telegram / embedded browsers) */
.dialog-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(2, 30, 20, .55);
  display: grid; place-items: center; padding: 20px;
  animation: fade-in .12s ease-out;
}
.dialog {
  width: min(400px, 100%);
  background: var(--paper); color: var(--ink);
  border-radius: var(--radius); padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
.dialog p { margin: 0 0 20px; font-weight: 700; font-size: 17px; line-height: 1.4; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.btn.danger-solid { background: var(--red); color: #fff; }
.btn.danger-solid:hover { background: #a3361f; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---- audit round 2 ---- */
.prose.wm { background-repeat: repeat; background-size: 360px 220px; }
.toc { background: var(--paper-soft); border-radius: 12px; padding: 14px 18px; margin: 0 0 22px; font-size: 14.5px; }
.toc-title { font-weight: 900; text-transform: uppercase; font-size: 12px; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
.toc ol { margin: 0; padding-left: 20px; }
.toc li { margin: 3px 0; }
.toc a { color: var(--green); text-decoration: none; font-weight: 600; }
.toc a:hover { text-decoration: underline; }
.funnel li { display: grid; grid-template-columns: minmax(140px, 1fr) 2fr 40px; gap: 12px; align-items: center; font-size: 14px; padding: 5px 0; }
.funnel-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.funnel-bar { height: 12px; background: var(--paper-soft); border-radius: 99px; overflow: hidden; }
.funnel-bar .bar { display: block; height: 100%; background: var(--green); border-radius: 99px; }
.funnel b { text-align: right; }
.sessions { margin: 10px 0 0; font-size: 14px; }
.sessions summary { cursor: pointer; font-weight: 700; color: var(--green); }
.draft-banner { background: #fff8e6; border: 1px solid var(--yellow); border-radius: 12px; padding: 10px 14px; margin-bottom: 10px; font-size: 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
@media (max-width: 600px) { .funnel li { grid-template-columns: 1fr 1.2fr 34px; gap: 8px; } }

/* ---- round 3: tiles that stand out from the page, reading theme, checklists, feedback, reminders ---- */
body { background: var(--green-deep); }
.top { background: transparent; }
.tile { border: 2px solid rgba(252, 194, 63, .35); background: var(--green); }
.tile:hover { border-color: var(--yellow); box-shadow: 0 14px 34px rgba(0, 0, 0, .3), 0 0 0 4px rgba(252, 194, 63, .15); }
.tile .gen-cover { background: var(--green); }
.tile .minutes, .page-hero .minutes { position: absolute; left: 12px; bottom: 10px; z-index: 2; font-size: 11px; font-weight: 800; background: rgba(0, 0, 0, .35); color: #fff; padding: 3px 8px; border-radius: 8px; }
.page-hero { position: relative; border: 2px solid rgba(252, 194, 63, .35); }
.continue, .mini-stat { border: 2px solid transparent; }
.mini-stat { background: var(--green); border-color: rgba(252, 194, 63, .35); }
.continue.done { background: var(--green); border-color: rgba(252, 194, 63, .35); }
.news-item { border: 2px solid transparent; }
.section-title { margin-top: 38px; }

.theme-toggle { font-size: 16px; padding: 6px 10px; }
.theme-dark .card.prose, .theme-dark .news-item, .theme-dark .toc { background: #0f2e22; color: #e6efe9; }
.theme-dark .card.prose h2, .theme-dark .toc a { color: var(--yellow); }
.theme-dark .prose th { background: #1b4a37; }
.theme-dark .prose tr:nth-child(even) td { background: #123527; }
.theme-dark .prose td { border-color: #1f4a39; }
.theme-dark .prose blockquote { background: #2a2a12; color: #f1e9c8; }
.theme-dark .prose code, .theme-dark .prose pre { background: #0a2219; color: #e6efe9; }
.theme-dark .prose a { color: #ffd77a; }
.theme-dark .checked { background: #163d2d; color: #9fe3bf; }
.theme-dark .prose.wm { background-image: none !important; }
.theme-dark .toc-title { color: #9fb8aa; }

.prose li.check { cursor: pointer; user-select: none; padding: 4px 8px; margin-left: -1.6em; border-radius: 8px; }
.prose li.check:hover { background: rgba(252, 194, 63, .15); }
.prose li.check.on { color: var(--muted); text-decoration: line-through; }
.theme-dark .prose li.check.on { color: #8fa89b; }

.feedback { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: center; margin: -8px 0 22px; color: rgba(255, 255, 255, .85); font-weight: 700; }
.feedback .btn.ghost { color: #fff; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .45); }

.reminders { display: flex; flex-direction: column; gap: 8px; }
.reminder { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; background: var(--paper); color: var(--ink); text-decoration: none; border-radius: 12px; padding: 12px 16px; border-left: 6px solid var(--yellow); }
.reminder.overdue { border-left-color: var(--red); }
.reminder b { color: var(--green); }
.reminder.overdue b { color: var(--red); }

.msg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.msg-grid textarea { margin-bottom: 6px; }
.version-row { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--line); padding: 8px 0; font-size: 14px; }
.steps { padding-left: 20px; }
.steps li { margin: 6px 0; }
.qr { background: #fff; display: inline-block; padding: 8px; border-radius: 12px; border: 1px solid var(--line); margin: 10px 0; }
.qr svg { width: 220px; height: 220px; display: block; }
.funnel li { grid-template-columns: minmax(140px, 1fr) 2fr 40px 90px; }
@media (max-width: 600px) { .funnel li { grid-template-columns: 1fr 1.2fr 34px; } .funnel .fb { display: none; } }

/* ---- dark theme: whole student UI, not only the lesson text ---- */
.theme-dark { background: #07160f; }
.theme-dark .card, .theme-dark .stat, .theme-dark .reminder, .theme-dark .news-item { background: #0f2e22; color: #e6efe9; }
.theme-dark .card h1, .theme-dark .card h2, .theme-dark .stat b, .theme-dark .reminder b { color: var(--yellow); }
.theme-dark .muted, .theme-dark .stat small, .theme-dark .stat span, .theme-dark .news-meta { color: #9fb8aa; }
.theme-dark .tile { background: #0f2e22; border-color: rgba(252, 194, 63, .45); }
.theme-dark .tile .gen-cover { background: #0f2e22; }
.theme-dark .continue { background: var(--yellow); }
.theme-dark .mini-stat, .theme-dark .continue.done { background: #0f2e22; }
.theme-dark .pager a { background: #0f2e22; }
.theme-dark input, .theme-dark select, .theme-dark textarea { background: #0a2219; color: #e6efe9; border-color: #1f4a39; }
.theme-dark .tracker-item { background: #123527; color: #e6efe9; }
.theme-dark .tracker-item:hover { background: #174130; }
.theme-dark .tracker-item .money b { color: var(--yellow); }
.theme-dark .reminder.overdue b { color: #ff8a73; }
.theme-dark .progress { background: rgba(255, 255, 255, .1); }
.theme-dark .dialog { background: #0f2e22; color: #e6efe9; }
.theme-dark .btn.ghost { color: var(--yellow); box-shadow: inset 0 0 0 2px var(--yellow); }
.theme-dark .login .card { background: #0f2e22; }
