:root {
  --nen: #faf7f8;
  --the: #ffffff;
  --chu: #2b2229;
  --chu-phu: #76697a;
  --vien: #ece3e8;
  --chinh: #c2185b;
  --chinh-nhat: #fce4ec;
  --xanh: #2e7d32;
  --xanh-nhat: #e8f5e9;
  --vang: #b26a00;
  --vang-nhat: #fff4e0;
  --do: #c62828;
  --do-nhat: #fdecea;
  --xam-nhat: #f3eff2;
  --bong: 0 1px 2px rgba(60, 20, 40, .06), 0 2px 8px rgba(60, 20, 40, .05);
  --bo: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --nen: #17131a; --the: #211b24; --chu: #f3eaf0; --chu-phu: #b3a5b5; --vien: #352b38;
    --chinh: #f06292; --chinh-nhat: #3a1f2c; --xanh: #81c784; --xanh-nhat: #1d2e1f;
    --vang: #ffb74d; --vang-nhat: #33281a; --do: #ef9a9a; --do-nhat: #3a1e1e; --xam-nhat: #2a222d;
    --bong: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--nen); color: var(--chu);
  font: 15px/1.5 "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--chinh); }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---- khung ---- */
.khung { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.thanh-ben { background: var(--the); border-right: 1px solid var(--vien); padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.thuong-hieu { font-weight: 700; font-size: 17px; padding: 4px 10px 16px; }
.thuong-hieu small { display: block; font-weight: 400; color: var(--chu-phu); font-size: 12px; }
.menu a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: var(--chu); text-decoration: none; margin-bottom: 2px; }
.menu a:hover { background: var(--xam-nhat); }
.menu a.dang-mo { background: var(--chinh-nhat); color: var(--chinh); font-weight: 600; }
.menu a.sap-co { color: var(--chu-phu); }
.menu .nhan-dot { margin-left: auto; font-size: 11px; background: var(--xam-nhat); color: var(--chu-phu); padding: 1px 7px; border-radius: 20px; }
.menu-nhom { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--chu-phu); padding: 14px 10px 4px; }
.noi-dung { padding: 24px 28px 80px; max-width: 1400px; width: 100%; min-width: 0; }
h1 { font-size: 22px; margin: 0 0 4px; }
.mo-ta { color: var(--chu-phu); margin: 0 0 18px; }

/* ---- the ---- */
.the { background: var(--the); border: 1px solid var(--vien); border-radius: var(--bo); box-shadow: var(--bong); padding: 16px; margin-bottom: 16px; }
.luoi-so { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.o-so { background: var(--the); border: 1px solid var(--vien); border-radius: var(--bo); padding: 14px 16px; box-shadow: var(--bong); }
.o-so .nhan { color: var(--chu-phu); font-size: 13px; }
.o-so .so { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.o-so .phu { color: var(--chu-phu); font-size: 12px; }

/* ---- form ---- */
.hang-loc { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
input[type=text], input[type=search], input[type=number], input[type=tel], select, textarea {
  background: var(--the); border: 1px solid var(--vien); border-radius: 9px; padding: 8px 11px; min-height: 38px; max-width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--chinh); outline-offset: -1px; }
.o-tim-lon { font-size: 18px; padding: 12px 16px; width: 100%; border-radius: 12px; }
.nut { background: var(--the); border: 1px solid var(--vien); border-radius: 9px; padding: 8px 14px; cursor: pointer; min-height: 38px; white-space: nowrap; }
.nut:hover { background: var(--xam-nhat); }
a.nut { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; color: inherit; }
a.nut.chinh { color: #fff; }
.nut.chinh { background: var(--chinh); border-color: var(--chinh); color: #fff; font-weight: 600; }
.nut.chinh:hover { filter: brightness(1.08); }
.nut.nho { padding: 4px 9px; min-height: 30px; font-size: 13px; }
.nut:disabled { opacity: .5; cursor: default; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 5px 12px; border-radius: 20px; border: 1px solid var(--vien); background: var(--the); cursor: pointer; font-size: 13px; user-select: none; }
.chip.chon { background: var(--chinh-nhat); border-color: var(--chinh); color: var(--chinh); font-weight: 600; }
label.dong-form { display: block; margin-bottom: 10px; }
label.dong-form span { display: block; font-size: 13px; color: var(--chu-phu); margin-bottom: 3px; }
label.dong-form input, label.dong-form select, label.dong-form textarea { width: 100%; }
.luoi-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.dong-ngh { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 8px; margin-bottom: 8px; }
.dong-ngh input { width: 100%; min-width: 0; }

/* ---- bang ---- */
.bang-cuon { overflow-x: auto; }
table.bang { width: 100%; border-collapse: collapse; font-size: 14px; }
.bang th { text-align: left; font-size: 12px; color: var(--chu-phu); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--vien); white-space: nowrap; background: var(--the); position: sticky; top: 0; }
.bang td { padding: 8px 10px; border-bottom: 1px solid var(--vien); vertical-align: top; }
.bang tr.bam { cursor: pointer; }
.bang tr.bam:hover td { background: var(--xam-nhat); }
.so-phai { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kenh b { display: block; }
.kenh small { color: var(--chu-phu); }
.nhan-mau { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 20px; background: var(--xam-nhat); color: var(--chu-phu); white-space: nowrap; margin: 1px 2px 1px 0; }
.nhan-mau.xanh { background: var(--xanh-nhat); color: var(--xanh); }
.nhan-mau.vang { background: var(--vang-nhat); color: var(--vang); }
.nhan-mau.do { background: var(--do-nhat); color: var(--do); }
.nhan-mau.hong { background: var(--chinh-nhat); color: var(--chinh); }
.phan-trang { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; color: var(--chu-phu); font-size: 13px; }
.thanh-diem { height: 6px; background: var(--xam-nhat); border-radius: 4px; width: 70px; overflow: hidden; margin-top: 4px; }
.thanh-diem i { display: block; height: 100%; background: var(--chinh); }
.ly-do { color: var(--chu-phu); font-size: 12px; }
.trong { text-align: center; color: var(--chu-phu); padding: 40px 10px; }

/* ---- ngan keo ---- */
.man-toi { position: fixed; inset: 0; background: rgba(20, 10, 15, .35); z-index: 40; }
.ngan-keo { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--the); z-index: 41; overflow-y: auto; padding: 20px; box-shadow: -4px 0 24px rgba(0,0,0,.12); }
.ngan-keo h2 { margin: 0 0 4px; font-size: 19px; }
.dau-ngan { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; margin-bottom: 14px; }

/* ---- thong bao ---- */
#bao { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--chu); color: var(--nen); padding: 10px 18px; border-radius: 10px; z-index: 60; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; }
#bao.hien { opacity: 1; }

/* ---- dang nhap ---- */
.dang-nhap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.dang-nhap .the { width: min(380px, 100%); text-align: center; padding: 28px 22px; }
.o-ma { font-size: 26px; letter-spacing: .35em; text-align: center; width: 100%; margin: 12px 0; }

/* ---- keo tha file ---- */
.vung-tha { border: 2px dashed var(--vien); border-radius: var(--bo); padding: 34px 16px; text-align: center; color: var(--chu-phu); cursor: pointer; background: var(--the); }
.vung-tha.dang-tha { border-color: var(--chinh); background: var(--chinh-nhat); }

/* ---- kanban ---- */
.kanban { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 10px; align-items: flex-start; }
.cot-kb { flex: 0 0 230px; background: var(--xam-nhat); border-radius: var(--bo); padding: 8px; min-height: 120px; }
.cot-kb.keo-toi { outline: 2px dashed var(--chinh); }
.dau-kb { font-weight: 600; font-size: 13px; padding: 4px 4px 8px; display: flex; gap: 6px; }
.the-kb { background: var(--the); border: 1px solid var(--vien); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; cursor: pointer; font-size: 13px; }
.the-kb.gap { border-left: 4px solid var(--do); }

/* ---- lich ---- */
.lich { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.ten-thu { font-size: 12px; color: var(--chu-phu); text-align: center; padding: 4px; }
.o-lich { border: 1px solid var(--vien); border-radius: 8px; min-height: 90px; padding: 4px; font-size: 12px; min-width: 0; }
.o-lich.hom-nay { border-color: var(--chinh); background: var(--chinh-nhat); }
.trong-lich { border: none; }
.so-ngay { font-weight: 600; color: var(--chu-phu); }
.thu-dt { display: none; }
.su-kien { background: var(--xam-nhat); border-radius: 5px; padding: 2px 5px; margin-top: 3px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.su-kien.gap { background: var(--do-nhat); color: var(--do); }

.luoi-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }

/* ---- in bao cao ---- */
@media print {
  .thanh-ben, .nut-menu, .khong-in, #bao { display: none !important; }
  .khung { display: block; }
  .noi-dung { padding: 0; max-width: none; }
  body { background: #fff; color: #000; }
  .the, .o-so { box-shadow: none; break-inside: avoid; }
}

/* ---- dien thoai ---- */
.nut-menu { display: none; }
@media (max-width: 860px) {
  .khung { grid-template-columns: 1fr; }
  .thanh-ben { position: fixed; z-index: 50; left: 0; top: 0; width: 250px; transform: translateX(-100%); transition: transform .2s; box-shadow: 4px 0 24px rgba(0,0,0,.15); }
  .thanh-ben.mo { transform: none; }
  .nut-menu { display: inline-flex; position: sticky; top: 0; z-index: 30; width: 100%; background: var(--the); border-bottom: 1px solid var(--vien); padding: 10px 16px; align-items: center; gap: 10px; font-weight: 600; }
  .nut-menu button { border: 1px solid var(--vien); background: var(--the); border-radius: 8px; padding: 4px 10px; font-size: 18px; }
  .noi-dung { padding: 16px 16px 80px; }
  .luoi-form, .dong-ngh { grid-template-columns: minmax(0, 1fr); }
  .dong-ngh { padding-bottom: 8px; border-bottom: 1px solid var(--vien); }
  table.the-dt thead { display: none; }
  table.the-dt, table.the-dt tbody, table.the-dt tr, table.the-dt td { display: block; width: 100%; }
  table.the-dt tr { border: 1px solid var(--vien); border-radius: 10px; margin-bottom: 10px; padding: 6px 4px; background: var(--the); }
  table.the-dt td { border: none; padding: 3px 10px; text-align: left; }
  table.the-dt td[data-nhan]::before { content: attr(data-nhan) ": "; color: var(--chu-phu); font-size: 12px; }
  table.the-dt td.an-dt { display: none; }
  .hang-loc > * { flex: 1 1 140px; }
  .lich, .luoi-2 { grid-template-columns: minmax(0, 1fr); }
  .luoi-so { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px; }
  .o-so { padding: 10px 12px; }
  .o-so .so { font-size: 21px; }
  .ten-thu, .trong-lich, .o-lich.rong { display: none; }
  .o-lich { min-height: 0; }
  .thu-dt { display: inline; }
  .cot-kb { flex-basis: 78vw; }
}
