:root {
  --nen: #f4f6f9; --the: #ffffff; --chu: #16202e; --phu: #5b6878; --vien: #dfe4eb; --vien-dam: #c5cdd8;
  --chinh: #0e2440; --nhan: #0f8f7e; --nhan-nhat: #e3f4f1; --do: #c0392b; --do-nhat: #fdecea;
  --vang: #a86b00; --vang-nhat: #fff4dc; --bong: 0 1px 2px rgba(16, 32, 54, .06), 0 2px 8px rgba(16, 32, 54, .05);
  --bo: 10px; --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --nen: #0d1520; --the: #152131; --chu: #e6ebf2; --phu: #93a1b3; --vien: #233348; --vien-dam: #30445e;
    --chinh: #0a1a2e; --nhan: #45c4b0; --nhan-nhat: #123a37; --do: #ff7b6e; --do-nhat: #3b1d1b;
    --vang: #f0b54a; --vang-nhat: #3a2d12; --bong: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--nen); color: var(--chu); font: 15px/1.5 var(--font); -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--nhan); text-decoration: none; }
a:hover { text-decoration: underline; }
.dang-tai { padding: 40px; text-align: center; color: var(--phu); }

/* ---------- Khung ---------- */
.khung { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.thanh-ben { background: var(--chinh); color: #d8e2ee; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.thuong-hieu { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; font-weight: 650; letter-spacing: .2px; }
.thuong-hieu img { width: 30px; height: 30px; }
.thuong-hieu small { display: block; font-weight: 400; color: #8fa6c1; font-size: 12px; }
.muc { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: #c7d3e2; font-size: 14.5px; }
.muc:hover { background: rgba(255, 255, 255, .07); text-decoration: none; }
.muc.dang { background: rgba(95, 211, 192, .16); color: #fff; }
.muc svg { width: 18px; height: 18px; flex: none; }
.nhom-muc { margin: 14px 12px 4px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .8px; color: #7d94b0; }
.chan-ben { margin-top: auto; padding: 12px; font-size: 13px; color: #9fb2c8; border-top: 1px solid rgba(255, 255, 255, .08); }
.chan-ben b { color: #fff; display: block; font-weight: 600; }
.chinh { min-width: 0; display: flex; flex-direction: column; }
.dau { display: flex; align-items: center; gap: 12px; padding: 14px 28px; border-bottom: 1px solid var(--vien); background: var(--the); position: sticky; top: 0; z-index: 5; }
.dau h1 { font-size: 18px; margin: 0; font-weight: 650; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.noi-dung { padding: 24px 28px 60px; max-width: 1400px; width: 100%; }
.duong-dan { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; color: var(--phu); font-size: 13.5px; margin-bottom: 14px; }
.duong-dan a { color: var(--phu); }
.duong-dan span.sep { opacity: .5; }

/* ---------- Thành phần ---------- */
.the { background: var(--the); border: 1px solid var(--vien); border-radius: var(--bo); box-shadow: var(--bong); }
.the-dem { padding: 18px 20px; }
.the-dem .so { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.the-dem .nhan { color: var(--phu); font-size: 13.5px; }
.luoi { display: grid; gap: 14px; }
.luoi-4 { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.luoi-3 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.o-nguon { display: flex; align-items: center; gap: 12px; padding: 14px 16px; color: var(--chu); }
.o-nguon:hover { border-color: var(--nhan); text-decoration: none; }
.o-nguon .ten { font-weight: 600; word-break: break-word; }
.o-nguon .mo { color: var(--phu); font-size: 13px; }
.bieu { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: var(--nhan-nhat); color: var(--nhan); flex: none; }
.bieu svg { width: 20px; height: 20px; }
h2 { font-size: 15px; margin: 28px 0 10px; font-weight: 650; }
h2:first-child { margin-top: 0; }

.nut { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 6px 14px; border-radius: 8px; border: 1px solid var(--vien-dam); background: var(--the); cursor: pointer; font-weight: 550; font-size: 14px; white-space: nowrap; }
.nut:hover { border-color: var(--nhan); }
.nut:disabled { opacity: .5; cursor: not-allowed; }
.nut.chinh-nut { background: var(--nhan); border-color: var(--nhan); color: #fff; }
.nut.do { color: var(--do); border-color: color-mix(in srgb, var(--do) 40%, var(--vien)); }
.nut.do:hover { background: var(--do-nhat); }
.nut.nho { min-height: 30px; padding: 3px 10px; font-size: 13px; }
.nut svg { width: 16px; height: 16px; }
.hang-nut { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cach { flex: 1; }

input[type=text], input[type=password], input[type=search], input[type=number], select, textarea {
  border: 1px solid var(--vien-dam); background: var(--the); border-radius: 8px; padding: 8px 11px; min-height: 38px; width: 100%; font-size: 16px; }
input:focus, select:focus, textarea:focus, .nut:focus-visible, a:focus-visible { outline: 2px solid var(--nhan); outline-offset: 1px; }
textarea { font-family: var(--mono); font-size: 14px; resize: vertical; }
label.truong { display: block; margin-bottom: 12px; }
label.truong > span { display: block; font-size: 13.5px; color: var(--phu); margin-bottom: 4px; }
.goi-y { color: var(--phu); font-size: 13px; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; background: var(--nhan-nhat); color: var(--nhan); font-weight: 600; }
.chip.vang { background: var(--vang-nhat); color: var(--vang); }
.chip.do { background: var(--do-nhat); color: var(--do); }
.chip.xam { background: var(--nen); color: var(--phu); border: 1px solid var(--vien); }
.canh-bao { padding: 10px 14px; border-radius: 8px; background: var(--vang-nhat); color: var(--vang); font-size: 14px; margin-bottom: 14px; }
.canh-bao.do { background: var(--do-nhat); color: var(--do); }
.rong { padding: 36px; text-align: center; color: var(--phu); }

/* ---------- Bảng dữ liệu ---------- */
.cong-cu { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.cong-cu input[type=search] { max-width: 340px; }
.bao-bang { overflow: auto; max-height: calc(100vh - 230px); border: 1px solid var(--vien); border-radius: var(--bo); background: var(--the); }
table.bang { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13.5px; }
.bang th, .bang td { padding: 7px 12px; border-bottom: 1px solid var(--vien); text-align: left; vertical-align: top; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bang th { position: sticky; top: 0; background: var(--the); z-index: 1; font-weight: 600; color: var(--phu); font-size: 12.5px; cursor: pointer; user-select: none; box-shadow: inset 0 -1px 0 var(--vien-dam); }
.bang th .kieu { font-weight: 400; opacity: .7; margin-left: 4px; }
.bang tbody tr { cursor: pointer; }
.bang tbody tr:hover td { background: color-mix(in srgb, var(--nhan) 6%, transparent); }
.bang td.so { text-align: right; font-variant-numeric: tabular-nums; }
.bang td.rid, .bang th.rid { color: var(--phu); position: sticky; left: 0; background: var(--the); }
.gia-null { color: var(--phu); font-style: italic; opacity: .7; }
.gia-an { color: var(--phu); letter-spacing: 2px; }
.gia-blob { color: var(--vang); }
.phan-trang { display: flex; align-items: center; gap: 10px; margin-top: 12px; color: var(--phu); font-size: 13.5px; flex-wrap: wrap; }

/* ---------- Tệp ---------- */
.ds-tep .dong-tep { display: grid; grid-template-columns: 28px 1fr 110px 150px auto; gap: 12px; align-items: center; padding: 9px 14px; border-bottom: 1px solid var(--vien); }
.ds-tep .dong-tep:last-child { border-bottom: 0; }
.ds-tep .dong-tep:hover { background: color-mix(in srgb, var(--nhan) 5%, transparent); }
.ds-tep .ten-tep { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--chu); }
.ds-tep .ten-tep.thu-muc { font-weight: 600; }
.ds-tep .meta { color: var(--phu); font-size: 13px; font-variant-numeric: tabular-nums; }
.ds-tep .bieu-tep { color: var(--phu); display: grid; place-items: center; }
.ds-tep .bieu-tep svg { width: 20px; height: 20px; }
.vung-tha { border: 2px dashed var(--vien-dam); border-radius: var(--bo); padding: 14px; text-align: center; color: var(--phu); font-size: 14px; margin-bottom: 12px; }
.vung-tha.dang-keo { border-color: var(--nhan); background: var(--nhan-nhat); color: var(--nhan); }
.tien-do { height: 6px; border-radius: 3px; background: var(--vien); overflow: hidden; }
.tien-do > i { display: block; height: 100%; background: var(--nhan); width: 0; transition: width .2s; }
.ds-tai-len { display: grid; gap: 8px; margin-bottom: 12px; }
.ds-tai-len .muc-tl { padding: 10px 14px; font-size: 13.5px; }

/* ---------- Hộp thoại + ngăn kéo ---------- */
.man-che { position: fixed; inset: 0; background: rgba(8, 18, 32, .45); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.hop { background: var(--the); border-radius: 14px; width: 100%; max-width: 460px; max-height: 90vh; overflow: auto; padding: 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.hop.rong-hon { max-width: 720px; }
.hop h3 { margin: 0 0 6px; font-size: 17px; }
.hop .hang-nut { justify-content: flex-end; margin-top: 18px; }
.ngan-keo { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--the); z-index: 40; box-shadow: -10px 0 40px rgba(0, 0, 0, .18); display: flex; flex-direction: column; }
.ngan-keo .dau-nk { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--vien); }
.ngan-keo .dau-nk h3 { margin: 0; font-size: 16px; flex: 1; }
.ngan-keo .than-nk { overflow: auto; padding: 16px 18px; flex: 1; }
.ngan-keo .chan-nk { padding: 12px 18px; border-top: 1px solid var(--vien); }
.truong-dong { margin-bottom: 12px; }
.truong-dong .ten-cot { font-size: 12.5px; color: var(--phu); margin-bottom: 3px; display: flex; gap: 6px; align-items: center; }
.truong-dong .gia { font-family: var(--mono); font-size: 13px; white-space: pre-wrap; word-break: break-word; background: var(--nen); border-radius: 6px; padding: 7px 9px; min-height: 32px; }
.xem-truoc { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto; border-radius: 8px; }
.ma-bi-mat { font-family: var(--mono); font-size: 17px; letter-spacing: 2px; background: var(--nen); padding: 10px; border-radius: 8px; text-align: center; word-break: break-all; user-select: all; }
.dong-nk { display: grid; grid-template-columns: 150px 120px 1fr auto; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--vien); font-size: 13.5px; align-items: center; }
.dong-nk:last-child { border-bottom: 0; }
.dong-nk .dt { color: var(--phu); word-break: break-all; }

/* ---------- Đăng nhập ---------- */
.trang-dn { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, #0e2440 0%, #13365c 55%, #0f8f7e 140%); }
.hop-dn { width: 100%; max-width: 400px; background: var(--the); border-radius: 16px; padding: 30px 28px; box-shadow: 0 30px 80px rgba(0, 0, 0, .3); }
.hop-dn .thuong-hieu { color: var(--chu); padding: 0 0 18px; }
.hop-dn .thuong-hieu small { color: var(--phu); }
.hop-dn input[name=ma] { letter-spacing: 6px; font-family: var(--mono); font-size: 20px; text-align: center; }
.loi-dn { color: var(--do); font-size: 14px; min-height: 20px; margin: 4px 0 10px; }
.khoa-sua { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }

#thong-bao { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; }
#thong-bao .tb { background: #1d2b3c; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); max-width: min(90vw, 520px); }
#thong-bao .tb.loi { background: #8e2a20; }

/* ---------- Điện thoại ---------- */
.nut-menu { display: none; }
@media (max-width: 860px) {
  .khung { grid-template-columns: 1fr; }
  .thanh-ben { position: fixed; z-index: 45; left: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .khung.mo-menu .thanh-ben { transform: none; box-shadow: 0 0 60px rgba(0, 0, 0, .4); }
  .nut-menu { display: inline-flex; }
  .dau { padding: 10px 16px; }
  .noi-dung { padding: 16px 16px 60px; }
  .ds-tep .dong-tep { grid-template-columns: 24px 1fr auto; }
  .ds-tep .dong-tep .meta { display: none; }
  .dong-nk { grid-template-columns: 1fr auto; }
  .dong-nk .luc-nk, .dong-nk .ai { grid-column: 1 / -1; }
  .bao-bang { max-height: none; }
  .cong-cu input[type=search] { max-width: none; }
}

/* tiện ích (không dùng style nội dòng vì chính sách bảo mật CSP) */
.u-contents{display:contents}.u-so-nho{font-size:18px!important;padding-top:8px}.u-mb10{margin-bottom:10px}.u-mb8{margin-bottom:8px}
.u-phai{margin-left:auto;font-size:12.5px}.u-mt10{margin-top:10px}.u-mt6{margin-top:6px}.u-mt8{margin-top:8px}.u-my10{margin:10px 0}
.u-mt16{margin:16px 0 0}.u-w280{max-width:280px}.u-min0{min-width:0}.u-the-form{padding:22px;max-width:440px}.u-p4{padding:4px 0!important}
.u-rong{width:100%}.u-ngat{word-break:break-all}
.chip svg, .khoa-sua svg { width: 14px; height: 14px; vertical-align: -2px; flex: none; }
.khoa-sua .chip { display: inline-flex; align-items: center; gap: 4px; }
@media (max-width: 860px) {
  .ds-tep .dong-tep { grid-template-columns: 24px 1fr; row-gap: 6px; }
  .ds-tep .dong-tep > .hang-nut { grid-column: 2; }
  .ds-tep .ten-tep { white-space: normal; word-break: break-word; }
}
