/* Giao diện thân thiện, nút to cho điện thoại. Dựa trên Pico.css */
:root { --pico-primary: #e8590c; --pico-primary-background: #e8590c; --pico-primary-hover: #d9480f; --pico-primary-hover-background: #d9480f; --pico-font-size: 106%; }
body { background: #fffaf3; }
main.container { padding-top: 1rem; padding-bottom: 6rem; }
.topbar { background: #fff; border-bottom: 1px solid #f1e3d3; position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; padding: .5rem 0; gap: .5rem; }
.brand { font-weight: 700; text-decoration: none; font-size: 1.1rem; }
.logout { display: flex; align-items: center; gap: .5rem; margin: 0; flex-wrap: wrap; justify-content: flex-end; }
.logout button { margin: 0; padding: .3rem .7rem; width: auto; }
.who { font-size: .85rem; color: #666; }
.small-link { font-size: .85rem; white-space: nowrap; }
.mainnav { display: flex; gap: .3rem; overflow-x: auto; padding-bottom: .5rem; white-space: nowrap; }
.mainnav a { padding: .4rem .75rem; border-radius: 999px; background: #fff3e6; text-decoration: none; font-size: .95rem; }
.mainnav a:hover { background: #ffe0c2; }
.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: #fff3e6; }
.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 #e8590c; margin-bottom: .5rem; }
.seg-btn { padding: .55rem 1rem; text-decoration: none; }
.seg-btn.active { background: #e8590c; color: #fff; }
.tabs { display: flex; gap: .5rem; margin-bottom: .5rem; }
.tabs a { padding: .4rem 1rem; border-radius: .5rem; text-decoration: none; background: #fff3e6; }
.tabs a.active { background: #e8590c; 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, #fffaf3 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; }
.badge.bad { background: #ffe3e3; color: #c92a2a; }
.badge.muted-badge { background: #f1f3f5; color: #868e96; }
.channels .badge { margin-right: .25rem; }
