/* SBH WORK — GIAI ĐOẠN 2 · HTML TĨNH · DỮ LIỆU GIẢ
   Responsive 3 cỡ theo luật: Desktop + Tablet + Điện thoại.
   KHÔNG kết nối Supabase / Getfly / KiotViet / AI. Thuần HTML+CSS. */

:root{
  --bg:#f4f6fb; --card:#ffffff; --ink:#0f172a; --muted:#5b6b83; --line:#dde5f0;
  --brand:#2e3192; --brand-2:#1d4ed8; --ok:#0f9d58; --warn:#d97706; --bad:#dc2626;
  --chip:#eef2fb; --r:12px; --sh:0 1px 2px rgba(15,23,42,.06),0 4px 14px rgba(15,23,42,.05);
}
*{box-sizing:border-box}
html,body{margin:0}
body{
  background:var(--bg); color:var(--ink); font-size:15px; line-height:1.5;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  -webkit-text-size-adjust:100%;
}
a{color:var(--brand-2)}

/* ── BĂNG CẢNH BÁO DỮ LIỆU GIẢ — luôn hiện, không được ẩn ───────────────── */
.fake{
  background:repeating-linear-gradient(45deg,#fef3c7,#fef3c7 12px,#fde68a 12px,#fde68a 24px);
  color:#78350f; border-bottom:1px solid #f59e0b;
  padding:8px 16px; font-size:13px; font-weight:700; text-align:center;
}
.fake span{font-weight:500}
/* Chế độ NỐI DỮ LIỆU THẬT — băng phải ĐỔI MÀU ĐỎ: người thử phải biết thao tác
   của mình ĐANG ĐƯỢC GHI vào hệ thật, không phải mô phỏng. */
.fake.that{
  background:repeating-linear-gradient(45deg,#fee2e2,#fee2e2 12px,#fecaca 12px,#fecaca 24px);
  color:#7f1d1d; border-bottom:1px solid #dc2626;
}

/* ── KHUNG ──────────────────────────────────────────────────────────────── */
header.top{
  background:var(--brand); color:#fff; padding:12px 16px;
  display:flex; align-items:center; gap:12px; flex-wrap:wrap;
  position:sticky; top:0; z-index:10;
}
header.top h1{margin:0; font-size:17px; font-weight:800; letter-spacing:.2px}
header.top .who{margin-left:auto; font-size:13px; opacity:.9}
.wrap{max-width:1180px; margin:0 auto; padding:16px}

/* ── ĐIỀU HƯỚNG ─────────────────────────────────────────────────────────── */
nav.tabs{display:flex; gap:6px; flex-wrap:wrap; margin-bottom:14px}
nav.tabs a{
  text-decoration:none; color:var(--ink); background:var(--card); border:1px solid var(--line);
  padding:8px 13px; border-radius:99px; font-size:14px; font-weight:600; white-space:nowrap;
}
nav.tabs a.on{background:var(--brand); color:#fff; border-color:var(--brand)}

/* ── THẺ / KHỐI ─────────────────────────────────────────────────────────── */
.card{background:var(--card); border:1px solid var(--line); border-radius:var(--r); box-shadow:var(--sh); padding:14px; margin-bottom:14px}
.card > h2{margin:0 0 4px; font-size:16px}
.card > .sub{margin:0 0 12px; color:var(--muted); font-size:13px}
.grid{display:grid; gap:12px}
.g2{grid-template-columns:repeat(2,1fr)}
.g3{grid-template-columns:repeat(3,1fr)}
.g4{grid-template-columns:repeat(4,1fr)}

/* ── KPI ────────────────────────────────────────────────────────────────── */
.kpi{background:var(--card); border:1px solid var(--line); border-radius:var(--r); padding:12px; text-align:center; box-shadow:var(--sh)}
.kpi b{display:block; font-size:26px; line-height:1.1}
.kpi span{font-size:12px; color:var(--muted); display:block; margin-top:2px}
.kpi.bad b{color:var(--bad)} .kpi.warn b{color:var(--warn)} .kpi.ok b{color:var(--ok)}

/* ── NHÃN TRẠNG THÁI ────────────────────────────────────────────────────── */
.chip{display:inline-block; font-size:11.5px; font-weight:700; padding:3px 9px; border-radius:99px; background:var(--chip); color:var(--brand); white-space:nowrap}
.chip.bad{background:#fee2e2; color:#991b1b}
.chip.warn{background:#fef3c7; color:#92400e}
.chip.ok{background:#dcfce7; color:#166534}
.chip.gray{background:#e5e7eb; color:#374151}
.chip.p1{background:#fee2e2; color:#991b1b}
.chip.p2{background:#fef3c7; color:#92400e}
.chip.p3{background:#e5e7eb; color:#374151}

/* ── VIỆC CẦN LÀM TRƯỚC (khối quan trọng nhất) ──────────────────────────── */
.next{background:#eef4ff; border:1px solid #bfdbfe; border-radius:var(--r); padding:14px}
.next .lbl{font-size:12px; font-weight:800; color:var(--brand-2); letter-spacing:.6px; text-transform:uppercase}
.next .ord{font-size:22px; font-weight:800; margin:4px 0 2px}
.next dl{display:grid; grid-template-columns:auto 1fr; gap:2px 12px; margin:10px 0 0; font-size:14px}
.next dt{color:var(--muted)}
.next dd{margin:0; font-weight:600}

/* ── BẢNG (desktop) → THẺ (điện thoại) ─────────────────────────────────── */
table{width:100%; border-collapse:collapse; font-size:14px}
th,td{text-align:left; padding:9px 10px; border-bottom:1px solid var(--line); vertical-align:middle}
th{background:#f8fafc; color:var(--muted); font-size:12px; text-transform:uppercase; letter-spacing:.4px; font-weight:700}
tbody tr:hover{background:#fafcff}
td.num,th.num{text-align:right; font-variant-numeric:tabular-nums}
.tbl-scroll{overflow-x:auto}

/* Thanh tiến độ nhỏ */
.bar{height:8px; border-radius:99px; background:#e8edf6; overflow:hidden; min-width:70px}
.bar > i{display:block; height:100%; background:var(--brand-2)}
.bar > i.warn{background:var(--warn)} .bar > i.bad{background:var(--bad)}

/* ── NÚT ────────────────────────────────────────────────────────────────── */
.btn{
  display:inline-block; border:1px solid var(--brand); background:var(--brand); color:#fff;
  padding:9px 14px; border-radius:10px; font-size:14px; font-weight:700; cursor:pointer; text-decoration:none;
}
.btn.ghost{background:#fff; color:var(--brand)}
.btn.sm{padding:6px 11px; font-size:13px}
.btn[disabled]{opacity:.45; cursor:not-allowed}
.btnrow{display:flex; gap:8px; flex-wrap:wrap}

/* ── Ô NHẬP ─────────────────────────────────────────────────────────────── */
label.f{display:block; font-size:13px; font-weight:700; color:var(--muted); margin:10px 0 4px}
input,select,textarea{
  width:100%; padding:10px; border:1px solid var(--line); border-radius:10px;
  font-size:16px; background:#fff; color:var(--ink);  /* 16px: chống iOS tự zoom */
}
.hint{font-size:12.5px; color:var(--muted); margin-top:4px}

/* ── CẢNH BÁO ───────────────────────────────────────────────────────────── */
.alert{border-left:4px solid var(--warn); background:#fffbeb; padding:10px 12px; border-radius:8px; margin-bottom:10px; font-size:14px}
.alert.bad{border-color:var(--bad); background:#fef2f2}
.alert.ok{border-color:var(--ok); background:#f0fdf4}

/* ════════════════════════════════════════════════════════════════════════
   TABLET  (≤ 1024px)  — lưới co lại
   ════════════════════════════════════════════════════════════════════════ */
@media (max-width:1024px){
  .g4{grid-template-columns:repeat(2,1fr)}
  .g3{grid-template-columns:repeat(2,1fr)}
}

/* ════════════════════════════════════════════════════════════════════════
   ĐIỆN THOẠI (≤ 640px) — luật bắt buộc: bảng thành thẻ dọc, chạm được
   ════════════════════════════════════════════════════════════════════════ */
@media (max-width:640px){
  body{font-size:16px}
  .wrap{padding:12px}
  .g4,.g3,.g2{grid-template-columns:1fr}

  /* bảng → thẻ: mỗi dòng thành một khối, nhãn lấy từ data-l */
  table.resp thead{display:none}
  table.resp,table.resp tbody,table.resp tr,table.resp td{display:block; width:100%}
  table.resp tr{
    border:1px solid var(--line); border-radius:var(--r); background:#fff;
    padding:10px; margin-bottom:10px; box-shadow:var(--sh);
  }
  table.resp td{border:0; padding:4px 0; display:flex; justify-content:space-between; gap:12px; text-align:right}
  table.resp td::before{
    content:attr(data-l); color:var(--muted); font-size:12.5px; font-weight:700;
    text-transform:uppercase; letter-spacing:.3px; text-align:left; flex:0 0 auto;
  }
  table.resp td.num{text-align:right}
  .bar{min-width:90px}

  /* nút to cho ngón tay */
  .btn{display:block; width:100%; text-align:center; padding:14px; font-size:16px}
  .btnrow{display:grid; grid-template-columns:1fr; gap:8px}
  header.top h1{font-size:15px}
  header.top .who{font-size:12px}
  .next .ord{font-size:19px}
}

/* In ấn: bỏ băng dữ liệu giả? KHÔNG — giữ để không lọt số giả ra ngoài */
@media print{ .fake{display:block} }

/* ════════════════════════════════════════════════════════════════════════
   GIAI ĐOẠN 3 — thành phần của Web Prototype (bấm được)
   ════════════════════════════════════════════════════════════════════════ */
.row{display:flex; gap:10px; flex-wrap:wrap; align-items:center}

/* Thanh các bước */
ol.buoc{list-style:none; margin:0; padding:0; display:flex; flex-wrap:wrap; gap:6px}
ol.buoc li{
  display:flex; align-items:center; gap:7px; padding:7px 11px; border-radius:99px;
  background:#fff; border:1px solid var(--line); font-size:13.5px; font-weight:600;
}
ol.buoc li .so{
  display:inline-flex; align-items:center; justify-content:center;
  width:21px; height:21px; border-radius:99px; background:#e8edf6; color:var(--muted);
  font-size:12px; font-weight:800; flex:0 0 auto;
}
ol.buoc li.xong{background:#f0fdf4; border-color:#bbf7d0; color:#166534}
ol.buoc li.xong .so{background:var(--ok); color:#fff}
ol.buoc li.dang{background:var(--brand); border-color:var(--brand); color:#fff; box-shadow:var(--sh)}
ol.buoc li.dang .so{background:#fff; color:var(--brand)}
ol.buoc li.dang .chip{background:rgba(255,255,255,.22); color:#fff}

@media (max-width:640px){
  ol.buoc li{font-size:12.5px; padding:6px 9px}
  ol.buoc li .ten{max-width:150px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
}
