:root {
  /* Color Palette - White & Light Green Dominant Theme */
  --clr-primary:       #10b981;
  --clr-primary-dark:  #059669;
  --clr-primary-light: #047857;
  --clr-primary-bg:    #ecfdf5;
  --clr-primary-border:#a7f3d0;

  --clr-secondary:     #0ea5e9;
  --clr-success:       #10b981;
  --clr-warning:       #f59e0b;
  --clr-danger:        #ef4444;
  --clr-info:          #06b6d4;

  /* Light Theme Surfaces & Neutrals */
  --clr-bg:            #f8fafc;
  --clr-bg-2:          #ffffff;
  --clr-bg-3:          #f1f5f9;
  --clr-card:          #ffffff;
  --clr-border:        #e2e8f0;
  --clr-text:          #0f172a;
  --clr-text-muted:    #64748b;
  --clr-text-light:    #94a3b8;

  /* Sidebar & Header */
  --sidebar-width:     240px;
  --sidebar-bg:        #ffffff;

  /* Fonts */
  --font-sans:         'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Radius */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  20px;
  --radius-full: 9999px;

  /* Shadows */
  --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 -1px rgba(0, 0, 0, 0.04);
  --shadow-lg:  0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
  --shadow-glow: 0 0 15px rgba(16, 185, 129, 0.25);
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--clr-bg);
  color: var(--clr-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--clr-primary-dark); text-decoration: none; transition: color .2s; }
a:hover { color: var(--clr-primary-dark); }

img { max-width: 100%; }

/* =============================
   SCROLLBAR
   ============================= */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--clr-bg); }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--clr-primary); }

/* =============================
   LAYOUT
   ============================= */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--clr-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform .3s ease;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--clr-border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--clr-primary), #059669);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: #ffffff;
  box-shadow: var(--shadow-glow);
}

.sidebar-logo .logo-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--clr-text);
  letter-spacing: -.3px;
}

.sidebar-logo .logo-sub {
  font-size: 10px;
  color: var(--clr-text-muted);
  display: block;
  margin-top: -2px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 8px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--clr-text-light);
  text-transform: uppercase;
  letter-spacing: .8px;
  padding: 8px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--clr-text-muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
  position: relative;
}

.nav-item:hover {
  background: var(--clr-bg-3);
  color: var(--clr-text);
}

.nav-item.active {
  background: var(--clr-primary-bg);
  color: var(--clr-primary-dark);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--clr-primary);
}

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

.nav-badge {
  margin-left: auto;
  background: var(--clr-danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--clr-border);
  background: #fafafa;
}

/* Main content */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--clr-bg-2);
  border-bottom: 1px solid var(--clr-border);
  padding: 0 24px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 16px;
}

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

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--clr-text);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--clr-text-muted);
}

.breadcrumb a { color: var(--clr-text-muted); }
.breadcrumb a:hover { color: var(--clr-primary-dark); }
.breadcrumb span { color: var(--clr-text); }

.content-area {
  padding: 24px;
  flex: 1;
}

/* =============================
   SIDEBAR TOGGLE (mobile)
   ============================= */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--clr-text);
  cursor: pointer;
  padding: 4px;
}

/* =============================
   CARDS
   ============================= */
.card {
  background: var(--clr-card);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

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

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

.card-subtitle {
  font-size: 12px;
  color: var(--clr-text-muted);
  margin-top: 2px;
}

/* =============================
   STAT CARDS
   ============================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--clr-card);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform .2s, box-shadow .2s;
  box-shadow: var(--shadow-sm);
}

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

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

.stat-icon.emerald{ background: #ecfdf5; color: #059669; }
.stat-icon.green  { background: #ecfdf5; color: #10b981; }
.stat-icon.blue   { background: #e0f2fe; color: #0284c7; }
.stat-icon.purple { background: #f3e8ff; color: #7e22ce; }
.stat-icon.yellow { background: #fef3c7; color: #d97706; }
.stat-icon.red    { background: #fee2e2; color: #dc2626; }
.stat-icon.cyan   { background: #cffafe; color: #0891b2; }

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

.stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--clr-text);
  line-height: 1.2;
}

.stat-label {
  font-size: 12px;
  color: var(--clr-text-muted);
  margin-top: 2px;
}

.stat-change {
  font-size: 11px;
  font-weight: 600;
  margin-top: 4px;
}

.stat-change.up   { color: var(--clr-success); }
.stat-change.down { color: var(--clr-danger); }

/* =============================
   BUTTONS
   ============================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
  white-space: nowrap;
  font-family: var(--font-sans);
}

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

.btn-primary {
  background: var(--clr-primary);
  color: #fff;
}
.btn-primary:hover { background: var(--clr-primary-dark); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3); }

.btn-secondary {
  background: var(--clr-bg-3);
  color: var(--clr-text);
  border: 1px solid var(--clr-border);
}
.btn-secondary:hover { background: #e2e8f0; color: var(--clr-text); }

.btn-success {
  background: #059669;
  color: #fff;
}
.btn-success:hover { background: #047857; color: #fff; transform: translateY(-1px); }

.btn-danger {
  background: var(--clr-danger);
  color: #fff;
}
.btn-danger:hover { background: #dc2626; color: #fff; }

.btn-warning {
  background: var(--clr-warning);
  color: #fff;
}
.btn-warning:hover { background: #d97706; color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--clr-text-muted);
  border: 1px solid transparent;
}
.btn-ghost:hover { background: var(--clr-bg-3); color: var(--clr-text); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { padding: 8px; border-radius: var(--radius-md); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

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

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  color: var(--clr-text);
  font-size: 13.5px;
  font-family: var(--font-sans);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}

.form-control:focus {
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.form-control::placeholder { color: var(--clr-text-light); }

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

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

.form-control.is-invalid { border-color: var(--clr-danger); }
.form-error { font-size: 12px; color: var(--clr-danger); margin-top: 4px; }
.form-hint  { font-size: 12px; color: var(--clr-text-muted); margin-top: 4px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.input-group {
  display: flex;
  align-items: center;
}

.input-group .form-control {
  flex: 1;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.input-group-addon {
  background: var(--clr-bg-3);
  border: 1px solid var(--clr-border);
  border-left: none;
  padding: 9px 12px;
  color: var(--clr-text-muted);
  font-size: 13px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 16px; height: 16px;
  accent-color: var(--clr-primary);
  cursor: pointer;
}

.form-check label { font-size: 13.5px; color: var(--clr-text); cursor: pointer; }

/* =============================
   TABLES
   ============================= */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--clr-border);
  background: #ffffff;
}

table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.table thead th {
  background: #f8fafc;
  padding: 11px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--clr-text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 1px solid var(--clr-border);
  white-space: nowrap;
}

.table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--clr-border);
  color: var(--clr-text);
  vertical-align: middle;
}

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

.table tbody tr:hover td { background: var(--clr-primary-bg); }

/* =============================
   BADGES
   ============================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-primary  { background: var(--clr-primary-bg); color: var(--clr-primary-dark); border: 1px solid var(--clr-primary-border); }
.badge-success  { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.badge-warning  { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.badge-danger   { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.badge-info     { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.badge-secondary{ background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }

/* =============================
   ALERTS
   ============================= */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}

.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }

.alert-success { background: #ecfdf5; border: 1px solid #a7f3d0; color: #047857; }
.alert-error   { background: #fee2e2; border: 1px solid #fca5a5; color: #b91c1c; }
.alert-warning { background: #fef3c7; border: 1px solid #fde68a; color: #b45309; }
.alert-info    { background: #e0f2fe; border: 1px solid #bae6fd; color: #0369a1; }

/* =============================
   MODAL
   ============================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}

.modal-overlay.open {
  display: flex !important;
  opacity: 1;
  pointer-events: all;
  z-index: 500;
}

.modal {
  background: var(--clr-card);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(.95) translateY(10px);
  transition: transform .2s;
}

.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
}

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

.modal-title { font-size: 16px; font-weight: 700; color: var(--clr-text); }
.modal-close {
  background: none; border: none; color: var(--clr-text-muted);
  cursor: pointer; padding: 4px; border-radius: var(--radius-sm);
  transition: color .2s, background .2s;
}
.modal-close:hover { color: var(--clr-text); background: var(--clr-bg-3); }
.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--clr-border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  background: #f8fafc;
}

/* =============================
   AVATAR
   ============================= */
.avatar {
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--clr-primary), #059669);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.avatar.lg { width: 48px; height: 48px; font-size: 18px; }
.avatar.sm { width: 24px; height: 24px; font-size: 11px; }

/* =============================
   EMPTY STATE
   ============================= */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--clr-text-muted);
}

.empty-state svg { width: 48px; height: 48px; margin-bottom: 16px; opacity: .4; }
.empty-state h3  { font-size: 16px; font-weight: 700; color: var(--clr-text); margin-bottom: 8px; }
.empty-state p   { font-size: 13.5px; }

/* =============================
   SEARCH BAR
   ============================= */
.search-bar {
  position: relative;
  display: flex;
  align-items: center;
}

.search-bar input {
  background: #ffffff;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-full);
  padding: 7px 14px 7px 36px;
  color: var(--clr-text);
  font-size: 13.5px;
  width: 240px;
  transition: all .2s;
  font-family: var(--font-sans);
}

.search-bar input:focus {
  outline: none;
  border-color: var(--clr-primary);
  width: 280px;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.search-bar svg {
  position: absolute;
  left: 11px;
  width: 15px; height: 15px;
  color: var(--clr-text-muted);
  pointer-events: none;
}

/* =============================
   PROGRESS BAR
   ============================= */
.progress {
  height: 6px;
  background: #e2e8f0;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--clr-primary), #059669);
  transition: width .5s ease;
}

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

.toast {
  background: #ffffff;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  max-width: 360px;
  animation: slideInRight .3s ease;
  font-size: 13.5px;
  color: var(--clr-text);
}

.toast.success { border-left: 4px solid var(--clr-success); }
.toast.error   { border-left: 4px solid var(--clr-danger); }
.toast.warning { border-left: 4px solid var(--clr-warning); }
.toast.info    { border-left: 4px solid var(--clr-info); }

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

.spin {
  animation: spin 1s linear infinite;
}

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

/* =============================
   CHIP / TAG
   ============================= */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  background: var(--clr-primary-bg);
  color: var(--clr-primary-dark);
  border: 1px solid var(--clr-primary-border);
}

/* =============================
   ONLINE / OFFLINE INDICATOR
   ============================= */
.connectivity-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  transition: all .3s;
}

.connectivity-badge.online  { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.connectivity-badge.offline { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }

.connectivity-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.online  .connectivity-dot { background: var(--clr-success); box-shadow: 0 0 6px var(--clr-success); }
.offline .connectivity-dot { background: var(--clr-danger);  box-shadow: 0 0 6px var(--clr-danger); }

/* =============================
   UTILITIES
   ============================= */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--clr-text-muted); }
.text-danger { color: var(--clr-danger); }
.text-success{ color: var(--clr-success); }
.text-warning{ color: var(--clr-warning); }
.text-sm     { font-size: 12px; }
.text-xs     { font-size: 11px; }
.font-bold   { font-weight: 700; }
.font-semibold { font-weight: 600; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.p-0  { padding: 0; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* =============================
   RESPONSIVE DASHBOARD & LAYOUTS
   ============================= */
.dashboard-grid-main {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.dashboard-grid-admin {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 4px;
}

@media (max-width: 992px) {
  .dashboard-grid-main,
  .dashboard-grid-admin {
    grid-template-columns: 1fr;
  }
}

/* =============================
   RESPONSIVE
   ============================= */
/* =============================
   RESPONSIVE
   ============================= */
@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }

  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
    width: 270px;
    z-index: 1000;
  }

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

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
    display: none;
  }

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

  .main-content {
    margin-left: 0;
    width: 100%;
  }

  .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: var(--clr-bg-3);
  }

  .content-area { padding: 14px 12px; }

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

  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px 12px; gap: 10px; }
  .stat-icon { width: 38px; height: 38px; font-size: 18px; }
  .stat-value { font-size: 18px; }
  .stat-label { font-size: 11px; }

  .card { padding: 16px 12px; }
  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .table-wrap, .datatable-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
  }

  .modal { max-height: 92vh; margin: 10px; width: calc(100% - 20px); }

  .search-bar input { width: 140px; }
  .search-bar input:focus { width: 170px; }

  .topbar { padding: 0 12px; height: 54px; }
  .topbar-right { gap: 6px; }

  .toast-container { bottom: 16px; right: 12px; left: 12px; }
  .toast { min-width: unset; max-width: unset; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .table-wrap { font-size: 12px; }
  .table thead th, .table tbody td { padding: 8px 10px; }
  .search-bar input { width: 120px; font-size: 12px; }
  .search-bar input:focus { width: 140px; }
  .page-title { font-size: 14.5px; }
}

/* =============================
   DATATABLES GREEN & WHITE THEME
   ============================= */
.datatable-wrapper {
  background: var(--clr-card);
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--clr-text);
}

/* Wrapper standalone (bukan di dalam card/table-wrap) */
.card > .datatable-wrapper,
.table-wrap > .datatable-wrapper {
  border: none;
  box-shadow: none;
  padding: 0;
}

/* Top & Bottom bar - override float dengan flex */
.datatable-top,
.datatable-bottom {
  padding: 10px 14px;
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--clr-card);
  border-bottom: 1px solid var(--clr-border);
}

.datatable-bottom {
  border-bottom: none;
  border-top: 1px solid var(--clr-border);
}

/* Override float dari library */
.datatable-top > nav,
.datatable-top > div,
.datatable-bottom > nav,
.datatable-bottom > div {
  float: none !important;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Search Input */
.datatable-search {
  display: flex;
  align-items: center;
}

.datatable-search input,
.datatable-input {
  background: #ffffff !important;
  border: 1px solid var(--clr-border) !important;
  border-radius: var(--radius-full) !important;
  padding: 6px 14px !important;
  font-size: 13px !important;
  font-family: var(--font-sans) !important;
  outline: none !important;
  color: var(--clr-text) !important;
  transition: border-color .2s, box-shadow .2s;
  box-shadow: none !important;
}

.datatable-search input:focus,
.datatable-input:focus {
  border-color: var(--clr-primary) !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15) !important;
}

/* Per-page Selector */
.datatable-selector {
  background: #ffffff !important;
  border: 1px solid var(--clr-border) !important;
  border-radius: var(--radius-md) !important;
  padding: 5px 8px !important;
  font-size: 13px !important;
  font-family: var(--font-sans) !important;
  color: var(--clr-text) !important;
  cursor: pointer;
  outline: none !important;
}

.datatable-selector:focus {
  border-color: var(--clr-primary) !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15) !important;
}

/* Per-page label text */
.datatable-perpage-form label,
.datatable-dropdown label {
  font-size: 13px;
  color: var(--clr-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

/* Table Container */
.datatable-container {
  overflow-x: auto;
}

/* Table itself */
.datatable-table {
  width: 100% !important;
  border-collapse: collapse !important;
  font-size: 13.5px !important;
}

.datatable-table thead th {
  background: #f8fafc !important;
  color: var(--clr-text-muted) !important;
  font-weight: 700 !important;
  font-size: 11px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  border-bottom: 2px solid var(--clr-border) !important;
  padding: 11px 14px !important;
  white-space: nowrap;
}

/* Sort arrows */
.datatable-table th a {
  color: var(--clr-text-muted) !important;
  text-decoration: none !important;
}

.datatable-table th.datatable-ascending a::after  { content: ' ↑'; color: var(--clr-primary); }
.datatable-table th.datatable-descending a::after { content: ' ↓'; color: var(--clr-primary); }

.datatable-table td {
  padding: 12px 14px !important;
  border-bottom: 1px solid var(--clr-border) !important;
  font-size: 13.5px !important;
  color: var(--clr-text) !important;
  vertical-align: middle !important;
}

.datatable-table tbody tr:last-child td {
  border-bottom: none !important;
}

.datatable-table tbody tr:hover td {
  background: var(--clr-primary-bg) !important;
}

/* Pagination */
.datatable-pagination ul {
  display: flex !important;
  gap: 4px !important;
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  float: none !important;
}

.datatable-pagination li {
  float: none !important;
  display: block;
}

.datatable-pagination li.datatable-hidden {
  visibility: hidden;
  display: none !important;
}

.datatable-pagination a,
.datatable-pagination button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 32px !important;
  height: 32px !important;
  background: #ffffff !important;
  border: 1px solid var(--clr-border) !important;
  border-radius: var(--radius-md) !important;
  color: var(--clr-text) !important;
  padding: 0 8px !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all .2s !important;
  text-decoration: none !important;
}

.datatable-pagination a:hover,
.datatable-pagination button:hover {
  background: var(--clr-primary-bg) !important;
  border-color: var(--clr-primary-border) !important;
  color: var(--clr-primary-dark) !important;
}

.datatable-pagination .datatable-active a,
.datatable-pagination .datatable-active button {
  background: var(--clr-primary) !important;
  border-color: var(--clr-primary) !important;
  color: #ffffff !important;
}

.datatable-pagination li.datatable-disabled a,
.datatable-pagination li.datatable-disabled button {
  opacity: 0.4 !important;
  cursor: not-allowed !important;
}

/* Info text */
.datatable-info {
  font-size: 12.5px !important;
  color: var(--clr-text-muted) !important;
  white-space: nowrap;
}

/* No rows state */
.datatable-empty {
  text-align: center !important;
  padding: 32px 16px !important;
  color: var(--clr-text-muted) !important;
  font-size: 13.5px !important;
}

/* Clearfix for any floats still used */
.datatable-top::after,
.datatable-bottom::after {
  content: '';
  display: table;
  clear: both;
}

