:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --line: #dee2e6;
  --text: #24292f;
  --muted: #6c757d;
  --accent: #0056b3;
  --blue: #1F497D;
  --green: #198754;
  --red: #dc3545;
  --mono: Consolas, "Cascadia Mono", "Courier New", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 13px/1.45 "Segoe UI", Roboto, Arial, sans-serif; }
[hidden] { display: none !important; }

/* ---- header & tabs ---- */
.topbar { display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  background: #fff; border-bottom: 1px solid var(--line); padding: 8px 16px; }
.brand { font-weight: 700; font-size: 16px; color: var(--accent); }
.brand .ver { font-size: 11px; color: var(--muted); font-weight: 600; margin-left: 4px; }
.author { color: var(--accent); font-weight: 600; font-size: 12px; }
.host-info { margin-left: auto; font-size: 12px; color: var(--muted); }
.host-info code { background: #eef3fb; color: var(--accent); padding: 1px 6px; border-radius: 4px; font-weight: 700; cursor: pointer; }
.maintabs { display: flex; gap: 2px; padding: 8px 16px 0; background: var(--bg); position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--line); }
.maintabs button, .subtabs button { border: 1px solid var(--line); border-bottom: none; background: #e1e6ed; color: #495057;
  font: 600 13px "Segoe UI", sans-serif; padding: 8px 16px; border-radius: 6px 6px 0 0; cursor: pointer; }
.maintabs button.active, .subtabs button.active { background: #fff; color: var(--accent); }
.subtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.subtabs button { padding: 6px 14px; font-size: 12.5px; }
main { padding: 12px 16px 40px; }
.tab, .subtab { display: none; }
.tab.active, .subtab.active { display: block; }

.page-title { text-align: center; font-size: 17px; margin: 4px 0 10px; }
.page-title.blue { color: var(--blue); }
.page-title.nomargin { margin: 0; text-align: left; }

/* ---- cards & layout ---- */
.card { background: var(--card); border: 1px solid #cfd6de; border-radius: 6px; padding: 8px 12px 10px; margin: 0 0 10px; }
.card legend { font-weight: 700; color: var(--accent); padding: 0 6px; }
.card.inner { background: #fbfcfd; margin-top: 6px; }
.row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.row.nomargin { margin: 0 0 4px; }
.row.right { justify-content: flex-end; }
.row.center { justify-content: center; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 120px; }
.full { width: 100%; display: block; margin: 3px 0 8px; }
.split { display: flex; gap: 10px; align-items: stretch; }
.split.nomargin > .card { margin: 0; }
.split.three > .card { flex: 1; min-width: 0; }
.form-grid { display: grid; grid-template-columns: 170px 1fr; gap: 6px 10px; align-items: center; margin: 8px 0; max-width: 900px; }
.narrow { max-width: 820px; margin: 0 auto; }
.narrow > b { display: block; margin-top: 10px; }
.btngrid { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; }
.sticky-head { position: sticky; top: 38px; background: var(--bg); z-index: 5; padding: 4px 0; }
@media (max-width: 1100px) { .split { flex-direction: column; } .btngrid { grid-template-columns: repeat(3, 1fr); } }

/* ---- inputs ---- */
input, select, textarea { font: inherit; border: 1px solid #b9c2cc; border-radius: 4px; padding: 5px 7px; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid #9ec5fe; border-color: #6ea8fe; }
input[readonly] { background: #f8f9fa; }
textarea { resize: vertical; width: 100%; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.area-tall { height: 380px; }
.area-xtall { height: 520px; }
.area-mid { height: 230px; }
.green { color: var(--green); }
.red { color: var(--red); }
.muted { color: var(--muted); }
label.radio, label.chk { display: inline-flex; align-items: center; gap: 4px; margin-right: 10px; cursor: pointer; }
.hint-blue { color: #0000cc; font-size: 12px; margin: 0 0 6px; }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; border: 1px solid #adb5bd; background: #e9ecef; color: #212529;
  font: 600 12.5px "Segoe UI", sans-serif; padding: 6px 12px; border-radius: 4px; cursor: pointer; white-space: nowrap; user-select: none; }
.btn:hover { filter: brightness(0.95); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn.solid, .btn.bigbtn { color: #fff; border-color: transparent; }
.btn.bigbtn { font-size: 14px; padding: 9px 20px; min-width: 240px; }
.btn.bigpad { padding: 10px; font-size: 14px; margin: 4px 0; }
.btn.xs { padding: 3px 8px; font-size: 11.5px; }
.btn.primary { background: #0d6efd; color: #fff; border-color: transparent; }
.btn.big { width: 100%; font-size: 15px; padding: 11px; margin: 4px 0 6px; }

/* ---- progress ---- */
.progress { height: 14px; background: #e9ecef; border-radius: 7px; overflow: hidden; margin: 6px 0; position: relative; border: 1px solid #d0d7de; }
.progress > div { height: 100%; width: 0; background: linear-gradient(90deg, #22a35a, #2fbf71); transition: width .25s; }
.progress.labeled { height: 20px; border-radius: 4px; }
.progress.labeled span { position: absolute; inset: 0; text-align: center; font-size: 12px; font-weight: 700; line-height: 18px; }

/* ---- logs ---- */
.log { margin: 0; padding: 8px; border-radius: 4px; white-space: pre-wrap; word-break: break-word; overflow: auto; font-family: var(--mono); font-size: 12px; min-height: 120px; }
.log.light { background: #fff; border: 1px solid #ced4da; color: #111; }
.log.dark { background: #1e1e1e; color: #00ff00; border: 1px solid #333; }
.log.tall { height: 300px; }
.log.xtall { height: 640px; }
.calc-result { background: #f8f9fa; border: 1px solid #ced4da; padding: 6px; margin: 6px 0; min-height: 56px; white-space: pre; overflow: auto; font-size: 11.5px; }

/* ---- grid tables ---- */
.grid-block { margin: 6px 0 10px; }
.grid-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 3px; }
.grid-title { font-weight: 700; font-size: 13.5px; }
.grid-wrap { overflow: auto; border: 1px solid #c8d0d8; background: #fff; border-radius: 3px; }
table.grid { border-collapse: collapse; width: max-content; min-width: 100%; font-size: 12.5px; }
table.grid th { position: sticky; top: 0; background: #f1f3f5; text-align: left; padding: 5px 10px; border-bottom: 1px solid #c8d0d8; border-right: 1px solid #e3e7eb; cursor: pointer; white-space: nowrap; font-weight: 600; }
table.grid th:hover { background: #e2e6ea; }
table.grid td { padding: 4px 10px; border-bottom: 1px solid #eef0f2; border-right: 1px solid #f1f3f5; white-space: nowrap; max-width: 520px; overflow: hidden; text-overflow: ellipsis; }
table.grid tr:hover td { background: #f3f8ff; }
table.grid tr.sel td { background: #cfe2ff; }
table.grid td.empty { color: var(--muted); text-align: center; font-style: italic; }

/* ---- misc ---- */
.statusbar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; gap: 10px;
  background: #f1f3f5; border-top: 1px solid #c8d0d8; padding: 3px 12px; font-size: 12px; z-index: 30; }
.statusbar b { color: var(--blue); }
#tab-bts { padding-bottom: 20px; }
.mt-header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); padding: 6px 10px; border-radius: 6px; margin-bottom: 8px; }
.author-mini { color: var(--accent); font-weight: 700; font-size: 12px; }
.chrome-badge { font-weight: 700; color: #0d6efd; }
.safe-note { color: var(--red); font-style: italic; }
.notice-box { background: #fff8e1; border: 1px solid #ffe08a; color: #7a5b00; padding: 8px 12px; border-radius: 6px; margin: 6px 0; }

.ctx { position: fixed; z-index: 1000; background: #fff; border: 1px solid #b9c2cc; border-radius: 4px; box-shadow: 0 6px 18px rgba(0,0,0,.18); padding: 3px 0; min-width: 260px; }
.ctx.hidden { display: none; }
.ctx-item { padding: 6px 14px; cursor: pointer; white-space: nowrap; }
.ctx-item:hover { background: #e7f1ff; }

.overlay { position: fixed; inset: 0; background: rgba(20,25,35,.35); display: flex; align-items: center; justify-content: center; z-index: 900; }
.modal { background: #fff; border-radius: 8px; box-shadow: 0 12px 40px rgba(0,0,0,.25); width: min(520px, 94vw); max-height: 88vh; display: flex; flex-direction: column; }
.modal.wide { width: min(900px, 96vw); }
.mhead { padding: 10px 14px; font-weight: 700; border-bottom: 1px solid var(--line); }
.mbody { padding: 12px 14px; overflow: auto; }
.mbody .msg { white-space: pre-wrap; word-break: break-word; }
.mfoot { padding: 8px 14px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 6px; }
.mbody table { border-collapse: collapse; width: 100%; }
.mbody th, .mbody td { border: 1px solid #dee2e6; padding: 5px 8px; text-align: left; font-size: 12.5px; }
.mbody th { background: #f1f3f5; }
.mbody pre.help { white-space: pre-wrap; font: 13px/1.55 "Segoe UI", sans-serif; margin: 0; }

#toast-root { position: fixed; right: 16px; bottom: 34px; display: flex; flex-direction: column; gap: 6px; z-index: 1100; }
.toast { background: #212529; color: #fff; padding: 8px 14px; border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.25); max-width: 420px; white-space: pre-wrap; word-break: break-word; font-size: 12.5px; }

/* ---- bản chạy trong trình duyệt (GitHub Pages) ---- */
.pyboot { position: sticky; top: 38px; z-index: 19; background: #fff8e1; border-bottom: 1px solid #ffe08a; padding: 6px 16px; font-size: 12.5px; color: #7a5b00; }
.pyboot .progress { margin: 4px 0 0; height: 8px; }
.helper-ok { color: var(--green); font-weight: 700; }
.helper-off { color: #7a5b00; font-weight: 600; }
.mbody ol { padding-left: 20px; } .mbody li { margin: 4px 0; }

/* ---- tab Mô phỏng trạm BTS (nhúng simulator/web/app.html) ---- */
.sim-tab.active { display: flex; flex-direction: column; gap: 8px; }
.sim-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sim-bar .grow { flex: 1 1 320px; }
#sim-frame { width: 100%; height: calc(100vh - 150px); min-height: 520px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
@media (max-width: 700px) { #sim-frame { height: calc(100vh - 120px); } .maintabs { overflow-x: auto; } .maintabs button { white-space: nowrap; } }

/* ---- đăng nhập & phân quyền ---- */
.auth-box { display: flex; align-items: center; gap: 8px; font-size: 12.5px; margin-left: auto; }
#tab-admin fieldset { min-width: 0; }
.auth-box .avatar, .u-cell .avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex: none; }
.auth-box .who { font-weight: 600; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-btn { background: #fff; border-color: #c6ccd3; gap: 8px; }
.role-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: #e7f1ff; color: var(--accent); }
.role-badge.admin { background: #fff3cd; color: #8a6100; }
.role-badge.pending { background: #f1f3f5; color: var(--muted); }
.role-badge.blocked { background: #f8d7da; color: var(--red); }
.auth-err { color: var(--red); font-weight: 600; }
.maintabs button[data-tab="admin"] { color: #8a6100; }
main { position: relative; }
.tab.teaser { filter: blur(2.5px) saturate(.8); opacity: .55; pointer-events: none; user-select: none; max-height: 1100px; overflow: hidden; }
#tab-locked.over.active { position: absolute; inset: 0; z-index: 6; background: linear-gradient(to bottom, transparent 0, var(--bg, #f4f6f9) 85%); }
#tab-locked.over .locked-card { position: sticky; top: 24px; box-shadow: 0 12px 40px rgba(15, 23, 42, .18); }
.pro-pill { display: inline-block; background: linear-gradient(90deg, #f59e0b, #ef4444); color: #fff; font-weight: 700; font-size: 12px; padding: 3px 10px; border-radius: 999px; margin-bottom: 8px; letter-spacing: .5px; }
.locked-what { color: var(--text, #1f2937) !important; text-align: left; }
.locked-feats { text-align: left; margin: 0 0 14px; padding-left: 20px; font-size: 13.5px; }
.locked-feats li { margin: 4px 0; }
.locked-feats li::marker { content: "✨ "; }
.locked-why { font-weight: 600; }
.locked-btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 10px; }
.pro-btn { background: linear-gradient(90deg, #f59e0b, #ef4444) !important; color: #fff !important; border: 0 !important; text-decoration: none; }
.locked-free { font-size: 12.5px; margin: 6px 0 0 !important; }
.maintabs button.locked, .tooltabs button.locked { color: inherit; opacity: .78; }
.maintabs button.locked::after, .tooltabs button.locked::after { content: "PRO"; font-size: 9px; font-weight: 700; color: #fff; background: linear-gradient(90deg, #f59e0b, #ef4444); border-radius: 6px; padding: 1px 5px; margin-left: 5px; vertical-align: 2px; }
.plan-badge { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: #e0f2fe; color: #075985; white-space: nowrap; }
.plan-badge.soon { background: #fef3c7; color: #92400e; }
.plan-badge.exp { background: #fee2e2; color: #991b1b; }
.exp-cell { white-space: nowrap; }
.exp-cell input[type=date] { width: 132px; }
.buy-plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.buy-plan { display: block; border: 2px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; position: relative; }
.buy-plan input { position: absolute; top: 12px; right: 10px; }
.buy-plan:has(input:checked) { border-color: #f59e0b; background: #fffbeb; }
.buy-plan.hot::before { content: "Phù hợp"; position: absolute; top: -9px; left: 10px; font-size: 10.5px; background: #ef4444; color: #fff; padding: 1px 7px; border-radius: 6px; }
.bp-head { display: flex; flex-direction: column; gap: 2px; padding-right: 22px; }
.bp-price { font-size: 18px; font-weight: 700; color: #c2410c; }
.bp-tools { font-size: 12px; margin-top: 6px; color: var(--muted); }
.pay-box { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.pay-qr { width: 260px; max-width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.pay-info { flex: 1; min-width: 260px; }
.pay-tbl td { padding: 4px 8px 4px 0; vertical-align: middle; }
.pay-st { padding: 8px 10px; border-radius: 8px; background: #e0f2fe; color: #075985; font-weight: 600; }
.pay-st.bad { background: #fee2e2; color: #991b1b; }
.shop-row label { display: inline-flex; flex-direction: column; font-size: 12.5px; gap: 2px; }
.trial-btn { background: linear-gradient(90deg, #10b981, #0ea5e9) !important; color: #fff !important; border: 0 !important; }
.trial-cfg { border: 1px dashed #10b981; border-radius: 8px; padding: 8px 10px; margin: 8px 0; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.trial-cfg .tool-chips { flex-basis: 100%; }
.trial-info { font-size: 12px; margin-top: 3px; }
.trial-ph { display: block; margin: 10px 0; }
.trial-ph input { display: block; width: 100%; max-width: 260px; margin-top: 4px; font-size: 16px; padding: 6px 8px; }
.locked-card { max-width: 560px; margin: 48px auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 26px 28px; text-align: center; }
.locked-card h2 { margin: 0 0 10px; font-size: 18px; }
.locked-card p { color: var(--muted); font-size: 14px; margin: 0 0 16px; white-space: pre-line; }
.tbl-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 6px; margin: 6px 0; background: #fff; }
.adm-tbl { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.adm-tbl th { position: sticky; top: 0; background: #eef2f7; text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.adm-tbl td { padding: 6px 8px; border-bottom: 1px solid #eef0f3; vertical-align: top; }
.adm-tbl .c { text-align: center; }
.adm-tbl tr.dirty td { background: #fffbea; }
.adm-tbl tr.st-pending td:first-child { box-shadow: inset 3px 0 0 #f0ad4e; }
.adm-tbl tr.st-blocked td { color: #9aa3ad; }
.adm-tbl .nowrap { white-space: nowrap; }
.u-cell { display: flex; gap: 8px; align-items: center; }
.tool-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; max-width: 520px; }
.tool-chips .chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 12px; padding: 2px 8px; cursor: pointer; background: #f8f9fa; font-size: 12px; }
.tool-chips .chip.on { background: #e7f1ff; border-color: #9ec5fe; color: var(--accent); }
.tool-chips .chip input { margin: 0; }
@media (max-width: 700px) { .auth-box { width: 100%; flex-wrap: wrap; } }

/* ---- hướng dẫn & chú thích nhanh ---- */
#qtip { position: fixed; z-index: 2000; background: #1f2937; color: #fff; font-size: 12.5px; line-height: 1.45; padding: 7px 10px;
  border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.25); pointer-events: none; white-space: pre-line; }
.help-top { margin-left: 4px; }
#help-fab { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 900; width: 44px; height: 44px;
  border-radius: 50%; border: 0; background: var(--accent); color: #fff; font: 700 20px/44px "Segoe UI", sans-serif; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.25); }
#help-fab:hover { filter: brightness(1.1); }
.help .help-sec { border: 1px solid var(--line); border-radius: 6px; margin: 0 0 8px; background: #fff; }
.help .help-sec > summary { cursor: pointer; font-weight: 700; padding: 8px 12px; color: var(--accent); }
.help .help-sec[open] > summary { border-bottom: 1px solid var(--line); }
.help .help-sec > p, .help .help-sec > ol, .help .help-sec > ul { margin: 8px 12px; }
.help ol li, .help ul li { margin: 3px 0; }
.help .help-notes { color: var(--muted); }

/* ---- điện thoại & màn hình hẹp ---- */
img, svg, video, canvas { max-width: 100%; }
@media (max-width: 900px) {
  .form-grid { grid-template-columns: 1fr; }
  .btngrid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  html, body { font-size: 14px; }
  .topbar { padding: 6px 10px; gap: 6px 10px; }
  .author { display: none; }
  .host-info { margin-left: 0; width: 100%; }
  .maintabs { padding: 6px 8px 0; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .maintabs::-webkit-scrollbar { display: none; }
  .maintabs button, .subtabs button { white-space: nowrap; flex: none; padding: 9px 12px; }
  .subtabs { overflow-x: auto; scrollbar-width: none; }
  main { padding: 10px 10px 80px; }
  .page-title { font-size: 15px; }
  /* bỏ độ rộng cố định viết trong HTML (style="width:…") để không tràn màn hình */
  main input:not([type=checkbox]):not([type=radio]):not([type=number]), main select, main textarea { max-width: 100%; }
  main input[style*="width"], main select[style*="width"] { width: auto !important; flex: 1 1 140px; min-width: 0; }
  .row > * { min-width: 0; }
  .btn { padding: 8px 12px; }
  .btn.bigbtn, .btn.big { width: 100%; }
  .split, .split.three { flex-direction: column; }
  .card { padding: 8px; }
  fieldset { min-width: 0; }
  .sticky-head { position: static; }
  pre.log, .log { max-width: 100%; overflow: auto; }
  .statusbar { flex-wrap: wrap; }
  .modal, .modal.wide { width: calc(100vw - 20px) !important; max-width: none !important; }
  /* tránh iOS tự phóng to khi chạm ô nhập (cỡ chữ < 16px) */
  input, select, textarea { font-size: 16px; }
}

/* ---- thông báo phiên bản thử nghiệm (BETA) ---- */
.beta-badge { margin-left: 6px; font: 700 11px "Segoe UI", sans-serif; color: #7a4d00; background: #ffe8a3; border: 1px solid #f0c64a;
  border-radius: 10px; padding: 1px 8px; cursor: pointer; vertical-align: middle; }
.beta-badge:hover { background: #ffdc73; }
.welcome { font-size: 13.5px; line-height: 1.6; }
.welcome .lead { font-size: 14.5px; margin: 0 0 10px; }
.welcome ul { margin: 6px 0 10px; padding-left: 20px; }
.welcome li { margin: 3px 0; }
.welcome .free { background: #e8f5e9; border: 1px solid #b7dfb9; color: #1b5e20; border-radius: 6px; padding: 8px 12px; margin: 10px 0; font-weight: 600; }
.welcome .contact { background: #f1f5fb; border: 1px solid #d3deee; border-radius: 6px; padding: 8px 12px; margin-top: 10px; }
.welcome .contact a { color: var(--accent); font-weight: 700; }
.welcome .noshow { display: flex; align-items: center; gap: 6px; margin-top: 12px; color: var(--muted); font-size: 12.5px; cursor: pointer; }

/* ---- RAML Compiler: mẫu thật ---- */
.raml-note { margin: 0 0 8px; font-size: 12.5px; }
.raml-note code { background: #fff3cd; padding: 0 4px; border-radius: 3px; }
details.raml-more { margin: 2px 0 8px; }
details.raml-more summary { cursor: pointer; color: var(--accent); font-weight: 600; margin-bottom: 4px; }

/* ---- Báo cáo tiến độ thông minh ---- */
.sr-panel { max-width: 1180px; margin: 12px auto; }
.sr-roles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 14px; margin: 8px 0; }
.sr-roles label { display: flex; flex-direction: column; font-size: 12px; font-weight: 600; color: var(--muted); }
.sr-roles select { font-weight: 400; }
.sr-ms select { padding: 2px 4px; }
.sr-ms td.c { text-align: center; }
.sr-ms tr.off td { color: var(--muted); }
.sr-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 4px 0 10px; }
.sr-kpi { border: 1px solid #d8e2ee; border-radius: 8px; padding: 8px 10px; background: #f8fbff; }
.sr-kpi .t { font-size: 12px; color: var(--muted); font-weight: 600; }
.sr-kpi .v { font-size: 20px; font-weight: 700; color: var(--accent); }
.sr-kpi .s { font-size: 12px; color: #2e7d32; font-weight: 600; }
.sr-kpi .bar { height: 5px; background: #e3e9f1; border-radius: 3px; margin-top: 5px; overflow: hidden; }
.sr-kpi .bar i { display: block; height: 100%; background: var(--accent); }
.sr-kpi.warn { background: #fff5f5; border-color: #f3c4c4; }
.sr-kpi.warn .v { color: #c62828; }
.sr-narr { margin: 4px 0 10px; padding-left: 18px; }
.sr-narr li { margin: 2px 0; }
.sr-sub { display: flex; gap: 4px; flex-wrap: wrap; margin: 8px 0 4px; }
.sr-sub button { border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 3px 12px; cursor: pointer; font-size: 12.5px; }
.sr-sub button.on { background: #e7f1ff; border-color: #9ec5fe; color: var(--accent); font-weight: 700; }
.sr-dash table.grid td.n, .sr-dash table.grid th.n { text-align: right; }
.sr-dash table.grid tr.tot td { font-weight: 700; background: #fff8e1; }
.sr-dash table.grid td.bad { background: #fde2e1; }
.sr-dash table.grid td.good { background: #e3f6e8; }
.sr-chart { width: 100%; height: auto; display: block; }

/* ---- Link tải phần mềm trạm (SW) ---- */
.sw-card { border: 1px solid #b7dfc0; background: #f3fbf5; border-radius: 8px; padding: 8px 12px; margin: 0 0 10px; }
.sw-main { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.sw-note { color: var(--muted); font-size: 12px; }
#sw-list table { margin-top: 6px; }
.adm-sw input { width: 100%; box-sizing: border-box; }
.adm-sw td { vertical-align: middle; }
.sr-panel fieldset { min-width: 0; }
.sr-chart { max-height: 320px; }

/* ---- Điều hướng 2 tầng: cụm (RAN / NETWORK / DATACENTER) → tool ---- */
.maintabs .nav-sep { width: 1px; background: var(--line); margin: 4px 8px 6px; flex: none; }
.maintabs button[data-domain] { letter-spacing: .3px; }
.maintabs button[data-domain].active { box-shadow: inset 0 3px 0 var(--accent); }
.tooltabs { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 8px 16px; background: #fff;
  border-bottom: 1px solid var(--line); position: sticky; top: 38px; z-index: 19; }
.tooltabs button { border: 1px solid #cdd6e1; background: #f4f7fb; color: #3d4a5a; border-radius: 18px; padding: 6px 14px;
  font: 600 13px "Segoe UI", sans-serif; cursor: pointer; }
.tooltabs button:hover { background: #e9f1fc; }
.tooltabs button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.flow-strip { background: #eef5ff; border: 1px solid #cfe0f7; border-radius: 6px; padding: 6px 12px; margin: 0 0 8px; font-size: 13px; }
.flow-strip i { color: var(--muted); }
.dc-card { max-width: 640px; }
.dc-card h2 { font-size: 22px; }
@media (max-width: 700px) {
  .tooltabs { padding: 6px 8px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; top: 40px; }
  .tooltabs button { white-space: nowrap; flex: none; }
  .maintabs .nav-sep { margin: 4px 4px 6px; }
}
#tab-mt > .subtabs { display: none; }   /* tool NETWORK chọn ở thanh tool phía trên */
.preview-pre { max-height: 60vh; overflow: auto; white-space: pre; font-size: 12.5px; }
.preview-tbl { max-height: 60vh; }
.preview-tbl th { position: static; cursor: default; }

/* ---- DATACENTER (thử nghiệm) ---- */
.trial-badge { font-size: 11px; font-weight: 700; background: #fff3cd; color: #8a6100; border: 1px solid #f2d27a; border-radius: 10px; padding: 1px 8px; vertical-align: middle; }
table.grid td.good { background: #e3f6e8; } table.grid td.bad { background: #fde2e1; } table.grid td.warnc { background: #fff4d6; }
table.grid td.n, table.grid th.n { text-align: right; }
.dc-bar { position: relative; height: 16px; min-width: 90px; background: #eef1f5; border-radius: 3px; overflow: hidden; }
.dc-bar i { position: absolute; left: 0; top: 0; bottom: 0; }
.dc-bar span { position: relative; font-size: 11px; font-weight: 700; padding-left: 4px; color: #222; }
.dc-racks { display: flex; gap: 14px; overflow-x: auto; padding: 6px 2px 12px; align-items: flex-start; }
.dc-rack { flex: none; width: 200px; background: #fff; border: 1px solid #c9d1db; border-radius: 6px; box-shadow: 0 1px 2px #0001; }
.dc-rack .rh { padding: 6px 8px; border-bottom: 1px solid #e3e7eb; display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.dc-rack .rh span { color: var(--muted); }
.dc-rack .rb { display: flex; padding: 4px; background: #2b2f36; border-radius: 0 0 6px 6px; }
.dc-rack .ul { display: grid; width: 22px; }
.dc-rack .ul .u { font-size: 9px; color: #9aa3ad; text-align: right; padding-right: 3px; line-height: 15px; }
.dc-rack .slots { display: grid; flex: 1; gap: 0; background: repeating-linear-gradient(#3a3f47 0 14px, #2b2f36 14px 15px); }
.dc-rack .dev { color: #fff; font-size: 10px; font-weight: 600; border: 1px solid #0006; border-radius: 2px; padding: 0 4px; overflow: hidden;
  white-space: nowrap; text-overflow: ellipsis; display: flex; align-items: center; cursor: default; }
.dc-rack .dev.dim { opacity: .25; } .dc-rack .dev.hit { outline: 2px solid #ffd54f; z-index: 1; }
.dc-leg { font-size: 12px; margin-left: 10px; white-space: nowrap; } .dc-leg i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.dc-h3 { font-size: 15px; margin: 14px 0 6px; color: var(--accent); }
.dc-findings { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 6px; }
.dc-f { border: 1px solid #dfe3e8; border-left: 4px solid #adb5bd; border-radius: 4px; padding: 6px 8px; font-size: 12.5px; background: #fff; }
.dc-f.bad { border-left-color: #c62828; background: #fff7f7; } .dc-f.warnc { border-left-color: #f0a400; background: #fffbf0; } .dc-f.good { border-left-color: #2e7d32; }
.dc-f .d { color: #555; margin-top: 2px; } .dc-f .fix { margin: 4px 0 0; background: #f4f6f9; padding: 4px 6px; font-size: 11.5px; white-space: pre-wrap; }
@media (max-width: 700px) { .dc-findings { grid-template-columns: 1fr; } }
.tag { font-size: 10.5px; font-weight: 700; border-radius: 8px; padding: 0 6px; margin-left: 4px; }
.tag.ok { background: #e3f6e8; color: #2e7d32; } .tag.guess { background: #fff4d6; color: #8a6100; }
.tag.hand { background: #e7f1ff; color: var(--accent); } .tag.none { background: #f1f3f5; color: #868e96; }

/* ---- Thanh "Dùng thử dữ liệu mẫu" ---- */
.demo-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; background: #f3f0ff; border: 1px dashed #b9a7f5;
  border-radius: 8px; padding: 6px 10px; margin: 0 0 10px; font-size: 12.5px; }
.demo-btn { background: #6f42c1 !important; color: #fff !important; border-color: #6f42c1 !important; font-weight: 700; }
.demo-btn:disabled { opacity: .6; }
.demo-files a { color: #5a32a3; } .demo-txt { flex: 1 1 380px; }

/* ---------- NETWORK: kiểm tra cổng / LLDP / so sánh / sinh cấu hình / IP toolbox ---------- */
.area-short { height: 90px; }
.tag.bad { background: #fde2e2; color: #c62828; }
.port-mx td.c, .port-mx th.c { text-align: center; padding: 3px 5px; }
.port-mx th.c { font-size: 11.5px; line-height: 1.15; }
.port-mx th.c .muted { font-size: 10px; font-weight: 400; }
.port-mx td.good { background: #e3f6e8; color: #1b5e20; font-weight: 700; }
.port-mx td.warnc { color: #8a6100; }
.lldp-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 12px; margin: 8px 0 4px; }
.lldp-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.lldp-canvas { border: 1px solid var(--line); border-radius: 8px; background: #fbfcfe; background-image: radial-gradient(#dde3ea 1px, transparent 1px); background-size: 20px 20px; touch-action: none; }
.lldp-canvas svg { width: 100%; height: auto; display: block; max-height: 72vh; user-select: none; }
.diff-blocks { display: flex; flex-direction: column; gap: 6px; max-height: 620px; overflow: auto; }
.diff-b { border: 1px solid #dfe3e8; border-radius: 6px; background: #fff; overflow: hidden; }
.diff-b .bh { background: #f4f6f9; padding: 4px 8px; font-size: 12.5px; border-bottom: 1px solid #e5e8ec; }
.df { font-family: Consolas, 'Courier New', monospace; font-size: 12px; padding: 1px 8px; white-space: pre-wrap; word-break: break-all; }
.df.add { background: #e6ffec; } .df.del { background: #ffebe9; }
.df .sg { display: inline-block; width: 14px; font-weight: 700; } .df.add .sg { color: #1a7f37; } .df.del .sg { color: #cf222e; }
.df .pth { color: #6e7781; }
.diff-script, .gen-prev { max-height: 560px; overflow: auto; white-space: pre; font-size: 12px; }
.udiff { max-height: 520px; overflow: auto; font-size: 12px; }
.udiff .a { background: #e6ffec; color: #116329; display: inline-block; width: 100%; } .udiff .d { background: #ffebe9; color: #82071e; display: inline-block; width: 100%; }
.udiff .h { color: #8250df; font-weight: 700; }
.gen-prev mark { background: #ffd8d8; color: #b00020; border-radius: 3px; }

/* ---------- 📍 dẫn tới vị trí: nháy viền + dòng/ô được chọn ---------- */
@keyframes ntFlash { 0%, 100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); } 15%, 60% { box-shadow: 0 0 0 4px rgba(220, 53, 69, .55); } }
.nt-flash { animation: ntFlash 1.3s ease-in-out 2; outline: 2px solid #dc3545 !important; outline-offset: 2px; }
tr.nt-hl > td { background: #ffe3e3 !important; }
tr.nt-hl > td:first-child { box-shadow: inset 4px 0 0 #dc3545; }
.nt-go { cursor: pointer; }
td.nt-cell { outline: 3px solid #dc3545 !important; outline-offset: -3px; font-weight: 700; background: #ffd6d6 !important; }
.dc-f.nt-hl, .ptp-tn.nt-hl, .nt-hl.dc-f { outline: 3px solid #dc3545; outline-offset: 1px; }
.ptp-tn.nt-hl { background: #ffe3e3; border-radius: 4px; }
.bp-site.nt-hl { outline: 3px solid #dc3545; outline-offset: 2px; border-radius: 6px; }
.iss-detail { margin: 8px 0; display: grid; gap: 4px; border-width: 2px; }
.iss-detail code { background: rgba(0,0,0,.06); padding: 0 4px; border-radius: 3px; }
.iss-detail .row .btn { margin: 2px 4px 2px 0; }
.iss-where { overflow-wrap: anywhere; }
.nt-go:hover { filter: brightness(.97); box-shadow: 0 0 0 2px #9ec5fe; }
.nt-go .go-hint { float: right; font-size: 11px; color: #0d6efd; font-weight: 600; }
.dc-rack.nt-hl { outline: 3px solid #dc3545; outline-offset: 3px; border-radius: 6px; }
.dc-rack .dev.nt-hl { outline: 3px solid #ffd400; z-index: 2; box-shadow: 0 0 0 3px #dc3545; }
.cfg-view { max-height: 460px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; background: #fbfcfe; font-family: Consolas, 'Courier New', monospace; font-size: 12px; }
.cfg-view .ln { display: flex; white-space: pre; }
.cfg-view .ln i { flex: 0 0 48px; text-align: right; padding-right: 8px; color: #8c959f; font-style: normal; user-select: none; border-right: 1px solid #e5e8ec; margin-right: 6px; }
.cfg-view .ln.hit { background: #ffe3e3; } .cfg-view .ln.hit i { color: #c62828; font-weight: 700; }

.helper-steps { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 10px; padding: 10px 12px; background: #f6faff; border: 1px solid #d8e2ee; border-radius: 8px; }
.helper-steps a.btn { color: #fff; text-decoration: none; display: inline-block; }

.hs-status { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 8px; background: #f0f6ff; border: 1px solid #c9dcf5; font-size: 14.5px; margin-bottom: 8px; }
.hs-status .hs-ic { font-size: 26px; line-height: 1; }
.spin { display: inline-block; animation: hsSpin 1.4s linear infinite; } @keyframes hsSpin { to { transform: rotate(360deg); } }
.hs-trouble { margin-top: 10px; padding: 10px 14px; border-radius: 8px; background: #fff8e6; border: 1px solid #f1d38a; font-size: 13.5px; }
.hs-trouble ol { margin: 6px 0 8px 18px; padding: 0; } .hs-trouble li { margin: 4px 0; }
.hs-allow { margin-top: 8px; padding: 8px 10px; border-radius: 6px; background: #fff; border: 2px dashed #f0ad4e; font-size: 13.5px; font-weight: normal; }
.sr-kpi.bad { background: #fff0f0; border-color: #f1aeb5; } .sr-kpi.bad .v { color: #c62828; }
.sr-kpi.good .v { color: #2e7d32; }
.ptp-tree { padding: 6px 4px; } .ptp-tn { padding: 3px 6px; cursor: pointer; border-left: 2px solid #d0d7e2; font-size: 13.5px; } .ptp-tn:hover { background: #f0f6ff; }
.cr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px 12px; margin-bottom: 6px; }
.cr-grid label, label.full { display: flex; flex-direction: column; gap: 3px; font-size: 13px; font-weight: 600; color: #34495e; }
.cr-grid input, .cr-grid select, label.full input, label.full textarea { font-weight: normal; }
label.full { margin: 6px 0; }
.cr-mail { white-space: pre-wrap; background: #f8fafc; border: 1px solid #d0d7e2; border-radius: 6px; padding: 10px; font-size: 13px; max-height: 420px; overflow: auto; }
.cr-node { display: inline-block; margin: 2px 4px 2px 0; padding: 2px 8px; border-radius: 10px; background: #e8f0fe; cursor: pointer; font-size: 12.5px; }
.cr-node.sel { background: #0d6efd; color: #fff; }
.cr-pre { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .cr-pre pre { margin: 0; max-height: 360px; overflow: auto; background: #0f172a; color: #e2e8f0; padding: 8px; border-radius: 6px; font-size: 12px; }
.kpi-chart { background: #fff; border: 1px solid #d0d7e2; border-radius: 6px; padding: 6px; overflow-x: auto; }
.kpi-chart svg { width: 100%; min-width: 600px; height: 280px; }
.tk-cmd { background: #0f172a; color: #e2e8f0; padding: 8px 10px; border-radius: 6px; font-size: 12.5px; white-space: pre-wrap; }
.tk-admin table input { width: 100%; box-sizing: border-box; font-size: 12.5px; }
@media (max-width: 760px) { .cr-pre { grid-template-columns: 1fr; } }
.bp-cats { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-bottom: 8px; }
.bp-cat { display: flex; align-items: center; gap: 4px; padding: 4px 8px; border: 1px solid #d0d7e2; border-radius: 6px; background: #f8fafc; font-size: 13px; }
.bp-site > summary { font-size: 13px; }
.bp-df { padding: 6px 8px; border: 1px solid #d0d7e2; border-radius: 6px; margin: 4px 0; background: #fbfcfe; }
.bp-df.need { border-color: #dc3545; background: #fff5f5; }
.bp-df .row { flex-wrap: wrap; gap: 6px; }
.bp-filter .row { flex-wrap: wrap; gap: 6px; }
.bp-vals { display: flex; flex-wrap: wrap; gap: 4px 14px; max-height: 160px; overflow: auto; padding: 4px 2px; border: 1px dashed #d0d7e2; border-radius: 6px; margin: 4px 0; }
.bp-cond { border-left: 3px solid #0d6efd; padding-left: 8px; margin: 4px 0; }

/* ⏳ khung "đang chạy" nổi góc dưới trái */
.busy { position: fixed; left: 16px; bottom: 16px; z-index: 9000; width: min(380px, calc(100vw - 32px)); background: #fff; border: 1px solid #b6d4fe;
  border-left: 4px solid #0d6efd; border-radius: 8px; box-shadow: 0 6px 24px rgba(13,110,253,.18); padding: 8px 12px; font-size: 12.5px; display: grid; gap: 4px; }
.busy-h { display: flex; align-items: center; gap: 8px; }
.busy-h b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #0a3d91; }
.busy-t { font-variant-numeric: tabular-nums; color: #0d6efd; font-weight: 700; }
.busy-d { color: #333; overflow-wrap: anywhere; }
.busy-tip { color: #6c757d; font-size: 11.5px; }
.busy .spin { width: 14px; height: 14px; border: 2px solid #cfe2ff; border-top-color: #0d6efd; border-radius: 50%; animation: busySpin .8s linear infinite; flex: none; }
.busy-bar { height: 5px; background: #e7f1ff; border-radius: 3px; overflow: hidden; position: relative; }
.busy-bar i { display: block; height: 100%; background: #0d6efd; border-radius: 3px; transition: width .4s; }
.busy-bar.ind i { position: absolute; animation: busyInd 1.3s ease-in-out infinite; }
@keyframes busySpin { to { transform: rotate(360deg); } }
@keyframes busyInd { 0% { left: -35%; } 100% { left: 100%; } }
@media (prefers-reduced-motion: reduce) { .busy .spin, .busy-bar.ind i { animation-duration: 3s; } }
.busy-btn { position: relative; opacity: .85; }
.busy-btn::after { content: ''; display: inline-block; width: 10px; height: 10px; margin-left: 6px; vertical-align: -1px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: busySpin .8s linear infinite; }
.cfg-view.ok .ln.hit { background: #d1f2db; } .cfg-view.ok .ln.hit i { color: #198754; }
.dc-f.good.nt-go .go-hint { color: #198754; }
tr.ok-hl > td { background: #d1f2db !important; } tr.ok-hl > td:first-child { box-shadow: inset 4px 0 0 #198754; }
.ok-hl:not(tr) { outline: 3px solid #198754; outline-offset: 1px; }

/* ---------- v1.9.30: cài ứng dụng · kéo thả file · lịch sử · xuất báo cáo · thống kê quản trị */
.pwa-btn { margin-left: 8px; background: #e8f1ff; border-color: #9ec5fe; color: #0b5ed7; font-weight: 600; }
#smart-drop { position: fixed; inset: 0; z-index: 9000; background: rgba(13, 110, 253, .12); border: 4px dashed #0d6efd; display: grid; place-items: center; pointer-events: none; }
#smart-drop[hidden] { display: none; }
#smart-drop > div { background: #fff; padding: 22px 30px; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,.18); text-align: center; line-height: 1.7; font-size: 15px; max-width: 520px; }
#smart-drop b { font-size: 19px; color: #0b5ed7; }
.smart-pick { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.smart-pick .btn { text-align: left; justify-content: flex-start; }
.smart-toast { display: flex; align-items: center; gap: 8px; }
.smart-toast .btn { background: #fff; color: #0b5ed7; }
.smart-bar { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; margin: 6px 0; }
.smart-bar[hidden] { display: none; }
.hs { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 12px; background: #f1f3f5; }
.hs.bad { background: #fde8e8; color: #b42318; } .hs.warn { background: #fff4e5; color: #9a6700; } .hs.good { background: #e7f6ec; color: #1a7f37; }
.cmp-head { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.cmp-list { max-height: 30vh; overflow: auto; margin: 4px 0 10px; padding-left: 18px; font-size: 13px; }
.cmp-list li { margin: 2px 0; }
.hist-view { max-height: 65vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin-top: 8px; }
.hist-view button, .hist-view .go-hint { pointer-events: none; opacity: .5; }
.rank-list { margin: 4px 0 10px; font-size: 13px; }
.rank-row { display: grid; grid-template-columns: 26px minmax(140px, 260px) 1fr auto; gap: 8px; align-items: center; margin: 3px 0; }
.rank-n { color: #6c757d; text-align: right; }
.rank-bar { background: #eef2f7; border-radius: 4px; height: 10px; overflow: hidden; }
.rank-bar i { display: block; height: 100%; background: linear-gradient(90deg, #0d6efd, #6ea8fe); }
.rank-v { color: #495057; white-space: nowrap; }
tr.err-hot td { background: #fff5f5; }
@media (max-width: 700px) { .rank-row { grid-template-columns: 22px 1fr auto; } .rank-bar { display: none; } .pwa-btn { margin: 4px 0 0; } }
