/* App Khai báo – vàng đồng trên nền đen. Chữ ≥ 16 px, nút ≥ 48 px, tương phản ≥ 4,5 : 1. Phông hệ thống (không tải mạng ngoài). */
:root {
  --nen: #141414;
  --the: #1f1f1f;
  --the2: #2a2a2a;
  --vang: #c9a35a;
  --vang-sang: #e6c784;
  --chu: #f5f1e6;
  --chu-nhat: #c9c2b3;
  --xanh: #3fae6a;
  --cam: #e0a030;
  --do: #e05a4a;
  --do-chu: #f08f82;
  --xam: #9a958b;
  --vien: #3a3630;
  --duoi: 76px;
  --phong: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--nen); color: var(--chu);
  font-family: var(--phong); font-size: 18px; line-height: 1.45;
  overflow-x: hidden; overflow-wrap: anywhere; word-break: break-word;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: env(safe-area-inset-bottom);
}
body.co-duoi { padding-bottom: calc(var(--duoi) + env(safe-area-inset-bottom) + 12px); }
img { max-width: 100%; }
h1 { font-size: 24px; line-height: 1.25; margin: 8px 0 12px; color: var(--vang-sang); }
p { margin: 8px 0; }

/* ---------- Đầu trang ---------- */
#dau {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top));
  background: #0d0d0d; border-bottom: 1px solid var(--vien); position: sticky; top: 0; z-index: 5;
}
.dau-logo { width: 44px; height: auto; flex: none; }
.dau-chu-logo { width: 150px; height: auto; flex: none; }

/* ---------- Thanh báo ---------- */
#bao:empty { display: none; }
#bao { padding: 8px 12px 0; }
.bao {
  display: block; width: 100%; border-radius: 10px; padding: 12px 14px; margin: 0 0 8px; font-size: 17px; font-weight: 600;
  border: 0; text-align: left; font-family: inherit; color: var(--nen);
}
.bao.to { font-size: 20px; padding: 16px; text-align: center; }
.bao-vang { background: var(--cam); }
.bao-do { background: var(--do); }
.bao-xanh { background: var(--xanh); }
.bao-moi { background: var(--vang-sang); min-height: 52px; cursor: pointer; }

/* ---------- Khung màn ---------- */
main { padding: 12px; max-width: 640px; margin: 0 auto; }
.man { display: flex; flex-direction: column; gap: 12px; }
.trong { color: var(--chu-nhat); text-align: center; padding: 24px 8px; }
.nho { font-size: 16px; color: var(--chu-nhat); }
.nhat { color: var(--chu-nhat); }
.loi { color: var(--do-chu); font-weight: 600; font-size: 17px; }
.loi:empty { display: none; }

.the {
  display: block; width: 100%; background: var(--the); border: 1px solid var(--vien); border-radius: 14px; padding: 14px;
  color: var(--chu); text-align: left; font: inherit;
}
button.the { cursor: pointer; }
button.the:active { background: var(--the2); }
.the-con { background: var(--the2); border-radius: 10px; padding: 10px; margin: 8px 0; display: flex; flex-direction: column; gap: 6px; }

/* ---------- Nút ---------- */
.nut {
  display: block; width: 100%; min-height: 52px; padding: 12px 16px; border-radius: 12px; border: 2px solid var(--vang);
  font: inherit; font-weight: 700; font-size: 18px; cursor: pointer; text-align: center; touch-action: manipulation;
}
.nut.to { min-height: 60px; font-size: 20px; }
.nut.nho { width: auto; min-height: 48px; font-size: 16px; padding: 10px 14px; display: inline-block; }
.nut.chinh { background: var(--vang); color: #141414; }
.nut.chinh:active { background: var(--vang-sang); }
.nut.phu { background: transparent; color: var(--vang-sang); }
.nut.nguy { background: transparent; color: var(--do-chu); border-color: var(--do); }
.nut:disabled { opacity: .55; cursor: default; }
.hang-nut { display: flex; flex-wrap: wrap; gap: 8px; }
.hang-nut > .nut { flex: 1 1 140px; width: auto; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--vang-sang); outline-offset: 2px; }

/* ---------- Đăng nhập ---------- */
.man-dn { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 12px; }
.logo-to { width: 160px; height: auto; }
.chu-logo { width: 220px; height: auto; margin-top: 8px; }
.ten-app { color: var(--chu-nhat); margin: 0 0 8px; font-size: 18px; }
.form-dn { display: flex; flex-direction: column; gap: 8px; }
label, .nhan-o { font-size: 17px; font-weight: 600; color: var(--vang-sang); display: block; }
input[type=text], input[type=password], input[type=number], input[type=time], input[type=datetime-local], textarea {
  width: 100%; min-height: 52px; font: inherit; font-size: 20px; color: var(--chu); background: #101010;
  border: 2px solid var(--vien); border-radius: 10px; padding: 10px 12px; max-width: 100%;
  -webkit-appearance: none; appearance: none;
}
input[type=password] { letter-spacing: 4px; }
textarea { min-height: 96px; resize: vertical; font-size: 18px; }
input:focus, textarea:focus { border-color: var(--vang); }
input[type=time]::-webkit-calendar-picker-indicator, input[type=datetime-local]::-webkit-calendar-picker-indicator { filter: invert(1); }

/* ---------- Tab Hôm nay / Ngày mai ---------- */
.tab2 { display: flex; gap: 8px; }
.tab {
  flex: 1; min-height: 52px; border-radius: 12px; border: 2px solid var(--vien); background: var(--the); color: var(--chu);
  font: inherit; font-weight: 700; cursor: pointer;
}
.tab.dang { border-color: var(--vang); background: var(--vang); color: #141414; }
.dong-tai { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; color: var(--chu-nhat); font-size: 16px; }
.dong-tai h1 { margin: 0; }

/* ---------- Thẻ việc ---------- */
.the-viec { display: flex; flex-direction: column; gap: 4px; }
.the-dau { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.ma-ct { font-size: 26px; font-weight: 800; color: var(--vang-sang); letter-spacing: .5px; }
.the-ten { font-size: 18px; font-weight: 600; }
.the-dong { font-size: 16px; color: var(--chu-nhat); }
.the-goi-y { font-size: 16px; color: var(--vang-sang); font-weight: 700; margin-top: 4px; }
.chi-xem { opacity: .85; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-block; border-radius: 999px; padding: 4px 12px; font-size: 16px; font-weight: 700; color: #141414; white-space: nowrap; }
.chip-xanh { background: var(--xanh); }
.chip-vang { background: var(--cam); }
.chip-do { background: var(--do); }
.chip-xam { background: var(--xam); }
.ten-tin { font-size: 20px; font-weight: 800; color: var(--vang-sang); }

/* ---------- Lưới nút khai báo ---------- */
.luoi-nut { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.nut-loai {
  min-height: 72px; border-radius: 14px; border: 2px solid var(--vang); background: var(--the); color: var(--vang-sang);
  font: inherit; font-size: 20px; font-weight: 800; cursor: pointer; padding: 8px; touch-action: manipulation;
}
.nut-loai.goi-y { background: var(--vang); color: #141414; }
.nut-loai.canh-bao { border-color: var(--do); color: var(--do-chu); }
.nut-loai:active { filter: brightness(1.2); }

/* ---------- Mẫu tin ---------- */
.tieu-de-tin { font-size: 28px; margin-bottom: 0; }
.phu-de { color: var(--chu-nhat); margin: 0; font-size: 18px; }
.form-tin { display: flex; flex-direction: column; gap: 16px; }
.o { display: flex; flex-direction: column; gap: 8px; }
.tich {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 10px 12px; border-radius: 12px;
  border: 2px solid var(--vang); background: transparent; color: var(--chu); font: inherit; font-size: 18px; font-weight: 700; text-align: left; cursor: pointer;
}
.o-vuong { flex: none; width: 32px; height: 32px; border-radius: 6px; border: 3px solid var(--vang); position: relative; }
.tich.da { background: rgba(201, 163, 90, .18); }
.tich.da .o-vuong { background: var(--vang); }
.tich.da .o-vuong::after {
  content: ""; position: absolute; left: 8px; top: 2px; width: 9px; height: 17px; border: solid #141414; border-width: 0 4px 4px 0; transform: rotate(45deg);
}
.nhom-chon { display: flex; flex-wrap: wrap; gap: 8px; }
.chon {
  min-height: 52px; padding: 10px 16px; border-radius: 12px; border: 2px solid var(--vien); background: var(--the2); color: var(--chu);
  font: inherit; font-size: 18px; font-weight: 600; cursor: pointer; max-width: 100%;
}
.chon.da { border-color: var(--vang); background: var(--vang); color: #141414; }
.hang-so { display: flex; align-items: center; gap: 10px; }
.hang-so input { text-align: center; flex: 1; min-width: 0; }
.nut-so {
  flex: none; width: 60px; height: 56px; border-radius: 12px; border: 2px solid var(--vang); background: transparent; color: var(--vang-sang);
  font: inherit; font-size: 30px; font-weight: 800; cursor: pointer; line-height: 1;
}
.so-to { flex: 1; text-align: center; font-size: 34px; font-weight: 800; color: var(--vang-sang); }
input[type=range] { width: 100%; height: 48px; accent-color: var(--vang); }
.hang-them { display: flex; gap: 8px; }
.hang-them input { flex: 1; min-width: 0; }

/* ---------- Ảnh ---------- */
.khu-anh { display: flex; flex-direction: column; gap: 10px; }
.luoi-anh { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.o-anh { display: flex; flex-direction: column; gap: 6px; }
.o-anh img, .nho-anh img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--vien); background: #000; }
.o-anh .nut.nho { width: 100%; }
.anh-cho { aspect-ratio: 1 / 1; border-radius: 10px; border: 2px dashed var(--vien); display: flex; align-items: center; justify-content: center;
  text-align: center; color: var(--chu-nhat); font-size: 16px; padding: 6px; }

/* ---------- Xác nhận, đã gửi ---------- */
.tom-tat p { margin: 4px 0; font-size: 20px; line-height: 1.4; }
.tom-tat .tt-dau { font-size: 24px; font-weight: 800; color: var(--vang-sang); }
.thanh-tien-do { height: 14px; border-radius: 7px; background: var(--the2); overflow: hidden; }
.thanh-day { display: block; height: 100%; background: var(--vang); width: 0; transition: width .3s; }
.tin { display: flex; flex-direction: column; gap: 4px; }

/* ---------- Tài khoản ---------- */
.hang-tk { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--vien); flex-wrap: wrap; }
.hang-tk:last-child { border-bottom: 0; }
.hang-tk > span:last-child { font-weight: 700; text-align: right; }

/* ---------- Thanh dưới ---------- */
#duoi {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; gap: 6px; padding: 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom));
  background: #0d0d0d; border-top: 1px solid var(--vien);
}
#duoi[hidden] { display: none; }
.duoi-nut {
  flex: 1; min-height: 56px; border-radius: 12px; border: 2px solid transparent; background: transparent; color: var(--chu);
  font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; padding: 4px; line-height: 1.2;
}
.duoi-nut.dang { border-color: var(--vang); color: var(--vang-sang); background: rgba(201, 163, 90, .12); }

/* ---------- Thông báo nhanh ---------- */
#tb-nhanh {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--duoi) + 20px + env(safe-area-inset-bottom)); z-index: 9;
  background: var(--vang-sang); color: #141414; padding: 14px 16px; border-radius: 12px; font-weight: 700; font-size: 18px;
  opacity: 0; transform: translateY(10px); transition: opacity .2s, transform .2s; pointer-events: none;
}
#tb-nhanh.hien { opacity: 1; transform: none; }
.an-chep { position: fixed; top: -1000px; left: 0; width: 1px; height: 1px; opacity: 0; }

@media (min-width: 420px) {
  .luoi-anh { grid-template-columns: 1fr 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
