/* ==========================================================================
   Markpage Demo Platform — Premium SaaS Dashboard Stylesheet
   Light theme, clean corporate design inspired by markpage.fr branding
   ========================================================================== */

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

/* ==========================================================================
   1. CSS Custom Properties
   ========================================================================== */
:root {
  --mp-primary: #FD2A44;
  --mp-primary-hover: #e01f38;
  --mp-primary-light: rgba(253, 42, 68, 0.1);
  --mp-dark: #1e293b;
  --mp-dark-light: #334155;
  --mp-text: #1e293b;
  --mp-text-secondary: #64748b;
  --mp-text-muted: #94a3b8;
  --mp-bg: #f8fafc;
  --mp-card: #ffffff;
  --mp-border: #e2e8f0;
  --mp-border-light: #f1f5f9;
  --mp-success: #00d084;
  --mp-warning: #f59e0b;
  --mp-danger: #ef4444;
  --mp-info: #0693e3;
  --mp-purple: #9b51e0;
  --mp-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --mp-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --mp-shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.12);
  --mp-radius: 12px;
  --mp-radius-sm: 8px;
  --mp-radius-xs: 6px;
  --mp-transition: 0.2s ease;
  --mp-sidebar-width: 260px;
}

/* ==========================================================================
   2. Reset & Base
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--mp-text);
  background-color: var(--mp-bg);
}

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

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol {
  list-style: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--mp-text);
}

/* ==========================================================================
   3. Sidebar
   ========================================================================== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--mp-sidebar-width);
  background-color: var(--mp-dark);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform var(--mp-transition);
  overflow-y: auto;
  overflow-x: hidden;
}

/* --- Sidebar Logo --- */
.sidebar-logo {
  padding: 20px 24px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo-img {
  max-width: 150px;
  margin: 0 auto;
  filter: brightness(0) invert(1);
}

/* --- Sidebar User --- */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--mp-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sidebar-user-name {
  color: #ffffff;
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.6875rem;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 500;
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 8px;
  border-radius: 4px;
  display: inline-block;
  margin-top: 2px;
  width: fit-content;
}

/* --- Sidebar Navigation --- */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 12px 0;
}

.sidebar-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-nav li {
  margin: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.875rem;
  font-weight: 400;
  text-decoration: none;
  transition: all var(--mp-transition);
  border-left: 3px solid transparent;
  cursor: pointer;
}

.nav-item:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.08);
}

.nav-item.active {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.1);
  border-left: 3px solid var(--mp-primary);
  font-weight: 600;
}

.nav-item i {
  width: 20px;
  text-align: center;
  font-size: 1rem;
  flex-shrink: 0;
}

/* --- Sidebar Footer --- */
.sidebar-footer {
  margin-top: auto;
  padding: 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
}

.sidebar-powered {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.75rem;
}

.sidebar-version {
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.6875rem;
  margin-top: 4px;
}

/* ==========================================================================
   4. Main Wrapper & Layout
   ========================================================================== */
.main-wrapper {
  margin-left: var(--mp-sidebar-width);
  min-height: 100vh;
  background-color: var(--mp-bg);
  transition: margin-left var(--mp-transition);
}

/* ==========================================================================
   5. Top Header
   ========================================================================== */
.top-header {
  background-color: #ffffff;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--mp-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.top-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.top-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* --- Hamburger (mobile) --- */
.hamburger-btn {
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  font-size: 1.25rem;
  color: var(--mp-text-secondary);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: var(--mp-radius-sm);
  transition: background var(--mp-transition);
}

.hamburger-btn:hover {
  background-color: var(--mp-border-light);
}

/* --- Breadcrumb --- */
.breadcrumb {
  display: flex;
  align-items: center;
  font-size: 0.875rem;
  color: var(--mp-text-secondary);
  flex-wrap: wrap;
}

.breadcrumb-item {
  color: var(--mp-text-secondary);
  text-decoration: none;
  transition: color var(--mp-transition);
}

.breadcrumb-item:hover {
  color: var(--mp-text);
}

.breadcrumb-item.active {
  color: var(--mp-text);
  font-weight: 600;
}

.breadcrumb-separator,
.breadcrumb-sep {
  color: #cbd5e1;
  margin: 0 8px;
  font-size: 0.75rem;
}

/* --- Header Search --- */
.header-search {
  position: relative;
  display: flex;
  align-items: center;
}

.header-search i {
  position: absolute;
  left: 12px;
  color: var(--mp-text-muted);
  font-size: 0.875rem;
  pointer-events: none;
}

.header-search-input {
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--mp-border);
  border-radius: var(--mp-radius-sm);
  font-size: 0.8125rem;
  width: 220px;
  background-color: var(--mp-bg);
  transition: all var(--mp-transition);
  outline: none;
  color: var(--mp-text);
}

.header-search-input::placeholder {
  color: var(--mp-text-muted);
}

.header-search-input:focus {
  border-color: var(--mp-primary);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px var(--mp-primary-light);
}

/* --- Header Notifications --- */
.header-notifications {
  position: relative;
}

.notification-btn {
  background: transparent;
  border: none;
  font-size: 1.125rem;
  color: var(--mp-text-secondary);
  cursor: pointer;
  position: relative;
  padding: 8px;
  border-radius: var(--mp-radius-sm);
  transition: all var(--mp-transition);
}

.notification-btn:hover {
  background-color: var(--mp-border-light);
  color: var(--mp-text);
}

.notification-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background-color: var(--mp-primary);
  color: #ffffff;
  font-size: 0.625rem;
  min-width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  line-height: 1;
}

/* --- Header User Dropdown --- */
.header-user-dropdown {
  position: relative;
}

.user-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--mp-radius-sm);
  transition: background var(--mp-transition);
}

.user-dropdown-btn:hover {
  background-color: var(--mp-border-light);
}

.user-dropdown-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--mp-dark);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-dropdown-name {
  font-size: 0.8125rem;
  color: var(--mp-dark-light);
  font-weight: 500;
}

.user-dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background-color: #ffffff;
  border-radius: var(--mp-radius);
  box-shadow: var(--mp-shadow-lg);
  min-width: 200px;
  padding: 8px;
  z-index: 1000;
  display: none;
  border: 1px solid var(--mp-border-light);
}

.user-dropdown-menu.show {
  display: block;
  animation: dropdownFadeIn 0.15s ease;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--mp-radius-sm);
  color: var(--mp-dark-light);
  text-decoration: none;
  font-size: 0.8125rem;
  transition: background var(--mp-transition);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
}

.dropdown-item:hover {
  background-color: var(--mp-border-light);
}

.dropdown-item i {
  color: var(--mp-text-muted);
  width: 16px;
  text-align: center;
  font-size: 0.875rem;
}

.dropdown-divider {
  border: none;
  border-top: 1px solid var(--mp-border);
  margin: 4px 0;
}

/* ==========================================================================
   6. Main Content Area
   ========================================================================== */
.main-content {
  padding: 24px 32px;
}

/* ==========================================================================
   7. Dashboard — Welcome Section
   ========================================================================== */
.dashboard-welcome {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 24px 0;
}

.dashboard-welcome-text h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--mp-text);
  margin: 0;
}

.dashboard-subtitle {
  color: var(--mp-text-secondary);
  font-size: 0.9375rem;
  margin-top: 4px;
}

.dashboard-welcome-date {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--mp-text-secondary);
  font-size: 0.875rem;
  background-color: #ffffff;
  padding: 8px 16px;
  border-radius: var(--mp-radius-sm);
  border: 1px solid var(--mp-border);
}

.dashboard-welcome-date i {
  color: var(--mp-text-muted);
}

/* ==========================================================================
   8. Dashboard — Grid Layouts
   ========================================================================== */
.dashboard-grid {
  display: grid;
  gap: 24px;
  margin-bottom: 24px;
}

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

.dashboard-grid.charts-row {
  grid-template-columns: 2fr 1fr;
}

.dashboard-grid.two-col-row {
  grid-template-columns: 1fr 1fr;
}

.dashboard-grid.full-row {
  grid-template-columns: 1fr;
}

/* ==========================================================================
   9. KPI Cards
   ========================================================================== */
.kpi-card {
  background-color: var(--mp-card);
  border-radius: var(--mp-radius);
  padding: 20px 24px;
  box-shadow: var(--mp-shadow-sm);
  border: 1px solid var(--mp-border-light);
  position: relative;
  overflow: hidden;
  transition: all var(--mp-transition);
}

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

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.kpi-card--green::before {
  background-color: var(--mp-success);
}

.kpi-card--blue::before {
  background-color: var(--mp-info);
}

.kpi-card--purple::before {
  background-color: var(--mp-purple);
}

.kpi-card--orange::before {
  background-color: var(--mp-warning);
}

.kpi-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.kpi-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.kpi-icon--green {
  background-color: rgba(0, 208, 132, 0.1);
  color: var(--mp-success);
}

.kpi-icon--blue {
  background-color: rgba(6, 147, 227, 0.1);
  color: var(--mp-info);
}

.kpi-icon--purple {
  background-color: rgba(155, 81, 224, 0.1);
  color: var(--mp-purple);
}

.kpi-icon--orange {
  background-color: rgba(252, 185, 0, 0.1);
  color: var(--mp-warning);
}

.kpi-card-body {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 8px;
}

.kpi-value {
  font-size: 1.875rem;
  font-weight: 800;
  color: var(--mp-text);
  line-height: 1;
}

.kpi-unit {
  font-size: 0.875rem;
  color: var(--mp-text-secondary);
  font-weight: 500;
}

.kpi-card-label {
  font-size: 0.8125rem;
  color: var(--mp-text-secondary);
  font-weight: 500;
}

.kpi-card-trend {
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: var(--mp-radius-xs);
}

.kpi-card-trend.trend--up {
  color: var(--mp-success);
  background-color: rgba(0, 208, 132, 0.1);
}

.kpi-card-trend.trend--down {
  color: var(--mp-danger);
  background-color: rgba(239, 68, 68, 0.1);
}

.kpi-card-trend.trend--neutral {
  color: var(--mp-text-secondary);
  background-color: var(--mp-border-light);
}

/* ==========================================================================
   10. Chart Containers
   ========================================================================== */
.chart-container {
  background-color: var(--mp-card);
  border-radius: var(--mp-radius);
  padding: 0;
  box-shadow: var(--mp-shadow-sm);
  border: 1px solid var(--mp-border-light);
  overflow: hidden;
}

.chart-container-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--mp-border-light);
}

.chart-container-header h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--mp-text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-container-header h3 i {
  color: var(--mp-text-muted);
  font-size: 0.875rem;
}

.chart-body {
  padding: 16px 20px;
  min-height: 280px;
  position: relative;
}

.chart-body canvas {
  width: 100% !important;
  max-height: 300px;
}

.chart-actions {
  display: flex;
  gap: 4px;
}

.chart-period-btn {
  padding: 4px 12px;
  border-radius: var(--mp-radius-xs);
  border: 1px solid var(--mp-border);
  background-color: #ffffff;
  font-size: 0.75rem;
  color: var(--mp-text-secondary);
  cursor: pointer;
  transition: all var(--mp-transition);
}

.chart-period-btn:hover {
  background-color: var(--mp-bg);
  border-color: #cbd5e1;
}

.chart-period-btn.active {
  background-color: var(--mp-primary);
  color: #ffffff;
  border-color: var(--mp-primary);
}

.chart-header-link {
  color: var(--mp-primary);
  font-size: 0.8125rem;
  text-decoration: none;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: opacity var(--mp-transition);
}

.chart-header-link:hover {
  opacity: 0.8;
}

/* ==========================================================================
   11. Alert List & Alert Cards
   ========================================================================== */
.alert-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
}

.alert-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--mp-radius-sm);
  border-left: 3px solid;
  background-color: #fafbfc;
  transition: background var(--mp-transition);
  cursor: pointer;
}

.alert-card:hover {
  background-color: var(--mp-border-light);
}

.alert-card--red {
  border-left-color: var(--mp-danger);
}

.alert-card--orange {
  border-left-color: var(--mp-warning);
}

.alert-card--blue {
  border-left-color: var(--mp-info);
}

.alert-card--green {
  border-left-color: var(--mp-success);
}

.alert-card--purple {
  border-left-color: var(--mp-purple);
}

.alert-card-icon {
  font-size: 1rem;
  width: 32px;
  flex-shrink: 0;
  text-align: center;
}

.alert-card--red .alert-card-icon {
  color: var(--mp-danger);
}

.alert-card--orange .alert-card-icon {
  color: var(--mp-warning);
}

.alert-card--blue .alert-card-icon {
  color: var(--mp-info);
}

.alert-card--green .alert-card-icon {
  color: var(--mp-success);
}

.alert-card--purple .alert-card-icon {
  color: var(--mp-purple);
}

.alert-card-content {
  flex: 1;
  min-width: 0;
}

.alert-card-content strong {
  font-size: 0.8125rem;
  color: var(--mp-text);
  display: block;
  margin-bottom: 2px;
}

.alert-card-content p {
  font-size: 0.75rem;
  color: var(--mp-text-secondary);
  margin: 0;
}

.alert-card-action {
  color: var(--mp-text-muted);
  font-size: 0.75rem;
  flex-shrink: 0;
  transition: color var(--mp-transition);
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
}

.alert-card-action:hover {
  color: var(--mp-primary);
}

/* ==========================================================================
   12. Timeline
   ========================================================================== */
.timeline {
  padding: 16px 20px;
}

.timeline-item {
  display: flex;
  gap: 16px;
  padding-bottom: 16px;
  position: relative;
}

.timeline-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 7px;
  top: 22px;
  bottom: 0;
  width: 2px;
  background-color: var(--mp-border);
}

.timeline-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 3px;
  position: relative;
  z-index: 1;
}

.timeline-dot--blue {
  background-color: var(--mp-info);
}

.timeline-dot--green {
  background-color: var(--mp-success);
}

.timeline-dot--orange {
  background-color: var(--mp-warning);
}

.timeline-dot--purple {
  background-color: var(--mp-purple);
}

.timeline-dot--red {
  background-color: var(--mp-danger);
}

.timeline-content {
  flex: 1;
  min-width: 0;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.timeline-actor {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--mp-text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.timeline-actor i {
  color: var(--mp-text-muted);
  font-size: 0.75rem;
}

.timeline-time {
  font-size: 0.75rem;
  color: var(--mp-text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.timeline-time i {
  font-size: 0.625rem;
}

.timeline-content p {
  font-size: 0.8125rem;
  color: #475569;
  margin: 0;
  line-height: 1.5;
}

/* ==========================================================================
   13. Data Table
   ========================================================================== */
.data-table-wrapper {
  padding: 0 16px 16px;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.data-table thead th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--mp-text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--mp-border-light);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--mp-bg);
  color: var(--mp-dark-light);
}

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

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--mp-radius-xs);
  font-size: 0.75rem;
  font-weight: 700;
  background-color: var(--mp-border-light);
  color: var(--mp-text-secondary);
}

.rank--gold {
  background-color: #fef3c7;
  color: #d97706;
}

.rank--silver {
  background-color: var(--mp-border-light);
  color: var(--mp-text-secondary);
}

.rank--bronze {
  background-color: #fed7aa;
  color: #c2410c;
}

.client-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.client-cell i {
  color: var(--mp-text-muted);
  font-size: 0.875rem;
}

.trend--up {
  color: var(--mp-success);
  font-size: 0.75rem;
  font-weight: 600;
}

.trend--down {
  color: var(--mp-danger);
  font-size: 0.75rem;
  font-weight: 600;
}

/* ==========================================================================
   14. Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--mp-radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--mp-transition);
  text-decoration: none;
  line-height: 1.5;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background-color: var(--mp-primary);
  color: #ffffff;
  border-color: var(--mp-primary);
}

.btn-primary:hover {
  background-color: var(--mp-primary-hover);
  border-color: var(--mp-primary-hover);
  box-shadow: 0 2px 8px rgba(253, 42, 68, 0.3);
}

.btn-secondary {
  background-color: var(--mp-dark);
  color: #ffffff;
  border-color: var(--mp-dark);
}

.btn-secondary:hover {
  background-color: var(--mp-dark-light);
  border-color: var(--mp-dark-light);
}

.btn-outline {
  background-color: transparent;
  color: var(--mp-text);
  border-color: var(--mp-border);
}

.btn-outline:hover {
  background-color: var(--mp-bg);
  border-color: #cbd5e1;
}

.btn-sm {
  padding: 5px 14px;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 12px 28px;
  font-size: 1rem;
}

.btn-icon {
  padding: 8px;
  width: 36px;
  height: 36px;
}

/* ==========================================================================
   15. Badges
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 20px;
  line-height: 1.4;
  white-space: nowrap;
}

.badge--success {
  background-color: rgba(0, 208, 132, 0.1);
  color: var(--mp-success);
}

.badge--warning {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--mp-warning);
}

.badge--danger {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--mp-danger);
}

.badge--info {
  background-color: rgba(6, 147, 227, 0.1);
  color: var(--mp-info);
}

.badge--purple {
  background-color: rgba(155, 81, 224, 0.1);
  color: var(--mp-purple);
}

.badge--neutral {
  background-color: var(--mp-border-light);
  color: var(--mp-text-secondary);
}

/* ==========================================================================
   16. Form Inputs
   ========================================================================== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--mp-text);
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.875rem;
  color: var(--mp-text);
  background-color: #ffffff;
  border: 1px solid var(--mp-border);
  border-radius: var(--mp-radius-sm);
  transition: all var(--mp-transition);
  outline: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--mp-text-muted);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--mp-primary);
  box-shadow: 0 0 0 3px var(--mp-primary-light);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  background-color: var(--mp-bg);
  cursor: not-allowed;
  opacity: 0.7;
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--mp-text-muted);
  margin-top: 4px;
}

.form-error {
  font-size: 0.75rem;
  color: var(--mp-danger);
  margin-top: 4px;
}

.form-input.is-error,
.form-select.is-error {
  border-color: var(--mp-danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* ==========================================================================
   17. Modal
   ========================================================================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background-color: #ffffff;
  border-radius: var(--mp-radius);
  box-shadow: var(--mp-shadow-lg);
  max-width: 560px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 1;
  animation: modalSlideIn 0.2s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

.modal-header h3 {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  font-size: 1.25rem;
  color: var(--mp-text-muted);
  cursor: pointer;
  border-radius: var(--mp-radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--mp-transition);
}

.modal-close:hover {
  background-color: var(--mp-border-light);
  color: var(--mp-text);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--mp-border-light);
}

/* ==========================================================================
   18. Toast Notifications
   ========================================================================== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-radius: var(--mp-radius-sm);
  background-color: #ffffff;
  box-shadow: var(--mp-shadow-lg);
  border-left: 4px solid var(--mp-border);
  min-width: 300px;
  max-width: 400px;
  font-size: 0.8125rem;
  color: var(--mp-text);
  animation: toastSlideIn 0.3s ease;
}

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

.toast--success {
  border-left-color: var(--mp-success);
}

.toast--success i {
  color: var(--mp-success);
}

.toast--error {
  border-left-color: var(--mp-danger);
}

.toast--error i {
  color: var(--mp-danger);
}

.toast--warning {
  border-left-color: var(--mp-warning);
}

.toast--warning i {
  color: var(--mp-warning);
}

.toast--info {
  border-left-color: var(--mp-info);
}

.toast--info i {
  color: var(--mp-info);
}

.toast-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--mp-text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 0.875rem;
  transition: color var(--mp-transition);
}

.toast-close:hover {
  color: var(--mp-text);
}

/* ==========================================================================
   19. Loading Spinner
   ========================================================================== */
.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--mp-border-light);
  border-top-color: var(--mp-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.spinner--sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.spinner--lg {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--mp-radius);
  z-index: 10;
}

/* ==========================================================================
   20. Sidebar Overlay (mobile)
   ========================================================================== */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 150;
  display: none;
  opacity: 0;
  transition: opacity var(--mp-transition);
}

.sidebar-overlay.show {
  display: block;
  opacity: 1;
}

/* ==========================================================================
   21. Utility Classes
   ========================================================================== */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-muted {
  color: var(--mp-text-muted);
}

.text-success {
  color: var(--mp-success);
}

.text-danger {
  color: var(--mp-danger);
}

.text-warning {
  color: var(--mp-warning);
}

.text-primary {
  color: var(--mp-primary);
}

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }

.w-100 { width: 100%; }

.hidden { display: none; }
.visible { display: block; }

/* ==========================================================================
   22. Page-Specific: Generic Card (reusable)
   ========================================================================== */
.card {
  background-color: var(--mp-card);
  border-radius: var(--mp-radius);
  box-shadow: var(--mp-shadow-sm);
  border: 1px solid var(--mp-border-light);
  overflow: hidden;
}

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

.card-header h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--mp-text);
  margin: 0;
}

.card-body {
  padding: 20px;
}

.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--mp-border-light);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ==========================================================================
   23. Pagination
   ========================================================================== */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  margin-top: 16px;
}

.pagination-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--mp-radius-xs);
  border: 1px solid var(--mp-border);
  background-color: #ffffff;
  color: var(--mp-text-secondary);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all var(--mp-transition);
}

.pagination-btn:hover {
  background-color: var(--mp-bg);
  border-color: #cbd5e1;
}

.pagination-btn.active {
  background-color: var(--mp-primary);
  color: #ffffff;
  border-color: var(--mp-primary);
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ==========================================================================
   24. Empty State
   ========================================================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--mp-text-muted);
}

.empty-state i {
  font-size: 2.5rem;
  margin-bottom: 16px;
  color: var(--mp-border);
}

.empty-state h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--mp-text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.8125rem;
  max-width: 320px;
}

/* ==========================================================================
   25. Tooltip
   ========================================================================== */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--mp-dark);
  color: #ffffff;
  font-size: 0.6875rem;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--mp-transition);
  z-index: 100;
}

[data-tooltip]:hover::after {
  opacity: 1;
}

/* ==========================================================================
   26. Scrollbar
   ========================================================================== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background-color: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--mp-text-muted);
}

.sidebar::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.15);
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.25);
}

/* ==========================================================================
   27. Responsive — Tablet (max-width: 1024px)
   ========================================================================== */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-wrapper {
    margin-left: 0;
  }

  .hamburger-btn {
    display: flex;
  }

  .main-content {
    padding: 20px;
  }
}

/* ==========================================================================
   28. Responsive — Small Tablet / Large Phone (max-width: 768px)
   ========================================================================== */
@media (max-width: 768px) {
  .dashboard-grid.kpi-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-grid.charts-row,
  .dashboard-grid.two-col-row {
    grid-template-columns: 1fr;
  }

  .dashboard-welcome {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .header-search-input {
    width: 160px;
  }

  .top-header {
    padding: 10px 16px;
  }

  .main-content {
    padding: 16px;
  }

  .user-dropdown-name {
    display: none;
  }

  .modal-content {
    width: 95%;
    margin: 16px;
  }
}

/* ==========================================================================
   29. Responsive — Phone (max-width: 480px)
   ========================================================================== */
@media (max-width: 480px) {
  .dashboard-grid.kpi-row {
    grid-template-columns: 1fr;
  }

  .dashboard-welcome-text h1 {
    font-size: 1.375rem;
  }

  .header-search {
    display: none;
  }

  .kpi-value {
    font-size: 1.5rem;
  }

  .chart-body {
    min-height: 200px;
  }

  .toast {
    min-width: unset;
    max-width: calc(100vw - 40px);
  }
}

/* ==========================================================================
   30. Print Styles
   ========================================================================== */
@media print {
  .sidebar,
  .sidebar-overlay,
  .top-header,
  .hamburger-btn,
  .toast-container {
    display: none !important;
  }

  .main-wrapper {
    margin-left: 0 !important;
  }

  .main-content {
    padding: 0;
  }

  .kpi-card,
  .chart-container,
  .card {
    box-shadow: none;
    border: 1px solid #ddd;
    break-inside: avoid;
  }

  body {
    background: #ffffff;
    color: #000000;
  }
}

/* ==========================================================================
   31. Selection
   ========================================================================== */
::selection {
  background-color: var(--mp-primary-light);
  color: var(--mp-primary);
}

/* ==========================================================================
   32. Focus Visible (Accessibility)
   ========================================================================== */
:focus-visible {
  outline: 2px solid var(--mp-primary);
  outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
input:focus:not(:focus-visible) {
  outline: none;
}
