:root {
  --bg: #faf8f5;
  --card: #ffffff;
  --ink: #222222;
  --txt: #555555;
  --soft: #8a8580;
  --line: #e9e5df;
  --wine: #7d2e42;
  --wine-soft: #f6e9ec;
  --ok: #2f7a55;
  --ok-soft: #e6f2ec;
  --warn: #a5671a;
  --warn-soft: #fbf0e0;
  --r: 16px;
  --serif: 'Playfair Display', Georgia, serif;
  --sans: 'Be Vietnam Pro', -apple-system, system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--sans); }
body { min-height: 100vh; }
a { color: var(--wine); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
.hide { display: none !important; }

/* Splash */
.splash { min-height: 100vh; display: grid; place-content: center; gap: 22px; justify-items: center; }
.logo { font-family: var(--serif); letter-spacing: .32em; font-size: 26px; color: var(--wine); padding-left: .32em; }
.spin { width: 22px; height: 22px; border: 2px solid var(--line); border-top-color: var(--wine); border-radius: 50%; animation: sp 0.9s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

/* Đăng nhập */
.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 40px 24px calc(40px + var(--safe-b)); max-width: 440px; margin: 0 auto; }
.login .logo { text-align: center; margin-bottom: 6px; }
.login .sub { text-align: center; font-size: 11px; letter-spacing: .3em; color: var(--soft); text-transform: uppercase; margin-bottom: 40px; }
.login h1 { font-family: var(--serif); font-weight: 500; font-size: 28px; line-height: 1.25; text-align: center; margin: 0 0 10px; }
.login p.lead { text-align: center; color: var(--txt); margin: 0 0 28px; }
label.f { display: block; font-size: 13px; color: var(--txt); margin: 0 0 6px; }
.in { width: 100%; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-size: 17px; outline: none; }
.in:focus { border-color: var(--wine); box-shadow: 0 0 0 3px var(--wine-soft); }
textarea.in { font-size: 15px; min-height: 96px; resize: vertical; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 14px 18px; border: 0; border-radius: 12px; background: var(--wine); color: #fff; font-weight: 500; font-size: 16px; cursor: pointer; text-decoration: none; }
.btn:disabled { opacity: .55; }
.btn.ghost { background: transparent; color: var(--wine); border: 1px solid var(--wine); }
.btn.light { background: var(--wine-soft); color: var(--wine); }
.btn.sm { width: auto; padding: 9px 14px; font-size: 14px; border-radius: 10px; }
.mt { margin-top: 14px; }
.err { color: #b3261e; font-size: 14px; margin-top: 10px; min-height: 1.2em; }
.note { color: var(--soft); font-size: 13px; text-align: center; margin-top: 18px; }
.linkbtn { background: none; border: 0; color: var(--wine); text-decoration: underline; cursor: pointer; padding: 0; font-size: 14px; }

/* Khung chính */
.top { background: var(--wine); color: #fff; padding: calc(18px + env(safe-area-inset-top, 0px)) 20px 26px; border-radius: 0 0 26px 26px; position: relative; overflow: hidden; }
.top::after { content: ''; position: absolute; right: -60px; top: -40px; width: 220px; height: 220px; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; }
.top .brand { font-family: var(--serif); letter-spacing: .3em; font-size: 13px; opacity: .85; }
.top .hi { font-size: 12px; letter-spacing: .18em; text-transform: uppercase; opacity: .75; margin-top: 18px; }
.top h1 { font-family: var(--serif); font-weight: 500; font-size: 24px; line-height: 1.3; margin: 4px 0 0; }
.top .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.chip { display: inline-block; font-size: 12px; padding: 4px 10px; border-radius: 99px; background: rgba(255,255,255,.16); }
.count { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.count .n { font-family: var(--serif); font-size: 44px; line-height: 1; }
.count .l { font-size: 13px; opacity: .9; line-height: 1.35; }

main { padding: 16px 16px calc(96px + var(--safe-b)); max-width: 640px; margin: 0 auto; }
.card { background: var(--card); border-radius: var(--r); padding: 18px; margin-bottom: 14px; box-shadow: 0 1px 2px rgba(0,0,0,.04); border: 1px solid #f0ece6; }
.card h2 { font-family: var(--serif); font-weight: 500; font-size: 19px; margin: 0 0 12px; }
.card h3 { font-size: 14px; font-weight: 600; margin: 16px 0 8px; }
.muted { color: var(--soft); }
.small { font-size: 13px; }
.alert { border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; background: var(--warn-soft); color: #6b4310; font-size: 14px; }
.alert b { color: #4d2f08; }
.alert.wine { background: var(--wine-soft); color: var(--wine); }

/* Hành trình */
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { position: relative; padding: 0 0 18px 34px; }
.steps li::before { content: ''; position: absolute; left: 10px; top: 22px; bottom: -2px; width: 2px; background: var(--line); }
.steps li:last-child::before { display: none; }
.steps li.done::before { background: var(--wine); }
.dot { position: absolute; left: 0; top: 2px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); background: #fff; display: grid; place-items: center; font-size: 12px; color: #fff; }
.done .dot { background: var(--wine); border-color: var(--wine); }
.cur .dot { border-color: var(--wine); box-shadow: 0 0 0 4px var(--wine-soft); }
.cur .dot::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--wine); }
.steps .t { font-weight: 500; }
.steps .d { font-size: 13px; color: var(--soft); }
.cur .t { color: var(--wine); }
.steps .tag { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 99px; background: var(--wine-soft); color: var(--wine); margin-left: 6px; vertical-align: 1px; }

/* Danh sách */
.row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .v { text-align: right; font-weight: 500; white-space: nowrap; }
.row.big .v { font-size: 18px; color: var(--wine); }
.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 6px 0 4px; }
.bar i { display: block; height: 100%; background: var(--wine); border-radius: 99px; }
.ev { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ev:last-child { border-bottom: 0; }
.ev .date { width: 52px; flex: none; text-align: center; border-radius: 12px; background: var(--wine-soft); color: var(--wine); padding: 6px 0; }
.ev .date b { display: block; font-family: var(--serif); font-size: 22px; line-height: 1.1; font-weight: 500; }
.ev .date span { font-size: 11px; }
.ev.past .date { background: #f2efea; color: var(--soft); }
.ev .t { font-weight: 500; }
.ul { margin: 0; padding-left: 20px; }
.ul li { margin: 4px 0; }

/* Ảnh */
.pp { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 10px 0 6px; }
.pp div { height: 6px; border-radius: 99px; background: var(--line); }
.pp div.on { background: var(--wine); }
.pplab { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; font-size: 11px; color: var(--soft); text-align: center; }
.pplab .on { color: var(--wine); font-weight: 500; }

/* QR */
.qr { text-align: center; }
.qr img { width: 240px; max-width: 80%; margin: 6px auto 10px; border-radius: 12px; border: 1px solid var(--line); }
.copy { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.copy button { flex: none; }

/* Yêu cầu */
.req { padding: 12px 0; border-bottom: 1px solid var(--line); }
.req:last-child { border-bottom: 0; }
.st { font-size: 12px; padding: 2px 9px; border-radius: 99px; display: inline-block; }
.st.cho { background: var(--warn-soft); color: var(--warn); }
.st.dang { background: var(--wine-soft); color: var(--wine); }
.st.xong { background: var(--ok-soft); color: var(--ok); }
.st.tuchoi { background: #f4e4e2; color: #a3352c; }
.reply { margin-top: 8px; padding: 10px 12px; border-radius: 12px; background: var(--bg); font-size: 14px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.seg button { border: 1px solid var(--line); background: #fff; padding: 8px 12px; border-radius: 99px; font-size: 14px; cursor: pointer; }
.seg button.on { border-color: var(--wine); background: var(--wine-soft); color: var(--wine); }

/* Thanh dưới */
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,.96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px 4px calc(6px + var(--safe-b)); z-index: 10; }
nav.tabs button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; font-size: 11px; color: var(--soft); cursor: pointer; position: relative; }
nav.tabs button svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.6; }
nav.tabs button.on { color: var(--wine); }
nav.tabs .badge { position: absolute; top: 2px; right: calc(50% - 18px); min-width: 16px; height: 16px; border-radius: 8px; background: var(--wine); color: #fff; font-size: 10px; line-height: 16px; padding: 0 4px; }

.toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%); background: #222; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 30; max-width: 90vw; text-align: center; }
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; display: flex; align-items: flex-end; }
.sheet { background: #fff; width: 100%; max-width: 640px; margin: 0 auto; border-radius: 22px 22px 0 0; padding: 22px 20px calc(22px + var(--safe-b)); max-height: 88vh; overflow: auto; }
.sheet h2 { font-family: var(--serif); font-weight: 500; font-size: 20px; margin: 0 0 12px; }
.foot { text-align: center; color: var(--soft); font-size: 12px; margin: 8px 0 0; }
