/* === Reset & Base === */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #0a1628;
  color: #e0e6ed;
  display: flex;
}

/* === Sidebar === */
.sidebar {
  position: fixed;
  left: 0; top: 0;
  width: 240px; height: 100vh;
  background: #001040;
  border-right: 1px solid #1a2d5a;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
}
.sidebar.collapsed { transform: translateX(-240px); }

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid #1a2d5a;
}
.logo {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 1px;
}
.logo-core { color: #ffffff; }
.logo-360 { color: #FF9900; }
.logo-plus { color: #F5B041; font-size: 2rem; }
.logo-subtitle {
  color: #5a6a8a;
  font-size: 0.75rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-top: 4px;
}

/* === Navigation === */
.nav-menu {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
}
.nav-menu::-webkit-scrollbar { width: 4px; }
.nav-menu::-webkit-scrollbar-thumb { background: #1a2d5a; border-radius: 4px; }

.nav-section { margin-bottom: 16px; }
.nav-section-title {
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #4a5a7a;
  padding: 8px 12px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin: 2px 0;
  color: #7a8aa6;
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}
.nav-item:hover {
  background: #0a2050;
  color: #c0cce0;
}
.nav-item.active {
  background: #0d2a6b;
  color: #ffffff;
  border-left: 3px solid #FF9900;
}
.nav-icon { font-size: 1rem; width: 20px; text-align: center; }

/* === Sidebar Footer === */
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid #1a2d5a;
}
.env-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: #5a6a8a;
}
.env-dot {
  width: 8px; height: 8px;
  background: #27ae60;
  border-radius: 50%;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* === Main Content === */
.main-content {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  transition: margin-left 0.3s ease;
}
.main-content.expanded { margin-left: 0; }

/* === Top Header === */
.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: #0d1a30;
  border-bottom: 1px solid #1a2d5a;
  min-height: 60px;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.header-left h1 {
  font-size: 1.2rem;
  font-weight: 500;
  color: #e0e6ed;
}
.menu-toggle {
  background: none;
  border: 1px solid #1a2d5a;
  color: #7a8aa6;
  font-size: 1.2rem;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.menu-toggle:hover { background: #1a2d5a; color: #fff; }

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.search-box {
  position: relative;
  width: 280px;
}
.search-box input {
  width: 100%;
  padding: 8px 36px 8px 14px;
  background: #0a1628;
  border: 1px solid #1a2d5a;
  border-radius: 8px;
  color: #e0e6ed;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}
.search-box input:focus { border-color: #FF9900; }
.search-box input::placeholder { color: #4a5a7a; }
.search-icon {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-icon {
  background: none;
  border: 1px solid #1a2d5a;
  color: #7a8aa6;
  font-size: 1rem;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-icon:hover { background: #1a2d5a; color: #fff; }
.user-avatar {
  width: 32px; height: 32px;
  background: #0d2a6b;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  cursor: pointer;
}

/* === Dashboard Container === */
.dashboard-wrapper {
  flex: 1;
  padding: 16px;
  overflow: hidden;
}
#dashboard-container {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #1a2d5a;
  background: #0d1a30;
  position: relative;
}

/* === Loading State === */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 16px;
}
.loading-state p { color: #5a6a8a; font-size: 0.9rem; }
.spinner {
  width: 40px; height: 40px;
  border: 3px solid #1a2d5a;
  border-top-color: #FF9900;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === Empty State === */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  text-align: center;
}
.empty-icon { font-size: 3rem; }
.empty-state h3 { color: #e0e6ed; font-size: 1.3rem; }
.empty-state p { color: #5a6a8a; font-size: 0.9rem; }
.empty-hint code {
  background: #1a2d5a;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  color: #FF9900;
}

/* === Fullscreen Mode === */
body.fullscreen .sidebar { transform: translateX(-240px); }
body.fullscreen .main-content { margin-left: 0; }
body.fullscreen .top-header { display: none; }
body.fullscreen .dashboard-wrapper { padding: 0; }
body.fullscreen #dashboard-container { border-radius: 0; border: none; }

/* === Responsive === */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-240px); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .search-box { width: 200px; }
}
@media (max-width: 768px) {
  .search-box { display: none; }
  .header-right { gap: 8px; }
}

/* === User Selection Panel === */
.user-selection-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 24px;
}
.user-selection-card {
  background: #0a1628;
  border: 1px solid #1a2d5a;
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 440px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.user-selection-header {
  text-align: center;
  margin-bottom: 24px;
}
.user-selection-icon { font-size: 2.5rem; }
.user-selection-header h2 {
  color: #e0e6ed;
  font-size: 1.3rem;
  margin-top: 12px;
}
.user-selection-header p {
  color: #5a6a8a;
  font-size: 0.85rem;
  margin-top: 6px;
}
.user-selection-search {
  margin-bottom: 16px;
}
.user-selection-search input {
  width: 100%;
  padding: 10px 14px;
  background: #0d1a30;
  border: 1px solid #1a2d5a;
  border-radius: 8px;
  color: #e0e6ed;
  font-size: 0.85rem;
  outline: none;
}
.user-selection-search input:focus { border-color: #FF9900; }
.user-selection-search input::placeholder { color: #4a5a7a; }
.user-selection-list {
  overflow-y: auto;
  max-height: 400px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.user-selection-list::-webkit-scrollbar { width: 4px; }
.user-selection-list::-webkit-scrollbar-thumb { background: #1a2d5a; border-radius: 4px; }
.user-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #0d1a30;
  border: 1px solid #1a2d5a;
  border-radius: 8px;
  color: #e0e6ed;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}
.user-option:hover {
  background: #0d2a6b;
  border-color: #FF9900;
}
.user-option-email { font-weight: 500; }
.user-option-role {
  font-size: 0.7rem;
  color: #5a6a8a;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Login Form */
.user-login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 20px 20px;
}
.user-login-form input[type="email"] {
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.user-login-form input[type="email"]:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
.btn-login {
  padding: 12px;
  background: #6366f1;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-login:hover { background: #4f46e5; }
.btn-login:disabled { background: #a5b4fc; cursor: not-allowed; }
.login-error {
  color: #dc2626;
  font-size: 13px;
  margin: 0;
}

/* === Error / Access Denied Panel === */
.error-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 24px;
}
.error-card {
  background: #0a1628;
  border: 1px solid #1a2d5a;
  border-radius: 16px;
  padding: 48px 40px;
  text-align: center;
  max-width: 480px;
  width: 100%;
}
.error-card.access-denied {
  border-color: #dc2626;
  border-width: 1px;
  box-shadow: 0 0 30px rgba(220, 38, 38, 0.08);
}
.error-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
}
.error-card h3 {
  color: #e0e6ed;
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 16px;
}
.error-card.access-denied h3 {
  color: #f87171;
}
.error-dashboard {
  color: #7a8aa6;
  font-size: 0.9rem;
  margin-bottom: 12px;
}
.error-dashboard strong {
  color: #e0e6ed;
}
.error-message {
  color: #5a6a8a;
  font-size: 0.85rem;
  line-height: 1.6;
  margin-bottom: 16px;
}
.error-user {
  color: #4a5a7a;
  font-size: 0.8rem;
  padding-top: 12px;
  border-top: 1px solid #1a2d5a;
}
.btn-retry {
  padding: 10px 24px;
  background: #FF9900;
  color: #000;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-retry:hover {
  background: #e68a00;
}
