:root {
  /* Primary Colors */
  --color-primary: #1e3a8a; /* Navy Blue */
  --color-primary-light: #2563eb;
  --color-bg: #f3f5f8; /* Light Gray / off-white background */
  --color-surface: #ffffff;
  --color-text-main: #111827;
  --color-text-muted: #6b7280;
  
  /* Accent Colors */
  --color-accent-green: #10b981; /* Soft Green */
  --color-accent-blue: #3b82f6; /* Light Blue */
  
  /* Status Colors */
  --status-red: #ef4444;    /* Delayed */
  --status-yellow: #f59e0b; /* Pending */
  --status-green: #10b981;  /* Completed */
  --status-blue: #3b82f6;   /* Active */

  --status-red-bg: #fee2e2;
  --status-yellow-bg: #fef3c7;
  --status-green-bg: #d1fae5;
  --status-blue-bg: #dbeafe;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
  
  /* Typography */
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
  
  /* Borders */
  --border-color: #e5e7eb;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-full: 9999px;

  /* Layout */
  --sidebar-width: 260px;
  --header-height: 70px;
}

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

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

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

/* Base UI Components */
.card {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  transition: box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.875rem;
  gap: 0.5rem;
}

.btn-primary {
  background-color: var(--color-primary);
  color: white;
}

.btn-primary:hover {
  background-color: var(--color-primary-light);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--color-text-main);
}

.btn-outline:hover {
  background-color: var(--color-bg);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.badge-delayed { background-color: var(--status-red-bg); color: var(--status-red); }
.badge-pending { background-color: var(--status-yellow-bg); color: var(--status-yellow); }
.badge-completed { background-color: var(--status-green-bg); color: var(--status-green); }
.badge-active { background-color: var(--status-blue-bg); color: var(--status-blue); }

/* Progress Bar */
.progress-container {
  width: 100%;
  background-color: #e5e7eb;
  border-radius: 999px;
  height: 0.5rem;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 999px;
  background-color: var(--color-accent-green);
  transition: width 0.3s ease;
}

/* Layout */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--color-primary);
  color: white;
  height: 100%;
  display: flex;
  flex-direction: column;
  z-index: 10;
  transition: transform 0.3s ease;
}

.sidebar-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-menu {
  flex: 1;
  padding: 1.5rem 1rem;
  overflow-y: auto;
}

.menu-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  color: rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-md);
  margin-bottom: 0.5rem;
  transition: all 0.2s;
  font-weight: 500;
  font-size: 0.9rem;
}

.menu-item i {
  width: 20px;
  margin-right: 0.75rem;
  font-size: 1.1rem;
}

.menu-item:hover, .menu-item.active {
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
}

.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.header {
  height: var(--header-height);
  background-color: var(--color-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  z-index: 5;
}

.header-search {
  position: relative;
  width: 300px;
}

.header-search i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
}

.header-search input {
  width: 100%;
  padding: 0.5rem 1rem 0.5rem 2.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background-color: var(--color-bg);
  outline: none;
  font-size: 0.875rem;
  transition: border-color 0.2s;
}

.header-search input:focus {
  border-color: var(--color-primary-light);
  background-color: white;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
}

.icon-btn:hover {
  color: var(--color-primary);
}

.notification-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background-color: var(--status-red);
  border-radius: 50%;
  border: 2px solid white;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--color-primary-light);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.875rem;
  font-weight: 600;
}

.user-role {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--color-text-main);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Dashboard Grid Layouts */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.5rem;
}

/* KPI Cards */
.kpi-cards {
  grid-column: span 12;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.kpi-info h3 {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.kpi-info .value {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--color-text-main);
}

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.kpi-icon.blue { background-color: var(--status-blue-bg); color: var(--status-blue); }
.kpi-icon.yellow { background-color: var(--status-yellow-bg); color: var(--status-yellow); }
.kpi-icon.red { background-color: var(--status-red-bg); color: var(--status-red); }
.kpi-icon.green { background-color: var(--status-green-bg); color: var(--status-green); }

/* Main Dashboard Sections */
.main-charts {
  grid-column: span 8;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.right-panel {
  grid-column: span 4;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.bottom-section {
  grid-column: span 12;
  margin-top: 1.5rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
}

.chart-container {
  position: relative;
  height: 300px;
  width: 100%;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--border-color);
  background-color: var(--color-bg);
}

td {
  padding: 1rem;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

tbody tr:hover {
  background-color: rgba(243, 245, 248, 0.5);
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-cell .avatar {
  width: 32px;
  height: 32px;
  font-size: 0.75rem;
}

/* Quick Actions List */
.action-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.action-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  transition: all 0.2s;
  cursor: pointer;
}

.action-item:hover {
  border-color: var(--color-primary-light);
  background-color: var(--status-blue-bg);
}

.action-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  font-size: 1.1rem;
}

.action-text {
  flex: 1;
}

.action-text h4 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.action-text p {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* Responsive */
@media (max-width: 1024px) {
  .main-charts { grid-column: span 12; }
  .right-panel { grid-column: span 12; }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .header-search { display: none; }
  .dashboard-grid { gap: 1rem; }
  .kpi-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .kpi-cards { grid-template-columns: 1fr; }
}

/* Utilities */
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }

/* Responsive Footer and Sidebar Toggle */
#sidebarToggle {
    display: none;
}

@media (max-width: 768px) {
    #sidebarToggle {
        display: block;
    }
    .header {
        padding: 0 1rem;
    }
    .content {
        padding: 1rem;
    }
    .header-actions {
        gap: 0.75rem;
    }
    .page-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .main-wrapper {
        width: 100%;
    }
}
