html.auth-checking body { visibility: hidden; }

.hidden {
  display: none !important;
}

.dashboard-page {
  margin: 0;
  min-height: 100vh;
  background: #f8fafc;
}

.top-nav {
  background: linear-gradient(90deg, #4f46e5 0%, #6d28d9 100%);
  color: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.15);
  position: sticky;
  top: 0;
  z-index: 50;
  overflow: visible;
}

.top-nav-inner {
  height: 70px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.brand-icon {
  font-size: 1.5rem;
}

.brand-text {
  font-size: 1.25rem;
  font-weight: 700;
}

.mobile-hamburger {
  display: none;
  color: #fff;
  background: transparent;
  border: 0;
  padding: 8px;
  font-size: 1.25rem;
  cursor: pointer;
}

.menu-items {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 16px;
  flex: 1;
  overflow: visible;
}

.nav-link-main {
  padding: 12px 16px;
  border-radius: 8px;
  transition: all 0.2s ease;
  white-space: nowrap;
  width: auto;
  text-align: center;
}

.nav-link-parent {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
}

.nav-chevron {
  font-size: 0.75rem;
  display: none;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  margin-left: auto;
  position: relative;
}

.nav-icon-btn {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  padding: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
  position: relative;
}

.nav-icon-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.nav-desktop-only {
  display: inline-flex;
}

.user-avatar-icon {
  font-size: 1.25rem;
}

.nav-notify-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #f87171;
}

.dashboard-user-menu {
  display: none;
  position: absolute;
  top: 70px;
  right: 16px;
  min-width: 200px;
  background: #fff;
  color: #1f2937;
  border-radius: 10px;
  box-shadow: 0 16px 28px rgba(15, 23, 42, 0.18);
  overflow: hidden;
  z-index: 50;
}

.dashboard-user-menu.is-open {
  display: block;
}

.user-menu-head {
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
}

.user-menu-name {
  font-weight: 600;
}

.user-menu-item {
  width: 100%;
  border: 0;
  background: #fff;
  color: #1f2937;
  text-align: left;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.user-menu-item:hover {
  background: #f3f4f6;
}

.user-menu-item-danger {
  color: #dc2626;
}

.user-menu-item-danger:hover {
  background: #fef2f2;
}

.dashboard-content {
  max-width: 100%;
  margin: 0 auto;
  padding: 24px;
}

.dash-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

.dash-stat-card {
  color: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
  padding: 24px;
}

.dash-stat-blue { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); }
.dash-stat-green { background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%); }
.dash-stat-purple { background: linear-gradient(135deg, #a855f7 0%, #9333ea 100%); }
.dash-stat-orange { background: linear-gradient(135deg, #f97316 0%, #ea580c 100%); }

.dash-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dash-stat-label {
  margin: 0;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.85);
}

.dash-stat-value {
  margin: 8px 0 0;
  font-size: 1.875rem;
  font-weight: 700;
}

.dash-stat-note {
  margin: 8px 0 0;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.85);
}

.dash-stat-icon {
  font-size: 3rem;
  opacity: 0.2;
}

.dash-panels-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.dash-panel {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
  padding: 24px;
}

.dash-panel-title {
  margin: 0 0 16px;
  font-size: 1.125rem;
  font-weight: 700;
  color: #1f2937;
}

.dash-recent-list,
.dash-status-list {
  display: grid;
  gap: 12px;
}

.dash-muted {
  margin: 0;
  color: #6b7280;
  font-size: 0.875rem;
}

.dash-status-row,
.dash-recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dash-status-label {
  color: #4b5563;
}

.dash-status-ok {
  color: #16a34a;
  font-weight: 600;
}

.dash-recent-item {
  padding: 12px;
  background: #f9fafb;
  border-radius: 8px;
}

.dash-recent-name {
  margin: 0;
  font-weight: 600;
  color: #1f2937;
}

.dash-recent-mail {
  margin: 0;
  font-size: 0.75rem;
  color: #6b7280;
}

.dash-company-badge {
  font-size: 0.75rem;
  border-radius: 999px;
  padding: 4px 12px;
}

.dash-company-badge-active {
  background: #dcfce7;
  color: #15803d;
}

.dash-company-badge-stopped {
  background: #fee2e2;
  color: #b91c1c;
}

.dash-error,
.dash-page-error {
  border-radius: 10px;
  padding: 24px;
  color: #dc2626;
}

.dash-error {
  background: #fef2f2;
}

.dash-page-error {
  background: #fff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

#menu-items {
  overflow: visible;
}

/* Navbar dropdown styles */
.nav-item {
  position: relative;
}

.nav-item::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 10px;
}

.nav-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: white;
  min-width: 220px;
  border-radius: 10px;
  border: 1px solid #e9edf5;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.16);
  z-index: 9999;
  overflow: visible;
}

.nav-item:hover > .nav-dropdown {
  display: block;
  animation: slideDown 0.2s ease-out;
}

.nav-item:hover > .nav-link {
  background: rgba(255, 255, 255, 0.15);
}

.nav-link {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.1px;
  line-height: 1.2;
}

.nav-link i,
.nav-dropdown-item i {
  width: 16px;
  text-align: center;
}

.nav-link.is-current,
.nav-item.is-current-parent > .nav-link {
  background: rgba(255, 255, 255, 0.22);
}

.nav-dropdown-item {
  position: relative;
  display: block;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  color: #333;
  white-space: nowrap;
  user-select: none;
  border-radius: 8px;
  box-shadow: inset 0 0 0 0 transparent;
  font-size: 13px;
  font-weight: 500;
}

.nav-dropdown-item:hover {
  background: #f5f7fa;
  box-shadow: inset 2px 0 0 0 #667eea;
}

.nav-dropdown-item.is-current {
  background: #eef2ff;
  box-shadow: inset 2px 0 0 0 #4f46e5;
  color: #3730a3;
}

.nav-dropdown-item.has-submenu::after {
  content: '›';
  position: absolute;
  right: 12px;
  font-size: 18px;
  color: #667eea;
}

.nav-dropdown-item.has-submenu::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  right: -8px;
  width: 8px;
}

.nav-submenu {
  display: none;
  position: absolute;
  left: 100%;
  top: -8px;
  background: white;
  min-width: 200px;
  border-radius: 10px;
  border: 1px solid #e9edf5;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.16);
  z-index: 9999;
  overflow: visible;
}

.nav-dropdown-item:hover > .nav-submenu {
  display: block;
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#contentArea {
  min-height: calc(100vh - 70px);
  background: #f5f5f5;
}

#menu-items {
  overflow: visible;
}

@media (min-width: 769px) {
  #menu-items {
    overflow: visible !important;
  }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.5s ease-out;
}

/* Mobile menu */
@media (max-width: 768px) {
  .mobile-hamburger {
    display: inline-flex;
  }

  .nav-chevron {
    display: inline-block;
  }

  .brand-text {
    display: none;
  }

  .nav-desktop-only {
    display: none;
  }

  #menu-items.menu-items {
    display: none;
    max-height: 0;
    overflow: hidden !important;
    padding: 0 !important;
    transition: max-height 0.3s ease-out;
  }

  #menu-items.menu-items.open {
    display: block;
    max-height: calc(100vh - 70px);
    overflow-y: auto !important;
    padding: 8px 8px 14px;
  }

  .nav-item {
    margin: 2px 0;
  }

  .nav-item::after {
    display: none;
  }

  .nav-link {
    border-radius: 10px;
  }

    .nav-link-main {
      width: 100%;
      text-align: left;
      justify-content: space-between;
    }

  .nav-dropdown {
    position: static;
    display: none !important;
    box-shadow: none;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    margin-top: 6px;
    border-radius: 10px;
  }

  .nav-item.active > .nav-dropdown {
    display: block !important;
  }

  .nav-dropdown-item {
    color: #eef2ff;
    border-radius: 8px;
  }

  .nav-link.is-current,
  .nav-item.is-current-parent > .nav-link {
    background: rgba(255, 255, 255, 0.24);
  }

  .nav-dropdown-item.is-current {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
    box-shadow: inset 2px 0 0 0 #c7d2fe;
  }

  .nav-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.14);
    box-shadow: inset 0 0 0 0 transparent;
  }

  .nav-dropdown-item.has-submenu::after {
    color: #c7d2fe;
  }

  .nav-submenu {
    position: static;
    margin-left: 10px;
    margin-top: 6px;
    box-shadow: none;
    background: transparent;
    border: none;
    border-left: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 0;
    padding-left: 8px;
    min-width: 0;
  }

  .nav-dropdown-item.active > .nav-submenu {
    display: block !important;
  }

  .nav-item:hover > .nav-dropdown {
    display: none;
  }

  .nav-dropdown-item:hover > .nav-submenu {
    display: none;
  }

  .dash-stats-grid {
    grid-template-columns: 1fr;
  }

  .dash-panels-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 769px) and (max-width: 1200px) {
  .dash-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
