/* Khung app điện thoại: 2 trang con (Nhập phiếu, Quản lý) + trang Sao lưu, thanh chuyển trang ở dưới. Một giao diện sáng (dùng ngoài trời). */
:root {
  color-scheme: light;
  --bg: #F5F4F0; --surface: #FFFFFF; --ink: #1B1E22; --muted: #5A5E66; --line: #E2DFD7; --soft: #EFEDE7;
  --accent: #C2410C; --accent-ink: #9A3412; --accent-soft: #FFF4EC;
  --ok: #166534; --ok-bg: #DCFCE7; --warn-bg: #FEF7C3; --warn-line: #CA8A04; --warn-ink: #713F12; --bad: #991B1B; --bad-bg: #FEE2E2;
  --tabs-h: 60px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 16px/1.5 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif; -webkit-text-size-adjust: 100%; }
body { overflow: hidden; }
button { font: inherit; color: inherit; }
.boot { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; z-index: 5; background: var(--bg); }
.boot b { font-size: 20px; }
.boot button { font-weight: 600; padding: 12px 22px; border: 0; border-radius: 12px; background: var(--accent); color: #fff; }
#frames { position: fixed; left: 0; right: 0; top: 0; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom)); }
#frames iframe { border: 0; width: 100%; height: 100%; display: block; background: var(--bg); }
#frames [hidden] { display: none !important; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tabs-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); display: flex; background: var(--surface); border-top: 1px solid var(--line); z-index: 3; }
.tabs[hidden] { display: none; }
.tabs button { flex: 1; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; font-weight: 600; color: var(--muted); position: relative; -webkit-tap-highlight-color: transparent; }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs button[aria-current] { color: var(--accent); }
.tabs i { position: absolute; top: 8px; left: calc(50% + 8px); width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }

/* trang Sao lưu */
.page { height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: calc(16px + env(safe-area-inset-top)) 16px 24px; }
.page h1 { font-size: 22px; margin: 4px 0 14px; }
.page h2 { font-size: 16px; margin: 0 0 6px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 14px; }
.card p { margin: 0 0 10px; color: var(--muted); font-size: 15px; }
.card p:last-child { margin-bottom: 0; }
.card.warn { background: var(--warn-bg); border-color: var(--warn-line); }
.card.warn p, .card.warn h2 { color: var(--warn-ink); }
.card.ok { background: var(--ok-bg); border-color: #86EFAC; }
.card.ok p, .card.ok h2 { color: var(--ok); }
.btn { display: flex; width: 100%; align-items: center; justify-content: center; gap: 8px; min-height: 50px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 16px; padding: 10px 16px; margin-top: 10px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn:disabled { opacity: .6; }
.steps { margin: 6px 0 0; padding-left: 20px; color: var(--muted); font-size: 15px; }
.steps li { margin-bottom: 4px; }
.meta { font-size: 13px; color: var(--muted); }
.msg { margin-top: 10px; font-size: 15px; font-weight: 600; }
.msg.bad { color: var(--bad); }
.msg.good { color: var(--ok); }

/* trang Chủ nhà */
.cn-top { display: flex; align-items: center; gap: 8px; margin: 4px 0 14px; }
.cn-top h1 { margin: 0; font-size: 21px; line-height: 1.25; }
.cn-back { flex: none; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 26px; line-height: 1; padding: 0 0 3px; }
.cn-h2 { font-size: 15px; margin: 14px 0 4px; color: var(--muted); }
.cn-site { display: block; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin-bottom: 10px; }
.cn-site > b { display: block; font-size: 17px; }
.cn-site .meta { display: block; }
.cn-nums { display: flex; gap: 8px; margin-top: 8px; }
.cn-nums > span { flex: 1; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; }
.cn-nums b { font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }
.good { color: var(--ok) !important; }
.due { color: var(--accent) !important; }
.bad { color: var(--bad) !important; }
.cn-kv { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 4px 0; font-size: 15px; }
.cn-kv span { color: var(--muted); }
.cn-kv b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cn-kv.big { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 10px; font-size: 18px; }
.cn-row { display: flex; width: 100%; align-items: center; gap: 10px; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 10px 0; font-size: 15px; }
.cn-row b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cn-name { flex: 1; min-width: 0; font-weight: 600; }
.cn-name small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
.cn-r { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 99px; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.part { background: var(--warn-bg); color: var(--warn-ink); }
.pill.wait { background: var(--soft); color: var(--muted); }
.link-del { border: 0; background: none; color: var(--bad); font-weight: 600; padding: 8px 4px; }
.f { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; min-width: 0; }
.f span { font-size: 14px; font-weight: 600; color: var(--muted); }
.f input, .f select { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font: inherit; font-size: 16px; background: #fff; color: var(--ink); }
.f input:focus, .f select:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.cn-2 { display: flex; gap: 10px; }
.cn-2 > .f { flex: 1; }
.chk { display: flex; gap: 10px; align-items: center; font-size: 15px; margin: 4px 0 12px; }
.chk input { width: 22px; height: 22px; }
details { margin-bottom: 12px; }
summary { font-weight: 600; color: var(--accent-ink); padding: 6px 0; }
.btn.small { min-height: 38px; width: auto; display: inline-flex; font-size: 14px; padding: 6px 12px; margin-top: 6px; }
.btn.danger { color: var(--bad); }
.cn-bl { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cn-bl-in { display: flex; align-items: center; gap: 6px; flex: none; }
.cn-bl-in input { width: 86px; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; font: inherit; font-size: 16px; text-align: right; }
.cn-bl-in .btn.small { margin: 0; }
.cn-img { width: 100%; border-radius: 10px; border: 1px solid var(--line); background: #fff; display: block; -webkit-touch-callout: default; }
.cn-sum .btn.small { align-self: flex-start; }

/* xóa toàn bộ dữ liệu: khóa + 2 bước */
#p-sl .msg.bad .steps { color: var(--bad); }
#p-sl label.check { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; font-size: 15px; line-height: 1.4; }
#p-sl label.check input { width: 22px; height: 22px; flex: none; margin-top: 1px; accent-color: var(--bad); }
#p-sl .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#p-sl .inp { display: block; width: 100%; margin-top: 10px; min-height: 50px; border: 2px solid var(--bad); border-radius: 12px; padding: 10px 14px; font-size: 18px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; background: var(--surface); color: inherit; }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }

/* Android: thanh mời cài app */
.inst { position: fixed; left: 10px; right: 10px; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 10px); z-index: 4; display: grid; grid-template-columns: 1fr auto auto; grid-template-rows: auto auto; column-gap: 8px; align-items: center; background: var(--ink); color: #fff; border-radius: 14px; padding: 12px 10px 12px 14px; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.inst[hidden] { display: none; }
.inst b { grid-column: 1; font-size: 15px; }
.inst span { grid-column: 1; grid-row: 2; font-size: 13px; opacity: .8; line-height: 1.3; }
.inst button { grid-row: 1 / 3; border: 0; border-radius: 10px; font: inherit; font-weight: 700; }
.inst #inst-go { background: var(--accent); color: #fff; padding: 10px 18px; }
.inst .x { background: none; color: #fff; opacity: .7; padding: 8px; font-size: 18px; }
