/* Giao diện mới (29/10/2026) — nạp sau app.css. GĐ bật công tắc "Quay về giao diện cũ" thì file này bị tắt (apGiaoDien).
   Chỉ đổi hình thức; số liệu, nút và quy tắc duyệt giữ nguyên. Giữ màu IK, chế độ tối dùng lại biến màu của app.css. */

/* ---- Chung: phẳng hơn, chữ và đường kẻ làm việc chính ---- */
h1, h2, h3, .topbar-title{font-weight:600; letter-spacing:-.015em;}
#topbar{border-top:none; background:var(--bg);}
.topbar-title{font-size:21px;}
.btn{border-radius:7px; min-height:36px;}
.btn-sm{min-height:30px;}
.btn-ghost{color:var(--accent-strong);}

/* Điều hướng: không viên nền hồng — mục đang chọn có vạch đỏ nhỏ bên trái và chữ đậm */
#sidebar{background:var(--bg);}
.navbtn{border-radius:0 6px 6px 0; border-left:2px solid transparent;}
.navbtn.active{background:transparent; color:var(--ink); font-weight:600; border-left-color:var(--accent);}
.nav-count{background:transparent; color:var(--accent-strong); padding:0 2px; min-width:0; font-size:12.5px;}
@media (hover: hover) and (pointer: fine){ .navbtn:hover{background:var(--surface);} }

/* Thẻ chuyển trang con: chữ có gạch chân */
.tabs{background:transparent; padding:0; border-bottom:1px solid var(--border); border-radius:0; gap:0;}
.tab{border-radius:0; border-bottom:2px solid transparent; padding:9px 12px; margin-bottom:-1px;}
.tab.active{background:transparent; box-shadow:none; color:var(--ink); border-bottom-color:var(--accent); font-weight:600;}
.tab-sep{margin:8px 6px;}

/* Mảng nội dung trên trang: viền mảnh, không bóng */
#viewRoot .panel{box-shadow:none; border-radius:10px;}
.stat{box-shadow:none;}
th{font-size:12px; text-transform:none; letter-spacing:0; font-weight:600;}

/* Trạng thái: chấm màu + chữ, không viên nền */
.badge{background:transparent !important; padding:0; font-weight:600; gap:6px; border-radius:0;}
.badge::before{content:""; width:7px; height:7px; border-radius:50%; background:currentColor; flex:none;}

/* Số liệu Tổng quan: dòng "nhãn … số" có đường kẻ; doanh số là một con số lớn */
#viewRoot > .grid-cards:has(> .stat){display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); column-gap:40px; row-gap:0; background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:4px 20px;}
#viewRoot > .grid-cards:has(> .stat) > *{grid-column:auto !important;}
#viewRoot > .grid-cards:has(> .stat) > .stat{background:transparent; border:none; border-radius:0; border-bottom:1px solid var(--border); padding:12px 0; flex-direction:row-reverse; justify-content:space-between; align-items:baseline; gap:16px;}
#viewRoot > .grid-cards:has(> .stat) > .stat .num{font-size:18px !important; font-weight:600; text-align:right; white-space:nowrap;}
#viewRoot > .grid-cards:has(> .stat) > .stat .lbl{font-size:13.5px; color:var(--ink);}
#viewRoot > .grid-cards:has(> .stat) > .stat .lbl span{color:var(--ink-muted);}
#viewRoot > .grid-cards:has(> .stat) > .stat[style*="span 2"]{grid-column:1 / -1 !important; flex-direction:column; align-items:flex-start; gap:2px; padding:14px 0 16px;}
#viewRoot > .grid-cards:has(> .stat) > .stat[style*="span 2"] .num{font-size:34px !important; text-align:left;}
#viewRoot > .grid-cards:has(> .stat) > .stat[style*="span 2"] .lbl{color:var(--ink-muted);}

/* Thông báo đầu trang (nhóm hạng mục 01/11): một dòng chữ có đường kẻ, không hộp */
#tbNhomHm.gon{display:flex; flex-wrap:wrap; gap:6px 14px; align-items:center; background:transparent; border:none; border-bottom:1px solid var(--border); border-radius:0; padding:2px 0 12px; font-size:13.5px; color:var(--ink);}
#tbNhomHm.gon > b{flex:1 1 280px; font-weight:600;}
#tbNhomHm.gon > details.ct{flex:1 1 100%; order:3;}
#tbNhomHm.gon > details.ct > summary{cursor:pointer; color:var(--accent-strong); font-weight:600; width:max-content;}

/* ---- Điện thoại ---- */
@media (max-width: 820px){
  /* Menu đáy: 4 mục + Thêm */
  #sidebar{position:fixed; left:0; right:0; bottom:0; top:auto; z-index:60; padding:4px 4px calc(4px + env(safe-area-inset-bottom)); gap:0; border-top:1px solid var(--border); border-bottom:none; background:var(--surface); overflow:visible; display:block;}
  #sidebar .brand{display:none;}
  #sidebar nav{display:grid; grid-template-columns:repeat(5, minmax(0, 1fr)); gap:0; width:100%;}
  #sidebar .navbtn{flex-direction:column; justify-content:center; gap:3px; padding:6px 2px; min-height:54px; font-size:12px; line-height:1.15; text-align:center; white-space:normal; border-left:none; border-top:2px solid transparent; border-radius:0; position:relative;}
  #sidebar .navbtn.active{border-top-color:var(--accent); background:transparent;}
  #sidebar .navbtn .ico{width:auto; flex:none;}
  #sidebar .navbtn .nav-count{position:absolute; top:3px; left:calc(50% + 8px); margin:0; background:var(--accent); color:var(--accent-contrast); border-radius:99px; padding:0 5px; font-size:12px; line-height:17px; min-width:17px;}
  .lbl-dai{display:none;}
  .lbl-ngan, .mo-them{display:flex;}
  #sidebar .navbtn.mo-them{display:flex;}
  #sidebar .navbtn.ngoai{display:none;}
  /* "Thêm" mở: các mục còn lại xếp thành dòng phía trên thanh đáy */
  #sidebar.mo-mo{box-shadow:0 -10px 30px rgba(20,17,13,.22);}
  #sidebar.mo-mo .navbtn.ngoai{display:flex; order:-1; grid-column:1 / -1; flex-direction:row; justify-content:flex-start; gap:12px; min-height:48px; padding:10px 16px; font-size:15px; text-align:left; border-top:none; border-bottom:1px solid var(--border);}
  #sidebar.mo-mo .navbtn.ngoai .lbl-ngan{display:none;}
  #sidebar.mo-mo .navbtn.ngoai .lbl-dai{display:inline;}
  #sidebar.mo-mo .navbtn.ngoai .nav-count{position:static; margin-left:auto;}
  #sidebar.mo-mo .navbtn.ngoai.active{color:var(--accent-strong);}
  #content{padding:12px 12px calc(84px + env(safe-area-inset-bottom));}
  #topbar{padding:10px 12px; gap:8px;}
  .topbar-title{font-size:19px;}
  .topbar-sub{display:none;}
  .update-bar{bottom:calc(74px + env(safe-area-inset-bottom));}
  .hb-top{bottom:calc(84px + env(safe-area-inset-bottom));}

  /* Thanh thẻ con: một hàng, cuộn ngang thay vì 3 hàng */
  .tabs{flex-wrap:nowrap; overflow-x:auto; scrollbar-width:none;}
  .tabs::-webkit-scrollbar{display:none;}
  .tab{white-space:nowrap; flex:none;}

  /* Hộp thoại và form: toàn màn hình, nút Hủy / Gửi dính đáy */
  #modalRoot{padding:0; z-index:80;}
  #modalRoot .modal{min-height:100%; border-radius:0; border:none; display:flex; flex-direction:column;}
  #modalRoot .modal-head{position:sticky; top:0; z-index:2; background:var(--surface);}
  #modalRoot .modal-body{flex:1;}
  #modalRoot .modal-foot{position:sticky; bottom:0; z-index:2; background:var(--surface); padding:10px 14px calc(10px + env(safe-area-inset-bottom));}
  #modalRoot .modal-foot > .btn{flex:1 1 auto; justify-content:center; min-height:46px;}
  #modalRoot .modal-foot > .foot-tools .btn{min-height:40px;}
  .btn{min-height:40px;}
  .btn-sm{min-height:34px;}
  input, select{min-height:44px;}

  /* Số liệu Tổng quan một cột */
  #viewRoot > .grid-cards:has(> .stat){grid-template-columns:minmax(0, 1fr); padding:2px 14px;}
  #viewRoot > .grid-cards:has(> .stat) > .stat[style*="span 2"] .num{font-size:28px !important;}

  /* Bảng thành thẻ (table.the): mỗi dòng là một thẻ, ô có tên cột; số tiền và trạng thái luôn thấy */
  .tablewrap:has(> table.the){overflow:visible;}
  table.the, table.the tbody{display:block; width:100%;}
  table.the thead{display:none;}
  table.the tr{display:block; padding:12px 14px; border-top:1px solid var(--border);}
  table.the tbody tr:first-child{border-top:none;}
  table.the tr[hidden]{display:none;}
  table.the td{display:flex; justify-content:space-between; align-items:baseline; gap:12px; padding:3px 0; border:none; text-align:right; font-size:14px; white-space:normal;}
  table.the td::before{content:attr(data-label); flex:none; font-family:'Be Vietnam Pro',system-ui,sans-serif; max-width:45%; color:var(--ink-muted); font-size:12.5px; font-weight:500; text-align:left;}
  table.the td[data-label=""]::before{display:none;}
  table.the td[data-label=""]{justify-content:flex-end;}
  table.the td.rong{display:none;}
  table.the td > *{min-width:0;}
  table.the td:first-child, table.the td.chk + td{justify-content:flex-start; font-weight:700; font-size:15px; padding-bottom:4px;}
  table.the td:first-child::before, table.the td.chk + td::before{display:none;}
  table.the td.num-cell{font-size:15px; font-weight:600;}
  table.the td.chk{float:right; padding:2px 0 0 10px;}
  table.the td.chk input{width:22px; height:22px; min-height:22px;}
  table.the td .clamp2{text-align:right;}
  table.the td .badge{white-space:normal; text-align:right;}
  /* Ô trạng thái có nút (Sếp góp ý 18/11/2026): nhãn một dòng canh giữa, ghi chú + nút xuống dòng riêng, không tràn trang */
  /* Ô nhiều mẩu (gói .o-gia ở theBang): xếp từng dòng canh phải; nhãn trạng thái một dòng; nút xuống dòng riêng (Sếp góp ý 18/11/2026) */
  table.the td > .o-gia{flex:1; text-align:right;}
  table.the td > .o-gia .badge{white-space:normal; text-align:right; max-width:100%;}   /* nhãn ngắn vẫn một dòng; nhãn dài (loại NCC) xuống dòng thay vì lấn mép */
  table.the td > .o-gia .nut-dong{display:flex; flex-wrap:wrap; justify-content:flex-end; gap:8px; white-space:normal !important;}
  .loc-nhanh{padding:10px 14px 2px;}
  .loc-nhanh input{max-width:none;}
}
@media (max-width: 380px){
  #sidebar .navbtn{padding-left:1px; padding-right:1px;}
  table.the td::before{max-width:40%;}
}
@media print{
  #sidebar{display:none !important;}
}
