:root {
  --ink: #1c2430;
  --muted: #5b6573;
  --paper: #f7f1e6;
  --card: #fffdf8;
  --line: #e6dccb;
  --a: #e06a4a;
  --b: #2f8f6b;
  --c: #2b6cb0;
  --d: #c9891a;
  --rule: #1c2430;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Be Vietnam Pro", "Times New Roman", "Segoe UI", serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
  font-size: 15px;
}
a { color: inherit; }
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar-inner {
  width: min(900px, calc(100% - 32px));
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  font-family: "Be Vietnam Pro", sans-serif;
  font-size: 13px;
  font-weight: 600;
}
.topbar a { text-decoration: none; color: #5b5346; }
.topbar a:hover { text-decoration: underline; }
.wrap {
  width: min(900px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 72px;
}
.doc {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(48, 36, 20, 0.08);
  padding: 36px 40px 48px;
}
.official {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
  font-size: 13.5px;
}
.left .school { font-weight: 700; text-transform: uppercase; }
.right { text-align: right; }
.doc-title {
  text-align: center;
  font-family: "Be Vietnam Pro", sans-serif;
  font-size: 22px;
  font-weight: 800;
  margin: 8px 0 4px;
}
.lesson-name {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 10px;
}
.meta-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 20px;
  font-size: 14px;
}
.meta-table th, .meta-table td {
  border: 1px solid var(--line);
  padding: 7px 10px;
  text-align: left;
  vertical-align: top;
}
.meta-table th { width: 28%; background: #f3eee4; font-weight: 600; }
.chip {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  margin-right: 4px;
  font-family: "Be Vietnam Pro", sans-serif;
}
.chip.a { background: #fde8e1; color: #9a3a22; }
.chip.b { background: #e3f4eb; color: #1d6a4d; }
.chip.c { background: #e4eefb; color: #1d4e89; }
.chip.d { background: #f8ecd2; color: #8a5d0c; }
.chip.mr { background: #fff1c9; color: #7a5408; }
.chip.gray { background: #eee8dc; color: #5b5346; }
h2 {
  font-family: "Be Vietnam Pro", sans-serif;
  font-size: 17px;
  margin: 22px 0 10px;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--rule);
}
h3 {
  font-family: "Be Vietnam Pro", sans-serif;
  font-size: 15.5px;
  margin: 16px 0 8px;
  color: #2a3340;
}
h4 { font-size: 14.5px; margin: 10px 0 6px; }
p, li { margin-bottom: 6px; }
ul, ol { padding-left: 22px; margin-bottom: 8px; }
.sub { font-weight: 700; margin-top: 8px; }
.act {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 12px 14px 10px;
  margin: 12px 0 16px;
  background: #fff;
}
.act-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 8px;
}
.time {
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  color: var(--muted);
  font-family: "Be Vietnam Pro", sans-serif;
}
.steps { margin-top: 6px; }
.steps dt {
  font-weight: 700;
  margin-top: 8px;
}
.steps dd { margin-left: 0; }
.note {
  background: #fff8e8;
  border: 1px dashed #d9c9a8;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  margin: 10px 0;
}
.sign {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 28px;
  text-align: center;
  font-size: 14px;
}
.sign .muted { color: var(--muted); font-style: italic; margin-bottom: 4px; }

@page {
  size: A4 portrait;
  margin: 14mm 14mm 16mm 14mm;
}

@media print {
  * {
    background: #fff !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  html, body {
    background: #fff !important;
    color: #000 !important;
    font-size: 11pt;
    line-height: 1.4;
    width: auto;
  }
  .topbar { display: none !important; }
  .wrap {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
  }
  .doc {
    border: none !important;
    border-radius: 0;
    box-shadow: none !important;
    padding: 0;
    background: #fff !important;
  }
  .doc-title { font-size: 16pt; }
  .lesson-name { font-size: 13pt; }
  h2 {
    font-size: 12pt;
    border-bottom: 1.5pt solid #000 !important;
    break-after: avoid;
    page-break-after: avoid;
  }
  h3 {
    font-size: 11pt;
    break-after: avoid;
    page-break-after: avoid;
  }
  .meta-table { font-size: 10.5pt; }
  .meta-table th,
  .meta-table td {
    background: #fff !important;
    color: #000 !important;
    border: 1px solid #000 !important;
  }
  .chip,
  .chip.a, .chip.b, .chip.c, .chip.d, .chip.mr {
    background: #fff !important;
    color: #000 !important;
    border: 1px solid #000 !important;
    border-radius: 2px;
  }
  .act {
    background: #fff !important;
    color: #000 !important;
    border: 1px dashed #000 !important;
    break-inside: auto;
    page-break-inside: auto;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
  }
  .act-head {
    display: block;
    break-inside: avoid;
    page-break-inside: avoid;
    break-after: avoid;
    page-break-after: avoid;
  }
  .act-head .time { float: right; }
  .act-head::after {
    content: "";
    display: table;
    clear: both;
  }
  .sub, dt {
    break-after: avoid;
    page-break-after: avoid;
  }
  p, li, dd {
    orphans: 3;
    widows: 3;
  }
  .note {
    background: #fff !important;
    color: #000 !important;
    border: 1px dashed #000 !important;
    border-radius: 0;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .sign {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  a { color: #000 !important; text-decoration: none; }
}
@media (max-width: 700px) {
  .doc { padding: 20px 16px 32px; }
  .official, .sign { grid-template-columns: 1fr; }
  .right { text-align: left; }
}
