/* =====================================================
   BGN DASHBOARD — Playful Android Material You Design
   ===================================================== */

/* Local Material Symbols Rounded Icon Font (Zero FOIT / Zero Network Delay) */
@font-face {
  font-family: 'Material Symbols Rounded';
  font-style: normal;
  font-weight: 100 700;
  src: url('fonts/material-symbols-rounded.woff2') format('woff2');
  font-display: block;
}

.material-symbols-rounded {
  font-family: 'Material Symbols Rounded', sans-serif;
  font-weight: normal;
  font-style: normal;
  font-size: 22px;
  line-height: 1;
  width: 22px;
  height: 22px;
  letter-spacing: normal;
  text-transform: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'liga';
  vertical-align: middle;
  flex-shrink: 0;
}

.sym-sm,
.material-symbols-rounded.sym-sm {
  font-size: 18px !important;
  width: 18px !important;
  height: 18px !important;
}

.sym-xs,
.material-symbols-rounded.sym-xs {
  font-size: 14px !important;
  width: 14px !important;
  height: 14px !important;
}

.sym-lg,
.material-symbols-rounded.sym-lg {
  font-size: 26px !important;
  width: 26px !important;
  height: 26px !important;
}

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800;900&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  /* Dynamic Android-Inspired Palette (Light Mode) */
  --bgn-navy: #1D4ED8;
  --bgn-navy-900: #1E3A8A;
  --bgn-navy-100: #DBEAFE;
  --bgn-navy-50: #EFF6FF;
  
  --bgn-green: #059669;
  --bgn-green-700: #047857;
  --bgn-green-600: #059669;
  --bgn-green-100: #D1FAE5;
  --bgn-green-50: #ECFDF5;

  --bgn-gold: #D97706;
  --bgn-gold-700: #B45309;
  --bgn-gold-600: #D97706;
  --bgn-gold-500: #F59E0B;
  --bgn-gold-100: #FEF3C7;

  --bgn-cyan: #0284C7;
  --bgn-purple: #7C3AED;
  --bgn-rose: #E11D48;

  /* Material You Design Tokens */
  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --on-primary: #FFFFFF;
  --primary-ctn: #DBEAFE;
  --on-primary-ctn: #1E3A8A;

  --secondary: #D97706;
  --secondary-ctn: #FEF3C7;
  --on-secondary-ctn: #78350F;

  --tertiary: #059669;
  --tertiary-ctn: #D1FAE5;
  --on-tertiary-ctn: #064E3B;

  --error: #E11D48;
  --error-ctn: #FFE4E6;
  --on-error-ctn: #881337;

  --success: #059669;
  --success-ctn: #D1FAE5;
  --warning: #D97706;
  --warning-ctn: #FEF3C7;

  --surface: #F0F4F9;
  --surface-0: #FFFFFF;
  --surface-1: #F8FAFC;
  --surface-2: #EDF2F7;
  --surface-3: #E2E8F0;

  --on-surface: #0F172A;
  --on-surface-v: #475569;
  --outline: #94A3B8;
  --outline-v: rgba(148, 163, 184, 0.22);
  --inv-primary: #93C5FD;

  /* Organic Rounded Geometry */
  --r-xs: 10px;
  --r-sm: 14px;
  --r-md: 20px;
  --r-lg: 28px;
  --r-xl: 36px;
  --r-full: 9999px;

  /* Playful Android Elevations & Shadows */
  --shadow-card: 0 4px 16px -2px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.03);
  --shadow-hover: 0 12px 28px -4px rgba(37, 99, 235, 0.12), 0 6px 14px -2px rgba(15, 23, 42, 0.04);
  --shadow-modal: 0 24px 48px -12px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(148, 163, 184, 0.15);
  --shadow-chip: 0 2px 8px rgba(15, 23, 42, 0.04);

  /* Friendly Approachable Typography */
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-display: 'Outfit', 'Plus Jakarta Sans', sans-serif;

  /* Legacy Compat */
  --md-sys-color-primary: var(--primary);
  --md-sys-color-on-primary: var(--on-primary);
  --md-sys-color-surface: var(--surface);
  --md-sys-color-on-surface: var(--on-surface);
  --md-sys-color-outline: var(--outline);
  --md-sys-color-outline-variant: var(--outline-v);
  --md-sys-color-on-surface-variant: var(--on-surface-v);
  --md-sys-color-error: var(--error);
  --md-sys-color-on-error: #FFFFFF;
  --md-sys-color-surface-container-lowest: var(--surface-0);
  --md-sys-color-surface-container-low: var(--surface-1);
  --md-sys-color-surface-container: var(--surface-2);
  --md-sys-color-surface-container-high: var(--surface-3);
  --md-sys-color-primary-container: var(--primary-ctn);
  --md-sys-color-on-primary-container: var(--on-primary-ctn);
  --md-sys-color-secondary-container: var(--secondary-ctn);
  --md-sys-color-on-secondary-container: var(--on-secondary-ctn);
  --md-sys-color-tertiary: var(--tertiary);
  --md-sys-color-tertiary-container: var(--tertiary-ctn);
  --md-sys-color-on-tertiary-container: var(--on-tertiary-ctn);
  --md-sys-color-error-container: var(--error-ctn);
  --md-sys-color-on-error-container: var(--on-error-ctn);
  --md-sys-color-warning: var(--warning);
  --md-sys-color-warning-container: var(--warning-ctn);
  --md-sys-color-on-warning-container: var(--on-secondary-ctn);
  --md-sys-color-success: var(--success);
  --md-sys-color-success-container: var(--success-ctn);
  --md-sys-color-inverse-primary: var(--inv-primary);
  --md-primary: var(--primary);
  --md-on-surface-variant: var(--on-surface-v);
  --md-outline-variant: var(--outline-v);
  --md-surface-container: var(--surface-2);
  --md-surface-container-low: var(--surface-1);
  --md-on-primary: var(--on-primary);
  --md-on-surface: var(--on-surface);
  --md-success: var(--success);
  --md-success-container: var(--success-ctn);
}

/* Luminous Expressive Dark Theme */
.dark {
  --primary: #60A5FA;
  --primary-hover: #93C5FD;
  --on-primary: #0F172A;
  --primary-ctn: #1E3A8A;
  --on-primary-ctn: #EFF6FF;

  --secondary: #FBBF24;
  --secondary-ctn: #78350F;
  --on-secondary-ctn: #FEF3C7;

  --tertiary: #34D399;
  --tertiary-ctn: #064E3B;
  --on-tertiary-ctn: #ECFDF5;

  --error: #FB7185;
  --error-ctn: #881337;
  --on-error-ctn: #FFE4E6;

  --success: #34D399;
  --success-ctn: #064E3B;
  --warning: #FBBF24;
  --warning-ctn: #78350F;

  --surface: #0B0F19;
  --surface-0: #111827;
  --surface-1: #182234;
  --surface-2: #1E293B;
  --surface-3: #2A384F;

  --on-surface: #F8FAFC;
  --on-surface-v: #94A3B8;
  --outline: #475569;
  --outline-v: rgba(255, 255, 255, 0.08);

  --shadow-card: 0 4px 16px -2px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
  --shadow-hover: 0 12px 30px -4px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(96, 165, 250, 0.3);
  --shadow-modal: 0 24px 48px -12px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1);
  --shadow-chip: 0 2px 8px rgba(0, 0, 0, 0.3);

  --bgn-navy-900: #60A5FA;
  --bgn-navy-100: #1E3A8A;
  --bgn-navy-50: #182234;
  --bgn-green-700: #34D399;
  --bgn-green-600: #34D399;
  --bgn-green-100: #064E3B;
  --bgn-green-50: #042F24;
  --bgn-gold-700: #FBBF24;
  --bgn-gold-600: #FBBF24;
  --bgn-gold-500: #FCD34D;
  --bgn-gold-100: #78350F;
  --bgn-cyan: #38BDF8;
  --bgn-purple: #A78BFA;
  --bgn-rose: #FB7185;
}

/* =====================================================
   GLOBAL RESET & TYPOGRAPHY
   ===================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100%;
  scroll-behavior: smooth;
}

body {
  font: 14.5px/1.55 var(--font);
  color: var(--on-surface);
  background: var(--surface);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  font-weight: 500;
  transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

h1, h2, h3, h4, .top-bar-title, .login-headline, .m3-kpi-value {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
}

img {
  max-width: 100%;
  height: auto;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
  outline: none;
}

input, select, textarea {
  font-family: inherit;
}

a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--primary-hover);
}

/* =====================================================
   PLAYFUL ANDROID LOGIN SCREEN
   ===================================================== */
#loginScreen {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(37, 99, 235, 0.12) 0%, transparent 40%),
              radial-gradient(circle at 80% 80%, rgba(5, 150, 105, 0.10) 0%, transparent 40%),
              radial-gradient(circle at 50% 50%, rgba(217, 119, 6, 0.06) 0%, transparent 50%),
              var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.login-surface {
  background: var(--surface-0);
  border: 1.5px solid var(--outline-v);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 420px;
  padding: 44px 36px 36px;
  box-shadow: var(--shadow-modal);
  animation: playfulPopIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(16px);
}

.login-surface::before {
  content: '';
  position: absolute;
  top: -80px;
  right: -80px;
  width: 200px;
  height: 200px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.25), rgba(56, 189, 248, 0.2));
  border-radius: 50%;
  filter: blur(40px);
  pointer-events: none;
}

.login-surface::after {
  content: '';
  position: absolute;
  bottom: -60px;
  left: -60px;
  width: 160px;
  height: 160px;
  background: linear-gradient(135deg, rgba(5, 150, 105, 0.2), rgba(245, 158, 11, 0.15));
  border-radius: 50%;
  filter: blur(35px);
  pointer-events: none;
}

@keyframes playfulPopIn {
  0% {
    opacity: 0;
    transform: scale(0.92) translateY(24px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.login-logo-wrap {
  width: 80px;
  height: 80px;
  border-radius: 28px;
  overflow: hidden;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, var(--surface-0), var(--surface-1));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  position: relative;
  z-index: 1;
  border: 2px solid rgba(37, 99, 235, 0.2);
  box-shadow: 0 12px 24px -6px rgba(37, 99, 235, 0.25), 0 0 0 6px rgba(37, 99, 235, 0.06);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.login-logo-wrap:hover {
  transform: rotate(5deg) scale(1.05);
}

.login-logo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.login-headline {
  font: 800 24px/1.2 var(--font-display);
  color: var(--on-surface);
  text-align: center;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
  letter-spacing: -0.02em;
}

.login-supporting {
  font: 500 13.5px/1.5 var(--font);
  color: var(--on-surface-v);
  text-align: center;
  margin-bottom: 28px;
  position: relative;
  z-index: 1;
}

.login-error-banner {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  margin-top: 16px;
  background: var(--error-ctn);
  color: var(--error);
  border-radius: var(--r-md);
  font: 600 13px/1.4 var(--font);
  border: 1.5px solid rgba(225, 29, 72, 0.25);
  animation: shakeError 0.4s ease;
}

.login-error-banner.show, .login-error-banner.visible {
  display: flex;
}

@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.login-footer-note {
  font: 500 12px/1.4 var(--font);
  color: var(--outline);
  text-align: center;
  margin-top: 24px;
  position: relative;
  z-index: 1;
}

/* =====================================================
   PLAYFUL FORM INPUTS (MATERIAL YOU FLOATING)
   ===================================================== */
.m3-text-field {
  position: relative;
  margin-bottom: 18px;
  z-index: 1;
}

.m3-text-field input {
  width: 100%;
  height: 54px;
  padding: 16px 18px 16px 48px;
  font: 500 14.5px/1.5 var(--font);
  color: var(--on-surface);
  background: var(--surface-1);
  border: 2px solid transparent;
  border-radius: var(--r-md);
  outline: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 2px 4px rgba(15, 23, 42, 0.02);
}

.m3-text-field input:hover {
  background: var(--surface-2);
}

.m3-text-field input:focus {
  border-color: var(--primary);
  background: var(--surface-0);
  box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.15), 0 4px 12px rgba(37, 99, 235, 0.08);
}

.m3-text-field label {
  position: absolute;
  left: 48px;
  top: 50%;
  transform: translateY(-50%);
  font: 500 14.5px/1 var(--font);
  color: var(--on-surface-v);
  pointer-events: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background: transparent;
  padding: 0 4px;
}

.m3-text-field input:focus + label,
.m3-text-field input:not(:placeholder-shown) + label {
  top: 2px;
  left: 42px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--primary);
  background: var(--surface-0);
  border-radius: 6px;
}

.m3-field-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--on-surface-v);
  font-size: 22px;
  z-index: 1;
  display: flex;
  align-items: center;
  transition: color 0.2s ease;
}

.m3-text-field input:focus ~ .m3-field-icon,
.m3-text-field:focus-within .m3-field-icon {
  color: var(--primary);
}

.m3-trail-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--on-surface-v);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.m3-trail-btn:hover {
  background: var(--surface-2);
  color: var(--on-surface);
}

/* =====================================================
   PLAYFUL BUTTONS (CAPSULES & PILLS)
   ===================================================== */
.m3-btn-filled {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 24px;
  border: none;
  border-radius: var(--r-full);
  background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
  color: #FFFFFF;
  font: 700 14px/1 var(--font);
  letter-spacing: 0.01em;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

.m3-btn-filled:hover {
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.4);
  transform: translateY(-2px) scale(1.01);
  background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
}

.m3-btn-filled:active {
  transform: translateY(0) scale(0.98);
}

.dark .m3-btn-filled {
  background: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%);
  color: #FFFFFF;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
}

.m3-btn-filled-full {
  width: 100%;
  height: 50px;
  font-size: 15px;
}

.m3-btn-tonal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border: none;
  border-radius: var(--r-full);
  background: var(--secondary-ctn);
  color: var(--on-secondary-ctn);
  font: 700 13px/1 var(--font);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-chip);
}

.m3-btn-tonal:hover {
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.2);
  transform: translateY(-1.5px) scale(1.02);
}

.m3-btn-outlined {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border: 1.5px solid var(--outline-v);
  border-radius: var(--r-full);
  background: var(--surface-0);
  color: var(--on-surface);
  font: 700 13px/1 var(--font);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-chip);
}

.m3-btn-outlined:hover {
  border-color: var(--primary);
  background: var(--surface-1);
  color: var(--primary);
  transform: translateY(-1.5px);
  box-shadow: var(--shadow-card);
}

.m3-btn-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border: none;
  border-radius: var(--r-full);
  background: transparent;
  color: var(--primary);
  font: 700 13.5px/1 var(--font);
  cursor: pointer;
  transition: all 0.2s ease;
}

.m3-btn-text:hover {
  background: var(--primary-ctn);
  color: var(--on-primary-ctn);
}

.m3-btn-error-tonal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border: none;
  border-radius: var(--r-full);
  background: var(--error-ctn);
  color: var(--error);
  font: 700 13px/1 var(--font);
  cursor: pointer;
  transition: all 0.2s ease;
}

.m3-btn-error-tonal:hover {
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.2);
  transform: translateY(-1px);
}

.m3-btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

/* =====================================================
   DASHBOARD TOP APP BAR (FLOATING & TRANSLUCENT)
   ===================================================== */
.m3-top-app-bar {
  background: linear-gradient(135deg, #1E3A8A 0%, #1D4ED8 50%, #2563EB 100%);
  flex-shrink: 0;
  z-index: 50;
  box-shadow: 0 6px 20px rgba(30, 58, 138, 0.25);
  position: relative;
}

.dark .m3-top-app-bar {
  background: linear-gradient(135deg, #0B0F19 0%, #111827 60%, #1E293B 100%);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 1px 0 rgba(255, 255, 255, 0.06);
}

.top-bar-inner {
  max-width: 1540px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.top-bar-logo {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.15);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.top-bar-logo:hover {
  transform: scale(1.08) rotate(-4deg);
}

.top-bar-title-group {
  flex: 1;
  min-width: 0;
}

.top-bar-title {
  font: 800 15.5px/1.2 var(--font-display);
  color: #FFFFFF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.top-bar-subtitle {
  font: 500 12px/1.2 var(--font);
  color: rgba(255, 255, 255, 0.75);
  margin-top: 1px;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-bar-actions .m3-btn-outlined {
  border-color: rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
}

.top-bar-actions .m3-btn-outlined:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.45);
}

.top-bar-actions .m3-btn-tonal {
  background: rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
}

.top-bar-actions .m3-btn-tonal:hover {
  background: rgba(255, 255, 255, 0.3);
}

.top-bar-actions .m3-btn-filled {
  background: #FFFFFF;
  color: #1D4ED8;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.top-bar-actions .m3-btn-filled:hover {
  background: #F8FAFC;
  transform: translateY(-1.5px) scale(1.02);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.top-bar-actions .m3-icon-btn,
.top-bar-actions .theme-toggle {
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  width: 36px;
  height: 36px;
}

.top-bar-actions .m3-icon-btn:hover,
.top-bar-actions .theme-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
  transform: scale(1.06);
}

.top-bar-actions .m3-btn-outlined.btn-logout-m3 {
  border-color: rgba(251, 113, 133, 0.4);
  color: #FFE4E6;
  background: rgba(225, 29, 72, 0.15);
}

.top-bar-actions .m3-btn-outlined.btn-logout-m3:hover {
  background: rgba(225, 29, 72, 0.3);
  border-color: rgba(251, 113, 133, 0.7);
}

/* User Role Chips in Top Bar */
.m3-role-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--r-full);
  font: 800 11.5px/1 var(--font);
  letter-spacing: 0.02em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.m3-role-chip.pusdatin {
  background: rgba(59, 130, 246, 0.25);
  color: #FFFFFF;
  border: 1.5px solid rgba(147, 197, 253, 0.4);
}

.m3-role-chip.bappeda {
  background: rgba(245, 158, 11, 0.25);
  color: #FFFFFF;
  border: 1.5px solid rgba(253, 230, 138, 0.4);
}

/* =====================================================
   PLAYFUL ANDROID TAB BAR (PILL SEGMENTS)
   ===================================================== */
.m3-tab-bar-wrapper {
  background: var(--surface-0);
  padding: 12px 0;
  flex-shrink: 0;
  border-bottom: 1.5px solid var(--outline-v);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.03);
  width: 100%;
  position: relative;
  overflow: hidden;
}

.m3-tab-bar {
  max-width: 1540px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.m3-tab-bar::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.m3-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: max-content;
  gap: 8px;
  padding: 0 18px;
  height: 38px;
  font: 700 13px/1 var(--font);
  color: var(--on-surface);
  background: var(--surface-1);
  border: 1px solid var(--outline-v);
  border-radius: var(--r-full);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
  position: relative;
}

.m3-tab .material-symbols-rounded {
  font-size: 19px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  color: inherit;
}

.m3-tab:hover:not(.active) {
  background: var(--surface-2);
  border-color: rgba(37, 99, 235, 0.4);
  color: var(--primary);
}

.m3-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.28);
}

.m3-tab.active .material-symbols-rounded {
  font-variation-settings: 'FILL' 1, 'wght' 600, 'GRAD' 0, 'opsz' 24;
}

.m3-badge {
  font: 800 10.5px/1 var(--font);
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-full);
  background: var(--error);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(225, 29, 72, 0.3);
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.m3-tab.active .m3-badge {
  background: #FFFFFF;
  color: var(--primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* =====================================================
   MONTH FILTER STRIP (FLOATING CAPSULES)
   ===================================================== */
.m3-chip-strip {
  background: var(--surface);
  padding: 12px 0;
  flex-shrink: 0;
  border-bottom: 1px solid var(--outline-v);
}

.m3-chip-strip-inner {
  max-width: 1540px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.m3-chip-strip-inner::-webkit-scrollbar {
  display: none;
}

.m3-chip-label {
  font: 800 11px/1 var(--font-display);
  color: var(--on-surface-v);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.m3-chip-label .material-symbols-rounded {
  font-size: 17px;
  color: var(--on-surface-v);
}

.m3-chip-row {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
}

.m3-chip-row::-webkit-scrollbar {
  display: none;
}

.m3-filter-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 32px;
  padding: 0 11px;
  border-radius: var(--r-full);
  border: 1px solid var(--outline-v);
  background: var(--surface-0);
  color: var(--on-surface);
  font: 600 11.5px/1 var(--font);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  flex-shrink: 0;
}

.m3-filter-chip:hover:not(.active) {
  background: var(--surface-1);
  border-color: rgba(37, 99, 235, 0.4);
  color: var(--primary);
}

.m3-filter-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
}

.m3-chip-month-label {
  font: 600 11.5px/1 var(--font);
  color: var(--on-surface-v);
  flex-shrink: 0;
  background: var(--surface-0);
  height: 32px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-full);
  border: 1px solid var(--outline-v);
}

.m3-chip-month-label strong {
  color: var(--primary);
  font-weight: 800;
  margin-left: 4px;
}

/* =====================================================
   MAIN DASHBOARD LAYOUT & SCROLLBARS
   ===================================================== */
main.m3-main {
  flex: 1 0 auto;
  min-height: 0;
  max-width: 1540px;
  width: 100%;
  margin: 0 auto;
  padding: 18px 20px 80px;
  scroll-behavior: smooth;
}

main.m3-main::-webkit-scrollbar {
  width: 8px;
}

main.m3-main::-webkit-scrollbar-track {
  background: transparent;
}

main.m3-main::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: var(--r-full);
}

main.m3-main::-webkit-scrollbar-thumb:hover {
  background: var(--outline);
}

.tab-pane {
  display: none;
  animation: fadeInPane 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-pane.active {
  display: block;
}

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

/* Footer */
.m3-footer {
  flex-shrink: 0;
  padding: 10px 24px;
  background: var(--surface-0);
  border-top: 1.5px solid var(--outline-v);
  font: 600 11.5px/1 var(--font);
  color: var(--on-surface-v);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  color: var(--on-surface);
}

/* =====================================================
   PLAYFUL ANDROID KPI WIDGET CARDS
   ===================================================== */
.m3-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.m3-kpi-card {
  background: var(--surface-0);
  border: 1.5px solid var(--outline-v);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.m3-kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  z-index: 1;
}

.m3-kpi-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-4px) scale(1.01);
}

/* Dynamic Gradients for KPI Accents */
.kpi-primary::before { background: linear-gradient(90deg, #2563EB, #60A5FA); }
.kpi-tertiary::before { background: linear-gradient(90deg, #059669, #34D399); }
.kpi-success::before { background: linear-gradient(90deg, #D97706, #FBBF24); }
.kpi-info::before { background: linear-gradient(90deg, #0284C7, #38BDF8); }
.kpi-purple::before { background: linear-gradient(90deg, #7C3AED, #A78BFA); }

.m3-kpi-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.m3-kpi-label {
  font: 800 11.5px/1.2 var(--font-display);
  color: var(--on-surface-v);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.m3-kpi-icon-container {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.m3-kpi-card:hover .m3-kpi-icon-container {
  transform: scale(1.1) rotate(6deg);
}

.kpi-primary .m3-kpi-icon-container {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.15), rgba(96, 165, 250, 0.25));
  color: #2563EB;
}
.kpi-tertiary .m3-kpi-icon-container {
  background: linear-gradient(135deg, rgba(5, 150, 105, 0.15), rgba(52, 211, 153, 0.25));
  color: #059669;
}
.kpi-success .m3-kpi-icon-container {
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.15), rgba(251, 191, 36, 0.25));
  color: #D97706;
}
.kpi-info .m3-kpi-icon-container {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.15), rgba(56, 189, 248, 0.25));
  color: #0284C7;
}
.kpi-purple .m3-kpi-icon-container {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(167, 139, 250, 0.25));
  color: #7C3AED;
}

.dark .kpi-primary .m3-kpi-icon-container { color: #60A5FA; }
.dark .kpi-tertiary .m3-kpi-icon-container { color: #34D399; }
.dark .kpi-success .m3-kpi-icon-container { color: #FBBF24; }
.dark .kpi-info .m3-kpi-icon-container { color: #38BDF8; }
.dark .kpi-purple .m3-kpi-icon-container { color: #A78BFA; }

.m3-kpi-value {
  font: 800 28px/1 var(--font-display);
  color: var(--on-surface);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  margin-bottom: 8px;
}

.m3-kpi-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font: 600 11.5px/1.3 var(--font);
  color: var(--on-surface-v);
  gap: 6px;
  flex-wrap: wrap;
}

.m3-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  height: 22px;
  border-radius: var(--r-full);
  font: 800 10.5px/1 var(--font);
  letter-spacing: 0.02em;
}

.m3-chip.primary { background: var(--primary-ctn); color: var(--on-primary-ctn); }
.m3-chip.success { background: var(--tertiary-ctn); color: var(--on-tertiary-ctn); }
.m3-chip.tertiary { background: var(--secondary-ctn); color: var(--on-secondary-ctn); }
.m3-chip.secondary { background: rgba(124, 58, 237, 0.12); color: #7C3AED; }
.dark .m3-chip.secondary { background: rgba(167, 139, 250, 0.2); color: #C4B5FD; }
.m3-chip.warning { background: var(--warning-ctn); color: var(--on-secondary-ctn); }

/* Playful Info Banner */
.m3-info-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: linear-gradient(135deg, var(--primary-ctn), rgba(219, 234, 254, 0.5));
  color: var(--on-primary-ctn);
  border-radius: var(--r-md);
  font: 600 13px/1.5 var(--font);
  margin-bottom: 14px;
  border: 1.5px solid rgba(37, 99, 235, 0.15);
  box-shadow: var(--shadow-card);
}

.dark .m3-info-banner {
  background: linear-gradient(135deg, #1E3A8A, #182234);
  color: #EFF6FF;
}

.m3-info-banner.warning {
  background: linear-gradient(135deg, var(--warning-ctn), rgba(254, 243, 199, 0.5));
  color: var(--on-secondary-ctn);
  border-color: rgba(217, 119, 6, 0.2);
}

.dark .m3-info-banner.warning {
  background: linear-gradient(135deg, #78350F, #1E293B);
  color: #FEF3C7;
}

.m3-banner-icon {
  font-size: 22px;
  flex-shrink: 0;
}

/* =====================================================
   PLAYFUL CARDS & GRIDS
   ===================================================== */
.m3-card {
  background: var(--surface-0);
  border: 1.5px solid var(--outline-v);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.m3-card:hover {
  box-shadow: var(--shadow-hover);
  border-color: rgba(37, 99, 235, 0.25);
}

.m3-card-header {
  padding: 16px 20px 10px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.m3-card-title {
  font: 800 15px/1.2 var(--font-display);
  color: var(--on-surface);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}

.m3-card-title .material-symbols-rounded {
  color: var(--primary);
  font-size: 20px;
}

.m3-card-subtitle {
  font: 500 12px/1.3 var(--font);
  color: var(--on-surface-v);
  margin-top: 3px;
}

.m3-card-body {
  padding: 4px 20px 16px;
}

.m3-grid-2-1 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

/* =====================================================
   TABLES & LISTS (ORGANIC SQUIRCLE TABLES)
   ===================================================== */
.m3-table-container,
.table-container {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  position: relative;
  width: 100%;
}

.m3-table-container::-webkit-scrollbar,
.table-container::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

.m3-table-container::-webkit-scrollbar-thumb,
.table-container::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: var(--r-full);
}

.m3-table,
.bgn-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
  font: 600 12.5px/1.4 var(--font);
  white-space: nowrap;
}

.m3-table th,
.bgn-table th {
  background: var(--surface-1);
  color: var(--on-surface-v);
  font: 800 11px/1 var(--font-display);
  padding: 12px 18px;
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 2;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--outline-v);
  white-space: nowrap;
}

.m3-table td,
.bgn-table td {
  padding: 11px 18px;
  border-bottom: 1px solid var(--outline-v);
  color: var(--on-surface);
  transition: background 0.15s ease;
  font-weight: 500;
  white-space: nowrap;
  vertical-align: middle;
}

.m3-table tbody tr,
.bgn-table tbody tr {
  transition: background 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.m3-table tbody tr:hover,
.bgn-table tbody tr:hover {
  background: rgba(37, 99, 235, 0.04);
}

.dark .m3-table tbody tr:hover,
.dark .bgn-table tbody tr:hover {
  background: rgba(96, 165, 250, 0.06);
}

.m3-table tfoot td,
.bgn-table tfoot td {
  font-weight: 800;
  background: var(--surface-1);
  border-top: 2px solid var(--outline-v);
}

/* Pagination container inside card footer */
.m3-table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1.5px solid var(--outline-v);
  background: var(--surface-1);
  border-radius: 0 0 calc(var(--r-lg) - 1.5px) calc(var(--r-lg) - 1.5px);
  gap: 12px;
  flex-wrap: wrap;
}

/* Rounded highlight for simulation month column */
.m3-month-highlight-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border-radius: var(--r-full);
  background: var(--primary-ctn);
  color: var(--on-primary-ctn);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.01em;
}

.m3-month-highlight-cell.is-total {
  background: var(--primary);
  color: #FFFFFF;
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

/* Modal Date Grid */
.m3-modal-date-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

@media (max-width: 600px) {
  .m3-modal-date-grid {
    grid-template-columns: 1fr;
  }
}

/* Status Tags (Organic Playful Pills with Live Dot) */
.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  line-height: 1.2;
  letter-spacing: 0.02em;
}

.tag-green {
  background: rgba(5, 150, 105, 0.12);
  color: #059669;
  border: 1px solid rgba(5, 150, 105, 0.25);
}
.tag-red {
  background: rgba(225, 29, 72, 0.12);
  color: #E11D48;
  border: 1px solid rgba(225, 29, 72, 0.25);
}
.tag-gold {
  background: rgba(217, 119, 6, 0.12);
  color: #D97706;
  border: 1px solid rgba(217, 119, 6, 0.25);
}
.tag-navy {
  background: rgba(37, 99, 235, 0.12);
  color: #2563EB;
  border: 1px solid rgba(37, 99, 235, 0.25);
}
.tag-slate {
  background: rgba(148, 163, 184, 0.15);
  color: #64748B;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.dark .tag-green {
  background: rgba(52, 211, 153, 0.18);
  color: #34D399;
  border-color: rgba(52, 211, 153, 0.35);
}
.dark .tag-red {
  background: rgba(251, 113, 133, 0.18);
  color: #FB7185;
  border-color: rgba(251, 113, 133, 0.35);
}
.dark .tag-gold {
  background: rgba(251, 191, 36, 0.18);
  color: #FBBF24;
  border-color: rgba(251, 191, 36, 0.35);
}
.dark .tag-navy {
  background: rgba(96, 165, 250, 0.18);
  color: #60A5FA;
  border-color: rgba(96, 165, 250, 0.35);
}
.dark .tag-slate {
  background: rgba(148, 163, 184, 0.15);
  color: #94A3B8;
  border-color: rgba(148, 163, 184, 0.25);
}

/* Action Buttons inside Tables */
.bgn-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 30px;
  padding: 0 12px;
  border: none;
  border-radius: var(--r-full);
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-white {
  background: var(--surface-1);
  color: var(--on-surface);
  border: 1.5px solid var(--outline-v);
  box-shadow: var(--shadow-chip);
}

.btn-white:hover {
  background: var(--surface-0);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1.5px);
  box-shadow: var(--shadow-card);
}

.btn-gold {
  background: linear-gradient(135deg, var(--primary), #1D4ED8);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-gold:hover {
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
  transform: translateY(-1.5px) scale(1.02);
}

.btn-sm {
  height: 28px;
  padding: 0 10px;
  font-size: 11px;
}

/* =====================================================
   FILTER PANEL & DROPDOWNS (GOOGLE MATERIAL YOU PILLS)
   ===================================================== */
.m3-filter-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.m3-filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1;
}

.m3-search-wrap {
  position: relative;
  flex: 0 1 280px;
  min-width: 200px;
}

.m3-search-input,
.m3-search-wrap input {
  width: 100%;
  height: 40px;
  padding: 0 16px 0 42px;
  border: 1.5px solid var(--outline-v);
  border-radius: var(--r-full);
  background: var(--surface-0);
  font: 600 13px/1 var(--font);
  color: var(--on-surface);
  outline: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1.5px 4px rgba(15, 23, 42, 0.04);
}

.m3-search-input:focus,
.m3-search-wrap input:focus {
  border-color: var(--primary);
  background: var(--surface-0);
  box-shadow: 0 0 0 3.5px rgba(37, 99, 235, 0.18), 0 2px 8px rgba(37, 99, 235, 0.08);
}

.m3-search-wrap .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary);
  font-size: 19px;
  pointer-events: none;
}

.m3-select {
  height: 40px;
  padding: 0 38px 0 16px;
  border: 1.5px solid var(--outline-v);
  border-radius: var(--r-full);
  background: var(--surface-0);
  font: 700 12.5px/1 var(--font);
  color: var(--on-surface);
  outline: none;
  appearance: none;
  -webkit-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.5 2L6 6.5L10.5 2' stroke='%232563EB' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1.5px 4px rgba(15, 23, 42, 0.04);
  cursor: pointer;
}

.m3-select:hover {
  border-color: var(--primary);
  background-color: var(--surface-1);
}

.m3-select:focus {
  border-color: var(--primary);
  background-color: var(--surface-0);
  box-shadow: 0 0 0 3.5px rgba(37, 99, 235, 0.18), 0 2px 8px rgba(37, 99, 235, 0.08);
}

/* =====================================================
   PLAYFUL ANDROID MODALS & DIALOGS
   ===================================================== */
.m3-dialog-scrim {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.m3-dialog-scrim.show {
  display: flex;
}

.m3-dialog {
  background: var(--surface-0);
  border: 1.5px solid var(--outline-v);
  border-radius: var(--r-xl);
  width: 100%;
  box-shadow: var(--shadow-modal);
  animation: modalPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@keyframes modalPop {
  0% {
    opacity: 0;
    transform: scale(0.94) translateY(20px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.m3-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px 14px;
  border-bottom: 1.5px solid var(--outline-v);
  flex-shrink: 0;
}

.m3-dialog-title {
  font: 800 17px/1.2 var(--font-display);
  color: var(--on-surface);
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.01em;
}

.m3-dialog-title .material-symbols-rounded {
  color: var(--primary);
  font-size: 22px;
}

.m3-dialog-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.m3-dialog-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 24px;
  border-top: 1.5px solid var(--outline-v);
  background: var(--surface-1);
  flex-shrink: 0;
}

.m3-form-item {
  margin-bottom: 16px;
}

.m3-form-item label {
  display: block;
  font: 800 12px/1 var(--font-display);
  color: var(--on-surface-v);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.m3-form-hint {
  font: 500 12.5px/1.4 var(--font);
  color: var(--on-surface-v);
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-clean {
  width: 100%;
  height: 44px;
  padding: 0 16px;
  border: 1.5px solid var(--outline-v);
  border-radius: var(--r-md);
  background: var(--surface-1);
  font: 600 14px/1 var(--font);
  color: var(--on-surface);
  outline: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.input-clean:focus {
  border-color: var(--primary);
  background: var(--surface-0);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

textarea.input-clean {
  height: auto;
  padding: 12px 16px;
  resize: vertical;
}

/* =====================================================
   PLAYFUL TOAST / SNACKBAR
   ===================================================== */
#toastContainer {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.m3-snackbar, .m3-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  border-radius: var(--r-full);
  font: 700 13px/1 var(--font);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.25);
  animation: toastPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  color: #FFFFFF;
  background: #0F172A;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.dark .m3-snackbar, .dark .m3-toast {
  background: #1E293B;
}

@keyframes toastPop {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* =====================================================
   MISCELLANEOUS UTILITIES
   ===================================================== */
.text-slate-500 { color: var(--on-surface-v); }
.text-slate-700 { color: var(--on-surface); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-danger { color: var(--error); }
.text-emerald-600, .text-emerald-700 { color: var(--success); }
.text-center { text-align: center; }
.tabular { font-variant-numeric: tabular-nums; }
.hide-sm { display: inline; }
@media (max-width: 600px) { .hide-sm { display: none; } }
.sym-sm { font-size: 18px; vertical-align: middle; }

/* Dark mode text overrides */
.dark .text-slate-800,
.dark .text-slate-700,
.dark .text-slate-600 {
  color: var(--on-surface) !important;
}
.dark .text-slate-500,
.dark .text-slate-400 {
  color: var(--on-surface-v) !important;
}

/* =====================================================
   RESPONSIVE DESIGN & MOBILE BOTTOM NAV
   ===================================================== */
.tab-txt-full { display: inline; }
.tab-txt-short { display: none; }

@media (min-width: 769px) {
  .tab-calc-btn {
    border-left: 2px solid var(--outline-v);
    margin-left: 4px;
    padding-left: 16px !important;
  }
}

/* Base Table Container with Horizontal Scroll */
.m3-table-container,
.table-container {
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  border-radius: var(--r-md);
  box-shadow: inset -4px 0 6px -3px rgba(0, 0, 0, 0.04);
}

@media (max-width: 1200px) {
  .m3-kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .m3-grid-2-1 { grid-template-columns: 1fr; }
}

@media (max-width: 1024px) {
  .top-bar-inner { padding: 0 16px; height: 54px; }
  .top-bar-subtitle { font-size: 11px; }
  .top-bar-actions { gap: 6px; }
  .m3-kpi-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
}

@media (max-width: 768px) {
  /* Smooth natural scrolling on mobile */
  html, body {
    height: auto !important;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  #dashboardApp {
    height: auto !important;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible !important;
  }

  /* Compact Sleek Fixed Top App Bar */
  .m3-top-app-bar {
    position: sticky;
    top: 0;
    z-index: 60;
    background: linear-gradient(135deg, #1E3A8A 0%, #1D4ED8 50%, #2563EB 100%) !important;
    box-shadow: 0 4px 16px rgba(30, 58, 138, 0.35);
    border-bottom: 1.5px solid rgba(255, 255, 255, 0.2);
  }

  .dark .m3-top-app-bar {
    background: linear-gradient(135deg, #0B0F19 0%, #111827 60%, #1E293B 100%) !important;
    border-bottom: 1.5px solid rgba(255, 255, 255, 0.08);
  }

  .top-bar-inner {
    padding: 0 10px;
    height: 50px;
    min-height: 50px;
    gap: 6px;
    flex-wrap: nowrap;
    justify-content: space-between;
  }

  .top-bar-logo {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 9px;
    padding: 2px;
    background: rgba(255, 255, 255, 0.2);
    border: 1.5px solid rgba(255, 255, 255, 0.4);
  }

  .top-bar-title-group {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
  }

  .top-bar-title {
    font-size: 13px;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #FFFFFF !important;
  }

  .top-bar-subtitle {
    display: none;
  }

  .top-bar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
  }

  /* Transform top-bar buttons into sleek round icon buttons on mobile with high contrast */
  .top-bar-actions .m3-btn-outlined,
  .top-bar-actions .m3-btn-tonal,
  .top-bar-actions .btn-portal-home,
  .theme-toggle {
    width: 32px;
    height: 32px;
    min-width: 32px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    font-size: 0;
    color: #FFFFFF !important;
    background: rgba(255, 255, 255, 0.18) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.4) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  }

  .top-bar-actions .m3-btn-outlined:active,
  .top-bar-actions .btn-portal-home:active,
  .theme-toggle:active {
    background: rgba(255, 255, 255, 0.3) !important;
    transform: scale(0.95);
  }

  .top-bar-actions .m3-btn-filled {
    width: 32px;
    height: 32px;
    min-width: 32px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    font-size: 0;
    background: #FFFFFF !important;
    color: #1D4ED8 !important;
    border: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  }

  .top-bar-actions .m3-btn-filled .sym-sm {
    color: #1D4ED8 !important;
  }

  .top-bar-actions .btn-logout-m3 {
    width: 32px;
    height: 32px;
    min-width: 32px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    font-size: 0;
    background: rgba(225, 29, 72, 0.35) !important;
    color: #FFFFFF !important;
    border: 1.5px solid rgba(254, 202, 202, 0.6) !important;
  }

  .top-bar-actions .sym-sm,
  .theme-toggle .material-symbols-rounded {
    font-size: 18px !important;
    margin: 0;
    color: inherit !important;
  }

  .top-bar-actions .hide-sm {
    display: none !important;
  }

  .m3-role-chip {
    padding: 2px 7px;
    font-size: 9.5px;
    font-weight: 700;
    gap: 3px;
    max-width: 75px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.2) !important;
    color: #FFFFFF !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
  }

  /* Month Filter Strip */
  .m3-chip-strip {
    padding: 6px 0;
    background: var(--surface-1);
    border-bottom: 1px solid var(--outline-v);
  }

  .m3-chip-strip-inner {
    padding: 0 10px;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex-wrap: nowrap;
    align-items: center;
  }

  .m3-chip-strip-inner::-webkit-scrollbar {
    display: none;
  }

  .m3-chip-label {
    font-size: 10.5px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .m3-chip-label .sym-sm {
    font-size: 14px;
  }

  .m3-chip-row {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
  }

  .m3-filter-chip {
    height: 26px;
    padding: 0 8px;
    font-size: 10.5px;
    font-weight: 700;
    flex-shrink: 0;
    border-radius: 9999px;
  }

  .m3-chip-month-label {
    height: 26px;
    padding: 0 7px;
    font-size: 10px;
    flex-shrink: 0;
    white-space: nowrap;
  }

  /* Main Container */
  main.m3-main {
    padding: 10px 10px calc(110px + env(safe-area-inset-bottom, 24px)) !important;
    overflow: visible !important;
  }

  .tab-pane {
    padding-bottom: 32px;
  }

  /* Info Banner */
  .m3-info-banner {
    padding: 9px 11px;
    font-size: 11.5px;
    line-height: 1.4;
    gap: 7px;
    border-radius: var(--r-sm);
    margin-bottom: 10px;
  }

  .m3-banner-icon {
    font-size: 18px;
    flex-shrink: 0;
  }

  /* 2-Column Balanced KPI Grid */
  .m3-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 10px;
  }

  .m3-kpi-card {
    padding: 10px 10px 8px;
    border-radius: 14px;
  }

  .m3-kpi-card:nth-child(5) {
    grid-column: span 2;
  }

  .m3-kpi-card-top {
    margin-bottom: 3px;
  }

  .m3-kpi-label {
    font-size: 10px;
    font-weight: 700;
  }

  .m3-kpi-icon-container {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    font-size: 16px;
  }

  .m3-kpi-value {
    font-size: 19px;
    line-height: 1.2;
    margin-bottom: 3px;
    font-weight: 800;
  }

  .m3-kpi-footer {
    font-size: 9.5px;
    gap: 3px;
    flex-wrap: wrap;
  }

  .m3-kpi-footer span {
    font-size: 9.5px;
  }

  .m3-chip {
    height: 18px;
    padding: 1px 6px;
    font-size: 8.5px;
  }

  /* Charts & Cards */
  .m3-grid-2-1 {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 10px;
  }

  .m3-card {
    border-radius: 14px;
    margin-bottom: 14px;
  }

  .m3-card-header {
    padding: 10px 12px 6px;
    flex-wrap: wrap;
    gap: 6px;
  }

  .m3-card-title {
    font-size: 13px;
    gap: 5px;
    font-weight: 700;
  }

  .m3-card-subtitle {
    font-size: 10.5px;
    line-height: 1.3;
  }

  .m3-card-body {
    padding: 4px 8px 10px;
  }

  /* Filter Panel & Search */
  .m3-filter-panel {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 10px;
  }

  .m3-filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    width: 100%;
  }

  .m3-search-wrap {
    grid-column: span 2;
    width: 100%;
    min-width: unset;
    flex: unset;
  }

  .m3-search-wrap input {
    height: 38px;
    font-size: 12.5px;
    padding-left: 34px;
  }

  .m3-search-wrap .search-icon {
    left: 10px;
    font-size: 16px;
  }

  .m3-select {
    width: 100%;
    height: 38px;
    font-size: 11.5px;
    padding: 0 24px 0 10px;
    background-position: right 8px center;
  }

  /* Table responsive styling */
  .m3-table-container,
  .table-container {
    max-height: none !important;
    overflow-y: visible !important;
    overflow-x: auto !important;
    border-radius: 12px;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 6px;
  }

  .m3-table th {
    padding: 8px 8px;
    font-size: 10px;
    white-space: nowrap;
  }

  .m3-table td {
    padding: 7px 8px;
    font-size: 11.5px;
    white-space: nowrap;
  }

  .status-tag {
    padding: 2px 6px;
    font-size: 9.5px;
    gap: 3px;
  }

  .m3-month-highlight-cell {
    padding: 2px 6px;
    font-size: 10.5px;
  }

  .m3-table-pagination {
    padding: 10px 12px;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-top: 4px;
  }

  /* Modals & Dialogs */
  .m3-dialog-scrim {
    padding: 8px;
    align-items: center;
  }

  .m3-dialog {
    max-width: 100% !important;
    width: 100%;
    max-height: calc(100dvh - 16px) !important;
    border-radius: 18px;
    display: flex;
    flex-direction: column;
  }

  .m3-dialog-header {
    padding: 12px 14px 8px;
    flex-shrink: 0;
  }

  .m3-dialog-title {
    font-size: 14px;
    gap: 5px;
  }

  .m3-dialog-body {
    padding: 10px 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
  }

  .m3-dialog-footer {
    padding: 8px 12px;
    gap: 6px;
    flex-wrap: wrap;
    flex-shrink: 0;
  }

  .m3-dialog-footer button {
    flex: 1 1 auto;
    justify-content: center;
    font-size: 12px;
    height: 36px;
  }

  .m3-modal-date-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .m3-footer {
    display: none;
  }

  /* 6-Tab Floating Bottom Navigation Bar */
  .m3-tab-bar-wrapper {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    z-index: 80;
    background: var(--surface-0);
    border-top: 1.5px solid var(--outline-v);
    padding: 3px 3px calc(5px + env(safe-area-inset-bottom, 4px));
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(16px);
    overflow: visible;
    box-sizing: border-box;
  }

  .m3-tab-bar {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    max-width: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    gap: 1px;
    overflow: visible;
    justify-items: center;
    align-items: center;
    box-sizing: border-box;
  }

  .tab-txt-full {
    display: none;
  }

  .tab-txt-short {
    display: block;
  }

  .m3-tab {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 48px;
    padding: 2px 1px;
    border: none;
    border-radius: 12px;
    background: transparent;
    position: relative;
    gap: 1px;
    min-width: 0;
    font-size: 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .tab-calc-btn {
    border-left: none !important;
    margin-left: 0 !important;
    padding-left: 1px !important;
  }

  .m3-tab .material-symbols-rounded {
    font-size: 20px;
    line-height: 1;
    color: var(--on-surface-v);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.2s ease;
  }

  .m3-tab-label {
    display: block;
    max-width: 100%;
    overflow: hidden;
  }

  .m3-tab-label .tab-txt-short {
    font: 700 8.5px/1 var(--font);
    color: var(--on-surface-v);
    white-space: nowrap;
    text-align: center;
    letter-spacing: -0.02em;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s ease;
    margin-top: 1px;
  }

  .m3-tab.active {
    background: var(--primary-ctn);
    color: var(--primary);
    box-shadow: none;
    transform: none;
    border: none;
  }

  .m3-tab.active .material-symbols-rounded {
    color: var(--primary);
    font-variation-settings: 'FILL' 1, 'wght' 700;
    transform: scale(1.05);
  }

  .m3-tab.active .m3-tab-label .tab-txt-short {
    color: var(--primary);
    font-weight: 800;
  }

  .m3-tab .m3-badge {
    position: absolute;
    top: 2px;
    right: calc(50% - 13px);
    min-width: 13px;
    height: 13px;
    padding: 0 2px;
    font-size: 8px;
    font-weight: 800;
    border-radius: 9999px;
    background: var(--error);
    color: #FFFFFF;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(225, 29, 72, 0.35);
  }

  .m3-tab.active .m3-badge {
    background: var(--primary);
    color: #FFFFFF;
  }

  /* Toasts */
  #toastContainer {
    bottom: 64px;
    width: calc(100% - 20px);
    max-width: 360px;
  }

  .m3-toast, .m3-snackbar {
    width: 100%;
    justify-content: center;
    font-size: 11.5px;
    padding: 8px 14px;
  }
}

@media (max-width: 480px) {
  .login-surface {
    padding: 24px 16px 18px;
    border-radius: 22px;
    margin: 8px;
  }

  .login-logo-wrap {
    width: 58px;
    height: 58px;
    border-radius: 16px;
    margin-bottom: 10px;
  }

  .login-headline {
    font-size: 18px;
    margin-bottom: 3px;
  }

  .login-supporting {
    font-size: 11.5px;
    margin-bottom: 16px;
  }

  .m3-text-field {
    margin-bottom: 10px;
  }

  .m3-text-field input {
    height: 46px;
    font-size: 14px;
  }

  .m3-btn-filled-full {
    height: 44px;
    font-size: 13.5px;
  }

  .top-bar-title {
    font-size: 12px;
  }

  .m3-tab-label .tab-txt-short {
    font-size: 8px;
  }

  .m3-tab .material-symbols-rounded {
    font-size: 19px;
  }

  .m3-kpi-value {
    font-size: 17.5px;
  }
}

/* =====================================================
   KALKULATOR PENDAPATAN & ANGGARAN SPPG STYLING
   ===================================================== */
.calc-hero-card {
  background: linear-gradient(135deg, var(--surface-0) 0%, var(--surface-1) 100%);
  border: 1.5px solid var(--outline-v);
  border-radius: var(--r-lg);
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(12px);
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
}

.calc-hero-card::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.14) 0%, rgba(37, 99, 235, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
}

.calc-grid-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 24px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  align-items: start;
}

@media (min-width: 1080px) {
  .calc-grid-layout {
    grid-template-columns: 420px minmax(0, 1fr);
    gap: 22px;
    align-items: stretch;
  }
}

@media (min-width: 1400px) {
  .calc-grid-layout {
    grid-template-columns: 440px minmax(0, 1fr);
    gap: 24px;
  }
}

.calc-params-card {
  background: var(--surface-0);
  border: 1.5px solid var(--outline-v);
  border-radius: var(--r-md);
  padding: 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
}

.calc-results-card {
  background: var(--surface-0);
  border: 1.5px solid var(--outline-v);
  border-radius: var(--r-md);
  padding: 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 100%;
}

.calc-breakdown-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.calc-breakdown-table-box {
  background: var(--surface-1);
  border: 1.5px solid var(--outline-v);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  box-sizing: border-box;
}

.calc-chart-box {
  background: var(--surface-1);
  border: 1.5px solid var(--outline-v);
  border-radius: var(--r-sm);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  box-sizing: border-box;
  justify-content: space-between;
  min-height: 260px;
}

.calc-chart-canvas-wrap {
  position: relative;
  height: 240px;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.calc-chart-canvas-wrap canvas {
  max-height: 240px !important;
  width: 100% !important;
  margin: 0 auto;
}

.calc-table-header-wrap {
  padding: 16px 20px;
  border-bottom: 1.5px solid var(--outline-v);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  box-sizing: border-box;
}

@media (min-width: 1080px) {
  .calc-table-header-wrap {
    flex-wrap: nowrap;
  }
  .calc-table-header-wrap .calc-filter-row-aligned {
    flex-wrap: nowrap;
    flex: 0 0 auto;
    justify-content: flex-end;
  }
}

.calc-form-group {
  margin-bottom: 10px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.calc-form-group:last-child {
  margin-bottom: 0;
}

.calc-form-group label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font: 600 11.5px/15px var(--font);
  color: var(--on-surface-v);
  margin-bottom: 5px;
  min-width: 0;
  box-sizing: border-box;
}

.calc-form-group .calc-hint {
  font: 600 10px/14px var(--font);
  color: var(--primary);
  background: rgba(37, 99, 235, 0.1);
  padding: 1.5px 7px;
  border-radius: var(--r-full);
  flex-shrink: 0;
}

.calc-input-row {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.calc-input-prefix {
  position: absolute;
  left: 11px;
  font: 700 12px/16px var(--font);
  color: var(--primary);
  pointer-events: none;
  z-index: 2;
}

.calc-input-suffix {
  position: absolute;
  right: 11px;
  font: 600 11px/16px var(--font);
  color: var(--on-surface-v);
  pointer-events: none;
  z-index: 2;
}

.calc-input-control {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  height: 38px;
  border-radius: var(--r-xs);
  border: 1.5px solid var(--outline-v);
  background: var(--surface-0);
  color: var(--on-surface);
  font: 700 12.5px/18px var(--font);
  padding: 6px 12px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.calc-input-control.has-prefix {
  padding-left: 36px;
}

.calc-input-control.has-suffix {
  padding-right: 64px;
}

.calc-input-control:focus {
  border-color: var(--primary);
  background: var(--surface-0);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Proportion bar */
.calc-ratio-bar-wrap {
  margin-top: 6px;
  margin-bottom: 8px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.calc-ratio-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  display: flex;
  overflow: hidden;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.calc-ratio-segment-pk {
  background: var(--primary);
  transition: width 0.3s ease;
}

.calc-ratio-segment-pb {
  background: var(--success);
  transition: width 0.3s ease;
}

.calc-kpi-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

@media (min-width: 1080px) {
  .calc-kpi-summary-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
  }
}

/* Seamless Continuous Rounded Border KPI Boxes */
.calc-kpi-pill-box {
  background: var(--surface-1);
  border: 1.5px solid var(--outline-v);
  border-top: 3.5px solid var(--primary);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
}

.calc-kpi-pill-box.kpi-box-success { border-top-color: var(--success); }
.calc-kpi-pill-box.kpi-box-warning { border-top-color: var(--warning); }
.calc-kpi-pill-box.kpi-box-purple { border-top-color: #7C3AED; }

.calc-kpi-pill-box:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-chip);
  border-color: rgba(37, 99, 235, 0.4);
}

.calc-kpi-pill-box .calc-kpi-title {
  font: 700 10.5px/14px var(--font);
  color: var(--on-surface-v);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  box-sizing: border-box;
}

.calc-kpi-pill-box .calc-kpi-val {
  font: 800 18px/22px var(--font-display);
  color: var(--on-surface);
  letter-spacing: -0.3px;
  box-sizing: border-box;
}

.calc-kpi-pill-box .calc-kpi-sub {
  font: 600 11px/15px var(--font);
  color: var(--on-surface-v);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
}

.calc-breakdown-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
  white-space: nowrap;
  box-sizing: border-box;
}

.calc-breakdown-table th {
  background: var(--surface-2);
  color: var(--on-surface-v);
  font: 700 11px/16px var(--font);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 11px 16px;
  text-align: left;
  border-bottom: 2px solid var(--outline-v);
  white-space: nowrap;
  box-sizing: border-box;
}

.calc-breakdown-table td {
  padding: 11px 16px;
  font: 500 12.5px/17px var(--font);
  color: var(--on-surface);
  border-bottom: 1px solid var(--outline-v);
  white-space: nowrap;
  vertical-align: middle;
  box-sizing: border-box;
}

.calc-breakdown-table tr:hover td {
  background: rgba(37, 99, 235, 0.03);
}

.calc-breakdown-table tr.total-row td {
  font-size: 13px;
  font-weight: 800;
  color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
  border-top: 2px solid var(--primary);
}

.calc-mode-segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: var(--surface-2);
  border: 1.5px solid var(--outline-v);
  padding: 3px;
  border-radius: var(--r-full);
  gap: 3px;
  margin-bottom: 10px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.calc-mode-btn {
  width: 100%;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 6px 8px;
  border-radius: var(--r-full);
  font: 700 11.5px/15px var(--font);
  color: var(--on-surface-v);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  box-sizing: border-box;
}

.calc-mode-btn.active {
  background: var(--surface-0);
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.calc-selected-row {
  background: rgba(37, 99, 235, 0.09) !important;
  box-shadow: inset 3.5px 0 0 var(--primary);
}

.calc-context-banner {
  background: var(--surface-1);
  border: 1.5px solid var(--outline-v);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.metric-strip-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.metric-pill-item {
  background: var(--surface-0);
  border: 1.5px solid var(--outline-v);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  box-shadow: var(--shadow-chip);
  transition: transform 0.2s ease;
  box-sizing: border-box;
  min-width: 0;
}

.metric-pill-item:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.metric-pill-label {
  font: 700 10.5px/14px var(--font);
  color: var(--on-surface-v);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.metric-pill-val {
  font: 800 18px/22px var(--font-display);
  color: var(--on-surface);
  margin-top: 3px;
}

.metric-pill-sub {
  font: 500 10.5px/13px var(--font);
  color: var(--on-surface-v);
  margin-top: 2px;
}

.m3-month-highlight-col {
  background: rgba(37, 99, 235, 0.09) !important;
  color: var(--primary) !important;
  font-weight: 800 !important;
}

/* =====================================================
   ULTRA-CLEAN KINETIC DROPDOWN COMPONENT (MATERIAL 3)
   ===================================================== */
.kinetic-dropdown {
  position: relative;
  width: 100%;
  user-select: none;
  box-sizing: border-box;
}

/* Trigger Button */
.dropdown-trigger {
  width: 100%;
  min-height: 48px;
  padding: 8px 16px;
  background: var(--surface-0);
  border: 1.5px solid var(--outline-v);
  border-radius: var(--r-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-chip);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.dropdown-trigger:hover {
  border-color: rgba(37, 99, 235, 0.4);
  background: var(--surface-1);
  transform: translateY(-1px);
}

.kinetic-dropdown.active .dropdown-trigger {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18), 0 8px 24px -4px rgba(37, 99, 235, 0.12);
  background: var(--surface-0);
}

/* Label Group */
.label-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  min-width: 0;
  overflow: hidden;
}

.sub-label {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--on-surface-v);
  transition: color 0.2s ease;
}

.kinetic-dropdown.active .sub-label {
  color: var(--primary);
}

.main-label {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--on-surface);
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Minimalist Toggle Indicator (Dynamic Kinetic Lines) */
.toggle-indicator {
  width: 16px;
  height: 12px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  flex-shrink: 0;
  margin-left: 10px;
}

.indicator-line {
  height: 2px;
  background-color: var(--on-surface-v);
  border-radius: 2px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.line-top { width: 16px; }
.line-bottom { width: 9px; }

.dropdown-trigger:hover .indicator-line {
  background-color: var(--on-surface);
}

.kinetic-dropdown.active .indicator-line {
  background-color: var(--primary);
}

.kinetic-dropdown.active .line-top {
  transform: translateY(5px) rotate(45deg);
}

.kinetic-dropdown.active .line-bottom {
  width: 16px;
  transform: translateY(-5px) rotate(-45deg);
}

.kinetic-dropdown.active {
  z-index: 99999 !important;
}

.m3-filter-row:has(.kinetic-dropdown.active),
.m3-filter-panel:has(.kinetic-dropdown.active),
.calc-section-box:has(.kinetic-dropdown.active),
.calc-params-card:has(.kinetic-dropdown.active),
.calc-form-group:has(.kinetic-dropdown.active),
.m3-form-item:has(.kinetic-dropdown.active),
.m3-dialog:has(.kinetic-dropdown.active),
.m3-modal-content:has(.kinetic-dropdown.active) {
  z-index: 99999 !important;
  position: relative;
}

/* Dropdown Flyout Panel */
.dropdown-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: min(92vw, 380px);
  background: var(--surface-0);
  border: 1.5px solid var(--outline-v);
  border-radius: var(--r-md);
  padding: 6px;
  list-style: none;
  z-index: 99999;
  box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(20px);
  box-sizing: border-box;

  /* Kinetic Reveal Animation */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-8px) scale(0.97);
  transform-origin: top center;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.2s;
}

.kinetic-dropdown.active .dropdown-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Dropdown Search Box */
.dropdown-search-wrap {
  padding: 4px 6px 8px;
  border-bottom: 1px solid var(--outline-v);
  margin-bottom: 4px;
}

.dropdown-search-input {
  width: 100%;
  height: 34px;
  background: var(--surface-1);
  border: 1px solid var(--outline-v);
  border-radius: var(--r-xs);
  padding: 0 12px;
  font: 600 12px/1 var(--font);
  color: var(--on-surface);
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}

.dropdown-search-input:focus {
  border-color: var(--primary);
}

/* Scroll Area */
.dropdown-panel-scroll {
  position: relative;
  max-height: 240px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}

.dropdown-panel-scroll::-webkit-scrollbar {
  width: 5px;
}

.dropdown-panel-scroll::-webkit-scrollbar-thumb {
  background: var(--outline);
  border-radius: 4px;
}

/* Floating Hover Pill */
.hover-pill {
  position: absolute;
  left: 4px;
  width: calc(100% - 8px);
  height: 44px;
  background: rgba(37, 99, 235, 0.12);
  border-radius: var(--r-xs);
  pointer-events: none !important;
  opacity: 0;
  transition: transform 0.18s cubic-bezier(0.2, 0, 0, 1), opacity 0.15s ease;
  z-index: 1;
}

/* List Items */
.dropdown-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
  z-index: 2;
}

.panel-item {
  position: relative;
  min-height: 42px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: var(--r-xs);
  cursor: pointer;
  z-index: 3;
  transition: background-color 0.15s ease, color 0.15s ease;
  box-sizing: border-box;
  text-decoration: none;
}

.panel-item * {
  pointer-events: none;
}

.panel-item-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  text-align: left;
}

.panel-item-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel-item-sub {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--on-surface-v);
}

.panel-item:hover .panel-item-title {
  color: var(--primary);
}

.panel-item.selected {
  color: var(--primary);
}

.panel-item.selected .panel-item-title {
  color: var(--primary);
  font-weight: 800;
}

/* Tag Status */
.item-tag {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: var(--r-full);
  background: var(--surface-2);
  color: var(--on-surface-v);
  transition: all 0.2s ease;
  flex-shrink: 0;
  margin-left: 8px;
}

.panel-item.selected .item-tag {
  background: var(--primary);
  color: #FFFFFF;
}

/* Compact Kinetic Dropdown Variant (for Forms & Filter Panels) */
.kinetic-dropdown.dropdown-compact .dropdown-trigger {
  min-height: 40px;
  height: 40px;
  padding: 4px 14px;
  border-radius: var(--r-full);
  background: var(--surface-0);
  border: 1.5px solid var(--outline-v);
  box-shadow: 0 1.5px 4px rgba(15, 23, 42, 0.04);
}

.kinetic-dropdown.dropdown-compact .dropdown-panel {
  min-width: 210px;
  width: max-content;
  max-width: 320px;
}

.kinetic-dropdown.dropdown-compact .sub-label {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.6px;
  line-height: 1;
}

.kinetic-dropdown.dropdown-compact .main-label {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.2;
}

.m3-filter-row .kinetic-dropdown {
  flex: 0 1 200px;
  min-width: 155px;
}

/* Universal Form & Modal Kinetic Dropdown Integration */
.m3-form-item .kinetic-dropdown,
.calc-form-group .kinetic-dropdown,
.m3-dialog .kinetic-dropdown {
  width: 100%;
  position: relative;
  display: block;
}

.m3-form-item .kinetic-dropdown .dropdown-trigger,
.calc-form-group .kinetic-dropdown .dropdown-trigger,
.m3-dialog .kinetic-dropdown .dropdown-trigger {
  width: 100%;
  box-sizing: border-box;
  border-radius: 10px;
  min-height: 42px;
  height: 42px;
}

.m3-form-item .kinetic-dropdown .dropdown-panel,
.calc-form-group .kinetic-dropdown .dropdown-panel,
.m3-dialog .kinetic-dropdown .dropdown-panel {
  z-index: 99999;
  width: 100%;
  min-width: 100%;
  box-shadow: 0 14px 35px -6px rgba(0, 0, 0, 0.35), 0 0 0 1px var(--outline-v);
}

/* =====================================================
   RESPONSIVE MOBILE CALC REDESIGN (NATIVE QUALITY)
   ===================================================== */
@media (max-width: 768px) {
  /* Calculator Module Strict Frame Bounding on Mobile */
  #tab-kalkulator {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }

  .calc-hero-card,
  .calc-params-card,
  .calc-results-card,
  .calc-section-box,
  .calc-context-banner,
  .calc-mode-segmented,
  .calc-kpi-pill-box,
  .m3-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  .calc-results-card > div,
  .m3-table-container,
  .table-scroll-container {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box !important;
  }

  .m3-filter-row .kinetic-dropdown {
    flex: 1 1 calc(50% - 4px);
    min-width: 130px;
    max-width: 100%;
  }

  /* Hero Banner */
  .calc-hero-card {
    padding: 14px 12px;
    border-radius: 14px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--surface-0) 0%, var(--surface-1) 100%);
    border: 1.5px solid var(--outline-v);
    box-shadow: var(--shadow-card);
  }

  .calc-hero-card h2 {
    font-size: 15px !important;
    line-height: 20px !important;
    font-weight: 800 !important;
  }

  .calc-hero-card p {
    font-size: 12px !important;
    line-height: 16px !important;
    margin-top: 4px !important;
    color: var(--on-surface-v) !important;
  }

  .calc-hero-card .m3-btn-tonal,
  .calc-hero-card .m3-btn-filled {
    flex: 1 1 auto;
    justify-content: center;
    height: 36px;
    padding: 0 12px;
    font-size: 12px;
    border-radius: 10px;
    font-weight: 700;
  }

  /* Grid Layout */
  .calc-grid-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    margin-bottom: 16px;
    width: 100%;
  }

  /* Primary Parameter Card & Results Card */
  .calc-params-card,
  .calc-results-card {
    padding: 16px 14px;
    border-radius: 16px;
    border: 1.5px solid var(--outline-v);
    background: var(--surface-0);
    box-shadow: var(--shadow-card);
    gap: 12px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Section Sub-Boxes */
  .calc-section-box {
    padding: 12px 12px;
    border-radius: 12px;
    border: 1.5px solid var(--outline-v);
    background: var(--surface-1);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
  }

  .calc-section-header {
    font: 700 11.5px/16px var(--font-display);
    color: var(--on-surface);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 8px;
  }

  /* Segmented Controls */
  .calc-mode-segmented {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 3px;
    gap: 3px;
    height: 36px;
    margin-bottom: 8px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1.5px solid var(--outline-v);
    width: 100%;
    box-sizing: border-box;
  }

  .calc-mode-btn {
    height: 100%;
    padding: 0 4px;
    font: 700 11px/1 var(--font);
    gap: 4px;
    border-radius: 999px;
    border: none;
    background: transparent;
    color: var(--on-surface-v);
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .calc-mode-btn.active {
    background: var(--surface-0);
    color: var(--primary);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  }

  .calc-mode-btn .sym-sm {
    font-size: 15px;
  }

  /* Context Banner */
  .calc-context-banner {
    padding: 10px 12px;
    font-size: 11.5px;
    line-height: 1.45;
    margin-bottom: 8px;
    border-radius: 10px;
    border: 1.5px solid var(--outline-v);
    background: var(--surface-0);
    width: 100%;
    box-sizing: border-box;
  }

  /* Form Groups & Labels */
  .calc-form-group {
    margin-bottom: 8px;
    width: 100%;
    box-sizing: border-box;
  }

  .calc-form-group:last-child {
    margin-bottom: 0;
  }

  .calc-form-group label {
    font: 700 11.5px/15px var(--font);
    color: var(--on-surface-v);
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .calc-form-group .calc-hint {
    font: 600 10px/14px var(--font);
    padding: 1.5px 6px;
    border-radius: 999px;
  }

  /* Input Controls */
  .calc-input-row {
    height: 38px;
    width: 100%;
    position: relative;
    display: flex;
    align-items: center;
    box-sizing: border-box;
  }

  .calc-input-prefix {
    left: 11px;
    font: 700 12px/16px var(--font);
    color: var(--primary);
  }

  .calc-input-suffix {
    right: 11px;
    font: 600 11px/16px var(--font);
    color: var(--on-surface-v);
  }

  .calc-input-control {
    height: 38px;
    font: 700 12.5px/18px var(--font);
    padding: 0 10px;
    border-radius: 8px;
    border: 1.5px solid var(--outline-v);
    background: var(--surface-0);
    color: var(--on-surface);
    width: 100%;
    box-sizing: border-box;
    transition: all 0.2s ease;
  }

  .calc-input-control.has-prefix {
    padding-left: 34px;
  }

  .calc-input-control.has-suffix {
    padding-right: 56px;
  }

  .calc-input-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  }

  /* Ratio Bar */
  .calc-ratio-bar-wrap {
    margin-top: 6px;
    margin-bottom: 6px;
    width: 100%;
  }

  .calc-ratio-bar {
    height: 5px;
    border-radius: 999px;
  }

  /* Summary KPI 2x2 Grid */
  .calc-kpi-summary-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
    margin-bottom: 12px;
    width: 100%;
  }

  .calc-kpi-pill-box {
    padding: 12px 12px 10px;
    border-radius: 12px;
    border: 1.5px solid var(--outline-v);
    border-top: 3.5px solid var(--primary);
    background: var(--surface-1);
    width: 100%;
    box-sizing: border-box;
  }

  .calc-kpi-pill-box .calc-kpi-title {
    font: 700 10px/14px var(--font);
    margin-bottom: 4px;
    gap: 4px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
  }

  .calc-kpi-pill-box .calc-kpi-title .sym-sm {
    font-size: 15px !important;
  }

  .calc-kpi-pill-box .calc-kpi-val {
    font: 800 16px/20px var(--font-display) !important;
    letter-spacing: -0.3px;
  }

  /* Breakdown Table & Chart */
  .calc-breakdown-table th {
    padding: 8px 8px;
    font-size: 10.5px;
  }

  .calc-breakdown-table td {
    padding: 7px 8px;
    font-size: 11.5px;
  }

  .calc-breakdown-table tr.total-row td {
    font-size: 12px;
  }

  /* 49 SPPG Simulation Table Mobile Controls */
  #calcSearchSppgTable {
    max-width: 100% !important;
    width: 100%;
    flex: 1 1 100%;
    height: 38px !important;
  }

  #calcFilterKecamatanTable {
    flex: 1 1 calc(50% - 4px);
    height: 38px !important;
  }
}

@media (max-width: 480px) {
  .calc-kpi-summary-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
  }

  .calc-kpi-pill-box {
    padding: 10px 10px 8px;
  }

  .calc-kpi-pill-box .calc-kpi-val {
    font-size: 14.5px !important;
  }

  .calc-mode-btn {
    font-size: 10px;
    padding: 0 2px;
  }
}

/* Print Optimization */
@media print {
  .m3-top-app-bar, .m3-tab-bar-wrapper, .m3-chip-strip, .m3-filter-panel, .top-bar-actions, #toastContainer, #loginScreen {
    display: none !important;
  }
  body {
    background: #FFFFFF !important;
    height: auto !important;
    overflow: visible !important;
  }
  #dashboardApp {
    height: auto !important;
    overflow: visible !important;
  }
  main.m3-main {
    overflow: visible !important;
    height: auto !important;
    padding: 0 !important;
  }
  .m3-card {
    box-shadow: none !important;
    border: 1px solid #E2E8F0 !important;
  }
  .tab-pane {
    display: block !important;
  }
}

/* ====================================================/* =====================================================
   ENHANCED EXPORT MODAL & GRANULAR DATE FILTER STYLES
   ===================================================== */
.modal-header-icon-badge {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(59, 130, 246, 0.22));
  color: var(--primary, #2563EB);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.15);
}

.dark .modal-header-icon-badge {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(96, 165, 250, 0.1));
  color: #93C5FD;
}

.export-segmented-group {
  display: flex;
  background: var(--surface-container-high, #F1F5F9);
  padding: 4px;
  border-radius: 12px;
  gap: 4px;
  margin-bottom: 16px;
  border: 1px solid var(--outline-v, #E2E8F0);
}

.dark .export-segmented-group {
  background: var(--surface-container-high, #1E293B);
  border-color: var(--outline-v, #334155);
}

.export-segmented-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8.5px 12px;
  border: none;
  background: transparent;
  color: var(--on-surface-variant, #64748B);
  font: 700 12.5px/18px 'Plus Jakarta Sans', sans-serif;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  white-space: nowrap;
}

.export-segmented-btn .material-symbols-rounded {
  font-size: 18px;
}

.export-segmented-btn.active {
  background: var(--primary, #2563EB);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
}

.dark .export-segmented-btn.active {
  background: var(--primary, #3B82F6);
  color: #FFFFFF;
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.35);
}

/* Format specific active colors */
.export-segmented-btn#btnExportFmtExcel.active {
  background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.32) !important;
}

.export-segmented-btn#btnExportFmtPdf.active {
  background: linear-gradient(135deg, #E11D48 0%, #BE123C 100%) !important;
  box-shadow: 0 2px 8px rgba(225, 29, 72, 0.32) !important;
}

.export-preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  margin-bottom: 14px;
}

.export-preset-chip {
  padding: 5px 11px;
  border-radius: 8px;
  font: 600 11.5px/16px 'Plus Jakarta Sans', sans-serif;
  background: var(--surface-container, #F8FAFC);
  color: var(--on-surface, #334155);
  border: 1px solid var(--outline-v, #E2E8F0);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.dark .export-preset-chip {
  background: var(--surface-container, #1E293B);
  color: var(--on-surface, #CBD5E1);
  border-color: var(--outline-v, #334155);
}

.export-preset-chip:hover {
  background: rgba(37, 99, 235, 0.08);
  color: var(--primary, #1E40AF);
  border-color: var(--primary, #2563EB);
  transform: translateY(-1px);
}

.dark .export-preset-chip:hover {
  background: rgba(59, 130, 246, 0.2);
  color: #93C5FD;
  border-color: #3B82F6;
}

.export-preset-chip:active {
  transform: scale(0.97);
}

.export-preview-card {
  background: linear-gradient(135deg, rgba(248, 250, 252, 0.95), rgba(241, 245, 249, 0.8));
  border: 1.5px solid var(--outline-v, #E2E8F0);
  border-radius: 14px;
  padding: 14px 16px;
  margin-top: 14px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
}

.dark .export-preview-card {
  background: linear-gradient(135deg, #0F172A, #1E293B);
  border-color: var(--outline-v, #334155);
}

.export-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font: 800 11.5px/16px 'Plus Jakarta Sans', sans-serif;
  color: var(--primary, #2563EB);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  gap: 8px;
  flex-wrap: wrap;
}

.dark .export-preview-header {
  color: #60A5FA;
}

.export-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.export-metric-item {
  background: var(--surface, #FFFFFF);
  border: 1px solid var(--outline-v, #E2E8F0);
  border-radius: 10px;
  padding: 8px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 56px;
}

.dark .export-metric-item {
  background: var(--surface-container, #1E293B);
  border-color: var(--outline-v, #334155);
}

.export-metric-val {
  font: 800 14px/18px var(--font-display, 'Outfit', sans-serif);
  color: var(--on-surface, #0F172A);
  letter-spacing: -0.2px;
}

.dark .export-metric-val {
  color: #F8FAFC;
}

.export-metric-val.highlight-cost {
  color: var(--success, #059669);
  font-size: 13px;
}

.dark .export-metric-val.highlight-cost {
  color: #34D399;
}

.export-metric-lbl {
  font: 600 10px/13px 'Plus Jakarta Sans', sans-serif;
  color: var(--on-surface-variant, #64748B);
  margin-top: 3px;
}

.dark .export-metric-lbl {
  color: #94A3B8;
}

.export-rule-badge-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.export-rule-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 7px;
  font: 700 11px/14px 'Plus Jakarta Sans', sans-serif;
}

.export-rule-pill.rule-5day {
  background: rgba(37, 99, 235, 0.12);
  color: #1D4ED8;
  border: 1px solid rgba(37, 99, 235, 0.25);
}

.dark .export-rule-pill.rule-5day {
  background: rgba(59, 130, 246, 0.18);
  color: #93C5FD;
  border-color: rgba(59, 130, 246, 0.35);
}

.export-rule-pill.rule-6day {
  background: rgba(5, 150, 105, 0.12);
  color: #047857;
  border: 1px solid rgba(5, 150, 105, 0.25);
}

.dark .export-rule-pill.rule-6day {
  background: rgba(16, 185, 129, 0.18);
  color: #6EE7B7;
  border-color: rgba(16, 185, 129, 0.35);
}

/* =====================================================
   TYPOGRAPHY & FORM CONTROL REFINEMENTS (DROPDOWNS & INPUTS)
   ===================================================== */
.input-clean,
select.input-clean,
input[type="date"].input-clean,
.m3-select {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  letter-spacing: -0.15px !important;
  padding: 10px 14px !important;
  border-radius: 10px !important;
  border: 1.5px solid var(--outline-v, #E2E8F0) !important;
  background-color: var(--surface, #FFFFFF) !important;
  color: var(--on-surface, #0F172A) !important;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  width: 100%;
  box-sizing: border-box;
}

/* Custom Sleek Chevron SVG Arrow for all native select elements */
select.input-clean,
select.m3-select {
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 14px center !important;
  background-size: 16px 16px !important;
  padding-right: 38px !important;
  cursor: pointer;
}

select.input-clean option,
select.m3-select option {
  background-color: var(--surface, #FFFFFF);
  color: var(--on-surface, #0F172A);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 12px;
}

.dark select.input-clean,
.dark select.m3-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
}

.dark select.input-clean option,
.dark select.m3-select option {
  background-color: #1E293B;
  color: #F8FAFC;
}

.dark .input-clean,
.dark select.input-clean,
.dark input[type="date"].input-clean,
.dark .m3-select {
  background-color: var(--surface-container, #1E293B) !important;
  border-color: var(--outline-v, #334155) !important;
  color: var(--on-surface, #F8FAFC) !important;
}

.input-clean:hover,
select.input-clean:hover,
input[type="date"].input-clean:hover,
.m3-select:hover {
  border-color: rgba(37, 99, 235, 0.45) !important;
}

.input-clean:focus,
select.input-clean:focus,
input[type="date"].input-clean:focus,
.m3-select:focus {
  border-color: var(--primary, #2563EB) !important;
  box-shadow: 0 0 0 3.5px rgba(37, 99, 235, 0.15) !important;
  outline: none !important;
}

/* Calculator Operational Schedule Box */
.calc-schedule-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 8px;
  font: 700 11.5px/16px 'Plus Jakarta Sans', sans-serif;
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary, #1D4ED8);
  border: 1px solid rgba(37, 99, 235, 0.2);
  margin-top: 6px;
}

.dark .calc-schedule-badge {
  background: rgba(59, 130, 246, 0.15);
  color: #93C5FD;
  border-color: rgba(59, 130, 246, 0.3);
}

.calc-schedule-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

/* =====================================================
   MOBILE DIALOG & EXPORT MODAL OPTIMIZATIONS
   ===================================================== */
@media (max-width: 640px) {
  .m3-dialog-scrim {
    padding: 10px;
    align-items: flex-end;
  }

  .m3-dialog {
    width: 100% !important;
    max-width: 100% !important;
    max-height: calc(100dvh - 20px) !important;
    border-radius: 20px 20px 14px 14px !important;
    margin: 0 !important;
  }

  .m3-dialog-header {
    padding: 14px 16px 12px;
  }

  .m3-dialog-title {
    font-size: 15.5px !important;
  }

  .m3-dialog-body {
    padding: 14px 16px;
  }

  .m3-dialog-footer {
    padding: 12px 16px;
    gap: 8px;
  }

  .export-segmented-group {
    padding: 3px;
    gap: 3px;
  }

  .export-segmented-btn {
    padding: 7px 6px;
    font-size: 11px;
    gap: 4px;
  }

  .export-segmented-btn .material-symbols-rounded {
    font-size: 16px;
  }

  .export-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .export-metric-val {
    font-size: 13px;
  }

  .export-metric-lbl {
    font-size: 9.5px;
  }

  .export-preset-chips {
    gap: 4px;
  }

  .export-preset-chip {
    padding: 4px 8px;
    font-size: 10.5px;
  }
}

@media (max-width: 420px) {
  .export-segmented-group#exportFormatGroup {
    flex-direction: column;
  }

  .m3-dialog-footer {
    flex-direction: column-reverse;
  }

  .m3-dialog-footer button {
    width: 100%;
    justify-content: center;
  }
}

/* =====================================================
   MATERIAL 3 CALENDAR COMPONENT (OFFICIAL SPEC)
   ===================================================== */
.m3-calendar-card {
  width: 100%;
  max-width: 100%;
  background-color: var(--surface, #FFFFFF);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
  border: 1.5px solid var(--outline-v, #E2E8F0);
  box-sizing: border-box;
  margin-top: 10px;
}

.dark .m3-calendar-card {
  background-color: var(--surface-container, #1E293B);
  border-color: var(--outline-v, #334155);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

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

.month-year-picker {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--on-surface, #0F172A);
  padding: 6px 10px;
  border-radius: 10px;
  transition: background-color 0.2s ease;
  user-select: none;
}

.dark .month-year-picker {
  color: #F8FAFC;
}

.nav-controls {
  display: flex;
  gap: 4px;
}

.icon-button {
  background: transparent;
  border: none;
  outline: none;
  width: 34px;
  height: 34px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--on-surface-variant, #64748B);
  transition: background-color 0.2s ease, transform 0.1s;
}

.icon-button:hover {
  background-color: var(--surface-container-high, #F1F5F9);
  color: var(--primary, #2563EB);
}

.dark .icon-button:hover {
  background-color: #334155;
  color: #93C5FD;
}

.icon-button:active {
  transform: scale(0.92);
}

/* Weekday Headers */
.weekdays-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  margin-bottom: 6px;
}

.weekday {
  font-size: 11px;
  font-weight: 800;
  color: var(--on-surface-variant, #64748B);
  padding: 6px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dark .weekday {
  color: #94A3B8;
}

/* Days Grid */
.days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  row-gap: 4px;
  column-gap: 4px;
  justify-items: center;
}

.day-cell {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--on-surface, #0F172A);
  border-radius: 9999px;
  cursor: pointer;
  position: relative;
  transition: all 0.18s cubic-bezier(0.2, 0, 0, 1);
  user-select: none;
}

.dark .day-cell {
  color: #F8FAFC;
}

.day-cell:hover:not(.empty):not(.selected) {
  background-color: var(--surface-container-high, #F1F5F9);
}

.dark .day-cell:hover:not(.empty):not(.selected) {
  background-color: #334155;
}

.day-cell.empty {
  cursor: default;
  pointer-events: none;
}

/* Material 3 Highlight States */
.day-cell.today {
  border: 1.5px solid var(--primary, #2563EB);
  color: var(--primary, #2563EB);
  font-weight: 700;
}

.dark .day-cell.today {
  border-color: #3B82F6;
  color: #93C5FD;
}

.day-cell.selected {
  background-color: var(--primary, #2563EB) !important;
  color: #FFFFFF !important;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}

.dark .day-cell.selected {
  background-color: #3B82F6 !important;
  color: #FFFFFF !important;
}

.day-cell.in-range {
  background-color: rgba(37, 99, 235, 0.12) !important;
  color: var(--primary, #1D4ED8) !important;
  border-radius: 6px;
}

.dark .day-cell.in-range {
  background-color: rgba(59, 130, 246, 0.22) !important;
  color: #93C5FD !important;
}

.day-cell.has-event::after {
  content: '';
  position: absolute;
  bottom: 4px;
  width: 4px;
  height: 4px;
  background-color: var(--success, #059669);
  border-radius: 50%;
}

.day-cell.selected.has-event::after {
  background-color: #FFFFFF;
}

.day-cell.is-off {
  color: var(--outline, #94A3B8);
  font-weight: 400;
}

/* Quick Action Chips */
.footer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--outline-v, #E2E8F0);
  gap: 8px;
  flex-wrap: wrap;
}

.dark .footer-actions {
  border-top-color: var(--outline-v, #334155);
}

.m3-button-tonal {
  background-color: rgba(37, 99, 235, 0.1);
  color: var(--primary, #1D4ED8);
  border: none;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dark .m3-button-tonal {
  background-color: rgba(59, 130, 246, 0.18);
  color: #93C5FD;
}

.m3-button-tonal:hover {
  background-color: rgba(37, 99, 235, 0.18);
}

/* =====================================================
   MATERIAL 3 DATEPICKER POPOVER & INPUT TRIGGER
   ===================================================== */
.m3-datepicker-wrap {
  position: relative;
  width: 100%;
}

.m3-datepicker-trigger {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.m3-datepicker-trigger input {
  padding-right: 38px !important;
  cursor: pointer;
}

.m3-datepicker-trigger .m3-datepicker-icon {
  position: absolute;
  right: 12px;
  pointer-events: none;
  color: var(--on-surface-variant, #64748B);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Floating M3 Calendar Popover */
.m3-datepicker-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 320px;
  max-width: calc(100vw - 32px);
  z-index: 1150;
  background: var(--surface, #FFFFFF);
  border: 1.5px solid var(--outline-v, #E2E8F0);
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 20px 45px -10px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.96);
  transform-origin: top left;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.2s;
  box-sizing: border-box;
}

.dark .m3-datepicker-popover {
  background: #1E293B;
  border-color: #334155;
  box-shadow: 0 24px 50px -10px rgba(0, 0, 0, 0.5);
}

.m3-datepicker-popover.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.m3-datepicker-popover .m3-calendar-card {
  margin-top: 0;
  padding: 0;
  border: none;
  box-shadow: none;
  background: transparent;
}

@media (max-width: 640px) {
  .m3-datepicker-popover {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -45%) scale(0.95);
    transform-origin: center center;
    width: calc(100vw - 36px) !important;
    max-width: 340px;
    z-index: 99999 !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
  }

  .m3-datepicker-popover.active {
    transform: translate(-50%, -50%) scale(1);
  }
}

