/* =========================================================
   GIAO DIỆN BẢNG ĐIỀU KHIỂN DÙNG CHUNG — trang quản lý (cặp đôi), tài khoản (khách), admin (tác giả)
   Phần riêng từng trang: web/account.css, quan-tri/admin.css
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
:root {
  --bg: #f6f1ea; --card: #fffdfa; --ink: #2a1d1f; --muted: #6f5f5a; --wine: #7a1f2b; --rose: #c4876b; --gold: #d6a756; --line: #e8dccf; --soft: #f1e8de; --danger: #b3261e; --ok: #2f6b3a;
  --serif: "Playfair Display", Georgia, serif; --sans: "Be Vietnam Pro", system-ui, sans-serif;
}
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 120px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.55 var(--sans); }
[hidden] { display: none !important; }
a { color: inherit; }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0; font-weight: 500; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.err { color: var(--danger); min-height: 1.2em; margin: 0; font-size: 14px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 18px; border-radius: 999px; border: 1.5px solid var(--wine); font-weight: 600; font-size: 14px; line-height: 1.3; text-decoration: none; white-space: nowrap; background: transparent; color: var(--wine); transition: background .2s, transform .15s; }
.btn:active { transform: scale(.98); }
.btn--main { background: var(--wine); color: #fff; }
.btn--main:disabled { background: #b9a7a2; border-color: #b9a7a2; cursor: default; }
.btn--line:hover { background: rgba(122,31,43,.06); }
.btn--sm { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn--text { border-color: transparent; color: var(--muted); }

input, select, textarea { width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px; }
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(122,31,43,.25); border-color: var(--wine); }
label { display: grid; gap: 5px; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 12px; }
fieldset { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px 2px; margin: 0 0 14px; min-width: 0; }
legend { padding: 0 6px; font-weight: 700; font-size: 14px; color: var(--wine); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.row2 { display: flex; gap: 8px; }
.switch { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; }
.switch input { width: 22px; min-height: 22px; height: 22px; accent-color: var(--wine); }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }

.brand { display: inline-flex; align-items: center; gap: 8px; font: 500 20px var(--serif); text-decoration: none; color: var(--ink); }
.brand-ic { width: 32px; height: 32px; border-radius: 9px; background: var(--wine); color: #f3d9a4; display: grid; place-items: center; font: 16px var(--sans); }

/* Đăng nhập */
.login { min-height: 100svh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(400px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 28px 24px; display: grid; gap: 12px; box-shadow: 0 24px 60px rgba(42,29,31,.08); }
.login-card h1 { font: 500 26px var(--serif); margin-top: 6px; }
.login-card p { margin: 0; }

/* Khung trang */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: rgba(246,241,234,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-title { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.top-title b { font: 500 18px var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-title small { color: var(--muted); font-size: 12px; }
.tabs { position: sticky; top: 59px; z-index: 19; display: flex; gap: 6px; overflow-x: auto; padding: 8px 16px; background: rgba(246,241,234,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: 0 0 auto; padding: 8px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: 13px; font-weight: 600; text-decoration: none; color: var(--muted); }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--wine); color: #fff; font-size: 11px; text-align: center; }
.badge:empty { display: none; }
.wrap { max-width: 860px; margin: 0 auto; padding: 16px 16px 120px; display: grid; gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 20px; }
.card h2 { font: 500 22px var(--serif); margin-bottom: 8px; }
.card h3 { font-size: 15px; font-weight: 700; margin: 18px 0 8px; }
.card > p { margin: 0 0 12px; }
@media (max-width: 640px) { .card { padding: 16px 14px; border-radius: 16px; } .hide-sm { display: none; } }

/* Link + khách */
.linkbox { display: flex; gap: 8px; }
.linkbox input { font-size: 14px; background: var(--soft); }
.guest-row input { flex: 1; }
.guest-row select, .guest-bulk select { width: auto; flex: none; }
.rsvp-opts { align-items: end; }
.rsvp-opts .switch { margin-bottom: 14px; }
.ben-links { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.ben-links > span { flex: 1 1 100%; }
.st--side { background: #fff3e0; color: #8a4b00; margin-left: 4px; }
.viewpass { margin-top: 12px; }
.viewpass small { font-weight: 400; }
.share-guest { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.share-guest > span { flex: 1 1 100%; }
/* câu hỏi thêm khi khách xác nhận */
.rsvpq { margin: 0 0 12px; }
.rsvpq summary { cursor: pointer; font-size: 13px; color: var(--wine); font-weight: 600; padding: 4px 0; }
.rsvpq > p { margin: 8px 0 10px; }
.chip { display: inline-block; margin: 2px 2px 2px 0; padding: 3px 10px; border-radius: 999px; border: 1px dashed var(--wine); background: #fff; font-size: 12px; font-weight: 600; color: var(--wine); }
.chip:hover { background: rgba(122,31,43,.06); }
.guest-list .ans b { font-weight: 700; }
/* chế độ người nhà thêm khách (?khach=token): chỉ hiện phần có data-khach trong mục khách mời */
.is-khach .tabs, .is-khach .savebar, .is-khach [data-design], .is-khach .card:not(#s-link), .is-khach #s-link > :not([data-khach]),
.is-khach [data-gdel], .is-khach [data-gshare], .is-khach .st--wait, .is-khach .st--open, .is-khach .st--unopen, .is-khach .views { display: none !important; }
.khach-note { padding: 10px 12px; border-radius: 12px; background: #fff8e6; color: #5a3d00; }
.guest-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.guest-list li { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 12px; background: var(--soft); }
.guest-list li > span { flex: 1; min-width: 0; display: grid; }
.guest-list small { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guest-list li > span > small:not(:last-child) { white-space: normal; font-size: 12px; color: var(--ink); }
.guest-bulk { margin-top: 8px; }
.guest-bulk summary { cursor: pointer; font-size: 13px; color: var(--wine); font-weight: 600; padding: 4px 0; }
.guest-bulk textarea { margin: 8px 0; }
.guest-tools { margin-top: 10px; }
.rsvp-sum { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.st { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; font-style: normal; vertical-align: middle; }
.st--yes { background: #e3f3e8; color: #1f6b3a; }
.st--no { background: #fbe4e4; color: #8f2626; }
.st--wait { background: var(--soft); color: var(--muted); }
.st--open { background: #e4eefb; color: #1f4e8c; }
.st--unopen { background: var(--soft); color: var(--muted); }
/* lượt mở thiệp (đợt 15) */
.views { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.views-nums { margin: 0 0 6px; font-size: 14px; }
.views-nums b { font-size: 18px; color: var(--wine); }
.views-bars { display: flex; align-items: flex-end; gap: 3px; height: 40px; }
.views-bars i { flex: 1; min-height: 3px; background: var(--rose); border-radius: 3px 3px 0 0; }
.views-bars i.zero { background: var(--line); }
.views-axis { display: flex; justify-content: space-between; font-size: 11px; margin-top: 3px; }
.views small { display: block; margin-top: 6px; }
.qr-row { display: flex; gap: 14px; align-items: center; margin-top: 12px; }
.qr-box { width: 112px; height: 112px; flex: none; border-radius: 12px; border: 1px solid var(--line); background: #fff; padding: 4px; display: grid; place-items: center; font-size: 11px; color: var(--muted); text-align: center; }
.qr-box svg { width: 100%; height: 100%; }
.preview { margin-top: 16px; }
.preview summary { cursor: pointer; font-weight: 700; color: var(--wine); padding: 6px 0; }
.phone { width: min(340px, 100%); aspect-ratio: 9/18; margin: 10px auto 0; border-radius: 36px; padding: 10px; background: #1d1719; }
.phone iframe { width: 100%; height: 100%; border: 0; border-radius: 27px; background: #fff; }

/* Mẫu */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-bottom: 18px; }
.tpl { padding: 0; border: 2px solid transparent; border-radius: 12px; background: #fff; overflow: hidden; text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); }
.tpl img { width: 100%; aspect-ratio: 4/5; object-fit: cover; }
.tpl span { display: block; padding: 5px 2px; }
.tpl.on { border-color: var(--p); color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--p) 25%, transparent); }

/* Danh sách có thể sửa */
.item { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px 2px; margin-bottom: 12px; background: #fff; }
.item-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.item-acts { display: inline-flex; gap: 4px; }
.item-acts button { min-width: 36px; min-height: 34px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--soft); font-size: 13px; color: var(--ink); }
.item-acts .danger, .danger { color: var(--danger); }
.busy { opacity: .5; pointer-events: none; }

/* Ảnh */
.slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.slot { display: grid; gap: 6px; align-content: start; font-size: 13px; }
.slot-img { position: relative; aspect-ratio: 4/5; border-radius: 12px; overflow: hidden; background: var(--soft); }
.slot-img img { width: 100%; height: 100%; object-fit: cover; }
.slot-img.is-stock img { opacity: .55; filter: grayscale(.4); }
.slot-img em { position: absolute; left: 8px; top: 8px; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.9); font-style: normal; font-size: 11px; font-weight: 700; color: var(--muted); }
.slot-acts { display: flex; gap: 4px; flex-wrap: wrap; }
@media (max-width: 640px) { .slots { grid-template-columns: 1fr 1fr; } }
.upload-btn { cursor: pointer; margin: 0 0 12px; display: inline-flex; color: #fff; }
.progress { position: relative; height: 32px; border-radius: 999px; background: var(--soft); overflow: hidden; margin-bottom: 12px; }
.progress i { position: absolute; inset: 0 auto 0 0; background: rgba(122,31,43,.18); transition: width .3s; }
.progress span { position: relative; display: block; text-align: center; line-height: 32px; font-size: 13px; font-weight: 600; }
.gal { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.g { margin: 0; position: relative; border-radius: 10px; overflow: hidden; aspect-ratio: 1; background: var(--soft); }
.g img { width: 100%; height: 100%; object-fit: cover; }
.g figcaption { position: absolute; inset: auto 0 0; display: flex; justify-content: space-between; padding: 4px; background: linear-gradient(transparent, rgba(0,0,0,.55)); }
.g button { width: 32px; height: 32px; border: 0; border-radius: 8px; background: rgba(255,255,255,.92); font-size: 14px; color: var(--ink); }
.g .danger { color: var(--danger); }

/* Câu chuyện */
.story-row { display: grid; grid-template-columns: 96px 1fr; gap: 12px; }
.story-ph { width: 96px; height: 96px; border-radius: 12px; overflow: hidden; background: var(--soft); border: 1.5px dashed var(--line); display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.story-ph img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 480px) { .story-row { grid-template-columns: 72px 1fr; } .story-ph { width: 72px; height: 72px; } }

/* Mừng cưới */
.gift .qr-prev { display: grid; justify-items: center; gap: 6px; margin: 4px 0 12px; text-align: center; }
.gift .qr-prev svg { width: 150px; height: 150px; }
.gift .qr-prev small { font-size: 12px; }

/* Lời chúc */
.wishes { display: grid; gap: 8px; margin-top: 8px; }
.wish { position: relative; padding: 12px 14px; border-radius: 12px; background: #fff; border: 1px solid var(--line); }
.wish p { margin: 0 0 4px; }
.wish small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.wish .item-acts { margin-top: 8px; }
.wish.is-hidden { opacity: .55; background: var(--soft); }
.wish.is-hidden::after { content: "Đang ẩn"; position: absolute; top: 10px; right: 12px; font-size: 11px; font-weight: 700; color: var(--muted); }

/* Thanh lưu + thông báo */
.savebar { position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); translate: -50% 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 8px 8px 8px 18px; border-radius: 999px; background: var(--ink); color: #e9ddd6; font-size: 14px; box-shadow: 0 14px 40px rgba(0,0,0,.25); width: max-content; max-width: calc(100vw - 24px); }
.savebar.dirty { background: var(--wine); color: #fff; }
.savebar.dirty .btn--main { background: var(--gold); border-color: var(--gold); color: #2a1a00; }
.toast { position: fixed; left: 50%; top: 16px; translate: -50% -20px; z-index: 50; padding: 10px 18px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; max-width: calc(100vw - 32px); text-align: center; }
.toast.on { opacity: 1; translate: -50% 0; }

/* ===== Danh sách dạng hàng (admin, quản lý) ===== */
.list { display: grid; gap: 8px; }
.row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 12px 14px; border-radius: 14px; background: #fff; border: 1px solid var(--line); }
.row b { font-family: var(--serif); font-weight: 500; font-size: 17px; }
.row small { display: block; color: var(--muted); font-size: 12px; }
.row .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 560px) { .row { grid-template-columns: 1fr; } .row .acts { justify-content: flex-start; } }
.tpl-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.tpl-tools input { flex: 1 1 160px; min-height: 38px; padding: 6px 12px; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--soft); }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted); min-height: 34px; }
.seg button.on { background: #fff; color: var(--wine); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.tpl { position: relative; }
.tpl i { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; background: #1d1719; color: #e8cf96; font-style: normal; font-size: 12px; display: grid; place-items: center; }
#tplMore { margin: -6px 0 16px; }
.pay { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; vertical-align: middle; }
.pay.ok { background: #e7f4ea; color: #2f6b3a; }
.pay.due { background: #fdecea; color: #b3261e; }
.tpl.is-locked img { filter: grayscale(.5) brightness(.85); }
.tpl i.lock { width: auto; height: auto; padding: 3px 7px; border-radius: 999px; font-size: 10px; font-weight: 700; top: 6px; right: 6px; }
.pay-dlg { border: 0; border-radius: 22px; padding: 26px 22px 22px; width: min(380px, calc(100vw - 24px)); max-height: calc(100svh - 24px); overflow: auto; text-align: center; background: var(--card); color: var(--ink); }
.pay-dlg::backdrop { background: rgba(42,29,31,.55); }
.pay-dlg h2 { font: 500 24px var(--serif); margin-bottom: 4px; }
.pay-dlg .dlg-x { position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--soft); font-size: 22px; }
.pay-qr { width: 200px; margin: 12px auto; padding: 8px; background: #fff; border-radius: 14px; box-shadow: 0 0 0 1px var(--line); }
.pay-qr svg { width: 100%; height: auto; display: block; }
.pay-info { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 4px; text-align: left; }
.pay-info li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 12px; border-radius: 10px; background: var(--soft); font-size: 14px; }
.pay-info span { color: var(--muted); }
.pay-dlg .btn { width: 100%; }
/* dòng trạng thái trống nằm trong lưới → trải hết chiều ngang */
.gal > p, .tpl-grid > p, .slots > p { grid-column: 1 / -1; margin: 4px 0; }

/* nhãn trạng thái dùng chung (đơn, thanh toán) */
.pay.info { background: #e8f0fb; color: #1d4f91; }
.pay.off { background: #eeeae6; color: #5e534f; }
/* nhạc nền: ô link + nút tải lên */
.music-row { display: grid; grid-template-columns: 1fr auto; gap: 0 10px; align-items: start; }
.music-up { margin-top: 24px; cursor: pointer; }
@media (max-width: 640px) { .music-row { grid-template-columns: 1fr; } .music-up { margin: -4px 0 12px; } }
.design-cta { margin: 2px 0 14px; }
.design-cta .btn { white-space: normal; text-align: left; min-height: 44px; padding: 8px 16px; }
