/* Trang tra cứu thời khóa biểu (v5.0): ưu tiên điện thoại, đọc rõ, không cuộn ngang */
:root {
  --bg: #f4f5f8; --card: #fff; --ink: #18202f; --muted: #5b6577; --line: #dfe3ea;
  --brand: #1d3f8f; --brand-ink: #fff; --accent: #2557c7;
  --orange: #b54708; --orange-bg: #fff4e5; --red: #b42318; --red-bg: #fdecea;
  --green: #067647; --green-bg: #e7f6ec; --blue: #1849a9; --blue-bg: #eaf1ff;
  --now: #0e7a3c; --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11151c; --card: #1a202a; --ink: #e8ecf3; --muted: #a3adbf; --line: #2c3442;
    --brand: #16316f; --accent: #8fb0ff;
    --orange: #ffb766; --orange-bg: #3a2a14; --red: #ff9a8f; --red-bg: #3b1d1a; --green: #6fd8a0; --green-bg: #15301f;
    --blue: #a9c3ff; --blue-bg: #1b2747; --now: #5ee08f;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif; }
a { color: var(--accent); }
button { font: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: 8px; z-index: 9; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid #f5b400; outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.pad { padding: 16px; }
.center { text-align: center; }

.bar { background: var(--brand); color: var(--brand-ink); padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; max-width: 960px; margin: 0 auto; }
.brand img { height: 36px; width: 36px; object-fit: contain; background: #fff; border-radius: 8px; padding: 2px; }
.brand span { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand b { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small { font-size: 13px; opacity: .85; }
.offline { background: #fef0c7; color: #7a4b00; padding: 8px 16px; text-align: center; font-size: 14px; }

main { max-width: 960px; margin: 0 auto; padding: 12px 16px 24px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.h1 { font-size: 24px; margin: 0 0 10px; }
.h { font-size: 15px; margin: 0 0 8px; color: var(--muted); font-weight: 600; }
.empty { text-align: center; padding: 40px 16px; }
.btn { display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: 10px; padding: 10px 16px; min-height: 44px; text-decoration: none; cursor: pointer; }
.btn.small { min-height: 44px; padding: 6px 12px; margin-top: 6px; font-size: 14px; }

.seg { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; margin: 10px 0 12px; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--ink); padding: 10px 6px; min-height: 44px; border-radius: 9px; cursor: pointer; }
.seg button[aria-selected="true"] { background: var(--accent); color: #fff; font-weight: 600; }
.search input { width: 100%; font-size: 17px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); min-height: 48px; }
.grade h3 { font-size: 14px; color: var(--muted); margin: 16px 0 8px; text-transform: uppercase; letter-spacing: .03em; }
.grid-btn { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.btn-cls { display: flex; align-items: center; justify-content: center; min-height: 52px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: 18px; }
.btn-cls.wide { grid-column: span 2; font-size: 15px; text-align: center; padding: 4px; }
.btn-cls:hover, .btn-cls:focus-visible { border-color: var(--accent); color: var(--accent); }
.plain { list-style: none; margin: 8px 0 0; padding: 0; }
.plain li a { display: block; padding: 12px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 6px 12px; min-height: 44px; text-decoration: none; cursor: pointer; font-size: 15px; display: inline-flex; align-items: center; }
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip.big { min-height: 44px; font-weight: 600; }
.follow { margin-bottom: 8px; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }

.head { display: flex; align-items: flex-start; gap: 10px; justify-content: space-between; }
.titlebox { min-width: 0; }
.head .h1 { margin: 4px 0 2px; }
.acts { display: flex; gap: 6px; flex-shrink: 0; }
.icon { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 56px; min-height: 52px; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); border-radius: 10px; font-size: 20px; cursor: pointer; text-decoration: none; padding: 4px 6px; }
.icon span { font-size: 12px; color: var(--muted); }
.icon.on { color: #c88a00; }

.daynav { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; margin-bottom: 8px; }
.daynav .nav { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; font-size: 30px; text-decoration: none; color: var(--accent); border-radius: 10px; }
.daynav .nav:hover { background: var(--bg); }
.daynav .dl { flex: 1; text-align: center; display: flex; flex-direction: column; }
.daynav .dl b { font-size: 18px; }
.daynav .dl small { color: var(--accent); font-weight: 600; }
.times { display: flex; justify-content: center; gap: 24px; margin: 6px 0 10px; color: var(--muted); }
.times b { color: var(--ink); font-size: 18px; }

.note { border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; border: 1px solid transparent; }
.note ul { margin: 6px 0 0; padding-left: 20px; }
.note.change { background: var(--orange-bg); color: var(--orange); border-color: color-mix(in srgb, var(--orange) 30%, transparent); }
.note.change li { color: var(--ink); }
.note.info { background: var(--blue-bg); color: var(--blue); }
.note.exam { background: var(--red-bg); color: var(--red); }
.offcard { text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 16px; margin-bottom: 12px; }
.offcard .big { font-size: 44px; }
.offcard h2 { margin: 6px 0; font-size: 20px; }

.groups summary { cursor: pointer; font-weight: 600; min-height: 32px; }
.grp { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.grp input { width: 22px; height: 22px; }

.lessons { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.ls, .act { display: flex; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.act { background: transparent; border-style: dashed; }
.tm { width: 62px; flex-shrink: 0; display: flex; flex-direction: column; }
.tm b { font-size: 17px; font-variant-numeric: tabular-nums; }
.tm small { color: var(--muted); font-size: 13px; }
.bd { flex: 1; min-width: 0; border-left: 4px solid var(--c, #c9d3e6); padding-left: 10px; }
.act .bd { border-left-color: var(--line); }
.sj { font-weight: 600; font-size: 17px; }
.mt { color: var(--muted); font-size: 15px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tags:empty { display: none; }
.tag { font-size: 13px; border-radius: 6px; padding: 2px 8px; background: var(--bg); color: var(--muted); font-weight: 600; }
.tag.red { background: var(--red-bg); color: var(--red); }
.tag.orange { background: var(--orange-bg); color: var(--orange); }
.tag.green { background: var(--green-bg); color: var(--green); }
.tag.blue { background: var(--blue-bg); color: var(--blue); }
.tag.now { background: var(--green-bg); color: var(--now); }
.tag.soon { background: var(--blue-bg); color: var(--blue); }
.ls.cur { border: 2px solid var(--now); box-shadow: 0 0 0 3px color-mix(in srgb, var(--now) 15%, transparent); }
.ls.cancel .sj, .ls.cancel .mt { text-decoration: line-through; color: var(--muted); }
.muted-row { opacity: .55; }

/* Cả tuần: bảng trên màn hình rộng, thẻ ngày trên điện thoại */
.week-wide { display: none; overflow-x: auto; }
.wk { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); table-layout: fixed; }
.wk th, .wk td { border: 1px solid var(--line); padding: 4px; vertical-align: top; font-size: 14px; }
.wk thead th { background: var(--bg); font-size: 14px; }
.wk thead th small, .wk tbody th small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.wk tbody th { width: 52px; background: var(--bg); }
.wk .today { background: color-mix(in srgb, var(--accent) 7%, var(--card)); }
.wk thead th.today { color: var(--accent); }
.wk tr.sess th { text-align: left; background: var(--bg); color: var(--muted); font-size: 13px; }
.cell { border-left: 4px solid var(--c); padding: 2px 6px; margin: 2px 0; border-radius: 4px; background: color-mix(in srgb, var(--c) 22%, var(--card)); }
.cell b { display: block; font-size: 14px; }
.cell small { display: block; color: var(--muted); font-size: 12px; }
.cell .t { color: var(--orange); font-weight: 600; }
.cell.cancel b { text-decoration: line-through; }
.daycard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; }
.daycard.today { border-color: var(--accent); }
.daycard h3 { margin: 0 0 6px; font-size: 16px; }
.mini { list-style: none; margin: 0; padding: 0; }
.mini li { display: flex; gap: 8px; align-items: center; padding: 3px 0; }
.mini .n { width: 26px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mini .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.mini li.cancel span:last-child { text-decoration: line-through; color: var(--muted); }
.mini em { color: var(--orange); font-style: normal; font-size: 14px; }
@media (min-width: 760px) { .week-wide { display: block; } .week-narrow { display: none; } }

.info { width: 100%; border-collapse: collapse; }
.info th, .info td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }

.skel div { height: 64px; background: linear-gradient(90deg, var(--line), var(--card), var(--line)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--radius); margin-bottom: 8px; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skel div { animation: none; } }

.foot { max-width: 960px; margin: 0 auto; padding: 0 16px 32px; }
.foot summary { cursor: pointer; color: var(--muted); }
.legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 12px; margin: 8px 0; }
.legend div { display: flex; gap: 8px; }
.legend dt { font-weight: 700; min-width: 56px; }
.legend dd { margin: 0; }

/* Chế độ nhúng website (J14) */
body.embed .bar, body.embed .foot, body.embed .skip { display: none; }
body.embed main { padding: 8px; }

@media print {
  .bar, .foot, .seg, .daynav .nav, .acts, .no-print, .follow, .groups, .offline { display: none !important; }
  body { background: #fff; color: #000; }
  .week-wide { display: block !important; } .week-narrow { display: none !important; }
  .wk th, .wk td { border-color: #999; }
}
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }
.strike { text-decoration: line-through; color: var(--muted); }
.note.off { background: var(--red-bg); color: var(--red); text-align: center; }
.wk.school tbody th { white-space: nowrap; }
.wk.school tbody th a { color: var(--ink); }
.daycard .plain li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.daycard .plain li:last-child { border-bottom: 0; }
.daycard .plain li a { display: inline-block; padding: 4px 0; border: 0; min-height: 0; color: var(--accent); }
.daycard .plain li .small { margin-top: 2px; }

/* v5.4 (SC7): chế độ khẩn cấp */
.note.kc { background: #b91c1c; color: #fff; text-align: center; }
.note.kc p { margin: 4px 0; font-size: 1.05em; }
.note.kc small { opacity: .9; }

/* v5.7: giao diện mới (chữ Be Vietnam Pro, xanh than + vàng đồng, bóng nhẹ) */
:root { --brand: #0f1f44; --accent: #2350c8; --radius: 14px; --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px -14px rgba(16, 24, 40, .16); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --brand: #0c1833; --accent: #8fb0ff; --shadow: 0 1px 2px rgba(0, 0, 0, .3); } }
body { font-family: var(--font); -webkit-font-smoothing: antialiased; }
.bar { background: linear-gradient(100deg, #0f1f44 0%, #16306a 60%, #1b3a7a 100%); box-shadow: 0 1px 0 rgba(255,255,255,.06), 0 6px 18px -10px rgba(15,31,68,.6); }
.brand b { font-weight: 600; letter-spacing: .01em; }
.card, .daynav, .ls, .daycard, .offcard, .seg { box-shadow: var(--shadow); }
.h1 { font-weight: 700; letter-spacing: -.015em; color: var(--ink); }
.seg button[aria-selected="true"] { background: #0f1f44; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg button[aria-selected="true"] { background: #2a4f9e; } }
.btn { font-weight: 500; }
.btn-cls { background: var(--card); box-shadow: 0 1px 2px rgba(16,24,40,.05); transition: border-color .15s, transform .05s; }
.btn-cls:hover { transform: translateY(-1px); }
.search input { border-radius: 12px; }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.grade h3 { letter-spacing: .1em; font-size: 12.5px; }
.closed { text-align: center; padding: 36px 18px; }
.closed .ic { font-size: 40px; }
input, select, textarea, button { font-family: inherit; }

/* v5.8d: màu trường Ngôi Sao Hà Nội (xanh lá, cam theo logo) */
:root { --brand: #0f974d; --accent: #0b7a3d; --navy: #0a4a2a; --navy2: #0f974d; --gold: #ef7921; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --brand: #0b5c31; --accent: #6fd8a0; --navy: #0a3a22; } }

/* ---------- v5.9: đồng bộ nhận diện trường (xanh lá #0f974d, cam #ef7921), tra cứu theo mã ---------- */
:root { --brand: #0f974d; --brand-d: #0b7a3d; --brand-dd: #0a4a2a; --accent: #0b7a3d; --orange: #c2410c; --orange-bg: #fff3e8; --cam: #ef7921;
  --bg: #f3f7f4; --line: #dce7e0; --now: #0f974d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --brand: #0f974d; --brand-d: #6fd8a0; --accent: #6fd8a0; --bg: #0f1612; --card: #17211b; --line: #26352c; } }
.bar { background: #fff; color: var(--ink); box-shadow: 0 1px 0 var(--line), 0 6px 20px -16px rgba(10, 74, 42, .5); border-top: 4px solid var(--brand); padding: 8px 16px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bar { background: #121b16; } }
.bar-in { max-width: 960px; margin: 0 auto; display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.brand { margin: 0; min-width: 0; }
.brand img { height: 44px; width: 44px; background: transparent; padding: 0; border-radius: 50%; }
.brand .pre { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); font-weight: 700; opacity: 1; }
.brand b { font-size: 16px; color: var(--brand-dd); font-weight: 800; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand b { color: #e8f3ec; } }
.brand small { color: var(--muted); opacity: 1; }
.topnav { display: flex; gap: 2px; flex-shrink: 0; }
.topnav a { color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 600; padding: 8px 12px; border-radius: 999px; }
.topnav a:hover { background: #eaf6ef; color: var(--brand-d); }
.topnav a.on { background: var(--brand); color: #fff; }
@media (max-width: 640px) { .topnav a:not(.on) { display: none; } .brand .pre { display: none; } .brand b { font-size: 15px; } }
.btn { background: var(--brand); }
.btn.primary { background: var(--cam); color: #fff; font-weight: 700; }
.btn.primary:hover { background: #d7650f; }
.btn.ghost { color: var(--brand-d); background: #fff; border-color: var(--line); }
.row-c { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.seg button[aria-selected="true"] { background: var(--brand); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg button[aria-selected="true"] { background: #0f974d; } }
.chip.on { background: var(--brand); border-color: var(--brand); }
.btn-cls:hover, .btn-cls:focus-visible { border-color: var(--brand); color: var(--brand-d); }
.daynav .nav, .daynav .dl small { color: var(--brand-d); }
.wk .today { background: color-mix(in srgb, var(--brand) 8%, var(--card)); }
.wk thead th.today { color: var(--brand-d); }
.daycard.today { border-color: var(--brand); }
.grade h3 { color: var(--brand-d); }
a { color: var(--brand-d); }

/* Ô nhập mã: dải xanh có họa tiết như trang chủ */
.hero-ma { position: relative; overflow: hidden; color: #fff; border-radius: 20px; margin: 4px 0 14px; padding: 30px 26px;
  background: linear-gradient(125deg, #0a4a2a 0%, #0f974d 55%, #19b062 100%); box-shadow: 0 24px 50px -30px rgba(10, 74, 42, .8); }
.hero-ma::before { content: ""; position: absolute; inset: 0; opacity: .12; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200' fill='none' stroke='%23fff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M30 22l4 8 9 1.3-6.5 6.3 1.5 9L30 42.4l-8 4.2 1.5-9-6.5-6.3 9-1.3z'/%3E%3Cpath d='M130 30h34v26h-34zM147 30v26'/%3E%3Cpath d='M70 110l40-40 8 8-40 40-11 3z'/%3E%3Ccircle cx='160' cy='140' r='4'/%3E%3Cellipse cx='160' cy='140' rx='20' ry='7'/%3E%3Cellipse cx='160' cy='140' rx='20' ry='7' transform='rotate(60 160 140)'/%3E%3Cellipse cx='160' cy='140' rx='20' ry='7' transform='rotate(-60 160 140)'/%3E%3Cpath d='M28 160h16M36 152v16'/%3E%3C/svg%3E");
  background-size: 200px 200px; }
.hero-ma::after { content: ""; position: absolute; right: -80px; top: -80px; width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, rgba(239, 121, 33, .55), transparent 70%); pointer-events: none; }
.hm-in { position: relative; z-index: 1; max-width: 640px; }
.hero-ma h1 { margin: 0 0 6px; font-size: clamp(24px, 3.4vw, 32px); font-weight: 800; letter-spacing: -.02em; }
.hero-ma p { margin: 0 0 16px; color: #dff3e7; }
.hero-ma p b { color: #fff; }
.hero-ma a { color: #fff; }
.ma-form { display: flex; gap: 8px; flex-wrap: wrap; }
.ma-form input { flex: 1 1 240px; min-width: 0; font: inherit; font-size: 19px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 12px 16px; min-height: 52px; border-radius: 12px; border: 2px solid transparent; background: #fff; color: #10291b; outline: none; }
.ma-form input::placeholder { text-transform: none; letter-spacing: 0; font-weight: 400; color: #7c8b82; font-size: 16px; }
.ma-form input:focus { border-color: var(--cam); box-shadow: 0 0 0 4px rgba(239, 121, 33, .3); }
.ma-form input[type="date"] { text-transform: none; letter-spacing: 0; }
.ma-form .btn { min-height: 52px; padding: 10px 22px; border-radius: 12px; }
.ma-err { background: rgba(255, 255, 255, .95); color: #b42318; border-radius: 10px; padding: 8px 12px; margin: 12px 0 0; font-weight: 600; }

/* Đầu trang khi xem theo mã: người tra cứu, mã, các con */
.code-head { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px; margin: 4px 0 12px; box-shadow: var(--shadow); }
.ch-who { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ch-who > div { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; flex: 1; }
.ch-who small { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.ch-who b { font-size: 17px; }
.ch-av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand), #19b062); color: #fff; font-weight: 800; }
.ch-code { font-family: ui-monospace, Menlo, Consolas, monospace; background: #eaf6ef; color: var(--brand-d); padding: 4px 10px; border-radius: 8px; font-weight: 700; letter-spacing: .05em; }
.ch-out { font-size: 14px; font-weight: 600; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; }
.kids { display: flex; gap: 8px; margin-top: 12px; overflow-x: auto; padding-bottom: 2px; }
.kid { flex: 0 0 auto; display: flex; flex-direction: column; min-width: 120px; padding: 8px 14px; border-radius: 12px; border: 1.5px solid var(--line); text-decoration: none; color: var(--ink); background: var(--bg); }
.kid b { font-size: 15px; } .kid small { color: var(--muted); font-size: 12.5px; }
.kid.on { background: var(--brand); border-color: var(--brand); color: #fff; } .kid.on small { color: #dff3e7; }
.kid:first-child.on { background: var(--cam); border-color: var(--cam); }
.kid-title { margin-bottom: 2px; }
.fam { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.fam-c header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.fam-c header b { display: block; font-size: 17px; } .fam-c header small { color: var(--muted); }
.fam-c header .btn { margin: 0; min-height: 36px; }
.fam-c .times { justify-content: flex-start; margin: 4px 0 8px; }
.fam-now { color: var(--now); font-weight: 600; margin: 0 0 8px; }
.fam-off { color: var(--muted); font-weight: 600; }
.fam-l li { padding: 5px 0; border-bottom: 1px dashed var(--line); }
.fam-l li:last-child { border-bottom: 0; }
.fam-l .n { width: 48px; font-size: 13px; }
.fam-l em { color: var(--muted); font-style: normal; font-size: 13.5px; }
.fam-l li.cur { background: #eaf6ef; border-radius: 6px; }
.fam-more { margin: 8px 0 0; font-size: 14px; }
.empty.prep { max-width: 620px; margin: 24px auto; background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); border-top: 4px solid var(--cam); }
.prep-ic { font-size: 46px; }
.empty.prep h1 { color: var(--brand-dd); margin: 8px 0; }
@media (max-width: 640px) { .hero-ma { padding: 22px 16px; border-radius: 16px; } .ma-form .btn { flex: 1 1 100%; } }
@media print { .code-head .ch-out, .kids, .hero-ma { display: none !important; } }

/* ---------- v6.4.1: trắng xanh theo nhận diện; vào tra cứu là hai ô Tiểu học, THCS ---------- */
:root { --bg: #f6faf7; --tint: #eaf6ef; --tint2: #d5eedf; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --tint: #17301f; --tint2: #1d3b27; } }
body { background: radial-gradient(1200px 420px at 50% -120px, var(--tint) 0%, transparent 70%), var(--bg); background-attachment: fixed; }
main { max-width: 1000px; }
.lobby-hero { text-align: center; padding: 28px 8px 8px; }
.lobby-hero small { display: inline-block; color: var(--brand-d); background: var(--card); border: 1px solid var(--tint2); border-radius: 999px;
  padding: 4px 12px; font-size: 12.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.lobby-hero h1 { margin: 12px 0 8px; font-size: clamp(28px, 4.4vw, 42px); font-weight: 800; letter-spacing: -.025em; color: var(--brand-dd); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lobby-hero h1 { color: #e8f3ec; } }
.lobby-hero p { margin: 0 auto; max-width: 620px; color: var(--muted); }
.cap-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; margin: 26px 0 18px; }
.cap-tile { position: relative; display: flex; flex-direction: column; gap: 14px; padding: 26px 24px 22px; min-height: 250px; border-radius: 22px;
  background: var(--card); border: 1px solid var(--line); color: var(--ink); text-decoration: none; overflow: hidden;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 18px 40px -26px rgba(10, 74, 42, .45); transition: transform .15s, box-shadow .15s, border-color .15s; }
.cap-tile::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: linear-gradient(90deg, #0f974d, #19b062); }
.cap-tile.cap-thcs::before { background: linear-gradient(90deg, #0a4a2a, #0f974d); }
.cap-tile::after { content: ""; position: absolute; right: -70px; bottom: -70px; width: 220px; height: 220px; border-radius: 50%; background: var(--tint); z-index: 0; }
.cap-tile > * { position: relative; z-index: 1; }
.cap-tile:hover, .cap-tile:focus-visible { transform: translateY(-3px); border-color: var(--brand); box-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 26px 50px -24px rgba(10, 74, 42, .55); }
.ct-ic { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: var(--tint); color: var(--brand-d); }
.cap-thcs .ct-ic { background: #0f974d; color: #fff; }
.ct-ic svg { width: 38px; height: 38px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ct-ic.sm { width: 48px; height: 48px; border-radius: 14px; flex-shrink: 0; }
.ct-ic.sm svg { width: 28px; height: 28px; }
.ct-txt { display: flex; flex-direction: column; gap: 4px; }
.ct-txt small { color: var(--brand-d); font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.ct-txt b { font-size: clamp(30px, 4vw, 38px); line-height: 1.1; font-weight: 800; letter-spacing: -.02em; color: var(--brand-dd); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ct-txt b { color: #e8f3ec; } }
.ct-meta { color: var(--muted); font-size: 15px; }
.ct-st { align-self: flex-start; margin-top: 6px; font-size: 13.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: #f2f4f3; color: var(--muted); }
.ct-st.ok { background: var(--tint); color: var(--brand-d); }
.ct-go { margin-top: auto; align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; background: var(--brand); color: #fff; font-weight: 700;
  padding: 10px 18px; border-radius: 12px; min-height: 44px; }
.ct-go i { font-style: normal; transition: transform .15s; }
.cap-tile:hover .ct-go i { transform: translateX(4px); }
.lobby-again { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; justify-content: center; margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.lobby-more { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 8px; }
.lobby-more a { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: 14px; background: var(--card); border: 1px dashed var(--tint2);
  text-decoration: none; color: var(--ink); }
.lobby-more a b { color: var(--brand-d); } .lobby-more a span { color: var(--muted); font-size: 14px; }
.lobby-more a:hover { border-style: solid; border-color: var(--brand); }
/* Đầu trang bên trong một cấp */
.cap-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin: 4px 0 14px; border-radius: 18px; background: var(--card);
  border: 1px solid var(--line); border-top: 5px solid var(--brand); box-shadow: var(--shadow); }
.cap-head.cap-thcs { border-top-color: #0a4a2a; }
.cap-head > div { flex: 1; min-width: 0; line-height: 1.15; }
.cap-head small { color: var(--brand-d); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.cap-head h1 { margin: 2px 0 0; font-size: clamp(22px, 3vw, 28px); font-weight: 800; color: var(--brand-dd); letter-spacing: -.02em; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cap-head h1 { color: #e8f3ec; } }
.ch-back { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; min-height: 44px; border-radius: 999px; border: 1px solid var(--line);
  text-decoration: none; font-weight: 600; font-size: 14px; color: var(--brand-d); background: var(--bg); }
.ch-back:hover { border-color: var(--brand); }
.cap-n { font-size: 13.5px; font-weight: 700; color: var(--brand-d); background: var(--tint); padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
/* Ô nhập mã: trắng xanh */
.hero-ma { color: var(--ink); background: linear-gradient(135deg, var(--card) 0%, var(--tint) 100%); border: 1px solid var(--tint2);
  box-shadow: 0 18px 40px -30px rgba(10, 74, 42, .55); }
.hero-ma::before { opacity: .07; filter: invert(38%) sepia(80%) saturate(500%) hue-rotate(100deg); }
.hero-ma::after { background: radial-gradient(circle, rgba(15, 151, 77, .16), transparent 70%); }
.hero-ma h1, .hero-ma h2 { color: var(--brand-dd); margin: 0 0 6px; }
.hero-ma h2 { font-size: 20px; font-weight: 800; }
.hero-ma p { color: var(--muted); }
.hero-ma p b { color: var(--brand-d); }
.hero-ma a { color: var(--brand-d); }
.ma-form input { border: 2px solid var(--tint2); }
.ma-form input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(15, 151, 77, .18); }
.ma-form .btn.primary { background: var(--brand); }
.ma-form .btn.primary:hover { background: var(--brand-d); }
.ma-form input:disabled, .ma-form .btn:disabled { opacity: .55; cursor: not-allowed; }
.ma-err { border: 1px solid #f3c1bb; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero-ma h1, :root:not([data-theme="light"]) .hero-ma h2 { color: #e8f3ec; } }
.note.cap-chua { color: var(--ink); background: var(--card); border: 1px solid var(--tint2); border-left: 5px solid var(--brand); border-radius: 14px; padding: 12px 16px; margin: 0 0 12px; }
.note.cap-chua p { margin: 4px 0 0; color: var(--muted); }
.empty-in { text-align: center; padding: 26px 12px; color: var(--muted); border: 1px dashed var(--tint2); border-radius: 14px; margin-top: 10px; }
.empty-in span { font-size: 34px; display: block; } .empty-in p { margin: 6px 0 0; }
.btn.ghost { border: 1px solid var(--tint2); }
@media (max-width: 640px) {
  .lobby-hero { padding-top: 16px; }
  .cap-tiles { gap: 12px; margin-top: 18px; }
  .cap-tile { min-height: 0; padding: 20px 18px 18px; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .cap-tile .ct-txt { flex: 1; min-width: 0; }
  .cap-tile .ct-go { width: 100%; justify-content: center; }
  .ct-ic { width: 54px; height: 54px; }
  .cap-head { padding: 10px 12px; gap: 8px; }
  .ch-back span { display: none; }
  .cap-head .ct-ic.sm { display: none; }
}
