:root {
  /* Màu & font lấy theo asahilife.com: navy #002F72, nền #FAF9FD, chữ #1A1B1F, Noto Sans */
  --navy: #002f72;
  --navy-2: #20376d;
  --pink: #002f72;
  --pink-soft: #e6ecf6;
  --bg: #faf9fd;
  --text: #1a1b1f;
  --muted: #5f6577;
  --line: #e1e3ec;
  --ok: #1f9d63;
  --warn: #d98a00;
  --bad: #d23b4c;
  --radius: 6px;
  --grad: linear-gradient(180deg, #002f72 0%, #5574a1 100%);
  --topbar-h: 56px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Noto Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}
h1, h2, h3 { margin: 0 0 8px; color: var(--navy); }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
a { color: var(--navy-2); }
.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: 13px; }
.hide { display: none !important; }

/* header */
.topbar {
  background: linear-gradient(90deg, #002f72 0%, #20376d 100%);
  color: #fff;
  height: var(--topbar-h);
  padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; font-weight: 700; font-size: 17px; letter-spacing: .2px; }
.logo { display: block; width: auto; }
.logo-fb { font-weight: 600; font-size: 20px; color: #fff; letter-spacing: .3px; }
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.who .name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: 12px; font-weight: 600;
  background: var(--pink-soft); color: var(--pink);
}
.topbar .badge { background: rgba(255,255,255,.15); color: #fff; }
.topbar .btn.ghost { background: #fff; color: #002364; border-color: transparent; }
.topbar .btn.ghost:hover { background: #eef1f8; }
.badge.ok { background: #e3f6ec; color: var(--ok); }
.badge.warn { background: #fff3d9; color: var(--warn); }
.badge.bad { background: #fde7ea; color: var(--bad); }
.badge.gray { background: #eceef5; color: var(--muted); }

.tabs {
  display: flex; gap: 4px; overflow-x: auto; background: #fff; border-bottom: 1px solid var(--line);
  padding: 0 10px; position: sticky; top: var(--topbar-h); z-index: 19;
}
.tabs a {
  padding: 11px 14px; text-decoration: none; color: var(--muted); font-weight: 600; white-space: nowrap;
  border-bottom: 3px solid transparent;
}
.tabs a.on { color: var(--navy); border-bottom-color: var(--pink); }

main { max-width: 1100px; margin: 0 auto; padding: 16px; min-height: calc(100vh - 260px); }

/* footer (nền navy chuyển sắc như asahilife.com) */
.foot { background: var(--grad); color: #fff; margin-top: 24px; }
.foot-in { max-width: 1100px; margin: 0 auto; padding: 28px 16px 24px; }
.foot-in p { margin: 14px 0 0; font-size: 13px; color: rgba(255,255,255,.75); }

/* cards & forms */
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px; box-shadow: 0 1px 2px rgba(20,37,74,.04);
}
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }
label { display: block; font-size: 13px; font-weight: 600; margin: 10px 0 4px; color: var(--navy); }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px;
  font: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--pink-soft); border-color: var(--pink); }
textarea { min-height: 90px; resize: vertical; }
input[type=file] { padding: 8px; }

.btn {
  display: inline-block; border: 0; cursor: pointer; font: inherit; font-weight: 600;
  background: var(--navy); color: #fff; padding: 9px 18px; border-radius: 6px; text-decoration: none;
}
.btn:hover { background: var(--navy-2); }
.btn.pink { background: var(--pink); }
.btn.pink:hover { background: var(--navy-2); }
.btn.ghost { background: #fff; color: var(--navy); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--bg); }
.btn.danger { background: #fff; color: var(--bad); border: 1px solid #f1c2c8; }
.btn.danger:hover { background: #fde7ea; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 4px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* tables */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { background: #f1f3f9; color: var(--navy); font-size: 13px; white-space: nowrap; }
td.act { white-space: nowrap; text-align: right; }
td.act .btn { margin-left: 4px; }

/* auth */
body:has(.auth) { background: #00183d; }
.auth { position: relative; z-index: 2; max-width: 420px; margin: 0 auto; padding: 44px 16px 56px; }
.auth .card { border: 1px solid rgba(255,255,255,.35); border-radius: 14px; padding: 24px 22px; background: rgba(255,255,255,.94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 20px 50px rgba(0,10,40,.4); }
.auth .card h2 { margin-bottom: 4px; }
.auth-hero { text-align: center; color: #fff; margin-bottom: 26px; }
.auth-logo { display: flex; justify-content: center; margin-bottom: 26px; }
.auth-title { font-size: 40px; font-weight: 300; line-height: 1.15; letter-spacing: .2px; }
.auth-div { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 16px 0 12px; }
.auth-div i { display: block; height: 1px; width: 48px; background: rgba(255,255,255,.25); }
.auth-sub { font-size: 16px; font-weight: 500; color: rgba(255,255,255,.85); }
@media (max-width: 380px) { .auth-title { font-size: 34px; } }
.seg { display: flex; background: #eef0f7; border-radius: 6px; padding: 3px; margin-bottom: 8px; }
.seg button {
  flex: 1; border: 0; background: transparent; padding: 9px; border-radius: 4px; font: inherit;
  font-weight: 600; color: var(--muted); cursor: pointer;
}
.seg button.on { background: #fff; color: var(--navy); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.form-msg { margin-top: 10px; font-size: 14px; }
.form-msg.err { color: var(--bad); }
.form-msg.okm { color: var(--ok); }

/* scan */
#reader { width: 100%; max-width: 360px; margin: 12px auto; border-radius: 6px; overflow: hidden; }
.result { border-radius: 6px; padding: 16px; margin: 14px 0; text-align: left; border: 2px solid; }
.result.ok { background: #e9f8f0; border-color: var(--ok); }
.result.info { background: #eaf1ff; border-color: #4a78d6; }
.result.warn { background: #fff7e3; border-color: var(--warn); }
.result.bad { background: #fdecef; border-color: var(--bad); }
.result h3 { margin-bottom: 4px; }

/* qr screen */
.qr-screen {
  min-height: 100vh; background: var(--navy); color: #fff;
  display: flex; flex-direction: column; align-items: center; padding: 18px 14px; gap: 12px;
}
.qr-screen h2 { color: #fff; margin: 0; text-align: center; }
.qr-box { background: #fff; padding: 14px; border-radius: 8px; }
.qr-box canvas { display: block; }
.bar { width: min(80vw, 360px); height: 8px; border-radius: 99px; background: rgba(255,255,255,.2); overflow: hidden; }
.bar i { display: block; height: 100%; width: 100%; background: #fff; transform-origin: left; }
.qr-stats { display: flex; gap: 24px; align-items: center; }
.qr-stats b { font-size: 34px; }
.qr-list { width: min(92vw, 420px); font-size: 14px; max-height: 180px; overflow: auto; }
.qr-list div { padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,.1); display: flex; justify-content: space-between; }

/* modal & toast */
.modal {
  position: fixed; inset: 0; background: rgba(15,22,45,.55); z-index: 50;
  display: flex; align-items: flex-start; justify-content: center; padding: 30px 12px; overflow: auto;
}
.modal-box { background: #fff; border-radius: 8px; padding: 18px; width: 100%; max-width: 520px; }
#toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 99; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); }
.toast { background: var(--navy); color: #fff; padding: 11px 14px; border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.25); font-size: 14px; }
.toast.err { background: var(--bad); }
.toast.ok { background: var(--ok); }

.stat { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.stat .chip { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 8px 14px; }
.stat .chip b { display: block; font-size: 20px; color: var(--navy); }

/* o ngay tren man hinh nho khong tran khung */
.grid2 > div { min-width: 0; }
input[type="date"] { min-width: 0; width: 100%; max-width: 100%; box-sizing: border-box; }
input[type="date"] { -webkit-appearance: none; appearance: none; display: block; }

/* dong lop hoc bam duoc ca dong */
tr.rowlink { cursor: pointer; }
tr.rowlink:active { background: #eef1f8; }
tr.rowlink a { color: inherit; text-decoration: none; }

/* nut tren 1 dong (trang chi tiet lop, lich day) */
.btnrow { display: flex; gap: 8px; flex-wrap: nowrap; margin-top: 12px; }
.btnrow .btn { flex: 1 1 auto; padding: 9px 6px; font-size: 14px; white-space: nowrap; text-align: center; }

/* lich day */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 12px; }
.cal-h { text-align: center; font-size: 12px; font-weight: 600; color: var(--muted, #6b7280); padding: 4px 0; }
.cal-cell { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 4px;
  min-height: 54px; padding: 6px 2px; border: 1px solid var(--line, #e3e6ef); border-radius: 8px; background: #fff;
  font: inherit; cursor: pointer; }
.cal-cell.out { opacity: .4; }
.cal-cell.today .cal-n { background: #002f72; color: #fff; border-radius: 50%; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; }
.cal-cell.sel { border-color: #002f72; box-shadow: 0 0 0 2px #002f7233; }
.cal-n { font-size: 14px; font-weight: 600; }
.cal-dots { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; }
.cal-dots i, .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.cal-dots i.s, .dot.s { background: #e0457b; }
.cal-dots i.c, .dot.c { background: #002f72; }
.sch-item { padding: 10px 0; border-top: 1px solid var(--line, #e3e6ef); }
.sch-item .btnrow { margin-top: 8px; }

/* ===== nền video + hero (theo asahilife.com) ===== */
.bgv { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: #00183d; }
.bgv-poster, .bgv-v { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background-size: cover; background-position: center; }
.bgv-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,24,61,.55) 0%, rgba(0,47,114,.35) 45%, rgba(0,24,61,.8) 100%); }
@media (prefers-reduced-motion: reduce) { .bgv-v { display: none; } }
.auth-jp { font-size: 15px; letter-spacing: 6px; color: rgba(255,255,255,.85); margin-bottom: 10px; }
.auth-title { text-shadow: 0 2px 20px rgba(0,0,0,.35); }
.auth-hero { color: #fff; }
.auth .small a, .auth .muted { color: #1c3a72; }

.phero { background-size: cover; background-position: center 35%; position: relative; color: #fff; }
.phero::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0,35,100,.88) 0%, rgba(0,47,114,.55) 55%, rgba(0,47,114,.25) 100%); }
.phero-in { position: relative; max-width: 1100px; margin: 0 auto; padding: 26px 16px 28px; }
.phero-jp { font-size: 12px; letter-spacing: 5px; opacity: .85; margin-bottom: 6px; }
.phero h1 { color: #fff; font-size: 26px; font-weight: 300; margin: 0 0 4px; letter-spacing: .2px; }
.phero p { margin: 0; font-size: 14px; color: rgba(255,255,255,.88); max-width: 560px; }
@media (min-width: 700px) { .phero-in { padding: 38px 16px 40px; } .phero h1 { font-size: 34px; } }
main { min-height: calc(100vh - 380px); }
.card { border-radius: 12px; box-shadow: 0 2px 10px rgba(0,35,100,.06); }
.foot { position: relative; overflow: hidden; }
.foot-jp { margin-top: 10px; font-size: 11px; letter-spacing: 4px; color: rgba(255,255,255,.55); }

/* ===== v9: căn giữa video, hero từng trang, hiệu ứng ===== */
.bgv-v { left: 50%; top: 50%; right: auto; bottom: auto; inset: auto; width: auto; height: auto; min-width: 100%; min-height: 100%;
  transform: translate(-50%, -50%); object-fit: cover; object-position: 50% 50%; }
.bgv-poster { background-position: 50% 50%; }
.auth { display: flex; flex-direction: column; justify-content: center; min-height: 100vh; min-height: 100dvh; }
.auth-hero, .auth .card { width: 100%; }
.phero { background-size: cover; background-repeat: no-repeat; background-color: #00235f; }
.phero::before { background: linear-gradient(90deg, rgba(0,24,61,.9) 0%, rgba(0,47,114,.6) 55%, rgba(0,47,114,.3) 100%); }
.phero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 28px; background: linear-gradient(180deg, transparent, var(--bg)); }
.phero-in { min-height: 112px; display: flex; flex-direction: column; justify-content: center; }
.phero h1 { font-weight: 600; font-size: 28px; letter-spacing: .2px; }
.phero-jp { font-size: 13px; letter-spacing: 8px; }
@media (min-width: 700px) { .phero-in { min-height: 170px; } .phero h1 { font-size: 38px; } }
@keyframes fadeup { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
main > .card, main > div > .card { animation: fadeup .45s ease both; }
.tabs { box-shadow: 0 2px 10px rgba(0,35,100,.06); }
.tabs a.on { border-bottom-color: var(--navy); }
.btn { border-radius: 8px; transition: background .15s, transform .1s; }
.btn:active { transform: scale(.98); }

/* ===== v10: chống tràn ngang trên điện thoại (xoay dọc), video luôn vừa khung ===== */
html, body { width: 100%; max-width: 100%; overflow-x: hidden; }
.bgv { width: 100%; height: 100%; max-width: 100%; contain: strict; }
.bgv-v, .bgv-poster { position: absolute; left: 0; top: 0; right: 0; bottom: 0; inset: 0; width: 100%; height: 100%;
  min-width: 0; min-height: 0; transform: none; object-fit: cover; object-position: 50% 50%; }
.auth { width: 100%; max-width: 420px; margin-left: auto; margin-right: auto; overflow-x: clip; }
.auth > * { min-width: 0; max-width: 100%; box-sizing: border-box; }
.auth-title { font-size: clamp(28px, 9vw, 40px); overflow-wrap: anywhere; }
.auth-jp { letter-spacing: clamp(2px, 1.6vw, 6px); }
.auth .card { overflow: hidden; }
@media (orientation: portrait) { .bgv-v, .bgv-poster { object-position: 55% 50%; } }

/* ===== v11: trang đăng nhập trở lại bản gốc (nền navy chuyển sắc, không video/ảnh) ===== */
body:has(.auth) { background: var(--grad) fixed; }
.auth { min-height: 0; display: block; }
.auth .card { background: #fff; border: 0; border-radius: 8px; backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: 0 10px 30px rgba(0,20,60,.25); }
.auth-title { font-size: clamp(30px, 9vw, 40px); text-shadow: none; }

/* ===== v12: video động nền cho TOÀN BỘ web ===== */
#bgv { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: linear-gradient(180deg, #00183d 0%, #002f72 60%, #1c3a72 100%); }
#bgv video { position: absolute; left: 0; top: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%; pointer-events: none; }
#bgv::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,24,61,.35) 0%, rgba(0,35,100,.15) 50%, rgba(0,24,61,.45) 100%); }
@media (prefers-reduced-motion: reduce) { #bgv video { display: none; } }
html, body { background: transparent; }
body, body:has(.auth) { background: transparent !important; }
#app { position: relative; z-index: 1; }
.topbar { background: rgba(0,35,100,.72); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.tabs { background: rgba(255,255,255,.88); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.phero { background: transparent !important; }
.phero::before, .phero::after { display: none !important; }
.phero h1, .phero p, .phero-jp { text-shadow: 0 2px 14px rgba(0,10,40,.55); }
.phero-in { min-height: 96px; }
.card { background: rgba(255,255,255,.95); }
.auth .card { background: rgba(255,255,255,.93); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,.4); border-radius: 14px; }
.auth-jp { font-size: 15px; letter-spacing: clamp(2px, 1.6vw, 6px); color: rgba(255,255,255,.9); margin-bottom: 10px; display: block; }
.auth-title, .auth-sub { text-shadow: 0 2px 16px rgba(0,10,40,.5); }
.foot { background: rgba(0,35,100,.8); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.qr-screen { position: relative; z-index: 2; }

/* ===== v13: banner tiêu đề có ảnh riêng từng trang; video động chỉ làm nền phần ruột ===== */
.phero { background-color: #00235f !important; background-size: cover !important; background-repeat: no-repeat !important; }
.phero::before { display: block !important; content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0,24,61,.88) 0%, rgba(0,47,114,.55) 55%, rgba(0,47,114,.25) 100%); }
.phero::after { display: none !important; }
.phero-in { min-height: 120px; }
@media (min-width: 700px) { .phero-in { min-height: 170px; } }

/* ===== v14: banner thấy rõ ảnh; đăng nhập/đăng ký/quên MK căn giữa ===== */
.phero::before { background: linear-gradient(90deg, rgba(0,24,61,.62) 0%, rgba(0,35,100,.25) 50%, rgba(0,24,61,0) 100%) !important; }
.phero { background-size: cover !important; }
.phero-in { min-height: 130px; }
@media (min-width: 700px) { .phero-in { min-height: 190px; } }
.auth { min-height: 100vh; min-height: 100dvh; display: grid !important; align-content: center; justify-items: stretch; width: 100%; max-width: 420px; margin: 0 auto; padding: 24px 16px; box-sizing: border-box; }
.auth-hero { text-align: center; margin-bottom: 20px; }
.auth-logo, .auth-div { justify-content: center; }

/* ===== v15: sửa lỗi banner bị nền trong suốt đè mất ảnh ===== */
.phero { background-image: var(--hero) !important; background-position: var(--heropos, center) !important; background-size: cover !important; background-repeat: no-repeat !important; background-color: #00235f !important; }
.phero::before { background: linear-gradient(90deg, rgba(0,24,61,.55) 0%, rgba(0,24,61,.15) 55%, rgba(0,24,61,0) 100%) !important; }

.auth .card h2, .auth .card h3 { text-align: center; }

.auth .card p, .auth .card .small { text-align: center; }
