/* Shell nav dùng chung cho Kho & Hàng hóa / Thuế và Kế toán (khớp mockup bước 1):
   MỘT thanh trên cùng full-width (logo · tab module · ô tìm · chip công ty · avatar)
   + sidebar phẳng cao hết chiều dọc sát dưới thanh trên (viền phải 1px, không card nổi).
   Drawer ≤900px. Chỉ đụng khung (header/aside), không đụng nội dung màn hình. */
:root {
  --bm-topbar-h: 54px;
  --bm-side-w: 236px;
}

/* Nền phẳng thống nhất (bỏ gradient xanh của trang cũ) */
body.bm-shell {
  background: var(--bg);
  font-size: 13px;
}

/* —— Thanh trên cùng —— */
body .top-nav {
  position: sticky;
  top: 0;
  z-index: 300;
  flex: 0 0 auto;
  min-height: var(--bm-topbar-h);
  background: #fff;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border-bottom: 1px solid var(--line);
  box-shadow: none;
  padding: 0;
}

.bm-topbar-main {
  display: flex;
  align-items: center;
  gap: 18px;
  height: var(--bm-topbar-h);
  padding: 0 16px;
  max-width: none;
  width: 100%;
  margin: 0;
}

.bm-menu-toggle {
  display: none;
  flex: 0 0 auto;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.bm-menu-toggle[aria-expanded="true"] {
  background: var(--accent-soft);
  border-color: #a7f3d0;
  color: var(--accent);
}

.bm-logo {
  flex: 0 0 auto;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--accent);
  margin-right: 6px;
  user-select: none;
}

body .top-nav .top-nav-inner,
.bm-module-nav {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 2px;
  max-width: none;
  margin: 0;
  padding: 0;
}

body .top-nav .top-nav-item {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  padding: 7px 12px;
  border-radius: 8px;
}

body .top-nav .top-nav-item:hover:not(.active) {
  background: #f3f7f5;
  color: var(--ink);
}

body .top-nav .top-nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.bm-page-title {
  display: none;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Ô tìm: rộng, nằm giữa tab module và chip công ty */
.bm-search-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 440px;
  min-width: 160px;
  height: 36px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8faf9;
  color: #7a8a83;
  font: inherit;
  font-size: 13px;
  padding: 0 12px;
  cursor: pointer;
  text-align: left;
}

.bm-search-trigger:hover {
  border-color: #b7cfc3;
  background: #fff;
}

.bm-search-trigger-ico {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  opacity: 0.7;
}

.bm-search-trigger-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bm-search-trigger kbd {
  flex: 0 0 auto;
  font: 11px ui-monospace, "SFMono-Regular", Consolas, monospace;
  color: #64748b;
  background: #fff;
  border: 1px solid #cbd5d0;
  border-radius: 4px;
  padding: 1px 5px;
}

.bm-topbar-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  margin-left: auto;
}

.bm-search-trigger + .bm-topbar-actions {
  margin-left: 0;
}

.bm-company-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 340px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  cursor: pointer;
  min-width: 0;
}

.bm-company-chip:hover,
.bm-company-chip[aria-expanded="true"] {
  border-color: #b7cfc3;
  background: var(--accent-soft);
}

.bm-company-chip[aria-disabled="true"] {
  cursor: default;
  opacity: 0.92;
}

.bm-company-chip-ico {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.bm-company-chip-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bm-company-chip-caret {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.7rem;
}

.bm-avatar {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.bm-avatar:hover {
  filter: brightness(1.08);
}

/* Popover công ty */
.bm-popover {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  z-index: 340;
  width: min(360px, calc(100vw - 1.25rem));
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(26, 43, 36, 0.16);
  padding: 0.85rem 0.95rem;
}

.bm-popover.hidden {
  display: none !important;
}

.bm-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.bm-popover-head h3 {
  margin: 0;
  font-size: 0.95rem;
}

.bm-popover .company-switcher {
  margin: 0;
  padding: 0;
  border: 0;
}

.bm-popover .company-switcher label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0.55rem 0 0.25rem;
}

.bm-popover .company-switcher label:first-of-type {
  margin-top: 0;
}

.bm-popover .company-switcher select {
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  font: inherit;
  background: #fff;
}

.bm-popover-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.85rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line);
}

.bm-btn-done {
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  padding: 0.4rem 1rem;
  cursor: pointer;
}

.bm-btn-done:hover {
  filter: brightness(1.05);
}

/* Menu tài khoản */
.bm-account-menu {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  z-index: 340;
  width: min(280px, calc(100vw - 1.25rem));
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(26, 43, 36, 0.16);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.bm-account-menu.hidden {
  display: none !important;
}

.bm-account-menu #bizmateUserLine,
.bm-account-menu .sub {
  margin: 0 0 0.25rem;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
  word-break: break-word;
}

.bm-account-menu .sidebar-btn {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: #fff;
  color: var(--ink);
}

.bm-account-menu .sidebar-btn-logout {
  background: #fff5f5;
  border-color: #fecaca;
  color: var(--danger);
}

/* —— Sidebar phẳng —— */
body .sidebar {
  flex: 0 0 var(--bm-side-w);
  width: var(--bm-side-w);
  background: #fff;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body .sidebar .side-nav {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 14px 10px;
  overflow-y: auto;
}

body .side-nav-label {
  margin: 14px 8px 5px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7a8a83;
}

body .side-nav-label:first-child {
  margin-top: 2px;
}

body .side-nav-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  margin: 1px 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  font-size: 13px;
  font-weight: 500;
  color: #2b3d35;
  text-align: left;
}

body .side-nav-btn:hover {
  background: #f3f7f5;
  color: var(--ink);
}

body .side-nav-btn.active {
  background: var(--accent-soft);
  border: 0;
  box-shadow: none;
  color: var(--accent);
  font-weight: 700;
}

body .side-nav-btn[hidden],
body .side-nav-btn.hidden {
  display: none !important;
}

body .side-nav-btn .nav-ico {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  opacity: 1;
  color: #6b7d75;
  stroke: currentColor;
  fill: none;
}

body .side-nav-btn:hover .nav-ico {
  color: #3d5249;
}

body .side-nav-btn.active .nav-ico {
  color: var(--accent);
}

