/* ============================================================
   AKAS v2 — Design System (AKAS Identity)
   Primary: Deep Navy #000666 | Fonts: Manrope + Inter
   ============================================================ */

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

/* === CSS Variables === */
:root {
  /* Primary Palette */
  --primary:          #000666;
  --primary-light:    #1a237e;
  --primary-dark:     #00044a;
  --on-primary:       #ffffff;

  /* Accent */
  --accent:           #00c7b4;
  --accent-light:     #a3f6f1;
  --accent-dark:      #00897b;

  /* Surfaces (Tonal Nesting) */
  --surface:          #f8f9fa;
  --surface-low:      #f3f4f5;
  --surface-lowest:   #ffffff;
  --surface-high:     #e9eaf0;
  --surface-highest:  #dde0f0;
  --surface-variant:  #e1e3e4;
  --outline-variant:  #c6c5d4;
  --outline:          #767683;

  --primary-fixed:    #e0e0ff;
  --primary-fixed-dim:#bdc2ff;
  --secondary:        #00639a;
  --secondary-fixed:  #cee5ff;

  /* Text */
  --on-surface:       #191c1d;
  --on-surface-var:   #454652;
  --on-surface-dim:   #737683;

  /* Status */
  --success:  #2e7d32;
  --success-bg: #e8f5e9;
  --warning:  #b68f02;
  --warning-bg: #fff8e1;
  --danger:   #ba1a1a;
  --danger-bg: #ffeaea;
  --info:     #1565c0;
  --info-bg:  #e3f2fd;

  /* Category Colors */
  --cat-ringan: #2e7d32;
  --cat-ringan-bg: #e8f5e9;
  --cat-sedang: #b68f02;
  --cat-sedang-bg: #fff8e1;
  --cat-berat:  #ba1a1a;
  --cat-berat-bg: #ffeaea;

  /* Shadows — ultra-diffused tinted */
  --shadow-sm: 0 2px 8px rgba(0, 7, 103, 0.06);
  --shadow:    0 8px 24px rgba(0, 7, 103, 0.08);
  --shadow-lg: 0 20px 40px rgba(0, 7, 103, 0.10);

  /* Radius */
  --radius-sm: 6px;
  --radius:    12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  /* Sidebar */
  --sidebar-width: 260px;
  --topbar-height: 64px;

  /* Transitions */
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background-color: var(--surface);
  color: var(--on-surface);
  font-size: 0.9375rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

html, body {
  max-width: 100%;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  line-height: 1.2;
  color: var(--on-surface);
}

a { text-decoration: none; color: var(--primary); }
a:hover { color: var(--primary-light); }

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

/* === Layout: Sidebar + Content === */
.layout-wrapper {
  display: flex;
  min-height: 100vh;
  min-width: 0;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--surface-low);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: var(--transition);
  border-right: 1px solid rgba(198, 197, 212, 0.35);
  scrollbar-width: thin;
  scrollbar-color: rgba(118,118,131,0.25) transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(118,118,131,0.25); border-radius: 4px; }

.sidebar-brand {
  padding: 22px 18px 14px;
  border-bottom: 1px solid rgba(198, 197, 212, 0.25);
}

.signature-gradient {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
}

.sidebar-brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-brand-logo {
  width: 44px; height: 44px;
  border-radius: 14px;
  object-fit: contain;
  background: var(--surface-lowest);
  padding: 6px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}

.sidebar-brand-row .sidebar-brand-logo {
  margin-bottom: 0;
}

.sidebar-brand-logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.sidebar-brand-logo-icon i {
  font-size: 1.05rem;
  color: #fff;
}

.sidebar-brand-name {
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--primary);
  line-height: 1.1;
}

.sidebar-brand-school {
  font-size: 0.74rem;
  color: rgba(69, 70, 82, 0.75);
  margin-top: 2px;
  line-height: 1.4;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
}

.nav-section-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(69, 70, 82, 0.7);
  padding: 12px 8px 6px;
  margin-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  color: var(--on-surface-var);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: rgba(255,255,255,0.65);
  color: var(--primary);
}

.nav-item.active {
  background: var(--surface-lowest);
  color: var(--primary);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.nav-item .nav-icon {
  width: 20px; height: 20px;
  flex-shrink: 0;
  opacity: 0.8;
}

.nav-item.active .nav-icon { opacity: 1; }

/* Sidebar user */
.sidebar-user {
  padding: 16px 20px;
  border-top: 1px solid rgba(198, 197, 212, 0.25);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(26, 35, 126, 0.18);
  flex-shrink: 0;
}

.sidebar-user-avatar-initial {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary-fixed);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--primary);
  flex-shrink: 0;
}

.sidebar-user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary);
  line-height: 1.2;
}

.sidebar-user-role {
  font-size: 0.7rem;
  color: rgba(69, 70, 82, 0.75);
  margin-top: 2px;
}

/* Content area */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  max-width: 100%;
  transition: margin-left 0.3s ease;
}

/* Topbar */
.topbar {
  height: var(--topbar-height);
  background: var(--surface-lowest);
  border-bottom: 1px solid rgba(198, 197, 212, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}

.topbar-title {
  font-family: 'Manrope', sans-serif;
  font-size: 1.0625rem;
  font-weight: 800;
  color: var(--primary);
}

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

.topbar-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-low);
  border-radius: 999px;
  padding: 10px 14px;
  min-width: 260px;
  max-width: 520px;
  flex: 1;
}

.topbar-search i {
  color: rgba(69, 70, 82, 0.75);
  font-size: 0.95rem;
}

.topbar-search input {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 0.875rem;
  color: var(--on-surface);
}

.topbar-search input::placeholder {
  color: rgba(69, 70, 82, 0.55);
}

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

.topbar-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: rgba(69, 70, 82, 0.75);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.topbar-icon-btn:hover {
  background: rgba(233, 234, 240, 0.7);
  color: var(--primary);
}

.topbar-divider {
  width: 1px;
  height: 28px;
  background: rgba(198, 197, 212, 0.35);
  margin: 0 6px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar-user-meta {
  display: none;
  text-align: right;
  min-width: 0;
}

.topbar-user-name {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-user-role {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(69, 70, 82, 0.65);
  font-weight: 800;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  object-fit: cover;
  box-shadow: var(--shadow-sm);
  border: 2px solid rgba(26, 35, 126, 0.18);
}

@media (min-width: 640px) {
  .topbar-user-meta {
    display: block;
  }
}

.topbar-user .sidebar-user-avatar-initial {
  width: 40px;
  height: 40px;
  font-size: 0.95rem;
}

.topbar-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--surface-high);
  cursor: pointer;
}

.topbar-burger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--on-surface);
}

/* Page content */
.page-content {
  padding: 28px;
  flex: 1;
  min-width: 0;
  max-width: 100%;
}

/* === Cards === */
.card {
  background: var(--surface-lowest);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(198, 197, 212, 0.18);
  overflow: visible;
}

.card-header {
  padding: 20px 24px;
  background: var(--surface-low);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.card-body {
  padding: 24px;
}

.card-title {
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--on-surface);
}

/* === Stat Cards === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface-lowest);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: var(--transition);
}

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

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

.stat-icon.primary   { background: #eef0ff; color: var(--primary); }
.stat-icon.success   { background: var(--success-bg); color: var(--success); }
.stat-icon.warning   { background: var(--warning-bg); color: var(--warning); }
.stat-icon.danger    { background: var(--danger-bg); color: var(--danger); }
.stat-icon.accent    { background: #e0fafa; color: var(--accent-dark); }

.stat-value {
  font-family: 'Manrope', sans-serif;
  font-size: 1.875rem;
  font-weight: 800;
  color: var(--on-surface);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--on-surface-var);
  font-weight: 500;
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
}
.btn-primary:hover {
  background: var(--primary-dark);
  color: var(--on-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 7, 103, 0.25);
}

.btn-secondary {
  background: var(--surface-high);
  color: var(--on-surface);
}
.btn-secondary:hover {
  background: var(--surface-highest);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover { background: #1b5e20; filter: brightness(1.05); transform: translateY(-1px); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #7f0000; transform: translateY(-1px); }

.btn-warning {
  background: #f9a825;
  color: #fff;
}
.btn-warning:hover { background: #f57f17; transform: translateY(-1px); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--surface-highest);
  color: var(--on-surface-var);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: #eef0ff; }

.btn-google {
  background: var(--surface-lowest);
  border: 1.5px solid var(--surface-highest);
  color: var(--on-surface);
  padding: 12px 20px;
  font-size: 0.9375rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  width: 100%;
  justify-content: center;
  font-weight: 500;
}
.btn-google:hover {
  background: var(--surface-low);
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.btn-sm { padding: 6px 12px; font-size: 0.8125rem; }
.btn-lg { padding: 13px 28px; font-size: 1rem; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* === Forms === */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--on-surface-var);
  margin-bottom: 7px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface-high);
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  color: var(--on-surface);
  outline: none;
  transition: var(--transition);
}

.form-control:focus {
  background: var(--surface-lowest);
  border-bottom-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 7, 103, 0.08);
}

.form-control::placeholder { color: var(--on-surface-dim); }

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

/* === Badges / Pills === */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 0.73rem;
  font-weight: 600;
  line-height: 1.4;
}

.badge-primary   { background: #eef0ff; color: var(--primary); }
.badge-success   { background: var(--success-bg); color: var(--success); }
.badge-warning   { background: var(--warning-bg); color: var(--warning); }
.badge-danger    { background: var(--danger-bg); color: var(--danger); }
.badge-info      { background: var(--info-bg); color: var(--info); }
.badge-secondary { background: var(--surface-high); color: var(--on-surface-var); }
.badge-ringan    { background: var(--cat-ringan-bg); color: var(--cat-ringan); }
.badge-sedang    { background: var(--cat-sedang-bg); color: var(--cat-sedang); }
.badge-berat     { background: var(--cat-berat-bg); color: var(--cat-berat); }

/* === Alert / Flash Messages === */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
}

.alert-success { background: var(--success-bg); color: var(--success); }
.alert-error   { background: var(--danger-bg); color: var(--danger); }
.alert-warning { background: var(--warning-bg); color: var(--warning); }
.alert-info    { background: var(--info-bg); color: var(--info); }

.alert-icon { flex-shrink: 0; margin-top: 1px; }

/* === Modal === */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; visibility: hidden;
  transition: var(--transition);
}

.modal-overlay.open {
  opacity: 1; visibility: visible;
}

.modal {
  background: var(--surface-lowest);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: var(--transition);
}

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

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

.modal-title {
  font-family: 'Manrope', sans-serif;
  font-size: 1.0625rem;
  font-weight: 700;
}

.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px;
  display: flex; justify-content: flex-end; gap: 10px;
  border-top: 1px solid var(--surface-high);
  background: var(--surface-low);
}

/* === Page Header === */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-heading {
  font-family: 'Manrope', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--on-surface);
}

.page-subheading {
  font-size: 0.875rem;
  color: var(--on-surface-var);
  margin-top: 4px;
  font-weight: 400;
}

/* === Filter bar === */
.filter-bar {
  background: var(--surface-lowest);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.filter-bar .form-group { margin-bottom: 0; flex: 1; min-width: 150px; }

/* === Auth Layout === */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  background: var(--surface);
}

.auth-visual {
  flex: 1;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 50%, #283593 100%);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 48px;
  position: relative;
  overflow: hidden;
  min-height: 200px;
}

.auth-visual::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.auth-visual-title {
  font-family: 'Manrope', sans-serif;
  font-size: 2.5rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
  position: relative;
}

.auth-visual-sub {
  font-size: 1rem;
  color: rgba(255,255,255,0.7);
  margin-top: 12px;
  max-width: 380px;
  line-height: 1.6;
  position: relative;
}

.auth-panel {
  width: 460px;
  flex-shrink: 0;
  background: var(--surface-lowest);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 52px 48px;
  box-shadow: var(--shadow-lg);
}

.auth-title {
  font-family: 'Manrope', sans-serif;
  font-size: 1.875rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 8px;
}

.auth-subtitle {
  color: var(--on-surface-var);
  font-size: 0.9rem;
  margin-bottom: 32px;
}

.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0; color: var(--on-surface-dim); font-size: 0.82rem;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--surface-high);
}

.google-icon {
  width: 20px; height: 20px; flex-shrink: 0;
}

/* === Admin Layout === */
.admin-page {
  min-height: 100vh;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.admin-login-card {
  background: var(--surface-lowest);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  padding: 44px 40px;
}

.admin-sidebar {
  background: var(--primary-dark);
}

/* === Pagination === */
.pagination {
  display: flex; gap: 6px; flex-wrap: wrap; margin-top: 20px;
}
.page-btn {
  min-width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--surface-lowest);
  color: var(--on-surface);
  font-size: 0.85rem; font-weight: 600;
  border: 1px solid var(--surface-high);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}
.page-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* === Print === */
@media print {
  .sidebar, .topbar, .no-print, .btn { display: none !important; }
  .main-content { margin-left: 0 !important; }
  body { background: white; }
  .page-content { padding: 0; }
}

.print-body {
  font-family: 'Times New Roman', serif;
  background: white;
  padding: 40px;
  max-width: 800px;
  margin: 0 auto;
  color: #000;
}

.print-kop {
  display: flex; align-items: center; gap: 20px;
  border-bottom: 3px double #000;
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.print-kop-text h2 { font-size: 1.1rem; }
.print-kop-text p { font-size: 0.85rem; margin-top: 2px; }

.print-title {
  text-align: center;
  font-size: 1rem;
  font-weight: bold;
  text-decoration: underline;
  margin: 16px 0;
  text-transform: uppercase;
}

/* === Utilities === */
.text-primary   { color: var(--primary); }
.text-success   { color: var(--success); }
.text-warning   { color: var(--warning); }
.text-danger    { color: var(--danger); }
.text-muted     { color: var(--on-surface-dim); }
.text-sm        { font-size: 0.8125rem; }
.text-xs        { font-size: 0.73rem; }
.text-bold      { font-weight: 700; }
.text-center    { text-align: center; }
.text-right     { text-align: right; }
.font-manrope   { font-family: 'Manrope', sans-serif; }

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

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mb-6 { margin-bottom: 24px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }

.empty-state {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 24px;
  color: var(--on-surface-dim);
}
.empty-state svg { margin: 0 auto 16px; opacity: 0.4; }
.empty-state h3 { font-size: 1rem; font-weight: 600; margin-bottom: 8px; color: var(--on-surface-var); }

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}
.sidebar-overlay.show { display: block; }

/* === Skeleton loader === */
.skeleton {
  background: linear-gradient(90deg, var(--surface-high) 25%, var(--surface) 50%, var(--surface-high) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.4s infinite;
  border-radius: 4px;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Identity chip */
.identity-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #a3f69c33;
  color: #1b5e20;
  border: 1px solid #a3f69c;
  border-radius: 50px;
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Logout form button */
.logout-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--on-surface-var);
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
}
.logout-btn:hover {
  background: rgba(233, 234, 240, 0.7);
  color: var(--primary);
}

/* Tab style */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-low);
  padding: 4px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tab-btn {
  flex: 1 1 160px;
  padding: 10px 16px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--on-surface-var);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.grid-split {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 24px;
}

.grid-2-1 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

.grid-2-1.swap-mobile {
  grid-template-areas: "main side";
}

.grid-2-1.swap-mobile > :nth-child(1) { grid-area: main; }
.grid-2-1.swap-mobile > :nth-child(2) { grid-area: side; }

.grid-2 > *,
.grid-split > *,
.grid-2-1 > * {
  min-width: 0;
}

.tab-btn.active {
  background: var(--surface-lowest);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Dropdown select styled */
.select-wrapper {
  position: relative;
}
.select-wrapper::after {
  content: '▾';
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--on-surface-dim);
  font-size: 0.75rem;
}

.filter-form .filter-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(163, 246, 156, 0.22);
  color: #1b5e20;
  border: 1px solid rgba(163, 246, 156, 0.65);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #1b5e20;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.hero-title {
  font-family: 'Manrope', sans-serif;
  font-size: 2.1rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--primary);
  margin-top: 10px;
  line-height: 1.05;
}

.hero-subtitle {
  margin-top: 10px;
  color: var(--on-surface-var);
  max-width: 720px;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.metric-card {
  background: var(--surface-lowest);
  border-radius: 22px;
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(198, 197, 212, 0.18);
  transition: var(--transition);
}

.metric-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

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

.metric-icon {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.metric-icon-primary { background: var(--primary-fixed); color: var(--primary); }
.metric-icon-warning { background: var(--warning-bg); color: var(--warning); }
.metric-icon-danger  { background: var(--danger-bg);  color: var(--danger); }
.metric-icon-success { background: var(--success-bg); color: var(--success); }

.metric-label {
  color: var(--on-surface-var);
  font-size: 0.85rem;
  font-weight: 600;
}

.metric-value {
  font-family: 'Manrope', sans-serif;
  font-size: 2rem;
  font-weight: 900;
  color: var(--primary);
  margin-top: 4px;
  line-height: 1.05;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 22px 0 12px;
}

.filter-tile {
  background: var(--surface-lowest);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(198, 197, 212, 0.14);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.filter-label {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(69, 70, 82, 0.78);
}

.filter-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: auto;
}

.meta-line {
  margin: 12px 0 14px;
  color: var(--on-surface-dim);
  font-size: 0.875rem;
}

.table-card {
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.callout {
  border-left: 4px solid var(--danger);
}

.callout-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.callout-icon {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--danger-bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--danger);
}

.callout-title {
  font-weight: 900;
  color: var(--danger);
  line-height: 1.1;
}

.callout-text {
  font-size: 0.9rem;
  color: var(--on-surface-var);
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .topbar-burger { display: block; }
  .topbar-search { display: none; }
  .topbar-user-meta { display: none; }
  .page-content { padding: 16px; }

  .auth-panel { width: 100%; padding: 32px 24px; }
  .auth-visual { display: none; }
  .auth-page { align-items: center; justify-content: center; }

  .grid-2 { grid-template-columns: 1fr; }
  .grid-split { grid-template-columns: 1fr; }
  .grid-2-1 { grid-template-columns: 1fr; }
  .grid-2-1.swap-mobile { grid-template-areas: "side" "main"; }

  .page-header { flex-direction: column; align-items: stretch; }
  .card-header { flex-direction: column; align-items: flex-start; }

  .hero-title { font-size: 1.75rem; }
  .hero-actions { width: 100%; }
  .hero-actions .btn { flex: 1 1 160px; }

  .filter-actions { grid-template-columns: 1fr 1fr; }

  table { font-size: 0.8rem; }
  th, td { padding: 10px 12px; }

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

  div.dataTables_wrapper div.dataTables_filter,
  div.dataTables_wrapper div.dataTables_length {
    float: none !important;
    text-align: left !important;
    width: 100%;
  }

  div.dataTables_wrapper div.dataTables_filter input {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    box-sizing: border-box;
  }

  div.dataTables_wrapper div.dataTables_length,
  div.dataTables_wrapper div.dataTables_filter {
    width: 100%;
  }

  div.dataTables_wrapper div.dataTables_filter label,
  div.dataTables_wrapper div.dataTables_length label {
    width: 100%;
  }

  div.dataTables_wrapper div.dataTables_paginate {
    float: none !important;
    text-align: left !important;
    width: 100%;
  }

  div.dataTables_wrapper div.dataTables_info {
    float: none !important;
    width: 100%;
  }
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr !important; }
  .filter-actions { grid-template-columns: 1fr; }
}
