/* AiiCafe tích điểm — token màu & thành phần dùng chung */
:root {
  --bg: #f4f3f1;
  --surface: #ffffff;
  --surface-2: #efedea;
  --ink: #16120f;          /* chữ chính + nút chính (màu mực) */
  --ink-2: #4a433d;        /* chữ phụ */
  --ink-3: #6f665e;        /* chú thích (≥4.5:1 trên nền) */
  --line: #e2dfda;
  --espresso: #2a1a12;     /* thẻ thành viên */
  --espresso-2: #4a2c1c;
  --caramel: #b8692e;      /* điểm nhấn cà phê */
  --caramel-ink: #8a4a1a;  /* chữ caramel trên nền sáng (≥4.5:1) */
  --gold: #e7b75a;         /* chỉ dùng cho điểm */
  --ok: #17734d;
  --ok-bg: #e5f3ec;
  --warn: #8a5a00;
  --warn-bg: #fdf3dc;
  --err: #b42318;
  --err-bg: #fdecea;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(22, 18, 15, .06), 0 6px 20px rgba(22, 18, 15, .06);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  font-feature-settings: "tnum" 1;
}
button, input, select, textarea { font: inherit; color: inherit; }
.app { max-width: 480px; margin: 0 auto; min-height: 100dvh; padding: 0 16px 32px; position: relative; }
.hidden { display: none !important; }

/* thanh đầu */
.topbar { display: flex; align-items: center; gap: 8px; height: 56px; }
.topbar h1 { font-size: 17px; font-weight: 700; margin: 0; flex: 1; text-align: center; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; }
.icon-btn:active { background: var(--surface-2); }
.icon-btn svg { width: 22px; height: 22px; }
.spacer { width: 44px; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; background: var(--espresso); display: grid; place-items: center; color: var(--gold); font-weight: 800; font-size: 15px; letter-spacing: -.5px; }
.brand-name { font-weight: 800; font-size: 20px; letter-spacing: -.4px; }
.brand-name span { color: var(--caramel); }

/* chữ */
.h-xl { font-size: 28px; line-height: 1.15; font-weight: 800; letter-spacing: -.6px; margin: 8px 0 6px; }
.h-lg { font-size: 22px; line-height: 1.2; font-weight: 750; letter-spacing: -.3px; margin: 4px 0 6px; }
.muted { color: var(--ink-3); font-size: 14px; }
.sub { color: var(--ink-2); font-size: 15px; }
.center { text-align: center; }

/* nút */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 52px; padding: 0 20px; border-radius: 14px; border: 0; background: var(--ink); color: #fff; font-weight: 650; font-size: 16px; cursor: pointer; white-space: nowrap; transition: transform .08s ease, opacity .15s; }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.secondary { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.ghost { background: transparent; color: var(--ink); min-height: 44px; }
.btn.caramel { background: var(--caramel-ink); }
.btn.ok { background: var(--ok); }
.btn.sm { min-height: 40px; width: auto; font-size: 14px; padding: 0 14px; border-radius: 11px; }
.btn .spin { width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.btn.secondary .spin { border-color: rgba(0,0,0,.15); border-top-color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }
.stack { display: grid; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; }

/* thẻ */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.input { width: 100%; height: 52px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); padding: 0 16px; font-size: 17px; outline: none; }
.input:focus { border-color: var(--ink); }
.input.big { height: 64px; font-size: 28px; font-weight: 750; letter-spacing: -.5px; }

/* thông báo trong dòng */
.note { border-radius: 14px; padding: 12px 14px; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; }
.note.err { background: var(--err-bg); color: var(--err); }
.note.ok { background: var(--ok-bg); color: var(--ok); }
.note.warn { background: var(--warn-bg); color: var(--warn); }
.note.info { background: var(--surface-2); color: var(--ink-2); }
.note b { color: inherit; }

/* PIN */
.pin-dots { display: flex; justify-content: center; gap: 10px; margin: 18px 0 8px; }
.pin-dot { width: 44px; height: 52px; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); display: grid; place-items: center; }
.pin-dot.on::after { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--ink); }
.pin-dot.cur { box-shadow: inset 0 0 0 2px var(--ink); }
.pin-dots.shake { animation: shake .35s; }
@keyframes shake { 20%,60% { transform: translateX(-8px); } 40%,80% { transform: translateX(8px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.key { height: 60px; border-radius: 16px; border: 0; background: var(--surface); box-shadow: var(--shadow); font-size: 24px; font-weight: 650; cursor: pointer; user-select: none; display: grid; place-items: center; }
.key:active { background: var(--surface-2); transform: scale(.97); }
.key.fn { background: transparent; box-shadow: none; font-size: 15px; color: var(--ink-2); }
.key svg { width: 24px; height: 24px; }

/* bảng tin nhỏ */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-size: 15px; z-index: 50; max-width: calc(100% - 32px); box-shadow: 0 10px 30px rgba(0,0,0,.25); animation: up .2s ease; }
.toast.err { background: var(--err); }
@keyframes up { from { opacity: 0; transform: translate(-50%, 8px); } }

.offline { position: sticky; top: 0; z-index: 40; background: var(--warn-bg); color: var(--warn); font-size: 14px; padding: 8px 16px; text-align: center; margin: 0 -16px; }

/* danh sách */
.list { display: grid; }
.li { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.li:last-child { border-bottom: 0; }
.li .grow { flex: 1; min-width: 0; }
.li .t { font-weight: 600; font-size: 15px; }
.li .d { color: var(--ink-3); font-size: 13px; }
.amt { font-weight: 750; font-size: 16px; white-space: nowrap; }
.amt.plus { color: var(--ok); }
.amt.minus { color: var(--ink); }
.empty { text-align: center; padding: 32px 12px; color: var(--ink-3); }
.empty .big { font-size: 17px; font-weight: 650; color: var(--ink); margin-bottom: 6px; }

.badge { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 99px; font-size: 13px; font-weight: 650; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge.sv { background: #e8eefc; color: #2446a6; }
.badge.bronze { background: #f3e2d3; color: #7a4318; }
.badge.silver { background: #e7e9ee; color: #3d4450; }
.badge.gold { background: #fbefcf; color: #7a5600; }

.skeleton { background: linear-gradient(90deg, var(--surface-2), #f8f7f5, var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 10px; }
@keyframes sk { to { background-position: -200% 0; } }

svg.i { width: 22px; height: 22px; fill: currentColor; flex: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
.grow { flex: 1; }
