:root {
  --chinh: #0f8a5f;
  --chinh-dam: #0b6b4a;
  --chinh-nhat: #e6f4ee;
  --vn: #0f8a5f;          /* viên nén */
  --ek: #c98a2e;          /* ép khối */
  --kh: #8a94a6;          /* kế hoạch */
  --nen: #f2f5f8;
  --the: #ffffff;
  --chu: #1f2a37;
  --chu-phu: #6b7685;
  --vien: #e5e9ef;
  --do: #e5484d;
  --vang: #d9900f;
  --xanh: #1e7be6;
  --bong: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --bo: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --chinh: #2bb37f; --chinh-dam: #5fd0a2; --chinh-nhat: #12392b;
    --vn: #2bb37f; --ek: #e0a54a; --kh: #8590a3;
    --nen: #0f141a; --the: #171e26; --chu: #e6ebf1; --chu-phu: #98a3b3; --vien: #2a333f;
    --bong: 0 1px 2px rgba(0, 0, 0, .3);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; background: var(--nen); color: var(--chu); }
.an { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--chinh); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Khung ── */
.dau { position: fixed; inset: 0 0 auto 0; height: 56px; background: var(--the); border-bottom: 1px solid var(--vien); display: flex; align-items: center; gap: 16px; padding: 0 20px; z-index: 20; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; letter-spacing: .2px; width: 196px; }
.logo.lon { font-size: 26px; width: auto; justify-content: center; }
.logo-icon { width: 28px; height: 28px; border-radius: 7px; background: var(--chinh) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M9 22c0-8 6-13 14-13-1 8-6 13-14 13z' fill='%23fff'/%3E%3C/svg%3E") center/80% no-repeat; flex: none; }
.chao { color: var(--chu-phu); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dau-phai { display: flex; align-items: center; gap: 14px; }
.nguoi { position: relative; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.nguoi .avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--chinh-nhat); color: var(--chinh-dam); display: grid; place-items: center; font-weight: 700; }
.nguoi .tha { position: absolute; right: 0; top: 40px; background: var(--the); border: 1px solid var(--vien); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); min-width: 180px; padding: 6px; display: none; }
.nguoi.mo .tha { display: block; }
.tha button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; cursor: pointer; font-weight: 400; }
.tha button:hover { background: var(--nen); }
.the-ai { font-size: 12px; padding: 3px 10px; border-radius: 99px; background: var(--chinh-nhat); color: var(--chinh-dam); }
.the-ai.tat { background: #fdecec; color: var(--do); }
.nut-menu { display: none; border: 0; background: none; font-size: 22px; cursor: pointer; }

.menu { position: fixed; top: 56px; bottom: 0; left: 0; width: 220px; background: var(--the); border-right: 1px solid var(--vien); overflow-y: auto; padding: 10px 10px 30px; z-index: 15; }
.menu .nhom { font-size: 12px; color: var(--chu-phu); text-transform: uppercase; letter-spacing: .5px; margin: 14px 10px 4px; }
.menu a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--chu); margin: 2px 0; }
.menu a:hover { background: var(--nen); text-decoration: none; }
.menu a.chon { background: var(--chinh-nhat); color: var(--chinh-dam); font-weight: 600; }
.menu .ic { width: 18px; text-align: center; opacity: .8; }

.noi-dung { margin: 56px 0 0 220px; padding: 18px 24px 10px; min-height: calc(100vh - 56px); }
.duong-dan { color: var(--chu-phu); margin-bottom: 14px; }
.duong-dan b { color: var(--chu); font-weight: 500; }
.chan { text-align: center; color: var(--chu-phu); font-size: 12px; padding: 26px 0 8px; }

/* ── Thẻ & lưới ── */
.luoi { display: grid; gap: 16px; margin-bottom: 16px; }
.c2 { grid-template-columns: 1fr 1fr; }
.c3 { grid-template-columns: repeat(3, 1fr); }
.c4 { grid-template-columns: repeat(4, 1fr); }
.c-21 { grid-template-columns: 2fr 1fr; }
.c-12 { grid-template-columns: 1fr 2fr; }
.the { background: var(--the); border-radius: var(--bo); box-shadow: var(--bong); padding: 18px 20px; min-width: 0; }
.the > h3, .tieu-de-the { margin: 0 0 14px; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tieu-de-the .phai { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.goi-y { color: var(--chu-phu); font-size: 12.5px; font-weight: 400; }
.thanh-cong-cu { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.thanh-cong-cu .phai { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* chọn kỳ (giống PUDU) */
.chon-ky { display: inline-flex; border: 1px solid var(--vien); border-radius: 6px; overflow: hidden; }
.chon-ky button { border: 0; border-right: 1px solid var(--vien); background: var(--the); padding: 5px 12px; cursor: pointer; }
.chon-ky button:last-child { border-right: 0; }
.chon-ky button.chon { color: var(--chinh); box-shadow: inset 0 0 0 1px var(--chinh); font-weight: 600; }

/* số liệu lớn */
.so-lieu { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 18px 24px; }
.sl .nhan { color: var(--chu-phu); font-size: 13px; }
.sl .gia-tri { font-size: 28px; font-weight: 600; line-height: 1.25; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.sl .gia-tri small { font-size: 14px; color: var(--chu-phu); font-weight: 400; }
.sl .so-sanh { font-size: 12.5px; color: var(--chu-phu); }
.tang { color: #12a150; } .giam { color: var(--do); }
.cham { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }

/* thanh tiến độ */
.tien-do { margin: 10px 0 16px; }
.tien-do .dong-tren { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; gap: 10px; }
.tien-do .ray { position: relative; height: 10px; background: var(--nen); border-radius: 99px; overflow: visible; }
.tien-do .dau-ray { height: 100%; border-radius: 99px; }
.tien-do .moc { position: absolute; top: -4px; width: 2px; height: 18px; background: var(--chu); opacity: .55; }
.ray-nho { height: 6px; background: var(--nen); border-radius: 99px; min-width: 70px; }
.ray-nho > div { height: 100%; border-radius: 99px; background: var(--chinh); }

/* bảng */
.bang-cuon { overflow-x: auto; }
table.bang { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.bang th { text-align: left; font-weight: 600; color: var(--chu-phu); font-size: 12.5px; background: var(--nen); padding: 9px 10px; white-space: nowrap; }
.bang td { padding: 9px 10px; border-bottom: 1px solid var(--vien); vertical-align: middle; }
.bang tr:hover td { background: color-mix(in srgb, var(--nen) 60%, transparent); }
.bang .so { text-align: right; white-space: nowrap; }
.bang tr.nghi td { color: var(--chu-phu); background: color-mix(in srgb, var(--nen) 70%, transparent); }
.bang tr.hom-nay td { box-shadow: inset 0 1px 0 var(--chinh), inset 0 -1px 0 var(--chinh); }
.bang tfoot td { font-weight: 600; border-top: 2px solid var(--vien); }
.rong-bang { text-align: center; color: var(--chu-phu); padding: 30px 0; }

/* nhãn trạng thái */
.nhan-tt { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 12px; white-space: nowrap; }
.nhan-tt.xanh-la { background: var(--chinh-nhat); color: var(--chinh-dam); }
.nhan-tt.do { background: #fdecec; color: var(--do); }
.nhan-tt.vang { background: #fff5e0; color: #a86a00; }
.nhan-tt.xam { background: var(--nen); color: var(--chu-phu); }
.nhan-tt.vn { background: color-mix(in srgb, var(--vn) 14%, transparent); color: var(--vn); }
.nhan-tt.ek { background: color-mix(in srgb, var(--ek) 16%, transparent); color: var(--ek); }

/* nút */
.nut { border: 1px solid var(--vien); background: var(--the); padding: 6px 14px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.nut:hover { border-color: var(--chinh); color: var(--chinh); }
.nut.chinh { background: var(--chinh); border-color: var(--chinh); color: #fff; }
.nut.chinh:hover { background: var(--chinh-dam); color: #fff; }
.nut.nguy { color: var(--do); }
.nut.nguy:hover { border-color: var(--do); }
.nut.nho { padding: 3px 10px; font-size: 12.5px; }
.nut.rong { width: 100%; padding: 10px; }
.nut[disabled] { opacity: .5; cursor: not-allowed; }
.lien-ket { border: 0; background: none; color: var(--chinh); cursor: pointer; padding: 0; }
.lien-ket.do { color: var(--do); }

/* form */
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 16px; }
.form .full { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--chu-phu); }
input, select, textarea { border: 1px solid var(--vien); border-radius: 6px; padding: 7px 10px; background: var(--the); color: var(--chu); min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--chinh) 35%, transparent); border-color: var(--chinh); }
input[type=number] { text-align: right; }
.o-nho { width: 110px; }
.loi-form { color: var(--do); min-height: 20px; font-size: 13px; }

/* cảnh báo */
.ds-canh-bao { list-style: none; margin: 0; padding: 0; }
.ds-canh-bao li { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--vien); }
.ds-canh-bao li:last-child { border-bottom: 0; }
.ds-canh-bao .dau-cb { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: none; }
.dau-cb.do { background: var(--do); } .dau-cb.vang { background: var(--vang); } .dau-cb.xanh { background: var(--xanh); }

.top-list { list-style: none; padding: 0; margin: 0; }
.top-list li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--vien); }
.top-list .stt { width: 22px; height: 22px; border-radius: 4px; background: var(--nen); display: grid; place-items: center; font-size: 12px; flex: none; }
.top-list li:nth-child(-n+3) .stt { background: var(--vang); color: #fff; }
.top-list .giua { flex: 1; min-width: 0; }
.top-list .giua div:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* mức dùng công suất */
.cong-suat { display: grid; grid-template-columns: 110px 1fr 54px; gap: 6px 10px; align-items: center; font-size: 13px; }
.cong-suat .ray { height: 12px; background: var(--nen); border-radius: 3px; overflow: hidden; }
.cong-suat .ray div { height: 100%; }

/* sơ đồ quy trình */
.so-do { display: grid; gap: 10px; }
.day-sx { display: flex; align-items: stretch; gap: 0; flex-wrap: wrap; row-gap: 8px; }
.day-sx .ten-day { width: 100%; font-weight: 600; margin: 4px 0 8px; }
.buoc { border: 1px solid var(--vien); border-radius: 8px; padding: 10px 12px; flex: 1 1 110px; min-width: 110px; background: var(--the); position: relative; }
.buoc .t { font-weight: 600; }
.buoc .s { font-size: 12px; color: var(--chu-phu); }
.buoc .ray-nho { margin-top: 6px; }
.buoc.nghen { border-color: var(--do); box-shadow: 0 0 0 2px color-mix(in srgb, var(--do) 25%, transparent); }
.mui-ten { display: grid; place-items: center; width: 22px; flex: none; color: var(--chu-phu); font-size: 18px; }
.phoi-tron { margin: 2px 0 2px 0; padding: 8px 12px; border: 1px dashed var(--ek); border-radius: 8px; color: var(--ek); font-size: 13px; }

/* biểu đồ */
.bieu-do { width: 100%; }
.bieu-do svg { width: 100%; height: auto; display: block; overflow: visible; }
.bieu-do text { fill: var(--chu-phu); font-size: 11px; }
.bieu-do .luoi-ngang { stroke: var(--vien); }
.chu-giai { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--chu-phu); margin-top: 8px; }
.chu-giai span { display: inline-flex; align-items: center; }

/* hợp đồng mới – thả file */
.vung-tha { border: 2px dashed var(--vien); border-radius: 12px; padding: 40px 20px; text-align: center; cursor: pointer; transition: .15s; }
.vung-tha:hover, .vung-tha.keo { border-color: var(--chinh); background: var(--chinh-nhat); }
.vung-tha .to { font-size: 17px; font-weight: 600; margin: 8px 0 4px; }
.dang-tai { display: flex; align-items: center; gap: 12px; justify-content: center; padding: 30px; color: var(--chu-phu); }
.xoay { width: 22px; height: 22px; border: 3px solid var(--vien); border-top-color: var(--chinh); border-radius: 50%; animation: xoay 1s linear infinite; }
@keyframes xoay { to { transform: rotate(360deg); } }
.hop-ai { background: linear-gradient(135deg, var(--chinh-nhat), transparent 70%); border: 1px solid color-mix(in srgb, var(--chinh) 25%, transparent); }
.ds-gach { margin: 6px 0 0; padding-left: 18px; }
.ds-gach li { margin: 3px 0; }
.dong-hd { display: grid; grid-template-columns: 1fr 1fr 1fr 32px; gap: 8px; align-items: end; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px dashed var(--vien); }
.dong-hd .mo-ta { order: 5; grid-column: 1 / -1; }
.bang td:first-child { white-space: nowrap; }

/* modal */
#lop-phu { position: fixed; inset: 0; background: rgba(15, 20, 26, .45); display: none; align-items: flex-start; justify-content: center; z-index: 50; padding: 6vh 16px; overflow-y: auto; }
#lop-phu.mo { display: flex; }
.hop-thoai { background: var(--the); border-radius: 12px; width: 100%; max-width: 640px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.hop-thoai .dau-ht { padding: 16px 20px; border-bottom: 1px solid var(--vien); font-weight: 600; font-size: 16px; display: flex; }
.hop-thoai .dau-ht button { margin-left: auto; border: 0; background: none; font-size: 20px; cursor: pointer; color: var(--chu-phu); }
.hop-thoai .than-ht { padding: 18px 20px; }
.hop-thoai .chan-ht { padding: 12px 20px; border-top: 1px solid var(--vien); display: flex; justify-content: flex-end; gap: 8px; align-items: center; }
.hop-thoai .chan-ht .loi-form { margin-right: auto; }

#thong-bao { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; }
.tb { background: var(--the); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.15); padding: 10px 16px; border-left: 4px solid var(--chinh); }
.tb.loi { border-left-color: var(--do); }

/* đăng nhập */
.dang-nhap { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 20% 10%, var(--chinh-nhat), var(--nen) 60%); }
.the-dang-nhap { background: var(--the); padding: 32px; border-radius: 14px; box-shadow: 0 10px 40px rgba(0,0,0,.08); width: 100%; max-width: 360px; display: grid; gap: 14px; }
.the-dang-nhap .phu { text-align: center; margin: -6px 0 6px; color: var(--chu-phu); }

.tab-ngang { display: flex; gap: 22px; border-bottom: 1px solid var(--vien); margin-bottom: 16px; overflow-x: auto; }
.tab-ngang button { border: 0; background: none; padding: 8px 0 10px; cursor: pointer; color: var(--chu-phu); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab-ngang button.chon { color: var(--chinh); border-bottom-color: var(--chinh); font-weight: 600; }
.tab-ngang .dem { background: var(--nen); border-radius: 99px; padding: 0 7px; font-size: 12px; margin-left: 4px; }

.ghi-chu-nho { font-size: 12.5px; color: var(--chu-phu); }
.chu-do { color: var(--do); } .chu-xanh { color: var(--chinh); } .dam { font-weight: 600; }
.mb0 { margin-bottom: 0; } .mt { margin-top: 14px; }

@media (max-width: 1100px) {
  .c4 { grid-template-columns: 1fr 1fr; }
  .c3, .c-21, .c-12 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .menu { transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 30px rgba(0,0,0,.2); }
  .menu.mo { transform: none; }
  .noi-dung { margin-left: 0; padding: 14px 16px 10px; }
  .nut-menu { display: block; }
  .logo { width: auto; }
  .chao, .the-ai { display: none; }
  .c2, .c4 { grid-template-columns: 1fr; }
  .sl .gia-tri { font-size: 24px; }
}

.cac-buoc { margin: 0; padding-left: 22px; }
.cac-buoc > li { margin: 0 0 18px; padding-left: 4px; }
.cac-buoc > li::marker { font-weight: 700; color: var(--chinh); }
.say-chung { background: color-mix(in srgb, var(--xanh) 6%, transparent); border: 1px dashed color-mix(in srgb, var(--xanh) 45%, transparent); border-radius: 10px; padding: 8px 10px 10px; }
.buoc.qua-say { border-style: dashed; color: var(--xanh); background: transparent; flex: 0 1 110px; }

/* mô phỏng 3D */
.khung-3d { position: relative; height: calc(100vh - 250px); min-height: 460px; border-radius: var(--bo); overflow: hidden; box-shadow: var(--bong); background: var(--the); }
.khung-3d canvas { display: block; }
.lop-nhan-3d { position: absolute; top: 0; left: 0; pointer-events: none; }
.nhan-3d { background: color-mix(in srgb, var(--the) 92%, transparent); color: var(--chu); border: 1px solid var(--vien); border-left: 3px solid var(--chinh);
  border-radius: 6px; padding: 4px 8px; font-size: 11.5px; line-height: 1.35; white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.nhan-3d b { font-size: 12.5px; }
.nhan-3d .muc { font-weight: 700; }
.nhan-3d .phu, .nhan-3d.phu { color: var(--chu-phu); }
.nhan-3d.phu { border-left-color: var(--kh); }
.chu-giai-3d { position: absolute; left: 12px; bottom: 12px; display: flex; flex-wrap: wrap; gap: 6px 12px; max-width: 520px; font-size: 12px;
  background: color-mix(in srgb, var(--the) 90%, transparent); padding: 8px 10px; border-radius: 8px; pointer-events: none; }
.chu-giai-3d i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.bang-chi-tiet { position: absolute; top: 12px; right: 12px; width: 320px; max-width: calc(100% - 24px); background: var(--the); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 14px 16px; max-height: calc(100% - 24px); overflow: auto; z-index: 2; }
.bang-chi-tiet .dong-ct { position: absolute; top: 8px; right: 10px; border: 0; background: none; font-size: 20px; cursor: pointer; color: var(--chu-phu); }
@media (max-width: 760px) { .khung-3d { height: 70vh; min-height: 380px; } .chu-giai-3d { display: none; } }

/* ── CRM & tiến độ đơn hàng ── */
.buoc-tt { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 10px 0 6px; }
.buoc-tt .b { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; font-size: 12px; color: var(--chu-phu); padding: 0 4px; }
.buoc-tt .b::before { content: ''; position: absolute; top: 13px; left: -50%; right: 50%; height: 3px; background: var(--vien); }
.buoc-tt .b:first-child::before { display: none; }
.buoc-tt .b.xong::before, .buoc-tt .b.hien::before { background: var(--m); }
.buoc-tt .c { position: relative; z-index: 1; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--the); border: 2px solid var(--vien); font-weight: 700; margin-bottom: 4px; }
.buoc-tt .b.xong .c { background: var(--m); border-color: var(--m); color: #fff; }
.buoc-tt .b.hien .c { border-color: var(--m); color: var(--m); box-shadow: 0 0 0 4px color-mix(in srgb, var(--m) 18%, transparent); }
.buoc-tt .b.hien .t { color: var(--chu); font-weight: 600; }
.buoc-tt small { display: block; color: var(--m); font-weight: 600; }
.buoc-tt .b.thieu .c { border-color: var(--do); color: var(--do); }
.buoc-tt .b.thieu small { color: var(--do); }

.kanban { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kb-cot { background: var(--nen); border-radius: 10px; padding: 10px; border-top: 3px solid var(--m); min-height: 120px; }
.kb-tieu-de { display: flex; justify-content: space-between; align-items: center; font-weight: 600; margin-bottom: 8px; font-size: 13px; }
.kb-tieu-de b { background: var(--m); color: #fff; border-radius: 99px; padding: 0 8px; font-size: 12px; }
.the-kb { display: block; background: var(--the); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--bong); border-left: 4px solid var(--m); color: var(--chu); }
.the-kb:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.kb-dau { display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.kb-khach { font-size: 13px; margin: 2px 0 4px; }
.kb-sp { margin-bottom: 6px; font-size: 12.5px; }
.kb-trong { color: var(--chu-phu); font-size: 12.5px; text-align: center; padding: 18px 0; }

.hom-nay-sp { margin: 6px 0 18px; }
.hom-nay-sp .dong-tren { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.thanh-chia { position: relative; display: flex; height: 22px; border-radius: 6px; overflow: visible; background: var(--nen); }
.thanh-chia > div:not(.moc-ke) { height: 100%; }
.thanh-chia > div:first-child { border-radius: 6px 0 0 6px; }
.thanh-chia .chua-gan { background: repeating-linear-gradient(45deg, #c9ced6, #c9ced6 6px, #dde1e6 6px, #dde1e6 12px); }
.thanh-chia .moc-ke { position: absolute; top: -5px; bottom: -5px; width: 2px; background: var(--chu); opacity: .6; }

.chip-don { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip { display: inline-flex; align-items: center; gap: 4px; flex-direction: row; border: 1px solid var(--vien); border-radius: 99px; padding: 4px 12px; cursor: pointer; color: var(--chu); font-size: 13px; background: var(--the); }
.chip input { display: none; }
.chip.chon { border-color: var(--m, var(--chinh)); background: color-mix(in srgb, var(--m, var(--chinh)) 10%, transparent); font-weight: 600; }
.chip small { color: var(--chu-phu); font-weight: 400; }

.gantt { --g-ten: 190px; position: relative; }
.g-hang { display: flex; align-items: center; min-height: 40px; border-bottom: 1px dashed var(--vien); }
.g-ten { width: var(--g-ten); flex: none; padding-right: 10px; font-size: 13px; }
.g-ray { position: relative; flex: 1; height: 26px; }
.g-truc .g-ray span { position: absolute; transform: translateX(-50%); font-size: 11px; color: var(--chu-phu); top: 4px; }
.g-thanh { position: absolute; top: 3px; height: 20px; border-radius: 5px; background: color-mix(in srgb, var(--m) 22%, transparent); overflow: hidden; }
.g-xong { height: 100%; background: var(--m); }
.g-thanh span { position: absolute; left: 6px; top: 1px; font-size: 11.5px; font-weight: 700; color: #fff; text-shadow: 0 0 3px rgba(0,0,0,.45); }
.g-du-kien { position: absolute; top: 2px; transform: translateX(-50%); color: #12a150; font-size: 16px; line-height: 20px; }
.g-du-kien.tre { color: var(--do); }
.g-hom-nay { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px dashed var(--do); pointer-events: none; }
.g-hom-nay span { position: absolute; top: -2px; left: 4px; font-size: 11px; color: var(--do); white-space: nowrap; }

.ds-pb { display: grid; gap: 6px; }
.dong-pb { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 1px solid var(--vien); border-left: 4px solid var(--m); border-radius: 6px; }
.dong-pb > span { flex: 1; }
.dong-pb input { width: 110px; }

.don-kh { border: 1px solid var(--vien); border-left: 4px solid var(--m); border-radius: 8px; padding: 12px 14px; margin-bottom: 12px; }
.don-kh-dau { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.don-kh-dau .phai { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Soạn hợp đồng ── */
.soan { display: grid; grid-template-columns: minmax(340px, 0.9fr) 1.1fr; gap: 16px; align-items: start; }
.soan-form h3 { margin: 0 0 10px; font-size: 14.5px; }
.soan-form textarea { resize: vertical; }
.soan-dong { display: grid; grid-template-columns: 1fr 1fr 1fr 32px; gap: 8px; align-items: end; padding: 10px; border: 1px dashed var(--vien); border-radius: 8px; margin-bottom: 8px; }
.soan-dong .full { grid-column: 1 / -1; }
.soan-xem { position: sticky; top: 70px; max-height: calc(100vh - 90px); overflow: auto; border-radius: var(--bo); box-shadow: var(--bong); background: #e8eaed; padding: 16px; }
.van-ban { background: #fff; color: #111; font-family: "Times New Roman", Times, serif; font-size: 14px; line-height: 1.55; padding: 36px 44px; max-width: 800px; margin: 0 auto; box-shadow: 0 1px 6px rgba(0,0,0,.15); }
.van-ban h2 { text-align: center; font-size: 18px; margin: 18px 0 2px; }
.van-ban h4 { font-size: 14px; margin: 14px 0 4px; }
.van-ban p { margin: 4px 0; text-align: justify; }
.vb-quoc-hieu, .vb-giua { text-align: center; }
.vb-can-cu { margin: 12px 0 !important; }
.vb-ben { margin-top: 10px !important; }
.vb-tt td { padding: 1px 6px 1px 0; vertical-align: top; }
.vb-tt td:first-child { width: 100px; }
.vb-bang { width: 100%; border-collapse: collapse; margin: 6px 0; font-size: 13px; }
.vb-bang th, .vb-bang td { border: 1px solid #333; padding: 4px 6px; vertical-align: top; }
.vb-bang .g { text-align: center; } .vb-bang .p { text-align: right; white-space: nowrap; }
.vb-ky { width: 100%; margin-top: 28px; text-align: center; }
.vb-ky td { width: 50%; vertical-align: top; }
.ky-ten { margin-top: 80px; font-weight: 700; }
.van-ban .trong { color: #999; }

@media (max-width: 1100px) { .soan { grid-template-columns: 1fr; } .soan-xem { position: static; max-height: none; } .kanban { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .kanban { grid-template-columns: 1fr; } .gantt { --g-ten: 110px; } .van-ban { padding: 20px 16px; } .buoc-tt .t { font-size: 11px; } }

@media print {
  @page { size: A4; margin: 15mm 15mm 15mm 20mm; }
  body { background: #fff; }
  .dau, .menu, .duong-dan, .chan, .khong-in, #thong-bao { display: none !important; }
  .noi-dung { margin: 0 !important; padding: 0 !important; }
  .soan { display: block; }
  .soan-xem { position: static; max-height: none; overflow: visible; box-shadow: none; background: none; padding: 0; }
  .van-ban { box-shadow: none; padding: 0; max-width: none; font-size: 13pt; }
  .van-ban .trong { color: #000; }
}

/* ── Tổng quan Năm / Tháng / Ngày ── */
.bang-mau { background: #fff5e0; color: #7a5200; border: 1px solid #f1d49a; border-radius: 8px; padding: 8px 14px; margin-bottom: 14px; }
.tq-dau { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; padding: 12px 20px; }
.tq-dau .chon-ky button { padding: 6px 18px; font-size: 14px; }
.dieu-ky { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.dieu-ky b { min-width: 130px; text-align: center; }
.dong-ho-hang { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 8px; }
.dong-ho { text-align: center; }
.dong-ho svg { width: 100%; max-width: 190px; display: block; margin: 0 auto; }
.dh-nen { fill: none; stroke: var(--nen); stroke-width: 14; stroke-linecap: round; }
.dh-tri { fill: none; stroke-width: 14; stroke-linecap: round; }
.dh-moc { stroke: var(--chu); stroke-width: 2; opacity: .55; }
.dh-so { font-size: 28px; font-weight: 700; fill: var(--chu); }
.dh-ten { font-weight: 600; margin-top: -4px; }
.tq-tien { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.tq-tien .sl .gia-tri { font-size: 22px; }
.may-tq .ray { position: relative; overflow: visible; }
.may-tq .ray > div { border-radius: 3px; }
.may-tq .ray i { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--chu); opacity: .55; }
.dong-chay { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; }
.buoc-chay { flex: 1 1 120px; border-radius: 10px; padding: 12px 14px; background: color-mix(in srgb, var(--m) 10%, var(--the)); border-top: 4px solid var(--m); }
.bc-so { font-size: 30px; font-weight: 700; line-height: 1.1; color: var(--m); }
.bc-ten { font-weight: 600; }
.mui-ten { align-self: center; font-size: 26px; color: var(--chu-phu); }
.dc-phu { flex: 1 1 150px; display: grid; gap: 8px; align-content: center; padding-left: 8px; }
.dc-phu div { display: flex; flex-direction: column; }
.tq-cho-ai { margin-top: 16px; }
.tq-cho-ai .dong-tren { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.chip i.cham { margin: 0; }
a.chip:hover { text-decoration: none; border-color: var(--m); }
.kb-them { display: block; text-align: center; font-size: 12.5px; padding: 4px 0; }
.kho-tom { display: flex; gap: 10px 16px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.kt { padding: 4px 12px; border-radius: 99px; font-size: 13px; }
.kt b { font-size: 16px; margin-right: 3px; }
.kt.do { background: #fdecec; color: var(--do); } .kt.vang { background: #fff5e0; color: #a86a00; } .kt.xanh { background: var(--chinh-nhat); color: var(--chinh-dam); }
.luoi-kho { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.o-kho { display: block; color: var(--chu); border: 1px solid var(--vien); border-left: 4px solid var(--m); border-radius: 8px; padding: 10px 12px; }
.o-kho:hover { text-decoration: none; box-shadow: var(--bong); }
.ok-dau { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; font-size: 13.5px; }
.ok-so { font-size: 24px; font-weight: 700; margin: 2px 0 6px; font-variant-numeric: tabular-nums; }
.ok-so small { font-size: 13px; color: var(--chu-phu); font-weight: 400; }
.ok-ly-do { font-size: 12.5px; color: var(--m); font-weight: 600; margin-top: 2px; }
.ray-kho { position: relative; height: 8px; background: var(--nen); border-radius: 99px; margin-bottom: 4px; }
.ray-kho > div { height: 100%; border-radius: 99px; }
.ray-kho i { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--do); opacity: .6; }
.ray-kho i.lau { background: var(--vang); }
.thanh-chia.nho { height: 8px; margin-bottom: 4px; }
.thanh-chia.nho > div:last-child { border-radius: 0 6px 6px 0; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .bang-mau { background: #3a2c0d; color: #f3cf7f; border-color: #5c4614; }
  :root:not([data-theme="light"]) .kt.do { background: #3b1718; } :root:not([data-theme="light"]) .kt.vang { background: #3a2c0d; color: #f3cf7f; }
}
@media (max-width: 760px) { .mui-ten { display: none; } .tq-dau { padding: 12px 14px; } .dieu-ky b { min-width: 0; } }

/* ── Trợ lý AI ── */
.tro-ly { position: fixed; right: 20px; bottom: 20px; z-index: 40; }
.tl-nut { display: flex; align-items: center; gap: 8px; border: 0; border-radius: 99px; padding: 12px 18px; background: var(--chinh); color: #fff; font-weight: 600; cursor: pointer; box-shadow: 0 6px 20px rgba(15, 138, 95, .35); }
.tl-nut:hover { background: var(--chinh-dam); }
.tl-ic { font-size: 18px; line-height: 1; }
.tl-hop { display: none; position: absolute; right: 0; bottom: 0; width: 390px; height: min(620px, calc(100vh - 90px)); background: var(--the); border: 1px solid var(--vien); border-radius: 14px; box-shadow: 0 16px 48px rgba(0,0,0,.2); flex-direction: column; overflow: hidden; }
.tro-ly.mo .tl-hop { display: flex; }
.tro-ly.mo .tl-nut { visibility: hidden; }
.tl-dau { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; background: var(--chinh); color: #fff; }
.tl-dau .ghi-chu-nho { color: rgba(255,255,255,.85); font-size: 12px; }
.tl-dau button { border: 0; background: none; color: #fff; font-size: 20px; cursor: pointer; padding: 0 6px; }
.tl-than { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--nen); }
.tl-tin { max-width: 88%; padding: 9px 12px; border-radius: 12px; font-size: 13.5px; line-height: 1.5; word-wrap: break-word; }
.tl-tin p { margin: 0 0 4px; } .tl-tin p:last-child { margin-bottom: 0; }
.tl-tin ul { margin: 2px 0 6px; padding-left: 18px; } .tl-tin li { margin: 2px 0; }
.tl-tin.bot { background: var(--the); align-self: flex-start; border-bottom-left-radius: 4px; box-shadow: var(--bong); }
.tl-tin.nguoi { background: var(--chinh); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.tl-tin code { background: var(--nen); padding: 0 4px; border-radius: 4px; }
.tl-tin.dang { display: flex; gap: 4px; padding: 12px 14px; }
.tl-tin.dang span { width: 7px; height: 7px; border-radius: 50%; background: var(--chu-phu); animation: tl-nhay 1s infinite ease-in-out; }
.tl-tin.dang span:nth-child(2) { animation-delay: .15s; } .tl-tin.dang span:nth-child(3) { animation-delay: .3s; }
@keyframes tl-nhay { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.tl-goi-y { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 12px; background: var(--nen); }
.tl-goi-y:not(:empty) { padding: 0 12px 10px; }
.tl-goi-y button { border: 1px solid var(--vien); background: var(--the); border-radius: 99px; padding: 4px 10px; font-size: 12.5px; cursor: pointer; color: var(--chu); }
.tl-goi-y button:hover { border-color: var(--chinh); color: var(--chinh); }
.tl-nhap { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--vien); background: var(--the); align-items: flex-end; }
.tl-nhap textarea { flex: 1; resize: none; border: 1px solid var(--vien); border-radius: 10px; padding: 8px 10px; background: var(--the); max-height: 120px; }
.tl-nhap .nut { border-radius: 10px; padding: 8px 14px; }
@media (max-width: 760px) {
  .tro-ly { right: 12px; bottom: 12px; }
  .tl-chu { display: none; }
  .tl-nut { padding: 14px; }
  .tl-hop { position: fixed; inset: 0; width: auto; height: auto; border-radius: 0; }
}
@media print { .tro-ly { display: none !important; } }
