/* Giao diện QLTS IT — "sáng, hiện đại" (duyệt 19/10/2026, theo bản mẫu TongQuanV2 / ChiTietV2) */
:root {
  --bg: #F6F7F9; --surface: #FFFFFF; --ink: #101828; --ink-2: #344054; --muted: #667085; --faint: #98A2B3;
  --line: #E4E7EC; --line-soft: #F2F4F7; --hover: #F9FAFB;
  --accent: #1F5BD8; --accent-dark: #1847AD; --accent-soft: #EEF4FF; --accent-line: #B2CCFF;
  --green: #067647; --green-soft: #ECFDF3; --red: #B42318; --red-soft: #FEF3F2; --red-dot: #F04438;
  --amber: #B54708; --amber-soft: #FFFAEB; --violet: #5925DC; --violet-soft: #F4F3FF; --gray: #475467; --gray-soft: #F2F4F7;
  --bs-body-font-family: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --bs-body-color: var(--ink); --bs-body-bg: var(--bg); --bs-border-color: var(--line);
  --bs-link-color-rgb: 31, 91, 216; --bs-link-hover-color-rgb: 24, 71, 173;
}
body { font-size: 14px; background: var(--bg); color: var(--ink); }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
.mono, code.asset { font-family: 'IBM Plex Mono', ui-monospace, Consolas, monospace; }
code.asset { color: var(--ink); font-weight: 600; font-size: 13px; }
a code.asset { color: var(--accent); }
.ico { flex: none; }

/* ---------- Khung trang ---------- */
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side { flex: 1 1 240px; max-width: 100%; background: var(--surface); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex: none; }
.brand-name { font-weight: 700; font-size: 14px; line-height: 1.2; display: block; }
.brand-sub { font-size: 12px; color: var(--muted); }
.nav-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); padding: 14px 10px 4px; }
.side .nav-link { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 10px; border-radius: 8px; color: var(--ink-2); font-weight: 500; }
.side .nav-link .ico { color: var(--muted); }
.side .nav-link:hover { background: var(--line-soft); color: var(--ink); text-decoration: none; }
.side .nav-link.active { background: var(--accent-soft); color: var(--accent); }
.side .nav-link.active .ico { color: var(--accent); }
.nav-count { margin-left: auto; font-size: 11px; font-weight: 600; background: #FEF0C7; color: #93370D; border-radius: 999px; padding: 0 7px; }
.side details { border-radius: 8px; }
.side summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
.side summary::-webkit-details-marker { display: none; }
.side summary .ico { transition: transform .15s; color: var(--faint); }
.side details[open] summary .ico { transform: rotate(90deg); }
.side .sub-links { display: flex; flex-direction: column; gap: 2px; }

.main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 10px clamp(16px, 3vw, 32px); background: var(--surface); border-bottom: 1px solid var(--line); }
.search { flex: 1 1 280px; max-width: 560px; display: flex; align-items: center; gap: 8px; border: 1px solid #D0D5DD; border-radius: 8px; padding: 0 12px; min-height: 40px; background: var(--surface); color: var(--muted); margin: 0; }
.search:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); }
.search input { border: 0; outline: 0; font: inherit; flex: 1; min-width: 0; background: none; color: var(--ink); }
.kbd { font-size: 11px; border: 1px solid #D0D5DD; border-radius: 4px; padding: 0 5px; color: var(--muted); white-space: nowrap; }
.iconbtn { width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; position: relative; color: var(--ink-2); }
.iconbtn:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.iconbtn .dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--red-dot); border: 2px solid var(--surface); }
.me { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.me-link { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; }
.me-link:hover b { color: var(--accent-dark); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: #D1E0FF; color: var(--accent-dark); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: none; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.me b { display: block; font-size: 13px; line-height: 1.2; }
.me span.r { font-size: 12px; color: var(--muted); }

.content { padding: 20px clamp(16px, 3vw, 32px) 48px; display: flex; flex-direction: column; gap: 18px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-head h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.page-head .sub, .sub { color: var(--muted); font-size: 13px; }
.crumb { font-size: 13px; color: var(--muted); }
.crumb a { color: var(--muted); }
.topnav { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Thẻ, ô số liệu ---------- */
.card { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.card-header { background: transparent; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 14px 16px; }
.card-header h2 { margin: 0; font-size: 15px; font-weight: 600; }
.card-header .note { font-size: 12px; color: var(--muted); }
.card.alert-card { border-color: #FECDCA; }
.card.alert-card .card-header { background: var(--red-soft); border-radius: 12px 12px 0 0; }
.card.alert-card h2 { color: var(--red); }

.figs, .kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.fig { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; color: inherit; }
a.fig:hover { border-color: var(--accent-line); text-decoration: none; }
.fig .k { font-size: 13px; color: var(--muted); }
.fig .v { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.fig .v.warn { color: var(--amber); } .fig .v.bad { color: var(--red); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; gap: 12px; align-items: flex-start; color: inherit; }
a.kpi:hover { border-color: var(--accent-line); text-decoration: none; color: inherit; }
.ki { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex: none; }
.ki.blue { background: var(--accent-soft); color: var(--accent); } .ki.green { background: var(--green-soft); color: var(--green); }
.ki.gray { background: var(--gray-soft); color: var(--gray); } .ki.red { background: var(--red-soft); color: var(--red); }
.ki.amber { background: var(--amber-soft); color: var(--amber); }
.kpi .k { font-size: 13px; color: var(--muted); } .kpi .v { font-size: 26px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi .h { font-size: 12px; color: var(--muted); }

/* ---------- Bảng ---------- */
.table { --bs-table-bg: var(--surface); --bs-table-hover-bg: var(--hover); margin: 0; }
.table > thead th { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--hover); border-bottom: 1px solid #EAECF0; white-space: nowrap; padding: 10px 14px; position: sticky; top: 0; }
.table td { font-variant-numeric: tabular-nums; vertical-align: middle; padding: 11px 14px; border-color: var(--line-soft); }
.table tbody tr:hover > td { background: var(--hover); }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.card .table-wrap { border: 0; border-radius: 0 0 12px 12px; }
td.n, th.n { text-align: right; }
.table-compact > thead th, .table-compact td { padding: 9px 10px; }
.table-compact { min-width: 0 !important; }
.zero { color: #D0D5DD; }

/* ---------- Trạng thái (chấm tròn + màu) ---------- */
.pill, .chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--gray-soft); color: var(--gray); }
.pill::before, .chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill.in_use, .pill.ok, .chip.green { background: var(--green-soft); color: var(--green); }
.pill.in_stock, .pill.info, .chip.blue { background: var(--accent-soft); color: var(--accent-dark); }
.pill.repairing, .pill.warn, .chip.amber { background: var(--amber-soft); color: var(--amber); }
.pill.broken, .pill.pending, .pill.bad, .chip.red { background: var(--red-soft); color: var(--red); }
.pill.disposed, .pill.idle, .chip.gray { background: var(--gray-soft); color: var(--gray); }
.pill.move, .chip.violet { background: var(--violet-soft); color: var(--violet); }
.br { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--gray-soft); border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
.away { color: var(--violet); font-weight: 600; }
.rule-box { display: flex; flex-wrap: wrap; gap: 8px 28px; background: var(--violet-soft); border: 1px solid #D9D6FE; border-radius: 10px; padding: 12px 16px; font-size: 13px; }
.rule-box b { color: var(--violet); }

/* ---------- Nút ---------- */
.btn { font-weight: 600; min-height: 40px; display: inline-flex; align-items: center; gap: 6px; border-radius: 8px; }
.btn-sm { min-height: 32px; }
.btn-primary { --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-hover-bg: var(--accent-dark); --bs-btn-hover-border-color: var(--accent-dark); --bs-btn-active-bg: var(--accent-dark); --bs-btn-active-border-color: var(--accent-dark); }
.btn-outline-secondary { --bs-btn-color: var(--ink-2); --bs-btn-border-color: #D0D5DD; --bs-btn-bg: var(--surface); --bs-btn-hover-bg: var(--hover); --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: #D0D5DD; --bs-btn-active-bg: var(--line-soft); --bs-btn-active-color: var(--ink); }
.btn-dark { --bs-btn-bg: var(--ink); --bs-btn-border-color: var(--ink); }
.btn:hover { text-decoration: none; }
.dropdown-menu { border-color: var(--line); border-radius: 10px; box-shadow: 0 12px 24px -4px rgba(16,24,40,.12); padding: 6px; min-width: 230px; }
.dropdown-item { display: flex; align-items: center; gap: 10px; border-radius: 6px; padding: 8px 10px; font-weight: 500; color: var(--ink-2); }
.dropdown-item .ico { color: var(--muted); }
.dropdown-item.text-danger .ico { color: var(--red); }

/* ---------- Danh sách, cặp nhãn - giá trị ---------- */
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.list-row:last-child { border-bottom: 0; }
.list-row .t { font-weight: 600; }
.list-row .m { font-size: 12px; color: var(--muted); }
.sev { width: 4px; align-self: stretch; border-radius: 4px; flex: none; }
.sev.red { background: var(--red-dot); } .sev.amber { background: #F79009; } .sev.violet { background: #7A5AF8; } .sev.gray { background: var(--faint); }
.empty { padding: 16px; color: var(--muted); font-size: 13px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.kv > div { padding: 11px 16px; border-bottom: 1px solid var(--line-soft); }
.kv .k { font-size: 12px; color: var(--muted); }
.kv .v { font-weight: 500; overflow-wrap: anywhere; }

/* ---------- Trang chi tiết thiết bị ---------- */
.hero { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.hero-top { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; justify-content: space-between; }
.hero-title { display: flex; gap: 14px; align-items: center; min-width: 0; }
.thumb { width: 56px; height: 56px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex: none; }
.hero h1 { margin: 0; font-size: 22px; font-weight: 700; font-family: 'IBM Plex Mono', ui-monospace, monospace; }
.hero .model { color: var(--gray); font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: 10px; overflow: hidden; }
.fact { background: var(--hover); padding: 12px 14px; min-width: 0; }
.fact .k { font-size: 12px; color: var(--muted); }
.fact .v { font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fact .s { font-size: 12px; color: var(--muted); }
.tabbar { display: flex; gap: 4px; padding: 0 12px; border-bottom: 1px solid #EAECF0; flex-wrap: wrap; }
.tabbar .tab { border: 0; background: none; font: inherit; font-weight: 600; color: var(--muted); padding: 12px 10px; border-bottom: 2px solid transparent; display: inline-flex; gap: 6px; align-items: center; }
.tabbar .tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tabbar .tab .n { font-size: 11px; background: var(--gray-soft); color: var(--gray); border-radius: 999px; padding: 0 7px; }
.timeline { padding: 6px 16px 12px; }
.timeline .ev { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; padding: 10px 0; position: relative; }
.timeline .ev::before { content: ""; position: absolute; left: 13px; top: 38px; bottom: -10px; width: 2px; background: var(--line-soft); }
.timeline .ev:last-child::before { display: none; }
.timeline .dotic { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; position: relative; z-index: 1; }
.timeline .dotic::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.dotic.ok { background: var(--green-soft); color: var(--green); } .dotic.move { background: var(--violet-soft); color: var(--violet); }
.dotic.warn { background: var(--amber-soft); color: var(--amber); } .dotic.info { background: var(--accent-soft); color: var(--accent); }
.dotic.idle { background: var(--gray-soft); color: var(--gray); } .dotic.bad { background: var(--red-soft); color: var(--red); }
.timeline .t { font-weight: 600; } .timeline .m { font-size: 13px; color: var(--muted); }
.timeline .d { font-size: 12px; color: var(--faint); white-space: nowrap; }
.cost-row { display: flex; justify-content: space-between; padding: 6px 0; font-variant-numeric: tabular-nums; }
.cost-row.total { border-top: 1px solid #EAECF0; margin-top: 6px; padding-top: 10px; font-weight: 700; }
.costbar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; margin: 4px 0 10px; background: var(--gray-soft); }
.costbar i { display: block; height: 100%; }
.quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.quick a, .quick button { font: inherit; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 72px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink-2); font-weight: 600; font-size: 13px; }
.quick a .ico, .quick button .ico { color: var(--accent); }
.quick a:hover, .quick button:hover { background: var(--hover); text-decoration: none; }
.dropdown-menu form { margin: 0; }
.dropdown-item { width: 100%; text-align: left; background: none; border: 0; }

/* ---------- Biểu đồ thanh theo chi nhánh ---------- */
.bars { padding: 12px 16px; display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) 44px; gap: 10px; align-items: center; font-size: 13px; }
.bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--gray-soft); }
.bar i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); padding: 0 16px 14px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; } .legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.seg-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.seg-tabs button { border: 0; background: none; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); padding: 6px 10px; border-radius: 6px; }
.seg-tabs button.on { background: var(--line-soft); color: var(--ink); }

/* ---------- Form ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.filters .form-control, .filters .form-select { min-width: 140px; width: auto; }
.form-label { font-weight: 600; font-size: 13px; margin-bottom: 4px; color: var(--ink-2); }
.form-control, .form-select { border-radius: 8px; border-color: #D0D5DD; min-height: 40px; }
.form-control:focus, .form-select:focus { border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); }
.form-text { font-size: 12px; color: var(--muted); }
.errorlist { color: var(--red); font-size: 12px; list-style: none; padding: 0; margin: 4px 0 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 18px; }
fieldset legend { font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.alert { border-radius: 10px; }

/* Ô chọn nhà cung cấp */
.sp-results { border: 1px solid var(--line); border-radius: 8px; max-height: 340px; overflow-y: auto; background: var(--surface); margin-top: 4px; box-shadow: 0 12px 24px -4px rgba(16,24,40,.08); }
.sp-company { padding: 6px 12px; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); background: var(--hover); font-weight: 600; }
.sp-branch { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 12px 8px 20px; border-bottom: 1px solid var(--line-soft); }
.sp-branch:hover, .sp-branch:focus { background: var(--accent-soft); }
.sp-branch .l1 { font-weight: 600; }
.sp-branch .l2 { font-size: 12px; color: var(--muted); }
.sp-star { color: var(--amber); }
.sp-card { border: 1px solid var(--accent-line); background: var(--accent-soft); border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-top: 6px; }

/* Tem QR */
.labels { display: grid; grid-template-columns: repeat(auto-fill, 62mm); gap: 4mm; }
.label { width: 62mm; height: 29mm; border: 1px dashed #98A2B3; display: flex; align-items: center; gap: 2mm; padding: 2mm; box-sizing: border-box; background: #fff; overflow: hidden; border-radius: 4px; }
.label img { width: 25mm; height: 25mm; flex: none; }
.label .c { font-family: 'IBM Plex Mono', monospace; font-weight: 600; font-size: 12pt; line-height: 1.1; }
.label .s { font-size: 7pt; color: #333; line-height: 1.2; }

/* Kết quả tìm kiếm */
.hit { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); color: inherit; }
.hit:hover { background: var(--hover); text-decoration: none; color: inherit; }
.hit:last-child { border-bottom: 0; }
.hit .ki { width: 34px; height: 34px; border-radius: 8px; }
.hit .t { font-weight: 600; } .hit .m { font-size: 12px; color: var(--muted); }

@media (max-width: 760px) {
  .side { flex-basis: 100%; border-right: 0; border-bottom: 1px solid var(--line); }
  .side .nav-group { display: none; }
  .side.open .nav-group { display: flex; flex-direction: column; gap: 2px; }
  .me .who { display: none; }
}
@media (min-width: 761px) { .menu-toggle { display: none !important; } .side .nav-group { display: flex; flex-direction: column; gap: 2px; } }
@media print {
  .side, .topbar, .no-print, .messages { display: none !important; }
  .content { padding: 0; }
  body { background: #fff; }
  .label { border-color: #ccc; }
}
