:root {
  --blue: #1857A6;
  --orange: #EE6C32;
  --yellow: #F4C21F;
  --text: #1f2937;
  --muted: #4b5563;
  --bg: #fff;
  --soft: #f6f8fc;
  --line: #e5e7eb;
  --green: #15803d;
  --red: #b91c1c;
  --radius: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
a { color: var(--blue); }
h1, h2, h3 { line-height: 1.3; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }

.logo { font-weight: 800; font-size: 22px; letter-spacing: .5px; }
.logo .my { color: var(--blue); }
.logo .rb { color: var(--orange); }

.topbar { display: flex; align-items: center; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; z-index: 10; }
.topbar .who { margin-left: auto; color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 18px; border-radius: 99px; border: 1px solid var(--line); background: #fff; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-accent { background: var(--orange); border-color: var(--orange); color: #fff; font-size: 18px; font-weight: 700; }
.btn-small { min-height: 36px; padding: 4px 12px; font-size: 14px; }

.tabs { display: flex; gap: 8px; margin: 16px 0; border-bottom: 2px solid var(--line); }
.tabs a { padding: 10px 16px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs a.active { color: var(--blue); border-color: var(--yellow); }

.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: #fff; margin-bottom: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 14px; color: var(--muted); font-weight: 600; }
.field input, .field textarea, .field select, input.search { font: inherit; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 8px; min-height: 44px; }
.field textarea { min-height: 100px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.checks { display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.checks label { display: flex; gap: 8px; align-items: center; min-height: 36px; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: 14px; color: var(--muted); }
.scroll-x { overflow-x: auto; }

.badge-done { color: var(--green); font-weight: 600; }
.badge-pending { color: var(--muted); }
.tag { display: inline-block; padding: 2px 10px; border-radius: 99px; background: #fff4cc; color: #6b4e00; font-size: 13px; font-weight: 600; }
.error { color: var(--red); min-height: 1.6em; }
.muted { color: var(--muted); }

dialog { border: none; border-radius: var(--radius); padding: 20px; width: min(560px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(15, 23, 42, .45); }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; background: var(--soft); padding: 16px; }
.login .card { width: min(380px, 100%); text-align: center; padding: 32px 24px; }
.login .logo { font-size: 34px; margin-bottom: 8px; }
.login .btn { width: 100%; }

/* Logo image (login + top bar) */
.logo-img { display: block; height: 36px; width: auto; }
.login .logo-img { width: min(260px, 100%); height: auto; margin: 0 auto 4px; }

/* Course picker (student form) */
.picker { border: 1px solid #cbd5e1; border-radius: 8px; }
.picker summary { list-style: none; cursor: pointer; padding: 10px 12px; min-height: 44px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.picker summary::-webkit-details-marker { display: none; }
.picker summary::after { content: "▾"; margin-left: auto; color: var(--muted); }
.picker[open] summary::after { content: "▴"; }
.picker-panel { border-top: 1px solid var(--line); padding: 8px; display: grid; gap: 8px; }
.picker .checks { border: 0; padding: 0; max-height: 220px; }

/* Photo list in block editor */
.gallery { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.gallery figure { margin: 0; width: 140px; border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.gallery img { width: 100%; height: 100px; object-fit: cover; border-radius: 6px; display: block; background: var(--soft); }
.gallery figcaption { gap: 4px; margin-top: 6px; justify-content: space-between; }
.gallery .btn-small { min-height: 32px; padding: 2px 8px; }

/* Lesson page: white base + scattered Myrobolab shapes (logo arcs, rings, dots) */
.lesson { --navy: #1b2f6b; position: relative; overflow: hidden; isolation: isolate; }
.lesson section { position: relative; padding: 40px 16px; }
.lesson section > .inner { max-width: 820px; margin: 0 auto; }
.lesson h1, .lesson h2, .lesson .num, .lesson .pill { font-family: "Baloo 2", system-ui, "Microsoft YaHei", sans-serif; }

.lesson .hero { text-align: center; padding: 64px 16px 32px; }
.lesson .hero h1 { color: var(--navy); font-size: clamp(30px, 5vw, 48px); margin: 12px 0 8px; line-height: 1.15; }
.lesson .hero h1::after { content: ""; display: block; width: 120px; height: 10px; margin: 14px auto 0; border-radius: 99px;
  background: linear-gradient(90deg, var(--yellow) 0 33%, var(--orange) 33% 66%, var(--blue) 66%); }
.lesson .hero .body { color: var(--muted); max-width: 640px; margin: 0 auto; }
.lesson .pill { display: inline-block; background: var(--navy); color: #fff; font-weight: 700; letter-spacing: 2px; padding: 4px 16px; border-radius: 99px; font-size: 14px; }

.lesson .sec-head { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.lesson .num { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: var(--blue); color: #fff; font-size: 22px; font-weight: 800; box-shadow: 4px 4px 0 var(--yellow); }
.lesson .kicker { display: block; color: var(--orange); font-weight: 700; font-size: 14px; letter-spacing: 1px; }
.lesson .sec-head h2 { margin: 0; color: var(--navy); font-size: clamp(22px, 3.2vw, 30px); }
.lesson .body { white-space: pre-wrap; font-size: 18px; }

/* Photos and video: straight and centred, one per row for easy reading */
.lesson .photos { display: flex; flex-direction: column; align-items: center; gap: 24px; margin-top: 20px; }
.lesson .photo { margin: 0; width: 100%; max-width: 720px; background: #fff; padding: 8px; border-radius: 10px; box-shadow: 0 6px 20px rgba(27, 47, 107, .12); }
.lesson .photo img { width: 100%; display: block; border-radius: 6px; margin: 0; }

.lesson .frame { max-width: 820px; margin: 0 auto; border-radius: var(--radius); box-shadow: 0 6px 20px rgba(27, 47, 107, .15); overflow: hidden; }
.lesson .frame video { width: 100%; display: block; }
.lesson .video .body { margin-top: 20px; }
.lesson .pdf { text-align: center; }
.lesson .btn-accent { min-height: 56px; padding: 12px 32px; box-shadow: 0 6px 0 #c4501d; }
.lesson .done .inner { text-align: center; border: 3px dashed #86c99b; border-radius: 20px; padding: 28px 16px; background: rgba(255, 255, 255, .85); }
.ratio { position: relative; padding-top: 56.25%; }
.ratio iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.lesson { background: #fff; }

/* Admin: left sidebar navigation */
.admin-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); min-height: calc(100vh - 57px); }
.sidenav { background: var(--soft); border-right: 1px solid var(--line); padding: 16px 10px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 57px; align-self: start; height: calc(100vh - 57px); }
.sidenav a { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 600; min-height: 44px; }
.sidenav a:hover { background: #e8eef8; }
.sidenav a.active { background: var(--blue); color: #fff; }
.admin-main { padding: 20px 24px; min-width: 0; }
@media (max-width: 760px) {
  .admin-layout { grid-template-columns: 1fr; }
  .sidenav { position: static; height: auto; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; }
  .sidenav a { white-space: nowrap; }
  .admin-main { padding: 16px; }
}

/* Attendance strip, calendar, progress bar */
.att-strip { position: relative; display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; }
.att-cell { flex: none; width: 96px; border: 1px solid var(--line); border-radius: 10px; padding: 8px; text-align: center; background: #fff; }
.att-cell .d { font-weight: 700; }
.att-cell .w { font-size: 12px; color: var(--muted); }
.att-cell select { width: 100%; margin-top: 6px; font: inherit; font-size: 13px; padding: 4px; border-radius: 6px; border: 1px solid #cbd5e1; min-height: 32px; }
.st { display: inline-block; margin-top: 6px; padding: 2px 10px; border-radius: 99px; font-size: 13px; font-weight: 700; }
.st-present { background: #dcfce7; color: #166534; }
.st-absent { background: #fee2e2; color: #991b1b; }
.st-pending { background: #fff4cc; color: #6b4e00; }
.st-upcoming { background: var(--soft); color: var(--muted); }
.st-manual::after { content: " ✎"; }

.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal .hd { text-align: center; font-size: 13px; color: var(--muted); font-weight: 600; padding: 4px 0; }
.cal a.day { min-height: 84px; border: 1px solid var(--line); border-radius: 10px; padding: 6px; text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: 4px; background: #fff; }
.cal a.day:hover { border-color: var(--blue); }
.cal .day.out { opacity: .4; }
.cal .day.today { border: 2px solid var(--orange); }
.cal .day .n { font-weight: 700; }
.cal .mark { font-size: 12px; background: #e8eef8; color: var(--blue); border-radius: 6px; padding: 2px 6px; font-weight: 600; }
@media (max-width: 600px) { .cal a.day { min-height: 60px; } .cal .mark { font-size: 11px; padding: 1px 3px; } }

.bar { height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--orange)); border-radius: 99px; }

/* Lesson as one PDF: pages full width, stacked with no gaps or frames */
.lesson .pdf-pages { max-width: 1600px; margin: 0 auto; background: #fff; }
.lesson .pdf-page { width: 100%; line-height: 0; }
.lesson .pdf-page canvas { display: block; width: 100%; height: 100%; }
