:root {
  --red: #d9161c; --red-deep: #a80f14; --yellow: #ffcb05; --amber: #f9a11b;
  --bg: #fff8e6; --surface: #fff; --ink: #2b1810; --muted: #7a5a4a; --line: #f0dfb8;
  --ok: #157a3c; --ok-bg: #e3f5e8; --fresh: #fff1a8; --warn-bg: #fde3e3;
  color-scheme: light dark;
  font-family: "Be Vietnam Pro", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #1c0b09; --surface: #2a1411; --ink: #fbeedd; --muted: #c9a99a; --line: #4a2419; --ok: #6fdc95; --ok-bg: #12351f; --fresh: #5a4300; --warn-bg: #4a1212; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); min-height: 100vh; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .6rem max(.9rem, env(safe-area-inset-left)); background: var(--red); color: #fff; box-shadow: 0 2px 0 var(--red-deep); }
.brand { white-space: nowrap; display: flex; align-items: center; gap: .5rem; font-weight: 900; font-style: italic; font-size: 1.2rem; letter-spacing: .02em; }
.top-right { display: flex; align-items: center; gap: .6rem; min-width: 0; }
@media (max-width: 520px) { .me { display: none; } }
.me { font-size: .8rem; opacity: .9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 9rem; }
.chip { white-space: nowrap; border: 0; border-radius: 999px; padding: .35rem .75rem; background: rgba(255,255,255,.18); color: #fff; font-size: .85rem; font-weight: 700; }
.chip[aria-pressed="true"] { background: var(--yellow); color: #2b1810; }

.banner { margin: 0; padding: .75rem 1rem; background: var(--warn-bg); color: var(--ink); border-bottom: 3px solid var(--red); font-weight: 700; }
.banner.ok { background: var(--ok-bg); border-color: var(--ok); }

main { max-width: 760px; margin: 0 auto; padding: .75rem .75rem 4rem; }
.toolbar { position: sticky; top: 3.1rem; z-index: 4; background: var(--bg); padding: .25rem 0 .5rem; }
#q { width: 100%; font-size: 1.1rem; padding: .75rem 1rem; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); }
#q:focus { border-color: var(--amber); outline: none; }
.row { display: flex; gap: .5rem; align-items: center; justify-content: space-between; margin-top: .5rem; flex-wrap: wrap; }
#day { font: inherit; font-size: .9rem; padding: .4rem .5rem; border-radius: 10px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); }
.summary { margin: 0 .25rem; color: var(--muted); font-size: .95rem; font-weight: 600; }

.list { list-style: none; margin: .25rem 0 0; padding: 0; display: grid; gap: .6rem; }
.card { background: var(--surface); border: 2px solid var(--line); border-radius: 16px; padding: .8rem .9rem; transition: background-color 1s; }
.card.fresh { background: var(--fresh); border-color: var(--yellow); animation: pop .5s ease-out; }
@keyframes pop { from { transform: scale(.97); } to { transform: none; } }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.amount { font-size: 1.9rem; font-weight: 900; color: var(--red-deep); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
@media (prefers-color-scheme: dark) { .amount { color: var(--yellow); } }
.when { text-align: right; display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }
.clock { font-weight: 800; font-size: 1.05rem; }
.ago { color: var(--muted); }
.who { margin: .2rem 0 0; font-weight: 700; }
.who .bank { font-weight: 400; color: var(--muted); }
.content { margin: .35rem 0 0; font-size: 1.1rem; word-break: break-word; }
.content mark { background: var(--yellow); color: #2b1810; border-radius: 4px; padding: 0 .2em; }
.raw { margin: .25rem 0 0; color: var(--muted); font-size: .78rem; word-break: break-all; }


.empty { text-align: center; color: var(--muted); padding: 2rem 0; }
.foot { position: fixed; bottom: 0; left: 0; right: 0; padding: .4rem 1rem calc(.4rem + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); font-size: .85rem; color: var(--muted); text-align: center; }
.foot.bad { color: #fff; background: var(--red); }



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

/* ---------- đăng nhập ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); display: grid; gap: 10px; padding: 24px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); text-align: center; }
.login-card img { justify-self: center; }
.login-card h1 { font-size: 1.15rem; margin: 0 0 6px; }
.login-card label { text-align: left; font-weight: 600; font-size: 0.95rem; }
.login-card input { font: inherit; font-size: 1.05rem; padding: 12px; border-radius: 10px; border: 1px solid var(--muted); background: var(--surface); color: var(--ink); min-height: 44px; }
.login-card button { font: inherit; font-weight: 700; padding: 12px; min-height: 44px; border: 0; border-radius: 10px; background: var(--red); color: #fff; cursor: pointer; }
.login-card button:disabled { opacity: 0.6; cursor: not-allowed; }
.login-msg { color: var(--red); min-height: 1.2em; margin: 0; font-weight: 600; }
.login-note { font-size: 0.85rem; color: var(--muted); margin: 0; }
@media (prefers-color-scheme: dark) { .login-msg { color: #ff8a8f; } }
