:root {
  /* Design Tokens - Light Theme */
  --bg-primary: #f2f4f7;
  --bg-secondary: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.9);
  
  --accent-primary: #2563eb;
  --accent-hover: #1d4ed8;
  
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  
  --border-color: #e5e7eb;
  
  --danger: #ef4444;
  --success: #10b981;

  --font-main: 'Inter', sans-serif;
}

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

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

/* Utilities */
.hidden { display: none !important; }
.view {
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
}
.view.active {
  opacity: 1;
  pointer-events: auto;
  position: relative;
}
.w-full { width: 100%; }

/* Buttons */
.btn {
  padding: 0.625rem 1.25rem;
  border-radius: 0.5rem;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.btn-primary {
  background-color: var(--accent-primary);
  color: white;
  box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.39);
}
.btn-primary:hover {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
}
.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.375rem;
  transition: all 0.2s;
}
.icon-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* Forms */
.input-group {
  margin-bottom: 1.25rem;
}
.input-group label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}
.input-group input, .select-input {
  width: 100%;
  padding: 0.625rem 0.75rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.25rem;
  color: var(--text-primary);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s;
}
.input-group input:focus, .select-input:focus {
  border-color: var(--accent-primary);
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Login View */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 40px);
  background-color: var(--bg-primary);
}

.login-box {
  background-color: var(--bg-secondary);
  padding: 2.5rem 3rem;
  border-radius: 0;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 420px;
}

.login-footer {
  height: 40px;
  background-color: #212529; /* Dark footer as in screenshot */
  color: #a0aebc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 3rem;
}
.brand-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
  text-align: center;
}
.main-logo {
  max-width: 250px;
  width: 100%;
  height: auto;
  margin-bottom: 1rem;
}
.app-subtitle {
  font-size: 1.2rem;
  color: #2563eb;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.logo-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), #60a5fa);
}
.logo-circle.small { width: 32px; height: 32px; }

/* App Layout */
#app-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 0;
}
.sidebar-brand {
  padding: 0 1.5rem;
  margin-bottom: 2rem;
}
.nav-menu {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0 1rem;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  border-radius: 0.5rem;
  transition: all 0.2s;
}
.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
}
.nav-item.active {
  background-color: rgba(59, 130, 246, 0.1);
  color: var(--accent-primary);
}
.user-profile {
  padding: 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}
.user-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  font-size: 0.875rem;
}
.badge {
  font-size: 0.7rem;
  background: rgba(255,255,255,0.1);
  padding: 0.125rem 0.375rem;
  border-radius: 1rem;
  display: inline-block;
  width: max-content;
  margin-top: 0.25rem;
}

/* Main Content */
.main-content {
  padding: 2.5rem;
  overflow-y: auto;
  position: relative;
}
.content-section {
  display: none;
  animation: fadeIn 0.4s ease;
}
.content-section.active {
  display: block;
}

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

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
}
.section-title { font-size: 1.5rem; margin-bottom: 0.25rem; }
.section-subtitle { color: var(--text-secondary); font-size: 0.875rem; }

/* Metrics */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}
.metric-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  border-radius: 1rem;
}
.metric-title { letter-spacing: 0.05em; font-size: 0.75rem; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 0.5rem; }
.metric-value { font-size: 2rem; font-weight: 700; }

/* Charts & Tables */
.chart-container, .table-container {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 1.5rem;
  margin-bottom: 2rem;
}
.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.card-title { font-size: 1.125rem; }

.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th, .data-table td {
  text-align: left;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.875rem;
}
.data-table th {
  color: var(--text-secondary);
  font-weight: 500;
}
.data-table tbody tr { transition: background 0.2s; }
.data-table tbody tr:hover { background: rgba(255,255,255,0.02); }

/* Simple Bar Chart implementation entirely in CSS/HTML for lightness */
.simple-bar-chart {
  display: flex;
  align-items: flex-end;
  height: 200px;
  gap: 2%;
  padding-top: 1rem;
}
.bar-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  height: 100%;
}
.bar {
  width: 100%;
  background: var(--accent-primary);
  border-radius: 4px 4px 0 0;
  transition: height 0.5s ease;
  min-height: 5px;
}
.bar-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal.active { display: flex; }
.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 2rem;
  width: 100%;
  max-width: 500px;
  animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.close-btn {
  background: none; border: none;
  color: var(--text-secondary);
  font-size: 1.5rem; cursor: pointer;
}

/* Toasts */
#toast-container {
  position: fixed;
  top: 1rem; right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  background: var(--bg-secondary);
  border-left: 4px solid var(--accent-primary);
  color: white;
  padding: 1rem;
  border-radius: 0.25rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  animation: slideInRight 0.3s ease-out;
}
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
