/* =========================================================
   MA'HAD DAR EL-ILMI — SETORAN HAFALAN SANTRI
   Design System & Modern CSS Stylesheet
   ========================================================= */

:root {
  /* Branding Color Palette (from Logo) */
  --brand-navy-dark: #091d3e;
  --brand-navy: #0f2b5c;
  --brand-navy-light: #183e7a;
  
  --brand-blue: #0284c7;
  --brand-blue-hover: #0369a1;
  --brand-blue-tint: #f0f9ff;
  
  --brand-amber: #f59e0b;
  --brand-amber-dark: #d97706;
  --brand-amber-tint: #fffbeb;

  /* Status Colors */
  --status-positive: #059669;
  --status-positive-bg: #ecfdf5;
  --status-positive-border: #a7f3d0;
  
  --status-attention: #dc2626;
  --status-attention-bg: #fef2f2;
  --status-attention-border: #fca5a5;

  /* Neutral UI Colors */
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  
  --border-light: #e2e8f0;
  --border-medium: #cbd5e1;
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-faint: #94a3b8;
  --text-white: #ffffff;

  /* Fonts */
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  /* Radii & Shadows */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 32px -4px rgba(15, 23, 42, 0.12), 0 4px 12px -2px rgba(15, 23, 42, 0.06);
  --shadow-glow: 0 0 25px rgba(2, 132, 199, 0.2);

  --transition-fast: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-page);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  font-size: 14px;
  overflow-x: hidden;
  position: relative;
}

/* Utility Helpers */
.hidden { display: none !important; }
.text-positive { color: var(--status-positive) !important; }
.text-attention { color: var(--status-attention) !important; }

/* Decorative Background Glows */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
}
.bg-glow-1 {
  width: 450px;
  height: 450px;
  top: -100px;
  left: -100px;
  background: radial-gradient(circle, var(--brand-blue) 0%, rgba(2,132,199,0) 70%);
}
.bg-glow-2 {
  width: 500px;
  height: 500px;
  bottom: -150px;
  right: -100px;
  background: radial-gradient(circle, var(--brand-amber) 0%, rgba(245,158,11,0) 70%);
}

/* Page Visibility */
.page {
  display: none !important;
  position: relative;
  z-index: 1;
  width: 100%;
}
.page.active {
  display: block !important;
}

/* =========================================================
   HALAMAN LOGIN
   ========================================================= */
#page-login.active {
  display: flex !important;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
}

.login-container {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 40px 32px 32px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(8px);
  animation: slideUpFade 0.4s ease-out;
}

@keyframes slideUpFade {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.brand-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.logo-wrapper {
  width: 88px;
  height: 88px;
  margin-bottom: 16px;
  padding: 8px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: var(--shadow-md), 0 0 0 1px var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-normal);
}
.logo-wrapper:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.main-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.institution-name {
  font-size: 22px;
  font-weight: 800;
  color: var(--brand-navy);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.institution-sub {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 4px;
}

.badge-app {
  display: inline-block;
  margin-top: 12px;
  padding: 4px 12px;
  background: var(--brand-blue-tint);
  color: var(--brand-blue);
  border: 1px solid rgba(2, 132, 199, 0.2);
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.divider-line {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-light), transparent);
  margin: 28px 0 24px;
}

/* Form Styles */
.field-group {
  margin-bottom: 20px;
}

.field-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.input-icon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-faint);
  pointer-events: none;
  transition: var(--transition-fast);
}

.field-group input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  font-family: var(--font-main);
  font-size: 14px;
  color: var(--text-main);
  background: #ffffff;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  outline: none;
  transition: var(--transition-fast);
}

.field-group input:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.12);
}

.field-group input:focus + .input-icon,
.input-icon-wrapper:focus-within .input-icon {
  color: var(--brand-blue);
}

.btn-toggle-eye {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}
.btn-toggle-eye:hover {
  color: var(--brand-navy);
}

.error-banner {
  background: var(--status-attention-bg);
  border: 1px solid var(--status-attention-border);
  color: var(--status-attention);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 20px;
  animation: shake 0.3s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* Button UI */
.btn {
  font-family: var(--font-main);
  font-weight: 700;
  font-size: 14px;
  padding: 11px 20px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition-fast);
  text-decoration: none;
  user-select: none;
}
.btn-block { width: 100%; }
.btn-lg { padding: 13px 24px; font-size: 15px; }

.btn-primary {
  background: linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-navy-light) 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(15, 43, 92, 0.25);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--brand-navy-dark) 0%, var(--brand-navy) 100%);
  box-shadow: 0 6px 16px rgba(15, 43, 92, 0.35);
  transform: translateY(-1px);
}
.btn-primary:active {
  transform: translateY(0);
}
.btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none !important;
}

.btn-secondary {
  background: var(--brand-blue);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.2);
}
.btn-secondary:hover {
  background: var(--brand-blue-hover);
  transform: translateY(-1px);
}

.login-footer {
  text-align: center;
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 24px;
}

/* =========================================================
   HALAMAN UTAMA (MAIN APP UI)
   ========================================================= */
#page-main.active {
  min-height: 100vh;
  display: flex !important;
  flex-direction: column;
}

/* Top App Navbar */
.app-navbar {
  background: linear-gradient(135deg, var(--brand-navy-dark) 0%, var(--brand-navy) 100%);
  color: #ffffff;
  padding: 14px 24px;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 40;
}

.navbar-container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.navbar-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  background: #ffffff;
  border-radius: 10px;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #ffffff;
}

.brand-subtitle {
  font-size: 11.5px;
  color: var(--brand-amber);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 16px;
}

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

.user-name {
  font-weight: 700;
  font-size: 14px;
  color: #ffffff;
}

.user-halaqah {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 500;
}

.btn-logout {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-fast);
}
.btn-logout:hover {
  background: rgba(239, 68, 68, 0.85);
  border-color: transparent;
}

/* Tabs Bar */
.nav-tabs-wrapper {
  background: #ffffff;
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 70px;
  z-index: 30;
}

.nav-tabs-container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  gap: 8px;
  padding: 0 24px;
}

.tab-btn {
  padding: 16px 20px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-family: var(--font-main);
  font-weight: 700;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition-fast);
}

.tab-btn svg {
  transition: var(--transition-fast);
  color: var(--text-faint);
}

.tab-btn:hover {
  color: var(--brand-navy);
}
.tab-btn:hover svg {
  color: var(--brand-blue);
}

.tab-btn.active {
  color: var(--brand-navy);
  border-bottom-color: var(--brand-amber);
}

.tab-btn.active svg {
  color: var(--brand-navy);
}

/* Content Area */
.main-content {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
}

.tab-content {
  display: none;
  animation: fadeIn 0.25s ease-in-out;
}
.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   TAB 1: INPUT SETORAN
   ========================================================= */

/* KPI Dashboard Cards */
.stats-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-fast);
}
.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.icon-total { background: #f0fdf4; color: #16a34a; }
.icon-setor { background: #eff6ff; color: #2563eb; }
.icon-belum { background: #fef2f2; color: #dc2626; }

.stat-data {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-main);
}

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

.stat-card-progress {
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 10px;
}

.progress-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.progress-percent {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  color: var(--brand-navy);
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: var(--border-light);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-amber) 0%, var(--status-positive) 100%);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

/* Toolbar Card (Search & Chips) */
.toolbar-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 260px;
  display: flex;
  align-items: center;
}

.search-box .search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-faint);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 11px 40px 11px 42px;
  font-family: var(--font-main);
  font-size: 14px;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  outline: none;
  background: var(--bg-page);
  transition: var(--transition-fast);
}

.search-box input:focus {
  background: #ffffff;
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.12);
}

.btn-clear-search {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
}
.btn-clear-search:hover {
  color: var(--text-main);
}

.filter-chips {
  display: flex;
  gap: 6px;
  align-items: center;
}

.chip-btn {
  padding: 8px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
  background: var(--bg-page);
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}
.chip-btn:hover {
  background: #ffffff;
  border-color: var(--border-medium);
  color: var(--text-main);
}
.chip-btn.active {
  background: var(--brand-navy);
  color: #ffffff;
  border-color: var(--brand-navy);
  box-shadow: 0 2px 6px rgba(15, 43, 92, 0.2);
}

.chip-btn-stats {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-style: dashed;
}
.chip-btn-stats.active, .chip-btn-stats:hover {
  background: var(--brand-blue-tint);
  color: var(--brand-blue);
  border-color: rgba(2, 132, 199, 0.4);
}

/* Section Title */
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 16px;
  padding: 0 4px;
}

.title-with-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.title-with-badge svg {
  color: var(--brand-blue);
}

.count-badge {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--brand-navy);
  background: var(--brand-blue-tint);
  border: 1px solid rgba(2, 132, 199, 0.2);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

/* Santri Grid Layout */
.santri-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.search-results-wrapper {
  margin-bottom: 28px;
  padding: 16px;
  background: rgba(2, 132, 199, 0.04);
  border: 1px dashed rgba(2, 132, 199, 0.3);
  border-radius: var(--radius-lg);
}

/* Santri Card Item */
.santri-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-fast);
}

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

.santri-card.is-setor {
  border-left-color: var(--status-positive);
}
.santri-card.is-belum {
  border-left-color: var(--status-attention);
}

.santri-avatar-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.avatar-circle {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-blue) 100%);
  color: #ffffff;
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.2);
}

.santri-card.is-setor .avatar-circle {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
}

.santri-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.santri-name {
  font-weight: 700;
  font-size: 14.5px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.santri-halaqah {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Status Toggle Button */
.btn-toggle-status {
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 12.5px;
  font-weight: 700;
  border: 1.5px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: var(--transition-fast);
}

.btn-toggle-status.setor {
  background: var(--status-positive-bg);
  color: var(--status-positive);
  border-color: var(--status-positive-border);
}
.btn-toggle-status.setor:hover {
  background: #d1fae5;
}

.btn-toggle-status.belum {
  background: var(--status-attention-bg);
  color: var(--status-attention);
  border-color: var(--status-attention-border);
}
.btn-toggle-status.belum:hover {
  background: #fee2e2;
}

.btn-toggle-status:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* Empty States & Loading */
.empty-state, .loading-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  background: var(--bg-card);
  border: 1px dashed var(--border-medium);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty-state svg {
  color: var(--text-faint);
}

.empty-state p {
  font-size: 13.5px;
  max-width: 360px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-light);
  border-top-color: var(--brand-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* =========================================================
   TAB 2: REKAP HAFALAN
   ========================================================= */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.rekap-controls {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.segmented-control {
  display: inline-flex;
  background: var(--bg-page);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  align-self: flex-start;
}

.mode-btn {
  padding: 8px 18px;
  border: none;
  background: transparent;
  font-family: var(--font-main);
  font-weight: 700;
  font-size: 13px;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.mode-btn.active {
  background: var(--brand-navy);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.rekap-filters-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
  justify-content: space-between;
}

.rekap-filter-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.rekap-filter-group label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

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

.form-input, .form-select {
  padding: 9px 12px;
  font-family: var(--font-main);
  font-size: 13.5px;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  outline: none;
  background: #ffffff;
  color: var(--text-main);
  transition: var(--transition-fast);
}

.form-input:focus, .form-select:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

.num-input {
  width: 90px;
  font-family: var(--font-mono);
}

.action-buttons {
  display: flex;
  gap: 10px;
}

/* KPI Summary Cards in Rekap */
.rekap-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border-top: 3px solid var(--brand-navy);
}

.summary-card .num {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  color: var(--brand-navy);
}

.summary-card .label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 2px;
  letter-spacing: 0.02em;
}

/* Tables Styling */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.custom-table th {
  background: var(--bg-page);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.custom-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13.5px;
}

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

.custom-table tbody tr:hover {
  background-color: var(--bg-page);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 700;
}

.status-badge.setor {
  background: var(--status-positive-bg);
  color: var(--status-positive);
  border: 1px solid var(--status-positive-border);
}

.status-badge.belum {
  background: var(--status-attention-bg);
  color: var(--status-attention);
  border: 1px solid var(--status-attention-border);
}

/* Rekap Bulanan Pivot Table */
.table-legend {
  display: flex;
  gap: 20px;
  padding: 12px 18px;
  background: var(--bg-page);
  border-bottom: 1px solid var(--border-light);
  font-size: 12px;
  font-weight: 600;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.dot-setor { background: var(--status-positive); }
.dot-belum { background: var(--status-attention); }
.dot-future { background: var(--border-medium); }

table.tabel-bulanan {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

table.tabel-bulanan th, table.tabel-bulanan td {
  text-align: center;
  padding: 8px 4px;
  border: 1px solid var(--border-light);
  min-width: 28px;
}

table.tabel-bulanan th.col-nama, table.tabel-bulanan td.col-nama {
  text-align: left;
  padding: 8px 12px;
  min-width: 180px;
  position: sticky;
  left: 0;
  background: #ffffff;
  z-index: 10;
  box-shadow: 2px 0 6px rgba(0, 0, 0, 0.04);
}

table.tabel-bulanan thead th.col-nama {
  background: var(--bg-page);
  z-index: 11;
}

.col-nama .nama-text {
  display: block;
  font-weight: 700;
  color: var(--text-main);
}
.col-nama .halaqah-text {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

.mark-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  transition: transform 0.1s ease;
}
.mark-dot:hover {
  transform: scale(1.3);
}

.mark-dot.mark-setor { background: var(--status-positive); }
.mark-dot.mark-belum { background: var(--status-attention); }
.mark-dot.mark-future { background: var(--border-medium); opacity: 0.5; }

/* Toast Notification */
.toast-notification {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--brand-navy-dark);
  color: #ffffff;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast-notification.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.toast-notification.error {
  background: var(--status-attention);
}

/* Responsive Media Queries */
@media (max-width: 768px) {
  .app-navbar { padding: 12px 16px; }
  .navbar-logo { width: 36px; height: 36px; }
  .brand-title { font-size: 14.5px; }
  .brand-subtitle { font-size: 10px; }
  .user-info { display: none; }
  .logout-text { display: none; }

  .nav-tabs-wrapper { top: 60px; }
  .nav-tabs-container { padding: 0 16px; }
  .tab-btn { padding: 12px 14px; font-size: 13px; }

  .main-content { padding: 16px; }

  .stats-overview { grid-template-columns: 1fr 1fr; }
  .stat-card-progress { grid-column: 1 / -1; }

  .toolbar-card { flex-direction: column; align-items: stretch; }
  .search-box { width: 100%; min-width: 0; }
  .filter-chips { justify-content: center; }

  .santri-grid { grid-template-columns: 1fr; }

  .rekap-filters-row { flex-direction: column; align-items: stretch; }
  .rekap-filter-group { flex-direction: column; align-items: stretch; }
  .action-buttons { width: 100%; }
  .action-buttons .btn { flex: 1; }
}

@media (max-width: 480px) {
  .login-card { padding: 32px 20px 24px; }
  .institution-name { font-size: 20px; }
  .stats-overview { grid-template-columns: 1fr; }
}
