@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ===================== DESIGN TOKENS (LIGHT BLUE THEME) ===================== */
:root {
  /* Backgrounds */
  --bg-base:       #eaf3fb;
  --bg-surface:    #dceafa;
  --bg-elevated:   #ffffff;
  --bg-card:       rgba(37, 99, 235, 0.05);
  --bg-card-hover: rgba(37, 99, 235, 0.10);
  --bg-glass:      rgba(255, 255, 255, 0.75);
  --bg-sidebar:    rgba(255, 255, 255, 0.96);

  /* Brand */
  --brand-1:   #6366f1;
  --brand-2:   #4f46e5;
  --brand-3:   #818cf8;
  --brand-4:   #a78bfa;
  --brand-glow:rgba(99, 102, 241, 0.22);

  /* Semantic */
  --success:   #059669;
  --success-bg:rgba(5,150,105,0.12);
  --warning:   #d97706;
  --warning-bg:rgba(217,119,6,0.12);
  --danger:    #e11d48;
  --danger-bg: rgba(225,29,72,0.12);
  --info:      #0284c7;
  --info-bg:   rgba(2,132,199,0.12);

  /* Text */
  --text-100: #0f172a;
  --text-200: #1e293b;
  --text-300: #475569;
  --text-400: #64748b;
  --text-primary:   var(--text-100);
  --text-secondary: var(--text-200);
  --bg-secondary:   var(--bg-surface);

  /* Borders */
  --border:       rgba(15,23,42,0.09);
  --border-hover: rgba(99,102,241,0.4);
  --border-glow:  rgba(99,102,241,0.5);

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(15,23,42,0.06);
  --shadow-md: 0 8px 24px rgba(15,23,42,0.10);
  --shadow-lg: 0 20px 60px rgba(15,23,42,0.16);
  --shadow-brand: 0 8px 24px rgba(99,102,241,0.25);

  /* Radius */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-full: 9999px;

  /* Transitions */
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ===================== RESET ===================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Plus Jakarta Sans', sans-serif;
  background: var(--bg-base);
  color: var(--text-100);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Animated background mesh */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 10%, rgba(99,102,241,0.10) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 90%, rgba(168,85,247,0.08) 0%, transparent 60%),
    radial-gradient(ellipse 40% 60% at 50% 50%, rgba(2,132,199,0.05) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(99,102,241,0.35); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--brand-1); }

/* ===================== LOGIN PAGE ===================== */
.login-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
  overflow: hidden;
  position: relative;
}

/* Background animated orbs */
.login-wrapper::before {
  content: '';
  position: fixed;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99,102,241,0.14) 0%, transparent 70%);
  top: -200px; left: -200px;
  animation: orb1 20s infinite ease-in-out;
  pointer-events: none;
}
.login-wrapper::after {
  content: '';
  position: fixed;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(168,85,247,0.10) 0%, transparent 70%);
  bottom: -150px; right: 400px;
  animation: orb2 25s infinite ease-in-out;
  pointer-events: none;
}
@keyframes orb1 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(80px, 60px) scale(1.2); } }
@keyframes orb2 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-60px, -80px) scale(1.15); } }

/* Image panel */
.login-image-panel {
  flex: 1.2;
  position: relative;
  overflow: hidden;
  display: none;
  background: linear-gradient(160deg, #0a1a4a 0%, #12277a 45%, #0a1a4a 100%);
}
@media (min-width: 900px) { .login-image-panel { display: block; } }

/* Animated circuit-board SVG (vector — never pixelates) */
.circuit-svg {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
}
.circuit-pulse path {
  stroke-dasharray: 14 260;
  stroke-dashoffset: 274;
  filter: drop-shadow(0 0 4px rgba(147,197,253,0.9));
  animation: circuitPulseFlow 3.2s linear infinite;
}
.circuit-pulse path:nth-child(2) { animation-delay: -0.8s; }
.circuit-pulse path:nth-child(3) { animation-delay: -1.6s; }
.circuit-pulse path:nth-child(4) { animation-delay: -2.4s; }
@keyframes circuitPulseFlow {
  from { stroke-dashoffset: 274; }
  to   { stroke-dashoffset: 0; }
}

.circuit-dots circle {
  transform-box: fill-box;
  transform-origin: center;
  animation: circuitDotGlow 2.6s ease-in-out infinite;
}
.circuit-dots circle:nth-child(odd)  { animation-delay: -1.1s; }
.circuit-dots circle:nth-child(even) { animation-delay: -0.3s; }
@keyframes circuitDotGlow {
  0%, 100% { opacity: 0.35; transform: scale(1); }
  50%      { opacity: 1;    transform: scale(1.35); }
}

/* Soft glow overlay for depth, slowly pulsing */
.login-image-panel::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 25% 30%, rgba(96,165,250,0.35) 0%, transparent 40%),
    radial-gradient(circle at 75% 70%, rgba(147,197,253,0.25) 0%, transparent 45%),
    linear-gradient(135deg, rgba(6,10,40,0.35) 0%, rgba(10,20,70,0.15) 50%, rgba(6,10,40,0.55) 100%);
  animation: glowPulse 6s ease-in-out infinite;
}
@keyframes glowPulse {
  0%, 100% { opacity: 0.85; }
  50%      { opacity: 1; }
}

/* Image panel overlay card stays dark for contrast against the photo/circuit bg */
.login-image-overlay {
  position: absolute;
  bottom: 48px; left: 48px; right: 48px;
  z-index: 3;
  background: rgba(8,8,28,0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--r-xl);
  padding: 32px;
}

.login-image-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 10px;
  line-height: 1.2;
}

.login-image-subtitle {
  font-size: 0.95rem;
  color: #cbd5e1;
  line-height: 1.6;
}

/* Form panel */
.login-form-panel {
  width: 520px;
  min-width: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border);
  padding: 48px 56px;
  z-index: 2;
}
@media (max-width: 900px) {
  .login-form-panel { width: 100%; min-width: 0; padding: 40px 32px; border-left: none; }
}
@media (max-width: 420px) {
  .login-form-panel { padding: 32px 20px; }
  .login-image-overlay { padding: 22px; }
  .login-image-title { font-size: 1.5rem; }
}

.login-form-inner { width: 100%; max-width: 380px; }

.login-kecamatan-logo {
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  gap: 8px;
  margin-bottom: 28px;
}
.login-kecamatan-logo img {
  width: 36px; height: auto;
}
.login-kecamatan-text {
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text-200);
}

.login-brand {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 40px;
}
.login-brand-icon {
  width: 48px; height: 48px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--brand-1), var(--brand-4));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  box-shadow: 0 4px 16px rgba(99,102,241,0.35);
}
.login-brand-name {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.3rem;
  font-weight: 800;
  background: linear-gradient(90deg, var(--brand-2), var(--brand-4));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-heading { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 1.8rem; font-weight: 800; color: var(--text-100); margin-bottom: 6px; }
.login-subheading { font-size: 0.9rem; color: var(--text-300); margin-bottom: 36px; }

/* Input group */
.input-group { margin-bottom: 22px; }
.input-group label {
  display: block; margin-bottom: 8px;
  font-size: 0.8rem; font-weight: 600;
  color: var(--text-300); text-transform: uppercase; letter-spacing: 0.06em;
}
.input-wrapper {
  position: relative;
}
.input-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-400); font-size: 1rem; pointer-events: none;
}
.input-group input {
  width: 100%;
  padding: 13px 16px 13px 42px;
  background: rgba(15,23,42,0.03);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-100);
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  transition: var(--transition);
}
.input-group input:focus {
  outline: none;
  border-color: var(--brand-glow);
  box-shadow: 0 0 0 3px var(--brand-glow);
  background: rgba(99,102,241,0.05);
}
.input-group input::placeholder { color: var(--text-400); }

.btn-login {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-3));
  border: none;
  border-radius: var(--r-md);
  color: white;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: var(--transition-spring);
  box-shadow: var(--shadow-brand);
  position: relative;
  overflow: hidden;
}
.btn-login::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 0; transition: var(--transition);
}
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(99,102,241,0.4); }
.btn-login:hover::after { opacity: 1; }
.btn-login:active { transform: translateY(0); }

/* ===================== APP LAYOUT ===================== */
.app-container { display: flex; min-height: 100vh; }

/* Overlay behind the mobile sidebar; only ever shown via the max-width:768px
   rules below, so it's explicitly hidden by default on desktop */
.sidebar-overlay { display: none; }

/* Sidebar */
.sidebar {
  width: 264px;
  background: var(--bg-sidebar);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  position: fixed; top: 0; left: 0;
  height: 100vh;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--border);
  z-index: 100;
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
}

.sidebar-header {
  padding: 28px 24px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  display: flex; align-items: center; gap: 12px;
}
.sidebar-logo-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-4));
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  box-shadow: 0 4px 12px rgba(99,102,241,0.3);
  flex-shrink: 0;
}
.sidebar-logo-text {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  background: linear-gradient(90deg, var(--brand-2), var(--brand-4));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.sidebar-logo-sub {
  font-size: 0.65rem;
  color: var(--text-400);
  font-weight: 500;
  letter-spacing: 0.04em;
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1; padding: 16px 12px; overflow-y: auto;
}

.nav-section-label {
  font-size: 0.65rem; font-weight: 700;
  color: var(--text-400); text-transform: uppercase; letter-spacing: 0.1em;
  padding: 0 12px; margin: 16px 0 8px;
}

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-radius: var(--r-md);
  color: var(--text-300);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 3px;
  text-decoration: none;
  font-size: 0.88rem; font-weight: 500;
  position: relative;
  border: 1px solid transparent;
}
.nav-item-icon {
  width: 34px; height: 34px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  background: rgba(15,23,42,0.04);
  transition: var(--transition);
  flex-shrink: 0;
}
.nav-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-100);
  border-color: var(--border);
}
.nav-item:hover .nav-item-icon {
  background: rgba(99,102,241,0.15);
}
.nav-item.active {
  background: rgba(99,102,241,0.10);
  color: var(--brand-2);
  font-weight: 600;
  border-color: rgba(99,102,241,0.2);
}
.nav-item.active .nav-item-icon {
  background: rgba(99,102,241,0.18);
}
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 3px; border-radius: 0 3px 3px 0;
  background: linear-gradient(to bottom, var(--brand-1), var(--brand-3));
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

.user-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}
.user-card:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-3));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.9rem; color: white;
  flex-shrink: 0;
}
.user-info-text { flex: 1; min-width: 0; }
.user-name-text { font-size: 0.85rem; font-weight: 600; color: var(--text-100); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role-text { font-size: 0.72rem; color: var(--text-400); margin-top: 1px; }

/* Main Content */
.main-content { margin-left: 264px; flex: 1; min-height: 100vh; display: flex; flex-direction: column; position: relative; z-index: 1; }

/* Top Header */
.top-header {
  height: 68px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}

.page-title-wrapper {}
.page-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.3rem; font-weight: 800; color: var(--text-100);
}
.page-breadcrumb { font-size: 0.75rem; color: var(--text-400); margin-top: 1px; }

.header-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* Content Area */
.content-area { padding: 32px; flex: 1; }

/* ===================== NOTIFICATIONS ===================== */
.notification-bell {
  position: relative; cursor: pointer;
  width: 40px; height: 40px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  transition: var(--transition);
}
.notification-bell:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }
.notification-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--danger);
  color: white; font-size: 0.65rem;
  min-width: 17px; height: 17px;
  border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  border: 2px solid var(--bg-base);
}
.notification-panel {
  position: absolute; top: 72px; right: 32px;
  width: 380px;
  background: var(--bg-elevated);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  max-height: 480px; overflow-y: auto; z-index: 200;
}
.notification-panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.notification-panel-title { font-size: 0.9rem; font-weight: 700; }
.notification-item {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}
.notification-item:hover { background: var(--bg-card-hover); }
.notification-item.unread { border-left: 3px solid var(--brand-1); background: rgba(99,102,241,0.05); }
.notification-action-text { font-size: 0.8rem; font-weight: 600; color: var(--brand-2); }
.notification-detail-text { font-size: 0.78rem; color: var(--text-300); margin-top: 3px; }
.notification-time { font-size: 0.72rem; color: var(--text-400); margin-top: 4px; }

/* ===================== STATS CARDS ===================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px; margin-bottom: 28px;
}
.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px;
  transition: var(--transition-spring);
  position: relative; overflow: hidden;
  cursor: default;
  box-shadow: var(--shadow-sm);
}
.stat-card::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(99,102,241,0.03) 0%, transparent 60%);
  border-radius: inherit;
}
.stat-card:hover {
  transform: translateY(-5px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-brand);
}
.stat-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
}
.stat-badge {
  font-size: 0.72rem; font-weight: 600;
  padding: 4px 10px; border-radius: var(--r-full);
}
.stat-badge.up { background: var(--success-bg); color: var(--success); }
.stat-badge.neutral { background: var(--info-bg); color: var(--info); }
.stat-value {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.9rem; font-weight: 800;
  color: var(--text-100); margin-bottom: 4px;
}
.stat-label { font-size: 0.82rem; color: var(--text-300); font-weight: 500; }
.stat-glow {
  position: absolute; bottom: -20px; right: -20px;
  width: 80px; height: 80px; border-radius: 50%;
  opacity: 0.12; filter: blur(20px);
}

/* ===================== FORMS ===================== */
.form-card {
  background: var(--bg-elevated);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px;
  margin-bottom: 24px;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.form-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--brand-1), var(--brand-3), var(--brand-4));
  border-radius: var(--r-full);
}
.form-section-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1rem; font-weight: 700;
  margin-bottom: 20px; color: var(--text-100);
  display: flex; align-items: center; gap: 10px;
}
.form-section-title span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 8px;
  background: rgba(99,102,241,0.12);
  font-size: 0.85rem;
}

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }

.form-group { display: flex; flex-direction: column; }
.form-group label {
  font-size: 0.78rem; font-weight: 600;
  color: var(--text-300); text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 14px;
  background: rgba(15,23,42,0.03);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-100);
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  transition: var(--transition);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--brand-1);
  box-shadow: 0 0 0 3px var(--brand-glow);
  background: rgba(99,102,241,0.05);
}
.form-group input::placeholder { color: var(--text-400); }
.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='14' height='10' viewBox='0 0 14 10' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L7 8.5L13 1.5' stroke='%23475569' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}
.form-group select option { background: var(--bg-elevated); color: var(--text-100); }
.form-group textarea { resize: vertical; min-height: 88px; }

/* File Upload */
.file-upload {
  border: 2px dashed var(--border);
  border-radius: var(--r-md);
  padding: 18px 16px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: rgba(15,23,42,0.015);
}
.file-upload:hover { border-color: var(--brand-1); background: rgba(99,102,241,0.05); }
.file-upload.has-file { border-color: var(--success); border-style: solid; background: var(--success-bg); }
.file-upload-label { display: block; color: var(--text-300); font-size: 0.82rem; }
.file-name { color: var(--success); font-weight: 600; font-size: 0.85rem; }

/* ===================== BUTTONS ===================== */
.btn {
  padding: 9px 18px;
  border-radius: var(--r-md);
  border: none;
  font-weight: 600; font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition-spring);
  display: inline-flex; align-items: center; justify-content: center;
  gap: 7px;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.01em;
  position: relative; overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.1);
  opacity: 0; transition: var(--transition);
}
.btn:hover::after { opacity: 1; }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--brand-1), var(--brand-3));
  color: white;
  box-shadow: 0 4px 14px rgba(99,102,241,0.3);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(99,102,241,0.4); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(5,150,105,0.3); }

.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(217,119,6,0.3); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(225,29,72,0.3); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-200);
}
.btn-outline:hover { border-color: var(--border-hover); background: var(--bg-card-hover); color: var(--text-100); }

.btn-ghost {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-200);
}
.btn-ghost:hover { background: var(--bg-card-hover); }

.btn-sm { padding: 6px 12px; font-size: 0.78rem; border-radius: 8px; }
.btn-xs { padding: 4px 10px; font-size: 0.74rem; border-radius: 6px; }
.btn-icon {
  width: 36px; height: 36px; padding: 0;
  border-radius: var(--r-sm);
}

/* ===================== TABLES ===================== */
.table-container {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden; overflow-x: auto;
  box-shadow: var(--shadow-sm);
}
.table-header {
  padding: 18px 22px;
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--border);
  background: rgba(15,23,42,0.015);
}
.table-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1rem; font-weight: 700; color: var(--text-100);
}
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-400);
  background: rgba(15,23,42,0.02);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(15,23,42,0.05);
  font-size: 0.88rem;
  color: var(--text-200);
}
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: var(--bg-card-hover); }
tbody tr:last-child td { border-bottom: none; }

/* ===================== FILTER BAR ===================== */
.filter-bar {
  display: flex; gap: 14px; margin-bottom: 22px;
  flex-wrap: wrap; align-items: flex-end;
}
.filter-group { display: flex; flex-direction: column; gap: 6px; }
.filter-group label { font-size: 0.72rem; font-weight: 600; color: var(--text-400); text-transform: uppercase; letter-spacing: 0.06em; }
.filter-group select,
.filter-group input {
  padding: 9px 12px;
  border-radius: var(--r-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-100);
  font-size: 0.85rem;
  font-family: 'Inter', sans-serif;
  min-width: 150px;
  transition: var(--transition);
}
.filter-group select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 7L11 1' stroke='%23475569' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }
.filter-group select:focus, .filter-group input:focus { outline: none; border-color: var(--brand-1); box-shadow: 0 0 0 2px var(--brand-glow); }
.filter-group select option { background: var(--bg-elevated); }

/* ===================== MODALS ===================== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; opacity: 0; visibility: hidden;
  transition: all 0.3s;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 32px;
  width: 92%; max-width: 620px;
  max-height: 88vh; overflow-y: auto;
  transform: scale(0.92) translateY(20px);
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-lg);
  position: relative;
}
.modal::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--brand-1), var(--brand-3), transparent);
}
.modal-overlay.active .modal { transform: scale(1) translateY(0); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.modal-title { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 1.2rem; font-weight: 800; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-300); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 700;
  transition: var(--transition);
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.modal-body { margin-bottom: 24px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

/* ===================== TOAST ===================== */
.toast-container {
  position: fixed; top: 20px; right: 20px;
  z-index: 2000; display: flex; flex-direction: column; gap: 10px;
}
.toast {
  padding: 14px 20px;
  border-radius: var(--r-md);
  color: white; font-weight: 500; font-size: 0.88rem;
  box-shadow: var(--shadow-md);
  transform: translateX(130%);
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex; align-items: center; gap: 10px;
  max-width: 380px; min-width: 260px;
  border: 1px solid rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
}
.toast.show { transform: translateX(0); }
.toast-success { background: rgba(5,150,105,0.92); }
.toast-error   { background: rgba(225,29,72,0.92); }
.toast-warning { background: rgba(217,119,6,0.92); color: #fff; }

/* ===================== INDICATORS ===================== */
.indicator-bar {
  height: 24px; border-radius: 6px; min-width: 80px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700;
}
.indicator-hijau  { background: rgba(5,150,105,0.14); color: var(--success); border: 1px solid rgba(5,150,105,0.3); }
.indicator-kuning { background: rgba(217,119,6,0.14); color: var(--warning); border: 1px solid rgba(217,119,6,0.3); }
.indicator-merah  { background: rgba(225,29,72,0.14); color: var(--danger); border: 1px solid rgba(225,29,72,0.3); }

/* ===================== LOADING ===================== */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(234,243,251,0.85);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 3000;
  flex-direction: column; gap: 16px;
}
.spinner {
  width: 44px; height: 44px;
  border: 3px solid var(--border);
  border-top-color: var(--brand-1);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
.loading-text { font-size: 0.85rem; color: var(--text-300); font-weight: 500; }

/* ===================== DASHBOARD CHARTS ===================== */
.progress-track {
  height: 6px; background: rgba(15,23,42,0.07);
  border-radius: var(--r-full); overflow: hidden; margin-top: 8px;
}
.progress-fill {
  height: 100%; border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--brand-1), var(--brand-3));
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-fill.success { background: linear-gradient(90deg, var(--success), #34d399); }
.progress-fill.warning { background: linear-gradient(90deg, var(--warning), #fbbf24); }
.progress-fill.danger  { background: linear-gradient(90deg, var(--danger), #fb7185); }

/* Badges */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: var(--r-full);
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em;
}
.badge-admin   { background: rgba(99,102,241,0.12); color: var(--brand-2); border: 1px solid rgba(99,102,241,0.25); }
.badge-user    { background: var(--success-bg); color: var(--success); border: 1px solid rgba(5,150,105,0.25); }
.badge-hijau   { background: var(--success-bg); color: var(--success); border: 1px solid rgba(5,150,105,0.25); }
.badge-kuning  { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(217,119,6,0.25); }
.badge-merah   { background: var(--danger-bg);  color: var(--danger);  border: 1px solid rgba(225,29,72,0.25); }

/* Empty State */
.empty-state {
  text-align: center; padding: 60px 24px; color: var(--text-400);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.5; }
.empty-state-title { font-size: 1rem; font-weight: 600; color: var(--text-300); margin-bottom: 6px; }
.empty-state-desc { font-size: 0.85rem; }

/* ===================== ANIMATIONS ===================== */
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes fadeIn  { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: translateX(0); } }
@keyframes pulse   { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes shimmer {
  from { background-position: -400px 0; }
  to   { background-position: 400px 0; }
}

.fade-in    { animation: fadeIn 0.45s cubic-bezier(0.4,0,0.2,1) both; }
.slide-in   { animation: slideIn 0.45s cubic-bezier(0.4,0,0.2,1) both; }
.pulse      { animation: pulse 2s infinite; }

/* Skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--r-md);
}

/* Hamburger Button (hidden on desktop by default; the mobile media query
   below turns it on — this rule MUST come before that media query so the
   cascade resolves correctly) */
.hamburger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-primary);
  width: 36px; height: 36px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2rem;
  transition: var(--transition);
  margin-right: 12px;
}
.hamburger-btn:hover { background: var(--bg-elevated); }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 1024px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
}

/* Tablet & mobile (was accidentally set to "max-width: 1px", disabling all of this) */
@media (max-width: 768px) {
  /* Sidebar: hidden off-screen by default on mobile/tablet, slides in
     when app.js's toggleSidebar() adds the "open" class */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
    z-index: 1000;
    width: 264px;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 5px 0 25px rgba(15,23,42,0.2); }

  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(15,23,42,0.5);
    z-index: 999;
  }
  .sidebar-overlay.show { display: block; }

  .main-content { margin-left: 0; }

  /* Header */
  .top-header { padding: 0 16px; }
  .hamburger-btn { display: flex; }
  .content-area { padding: 16px 12px; }

  /* Stats */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-card { padding: 16px; }
  .stat-value { font-size: 1.4rem; }

  /* Tables - horizontal scroll */
  .table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 600px; font-size: 0.78rem; }
  th, td { padding: 8px 10px; }

  /* Forms */
  .form-grid { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; gap: 10px; }
  .filter-group { width: 100%; }
  .filter-group select { width: 100%; }

  /* Notifications */
  .notification-panel { width: calc(100vw - 32px); right: 16px; }

  /* Modal */
  .modal { width: calc(100vw - 32px); max-height: 90vh; overflow-y: auto; margin: 16px; }

  /* Forms & table headers: tighter padding + wrapping button/select rows
     so nothing gets squeezed or cut off in narrow portrait width */
  .form-card { padding: 18px 16px; }
  .form-section-title { font-size: 0.92rem; margin-bottom: 16px; }
  .table-header { padding: 14px 16px; flex-wrap: wrap; gap: 10px; }
  .table-header > div { flex-wrap: wrap; width: 100%; }
  .table-header select,
  .table-header .btn { width: 100%; }
  .filter-group[style*="align-self"] { align-self: stretch !important; }
  .filter-group .btn { width: 100%; }

  /* Prevent iOS Safari from auto-zooming in on focused inputs */
  input, select, textarea, button { font-size: 16px; }
}

/* Small phones */
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }

  /* Header actions compact */
  .page-breadcrumb { display: none; }
  .stat-card { padding: 12px; }
  .btn { padding: 6px 10px; font-size: 0.75rem; }

  /* Table full scroll */
  table { min-width: 480px; font-size: 0.75rem; }
  .table-header { flex-direction: column; gap: 10px; align-items: flex-start; }

  /* PDF Modal full screen */
  .pdf-modal-overlay { padding: 0; }
  .pdf-modal { border-radius: 0; height: 100vh; width: 100vw; }
}

/* Phones in landscape: viewport height is short, so shrink vertical chrome
   (sidebar header, top header) and let the sidebar scroll independently
   instead of pushing its footer off-screen */
@media (max-width: 900px) and (max-height: 500px) and (orientation: landscape) {
  .sidebar { overflow-y: auto; }
  .sidebar-header { padding: 14px 20px 10px; }
  .sidebar-nav { padding: 8px 0; }
  .nav-item { padding: 9px 20px; }
  .sidebar-footer { padding: 10px 20px; }

  .top-header { height: 52px; padding: 0 16px; }
  .content-area { padding: 12px 16px; }

  .stats-grid { grid-template-columns: repeat(4, 1fr); gap: 10px; }
  .stat-card { padding: 10px; }

  .modal { max-height: 84vh; overflow-y: auto; }
  .pdf-modal { height: 92vh; }
}


.pdf-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.75);
  z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.pdf-modal {
  background: var(--bg-elevated);
  border-radius: 16px;
  width: 90vw; max-width: 900px;
  height: 85vh;
  display: flex; flex-direction: column;
  border: 1px solid var(--border);
}
.pdf-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.pdf-modal-title { font-weight: 700; font-size: 1rem; }
.pdf-modal-close {
  background: none; border: none; color: var(--text-400);
  font-size: 1.5rem; cursor: pointer; line-height: 1;
  padding: 4px 8px; border-radius: 6px;
}
.pdf-modal-close:hover { color: var(--danger); background: rgba(225,29,72,0.1); }
.pdf-modal-body { flex: 1; overflow: hidden; padding: 12px; }
.pdf-modal-body iframe { width: 100%; height: 100%; border: none; border-radius: 8px; background: white; }

/* Detail Modal Realisasi */
.detail-info-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 16px; margin-bottom: 20px;
}
@media (max-width: 600px) { .detail-info-grid { grid-template-columns: 1fr; } }
.detail-info-item label {
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-400); display: block; margin-bottom: 4px;
}
.detail-info-item span {
  font-size: 0.95rem; color: var(--text-primary);
}
.berkas-list { display: flex; flex-direction: column; gap: 8px; }
.berkas-item {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 10px 14px; background: var(--bg-secondary);
  border-radius: 8px; border: 1px solid var(--border); gap: 8px;
}
.berkas-item-name { font-size: 0.85rem; color: var(--text-secondary); }
.berkas-item-actions { display: flex; gap: 6px; flex-wrap: wrap; }