/* =====================================================================
   KAIROS – giao diện chung
   Màu thương hiệu: #F4FFFC nền · #91EAAF bạc hà · #C3E956 chanh · #4D7111 rêu · #1F4B2C đậm
   Chữ giao diện: Be Vietnam Pro (đủ dấu tiếng Việt). Chữ "kairos": Poppins ExtraBold.
   ===================================================================== */

@font-face { font-family: "Be Vietnam Pro"; font-weight: 400; font-display: swap; src: url("/fonts/be-vietnam-pro-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 400; font-display: swap; src: url("/fonts/be-vietnam-pro-vietnamese-400-normal.woff2") format("woff2"); unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 500; font-display: swap; src: url("/fonts/be-vietnam-pro-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 500; font-display: swap; src: url("/fonts/be-vietnam-pro-vietnamese-500-normal.woff2") format("woff2"); unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 700; font-display: swap; src: url("/fonts/be-vietnam-pro-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 700; font-display: swap; src: url("/fonts/be-vietnam-pro-vietnamese-700-normal.woff2") format("woff2"); unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 800; font-display: swap; src: url("/fonts/be-vietnam-pro-latin-800-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 800; font-display: swap; src: url("/fonts/be-vietnam-pro-vietnamese-800-normal.woff2") format("woff2"); unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }
@font-face { font-family: "Poppins"; font-weight: 800; font-display: swap; src: url("/fonts/poppins-latin-800-normal.woff2") format("woff2"); }

:root {
  --bg: #F4FFFC;
  --mint: #91EAAF;
  --lime: #C3E956;
  --moss: #4D7111;
  --deep: #1F4B2C;

  --ink: #1F4B2C;                       /* chữ chính: 9.9:1 trên nền sáng */
  --ink-soft: #3F6248;                  /* chữ phụ: 6.6:1 */
  --card: #FFFFFF;
  --tint: #E6F7EE;                      /* nền nhạt cho hình minh họa */
  --line: rgba(31, 75, 44, 0.14);
  --danger: #A3261D;
  --danger-bg: #FDECEA;

  --r-s: 12px;
  --r-m: 18px;
  --r-l: 28px;
  --shadow: 0 10px 34px rgba(31, 75, 44, 0.12);

  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-brand: "Poppins", "Be Vietnam Pro", system-ui, sans-serif;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 26px; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 20px; line-height: 1.25; font-weight: 700; }
h3 { font-size: 17px; line-height: 1.3; font-weight: 700; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--moss); }
[hidden] { display: none !important; }
svg { display: block; }

:focus-visible { outline: 3px solid var(--moss); outline-offset: 2px; border-radius: 8px; }
.on-deep :focus-visible { outline-color: var(--lime); }

.muted { color: var(--ink-soft); }
.small { font-size: 14px; }
.center { text-align: center; }
.stack > * + * { margin-top: 12px; }
.stack-l > * + * { margin-top: 20px; }

/* ---------- Nút ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 52px; padding: 12px 20px;
  border: 0; border-radius: 16px;
  background: var(--deep); color: #fff;
  font-weight: 700; font-size: 16px; text-decoration: none;
  transition: transform 0.08s ease, background-color 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.6; cursor: default; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn.is-secondary { background: transparent; color: var(--moss); box-shadow: inset 0 0 0 2px var(--moss); }
.btn.is-lime { background: var(--lime); color: var(--deep); }
.btn.is-small { width: auto; min-height: 44px; padding: 8px 16px; border-radius: 14px; font-size: 15px; }
.link-btn {
  background: none; border: 0; padding: 12px 8px; min-height: 44px;
  color: var(--moss); font-weight: 500; text-decoration: underline; text-underline-offset: 3px;
}

/* ---------- Ô nhập ---------- */
.field { display: block; }
.field > span { display: block; font-weight: 500; font-size: 14px; margin-bottom: 6px; }
.field input {
  width: 100%; min-height: 52px; padding: 12px 14px;
  border: 1.5px solid rgba(31, 75, 44, 0.35); border-radius: 14px;
  background: #fff; font-size: 16px;            /* 16px để iPhone không tự phóng to */
}
.field input::placeholder { color: #56705E; }
.field input:focus { outline: 3px solid var(--mint); outline-offset: 0; border-color: var(--deep); }
#invite { text-transform: uppercase; }
#invite::placeholder { text-transform: none; }
.field .hint { margin-top: 6px; font-size: 13px; color: var(--ink-soft); }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 64px; }
.pw-toggle {
  position: absolute; right: 4px; top: 4px; height: 44px; min-width: 56px;
  background: none; border: 0; color: var(--moss); font-weight: 500; font-size: 14px;
}
.alert {
  padding: 12px 14px; border-radius: 14px; font-size: 15px;
  background: var(--danger-bg); color: var(--danger);
}
.alert.is-info { background: var(--tint); color: var(--ink); }

/* ---------- Màn chào (cài đặt / đăng nhập): mảng xanh đậm + thẻ kính mờ ---------- */
.gate { min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  background: var(--deep); color: #fff;
  padding: calc(var(--safe-t) + 28px) 24px 64px;
}
.hero::before, .hero::after { content: ""; position: absolute; z-index: -1; border-radius: 50%; filter: blur(46px); }
.hero::before { width: 260px; height: 260px; right: -150px; top: -130px; background: #7DB83A; opacity: 0.5; }
.hero::after { width: 240px; height: 240px; left: -80px; bottom: -140px; background: var(--mint); opacity: 0.35; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-tile {
  width: 56px; height: 56px; flex: none; border-radius: 16px; background: var(--bg);
  display: grid; place-items: center; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}
.brand-tile img { width: 40px; height: 40px; }
.brand-name { font-family: var(--font-brand); font-weight: 800; font-size: 32px; line-height: 1; letter-spacing: -0.01em; }
.brand-slogan { margin-top: 6px; font-weight: 500; font-size: 13px; letter-spacing: 0.08em; color: #F4FFFC; }

.gate-body { flex: 1; width: 100%; max-width: 520px; margin: -36px auto 0; padding: 0 16px calc(var(--safe-b) + 24px); position: relative; z-index: 1; }
.glass {
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: blur(18px) saturate(1.2); backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--r-l);
  box-shadow: var(--shadow);
  padding: 24px 20px;
}
.gate-foot { margin-top: 8px; text-align: center; }

/* ---------- Các bước cài đặt (là một trình tự thật nên có đánh số) ---------- */
.steps { list-style: none; margin: 18px 0 0; padding: 0; }
.step { display: grid; grid-template-columns: 104px 1fr; gap: 14px; align-items: center; padding: 14px 0; }
.step + .step { border-top: 1px solid var(--line); }
.step-art { width: 104px; height: 104px; border-radius: 20px; background: var(--tint); overflow: hidden; }
.step-art svg { width: 100%; height: 100%; }
.step-num {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--lime); color: var(--deep); font-weight: 700; font-size: 14px; margin-bottom: 6px;
}
.step-text strong { font-weight: 700; }
.step-text p { font-size: 15px; }

.copy-box {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 14px;
  background: var(--tint); font-size: 14px; word-break: break-all; user-select: all; -webkit-user-select: all;
}

/* ---------- Chuyển Tạo tài khoản / Đăng nhập ---------- */
.seg { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 16px; background: var(--tint); }
.seg button {
  min-height: 44px; border: 0; border-radius: 12px; background: transparent;
  font-weight: 500; color: var(--ink-soft);
}
.seg button[aria-selected="true"] { background: #fff; color: var(--deep); font-weight: 700; box-shadow: 0 1px 4px rgba(31, 75, 44, 0.16); }

/* ---------- Khung app sau khi đăng nhập ---------- */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: calc(var(--safe-t) + 10px) 16px 12px;
  background: var(--deep); color: #fff;
}
.topbar-tile { width: 36px; height: 36px; border-radius: 11px; background: var(--bg); display: grid; place-items: center; flex: none; }
.topbar-tile img { width: 26px; height: 26px; }
.topbar-title { flex: 1; min-width: 0; }
.topbar-title b { display: block; font-size: 17px; line-height: 1.2; }
.topbar-title span { display: block; font-size: 13px; color: #DDF5E4; }
.icon-btn {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.14); color: #fff;
}
.icon-btn svg { width: 22px; height: 22px; }

.main { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 18px 16px calc(var(--safe-b) + 96px); }
.main > * + * { margin-top: 16px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-m); padding: 18px 16px; }
.card.is-key { background: var(--lime); border-color: transparent; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px 8px calc(var(--safe-b) + 6px);
  background: rgba(244, 255, 252, 0.84);
  -webkit-backdrop-filter: blur(16px) saturate(1.3); backdrop-filter: blur(16px) saturate(1.3);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 56px; border: 0; background: none; text-decoration: none;
  font-size: 12px; font-weight: 500; color: var(--ink-soft);
}
.tab-ico { display: grid; place-items: center; width: 56px; height: 30px; border-radius: 15px; }
.tab-ico svg { width: 22px; height: 22px; }
.tab[aria-current="page"] { color: var(--deep); font-weight: 700; }
.tab[aria-current="page"] .tab-ico { background: var(--lime); }

/* ---------- Trạng thái trống ---------- */
.empty { text-align: center; padding: 28px 16px; }
.empty-art { width: 120px; height: 120px; margin: 0 auto 12px; }
.empty p { color: var(--ink-soft); max-width: 34ch; margin: 8px auto 16px; }

/* ---------- Danh sách kiểm tra ---------- */
.checks { list-style: none; margin: 14px 0 0; padding: 0; }
.check { display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding: 12px 0; align-items: start; }
.check + .check { border-top: 1px solid var(--line); }
.check-dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--tint); color: var(--ink-soft); }
.check-dot svg { width: 16px; height: 16px; }
.check[data-state="ok"] .check-dot { background: var(--mint); color: var(--deep); }
.check[data-state="bad"] .check-dot { background: var(--danger-bg); color: var(--danger); }
.check b { display: block; font-weight: 700; }
.check span { display: block; font-size: 14px; color: var(--ink-soft); overflow-wrap: anywhere; }
.check .btn { margin-top: 10px; }

.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; font-size: 15px; }
.rows li + li { border-top: 1px solid var(--line); }
.rows li span:last-child { color: var(--ink-soft); text-align: right; overflow-wrap: anywhere; }

/* ---------- Thông báo nhỏ + thanh cập nhật ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-b) + 92px); transform: translate(-50%, 12px);
  z-index: 20; max-width: min(92vw, 440px); padding: 12px 16px; border-radius: 14px;
  background: var(--deep); color: #fff; font-size: 15px; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease, transform 0.2s ease;
}
#toast.is-on { opacity: 1; transform: translate(-50%, 0); }

#update-bar {
  position: fixed; left: 12px; right: 12px; top: calc(var(--safe-t) + 10px); z-index: 30;
  max-width: 536px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px;
  border-radius: 18px; background: var(--lime); color: var(--deep); box-shadow: var(--shadow);
  font-weight: 500;
}
#update-bar span { flex: 1; }

/* ---------- Màn chờ lúc mở app ---------- */
.splash { min-height: 100dvh; display: grid; place-items: center; background: var(--deep); }
.splash-tile { width: 96px; height: 96px; border-radius: 26px; background: var(--bg); display: grid; place-items: center; }
.splash-tile img { width: 68px; height: 68px; }

@media (min-width: 720px) {
  .hero { padding-bottom: 84px; }
  .hero .brand { max-width: 488px; margin: 0 auto; }
  .tabbar { left: 50%; right: auto; width: 560px; transform: translateX(-50%); border: 1px solid var(--line); border-bottom: 0; border-radius: 22px 22px 0 0; }
}

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

@media print {
  .tabbar, #toast, #update-bar, .no-print { display: none !important; }
  .hero { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
