/* =====================================================
   Splitly - stylesheet dùng chung cho mọi trang
   Bảng màu lấy cảm hứng từ các màu xu hướng 2026:
   Cloud Dancer (nền), Transformative Teal (chủ đạo),
   Universal Khaki (nhấn), Warm Mahogany (nợ/cảnh báo),
   Silhouette espresso (chữ)
   ===================================================== */

:root {
  /* Màu 2026 */
  --cloud: #F0EEE9;          /* Cloud Dancer */
  --cloud-2: #E5E1D8;
  --paper: #FBFAF7;
  --teal: #1B7377;           /* Transformative Teal */
  --teal-deep: #0F4F52;
  --teal-soft: #D4E7E5;
  --gem: #3AA394;            /* Hidden Gem */
  --khaki: #C5B08A;          /* Universal Khaki */
  --khaki-soft: #EDE4D0;
  --mahogany: #8B3A34;       /* Warm Mahogany */
  --mahogany-soft: #F0DAD6;
  --ink: #2A2321;            /* Silhouette espresso */
  --ink-2: #5C514B;
  --ink-3: #8A7F77;

  --line: rgba(42, 35, 33, .11);
  --line-strong: rgba(42, 35, 33, .22);

  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 24px;
  --shadow: 0 1px 2px rgba(42,35,33,.05), 0 10px 30px -12px rgba(42,35,33,.18);
  --shadow-lift: 0 2px 4px rgba(42,35,33,.06), 0 18px 40px -14px rgba(15,79,82,.30);

  --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--cloud);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }
img, svg { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--gem); outline-offset: 2px; border-radius: 8px; }

h1, h2, h3 { line-height: 1.2; letter-spacing: -.02em; font-weight: 700; }
h1 { font-size: clamp(1.6rem, 5.4vw, 2.2rem); font-weight: 800; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
.muted { color: var(--ink-2); font-size: .95rem; }
.label, label { display: block; font-size: .875rem; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }

/* Nền trang: hai vòng tròn chồng nhau - dấu ấn "chia đôi" */
.backdrop-art {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(38rem 26rem at 108% -8%, rgba(27,115,119,.16), transparent 65%),
    radial-gradient(30rem 22rem at -12% 0%, rgba(197,176,138,.28), transparent 65%),
    var(--cloud);
}

/* ---------- Khung trang ---------- */
.container {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 20px 16px calc(120px + var(--safe-b));
}
.page-head { margin: 8px 0 22px; }
.page-head .muted { margin-top: 6px; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(240, 238, 233, .86);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-inner {
  max-width: 780px; margin: 0 auto; height: 60px;
  padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 800; font-size: 1.15rem; letter-spacing: -.03em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; }
.topbar-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-name { display: none; font-weight: 600; font-size: .92rem; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Thẻ ---------- */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card-title { margin-bottom: 14px; }

/* ---------- Nút ---------- */
.btn {
  --_bg: var(--paper); --_fg: var(--ink); --_bd: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px;
  border-radius: 999px; border: 1.5px solid var(--_bd);
  background: var(--_bg); color: var(--_fg);
  font-weight: 600; font-size: .95rem; line-height: 1; white-space: nowrap;
  transition: transform .15s ease, background-color .15s ease, box-shadow .15s ease, border-color .15s ease;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn[disabled], .btn.is-loading { opacity: .65; pointer-events: none; }
.btn-primary { --_bg: var(--teal); --_fg: #fff; --_bd: var(--teal); box-shadow: 0 8px 20px -10px rgba(27,115,119,.7); }
.btn-primary:hover { --_bg: var(--teal-deep); --_bd: var(--teal-deep); }
.btn-ghost { --_bg: transparent; --_bd: var(--line-strong); }
.btn-ghost:hover { --_bg: rgba(42,35,33,.05); }
.btn-danger { --_bg: transparent; --_fg: var(--mahogany); --_bd: rgba(139,58,52,.35); }
.btn-danger:hover { --_bg: var(--mahogany-soft); }
.btn-danger-solid { --_bg: var(--mahogany); --_fg: #fff; --_bd: var(--mahogany); }
.btn-danger-solid:hover { --_bg: #6f2c27; --_bd: #6f2c27; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: .85rem; }
.btn-block { width: 100%; }
.btn.is-loading::after {
  content: ""; width: 16px; height: 16px; border-radius: 50%;
  border: 2.5px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent;
  display: inline-grid; place-items: center; color: var(--ink-2);
  transition: background-color .15s ease, color .15s ease;
  flex: none;
}
.icon-btn:hover { background: rgba(42,35,33,.07); }
.icon-btn.danger { color: var(--mahogany); }
.icon-btn.danger:hover { background: var(--mahogany-soft); }

/* ---------- Form ---------- */
.form { display: grid; gap: 16px; }
.form-title { margin-bottom: 2px; }
.field { min-width: 0; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], select {
  width: 100%; min-height: 48px; padding: 10px 14px;
  border-radius: var(--r-md); border: 1.5px solid var(--line-strong);
  background: #fff; font-size: 16px; /* 16px để iOS không tự phóng to */
  transition: border-color .15s ease, box-shadow .15s ease;
  appearance: none; -webkit-appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235C514B' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px;
}
input::placeholder { color: var(--ink-3); }
input:focus, select:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 4px rgba(27,115,119,.16); }
.cur-tag { font-weight: 700; color: var(--teal); margin-left: 4px; }
.hint-line { color: var(--ink-3); font-size: .85rem; }
.form-error {
  background: var(--mahogany-soft); color: var(--mahogany);
  border-radius: var(--r-sm); padding: 10px 14px; font-size: .9rem; font-weight: 500;
}

/* Nhóm nút chọn (tab dạng viên thuốc) */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--cloud-2); border-radius: 999px; }
.seg-btn {
  border: 0; background: transparent; min-height: 40px; padding: 0 10px; border-radius: 999px;
  font-weight: 600; font-size: .9rem; color: var(--ink-2); transition: background-color .2s ease, color .2s ease, box-shadow .2s ease;
}
.seg-btn.is-active { background: var(--paper); color: var(--teal-deep); box-shadow: 0 1px 3px rgba(42,35,33,.16); }

/* ---------- Avatar ---------- */
.avatar {
  --bg: var(--teal); --fg: #fff;
  display: inline-grid; place-items: center; flex: none;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--bg); color: var(--fg);
  font-weight: 700; font-size: .85rem; letter-spacing: 0; overflow: hidden;
  text-indent: 0;
}
.avatar { position: relative; }
.avatar > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; background: var(--cloud-2); }
.avatar-sm { width: 34px; height: 34px; font-size: .78rem; }
.avatar-lg { width: 46px; height: 46px; font-size: .95rem; }

/* ---------- Trang đăng nhập ---------- */
.auth-page .backdrop-art {
  background:
    radial-gradient(44rem 30rem at 100% 0%, rgba(27,115,119,.20), transparent 62%),
    radial-gradient(34rem 26rem at 0% 100%, rgba(197,176,138,.34), transparent 62%),
    var(--cloud);
}
.auth {
  min-height: 100dvh; max-width: 1040px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr; align-content: center; gap: 28px;
  padding: 28px 16px calc(28px + var(--safe-b));
}
.auth-hero { position: relative; padding-top: 6px; }
.hero-brand { font-weight: 800; letter-spacing: -.03em; font-size: 1.25rem; color: var(--teal-deep); margin-bottom: 14px; }
.auth-hero h1 { max-width: 15ch; font-size: clamp(1.9rem, 7.6vw, 3.4rem); line-height: 1.06; letter-spacing: -.035em; }
.hero-sub { margin-top: 14px; color: var(--ink-2); max-width: 46ch; }
.hero-circles { width: 104px; margin-bottom: 14px; }
.hero-circles svg { width: 100%; height: auto; overflow: visible; }
.hero-circles .c-khaki { animation: slideCircle 1s .1s cubic-bezier(.2,.8,.2,1) both; }
.hero-circles .c-lens { animation: fadeIn .5s .95s both; }
@keyframes slideCircle { from { transform: translateX(-46px); } to { transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.auth-card { padding: 22px; display: grid; gap: 18px; }

/* ---------- Dashboard ---------- */
.create-card { margin-bottom: 30px; }
.icon-picker { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.icon-opt {
  aspect-ratio: 1; min-height: 44px; border-radius: var(--r-md);
  border: 1.5px solid var(--line); background: #fff; font-size: 1.5rem; line-height: 1;
  display: grid; place-items: center;
  transition: transform .15s ease, border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.icon-opt:hover { border-color: var(--khaki); background: var(--khaki-soft); }
.icon-opt.is-selected { border-color: var(--teal); background: var(--teal-soft); box-shadow: 0 0 0 3px rgba(27,115,119,.2); transform: scale(1.04); }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 26px 2px 12px; }
.section-head h2 { font-size: 1.1rem; }
.count-pill { background: var(--khaki-soft); color: #6d5a34; border-radius: 999px; padding: 2px 10px; font-size: .8rem; font-weight: 700; }

.group-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.group-card {
  position: relative; display: flex; align-items: stretch; min-width: 0;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease;
}
.group-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.group-card.is-removing { opacity: 0; transform: scale(.96); transition: opacity .25s ease, transform .25s ease; }
.group-card.is-new { animation: pop .5s cubic-bezier(.2,.9,.3,1.3); }
@keyframes pop { from { transform: scale(.94); box-shadow: 0 0 0 6px rgba(58,163,148,.4); } to { transform: none; } }
.group-link {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px;
  padding: 16px; color: inherit; border-radius: var(--r-lg);
}
.group-link:hover { text-decoration: none; }
.g-icon {
  width: 56px; height: 56px; flex: none; border-radius: 18px;
  display: grid; place-items: center; font-size: 1.8rem;
  background: var(--teal-soft);
}
.group-card:nth-child(3n+2) .g-icon { background: var(--khaki-soft); }
.group-card:nth-child(3n+3) .g-icon { background: var(--mahogany-soft); }
.g-info { min-width: 0; flex: 1; }
.g-info h3 { overflow-wrap: anywhere; }
.g-sub { color: var(--ink-3); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-balance { display: block; margin-top: 6px; font-size: .85rem; font-weight: 700; }
.pos { color: var(--teal); }
.neg { color: var(--mahogany); }
.zero { color: var(--ink-3); }
.group-card .icon-btn { align-self: center; margin-right: 8px; }
.badge {
  display: inline-block; vertical-align: 1px; margin-left: 6px;
  font-size: .7rem; font-weight: 700; padding: 1px 8px; border-radius: 999px;
  background: var(--teal-soft); color: var(--teal-deep);
}
.badge-khaki { background: var(--khaki-soft); color: #6d5a34; }

.empty {
  text-align: center; padding: 34px 20px; border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-lg); color: var(--ink-2);
}
.empty .emoji { font-size: 2.2rem; display: block; margin-bottom: 6px; }
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }

.skeleton-list { display: grid; gap: 12px; }
.skeleton {
  height: 88px; border-radius: var(--r-lg);
  background: linear-gradient(100deg, var(--cloud-2) 30%, #EFEBE3 50%, var(--cloud-2) 70%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Trang nhóm ---------- */
.back-link { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: .9rem; color: var(--ink-2); margin-bottom: 14px; padding: 6px 10px 6px 4px; border-radius: 999px; }
.back-link:hover { text-decoration: none; background: rgba(42,35,33,.06); }
.group-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.group-emblem {
  width: 68px; height: 68px; flex: none; border-radius: 22px; font-size: 2.2rem;
  display: grid; place-items: center; background: var(--paper);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.group-head-text { min-width: 0; }
.group-head-text h1 { overflow-wrap: anywhere; }

.summary { padding: 20px; margin-bottom: 18px; position: relative; overflow: hidden; }
.summary::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%;
  background: var(--khaki-soft); z-index: 0; opacity: .8;
}
.summary > * { position: relative; z-index: 1; }
.summary-label { color: var(--ink-2); font-size: .9rem; font-weight: 500; }
.summary-amount { font-size: clamp(1.9rem, 8vw, 2.5rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.15; margin: 2px 0 2px; overflow-wrap: anywhere; }
.summary-total { color: var(--ink-3); font-size: .85rem; }
.summary-debts { display: grid; gap: 8px; margin-top: 14px; }
.debt-chip {
  display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.75);
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 8px 8px 12px; font-size: .9rem;
}
.debt-chip .txt { flex: 1; min-width: 0; }
.summary-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.summary-actions .btn { flex: 1 1 140px; }

.tabs {
  position: sticky; top: calc(60px + env(safe-area-inset-top, 0px)); z-index: 20;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  padding: 4px; margin: 0 0 16px; background: var(--cloud-2); border-radius: 999px;
}
.tab {
  border: 0; background: transparent; min-height: 42px; border-radius: 999px;
  font-weight: 600; font-size: .92rem; color: var(--ink-2);
  transition: background-color .2s ease, color .2s ease, box-shadow .2s ease;
}
.tab.is-active { background: var(--paper); color: var(--teal-deep); box-shadow: 0 1px 4px rgba(42,35,33,.18); }

.month-title { font-size: .9rem; color: var(--ink-3); font-weight: 700; margin: 20px 4px 8px; letter-spacing: 0; }
.month-title:first-child { margin-top: 4px; }

.exp { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); margin-bottom: 8px; overflow: hidden; }
.exp-main {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
  border: 0; background: transparent; padding: 12px 14px; min-height: 68px;
}
.exp-date { width: 34px; flex: none; text-align: center; line-height: 1.1; color: var(--ink-3); font-size: .72rem; font-weight: 600; }
.exp-date b { display: block; font-size: 1.1rem; color: var(--ink); font-weight: 700; }
.exp-icon { width: 42px; height: 42px; flex: none; border-radius: 14px; background: var(--khaki-soft); display: grid; place-items: center; font-size: 1.3rem; }
.exp.is-payment .exp-icon { background: var(--teal-soft); }
.exp-body { flex: 1; min-width: 0; }
.exp-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.exp-sub { display: block; color: var(--ink-3); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exp-amt { text-align: right; flex: none; max-width: 42%; line-height: 1.25; }
.exp-amt .lbl { display: block; font-size: .72rem; font-weight: 600; }
.exp-amt b { font-size: .98rem; font-weight: 700; overflow-wrap: anywhere; }
.exp-detail { display: none; border-top: 1px dashed var(--line-strong); padding: 12px 14px 14px; background: rgba(237,228,208,.25); }
.exp.is-open .exp-detail { display: block; animation: reveal .22s ease; }
@keyframes reveal { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.exp-meta { color: var(--ink-3); font-size: .82rem; margin-bottom: 10px; }
.split-list { display: grid; gap: 8px; margin-bottom: 12px; }
.split-row { display: flex; align-items: center; gap: 10px; font-size: .92rem; }
.split-row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.split-row .am { font-weight: 700; }
.exp-actions { display: flex; gap: 8px; }

/* Số dư */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 6px 16px; margin-bottom: 18px; }
.panel-title { font-size: 1rem; margin: 6px 4px 10px; }
.bal-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.bal-row:last-child { border-bottom: 0; }
.bal-main { flex: 1; min-width: 0; }
.bal-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bal-status { font-size: .82rem; font-weight: 600; }
.bal-bar { height: 6px; border-radius: 999px; background: var(--cloud-2); margin-top: 8px; overflow: hidden; }
.bal-bar > i { display: block; height: 100%; border-radius: 999px; min-width: 4px; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.bal-bar .pos-fill { background: var(--teal); }
.bal-bar .neg-fill { background: var(--mahogany); }
.transfer { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.transfer:last-child { border-bottom: 0; }
.transfer .txt { flex: 1 1 180px; min-width: 0; font-size: .93rem; }
.transfer .txt b { font-weight: 700; }
.transfer .arrow { color: var(--khaki); flex: none; }
.transfer .btn { margin-left: auto; }

/* Thành viên */
.member-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.member-row:last-child { border-bottom: 0; }
.member-link {
  display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0;
  color: inherit; border-radius: var(--r-md); margin: -6px -8px; padding: 6px 8px;
  transition: background-color .15s ease;
}
.member-link:hover { text-decoration: none; background: rgba(42,35,33,.05); }
.member-link:active { background: rgba(42,35,33,.09); }
.member-info { flex: 1; min-width: 0; }
.member-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-sub { color: var(--ink-3); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.add-form { display: grid; gap: 14px; padding: 4px 0 12px; }
.check-line { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 0; font-size: .92rem; font-weight: 500; color: var(--ink); cursor: pointer; }
.notice { background: var(--khaki-soft); color: #5a4a29; border-radius: var(--r-sm); padding: 10px 14px; font-size: .9rem; font-weight: 500; }
.hint { color: var(--ink-3); font-size: .85rem; margin: 0 4px 12px; }
.danger-zone { margin-top: 8px; display: grid; gap: 8px; }

/* FAB */
.fab {
  position: fixed; right: 18px; bottom: calc(20px + var(--safe-b)); z-index: 25;
  width: 60px; height: 60px; border-radius: 50%; border: 0;
  background: var(--teal); color: #fff; display: grid; place-items: center;
  box-shadow: 0 14px 30px -8px rgba(15,79,82,.65);
  transition: transform .15s ease, background-color .15s ease;
}
.fab:hover { background: var(--teal-deep); }
.fab:active { transform: scale(.92); }

/* ---------- Modal / bottom sheet ---------- */
.modal {
  position: fixed; inset: 0; z-index: 60; display: none;
  align-items: flex-end; justify-content: center;
  background: rgba(42,35,33,.5);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.modal.open { display: flex; animation: fadeIn .18s ease; }
.sheet {
  width: 100%; max-width: 540px; max-height: 94vh; max-height: 94dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--paper); border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 18px 18px calc(22px + var(--safe-b));
  animation: sheetUp .28s cubic-bezier(.2,.9,.3,1);
}
@keyframes sheetUp { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.sheet-text { color: var(--ink-2); margin-bottom: 18px; }
.sheet-actions { display: flex; gap: 10px; }
.sheet-actions .btn { flex: 1; }

/* Danh sách người tham gia trong form chi phí */
.participants { display: grid; gap: 4px; border: 1px solid var(--line); border-radius: var(--r-md); padding: 6px 12px; background: #fff; }
.p-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; min-height: 52px; cursor: pointer; }
.p-row + .p-row { border-top: 1px solid var(--line); }
.p-row .nm { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-row .p-amt { font-size: .88rem; font-weight: 600; color: var(--teal); white-space: nowrap; }
.p-row input[type="checkbox"], .check-line input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; width: 24px; height: 24px; border-radius: 8px; flex: none;
  border: 2px solid var(--line-strong); background: #fff; display: grid; place-items: center; cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.p-row input[type="checkbox"]:checked, .check-line input[type="checkbox"]:checked { background: var(--teal); border-color: var(--teal); }
.p-row input[type="checkbox"]:checked::after, .check-line input[type="checkbox"]:checked::after { content: ""; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translate(-1px, -1px); }
.p-input { display: flex; align-items: center; gap: 6px; }
.p-input input { width: 110px; min-height: 42px; text-align: right; padding: 6px 10px; }
.p-input span { color: var(--ink-3); font-weight: 600; font-size: .85rem; min-width: 14px; }
.split-summary { font-size: .88rem; font-weight: 600; color: var(--ink-2); padding: 0 4px; }
.split-summary.ok { color: var(--teal); }
.split-summary.bad { color: var(--mahogany); }

/* ---------- Toast ---------- */
.toasts { position: fixed; left: 0; right: 0; top: calc(70px + env(safe-area-inset-top, 0px)); z-index: 100; display: grid; justify-items: center; gap: 8px; padding: 0 16px; pointer-events: none; }
.toast {
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 999px; font-size: .92rem; font-weight: 500;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,.5); max-width: 100%; animation: toastIn .28s cubic-bezier(.2,.9,.3,1.2);
}
.toast.error { background: var(--mahogany); }
.toast.success { background: var(--teal-deep); }
.toast.out { opacity: 0; transform: translateY(-8px); transition: all .25s ease; }
@keyframes toastIn { from { transform: translateY(-14px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Tiện ích hiển thị ---------- */
.only-desktop { display: none; }

/* ---------- Tablet / desktop ---------- */
@media (min-width: 640px) {
  .topbar-name { display: inline; }
  .field-row { gap: 16px; }
  .group-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .icon-picker { grid-template-columns: repeat(10, 1fr); }
  .modal { align-items: center; padding: 20px; }
  .sheet { border-radius: var(--r-lg); padding-bottom: 22px; max-height: 90vh; }
  .only-desktop { display: inline-flex; }
  .only-mobile { display: none !important; }
  .fab { display: none; }
  .card { padding: 26px; }
  .container { padding-top: 32px; }
}
@media (min-width: 900px) {
  .hero-circles { width: 138px; margin-bottom: 20px; }
  .auth { grid-template-columns: 1.15fr .85fr; align-items: center; gap: 56px; padding: 40px 32px; }
  .auth-card { padding: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

.user-dropdown-container {
  position: relative;
}
.user-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 20px;
  color: inherit;
  font: inherit;
}
.user-dropdown-btn .img-avatar {
  object-fit: cover;
  border-radius: 50%;
}
.user-dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.08);
  min-width: 180px;
  display: none;
  z-index: 1000;
  overflow: hidden;
}
.user-dropdown-menu.show {
  display: block;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: #374151;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}
.dropdown-item:hover {
  background-color: #f3f4f6;
}
.dropdown-item.text-danger {
  color: #ef4444;
}
.dropdown-divider {
  height: 1px;
  background-color: #e5e7eb;
  margin: 4px 0;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  max-width: 90%;
  margin: 0 auto;
}

.avatar-item {
  position: relative;
  cursor: pointer;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid transparent;
  transition: all 0.2s ease-in-out;
  padding: 2px;
  box-shadow: 0 5px 6px rgba(0, 0, 0, 0.1);
}

.avatar-item input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.avatar-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.avatar-item:hover {
  transform: scale(1.05);
}

.avatar-item.active {
  border-color: #3b82f6; /* Viền xanh khi chọn */
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

/* Ép các ô input rộng 100% */
.profile-card .form-control {
  width: 100% !important;
  box-sizing: border-box;
}

/* Thông báo hết số lượng ký tự */
.text-danger-limit {
  color: #dc2626 !important;
  font-weight: 600;
}

/* Container chứa các nút hobby */
.hobby-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* Kiểu dáng các chip thường (Chưa chọn) */
.hobby-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 16px;
  border-radius: 50px;
  border: 1px solid transparent;
  background-color: var(--chip-bg, #f1f5f9);
  color: var(--chip-color, #334155);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease-in-out;
  user-select: none;
}

.hobby-chip:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}

/* Khi được CHỌN (Active) - Theo hình thiết kế */
.hobby-chip.active {
  background-color: #e0e7ff !important; /* Background nền chọn */
  color: #4f46e5 !important;            /* Màu chữ và icon chọn */
  border: 1.5px solid #4f46e5 !important;/* Viền màu đậm nổi bật */
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.15);
}

.textcount{
  font-size:12px;
  padding:10px;
  color: #6981d6;
  font-weight:bold;
}
/* ---------- Link chia sẻ nhóm ---------- */
.share-box { display: flex; gap: 8px; align-items: stretch; }
.share-box input[type="text"] { flex: 1; min-width: 0; font-size: .85rem; color: var(--ink-2); background: var(--cloud); text-overflow: ellipsis; }
.share-box .btn { flex: none; min-height: 48px; }
.guest-banner { display: flex; gap: 10px; align-items: flex-start; background: var(--khaki-soft); color: #5b4a29; border-radius: var(--r-md); padding: 10px 14px; font-size: .9rem; margin-bottom: 12px; }
.user-link { color: inherit; border-bottom: 1px dashed var(--line-strong); }
.user-link:hover { color: var(--teal); text-decoration: none; border-bottom-color: var(--teal); }
