/* Quản Lý Máy Con — HQ Game Việt
   Mobile-first, portrait. Buttons >= 48px. Safe-area aware. */
*{box-sizing:border-box}
/* Thuộc tính hidden phải thắng mọi display của class (VD: .row{display:flex}
   từng làm #pair-code-row hiện cả ở live mode dù renderParent đã hidden=true). */
[hidden]{display:none!important}
:root{
  --red:#43A047; --wine:#2E7D32; --bronze:#66BB6A;
  --bg:#F1F8E9; --card:#FFFFFF; --ink:#2B2118; --muted:#6B5D4F;
  --line:#DCEDC8; --green:#2E7D32; --green-bg:#E6F2E6;
  --red-dark:#2E7D32; --red-bg:#E8F5E9; --pink:#F1F8E9; --gold-soft:#E8F5E9;
  --radius:20px;
}
html{-webkit-text-size-adjust:100%}
body{
  margin:0; background:var(--bg); color:var(--ink);
  font-family:"Be Vietnam Pro","Noto Sans",system-ui,-apple-system,"Segoe UI",sans-serif;
  font-size:17px; line-height:1.65; overflow-x:hidden;
  padding-bottom:env(safe-area-inset-bottom,0);
}
h1,h2,h3{font-family:"Noto Serif","Be Vietnam Pro",serif; color:var(--wine); line-height:1.3; margin:0 0 12px}
h1{font-size:34px} h2{font-size:26px} h3{font-size:20px}
p{margin:0 0 12px}
a{color:var(--red)}
img,video{max-width:100%; height:auto}
.wrap{max-width:960px; margin:0 auto; padding-left:16px; padding-right:16px}
.section{padding:36px 0}
.section-alt{background:#E8F5E9}
.lead{font-size:18px}
.muted{color:var(--muted)}
.small{font-size:14px; line-height:1.55}
/* Bộ đếm ngược tự khóa (v29): ngay dưới thẻ khóa, chữ to, xanh lá đậm. */
.relock-countdown{font-size:17px; font-weight:700; color:#2E7D32; margin:2px 4px 0; text-align:center}
/* Dòng trạng thái lưu cài đặt khóa (v29): lỗi phải đỏ + đậm, không thể bỏ qua. */
.lockset-status{font-size:16px; line-height:1.5; margin:8px 0 0; min-height:1.5em}
.lockset-status.error{color:#B71C1C; font-weight:700}
.lockset-status.ok{color:#2E7D32; font-weight:600}
.sr-only{position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap}

/* Topbar */
.topbar{background:var(--wine); color:#fff; position:sticky; top:0; z-index:20;
  padding-top:env(safe-area-inset-top,0)}
.topbar-in{display:flex; align-items:center; gap:10px; min-height:56px; flex-wrap:wrap; padding-top:6px; padding-bottom:6px}
.brand{color:#fff; font-weight:800; letter-spacing:.5px; text-decoration:none; font-size:17px; white-space:nowrap}
.topnav{display:flex; gap:4px; margin-left:auto}
.topnav a{color:#E8F5E9; text-decoration:none; font-size:15px; padding:10px 8px; border-radius:8px; min-height:44px; display:inline-flex; align-items:center}
.topnav a:active{background:rgba(255,255,255,.15)}
.lang-switch{display:flex; border:1px solid rgba(255,255,255,.5); border-radius:999px; overflow:hidden}
.lang-btn{border:0; background:transparent; color:#fff; font:inherit; font-size:14px;
  min-height:40px; padding:8px 12px; cursor:pointer}
.lang-btn.active{background:#fff; color:var(--wine); font-weight:700}

/* Hero */
.hero{background:linear-gradient(180deg,#E8F5E9,#F1F8E9); padding:44px 0 32px; text-align:center}
.badges{display:flex; gap:8px; justify-content:center; flex-wrap:wrap; margin-bottom:14px}
.badge{display:inline-block; background:#fff; border:1px solid var(--bronze); color:var(--wine);
  border-radius:999px; padding:8px 14px; font-size:15px; font-weight:700}
.hero-en{font-size:19px; color:var(--muted); font-weight:600; margin-top:-6px}
.hero-sub{max-width:640px; margin:0 auto 20px; font-size:18px}
.hero-cta{display:flex; gap:12px; justify-content:center; flex-wrap:wrap; margin:0}

/* Buttons — all >= 48px tall */
.btn{display:inline-flex; align-items:center; justify-content:center; gap:8px;
  min-height:52px; padding:12px 20px; border-radius:16px; border:2px solid transparent;
  font:inherit; font-size:17px; font-weight:700; text-decoration:none; cursor:pointer;
  text-align:center; line-height:1.3; -webkit-tap-highlight-color:transparent}
.btn:active{transform:translateY(1px)}
.btn-primary{background:var(--red); color:#fff; box-shadow:0 4px 14px rgba(67,160,71,.32)}
.btn-primary:hover{background:var(--wine)}
.btn-danger{background:#B71C1C; color:#fff; box-shadow:0 4px 14px rgba(183,28,28,.28)}
.btn-danger-outline{background:#fff; border:2px solid #B71C1C; color:#B71C1C}
.btn-ghost{background:#fff; border-color:var(--red); color:var(--red)}
.btn-big{width:100%; font-size:19px; min-height:56px}
.btn-block{display:flex; width:100%}
.btn-small{min-height:44px; font-size:15px; padding:10px 16px; border-radius:12px}
.btn[disabled]{opacity:.55; cursor:default}

/* Cards */
.card{background:#fff; border:1px solid var(--line); border-radius:20px; padding:18px; margin:14px 0;
  box-shadow:0 2px 6px rgba(43,33,24,.05),0 10px 26px rgba(43,33,24,.06)}
.dl-card{text-align:center}
.dl-card .btn-big{margin-bottom:12px}
.feat-grid{display:grid; grid-template-columns:1fr; gap:14px}
.feat{margin:0}
.feat h3{margin-bottom:6px}
.feat p{margin:0}

/* Demo dashboard */
.demo{padding:20px 16px}
.role-row{display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-bottom:8px}
.btn-role{flex-direction:column; gap:2px; background:#fff; border-color:var(--red); color:var(--ink); min-height:72px}
.btn-role span{font-size:14px; font-weight:400; color:var(--muted)}
.btn-role.active{background:var(--red); color:#fff}
.btn-role.active span{color:#E8F5E9}
.row{display:flex; gap:12px; align-items:flex-end; flex-wrap:wrap}
.wrap-row>*{flex:1 1 140px}
.field{display:flex; flex-direction:column; gap:6px; font-weight:600; font-size:15px}
.field.grow{flex:1 1 180px}
input[type=text],input[type=password],input[type=time],input[type=number],select{
  width:100%; min-height:48px; padding:10px 12px; border:2px solid var(--line); border-radius:10px;
  font:inherit; font-size:17px; background:#fff; color:var(--ink)}
input:focus,select:focus{outline:3px solid rgba(67,160,71,.35); border-color:var(--red)}
.pair-code{font-size:30px; font-weight:800; letter-spacing:6px; color:var(--wine);
  background:#E8F5E9; border:2px dashed var(--bronze); border-radius:12px;
  padding:12px 16px; margin:0; text-align:center; min-width:0; flex:1 1 200px; word-break:break-all}
.device-status{font-size:20px; font-weight:800; padding:9px 14px; border-radius:14px; margin:0 0 12px; text-align:center}
.device-status.locked{background:#FFEBEE; color:#E57373}
.device-status.open{background:var(--green-bg); color:var(--green)}
/* Cảnh báo tắt quyền (v40): dòng đỏ trên thẻ bé + đầu màn hình bé */
.tamper-warn{background:#FFEBEE; color:#C62828; font-weight:700; padding:9px 14px; border-radius:14px; margin:0 0 12px; text-align:center}
.sched-warn{background:#FFF8E1; color:#BF360C; font-weight:700; padding:9px 14px; border-radius:14px; margin:0 0 12px; text-align:center}
.kid-tamper{display:block; color:#C62828; font-weight:700; font-size:13px}

/* Switches (big touch targets) */
.switch-row{display:flex; gap:12px; flex-wrap:wrap; align-items:center; margin-bottom:12px}
.switch{display:inline-flex; align-items:center; gap:10px; min-height:48px; padding:8px 14px 8px 8px;
  border:2px solid var(--line); border-radius:999px; background:#fff; font:inherit; font-size:16px;
  font-weight:600; cursor:pointer; text-align:left}
.switch .knob{flex:0 0 auto; width:52px; height:30px; border-radius:999px; background:#C8E6C9; position:relative; transition:background .15s}
.switch .knob::after{content:""; position:absolute; top:3px; left:3px; width:24px; height:24px;
  border-radius:50%; background:#fff; box-shadow:0 1px 3px rgba(0,0,0,.3); transition:left .15s}
.switch[aria-pressed="true"]{border-color:var(--red); background:#F1F8E9}
.switch[aria-pressed="true"] .knob{background:var(--red)}
.switch[aria-pressed="true"] .knob::after{left:25px}
.pill{display:inline-block; min-height:32px; padding:6px 12px; border-radius:999px;
  background:#E8F5E9; color:var(--muted); font-size:15px; font-weight:700}
.pill.on{background:var(--green-bg); color:var(--green)}
.pill.off{background:#FFEBEE; color:#E57373}

/* App list */
.app-list{list-style:none; margin:0 0 14px; padding:0; display:grid; gap:10px}
.app-list li{display:flex; align-items:center; gap:12px; background:#fff; border:1px solid var(--line);
  border-radius:16px; padding:8px 12px; min-height:56px; box-shadow:0 1px 4px rgba(43,33,24,.04)}
/* Tieu de muc goi dang ky (1 may / 2 may / 3 may tro len): nen xanh nhat, khong co nut mua. */
.app-list li.sub-tier-head{background:#E8F5E9; min-height:44px}
.app-list .app-ico{flex:0 0 auto; width:40px; height:40px; border-radius:12px; background:#E8F5E9;
  display:flex; align-items:center; justify-content:center; font-size:17px; font-weight:800; color:var(--wine)}
.app-list .app-meta{flex:1 1 auto; min-width:0}
.app-list .app-meta strong{display:block; font-size:17px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.app-list .app-meta small{display:block; color:var(--muted); font-size:14px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.app-list .app-state{font-size:14px; font-weight:700; white-space:nowrap}
.app-list .app-state.locked{color:#2E7D32}
.app-list .app-state.open{color:var(--green)}
.app-list .switch{padding:6px 10px 6px 6px; min-height:44px}
.app-list .app-del{flex:0 0 auto; width:34px; height:34px; border-radius:50%; border:1px solid var(--line); background:#fff; color:var(--muted); font-size:20px; line-height:1; cursor:pointer}
.app-list .app-del:hover{border-color:var(--red); color:var(--red); background:#F1F8E9}
.pick-app{display:flex; align-items:center; gap:10px; width:100%; padding:8px 10px; border:1px solid var(--line); border-radius:12px; background:#fff; cursor:pointer; text-align:left; font:inherit}
.pick-app:active{background:#E8F5E9}
#app-pick-search{margin:0 0 10px}

/* Templates + messages */
.tpl-row{display:flex; gap:8px; flex-wrap:wrap; margin-bottom:12px}
.tpl-btn{min-height:48px; padding:10px 14px; border-radius:999px; border:2px solid var(--line);
  background:#fff; font:inherit; font-size:15px; font-weight:600; cursor:pointer; text-align:left}
.tpl-btn:active{border-color:var(--red); background:#F1F8E9}
.msg-list{list-style:none; margin:12px 0 0; padding:0; display:grid; gap:10px}
.msg-list li{background:#fff; border:1px solid var(--line); border-left:5px solid var(--bronze);
  border-radius:10px; padding:12px 14px}
.msg-list .msg-text{font-size:17px; overflow-wrap:anywhere}
.msg-list .msg-meta{font-size:14px; color:var(--muted); margin-top:4px}
.msg-list .msg-meta .read{color:var(--green); font-weight:700}

/* Child phone screen */
.phone{background:#1B1B1B; color:#fff; border-radius:20px; padding:22px 18px; margin-top:12px; text-align:center}
.phone.locked{background:#2E7D32}
.phone-status{font-size:26px; font-weight:800; margin:0 0 6px}
.phone-sub{color:#C8E6C9; font-size:16px}
.phone h4{color:#A5D6A7; font-family:"Be Vietnam Pro",sans-serif; font-size:17px; margin:18px 0 10px}
.phone .msg-list li{background:#2B2B2B; border-color:#444; color:#fff; text-align:left}
.phone .msg-list .msg-meta{color:#C8E6C9}
.phone .msg-list .msg-meta .read{color:#8BC34A}
.phone .btn{margin-top:6px}

/* Steps, note, FAQ, footer */
.steps{margin:0; padding-left:24px; display:grid; gap:12px; font-size:17px}
.steps li::marker{color:var(--red); font-weight:800}
.note-card{border:2px solid var(--red); background:#F1F8E9}
.note-card h2{color:#2E7D32}
.faq details{background:var(--card); border:1px solid var(--line); border-radius:12px; padding:6px 16px; margin:10px 0}
.faq summary{cursor:pointer; font-weight:700; font-size:17px; min-height:48px; display:flex; align-items:center; list-style:none}
.faq summary::-webkit-details-marker{display:none}
.faq summary::after{content:"+"; margin-left:auto; font-size:24px; color:var(--red); flex:0 0 auto; padding-left:12px}
.faq details[open ] summary::after{content:"−"}
.faq p{margin:4px 0 14px}
.footer{background:var(--wine); color:#E8F5E9; padding:28px 0 calc(28px + env(safe-area-inset-bottom,0))}
.footer a{color:#A5D6A7}
.footer p{margin:0 0 8px}
.demo-foot{margin:20px 0 0; text-align:center}

@media (min-width:640px){
  h1{font-size:44px} h2{font-size:30px}
  .feat-grid{grid-template-columns:1fr 1fr}
  .demo{padding:24px}
}
@media (min-width:900px){
  .feat-grid{grid-template-columns:1fr 1fr 1fr}
}
@media (max-width:380px){
  body{font-size:16px}
  h1{font-size:30px}
  .pair-code{font-size:24px; letter-spacing:4px}
  .topnav a{padding:10px 6px; font-size:14px}
}

/* ---------- App shell — điều hướng theo màn hình ---------- */
#app-shell{max-width:480px; margin:0 auto}
/* Header gradient rượu vang -> đỏ gạch + icon khóa trắng (theo mockup đã duyệt).
   Thanh trạng thái điện thoại giả trong mockup KHÔNG đưa vào app thật
   (hệ điều hành đã có thanh trạng thái riêng). */
.app-top{background:linear-gradient(135deg,#2E7D32 0%,#43A047 70%,#66BB6A 100%); border-bottom:3px solid var(--bronze); padding-top:env(safe-area-inset-top,0)}
.app-top .app-head{margin-bottom:0; padding:8px 16px 12px}
.app-icon{width:50px; height:50px; border-radius:16px; background:#fff; display:flex; align-items:center; justify-content:center; box-shadow:0 3px 10px rgba(0,0,0,.28); flex:0 0 auto}
.app-head{display:flex; align-items:center; gap:12px; margin-bottom:14px}
.app-head-title{font-size:22px; color:var(--wine); font-weight:800; flex:1 1 auto; min-width:0; line-height:1.25; white-space:nowrap}
.app-top .app-head-title{color:#fff}
.app-head-title small{display:block; font-size:13px; font-weight:500; color:#E8F5E9; opacity:.92; white-space:normal}
.app-toolbar{display:flex; align-items:center; justify-content:space-between; gap:10px; padding:10px 0; border-bottom:1px solid var(--line); margin-bottom:14px}
.app-toolbar .lang-switch{border-color:var(--red); flex:0 0 auto}
.app-toolbar .lang-btn{color:var(--red)}
.app-toolbar .lang-btn.active{background:var(--red); color:#fff}
/* Chế độ app (APK/IPA): header + toolbar tràn full-bleed như mockup. */
body.app-mode .app-top{margin:-16px -12px 0}
body.app-mode .app-toolbar{margin-left:-12px; margin-right:-12px; padding-left:12px; padding-right:12px}
.screen{padding:4px 0 8px}
.screen[hidden]{display:none}
.screen-head{margin-bottom:6px}
.screen-head .nav-back{margin-bottom:12px}
.screen-head h3{margin-bottom:6px; overflow-wrap:anywhere}
.func-list{display:grid; gap:12px; margin:14px 0}
.func-card{display:flex; align-items:center; gap:12px; width:100%; min-height:64px; padding:15px 16px;
  background:#fff; border:1px solid var(--line); border-radius:20px; font:inherit; text-align:left; cursor:pointer;
  box-shadow:0 2px 6px rgba(43,33,24,.05),0 10px 26px rgba(43,33,24,.06)}
.func-card:active{border-color:var(--red); background:#F1F8E9}
.func-card:disabled{opacity:.55; cursor:default}
.func-meta{flex:1 1 auto; min-width:0}
.func-t{display:block; font-size:18px; font-weight:700; color:var(--ink); overflow-wrap:anywhere}
.func-s{display:block; font-size:15px; line-height:1.45; color:var(--muted); font-weight:400; margin-top:2px; overflow-wrap:anywhere}
.func-chev{font-size:28px; line-height:1; color:var(--red); flex:0 0 auto}
.func-card .pill{flex:0 0 auto}
/* Pill là nút khóa/mở thật: bỏ viền/mặc định của <button>. */
button.pill{font:inherit; border:0; cursor:pointer}
button.pill:active{filter:brightness(.96)}
/* Nút chính trong thẻ "Khóa cả máy" (tiêu đề + trạng thái): không viền/nền,
   chiếm hết phần còn lại của thẻ; bấm vào mở màn hình khóa. */
.lock-card-main{flex:1 1 auto; min-width:0; background:none; border:0; padding:0; font:inherit; text-align:left; cursor:pointer; display:flex; align-items:center; gap:12px}
.lock-card-main .func-meta{display:block; flex:1 1 auto; min-width:0}
/* Ô hẹn tự khóa lại đặt ngay cạnh nút khóa/mở trên thẻ bé (cài đặt theo
   từng máy con): nhãn nhỏ phía trên, select gọn để vừa hàng với pill. */
.lockset-inline{flex:0 0 auto; display:flex; flex-direction:column; gap:2px; max-width:118px}
.lockset-inline>span{font-size:12px; line-height:1.2; color:var(--muted); font-weight:600}
.lockset-inline select{width:100%; min-height:38px; padding:6px 8px; font-size:15px}

/* ---------- Tiêu đề màn hình + nhãn mục (theo mockup đã duyệt) ---------- */
.screen-head h3{font-size:24px}
#scr-home > h3{font-size:27px}
.title-row{display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px}
.title-row h3{margin:0}
.title-row p{margin:0}
.section-label{font-size:13px; font-weight:700; letter-spacing:1.6px; text-transform:uppercase; color:var(--red); margin:10px 0}

/* ---------- Thẻ bé (dashboard) — theo mockup đã duyệt ---------- */
#kid-cards .card{margin:0}
.kid-card{display:flex; align-items:center; gap:14px; padding:16px; cursor:pointer}
.avatar{width:58px; height:58px; border-radius:50%; background:var(--gold-soft); color:var(--wine); font-weight:800; font-size:25px; display:flex; align-items:center; justify-content:center; flex:0 0 auto; border:2px solid #C8E6C9}
.avatar.locked{background:var(--red-bg); border-color:#C8E6C9; color:var(--red-dark)}
.kid-meta{flex:1; min-width:0}
.kid-name{display:block; font-size:19px; font-weight:700; line-height:1.3; overflow-wrap:anywhere}
.kid-sub{display:block; font-size:14px; color:var(--muted); margin-top:3px; line-height:1.4; overflow-wrap:anywhere}
.kid-countdown{display:block; font-size:13px; font-weight:700; color:#2E7D32; margin-top:2px}
.kid-side{display:flex; flex-direction:column; align-items:flex-end; gap:9px; flex:0 0 auto}
.pill-status{font-size:14px; font-weight:700; padding:6px 13px; border-radius:999px; white-space:nowrap}
.pill-status.on{background:var(--green-bg); color:var(--green)}
.pill-status.off{background:#FFEBEE; color:#E57373}
.btn-lock{display:inline-flex; align-items:center; gap:6px; min-height:40px; padding:8px 15px; border-radius:999px; font:inherit; font-size:15px; font-weight:700; border:0; cursor:pointer; color:#fff}
.btn-lock.lock{background:var(--red); box-shadow:0 3px 10px rgba(67,160,71,.32)}
.btn-lock.unlock{background:var(--green); box-shadow:0 3px 10px rgba(46,125,50,.3)}
.btn-lock svg{width:16px; height:16px}
.btn-lock[disabled]{opacity:.55; cursor:default}

/* ---------- Thẻ khóa cả máy (màn hình khóa) — theo mockup đã duyệt ---------- */
.lock-hero{background:linear-gradient(180deg,#F1F8E9,#FFFFFF); border:2px solid #C8E6C9; border-radius:22px; padding:12px 18px; margin-bottom:14px;
  box-shadow:0 2px 6px rgba(43,33,24,.05),0 10px 26px rgba(43,33,24,.06)}
.lock-hero .device-status{margin-bottom:10px}
.lock-hero .btn{margin:0}

/* ---------- Nhắn cho con: bong bóng chat (theo mockup đã duyệt) ---------- */
.chat{display:flex; flex-direction:column; gap:8px; margin:12px 0 4px}
.bubble{max-width:84%; padding:10px 14px; border-radius:18px; font-size:16px; line-height:1.55; overflow-wrap:anywhere}
.bubble.me{align-self:flex-end; background:var(--red); color:#fff; border-bottom-right-radius:6px; box-shadow:0 3px 10px rgba(67,160,71,.25)}
.bubble.them{align-self:flex-start; background:#fff; border:1px solid var(--line); border-bottom-left-radius:6px; box-shadow:0 1px 4px rgba(43,33,24,.05)}
.bubble .msg-text{overflow-wrap:anywhere}
.bubble .msg-meta{font-size:12px; margin-top:3px}
.bubble.me .msg-meta{color:#C8E6C9}
.bubble.them .msg-meta{color:var(--muted)}
.bubble .msg-meta .read{font-weight:700; color:#8BC34A}
.bubble.me .msg-meta .read{color:#B9F6CA}
.bubble .msg-attach{margin:6px 0 2px}
.bubble .msg-attach img{max-width:100%; max-height:220px; border-radius:10px; display:block}
.bubble.me .msg-attach a{color:#fff}
.file-chip{display:flex; gap:10px; align-items:center; background:rgba(255,255,255,.16); border:1px solid rgba(255,255,255,.4); border-radius:12px; padding:8px 12px; margin-bottom:6px; text-decoration:none; color:inherit}
.file-ico{width:38px; height:38px; border-radius:10px; background:#fff; color:var(--red-dark); font-size:11px; font-weight:800; display:flex; align-items:center; justify-content:center; flex:0 0 auto}
.file-meta{font-size:14px; line-height:1.4; min-width:0; overflow-wrap:anywhere}
.file-meta small{display:block; font-size:12px; opacity:.85}
.bubble.them .file-chip{background:#E8F5E9; border-color:var(--line)}
.bubble.them .file-ico{background:var(--red); color:#fff}

/* ---------- Cài đặt: thẻ tài khoản + vùng nguy hiểm (theo mockup đã duyệt) ---------- */
.account-card{display:flex; align-items:center; gap:14px; padding:16px}
.account-card .avatar{width:60px; height:60px; font-size:26px}
.danger-zone{border:2px solid #C8E6C9; background:#F1F8E9; border-radius:20px; padding:18px; margin:14px 0;
  box-shadow:0 2px 6px rgba(43,33,24,.05)}
.danger-zone h4{color:var(--red-dark); font-size:18px; font-family:"Be Vietnam Pro",sans-serif; margin:0 0 6px}
.danger-zone p{font-size:15px; color:var(--muted); line-height:1.5; margin:0 0 14px}
.danger-zone p:last-child{margin-bottom:0}
#kid-cards{display:grid; gap:12px; margin:14px 0}
#home-empty{margin:14px 0}
#home-empty .btn{margin-top:6px}
#home-add-kid{margin-bottom:4px}
#pair-next{margin-top:16px}

/* Thanh tab dưới cùng (chỉ vai phụ huynh) */
.app-tabs{display:flex; gap:4px; position:sticky; bottom:0; z-index:10;
  background:#fff; border-top:1px solid var(--line);
  padding:6px 8px calc(10px + env(safe-area-inset-bottom,0)); margin-top:18px}
.app-tabs[hidden]{display:none}
.tab-btn{flex:1 1 0; min-width:0; min-height:56px; border:0; background:transparent;
  font:inherit; font-size:14px; font-weight:700; color:var(--muted); cursor:pointer; border-radius:10px;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; padding:6px 2px}
.tab-btn.active{color:var(--red); background:#F1F8E9}
.tab-ico{font-size:20px; line-height:1}
.tab-btn span:last-child{overflow-wrap:anywhere; text-align:center; line-height:1.3}

/* ---------- Chế độ app (Capacitor hoặc ?app=1) ---------- */
/* Ẩn toàn bộ trang landing, chỉ hiện app shell full-screen — không còn cảm giác website. */
body.app-mode{padding-bottom:0}
/* Thanh tab dính đáy màn hình trong app (màn ngắn vẫn có tab ở đáy,
   như mockup đã duyệt); trên web demo giữ nguyên vị trí sau nội dung. */
body.app-mode #app-shell{display:flex; flex-direction:column; min-height:calc(100vh - 16px)}
body.app-mode .app-tabs{margin-top:auto}
body.app-mode .topbar, body.app-mode .hero, body.app-mode .footer{display:none}
body.app-mode main > section:not(#thu-ngay){display:none}
body.app-mode #thu-ngay{padding:0}
body.app-mode #thu-ngay > .wrap{max-width:480px; padding-left:12px; padding-right:12px}
body.app-mode #thu-ngay h2, body.app-mode #thu-ngay .lead{display:none}
body.app-mode #demo{border:0; border-radius:0; margin:0; padding:16px 0 calc(8px + env(safe-area-inset-bottom,0)); background:transparent}
body.app-mode .demo-foot{display:none}

/* Live mode: form đăng nhập phụ huynh — các field xếp dọc cần khoảng cách. */
#auth-form .field{margin-bottom:12px}
#auth-form .row{margin-top:4px}

/* ---------- Tin nhắn: ảnh/tài liệu đính kèm ---------- */
.msg-attach{margin:6px 0 2px}
.msg-attach img{max-width:220px; max-height:220px; border-radius:10px; display:block}
.msg-attach a{color:var(--blue); overflow-wrap:anywhere}
.msg-attach-prev{margin:6px 0; display:flex; align-items:center; gap:8px}
.msg-attach-prev .msg-text{overflow-wrap:anywhere}

/* ---------- Toast thông báo đẩy (app mở sẵn vẫn thấy) ---------- */
.push-toast{position:fixed; left:50%; transform:translateX(-50%); bottom:calc(72px + env(safe-area-inset-bottom,0)); z-index:60; max-width:min(92vw,480px); background:#222; color:#fff; padding:10px 14px; border-radius:12px; font-size:14px; box-shadow:0 4px 16px rgba(0,0,0,.3)}

/* ---------- Ẩn bản thử trên web (chỉ hiện trong APK) ---------- */
/* #demo là app shell của APK (body.app-mode) nên KHÔNG được xóa khỏi
   index.html — chỉ ẩn section #thu-ngay khi xem bằng trình duyệt.
   14/11 Alan cho hiện trên web, 15/11 Alan quyết ẩn lại. */
body:not(.app-mode) #thu-ngay{display:none}

/* ---------- Hướng dẫn cài đặt ---------- */
.guide-grid{display:grid; grid-template-columns:1fr; gap:14px}
.guide-col{margin:0}
.guide-col h3{margin-bottom:6px}
.guide-steps{list-style:none; margin:14px 0 0; padding:0; display:grid; gap:16px; counter-reset:guide-step}
.guide-steps li{position:relative; padding-left:52px}
.guide-steps li::before{counter-increment:guide-step; content:counter(guide-step);
  position:absolute; left:0; top:0; width:38px; height:38px; border-radius:50%;
  background:var(--red); color:#fff; font-size:18px; font-weight:800;
  display:flex; align-items:center; justify-content:center}
.guide-steps h4{font-family:"Be Vietnam Pro",sans-serif; color:var(--ink); font-size:17px; margin:0 0 4px}
.guide-steps p{margin:0 0 8px}
.guide-fig{margin:0 0 4px}
.guide-fig img{display:block; width:100%; max-width:320px; border:1px solid var(--line); border-radius:12px}
@media (min-width:900px){
  .guide-grid{grid-template-columns:1fr 1fr}
}

/* Màn hình gọi đến (v24) — overlay toàn màn hình như điện thoại: tên bé,
   nút Nghe/Từ chối. Nằm trên mọi màn hình (z-index cao hơn toast). */
.incoming-call{position:fixed;inset:0;z-index:9999;display:flex;align-items:center;justify-content:center;background:rgba(27,60,27,.94);color:#fff;text-align:center}
.incoming-call[hidden]{display:none}
.incoming-call-card{padding:24px;max-width:420px}
.incoming-call-avatar{font-size:64px;margin:0 0 8px}
.incoming-call-name{font-size:24px;font-weight:700;margin:0 0 8px;color:#fff}
.incoming-call .muted{color:#ddd}
.incoming-call-actions{justify-content:center;margin-top:28px}
