:root {
  /* Colors */
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-tertiary: #1e293b;
  --bg-glass: rgba(255, 255, 255, 0.05);
  
  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --status-green: #22c55e;
  --status-yellow: #eab308;
  --status-orange: #f97316;
  --status-red: #ef4444;
  
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;

  --border-color: rgba(255, 255, 255, 0.1);
  --border-focus: rgba(99, 102, 241, 0.5);
  
  /* Fonts */
  --font-family: 'Inter', sans-serif;
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary); 
}
::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary); 
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted); 
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 600;
}
a {
  color: var(--accent-primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

/* Layout */
#app-shell {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Sidebar */
#sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 10;
}
.sidebar-header {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
}
.sidebar-header .logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}
.sidebar-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.nav-links {
  padding: 16px 12px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--text-secondary);
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.9rem;
  transition: var(--transition-fast);
}
.nav-link:hover {
  background: var(--bg-glass);
  color: var(--text-primary);
  text-decoration: none;
}
.nav-link.active {
  background: var(--accent-primary);
  color: white;
}
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.user-info {
  display: flex;
  flex-direction: column;
}
.user-name {
  font-size: 0.9rem;
  font-weight: 600;
}
.user-role {
  font-size: 0.75rem;
  text-transform: capitalize;
  margin-top: 2px;
}
.logout-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.logout-btn:hover {
  color: var(--status-red);
  background: var(--bg-glass);
}

/* Main Content */
#main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-primary);
}

#top-bar {
  padding: 20px 28px 0 28px;
  flex-shrink: 0;
}

#page-content {
  flex: 1;
  min-width: 0;
  padding: 28px;
  overflow-y: auto;
}

/* Right Sidebar (Critical Exceptions) */
#exceptions-panel {
  width: 310px;
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  z-index: 9;
}
.exceptions-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Metrics Row */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
  min-width: 0;
}
.metric-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
}
.metric-card .title {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.metric-card .value {
  font-size: 1.5rem;
  font-weight: 700;
}

/* Glass Card */
.glass-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition-fast);
}
.btn-primary {
  background: var(--accent-primary);
  color: white;
}
.btn-primary:hover {
  background: #4f46e5;
}
.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background: var(--bg-glass);
  border-color: var(--text-muted);
}
.btn-danger {
  background: var(--status-red);
  color: white;
}
.btn-danger:hover {
  background: #dc2626;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.badge.green {
  background: rgba(34, 197, 94, 0.15);
  color: var(--status-green);
}
.badge.green .badge-dot {
  background: var(--status-green);
}
.badge.yellow {
  background: rgba(234, 179, 8, 0.15);
  color: var(--status-yellow);
}
.badge.yellow .badge-dot {
  background: var(--status-yellow);
}
.badge.orange {
  background: rgba(249, 115, 22, 0.15);
  color: var(--status-orange);
}
.badge.orange .badge-dot {
  background: var(--status-orange);
}
.badge.red {
  background: rgba(239, 68, 68, 0.15);
  color: var(--status-red);
}
.badge.red .badge-dot {
  background: var(--status-red);
}
.badge.blue {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary);
}
.badge.blue .badge-dot {
  background: var(--accent-primary);
}

/* Tables */
.table-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
th {
  background: var(--bg-tertiary);
  padding: 12px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-color);
}
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.875rem;
}
tr:last-child td {
  border-bottom: none;
}
tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Form inputs */
.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition-fast);
}
.form-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Modal */
#modal-container {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-content {
  width: 100%;
  max-width: 550px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
}
.modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-glass);
}

/* Toast */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
}
.toast {
  padding: 12px 18px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  transition: all 0.3s ease;
  font-size: 0.875rem;
}
.toast.success {
  border-left: 4px solid var(--success);
}
.toast.error {
  border-left: 4px solid var(--error);
}
.toast.warning {
  border-left: 4px solid var(--warning);
}

/* Shimmer loading */
.shimmer {
  background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-tertiary) 50%, var(--bg-secondary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Animations */
.animate-fade-in {
  animation: fadeIn 0.3s ease forwards;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Login Screen Styles */
#login-screen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.15), transparent 50%),
              radial-gradient(circle at bottom left, rgba(139, 92, 246, 0.1), transparent 50%),
              var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.login-wrapper {
  width: 100%;
  max-width: 440px;
  padding: 20px;
}
.login-card {
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 36px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}
.login-header {
  text-align: center;
  margin-bottom: 28px;
}
.login-header .logo-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px auto;
  color: white;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}
.login-header h2 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.login-header p {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Capacity Bars */
.capacity-track {
  height: 10px;
  background: var(--bg-tertiary);
  border-radius: 5px;
  overflow: hidden;
  margin-top: 6px;
}
.capacity-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.6s ease;
}

/* Teams Grid */
.teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}
.team-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.team-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-primary) !important;
  box-shadow: 0 12px 30px rgba(99, 102, 241, 0.15);
}

/* Task Kanban */
.task-kanban {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}
.task-column {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
}

/* Utilities */
.cursor-pointer {
  cursor: pointer;
}
