/* ============ Tokens ============ */
:root {
  --bg: #fff8f1;
  --surface: #ffffff;
  --surface-2: #fff2e6;
  --text: #2b2140;
  --muted: #776b88;
  --line: #f3e3d4;

  --coral: #ff6b4a;
  --sun: #ffb020;
  --sea: #14b8a6;
  --sky: #3b82f6;
  --grape: #a855f7;
  --pink: #ec4899;

  --grad: linear-gradient(135deg, #f9733b 0%, #f43f6e 55%, #9d4edd 100%);
  --grad-sky: linear-gradient(160deg, #ff9a5a 0%, #ff5e7e 45%, #8f5cff 100%);
  --on-grad: #ffffff;
  --danger: #e11d48;
  --danger-soft: #ffe4ea;
  --warn-soft: #fff1cc;

  --shadow: 0 10px 24px -12px rgba(244, 63, 110, .35), 0 2px 6px rgba(43, 33, 64, .06);
  --shadow-sm: 0 2px 8px rgba(43, 33, 64, .07);
  --radius: 22px;
  --nav-h: 64px;

  --font: "Times New Roman", Tinos, Times, serif;
  --font-display: "Times New Roman", Tinos, Times, serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16111f;
    --surface: #221a2e;
    --surface-2: #2c2339;
    --text: #f7f0fb;
    --muted: #b4a8c4;
    --line: #382d48;
    --danger: #ff7a93;
    --danger-soft: #3c1623;
    --warn-soft: #3a2f16;
    --shadow: 0 10px 24px -12px rgba(0, 0, 0, .7);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, .35);
  }
}

/* ============ Base ============ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.5 var(--font);
  padding-bottom: calc(var(--nav-h) + 28px + env(safe-area-inset-bottom));
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; line-height: 1.2; font-family: var(--font-display); }
[hidden] { display: none !important; }
a { color: var(--coral); font-weight: 600; }

main { max-width: 640px; margin: 0 auto; }
.page { padding: 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.empty { color: var(--muted); text-align: center; padding: 18px 0; }

.section-title { font-size: 21px; font-weight: 800; margin-bottom: 12px; }

/* ============ Loading / error ============ */
.state { min-height: 75vh; display: grid; place-content: center; gap: 10px; text-align: center; padding: 24px; color: var(--muted); font-weight: 600; }
.loader { font-size: 54px; animation: hop 0.9s ease-in-out infinite; }
@keyframes hop { 0%, 100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-16px) rotate(6deg); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Hero ============ */
.hero { position: relative; display: flex; align-items: flex-end; color: #fff; overflow: hidden;
        background: var(--grad-sky); }
.hero > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero.has-img::before { content: ""; position: absolute; inset: 0; z-index: 1;
                        background: linear-gradient(to top, rgba(43, 18, 64, .8) 5%, rgba(43, 18, 64, .15) 60%, rgba(0,0,0,0)); }
.sun { position: absolute; top: 18px; right: 20px; width: 54px; height: 54px; border-radius: 50%;
       background: radial-gradient(circle, #fff6b0 0%, #ffd23f 55%, #ffb020 100%);
       box-shadow: 0 0 0 14px rgba(255, 220, 90, .25), 0 0 60px 20px rgba(255, 210, 80, .45); animation: glow 4s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 22px rgba(255, 220, 90, .18), 0 0 80px 30px rgba(255, 210, 80, .5); } }
.hero-body { position: relative; z-index: 2; padding: 22px 18px 58px; width: 100%; }
.hero:not(.has-img) h1 { padding-right: 70px; }
.hero h1 { font-size: 30px; font-weight: 800; margin: 0 0 12px; text-shadow: 0 2px 12px rgba(60, 10, 60, .35); }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-weight: 600; font-size: 14px;
        background: rgba(255, 255, 255, .92); color: #3a2350; }
.waves { position: absolute; left: 0; right: 0; bottom: -1px; z-index: 3; width: 100%; height: 44px; color: var(--bg); }
.waves .back { opacity: .45; animation: sway 6s ease-in-out infinite alternate; }
@keyframes sway { to { transform: translateX(-40px); } }

/* ============ Crowd (người đã đăng ký) ============ */
.crowd { position: relative; z-index: 4; margin: -26px 16px 0; background: var(--surface); border-radius: 999px;
         box-shadow: var(--shadow); padding: 8px 16px 8px 10px; display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--muted); }
.crowd { width: calc(100% - 32px); border: 0; font: inherit; font-size: 15px; text-align: left; cursor: pointer; }
.crowd:active { transform: scale(.98); }
.crowd b { color: var(--text); }
.crowd-go { margin-left: auto; font-size: 24px; line-height: 1; color: var(--coral); }
.faces { display: flex; flex: none; }
.faces .avatar { margin-left: -8px; border: 2px solid var(--surface); }
.faces .avatar:first-child { margin-left: 0; }

/* ============ Tab con ============ */
.subtabs { position: sticky; top: 0; z-index: 10; display: flex; gap: 6px; overflow-x: auto; padding: 12px 16px 8px;
           background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
           scrollbar-width: none; }
.subtabs::-webkit-scrollbar { display: none; }
.subtabs button { flex: 1 0 auto; border: 0; border-radius: 999px; padding: 8px 12px; font: inherit; font-size: 15px; font-weight: 700;
                  white-space: nowrap; background: var(--surface); color: var(--muted); box-shadow: var(--shadow-sm); cursor: pointer; }
.subtabs button[aria-selected="true"] { background: var(--grad); color: #fff; }
.off { display: none !important; }
.subtabs + .page { padding-top: 8px; }

/* ============ Info ============ */
.intro { position: relative; margin: 0 0 14px; padding: 14px 16px 14px 44px; border-radius: 18px; white-space: pre-line;
         background: var(--surface-2); font-style: italic; }
.intro::before { content: "💬"; position: absolute; left: 14px; top: 13px; font-style: normal; }
.intro:last-child { margin-bottom: 0; }
.info-rows { list-style: none; margin: 0; padding: 0; }
.info-rows li { display: grid; grid-template-columns: 26px 96px 1fr; gap: 8px; padding: 10px 0; border-top: 1px dashed var(--line); }
.info-rows li:first-child { border-top: 0; padding-top: 0; }
.info-rows .lbl { color: var(--muted); font-size: 14px; }
.info-rows .val { font-weight: 600; word-break: break-word; }
.notice { margin: 0; background: var(--warn-soft); border-radius: 16px; padding: 12px 14px; font-weight: 600; }

/* ============ Gallery ============ */
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.gallery button { aspect-ratio: 1; padding: 0; border: 0; border-radius: 12px; overflow: hidden; background: var(--surface-2); cursor: zoom-in; }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.gallery button:hover img { transform: scale(1.05); }

/* ============ Guide ============ */
.guide-list { display: grid; gap: 12px; }
.guide { display: grid; grid-template-columns: 96px 1fr; overflow: hidden; border-radius: 18px; background: var(--surface);
         box-shadow: var(--shadow-sm); border-left: 4px solid var(--c); }
.guide img, .guide-ph { width: 96px; height: 100%; min-height: 96px; object-fit: cover; }
.guide img { cursor: zoom-in; background: var(--surface-2); }
.guide-ph { display: grid; place-items: center; font-size: 40px;
            background: linear-gradient(135deg, color-mix(in srgb, var(--c) 45%, #fff), color-mix(in srgb, var(--c) 80%, #fff)); }
.guide-body { padding: 10px 14px; }
.guide h3 { font-size: 18px; font-weight: 800; margin-bottom: 2px; }
.guide .addr { display: block; width: fit-content; font-size: 14px; font-weight: 600; margin-bottom: 2px; text-decoration: none; }
.guide p { margin: 0; white-space: pre-line; color: var(--muted); font-size: 15px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.link-btn { background: none; border: 0; padding: 6px 0 0; color: var(--c, var(--coral)); font: inherit; font-weight: 700; cursor: pointer; }

/* ============ Lịch trình ============ */
#scheduleList { display: grid; gap: 16px; }
.day { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.day-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px;
            background: linear-gradient(135deg, color-mix(in srgb, var(--c) 18%, var(--surface)), var(--surface));
            border-bottom: 1px solid color-mix(in srgb, var(--c) 20%, transparent); }
.day-head h3 { font-size: 22px; font-weight: 800; color: var(--c); }
.day-date { background: var(--c); color: #fff; font-weight: 700; font-size: 14px; padding: 3px 10px; border-radius: 999px; }
.day-count { margin-left: auto; font-size: 13px; color: var(--muted); }

.timeline { list-style: none; margin: 0; padding: 16px 18px 6px; }
.timeline li { position: relative; padding: 0 0 18px 28px; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 16px; bottom: -2px;
                       border-left: 2px dashed color-mix(in srgb, var(--c) 40%, transparent); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 0; top: 3px; width: 14px; height: 14px; border-radius: 50%;
                      background: var(--surface); border: 3px solid var(--c); box-sizing: border-box; }
.timeline time { display: block; font-size: 13.5px; font-weight: 800; color: var(--c); letter-spacing: .02em; line-height: 1.4; }
.timeline b { display: block; font-size: 16.5px; line-height: 1.35; }
.tl-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tl-meta span { font-size: 13.5px; background: var(--surface-2); color: var(--muted); padding: 3px 10px; border-radius: 10px;
                white-space: pre-line; }
/* Địa điểm có Google Maps: bấm mở bản đồ */
.tl-meta .tl-map { font-size: 13.5px; font-weight: 600; background: color-mix(in srgb, var(--c) 12%, var(--surface));
                   color: var(--c); padding: 3px 10px; border-radius: 10px; text-decoration: none; }
.tl-meta .tl-map::after { content: ' ↗'; font-size: 12px; }
.day-route { flex: none; font-size: 13px; font-weight: 700; color: #fff; background: var(--c); padding: 5px 11px;
             border-radius: 999px; text-decoration: none; white-space: nowrap; }
.timeline img { margin-top: 10px; border-radius: 14px; aspect-ratio: 16 / 9; object-fit: cover; width: 100%; cursor: zoom-in; }

/* ============ Budget ============ */
.bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; gap: 3px; margin-bottom: 8px; }
.bar span { min-width: 4px; }
.budget-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.budget-row .dot { width: 12px; height: 12px; border-radius: 4px; margin-top: 5px; flex: none; }
.budget-row .name { flex: 1; }
.budget-row .amt { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.budget-total { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 0 2px; }
.budget-total span:first-child { font-weight: 700; }
.budget-total .amt { font-family: var(--font-display); font-size: 26px; font-weight: 800;
                     background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ============ Chi tiêu ============ */
#spendBox { display: grid; gap: 16px; align-items: start; }
#spendBox h3 { font-size: 19px; font-weight: 800; margin-bottom: 8px; }
.fund-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fund-grid div { background: var(--surface-2); border-radius: 14px; padding: 10px; }
.fund-grid span { display: block; font-size: 12.5px; color: var(--muted); }
.fund-grid b { font-size: 16px; font-variant-numeric: tabular-nums; }
.fund-grid .spent { color: #7e22ce; }
.fund-grid .left b { color: #15803d; }
.fund-grid .over b { color: var(--danger); }
.fund-bar { margin-top: 12px; }
.fund-bar span { background: linear-gradient(90deg, #8b5cf6, #6366f1); }
.fund-bar.over span { background: var(--danger); }
.fund .muted.small { margin: 4px 0 0; }
.fund-avg { margin: 12px 0 0; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); font-size: 14.5px; }
.grp-list, .exp-list { list-style: none; margin: 0; padding: 0; }
.grp-list li { padding: 7px 0; }
.grp-top { display: flex; justify-content: space-between; gap: 10px; font-size: 15px; }
.grp-top b { font-variant-numeric: tabular-nums; }
.grp-bar { height: 8px; border-radius: 999px; background: var(--surface-2); margin-top: 5px; overflow: hidden; }
.grp-bar span { display: block; height: 100%; border-radius: 999px; background: var(--c); }
.exp-day + .exp-day { margin-top: 14px; }
.exp-day-head { display: flex; justify-content: space-between; font-size: 13.5px; font-weight: 700; color: var(--muted);
                padding: 6px 10px; border-radius: 10px; background: var(--surface-2); }
.exp-list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px dashed var(--line); }
.exp-list li:first-child { border-top: 0; }
.exp-ico { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--surface-2); font-size: 18px; }
.exp-body { flex: 1; min-width: 0; }
.exp-amt { font-weight: 700; white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.exp-amt .link-btn { display: block; margin-left: auto; padding: 0; font-size: 12.5px; }

/* ============ Nộp tiền ============ */
#payBox, .pay-col { display: grid; gap: 16px; align-items: start; }
#payBox h3 { font-size: 19px; font-weight: 800; margin-bottom: 4px; }
.pay-fee { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; }
.pay-fee b { font-family: var(--font-display); font-size: 26px; font-weight: 800;
             background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pay-sum > p { margin: 2px 0 10px; }
.progress { height: 12px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #14b8a6, #22c55e); }
.pay-nums { display: flex; justify-content: space-between; gap: 10px; margin-top: 6px; font-size: 14px; color: var(--muted); }
.pay-nums b { color: var(--text); }
.bank { display: grid; gap: 10px; }
.bank select { width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--surface-2);
               border: 2px solid transparent; border-radius: 14px; padding: 10px 12px; }
.bank select:focus { outline: none; border-color: var(--coral); }
.bank-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.bank-row .lbl { color: var(--muted); font-size: 14px; flex: none; }
.bank-row .v { font-weight: 700; text-align: right; word-break: break-word; }
.bank-row.big .v { font-family: var(--font-display); font-size: 22px; color: var(--coral); }
.bank-row.big .v.ok { color: #15803d; }
.copy { border: 0; background: var(--surface-2); color: var(--coral); border-radius: 8px; padding: 3px 8px; margin-left: 8px;
        font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.qr { width: 240px; max-width: 75%; justify-self: center; padding: 0; border: 0; border-radius: 16px; overflow: hidden;
      background: #fff; box-shadow: var(--shadow-sm); cursor: zoom-in; }
.qr img { width: 100%; }
.center { text-align: center; margin: 0; }
.pay-list { list-style: none; margin: 6px 0 0; padding: 0; }
.pay-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px dashed var(--line); }
.pay-row:first-child { border-top: 0; }
.pay-row.me b { color: var(--coral); }
.st { flex: none; font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.st.ok { background: color-mix(in srgb, #22c55e 15%, transparent); color: #15803d; }
.st.part { background: color-mix(in srgb, var(--sun) 20%, transparent); color: #b45309; }
.st.no { background: var(--surface-2); color: var(--muted); }
.st.back { background: color-mix(in srgb, var(--sky) 15%, transparent); color: #1d4ed8; }
.st.self { background: color-mix(in srgb, var(--grape) 14%, transparent); color: #7e22ce; }
.pending-note { margin: 0 0 10px; font-size: 13.5px; font-weight: 600; color: #7e22ce; }
.pay-row { justify-content: flex-start; }
.pay-who { flex: 1; min-width: 0; }
.tick { flex: none; display: grid; place-items: center; width: 34px; height: 34px; cursor: pointer; }
.tick input { width: 22px; height: 22px; accent-color: #22c55e; cursor: pointer; margin: 0; }
.tick.locked input { cursor: default; }
.phase { display: inline-block; font-size: 12.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; margin-bottom: 8px;
         background: color-mix(in srgb, var(--sun) 20%, transparent); color: #b45309; }
.phase.done { background: color-mix(in srgb, var(--sky) 15%, transparent); color: #1d4ed8; }
.settle-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.settle-grid div { background: var(--surface-2); border-radius: 14px; padding: 8px 10px; }
.settle-grid span { display: block; font-size: 12.5px; color: var(--muted); }
.settle-grid b { font-size: 15px; font-variant-numeric: tabular-nums; }
.settle-grid .owe b { color: #b45309; }
.settle-grid .refund b { color: #1d4ed8; }
.bank-row.big .v.refund { color: #1d4ed8; }

/* ============ Buttons ============ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 22px;
       border-radius: 16px; border: 0; background: var(--surface); color: var(--text);
       font: inherit; font-weight: 700; font-size: 16px; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.btn.primary { background: var(--grad); color: var(--on-grad); box-shadow: 0 10px 20px -10px #f43f6e; }
.btn.primary:active { transform: scale(.97); }
.btn.sm { min-height: 38px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; cursor: default; }
.cta { font-size: 17px; min-height: 56px; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .25); color: #fff;
            display: grid; place-items: center; cursor: pointer; flex: none; }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.spinning svg { animation: spin .8s linear infinite; }

/* ============ Page hero (Đăng ký / Danh sách / Bình luận) ============ */
.page-hero { position: relative; overflow: hidden; color: #fff; padding: 18px 18px 44px; background: var(--grad-bg, var(--grad)); }
.page-hero .row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; position: relative; z-index: 2; }
.page-hero h1 { font-size: 26px; font-weight: 800; }
.page-hero p { margin: 4px 0 0; opacity: .95; font-weight: 500; }
.page-hero .deco { position: absolute; right: 14px; bottom: 18px; font-size: 46px; line-height: 1; opacity: .9; transform: rotate(-10deg); z-index: 1; }
.page-hero .waves { height: 30px; }
.page-hero + .page { margin-top: -12px; position: relative; z-index: 4; }
.page-hero:has(.icon-btn) .deco { right: 64px; bottom: 16px; font-size: 40px; }
#tab-spend .page-hero { --grad-bg: linear-gradient(135deg, #8b5cf6, #6366f1 55%, #0ea5e9); }
#tab-pay .page-hero { --grad-bg: linear-gradient(135deg, #22c55e, #14b8a6 55%, #0ea5e9); }
#tab-list .page-hero { --grad-bg: linear-gradient(135deg, #14b8a6, #3b82f6 60%, #8b5cf6); }

/* ============ Forms ============ */
.field { display: grid; gap: 6px; }
.field > span { font-weight: 700; font-size: 14px; }
input[type=text], input[type=number], input[type=password], input[type=date], input[type=tel], input[type=email], textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--surface-2);
  border: 2px solid transparent; border-radius: 14px; padding: 12px 14px; transition: border-color .15s, background .15s; }
textarea { resize: vertical; min-height: 90px; }
input:focus, textarea:focus { outline: none; border-color: var(--coral); background: var(--surface); }
form { display: grid; gap: 18px; }
fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 18px; min-width: 0; }

.toggle-row { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 18px; cursor: pointer;
              background: var(--surface-2); transition: background .2s; }
.toggle-row .emo { font-size: 26px; }
.toggle-row .txt { flex: 1; }
.toggle-row .txt b { display: block; }
.toggle-row .txt small { color: var(--muted); }
.toggle-row:has(.switch:checked) { background: color-mix(in srgb, var(--sea) 16%, var(--surface)); }
.switch { appearance: none; -webkit-appearance: none; width: 52px; height: 32px; border-radius: 999px; background: var(--line);
          position: relative; cursor: pointer; transition: background .2s; flex: none; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%;
                 background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s; }
.switch:checked { background: var(--sea); }
.switch:checked::after { transform: translateX(20px); }

.family-box { display: grid; gap: 10px; animation: pop .25s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(-6px); } }
.stepper-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 18px;
               background: color-mix(in srgb, var(--c) 12%, var(--surface)); }
.stepper-row .who { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.stepper-row .who .emo { font-size: 26px; }
.stepper-row small { display: block; color: var(--muted); font-weight: 500; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--c); color: #fff;
                  font-size: 22px; font-weight: 700; line-height: 1; cursor: pointer; }
.stepper button:active { transform: scale(.9); }
.stepper input { width: 46px; text-align: center; padding: 6px 2px; background: transparent; font-weight: 800; font-size: 20px; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.form-error { margin: 0; color: var(--danger); background: var(--danger-soft); padding: 10px 14px; border-radius: 14px; font-size: 14px; font-weight: 600; }

/* ============ Members ============ */
.stats { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; justify-content: center;
         background: var(--surface); border-radius: 16px; padding: 10px 14px; box-shadow: var(--shadow-sm); }
.stat { display: flex; align-items: baseline; gap: 5px; }
.stat b { font-family: var(--font-display); font-size: 22px; line-height: 1; color: var(--c); font-variant-numeric: tabular-nums; }
.stat span { font-size: 14px; color: var(--muted); }
.search { position: relative; }
.search input { padding-left: 42px; background: var(--surface); box-shadow: var(--shadow-sm); }
.search svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); }

.member-list { --pad: 14px; list-style: none; margin: 0; padding: 0; overflow: hidden;
               background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.member-list ul { list-style: none; margin: 0; padding: 0; }
.m-row { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "who idx" "det det" "note note";
         gap: 4px 10px; padding: 12px var(--pad); border-top: 1px dashed var(--line); }
.m-row:first-child { border-top: 0; }
.m-head { display: none; }
.m-row.me { background: linear-gradient(90deg, color-mix(in srgb, var(--coral) 9%, transparent), transparent 70%); }

/* Nhóm theo phòng: dòng tiêu đề màu + viền màu bên trái cho các thành viên cùng phòng */
.room-group + .room-group { border-top: 6px solid var(--bg); }
.room-head { display: flex; align-items: baseline; gap: 6px; padding: 9px var(--pad); font-size: 15px;
             background: color-mix(in srgb, var(--c) 13%, var(--surface)); box-shadow: inset 4px 0 0 var(--c); }
.room-head b { color: var(--c); font-size: 16px; }
.room-head span { color: var(--muted); font-size: 13.5px; }
.room-group .m-row { box-shadow: inset 4px 0 0 var(--c); }
.room-group.unassigned .room-head { box-shadow: none; }
.room-group.unassigned .m-row { box-shadow: none; }
.m-idx { grid-area: idx; color: var(--muted); font-size: 14px; }
.m-idx::before { content: "#"; }
.m-who { grid-area: who; display: flex; align-items: center; gap: 8px; min-width: 0; }
.m-who b { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-det { grid-area: det; display: flex; flex-wrap: wrap; gap: 2px 14px; padding-left: 42px; font-size: 14.5px; }
.m-adults::after { content: " người lớn"; }
.m-kids::after { content: " trẻ em"; }
.m-kids::before { content: "· "; color: var(--muted); }
.m-adults { margin-right: -8px; }
.m-room::before { content: "🛏️ "; }
.m-note { grid-area: note; padding-left: 42px; font-size: 14px; color: var(--muted); }
.m-note:empty { display: none; }
.m-note:not(:empty)::before { content: "📝 "; }
.unset { color: var(--muted); }
.member-list .empty { padding: 20px var(--pad); }

.avatar { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800;
          font-family: var(--font-display); font-size: 19px; flex: none; }
.avatar.sm { width: 34px; height: 34px; font-size: 14px; }
.tag { font-size: 12px; padding: 3px 9px; border-radius: 999px; font-weight: 700; flex: none;
       background: color-mix(in srgb, var(--c, var(--sea)) 16%, transparent); color: var(--c, var(--sea)); }

/* ============ Trò chuyện (kiểu app chat) ============ */
.chat { display: flex; flex-direction: column; margin: 12px 12px 0; overflow: hidden;
        height: calc(100vh - var(--nav-h) - 52px); height: calc(100dvh - var(--nav-h) - 52px - env(safe-area-inset-bottom));
        min-height: 380px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; color: #fff;
             background: linear-gradient(135deg, #ffb020, #ff6b4a 55%, #ec4899); }
.chat-head .faces:empty { display: none; }
.chat-head .faces .avatar { border-color: rgba(255, 255, 255, .8); }
.chat-title { flex: 1; min-width: 0; line-height: 1.25; }
.chat-title b { display: block; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-title small { font-size: 13px; opacity: .92; }

.chat-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; list-style: none; margin: 0; padding: 12px 12px 8px;
             display: flex; flex-direction: column; background: var(--bg); }
.chat-empty { margin: auto; color: var(--muted); text-align: center; }
.chat-sep { align-self: center; margin: 12px 0 6px; }
.chat-sep span { font-size: 12.5px; color: var(--muted); background: var(--surface); padding: 3px 12px; border-radius: 999px; box-shadow: var(--shadow-sm); }

.msg { display: flex; align-items: flex-end; gap: 8px; margin-top: 2px; }
.msg.first { margin-top: 10px; }
.msg .avatar.sm, .avatar-gap { width: 30px; height: 30px; font-size: 13px; flex: none; }
.msg-body { display: flex; flex-direction: column; align-items: flex-start; max-width: 78%; min-width: 0; }
.msg-name { font-size: 12.5px; color: var(--muted); margin: 0 0 2px 12px; }
.bubble { background: var(--surface); padding: 8px 13px; border-radius: 18px; box-shadow: var(--shadow-sm);
          white-space: pre-line; word-break: break-word; line-height: 1.4; }
.msg:not(.first) .bubble { border-top-left-radius: 6px; }
.msg:not(.last) .bubble { border-bottom-left-radius: 6px; }
.msg-time { font-size: 11.5px; color: var(--muted); margin: 3px 10px 0; }
.msg.me { justify-content: flex-end; }
.msg.me .msg-body { align-items: flex-end; }
.msg.me .bubble { background: var(--grad); color: #fff; border-radius: 18px; }
.msg.me:not(.first) .bubble { border-top-right-radius: 6px; }
.msg.me:not(.last) .bubble { border-bottom-right-radius: 6px; }
.msg.pending .bubble { opacity: .8; }

.composer { display: grid; gap: 6px; padding: 8px 10px 10px; border-top: 1px solid var(--line); background: var(--surface); }
.composer .form-error { padding: 6px 12px; }
.composer-name input { padding: 9px 14px; border-radius: 999px; }
.composer-me { font-size: 13px; color: var(--muted); padding: 0 6px; }
.composer-me .link-btn { padding: 0; font-size: 13px; }
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.composer-row textarea { flex: 1; min-height: 44px; max-height: 120px; resize: none; border-radius: 22px; padding: 10px 16px; line-height: 1.4; }
.send { width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%; background: var(--grad); color: #fff;
        display: grid; place-items: center; cursor: pointer; box-shadow: 0 6px 14px -6px #f43f6e; }
.send svg { width: 20px; height: 20px; margin-left: 2px; }
.send:active { transform: scale(.92); }

/* ============ Bottom nav ============ */
.bottom-nav { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 20;
              display: grid; grid-template-columns: repeat(7, 1fr); height: var(--nav-h); max-width: 680px; margin: 0 auto;
              background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
              border-radius: 24px; box-shadow: 0 12px 30px -10px rgba(43, 33, 64, .35); }
.bottom-nav button { border: 0; background: none; color: var(--muted); font: inherit; font-size: 11px; white-space: nowrap; padding: 0; font-weight: 600;
                     display: grid; place-content: center; justify-items: center; gap: 2px; cursor: pointer; }
.nav-ico { width: 42px; height: 30px; border-radius: 999px; display: grid; place-items: center; transition: background .2s, color .2s; }
.nav-ico svg { width: 22px; height: 22px; }
.bottom-nav button[aria-current="page"] { color: var(--text); font-weight: 800; }
.bottom-nav button[aria-current="page"] .nav-ico { background: var(--grad); color: #fff; }
/* Điện thoại hẹp: 7 mục menu, thu nhỏ chữ/icon cho vừa */
@media (max-width: 420px) {
  .bottom-nav { left: 8px; right: 8px; }
  .bottom-nav button { font-size: 10px; letter-spacing: -.2px; }
  .nav-ico { width: 36px; }
}

/* ============ Toast / lightbox / confetti ============ */
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 26px + env(safe-area-inset-bottom)); z-index: 30;
         transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: .25s;
         background: #2b2140; color: #fff; padding: 12px 18px; border-radius: 16px; font-weight: 600; font-size: 14px; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.lightbox { position: fixed; inset: 0; z-index: 40; background: rgba(20, 10, 30, .92); display: grid; place-items: center; padding: 16px; cursor: zoom-out; }
.lightbox img { max-height: 90vh; border-radius: 14px; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translate(var(--dx), 110vh) rotate(var(--r)); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .confetti { display: none; }
}

/* ============ Desktop (từ 900px) ============ */
.bottom-nav .nav-brand { display: none; }

@media (min-width: 900px) {
  body { padding-bottom: 40px; padding-top: 72px; font-size: 17px; }
  main { max-width: 1100px; padding: 0 24px; }

  /* Thanh điều hướng lên trên cùng */
  .bottom-nav { top: 0; bottom: auto; left: 0; right: 0; max-width: none; height: 64px; border-radius: 0;
                display: flex; align-items: center; justify-content: flex-end; gap: 4px;
                padding: 0 max(24px, calc((100vw - 1100px) / 2 + 24px));
                box-shadow: 0 1px 0 var(--line), 0 6px 20px -12px rgba(43, 33, 64, .25); }
  .bottom-nav button { display: flex; align-items: center; gap: 6px; height: 44px; padding: 0 14px 0 6px;
                       border-radius: 999px; font-size: 15px; }
  .bottom-nav button:not(.nav-brand):hover { background: var(--surface-2); color: var(--text); }
  .bottom-nav .nav-brand { display: block; margin-right: auto; padding: 0 !important; font-family: var(--font-display);
               font-size: 21px !important; font-weight: 800; color: var(--text) !important;
               max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .toast { bottom: 28px; }

  /* Ảnh bìa & phần đầu các tab */
  .hero, .page-hero { margin-top: 20px; border-radius: 28px; }
  .hero-body { padding: 44px 44px 72px; }
  .hero h1 { font-size: 46px; }
  .hero:not(.has-img) h1 { padding-right: 140px; }
  .sun { top: 28px; right: 44px; width: 88px; height: 88px; }
  .page-hero { padding: 26px 40px 50px; }
  .page-hero h1 { font-size: 32px; }
  .page-hero .deco, .page-hero:has(.icon-btn) .deco { font-size: 54px; right: 40px; bottom: 26px; }
  .page-hero:has(.icon-btn) .deco { right: 104px; }
  .page-hero .icon-btn { width: 48px; height: 48px; }

  .crowd { margin: -28px 0 0 44px; width: fit-content; }
  .crowd:hover { box-shadow: 0 0 0 2px var(--coral), var(--shadow); }
  .subtabs { padding: 18px 0 10px; gap: 8px; }
  .subtabs button { flex: none; padding: 10px 22px; font-size: 16px; }
  .page { padding: 16px 0 24px; gap: 24px; }
  .page-hero + .page { margin-top: -16px; }
  .card { padding: 24px; }

  /* Tổng quan: giới thiệu bên trái, thông tin bên phải */
  .gallery { grid-template-columns: repeat(5, 1fr); gap: 10px; }

  /* Điểm đến: 2 cột */
  .guide-list { grid-template-columns: 1fr 1fr; gap: 16px; }
  #guideList { grid-template-columns: 1fr; } /* Điểm đến: mỗi thẻ trải hết bề ngang */
  .guide-list > .guide:only-child { grid-column: 1 / -1; } /* chỉ có 1 thẻ thì cũng trải hết */
  .guide { grid-template-columns: 150px 1fr; }
  .guide img, .guide-ph { width: 150px; min-height: 130px; }
  .guide-body { padding: 16px 18px; }

  /* Lịch trình: các ngày xếp cạnh nhau */
  #scheduleList { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; align-items: start; }

  /* Kinh phí: danh sách bên trái, phí/người bên phải */
  /* Nộp tiền: tổng quan + chuyển khoản bên trái, danh sách bên phải */
  #payBox, #spendBox { grid-template-columns: 1fr 1.1fr; gap: 20px; }

  /* Đăng ký: form ở giữa */
  #regForm, #regClosed { width: 100%; max-width: 640px; margin: 0 auto; }

  /* Danh sách: thống kê + tìm kiếm 1 hàng, thành viên dạng bảng */
  #tab-list .page { grid-template-columns: auto 340px; justify-content: space-between; align-items: center; }
  #memberStats { justify-content: flex-start; gap: 6px 22px; padding: 12px 20px; }
  .member-list { grid-column: 1 / -1; --pad: 20px; }
  .m-row { grid-template-columns: 36px minmax(220px, 1.6fr) 96px 72px minmax(200px, 2fr);
           grid-template-areas: none; align-items: center; gap: 12px; padding: 10px var(--pad); }
  .m-row > *, .m-det > * { grid-area: auto; }
  .m-det { display: contents; }
  .m-head { display: grid; padding: 14px var(--pad) 10px; font-size: 13px; font-weight: 700; color: var(--muted);
            text-transform: uppercase; letter-spacing: .04em; border-bottom: 2px solid var(--line); }
  .m-head .m-who { font-weight: 700; }
  .m-head + .m-row { border-top: 0; }
  .m-adults::after, .m-kids::after, .m-idx::before, .m-kids::before, .m-room::before, .m-note:not(:empty)::before { content: none; }
  .m-adults, .m-kids { text-align: center; font-variant-numeric: tabular-nums; margin: 0; white-space: nowrap; }
  .m-note, .m-det { padding-left: 0; }
  .m-note:empty { display: block; }
  .m-note { font-size: 14.5px; }

  /* Trò chuyện: khung chat ở giữa, cao vừa màn hình */
  .chat { max-width: 820px; margin: 20px auto 0; height: calc(100vh - 72px - 64px); }
  .chat-head { padding: 12px 18px; }
  .chat-list { padding: 16px 20px 10px; }
  .msg-body { max-width: 65%; }
  .composer { padding: 10px 16px 14px; }
}

/* ---------- Quản lý ---------- */
.admin-link { justify-self: center; color: var(--muted); font-size: 14px; padding: 8px 0 24px; }
.admin-edit { display: block; margin: 0 0 10px auto; font-size: 14px; }
.admin-login { display: grid; gap: 12px; }
.admin-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tabs button { flex: 0 0 auto; border: 0; border-radius: 999px; padding: 8px 12px; font: inherit; font-size: 14px; font-weight: 700;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); cursor: pointer; }
.admin-tabs button[aria-selected="true"] { background: var(--grad); color: #fff; }
.admin-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.admin-bar .link-btn { padding: 0; }
#adminRows { display: grid; gap: 10px; }
.admin-row { padding: 0; }
.admin-row summary { padding: 14px 18px; font-weight: 700; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 8px; }
.admin-row summary::-webkit-details-marker { display: none; }
.admin-row summary::after { content: '✏️'; flex: none; }
.admin-row[open] summary { border-bottom: 1px solid var(--line); }
.admin-row form { display: grid; gap: 12px; padding: 14px 18px 18px; }
.admin-row input, .admin-row textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: 16px; padding: 10px 12px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--text); }
.admin-row textarea { resize: vertical; }
.admin-check { display: flex; align-items: center; gap: 10px; }
.admin-check input { width: 20px; height: 20px; }
.admin-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.sm:not(.primary):not(.danger) { background: var(--line); color: var(--text); }

/* ---------- Tải ảnh ---------- */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head .section-title { margin-bottom: 0; }
.upload-btn { cursor: pointer; flex: none; position: relative; }
.btn.sm.upload-btn:not(.primary) { background: var(--surface); color: var(--coral); box-shadow: var(--shadow-sm); }
.upload-btn.busy { pointer-events: none; opacity: .7; }
.upload-btn.busy[data-label] { font-size: 0; }
.upload-btn.busy[data-label]::after { content: attr(data-label); font-size: 14px; }
#galleryEmpty { margin: 0 0 4px; }
.admin-image { display: flex; gap: 8px; align-items: center; }
.admin-image input[type=text] { flex: 1; min-width: 0; }
.admin-album { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.admin-album figure { margin: 0; display: grid; gap: 6px; }
.admin-album img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; cursor: zoom-in; }

/* Màn hình vừa: menu trên cùng có 7 mục, thu hẹp khoảng cách cho vừa */
@media (min-width: 900px) and (max-width: 1180px) {
  .bottom-nav { gap: 0; }
  .bottom-nav button { padding: 0 10px 0 4px; font-size: 14px; }
}

/* Tab Nộp tiền: nút sửa tài khoản / QR (đã có QR) */
.bank-edit { display: block; margin: 8px auto 0; font-size: 14px; }

/* ============ Sửa ngay trên trang (chế độ admin) ============ */
.ed-btn { float: right; position: relative; z-index: 3; margin: 0 0 4px 8px; width: 32px; height: 32px; flex: none;
          border: 0; border-radius: 50%; cursor: pointer; background: var(--surface); color: var(--text);
          box-shadow: 0 2px 10px -2px rgba(43, 33, 64, .35); font-size: 15px; line-height: 1; padding: 0; }
.ed-btn:hover { box-shadow: 0 0 0 2px var(--coral); }
.ed-btn.ed-wide { float: none; display: block; width: 100%; height: auto; min-height: 46px; margin: 10px 0 0; border-radius: 14px;
                  background: var(--surface-2); font: inherit; font-weight: 700; font-size: 15px; box-shadow: none; }
.guide { position: relative; }
.guide > .ed-btn { position: absolute; top: 8px; right: 8px; float: none; margin: 0; }
.hero > .ed-btn { position: absolute; top: 14px; right: 14px; z-index: 5; float: none; margin: 0; }
.timeline li > .ed-btn { width: 28px; height: 28px; font-size: 13px; }
.budget-row .ed-btn { order: 3; float: none; margin: 0; width: 28px; height: 28px; font-size: 13px; }
.m-who .ed-btn, .pay-who .ed-btn, .exp-body .ed-btn { width: 28px; height: 28px; font-size: 13px; }
.m-who .ed-btn { float: none; margin: 0 0 0 auto; }
.msg-body .ed-btn { float: none; width: 24px; height: 24px; font-size: 11px; margin: 3px 0 0; }
.ed-add { display: block; width: 100%; margin: 10px 0 4px; padding: 12px; border: 2px dashed var(--line); border-radius: 16px;
          background: none; color: var(--muted); font: inherit; font-weight: 700; cursor: pointer; text-align: center; }
.ed-add:hover { border-color: var(--coral); color: var(--coral); }

/* Khung sửa trượt từ dưới lên (máy tính: giữa màn hình) */
.sheet-bg { position: fixed; inset: 0; z-index: 45; background: rgba(20, 10, 30, .55);
            display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; display: grid; gap: 14px;
         background: var(--surface); color: var(--text); border-radius: 24px 24px 0 0;
         padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); animation: sheet-up .22s ease-out; }
.sheet-head { display: flex; align-items: center; gap: 10px; position: sticky; top: -18px; margin: -18px -18px 0;
              padding: 18px 18px 10px; background: var(--surface); z-index: 1; }
.sheet-head h3 { margin: 0; flex: 1; font-size: 19px; }
.sheet-x { border: 0; background: var(--surface-2); color: var(--text); width: 34px; height: 34px; border-radius: 50%;
           cursor: pointer; font-size: 15px; flex: none; }
body.sheet-open { overflow: hidden; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
@media (min-width: 900px) {
  .sheet-bg { align-items: center; }
  .sheet { border-radius: 24px; }
}

/* ============ Trò chuyện: bảng biểu tượng + thả cảm xúc ============ */
.emoji-btn { width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%; background: var(--surface-2);
             font-size: 22px; line-height: 1; cursor: pointer; padding: 0; }
.emoji-btn.on { box-shadow: 0 0 0 2px var(--coral); }
.emoji-panel { max-height: 210px; overflow-y: auto; overscroll-behavior: contain; background: var(--surface-2);
               border-radius: 18px; padding: 6px 8px; }
.emoji-group > span { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin: 6px 4px 2px; }
.emoji-group > div { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); }
.emoji-group button { border: 0; background: none; font-size: 24px; height: 42px; border-radius: 10px; cursor: pointer; padding: 0; }
.emoji-group button:hover, .emoji-group button:focus-visible { background: var(--surface); }

.rx-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 3px; }
.rx { display: inline-flex; align-items: center; gap: 3px; height: 26px; padding: 0 8px; border-radius: 999px;
               border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: 14px;
               cursor: pointer; line-height: 1; }
.rx span { font-size: 12px; font-weight: 700; color: var(--muted); }
.rx.mine { border-color: var(--coral); background: color-mix(in srgb, var(--coral) 12%, var(--surface)); }
.rx.mine span { color: var(--coral); }
.rx-picker { display: flex; gap: 2px; margin-top: 4px; padding: 4px 6px; background: var(--surface); border-radius: 999px;
             box-shadow: 0 6px 18px -6px rgba(43, 33, 64, .35); }
.rx-picker button { border: 0; background: none; font-size: 22px; width: 38px; height: 36px; border-radius: 50%; cursor: pointer; padding: 0;
                    transition: transform .12s; }
.rx-picker button:hover { transform: scale(1.25); }
.bubble[data-react-pick] { cursor: pointer; -webkit-user-select: text; user-select: text; }

/* ============ Trò chuyện: @nhắc tên ============ */
.mention-list { display: grid; gap: 2px; padding: 6px; background: var(--surface); border-radius: 16px;
                box-shadow: 0 8px 24px -8px rgba(43, 33, 64, .35); max-height: 260px; overflow-y: auto; }
.mention-list button { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 0; border-radius: 12px;
                       background: none; color: var(--text); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.mention-list button .avatar.sm { width: 28px; height: 28px; font-size: 12px; flex: none; }
.mention-list button[aria-selected="true"], .mention-list button:hover { background: var(--surface-2); }
.mention { font-weight: 800; color: var(--coral); }
.msg.me .mention { color: #fff; text-decoration: underline; text-underline-offset: 2px; }
.mention.me { background: color-mix(in srgb, var(--coral) 16%, transparent); border-radius: 6px; padding: 0 3px; }
/* Tin có nhắc tên mình: viền nổi bật */
.msg.mentioned .bubble { box-shadow: 0 0 0 2px var(--coral), var(--shadow-sm); }

/* ============ Thông báo tin nhắn mới ============ */
.nav-ico { position: relative; }
.nav-badge { position: absolute; top: -4px; right: -2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
             background: #ef1c1c; color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center;
             box-shadow: 0 0 0 2px var(--surface); }
.nav-badge.at-me { background: #ef1c1c; }
/* Chấm đỏ nhịp nháy nhẹ cho dễ thấy */
.nav-badge:not([hidden]) { animation: badge-pulse 1.6s ease-in-out infinite; }
@keyframes badge-pulse { 50% { transform: scale(1.18); box-shadow: 0 0 0 2px var(--surface), 0 0 0 6px rgba(239, 28, 28, .25); } }
.nav-badge[hidden] { display: none; }
.notify-btn { font-size: 18px; }
.notify-btn.on { background: rgba(255, 255, 255, .35); }

/* ============ Điện thoại: chỉnh hiển thị (đánh giá 2026-11-13) ============ */
/* Đầu mỗi ngày ở Lịch trình: không vỡ dòng "Ngày / 1" */
.day-head h3, .day-date, .day-count { white-space: nowrap; }
.day-route { margin-left: auto; }
.day-count + .day-route { margin-left: 0; }
@media (max-width: 420px) {
  .day-head { padding: 12px 14px; gap: 8px; }
  .day-count { display: none; }
  .day-count + .day-route { margin-left: auto; }
}
/* Nút bấm đủ lớn cho ngón tay (≥ 32px) */
.tl-meta .tl-map { display: inline-flex; align-items: center; min-height: 32px; padding: 4px 12px; }
.tl-meta .tl-map::after { content: '↗'; margin-left: 4px; }
.day-route { padding: 8px 12px; }
.copy { min-height: 32px; padding: 6px 11px; }
.timeline li > .ed-btn, .budget-row .ed-btn, .m-who .ed-btn, .pay-who .ed-btn, .exp-body .ed-btn { width: 32px; height: 32px; font-size: 14px; }
/* Thẻ có nút ✏️ ở góc: chừa chỗ để tiêu đề không chạy dưới nút */
.guide:has(> .ed-btn) h3 { padding-right: 36px; }
/* Đầu khung chat trên điện thoại: bỏ avatar, tên chuyến tối đa 2 dòng, ẩn dòng gợi ý */
@media (max-width: 480px) {
  .chat-head .faces { display: none; }
  .chat-title b { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 16px; }
  .chat-hint { display: none; }
}
/* Chat ở chế độ admin: nút ✏️ nằm trong bảng cảm xúc (chạm vào tin), không rải dưới mọi tin */
.rx-picker .ed-btn { float: none; width: 36px; height: 36px; margin: 0 0 0 4px; box-shadow: none; background: var(--surface-2); font-size: 15px; }
/* Thiết bị đang ở chế độ admin: chấm xanh trên icon ⚙️ Quản lý (mỗi máy phải đăng nhập riêng) */
body.is-admin .bottom-nav [data-nav="admin"] .nav-ico::after {
  content: ''; position: absolute; top: 1px; right: 5px; width: 10px; height: 10px; border-radius: 50%;
  background: #22c55e; box-shadow: 0 0 0 2px var(--surface); }

/* ============ Trò chuyện: trả lời (trích dẫn) ============ */
.rx-picker { flex-wrap: wrap; border-radius: 18px; }
.rx-actions { flex-basis: 100%; display: flex; align-items: center; gap: 6px; margin-top: 2px; padding-top: 4px;
              border-top: 1px solid var(--line); }
.rx-reply { flex: 1; min-height: 36px; border: 0; border-radius: 12px; background: var(--surface-2); color: var(--text);
            font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.rx-actions .ed-btn { margin: 0; }
/* .rx-picker button (cỡ emoji 22px) không áp vào nút Trả lời */
.rx-picker .rx-reply { width: auto; height: auto; min-height: 36px; font-size: 14px; border-radius: 12px; transition: none; background: var(--surface-2); }
.rx-picker .rx-reply:hover { transform: none; background: var(--line); }
/* Khung trích dẫn phía trên bong bóng */
.quote { display: grid; gap: 1px; max-width: 100%; text-align: left; margin: 2px 0 -6px; padding: 6px 12px 12px;
         border: 0; border-left: 3px solid var(--coral); border-radius: 12px 12px 4px 4px; cursor: pointer;
         background: color-mix(in srgb, var(--surface) 55%, var(--line)); color: var(--muted); font: inherit; font-size: 13px; }
.quote b { color: var(--text); font-size: 12.5px; }
.quote span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.msg.me .quote { border-left: 0; border-right: 3px solid var(--coral); text-align: right; }
/* Thanh "đang trả lời" trên ô nhắn */
.reply-bar { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border-left: 3px solid var(--coral);
             background: var(--surface-2); border-radius: 12px; }
.reply-text { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); }
.reply-text b { color: var(--text); }
.reply-text span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-x { flex: none; width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--surface); cursor: pointer; color: var(--text); }
/* Bấm trích dẫn -> tin gốc sáng lên */
.msg.flash .bubble { animation: msg-flash 1.4s ease-out; }
@keyframes msg-flash { 0%, 30% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--coral) 55%, transparent); } }

/* Trích dẫn kiểu Zalo: nằm trong bong bóng, vạch màu bên trái, tên đậm, nội dung 1 dòng */
.bubble .quote { display: grid; gap: 0; max-width: 100%; min-width: 0; margin: 2px 0 6px; padding: 1px 0 1px 10px;
                 border: 0; border-left: 3px solid var(--coral); border-radius: 0; background: none; text-align: left;
                 color: var(--muted); font-size: 14px; cursor: pointer; }
.bubble .quote b { color: var(--text); font-size: 14.5px; font-weight: 700; }
.bubble .quote span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; -webkit-line-clamp: unset; }
.msg.me .bubble .quote { border: 0; border-left: 3px solid rgba(255, 255, 255, .85); text-align: left; color: rgba(255, 255, 255, .85); }
.msg.me .bubble .quote b { color: #fff; }

/* ============ Trò chuyện: gửi ảnh ============ */
.chat-img { display: block; width: auto; max-width: min(240px, 100%); max-height: 300px; margin: 3px 0; border-radius: 12px;
            object-fit: cover; cursor: zoom-in; background: var(--surface-2);
            -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.bubble[data-only-img] { padding: 4px; background: none; box-shadow: none; }
.bubble[data-only-img] .chat-img { margin: 0; border-radius: 16px; box-shadow: var(--shadow-sm); }
.msg.me .bubble[data-only-img] { background: none; }
.bubble[data-only-img] .quote { margin: 2px 6px 6px; }
.msg.me .bubble[data-only-img] .quote { color: var(--muted); border-left-color: var(--coral); }
.msg.me .bubble[data-only-img] .quote b { color: var(--text); }
.photo-bar img { width: 44px; height: 44px; flex: none; object-fit: cover; border-radius: 8px; }
.photo-bar span { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); }
@media (max-width: 420px) {
  .composer-row { gap: 6px; }
  .composer-row .emoji-btn { width: 40px; height: 40px; font-size: 20px; }
}
