:root {
  --vang: #FDB813; --do: #EA2127; --xanh: #026EB6;
  --vang-dam: #d99a06; --chu: #14213d; --chu2: #4b5568; --nen: #f3f5f9; --vien: #d9dee8;
  --xanh-nhat: #e8f2fb; --vang-nhat: #fff6dc; --do-nhat: #fdecec;
  --r: 16px; --bong: 0 1px 2px rgba(20,33,61,.06), 0 4px 14px rgba(20,33,61,.06);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: #e9ecf2; color: var(--chu); font: 16px/1.5 "Be Vietnam Pro", system-ui, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
.app { max-width: 560px; min-height: 100dvh; margin: 0 auto; background: var(--nen); display: flex; flex-direction: column; box-shadow: 0 0 40px rgba(20,33,61,.08); }

/* ---- Đầu trang ---- */
.dau { background: var(--vang); padding: calc(14px + env(safe-area-inset-top)) 20px 14px; position: sticky; top: 0; z-index: 20; }
.dau-hang { display: flex; align-items: center; gap: 10px; }
.dau-eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .12em; color: var(--chu); flex: 1; display: flex; align-items: center; gap: 8px; }
.dau-eyebrow img { height: 22px; border-radius: 4px; }
.dau h1 { margin: 4px 0 10px; font-size: 26px; line-height: 1.2; color: var(--xanh); font-weight: 800; }
.nut-tron { width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.55); display: grid; place-items: center; cursor: pointer; flex: none; }
.nut-tron:active { transform: scale(.95); }
.nut-tron svg { width: 22px; height: 22px; }
.tien { display: flex; gap: 6px; }
.tien button { flex: 1; height: 7px; border-radius: 4px; border: 0; padding: 0; background: rgba(120,80,0,.28); cursor: default; position: relative; }
.tien button::after { content: ""; position: absolute; inset: -12px 0; }
.tien button.xong { background: var(--do); cursor: pointer; }
.tien button.dang { background: var(--do); box-shadow: 0 0 0 2px rgba(255,255,255,.7); }
.dau-buoc { font-size: 13px; margin-top: 6px; color: #3a2c00; display: flex; justify-content: space-between; gap: 10px; }
.t-luu { opacity: .75; } .t-luu.loi { color: #a3121a; opacity: 1; font-weight: 700; }
.bang-xem { margin: 8px 0 0; background: #14213d; color: #fff; border-radius: 10px; padding: 8px 12px; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.bang-xem button { margin-left: auto; border: 0; border-radius: 8px; background: #fff; color: #14213d; font-weight: 800; padding: 6px 12px; cursor: pointer; }
.vao-bia { text-align: center; margin: 6px 0 18px; } .vao-bia img { width: min(260px, 70%); border-radius: 10px; } .vao-bia p { color: var(--chu2); margin: 10px 8px 0; }
.ma-lon { font: 800 34px/1.2 "Be Vietnam Pro", monospace; letter-spacing: .18em; color: var(--xanh); margin: 6px 0; }
.dt-hang { padding: 14px; } .dt-dau { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } .dt-dau .dem { margin-left: auto; color: var(--chu2); font-size: 14px; }
.nhan-khoa { background: var(--do-nhat); color: #a3121a; font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 999px; }
.qt-chan { position: sticky; bottom: -18px; background: #fff; padding: 10px 0; margin-top: 10px; }

/* ---- Thân ---- */
.than { flex: 1; padding: 18px 16px 120px; }
.mo { color: var(--chu2); margin: 0 4px 14px; font-size: 15px; }
.the { background: #fff; border-radius: var(--r); padding: 16px; box-shadow: var(--bong); margin-bottom: 14px; border: 1px solid #eef0f5; }
.the h3 { margin: 0 0 10px; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.the h3 .dem { margin-left: auto; font-size: 13px; color: var(--chu2); font-weight: 700; }
.nhan { display: block; font-weight: 700; font-size: 14px; margin: 12px 0 6px; }
.nhan small { font-weight: 500; color: var(--chu2); }
.o { width: 100%; min-height: 50px; border: 1.5px solid var(--vien); border-radius: 12px; padding: 12px 14px; background: #fff; outline: none; font-size: 16px; }
.o:focus { border-color: var(--xanh); box-shadow: 0 0 0 3px rgba(2,110,182,.14); }
.o.loi { border-color: var(--do); }
textarea.o { min-height: 110px; resize: vertical; }
.goi-y { font-size: 13px; color: var(--chu2); margin-top: 5px; display: flex; justify-content: space-between; gap: 8px; }
.goi-y .vuot { color: var(--do); font-weight: 700; }
.bao-loi { color: var(--do); font-size: 13px; margin-top: 5px; font-weight: 600; }
.luoi2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.luoi3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 10px; }
.luoi3 .nhan { font-size: 13px; min-height: 40px; display: flex; align-items: flex-end; }
.tien-to { display: flex; align-items: stretch; border: 1.5px solid var(--vien); border-radius: 12px; overflow: hidden; background: #fff; }
.tien-to span { background: var(--vang-nhat); padding: 0 10px; display: flex; align-items: center; font-size: 12px; font-weight: 800; color: #7a5800; max-width: 46%; line-height: 1.25; }
.tien-to .o { border: 0; border-radius: 0; box-shadow: none !important; }
.tien-to:focus-within { border-color: var(--xanh); }

/* ---- Thẻ chọn gói ---- */
.chon { display: flex; gap: 14px; align-items: center; background: #fff; border: 2px solid #e6e9f0; border-radius: var(--r); padding: 16px; margin-bottom: 12px; cursor: pointer; box-shadow: var(--bong); width: 100%; text-align: left; }
.chon.on { border-color: var(--xanh); background: var(--xanh-nhat); }
.chon .tron { width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid #a9b1c2; flex: none; display: grid; place-items: center; }
.chon.on .tron { border-color: var(--xanh); }
.chon.on .tron::after { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--xanh); }
.chon .vuong { border-radius: 7px; }
.chon.on .vuong::after { border-radius: 2px; }
.chon b { font-size: 18px; display: block; }
.chon p { margin: 2px 0 0; color: var(--chu2); font-size: 14px; }
.chon .muc { margin-left: auto; display: flex; flex-direction: column; gap: 4px; flex: none; }
.chon .muc i { width: 30px; height: 6px; border-radius: 3px; background: #d6dbe5; }
.chon .muc i.co { background: var(--xanh); }
.chon .gia { font-size: 13px; color: var(--xanh); font-weight: 700; margin-top: 4px; }

/* ---- Viên thuốc ---- */
.vien { display: flex; flex-wrap: wrap; gap: 8px; }
.vt { min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 2px solid #cfd5e1; background: #fff; font-weight: 700; font-size: 15px; cursor: pointer; color: #475066; }
.vt.on { background: var(--xanh); border-color: var(--xanh); color: #fff; }
.vt:disabled { opacity: .4; cursor: not-allowed; }
.vt.nho { min-height: 38px; padding: 6px 14px; font-size: 14px; }
.lien-ket { background: none; border: 0; color: var(--xanh); font-weight: 700; cursor: pointer; padding: 6px 0; font-size: 14px; }

/* ---- Nút ---- */
.chan { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 560px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.96); border-top: 1px solid #e6e9f0; z-index: 15; backdrop-filter: blur(6px); }
.nut { min-height: 52px; border-radius: 14px; border: 2px solid transparent; font-weight: 800; font-size: 17px; cursor: pointer; padding: 10px 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.nut.chinh { background: var(--do); color: #fff; width: 100%; box-shadow: 0 6px 16px rgba(234,33,39,.28); }
.nut.chinh:active { transform: translateY(1px); }
.nut.phu { background: #fff; border-color: #cfd5e1; color: var(--chu); font-size: 15px; }
.nut.xanh { background: #fff; border-color: var(--xanh); color: var(--xanh); width: 100%; font-size: 16px; }
.nut.xanh.dac { background: var(--xanh); color: #fff; }
.nut:disabled { opacity: .5; cursor: not-allowed; }
.hang2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.nut svg { width: 20px; height: 20px; flex: none; }

/* ---- Hộp ghi chú ---- */
.meo { background: var(--vang-nhat); border: 1.5px solid #f6d77f; border-radius: 14px; padding: 12px 14px; font-size: 14px; margin-bottom: 14px; }
.meo.do { background: var(--do-nhat); border-color: #f5b5b7; }
.meo.xanh { background: var(--xanh-nhat); border-color: #b7d5ee; }
.meo ul { margin: 6px 0 0; padding-left: 18px; }
.meo b:first-child { color: #6b4b00; }
.meo.do b:first-child { color: #a3121a; }

/* ---- Ảnh hiện trạng ---- */
.o-anh { border: 2px dashed #b9c1d0; border-radius: 14px; min-height: 96px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: #556078; font-weight: 700; cursor: pointer; background: #fafbfd; position: relative; overflow: hidden; width: 100%; padding: 0; }
.o-anh svg { width: 30px; height: 30px; color: var(--xanh); }
.o-anh img { width: 100%; display: block; max-height: 260px; object-fit: cover; }
.o-anh.co { border-style: solid; border-color: #e1e5ee; }
.o-anh .doi { position: absolute; right: 10px; bottom: 10px; background: rgba(17,24,39,.75); color: #fff; padding: 6px 12px; border-radius: 999px; font-size: 13px; }
.kiem { font-size: 13px; margin-top: 8px; padding: 8px 12px; border-radius: 10px; }
.kiem.dat { background: #e9f8ef; color: #17633a; }
.kiem.chua { background: var(--do-nhat); color: #a3121a; }
.kiem ul { margin: 2px 0 0; padding-left: 18px; }
.da-cham { font-size: 13px; color: #17633a; font-weight: 700; margin-top: 6px; }

/* ---- Xem trước biển ---- */
.xem-bien { margin-top: 14px; }
.xem-bien canvas { width: 100%; display: block; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,.12); }
.xem-bien .chu-thich { text-align: center; font-size: 13px; color: var(--chu2); margin-top: 6px; }
.hang-doc { display: flex; gap: 10px; justify-content: center; margin-top: 12px; }
.hang-doc canvas { width: 70px; height: auto; box-shadow: 0 2px 10px rgba(0,0,0,.12); border-radius: 4px; }

/* ---- Bàn ghế ---- */
.sodo { width: 100%; height: auto; display: block; }
.so-lieu { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; font-size: 16px; }
.so-lieu b { text-align: right; font-size: 18px; }
.tab-phong { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; }

/* ---- So sánh trước sau ---- */
.tab-khu { display: flex; gap: 8px; margin-bottom: 12px; }
.tab-khu .vt { flex: 1; padding: 8px 6px; font-size: 14px; }
.ss { position: relative; border-radius: 18px; overflow: hidden; background: #dfe3ea; aspect-ratio: 4/3; box-shadow: var(--bong); touch-action: pan-y; user-select: none; }
.ss img, .ss canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.ss .sau { clip-path: inset(0 calc(100% - var(--x, 50%)) 0 0); }
.ss .vach { position: absolute; top: 0; bottom: 0; left: var(--x, 50%); width: 3px; background: #fff; transform: translateX(-50%); box-shadow: 0 0 6px rgba(0,0,0,.3); }
.ss .num { position: absolute; top: 50%; left: var(--x, 50%); width: 46px; height: 46px; border-radius: 50%; background: #fff; transform: translate(-50%, -50%); display: grid; place-items: center; box-shadow: 0 2px 10px rgba(0,0,0,.25); cursor: ew-resize; }
.ss .num svg { width: 22px; height: 22px; }
.nhan-ss { position: absolute; top: 10px; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 800; z-index: 2; }
.nhan-ss.t { left: 10px; background: var(--xanh); color: #fff; }
.nhan-ss.p { right: 10px; background: #fff; color: var(--chu); }
.ss .cho { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(243,245,249,.75); font-weight: 700; color: var(--chu2); z-index: 3; }
.nguon { font-size: 13px; color: var(--chu2); margin: 8px 4px 0; }
.pa { display: flex; align-items: center; gap: 12px; margin: 14px 4px 6px; font-weight: 800; }
.pa button { width: 52px; height: 52px; border-radius: 50%; border: 2px solid #cfd5e1; background: #fff; font-weight: 800; font-size: 18px; cursor: pointer; }
.pa button.on { background: var(--xanh); border-color: var(--xanh); color: #fff; }
.pa small { font-weight: 500; color: var(--chu2); font-size: 13px; }
.the-ai { display: flex; gap: 12px; align-items: center; }
.the-ai .ic { width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, var(--xanh), #3fa2e8); display: grid; place-items: center; color: #fff; flex: none; }
.the-ai .ic svg { width: 24px; height: 24px; }
.the-ai p { margin: 0; font-size: 14px; color: var(--chu2); }
.da-luu { color: #17633a; font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 6px; margin-top: 8px; }

/* ---- Hồ sơ, báo giá ---- */
.ds-check { list-style: none; padding: 0; margin: 0; }
.ds-check li { display: flex; gap: 12px; margin: 10px 0; font-size: 15px; color: var(--chu2); }
.ds-check li b { color: var(--chu); }
.ds-check .v { width: 26px; height: 26px; border-radius: 50%; background: var(--xanh); color: #fff; display: grid; place-items: center; flex: none; margin-top: 1px; }
.ds-check .v.x { background: #c3c9d5; }
.ds-check .v svg { width: 15px; height: 15px; }
.bg-dong { display: flex; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid #edf0f5; font-size: 16px; }
.bg-dong b { white-space: nowrap; }
.bg-dong.tong { border: 0; font-weight: 800; font-size: 17px; }
.bg-dong.tong b { color: var(--do); }
details.ct summary { cursor: pointer; color: var(--xanh); font-weight: 700; font-size: 14px; padding: 8px 0; }
.bang-ct { width: 100%; border-collapse: collapse; font-size: 13px; }
.bang-ct td, .bang-ct th { padding: 7px 4px; border-bottom: 1px solid #eef0f5; text-align: left; vertical-align: top; }
.bang-ct td:last-child, .bang-ct th:last-child { text-align: right; white-space: nowrap; }
.bang-ct .ma { color: var(--chu2); font-size: 11px; display: block; }
.ghi-nho { background: #eef1f7; border-radius: 14px; padding: 12px 14px; font-size: 14px; color: var(--chu2); margin-bottom: 14px; }
.chk { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-size: 15px; }
.chk input { width: 24px; height: 24px; accent-color: var(--xanh); flex: none; margin: 1px 0 0; }

/* ---- Lớp phủ, hộp thoại ---- */
[hidden] { display: none !important; }
.lop { position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.hop { background: #fff; width: 100%; max-width: 560px; max-height: 92dvh; overflow: auto; border-radius: 22px 22px 0 0; padding: 20px 18px calc(18px + env(safe-area-inset-bottom)); animation: len .22s ease; }
.hop.rong { max-width: 940px; }
@media (min-width: 700px) { .lop { align-items: center; } .hop { border-radius: 22px; } }
@keyframes len { from { transform: translateY(30px); opacity: 0; } }
.hop h2 { margin: 0 0 8px; font-size: 20px; }
.hop-dong { float: right; }
.c4-dau { margin-bottom: 10px; } .c4-dau b { display: block; font-size: 18px; } .c4-dau span { font-size: 14px; color: var(--chu2); }
.c4-khung { position: relative; display: flex; justify-content: center; touch-action: none; }
.c4-khung canvas { border-radius: 10px; touch-action: none; }
.c4-kinh { position: absolute; pointer-events: none; display: none; border-radius: 50%; box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.mau-hm { display: grid; gap: 14px; }
.mau-hm .muc b { display: block; } .mau-hm .muc p { margin: 2px 0 8px; font-size: 14px; color: var(--chu2); }
.mau-hm .anh { display: flex; gap: 8px; overflow-x: auto; }
.mau-hm .anh img { height: 120px; border-radius: 10px; }
.menu-ds button { display: flex; width: 100%; align-items: center; gap: 12px; padding: 14px 6px; background: none; border: 0; border-bottom: 1px solid #eef0f5; font-weight: 700; font-size: 16px; cursor: pointer; text-align: left; }
.menu-ds svg { width: 22px; height: 22px; color: var(--xanh); }
.xoay { width: 22px; height: 22px; border: 3px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: xoay 0.8s linear infinite; display: inline-block; }
.xoay.toi { border-color: rgba(2,110,182,.2); border-top-color: var(--xanh); }
@keyframes xoay { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: #17233b; color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 80; font-size: 15px; max-width: min(92vw, 520px); box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.toast.loi { background: #a3121a; } .toast.canh { background: #8a5a00; }

/* ---- Quản trị ---- */
.qt-tab { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 14px; }
.qt-bang { width: 100%; border-collapse: collapse; font-size: 13px; }
.qt-bang th, .qt-bang td { padding: 6px 4px; border-bottom: 1px solid #eef0f5; text-align: left; }
.qt-bang input { width: 100%; min-width: 84px; border: 1.5px solid var(--vien); border-radius: 8px; padding: 7px 8px; font-size: 14px; }
.qt-bang input[type=checkbox] { width: 20px; height: 20px; min-width: 0; }
.qt-cuon { overflow-x: auto; }
.qt-mau { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.qt-mau input[type=color] { width: 54px; height: 40px; border: 0; padding: 0; background: none; }

/* ---- In hồ sơ (PDF) ---- */
.in-an { display: none; }
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; }
  .app, .lop, .toast { display: none !important; }
  .in-an { display: block; font-size: 11.5pt; color: #14213d; }
  .in-trang { page-break-after: always; }
  .in-trang:last-child { page-break-after: auto; }
  .in-bia { text-align: center; padding-top: 30mm; }
  .in-logo { width: 90mm; }
  .in-nhan { margin-top: 14mm; letter-spacing: .12em; font-weight: 800; color: #026EB6; }
  .in-bia h1 { color: #EA2127; font-family: Oswald, sans-serif; font-size: 26pt; margin: 4mm 0 12mm; }
  .in-tt { max-width: 140mm; margin: 0 auto; text-align: left; }
  .in-an h2 { color: #026EB6; border-bottom: 3px solid #FDB813; padding-bottom: 2mm; font-size: 16pt; }
  .in-an h3 { margin: 4mm 0 2mm; font-size: 12.5pt; }
  .in-hai { display: grid; grid-template-columns: 1fr 1fr; gap: 4mm; }
  .in-hai img { width: 100%; height: 62mm; object-fit: cover; border-radius: 2mm; }
  .in-trong div { height: 62mm; display: grid; place-items: center; background: #f1f3f7; color: #888; border-radius: 2mm; }
  figure { margin: 0; break-inside: avoid; } figcaption { font-size: 9pt; color: #555; text-align: center; margin-top: 1mm; }
  .in-ba { display: grid; grid-template-columns: 1fr; gap: 4mm; }
  .in-bang { width: 100%; border-collapse: collapse; margin: 2mm 0 4mm; font-size: 10.5pt; }
  .in-bang th { background: #FDB813; text-align: left; padding: 2mm; }
  .in-bang td { border-bottom: .3mm solid #ddd; padding: 1.8mm 2mm; vertical-align: top; }
  .in-nhom td { background: #e8f2fb; font-weight: 800; }
  .in-tong td { font-weight: 800; }
  .in-lon td { font-size: 12.5pt; color: #EA2127; border-top: .6mm solid #14213d; }
  .in-nho { font-size: 9.5pt; color: #444; }
  .in-do { color: #c1121f; }
  .in-canh { background: #fff3cd; padding: 2mm 3mm; border-radius: 2mm; font-weight: 700; }
  .in-luuy { margin-top: 16mm; font-size: 10pt; color: #444; }
  .in-bien img { width: 100%; margin: 3mm 0 1mm; }
  .in-doc { display: flex; gap: 5mm; } .in-doc figure { width: 28mm; } .in-doc img { width: 100%; }
  .in-sodo { display: grid; grid-template-columns: 1fr 1fr; gap: 5mm; } .in-sodo svg { width: 100%; height: auto; max-height: 110mm; }
  .in-mau { display: grid; grid-template-columns: 1fr 1fr; gap: 3mm; } .in-mau div { display: grid; grid-template-columns: 14mm 1fr; gap: 0 3mm; align-items: center; }
  .in-mau span { grid-row: span 2; height: 12mm; border: .3mm solid #ccc; border-radius: 2mm; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .in-ky { margin-top: 10mm; font-style: italic; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
