/* Giao diện chung của website Hỷ Thư: trang chủ, tạo thiệp, thanh toán, quản lý.
   Phong cách nhà mốt cao cấp: nền trắng, chữ đen nâu, một họ chữ hình học (Montserrat),
   nhiều khoảng trắng, ảnh lớn, đường kẻ mảnh, nút bo tròn. Không dùng nhũ, không dùng màu phụ.
   Bố cục: cột nội dung tối đa 1440px, lề hai bên 16px trở lên, ưu tiên điện thoại. */
:root {
  --bg: #ffffff; --surface: #ffffff; --tile: #f4f2ef; --tile-2: #ebe7e2;
  --ink: #19110b; --muted: #5d5650; --line: #e8e3dd; --line-strong: #cbc4bb;
  --gold: #19110b; --gold-2: #ffffff; --gold-deep: #19110b;
  --accent: #19110b; --accent-ink: #ffffff; --accent-soft: #f4f2ef; --accent-deep: #19110b;
  --noir: #19110b; --noir-2: #2a2119; --on-noir: #ffffff; --on-noir-muted: rgba(255, 255, 255, .7);
  --ok: #2f6b47; --ok-soft: #e7f1ea; --warn: #85520f; --warn-soft: #f8f0e2; --bad: #a8291f; --bad-soft: #f9e6e3;
  --ui: 'Montserrat', 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Montserrat', 'Be Vietnam Pro', system-ui, sans-serif;
  --radius: 2px; --shadow: 0 30px 60px -40px rgba(25, 17, 11, .35);
  --foil: linear-gradient(var(--ink), var(--ink));
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--ui); font-size: 15.5px; font-weight: 400; line-height: 1.7; letter-spacing: .01em; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: var(--ink); }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; font-weight: 400; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }
[hidden] { display: none !important; }
::selection { background: var(--ink); color: #fff; }

.wrap { max-width: 1440px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
@media (min-width: 720px) { .wrap { padding-left: max(40px, env(safe-area-inset-left, 0px)); padding-right: max(40px, env(safe-area-inset-right, 0px)); } }
@media (min-width: 1200px) { .wrap { padding-left: 64px; padding-right: 64px; } }
.wrap.narrow { max-width: 820px; }
.eyebrow { font-size: 11.5px; font-weight: 500; letter-spacing: .24em; text-transform: uppercase; color: var(--ink); }
.display { font-family: var(--display); font-weight: 300; line-height: 1.18; letter-spacing: -.005em; }
.display em, em.gold { font-style: normal; }
.foil { color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.num { font-variant-numeric: tabular-nums; }
.rule { display: flex; align-items: center; gap: 14px; color: var(--line-strong); }
.rule::before, .rule::after { content: ""; flex: 1; height: 1px; background: currentColor; }
.link { color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 500; letter-spacing: .02em; background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat; padding-bottom: 3px; transition: background-size .4s var(--ease); }
.link:hover { background-size: 0 1px; background-position: 100% 100%; }

/* Thanh trên cùng (các trang làm việc) */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); transition: background .35s, border-color .35s, color .35s; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 21; background: var(--bg); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.logo svg { display: none; }
.logo .wm { display: grid; line-height: 1; }
.logo .wm b { font-family: var(--display); font-weight: 500; font-size: 17px; letter-spacing: .42em; margin-right: -.42em; text-transform: uppercase; }
.logo .wm small { display: none; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a:not(.btn) { color: inherit; text-decoration: none; font-weight: 500; font-size: 13px; letter-spacing: .04em; padding: 10px 12px; position: relative; }
.nav a:not(.btn)::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 5px; height: 1px; background: currentColor; transform: scaleX(0); transition: transform .4s var(--ease); transform-origin: left; }
.nav a:not(.btn):hover::after { transform: scaleX(1); }
@media (max-width: 860px) { .nav a.hide-sm { display: none; } }

/* Nút: bo tròn, chữ thường, đen hoặc viền mảnh */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; border-radius: 999px; padding: 11px 22px; font-weight: 500; font-size: 13.5px; letter-spacing: .02em; cursor: pointer; border: 1px solid var(--ink); background: transparent; color: var(--ink); text-decoration: none; white-space: nowrap; transition: background .3s, color .3s, border-color .3s; min-height: 46px; }
.btn:hover { background: var(--ink); color: #fff; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #3a2c21; border-color: #3a2c21; }
.btn.gold { background: #fff; border-color: #fff; color: var(--ink); }
.btn.gold:hover { background: transparent; color: #fff; }
.btn.line-light { border-color: rgba(255, 255, 255, .8); color: #fff; }
.btn.line-light:hover { background: #fff; color: var(--ink); }
.btn.ghost { border-color: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--tile); color: var(--ink); }
.btn.lg { padding: 15px 34px; font-size: 14px; min-height: 52px; }
.btn.sm { padding: 7px 16px; font-size: 12.5px; min-height: 38px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:disabled:hover { background: transparent; color: var(--ink); }
.btn.primary:disabled:hover { background: var(--ink); color: #fff; }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn .arrow { transition: transform .35s var(--ease); }
.btn:hover .arrow { transform: translateX(4px); }

/* Khối */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.pad { padding: 28px; }
@media (max-width: 520px) { .pad { padding: 18px; } }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 500; letter-spacing: .06em; padding: 4px 11px; border-radius: 999px; background: var(--tile); color: var(--ink); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.plain { background: #fff; color: var(--muted); border: 1px solid var(--line); }
.notice { border-radius: var(--radius); padding: 13px 15px; font-size: 13.5px; background: var(--warn-soft); color: var(--warn); }
.notice.info { background: var(--tile); color: var(--ink); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }

/* Ô nhập */
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-size: 11px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: var(--ink); }
.field .hint { font-size: 12px; color: var(--muted); }
.field .err { font-size: 12px; color: var(--bad); }
.input, .field input[type=text], .field input[type=date], .field input[type=time], .field input[type=tel], .field input[type=password], .field input[type=search], .field select, .field textarea {
  width: 100%; border: 1px solid var(--line-strong); background: #fff; border-radius: var(--radius); padding: 12px 14px; font-size: 15px; transition: border-color .2s; min-height: 48px;
}
.field textarea { resize: vertical; min-height: 92px; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: none; border-color: var(--ink); }
.field.invalid input, .field.invalid textarea { border-color: var(--bad); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); cursor: pointer; }
.switch:first-child { border-top: 0; }
.switch b { display: block; font-size: 14px; font-weight: 500; }
.switch span.hint { font-size: 12px; color: var(--muted); }
.switch input { appearance: none; -webkit-appearance: none; flex: none; width: 42px; height: 24px; border-radius: 999px; background: var(--line-strong); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .25s var(--ease); }
.switch input:checked { background: var(--ink); }
.switch input:checked::after { transform: translateX(18px); }

/* Bảng */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { text-align: left; padding: 13px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-weight: 500; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }

/* Thông báo nổi */
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 24px); transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 13px 22px; border-radius: 999px; font-size: 13.5px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 100; max-width: calc(100vw - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.spinner { width: 18px; height: 18px; border: 1.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Chân trang (các trang làm việc) */
.footer { background: #fff; color: var(--muted); padding-block: 48px calc(env(safe-area-inset-bottom, 0px) + 36px); border-top: 1px solid var(--line); }
.footer .wrap { display: grid; gap: 22px; }
.footer .top { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; align-items: center; }
.footer .logo { color: var(--ink); }
.footer p { font-size: 12px; }
.footer nav { display: flex; gap: 22px; flex-wrap: wrap; }
.footer nav a { color: var(--ink); text-decoration: none; font-size: 12.5px; }
.footer nav a:hover { text-decoration: underline; text-underline-offset: 4px; }
.footer.slim { padding-block: 30px calc(env(safe-area-inset-bottom, 0px) + 32px); }

/* Khung điện thoại để xem thiệp: viền đen mảnh */
.phone { position: relative; width: 100%; max-width: 360px; aspect-ratio: 9 / 18.6; border-radius: 44px; background: #0f0b08; padding: 8px; box-shadow: 0 50px 80px -50px rgba(25, 17, 11, .55), inset 0 0 0 1px rgba(255, 255, 255, .08); margin-inline: auto; }
.phone::before { content: ""; position: absolute; top: 18px; left: 50%; transform: translateX(-50%); width: 84px; height: 23px; border-radius: 999px; background: #000; z-index: 2; }
.phone iframe { width: 100%; height: 100%; border: 0; border-radius: 37px; background: #f4f2ef var(--poster, none) center top / cover no-repeat; display: block; }

/* Trợ lý chat */
.chat-fab { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); z-index: 40; display: inline-flex; align-items: center; gap: 9px; padding: 12px 20px; border-radius: 999px; border: 0; background: var(--ink); color: #fff; font-weight: 500; font-size: 12.5px; letter-spacing: .04em; cursor: pointer; box-shadow: 0 16px 30px -16px rgba(25, 17, 11, .6); }
.chat-fab svg { width: 17px; height: 17px; }
@media (max-width: 600px) { .chat-fab { width: 50px; height: 50px; padding: 0; justify-content: center; } .chat-fab span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } .chat-fab svg { width: 20px; height: 20px; } }
.chat-fab { transition: opacity .4s, transform .4s; }
.landing.at-top .chat-fab, .menu-open .chat-fab { opacity: 0; transform: translateY(12px); pointer-events: none; }
.chat-panel { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); z-index: 41; width: min(380px, calc(100vw - 32px)); height: min(560px, calc(100vh - 110px)); background: #fff; border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 40px 80px -30px rgba(25, 17, 11, .45); display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; }
body[data-chat="high"] .chat-fab { bottom: calc(env(safe-area-inset-bottom, 0px) + 104px); }
@media (min-width: 981px) { body[data-chat="high"] .chat-fab { bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); } }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px; background: #fff; color: var(--ink); border-bottom: 1px solid var(--line); }
.chat-head b { display: block; font-size: 12px; font-weight: 500; letter-spacing: .2em; text-transform: uppercase; }
.chat-head span { font-size: 12px; color: var(--muted); }
.chat-head button { background: var(--tile); border: 0; color: var(--ink); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; }
.chat-log { overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: #fff; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.bot { background: var(--tile); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.me { background: var(--ink); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.chat-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-quick button { border: 1px solid var(--line-strong); background: #fff; border-radius: 999px; padding: 6px 13px; font-size: 12.5px; cursor: pointer; }
.chat-quick button:hover { border-color: var(--ink); }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; min-width: 0; border: 1px solid var(--line-strong); border-radius: 999px; padding: 10px 16px; font-size: 15px; }
.chat-form input:focus { outline: none; border-color: var(--ink); }
.chat-form button { flex: none; }

/* Nút Zalo nổi, nằm trên nút Hỏi đáp */
.zalo-fab { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(env(safe-area-inset-bottom, 0px) + 78px); z-index: 40; width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; background: #0068ff; color: #fff; font-size: 12px; font-weight: 600; letter-spacing: .02em; text-decoration: none; box-shadow: 0 16px 30px -16px rgba(0, 60, 160, .7); transition: opacity .4s, transform .4s; }
body[data-chat="high"] .zalo-fab { bottom: calc(env(safe-area-inset-bottom, 0px) + 164px); }
@media (min-width: 981px) { body[data-chat="high"] .zalo-fab { bottom: calc(env(safe-area-inset-bottom, 0px) + 78px); } }
.landing.at-top .zalo-fab, .menu-open .zalo-fab { opacity: 0; transform: translateY(12px); pointer-events: none; }
.chat-human { display: block; padding: 10px 16px; font-size: 13px; text-align: center; background: var(--tile); color: var(--ink); text-decoration: underline; text-underline-offset: 3px; border-top: 1px solid var(--line); }

/* Trợ lý: đầu khung, dấu đang gõ, nút dẫn trang */
.chat-head { justify-content: flex-start; }
.chat-head > div { flex: 1; min-width: 0; }
.chat-head span { display: flex; align-items: center; gap: 6px; }
.chat-av { flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: #fff; display: grid !important; place-items: center; font-size: 11px !important; letter-spacing: .12em; font-weight: 500; }
.chat-head .dot { width: 7px; height: 7px; border-radius: 50%; background: #2fae66; display: inline-block; }
.msg.typing { display: inline-flex; gap: 4px; align-items: center; padding: 14px 16px; }
.msg.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite both; }
.msg.typing i:nth-child(2) { animation-delay: .2s; }
.msg.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.chat-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-acts a { font-size: 13px; padding: 7px 14px; border-radius: 999px; background: var(--ink); color: #fff; text-decoration: none; }
.chat-acts a.zalo { background: #0068ff; }
.chat-panel { animation: chatIn .35s var(--ease); }
@keyframes chatIn { from { opacity: 0; transform: translateY(14px) scale(.98); } }
@media (max-width: 520px) { .chat-panel { right: 8px; left: 8px; width: auto; bottom: calc(env(safe-area-inset-bottom, 0px) + 8px); height: min(78vh, 600px); } }
/* Công tắc ngôn ngữ */
.lang-sw { font-size: 11.5px !important; font-weight: 500; letter-spacing: .14em !important; border: 1px solid currentColor; border-radius: 999px; padding: 5px 10px !important; margin-left: 6px; text-decoration: none !important; opacity: .85; color: inherit; }
.lang-sw:hover { opacity: 1; }
.lang-sw::after { display: none !important; }

/* Thông tin người bán ở chân trang */
.seller-info { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line, #e6e1dc); text-align: center; display: grid; gap: 14px; justify-items: center; }
.seller-info p { margin: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 22px; font-size: 12px; line-height: 1.7; color: var(--muted, #5d5650); letter-spacing: .02em; }
.seller-info b { font-weight: 500; color: inherit; }
.seller-info .bct { font-size: 12px; color: var(--muted, #5d5650); }
.seller-info .bct img { display: block; width: 130px; height: auto; }
