/* ===================================================================
   HANA Quản trị Doanh nghiệp — giao diện
   Máy tính: thanh menu trái cố định. Điện thoại: menu kéo từ trái (☰).
   =================================================================== */

:root {
  --xanh: #123d63;
  --xanh-dam: #0c2b47;
  --xanh-nhat: #e8f0f8;
  --nhan: #1f6fd1;
  --nen: #f3f5f7;
  --the: #fff;
  --chu: #17212b;
  --chu-phu: #5b6875;
  --chu-mo: #8a96a3;
  --vien: #dfe5ea;
  --vien-dam: #c9d2da;
  --tot: #138a52;
  --tot-nen: #e5f5ec;
  --canh: #b26a00;
  --canh-nen: #fff4e0;
  --xau: #c62f2f;
  --xau-nen: #fdecec;
  --c-thu: #2a6fdb;
  --c-chi: #e8833a;
  --bo: 12px;
  --dong: 0 1px 3px rgba(16, 32, 48, .06), 0 2px 10px rgba(16, 32, 48, .05);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* 🔴 ĐỪNG XOÁ: `hidden` của HTML chỉ là display:none mặc định, mọi luật display:flex/grid
   viết ra đều đè mất — lớp phủ đang nạp, menu, hộp thoại sẽ không bao giờ ẩn (vấp thật ở app Nhân sự). */
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0; background: var(--nen); color: var(--chu);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--nhan); }

/* ------------------------------------------------------------ nạp */
.nap { position: fixed; inset: 0; display: grid; place-items: center; background: var(--xanh); z-index: 90; padding: 20px; }
.nap-vong { width: 42px; height: 42px; border: 4px solid rgba(255,255,255,.25); border-top-color: #fff; border-radius: 50%; animation: quay .8s linear infinite; }
@keyframes quay { to { transform: rotate(360deg); } }
.nap-chu { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); max-width: 420px; width: calc(100% - 40px);
  background: #fff; border-radius: var(--bo); padding: 18px; text-align: center; box-shadow: 0 8px 30px rgba(0,0,0,.3); }
.nap-tieu { font-weight: 700; margin-bottom: 8px; }
.nap-ly { font-size: 13.5px; color: var(--chu-phu); word-break: break-word; margin-bottom: 14px; }

/* ------------------------------------------------------------ khung */
.khung { display: flex; min-height: 100vh; }
.trai {
  width: 236px; flex: 0 0 236px; background: var(--xanh-dam); color: #dbe6f1; position: sticky; top: 0; height: 100vh;
  overflow-y: auto; display: flex; flex-direction: column;
}
.trai-dau { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; border-bottom: 1px solid rgba(255,255,255,.08); }
.trai-dau img { width: 34px; height: 34px; border-radius: 9px; background: #fff; }
.trai-ten { font-weight: 700; color: #fff; font-size: 14.5px; line-height: 1.25; }
.trai-phu { font-size: 11.5px; opacity: .7; }
.nhom-menu { padding: 10px 8px 2px; }
.nhom-ten { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; opacity: .55; padding: 6px 10px 4px; }
.muc { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: #dbe6f1; text-decoration: none; font-size: 14px; cursor: pointer; }
.muc:hover { background: rgba(255,255,255,.07); color: #fff; }
.muc.chon { background: var(--nhan); color: #fff; font-weight: 600; }
.muc i { font-style: normal; width: 20px; text-align: center; }
.trai-chan { margin-top: auto; padding: 12px 16px 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px; }
.trai-chan b { color: #fff; display: block; }
.trai-chan button { margin-top: 8px; background: rgba(255,255,255,.1); border: 0; color: #fff; border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 13px; }

.phai { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dau { display: flex; align-items: center; gap: 12px; padding: 12px 22px; background: var(--the); border-bottom: 1px solid var(--vien); position: sticky; top: 0; z-index: 30; }
.dau h1 { font-size: 18px; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nut-menu { display: none; width: 40px; height: 40px; border: 0; border-radius: 10px; background: var(--xanh-nhat); font-size: 19px; cursor: pointer; }
.dong-bo { font-size: 12.5px; color: var(--chu-mo); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.dong-bo::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tot); }
.dong-bo.loi::before { background: var(--xau); }
.dong-bo.moi { color: var(--nhan); font-weight: 600; cursor: pointer; }
.man { padding: 20px 22px 60px; max-width: 1280px; width: 100%; }

/* ------------------------------------------------------------ khối chung */
.the { background: var(--the); border-radius: var(--bo); box-shadow: var(--dong); padding: 16px 18px; margin-bottom: 16px; }
.the h2 { font-size: 15.5px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.the h2 .them { margin-left: auto; }
.luoi { display: grid; gap: 14px; }
.luoi-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.luoi-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.o-so-ds { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.o-so { background: var(--the); border-radius: var(--bo); box-shadow: var(--dong); padding: 14px 16px; }
.o-so .nhan-o { font-size: 12.5px; color: var(--chu-phu); }
.o-so .gia-tri { font-size: 22px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.o-so .phu { font-size: 12.5px; color: var(--chu-mo); margin-top: 2px; }
.o-so.xau .gia-tri { color: var(--xau); }
.o-so.tot .gia-tri { color: var(--tot); }

.thanh-loc { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.thanh-loc .day { flex: 1; }
.o-nhap, select.o-nhap, textarea.o-nhap {
  border: 1px solid var(--vien-dam); background: #fff; border-radius: 9px; padding: 8px 10px; min-height: 38px; outline: none; max-width: 100%;
}
.o-nhap:focus { border-color: var(--nhan); box-shadow: 0 0 0 3px rgba(31,111,209,.15); }
.nut {
  border: 0; background: var(--nhan); color: #fff; border-radius: 9px; padding: 8px 14px; min-height: 38px; cursor: pointer; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; text-decoration: none;
}
.nut:hover { filter: brightness(1.06); }
.nut:disabled { opacity: .55; cursor: default; }
.nut.phu { background: var(--xanh-nhat); color: var(--xanh); }
.nut.vien { background: #fff; color: var(--chu); border: 1px solid var(--vien-dam); }
.nut.xau { background: var(--xau-nen); color: var(--xau); }
.nut.nho { padding: 4px 10px; min-height: 30px; font-size: 13px; }
.tab { display: flex; gap: 4px; background: #e6ebf0; padding: 4px; border-radius: 10px; margin-bottom: 14px; width: fit-content; max-width: 100%; overflow-x: auto; }
.tab button { border: 0; background: transparent; padding: 6px 14px; border-radius: 7px; cursor: pointer; white-space: nowrap; color: var(--chu-phu); }
.tab button.chon { background: #fff; color: var(--chu); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* ------------------------------------------------------------ bảng */
.bang-boc { overflow-x: auto; border: 1px solid var(--vien); border-radius: 10px; background: #fff; }
table.bang { width: 100%; border-collapse: collapse; font-size: 14px; }
.bang th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--chu-phu); background: #f7f9fb; padding: 9px 10px; border-bottom: 1px solid var(--vien); white-space: nowrap; position: sticky; top: 0; }
.bang td { padding: 9px 10px; border-bottom: 1px solid #edf1f4; vertical-align: top; }
.bang tr:last-child td { border-bottom: 0; }
.bang tr.bam { cursor: pointer; }
.bang tr.bam:hover td { background: #f5f9ff; }
.bang .so, .bang th.so { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bang td.nw { white-space: nowrap; }
.bang tr.huy td { color: var(--chu-mo); text-decoration: line-through; }
.bang tfoot td { font-weight: 700; background: #f7f9fb; border-top: 1px solid var(--vien); }
.bang-trong { padding: 28px; text-align: center; color: var(--chu-mo); }
.bang-chan { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; color: var(--chu-mo); }

.nhan { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #eef1f4; color: var(--chu-phu); white-space: nowrap; font-weight: 600; }
.nhan.tot { background: var(--tot-nen); color: var(--tot); }
.nhan.canh { background: var(--canh-nen); color: var(--canh); }
.nhan.xau { background: var(--xau-nen); color: var(--xau); }
.nhan.lam { background: var(--xanh-nhat); color: var(--nhan); }
.am { color: var(--xau); }
.duong { color: var(--tot); }
.mo { color: var(--chu-mo); font-size: 13px; }
.dam { font-weight: 700; }

/* ------------------------------------------------------------ hộp thoại & form */
.hop { position: fixed; inset: 0; background: rgba(10, 20, 30, .45); z-index: 60; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.hop-trong { background: #fff; border-radius: 14px; width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.hop-trong.rong { max-width: 920px; }
.hop-dau { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--vien); font-weight: 700; font-size: 16px; }
.hop-dau span { flex: 1; }
.hop-dong { border: 0; background: #eef1f4; width: 34px; height: 34px; border-radius: 9px; cursor: pointer; font-size: 15px; }
.hop-than { padding: 16px 18px 18px; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form .rong { grid-column: 1 / -1; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--chu-phu); font-weight: 600; }
.form label .o-nhap { color: var(--chu); font-weight: 400; width: 100%; }
.form label.bat { flex-direction: row; align-items: center; gap: 8px; color: var(--chu); font-weight: 400; }
.form .goi-y { font-weight: 400; color: var(--chu-mo); font-size: 12px; }
.hang-nut { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.hang-nut .trai-nut { margin-right: auto; }

/* dòng hàng trong đơn */
.dong-don { display: grid; grid-template-columns: minmax(0, 3fr) 90px 130px 120px 34px; gap: 8px; align-items: center; margin-bottom: 8px; }
.dong-don .tien-dong { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.dong-don button { border: 0; background: var(--xau-nen); color: var(--xau); border-radius: 8px; height: 34px; cursor: pointer; }
.tong-don { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; justify-content: end; margin: 12px 0 0 auto; max-width: 360px; font-variant-numeric: tabular-nums; }
.tong-don .lon { font-size: 18px; font-weight: 700; }

/* ------------------------------------------------------------ bảng kéo thả (việc, phễu khách) */
.cot-kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.cot-k { background: #e9eef3; border-radius: 12px; padding: 10px; min-height: 200px; }
.cot-k.ve-day { outline: 2px dashed var(--nhan); background: #e2ecf8; }
.cot-k h3 { font-size: 13.5px; margin: 2px 4px 10px; display: flex; justify-content: space-between; color: var(--chu-phu); }
.the-k { background: #fff; border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; box-shadow: 0 1px 2px rgba(0,0,0,.06); cursor: grab; font-size: 14px; }
.the-k:active { cursor: grabbing; }
.the-k .ten-k { font-weight: 600; margin-bottom: 4px; }
.the-k .phu-k { font-size: 12.5px; color: var(--chu-mo); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.the-k.qua-han { border-left: 3px solid var(--xau); }

/* ------------------------------------------------------------ biểu đồ */
.bd-chu { display: flex; gap: 14px; font-size: 12.5px; color: var(--chu-phu); margin-bottom: 6px; flex-wrap: wrap; }
.bd-chu span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; background: var(--m); vertical-align: -1px; }
svg.bd { width: 100%; height: auto; display: block; }
svg.bd .cot:hover { opacity: .8; }
svg.bd text { fill: var(--chu-mo); font-size: 11px; }
svg.bd .luoi-ngang { stroke: #edf1f4; }

/* ------------------------------------------------------------ chấm công */
.cc-boc { overflow-x: auto; border: 1px solid var(--vien); border-radius: 10px; background: #fff; }
table.cc { border-collapse: collapse; font-size: 13px; }
.cc th, .cc td { border: 1px solid #edf1f4; padding: 0; text-align: center; min-width: 34px; height: 34px; }
.cc th { background: #f7f9fb; color: var(--chu-phu); font-weight: 600; font-size: 12px; padding: 0 4px; }
.cc th.cn { color: var(--xau); }
.cc td.ten { text-align: left; padding: 0 10px; white-space: nowrap; min-width: 170px; position: sticky; left: 0; background: #fff; z-index: 1; }
.cc td.o { cursor: pointer; user-select: none; }
.cc td.o.c1 { background: var(--tot-nen); color: var(--tot); font-weight: 700; }
.cc td.o.c05 { background: var(--canh-nen); color: var(--canh); font-weight: 700; }
.cc td.tong { font-weight: 700; padding: 0 8px; }

/* ------------------------------------------------------------ màn cổng vào */
.cong { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, var(--xanh-dam), var(--xanh) 60%, #1d5a8f); }
.cong-the { background: #fff; border-radius: 16px; padding: 26px 24px; width: 100%; max-width: 440px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.cong-the h1 { font-size: 20px; margin: 10px 0 4px; }
.cong-the p { color: var(--chu-phu); margin: 0 0 16px; font-size: 14px; }
.cong-the .form { grid-template-columns: 1fr; }
.cong-logo { display: flex; align-items: center; gap: 10px; color: var(--xanh); font-weight: 700; }
.cong-logo img { width: 40px; height: 40px; border-radius: 10px; }
.chon-nganh { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.chon-nganh label { border: 1.5px solid var(--vien-dam); border-radius: 10px; padding: 10px 6px; text-align: center; cursor: pointer; font-size: 13px; color: var(--chu); font-weight: 600; }
.chon-nganh input { display: none; }
.chon-nganh label:has(input:checked) { border-color: var(--nhan); background: var(--xanh-nhat); color: var(--nhan); }
.chon-nganh i { display: block; font-style: normal; font-size: 22px; }

.banh { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1d2a36; color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 80; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: calc(100% - 32px); }
.banh.loi { background: var(--xau); }
.banh.vui { background: var(--tot); }

.canh-bao { display: block; padding: 10px 12px; border-radius: 10px; margin-bottom: 8px; font-size: 14px; background: var(--canh-nen); color: #6b4300; }
.canh-bao.xau { background: var(--xau-nen); color: #7d1b1b; }
.canh-bao.tot { background: var(--tot-nen); color: #0d5a36; }
.ds-gon { list-style: none; margin: 0; padding: 0; }
.ds-gon li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid #edf1f4; font-size: 14px; }
.ds-gon li:last-child { border-bottom: 0; }

/* ------------------------------------------------------------ điện thoại */
@media (max-width: 900px) {
  .trai { position: fixed; left: 0; top: 0; z-index: 70; transform: translateX(-100%); transition: transform .2s; box-shadow: 4px 0 20px rgba(0,0,0,.3); }
  .trai.mo-ra { transform: none; }
  .man-che { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 65; }
  .nut-menu { display: block; }
  .dau { padding: 10px 14px; }
  .man { padding: 14px 14px 60px; }
  .luoi-2, .luoi-3 { grid-template-columns: minmax(0, 1fr); }
  .o-so-ds { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .o-so .gia-tri { font-size: 18px; }
  .form { grid-template-columns: minmax(0, 1fr); }
  .dong-don { grid-template-columns: minmax(0, 1fr) 70px 110px 34px; }
  .dong-don .tien-dong { display: none; }
  .hop { padding: 0; }
  .hop-trong, .hop-trong.rong { border-radius: 0; min-height: 100vh; }
  .dong-bo span { display: none; }
}
@media print {
  .trai, .dau, .thanh-loc, .nut, .tab { display: none !important; }
  .man { padding: 0; }
  .the { box-shadow: none; border: 1px solid #ddd; }
}
