:root {
  --bg: #f1e8d6;
  --surface: #faf5ea;
  --surface-2: #f3eadb;
  --line: #e0d0b0;
  --ink: #3a2c17;
  --ink-2: #5c4a2f;
  --muted: #86704d;
  --gold: #b3843a;
  --gold-deep: #8a6424;
  --gold-soft: #ead6a8;
  --gold-glow: rgba(179, 132, 58, .18);
  --ok: #5f8445;
  --ok-soft: #dfe8cf;
  --warn: #bb7a25;
  --bad: #a94a35;
  --bad-soft: #f2d5cb;
  --shadow: 0 1px 2px rgba(80, 55, 20, .06), 0 8px 24px rgba(80, 55, 20, .08);
  --shadow-lg: 0 24px 60px rgba(60, 40, 10, .22);
  --r: 18px;
  --serif: "Playfair Display", Georgia, serif;
  --sans: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --nav-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17130d; --surface: #241e15; --surface-2: #2d261b; --line: #3d3324;
    --ink: #f2e7d2; --ink-2: #dccdb0; --muted: #a8946f; --gold: #d6aa5c; --gold-deep: #e8c47f;
    --gold-soft: #4a3a1f; --gold-glow: rgba(214, 170, 92, .16);
    --ok: #9cc27d; --ok-soft: #2c3522; --warn: #e2a453; --bad: #e0876f; --bad-soft: #402520;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17130d; --surface: #241e15; --surface-2: #2d261b; --line: #3d3324;
  --ink: #f2e7d2; --ink-2: #dccdb0; --muted: #a8946f; --gold: #d6aa5c; --gold-deep: #e8c47f;
  --gold-soft: #4a3a1f; --gold-glow: rgba(214, 170, 92, .16);
  --ok: #9cc27d; --ok-soft: #2c3522; --warn: #e2a453; --bad: #e0876f; --bad-soft: #402520;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans); color: var(--ink); background: var(--bg);
  background-image: radial-gradient(1200px 600px at 100% -10%, var(--gold-glow), transparent 60%),
                    radial-gradient(900px 500px at -10% 110%, var(--gold-glow), transparent 60%);
  background-attachment: fixed; font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
body.locked { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
a { color: var(--gold-deep); }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; margin: 0; letter-spacing: .2px; }
.muted { color: var(--muted); }
.xs { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.grow { flex: 1; min-width: 0; }
.gold-t { color: var(--gold-deep); }
.boot { min-height: 100vh; display: grid; place-items: center; }
.short, .mob { display: none; }
[hidden] { display: none !important; }

/* ---------- crest ---------- */
.crest {
  width: 46px; height: 46px; border-radius: 50%; padding: 2px; flex: none; display: block;
  background: linear-gradient(145deg, #e8c77f, #9a6f2b); box-shadow: 0 6px 16px rgba(154,111,43,.35);
}
.crest img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; border: 2px solid var(--surface); }
.crest.big { width: 116px; height: 116px; padding: 3px; margin: 0 auto; box-shadow: 0 0 0 6px var(--gold-glow), 0 14px 34px rgba(154,111,43,.35); }
.crest.big img { border-width: 3px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand b { font-family: var(--serif); font-size: 19px; display: block; line-height: 1.1; }
.brand small { color: var(--muted); font-size: 12px; letter-spacing: 1.6px; text-transform: uppercase; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 256px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; padding: 24px 18px; display: flex; flex-direction: column; gap: 28px;
  border-right: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 70%, transparent); backdrop-filter: blur(8px);
}
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; text-decoration: none;
  color: var(--ink-2); font-weight: 500; transition: background .15s, color .15s;
}
.nav a svg { width: 20px; height: 20px; flex: none; }
.nav a:hover { background: var(--surface-2); }
.nav a.on { background: var(--gold-soft); color: var(--gold-deep); font-weight: 600; }
.side .me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: var(--surface-2); }
.side .me b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .me small { color: var(--muted); font-size: 12px; }
.main-col { min-width: 0; }
main { padding: 30px 36px 60px; max-width: 1180px; width: 100%; }
.topline { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.topline h1 { font-size: 30px; line-height: 1.2; }
.eyebrow { font-size: 12px; letter-spacing: 1.8px; text-transform: uppercase; color: var(--gold); font-weight: 600; margin-bottom: 6px; }
.sec-title { font-size: 20px; margin: 28px 0 14px; }
.mobile-top, .bottom-nav { display: none; }

/* ---------- bell ---------- */
.bell { position: relative; }
.badge {
  position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px;
  background: #c8412c; color: #fff; font-size: 11px; font-weight: 700; line-height: 19px; text-align: center;
  box-shadow: 0 0 0 2px var(--surface); font-family: var(--sans); animation: pop .25s;
}

/* ---------- cards ---------- */
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g2 { grid-template-columns: 1.35fr 1fr; }
.g2e { grid-template-columns: 1fr 1fr; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); min-width: 0; color: inherit; text-decoration: none; display: block; }
.card h3 { font-size: 18px; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card h3 .link { font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--gold-deep); text-decoration: none; background: none; border: 0; padding: 4px 0; }
.section { margin-top: 16px; }

.stat { position: relative; overflow: hidden; }
.stat .k { color: var(--muted); font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.stat .v { font-size: 25px; font-weight: 700; margin-top: 8px; letter-spacing: -.3px; white-space: nowrap; }
.stat .s { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.stat .ico { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); font-size: 15px; flex: none; }
.stat.hero { background: linear-gradient(150deg, #c89a4c 0%, #9c722e 100%); color: #fff9ec; border-color: transparent; }
.stat.hero .k, .stat.hero .s { color: rgba(255, 246, 225, .88); }
.stat.hero .ico { background: rgba(255,255,255,.18); }
.stat.hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; border: 22px solid rgba(255,255,255,.08); }
.hero-track { height: 5px; border-radius: 9px; background: rgba(255,255,255,.22); margin-top: 12px; overflow: hidden; }
.hero-track i { display: block; height: 100%; background: #fff4d9; border-radius: 9px; }
.pos { color: var(--ok); } .neg { color: var(--bad); }

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--surface);
  padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 14px; transition: transform .08s, background .15s; white-space: nowrap; text-decoration: none; color: var(--ink);
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.97); }
.btn.gold { background: linear-gradient(150deg, #c99c4f, #a0752f); color: #fff9ec; border-color: transparent; box-shadow: 0 6px 16px rgba(160,117,47,.3); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; padding: 13px; }
.btn svg { width: 18px; height: 18px; }
.btn:disabled { opacity: .5; pointer-events: none; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); flex: none; color: var(--ink-2); padding: 0; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.ghost { border-color: transparent; background: transparent; }
.icon-btn svg { width: 20px; height: 20px; }

label.f { display: block; margin-bottom: 14px; }
label.f > span { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.in {
  width: 100%; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); outline: none; transition: border .15s, box-shadow .15s;
  -webkit-appearance: none; appearance: none; min-height: 44px;
}
textarea.in { resize: vertical; min-height: 64px; font-family: inherit; }
.in:focus { border-color: var(--gold); box-shadow: 0 0 0 4px var(--gold-glow); background: var(--surface); }
.in.big { font-size: 30px; font-weight: 700; padding: 12px 16px; text-align: center; letter-spacing: -.5px; }
.title-in { font-size: 18px; font-weight: 600; padding: 13px 15px; }
.row { display: flex; gap: 12px; } .row > * { flex: 1; min-width: 0; }
.err { color: var(--bad); font-size: 13.5px; min-height: 20px; margin: 4px 0 8px; }

.fs { margin-bottom: 18px; }
.fs-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.fs-h span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.fs-h small { font-size: 12px; color: var(--muted); }

.seg { display: inline-flex; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 10px; font-weight: 600; font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg button:disabled { opacity: .4; }
.seg.full { display: flex; margin-top: 10px; } .seg.full button { flex: 1; }
#p-kind { margin: 0 0 14px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 5px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 13.5px; font-weight: 500; white-space: nowrap; flex: none; }
.chip.plain { padding: 7px 14px; }
.chip.on { background: var(--gold-soft); border-color: var(--gold); color: var(--gold-deep); font-weight: 600; }
.pick, .quick { display: flex; gap: 8px; flex-wrap: wrap; }
.pick button, .quick button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 8px 12px; font-size: 13.5px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex: none; }
.pick button.on { border-color: var(--gold); background: var(--gold-soft); color: var(--gold-deep); font-weight: 600; }
.quick { margin: 8px 0 16px; }
.quick button { background: transparent; border-style: dashed; color: var(--ink-2); padding: 6px 11px; font-size: 13px; }

/* ---------- avatar ---------- */
.av { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 16px; flex: none; background: var(--c, var(--gold-soft)); box-shadow: 0 0 0 2px var(--surface); line-height: 1; }
.av.none { background: var(--surface-2); color: var(--muted); font-weight: 700; font-size: 14px; border: 1px dashed var(--line); }
.av.lg { width: 46px; height: 46px; font-size: 23px; }
.av.xl { width: 64px; height: 64px; font-size: 32px; }
.av.sm { width: 24px; height: 24px; font-size: 13px; }
.av.xs { width: 20px; height: 20px; font-size: 11px; box-shadow: 0 0 0 1.5px var(--surface); }

/* ---------- month switch ---------- */
.month { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 4px; box-shadow: var(--shadow); }
.month b { min-width: 130px; text-align: center; font-weight: 600; }
.month button { width: 38px; height: 36px; border: 0; background: transparent; border-radius: 10px; font-size: 20px; color: var(--gold-deep); }
.month button:hover { background: var(--surface-2); }

/* ---------- tasks ---------- */
.group-h { display: flex; align-items: center; gap: 10px; margin: 22px 0 10px; font-weight: 600; color: var(--ink-2); font-size: 14px; }
.group-h .count { background: var(--surface-2); border: 1px solid var(--line); padding: 1px 9px; border-radius: 999px; font-size: 12px; color: var(--muted); }
.group-h.late { color: var(--bad); }
.tasks { display: flex; flex-direction: column; gap: 10px; }
.task {
  display: flex; align-items: center; gap: 14px; padding: 13px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); transition: transform .2s, opacity .25s;
}
.card .task { box-shadow: none; background: var(--surface-2); border-color: transparent; }
.task.late { box-shadow: inset 4px 0 0 var(--bad), var(--shadow); }
.card .task.late { box-shadow: inset 4px 0 0 var(--bad); }
.task.done-anim { opacity: 0; transform: translateX(30px); }
.check {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--gold); background: transparent; flex: none; display: grid; place-items: center; transition: background .15s, transform .15s; padding: 0;
}
.check:hover { background: var(--gold-glow); }
.check:active { transform: scale(.88); }
.check svg { width: 16px; height: 16px; opacity: 0; color: #fff; }
.check.on { background: var(--gold); } .check.on svg { opacity: 1; }
.task .body { flex: 1; min-width: 0; cursor: pointer; }
.task .t { font-weight: 600; line-height: 1.3; }
.task.is-done .t { text-decoration: line-through; color: var(--muted); }
.task .meta { display: flex; flex-wrap: wrap; gap: 5px 10px; margin-top: 5px; font-size: 12.5px; color: var(--muted); align-items: center; }
.task .right { display: flex; align-items: center; gap: 10px; flex: none; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.tag svg { width: 12px; height: 12px; }
.tag.gold { background: var(--gold-soft); border-color: transparent; color: var(--gold-deep); }
.pts { font-weight: 700; color: var(--gold-deep); font-size: 13px; white-space: nowrap; }

.series { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-top: 18px; }
.scard { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); cursor: pointer; transition: transform .15s; }
.scard:active { transform: scale(.99); }
.s-top { display: flex; gap: 12px; align-items: flex-start; }
.s-top b { display: block; font-size: 15.5px; }
.s-top small { color: var(--muted); font-size: 12.5px; }
.s-ico { width: 38px; height: 38px; border-radius: 12px; background: var(--gold-soft); color: var(--gold-deep); display: grid; place-items: center; flex: none; }
.s-ico svg { width: 20px; height: 20px; }
.s-bot { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.s-bot .xs { display: block; margin-bottom: 4px; }
.s-bot .next { text-align: right; }
.who { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 500; }
.rot { display: inline-flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.rot i { color: var(--muted); font-style: normal; font-size: 12px; }
.rot span { border-radius: 50%; padding: 2px; }
.rot span.cur { background: var(--gold); }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty.sm { padding: 26px 10px; }
.empty .big { font-size: 40px; margin-bottom: 8px; }

/* ---------- task modal ---------- */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.people button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px 8px; border-radius: 14px; border: 1.5px solid transparent; background: var(--surface-2); font-size: 12.5px; font-weight: 500; transition: border .15s, background .15s; }
.people button span:last-of-type { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people button.on { border-color: var(--gold); background: var(--gold-soft); color: var(--gold-deep); font-weight: 600; }
.people button.on .av { box-shadow: 0 0 0 2px var(--gold); }
.people .order { position: absolute; top: 5px; right: 6px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--gold); color: #fff; font-size: 11px; font-weight: 700; font-style: normal; display: grid; place-items: center; }
.people .order:empty { display: none; }
#rep-opts:not(:empty) { margin-top: 12px; }
.every { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; overflow: hidden; }
.stepper button { width: 42px; height: 42px; border: 0; background: transparent; font-size: 20px; color: var(--gold-deep); }
.stepper b { min-width: 34px; text-align: center; font-size: 16px; }
.stepper.sm button { width: 36px; height: 36px; }
.wdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.wdays button { height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 600; font-size: 13.5px; }
.wdays button.on { background: var(--gold); border-color: var(--gold); color: #fff; }
.summary { display: flex; flex-direction: column; gap: 6px; background: var(--gold-glow); border: 1px dashed var(--gold); border-radius: 14px; padding: 12px 14px; margin-bottom: 18px; font-size: 13.5px; color: var(--gold-deep); font-weight: 500; }
.summary span { display: flex; gap: 8px; align-items: center; }
.summary svg { width: 16px; height: 16px; flex: none; }
.row2 { display: flex; gap: 14px; align-items: flex-start; }

/* ---------- money ---------- */
.bars { display: flex; flex-direction: column; gap: 14px; }
.bar-row .top { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin-bottom: 6px; }
.bar-row .top .l { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bar-row .top .l span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .top .r { white-space: nowrap; font-weight: 600; }
.bar-row .top .r small { color: var(--muted); font-weight: 400; }
.track { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.track i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #d6ae65, #a97b33); }
.track i.over { background: linear-gradient(90deg, #d27c62, var(--bad)); }
.track i.warn { background: linear-gradient(90deg, #e2b064, var(--warn)); }

.ledger-h { margin: 30px 0 14px; align-items: center; }
.ledger-h h2 { font-size: 22px; }
.tx-day { margin-top: 18px; }
.tx-day .h { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); font-weight: 600; padding: 0 4px 8px; }
.tx-list { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); }
.tx { display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; border-top: 1px solid var(--line); }
.tx:first-child { border-top: 0; }
.tx:hover { background: var(--surface-2); }
.tx .cat { width: 42px; height: 42px; border-radius: 13px; background: var(--surface-2); display: grid; place-items: center; font-size: 20px; flex: none; }
.tx .mid { flex: 1; min-width: 0; }
.tx .mid b { display: block; font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx .mid small { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.tx .mid small span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx .amt { font-weight: 700; white-space: nowrap; }
.tx .amt.amt-in { color: var(--ok); }

.amount-box { text-align: center; margin-bottom: 4px; }
.amount-box small { display: block; margin-top: 6px; min-height: 18px; font-size: 13px; }
#f-tx .in.big { color: var(--bad); background: transparent; border-width: 0 0 2px; border-radius: 0; box-shadow: none; }
#f-tx.is-income .in.big { color: var(--ok); }
#f-tx .quick { justify-content: center; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.cat-grid button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 14px; border: 1.5px solid transparent; background: var(--surface-2); }
.cat-grid button span { font-size: 22px; line-height: 1; }
.cat-grid button small { font-size: 11.5px; line-height: 1.25; text-align: center; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cat-grid button.on { border-color: var(--gold); background: var(--gold-soft); }
.cat-grid button.on small { color: var(--gold-deep); font-weight: 600; }

.chart { width: 100%; display: block; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--sans); }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.donut-wrap { display: flex; align-items: center; gap: 22px; }
.donut-wrap svg { flex: none; }
.donut-wrap .bars { flex: 1; min-width: 0; }
.progress-ring { position: relative; display: grid; place-items: center; }
.progress-ring .c { position: absolute; text-align: center; }
.progress-ring .c b { font-size: 20px; display: block; }
.progress-ring .c small { font-size: 11px; color: var(--muted); }

/* ---------- family ---------- */
.member-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.mcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.mcard[data-act] { cursor: pointer; }
.mcard::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--c, var(--gold)); }
.mcard .hd { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.mcard .hd b { display: block; font-size: 15.5px; }
.mcard .hd small { color: var(--muted); font-size: 12.5px; }
.mcard .edit-ico { color: var(--muted); } .mcard .edit-ico svg { width: 18px; height: 18px; }
.mcard.off { opacity: .55; }
.mstats { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface-2); border-radius: 12px; }
.mstats div { padding: 9px 6px; text-align: center; }
.mstats div + div { border-left: 1px solid var(--line); }
.mstats span { display: block; font-size: 11.5px; color: var(--muted); }
.mstats b { font-size: 15px; display: inline-flex; align-items: center; gap: 4px; }
.late-dot { font-style: normal; background: var(--bad); color: #fff; font-size: 10px; min-width: 16px; height: 16px; border-radius: 8px; display: inline-grid; place-items: center; padding: 0 4px; }
.list-plain { display: flex; flex-direction: column; }
.list-plain > div { display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-top: 1px solid var(--line); min-height: 52px; }
.list-plain > div:first-child { border-top: 0; }
.list-plain .tap { cursor: pointer; }
.list-plain .tap:active { background: var(--surface-2); }
.list-plain.total { border-top: 2px solid var(--line); margin-top: 4px; }
.c-emo { font-size: 20px; width: 30px; text-align: center; flex: none; }
.mem-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.switch-row { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.switch-row input { width: 20px; height: 20px; accent-color: var(--gold); }
.add-member { margin-top: 12px; }

.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.emoji-grid button { aspect-ratio: 1; border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; font-size: 19px; padding: 0; }
.emoji-grid button.on { border-color: var(--gold); background: var(--gold-soft); box-shadow: 0 0 0 2px var(--gold-glow); }
.colors { display: flex; gap: 10px; flex-wrap: wrap; }
.colors button { width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent; padding: 0; }
.colors button.on { border-color: var(--ink); box-shadow: 0 0 0 3px var(--surface) inset; }

/* ---------- notifications ---------- */
.push-banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--gold-glow); border: 1px solid var(--gold-soft); margin-bottom: 14px; }
.push-banner.card-like { margin-bottom: 16px; }
.push-banner b { display: block; font-size: 14px; }
.push-banner small { display: block; font-size: 12.5px; color: var(--ink-2); margin-top: 1px; }
.pb-ico { width: 38px; height: 38px; border-radius: 12px; background: var(--gold); color: #fff; display: grid; place-items: center; flex: none; }
.pb-ico svg { width: 20px; height: 20px; }
.notifs { display: flex; flex-direction: column; margin: 0 -8px; }
.notif { display: flex; align-items: flex-start; gap: 12px; padding: 12px 10px; border: 0; background: transparent; text-align: left; border-radius: 14px; width: 100%; }
.notif:hover, .notif:active { background: var(--surface-2); }
.notif .n-ico { width: 40px; height: 40px; border-radius: 13px; background: var(--surface-2); display: grid; place-items: center; font-size: 19px; flex: none; }
.notif.unread .n-ico { background: var(--gold-soft); }
.notif b { display: block; font-weight: 500; font-size: 14px; line-height: 1.35; }
.notif.unread b { font-weight: 700; }
.notif small { display: block; color: var(--ink-2); font-size: 13px; margin-top: 2px; white-space: pre-line; }
.notif em { display: block; font-style: normal; color: var(--muted); font-size: 12px; margin-top: 3px; }
.notif .dot { width: 9px; height: 9px; border-radius: 50%; background: #c8412c; flex: none; margin-top: 8px; }
.h-actions { display: flex; align-items: center; gap: 6px; }

.chooser { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chooser button { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 22px 10px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface-2); font-size: 14.5px; }
.chooser button span { font-size: 34px; line-height: 1; }
.chooser button:active { transform: scale(.97); background: var(--gold-soft); }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(40, 28, 10, .45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); z-index: 50; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 22px; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; overscroll-behavior: contain; padding: 22px 24px 0; box-shadow: var(--shadow-lg); animation: pop .18s ease-out; border: 1px solid var(--line); transition: transform .15s; }
.modal > :last-child:not(form), .modal form { padding-bottom: 22px; }
.modal h2 { font-size: 22px; margin-bottom: 18px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.modal .actions { display: flex; gap: 10px; margin-top: 8px; align-items: center; }
.modal .actions.sticky { position: sticky; bottom: 0; background: var(--surface); padding: 12px 0 0; margin-top: 4px; border-top: 1px solid var(--line); }
.grab { display: none; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }

.toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 10px 12px 10px 18px; border-radius: 14px; z-index: 60; font-weight: 500; font-size: 14px; box-shadow: var(--shadow-lg); animation: pop .2s; max-width: calc(100vw - 32px); display: flex; align-items: center; gap: 10px; }
.toast-btn { background: transparent; border: 0; color: var(--gold-soft); font-weight: 700; padding: 4px 6px; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth .box { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 26px; padding: 36px 30px; box-shadow: var(--shadow-lg); text-align: center; }
.auth h1 { font-size: 28px; margin: 20px 0 4px; }
.auth p { color: var(--muted); margin: 0 0 24px; }
.auth form { text-align: left; }
.ornament { display: flex; align-items: center; gap: 10px; color: var(--gold); font-size: 12px; letter-spacing: 3px; justify-content: center; margin-top: 22px; }
.ornament::before, .ornament::after { content: ""; height: 1px; width: 50px; background: linear-gradient(90deg, transparent, var(--gold)); }
.ornament::after { transform: scaleX(-1); }

/* ---------- desktop FAB ---------- */
.fab {
  position: fixed; right: 28px; bottom: 28px; width: 60px; height: 60px; border-radius: 20px; border: 0; z-index: 30;
  background: linear-gradient(150deg, #cfa256, #9c712d); color: #fff9ec; box-shadow: 0 14px 30px rgba(156,113,45,.45); display: grid; place-items: center;
}
.fab svg { width: 28px; height: 28px; }
.fab:active { transform: scale(.95); }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .g4 { grid-template-columns: repeat(2, 1fr); }
  .g2, .g2e { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  body { font-size: 15px; }
  .shell { grid-template-columns: 1fr; }
  .side, .fab, .desk { display: none !important; }
  .mob { display: flex; }
  .full { display: none; } .short { display: inline; }
  main { padding: 6px 16px calc(var(--nav-h) + 34px + env(safe-area-inset-bottom)); }

  .mobile-top {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; position: sticky; top: 0; z-index: 35;
    padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
    background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
    border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  }
  .mobile-top .brand { gap: 10px; min-width: 0; }
  .mobile-top .brand b { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mobile-top .crest { width: 38px; height: 38px; }
  .mt-actions { display: flex; align-items: center; gap: 10px; }
  .me-link { text-decoration: none; display: grid; }
  .me-link .av { width: 36px; height: 36px; font-size: 19px; }

  .bottom-nav {
    display: grid; grid-template-columns: 1fr 1fr 72px 1fr 1fr; align-items: center; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding: 0 6px env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3);
    border-top: 1px solid var(--line); box-shadow: 0 -6px 24px rgba(80,55,20,.06);
  }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600; }
  .bottom-nav a svg { width: 24px; height: 24px; transition: transform .2s; }
  .bottom-nav a.on { color: var(--gold-deep); }
  .bottom-nav a.on svg { transform: translateY(-1px); stroke-width: 2.2; }
  .bn-add {
    width: 58px; height: 58px; margin: -26px auto 0; border-radius: 50%; border: 4px solid var(--bg); display: grid; place-items: center;
    background: linear-gradient(150deg, #d2a65a, #9c712d); color: #fff9ec; box-shadow: 0 10px 24px rgba(156,113,45,.45); padding: 0;
  }
  .bn-add svg { width: 26px; height: 26px; }
  .bn-add:active { transform: scale(.93); }

  .topline { margin: 10px 0 16px; gap: 12px; }
  .topline h1 { font-size: 26px; }
  .topline > .seg, .topline > .month { width: 100%; }
  .topline > .seg { display: flex; } .topline > .seg button { flex: 1; }
  .month { justify-content: space-between; }
  .ledger-h { flex-wrap: nowrap; } .ledger-h > .seg { width: auto; }
  .ledger-h > .seg button { flex: none; padding: 7px 11px; }
  .sec-title { font-size: 19px; margin: 24px 0 12px; }

  .card { padding: 16px; border-radius: 18px; }
  .grid { gap: 12px; }
  .stats.g4 { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stats .hero { grid-column: 1 / -1; padding: 18px; }
  .stats .hero .v { font-size: 30px; }
  .stats .stat:not(.hero) { padding: 12px 10px; }
  .stats .stat:not(.hero) .k { font-size: 11.5px; gap: 5px; flex-direction: column; align-items: flex-start; }
  .stats .stat:not(.hero) .ico { width: 26px; height: 26px; font-size: 13px; border-radius: 8px; }
  .stats .stat:not(.hero) .v { font-size: 18px; margin-top: 6px; }
  .stats .stat:not(.hero) .s { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  .scroll { flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none; margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; scroll-padding: 0 16px; }
  .scroll::-webkit-scrollbar { display: none; }
  .modal .scroll { margin-left: -18px; margin-right: -18px; padding-left: 18px; padding-right: 18px; }

  .task { gap: 12px; padding: 12px; }
  .check { width: 32px; height: 32px; }
  .task .right { flex-direction: column-reverse; gap: 4px; }
  .task .pts { font-size: 12px; }
  .series { grid-template-columns: 1fr; }

  .donut-wrap { flex-direction: column; align-items: stretch; }
  .donut-wrap .progress-ring { align-self: center; }
  .member-cards { grid-template-columns: 1fr 1fr; gap: 10px; }
  .mcard { padding: 14px 12px 12px; }
  .mcard .hd { flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
  .mcard .hd .av.lg { width: 42px; height: 42px; font-size: 21px; }
  .mcard .edit-ico { position: absolute; top: 14px; right: 12px; }
  .mstats div { padding: 7px 2px; }
  .mstats b { font-size: 14px; }
  .mstats span { font-size: 10.5px; }
  .tx { padding: 12px 14px; }

  .in, select.in, textarea.in { font-size: 16px; }
  .in.big { font-size: 34px; }
  .title-in { font-size: 18px; }

  .modal-bg { place-items: end center; padding: 0; }
  .modal {
    border-radius: 24px 24px 0 0; max-width: none; max-height: 94vh; max-height: 94dvh; padding: 6px 18px 0; border-width: 1px 0 0;
    animation: up .25s cubic-bezier(.2,.8,.3,1);
  }
  .modal > :last-child:not(form), .modal form { padding-bottom: max(18px, env(safe-area-inset-bottom)); }
  .modal .actions.sticky { padding-bottom: max(12px, env(safe-area-inset-bottom)); margin-bottom: calc(-1 * max(18px, env(safe-area-inset-bottom))); }
  .modal .actions .btn { padding: 12px 16px; }
  .modal .actions .btn.gold { flex: 1; max-width: 60%; }
  .grab { display: block; width: 42px; height: 5px; border-radius: 3px; background: var(--line); margin: 6px auto 12px; }
  .modal h2 { font-size: 21px; margin-bottom: 14px; }
  .people { grid-template-columns: repeat(4, 1fr); }
  .cat-grid { grid-template-columns: repeat(4, 1fr); }
  .toast { bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); }
  @keyframes up { from { transform: translateY(60%); } }
}
@media (max-width: 380px) {
  main { padding-left: 12px; padding-right: 12px; }
  .stats .stat:not(.hero) .v { font-size: 16px; }
  .people, .cat-grid { grid-template-columns: repeat(3, 1fr); }
  .month b { min-width: 104px; font-size: 14px; }
  .member-cards { grid-template-columns: 1fr; }
}

/* ---------- chia tiền ---------- */
.split-rows { display: flex; flex-direction: column; }
.sp-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.sp-row:first-child { border-top: 0; padding-top: 0; }
.sp-row b { display: block; font-size: 14.5px; }
.sp-row small { color: var(--muted); font-size: 12px; }
.bal { font-weight: 700; font-variant-numeric: tabular-nums; padding: 4px 10px; border-radius: 99px; background: var(--surface-2); font-size: 14px; white-space: nowrap; }
.bal.plus { background: var(--ok-soft); color: var(--ok); }
.bal.minus { background: var(--bad-soft); color: var(--bad); }
.settle { margin-top: 14px; padding-top: 14px; border-top: 2px dashed var(--line); }
.st-row { display: flex; align-items: center; gap: 6px; padding: 7px 0; font-size: 14px; flex-wrap: wrap; }
.st-row i { color: var(--muted); font-style: normal; margin: 0 2px; }
.st-row .amt { text-align: right; font-weight: 700; color: var(--gold-deep); }
.even { margin-top: 14px; padding: 12px; border-radius: 12px; background: var(--ok-soft); color: var(--ok); font-weight: 600; text-align: center; font-size: 14px; }
#f-tx.is-transfer .in.big { color: var(--gold-deep); }

/* ---------- nhà: sửa chữa ---------- */
.house-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.vendors { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; margin-top: 14px; }
.vcard { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.v-top { display: flex; gap: 12px; align-items: center; cursor: pointer; }
.v-top b { display: block; font-size: 15.5px; }
.v-top small { color: var(--muted); font-size: 12.5px; }
.v-ico { width: 44px; height: 44px; border-radius: 14px; background: var(--gold-soft); display: grid; place-items: center; font-size: 22px; flex: none; }
.v-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.v-title .v-ico { width: 38px; height: 38px; font-size: 19px; }
.v-note { font-size: 13px; color: var(--ink-2); background: var(--surface-2); padding: 8px 10px; border-radius: 10px; }
.v-meta { font-size: 12.5px; color: var(--muted); }
.v-act { display: flex; gap: 8px; flex-wrap: wrap; }
.v-act .btn svg { width: 16px; height: 16px; }
.v-act.big .btn { flex: 1; padding: 12px; }
.v-line { margin: 8px 0 0; font-size: 14px; color: var(--ink-2); }
.stars { color: var(--line); letter-spacing: 1px; }
.stars i { font-style: normal; } .stars i.on { color: #d9a441; }
.rate { display: flex; gap: 4px; }
.rate button { font-size: 30px; line-height: 1; border: 0; background: none; color: var(--line); padding: 2px 4px; }
.rate button.on { color: #d9a441; }

/* ---------- nhà: mật khẩu ---------- */
.vault-lock { max-width: 420px; margin: 20px auto; text-align: center; padding: 30px 24px; }
.vault-lock h3 { justify-content: center; margin: 14px 0 6px; }
.vault-lock p { margin: 0 0 18px; font-size: 14px; }
.vault-lock .in { margin-bottom: 4px; text-align: center; }
.vl-ico { width: 64px; height: 64px; margin: 0 auto; border-radius: 20px; background: linear-gradient(150deg, #c99c4f, #a0752f); color: #fff; display: grid; place-items: center; box-shadow: 0 10px 24px rgba(160,117,47,.35); }
.vl-ico svg { width: 32px; height: 32px; }
.vault-bar { display: flex; gap: 8px; align-items: center; }
.vault-bar .in { flex: 1; }
.vault-bar .btn { min-height: 44px; }
.vrow { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; border-top: 1px solid var(--line); }
.vrow:first-child { border-top: 0; }
.vrow .cat { width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; font-size: 19px; flex: none; }
.vrow .mid { flex: 1; min-width: 0; cursor: pointer; }
.vrow .mid b { display: block; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vrow .mid small { color: var(--muted); font-size: 12.5px; display: flex; gap: 6px; align-items: center; overflow: hidden; }
.vrow .mid small span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.secret { display: inline-block; margin-top: 5px; padding: 3px 8px; border-radius: 8px; background: var(--gold-soft); color: var(--gold-deep); font-size: 14px; word-break: break-all; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.v-btns { display: flex; gap: 6px; flex: none; }
.v-btns .icon-btn { width: 38px; height: 38px; font-size: 16px; }
.icon-btn.gold-i { background: var(--gold-soft); color: var(--gold-deep); border-color: transparent; }
.pw-row { display: flex; gap: 6px; }
.pw-row .in { flex: 1; }
.pw-row .icon-btn { width: 44px; height: 44px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .5px; }
.h-actions { font-family: var(--sans); }
.tx .mid small .tag { padding: 0 6px; font-size: 11px; }
@media (max-width: 820px) {
  .people { grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); }
  .vendors { grid-template-columns: 1fr; }
  .house-top .btn { flex: 1; }
  .house-top > .muted { width: 100%; text-align: center; }
  .desk-i { display: none; }
  .v-btns .icon-btn { width: 40px; height: 40px; }
  .vrow { padding-left: 12px; gap: 10px; }
  .vrow .cat { width: 36px; height: 36px; font-size: 17px; }
}
/* ---------- duyệt thu chi ---------- */
.pill { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 99px; font-size: 11px; font-weight: 700; white-space: nowrap; flex: none; }
.pill.wait { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.pill.gold { background: var(--gold-soft); color: var(--gold-deep); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.queue { margin-bottom: 16px; border-color: var(--gold-soft); box-shadow: 0 0 0 3px var(--gold-glow), var(--shadow); }
.count-pill { font-family: var(--sans); font-size: 12px; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: #c8412c; color: #fff; display: inline-grid; place-items: center; margin-left: 6px; }
.count-pill.gold { background: var(--gold); }
.card h3 .count-pill + .muted { margin-left: auto; font-family: var(--sans); font-weight: 600; }
.q-list { display: flex; flex-direction: column; }
.q-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.q-row:first-child { border-top: 0; padding-top: 2px; }
.q-row .cat { width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; font-size: 19px; flex: none; }
.q-row .mid { flex: 1; min-width: 0; }
.q-row .mid b { display: block; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-row .mid small { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; margin-top: 3px; flex-wrap: wrap; }
.q-reason { font-size: 12.5px; color: var(--bad); margin-top: 4px; }
.q-right { text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.q-right b { font-size: 15px; }
.q-acts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.q-banner { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 18px; margin-bottom: 16px; text-decoration: none; color: #fff9ec;
  background: linear-gradient(150deg, #b98a3e, #8e6526); box-shadow: 0 10px 24px rgba(142,101,38,.3); }
.q-banner.soft { background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow); }
.q-banner b { display: block; font-size: 15px; }
.q-banner small { display: block; font-size: 12.5px; opacity: .88; margin-top: 1px; }
.qb-ico { width: 40px; height: 40px; border-radius: 12px; background: rgba(255,255,255,.18); display: grid; place-items: center; font-size: 20px; flex: none; }
.q-banner.soft .qb-ico { background: var(--surface-2); }
.qb-go { font-size: 26px; opacity: .8; }
.hint { background: var(--surface-2); border: 1px dashed var(--line); border-radius: 12px; padding: 9px 12px; font-size: 13px; color: var(--ink-2); margin-bottom: 14px; }
.tx-status { display: flex; align-items: center; gap: 8px; margin: -8px 0 12px; flex-wrap: wrap; }
.row-acts { display: flex; gap: 6px; flex: none; }
.row-acts .icon-btn { width: 36px; height: 36px; }
.row-acts .icon-btn svg { width: 17px; height: 17px; }
.icon-btn.danger-i { color: var(--bad); }
.list-plain.cats > div { min-height: 56px; }
@media (max-width: 820px) {
  .q-row { flex-wrap: wrap; }
  .q-right { flex-direction: row; align-items: center; width: 100%; padding-left: 52px; justify-content: space-between; }
  .q-acts .btn { padding: 9px 14px; }
}
/* ---------- ảnh đại diện & hồ sơ ---------- */
.av.ini { color: #5a4526; font-weight: 700; font-size: 12px; letter-spacing: .3px; font-family: var(--sans); }
.av.lg.ini { font-size: 17px; } .av.xl.ini { font-size: 22px; } .av.sm.ini { font-size: 10px; } .av.xs.ini { font-size: 8.5px; }
.av.img { background: var(--surface-2); overflow: hidden; }
.av.img img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.av.xxl { width: 88px; height: 88px; font-size: 30px; box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--gold-soft); }
.mem-photo { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }
.ph-btns { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.ph-btns label.btn { cursor: pointer; }
.pf-head { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.pf-head h2 { font-size: 23px; }
.pf-quick { display: flex; gap: 8px; margin-top: 10px; }
.pf-quick .btn svg { width: 16px; height: 16px; }
.pf-sec { background: var(--surface-2); border-radius: 14px; padding: 4px 14px; margin-bottom: 12px; }
.pf-h { font-size: 11.5px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--gold); margin: 12px 0 6px; }
.pf-sec .pf-h { margin: 10px 0 2px; }
.pf-row { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.pf-sec .pf-h + .pf-row { border-top: 0; }
.pf-row span { color: var(--muted); flex: none; }
.pf-row b { font-weight: 600; text-align: right; word-break: break-word; }
.pf-row a { color: var(--gold-deep); text-decoration: none; }
.pf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.pf-grid label.f:has(textarea) { grid-column: 1 / -1; }
.mcard .edit-ico { font-size: 22px; line-height: 1; }
@media (max-width: 820px) {
  .pf-grid { grid-template-columns: 1fr; }
  .av.xxl { width: 76px; height: 76px; }
}
/* kho mật khẩu hiển thị đầy đủ */
.vcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.vcard2 { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px 14px 10px; box-shadow: var(--shadow); }
.vc-top { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.vc-top .cat { width: 40px; height: 40px; border-radius: 12px; background: var(--gold-soft); display: grid; place-items: center; font-size: 19px; flex: none; }
.vc-top b { font-size: 15.5px; margin-right: 8px; }
.vl { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px dashed var(--line); font-size: 14px; }
.vl span { color: var(--muted); width: 74px; flex: none; font-size: 13px; }
.vl b { flex: 1; min-width: 0; word-break: break-all; font-weight: 600; }
.vl b.mono { background: var(--surface-2); padding: 3px 8px; border-radius: 8px; font-size: 14.5px; }
.vl a { color: var(--gold-deep); text-decoration: none; }
.vl .icon-btn { width: 36px; height: 36px; }
.vl .icon-btn svg { width: 16px; height: 16px; }
.vnote { margin-top: 6px; padding: 8px 10px; background: var(--surface-2); border-radius: 10px; font-size: 13px; color: var(--ink-2); white-space: pre-line; }
@media (max-width: 820px) { .vcards { grid-template-columns: 1fr; } }
/* ---------- X lần/tuần & ảnh bằng chứng ---------- */
.dots { display: inline-flex; gap: 3px; vertical-align: middle; margin-right: 2px; }
.dots b { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--gold); display: block; }
.dots b.on { background: var(--gold); }
.wk { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; color: var(--gold-deep); }
.wk.neg { color: var(--bad); }
.proof { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 13px; color: var(--ink-2); }
.thumb { width: 64px; height: 64px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); padding: 0; flex: none; background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-full { width: 100%; border-radius: 14px; display: block; max-height: 75vh; object-fit: contain; background: var(--surface-2); }
.shot { display: block; border: 2px dashed var(--gold); border-radius: 18px; background: var(--gold-glow); cursor: pointer; margin-bottom: 16px; overflow: hidden; position: relative; }
.shot-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 34px 16px; font-size: 40px; text-align: center; }
.shot-empty b { font-size: 16px; color: var(--gold-deep); }
.shot-empty small { font-size: 13px; color: var(--muted); }
.shot.has { border-style: solid; background: var(--surface-2); }
.shot.has .shot-empty { padding: 0; font-size: 14px; }
.shot.has img { width: 100%; max-height: 50vh; object-fit: contain; display: block; }
.retake { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.55); color: #fff !important; padding: 5px 12px; border-radius: 99px; }
.proof-sw { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; margin: 0 0 14px; font-weight: 500; font-size: 14px; }
/* ---------- tổng quan: con người ---------- */
.center { text-align: center; }
.me-hero { background: linear-gradient(150deg, #c89a4c 0%, #94692a 100%); color: #fff9ec; border-radius: 22px; padding: 20px; box-shadow: 0 16px 34px rgba(148,105,42,.32); cursor: pointer; position: relative; overflow: hidden; }
.me-hero::after { content: ""; position: absolute; right: -50px; top: -60px; width: 180px; height: 180px; border-radius: 50%; border: 26px solid rgba(255,255,255,.07); }
.mh-top { display: flex; align-items: center; gap: 16px; position: relative; z-index: 1; }
.mh-top b { font-family: var(--serif); font-size: 24px; display: block; line-height: 1.15; }
.mh-top small { opacity: .88; font-size: 13px; }
.me-hero .av.xxl { box-shadow: 0 0 0 3px rgba(255,255,255,.85); }
.mh-rank { text-align: center; flex: none; }
.mh-rank span { font-size: 34px; font-weight: 800; display: block; line-height: 1; }
.mh-rank small { font-size: 11px; opacity: .85; }
.mh-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 18px; position: relative; z-index: 1; }
.mh-stats div { background: rgba(255,255,255,.14); border-radius: 14px; padding: 10px 8px; text-align: center; }
.mh-stats b { display: block; font-size: 24px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.mh-stats small { display: block; font-size: 11px; opacity: .9; margin-top: 3px; line-height: 1.25; }
.bday-banner { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 18px; margin-bottom: 14px; font-size: 30px;
  background: linear-gradient(120deg, #f6e2b8, #efc98a); color: #5a3d12; box-shadow: var(--shadow); }
.bday-banner b { display: block; font-size: 16px; } .bday-banner small { font-size: 13px; }
.late-note { color: var(--bad); font-size: 13px; font-weight: 600; margin: -6px 0 10px; }
.board { display: flex; flex-direction: column; gap: 4px; }
.b-row { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 14px; cursor: pointer; }
.b-row.me { background: var(--gold-glow); }
.b-rank { width: 28px; text-align: center; font-size: 20px; font-weight: 800; color: var(--muted); flex: none; }
.b-name { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 5px; font-size: 14.5px; }
.b-row small { color: var(--muted); font-size: 12px; display: block; margin-top: 4px; }
.bdays { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.bd-card { flex: 0 0 132px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px 10px; text-align: center; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; }
.bd-card b { font-size: 14px; margin-top: 6px; }
.bd-days { font-size: 30px; font-weight: 800; color: var(--gold-deep); line-height: 1.1; margin-top: 4px; }
.bd-card small { color: var(--muted); font-size: 12px; }
.bd-card em { font-style: normal; font-size: 11.5px; color: var(--ink-2); margin-top: 4px; }
.bd-card.soon { border-color: var(--gold); background: var(--gold-glow); }
.bd-card.today { background: linear-gradient(150deg, #f6e2b8, #efc98a); border-color: transparent; }
.people-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px; box-shadow: var(--shadow); cursor: pointer; position: relative; overflow: hidden; }
.pcard::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--c, var(--gold)); }
.pc-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.pc-top b { display: block; font-size: 15.5px; }
.pc-top small { color: var(--muted); font-size: 12.5px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-rank { font-size: 20px; font-weight: 800; color: var(--muted); }
.pc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pc-grid div { background: var(--surface-2); border-radius: 10px; padding: 7px 10px; }
.pc-grid span { display: block; font-size: 11px; color: var(--muted); }
.pc-grid b { font-size: 14px; }
@media (max-width: 820px) {
  .me-hero { padding: 16px; border-radius: 20px; }
  .mh-top b { font-size: 21px; }
  .mh-stats { gap: 6px; }
  .mh-stats b { font-size: 20px; }
  .mh-stats small { font-size: 10px; }
  .people-cards { grid-template-columns: 1fr; }
  .bdays { margin: 0 -16px; padding: 0 16px 4px; }
}
/* ---------- tối ưu điện thoại (vòng 2) ---------- */
.ptr { position: fixed; top: calc(8px + env(safe-area-inset-top)); left: 50%; transform: translate(-50%, 0); z-index: 45; width: 38px; height: 38px; border-radius: 50%;
  background: var(--surface); box-shadow: var(--shadow); display: grid; place-items: center; font-size: 20px; color: var(--gold-deep); opacity: 0; pointer-events: none; transition: opacity .15s; }
.ptr.ready { background: var(--gold); color: #fff; }
.ptr.spin { opacity: 1 !important; animation: ptrspin .7s linear infinite; }
@keyframes ptrspin { to { transform: translate(-50%, 50px) rotate(360deg); } }
@media (max-width: 820px) {
  html { scroll-padding-top: 70px; }
  .topline { margin: 6px 0 14px; }
  .topline h1 { font-size: 24px; }
  .eyebrow { font-size: 11px; letter-spacing: 1.5px; margin-bottom: 3px; }
  .sec-title { font-size: 18px; }
  .card h3 { font-size: 17px; margin-bottom: 12px; }
  /* hàng nút số tiền nhanh: cuộn ngang từ trái, không căn giữa */
  #f-tx .quick { justify-content: flex-start; }
  #f-tx .in.big { font-size: 38px; }
  /* dòng phụ trong sổ giao dịch / hàng chờ được xuống dòng thay vì bị cắt */
  .tx .mid small, .q-row .mid small { flex-wrap: wrap; row-gap: 4px; }
  .tx .mid small span { white-space: normal; }
  .tx .amt { font-size: 14.5px; }
  .tx .cat { width: 38px; height: 38px; font-size: 18px; }
  /* thẻ thành viên 2 cột */
  .mstats span { font-size: 10.5px; white-space: nowrap; }
  .mcard .hd small { font-size: 11.5px; }
  /* danh sách cài đặt: nút xuống dòng khi chật */
  .list-plain > div { flex-wrap: wrap; row-gap: 8px; }
  .list-plain > div > .seg { margin-left: auto; }
  .list-plain.cats > div { flex-wrap: nowrap; }
  .list-plain.cats .grow { font-size: 14px; line-height: 1.3; }
  .row-acts .icon-btn { width: 34px; height: 34px; }
  .card h3 .btn.sm { padding: 6px 10px; }
  /* thẻ việc gọn hơn */
  .task { padding: 11px 12px; border-radius: 15px; }
  .task .t { font-size: 14.5px; }
  .tag { font-size: 11.5px; }
  .group-h { margin: 18px 0 8px; }
  /* bảng xếp hạng & thẻ người */
  .b-row { padding: 8px 4px; gap: 10px; }
  .pc-grid b { font-size: 13.5px; }
  /* nút bấm trong modal đủ lớn để chạm */
  .modal .pick button, .modal .quick button { padding: 9px 13px; }
  .modal h2 { font-size: 20px; }
  .modal .row { gap: 10px; }
  .h-actions .btn.sm { padding: 6px 8px; }
  .vault-bar { position: sticky; top: calc(60px + env(safe-area-inset-top)); z-index: 5; background: var(--bg); padding: 6px 0; margin: 0 -2px; }
  .house-top { gap: 8px; }
  .v-act .btn { flex: 1; }
  .q-banner { padding: 12px 14px; }
}
@media (max-width: 360px) {
  .mh-stats { grid-template-columns: repeat(2, 1fr); }
  .member-cards { grid-template-columns: 1fr; }
  .cat-grid { grid-template-columns: repeat(3, 1fr); }
  .bottom-nav a { font-size: 10px; }
}
.list-plain > div > .grow > b { white-space: nowrap; }
@media (max-width: 380px) { .list-plain .seg button { padding: 7px 10px; font-size: 12.5px; } }

/* ---------- tổng quan trên điện thoại: không để chữ gãy dòng ---------- */
.mh-stats small, .q-banner b, .q-banner small, .push-banner b, .push-banner small, .mh-top small, .pc-top small, .pc-grid span, .pc-grid b, .b-name b, .b-row small, .bd-card em {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mh-top .grow, .q-banner .grow, .push-banner .grow { min-width: 0; }
.mh-top small { display: block; }
.mh-stats b .of { font-style: normal; font-size: .55em; opacity: .8; font-weight: 700; }
.mh-stats div { min-width: 0; }
@media (max-width: 820px) {
  .mh-top { gap: 12px; }
  .me-hero .av.xxl { width: 64px; height: 64px; font-size: 24px; }
  .mh-top b { font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mh-rank span { font-size: 28px; }
  .mh-stats { grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
  .mh-stats div { display: flex; align-items: baseline; gap: 8px; text-align: left; padding: 10px 12px; }
  .mh-stats b { font-size: 22px; flex: none; }
  .mh-stats small { margin: 0; font-size: 12px; }
  .push-banner { padding: 10px 12px; gap: 10px; }
  .push-banner .pb-ico { width: 34px; height: 34px; }
  .q-banner b { font-size: 14.5px; }
  .bday-banner { font-size: 26px; padding: 12px 14px; }
  .bday-banner b { font-size: 15px; }
  .b-name { font-size: 14px; }
  .pc-grid div { padding: 7px 9px; }
}
/* ghi chú công việc: ngay dưới tên việc */
.note-in { margin: -6px 0 10px; min-height: 42px; resize: none; font-size: 14px; background: var(--surface); line-height: 1.4; overflow: hidden; }
.t-note { font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.task.is-done .t-note { opacity: .75; }
@media (max-width: 820px) { .note-in { font-size: 16px; } }
/* 4 ô gọn: Tuổi · Sinh nhật · Ở nhà · Điểm */
.kv4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.kv4 > div { background: var(--surface-2); border-radius: 12px; padding: 8px 6px 7px; text-align: center; min-width: 0; }
.kv4 span { display: block; font-size: 10px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kv4 b { display: block; font-size: 19px; font-weight: 800; line-height: 1.15; margin-top: 3px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.kv4 b i { font-style: normal; font-size: 10.5px; font-weight: 600; margin-left: 2px; color: var(--muted); }
.kv4 .hot b, .kv4 .pts b { color: var(--gold-deep); }
.kv4.on-gold { margin-top: 16px; position: relative; z-index: 1; }
.kv4.on-gold > div { background: rgba(255,255,255,.15); }
.kv4.on-gold span, .kv4.on-gold b i { color: rgba(255,249,236,.8); }
.kv4.on-gold b, .kv4.on-gold .hot b, .kv4.on-gold .pts b { color: #fff9ec; font-size: 22px; }
.kv4.on-gold .hot { background: rgba(255,255,255,.28); }
@media (max-width: 380px) { .kv4 b { font-size: 17px; } .kv4.on-gold b { font-size: 19px; } .kv4 span { font-size: 9.5px; letter-spacing: .3px; } }.push-banner small { white-space: normal; }
@media (max-width: 400px) {
  .kv4 { gap: 4px; }
  .kv4 > div { padding: 7px 3px 6px; }
  .kv4 b, .kv4.on-gold b, .kv4.on-gold .hot b, .kv4.on-gold .pts b { font-size: 16px; }
  .kv4 b i { font-size: 9.5px; margin-left: 1px; }
  .kv4 span { font-size: 9px; letter-spacing: .2px; }
}
.nofn { font-style: italic; opacity: .75; }

/* ảnh bằng chứng: chụp hoặc tải lên */
.shot { cursor: default; margin-bottom: 10px; }
.shot-ico { font-size: 38px; line-height: 1; }
.shot.drag { border-style: solid; background: var(--gold-soft); }
.shot-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.shot-btns .btn { cursor: pointer; padding: 12px 10px; }