/* Teacher site. Light theme only; every colour is a token here (workbench.css uses them too). */
:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --line: #dcdfe4;
  --text: #1f2329;
  --muted: #646a73;
  --faint: #a1a6ae;
  --accent: #1764d8;
  --accent-hover: #0f52b8;
  --accent-bg: #e8f0fd;
  --ok: #1f7a38;
  --ok-bg: #e6f6ea;
  --warn: #9a5b00;
  --warn-line: #f0a020;
  --warn-bg: #fff4dc;
  --bad: #c62828;
  --bad-bg: #fdeaea;
  --star: #e0a100;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { font-size: 14px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.55rem; margin: 0 0 14px; }
h2 { font-size: 1.2rem; margin: 0 0 10px; }
h3 { font-size: 1.05rem; margin: 0 0 8px; }
p { margin: 0 0 8px; }
code, kbd { font-family: ui-monospace, Menlo, Consolas, monospace; }

/* Top bar */
.topbar { display: flex; align-items: center; gap: 24px; padding: 0 24px; height: 52px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.nav { display: flex; gap: 4px; }
.nav a { padding: 6px 12px; border-radius: 6px; color: var(--muted); }
.nav a.on { color: var(--accent); background: var(--accent-bg); font-weight: 600; }
.nav a:hover { text-decoration: none; color: var(--text); }
.menu { margin-left: auto; position: relative; }
.menu summary { cursor: pointer; list-style: none; color: var(--muted); padding: 6px 8px; }
.menu summary::-webkit-details-marker { display: none; }
.menu-items { position: absolute; right: 0; top: 36px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.08); min-width: 140px; padding: 6px 0; }
.menu-items a, .menu-items button { display: block; width: 100%; text-align: left; padding: 7px 14px; background: none; border: 0; font: inherit; color: var(--text); cursor: pointer; }
.menu-items a:hover, .menu-items button:hover { background: var(--bg); text-decoration: none; }

/* Page */
.page { max-width: 1180px; margin: 0 auto; padding: 22px 24px 60px; }
.narrow { max-width: 440px; margin: 40px auto; }
.crumbs { color: var(--muted); font-size: 0.9rem; margin-bottom: 6px; }
.crumbs a { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.hint { color: var(--muted); font-size: 0.9rem; }
.section-title { color: var(--muted); font-size: 0.9rem; margin: 18px 0 6px; }
.empty { color: var(--muted); text-align: center; padding: 28px; }

/* Messages */
.messages { list-style: none; margin: 0 0 14px; padding: 0; }
.message { padding: 9px 14px; border-radius: 8px; margin-bottom: 6px; background: var(--accent-bg); }
.message-success { background: var(--ok-bg); color: var(--ok); }
.message-error { background: var(--bad-bg); color: var(--bad); }
.message-warning { background: var(--warn-bg); color: var(--warn); }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; }
.card.login h1 { font-size: 1.3rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 4px; padding: 6px 13px; border-radius: 7px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { border-color: transparent; background: none; color: var(--accent); }
.btn-small { padding: 3px 9px; font-size: 0.9rem; }
.btn-danger { color: var(--bad); }
.btn:disabled, .btn.disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.wide { width: 100%; justify-content: center; margin-top: 14px; }
form.inline { display: inline; margin: 0; }

/* Forms */
label { display: block; font-size: 0.9rem; color: var(--muted); margin: 12px 0 4px; }
input[type=text], input[type=password], input[type=number], input[type=date], input:not([type]), select, textarea {
  width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; font: inherit; background: var(--card); color: var(--text);
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-bg); border-color: var(--accent); }
.field-error { color: var(--bad); font-size: 0.9rem; margin: 4px 0 0; }
.form-actions { margin-top: 16px; display: flex; gap: 8px; justify-content: flex-end; }
ul.checks { list-style: none; margin: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; }
ul.checks label { display: flex; gap: 8px; align-items: center; color: var(--text); margin: 4px 0; font-size: 1rem; }

/* Chips, tags, tabs */
.chip { display: inline-block; padding: 3px 11px; border-radius: 14px; border: 1px solid var(--line); color: var(--muted); background: var(--card); }
.chip:hover { text-decoration: none; border-color: var(--accent); }
.chip-on { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.tag { display: inline-block; font-size: 0.8rem; padding: 1px 8px; border-radius: 10px; background: var(--bg); color: var(--muted); }
.tag-ok { background: var(--ok-bg); color: var(--ok); }
.tag-warn { background: var(--warn-bg); color: var(--warn); }
.tag-accent { background: var(--accent-bg); color: var(--accent); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 16px 0 14px; }
.tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--text); }

/* Progress bar */
.bar { flex: 1; min-width: 80px; height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--ok); }

/* Tables */
.table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; font-size: 0.9rem; background: #fafbfc; }
.table tr:last-child td { border-bottom: 0; }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.bad { color: var(--bad); }
.stars { color: var(--star); letter-spacing: 1px; }

/* Row menus (···) */
details.more { position: relative; display: inline-block; }
details.more summary { list-style: none; cursor: pointer; color: var(--muted); padding: 2px 8px; border-radius: 6px; }
details.more summary::-webkit-details-marker { display: none; }
details.more[open] summary { background: var(--bg); }
details.more .more-items { position: absolute; right: 0; z-index: 5; background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.08); min-width: 200px; padding: 6px 0; }
details.more .more-items a, details.more .more-items button { display: block; width: 100%; text-align: left; padding: 7px 14px; background: none; border: 0; font: inherit; color: var(--text); cursor: pointer; }
details.more .more-items a:hover, details.more .more-items button:hover { background: var(--bg); text-decoration: none; }

@media print {
  .topbar, .crumbs, .messages, [data-print], .no-print { display: none !important; }
  body { background: #fff; }
  .page { padding: 0; }
}

/* Home */
.class-card .class-name { font-size: 1.2rem; font-weight: 700; color: var(--text); }
.class-card p { margin: 6px 0 0; }
.code { font-weight: 700; font-size: 1.05rem; letter-spacing: 2px; background: var(--bg); padding: 2px 8px; border-radius: 5px; }
.homework-line { margin: 12px 0; padding: 9px 12px; background: var(--bg); border-radius: 8px; }
.homework-line .bar { background: var(--card); }

/* Class page */
.class-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.class-head h1 { margin-bottom: 2px; }
.code-box { margin-left: auto; display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; }
.code-box small { display: block; color: var(--muted); font-size: 0.8rem; }
.code-box kbd { font-size: 1.35rem; font-weight: 700; letter-spacing: 3px; }
.hw-card p { margin: 4px 0 8px; }

/* Students tab */
details.add-students > summary { list-style: none; }
details.add-students > summary::-webkit-details-marker { display: none; }
details.add-students[open] { flex-basis: 100%; }
.add-card { margin-top: 10px; max-width: 560px; }
.roster { margin-top: 12px; }
.roster td.actions { text-align: right; width: 60px; }
tr.faint td { color: var(--faint); }

/* Parent notice (prints on one A4 page) */
.notice { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 36px 44px; max-width: 760px; margin: 12px auto; font-size: 1.15rem; }
.notice h1 { font-size: 1.7rem; text-align: center; margin-bottom: 20px; }
.notice-steps { padding-left: 1.4em; line-height: 2.4; }
.notice-code { display: inline-block; font: 700 2rem/1.2 ui-monospace, Menlo, Consolas, monospace; letter-spacing: 6px; border: 2px solid var(--text); border-radius: 8px; padding: 4px 14px; margin-left: 6px; vertical-align: middle; }
.notice-actions { max-width: 760px; margin: 0 auto; }
@media print { .notice { border: 0; margin: 0; max-width: none; } }

/* Library and preview */
.chips { margin: 4px 0 6px; }
.unit { margin-top: 18px; }
.unit h2 small { font-weight: 400; font-size: 0.9rem; margin-left: 8px; }
.unit-empty { margin: 0 0 8px; }
.lesson-card { display: grid; grid-template-columns: 84px 1fr auto; gap: 14px; align-items: center; padding: 12px 14px; }
.thumb { width: 84px; height: 63px; border-radius: 7px; object-fit: cover; background: var(--bg); display: block; }
.thumb-empty { background: repeating-linear-gradient(45deg, var(--bg) 0 7px, var(--card) 7px 14px); border: 1px solid var(--line); }
.lesson-title { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.lesson-info p { margin: 2px 0 0; }
.lesson-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.switch { display: inline-flex; align-items: center; gap: 7px; background: none; border: 0; font: inherit; color: var(--muted); cursor: pointer; padding: 2px 0; }
.switch i { width: 34px; height: 19px; border-radius: 10px; background: var(--line); position: relative; display: inline-block; transition: background .15s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: left .15s; }
.switch-on { color: var(--ok); }
.switch-on i { background: var(--ok); }
.switch-on i::after { left: 17px; }
.switch-static { cursor: default; }
.preview-page { display: grid; grid-template-columns: 360px 1fr; gap: 18px; align-items: start; }
.preview-img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: var(--bg); }
.preview-sentence { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; font-size: 1.15rem; }
.preview-sentence audio { height: 32px; max-width: 320px; }
.quiz-options { margin-top: 8px; }
.quiz-option { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; }
.quiz-option img { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; }
.quiz-correct { border-color: var(--ok); color: var(--ok); }

/* Assign dialog */
.dialog-page { display: flex; justify-content: center; padding-top: 20px; }
.dialog { width: 460px; box-shadow: 0 12px 36px rgba(0,0,0,.12); padding: 22px 24px; }
.dialog h1 { font-size: 1.3rem; }
.fixed-box { padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); }
.dates { display: flex; gap: 12px; }
.dates > div { flex: 1; }

/* Results */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 14px 0; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.tile small { display: block; color: var(--muted); font-size: 0.85rem; }
.tile-main { font-size: 1.1rem; }
.tile-main b { font-size: 1.4rem; }
.results-cols { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
.word-bar { display: grid; grid-template-columns: 90px 1fr 28px; gap: 8px; align-items: center; padding: 4px 0; }
.bar-red > i { background: var(--bad); opacity: .75; }

/* One child's reads */
.child-rows { padding: 4px 16px; }
.child-row { display: grid; grid-template-columns: 24px 1fr auto 260px; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.child-row:last-child { border-bottom: 0; }
.child-row .n { color: var(--faint); }
.child-row .t { font-size: 1.15rem; }
.child-row .meta { font-size: 0.9rem; color: var(--muted); white-space: nowrap; }
.child-row audio { height: 32px; width: 260px; }
.w-red { color: var(--bad); text-decoration: underline wavy var(--bad); text-underline-offset: 4px; }
.w-yellow { color: var(--warn); }

/* Drafts */
.wide-narrow { max-width: 560px; }
.draft-card .lesson-title { font-size: 1.05rem; }
