@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Montserrat:wght@700;800;900&display=swap');

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Montserrat', var(--font-sans);

  /* Colors */
  --bg-app: #f4f7fc;
  --bg-card: #ffffff;
  --bg-sidebar: #0b1120;
  --bg-sidebar-hover: #1e293b;
  --bg-sidebar-active: #2563eb;
  
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-dark: #1e40af;
  
  --secondary: #64748b;
  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --info: #0284c7;
  --info-light: #f0f9ff;
  --purple: #8b5cf6;
  --purple-light: #f5f3ff;
  --pink: #ec4899;
  --pink-light: #fdf2f8;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-white: #ffffff;

  --border-color: #e2e8f0;
  --border-light: #f1f5f9;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 2px 10px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.02);

  --sidebar-width: 260px;
  --topbar-height: 70px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark mode overrides (optional class) */
body.dark-mode {
  --bg-app: #090d16;
  --bg-card: #111827;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #1e293b;
  --border-light: #1e293b;
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.4);
}

html {
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  position: relative;
}

img, video, canvas {
  max-width: 100%;
  height: auto;
}

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

/* APP LAYOUT */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  position: relative;
}


/* SIDEBAR */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  overflow-y: auto;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  transition: var(--transition);
}

.sidebar-header {
  padding: 24px 20px 18px 20px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-logo-img {
  height: 48px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  color: #94a3b8;
  transition: var(--transition);
  position: relative;
}

.nav-item:hover {
  background-color: var(--bg-sidebar-hover);
  color: #ffffff;
  transform: translateX(3px);
}

.nav-item.active {
  background-color: var(--bg-sidebar-active);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  color: #fff;
}

.sidebar-footer {
  padding: 20px;
  margin: 12px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.sidebar-footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 50% 0%, rgba(56, 189, 248, 0.15), transparent 70%);
  pointer-events: none;
}

.sidebar-footer-text {
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #ffffff;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.sidebar-footer-sub {
  font-size: 10px;
  color: #38bdf8;
  letter-spacing: 1px;
  font-weight: 600;
}

/* MAIN CONTENT WRAPPER */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: calc(100% - var(--sidebar-width));
  max-width: 100%;
  overflow-x: hidden;
}

/* TOPBAR */
.topbar {
  height: var(--topbar-height);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 90;
  width: 100%;
  max-width: 100%;
}


.topbar-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: #f1f5f9;
  border: 1px solid transparent;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  width: 380px;
  transition: var(--transition);
}

.topbar-search:focus-within {
  background-color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.topbar-search input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 13.5px;
  color: var(--text-main);
  width: 100%;
}

.topbar-search svg {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.date-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  padding: 7px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

.date-badge svg {
  width: 16px;
  height: 16px;
  color: var(--primary);
}

.action-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  position: relative;
  cursor: pointer;
  transition: var(--transition);
}

.action-icon-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.action-icon-btn svg {
  width: 18px;
  height: 18px;
}

.badge-dot {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 8px;
  height: 8px;
  background-color: var(--danger);
  border-radius: 50%;
  border: 2px solid #ffffff;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 6px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  cursor: pointer;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #1e40af);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

/* PAGE CONTENT CONTAINER */
.page-container {
  padding: 24px 28px 40px 28px;
  flex: 1;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}


/* WELCOME BANNER (Image 1) */
.welcome-banner {
  background: linear-gradient(135deg, #ffffff 0%, #f0f7ff 60%, #e0edfe 100%);
  border: 1px solid #dbeafe;
  border-radius: var(--radius-xl);
  padding: 26px 32px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.welcome-banner::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.banner-content {
  position: relative;
  z-index: 2;
  max-width: 650px;
}

.banner-eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2.5px;
  color: var(--primary);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.banner-title {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: #0f172a;
  margin-bottom: 6px;
}

.banner-title span {
  color: var(--primary);
}

.banner-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

.banner-action {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 12px;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  outline: none;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.btn-secondary {
  background-color: #ffffff;
  border-color: var(--border-color);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background-color: #f8fafc;
  border-color: #cbd5e1;
}

.btn-success {
  background-color: var(--success);
  color: #ffffff;
}

.btn-danger {
  background-color: var(--danger);
  color: #ffffff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

/* MODULE QUICK SHORTCUT PILLS (Image 1) */
.modules-carousel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.module-pill-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  transition: var(--transition);
  cursor: pointer;
  text-decoration: none;
}

.module-pill-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(37, 99, 235, 0.3);
}

.pill-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}

.module-pill-card:hover .pill-icon {
  transform: scale(1.08);
}

.pill-icon svg {
  width: 22px;
  height: 22px;
}

.pill-info {
  flex: 1;
  min-width: 0;
}

.pill-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
}

.pill-arrow {
  color: #cbd5e1;
  transition: var(--transition);
  display: flex;
  align-items: center;
}

.module-pill-card:hover .pill-arrow {
  color: var(--primary);
  transform: translateX(4px);
}

/* Pill Icon Colors */
.pill-production .pill-icon { background: #e0f2fe; color: #0284c7; }
.pill-expenses .pill-icon { background: #fce7f3; color: #db2777; }
.pill-purchase .pill-icon { background: #ede9fe; color: #7c3aed; }
.pill-inventory .pill-icon { background: #d1fae5; color: #059669; }
.pill-attendance .pill-icon { background: #fef3c7; color: #d97706; }
.pill-vehicle .pill-icon { background: #dcfce7; color: #16a34a; }
.pill-maintenance .pill-icon { background: #e0e7ff; color: #4f46e5; }
.pill-quality .pill-icon { background: #ffe4e6; color: #e11d48; }
.pill-accounts .pill-icon { background: #ede9fe; color: #6366f1; }

/* STAT CARDS ROW */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
  width: 100%;
  max-width: 100%;
}

.stats-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.stats-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}


.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.stat-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon-wrap svg {
  width: 20px;
  height: 20px;
}

.stat-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.stat-unit {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 4px;
}

.stat-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed #f1f5f9;
}

.stat-trend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
}

.stat-trend.up {
  color: #10b981;
}

.stat-trend.down {
  color: #ef4444;
}

.stat-comparison {
  font-size: 11.5px;
  color: var(--text-muted);
}

.stat-sparkline {
  width: 90px;
  height: 32px;
}

/* MAIN DASHBOARD 3-COLUMN & 2-ROW GRID (Image 1) */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin-bottom: 24px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: var(--transition);
}

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

.card-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  color: var(--text-main);
}

.card-icon svg {
  width: 17px;
  height: 17px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.card-action select,
.filter-select {
  border: 1px solid var(--border-color);
  background: #ffffff;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  outline: none;
  cursor: pointer;
}

.card-link {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-link:hover {
  text-decoration: underline;
}

.card-body {
  padding: 20px 22px;
  flex: 1;
}

/* CHART CONTAINERS */
.chart-container {
  position: relative;
  width: 100%;
}

.chart-center-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.chart-center-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
}

.chart-center-sub {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

/* LEGEND ITEMS */
.legend-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
}

.legend-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.legend-name {
  color: var(--text-muted);
  font-weight: 500;
}

.legend-val {
  font-weight: 700;
  color: var(--text-main);
}

/* RECENT ACTIVITIES LIST (Image 1) */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.activity-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed #f1f5f9;
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.activity-icon svg {
  width: 18px;
  height: 18px;
}

.activity-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.activity-time {
  font-size: 11.5px;
  color: var(--text-light);
  white-space: nowrap;
}

/* PENDING APPROVALS LIST (Image 1) */
.approvals-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.approval-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: var(--transition);
  cursor: pointer;
  text-decoration: none;
}

.approval-item:hover {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
  transform: translateX(3px);
}

.approval-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.approval-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.approval-icon svg {
  width: 18px;
  height: 18px;
}

.approval-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
}

.approval-badge-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.approval-badge {
  background: #fef3c7;
  color: #b45309;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.approval-chevron {
  color: #94a3b8;
}

/* QUALITY DONUT RING (Image 1) */
.qc-flex {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 20px;
}

.qc-ring-wrap {
  position: relative;
  width: 140px;
  height: 140px;
}

.qc-ring-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.qc-rate-val {
  font-size: 20px;
  font-weight: 900;
  color: var(--text-main);
}

.qc-rate-sub {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

/* DATA TABLES (Used in all modules) */
.data-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  display: block;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background: #ffffff;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.data-table-wrap .data-table,
.data-table-wrap table {
  max-width: none !important;
}


.data-table-wrap::-webkit-scrollbar {
  height: 6px;
}

.data-table-wrap::-webkit-scrollbar-track {
  background: #f8fafc;
}

.data-table-wrap::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}

.data-table-wrap::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.data-table th {
  background-color: #f8fafc;
  padding: 13px 16px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table td.nowrap,
.data-table th.nowrap {
  white-space: nowrap;
}

/* Material & Tag Chips inside tables */
.mat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.mat-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 11.5px;
  color: #475569;
  white-space: nowrap;
}

.mat-chip strong {
  color: #0f172a;
  margin-right: 3px;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background-color: #f8fafc;
}

/* STATUS BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-info { background: #e0f2fe; color: #0369a1; }
.badge-primary { background: #dbeafe; color: #1d4ed8; }
.badge-secondary { background: #f1f5f9; color: #475569; }

/* MODULE PAGE HEADERS */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.page-title-block h1 {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.page-title-block p {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* MODAL SYSTEM */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-content {
  background: #ffffff;
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  transform: translateY(20px);
  transition: transform 0.25s ease;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

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

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: #f8fafc;
}

/* FORM CONTROLS */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.col-span-2 {
  grid-column: span 2;
}

.form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
}

.form-control {
  padding: 9px 13px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-family: var(--font-sans);
  color: var(--text-main);
  background: #ffffff;
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* TOAST ALERTS */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #0f172a;
  color: #ffffff;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.toast-success { background: #065f46; }
.toast.toast-error { background: #991b1b; }

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* RESPONSIVE DESIGN & MOBILE NAVIGATION */
.mobile-toggle-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  cursor: pointer;
  margin-right: 10px;
  flex-shrink: 0;
  transition: var(--transition);
}

.mobile-toggle-btn:hover {
  background: #e2e8f0;
}

.sidebar-mobile-close {
  display: none;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.sidebar-mobile-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 95;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-backdrop.active {
  display: block;
  opacity: 1;
}

@media (max-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .stats-grid,
  .stats-grid-4,
  .stats-grid-3 {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 900px) {
  .mobile-toggle-btn {
    display: inline-flex;
  }
  .sidebar-mobile-close {
    display: block;
  }
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .main-wrapper {
    margin-left: 0;
    width: 100% !important;
    max-width: 100% !important;
  }
  .topbar {
    padding: 0 16px;
    width: 100% !important;
    max-width: 100% !important;
  }
  .page-container {
    padding: 18px 16px 36px 16px;
    width: 100% !important;
    max-width: 100% !important;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .modules-carousel {
    grid-template-columns: repeat(2, 1fr);
  }
  .stats-grid,
  .stats-grid-4,
  .stats-grid-3 {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .topbar-search {
    width: 200px;
  }
}

@media (max-width: 680px) {
  html, body, .app-container, .main-wrapper, .page-container {
    max-width: 100% !important;
    overflow-x: hidden !important;
    width: 100% !important;
  }

  .topbar {
    padding: 0 12px;
    height: 58px;
    width: 100% !important;
    max-width: 100% !important;
  }

  .topbar-actions {
    gap: 8px;
  }

  /* Compact User Profile on Mobile so it doesn't push the header */
  .user-profile {
    padding: 2px !important;
    background: transparent !important;
    border: none !important;
    gap: 0 !important;
  }
  .user-profile .user-name,
  .user-profile span,
  .user-profile i {
    display: none !important;
  }
  .user-avatar {
    width: 34px;
    height: 34px;
    font-size: 13px;
  }

  .welcome-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
  }
  .banner-action {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }
  .banner-action .btn {
    width: 100%;
    justify-content: center;
  }

  .stats-grid,
  .stats-grid-4,
  .stats-grid-3 {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .stat-card {
    padding: 16px;
    width: 100% !important;
    max-width: 100% !important;
  }

  .modules-carousel {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .form-grid {
    grid-template-columns: 1fr !important;
  }
  .form-group.col-span-2 {
    grid-column: span 1 !important;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    max-width: 100%;
  }
  .page-title-block {
    width: 100%;
  }
  .page-title-block h1 {
    font-size: 20px;
    word-break: break-word;
  }
  .page-title-block p {
    font-size: 12px;
  }
  .page-header-actions {
    width: 100%;
    flex-direction: column;
    gap: 8px;
  }
  .page-header-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .card {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: var(--radius-md);
  }
  .card-header {
    padding: 12px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .card-body {
    padding: 12px;
  }

  .topbar-search,
  .date-badge {
    display: none !important;
  }
  .qc-flex {
    flex-direction: column;
    gap: 12px;
  }

  /* Modal mobile responsiveness */
  .modal-overlay {
    padding: 10px;
  }
  .modal-content {
    width: 100% !important;
    max-width: 100% !important;
    padding: 16px !important;
    margin: 0 !important;
  }

  /* Compact padding for cards view in production */
  #productionCardsView {
    grid-template-columns: 1fr !important;
    padding: 12px !important;
  }
}


