/* ============================================================
   SIDesa Ringkas — Premium Design System 2026
   Palette: #1F6F5F | #2FA084 | #6FCF97 | #FFF4E1
   Style: Modern SaaS · Glassmorphism · Gen-Z Friendly
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,300;0,14..32,400;0,14..32,500;0,14..32,600;0,14..32,700;0,14..32,800;1,14..32,400&family=Plus+Jakarta+Sans:wght@500;600;700;800&display=swap');

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  /* Brand Palette */
  --primary-dark:  #1F6F5F;
  --primary:       #2FA084;
  --primary-mid:   #27907A;
  --secondary:     #6FCF97;
  --secondary-light: #A8EFC4;
  --bg-warm:       #FFF4E1;

  /* Tonal derivations */
  --primary-light: rgba(47,160,132,.12);
  --primary-xs:    rgba(47,160,132,.06);
  --primary-glow:  rgba(47,160,132,.30);

  /* Sidebar */
  --bg-sidebar:      #0D2B24;
  --bg-sidebar-mid:  #122E27;
  --bg-sidebar-hover: rgba(47,160,132,.14);
  --bg-sidebar-active: #2FA084;

  /* Surfaces */
  --bg:            #F0FAF6;
  --bg-card:       #FFFFFF;
  --bg-glass:      rgba(255,255,255,.72);
  --bg-glass-dark: rgba(13,43,36,.72);

  /* Text */
  --text-primary:   #0D2B24;
  --text-secondary: #3D6B5E;
  --text-muted:     #7AADA0;
  --text-on-dark:   #E8F5F1;

  /* Status colours */
  --accent:        #2FA084;
  --accent-dark:   #1F6F5F;
  --accent-light:  rgba(111,207,151,.18);

  --warning:       #F59E0B;
  --warning-light: rgba(245,158,11,.12);
  --error:         #EF4444;
  --error-light:   rgba(239,68,68,.12);
  --info:          #06B6D4;
  --info-light:    rgba(6,182,212,.12);

  /* Borders */
  --border:        rgba(47,160,132,.18);
  --border-hover:  rgba(47,160,132,.38);
  --border-focus:  #2FA084;

  /* Radius */
  --radius-sm:  8px;
  --radius:     14px;
  --radius-lg:  18px;
  --radius-xl:  24px;
  --radius-2xl: 32px;

  /* Shadows */
  --shadow-xs:      0 1px 3px rgba(31,111,95,.06);
  --shadow-sm:      0 2px 8px rgba(31,111,95,.08);
  --shadow:         0 4px 20px rgba(31,111,95,.10);
  --shadow-md:      0 8px 32px rgba(31,111,95,.14);
  --shadow-lg:      0 16px 48px rgba(31,111,95,.18);
  --shadow-colored: 0 8px 28px rgba(47,160,132,.30);
  --shadow-glow:    0 0 0 3px rgba(47,160,132,.20);

  /* Transitions */
  --transition:      all .22s cubic-bezier(.4,0,.2,1);
  --transition-slow: all .36s cubic-bezier(.4,0,.2,1);

  /* Sidebar widths */
  --sidebar-collapsed: 72px;
  --sidebar-expanded:  280px;
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
img { max-width: 100%; }

/* ── Layout Shell ───────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ═══════════════════════════════════════════════════════════
   SIDEBAR — Collapsed 72px, Expands to 264px on hover
   ═══════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-collapsed);
  min-height: 100vh;
  background: linear-gradient(180deg, var(--bg-sidebar) 0%, #0a2019 100%);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  transition: width .3s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
  border-right: 1px solid rgba(47,160,132,.08);
  box-shadow: 4px 0 24px rgba(0,0,0,.18);
}

/* Expanded on hover (desktop) */
@media (min-width: 1025px) {
  .sidebar:hover {
    width: var(--sidebar-expanded);
  }
  .sidebar:hover .sidebar-text,
  .sidebar:hover .sidebar-brand-text,
  .sidebar:hover .sidebar-user-info,
  .sidebar:hover .nav-section-label {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
  }
  .sidebar:hover .sidebar-logo-icon { margin-right: 0; }
}

/* ── Sidebar Brand ─────────────────────────────────────────── */
.sidebar-brand {
  padding: 20px 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
  min-height: 40px;
}

.sidebar-logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(47,160,132,.40);
  position: relative;
  overflow: hidden;
}
.sidebar-logo-icon::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.15) 0%, transparent 60%);
}

.sidebar-brand-text {
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity .25s ease, transform .25s ease;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-app-name {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  letter-spacing: -.02em;
}

.sidebar-desa-name {
  font-size: 10px;
  color: #fff;
  margin-top: 1px;
  letter-spacing: .02em;
}

/* ── Sidebar User ──────────────────────────────────────────── */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 8px;
  background: rgba(255,255,255,.05);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,.06);
  min-height: 48px;
  transition: padding .3s ease;
}
.sidebar:hover .sidebar-user {
  padding: 10px 12px;
}

.sidebar-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(47,160,132,.35);
}

.sidebar-user-info {
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity .25s .04s ease, transform .25s .04s ease;
  pointer-events: none;
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-user-name {
  font-size: 12px;
  color: rgba(255,255,255,.90);
  font-weight: 600;
}

.sidebar-user-role {
  font-size: 10px;
  color: #fff;
  margin-top: 1px;
}

/* ── Sidebar Nav ───────────────────────────────────────────── */
.sidebar-nav {
  padding: 12px 10px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-section-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .10em;
  color: #fff;
  padding: 0 10px;
  margin: 14px 0 5px;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity .2s .06s ease, transform .2s .06s ease;
  pointer-events: none;
  white-space: nowrap;
}
.nav-section-label:first-child { margin-top: 0; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px;
  border-radius: var(--radius);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 2px;
  position: relative;
  min-height: 44px;
  white-space: nowrap;
  overflow: hidden;
}

.nav-link .nav-icon {
  width: 20px; height: 20px;
  flex-shrink: 0;
  opacity: 1;
  transition: opacity .2s;
}

.sidebar-text {
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity .22s .04s ease, transform .22s .04s ease;
  pointer-events: none;
}

.nav-link:hover {
  background: var(--bg-sidebar-hover);
  color: #fff;
}
.nav-link:hover .nav-icon { opacity: 1; }
.nav-link:hover .sidebar-text { color: #fff; }

.nav-link.active {
  background: var(--bg-sidebar-active);
  color: #fff;
  box-shadow: 0 4px 16px rgba(47,160,132,.38), inset 0 1px 0 rgba(255,255,255,.15);
}
.nav-link.active .nav-icon { opacity: 1; }
.nav-link.active::before {
  content: '';
  position: absolute;
  right: -10px;
  top: 50%; transform: translateY(-50%);
  width: 3px; height: 24px;
  background: var(--secondary);
  border-radius: 3px 0 0 3px;
  opacity: 0;
  transition: opacity .2s;
}

/* Sidebar text on collapsed / expanded */
@media (min-width: 1025px) {
  .sidebar-text {
    display: none;
  }
  .sidebar:hover .sidebar-text {
    display: inline;
    opacity: 1;
    transform: translateX(0);
  }
  .sidebar:hover .nav-link.active::before { opacity: 1; }
}

/* ── Sidebar Footer ────────────────────────────────────────── */
.sidebar-footer {
  padding: 10px 10px 16px;
  border-top: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}

/* Mobile sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  z-index: 99;
}
.sidebar-overlay.show { display: block; }

/* ═══════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════ */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-collapsed);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left .3s cubic-bezier(.4,0,.2,1);
}

/* ═══════════════════════════════════════════════════════════
   TOPBAR / HEADER
   ═══════════════════════════════════════════════════════════ */
.topbar {
  background: rgba(255,255,255,.80);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(47,160,132,.12);
  padding: 0 28px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 20px rgba(31,111,95,.06);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-greeting {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.topbar-greeting-text {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
}

.topbar-greeting-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-dark);
  font-family: 'Plus Jakarta Sans', sans-serif;
  line-height: 1.25;
  letter-spacing: -.02em;
}

.topbar-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  letter-spacing: -.02em;
}

.hamburger-btn {
  display: none;
  background: none;
  border: none;
  padding: 8px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}
.hamburger-btn:hover {
  background: var(--primary-xs);
  color: var(--primary);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-time {
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 12px;
  background: var(--primary-xs);
  border-radius: 999px;
  border: 1px solid var(--border);
}

/* Topbar icon buttons */
.topbar-icon-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  background: var(--primary-xs);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}
.topbar-icon-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--border-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-xs);
}

/* Topbar user chip */
.topbar-user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  background: var(--primary-xs);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: var(--transition);
}
.topbar-user-chip:hover {
  background: var(--primary-light);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-xs);
}

.topbar-avatar {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(47,160,132,.30);
}

.topbar-user-info { display: flex; flex-direction: column; }
.topbar-user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); line-height: 1.25; }
.topbar-user-role { font-size: 10px; color: var(--text-muted); }

/* ── Page Content ─────────────────────────────────────────────── */
.page-content {
  padding: 24px 28px;
  flex: 1;
}

/* ═══════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow);
  border-color: var(--border-hover);
}

.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid rgba(47,160,132,.10);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(240,250,246,.5);
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  letter-spacing: -.02em;
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.card-body {
  padding: 22px;
}

/* ═══════════════════════════════════════════════════════════
   STAT CARDS — Premium gradient with lift effect
   ═══════════════════════════════════════════════════════════ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  border-radius: var(--radius-xl);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow);
  transition: transform .25s cubic-bezier(.4,0,.2,1), box-shadow .25s cubic-bezier(.4,0,.2,1);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.20);
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 120px; height: 120px;
  background: rgba(255,255,255,.07);
  border-radius: 50%;
  transform: translate(30%, -30%);
  pointer-events: none;
}

.stat-card::before {
  content: '';
  position: absolute;
  bottom: -20px; left: -20px;
  width: 80px; height: 80px;
  background: rgba(255,255,255,.05);
  border-radius: 50%;
  pointer-events: none;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

/* Specific card gradients */
.stat-card-1 {
  background: linear-gradient(135deg, #2FA084 0%, #1F6F5F 100%);
}
.stat-card-2 {
  background: linear-gradient(135deg, #27A3B6 0%, #127A90 100%);
}
.stat-card-3 {
  background: linear-gradient(135deg, #8B6FCF 0%, #5A3FA8 100%);
}
.stat-card-4 {
  background: linear-gradient(135deg, #6FCF97 0%, #2FA084 100%);
}

.stat-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: rgba(255,255,255,.18);
  backdrop-filter: blur(8px);
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,.22);
}

.stat-icon img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border: 1px solid #000;
  border-radius: 4px;
}

.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.18);
  color: rgba(255,255,255,.90);
  backdrop-filter: blur(6px);
}

.stat-label {
  font-size: 12px;
  color: rgba(255,255,255,.72);
  font-weight: 500;
  letter-spacing: .02em;
}

.stat-value {
  font-size: 34px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
  font-family: 'Plus Jakarta Sans', sans-serif;
  letter-spacing: -.03em;
}

.stat-desc {
  font-size: 11px;
  color: rgba(255,255,255,.58);
}

/* ═══════════════════════════════════════════════════════════
   CHARTS GRID
   ═══════════════════════════════════════════════════════════ */
.chart-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 24px;
}

/* ── Activity Feed ──────────────────────────────────────────── */
.activity-feed {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(47,160,132,.08);
  transition: background .15s;
}
.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
  margin-top: 5px;
  box-shadow: 0 0 0 3px rgba(47,160,132,.16);
}

.activity-text {
  flex: 1;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
}

.activity-time {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
  white-space: nowrap;
  padding: 2px 8px;
  background: var(--primary-xs);
  border-radius: 999px;
  border: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.badge-primary   { background: var(--primary-light); color: var(--primary-dark); border: 1px solid rgba(47,160,132,.25); }
.badge-success   { background: var(--accent-light);  color: var(--accent-dark); border: 1px solid rgba(111,207,151,.30); }
.badge-warning   { background: var(--warning-light); color: #92400E; border: 1px solid rgba(245,158,11,.25); }
.badge-error     { background: var(--error-light);   color: #991B1B; border: 1px solid rgba(239,68,68,.25); }
.badge-info      { background: var(--info-light);    color: #0E7490; border: 1px solid rgba(6,182,212,.25); }
.badge-neutral   { background: rgba(61,107,94,.08);  color: var(--text-secondary); border: 1px solid var(--border); }

/* Surat status badges */
.badge-baru          { background: rgba(61,107,94,.08); color: var(--text-secondary); border: 1px solid var(--border); }
.badge-diverifikasi  { background: var(--primary-light); color: var(--primary-dark); border: 1px solid rgba(47,160,132,.25); }
.badge-diproses      { background: var(--warning-light); color: #92400E; border: 1px solid rgba(245,158,11,.25); }
.badge-selesai       { background: var(--accent-light);  color: var(--accent-dark); border: 1px solid rgba(111,207,151,.30); }
.badge-ditolak       { background: var(--error-light);   color: #991B1B; border: 1px solid rgba(239,68,68,.25); }

/* ═══════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  border: none;
  transition: var(--transition);
  white-space: nowrap;
  cursor: pointer;
  line-height: 1;
  letter-spacing: .01em;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--primary-glow);
  filter: brightness(1.06);
}
.btn-primary:active { transform: translateY(0); }

.btn-success {
  background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(111,207,151,.35);
}
.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(111,207,151,.45);
}

.btn-danger {
  background: linear-gradient(135deg, #F87171 0%, var(--error) 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(239,68,68,.30);
}
.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(239,68,68,.40);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
}
.btn-outline:hover {
  background: var(--primary-xs);
  border-color: var(--border-hover);
  color: var(--primary);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 13px 26px;
  font-size: 15px;
  border-radius: var(--radius);
}

/* Quick Action pill buttons */
.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  box-shadow: var(--shadow-xs);
}
.btn-action:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: var(--shadow-colored);
}
.btn-action:hover .btn-action-icon {
  background: rgba(255,255,255,.20);
  color: #fff;
}

.btn-action-icon {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--primary-xs);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}

/* ═══════════════════════════════════════════════════════════
   FORM ELEMENTS
   ═══════════════════════════════════════════════════════════ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.form-label .required {
  color: var(--error);
  margin-left: 2px;
}

.form-control {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-card);
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-glow);
  background: #fff;
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.input-group { position: relative; }
.input-group .input-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.input-group .form-control { padding-left: 36px; }

/* ═══════════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════════ */
.table-wrapper {
  overflow-x: auto;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.table-scrollable {
  max-height: 520px;
  overflow-y: auto;
  position: relative;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.table-scrollable-fill {
  overflow-y: auto;
  position: relative;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

@media (min-width: 1025px) {
  .table-scrollable-fill {
    flex: 1;
  }

  .page-content:has(.table-scrollable-fill) {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 64px);
    overflow: hidden;
    box-sizing: border-box;
  }

  .page-content:has(.table-scrollable-fill) .card {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .page-content:has(.table-scrollable-fill) .card .pagination {
    margin-top: auto;
    border-top: 1px solid rgba(47,160,132,.10);
    background: var(--bg-card);
    z-index: 5;
  }
}

@media (max-width: 1024px) {
  .table-scrollable-fill {
    max-height: 480px;
  }
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.data-table thead {
  background: #f2fbf7;
}

table.data-table thead th {
  padding: 13px 18px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-secondary);
  text-align: left;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 10;
  background: #f2fbf7;
  box-shadow: inset 0 -2px 0 rgba(47,160,132,.12), 0 2px 4px rgba(0,0,0,.02);
}

table.data-table tbody tr {
  border-bottom: 1px solid rgba(47,160,132,.06);
  transition: background .14s;
}

table.data-table tbody tr:last-child { border-bottom: none; }
table.data-table tbody tr:hover { background: var(--primary-xs); }

table.data-table tbody td {
  padding: 13px 18px;
  color: var(--text-primary);
  vertical-align: middle;
}

.td-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════
   STEP WIZARD
   ═══════════════════════════════════════════════════════════ */
.step-indicator {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 28px;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
}

.step-item::before {
  content: '';
  position: absolute;
  top: 16px;
  left: calc(-50% + 16px);
  right: calc(50% + 16px);
  height: 2px;
  background: var(--border);
  z-index: 0;
}

.step-item:first-child::before { display: none; }

.step-item.done::before, .step-item.active::before {
  background: var(--primary);
}

.step-circle {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  position: relative;
  z-index: 1;
  transition: var(--transition);
}

.step-item.active .step-circle {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 5px rgba(47,160,132,.18);
}

.step-item.done .step-circle {
  background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
  color: #fff;
}

.step-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: center;
}

.step-item.active .step-label { color: var(--primary); font-weight: 600; }
.step-item.done .step-label   { color: var(--accent); }

/* ── Multi-Step Form Panel ───────────────────────────────────── */
.step-panel {
  display: none;
  animation: fadeSlideUp .25s ease;
}
.step-panel.active { display: block; }

/* ── Progressive Disclosure ──────────────────────────────────── */
.optional-section {
  max-height: 0;
  overflow: hidden;
  transition: max-height .4s cubic-bezier(.4,0,.2,1), opacity .3s;
  opacity: 0;
}
.optional-section.open { max-height: 1000px; opacity: 1; }

.toggle-optional-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--primary);
  background: none;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 9px 16px;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
  justify-content: center;
  font-weight: 600;
}
.toggle-optional-btn:hover {
  background: var(--primary-xs);
  border-color: var(--primary);
}
.toggle-optional-btn .arrow { transition: transform .3s; }
.toggle-optional-btn.open .arrow { transform: rotate(180deg); }

/* ── Search Bar ──────────────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
  min-width: 240px;
}
.search-bar:focus-within {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-glow);
  background: #fff;
}
.search-bar input {
  border: none;
  background: none;
  outline: none;
  font-size: 13px;
  color: var(--text-primary);
  flex: 1;
  font-family: inherit;
}
.search-bar svg { color: var(--text-muted); flex-shrink: 0; }

/* ── Toolbar ─────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Flash Messages ──────────────────────────────────────────── */
.flash-msg {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 18px;
  animation: fadeSlideUp .3s ease;
}
.flash-msg.success {
  background: var(--accent-light);
  color: var(--accent-dark);
  border: 1px solid rgba(111,207,151,.35);
}
.flash-msg.error {
  background: var(--error-light);
  color: #991B1B;
  border: 1px solid rgba(239,68,68,.30);
}

/* ── Toast ───────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  background: var(--text-primary);
  color: #fff;
  box-shadow: var(--shadow-md);
  pointer-events: all;
  animation: toastIn .3s ease forwards;
  max-width: 340px;
  backdrop-filter: blur(12px);
}
.toast.toast-success { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); }
.toast.toast-error   { background: linear-gradient(135deg, #F87171 0%, var(--error) 100%); }
.toast.toast-out { animation: toastOut .3s ease forwards; }

/* ── Modal ───────────────────────────────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(13,43,36,.50);
  backdrop-filter: blur(6px);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-backdrop.show { display: flex; }

.modal {
  background: #fff;
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 500px;
  margin: 20px;
  box-shadow: var(--shadow-lg);
  animation: fadeScaleIn .25s ease;
  border: 1px solid var(--border);
}

.modal-header {
  padding: 22px 26px 18px;
  border-bottom: 1px solid rgba(47,160,132,.10);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(240,250,246,.50);
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--text-primary);
}

.modal-body { padding: 22px 26px; }

.modal-footer {
  padding: 18px 26px 22px;
  border-top: 1px solid rgba(47,160,132,.10);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ═══════════════════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.login-hero {
  background: linear-gradient(160deg, var(--bg-sidebar) 0%, #0a2019 50%, var(--primary-dark) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  position: relative;
  overflow: hidden;
}

.login-hero::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(47,160,132,.20) 0%, transparent 70%);
  border-radius: 50%;
  top: -150px; right: -150px;
}
.login-hero::after {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(111,207,151,.12) 0%, transparent 70%);
  border-radius: 50%;
  bottom: -80px; left: -80px;
}

.login-hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  color: #fff;
}

.login-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(47,160,132,.18);
  border: 1px solid rgba(47,160,132,.30);
  border-radius: 999px;
  padding: 7px 18px;
  font-size: 12px;
  color: var(--secondary);
  margin-bottom: 24px;
  backdrop-filter: blur(8px);
  font-weight: 600;
}

.login-hero-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 38px;
  font-weight: 800;
  margin-bottom: 16px;
  line-height: 1.15;
  letter-spacing: -.03em;
}

.login-hero-desc {
  font-size: 15px;
  color: rgba(255,255,255,.68);
  max-width: 360px;
  margin: 0 auto 36px;
  line-height: 1.75;
}

.login-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
  max-width: 320px;
  margin: 0 auto;
}

.login-feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: rgba(255,255,255,.75);
}

.login-feature-icon {
  width: 28px; height: 28px;
  background: rgba(47,160,132,.20);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  border: 1px solid rgba(47,160,132,.30);
}

.login-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background: var(--bg-warm);
}

.login-form-box {
  width: 100%;
  max-width: 380px;
}

.login-form-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -.03em;
}

.login-form-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 30px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: .04em;
  text-transform: uppercase;
}

.login-input {
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
  background: #fff;
  color: var(--text-primary);
}

.login-input:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-glow);
}

.login-btn {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 13px;
  font-size: 14px;
  font-weight: 700;
  font-family: 'Plus Jakarta Sans', sans-serif;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 6px 20px var(--primary-glow);
  margin-top: 4px;
  letter-spacing: .01em;
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px var(--primary-glow);
  filter: brightness(1.06);
}

.login-footer-note {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 22px;
}

/* ── Page Header ─────────────────────────────────────────────── */
.page-header {
  margin-bottom: 22px;
}

.page-header-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -.03em;
}

.page-header-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ── Avatar ──────────────────────────────────────────────────── */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── Empty State ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 52px 20px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 44px; margin-bottom: 14px; filter: grayscale(.3); }
.empty-state-text { font-size: 14px; color: var(--text-muted); }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  padding: 16px;
}

.page-btn {
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.page-btn:hover { background: var(--primary-light); color: var(--primary); border-color: var(--border-hover); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: var(--shadow-colored); }

/* ── Filter Chips ─────────────────────────────────────────────── */
.filter-chip {
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.filter-chip:hover, .filter-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-colored);
}

/* ── KK Card ─────────────────────────────────────────────────── */
.kk-info-box {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════════════════
   DASHBOARD — Quick Actions
   ═══════════════════════════════════════════════════════════ */
.quick-actions-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 6px 0;
}

/* ═══════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════ */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeScaleIn {
  from { opacity: 0; transform: scale(.94); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(40px); }
}

@keyframes countUp {
  from { opacity: 0; transform: scale(.85); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 var(--primary-glow); }
  70%  { box-shadow: 0 0 0 8px rgba(47,160,132,0); }
  100% { box-shadow: 0 0 0 0 rgba(47,160,132,0); }
}

.animate-fade-up {
  animation: fadeSlideUp .42s cubic-bezier(.4,0,.2,1) both;
}

.anim-delay-1 { animation-delay: .06s; }
.anim-delay-2 { animation-delay: .12s; }
.anim-delay-3 { animation-delay: .18s; }
.anim-delay-4 { animation-delay: .24s; }
.anim-delay-5 { animation-delay: .30s; }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .sidebar {
    width: var(--sidebar-expanded);
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    width: var(--sidebar-expanded);
  }
  .sidebar:hover { width: var(--sidebar-expanded); }

  /* Always show text on mobile when open */
  .sidebar.open .sidebar-text,
  .sidebar.open .sidebar-brand-text,
  .sidebar.open .sidebar-user-info,
  .sidebar.open .nav-section-label {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
  }

  .main-content { margin-left: 0; }
  .hamburger-btn { display: flex; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-grid-2 { grid-template-columns: 1fr; }
  .login-page { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .login-panel { padding: 32px 24px; }
  .topbar-greeting { display: none; }
}

@media (max-width: 768px) {
  .page-content { padding: 16px 18px; }
  .topbar { padding: 0 18px; }
  .topbar-user-info { display: none; }
}

@media (max-width: 640px) {
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search-bar { min-width: unset; }
  .quick-actions-grid { gap: 8px; }
}
