/* TamvangHub · Tâm Vàng — trường nghề (fork Dev). Dựa trên Pico.css */
:root:not([data-theme=dark]),
[data-theme=light] {
  --ink: #1c2b33;
  --muted: #5c6b73;
  --line: #e3ebe8;
  --surface: #ffffff;
  --bg: #f3f6f4;
  --brand: #002c22;
  --brand-dark: #001a14;
  --accent: #f99c00;
  --pico-font-family: "Be Vietnam Pro", "Segoe UI", sans-serif;
  --pico-primary: var(--brand);
  --pico-primary-background: var(--brand);
  --pico-primary-hover: var(--brand-dark);
  --pico-primary-hover-background: var(--brand-dark);
  --pico-primary-focus: rgba(249, 156, 0, .35);
  --pico-background-color: var(--bg);
  --pico-color: var(--ink);
  --pico-muted-color: var(--muted);
  --pico-border-radius: 12px;
  --pico-font-size: 106%;
}
body { background: var(--bg); color: var(--ink); }
main.container { padding-top: 1.25rem; padding-bottom: 5rem; }
h2, h3 { letter-spacing: -0.02em; }
.topbar { background: rgba(255,255,255,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; padding: .7rem 0 .45rem; gap: .75rem; }
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: inherit; min-width: 0; flex: 1 1 auto; }
.logo { width: 44px; height: 44px; flex: none; border-radius: 12px; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: 1rem; font-weight: 700; white-space: normal; overflow-wrap: anywhere; }
.brand-text small { color: var(--muted); font-size: .75rem; font-weight: 500; }
.page-brand { margin-bottom: 1rem; }
.page-brand .brand-text strong { white-space: normal; }
.logout { display: flex; align-items: center; gap: .65rem; margin: 0; flex: 0 1 auto; min-width: 0; }
.logout > a, .logout > button { flex: none; }
.logout button { margin: 0; width: auto; }
.who { display: flex; flex-direction: column; align-items: flex-end; text-align: right; min-width: 0; font-size: .8rem; color: var(--muted); line-height: 1.2; }
.who b { color: var(--ink); font-weight: 600; }
.mainnav { display: flex; flex-wrap: nowrap; gap: .35rem; padding: .15rem 0 .7rem; white-space: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; overscroll-behavior-x: contain; }
.mainnav a { padding: .45rem .85rem; border-radius: 999px; background: #fff; border: 1px solid var(--line); text-decoration: none; font-size: .92rem; font-weight: 600; color: var(--ink); }
.mainnav a:hover { background: #e7f3f0; border-color: #c5ddd6; }
.mainnav a.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.site-footer { color: var(--muted); font-size: .8rem; padding-bottom: 1.5rem; }
.login-wrap { min-height: calc(100vh - 5rem); display: flex; align-items: center; justify-content: center; }
.login-card { width: min(440px, 100%); margin: 1.5rem auto; padding: 2rem 1.5rem 1.5rem; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: 0 16px 40px rgba(16, 42, 36, .08); }
.login-brand { text-align: center; margin-bottom: 1.25rem; }
.login-brand .logo-lg { display: flex; justify-content: center; margin: 0 auto .85rem; }
.login-brand .logo-lg .logo { width: 72px; height: 72px; }
.login-brand h1 { font-size: 1.35rem; margin: 0 0 .2rem; line-height: 1.3; }
.login-brand p { margin: 0; color: var(--muted); }
.login-card button.big { width: 100%; }
@media (max-width: 640px) {
  .who span { display: none; }
}
.muted { color: #777; }
.small-text { font-size: .8rem; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.narrow { max-width: 560px; margin: 1rem auto; }
.row-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; }
.inline { display: inline-block; margin: 0; }
.inline input, .inline button { margin-bottom: 0; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .5rem 0 1rem; }
.actions > *, .actions button, .actions [role=button] { margin: 0; width: auto; }
button.big, [role=button].big { font-size: 1.05rem; padding: .75rem 1.2rem; }
button.small, .small { font-size: .85rem; padding: .3rem .6rem; }
button.link { background: none; border: none; color: var(--pico-primary); padding: 0 .3rem; width: auto; margin: 0; text-decoration: underline; }
.danger { color: #c92a2a !important; }
.flash { padding: .75rem 1rem; border-radius: .5rem; margin-bottom: .75rem; }
.flash-success { background: #e6fcf5; border-left: 4px solid #12b886; }
.flash-error { background: #fff5f5; border-left: 4px solid #fa5252; }
.flash-warning { background: #fff9db; border-left: 4px solid #fab005; }
.flash-info { background: #e7f5ff; border-left: 4px solid #339af0; }
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .8rem; background: #eee; }
.badge.warn { background: #fff3bf; color: #8a5a00; }
.badge.info { background: #e7f5ff; color: #1864ab; }
.badge.ok { background: #d3f9d8; color: #2b8a3e; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .75rem; margin: 1rem 0; }
.stat { background: #fff; border-radius: .75rem; padding: .75rem; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.stat b { display: block; font-size: 1.8rem; color: var(--pico-primary); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .75rem; }
.tile { display: flex; flex-direction: column; gap: .2rem; padding: 1rem; background: #fff; border-radius: .75rem; text-decoration: none; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.tile strong { font-size: 1.2rem; }
.checklist { list-style: none; padding: 0; }
.checklist li { list-style: none; padding: .2rem 0; }
.checklist li.ok::before { content: "✅ "; }
.checklist li.todo::before { content: "⏳ "; }
.table-wrap { overflow-x: auto; }
tr.inactive td { opacity: .5; }
tr.total td { font-weight: 700; background: #e7f3f0; }
.filter { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.filter input, .filter select, .filter button { margin-bottom: .5rem; width: auto; }
.seg { display: flex; border-radius: .5rem; overflow: hidden; border: 1px solid var(--brand); margin-bottom: .5rem; }
.seg-btn { padding: .55rem 1rem; text-decoration: none; }
.seg-btn.active { background: var(--brand); color: #fff; }
.tabs { display: flex; gap: .5rem; margin-bottom: .5rem; }
.tabs a { padding: .4rem 1rem; border-radius: .5rem; text-decoration: none; background: #e7f3f0; }
.tabs a.active { background: var(--brand); color: #fff; }
.low { color: #c92a2a; }

/* Điểm danh */
.kid-list { display: flex; flex-direction: column; gap: .6rem; }
.kid { background: #fff; border-radius: .75rem; padding: .75rem; border-left: 6px solid #ddd; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.kid.s-present { border-left-color: #40c057; }
.kid.s-late { border-left-color: #fab005; }
.kid.s-excused { border-left-color: #339af0; }
.kid.s-unexcused { border-left-color: #fa5252; }
.kid-head { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: .5rem; }
.kid-name { font-weight: 600; font-size: 1.05rem; }
.status-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: .35rem; }
@media (max-width: 520px) { .status-btns { grid-template-columns: repeat(2, 1fr); } }
.sbtn { margin: 0; }
.sbtn input { position: absolute; opacity: 0; pointer-events: none; }
.sbtn span { display: block; text-align: center; padding: .7rem .3rem; border-radius: .5rem; border: 2px solid #e9ecef; cursor: pointer; font-size: .95rem; user-select: none; }
.sbtn.s-present input:checked + span { background: #40c057; border-color: #40c057; color: #fff; }
.sbtn.s-late input:checked + span { background: #fab005; border-color: #fab005; color: #222; }
.sbtn.s-excused input:checked + span { background: #339af0; border-color: #339af0; color: #fff; }
.sbtn.s-unexcused input:checked + span { background: #fa5252; border-color: #fa5252; color: #fff; }
.kid .note { margin: .5rem 0 0; padding: .4rem .6rem; font-size: .9rem; height: auto; }
.badge.s-present { background: #d3f9d8; } .badge.s-late { background: #fff3bf; } .badge.s-excused { background: #d0ebff; } .badge.s-unexcused { background: #ffe3e3; }
.sticky-bar { position: sticky; bottom: 0; display: flex; gap: .5rem; padding: .75rem 0; background: linear-gradient(transparent, var(--bg) 30%); }
.sticky-bar button { flex: 1; margin: 0; }

/* Báo cơm */
.meal-row { padding: 1rem; }
.stepper { display: flex; gap: .5rem; align-items: center; margin: .5rem 0; }
.stepper input { text-align: center; font-size: 1.5rem; font-weight: 700; margin: 0; }
.stepper .step { width: 3.5rem; font-size: 1.5rem; margin: 0; padding: .4rem; }
.type-row { align-items: center; }

/* Thông báo */
.notif.confirmed { border-left: 5px solid #40c057; }
.notif textarea.msg { font-size: .9rem; margin: .5rem 0; }
.parent-note { background: #fff9db; padding: .5rem; border-radius: .5rem; }

/* Thẻ QR */
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .75rem; }
.qr-card { border: 1px dashed #aaa; border-radius: .5rem; padding: .5rem; text-align: center; background: #fff; display: flex; flex-direction: column; break-inside: avoid; }
.qr-card img { width: 100%; max-width: 160px; margin: 0 auto; }
@media print { .topbar, footer, .noprint, .flash { display: none !important; } body { background: #fff; } }

/* ---------- Đón / trả trẻ ---------- */
:root { --st-chua: #9e9e9e; --st-den: #2e7d32; --st-ve: #1565c0; --st-nghi: #ef6c00; --st-vang: #c62828; }
.state-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 1rem; }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .8rem; border-radius: 999px; border: 2px solid var(--st-chua);
  text-decoration: none; color: inherit; font-size: .95rem; min-height: 44px; background: var(--pico-background-color, #fff); }
.chip b { font-size: 1.15rem; }
.chip.active { background: #263238; color: #fff; border-color: #263238; }
.chip.st-chua_den { border-color: var(--st-chua); }
.chip.st-da_den { border-color: var(--st-den); }
.chip.st-da_ve { border-color: var(--st-ve); }
.chip.st-xin_nghi { border-color: var(--st-nghi); }
.chip.st-vang { border-color: var(--st-vang); }
.chip.late, .chip.st-late { border-color: #6a1b9a; }
.big-chips .chip { flex: 1 1 40%; justify-content: center; }
.stat.st-da_den b { color: var(--st-den); } .stat.st-chua_den b { color: var(--st-chua); }
.stat.st-da_ve b { color: var(--st-ve); } .stat.st-xin_nghi b { color: var(--st-nghi); }

.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .6rem; }
.ktile { border: 1px solid #ddd; border-left: 6px solid var(--st-chua); border-radius: .6rem; padding: .6rem .7rem; background: var(--pico-card-background-color, #fff); }
.ktile.st-da_den { border-left-color: var(--st-den); }
.ktile.st-da_ve { border-left-color: var(--st-ve); opacity: .85; }
.ktile.st-xin_nghi { border-left-color: var(--st-nghi); background: #fff8f0; }
.ktile.st-vang { border-left-color: var(--st-vang); }
.ktile-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.ktile-info { margin: .3rem 0; }
.ktile-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.ktile-actions > *, .ktile-actions button, .ktile-actions [role=button] { flex: 1 1 auto; margin: 0; min-height: 48px; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 2.4rem; height: 2.4rem; border-radius: 50%;
  background: #e0f2f1; color: #00695c; font-weight: 700; flex: none; font-size: .9rem; }
.badge.late { background: #f3e5f5; color: #6a1b9a; }
.badge.st-chua_den { background: #eeeeee; color: #424242; }
.badge.st-da_den { background: #e8f5e9; color: var(--st-den); }
.badge.st-da_ve { background: #e3f2fd; color: var(--st-ve); }
.badge.st-xin_nghi { background: #fff3e0; color: var(--st-nghi); }
.badge.st-vang { background: #ffebee; color: var(--st-vang); }
.badge.kind-checkin { background: #e8f5e9; color: var(--st-den); }
.badge.kind-checkout { background: #e3f2fd; color: var(--st-ve); }

.guardian-list { display: grid; gap: .5rem; margin-bottom: 1rem; }
.gcard { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .6rem .8rem; border: 2px solid #ddd;
  border-radius: .6rem; cursor: pointer; min-height: 56px; margin: 0; }
.gcard > span { display: flex; align-items: center; gap: .6rem; }
.gcard input[type=radio] { margin: 0; }
.gcard:has(input:checked) { border-color: var(--st-den); background: #f1f8e9; }
.gcard.static { cursor: default; }
.gphoto { width: 3rem; height: 3rem; object-fit: cover; border-radius: 50%; flex: none; }
.camera-btn { display: block; border: 2px dashed #90a4ae; border-radius: .6rem; padding: .8rem; text-align: center; cursor: pointer; margin: .6rem 0; }
.camera-btn input[type=file] { margin-top: .4rem; }
.big-camera { font-size: 1.3rem; padding: 1.5rem .8rem; }
.preview { max-width: 100%; max-height: 320px; border-radius: .6rem; display: block; margin: .5rem auto; }
.face-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; margin: .6rem 0; }
.face-card { border: 2px solid #ddd; border-radius: .6rem; padding: .5rem; text-align: center; margin: 0; }
.face-card.matched { border-color: var(--st-den); }
.face-card.unknown { border-color: #ffb74d; }
.face-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: .4rem; }
.face-card select { margin: .3rem 0 0; font-size: .9rem; }
ul.plain { list-style: none; padding: 0; } ul.plain li { list-style: none; margin-bottom: .4rem; }
.kid.lv-pending { border-left: 5px solid var(--st-nghi); }
.kid.lv-rejected, .kid.lv-cancelled { opacity: .6; }

article, .stat, .tile, .kid, .ktile {
  border-color: var(--line);
  box-shadow: 0 1px 2px rgba(16, 42, 36, .04);
}
.stat b { color: var(--brand); }
.class-card > header { background: transparent; border: 0; padding: 0 0 .35rem; margin: 0; }
button.big, [role=button].big { min-height: 48px; font-weight: 600; }
input, select, textarea { background: #fff; }

.scan-launch { margin: 0 0 .8rem; }
.scan-stage { position: relative; background: #10211c; border-radius: 16px; overflow: hidden; aspect-ratio: 3 / 4; max-height: 68vh; margin-bottom: .8rem; }
.scan-stage video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 16% 14%; border: 3px solid #fff; border-radius: 16px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .35); pointer-events: none; }
.scan-result { margin: .8rem 0; padding: .9rem 1rem; border-radius: 12px; }
.scan-result p { margin: 0 0 .5rem; }
.scan-result button { width: 100%; margin-bottom: .4rem; }
.scan-ok { background: #e6fcf5; border-left: 4px solid #0e6b5c; }
.scan-bad { background: #fff5f5; border-left: 4px solid #fa5252; }

/* Phông chữ lưu sẵn trong máy (không cần Internet) */
@font-face { font-family: "Be Vietnam Pro"; src: url("/static/fonts/BeVietnamPro-Regular.ttf") format("truetype"); font-weight: 400 500; font-display: swap; }
@font-face { font-family: "Be Vietnam Pro"; src: url("/static/fonts/BeVietnamPro-Bold.ttf") format("truetype"); font-weight: 600 800; font-display: swap; }
/* Bản nhiều trường: link đổi mật khẩu, nhãn kênh gửi tin */
.logout { flex-wrap: wrap; justify-content: flex-end; }
.small-link { font-size: .85rem; white-space: nowrap; text-decoration: none; }
@media (max-width: 640px) { .hide-sm { display: none; } }
.badge.bad { background: #ffe3e3; color: #c92a2a; }
.badge.muted-badge { background: #f1f3f5; color: #868e96; }
.channels .badge { margin-right: .25rem; }

/* Nhập danh sách từ file */
.import-preview table.compact td, .import-preview table.compact th { padding: .25rem .35rem; font-size: .85rem; vertical-align: top; }
.import-preview table.compact input:not([type=checkbox]) { min-width: 7rem; padding: .25rem .4rem; height: auto; margin: 0; font-size: .85rem; }
.import-preview tr.st-error td { background: #fff5f5; }
.import-preview .small { font-size: .75rem; }
.imp-reason { color: #c92a2a; font-size: .78rem; }
.badge.imp-new { background: #d3f9d8; color: #2b8a3e; } .badge.imp-update { background: #e7f5ff; color: #1864ab; }
.badge.imp-error { background: #ffe3e3; color: #c92a2a; } .badge.imp-skip, .badge.imp-same { background: #eee; color: #555; }
.import-actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; position: sticky; bottom: 0; background: var(--pico-background-color, #fff); padding: .5rem 0; }
.import-actions button { width: auto; margin: 0; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-start; }
.btn-row form { margin: 0; }

/* Quét QR – màn hình gọn cho điện thoại */
.scan-min-bar { display: none; }
.scan-history { list-style: none; padding: 0; margin: .4rem 0; font-size: .9rem; }
.scan-history li { padding: .3rem 0; border-bottom: 1px solid var(--line); list-style: none; }
.scan-head h2 { margin: 0; }
body.scan-min .topbar, body.scan-min .site-footer, body.scan-min .scan-help, body.scan-min .scan-head { display: none !important; }
body.scan-min main.container { padding: 0 .5rem; max-width: 640px; }
body.scan-min .scan-page { margin: 0; padding: .5rem; box-shadow: none; background: transparent; }
body.scan-min .scan-min-bar { display: flex; align-items: center; justify-content: space-between; gap: .5rem; position: sticky; top: 0; z-index: 5;
  padding: .6rem .8rem; background: var(--brand); color: #fff; }
body.scan-min .scan-min-bar a { color: #fff; text-decoration: none; font-size: .9rem; }
body.scan-min .scan-count { background: rgba(255,255,255,.2); border-radius: 999px; padding: .1rem .6rem; font-size: .85rem; }
body.scan-min .scan-stage { max-height: 62vh; }
body.scan-min .scan-result { font-size: 1.1rem; }

/* Quét QR: trạng thái camera, thẻ xác nhận to ở cuối màn hình */
.scan-status { position: absolute; left: 0; right: 0; bottom: 0; padding: .6rem .8rem; color: #fff; background: rgba(0, 0, 0, .55); font-size: .95rem; text-align: center; }
.scan-stage.scan-hit .scan-frame { border-color: #69db7c; }
.scan-auto { margin: .2rem 0 .6rem; }
.scan-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; padding: .6rem .6rem calc(.6rem + env(safe-area-inset-bottom)); }
.scan-card { max-width: 640px; margin: 0 auto; background: #fff; border-radius: 18px; padding: 1rem 1.1rem; box-shadow: 0 -6px 30px rgba(0, 0, 0, .28); max-height: 80vh; overflow-y: auto; }
.scan-card-head { display: flex; gap: .8rem; align-items: center; margin-bottom: .4rem; }
.scan-card-head img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; flex: none; }
.scan-card-name { font-size: 1.5rem; font-weight: 800; line-height: 1.2; }
.scan-card-action { display: inline-block; font-size: 1.2rem; font-weight: 800; padding: .2rem .8rem; border-radius: 999px; margin: .2rem 0 .4rem; background: #e7f5ff; color: #1864ab; }
.scan-card-action.act-in { background: #d3f9d8; color: #2b8a3e; }
.scan-card-action.act-out, .scan-card-action.act-need_out { background: #fff3bf; color: #a35f00; }
.scan-card-action.act-already_in, .scan-card-action.act-already_out { background: #f1f3f5; color: #495057; }
.scan-card p { margin: 0 0 .6rem; font-size: 1.05rem; }
.scan-card-buttons { display: grid; gap: .5rem; }
.scan-card-buttons button { width: 100%; margin: 0; min-height: 56px; font-size: 1.15rem; }
.scan-card-buttons button.scan-yes { background: #2b8a3e; border-color: #2b8a3e; color: #fff; }

/* Màn hình Bếp: tóm tắt suất đặc biệt + ghi chú giáo viên */
.special-box { border: 2px solid #F2B84B; background: #FFF8E8; border-radius: 12px; padding: .75rem 1rem; margin: .5rem 0 1rem; }
.special-box.none { border-color: #dfe7e4; background: #f7faf9; color: #5b6b67; }
.special-box summary { cursor: pointer; font-size: 1.05rem; }
.special-box ul { margin: .5rem 0 0; }
.special-box li { margin-bottom: .25rem; list-style: disc; margin-left: 1.25rem; }
.kitchen-note { background: #EEF6F3; border-left: 3px solid #0E6B5C; padding: .1rem .4rem; margin-bottom: .2rem; border-radius: 4px; }

/* Trợ giúp: trả lời tự động */
.help-page .faq-search-row { display: flex; gap: .5rem; }
.help-page .faq-search-row input { flex: 1; margin-bottom: 0; }
.help-page .faq-search-row button { width: auto; flex: 0 0 auto; margin-bottom: 0; }
.help-page .faq-search label { margin-bottom: .3rem; }
.help-page .faq-search { margin-bottom: .8rem; }
.faq-card { border: 1px solid #dbe4ea; border-left: 4px solid #1e88e5; border-radius: 8px; padding: .75rem .9rem; margin: .6rem 0; background: #fbfdff; }
.faq-q { font-weight: 600; margin-bottom: .35rem; }
.faq-a p, .faq-a ul, .faq-a ol { margin-bottom: .4rem; }
.faq-a ul, .faq-a ol { padding-left: 1.2rem; }
.faq-a li { margin-bottom: .15rem; }
.faq-link { margin: .4rem 0; }
.faq-link a[role=button] { width: auto; }
.faq-vote { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: .4rem; }
.faq-vote form { margin: 0; }
.faq-vote button { width: auto; margin: 0; padding: .25rem .6rem; }
.faq-none { background: #fff8e1; border-radius: 8px; padding: .6rem .8rem; }
.faq-all > summary, .faq-ticket > summary { margin: .8rem 0 .4rem; }
.faq-topic { margin: .8rem 0 .3rem; font-size: 1rem; color: #455a64; }
.faq-item { margin: 0; border-bottom: 1px solid #eceff1; }
.faq-item > summary { padding: .45rem 0; }
.faq-item .faq-card { border-left-color: #90a4ae; }
.faq-item .faq-card .faq-q { display: none; }
@media (max-width: 576px) { .faq-card { padding: .6rem .7rem; } }
.inline-check { display: inline-flex; align-items: center; gap: .3rem; margin-right: 1rem; }
/* Kế hoạch: danh sách dạng thẻ (gọn trên điện thoại) */
.tabs { flex-wrap: wrap; }
.plan-list { list-style: none; padding: 0; margin: 0; }
.plan-list li { list-style: none; padding: .6rem 0; border-bottom: 1px solid #e9ecef; }
.plan-list li .actions { margin-top: .3rem; display: flex; gap: .75rem; align-items: center; }

/* Đón/trả: bảng xác nhận người đưa/đón (bắt buộc trước khi ghi) */
.ktile:has([data-sheet]) { cursor: pointer; }
dialog.ci-sheet > article { width: min(560px, 100%); max-height: 92vh; overflow-y: auto; margin: auto auto 0; padding: 1rem; }
@media (min-width: 700px) { dialog.ci-sheet > article { margin: auto; } }
.ci-head { display: flex; gap: .6rem; align-items: center; margin-bottom: .4rem; }
.ci-q { font-weight: 600; margin: .4rem 0; }
.ci-people { display: grid; gap: .4rem; margin-bottom: .4rem; }
.ci-opt { display: flex; align-items: center; gap: .6rem; min-height: 56px; padding: .5rem .7rem; border: 2px solid #ccc; border-radius: .6rem; cursor: pointer; margin: 0 0 .4rem; font-size: 1.05rem; }
.ci-opt.on { border-color: var(--pico-primary, #1e88e5); background: rgba(30, 136, 229, .08); }
.ci-opt input { margin: 0; }
.ci-face { width: 44px; height: 44px; object-fit: cover; border-radius: 50%; }
.ci-actions { display: flex; gap: .5rem; }
.ci-actions button { flex: 1 1 0; min-height: 52px; margin: 0; }
.scan-people { display: grid; gap: .4rem; margin-bottom: .5rem; }
.scan-people button { margin: 0; }
.scan-people button[aria-pressed="true"]::before { content: "✔ "; }
.scan-confirm-row { display: flex; gap: .5rem; }
.scan-confirm-row button { flex: 1 1 0; margin: 0; }
.scan-confirm-row button:disabled { opacity: .45; }

/* Cảnh báo quá giờ chưa xác nhận đón về */
.overdue-banner { background: #fff0f0; border: 2px solid #e03131; color: #a51111; border-radius: .6rem; padding: .7rem .9rem; margin: .6rem 0 1rem; }
.overdue-banner ul { margin: .4rem 0; padding-left: 1.2rem; }
.overdue-banner li { margin: .15rem 0; }
.overdue-banner a { color: #c92a2a; font-weight: 600; }
.overdue-banner small { color: #7a1d1d; }
.ktile.overdue { border-color: #e03131; border-left-color: #e03131; box-shadow: 0 0 0 2px #ffc9c9; }
.badge.overdue { background: #e03131; color: #fff; }
.alert-row.resolved { opacity: .6; }

/* Đổi lớp ngay trong bảng đón/trả (hiệu phó, trợ lý, GV nhiều lớp) */
.class-switch { display: flex; align-items: center; gap: .5rem; margin: 0 0 .6rem; }
.class-switch-back { flex: 0 0 auto; white-space: nowrap; font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; }
.class-chips { position: relative; flex: 1 1 auto; min-width: 0; display: flex; gap: .4rem; overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: thin; padding: .15rem 0 .35rem; }
.class-chips .chip { flex: 0 0 auto; white-space: nowrap; font-weight: 600; }
@media (max-width: 576px) { .class-switch { flex-wrap: wrap; } .class-chips { flex-basis: 100%; } }

/* BUINHUIROM SYSTEM - học vụ phổ thông */
.tabs a[aria-current="page"] { background: var(--brand); color: #fff; }
.k12-tabs { flex-wrap: wrap; margin-bottom: 1rem; }
.class-strip { display: flex; flex-wrap: wrap; gap: .35rem; margin: .5rem 0 1rem; }
.class-strip a[role="button"].small, button.small { padding: .25rem .7rem; font-size: .85rem; width: auto; margin: 0; }
form.inline { margin: 0; } form.inline select { margin: 0; padding-top: .3rem; padding-bottom: .3rem; }
/* 🍽 Ghi chú ăn uống hôm nay (Báo cơm / bếp) */
.day-notes { border: 2px solid #7cc4a4; background: #f1faf5; border-radius: 12px; padding: .75rem 1rem; margin: .5rem 0 1rem; }
.day-notes h3 { margin: 0 0 .5rem; font-size: 1.05rem; }
.day-notes ul { margin: .25rem 0 .5rem; }
.day-notes li { list-style: disc; margin-left: 1.25rem; margin-bottom: .2rem; }
.day-notes-allergy { border-top: 1px dashed #b9d9c9; padding-top: .4rem; }
/* Đón/trả: ghi chú ăn uống */
.ci-diet { border: 1px solid #dfe7e4; border-radius: 10px; padding: .5rem .6rem; margin: .5rem 0; }
.ci-diet summary { cursor: pointer; font-weight: 600; }
.ci-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin: .4rem 0; }
.ci-chips label { display: inline-flex; align-items: center; gap: .25rem; border: 1px solid #cfd8d5; border-radius: 999px; padding: .2rem .6rem; font-size: .9rem; margin: 0; cursor: pointer; background: #fff; }
.ci-chips label:has(input:checked) { background: #e3f4ec; border-color: #2f9e6e; }
.ci-chips input { margin: 0; width: auto; }
.ci-badge-diet { background: #e8f4ff; color: #1d5a8a; }
.ci-badge-day { background: #e3f4ec; color: #1f6d4c; }

/* 🍽 Lưu ý suất ăn (Báo cơm lớp / bếp) */
.badge.danger { background: #ffe3e3; color: #c92a2a; font-weight: 700; }
.badge.scope { background: #e9ecef; color: #343a40; }
.badge.scope-day { background: #e3f4ec; color: #1f6d4c; }
.badge.scope-profile { background: #f1f3f5; color: #6c757d; }
.meal-notes { border: 2px solid #f0b37e; background: #fff8f1; border-radius: 12px; padding: .75rem 1rem; margin: 1rem 0; }
.meal-notes h3 { margin: 0 0 .5rem; font-size: 1.05rem; }
.meal-notes ul { margin: .25rem 0 .5rem; padding-left: 0; }
.meal-note-item { list-style: none; margin-bottom: .35rem; padding: .25rem .4rem; border-radius: 8px; }
.meal-note-item.is-allergy { background: #fff0f0; border-left: 4px solid #e03131; }
.meal-note-item .mn-line { font-size: .9rem; margin: .1rem 0 0 .2rem; }
.mn-table td { vertical-align: top; }
.mn-table .ci-chips label { font-size: .85rem; padding: .1rem .45rem; }
.mn-table input[type=text] { margin: .2rem 0 0; padding: .3rem .5rem; font-size: .9rem; }
.mn-table .mn-skip { font-size: .8rem; color: #6c757d; }
.mn-row-allergy td:first-child { border-left: 4px solid #e03131; }
@media (max-width: 720px) { .mn-table thead { display: none; } .mn-table tr, .mn-table td { display: block; width: 100%; } }

/* ---------- Menu nhóm (phân hiệu Tiểu học / THCS, hiệu trưởng TH / THCS) ---------- */
.mainnav details.navgroup { position: relative; margin: 0; }
.mainnav details.navgroup > summary { list-style: none; cursor: pointer; padding: .45rem 1.6rem .45rem .85rem; border-radius: 999px;
  background: #fff; border: 1px solid var(--line); font-size: .92rem; font-weight: 600; color: var(--ink); margin: 0; line-height: inherit; }
.mainnav details.navgroup > summary::-webkit-details-marker { display: none; }
.mainnav details.navgroup > summary::after { content: "▾"; position: absolute; right: .65rem; top: .45rem; float: none; width: auto; height: auto;
  background: none; transform: none; font-size: .8rem; opacity: .7; }
.mainnav details.navgroup > summary:hover { background: #e7f3f0; border-color: #c5ddd6; }
.mainnav details.navgroup.active > summary { background: var(--brand); border-color: var(--brand); color: #fff; }
.mainnav details.navgroup[open] > summary { box-shadow: 0 0 0 3px #c5ddd6; }
.mainnav .navmenu { position: absolute; left: 0; top: calc(100% + .3rem); z-index: 60; min-width: 240px; display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--line); border-radius: .7rem; padding: .35rem; box-shadow: 0 8px 24px rgba(0,0,0,.12); white-space: normal; }
.mainnav .navmenu a { border: 0; border-radius: .5rem; padding: .6rem .75rem; background: none; min-height: 44px; display: flex; align-items: center; gap: .35rem; }
.mainnav .navmenu a.active { background: #e7f3f0; color: var(--brand); }
@media (max-width: 640px) {
  .mainnav details.navgroup[open] { flex-basis: 100%; order: 0; }
  .mainnav .navmenu { position: static; margin-top: .35rem; box-shadow: none; min-width: 0; }
}
.mainnav:has(details.navgroup) { justify-content: flex-start; }
@media (max-width: 640px) { .who b { display: inline-block; max-width: 28vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; } }
@media (max-width: 640px) { .brand { flex: 1 1 40%; } .brand-text small { white-space: normal; overflow-wrap: anywhere; } }

/* Chế độ đơn giản cho giáo viên (Bật/tắt tính năng): chữ to, nút to, menu phẳng, ẩn nút nâng cao */
body.simple-mode{font-size:1.15rem}
body.simple-mode main{line-height:1.6}
body.simple-mode button,body.simple-mode [role=button],body.simple-mode input[type=submit]{font-size:1.1rem;min-height:3rem;padding:.6rem 1.1rem}
body.simple-mode .mainnav a{font-size:1.1rem;padding:.6rem .9rem}
body.simple-mode .adv,body.simple-mode .simple-hide{display:none !important}
body.simple-mode table{font-size:1.05rem}
/* Hướng dẫn sử dụng (Trợ giúp TH / THCS) */
.guide-here { border: 2px solid var(--pico-primary, #1095c1); border-radius: .5rem; padding: .75rem 1rem; margin-bottom: 1rem; }
.guide-sec { border-bottom: 1px solid var(--pico-muted-border-color, #ddd); padding: .5rem 0 1rem; scroll-margin-top: 4rem; }
.guide-sec h3 { margin-bottom: .25rem; }
.guide-stub .faq-a { opacity: .8; }
.guide-links a { margin: 0 .4rem .4rem 0; }
.guide-toc { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: .5rem 1rem; margin-bottom: 1.5rem; }
.guide-toc ul { margin: .25rem 0 0; padding-left: 1.1rem; }
.guide-toc li { list-style: disc; margin: .1rem 0; }
.guide-group { margin-top: 1.5rem; font-size: 1.25rem; }

/* ===== Điện thoại (cỡ chữ cân đối, đầu trang 1 hàng ≤56px, menu trang thu gọn, thanh dưới cho trường TH/THCS) ===== */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.m-navbtn, .m-acct, .mbar { display: none; }
@media (max-width: 640px) {
  :root, :root:not([data-theme=dark]) { --pico-font-size: 93.75%; --pico-line-height: 1.45; --pico-font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif; }
  body { line-height: 1.45; overflow-wrap: break-word; }
  h1, main h1, .login-brand h1 { --pico-font-size: clamp(20px, 18px + .6vw, 22px); font-size: clamp(20px, 18px + .6vw, 22px); line-height: 1.3; }
  h2 { --pico-font-size: 18px; font-size: 18px; line-height: 1.35; }
  h3 { --pico-font-size: 16px; font-size: 16px; }
  h4, h5, h6 { --pico-font-size: 15px; font-size: 15px; }
  small, .small, .muted, main p small, .login-brand p { font-size: 13px; }
  .stat b { font-size: 1.4rem; }
  body > header.topbar, .topbar { padding-block: 0; padding-top: env(safe-area-inset-top); }
  .topbar-inner { flex-wrap: nowrap; gap: .35rem; padding: 6px 0; min-height: 55px; max-height: 55px; }
  .brand { gap: .5rem; min-height: 44px; }
  .login-card .muted, .login-card small, .login-card p { font-size: 13px; }
  .brand svg, .brand img { width: 28px; height: 28px; flex: none; }
  .brand-text strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .9375rem; }
  .brand-text small { display: none; }
  .topbar .logout { display: none; }
  .m-navbtn { display: grid; place-items: center; flex: none; width: 44px; height: 44px; margin: 0; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--ink); }
  .m-acct { display: block; position: relative; flex: none; margin: 0; }
  .m-acct > summary { list-style: none; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; cursor: pointer; }
  .m-acct > summary::-webkit-details-marker, .m-acct > summary::after { display: none; }
  .m-ava { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--brand, #0e6b5c); color: #fff; font-weight: 600; font-size: .95rem; }
  .m-acct-menu { position: absolute; right: 0; top: 48px; z-index: 40; min-width: 220px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.14); padding: 6px; }
  .m-acct-who { padding: 8px 10px; font-size: .8125rem; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; }
  .m-acct-menu a, .m-acct-menu button { display: flex; align-items: center; width: 100%; min-height: 44px; margin: 0; padding: 0 10px; border: 0; background: none; border-radius: 8px; color: var(--ink); font-size: .95rem; text-decoration: none; text-align: left; }
  .m-acct-menu form { margin: 0; }
  .mainnav { display: none; }
  body.nav-open .mainnav { display: flex; flex-direction: column; flex-wrap: nowrap; gap: 4px; padding: 4px 0 10px; white-space: normal; max-height: calc(100vh - 120px); overflow-y: auto; }
  body.nav-open .mainnav > a, body.nav-open .mainnav details.navgroup > summary { display: flex; align-items: center; min-height: 44px; border-radius: 10px; }
  body.nav-open .mainnav details.navgroup > div, body.nav-open .mainnav details.navgroup .navmenu { position: static; box-shadow: none; }
  main.container { overflow-x: hidden; }
  table { display: block; overflow-x: auto; }
  body.has-mbar { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .mbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .mbar a { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; color: var(--muted); text-decoration: none; font-size: .75rem; }
  .mbar a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; padding: 0 2px; }
  .mbar a.on { color: var(--brand, #0e6b5c); font-weight: 600; }
  .mbar .ic { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
}

/* Menu trang cũ của trường đã bật "Trợ lý Buinhuirom": nhóm "Công cụ nghiệp vụ" */
.mainnav .navgroup.tools .navmenu { max-height: 70vh; overflow-y: auto; }
.mainnav .navhead { display: block; padding: .45rem .75rem .15rem; font-size: .75rem; font-weight: 600; color: var(--muted, #667085); text-transform: uppercase; letter-spacing: .02em; }

/* Đầu trang + menu theo kiểu Mam (phản hồi 1/11): tên phân hiệu hiện đủ, xuống dòng (không "…"), tên trường dòng nhỏ dưới;
   menu = nút tròn 1 hàng vuốt ngang ngay dưới đầu trang; không còn nút ☰ và thanh dưới. */
@media (max-width: 640px) {
  .topbar { position: static; }
  .topbar-inner { max-height: none; min-height: 56px; padding: 8px 12px 6px; align-items: center; }
  .brand { flex: 1 1 0; min-width: 0; gap: .5rem; }
  .brand svg, .brand img { width: 36px; height: 36px; }
  .brand-text strong { white-space: normal; overflow: visible; text-overflow: clip; font-size: 16px; line-height: 1.2; overflow-wrap: break-word; }
  .brand-text small { display: block; font-size: 13px; line-height: 1.25; white-space: normal; }
  .m-navbtn, .mbar { display: none !important; }
  .mainnav, body.nav-open .mainnav { display: flex; flex-direction: row; flex-wrap: nowrap; gap: 6px; overflow-x: auto; overflow-y: hidden;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; padding: 2px 12px 10px; margin: 0; white-space: nowrap; max-height: none; }
  .mainnav::-webkit-scrollbar { display: none; }
  .mainnav > a, .mainnav details.navgroup > summary { flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 999px; font-size: 15px; }
  .mainnav details.navgroup > summary { padding-right: 1.6rem; }
  .mainnav details.navgroup { flex: none; }
  .mainnav:has(details.navgroup[open]) { flex-wrap: wrap; overflow: visible; }
  .mainnav details.navgroup[open] { flex-basis: 100%; }
  .mainnav details.navgroup .navmenu { position: static; box-shadow: none; min-width: 0; white-space: normal; }
}


/* Header sau login: tên trường LỚN (~17–18px đậm), phụ 12px; 1 dòng trên iPhone 390 */
.brand-text strong {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  overflow-wrap: normal !important;
  font-size: 17px !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
}
.brand-text { min-width: 0; overflow: hidden; }
.brand-text small {
  display: block !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  overflow-wrap: normal;
  font-size: 12px !important;
  font-weight: 500 !important;
  line-height: 1.25 !important;
}
.brand { min-width: 0; flex: 1 1 auto; }
@media (max-width: 400px) {
  .brand svg, .brand img { width: 26px !important; height: 26px !important; }
  .brand-text strong { font-size: 16px !important; }
  .brand-text small { font-size: 11px !important; }
  .m-ava { width: 28px !important; height: 28px !important; font-size: .8rem !important; }
  .m-acct > summary, .m-navbtn { width: 36px !important; height: 36px !important; }
  .topbar .logout .small-link { display: none !important; }
}

/* Login: placeholder không viết hoa */
.school-code-input { text-transform: uppercase; }
.school-code-input::placeholder { text-transform: none; opacity: .55; }
.school-code-help { display: block; margin: -.5rem 0 1rem; line-height: 1.35; }


/* t65u: brand cream + mainnav horizontal scroll on mobile */
:root:not([data-theme=dark]), [data-theme=light] {
  --bg: #fdfbf7;
  --brand: #002c22;
  --brand-dark: #001a14;
  --accent: #f99c00;
  --ink: #002c22;
  --muted: rgba(0,95,70,.75);
  --line: rgba(0,78,59,.12);
}
.mainnav {
  display: flex;
  flex-wrap: nowrap;
  gap: .35rem;
  padding: .15rem 0 .7rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  overscroll-behavior-x: contain;
}
.mainnav::-webkit-scrollbar { height: 4px; }
.mainnav::-webkit-scrollbar-thumb { background: rgba(0,78,59,.25); border-radius: 4px; }
.mainnav a { flex: none; white-space: nowrap; }
.mainnav-hint {
  display: none;
  font-size: .72rem;
  color: var(--muted);
  margin: -0.35rem 0 .4rem;
}
@media (max-width: 720px) {
  .mainnav-hint { display: block; }
}
