/* =========================================================
   LifeGood – hệ thiết kế "kính lỏng" (liquid glass)
   Nền là các quầng màu xanh trôi chậm; mọi bề mặt là kính mờ trong suốt
   có viền bắt sáng, bóng nhiều lớp để tạo chiều sâu. Thanh trên/dưới nổi
   trên nội dung nên nội dung cuộn xuyên qua kính.
   Tắt hết hiệu ứng khi máy bật "giảm chuyển động".
   ========================================================= */

:root {
  --bg: #eaf2ec;
  --text: #0f1d16;
  --muted: #5d6f65;
  --brand: #15803d;
  --brand-2: #22c55e;
  --brand-soft: rgba(34, 197, 94, .14);
  --border: rgba(15, 40, 25, .08);
  --border-strong: rgba(15, 40, 25, .16);

  /* Quầng màu nền */
  --orb-1: rgba(16, 185, 129, .62);
  --orb-2: rgba(56, 189, 248, .5);
  --orb-3: rgba(132, 204, 22, .45);
  --orb-4: rgba(20, 184, 166, .55);

  /* Chất liệu kính */
  --glass-bg: rgba(255, 255, 255, .4);
  --glass-strong: rgba(255, 255, 255, .74);
  --glass-sheen: rgba(255, 255, 255, .75);
  --glass-rim: rgba(255, 255, 255, 1);
  --glass-rim-2: rgba(255, 255, 255, .35);
  /* Mép trên sáng + đáy hơi tối bên trong = cảm giác tấm kính có độ dày */
  --glass-inner: inset 0 1.5px 0 rgba(255, 255, 255, .95), inset 0 -12px 22px -14px rgba(10, 50, 30, .18), inset 0 0 28px rgba(255, 255, 255, .22);
  --glass-shadow: 0 2px 4px rgba(10, 40, 25, .06), 0 16px 34px -8px rgba(10, 40, 25, .24), 0 42px 80px -24px rgba(10, 40, 25, .3);
  --blur: blur(26px) saturate(185%);
  --tile: rgba(255, 255, 255, .45);
  --tile-border: rgba(255, 255, 255, .7);
  --field: rgba(255, 255, 255, .6);
  --lens: rgba(255, 255, 255, .78);
  --bar-bg: rgba(255, 255, 255, .66);
  --scrim: rgba(234, 242, 236, .55);

  /* Nút "thạch" xanh */
  --jelly: linear-gradient(180deg, rgba(255, 255, 255, .38), rgba(255, 255, 255, 0) 55%), linear-gradient(135deg, var(--brand-2), var(--brand));
  --jelly-shadow: inset 0 1.5px 0 rgba(255, 255, 255, .6), inset 0 -4px 10px rgba(0, 40, 15, .22), 0 4px 8px -2px rgba(21, 128, 61, .35), 0 14px 28px -8px rgba(21, 128, 61, .6);

  --status-ok: #16a34a;
  --status-warn: #d97706;
  --status-over: #dc2626;
  --radius-sm: 12px;
  --radius: 20px;
  --radius-lg: 26px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.4, .5, 1);
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Khoảng chừa cho thanh trên / thanh tab nổi */
  --top-h: calc(env(safe-area-inset-top) + 84px);
  --bottom-h: calc(env(safe-area-inset-bottom) + 90px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #050907;
    --text: #e9f1ec;
    --muted: #93a49a;
    --brand: #34d27a;
    --brand-2: #4ade80;
    --brand-soft: rgba(52, 210, 122, .14);
    --border: rgba(255, 255, 255, .08);
    --border-strong: rgba(255, 255, 255, .14);
    --orb-1: rgba(16, 185, 129, .5);
    --orb-2: rgba(14, 165, 233, .32);
    --orb-3: rgba(101, 163, 13, .26);
    --orb-4: rgba(20, 184, 166, .4);
    --glass-bg: rgba(255, 255, 255, .07);
    --glass-strong: rgba(24, 32, 28, .78);
    --glass-sheen: rgba(255, 255, 255, .09);
    --glass-rim: rgba(255, 255, 255, .5);
    --glass-rim-2: rgba(255, 255, 255, .06);
    --glass-inner: inset 0 1.5px 0 rgba(255, 255, 255, .2), inset 0 -14px 24px -14px rgba(0, 0, 0, .5), inset 0 0 28px rgba(255, 255, 255, .04);
    --glass-shadow: 0 2px 4px rgba(0, 0, 0, .4), 0 18px 38px -8px rgba(0, 0, 0, .75), 0 44px 84px -24px rgba(0, 0, 0, .7);
    --tile: rgba(255, 255, 255, .05);
    --tile-border: rgba(255, 255, 255, .08);
    --field: rgba(255, 255, 255, .06);
    --lens: rgba(255, 255, 255, .14);
    --bar-bg: rgba(16, 24, 20, .74);
    --scrim: rgba(5, 9, 7, .5);
    --jelly-shadow: inset 0 1.5px 0 rgba(255, 255, 255, .45), inset 0 -4px 10px rgba(0, 0, 0, .28), 0 4px 8px -2px rgba(0, 0, 0, .5), 0 14px 30px -8px rgba(34, 197, 94, .5);
    --status-ok: #34d27a;
    --status-warn: #f59e0b;
    --status-over: #f87171;
  }
}
:root[data-theme="dark"] {
  --bg: #050907; --text: #e9f1ec; --muted: #93a49a; --brand: #34d27a; --brand-2: #4ade80; --brand-soft: rgba(52, 210, 122, .14);
  --border: rgba(255, 255, 255, .08); --border-strong: rgba(255, 255, 255, .14);
  --orb-1: rgba(16, 185, 129, .5); --orb-2: rgba(14, 165, 233, .32); --orb-3: rgba(101, 163, 13, .26); --orb-4: rgba(20, 184, 166, .4);
  --glass-bg: rgba(255, 255, 255, .07); --glass-strong: rgba(24, 32, 28, .78); --glass-sheen: rgba(255, 255, 255, .09);
  --glass-rim: rgba(255, 255, 255, .5); --glass-rim-2: rgba(255, 255, 255, .06);
  --glass-inner: inset 0 1.5px 0 rgba(255, 255, 255, .2), inset 0 -14px 24px -14px rgba(0, 0, 0, .5), inset 0 0 28px rgba(255, 255, 255, .04);
  --glass-shadow: 0 2px 4px rgba(0, 0, 0, .4), 0 18px 38px -8px rgba(0, 0, 0, .75), 0 44px 84px -24px rgba(0, 0, 0, .7);
  --tile: rgba(255, 255, 255, .05); --tile-border: rgba(255, 255, 255, .08); --field: rgba(255, 255, 255, .06);
  --lens: rgba(255, 255, 255, .14); --bar-bg: rgba(16, 24, 20, .74); --scrim: rgba(5, 9, 7, .5);
  --jelly-shadow: inset 0 1.5px 0 rgba(255, 255, 255, .45), inset 0 -4px 10px rgba(0, 0, 0, .28), 0 4px 8px -2px rgba(0, 0, 0, .5), 0 14px 30px -8px rgba(34, 197, 94, .5);
  --status-ok: #34d27a; --status-warn: #f59e0b; --status-over: #f87171;
}

/* ---------- Nền tảng ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
html { background: var(--bg); }
body {
  background: transparent; /* để lộ các quầng màu nền vẽ ở body::before */
  color: var(--text);
  font: 16px/1.55 var(--font);
  letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
/* Các quầng màu trôi chậm phía sau lớp kính */
body::before, body::after {
  content: ""; position: fixed; z-index: -1; pointer-events: none;
}
body::before {
  inset: -25%;
  background:
    radial-gradient(32% 26% at 22% 24%, var(--orb-1), transparent 70%),
    radial-gradient(28% 24% at 82% 18%, var(--orb-2), transparent 70%),
    radial-gradient(34% 28% at 78% 72%, var(--orb-3), transparent 70%),
    radial-gradient(30% 26% at 24% 80%, var(--orb-4), transparent 70%);
  animation: drift 28s ease-in-out infinite alternate;
  /* Thị sai: nền trôi chậm hơn nội dung khi cuộn (app.js đặt --par) */
  translate: 0 calc(var(--par, 0) * -0.12px);
}
body::after {
  inset: -10%;
  background:
    radial-gradient(22% 18% at 60% 42%, var(--orb-4), transparent 70%),
    radial-gradient(20% 16% at 35% 55%, var(--orb-2), transparent 70%);
  opacity: .7;
  animation: drift2 36s ease-in-out infinite alternate;
  translate: 0 calc(var(--par, 0) * -0.22px);
}
button, textarea, input, select { font: inherit; color: inherit; }
button { -webkit-user-select: none; user-select: none; }
a { color: var(--brand); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { margin: 0; color: var(--muted); font-size: 14px; }
.tip { margin: 0 4px; font-size: 13px; color: var(--muted); }

/* ---------- Chất liệu kính dùng chung ---------- */
.card, .chip, .msg.ai, .composer, .tabbar, .topbar, .seg, .modal-box, .attach-preview {
  position: relative;
  background: radial-gradient(140% 70% at 50% -12%, var(--glass-sheen), transparent 58%), var(--glass-bg);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 0;
  box-shadow: var(--glass-inner), var(--glass-shadow);
}
/* Thanh nổi (trên, tab, soạn tin) đục hơn để chữ phía sau không lẫn vào */
.topbar, .tabbar, .composer {
  background: radial-gradient(140% 70% at 50% -12%, var(--glass-sheen), transparent 58%), var(--bar-bg);
  -webkit-backdrop-filter: blur(30px) saturate(190%); backdrop-filter: blur(30px) saturate(190%);
  /* Nổi cao hơn thẻ: bóng xa và đậm hơn */
  box-shadow: var(--glass-inner), var(--glass-shadow), 0 30px 60px -16px rgba(5, 25, 15, .28);
}
/* Viền bắt sáng: sáng ở góc trên-trái và dưới-phải, mờ dần ở giữa */
.card::before, .chip::before, .msg.ai::before, .composer::before, .tabbar::before, .topbar::before,
.seg::before, .modal-box::before, .attach-preview::before, .tab-indicator::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; pointer-events: none;
  background: linear-gradient(155deg, var(--glass-rim) 0%, var(--glass-rim-2) 28%, transparent 52%, var(--glass-rim-2) 78%, var(--glass-rim) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}

/* Hiệu ứng nhấn chung: lún nhẹ kiểu lò xo */
.chip, .primary-btn, .ghost-btn, .send, .tool-btn, .icon-btn, .tab, .seg-btn, .check, .del, .plan-btn, .link-btn, .sos-row {
  transition: transform .28s var(--spring), background-color .2s var(--ease), color .2s var(--ease), box-shadow .25s var(--ease), opacity .2s;
}
.chip:active, .primary-btn:active, .ghost-btn:active, .send:active, .tool-btn:active, .icon-btn:active, .seg-btn:active, .sos-row:active { transform: scale(.95); }

/* ---------- Màn hình chờ khi mở app ---------- */
.splash {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center;
  -webkit-backdrop-filter: blur(30px); backdrop-filter: blur(30px);
  transition: opacity .45s var(--ease), visibility .45s;
}
.splash.gone { opacity: 0; visibility: hidden; }
.splash img {
  width: 76px; height: 76px; border-radius: 22px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 20px 44px -10px rgba(21, 128, 61, .55);
  animation: breathe 1.6s var(--ease) infinite;
}

/* ---------- Khung app ---------- */
.app {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column;
  height: 100dvh; max-width: 640px; margin: 0 auto;
}
/* Mép trên/dưới mờ dần như iOS khi nội dung cuộn xuyên qua */
.app::before, .app::after {
  content: ""; position: absolute; left: 0; right: 0; z-index: 4; pointer-events: none;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.app::before {
  top: 0; height: calc(var(--top-h) - 6px);
  background: linear-gradient(var(--scrim), transparent);
  -webkit-mask-image: linear-gradient(#000 45%, transparent); mask-image: linear-gradient(#000 45%, transparent);
}
.app::after {
  bottom: 0; height: calc(var(--bottom-h) - 10px);
  background: linear-gradient(transparent, var(--scrim));
  -webkit-mask-image: linear-gradient(transparent, #000 55%); mask-image: linear-gradient(transparent, #000 55%);
}
.topbar {
  position: absolute; z-index: 6;
  top: calc(env(safe-area-inset-top) + 8px); left: 12px; right: 12px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 8px 8px 10px; border-radius: 24px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { border-radius: 12px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 6px 14px -4px rgba(21, 128, 61, .5); }
.brand h1 { font-size: 18px; font-weight: 700; margin: 0; line-height: 1.2; letter-spacing: -.02em; }
.status { margin: 0; font-size: 13px; color: var(--muted); transition: color .2s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); cursor: pointer;
  display: grid; place-items: center;
}
.icon-btn:hover { background: var(--tile); color: var(--brand); }
.topbar .icon-btn { background: var(--tile); box-shadow: inset 0 1px 0 var(--tile-border); }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
/* Chỉ trượt phần cuộn, không trượt cả view (để thanh nổi luôn nằm trên lớp mờ mép màn hình) */
.view > .chat, .view > .scroll { animation: viewIn .4s var(--ease); }

/* ---------- Trò chuyện ---------- */
.chat {
  flex: 1; overflow-y: auto; overscroll-behavior: contain; scroll-behavior: smooth;
  padding: var(--top-h) 16px calc(var(--bottom-h) + var(--dock-h, 66px) + 12px);
  scroll-padding: var(--top-h) 0 calc(var(--bottom-h) + var(--dock-h, 66px) + 12px);
  display: flex; flex-direction: column; gap: 10px;
}
.welcome { text-align: center; margin: auto 0; padding: 12px 0 24px; animation: lift .6s var(--ease) both; }
.hello {
  font-size: 46px; display: inline-grid; place-items: center; width: 88px; height: 88px; border-radius: 30px;
  background: radial-gradient(120% 80% at 50% 0%, var(--glass-sheen), transparent 60%), var(--glass-bg);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  box-shadow: var(--glass-inner), var(--glass-shadow);
  animation: floaty 4s ease-in-out infinite;
}
.welcome h2 { font-size: 24px; font-weight: 700; letter-spacing: -.025em; margin: 16px 0 4px; }
.welcome p { color: var(--muted); margin: 0 0 22px; }
.chips { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chip {
  padding: 15px 14px; border-radius: var(--radius);
  font-size: 15px; font-weight: 500; cursor: pointer; text-align: left;
  animation: rise .55s var(--ease) both;
}
.chip:nth-child(2) { animation-delay: .05s; } .chip:nth-child(3) { animation-delay: .1s; }
.chip:nth-child(4) { animation-delay: .15s; } .chip:nth-child(5) { animation-delay: .2s; } .chip:nth-child(6) { animation-delay: .25s; }
.chip:hover { box-shadow: var(--glass-inner), var(--glass-shadow), 0 0 0 4px var(--brand-soft); }

.msg {
  max-width: 84%; padding: 11px 15px; border-radius: 22px;
  overflow-wrap: anywhere; animation: msgIn .42s var(--spring) both;
}
.msg.me {
  align-self: flex-end; background: var(--jelly); color: #fff;
  border-bottom-right-radius: 8px; white-space: pre-wrap; box-shadow: var(--jelly-shadow);
  transform-origin: bottom right;
}
.msg.ai { align-self: flex-start; border-bottom-left-radius: 8px; transform-origin: bottom left; }
.msg.ai p { margin: 0 0 8px; }
.msg.ai p:last-child, .msg.ai ul:last-child, .msg.ai ol:last-child { margin-bottom: 0; }
.msg.ai ul, .msg.ai ol { margin: 0 0 8px; padding-left: 20px; }
.msg.ai li { margin: 3px 0; }
.msg.ai li::marker { color: var(--brand); }
.msg.ai h3 { font-size: 16px; margin: 4px 0 6px; }
.msg.ai strong { font-weight: 650; }
.msg.error {
  align-self: center; background: var(--tile); color: var(--muted); font-size: 14px; text-align: center;
  border: 1px dashed var(--border-strong); white-space: pre-wrap; overflow-wrap: anywhere;
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
}
.msg.ai .timing { margin-top: 8px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.msg-img { display: block; max-width: 100%; max-height: 260px; border-radius: 16px; margin: 2px 0 6px; }
.msg.me:has(.msg-img:only-child) { padding: 4px; }
.img-tag { display: inline-block; font-size: 13px; opacity: .9; margin-right: 6px; }
.brief-label {
  align-self: flex-start; font-size: 12px; font-weight: 600; color: var(--brand);
  background: var(--glass-bg); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  box-shadow: var(--glass-inner); padding: 5px 12px; border-radius: 999px; margin-top: 8px;
  animation: msgIn .42s var(--spring) both;
}

.wait-label { display: block; margin-top: 4px; font-size: 13px; color: var(--muted); animation: fadeIn .25s var(--ease); }
.typing { display: inline-flex; gap: 5px; padding: 6px 2px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); opacity: .3; animation: typing 1.2s var(--ease) infinite; }
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }

/* Thẻ kết quả (đã ghi sổ / thêm việc / khẩn cấp) */
.receipt {
  margin-top: 10px; padding: 11px 13px; border-radius: 16px;
  background: var(--brand-soft); box-shadow: inset 0 1px 0 var(--tile-border);
  font-size: 14px; animation: rise .4s var(--ease) both;
}
.receipt-head { font-weight: 650; margin-bottom: 4px; }
.receipt-row { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.receipt-row + .receipt-row { border-top: 1px solid var(--border); }
.receipt-row strong { white-space: nowrap; font-variant-numeric: tabular-nums; }
.receipt.sos { background: var(--tile); border: 1px solid color-mix(in srgb, var(--status-over) 40%, transparent); }

/* ---------- Ô soạn tin (nổi trên nội dung, ngay trên thanh tab) ---------- */
.dock {
  position: absolute; z-index: 6; left: 12px; right: 12px; bottom: var(--bottom-h);
  display: flex; flex-direction: column; gap: 8px; padding-bottom: 8px;
}
.attach-preview {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius);
  font-size: 13px; color: var(--muted); animation: rise .3s var(--ease);
}
.attach-preview img { width: 44px; height: 44px; object-fit: cover; border-radius: 12px; }
.attach-preview span { flex: 1; }
.composer {
  display: flex; align-items: flex-end; gap: 4px; padding: 6px; border-radius: 28px;
  transition: box-shadow .25s var(--ease);
}
.composer:focus-within { box-shadow: var(--glass-inner), var(--glass-shadow), 0 0 0 4px var(--brand-soft); }
.composer textarea {
  flex: 1; resize: none; max-height: 140px; overflow-y: hidden;
  padding: 10px 6px; border: 0; background: transparent; outline: none;
  font-size: 16px; /* >=16px để iOS không tự zoom */
}
.composer textarea::placeholder { color: var(--muted); }
.tool-btn {
  width: 40px; height: 40px; flex: none; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center;
}
.tool-btn:hover { background: var(--tile); color: var(--brand); }
.tool-btn.listening { color: #fff; background: var(--status-over); animation: pulse 1.2s infinite; }
.send {
  width: 40px; height: 40px; flex: none; border: 0; border-radius: 50%;
  background: var(--jelly); color: #fff; cursor: pointer;
  display: grid; place-items: center; box-shadow: var(--jelly-shadow);
}
.send svg { transition: transform .3s var(--spring); }
.send:not(:disabled):hover svg { transform: translateX(2px); }
.send:disabled { opacity: .35; box-shadow: none; cursor: default; }

/* ---------- Thanh tab kính nổi ---------- */
.tabbar {
  position: absolute; z-index: 6; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 10px);
  display: flex; padding: 6px; border-radius: 999px;
}
/* "Thấu kính" trượt theo tab, co giãn như giọt nước khi di chuyển */
.tab-indicator {
  position: absolute; top: 6px; bottom: 6px; left: 6px; width: calc((100% - 12px) / 5);
  border-radius: 999px; background: var(--lens);
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, .95), inset 0 -6px 12px -6px rgba(10, 40, 25, .18), 0 2px 4px rgba(10, 40, 25, .08), 0 8px 20px -6px rgba(10, 40, 25, .3);
  transform: translateX(calc(var(--tab-i, 0) * 100%));
  transition: transform .55s var(--spring);
}
.tab-indicator.squish { animation: squish .55s var(--ease); }
.tab {
  position: relative; z-index: 1; flex: 1; border: 0; background: transparent; cursor: pointer;
  padding: 7px 0 6px; font-size: 11px; font-weight: 600; color: var(--muted); white-space: nowrap; letter-spacing: -.01em;
  display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0;
}
.tab svg { width: 22px; height: 22px; transition: transform .4s var(--spring); }
.tab:active svg { transform: scale(.88); }
.tab.active { color: var(--brand); }
.tab.active svg { transform: translateY(-1px) scale(1.08); }
.badge {
  position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--status-over); color: #fff; font-size: 11px; line-height: 18px; font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 3px 8px -2px rgba(220, 38, 38, .6); animation: popIn .4s var(--spring);
}

/* ---------- Thẻ & bố cục chung ---------- */
.scroll {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  padding: var(--top-h) 16px calc(var(--bottom-h) + 16px);
  scroll-padding: var(--top-h) 0 calc(var(--bottom-h) + 16px);
  display: flex; flex-direction: column; gap: 14px;
}
#money-content, #task-groups { display: flex; flex-direction: column; gap: 14px; }
/* Nội dung dài hơn màn hình thì cuộn, không được co thẻ lại (thẻ có overflow: hidden sẽ bị co mất nội dung) */
.scroll > *, #money-content > *, #task-groups > *, #coach-list > * { flex-shrink: 0; }
.card {
  border-radius: var(--radius-lg); padding: 18px;
  animation: rise .5s var(--ease) both;
}
.scroll > .card:nth-child(2), #money-content > .card:nth-child(2), #task-groups > .card:nth-child(2) { animation-delay: .05s; }
.scroll > .card:nth-child(3), #money-content > .card:nth-child(3), #task-groups > .card:nth-child(3) { animation-delay: .1s; }
.scroll > .card:nth-child(n+4), #task-groups > .card:nth-child(n+4) { animation-delay: .15s; }
.card h3 { font-size: 15px; font-weight: 650; letter-spacing: -.01em; margin: 0 0 12px; }
.card h3 + .muted { margin-top: -4px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }

.primary-btn {
  margin-top: 10px; padding: 12px 18px; border: 0; border-radius: 999px;
  background: var(--jelly); color: #fff; font-weight: 600; cursor: pointer;
  box-shadow: var(--jelly-shadow); text-shadow: 0 1px 1px rgba(0, 40, 15, .2);
}
.primary-btn:hover { filter: brightness(1.05); }
.primary-btn.wide { width: 100%; margin-top: 0; padding: 14px; font-size: 16px; }
.primary-btn:disabled { opacity: .6; }
.ghost-btn {
  padding: 11px 16px; border-radius: 999px; border: 1px solid var(--tile-border);
  background: var(--tile); color: var(--text); font-weight: 600; cursor: pointer;
  box-shadow: inset 0 1px 0 var(--tile-border);
}
.ghost-btn:hover { background: var(--brand-soft); }
.ghost-btn.danger { color: var(--status-over); }
a.ghost-btn { text-decoration: none; display: inline-block; }
.link-btn { border: 0; background: transparent; color: var(--brand); font-weight: 600; cursor: pointer; padding: 4px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn-row .primary-btn { margin: 0; }
.del {
  width: 32px; height: 32px; flex: none; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); font-size: 20px; cursor: pointer; opacity: .7;
}
.del:hover { opacity: 1; background: color-mix(in srgb, var(--status-over) 12%, transparent); color: var(--status-over); }

.empty { text-align: center; }
.empty-emoji { font-size: 42px; animation: floaty 3s ease-in-out infinite; }
.empty p { margin: 6px 0; color: var(--muted); }
.empty p strong { color: var(--text); }

/* ---------- Sổ chi tiêu ---------- */
.month-nav { display: flex; align-items: center; justify-content: space-between; }
.month-nav h2 { font-size: 17px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.month-nav .icon-btn {
  font-size: 26px; line-height: 1; background: var(--glass-bg);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: var(--glass-inner), var(--glass-shadow);
}
.month-nav .icon-btn:disabled { opacity: .35; cursor: default; }

.hero {
  text-align: center; overflow: hidden; padding: 24px 18px 18px;
  background:
    radial-gradient(90% 70% at 50% 0%, color-mix(in srgb, var(--brand-2) 26%, transparent), transparent 70%),
    radial-gradient(140% 70% at 50% -12%, var(--glass-sheen), transparent 58%),
    var(--glass-bg);
}
.hero-label { margin: 0; color: var(--muted); font-size: 14px; }
.hero-value { margin: 4px 0 0; font-size: 42px; font-weight: 750; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.hero-sub { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.hero-sub div {
  background: var(--tile); border: 1px solid var(--tile-border); border-radius: 16px; padding: 9px 10px;
  display: flex; flex-direction: column; box-shadow: inset 0 1px 0 var(--tile-border);
}
.hero-sub span { font-size: 13px; color: var(--muted); }
.hero-sub strong { font-variant-numeric: tabular-nums; }

.cats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.cat-line { display: flex; justify-content: space-between; gap: 8px; font-size: 15px; margin-bottom: 7px; }
.cat-val { white-space: nowrap; font-variant-numeric: tabular-nums; }
.cat-val small { color: var(--muted); }
.bar {
  height: 10px; background: var(--tile); border-radius: 999px; overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .08), inset 0 0 0 1px var(--tile-border);
}
.bar span {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .4), rgba(255, 255, 255, 0) 60%), linear-gradient(90deg, var(--brand), var(--brand-2));
  box-shadow: 0 0 12px -2px color-mix(in srgb, var(--brand-2) 70%, transparent);
  transform-origin: left center; animation: grow .9s var(--ease) both;
}
.budget-ok span { background: linear-gradient(180deg, rgba(255, 255, 255, .4), transparent 60%), var(--status-ok); }
.budget-warn span { background: linear-gradient(180deg, rgba(255, 255, 255, .4), transparent 60%), var(--status-warn); }
.budget-over span { background: linear-gradient(180deg, rgba(255, 255, 255, .4), transparent 60%), var(--status-over); }
.budget-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 5px; font-variant-numeric: tabular-nums; }
.status-ok, .status-warn, .status-over { font-weight: 600; color: var(--text); }
.budget-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; animation: rise .3s var(--ease); }
.budget-form select, .budget-form input {
  font-size: 16px; padding: 10px 14px; border-radius: 14px;
  border: 1px solid var(--tile-border); background: var(--field); color: var(--text); min-width: 0;
}
.budget-form select { flex: 1 1 100%; }
.budget-form input { flex: 1; }
.budget-form .primary-btn { margin: 0; }
#budget-card .tip { margin: 10px 0 0; }

.day + .day { margin-top: 16px; }
.day-head {
  display: flex; justify-content: space-between; font-size: 13px; font-weight: 500; color: var(--muted);
  padding-bottom: 6px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums;
}
.item { display: flex; align-items: center; gap: 12px; padding: 9px 0; animation: fadeIn .3s var(--ease) both; }
.item + .item { border-top: 1px solid var(--border); }
.item-emoji {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center;
  font-size: 19px; background: var(--tile); border: 1px solid var(--tile-border); border-radius: 14px;
  box-shadow: inset 0 1px 0 var(--tile-border), 0 4px 10px -6px rgba(0, 0, 0, .2);
}
.item-note { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.item-note small { color: var(--muted); font-size: 12px; }
.item strong { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Việc cần làm ---------- */
.quick-add { display: flex; gap: 8px; padding: 8px; border-radius: 999px; }
.quick-add:focus-within { box-shadow: var(--glass-inner), var(--glass-shadow), 0 0 0 4px var(--brand-soft); }
.quick-add input {
  flex: 1; min-width: 0; font-size: 16px; border: 0; background: transparent; color: var(--text); outline: none; padding: 8px 12px;
}
.quick-add .primary-btn { margin: 0; padding: 10px 18px; }
.task-group h3 small { color: var(--muted); font-weight: 500; }
.task { display: flex; align-items: center; gap: 12px; padding: 9px 0; transition: opacity .3s var(--ease); }
.task + .task { border-top: 1px solid var(--border); }
.check {
  width: 26px; height: 26px; flex: none; border-radius: 50%; cursor: pointer;
  border: 2px solid var(--border-strong); background: var(--tile); color: #fff; font-weight: 700; font-size: 14px;
  display: grid; place-items: center; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .06);
}
.check:hover { border-color: var(--brand); }
.task.done .check { background: var(--jelly); border-color: transparent; box-shadow: var(--jelly-shadow); animation: checkPop .45s var(--spring); }
.task-body { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.task-body small { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.task-title { transition: color .3s var(--ease); background: linear-gradient(currentColor, currentColor) no-repeat 0 55% / 0 1.5px; }
.task.done .task-title { color: var(--muted); background-size: 100% 1.5px; transition: background-size .35s var(--ease), color .3s; }

/* ---------- Báo cáo câu trả lời AI ---------- */
.report-btn {
  display: block; margin: 8px 0 -4px auto; padding: 2px 4px; border: 0; background: transparent; cursor: pointer;
  font-size: 12px; color: var(--muted); opacity: .75;
}
.report-btn:hover { opacity: 1; color: var(--status-over); }
.report-btn:disabled { cursor: default; color: var(--brand); opacity: 1; }
.report-reasons { display: flex; flex-direction: column; gap: 8px; }
.report-reason {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px; cursor: pointer; font-weight: 500;
  background: var(--tile); border: 1px solid var(--tile-border);
}
.report-reason:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.report-reason input { accent-color: var(--brand); }
#report-cancel { align-self: center; }
.reports { display: flex; flex-direction: column; gap: 8px; }
.report { padding: 10px 12px; border-radius: 14px; background: var(--tile); border: 1px solid var(--tile-border); font-size: 14px; }
.report.open { border-color: color-mix(in srgb, var(--status-over) 45%, transparent); }
.report summary { cursor: pointer; }
.report p { margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.report .plan-btn { margin-top: 10px; }

/* ---------- Chuyển sang địa chỉ mới ---------- */
.move-card { flex: none; }
.move-card h3 { margin-bottom: 6px; }
.move-card .btn-row { margin-top: 10px; }
.move-card a.primary-btn { text-decoration: none; display: inline-block; margin: 0; }

/* ---------- Rèn luyện ---------- */
#coach-list { display: flex; flex-direction: column; gap: 14px; }
#coach-list:empty { display: none; }
.coach-form { display: flex; flex-direction: column; gap: 12px; }
.coach-form h3 { margin-bottom: 0; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; min-width: 0; }
.field small { color: var(--muted); font-weight: 500; }
.field textarea, .field select, .field input, .week-note {
  font: inherit; font-size: 16px; font-weight: 400; padding: 11px 14px; border-radius: 16px; color: var(--text); width: 100%;
  border: 1px solid var(--tile-border); background: var(--field); outline: none; resize: vertical;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .05); transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.field textarea:focus, .field select:focus, .field input:focus, .week-note:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.field-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.field-row .field select, .field-row .field input { padding: 10px; }
.coach-form .auth-error:empty { display: none; }
#coach-cancel { align-self: center; }
#coach-new { align-self: center; }
.coach-loading { text-align: center; }
.coach-loading p { margin: 6px 0 0; }

.program-head { display: flex; align-items: center; gap: 14px; }
.program-title { flex: 1; min-width: 0; }
.program-title h3 { margin: 0; font-size: 16px; overflow-wrap: anywhere; }
.program-title small { color: var(--muted); font-size: 13px; }
/* Vòng tiến độ tuần: dải màu theo --p (0..1) */
.ring {
  --p: 0; width: 54px; height: 54px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background:
    radial-gradient(closest-side, var(--glass-strong) 72%, transparent 74%),
    conic-gradient(var(--brand-2) calc(var(--p) * 360deg), var(--tile) 0);
  box-shadow: inset 0 1px 0 var(--tile-border), 0 6px 16px -8px rgba(21, 128, 61, .5);
}
.ring span { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.streak {
  flex: none; padding: 5px 10px; border-radius: 999px; font-size: 13px; font-weight: 700;
  background: color-mix(in srgb, #f97316 16%, transparent); color: #c2410c; box-shadow: inset 0 1px 0 var(--tile-border);
  font-variant-numeric: tabular-nums;
}
:root[data-theme="dark"] .streak { color: #fdba74; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .streak { color: #fdba74; } }

.today {
  margin-top: 14px; padding: 14px; border-radius: 20px; display: flex; flex-direction: column; gap: 4px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--brand-2) 18%, transparent), transparent 70%), var(--tile);
  border: 1px solid var(--tile-border); box-shadow: inset 0 1px 0 var(--tile-border);
}
.today small { color: var(--brand); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.today strong { font-size: 18px; letter-spacing: -.01em; }
.today p { margin: 0; color: var(--muted); font-size: 14px; }
.today .today-btn { margin-top: 10px; width: 100%; }
.today.done strong { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1.5px; }

.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 14px; }
.day-dot {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 0 8px; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--tile-border); background: var(--tile); color: var(--muted); font-size: 11px; font-weight: 600;
  box-shadow: inset 0 1px 0 var(--tile-border); transition: transform .28s var(--spring), background-color .2s;
}
.day-dot b { font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; }
.day-dot:active { transform: scale(.92); }
.day-dot:disabled { cursor: default; opacity: .55; }
.day-dot.today { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft), inset 0 1px 0 var(--tile-border); color: var(--brand); }
.day-dot.done { background: var(--jelly); border-color: transparent; color: rgba(255, 255, 255, .85); box-shadow: var(--jelly-shadow); animation: checkPop .45s var(--spring); }
.day-dot.done b { color: #fff; }
.day-dot.missed b { color: var(--muted); }

.coach-msg { margin: 12px 0 0; font-size: 14px; color: var(--muted); }
.coach-note { margin-top: 12px; padding: 11px 13px; border-radius: 16px; background: var(--brand-soft); font-size: 14px; box-shadow: inset 0 1px 0 var(--tile-border); }
.coach-note p { margin: 4px 0 0; }
.coach-more { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.coach-more summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--brand); list-style: none; }
.coach-more summary::-webkit-details-marker { display: none; }
.coach-more summary::after { content: " ›"; display: inline-block; transition: transform .25s var(--ease); }
.coach-more[open] summary::after { transform: rotate(90deg); }
.coach-more .task { animation: fadeIn .3s var(--ease) both; }
.roadmap { margin: 8px 0 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.roadmap li { padding: 8px 12px; border-radius: 14px; background: var(--tile); border: 1px solid var(--tile-border); }
.roadmap li b { margin-right: 6px; }
.roadmap li.past { color: var(--muted); }
.roadmap li.cur { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

.week-done { margin-top: 14px; padding: 14px; border-radius: 20px; background: var(--tile); border: 1px solid var(--tile-border); display: flex; flex-direction: column; gap: 10px; animation: rise .4s var(--ease) both; }
.week-done h4 { margin: 0; font-size: 17px; }
.feel-chips { display: flex; gap: 6px; }
.feel {
  flex: 1; min-width: 0; padding: 9px 4px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 13px; white-space: nowrap;
  border: 1px solid var(--tile-border); background: var(--field); transition: transform .28s var(--spring), background-color .2s;
}
.feel:active { transform: scale(.94); }
.feel.on { background: var(--jelly); color: #fff; border-color: transparent; box-shadow: var(--jelly-shadow); }
.week-note { font-size: 15px; }

.program-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; border-top: 1px solid var(--border); padding-top: 8px; }
.remind-row { padding: 4px 0; font-size: 14px; font-weight: 500; gap: 8px; display: flex; align-items: center; cursor: pointer; }
.remind-row input[type="time"] { font-size: 15px; padding: 5px 10px; border-radius: 12px; border: 1px solid var(--tile-border); background: var(--field); color: var(--text); }
.program.done .program-foot { border-top: 0; margin-top: 4px; }

/* ---------- Đăng nhập ---------- */
.auth {
  min-height: 100dvh; display: grid; place-items: center;
  padding: calc(env(safe-area-inset-top) + 24px) 16px calc(env(safe-area-inset-bottom) + 24px);
}
.auth-box { width: 100%; max-width: 380px; text-align: center; animation: lift .6s var(--ease) both; }
.auth-box img { border-radius: 20px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 18px 40px -10px rgba(21, 128, 61, .55); }
.auth-box h1 { margin: 14px 0 2px; font-size: 30px; font-weight: 750; letter-spacing: -.035em; }
.auth-sub { margin: 0 0 22px; color: var(--muted); }
.seg { display: grid; grid-template-columns: 1fr 1fr; border-radius: 999px; padding: 5px; margin-bottom: 18px; }
.seg-btn { position: relative; border: 0; background: transparent; padding: 10px; border-radius: 999px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg-btn.active { background: var(--jelly); color: #fff; box-shadow: var(--jelly-shadow); }
.auth-form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.auth-form input:not([type="checkbox"]) {
  font-size: 16px; padding: 13px 16px; border-radius: 16px; color: var(--text);
  border: 1px solid var(--tile-border); background: var(--field); outline: none;
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .05), 0 6px 18px -10px rgba(10, 40, 25, .25);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.auth-form input:not([type="checkbox"]):focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.auth-error { margin: 0; min-height: 1.2em; color: var(--status-over); font-size: 14px; }
.auth-hint { margin: 0; font-size: 13px; color: var(--muted); }
.auth-foot { margin-top: 18px; font-size: 13px; }

/* Ô tick tùy biến (đồng ý, cài đặt) */
.consent-group { display: flex; flex-direction: column; gap: 12px; }
.consent { display: flex; flex-direction: row !important; align-items: flex-start; gap: 10px !important; font-weight: 500 !important; cursor: pointer; }
.consent-group .consent span { font-size: 14px; line-height: 1.5; }
.consent input, .setting-row input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; flex: none; margin: 1px 0 0;
  width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--border-strong); background: var(--field);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .06);
  display: grid; place-items: center; cursor: pointer; transition: background-color .2s var(--ease), border-color .2s var(--ease);
}
.consent input::after, .setting-row input[type="checkbox"]::after {
  content: ""; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) scale(0); margin-top: -2px; transition: transform .3s var(--spring);
}
.consent input:checked, .setting-row input[type="checkbox"]:checked { background: var(--jelly); border-color: transparent; box-shadow: var(--jelly-shadow); }
.consent input:checked::after, .setting-row input[type="checkbox"]:checked::after { transform: rotate(45deg) scale(1); }

/* ---------- Tài khoản ---------- */
.profile { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 56px; height: 56px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--jelly); color: #fff; font-size: 22px; font-weight: 700; box-shadow: var(--jelly-shadow);
  text-shadow: 0 1px 2px rgba(0, 40, 15, .25);
}
.profile-name { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
#ios-tip { margin-top: 12px; }
.plan-card h3 { margin-bottom: 6px; }
.plan-card .tip { margin: 8px 0 0; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; }
.setting-row + .setting-row { border-top: 1px solid var(--border); }
.setting-row label { display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }
.setting-row input[type="text"] { flex: 1; min-width: 0; max-width: 55%; text-align: right; }
.setting-row input[type="time"], .setting-row input[type="text"] {
  font-size: 16px; padding: 7px 12px; border-radius: 14px;
  border: 1px solid var(--tile-border); background: var(--field); color: var(--text);
}
.memories { list-style: none; margin: 0; padding: 0; }
.memories li { display: flex; align-items: center; gap: 8px; padding: 7px 0; font-size: 15px; animation: fadeIn .3s var(--ease) both; }
.memories li + li { border-top: 1px solid var(--border); }
.memories li span { flex: 1; overflow-wrap: anywhere; }

.sos-list { display: flex; flex-direction: column; gap: 8px; }
.sos-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; text-decoration: none;
  padding: 11px 14px; border-radius: 16px; background: var(--tile); border: 1px solid var(--tile-border); color: var(--text);
  box-shadow: inset 0 1px 0 var(--tile-border);
}
.sos-row:hover { border-color: var(--border-strong); }
.sos-row span { display: flex; flex-direction: column; }
.sos-row small { color: var(--muted); font-size: 12px; }
.sos-row b { color: var(--status-over); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Quản trị ---------- */
#admin-days {
  font-size: 14px; padding: 6px 10px; border-radius: 12px;
  border: 1px solid var(--tile-border); background: var(--field); color: var(--text);
}
.admin-model { margin: 0 0 12px; font-size: 14px; }
.admin-model small { color: var(--muted); }
.admin-totals { grid-template-columns: repeat(3, 1fr); margin: 0 0 12px; }
.admin-totals strong { font-size: 15px; }
.admin-sub { margin: 16px 0 6px; font-size: 14px; }
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.admin-table th, .admin-table td { padding: 9px 6px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
.admin-table th:first-child { text-align: left; }
.admin-table thead th { color: var(--muted); font-weight: 600; font-size: 12px; }
.admin-table td.muted { text-align: left; }
.plan-btn {
  border: 1px solid var(--tile-border); background: var(--tile); color: var(--text);
  border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.plan-btn.on { border-color: var(--status-warn); background: color-mix(in srgb, var(--status-warn) 14%, transparent); }

/* ---------- Hộp thoại ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50; background: rgba(6, 12, 9, .28);
  -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%);
  display: grid; place-items: center; padding: 16px; overflow-y: auto; animation: fadeIn .3s var(--ease);
}
.modal-box {
  width: 100%; max-width: 460px; color: var(--text);
  background: radial-gradient(140% 70% at 50% -12%, var(--glass-sheen), transparent 58%), var(--glass-strong);
  border-radius: 30px; padding: 24px; display: flex; flex-direction: column; gap: 12px; animation: sheetIn .5s var(--spring);
}
.modal-box h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.modal-alt { justify-content: center; margin-top: 0; }
.modal-alt .ghost-btn { font-size: 13px; padding: 8px 12px; }

/* ---------- Chuyển động ---------- */
/* Lưu ý: không đổi opacity trên phần tử chứa lớp kính (kính bên trong sẽ mất mờ trong lúc chạy) */
@keyframes viewIn { from { transform: translateY(10px); } }
@keyframes lift { from { transform: translateY(14px); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes msgIn { from { opacity: 0; transform: translateY(12px) scale(.94); } }
@keyframes sheetIn { from { opacity: 0; transform: translateY(30px) scale(.96); } }
@keyframes popIn { from { transform: scale(0); } }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes squish { 35% { scale: 1.22 .86; } 70% { scale: .96 1.04; } }
@keyframes typing { 0%, 70%, 100% { opacity: .3; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-4px); } }
@keyframes checkPop { 0% { transform: scale(.7); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(220, 38, 38, .15); } }
@keyframes breathe { 50% { transform: scale(1.06); } }
@keyframes floaty { 50% { transform: translateY(-6px); } }
@keyframes drift {
  0% { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); }
  50% { transform: translate3d(4%, -3%, 0) rotate(12deg) scale(1.08); }
  100% { transform: translate3d(-3%, 4%, 0) rotate(-8deg) scale(1.02); }
}
@keyframes drift2 {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(-8%, 6%, 0) scale(1.15); }
}

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