:root {
  --nen: #F4F6FA; --the: #FFFFFF; --vien: #E3E7EF; --chu: #18202F; --chu-phu: #637087; --nhan: #2F6FED;
  --ben: #0F1A33; --ben-2: #1B2A4A; --ben-chu: #C9D3E6; --ben-sang: #2A3B63;
  --xanh: #2E7D32; --do: #C62828; --lam: #1565C0; --xam: #757575;
  --ut1: #B3261E; --ut2: #2E6B3A; --ut3: #7A3E10; --ut4: #F6E3A1; --ut4-chu: #5A4A00;
  --sheet: #6A9F4B; --bong: 0 1px 2px rgba(16,24,40,.06), 0 4px 16px rgba(16,24,40,.06); --bo: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; color: var(--chu); background: var(--nen); }
.an { display: none !important; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--nhan); }

/* đăng nhập */
.man-dang-nhap { min-height: 100%; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, #0F1A33, #1E3566); }
.the-dang-nhap { width: 100%; max-width: 380px; background: var(--the); border-radius: 16px; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.35); display: grid; gap: 12px; }
.the-dang-nhap h1 { margin: 4px 0 0; font-size: 22px; }
.the-dang-nhap .phu { margin: 0 0 8px; color: var(--chu-phu); }
.logo-lon { width: 56px; height: 56px; border-radius: 14px; background: linear-gradient(135deg, #3D7BFF, #7FB3FF); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 22px; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--chu-phu); font-weight: 600; }
input, select, textarea { border: 1px solid var(--vien); border-radius: 8px; padding: 9px 10px; background: #fff; font-size: 15px; color: var(--chu); }
input:focus, select:focus, textarea:focus { outline: 2px solid #B9D0FF; border-color: var(--nhan); }
textarea { min-height: 90px; resize: vertical; }
.loi { color: var(--do); margin: 0; min-height: 1.2em; font-size: 14px; }
.nut-chinh { background: var(--nhan); color: #fff; border: 0; border-radius: 8px; padding: 10px 16px; font-weight: 600; }
.nut-chinh:hover { background: #255fd1; }
.nut-vien { background: transparent; border: 1px solid var(--vien); border-radius: 8px; padding: 7px 12px; color: inherit; }
.nut-nho { padding: 5px 10px; font-size: 13px; }
.nut-do { background: #fff; color: var(--do); border: 1px solid #F1C4C4; border-radius: 8px; padding: 7px 12px; }

/* khung ứng dụng */
.ung-dung { display: flex; min-height: 100%; }
.thanh-ben { width: 248px; flex: none; background: var(--ben); color: var(--ben-chu); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.thuong-hieu { display: flex; gap: 12px; align-items: center; padding: 20px 18px 16px; }
.thuong-hieu .logo { width: 40px; height: 40px; border-radius: 10px; background: linear-gradient(135deg, #3D7BFF, #7FB3FF); color: #fff; display: grid; place-items: center; font-weight: 800; }
.thuong-hieu b { color: #fff; letter-spacing: .5px; display: block; }
.thuong-hieu small { font-size: 10px; letter-spacing: 2px; color: #8796B4; }
#menu { flex: 1; overflow-y: auto; padding: 6px 10px; display: grid; gap: 2px; align-content: start; }
#menu a { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; color: var(--ben-chu); text-decoration: none; font-weight: 500; }
#menu a:hover { background: var(--ben-2); color: #fff; }
#menu a.dang { background: var(--ben-sang); color: #fff; }
#menu a i { font-style: normal; width: 20px; text-align: center; opacity: .9; }
#menu .nhom-menu { font-size: 11px; letter-spacing: 1.5px; color: #6E7E9E; padding: 14px 12px 4px; }
.chan-ben { padding: 14px 16px; border-top: 1px solid #22314F; display: grid; gap: 8px; font-size: 13px; }
.chan-ben .nut-vien { border-color: #2C3D60; color: #fff; }
.noi-dung { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.thanh-tren { display: flex; align-items: center; gap: 12px; padding: 14px 24px; background: var(--the); border-bottom: 1px solid var(--vien); position: sticky; top: 0; z-index: 5; }
.thanh-tren { flex-wrap: wrap; }
.thanh-tren h2 { margin: 0; font-size: 19px; flex: 1 1 auto; white-space: nowrap; }
.hanh-dong-tren { display: flex; gap: 8px; flex-wrap: wrap; }
.nut-menu { display: none; border: 1px solid var(--vien); background: #fff; border-radius: 8px; padding: 6px 10px; }
.trang { padding: 20px 24px 40px; }
.trang > * + * { margin-top: 14px; }
.hep { max-width: 520px; }
.man-mo { display: none; }

/* thẻ, lưới */
.luoi { display: grid; gap: 14px; }
.luoi-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.luoi-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.the { background: var(--the); border: 1px solid var(--vien); border-radius: var(--bo); box-shadow: var(--bong); padding: 16px; min-width: 0; }
.the h3 { margin: 0 0 10px; font-size: 15px; }
.so-lon { font-size: 28px; font-weight: 800; margin-top: 4px; }
.so-nhan { font-size: 13px; color: var(--chu-phu); font-weight: 600; }
.kpi-do .so-lon { color: var(--do); } .kpi-lam .so-lon { color: var(--lam); } .kpi-xanh .so-lon { color: var(--xanh); }
.trong { color: var(--chu-phu); font-size: 14px; padding: 8px 0; }
.ds-gon { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ds-gon li { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 8px 10px; border: 1px solid var(--vien); border-radius: 8px; cursor: pointer; }
.ds-gon li:hover { border-color: #B9D0FF; }
.ds-gon .ten { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nho { font-size: 12px; color: var(--chu-phu); }

/* nhãn màu */
.vien-tron { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; color: #fff; }
.td-chua_thuc_hien { background: var(--do); } .td-dang_lam { background: var(--lam); } .td-xong { background: var(--xanh); } .td-tam_dung { background: var(--xam); }
.ut-qt_gap { background: var(--ut1); } .ut-qt_khong_gap { background: var(--ut2); } .ut-gap_khong_qt { background: var(--ut3); } .ut-khong_qt_khong_gap { background: var(--ut4); color: var(--ut4-chu); }
select.chon-mau { border: 0; border-radius: 999px; padding: 4px 26px 4px 10px; font-size: 13px; font-weight: 600; color: #fff; appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 13px) 50%, calc(100% - 8px) 50%; background-size: 5px 5px; background-repeat: no-repeat; max-width: 100%; }
select.chon-mau option { color: var(--chu); background: #fff; }
select.chon-mau.ut-khong_qt_khong_gap { color: var(--ut4-chu); }
.cham-du-an { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }

/* bảng kiểu sheet */
.bo-loc { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; align-items: end; }
.bo-loc label { font-size: 12px; }
.bo-loc input, .bo-loc select { padding: 7px 8px; font-size: 14px; }
.cuon-ngang { overflow-x: auto; border-radius: var(--bo); border: 1px solid var(--vien); box-shadow: var(--bong); background: #fff; }
table.sheet { border-collapse: collapse; width: 100%; min-width: 980px; font-size: 14px; }
.sheet th { background: var(--sheet); color: #fff; font-family: Georgia, "Times New Roman", serif; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; padding: 10px 8px; text-align: center; position: sticky; top: 0; }
.sheet td { border: 1px dashed #C9CED8; padding: 6px 8px; vertical-align: middle; }
.sheet td.ngay, .sheet td.cty { font-weight: 600; }
.sheet td.ngay { text-align: center; white-space: nowrap; }
.sheet tr.dau-ngay td { border-top: 2px solid #9AA4B5; }
.sheet .ten-viec { cursor: pointer; }
.sheet .ten-viec:hover { color: var(--nhan); text-decoration: underline; }
.sheet .chi-tiet { color: var(--chu-phu); max-width: 260px; }
.sheet .ai { font-size: 11px; background: #EEF3FF; color: #2F55B5; border-radius: 6px; padding: 1px 6px; margin-left: 6px; }
.qua-han { color: var(--do); font-weight: 600; }
.ngay-the { margin: 14px 4px 6px; font-size: 13px; color: var(--chu-phu); }
.ngay-the:first-child { margin-top: 4px; }
.the-viec { background: #fff; border: 1px solid var(--vien); border-radius: 10px; padding: 10px 12px; margin: 0 0 8px; display: grid; gap: 6px; }
.the-viec .ten-viec { font-weight: 600; cursor: pointer; }
.hang-chon { display: flex; gap: 6px; flex-wrap: wrap; }
@media (max-width: 700px) { #bang-viec.cuon-ngang { border: 0; box-shadow: none; background: transparent; } }

/* ma trận */
.ma-tran { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.o-mt { border-radius: var(--bo); padding: 14px; min-height: 160px; border: 1px solid var(--vien); background: #fff; }
.o-mt h3 { margin: 0 0 8px; font-size: 14px; display: flex; justify-content: space-between; }
.o-mt.qt_gap { border-top: 6px solid var(--ut1); } .o-mt.qt_khong_gap { border-top: 6px solid var(--ut2); }
.o-mt.gap_khong_qt { border-top: 6px solid var(--ut3); } .o-mt.khong_qt_khong_gap { border-top: 6px solid #E2C766; }

/* dự án */
.the-du-an { cursor: pointer; display: grid; gap: 8px; }
.the-du-an h3 { margin: 0; display: flex; align-items: center; }
.thanh-tien { height: 8px; background: #EDF0F5; border-radius: 99px; overflow: hidden; }
.thanh-tien span { display: block; height: 100%; background: var(--xanh); }
.kanban { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; }
.cot-kb { background: #EEF1F6; border-radius: var(--bo); padding: 10px; min-height: 200px; }
.cot-kb h4 { margin: 2px 4px 10px; font-size: 13px; display: flex; justify-content: space-between; }
.the-kb { background: #fff; border: 1px solid var(--vien); border-radius: 10px; padding: 10px; margin-bottom: 8px; cursor: pointer; display: grid; gap: 6px; }

/* cây đội AI */
.cay-khung { overflow-x: auto; padding: 10px 0 20px; }
.cay, .cay ul { list-style: none; margin: 0; padding: 0; }
.cay { display: flex; justify-content: center; min-width: max-content; }
.cay ul { display: flex; justify-content: center; padding-top: 28px; position: relative; }
.cay li { position: relative; padding: 28px 10px 0; display: flex; flex-direction: column; align-items: center; }
.cay > li { padding-top: 0; }
.cay li::before, .cay li::after { content: ""; position: absolute; top: 0; width: 50%; height: 28px; border-top: 2px solid #9DB4E0; }
.cay li::before { right: 50%; } .cay li::after { left: 50%; border-left: 2px solid #9DB4E0; }
.cay li:only-child::before, .cay li:only-child::after { border-top: 0; }
.cay li:only-child { padding-top: 28px; }
.cay > li::before, .cay > li::after { display: none; }
.cay li:first-child::before, .cay li:last-child::after { border: 0 none; }
.cay li:last-child::before { border-right: 2px solid #9DB4E0; border-radius: 0 8px 0 0; }
.cay li:first-child::after { border-radius: 8px 0 0 0; }
.cay ul::before { content: ""; position: absolute; top: 0; left: 50%; height: 28px; border-left: 2px solid #9DB4E0; }
.cay li:only-child::after { display: none; }
.cay li:only-child::before { border-top: 0; border-radius: 0; border-right: 2px solid #9DB4E0; }
.nut-cay { width: 196px; background: #fff; border: 1px solid var(--vien); border-radius: 14px; box-shadow: var(--bong); padding: 12px; text-align: left; display: grid; gap: 6px; cursor: pointer; }
.nut-cay:hover { border-color: #8FB0F5; transform: translateY(-1px); }
.nut-cay .dau { display: flex; gap: 10px; align-items: center; }
.nut-cay .anh { width: 38px; height: 38px; border-radius: 10px; background: #EEF3FF; display: grid; place-items: center; font-size: 20px; flex: none; }
.nut-cay b { font-size: 14px; display: block; }
.nut-cay .vai { font-size: 11px; color: var(--chu-phu); text-transform: uppercase; letter-spacing: .8px; }
.nut-cay.chu-nhan { background: linear-gradient(135deg, #0F1A33, #2A3B63); color: #fff; border: 0; }
.nut-cay.chu-nhan .vai { color: #9FB0D3; }
.nut-cay.truong { border: 2px solid #3D7BFF; }
.trang-thai-ai { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--chu-phu); }
.den { width: 8px; height: 8px; border-radius: 50%; background: #B0B8C6; flex: none; }
.den.ban { background: #F59E0B; box-shadow: 0 0 0 3px #FDE7BF; } .den.ranh { background: #22A06B; }
.viec-ai { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.viec-ai li { border: 1px solid var(--vien); border-radius: 10px; padding: 10px; display: grid; gap: 4px; }
.viec-ai pre { white-space: pre-wrap; font: 12.5px/1.45 ui-monospace, Menlo, monospace; background: #F6F8FB; padding: 8px; border-radius: 8px; margin: 4px 0 0; max-height: 220px; overflow: auto; }
.tt-ai { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: #EEF1F6; color: #3A4458; }
.tt-ai.completed { background: #E3F4E8; color: #1E6B3A; } .tt-ai.in_progress, .tt-ai.pending { background: #E6EEFF; color: #2550B8; }
.tt-ai.failed, .tt-ai.cancelled, .tt-ai.stale, .tt-ai.in_review, .tt-ai.blocked { background: #FDECEC; color: #A3271F; }

/* hộp thoại, ngăn bên, thông báo */
.hop-thoai { position: fixed; inset: 0; background: rgba(15,26,51,.45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.hop-thoai-the { background: #fff; border-radius: 14px; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; padding: 22px; position: relative; }
.hop-thoai-the h3 { margin: 0 0 14px; }
.dong { position: absolute; top: 10px; right: 12px; border: 0; background: transparent; font-size: 24px; line-height: 1; color: var(--chu-phu); }
.form { display: grid; gap: 12px; }
.form input:not([type=checkbox]):not([type=color]), .form select, .form textarea { width: 100%; min-width: 0; }
.form .hang > * { min-width: 0; }
.form .hang { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form .nut-hang { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
.chon-nhieu { display: flex; flex-wrap: wrap; gap: 6px 14px; font-weight: 500; color: var(--chu); }
.chon-nhieu label { display: flex; gap: 6px; align-items: center; font-weight: 500; font-size: 14px; color: var(--chu); }
.ngan-ben { position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100%); background: #fff; box-shadow: -10px 0 40px rgba(16,24,40,.18); z-index: 40; overflow-y: auto; padding: 22px; }
.ngan-ben h3 { margin: 0 0 6px; padding-right: 30px; }
.thong-bao { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #18202F; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 60; max-width: 92vw; }
.thong-bao.xau { background: var(--do); }
.bang-don { width: 100%; border-collapse: collapse; font-size: 14px; }
.bang-don th, .bang-don td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--vien); }
.bang-don th { font-size: 12px; color: var(--chu-phu); text-transform: uppercase; letter-spacing: .5px; }

/* điện thoại */
@media (max-width: 900px) {
  .thanh-ben { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .2s; z-index: 30; }
  .ung-dung.mo-menu .thanh-ben { transform: none; }
  .ung-dung.mo-menu .man-mo { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; }
  .nut-menu { display: inline-block; }
  .thanh-tren { padding: 10px 16px; }
  .trang { padding: 16px; }
  .ma-tran { grid-template-columns: 1fr; }
  .form .hang { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: repeat(4, 80%); }
  /* cây chuyển sang dọc, thụt lề */
  .cay, .cay ul { display: block; min-width: 0; }
  .cay ul { padding: 0 0 0 22px; border-left: 2px solid #9DB4E0; margin-left: 18px; }
  .cay ul::before, .cay li::before, .cay li::after { display: none; }
  .cay li { padding: 10px 0 0; align-items: stretch; display: block; }
  .nut-cay { width: 100%; }
}
