/**
 * Desktop Application View Styles
 */

.desktop-app {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-main);
}

/* Sidebar - Precision White / Slate Industrial Sidebar */
.desktop-sidebar {
  width: 260px;
  background: #ffffff;
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: 1px 0 3px rgba(15, 23, 42, 0.02);
  transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s ease;
  position: relative;
  z-index: 40;
}

.sidebar-header {
  height: 58px;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border-subtle);
  box-sizing: border-box;
}
.sidebar-brand-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  width: 100%;
  overflow: hidden;
}
.sidebar-logo-crop {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.sidebar-brand-logo {
  height: 20px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
  display: block;
}

/* Sidebar Organization Switcher */
.sidebar-tenant-switcher {
  position: relative;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  background: #f8fafc;
  display: flex;
  align-items: center;
  transition: var(--transition);
}
.sidebar-tenant-trigger {
  width: 100%;
  height: 34px;
  min-height: 34px;
  padding: 0 0.65rem;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: var(--transition);
  box-sizing: border-box;
  text-align: left;
  outline: none;
}
.sidebar-tenant-trigger:hover {
  border-color: #0284c7;
  background-color: #f0f9ff;
}
.sidebar-tenant-trigger.active,
.sidebar-tenant-trigger:focus-visible {
  border-color: #0284c7;
  background-color: #e0f2fe;
  color: #0369a1;
  box-shadow: 0 0 0 2px var(--primary-glow);
}
.sidebar-tenant-icon {
  font-size: 19px;
  color: #0284c7;
  flex-shrink: 0;
  line-height: 1;
}
.sidebar-tenant-name {
  flex: 1;
  min-width: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-tenant-trigger.active .sidebar-tenant-name {
  color: #0284c7;
}
.sidebar-tenant-chevron {
  font-size: 18px;
  color: #64748b;
  flex-shrink: 0;
  line-height: 1;
  transition: transform 0.15s ease;
}
.sidebar-tenant-trigger.active .sidebar-tenant-chevron {
  transform: rotate(180deg);
  color: #0284c7;
}

/* Floating Dropdown / Flyout Menu for Organization Switcher */
.sidebar-tenant-flyout {
  display: none;
  position: fixed;
  z-index: 1050;
  width: 280px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.15), 0 8px 10px -6px rgba(15, 23, 42, 0.1);
  overflow: hidden;
  animation: flyoutFadeIn 0.15s ease-out;
  padding: 0.35rem 0;
  box-sizing: border-box;
  max-height: calc(100vh - 24px);
}
.sidebar-tenant-flyout.open {
  display: flex;
  flex-direction: column;
}
@keyframes flyoutFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.tenant-flyout-header {
  padding: 0.45rem 0.75rem 0.35rem;
  border-bottom: 1px solid #f1f5f9;
  flex-shrink: 0;
}
.tenant-flyout-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}
.tenant-flyout-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.tenant-flyout-list::-webkit-scrollbar {
  width: 5px;
}
.tenant-flyout-list::-webkit-scrollbar-track {
  background: transparent;
}
.tenant-flyout-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
.tenant-flyout-list::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}
.tenant-flyout-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
  color: #1e293b;
  user-select: none;
  flex-shrink: 0;
}
.tenant-flyout-item:hover,
.tenant-flyout-item:focus-visible {
  background: #f1f5f9;
  outline: none;
}
.tenant-flyout-item.active {
  background: #f0f9ff;
}
.tenant-flyout-item-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.tenant-flyout-item-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #0f172a;
  white-space: normal;
  word-break: break-word;
  line-height: 1.3;
}
.tenant-flyout-item.active .tenant-flyout-item-name {
  color: #0284c7;
}
.tenant-flyout-item-role {
  font-size: 0.68rem;
  font-weight: 500;
  color: #64748b;
  margin-top: 1px;
}
.tenant-flyout-check {
  font-size: 18px;
  color: #0284c7;
  flex-shrink: 0;
}
.tenant-flyout-footer {
  border-top: 1px solid #f1f5f9;
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}
.tenant-flyout-action-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.4rem 0.65rem;
  border: none;
  background: transparent;
  border-radius: 5px;
  font-size: 0.78rem;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}
.tenant-flyout-action-btn:hover {
  background: #f8fafc;
  color: #0284c7;
}
.tenant-flyout-action-btn .material-symbols-rounded {
  font-size: 17px;
  color: #64748b;
}
.tenant-flyout-action-btn:hover .material-symbols-rounded {
  color: #0284c7;
}
.tenant-flyout-empty {
  padding: 1rem;
  text-align: center;
  color: #94a3b8;
  font-size: 0.82rem;
}

/* Grouped Navigation */
.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  overflow-y: auto;
}
.nav-section {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.nav-section-title {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #94a3b8;
  padding: 0.35rem 0.75rem 0.2rem;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.75rem;
  color: #475569;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.86rem;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  text-decoration: none;
}
.nav-item:hover {
  color: #0f172a;
  background: #f1f5f9;
  text-decoration: none;
}
.nav-item.active {
  color: var(--primary);
  background: #f0f9ff;
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}
.nav-icon-wrapper {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nav-icon {
  font-size: 20px;
  line-height: 1;
}
.nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.nav-badge-pill {
  font-size: 0.68rem;
  padding: 0.1rem 0.45rem;
  border-radius: 10px;
  font-weight: 700;
  line-height: 1.2;
}

/* Sidebar Status Card */
.sidebar-status-card {
  margin: 0.4rem 0.75rem;
  padding: 0.5rem 0.75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.status-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
  flex-shrink: 0;
  animation: pulse-dot 2s infinite ease-in-out;
}
@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.85); opacity: 0.5; }
}
.status-card-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  white-space: nowrap;
}
.status-card-title {
  font-size: 0.74rem;
  font-weight: 700;
  color: #1e293b;
}
.status-card-sub {
  font-size: 0.68rem;
  color: #64748b;
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 0.75rem 0.75rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: #ffffff;
}
.sidebar-worker-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  color: #1e293b;
  text-decoration: none;
  transition: var(--transition);
}
.sidebar-worker-link:hover {
  background: #f0f9ff;
  border-color: #bae6fd;
  color: var(--primary);
  text-decoration: none;
}
.worker-link-icon {
  color: var(--primary);
  display: flex;
  align-items: center;
}
.worker-link-text {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
}
.worker-link-title {
  font-size: 0.8rem;
  font-weight: 600;
}
.worker-link-badge {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  background: #e0f2fe;
  color: #0369a1;
}

/* Sidebar Collapsed State */
.desktop-sidebar.collapsed {
  width: 68px;
}
.desktop-sidebar.collapsed .nav-section-title,
.desktop-sidebar.collapsed .nav-label,
.desktop-sidebar.collapsed .nav-badge-pill,
.desktop-sidebar.collapsed .status-card-details,
.desktop-sidebar.collapsed .worker-link-text {
  display: none !important;
}
.desktop-sidebar.collapsed .sidebar-header {
  padding: 0;
  justify-content: center;
  height: 58px;
}
.desktop-sidebar.collapsed .sidebar-brand-wrapper {
  justify-content: center;
  width: 100%;
}
.desktop-sidebar.collapsed .sidebar-logo-crop {
  width: 32px;
  height: 32px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  border-radius: 6px;
}
.desktop-sidebar.collapsed .sidebar-brand-logo {
  height: 30px;
  width: auto;
  max-width: none;
  flex-shrink: 0;
  margin-left: 7px;
  display: block !important;
}
.desktop-sidebar.collapsed .sidebar-tenant-switcher {
  padding: 0.5rem 0.35rem;
  align-items: center;
  justify-content: center;
}
.desktop-sidebar.collapsed .sidebar-tenant-trigger {
  width: 38px;
  height: 32px;
  min-width: 38px;
  min-height: 32px;
  padding: 0;
  justify-content: center;
}
.desktop-sidebar.collapsed .sidebar-tenant-name,
.desktop-sidebar.collapsed .sidebar-tenant-chevron {
  display: none !important;
}
.desktop-sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 0.65rem 0;
}
.desktop-sidebar.collapsed .nav-section {
  gap: 0.35rem;
}
.desktop-sidebar.collapsed .sidebar-status-card {
  margin: 0.4rem auto;
  padding: 0.6rem;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
}
.desktop-sidebar.collapsed .sidebar-worker-link {
  justify-content: center;
  padding: 0.5rem 0;
}

/* Backdrop for Mobile Sidebar */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(1px);
  z-index: 38;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.sidebar-backdrop.open {
  opacity: 1;
  visibility: visible;
}

/* Main Area */
.desktop-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-main);
  min-width: 0;
}

/* Topbar Header Toolbar */
.desktop-topbar {
  height: 58px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  gap: 1rem;
  position: relative;
  z-index: 30;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-shrink: 0;
}
.topbar-toggle-btn {
  width: 34px;
  height: 34px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #475569;
  transition: var(--transition);
}
.topbar-toggle-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
}

/* Topbar Page Title */
.topbar-page-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Global Search Field in Topbar */
.topbar-center {
  flex: 1;
  max-width: 420px;
  display: flex;
  justify-content: center;
}
.global-search-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}
.search-bar-icon {
  position: absolute;
  left: 0.75rem;
  font-size: 18px;
  color: #94a3b8;
  pointer-events: none;
}
.global-search-field {
  width: 100%;
  height: 34px;
  padding-left: 2.25rem;
  padding-right: 2.25rem;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: #0f172a;
  transition: var(--transition);
}
.global-search-field:focus {
  background: #ffffff;
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.global-search-clear-btn {
  position: absolute;
  right: 0.65rem;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: #e2e8f0;
  color: #64748b;
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: var(--transition);
}
.global-search-clear-btn:hover {
  background: #cbd5e1;
  color: #0f172a;
}
.shortcut-badge {
  position: absolute;
  right: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  background: #e2e8f0;
  color: #475569;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  pointer-events: none;
}

/* Global Search Live Results Dropdown */
.global-search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 440px;
  max-width: calc(100vw - 2rem);
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.15), 0 8px 10px -6px rgba(15, 23, 42, 0.1);
  max-height: 440px;
  overflow-y: auto;
  z-index: 1000;
  padding: 0.35rem 0;
}
.search-section-header {
  padding: 0.45rem 0.85rem 0.25rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.search-section-header svg {
  color: #94a3b8;
}
.search-item {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.85rem;
  gap: 0.75rem;
  cursor: pointer;
  transition: background 0.15s ease;
  border-left: 3px solid transparent;
  color: inherit;
  text-decoration: none;
}
.search-item:hover,
.search-item.selected {
  background: #f1f5f9;
  border-left-color: var(--primary);
}
.search-item-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}
.search-item-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.search-item-top {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  justify-content: space-between;
}
.search-item-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: #0f172a;
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-item-badge {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: #0284c7;
  background: #e0f2fe;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}
.search-item-anomaly-badge {
  font-size: 0.68rem;
  font-weight: 700;
  color: #b45309;
  background: #fef3c7;
  border: 1px solid #fde68a;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}
.search-item-subtitle {
  font-size: 0.75rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-item-arrow {
  color: #94a3b8;
  font-size: 0.85rem;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
}
.search-item:hover .search-item-arrow,
.search-item.selected .search-item-arrow {
  opacity: 1;
  color: var(--primary);
}
.search-divider {
  height: 1px;
  background: #f1f5f9;
  margin: 0.35rem 0;
}
.search-footer-actions {
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  padding: 0.4rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.search-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.5rem;
  border-radius: 5px;
  font-size: 0.78rem;
  color: #475569;
  cursor: pointer;
  transition: background 0.15s;
  border-left: 3px solid transparent;
}
.search-action-row:hover,
.search-action-row.selected {
  background: #e2e8f0;
  color: #0f172a;
  border-left-color: var(--primary);
}
.action-key-pill {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  padding: 0.05rem 0.35rem;
  color: #334155;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.search-loading-indicator,
.search-empty-notice {
  padding: 1.25rem 1rem;
  text-align: center;
  font-size: 0.82rem;
  color: #64748b;
}
.search-empty-hint {
  font-size: 0.74rem;
  color: #94a3b8;
  margin-top: 0.35rem;
}

@keyframes searchPulse {
  0% { background-color: rgba(2, 132, 199, 0.28); }
  100% { background-color: transparent; }
}
.table-row-highlight {
  animation: searchPulse 2.5s ease-out;
}

/* Topbar Right Tools */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}
.topbar-clock-time {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #1e293b;
}
.topbar-tz-sep {
  color: #cbd5e1;
  margin: 0 0.15rem;
}
.topbar-action-btn {
  position: relative;
  width: 34px;
  height: 34px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #475569;
  transition: var(--transition);
}
.topbar-action-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
}
.topbar-badge-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 0.1rem 0.35rem;
  border-radius: 10px;
  border: 2px solid #ffffff;
  line-height: 1;
}
.topbar-worker-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 0.75rem;
  height: 34px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #334155;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
}
.topbar-worker-btn:hover {
  background: #f0f9ff;
  color: var(--primary);
  border-color: #bae6fd;
  text-decoration: none;
}
.topbar-install-btn {
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* User Profile Badge & Dropdown */
.user-profile-wrapper {
  position: relative;
}
.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.65rem 0.25rem 0.35rem;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  cursor: pointer;
  transition: var(--transition);
}
.user-profile-badge:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}
.user-avatar {
  width: 26px;
  height: 26px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.72rem;
  color: white;
}
.user-name-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #1e293b;
  max-width: 100px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-chevron {
  font-size: 16px;
  color: #64748b;
  transition: transform 0.2s ease;
}
.user-profile-wrapper.open .user-chevron {
  transform: rotate(180deg);
}

.user-dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 240px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  padding: 0.75rem;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: all 0.15s ease;
}
.user-profile-wrapper.open .user-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.dropdown-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding-bottom: 0.65rem;
}
.dropdown-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dropdown-user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.dropdown-user-info strong {
  font-size: 0.85rem;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dropdown-user-info span {
  font-size: 0.74rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dropdown-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 0.4rem 0;
}
.dropdown-item-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.25rem 0.35rem;
}
.dropdown-info-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  font-weight: 700;
  color: #94a3b8;
}
.dropdown-info-val {
  font-size: 0.8rem;
  font-weight: 600;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dropdown-lang-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0.35rem;
}
.dropdown-lang-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
}
.dropdown-lang-label svg {
  color: #64748b;
}
.dropdown-lang-select {
  background: #f8fafc;
  color: var(--text-main);
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.5rem;
  font-weight: 600;
  font-size: 0.78rem;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}
.dropdown-lang-select:hover,
.dropdown-lang-select:focus {
  border-color: var(--primary);
  background: #ffffff;
}
.dropdown-menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  color: #334155;
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: var(--transition);
}
.dropdown-menu-item:hover {
  background: #f1f5f9;
  color: #0f172a;
  text-decoration: none;
}
.dropdown-logout-btn {
  color: #ef4444;
}
.dropdown-logout-btn:hover {
  color: #b91c1c;
  background: #fee2e2;
}

/* Responsive Media Queries */
@media (max-width: 1100px) {
  .topbar-center {
    display: none;
  }
}
@media (max-width: 860px) {
  .desktop-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .desktop-sidebar.mobile-open {
    transform: translateX(0);
  }
  .topbar-page-title {
    max-width: 220px;
    overflow: hidden;
  }
}

/* Page Content */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

/* Dashboard Metric Cards - High-Contrast Light Control Room */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
.metric-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--border-subtle);
}
.metric-card.accent-primary::before { background: var(--primary); }
.metric-card.accent-green::before { background: var(--accent-green); }
.metric-card.accent-rose::before { background: var(--accent-rose); }
.metric-card.accent-amber::before { background: var(--accent-amber); }

.metric-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.metric-value {
  font-size: 1.85rem;
  font-weight: 800;
  margin: 0.35rem 0 0.15rem;
  letter-spacing: -0.02em;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.metric-sub {
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* Tables - Precision Tabular Layout with Sticky Headers */
.table-container {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.table-toolbar {
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  background: #ffffff;
}
.table-search {
  max-width: 320px;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.data-table thead th {
  background: #f8fafc;
  color: #334155;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.75rem 1rem;
  font-weight: 700;
  border-bottom: 2px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 5;
  white-space: nowrap;
}
.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 0.88rem;
  vertical-align: middle;
}
.data-table tr:hover td {
  background: #f8fafc;
}

/* Lightbox & QR preview */
.qr-preview-box {
  background: #ffffff;
  padding: 1.5rem;
  border-radius: var(--radius-md);
  text-align: center;
  color: #000000;
  margin: 1rem auto;
  max-width: 280px;
  box-shadow: var(--shadow-md);
}
.qr-preview-box canvas {
  margin: 0.5rem auto;
  display: block;
}
.qr-meter-info {
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 0.5rem;
}

/* Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.75rem;
}
@media (max-width: 1100px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}
.chart-box {
  position: relative;
  width: 100%;
  min-height: 280px;
}
canvas.chart-canvas {
  width: 100% !important;
  height: 280px !important;
}

/* Anomaly Notifications Dropdown Popover */
.topbar-anomaly-wrapper {
  position: relative;
}
.anomaly-dropdown-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 380px;
  max-width: 92vw;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
  z-index: 1000;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: popoverSlideIn 0.16s ease-out;
}
.topbar-anomaly-wrapper.open .anomaly-dropdown-popover {
  display: flex;
}
@keyframes popoverSlideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.anomaly-popover-header {
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.anomaly-popover-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.anomaly-popover-list {
  max-height: 380px;
  overflow-y: auto;
  padding: 0.25rem 0;
}
.anomaly-popover-item {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: background 0.15s ease;
}
.anomaly-popover-item:last-child {
  border-bottom: none;
}
.anomaly-popover-item:hover {
  background: #fff1f2;
}
.anomaly-popover-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.anomaly-popover-meter {
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: #0f172a;
}
.anomaly-popover-reason {
  font-size: 0.78rem;
  color: #be123c;
  font-weight: 600;
  line-height: 1.25;
}
.anomaly-popover-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: var(--text-dim);
}
.anomaly-popover-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.2rem;
}
.anomaly-popover-empty {
  padding: 2.2rem 1rem;
  text-align: center;
  color: var(--accent-green);
  font-size: 0.88rem;
  font-weight: 600;
}
.anomaly-popover-footer {
  padding: 0.6rem 1rem;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
}

/* ==========================================================================
   Data Exporter & Export Template Hub Professional Layout
   ========================================================================== */
.export-hub-header {
  padding: 0.95rem 1.25rem;
  background: #ffffff;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.export-hub-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.export-hub-icon-box {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #16a34a;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.export-hub-heading-wrapper {
  display: flex;
  flex-direction: column;
}
.export-hub-main-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}
.export-hub-subtext {
  font-size: 0.76rem;
  color: var(--text-dim);
  margin: 0;
}
.export-actions-cluster {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Secondary Filter Toolbar */
.export-filter-bar {
  padding: 0.65rem 1.25rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.export-filter-controls {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1;
  flex-wrap: wrap;
  min-width: 300px;
}

/* Format Pill Selector */
.export-format-pills {
  display: inline-flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
  height: 34px;
}
.export-format-pill {
  height: 28px;
  padding: 0 0.65rem;
  font-size: 0.76rem;
  font-weight: 700;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.15s ease;
  user-select: none;
}
.export-format-pill:hover {
  background: #f1f5f9;
  color: #0f172a;
}
.export-format-pill.active {
  background: #0f172a;
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.15);
}
.export-format-pill.active[data-format="xlsx"] {
  background: #107c41;
  color: #ffffff;
}
.export-format-pill.active[data-format="ods"] {
  background: #ea580c;
  color: #ffffff;
}
.export-format-pill.active[data-format="csv"] {
  background: #0284c7;
  color: #ffffff;
}
.export-format-pill.active[data-format="pdf"] {
  background: #dc2626;
  color: #ffffff;
}

/* Anomalies Status Filter Tabs */
#anomalies-status-filter .tab-btn.active[data-status="active"] {
  background: #be123c;
  color: #ffffff;
}
#anomalies-status-filter .tab-btn.active[data-status="resolved"] {
  background: #059669;
  color: #ffffff;
}
#anomalies-status-filter .tab-btn.active[data-status="all"] {
  background: #0f172a;
  color: #ffffff;
}

/* Tenant Requests Status Filter Tabs */
#tenant-requests-filter-pills .filter-pill-btn.active[data-filter="pending"],
#tenant-requests-filter-pills .tab-btn.active[data-filter="pending"] {
  background: #d97706;
  color: #ffffff;
}
#tenant-requests-filter-pills .filter-pill-btn.active[data-filter="approved"],
#tenant-requests-filter-pills .tab-btn.active[data-filter="approved"] {
  background: #059669;
  color: #ffffff;
}
#tenant-requests-filter-pills .filter-pill-btn.active[data-filter="rejected"],
#tenant-requests-filter-pills .tab-btn.active[data-filter="rejected"] {
  background: #dc2626;
  color: #ffffff;
}
#tenant-requests-filter-pills .filter-pill-btn.active[data-filter="all"],
#tenant-requests-filter-pills .tab-btn.active[data-filter="all"] {
  background: #0f172a;
  color: #ffffff;
}

/* Search input with inner icon and clear button */
.export-search-wrapper,
.import-search-wrapper {
  position: relative;
  max-width: 250px;
  width: 100%;
}
.export-search-wrapper .search-icon,
.import-search-wrapper .search-icon {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 16px;
  pointer-events: none;
}
.export-search-input,
.import-search-input {
  padding-left: 2rem !important;
  padding-right: 1.85rem !important;
  height: 34px;
  font-size: 0.82rem !important;
}
.export-search-clear,
.import-search-clear {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: #e2e8f0;
  color: #64748b;
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.export-search-clear:hover,
.import-search-clear:hover {
  background: #cbd5e1;
  color: #0f172a;
}

/* Reset filters button */
.export-reset-btn {
  height: 34px;
  font-size: 0.78rem;
  gap: 0.3rem;
  padding: 0 0.65rem;
  color: #64748b;
  border-color: #cbd5e1;
  display: inline-flex;
  align-items: center;
}
.export-reset-btn.is-active {
  color: #0284c7;
  border-color: #7dd3fc;
  background: #f0f9ff;
  font-weight: 600;
}

/* Template Card Enhancement */
.template-card {
  position: relative;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.template-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04) !important;
}
.template-card.is-default-card {
  border-color: #3b82f6 !important;
}
.template-card.is-default-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: #3b82f6;
}

/* ==========================================================================
   Data Importer & Template Builder Professional Layout
   ========================================================================== */
.import-hub-header {
  padding: 0.95rem 1.25rem;
  background: #ffffff;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.import-hub-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.import-hub-icon-box {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.import-hub-heading-wrapper {
  display: flex;
  flex-direction: column;
}
.import-hub-main-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}
.import-hub-subtext {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin: 2px 0 0 0;
}
.import-actions-cluster {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.import-filter-bar {
  padding: 0.65rem 1.25rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.import-filter-controls {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1;
  flex-wrap: wrap;
  min-width: 300px;
}
.import-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.15rem;
  padding: 1.25rem;
}
.import-tpl-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.9rem;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  position: relative;
  overflow: hidden;
}
.import-tpl-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
}
.import-tpl-card.default-card {
  border-color: #0284c7;
}
.import-tpl-card.default-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: #0284c7;
}
.import-card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.import-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}
.import-card-desc {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin: 0.35rem 0 0 0;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.import-card-details {
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: 6px;
  padding: 0.65rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.import-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.76rem;
}
.import-detail-row .detail-label {
  color: var(--text-dim);
}
.import-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid #f1f5f9;
}

/* File Dropzone */
.import-dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.import-dropzone:hover, .import-dropzone.dragover {
  background: #eff6ff;
  border-color: var(--primary);
}
.import-dropzone .dropzone-text strong {
  display: block;
  font-size: 0.88rem;
  color: #0f172a;
}
.import-dropzone .dropzone-text p {
  margin: 2px 0 0;
  font-size: 0.76rem;
  color: var(--text-dim);
}

/* Chips container for detected headers */
.import-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.import-header-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 4px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: #334155;
}

/* Metric Cards for Dry-Run Preview */
.import-metric-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
}
.import-metric-card {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.import-metric-card .metric-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.import-metric-card .metric-val {
  font-size: 1.3rem;
  font-weight: 700;
  font-family: var(--font-mono);
}
.import-metric-card.metric-total {
  border-left: 3px solid #64748b;
}
.import-metric-card.metric-valid {
  border-left: 3px solid #059669;
}
.import-metric-card.metric-unregistered {
  border-left: 3px solid #dc2626;
}
.import-metric-card.metric-anomalies {
  border-left: 3px solid #ea580c;
}

/* Empty State */
.import-empty-state {
  padding: 3.5rem 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}
.import-empty-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  margin-bottom: 0.5rem;
}
.import-empty-state h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
}
.import-empty-state p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-dim);
  max-width: 380px;
}


