/* Sổ chi tiêu: giao diện một file CSS, không dùng thư viện. Sáng và tối theo máy. */
:root {
  --nen: #f4f6f8;
  --mat: #ffffff;
  --mat-2: #f0f2f5;
  --chu: #0f172a;
  --chu-2: #475569;
  --chu-3: #6b7686;
  --vien: #e3e7ec;
  --nhan: #0f766e;
  --nhan-nen: #e3f4f1;
  --tren-nhan: #ffffff;
  --thu: #15803d;
  --chi: #b42318;
  --canh-bao: #b45309;
  --canh-bao-nen: #fdf3e2;
  --bong: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .05);
  --bo: 16px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --nen: #0b0f14;
    --mat: #141a22;
    --mat-2: #1b222c;
    --chu: #e8edf3;
    --chu-2: #b3bdca;
    --chu-3: #8792a2;
    --vien: #252d38;
    --nhan: #2dd4bf;
    --nhan-nen: #10302d;
    --tren-nhan: #06231f;
    --thu: #4ade80;
    --chi: #ff8a7a;
    --canh-bao: #fbbf24;
    --canh-bao-nen: #33270c;
    --bong: 0 1px 2px rgba(0, 0, 0, .4);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--nen);
  color: var(--chu);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
.so { font-variant-numeric: tabular-nums; white-space: nowrap; }
.mo { color: var(--chu-3); }
.nho { font-size: 13px; }
[hidden] { display: none !important; }

/* Khung: thanh bên trên máy tính, thanh dưới trên điện thoại */
.khung { display: grid; grid-template-columns: 232px 1fr; min-height: 100dvh; }
.thanh {
  position: sticky; top: 0; height: 100dvh; padding: 20px 12px;
  border-right: 1px solid var(--vien); background: var(--mat);
  display: flex; flex-direction: column; gap: 4px;
}
.ten-app { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 700; font-size: 17px; }
.ten-app img { width: 28px; height: 28px; border-radius: 8px; }
.thanh a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  color: var(--chu-2); text-decoration: none; font-weight: 550;
}
.thanh a svg { width: 20px; height: 20px; flex: none; }
.thanh a:hover { background: var(--mat-2); }
.thanh a.dang-chon { background: var(--nhan-nen); color: var(--nhan); }
.huy-hieu {
  margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; text-align: center;
  background: var(--nhan); color: var(--tren-nhan); font-size: 12px; font-weight: 700;
}
.chinh { padding: 28px clamp(16px, 4vw, 40px) 96px; max-width: 1080px; width: 100%; margin: 0 auto; }
.dau-trang { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.dau-trang h1 { font-size: 24px; letter-spacing: -.02em; margin-right: auto; }

@media (max-width: 800px) {
  .khung { grid-template-columns: 1fr; }
  .thanh {
    position: fixed; inset: auto 0 0 0; height: auto; z-index: 20; flex-direction: row; gap: 0;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--vien);
  }
  .ten-app { display: none; }
  .thanh a { flex: 1; flex-direction: column; gap: 2px; padding: 6px 2px; font-size: 11px; position: relative; }
  .huy-hieu { position: absolute; top: 0; left: 54%; margin: 0; font-size: 10px; min-width: 18px; padding: 0 5px; }
  .chinh { padding: 18px 14px 110px; }
  .dau-trang h1 { font-size: 21px; }
}

/* Thẻ, lưới */
.the { background: var(--mat); border: 1px solid var(--vien); border-radius: var(--bo); box-shadow: var(--bong); padding: 18px; }
.the h2 { font-size: 15px; }
.the > h2 { margin-bottom: 12px; }
.luoi { display: grid; gap: 14px; }
.luoi-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.luoi-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }
.chong { display: grid; gap: 14px; }
.o-so .nhan { font-size: 13px; color: var(--chu-3); font-weight: 550; }
.o-so .gia-tri { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; }
.o-so .phu { font-size: 13px; color: var(--chu-3); margin-top: 2px; }

/* Nút, ô nhập */
.nut {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px;
  padding: 8px 16px; border-radius: 12px; border: 1px solid var(--vien); background: var(--mat); font-weight: 600;
}
.nut:hover { background: var(--mat-2); }
.nut.chinh-yeu { background: var(--nhan); border-color: var(--nhan); color: var(--tren-nhan); }
.nut.chinh-yeu:hover { filter: brightness(1.06); }
.nut.nguy { color: var(--chi); }
.nut.nho { min-height: 34px; padding: 4px 12px; font-size: 13px; border-radius: 10px; }
.nut:disabled { opacity: .55; cursor: default; }
input, select, textarea {
  width: 100%; min-height: 42px; padding: 8px 12px; border-radius: 12px;
  border: 1px solid var(--vien); background: var(--mat); outline: none;
}
input:focus, select:focus, textarea:focus, .nut:focus-visible, a:focus-visible { outline: 2px solid var(--nhan); outline-offset: 1px; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--chu-2); }
.hang { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.hang > * { flex: 1 1 140px; }
.loc { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.loc > * { flex: 1 1 130px; min-height: 40px; }
.loc input[type=search] { flex: 2 1 200px; }
.doan { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--mat-2); gap: 2px; }
.doan button { border: 0; background: none; padding: 7px 14px; border-radius: 9px; font-weight: 600; color: var(--chu-2); }
.doan button.dang-chon { background: var(--mat); color: var(--chu); box-shadow: var(--bong); }

/* Danh sách giao dịch */
.ds { display: grid; }
.ngay-nhom { padding: 14px 4px 6px; font-size: 12px; font-weight: 700; color: var(--chu-3); text-transform: uppercase; letter-spacing: .04em; }
.gd {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; width: 100%; text-align: left;
  padding: 11px 6px; border: 0; border-top: 1px solid var(--vien); background: none; border-radius: 0;
}
.ds .gd:first-child, .ngay-nhom + .gd { border-top: 0; }
button.gd:hover { background: var(--mat-2); }
.bieu-tuong { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--mat-2); color: var(--chu-2); font-weight: 700; }
.gd .ten { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gd .phu { font-size: 13px; color: var(--chu-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gd .giua { min-width: 0; }
.gd .ten, .gd .phu { display: block; }
.gd .tien .phu { font-weight: 500; }
.the > .gd:first-child { border-top: 0; }
.gd .tien { text-align: right; font-weight: 650; }
.tien.thu { color: var(--thu); }
.nhan-nho { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 650; background: var(--mat-2); color: var(--chu-2); }
.nhan-nho.cho { background: var(--canh-bao-nen); color: var(--canh-bao); }
.nhan-nho.xong { background: var(--nhan-nen); color: var(--nhan); }
.duyet-hang { display: flex; gap: 8px; padding: 0 6px 12px 58px; flex-wrap: wrap; }
.duyet-hang select { flex: 1 1 160px; min-height: 36px; padding: 4px 10px; }
.trong { padding: 36px 12px; text-align: center; color: var(--chu-3); }

/* Thanh ngang chi theo danh mục: một màu, độ dài là số tiền */
.thanh-ngang { display: grid; gap: 10px; }
.tn { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; gap: 10px; align-items: center; font-size: 14px; }
.tn .ten { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tn .ray { height: 10px; }
.tn .cot { height: 10px; min-width: 3px; border-radius: 0 4px 4px 0; background: var(--nhan); }
.tn:hover .cot { filter: brightness(1.15); }

/* Tài khoản */
.tk { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 12px 6px; border: 0; border-top: 1px solid var(--vien); background: none; width: 100%; text-align: left; }
.tk:first-of-type { border-top: 0; }
button.tk:hover { background: var(--mat-2); }

/* Tấm trượt (sửa, thêm) */
.man-phu { position: fixed; inset: 0; background: rgba(8, 12, 18, .5); z-index: 40; display: grid; place-items: end center; }
.tam {
  width: min(560px, 100%); max-height: 92dvh; overflow: auto; background: var(--mat);
  border-radius: 22px 22px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); display: grid; gap: 14px;
}
@media (min-width: 801px) { .man-phu { place-items: center; } .tam { border-radius: 22px; } }
.tam h2 { font-size: 18px; }
.tam .chan { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
.tam .chan .trai { margin-right: auto; }
.kiem { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.kiem input { width: 18px; min-height: 18px; margin-top: 2px; flex: none; }

.noi { position: fixed; right: 20px; bottom: 24px; z-index: 30; width: 56px; height: 56px; border-radius: 18px; border: 0;
  background: var(--nhan); color: var(--tren-nhan); font-size: 30px; line-height: 1; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
@media (max-width: 800px) { .noi { bottom: calc(78px + env(safe-area-inset-bottom)); right: 16px; } }
.bao { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); z-index: 60; background: var(--chu); color: var(--nen);
  padding: 10px 16px; border-radius: 12px; font-weight: 600; max-width: 90vw; }
.dai-bao { padding: 10px 14px; border-radius: 12px; background: var(--canh-bao-nen); color: var(--canh-bao); font-weight: 550; margin-bottom: 14px; }

/* Đăng nhập */
.dang-nhap { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.dang-nhap .the { width: min(400px, 100%); display: grid; gap: 14px; padding: 28px 24px; }
.dang-nhap img { width: 56px; height: 56px; border-radius: 16px; }
.dang-nhap h1 { font-size: 22px; }
