:root {
  --his-blue: #0b4fa0;
  --his-blue-dark: #083d7d;
  --his-blue-light: #e8f0fb;
  --his-bg: #f3f3f5;
  --his-green: #39d353;
  --nav-h: 46px;
  --tab-h: 34px;
  --foot-h: 36px;
}

html, body { height: 100%; }
body {
  background: #fff;
  font-family: Arial, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  padding-top: var(--nav-h);
  padding-bottom: var(--foot-h);
  color: #222;
}

/* ---------- Thanh menu trên ---------- */
.his-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1030; height: var(--nav-h);
  background: linear-gradient(90deg, #072f63 0%, #0b4fa0 55%, #1263b8 100%);
  box-shadow: 0 2px 8px rgba(5,30,70,.35);
}
.his-nav-inner { display: flex; align-items: center; height: 100%; padding: 0 12px 0 14px; gap: 6px; }
.his-brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; margin-right: 10px; flex: 0 0 auto; }
.his-brand .logo { width: 32px; height: 32px; border-radius: 9px; background: #fff; color: var(--his-blue); display: grid; place-items: center; font-size: 18px; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.his-brand .chu { display: flex; flex-direction: column; line-height: 1.05; }
.his-brand .chu b { font-size: 15px; letter-spacing: .3px; }
.his-brand .chu small { font-size: 10.5px; opacity: .75; }
.his-brand:hover { color: #fff; } .his-brand:hover .logo { transform: scale(1.05); }
.his-burger { display: none; background: none; border: 0; color: #fff; font-size: 24px; margin-left: auto; }
.his-menu { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; }
.his-menu-item { position: relative; }
.his-menu-link {
  display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 11px; border-radius: 8px;
  color: #e8f0fb; font-weight: 600; font-size: 13px; text-decoration: none; white-space: nowrap; transition: background .15s;
}
.his-menu-link .mi { font-size: 15px; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; background: rgba(255,255,255,.12); color: #fff; }
.his-menu-link .cv { font-size: 10px; opacity: .7; transition: transform .2s; }
.his-menu-item:hover > .his-menu-link, .his-menu-item.open > .his-menu-link { background: rgba(255,255,255,.14); color: #fff; }
.his-menu-item:hover > .his-menu-link .cv, .his-menu-item.open > .his-menu-link .cv { transform: rotate(180deg); }
.his-menu-item:hover > .his-menu-link .mi, .his-menu-item.open > .his-menu-link .mi { background: #fff; color: var(--m); }
.his-menu-item.hien-tai > .his-menu-link { background: rgba(255,255,255,.2); color: #fff; box-shadow: inset 0 -3px 0 #ffd54f; }
.his-menu-item.hien-tai > .his-menu-link .mi { background: #fff; color: var(--m); }
/* bảng menu thả xuống */
.his-dropdown {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; min-width: 300px; z-index: 5;
  background: #fff; border-radius: 10px; box-shadow: 0 12px 32px rgba(10,30,60,.25); border: 1px solid #d5deea; overflow: hidden;
  animation: ddHien .14s ease-out;
}
.his-dropdown::before { content: ''; position: absolute; top: -8px; left: 0; right: 0; height: 8px; } /* cầu nối để rê chuột không bị mất */
@keyframes ddHien { from { opacity: 0; transform: translateY(-4px); } }
.his-menu-item:hover > .his-dropdown, .his-menu-item.open > .his-dropdown { display: block; }
.his-dropdown.hai-cot { min-width: 560px; }
.his-dropdown.hai-cot > ul { display: grid; grid-template-columns: 1fr 1fr; column-gap: 4px; }
.his-dropdown.phai { left: auto; right: 0; min-width: 280px; }
.his-dropdown.ba-cot { min-width: min(980px, 96vw); left: auto; right: 0; }
.his-dropdown.ba-cot > ul { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 4px; max-height: calc(100vh - 140px); overflow: auto; }
.his-dropdown.ba-cot a .ten { white-space: normal; }
.his-dropdown.hai-cot li.divider, .his-dropdown.ba-cot li.divider { grid-column: 1 / -1; }
.his-dropdown .dd-dau { display: flex; align-items: center; gap: 8px; padding: 9px 14px; font-weight: 800; font-size: 13px; color: var(--m);
  background: linear-gradient(90deg, color-mix(in srgb, var(--m) 12%, #fff), #fff); border-bottom: 1px solid #edf1f6; text-transform: uppercase; letter-spacing: .3px; }
.his-dropdown .dd-ic { width: 26px; height: 26px; border-radius: 7px; background: var(--m); color: #fff; display: grid; place-items: center; font-size: 14px; }
.his-dropdown ul { list-style: none; margin: 0; padding: 6px; }
.his-dropdown a { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; color: #1d2b3a; text-decoration: none; }
.his-dropdown a .o { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; font-size: 16px;
  color: var(--m, var(--his-blue)); background: color-mix(in srgb, var(--m, var(--his-blue)) 11%, #fff); transition: all .12s; }
.his-dropdown a .nd { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.his-dropdown a .ten { font-weight: 600; font-size: 13px; white-space: nowrap; }
.his-dropdown a small { font-size: 11.5px; color: #7a8899; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.his-dropdown a:hover { background: color-mix(in srgb, var(--m, var(--his-blue)) 8%, #fff); }
.his-dropdown a:hover .o { background: var(--m, var(--his-blue)); color: #fff; }
.his-dropdown a.nguy .o { color: #c62828; background: #fdecea; } .his-dropdown a.nguy:hover .o { background: #c62828; color: #fff; } .his-dropdown a.nguy .ten { color: #c62828; }
.his-dropdown .divider { border-top: 1px solid #e3e7ee; margin: 4px 6px; grid-column: 1 / -1; }
/* người dùng (góc phải) */
.his-user { margin-left: auto; flex: 0 0 auto; --m: var(--his-blue); }
.his-user > .his-menu-link { height: 38px; padding: 0 8px 0 4px; gap: 8px; }
.his-user .av { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, #ffd54f, #ff8f00); color: #3e2700; font-weight: 800; display: grid; place-items: center; font-size: 14px; flex: 0 0 auto; }
.his-user .av.lon { width: 44px; height: 44px; font-size: 20px; }
.his-user .u { display: flex; flex-direction: column; line-height: 1.15; max-width: 190px; }
.his-user .u b { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }
.his-user .u small { font-size: 11px; opacity: .8; font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
.his-user .dd-user { display: flex; gap: 12px; align-items: center; padding: 12px 14px; background: #f4f7fb; border-bottom: 1px solid #e3e9f1; line-height: 1.45; }
@media (max-width: 1360px) { .his-brand .chu small, .his-user .u small { display: none; } .his-menu-link { padding: 0 8px; } }
@media (max-width: 1300px) { .his-brand .chu, .his-user .u { display: none; } }
@media (max-width: 1150px) and (min-width: 993px) { .his-menu-link > span { display: none; } .his-menu-link .mi { width: 28px; height: 28px; } }

/* ---------- Thanh trạng thái dưới ---------- */
.his-status {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 1030; height: var(--foot-h);
  background: linear-gradient(90deg, #0b3f86, var(--his-blue) 45%, #1259b8); color: #e8f0fb;
  display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; overflow: hidden;
  padding: 0 14px; font-size: 12.5px; box-shadow: 0 -2px 8px rgba(10, 40, 90, .25); border-top: 1px solid rgba(255,255,255,.15);
}
.his-status .st-o { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 13px; background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.12); white-space: nowrap; color: #e8f0fb; text-decoration: none; min-width: 0; }
.his-status a.st-o:hover { background: rgba(255,255,255,.2); color: #fff; }
.his-status .st-o b { color: #fff; font-weight: 700; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.his-status .st-o i { font-size: 13px; opacity: .9; }
.his-status .st-o small { color: #b9cdea; font-size: 11px; }
.his-status .lbl { color: #9fe3a8; font-size: 11px; text-transform: uppercase; letter-spacing: .3px; font-weight: 700; }
.his-status .st-user { padding-left: 3px; background: rgba(255,255,255,.14); }
.his-status .st-av { width: 20px; height: 20px; border-radius: 50%; background: #ffb300; color: #3e2700; font-weight: 800; font-size: 11px; display: grid; place-items: center; }
.his-status .st-qt { background: #ffca28; color: #4e3200; border-radius: 9px; padding: 0 7px; font-size: 10.5px; font-weight: 800; }
.his-status .st-doi { font-size: 11px !important; opacity: .6 !important; }
.his-status .st-mang { color: #b9f6ca; } .his-status .st-mang.mat { background: #c62828; color: #fff; border-color: #ff8a80; }
.his-status .st-gio span { font-variant-numeric: tabular-nums; font-weight: 600; color: #fff; }
.his-status .st-f2 kbd { background: #fff; color: var(--his-blue); font-size: 10.5px; padding: 0 5px; border-radius: 4px; font-weight: 800; }
.his-status a { color: #fff; text-decoration: none; }
@media (max-width: 1500px) { .his-status .st-an2 { display: none; } }
@media (max-width: 1250px) { .his-status .st-an1, .his-status .st-o .lbl { display: none; } .his-status .st-o b { max-width: 170px; } }

/* ---------- Vùng nội dung ---------- */
.his-main {
  min-height: calc(100vh - var(--nav-h) - var(--foot-h));
  background: var(--his-bg);
  margin: 0 60px;
  border-left: 1px solid #c9d6e8; border-right: 1px solid #c9d6e8;
  padding: 12px 14px 24px;
}
.his-flash { margin-bottom: 10px; }

.page-title {
  font-size: 15px; font-weight: bold; color: var(--his-blue); text-transform: uppercase;
  border-bottom: 2px solid var(--his-blue); padding-bottom: 6px; margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.page-title .actions { margin-left: auto; display: flex; gap: 8px; text-transform: none; font-weight: normal; flex-wrap: wrap; }
/* nút chức năng trên thanh tiêu đề: to, dễ nhìn, dễ bấm */
.page-title .actions .btn-sm { font-size: 14px; padding: 6px 14px; border-radius: 6px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.page-title .actions .btn-sm .bi { font-size: 16px; }
.page-title .actions .btn-sm .badge { font-size: 11px; }
.page-title .actions .form-control-sm { font-size: 14px; height: 36px; }

.panel { background: #fff; border: 1px solid #cfd9e6; margin-bottom: 12px; }
.panel-head {
  background: linear-gradient(#f6f9fd, #e6eef8); border-bottom: 1px solid #cfd9e6;
  padding: 6px 10px; font-weight: bold; color: var(--his-blue);
  display: flex; align-items: center; gap: 8px;
}
.panel-head .ms-auto { font-weight: normal; }
.panel-body { padding: 10px; }

.form-label { margin-bottom: 2px; font-weight: 600; color: #34465c; font-size: 12px; }
.form-control, .form-select { font-size: 13px; padding: 4px 8px; border-radius: 2px; }
/* chừa chỗ cho mũi tên của select (padding chung ở trên ghi đè mất padding-right 2.25rem của Bootstrap) */
.form-select { padding-right: 26px; background-position: right 7px center; }
.form-control-sm, .form-select-sm { font-size: 12px; }
.btn { font-size: 13px; border-radius: 2px; padding: 4px 12px; }
.btn-sm { font-size: 12px; padding: 2px 8px; }
.btn-primary { background: var(--his-blue); border-color: var(--his-blue); }
.btn-primary:hover { background: var(--his-blue-dark); border-color: var(--his-blue-dark); }
.req::after { content: ' *'; color: #d00; }

.table-his { font-size: 12.5px; background: #fff; margin-bottom: 0; }
.table-his thead th {
  background: #dfe9f6; color: #1e3554; font-weight: bold; white-space: nowrap;
  border-bottom: 1px solid #b9c9de; position: sticky; top: 0; z-index: 1;
}
.table-his td, .table-his th { padding: 4px 6px; vertical-align: middle; }
.table-his tbody tr:hover { background: #fffbe0; }
.table-his tr.row-link { cursor: pointer; }
.table-wrap { max-height: 62vh; overflow: auto; border: 1px solid #cfd9e6; }
.num { text-align: right; white-space: nowrap; }

.nav-tabs .nav-link { font-weight: 600; color: #34465c; padding: 6px 14px; border-radius: 0; }
.nav-tabs .nav-link.active { color: var(--his-blue); border-top: 2px solid var(--his-blue); }
.tab-content > .tab-pane { background: #fff; border: 1px solid #dee2e6; border-top: 0; padding: 12px; }

.bn-header {
  background: #fff; border: 1px solid #cfd9e6; border-left: 4px solid var(--his-blue);
  padding: 8px 12px; margin-bottom: 10px; display: flex; flex-wrap: wrap; gap: 6px 22px;
}
.bn-header b { color: var(--his-blue); }
.bn-header .ten { font-size: 15px; font-weight: bold; text-transform: uppercase; color: #b4101b; }

.stat-card { background: #fff; border: 1px solid #cfd9e6; padding: 10px 14px; border-top: 3px solid var(--his-blue); }
.stat-card .v { font-size: 22px; font-weight: bold; color: var(--his-blue); }
.stat-card .l { color: #5b6b80; }

/* ---------- Autocomplete ---------- */
.ac-wrap { position: relative; }
.ac-list {
  position: fixed; z-index: 2000; left: 0; top: 0;
  background: #fff; border: 1px solid #b9c9de; max-height: 260px; overflow: auto;
  box-shadow: 0 6px 14px rgba(0,0,0,.15); display: none;
}
.ac-list div { padding: 4px 8px; cursor: pointer; border-bottom: 1px solid #f0f0f0; }
.ac-list div.active, .ac-list div:hover { background: var(--his-blue-light); }
.ac-list small { color: #6b7a8c; }
.ac-list div { white-space: normal; line-height: 1.35; }
.ac-list .ac-ton { display: inline-block; margin-left: 8px; padding: 0 7px; border-radius: 10px; font-weight: 700; font-size: 12px; white-space: nowrap; }
.ac-list .ac-ton.con { background: #d1f2dc; color: #0a6b2d; }
.ac-list .ac-ton.it { background: #ffe8c2; color: #9a5a00; }
.ac-list .ac-ton.het { background: #ffd6d6; color: #b00020; }

/* ---------- Trang chủ ---------- */
.home-banner {
  position: relative; max-width: 1170px; height: 610px; overflow: hidden;
  background:
    radial-gradient(circle at 78% 60%, rgba(255,255,255,.85) 0, rgba(255,255,255,0) 30%),
    linear-gradient(115deg, #e9f4fb 0%, #d7ecf8 40%, #f1f6fa 70%, #e3eef6 100%);
}
.home-banner::before {
  content: ''; position: absolute; right: -80px; bottom: -120px; width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle, rgba(70,160,230,.25), rgba(70,160,230,0) 70%);
}
.home-logo { position: absolute; left: 0; right: 0; top: 70px; text-align: center; color: var(--his-blue); }
.home-logo .mark {
  width: 96px; height: 96px; border-radius: 50%; margin: 0 auto 10px;
  background: var(--his-blue); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 52px;
  box-shadow: 0 0 0 6px rgba(11,79,160,.15);
}
.home-logo h1 { font-size: 38px; font-weight: bold; margin: 0; letter-spacing: 1px; }
.home-logo h2 { font-size: 28px; font-weight: bold; margin: 8px 0 0; }
.home-icons { position: absolute; left: 100px; top: 300px; display: flex; gap: 28px; }
.home-icons .c {
  width: 170px; height: 170px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 70px; background: rgba(120,200,240,.55);
  border: 4px solid rgba(255,255,255,.75); box-shadow: 0 6px 18px rgba(30,110,170,.18);
}
.home-icons .c:nth-child(3) { background: rgba(80,190,240,.75); }
.home-icons .c:nth-child(4) { background: rgba(30,160,230,.85); }
.home-icons .c:nth-child(5) { background: #fff; color: var(--his-blue); }
.home-drop {
  position: absolute; left: 740px; top: 470px; width: 110px; height: 110px; border-radius: 50%;
  background: rgba(150,200,230,.6); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 44px;
  border: 3px solid rgba(255,255,255,.7);
}
.home-stats { max-width: 1170px; margin-top: 12px; }

/* ---------- Sơ đồ giường ---------- */
.bed { width: 120px; min-height: 74px; border: 1px solid #b9c9de; background: #eaf6ea; padding: 6px; font-size: 12px; }
.bed.busy { background: #fde8e8; border-color: #e6a3a3; }
.bed .code { font-weight: bold; }

/* ---------- Đăng nhập ---------- */
.login-page {
  min-height: 100vh; margin-top: calc(-1 * var(--nav-h)); margin-bottom: calc(-1 * var(--foot-h)); display: flex; align-items: center; justify-content: center;
  background: linear-gradient(120deg, #0b4fa0 0%, #1572c9 55%, #63b3ec 100%);
}
.login-box { width: 400px; max-width: 94vw; background: #fff; box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.login-box .head { background: var(--his-blue-dark); color: #fff; padding: 18px; text-align: center; }
.login-box .head .bi { font-size: 40px; }
.login-box .head h1 { font-size: 22px; margin: 4px 0 0; font-weight: bold; }
.login-box .head p { margin: 2px 0 0; font-size: 12px; opacity: .85; }
.login-box .body { padding: 20px 24px; }

/* ---------- Responsive ---------- */
@media (max-width: 992px) {
  .his-burger { display: block; }
  .his-menu { display: none; position: absolute; top: 100%; left: 0; right: 0; background: #0b4fa0; flex-direction: column; align-items: stretch; padding: 6px; max-height: calc(100vh - var(--nav-h)); overflow: auto; }
  .his-menu.open { display: flex; }
  .his-menu-link > span { display: inline; }
  .his-dropdown, .his-dropdown.hai-cot { position: static; box-shadow: none; min-width: 0; margin: 4px 0 6px; }
  .his-dropdown.hai-cot > ul, .his-dropdown.ba-cot > ul { grid-template-columns: 1fr; }
  .his-dropdown.ba-cot { position: static; min-width: 0; }
  .his-user { display: none; }
  .his-main { margin: 0; }
  .his-status { padding: 0 8px; font-size: 12px; } .his-status .st-gio, .his-status .st-mang { display: none; }
  .home-banner { height: auto; padding-bottom: 30px; }
  .home-logo { position: static; padding-top: 30px; }
  .home-logo h1 { font-size: 28px; } .home-logo h2 { font-size: 18px; }
  .home-icons, .home-drop { display: none; }
}

/* ---------- In ấn ---------- */
@media print {
  body { padding: 0; background: #fff; }
  .his-nav, .his-status, .no-print, .his-flash { display: none !important; }
  .his-main { margin: 0; border: 0; padding: 0; background: #fff; }
}

/* Hàng 'Hướng xử trí' đặt trong legend để vẫn bấm được tab khi form bị khóa */
legend.kt-legend { float: none; width: 100%; font-size: inherit; line-height: inherit; margin: 0 0 6px; padding: 0; }

/* ===== Trạng thái đang tải ===== */
#hisTaiBar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 3000; pointer-events: none; opacity: 0; transition: opacity .2s; overflow: hidden; }
#hisTaiBar i { display: block; height: 100%; width: 40%; background: linear-gradient(90deg, #4fc3f7, #ffd54a, #66bb6a); border-radius: 2px; animation: hisTaiChay 1.1s ease-in-out infinite; }
#hisTaiBar.chay { opacity: 1; }
@keyframes hisTaiChay { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
#hisTai { position: fixed; inset: 0; z-index: 2990; background: rgba(240, 244, 250, .55); backdrop-filter: blur(1.5px); display: none; align-items: center; justify-content: center; }
#hisTai.hien { display: flex; animation: hisTaiVao .2s ease; }
@keyframes hisTaiVao { from { opacity: 0; } }
#hisTai .hop { background: #fff; border-radius: 12px; box-shadow: 0 10px 34px rgba(16, 40, 80, .2); padding: 22px 34px; text-align: center; min-width: 240px; border: 1px solid #dbe4f0; }
#hisTai .xoay { width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 50%; border: 4px solid #e3edfb; border-top-color: #0b4fa0; border-right-color: #0b4fa0; animation: hisTaiXoay .8s linear infinite; }
@keyframes hisTaiXoay { to { transform: rotate(360deg); } }
#hisTai .tde { font-weight: 700; color: #0b4fa0; font-size: 15px; }
#hisTai .giay { font-size: 12.5px; color: #6a7a90; min-height: 18px; margin-top: 2px; font-variant-numeric: tabular-nums; }
#hisTai .lau { display: none; font-size: 12.5px; color: #8a5a00; margin-top: 6px; max-width: 280px; }
#hisTai.lau .lau { display: block; }
.dang-tai { pointer-events: none; opacity: .85; }
@media print { #hisTai, #hisTaiBar { display: none !important; } }

/* ---------- Thanh tab làm việc (his-tabs.js) ---------- */
html.co-tab body { padding-top: calc(var(--nav-h) + var(--tab-h)); }
.his-tabbar { position: fixed; top: var(--nav-h); left: 0; right: 0; z-index: 1029; height: var(--tab-h); display: flex; align-items: flex-end;
  background: #e9eef5; border-bottom: 1px solid #c3d0e1; padding: 0 8px 0 14px; box-shadow: inset 0 3px 4px -3px rgba(5,30,70,.25); }
.his-tabs { display: flex; gap: 3px; overflow-x: auto; overflow-y: hidden; flex: 1; scrollbar-width: none; height: 100%; align-items: flex-end; }
.his-tabs::-webkit-scrollbar { display: none; }
.his-tab { --m: var(--his-blue); flex: 0 0 auto; display: flex; align-items: center; gap: 7px; height: 28px; max-width: 240px; min-width: 120px; padding: 0 5px 0 8px;
  background: #f6f8fb; border: 1px solid #ccd7e5; border-bottom: 0; border-radius: 8px 8px 0 0; color: #43546b; cursor: pointer; user-select: none; position: relative;
  transition: background .12s; }
.his-tab:hover { background: #fff; }
.his-tab .ic { flex: 0 0 auto; width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-size: 12px; color: var(--m);
  background: color-mix(in srgb, var(--m) 13%, #fff); }
.his-tab .ic.spinner-border { width: 14px; height: 14px; border-width: 2px; background: none; border-radius: 50%; margin: 0 3px; }
.his-tab .ten { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; font-size: 12.5px; }
.his-tab .dong { border: 0; background: none; width: 20px; height: 20px; border-radius: 50%; line-height: 1; font-size: 16px; color: #8a96a6; padding: 0; flex: 0 0 auto; opacity: .55; }
.his-tab:hover .dong, .his-tab.on .dong { opacity: 1; }
.his-tab .dong:hover { background: #e53935; color: #fff; }
.his-tab.on { background: #fff; color: #102a4c; font-weight: 700; height: 31px; margin-bottom: -1px; border-color: #c3d0e1;
  box-shadow: inset 0 3px 0 var(--m), 0 -2px 6px rgba(10,30,60,.08); }
.his-tab.on .ic { background: var(--m); color: #fff; }
.his-tab.keo { opacity: .45; }
.his-tab-cuoi { display: flex; gap: 2px; padding: 0 0 4px 8px; }
.his-tab-cuoi button { border: 0; background: none; color: #4a5b70; width: 28px; height: 24px; border-radius: 6px; }
.his-tab-cuoi button:hover { background: #d3dde9; color: var(--his-blue); }
.his-khung { position: fixed; top: calc(var(--nav-h) + var(--tab-h)); bottom: var(--foot-h); left: 60px; right: 60px; background: var(--his-bg); border-left: 1px solid #c9d6e8; border-right: 1px solid #c9d6e8; z-index: 1; }
.his-frame { width: 100%; height: 100%; border: 0; display: block; background: var(--his-bg); }
.his-tab-menu { display: none; position: fixed; z-index: 3000; min-width: 230px; max-width: 380px; max-height: 70vh; overflow: auto; background: #fff; border: 1px solid #d5deea; border-radius: 10px; box-shadow: 0 12px 30px rgba(10,30,60,.22); padding: 5px; }
.his-tab-menu button { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; text-align: left; padding: 6px 10px; font-size: 13px; color: #1d2b3a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 6px; }
.his-tab-menu button:hover { background: var(--his-blue-light); }
.his-tab-menu button .bi { color: var(--m, var(--his-blue)); width: 16px; }
.his-tab-menu kbd { margin-left: auto; background: #eef1f5; color: #6a7a90; font-size: 11px; padding: 1px 5px; }
.his-tab-menu hr { margin: 4px 0; }
/* trang hiển thị bên trong 1 tab: ẩn menu + thanh dưới */
html.trong-tab body { padding: 0; }
html.trong-tab .his-nav, html.trong-tab .his-status { display: none !important; }
html.trong-tab .his-main { margin: 0; border: 0; min-height: 100vh; }
@media (max-width: 992px) { .his-tabbar { padding-left: 6px; } .his-khung { left: 0; right: 0; } }
@media print { .his-tabbar, .his-tab-menu { display: none !important; } html.co-tab body { padding-top: 0; } }
.his-menu > .his-menu-item:nth-last-child(-n+2) > .his-dropdown { left: auto; right: 0; }

/* nhóm con trong menu (vd Dược > Quản lý tủ trực) */
.his-dropdown li.dd-nhom { grid-column: 1 / -1; margin: 6px 6px 2px; padding: 5px 8px 3px; border-top: 1px solid #e3e7ee; font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: #8a5a2a; }
.his-dropdown a.chua { opacity: .55; cursor: default; } .his-dropdown a.chua:hover { background: transparent; }

/* menu con bay ra (vd Dược > Quản lý tủ trực ▸) - giữ menu chính gọn như phần mềm gốc */
.his-dropdown { overflow: visible; } .his-dropdown .dd-dau { border-radius: 10px 10px 0 0; }
.his-dropdown li.dd-sub { position: relative; }
.his-dropdown .dd-sublink .cv2 { margin-left: auto; font-size: 11px; color: #9aa6b4; transition: transform .12s; }
.his-dropdown li.dd-sub:hover > .dd-sublink, .his-dropdown li.dd-sub.mo > .dd-sublink { background: color-mix(in srgb, var(--m, var(--his-blue)) 10%, #fff); }
.his-dropdown li.dd-sub:hover > .dd-sublink .o { background: var(--m, var(--his-blue)); color: #fff; }
.his-dropdown li.dd-sub:hover > .dd-sublink .cv2 { color: var(--m); transform: translateX(2px); }
.his-dropdown .dd-sublink .ten::after { content: ''; }
.dd-fly { display: none; position: absolute; top: -6px; left: calc(100% + 4px); min-width: 310px; z-index: 7; background: #fff; border: 1px solid #d5deea; border-radius: 10px;
  box-shadow: 0 14px 34px rgba(10,30,60,.28); animation: ddHien .12s ease-out; }
.dd-fly::before { content: ''; position: absolute; top: 0; bottom: 0; left: -10px; width: 10px; } /* cầu nối rê chuột */
.dd-fly.trai { left: auto; right: calc(100% + 4px); } .dd-fly.trai::before { left: auto; right: -10px; }
.his-dropdown li.dd-sub:hover > .dd-fly, .his-dropdown li.dd-sub.mo > .dd-fly { display: block; }
.dd-fly .dd-fly-dau { padding: 8px 12px; font-weight: 800; font-size: 12px; color: var(--m); text-transform: uppercase; letter-spacing: .3px; border-bottom: 1px solid #edf1f6;
  background: linear-gradient(90deg, color-mix(in srgb, var(--m) 10%, #fff), #fff); border-radius: 10px 10px 0 0; }
.dd-fly ul { padding: 5px; } .dd-fly a { padding: 5px 8px; } .dd-fly a .o { width: 28px; height: 28px; font-size: 14px; }
@media (max-width: 992px) {
  .dd-fly, .dd-fly.trai { position: static; box-shadow: none; border: 0; border-left: 3px solid color-mix(in srgb, var(--m) 30%, #fff); border-radius: 0; margin: 2px 0 4px 18px; min-width: 0; }
  .his-dropdown li.dd-sub:hover > .dd-fly { display: none; } .his-dropdown li.dd-sub.mo > .dd-fly { display: block; }
  .his-dropdown li.dd-sub.mo > .dd-sublink .cv2 { transform: rotate(90deg); }
}

.dd-fly.hai-cot { min-width: 520px; } .dd-fly.hai-cot > ul { display: grid; grid-template-columns: 1fr 1fr; column-gap: 2px; }
.dd-fly .dd-fly-dau { display: flex; align-items: center; gap: 6px; } .dd-fly .dd-fly-dau .xem { margin-left: auto; padding: 1px 8px; font-size: 11px; text-transform: none; letter-spacing: 0; font-weight: 700; color: var(--m); border-radius: 6px; }
.dd-fly .dd-fly-dau .xem:hover { background: color-mix(in srgb, var(--m) 12%, #fff); }
.dd-fly a .ten { white-space: normal; } .dd-fly ul { max-height: calc(100vh - 150px); overflow: auto; }
@media (max-width: 992px) { .dd-fly.hai-cot { min-width: 0; } .dd-fly.hai-cot > ul { grid-template-columns: 1fr; } }
