/* Chuối Chiên Cô Minh — design system: vàng chuối, nền kem, thẻ trắng, chữ nâu. Không gradient. */
:root {
  --vang: #F5B800;
  --vang-dam: #C99500;
  --vang-nhat: #FFF3C4;
  --kem: #FFFAEE;
  --trang: #FFFFFF;
  --nau: #3B2A1A;
  --nau-vua: #6E5A45;
  --nau-nhat: #9C8A76;
  --vien: #EFE3CB;
  --xanh: #23894F;
  --xanh-nhat: #E3F4EA;
  --do: #C93A36;
  --do-nhat: #FBE7E6;
  --cam: #D9790A;
  --cam-nhat: #FDEFD9;
  --bo: 14px;
  --bo-nho: 10px;
  --bong: 0 1px 2px rgba(59, 42, 26, .06), 0 2px 8px rgba(59, 42, 26, .05);
  --nav-cao: 64px;
  --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--nau); background: var(--kem); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 1.1rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 600; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.so, .tien { font-variant-numeric: tabular-nums; }
.mo { color: var(--nau-nhat); font-size: .875rem; }
.nho { font-size: .8125rem; }

/* ---------- Khung ---------- */
.ung-dung { min-height: 100vh; min-height: 100dvh; }
.thanh-ben { display: none; }
.khung-chinh { min-width: 0; }
.dau-trang { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px; padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top)); background: var(--kem); border-bottom: 1px solid var(--vien); }
.dau-trang h1 { font-size: 1.15rem; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nguoi-dung { font-size: .8125rem; color: var(--nau-vua); white-space: nowrap; }
.nut-quay-lai { border: 0; background: none; font-size: 1.8rem; line-height: 1; padding: 0 8px 4px 0; cursor: pointer; }
main { padding: 16px; padding-bottom: calc(var(--nav-cao) + 24px + env(safe-area-inset-bottom)); max-width: 1200px; outline: none; }

.thanh-duoi { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-cao) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--trang); border-top: 1px solid var(--vien); }
.thanh-duoi a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none;
  font-size: .72rem; font-weight: 500; color: var(--nau-nhat); }
.thanh-duoi a .bt { font-size: 1.3rem; line-height: 1; }
.thanh-duoi a.dang-mo { color: var(--nau); }
.thanh-duoi a.dang-mo .bt { background: var(--vang-nhat); border-radius: 999px; padding: 2px 14px; }

@media (min-width: 900px) {
  .ung-dung { display: grid; grid-template-columns: 232px 1fr; }
  .thanh-ben { display: block; position: sticky; top: 0; height: 100vh; padding: 16px 12px; background: var(--trang); border-right: 1px solid var(--vien); overflow-y: auto; }
  .thuong-hieu { display: flex; align-items: center; gap: 10px; font-weight: 700; padding: 4px 8px 16px; }
  .thanh-ben nav a { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: var(--bo-nho); text-decoration: none; color: var(--nau-vua); font-weight: 500; }
  .thanh-ben nav a:hover { background: var(--kem); }
  .thanh-ben nav a.dang-mo { background: var(--vang-nhat); color: var(--nau); }
  .thanh-ben nav .nhom { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--nau-nhat); padding: 16px 12px 4px; }
  .thanh-duoi { display: none; }
  main { padding: 24px 32px 48px; }
  .dau-trang { padding: 16px 32px; }
}

/* ---------- Thẻ & lưới ---------- */
.the { background: var(--trang); border: 1px solid var(--vien); border-radius: var(--bo); padding: 16px; box-shadow: var(--bong); }
.the + .the, .phan + .phan { margin-top: 12px; }
.phan { margin-top: 20px; }
.phan > h2 { margin-bottom: 10px; }
.luoi { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.luoi-1 { display: grid; gap: 12px; }
@media (min-width: 640px) { .luoi { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .luoi.luoi-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .hai-cot { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; } .hai-cot .phan { margin-top: 0; } }
.chi-so { padding: 14px; }
.chi-so .nhan { font-size: .8125rem; color: var(--nau-vua); }
.chi-so .gia-tri { font-size: clamp(1.02rem, 4.4vw, 1.35rem); font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chi-so .phu { font-size: .75rem; color: var(--nau-nhat); margin-top: 2px; }
.chi-so.lon { grid-column: 1 / -1; background: var(--vang-nhat); border-color: #F2DE95; }
.chi-so.lon .gia-tri { font-size: 1.9rem; }

.hang { display: flex; align-items: center; gap: 12px; }
.hang > .gian { flex: 1; min-width: 0; }
.danh-sach { list-style: none; margin: 0; padding: 0; }
.danh-sach > li { padding: 12px 0; border-bottom: 1px solid var(--vien); }
.danh-sach > li:last-child { border-bottom: 0; }
.danh-sach a.dong { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.cham { width: 10px; height: 10px; border-radius: 999px; flex: none; background: var(--nau-nhat); }
.cham.du { background: var(--xanh); } .cham.sap_het { background: var(--cam); } .cham.het, .cham.am { background: var(--do); }
.the-nhan { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--kem); color: var(--nau-vua); white-space: nowrap; }
.the-nhan.xanh { background: var(--xanh-nhat); color: var(--xanh); }
.the-nhan.do { background: var(--do-nhat); color: var(--do); }
.the-nhan.cam { background: var(--cam-nhat); color: var(--cam); }
.the-nhan.vang { background: var(--vang-nhat); color: var(--nau); }
.ten-dai { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Nút ---------- */
.nut { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 18px; border-radius: 12px;
  border: 1px solid var(--vien); background: var(--trang); font-weight: 600; cursor: pointer; text-decoration: none; touch-action: manipulation; }
.nut:active { transform: translateY(1px); }
.nut.chinh { background: var(--vang); border-color: var(--vang-dam); color: var(--nau); }
.nut.chinh:hover { background: #FFC61A; }
.nut.nguy-hiem { color: var(--do); border-color: #F1C4C2; }
.nut.rong { width: 100%; }
.nut.nho { min-height: 36px; padding: 6px 12px; font-size: .875rem; border-radius: 10px; }
.nut:disabled { opacity: .55; cursor: not-allowed; }
.nut:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid #FFD54A; outline-offset: 2px; }
.nhom-nut { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .nhom-nut { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.nut-lon { flex-direction: column; min-height: 84px; font-size: .9rem; text-align: center; }
.nut-lon .bt { font-size: 1.5rem; }
.chip { display: inline-flex; align-items: center; min-height: 36px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--vien); background: var(--trang);
  font-size: .875rem; font-weight: 500; cursor: pointer; white-space: nowrap; }
.chip.dang-chon { background: var(--nau); color: #fff; border-color: var(--nau); }
.hang-chip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.hang-chip::-webkit-scrollbar { display: none; }
.tab { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--trang); border: 1px solid var(--vien); border-radius: 12px; padding: 4px; gap: 4px; }
.tab button { border: 0; background: none; min-height: 40px; border-radius: 9px; font-weight: 600; color: var(--nau-vua); cursor: pointer; }
.tab button.dang-chon { background: var(--vang-nhat); color: var(--nau); }

/* ---------- Form ---------- */
.truong { display: grid; gap: 6px; margin-bottom: 14px; }
.truong > label, .nhan-truong { font-size: .875rem; font-weight: 600; color: var(--nau-vua); }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid #E2D3B4; border-radius: 10px; background: var(--trang); font-size: 16px; }
textarea { min-height: 80px; resize: vertical; }
.goi-y-loi { color: var(--do); font-size: .875rem; }
.hang-truong { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dong-phieu { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--vien); border-radius: 12px; background: var(--kem); margin-bottom: 10px; }
.dong-phieu .hang-truong { grid-template-columns: 1fr 1fr; }
.dong-phieu .xoa { justify-self: end; }
.thanh-hanh-dong { position: sticky; bottom: calc(var(--nav-cao) + env(safe-area-inset-bottom)); margin: 16px -16px 0; padding: 12px 16px;
  background: rgba(255, 250, 238, .96); border-top: 1px solid var(--vien); z-index: 5; }
@media (min-width: 900px) { .thanh-hanh-dong { bottom: 0; margin: 16px 0 0; border: 1px solid var(--vien); border-radius: var(--bo); } }
.tong-ket { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.tong-ket .tien { font-size: 1.25rem; font-weight: 700; }

/* ---------- Chốt ngày ---------- */
.chon-ngay { display: flex; align-items: center; gap: 8px; }
.chon-ngay input { flex: 1; text-align: center; font-weight: 600; }
.chon-ngay .nut { min-width: 48px; padding: 0; }
.mon { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--vien); }
.mon:last-child { border-bottom: 0; }
.mon .ten { font-weight: 600; min-width: 0; }
.mon .gia { font-size: .8125rem; color: var(--nau-nhat); }
.mon .thanh-tien { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.bo-dem { display: grid; grid-template-columns: 52px 1fr 52px; gap: 8px; grid-column: 1 / -1; }
.bo-dem button { min-height: 52px; border-radius: 12px; border: 1px solid var(--vien); background: var(--kem); font-size: 1.4rem; font-weight: 700; cursor: pointer; touch-action: manipulation; }
.bo-dem input { text-align: center; font-size: 1.35rem; font-weight: 700; min-height: 52px; }
.mon.co-so .bo-dem input { border-color: var(--vang-dam); background: var(--vang-nhat); }
.mon .canh-bao-nho { grid-column: 1 / -1; }
.o-tien { display: grid; grid-template-columns: 1fr 1.2fr; gap: 10px; align-items: center; margin-bottom: 10px; }
.o-tien input { text-align: right; font-weight: 700; font-size: 1.1rem; }
.doi-chieu { display: grid; gap: 4px; padding: 12px; border-radius: 12px; background: var(--kem); }
.doi-chieu .hang { justify-content: space-between; }
.hop-canh-bao { padding: 12px; border-radius: 12px; background: var(--cam-nhat); color: #7A4300; font-size: .9rem; }
.hop-canh-bao.do { background: var(--do-nhat); color: #8A1F1C; }
.hop-canh-bao.xanh { background: var(--xanh-nhat); color: #145232; }
details.mo-rong { border: 1px solid var(--vien); border-radius: 12px; background: var(--trang); margin-top: 12px; }
details.mo-rong > summary { padding: 14px 16px; cursor: pointer; font-weight: 600; list-style: none; }
details.mo-rong > summary::before { content: '▸ '; }
details.mo-rong[open] > summary::before { content: '▾ '; }
details.mo-rong > div { padding: 0 16px 16px; }
.trang-thai-gui { font-size: .875rem; font-weight: 600; text-align: center; margin-top: 8px; }

/* ---------- Biểu đồ ---------- */
.bieu-do { width: 100%; max-width: 560px; height: auto; display: block; }
.bieu-do text { font-family: var(--font); font-size: 11px; fill: var(--nau-nhat); }
.chu-thich { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8125rem; color: var(--nau-vua); margin-top: 6px; }
.chu-thich i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.thanh-ngang { display: grid; gap: 8px; }
.thanh-ngang .dong { display: grid; grid-template-columns: minmax(0, 1.2fr) 2fr auto; gap: 8px; align-items: center; font-size: .875rem; }
.thanh-ngang .ray { height: 12px; background: var(--kem); border-radius: 6px; overflow: hidden; }
.thanh-ngang .ray span { display: block; height: 100%; background: var(--vang); border-radius: 6px; }

/* ---------- Bảng (desktop) / thẻ (mobile) ---------- */
.bang-wrap { overflow-x: auto; border: 1px solid var(--vien); border-radius: var(--bo); background: var(--trang); }
table.bang { width: 100%; border-collapse: collapse; font-size: .875rem; }
.bang th, .bang td { padding: 10px 12px; border-bottom: 1px solid var(--vien); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bang th:first-child, .bang td:first-child, .bang .trai { text-align: left; }
.bang th { background: var(--kem); font-weight: 600; color: var(--nau-vua); position: sticky; top: 0; }
.bang tr:last-child td { border-bottom: 0; }
.bang tfoot td { font-weight: 700; background: var(--kem); }
.am-so { color: var(--do); }
.chi-mobile { display: block; }
.chi-desktop { display: none; }
@media (min-width: 900px) { .chi-mobile { display: none; } .chi-desktop { display: block; } }
.the-dong { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 0; border-bottom: 1px solid var(--vien); font-size: .9rem; }
.the-dong:last-child { border-bottom: 0; }
.the-dong .phai { text-align: right; font-variant-numeric: tabular-nums; }
.the-dong .ca-dong { grid-column: 1 / -1; }

/* ---------- Đăng nhập ---------- */
.dang-nhap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.dang-nhap .the { width: 100%; max-width: 380px; padding: 28px 20px; }
.dang-nhap .logo { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 20px; text-align: center; }

/* ---------- Thông báo, khung xương ---------- */
.thong-bao { position: fixed; left: 16px; right: 16px; bottom: calc(var(--nav-cao) + 16px + env(safe-area-inset-bottom)); z-index: 50; display: grid; gap: 8px; pointer-events: none; }
@media (min-width: 900px) { .thong-bao { left: auto; right: 24px; bottom: 24px; width: 380px; } }
.thong-bao > div { padding: 12px 16px; border-radius: 12px; background: var(--nau); color: #fff; box-shadow: 0 6px 20px rgba(0,0,0,.18); font-size: .925rem; pointer-events: auto; }
.thong-bao > .loi { background: var(--do); }
.thong-bao > .tot { background: var(--xanh); }
.xuong { background: #F4EAD6; animation: xuong 1.2s infinite ease-in-out alternate; border-radius: 10px; min-height: 16px; }
@keyframes xuong { to { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .xuong { animation: none; } }
.rong-trong { text-align: center; padding: 28px 12px; color: var(--nau-nhat); }
.bo-loc { display: grid; gap: 10px; margin-bottom: 12px; }
.khoang-ngay { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
