/* ============================================================
   AD1 — ADMIN APP SHELL (TailAdmin-inspired, MIT)
   Giữ nguyên component/ID cũ; chỉ thay bố cục sidebar + header.
   ============================================================ */
:root {
  /* AD9 — đồng bộ token với Landing (#007AFF / #0a192f) */
  --brand-primary: #007aff;
  --brand-primary-hover: #0062cc;
  --brand-navy: #0a192f;
  --brand-accent: #64b5f6;
  --brand-surface-muted: #f8f9fa;

  --admin-sidebar-width: 260px;
  --admin-shell-bg: #f6f7fb;
  --admin-surface: #ffffff;
  --admin-border: #e5e7eb;
  --admin-text: #1d2939;
  --admin-muted: #6b7280;
  --admin-primary: var(--brand-primary);
  --admin-primary-hover: var(--brand-primary-hover);
  --admin-primary-soft: #eff6ff;
  --admin-sidebar-text: #4b5563;
}

body.admin-shell-body {
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--admin-shell-bg);
  color: var(--admin-text);
}

.admin-shell {
  display: block;
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 100vh;
  overflow-x: clip;
}

.admin-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1100;
  display: flex;
  width: var(--admin-sidebar-width);
  height: 100vh;
  flex-direction: column;
  justify-content: flex-start;
  overflow: hidden;
  padding: 0;
  border-right: 1px solid var(--admin-border);
  background: var(--admin-surface);
  box-sizing: border-box;
  box-shadow: none;
}

.admin-sidebar-header {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  padding: 18px 16px 16px;
  border-bottom: 1px solid #f3f4f6;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: var(--admin-text);
  text-decoration: none;
}

.admin-brand-icon {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  border-radius: 12px;
  background: #1d1d1f;
  color: #fff;
  font-size: 20px;
  box-shadow: 0 6px 14px rgba(29, 29, 31, 0.22);
  overflow: hidden;
}

.admin-brand-icon img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
}

.admin-brand strong,
.admin-brand small {
  display: block;
}

.admin-brand strong {
  font-size: 16px;
  line-height: 1.2;
  font-weight: 700;
  color: #111827;
}

.admin-brand small {
  margin-top: 2px;
  color: var(--admin-muted);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.admin-menu-label {
  flex: 0 0 auto;
  margin: 16px 16px 8px;
  color: #9ca3af;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.admin-sidebar .tab-nav {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 4px;
  min-height: 0;
  margin: 0;
  padding: 0 10px 12px;
  overflow-x: hidden;
  overflow-y: auto;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.admin-sidebar .tab-nav::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.admin-sidebar .tab-nav::-webkit-scrollbar-thumb {
  background: transparent;
}

.admin-sidebar .tab-btn {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--admin-sidebar-text);
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.admin-sidebar .tab-btn > span:not(.admin-menu-icon) {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-sidebar .tab-btn:hover {
  background: #f3f4f6;
  color: var(--admin-primary);
}

.admin-sidebar .tab-btn.active {
  background: var(--admin-primary-soft);
  color: var(--admin-primary);
  font-weight: 600;
  box-shadow: none;
  border-color: transparent;
}

/* AD10 — nhóm menu lớn + submenu */
.admin-nav-group {
  margin-bottom: 4px;
}

.admin-nav-group-toggle {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--admin-sidebar-text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.2s ease, color 0.2s ease;
}

.admin-nav-group-toggle:hover {
  background: #f3f4f6;
  color: var(--admin-primary);
  transform: none;
}

.admin-nav-group-toggle:active {
  transform: none;
}

.admin-nav-group-label {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.admin-nav-group-label > span:not(.admin-menu-icon) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-nav-chevron {
  color: #9ca3af;
  font-size: 16px;
  line-height: 1;
  transition: transform 0.24s cubic-bezier(0.4, 0, 0.2, 1);
}

.admin-nav-group.is-open .admin-nav-chevron {
  transform: rotate(90deg);
}

.admin-nav-group:not(.is-open) .admin-nav-chevron {
  transform: rotate(0deg);
}

.admin-nav-group-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  padding: 0 0 4px 0;
  margin: 0 0 2px 8px;
  visibility: hidden;
  transform: translateY(-4px);
  transform-origin: top;
  transition:
    max-height 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.2s ease,
    transform 0.24s ease,
    visibility 0s linear 0.28s;
}

.admin-nav-group.is-open .admin-nav-group-items {
  max-height: 720px;
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition:
    max-height 0.32s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.22s ease 0.04s,
    transform 0.26s ease,
    visibility 0s;
}

.admin-nav-group.is-open > .admin-nav-group-toggle {
  background: #f3f4f6;
  color: #111827;
}

.admin-sidebar .admin-nav-group-items .tab-btn {
  min-height: 40px;
  padding: 9px 12px 9px 14px;
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.2s ease, color 0.2s ease;
}

.admin-sidebar .admin-nav-group-items .tab-btn:hover {
  transform: none;
  background: #f3f4f6;
  color: var(--admin-primary);
}

.admin-sidebar .admin-nav-group-items .tab-btn:active {
  transform: none;
}

.admin-sidebar .admin-nav-group-items .tab-btn.active {
  background: var(--admin-primary-soft);
  color: var(--admin-primary);
  font-weight: 600;
  box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
  .admin-nav-group-toggle,
  .admin-nav-chevron,
  .admin-nav-group-items,
  .admin-sidebar .admin-nav-group-items .tab-btn {
    transition-duration: 0.01ms !important;
  }
}

.admin-sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  margin: auto 12px 14px;
  padding: 12px 12px;
  border: 0;
  border-top: 1px solid #f3f4f6;
  border-radius: 0;
  background: transparent;
  color: var(--admin-muted);
  font-size: 13px;
}

.admin-status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px #d1fae5;
}

.admin-main {
  width: calc(100% - var(--admin-sidebar-width));
  min-width: 0;
  margin-left: var(--admin-sidebar-width);
}

.admin-main .navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  min-height: 76px;
  padding: 12px 28px;
  border-bottom: 1px solid var(--admin-border);
  background: rgba(255, 255, 255, 0.96);
  color: var(--admin-text);
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.04);
  backdrop-filter: blur(10px);
}

.admin-navbar-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-navbar-title h2 {
  color: var(--admin-text);
  font-size: 18px;
}

.admin-navbar-title p {
  margin-top: 2px;
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-main .nav-right {
  min-width: 0;
}

.admin-main .nav-right span {
  overflow: hidden;
  max-width: 260px;
  color: var(--admin-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #e4e7ec;
  border-radius: 50%;
  background: #f9fafb;
}

.admin-icon-btn {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  background: #fff;
  color: var(--admin-text);
  cursor: pointer;
  font-size: 20px;
}

.admin-icon-btn:hover {
  background: #f9fafb;
}

.admin-menu-toggle,
.admin-sidebar-close {
  display: none;
}

/* Desktop: luôn hiện nút thu hẹp / mở rộng menu */
@media (min-width: 1025px) {
  .admin-menu-toggle {
    display: grid;
  }
}

/* Desktop collapsed sidebar — mini-rail kiểu YouTube (icon + nhãn dưới) */
body.admin-sidebar-collapsed {
  --admin-sidebar-width: 72px;
}

body.admin-sidebar-collapsed .admin-sidebar {
  width: var(--admin-sidebar-width);
  overflow: hidden;
  transition: width 0.18s ease;
}

body.admin-sidebar-collapsed .admin-brand > span:last-child,
body.admin-sidebar-collapsed .admin-menu-label,
body.admin-sidebar-collapsed .admin-nav-chevron,
body.admin-sidebar-collapsed .admin-nav-group-label > span:not(.admin-menu-icon),
body.admin-sidebar-collapsed .admin-sidebar-footer .admin-status-text,
body.admin-sidebar-collapsed .admin-sidebar-footer > span:last-child,
body.admin-sidebar-collapsed .admin-nav-badge {
  display: none !important;
}

body.admin-sidebar-collapsed .admin-sidebar-header {
  justify-content: center;
  min-height: 56px;
  padding: 12px 4px 8px;
  border-bottom: 0;
}

body.admin-sidebar-collapsed .admin-brand {
  justify-content: center;
  gap: 0;
}

body.admin-sidebar-collapsed .admin-brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  box-shadow: none;
}

body.admin-sidebar-collapsed .admin-sidebar .tab-nav {
  gap: 2px;
  padding: 4px 4px 8px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

body.admin-sidebar-collapsed .admin-sidebar .tab-nav::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

body.admin-sidebar-collapsed .admin-sidebar {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

body.admin-sidebar-collapsed .admin-sidebar::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

body.admin-sidebar-collapsed .admin-nav-group-toggle {
  display: none !important;
}

body.admin-sidebar-collapsed .admin-nav-group {
  margin-bottom: 0;
}

body.admin-sidebar-collapsed .admin-nav-group.is-open .admin-nav-group-items,
body.admin-sidebar-collapsed .admin-nav-group .admin-nav-group-items {
  display: flex !important;
  flex-direction: column;
  align-items: stretch;
  visibility: visible !important;
  max-height: none !important;
  opacity: 1 !important;
  overflow: visible !important;
  transform: none !important;
  margin: 0 !important;
  gap: 2px;
  padding: 0;
}

body.admin-sidebar-collapsed .admin-nav-group-items .tab-btn {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100% !important;
  min-width: 0;
  max-width: none;
  min-height: 44px !important;
  height: 44px;
  margin: 0;
  gap: 0;
  padding: 10px 0 !important;
  border-radius: 10px;
  box-shadow: none !important;
  transform: none !important;
  text-align: center;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.15;
  color: #4b5563;
}

body.admin-sidebar-collapsed .admin-nav-group-items .tab-btn:hover,
body.admin-sidebar-collapsed .admin-nav-group-items .tab-btn:active {
  transform: none !important;
  background: #f3f4f6;
  color: #374151;
}

body.admin-sidebar-collapsed .admin-nav-group-items .tab-btn.active {
  background: #f3f4f6;
  color: #111827;
  font-weight: 500;
  box-shadow: none !important;
}

body.admin-sidebar-collapsed .admin-nav-group-items .tab-btn .admin-menu-icon {
  display: grid !important;
  width: 22px !important;
  height: 22px !important;
  margin: 0 !important;
  flex: 0 0 22px !important;
  place-items: center;
  opacity: 0.78 !important;
  overflow: visible;
  color: #6b7280;
}

body.admin-sidebar-collapsed .admin-nav-group-items .tab-btn:hover .admin-menu-icon,
body.admin-sidebar-collapsed .admin-nav-group-items .tab-btn.active .admin-menu-icon {
  opacity: 0.95 !important;
  color: #374151;
}

body.admin-sidebar-collapsed .admin-nav-group-items .tab-btn .admin-menu-icon svg {
  display: block !important;
  width: 20px !important;
  height: 20px !important;
  min-width: 20px;
  min-height: 20px;
  overflow: visible;
  stroke: currentColor;
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  vector-effect: non-scaling-stroke;
}

/* Thu gọn: chỉ icon — nhãn đầy đủ qua title/tooltip (tránh chữ bị cắt) */
body.admin-sidebar-collapsed .admin-nav-group-items .tab-btn > span:not(.admin-menu-icon):not(.admin-nav-badge) {
  display: none !important;
}

body.admin-sidebar-collapsed .admin-sidebar-footer {
  justify-content: center;
  margin: auto 0 0;
  padding: 10px 4px 14px;
  border-top: 1px solid #f3f4f6;
}

body.admin-sidebar-collapsed .admin-sidebar-footer > span:first-child {
  display: block;
  width: 8px;
  height: 8px;
  margin: 0 auto;
  flex: 0 0 8px;
}

body.admin-sidebar-collapsed .admin-main {
  transition: margin-left 0.18s ease, width 0.18s ease;
}

.admin-sidebar-overlay {
  display: none;
}

.admin-main .dashboard-content,
.admin-main .dashboard-content.wide-layout {
  width: 100%;
  max-width: min(1440px, 100%);
  margin: 0 auto;
  padding: 28px;
  box-sizing: border-box;
  min-width: 0;
}

.admin-main .welcome-box,
.admin-main .platform-overview-section,
.admin-main .buildings-section,
.admin-main .users-section,
.admin-main .logs-section {
  border: 1px solid var(--admin-border);
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.05);
}

.admin-main .logs-page {
  width: 100%;
  max-width: none;
  margin-left: 0;
  transform: none;
}

@media (max-width: 1024px) {
  .admin-sidebar {
    transform: translateX(-100%);
    transition: transform 0.22s ease;
  }

  .admin-main {
    width: 100%;
    margin-left: 0;
  }

  .admin-menu-toggle,
  .admin-sidebar-close {
    display: grid;
  }

  .admin-sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 1050;
    width: 100%;
    height: 100%;
    border: 0;
    background: rgba(16, 24, 40, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
  }

  body.admin-sidebar-open {
    overflow: hidden;
  }

  body.admin-sidebar-open .admin-sidebar {
    transform: translateX(0);
  }

  body.admin-sidebar-open .admin-sidebar-overlay {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }
}

@media (max-width: 640px) {
  .admin-main .navbar {
    min-height: 64px;
    padding: 10px 14px;
  }

  .admin-navbar-title p,
  .admin-main .nav-right #userEmail,
  .admin-user-avatar {
    display: none;
  }

  .admin-navbar-title h2 {
    font-size: 16px;
  }

  .admin-main .dashboard-content,
  .admin-main .dashboard-content.wide-layout {
    padding: 16px 12px 24px;
  }

  .admin-main .btn-logout {
    padding: 8px 10px;
  }
}
/* ============================================
   FILE: admin.css
   MỤC ĐÍCH: Trang trí giao diện Web Admin cho đẹp mắt
   ============================================ */

/* Reset mặc định */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background-color: #f0f2f5;
    color: #333;
}

/* ==========================================
   TRANG ĐĂNG NHẬP (LOGIN)
   ========================================== */

.login-container {
    max-width: 420px;
    margin: 100px auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 24px;
    color: #2c3e50;
    margin-bottom: 8px;
}

.login-header p {
    color: #7f8c8d;
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
    color: #2c3e50;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #3498db;
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: #3498db;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-login:hover {
    background: #2980b9;
}

/* Buttons cho footer đăng ký (login page) */
.btn-trial, .btn-org-register {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background 0.3s;
  margin-bottom: 10px;
  box-sizing: border-box;
}
.btn-trial {
  background: #27ae60;
  color: #fff;
}
.btn-trial:hover {
  background: #219a52;
}
.btn-org-register {
  background: #8e44ad;
  color: #fff;
}
.btn-org-register:hover {
  background: #732d91;
}

.error-msg {
    text-align: center;
    color: #e74c3c;
    margin-top: 15px;
    font-size: 14px;
}

.success-msg {
    text-align: center;
    color: #27ae60;
    margin-top: 15px;
    font-size: 14px;
    font-weight: 600;
}

/* ==========================================
   MODAL CSS (Bảng hiện lên)
   ========================================== */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.5); /* Nền mờ phía sau */
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 12px;
    width: min(520px, calc(100vw - 32px));
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-content h3 { margin-top: 0; color: #2c3e50; }
.modal-content label { display: block; margin-top: 15px; font-weight: bold; font-size: 14px; }
.modal-content input, .modal-content select { width: 100%; padding: 10px; margin-top: 5px; border: 1px solid #ddd; border-radius: 6px; box-sizing: border-box; }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 25px;
}

/* ==========================================
   TRANG DASHBOARD
   ========================================== */

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #2c3e50;
    color: #fff;
    padding: 16px 30px;
}

.navbar h2 {
    font-size: 18px;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-right span {
    font-size: 14px;
    color: #bdc3c7;
}

.btn-logout {
    padding: 8px 16px;
    background: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.btn-logout:hover {
    background: #c0392b;
}

.dashboard-content {
    max-width: 1000px;
    margin: 30px auto;
    padding: 0 20px;
    box-sizing: border-box;
    min-width: 0;
}

.dashboard-content.wide-layout {
    /* Không dùng 100vw — sẽ tràn ngang vì admin-main đã trừ sidebar */
    max-width: min(1400px, 100%);
}

.table-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 8px;
}

.table-scroll-wrapper .buildings-table {
    min-width: 0;
}

.cell-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    display: inline-block;
    vertical-align: middle;
    width: 100%;
}

.building-actions {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 4px;
    align-items: center;
    white-space: nowrap;
}

.building-actions .btn-edit,
.building-actions .btn-logout,
.building-actions .btn-create,
.building-actions button,
.building-actions .ba-btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

#buildingsTable th:last-child,
#buildingsTable td.actions-cell {
    width: 320px;
    min-width: 320px;
    max-width: 320px;
    white-space: nowrap;
    overflow: visible;
}

.org-plan-select {
    padding: 4px 6px;
    border-radius: 4px;
    border: 1px solid #ddd;
    font-size: 12px;
    font-weight: 600;
    background: #f8f9fa;
    cursor: pointer;
    max-width: 120px;
}

.org-status-btn {
    padding: 4px 8px;
    font-size: 12px;
    white-space: nowrap;
}

.org-name-link {
    cursor: pointer;
    color: #2980b9;
}

.org-name-link:hover {
    text-decoration: underline;
}

.org-detail-btn {
    background: #8e44ad !important;
    color: #fff !important;
}

.org-detail-modal {
    max-height: 90vh;
    overflow-y: auto;
}

.org-detail-body {
    margin-top: 8px;
}

.org-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

.org-detail-label {
    display: block;
    font-size: 11px;
    color: #7f8c8d;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.org-detail-value {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
}

.org-detail-section {
    margin-bottom: 16px;
}

.org-detail-section h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #34495e;
}

.org-detail-hint {
    font-size: 11px;
    font-weight: normal;
    color: #95a5a6;
}

.org-detail-empty {
    color: #95a5a6;
    font-size: 13px;
    margin: 0;
}

.org-detail-list {
    margin: 0;
    padding-left: 18px;
    font-size: 13px;
}

.org-detail-logs li {
    margin-bottom: 6px;
}

.org-detail-log-time {
    color: #7f8c8d;
    font-size: 12px;
    margin-right: 4px;
}

.org-detail-mini-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.org-detail-mini-table th,
.org-detail-mini-table td {
    border: 1px solid #ecf0f1;
    padding: 6px 8px;
    text-align: left;
}

.org-detail-mini-table th {
    background: #f4f6f7;
    font-weight: 600;
}

.org-detail-id {
    font-family: monospace;
    font-size: 11px;
    word-break: break-all;
    cursor: pointer;
}

.org-detail-note {
    font-size: 12px;
    color: #7f8c8d;
    margin: 10px 0 8px;
    line-height: 1.4;
}

.org-detail-quota-banner {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.45;
}

.org-detail-quota-banner.warn {
    background: #fff7ed;
    border: 1px solid #fdba74;
    color: #9a3412;
}

.org-detail-quota-banner.locked {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #991b1b;
    font-weight: 600;
}

.org-detail-row-locked {
    background: #fff5f5;
}

.org-building-counts.obc-over .obc-total {
    color: #b45309;
}

.obc-warn {
    color: #dc2626;
    font-size: 12px;
}

.org-detail-subscription {
    margin: 0 0 12px;
    font-size: 13px;
    color: #475569;
}

.org-plan-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: -4px 0 12px;
}

.org-plan-actions .btn-create,
.org-plan-actions .btn-edit,
.org-plan-actions .btn-logout {
    padding: 6px 10px !important;
    font-size: 12px !important;
}

.org-plan-manage-link {
    padding: 0;
    border: none;
    background: none;
    color: #2980b9;
    font-size: 11px;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: underline;
    white-space: nowrap;
}

.org-plan-manage-link:hover {
    color: #1a5276;
}

.org-plan-cell {
    min-width: 128px;
    max-width: 170px;
    vertical-align: middle;
}

.org-plan-list-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    width: 100%;
}

.org-plan-list-cell .plan-badge {
    display: inline-block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.org-subscription-manage {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    padding: 12px 14px;
    margin-bottom: 12px;
}

.org-sub-manage-hint {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 10px;
    line-height: 1.45;
}

.org-sub-group + .org-sub-group {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #dbe3ee;
}

.org-sub-group-title {
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}

.org-detail-section-manage h4 {
    margin-bottom: 8px;
}

.org-life-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

.org-life-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f8fafc;
    padding: 10px 12px;
}

.org-life-k {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 4px;
}

.org-life-v {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.35;
}

.org-admin-card {
    border: 1px solid #e0e6ed;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 10px;
    background: #fff;
}

.org-admin-card-title {
    font-weight: 700;
    font-size: 15px;
    color: #2c3e50;
    margin-bottom: 8px;
}

.org-admin-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    padding: 4px 0;
    border-bottom: 1px solid #f4f6f7;
}

.org-admin-row span:first-child {
    color: #7f8c8d;
    flex-shrink: 0;
}

.org-admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.org-reset-pwd-btn {
    padding: 6px 10px !important;
    font-size: 12px !important;
}

.table-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: center;
    margin-top: 12px;
}

.table-pagination button {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.table-pagination button:hover:not(:disabled) {
    background: #f8f9fa;
}

.table-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.table-pagination .page-info {
    font-size: 13px;
    color: #666;
}

.welcome-box {
    background: #fff;
    padding: 20px 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    margin-bottom: 25px;
}

.user-org-line {
    margin: 0 0 8px 0;
    font-size: 15px;
    color: #2c3e50;
    line-height: 1.4;
}

.user-org-line strong {
    color: #8e44ad;
    font-weight: 700;
}

.welcome-box h3 {
    font-size: 18px;
    margin-bottom: 6px;
}

.badge {
    background: #27ae60;
    color: #fff;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* Khu vực Super Admin */
.admin-section {
    background: #fef9e7;
    border: 1px solid #f9e79f;
    padding: 20px 25px;
    border-radius: 10px;
    margin-bottom: 25px;
}

.admin-section h3 {
    margin-bottom: 15px;
    color: #d4ac0d;
}

.create-account-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.create-account-form input {
    flex: 1;
    min-width: 200px;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
}

.btn-create {
    padding: 10px 20px;
    background: #f39c12;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.btn-create:hover {
    background: #e67e22;
}

/* Danh sách Tòa nhà */
.buildings-section {
    background: #fff;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.btn-add {
    padding: 10px 18px;
    background: #27ae60;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.btn-add:hover {
    background: #219a52;
}

.buildings-table {
    width: 100%;
    border-collapse: collapse;
}

.buildings-table th {
    background: #ecf0f1;
    padding: 12px 15px;
    text-align: left;
    font-size: 13px;
    color: #7f8c8d;
    text-transform: uppercase;
}

.buildings-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.buildings-table tr:hover {
    background: #fafafa;
}

.btn-edit {
    padding: 6px 14px;
    background: #3498db;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.btn-edit:hover {
    background: #2980b9;
}

.status-draft {
    color: #e67e22;
    font-weight: 600;
}

.status-published {
    color: #27ae60;
    font-weight: 600;
}

/* ==========================================
   USER MANAGEMENT PAGE — FULL WIDTH LAYOUT
   ========================================== */

.user-management-page {
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100vw - 48px);
  max-width: 1400px;
  margin: 0;
  padding: 0;
}

.user-management-container {
  background: transparent;
}

/* Header Card */
.um-header-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 14px;
  padding: 32px 28px;
  margin-bottom: 24px;
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.25);
}

.um-header-title {
  font-size: 26px;
  margin: 0 0 8px 0;
  font-weight: 700;
}

.um-header-subtitle {
  font-size: 15px;
  margin: 0;
  opacity: 0.9;
}

/* Form Card */
.um-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  padding: 20px 24px;
  margin-bottom: 24px;
}

.um-form-card {
  /* same as .um-card */
}

.um-create-account {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.um-input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.um-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
}

.um-input::placeholder {
  color: #9ca3af;
}

.um-btn {
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.um-btn-primary {
  background: #667eea;
  color: white;
}

.um-btn-primary:hover {
  background: #5a6fd6;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* User Table Card */
.user-table-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  overflow: hidden;
  margin-bottom: 32px;
}

.utc-header {
  padding: 20px 24px;
  border-bottom: 1px solid #eef2f7;
  background: #f9fafb;
}

.utc-title {
  margin: 0;
  font-size: 18px;
  color: #1e293b;
  font-weight: 700;
}

/* Users Table Styles (improved) */
.users-table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.users-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
}

.users-table th,
.users-table td {
  padding: 14px 12px;
  vertical-align: middle;
  text-align: left;
  border-bottom: 1px solid #eef2f7;
  font-size: 14px;
}

.users-table th {
  background: #f8fafc;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.5px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.users-table tr:hover {
  background: #f9fafb;
}

.users-table td {
  color: #334155;
  line-height: 1.5;
}

/* Column widths — Email/Họ tên vừa; Thao tác cố định 248px */
.users-table th:nth-child(1),
.users-table td:nth-child(1) { width: 18%; } /* Email */
.users-table th:nth-child(2),
.users-table td:nth-child(2) { width: 12%; } /* Họ tên */
.users-table th:nth-child(3),
.users-table td:nth-child(3) { width: 9%; } /* SĐT */
.users-table th:nth-child(4),
.users-table td:nth-child(4) { width: 11%; } /* Vai trò */
.users-table th:nth-child(5),
.users-table td:nth-child(5) { width: 10%; } /* Trạng thái */
.users-table th:nth-child(6),
.users-table td:nth-child(6) { width: 8%; } /* Tổ chức */
.users-table th:nth-child(7),
.users-table td:nth-child(7) { width: 7%; } /* Tòa nhà */
.users-table th:nth-child(8),
.users-table td:nth-child(8) { width: 7%; } /* Ngày tạo */
.users-table th:nth-child(9),
.users-table td:nth-child(9) {
  width: 248px;
  min-width: 248px;
  max-width: 248px;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  position: static;
  box-shadow: none;
  border-left: 0 !important;
} /* Thao tác */

/* Text truncation with ellipsis for long content */
.users-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Badge role/status + actions: không cắt pill */
.users-table td:nth-child(4),
.users-table td:nth-child(5),
.users-table td:nth-child(9) {
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}

/* Badges */
.role-badge,
.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
  max-width: none;
  box-sizing: border-box;
}

.role-badge.super-admin {
  background: #ede7fe;
  color: #5b21b6;
}

.role-badge.building-admin {
  background: #dbeafe;
  color: #1d4ed8;
}

.role-badge.org-admin {
  background: #fce7f3;
  color: #9d174d;
}

.role-badge.registered-user {
  background: #e0f2fe;
  color: #0369a1;
}

.role-badge.finance-admin {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.active {
  background: #dcfce7;
  color: #166534;
}

.status-badge.inactive {
  background: #fee2e2;
  color: #991b1b;
}

/* Actions cell */
.actions-cell {
  white-space: nowrap;
}

.user-actions {
  display: flex;
  flex-direction: row;
  gap: 6px;
  flex-wrap: nowrap;
  justify-content: flex-start;
  max-width: none;
  min-width: 0;
}

.user-actions button {
  flex-shrink: 0;
  font-size: 12px !important;
  padding: 5px 8px !important;
  white-space: nowrap;
}

.badge-inactive {
  background: #94a3b8 !important;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: #fff;
}

.plan-badge {
  background: #475569;
  color: #fff;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.plan-badge.plan-free { background: #64748b; }
.plan-badge.plan-pro { background: #2563eb; }
.plan-badge.plan-enterprise { background: #7c3aed; }

.badge-quota-locked {
  background: #dc2626 !important;
  color: #fff;
  padding: 4px 10px;
  border-radius: 999px;
}

.quota-alert-line {
  margin: 8px 0 0;
  padding: 10px 14px;
  border: 1px solid #fdba74;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.45;
}

.quota-alert-line.quota-alert-warn {
  background: #fff7ed;
  border-color: #fdba74;
  color: #9a3412;
}

.quota-alert-line.quota-alert-locked {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
  font-weight: 600;
}

/* Header actions for User Management */
.um-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.um-header-info {
  flex: 1;
}

.um-header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-shrink: 0;
}

.um-filter-select {
  padding: 10px 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  color: #333;
  font-size: 14px;
  cursor: pointer;
  min-width: 140px;
  transition: all 0.2s;
}

.um-filter-select:hover {
  border-color: rgba(255, 255, 255, 0.8);
  background: #f8fafc;
}

.um-filter-select:focus {
  outline: none;
  border-color: white;
  background: white;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

.um-btn-secondary {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.um-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

/* Responsive cho User Management */
@media (max-width: 768px) {
  .user-management-page {
    width: calc(100vw - 24px);
    max-width: none;
  }

  .um-header-top {
    flex-direction: column;
    align-items: stretch;
  }

  .um-header-actions {
    justify-content: flex-start;
    margin-top: 12px;
  }

  .um-create-account {
    grid-template-columns: 1fr;
  }

  .um-btn-primary {
    width: 100%;
  }
}

/* ==========================================
   TAB NAVIGATION (Dashboard Super Admin)
   ========================================== */

.tab-nav {
    display: flex;
    gap: 6px;
    background: #fff;
    border-radius: 10px;
    padding: 8px 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    flex-wrap: wrap;
}

.tab-btn {
    padding: 9px 22px;
    background: #ecf0f1;
    color: #555;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s, color 0.2s;
}

.tab-btn:hover {
    background: #d5dbdb;
}

.tab-btn.active {
    background: #2c3e50;
    color: #fff;
}

/* ==========================================
   LOGS PAGE — WIDE TABLE LAYOUT
   ========================================== */

.logs-page {
  width: calc(100vw - 48px);
  max-width: 1400px;
  margin-left: 50%;
  transform: translateX(-50%);
}

.logs-section {
  width: 100%;
  background: transparent;
  padding: 0;
  margin-bottom: 25px;
}

.logs-section h3 {
  color: #2c3e50;
}

/* User Management Section — không dùng 100vw / translate (gây cắt sidebar) */
.user-management-section {
  width: 100%;
  max-width: 100%;
  margin-left: 0;
  transform: none;
  box-sizing: border-box;
}

.users-table-wrapper {
  width: 100%;
  overflow-x: auto;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.users-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  table-layout: fixed;
}

.users-table thead {
  background: #e8ecf1;
}

.users-table th {
  padding: 10px 12px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: #2c3e50;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  border-bottom: 2px solid #dce2e8;
}

.users-table tbody tr:hover {
  background: #f8f9fa;
}

.users-table td {
  padding: 10px 12px;
  vertical-align: middle;
  border-bottom: 1px solid #edf2f7;
  font-size: 13px;
  color: #333;
  line-height: 1.5;
}

/* Column widths — Email/Họ tên vừa; Thao tác cố định 248px */
.users-table th:nth-child(1),
.users-table td:nth-child(1) { width: 18%; } /* Email */

.users-table th:nth-child(2),
.users-table td:nth-child(2) { width: 12%; } /* Họ tên */

.users-table th:nth-child(3),
.users-table td:nth-child(3) { width: 9%; } /* SĐT */

.users-table th:nth-child(4),
.users-table td:nth-child(4) { width: 11%; } /* Vai trò */

.users-table th:nth-child(5),
.users-table td:nth-child(5) { width: 10%; } /* Trạng thái */

.users-table th:nth-child(6),
.users-table td:nth-child(6) { width: 8%; } /* Tổ chức */

.users-table th:nth-child(7),
.users-table td:nth-child(7) { width: 7%; } /* Tòa nhà */

.users-table th:nth-child(8),
.users-table td:nth-child(8) { width: 7%; } /* Ngày tạo */

.users-table th:nth-child(9),
.users-table td:nth-child(9) {
  width: 248px;
  min-width: 248px;
  max-width: 248px;
  white-space: nowrap;
  position: static;
  right: auto;
  background: transparent;
  box-shadow: none;
  border-left: 0 !important;
  overflow: visible;
} /* Thao tác */

.users-table thead th:nth-child(9) {
  background: transparent;
  z-index: auto;
}

.users-table tbody tr:hover td:nth-child(9) {
  background: transparent;
}

/* Actions cell */
.actions-cell {
  white-space: nowrap;
}

.user-actions {
  display: inline-flex;
  flex-direction: row;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-start;
  max-width: 100%;
  min-width: 0;
}

.user-actions button {
  flex-shrink: 0;
  font-size: 11px !important;
  padding: 4px 7px !important;
  white-space: nowrap;
}

/* Email truncation (cột 1) */
.users-table td:nth-child(1) {
  overflow: hidden;
  text-overflow: ellipsis;
}

#usersTable {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  table-layout: fixed;
}

#usersTable th:last-child,
#usersTable td.actions-cell {
  width: 248px;
  min-width: 248px;
  max-width: 248px;
  white-space: nowrap;
  overflow: visible;
  position: static;
  right: auto;
  z-index: auto;
  background: transparent;
  box-shadow: none;
  border-left: 0 !important;
}

#usersTable thead th:last-child {
  background: transparent;
  z-index: auto;
}

#usersTable tbody tr:hover td.actions-cell {
  background: transparent;
}


.logs-filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
  background: #fff;
  padding: 16px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  margin-bottom: 12px;
}

.logs-filter-bar label {
  font-size: 13px;
  color: #666;
  margin-bottom: 4px;
  display: block;
}

.logs-filter-bar select,
.logs-filter-bar input[type="text"],
.logs-filter-bar input[type="date"] {
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #ddd;
  font-size: 14px;
  background: #fff;
}

.logs-filter-bar select:focus,
.logs-filter-bar input:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.12);
}

.logs-table-wrapper {
  width: 100%;
  overflow-x: auto;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.logs-table {
  width: 100%;
  min-width: 1150px;
  table-layout: fixed;
  border-collapse: collapse;
}

.logs-table thead {
  background: #34495e;
  color: #fff;
}

.logs-table th {
  padding: 12px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.logs-table th:last-child {
  border-right: none;
}

.logs-table tbody tr:hover {
  background: #f8f9fa;
}

.logs-table td {
  padding: 10px 12px;
  vertical-align: top;
  border-bottom: 1px solid #eee;
  font-size: 13px;
  color: #333;
  line-height: 1.5;
}

.logs-table td:nth-child(1) { /* Thời gian */
  width: 140px;
  white-space: nowrap;
}

.logs-table td:nth-child(2) { /* Người dùng */
  width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logs-table td:nth-child(3) { /* Role */
  width: 130px;
  white-space: nowrap;
}

.logs-table td:nth-child(4) { /* Hành động */
  width: 150px;
  white-space: nowrap;
}

.logs-table td:nth-child(5) { /* Đối tượng */
  width: 220px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.logs-table td:nth-child(6) { /* Chi tiết */
  width: 260px;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.4;
  color: #555;
}

.logs-table td:nth-child(7) { /* IP */
  width: 90px;
  white-space: nowrap;
}

.logs-table .badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.logs-table .role-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  background: #ecf0f1;
  color: #2c3e50;
}

#logsTotal {
  font-size: 14px;
  font-weight: 600;
  color: #2c3e50;
}

#logsPagination {
  margin-top: 15px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

#logsPagination button {
  padding: 6px 12px;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}

#logsPagination button:hover:not(:disabled) {
  background: #f8f9fa;
}

#logsPagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#logsPagination .page-info {
  font-size: 13px;
  color: #666;
}

/* Responsive cho Logs Page */
@media (max-width: 768px) {
  .logs-page {
    width: calc(100vw - 24px);
    max-width: none;
  }

  .logs-filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .logs-filter-bar > div {
    width: 100%;
  }

  .logs-filter-bar select,
  .logs-filter-bar input[type="text"],
  .logs-filter-bar input[type="date"] {
    width: 100%;
  }
}

/* Phase 4.2a — Thẻ tổng quan tổ chức */
.org-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.org-overview-card {
  background: linear-gradient(135deg, #f8f9fc 0%, #fff 100%);
  border: 1px solid #e8ecf1;
  border-radius: 10px;
  padding: 14px 16px;
  cursor: default;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.org-overview-card.is-clickable {
  cursor: pointer;
}

.org-overview-card.is-clickable:hover {
  border-color: #3498db;
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.12);
}

.org-overview-card.is-selected {
  border-color: #3498db;
  background: linear-gradient(135deg, #eef6fc 0%, #fff 100%);
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.15);
}

.org-overview-card.is-selected .ov-value {
  color: #2980b9;
}

.org-overview-card .ov-label {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
}

.org-overview-card .ov-value {
  font-size: 22px;
  font-weight: 700;
  color: #1f2937;
  line-height: 1.2;
}

.org-overview-card .ov-sub {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 4px;
}

.org-overview-card.accent-purple { border-left: 4px solid #8e44ad; }
.org-overview-card.accent-green { border-left: 4px solid #27ae60; }
.org-overview-card.accent-orange { border-left: 4px solid #e67e22; }
.org-overview-card.accent-blue { border-left: 4px solid #3498db; }
.org-overview-card.accent-gray { border-left: 4px solid #95a5a6; }
.org-overview-card.accent-red { border-left: 4px solid #e74c3c; }
.org-overview-card.accent-teal { border-left: 4px solid #16a085; }

.org-overview-card.card-needs-attention {
  border-color: #e67e22;
  box-shadow: 0 0 0 1px rgba(230, 126, 34, 0.25);
}

.org-overview-card .ov-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.ov-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: #fef3c7;
  color: #b45309;
  white-space: nowrap;
}

.card-needs-attention .ov-badge {
  background: #fee2e2;
  color: #b91c1c;
}

.ov-progress {
  height: 5px;
  background: #ecf0f1;
  border-radius: 3px;
  margin-top: 8px;
  overflow: hidden;
}

.ov-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #3498db, #2ecc71);
  border-radius: 3px;
}

.ov-progress-label {
  font-size: 10px;
  color: #7f8c8d;
  margin-top: 4px;
}

.platform-overview-hint {
  font-size: 12px;
  color: #7f8c8d;
  margin: 0 0 10px 0;
}

.platform-overview-section {
  margin-bottom: 20px;
}

.platform-overview-title {
  margin: 0 0 10px 0;
  font-size: 15px;
  color: #2c3e50;
  font-weight: 600;
}

/* Phase 4.2b — nhiều ORG_ADMIN trong bảng */
.org-admins-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 220px;
}

.org-admin-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: #ede7fe;
  color: #5b21b6;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.org-admin-chip .admin-inactive-tag {
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 4px;
  background: #fee2e2;
  color: #b91c1c;
  font-weight: 600;
}

.buildings-table td .org-admins-cell {
  white-space: normal;
}

/* Phase 4.2c — tòa XB / nháp */
.org-building-counts {
  line-height: 1.25;
  min-width: 72px;
}

.org-building-counts .obc-total {
  font-size: 15px;
  font-weight: 700;
  color: #1f2937;
}

.org-building-counts .obc-split {
  font-size: 10px;
  color: #6b7280;
  margin-top: 2px;
}

.org-building-counts .obc-pub {
  color: #15803d;
  font-weight: 600;
}

.org-building-counts .obc-draft {
  color: #b45309;
  font-weight: 600;
}

.org-building-counts .obc-sep {
  margin: 0 2px;
  color: #d1d5db;
}

/* Phase 4.2d / 4.5 — sắp xếp bảng dashboard */
.org-sort-hint {
  font-size: 12px;
  color: #7f8c8d;
  margin: 0 0 8px 0;
}

.dash-sort-table th.org-sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  position: relative;
  padding-right: 22px;
}

.dash-sort-table th.org-sortable:hover {
  background: #eef6fc;
  color: #2980b9;
}

.dash-sort-table th.org-sort-active {
  background: #e8f4fc;
  color: #2980b9;
  font-weight: 600;
}

.dash-sort-table .org-sort-indicator {
  display: inline-block;
  min-width: 14px;
  margin-left: 4px;
  font-size: 11px;
  line-height: 1;
  color: #3498db;
  font-weight: 700;
  vertical-align: middle;
}

.dash-sort-table th.org-sortable:not(.org-sort-active) .org-sort-indicator {
  color: #bdc3c7;
}

.users-table.dash-sort-table thead th.org-sortable:hover {
  background: #3d566e;
  color: #fff;
}

.users-table.dash-sort-table thead th.org-sort-active {
  background: #3d566e;
  color: #aed6f1;
}

.users-table.dash-sort-table .org-sort-indicator {
  color: #85c1e9;
}

.users-table.dash-sort-table th.org-sortable:not(.org-sort-active) .org-sort-indicator {
  color: #7f8c8d;
}

/* ===== Tab Gói & Thanh toán (Phase 5.7 UX) ===== */
.billing-tab-section {
  max-width: 1200px;
}

.billing-tab-intro {
  margin: 6px 0 0;
  font-size: 13px;
  color: #64748b;
  line-height: 1.5;
}

.billing-tab-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin: 16px 0;
}

.billing-field-label {
  display: block;
  font-size: 12px;
  color: #64748b;
  margin-bottom: 4px;
}

.billing-tab-body {
  margin-top: 8px;
}

.billing-tab-empty,
.billing-tab-loading,
.billing-tab-error {
  padding: 24px;
  text-align: center;
  color: #64748b;
  background: #f8fafc;
  border: 1px dashed #dbe3ee;
  border-radius: 10px;
}

.billing-tab-error {
  color: #b91c1c;
  background: #fef2f2;
  border-color: #fecaca;
}

.billing-tab-org-head {
  margin-bottom: 12px;
}

.billing-tab-org-head h4 {
  margin: 0 0 4px;
  font-size: 18px;
}

.billing-tab-org-meta {
  font-size: 13px;
  color: #64748b;
}

.billing-tab-section-block {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid #e5e7eb;
}

.billing-tab-section-block h4 {
  margin: 0 0 10px;
  font-size: 14px;
}

.billing-state-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.billing-state-free { background: #e2e8f0; color: #334155; }
.billing-state-paid_active { background: #dcfce7; color: #166534; }
.billing-state-grace { background: #fef3c7; color: #92400e; }
.billing-state-expired { background: #fee2e2; color: #991b1b; }

.billing-future-note {
  margin-top: 12px;
  padding: 10px 12px;
  font-size: 12px;
  color: #475569;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  line-height: 1.45;
}

.org-billing-snapshot {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.org-billing-snapshot-head h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.org-billing-snapshot-line {
  margin-bottom: 4px;
}

.org-billing-snapshot-hint {
  font-size: 12px;
  color: #64748b;
  margin: 10px 0;
  line-height: 1.45;
}

.org-billing-snapshot-btn {
  margin-top: 4px;
}

.org-billing-snapshot-expiry,
.org-billing-snapshot .org-detail-subscription {
  font-size: 13px;
  color: #475569;
  margin: 4px 0;
}

.billing-action-panel .org-plan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ===== Phase 6 — Analytics ===== */
.analytics-tab-section {
  padding: 8px 0 24px;
}

.analytics-header-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.analytics-tab-intro {
  margin: 4px 0 0;
  font-size: 13px;
  color: #64748b;
  max-width: 520px;
  line-height: 1.45;
}

.analytics-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
}

.analytics-loading,
.analytics-error,
.analytics-empty {
  margin: 8px 0;
  font-size: 13px;
  color: #64748b;
}

.analytics-error {
  color: #b91c1c;
}

.analytics-summary-meta {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 10px;
}

.analytics-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.analytics-summary-card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  padding: 14px 16px;
}

.analytics-summary-value {
  font-size: 22px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
}

.analytics-summary-label {
  margin-top: 4px;
  font-size: 12px;
  color: #64748b;
}

.analytics-card-login { border-left: 3px solid #0ea5e9; }
.analytics-card-publish { border-left: 3px solid #10b981; }
.analytics-card-invoice { border-left: 3px solid #f59e0b; }
.analytics-card-amount { border-left: 3px solid #6366f1; }

.analytics-charts-grid,
.analytics-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.analytics-chart-card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  padding: 14px 16px;
}

.analytics-chart-card h4 {
  margin: 0 0 12px;
  font-size: 14px;
  color: #334155;
}

.analytics-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  min-height: 140px;
  height: 160px;
  padding-top: 8px;
}

.analytics-bar-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.analytics-bar-track {
  flex: 1;
  width: 100%;
  max-width: 18px;
  display: flex;
  align-items: flex-end;
  background: #f1f5f9;
  border-radius: 4px 4px 0 0;
  overflow: hidden;
}

.analytics-bar-fill {
  width: 100%;
  min-height: 0;
  background: linear-gradient(180deg, #38bdf8, #0284c7);
  border-radius: 4px 4px 0 0;
  transition: height 0.2s ease;
}

.analytics-bar-label {
  margin-top: 4px;
  font-size: 9px;
  color: #94a3b8;
  white-space: nowrap;
  transform: rotate(-35deg);
  transform-origin: top center;
  height: 18px;
}

.analytics-bar-label-spacer {
  visibility: hidden;
}

.analytics-plan-row {
  margin-bottom: 10px;
}

.analytics-plan-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 4px;
  color: #475569;
}

.analytics-plan-bar {
  height: 10px;
  background: #f1f5f9;
  border-radius: 999px;
  overflow: hidden;
}

.analytics-plan-fill {
  height: 100%;
  border-radius: 999px;
}

.analytics-plan-fill.plan-free { background: #94a3b8; }
.analytics-plan-fill.plan-pro { background: #0ea5e9; }
.analytics-plan-fill.plan-ent { background: #6366f1; }

.analytics-paid-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.analytics-paid-table th,
.analytics-paid-table td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid #e2e8f0;
}

.analytics-paid-table th {
  color: #64748b;
  font-weight: 600;
}

.analytics-alert-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.analytics-alert-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

.analytics-alert-item.severity-warn {
  border-color: #fcd34d;
  background: #fffbeb;
}

.analytics-alert-item.severity-danger {
  border-color: #fca5a5;
  background: #fef2f2;
}

.analytics-alert-item.severity-info {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.analytics-alert-type {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #64748b;
  min-width: 88px;
}

.analytics-alert-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  color: #334155;
}

.analytics-alerts-ok {
  color: #059669;
}

.analytics-billing-hint {
  margin: 4px 0 14px;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #eff6ff;
}

.analytics-billing-hint-text {
  margin: 0 0 10px;
  font-size: 13px;
  color: #334155;
  line-height: 1.45;
}

.analytics-billing-hint-btn {
  margin: 0;
}

@media (max-width: 900px) {
  .analytics-summary-grid,
  .analytics-charts-grid,
  .analytics-bottom-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Module B — Creator dashboard ===== */
.creator-tab-section {
  width: 100%;
  max-width: none;
}

.creator-tab-section .creator-header-row {
  align-items: flex-start;
  gap: 12px;
}

.creator-tab-section .creator-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.creator-tab-section .creator-status {
  min-height: 0;
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--admin-muted, #667085);
}

.creator-tab-section .creator-status:empty {
  display: none;
}

.creator-panel {
  background: #fff;
  border: 1px solid #e8ecf1;
  border-radius: 12px;
  padding: 14px 16px 16px;
  margin-bottom: 14px;
  width: 100%;
  box-sizing: border-box;
}

.creator-panel-title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: #1d2939;
  letter-spacing: 0.01em;
}

.creator-panel-intro {
  margin: 2px 0 0;
  font-size: 12px;
}

.creator-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.creator-panel-head .creator-panel-title {
  margin-bottom: 0;
}

.creator-ws-count {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: #667085;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f2f4f7;
}

.creator-ws-count:empty {
  display: none;
}

.creator-tab-section .creator-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  width: 100%;
}

.creator-tab-section .creator-kpi-grid .org-overview-card {
  min-height: 0;
  padding: 12px 14px;
}

.creator-tab-section .creator-filter-card {
  width: 100%;
  appearance: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.creator-tab-section .creator-filter-card:hover {
  border-color: #98a2b3;
  box-shadow: 0 4px 12px rgba(16, 24, 40, 0.08);
  transform: translateY(-1px);
}

.creator-tab-section .creator-filter-card:focus-visible {
  outline: 3px solid rgba(52, 152, 219, 0.2);
  outline-offset: 2px;
}

.creator-tab-section .creator-filter-card.is-selected {
  background: #f8fbff;
  border-color: #3498db;
  box-shadow: 0 0 0 1px rgba(52, 152, 219, 0.12);
}

.creator-tab-section .creator-filter-card .ov-sub {
  color: #667085;
}

.creator-tab-section .creator-kpi-grid .ov-card-main {
  display: block;
}

.creator-tab-section .creator-kpi-grid .ov-value {
  font-size: 24px;
}

.creator-tab-section .creator-kpi-grid .ov-sub {
  margin-top: 6px;
}

.creator-stats-note {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--admin-muted, #667085);
}

.creator-table-wrap {
  overflow-x: auto;
  overflow-y: visible;
  max-height: none !important;
  border: 1px solid #eaecf0;
  border-radius: 10px;
  background: #fff;
}

.creator-panel--table .table-pagination {
  margin-top: 10px;
}

.creator-ws-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  margin: 0;
}

.creator-ws-table thead th {
  background: #f8fafc;
  font-size: 12px;
  font-weight: 600;
  color: #475467;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #eaecf0;
  white-space: nowrap;
}

.creator-ws-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid #f2f4f7;
  font-size: 13px;
  color: #344054;
  vertical-align: middle;
}

.creator-ws-table tbody tr:last-child td {
  border-bottom: none;
}

.creator-ws-table tbody tr:hover td {
  background: #f8fafc;
}

.creator-ws-table .col-name {
  width: 38%;
}

.creator-ws-table .col-status {
  width: 18%;
}

.creator-ws-table .col-place {
  width: 28%;
}

.creator-ws-table .col-actions {
  width: 16%;
  text-align: right;
  white-space: nowrap;
}

.creator-cell-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.creator-empty-cell {
  text-align: center !important;
  color: #98a2b3 !important;
  padding: 28px 12px !important;
}

.creator-open-editor {
  display: inline-block;
  text-decoration: none;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .creator-tab-section .creator-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .creator-ws-table .col-name,
  .creator-ws-table .col-status,
  .creator-ws-table .col-place,
  .creator-ws-table .col-actions {
    width: auto;
  }

  .creator-ws-table {
    table-layout: auto;
    min-width: 560px;
  }
}

/* —— Searchable combobox (tòa nhà / chọn có lọc) —— */
.admin-combobox {
  position: relative;
  display: block;
  width: 100%;
}

.admin-combobox-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 12px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  font: inherit;
  background: #fff;
}

.admin-combobox-input:focus {
  outline: 2px solid #93c5fd;
  outline-offset: 1px;
  border-color: #60a5fa;
}

.admin-combobox.is-open .admin-combobox-input {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.admin-combobox-list {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: 100%;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  max-height: 240px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #d0d5dd;
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.admin-combobox-option {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  text-align: left;
  font: inherit;
  cursor: pointer;
  color: #1e293b;
}

.admin-combobox-option:hover,
.admin-combobox-option.is-active {
  background: #eff6ff;
}

.admin-combobox-option.is-empty {
  color: #64748b;
  font-style: italic;
}

.admin-combobox-option.is-clear {
  color: #475569;
  border-bottom: 1px solid #eef2f7;
}

.admin-combobox-option .admin-combobox-meta {
  display: block;
  font-size: 12px;
  color: #94a3b8;
  margin-top: 2px;
}

.admin-combobox-empty {
  padding: 10px 12px;
  color: #94a3b8;
  font-size: 13px;
}

body[data-admin-theme="dark"] .admin-combobox-input {
  background: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}

body[data-admin-theme="dark"] .admin-combobox-list {
  background: #0f172a;
  border-color: #334155;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}

body[data-admin-theme="dark"] .admin-combobox-option {
  color: #e2e8f0;
}

body[data-admin-theme="dark"] .admin-combobox-option:hover,
body[data-admin-theme="dark"] .admin-combobox-option.is-active {
  background: #1e293b;
}


/* Emergency section — layout gần Tòa nhà / overview */
.emergency-subnav {
  display: none !important;
}
.emergency-subpanel[hidden] {
  display: none !important;
}
.emergency-section .emergency-lead {
  margin: 0 0 16px;
  color: #667085;
  font-size: 14px;
  line-height: 1.5;
  max-width: 920px;
}
.emergency-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 960px) {
  .emergency-layout {
    grid-template-columns: 1fr;
  }
}
.emergency-card {
  background: #fff;
  border: 1px solid #eaecf0;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.emergency-card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #1d2939;
}
.emergency-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.emergency-form {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.emergency-form label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: #475467;
}
.emergency-form input,
.emergency-form select {
  padding: 8px 12px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  font-size: 14px;
}
.emergency-field-hint {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 400;
  color: #98a2b3;
  line-height: 1.35;
}
.emergency-command-panel {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  border-radius: 8px;
}
.emergency-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.emergency-config-hint {
  margin: 0 0 14px;
  font-size: 12px;
  color: #98a2b3;
  line-height: 1.45;
}
.emergency-detail-panel {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #fde68a;
  border-radius: 10px;
  background: #fffbeb;
}
body[data-admin-theme="dark"] .emergency-card {
  background: #0f172a;
  border-color: #334155;
}
body[data-admin-theme="dark"] .emergency-card-title {
  color: #e2e8f0;
}
body[data-admin-theme="dark"] .emergency-lead,
body[data-admin-theme="dark"] .emergency-config-hint {
  color: #94a3b8;
}
body[data-admin-theme="dark"] .emergency-detail-panel {
  background: #1e293b;
  border-color: #92400e;
}

.seismic-data-subpanel {
  display: none;
}
.seismic-data-subpanel.is-active {
  display: block;
}
.seismic-data-subpanel[hidden] {
  display: none !important;
}
