:root {
  --teal: #0397A7; --teal-d: #027A88; --teal-soft: #E6F5F7; --orange: #F8A46B; --orange-soft: #FFF1E6;
  --ink: #00425A; --muted: #5B7480; --line: #D6E3E5; --bg: #F3F8F9; --card: #FFFFFF; --err: #C62828;
  --radius: 14px; --gutter: 16px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Be Vietnam Pro", "Helvetica Neue", Arial, sans-serif; font-size: 16px; line-height: 1.55; }
a { color: var(--teal-d); }
button, input, select, textarea { font: inherit; color: inherit; }

.shell { max-width: 820px; margin: 0 auto; padding: 0 var(--gutter) 120px; }
.steps { display: none; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }

.hero { overflow: hidden; margin-top: var(--gutter); }
.hero-img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 1; object-fit: cover; }
.hero-body { padding: 18px 22px 16px; border-top: 6px solid var(--teal); }
.hero h1 { font-size: 24px; line-height: 1.3; margin: 0 0 8px; font-weight: 700; }
.desc { white-space: pre-line; font-size: 15px; }
.desc.collapsed { max-height: 4.8em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent); }
.more { background: none; border: 0; color: var(--teal-d); padding: 4px 0; cursor: pointer; font-weight: 600; }
.reqnote { margin: 10px 0 0; font-size: 13px; color: var(--err); }
.star { color: var(--err); }

.notice { margin-top: 12px; padding: 12px 16px; border-radius: 10px; background: var(--orange-soft); font-size: 14px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.notice button { background: none; border: 0; color: var(--teal-d); font-weight: 600; cursor: pointer; padding: 0; }

.progress { height: 6px; background: var(--line); border-radius: 99px; margin: 16px 0 4px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--teal); transition: width .3s; }

.sec { padding: 18px 22px; margin-top: 12px; border-left: 6px solid var(--teal); display: flex; gap: 14px; align-items: flex-start; }
.sec h2 { margin: 0; font-size: 20px; line-height: 1.35; }
.sec p { margin: 6px 0 0; color: var(--muted); font-size: 14.5px; }

.q { padding: 18px 22px; margin-top: 12px; scroll-margin-top: 16px; }
.q.invalid { border-color: var(--err); box-shadow: 0 0 0 1px var(--err) inset; }
.q > .lbl > label, .q > .lbl > .qt { display: block; font-weight: 600; font-size: 16.5px; line-height: 1.4; }
.help { color: var(--muted); font-size: 14px; margin: 4px 0 10px; }
.err { color: var(--err); font-size: 14px; margin-top: 8px; display: none; }
.invalid > .err, .f.invalid .err { display: block; }

input[type=text], input[type=email], input[type=tel], input[type=url], input[type=number], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; font-size: 16px; }
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
::placeholder { color: #9AAEB5; opacity: 1; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal); outline-offset: 1px; border-color: var(--teal); }
.q:not(.repeat) > input, .q > textarea, .q > select { margin-top: 6px; }

.opts { display: grid; gap: 8px; margin-top: 8px; }
.opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; min-height: 48px; background: #fff; }
.opt:hover { border-color: var(--teal); }
.opt input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--teal); flex: none; }
.opt.on { border-color: var(--teal); background: var(--teal-soft); }
.opt .other-in { display: block; width: 100%; height: auto; min-height: 42px; margin: 8px 0 0; flex: none; }
.chips { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.chips .opt { padding: 10px 12px; }

.rows { display: grid; gap: 12px; margin-top: 10px; }
.row { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #FAFDFD; position: relative; }
.row-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-weight: 600; color: var(--teal-d); font-size: 14.5px; }
.row-del { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 6px 8px; border-radius: 8px; }
.row-del:hover { background: var(--line); color: var(--err); }
.grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.grid > .f { grid-column: 1 / -1; }
.grid > .f.short { grid-column: auto; }
.f > .lbl > label { display: block; font-size: 14.5px; font-weight: 500; }
.f > .lbl { margin-bottom: 4px; }
.f .help { margin: -2px 0 6px; font-size: 13px; }
.f.wide { grid-column: 1 / -1; }
.f.invalid input, .f.invalid select { border-color: var(--err); }
.add { margin-top: 12px; }

.drop { margin-top: 10px; border: 2px dashed var(--line); border-radius: 12px; padding: 16px; text-align: center; background: #FAFDFD; }
.drop.over { border-color: var(--teal); background: var(--teal-soft); }
.drop p { margin: 6px 0 0; font-size: 13.5px; color: var(--muted); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-top: 12px; }
.thumb { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; font-size: 12px; position: relative; }
.thumb img, .thumb .pdf { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--teal-soft); }
.thumb .pdf { display: flex; flex-direction: column; gap: 4px; align-items: center; justify-content: center; font-weight: 700; color: var(--teal-d); font-size: 16px; }
.thumb span { display: block; padding: 4px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb button { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,66,90,.75); color: #fff; cursor: pointer; font-size: 16px; line-height: 1; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 12px; border: 1px solid var(--teal); font-weight: 600; cursor: pointer; font-size: 16px; }
.btn.primary { background: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-d); }
.btn.ghost { background: #fff; color: var(--teal-d); }
.btn.soft { background: var(--teal-soft); color: var(--teal-d); border-color: transparent; }
.btn[disabled] { opacity: .5; cursor: default; }
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; gap: 10px; align-items: center; justify-content: space-between;
  padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.96); border-top: 1px solid var(--line);
  backdrop-filter: blur(6px); }
.nav .btn { flex: 1; }
.nav-step { font-size: 13px; color: var(--muted); white-space: nowrap; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.done { padding: 28px 22px; margin-top: 16px; text-align: center; }
.done h2 { margin: 6px 0; }
.done .code { display: inline-block; margin: 10px 0; padding: 10px 18px; border-radius: 10px; background: var(--teal-soft); font-weight: 700; font-size: 20px; letter-spacing: .5px; }
.foot { text-align: center; color: var(--muted); font-size: 13px; margin: 28px 0 8px; }
.muted { color: var(--muted); font-size: 14px; }

.overlay { position: fixed; inset: 0; background: rgba(0,40,55,.45); display: grid; place-items: center; z-index: 50; padding: var(--gutter); }
.overlay-box { background: #fff; border-radius: var(--radius); padding: 22px; width: min(420px, 100%); text-align: center; }
.bar { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 12px 0; }
.bar span { display: block; height: 100%; width: 0; background: var(--teal); transition: width .2s; }

/* Điện thoại nhỏ */
@media (max-width: 420px) {
  .hero h1 { font-size: 21px; }
  .q, .sec, .hero-body { padding-left: 16px; padding-right: 16px; }
  .chips { grid-template-columns: 1fr 1fr; }
  .nav-step { display: none; }
}
/* iPad dọc trở lên */
@media (min-width: 700px) {
  .grid > .f { grid-column: auto; }
  .grid > .f.wide, .grid > .f.wide2 { grid-column: 1 / -1; }
  .nav { position: static; padding: 0; background: none; border: 0; margin-top: 18px; backdrop-filter: none; }
  .nav .btn { flex: 0 0 auto; min-width: 150px; }
  .shell { padding-bottom: 40px; }
}
/* iPad ngang, máy tính: cột các bước bên trái */
@media (min-width: 1100px) {
  .shell { max-width: 1120px; display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 28px; }
  .steps { display: block; position: sticky; top: 16px; align-self: start; margin-top: 16px; padding: 14px; }
  .steps ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
  .steps li { padding: 10px 12px; border-radius: 10px; font-size: 14.5px; color: var(--muted); display: flex; gap: 10px; align-items: center; }
  .steps li b { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--line); color: var(--ink); font-size: 13px; flex: none; }
  .steps li.now { background: var(--teal-soft); color: var(--ink); font-weight: 600; }
  .steps li.now b, .steps li.ok b { background: var(--teal); color: #fff; }
  .steps .logo { display: block; height: 34px; margin: 4px 6px 14px; }
  .grid { grid-template-columns: repeat(3, 1fr); }
  .grid > .f.wide2 { grid-column: span 2; }
  .progress { display: none; }
  .shell.finished { grid-template-columns: minmax(0, 1fr); max-width: 820px; }
}

.nojs { margin: 16px; padding: 16px; }
.done-logo { height: 44px; width: auto; display: block; margin: 0 auto; }
.grow { flex: 1; }
.pick { display: inline-flex; align-items: center; }
.hero-mini { display: none; }
.hero.compact .desc, .hero.compact .more, .hero.compact .hero-body, .hero.compact .hero-img { display: none; }
.hero.compact .hero-mini { display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-bottom: 4px solid var(--teal); }
.hero-mini img { height: 30px; width: auto; display: block; }
.hero-mini span { font-weight: 600; font-size: 15px; color: var(--ink); padding-left: 14px; border-left: 1px solid var(--line); }

/* ---------- Icon ---------- */
.ic { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sec-ic { flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--teal-soft); color: var(--teal-d); }
.sec-ic .ic { width: 22px; height: 22px; }
.steps li b .ic { width: 15px; height: 15px; stroke-width: 3; }
.thumb .pdf .ic { width: 30px; height: 30px; }
.thumb .pdf small { font-size: 12px; }
.row-del { display: inline-flex; align-items: center; gap: 6px; }
.row-del .ic { width: 15px; height: 15px; }
.foot a { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }
.foot .ic { width: 14px; height: 14px; }
.err:not(:empty)::before { content: "!"; display: inline-block; width: 15px; height: 15px; margin-right: 6px; vertical-align: -2px; border-radius: 50%;
  background: var(--err); color: #fff; font-size: 11px; font-weight: 700; line-height: 15px; text-align: center; }

/* ---------- Hiệu ứng ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes inR { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes inL { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { from { background-position: -400px 0; } to { background-position: 400px 0; } }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes flash { from { box-shadow: 0 0 0 3px var(--teal); } to { box-shadow: 0 0 0 0 transparent; } }

/* Đang tải: khung mờ chạy sáng */
.skel { height: 120px; margin-top: 12px; border-color: transparent;
  background: linear-gradient(90deg, #EAF2F3 0, #F7FBFB 50%, #EAF2F3 100%) 0 0 / 800px 100%; animation: shimmer 1.2s linear infinite; }
.skel.short { height: 70px; }

/* Vào trang lần đầu */
body.ready .hero, body.ready .steps { animation: rise .45s ease-out both; }
body.ready .steps { animation-delay: .08s; }

/* Chuyển trang */
#page.out-fwd, #page.out-back { opacity: 0; transition: opacity .16s ease-in, transform .16s ease-in; }
#page.out-fwd { transform: translateX(-16px); }
#page.out-back { transform: translateX(16px); }
#page.in-fwd > .card { animation: inR .38s cubic-bezier(.2, .7, .2, 1) both; }
#page.in-back > .card { animation: inL .38s cubic-bezier(.2, .7, .2, 1) both; }
#page.in-fwd > .card:nth-child(2), #page.in-back > .card:nth-child(2) { animation-delay: .04s; }
#page.in-fwd > .card:nth-child(3), #page.in-back > .card:nth-child(3) { animation-delay: .08s; }
#page.in-fwd > .card:nth-child(4), #page.in-back > .card:nth-child(4) { animation-delay: .12s; }
#page.in-fwd > .card:nth-child(5), #page.in-back > .card:nth-child(5) { animation-delay: .16s; }
#page.in-fwd > .card:nth-child(n+6), #page.in-back > .card:nth-child(n+6) { animation-delay: .2s; }

/* Thao tác */
.btn { transition: background-color .15s, transform .1s, box-shadow .15s; }
.btn:active:not([disabled]) { transform: scale(.97); }
.btn.primary:hover { box-shadow: 0 4px 14px rgba(3, 151, 167, .3); }
#next .ic { transition: transform .15s; }
#next:hover .ic { transform: translateX(3px); }
.opt { transition: border-color .15s, background-color .15s; }
.opt input:checked { animation: pop .25s ease-out; }
input, select, textarea { transition: border-color .15s, box-shadow .15s; }
.q.shake { animation: shake .4s ease-in-out; }
.row-new { animation: rise .3s ease-out both, flash .9s ease-out .2s; }
.thumb { animation: rise .25s ease-out both; }
.progress span { transition: width .45s cubic-bezier(.2, .7, .2, 1); }
.steps li { transition: background-color .25s, color .25s; }
.steps li b { transition: background-color .25s, color .25s; }
.steps li.ok b .ic { animation: pop .3s ease-out; }
.notice:not([hidden]) { animation: rise .35s ease-out both; }

/* Đang gửi */
.overlay:not([hidden]) { animation: fadeIn .2s ease-out; }
.overlay:not([hidden]) .overlay-box { animation: rise .3s ease-out; }
.spinner { width: 40px; height: 40px; margin: 0 auto 6px; border-radius: 50%; border: 4px solid var(--teal-soft); border-top-color: var(--teal); animation: spin .8s linear infinite; }

/* Gửi xong */
.done:not([hidden]) { animation: rise .4s ease-out both; }
.done-check { width: 76px; height: 76px; display: block; margin: 0 auto 6px; fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.done-check circle { stroke: var(--teal); stroke-dasharray: 151; stroke-dashoffset: 151; animation: draw .6s ease-out .1s forwards; }
.done-check path { stroke: var(--orange); stroke-width: 4; stroke-dasharray: 36; stroke-dashoffset: 36; animation: draw .35s ease-out .6s forwards; }
.done .code { animation: pop .4s ease-out .8s both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .done-check circle, .done-check path { stroke-dashoffset: 0; }
}

.desc a, .done p a { font-weight: 600; color: var(--teal-d); text-decoration: underline; text-underline-offset: 2px; }

/* Turnstile ở bước cuối */
.ts-box { margin-top: 14px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.ts-box .muted { margin: 0; font-size: 12.5px; }
#ts { min-height: 65px; }
@media (min-width: 700px) { .ts-box { align-items: flex-end; text-align: right; } }

/* Nút i: giải thích thêm cho câu khó */
.lbl { display: flex; align-items: flex-start; gap: 8px; }
.lbl > label, .lbl > .qt { flex: 1 1 auto; min-width: 0; }
.info-btn { flex: none; width: 24px; height: 24px; margin-top: 1px; border-radius: 50%; border: 1.5px solid var(--teal); background: #fff; color: var(--teal-d);
  font: italic 700 14px/1 Georgia, "Times New Roman", serif; cursor: pointer; display: grid; place-items: center; padding: 0; transition: background-color .15s, color .15s; }
.info-btn:hover, .info-btn.on { background: var(--teal); color: #fff; }
.info { margin: 8px 0 4px; padding: 10px 12px; border-radius: 10px; background: var(--teal-soft); border-left: 3px solid var(--teal);
  font-size: 14px; line-height: 1.55; color: var(--ink); }
.info:not([hidden]) { animation: rise .25s ease-out both; }

/* Giờ mở cửa */
.btn.sm { min-height: 38px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.hquick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.hours { display: grid; gap: 8px; margin-top: 10px; }
.hday { display: grid; grid-template-columns: 78px 96px minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; transition: background-color .2s; }
.hday.off { background: #F5F8F9; }
.hname { font-weight: 600; padding-top: 8px; }
.hswitch { display: inline-flex; align-items: center; gap: 8px; padding-top: 6px; cursor: pointer; font-size: 14.5px; }
.hswitch input { appearance: none; -webkit-appearance: none; width: 40px; height: 24px; margin: 0; border-radius: 99px; background: var(--line); position: relative;
  cursor: pointer; transition: background-color .2s; flex: none; }
.hswitch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .2s; }
.hswitch input:checked { background: var(--teal); }
.hswitch input:checked::after { transform: translateX(16px); }
.hranges { display: grid; gap: 6px; }
.hranges > .muted { padding-top: 8px; }
.hrange { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hrange input[type=time] { min-width: 112px; min-height: 42px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 16px; }
.hadd, .hdel { background: none; border: 0; color: var(--teal-d); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 2px; font-size: 14px; justify-self: start; }
.hdel { color: var(--muted); }
.hdel:hover { color: var(--err); }
@media (max-width: 560px) {
  .hday { grid-template-columns: minmax(0, 1fr) auto; }
  .hranges { grid-column: 1 / -1; }
  .hname, .hswitch { padding-top: 2px; }
}

/* Ảnh trong từng dòng (ảnh hạng phòng) */
.row .drop { margin-top: 4px; padding: 12px; }
.row .thumbs { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
.more-unit { margin: 18px auto 14px; padding: 16px; max-width: 520px; border-radius: 12px; background: var(--teal-soft); text-align: left; }
.more-unit p { margin: 0 0 12px; font-size: 15px; }
.more-unit .btn { width: 100%; }
