/* ==========================================================================
   MATERIAL 3 EXPRESSIVE DESIGN TOKENS (IDENTITAS ROSE / AKHWAT BPIBS)
   ========================================================================== */
:root {
  /* Brand & Accent Colors */
  --md-sys-color-primary: #B91C68;
  --md-sys-color-primary-hover: #9E1657;
  --md-sys-color-on-primary: #FFFFFF;
  --md-sys-color-primary-container: #FCE4EE;
  --md-sys-color-on-primary-container: #4A0426;

  --md-sys-color-secondary: #6E4F5B;
  --md-sys-color-on-secondary: #FFFFFF;
  --md-sys-color-secondary-container: #F7E1EA;
  --md-sys-color-on-secondary-container: #2D1520;

  --md-sys-color-tertiary: #8A5300;
  --md-sys-color-on-tertiary: #FFFFFF;
  --md-sys-color-tertiary-container: #FDE7C2;
  --md-sys-color-on-tertiary-container: #2E1900;

  --md-sys-color-error: #BA1A1A;
  --md-sys-color-error-container: #FFDAD6;
  --md-sys-color-on-error-container: #410002;

  /* Semantic Status & Accent Badges */
  --badge-success-bg: #DCFCE7;
  --badge-success-fg: #14532D;
  --badge-success-border: #86EFAC;
  --badge-success-surface: #F3FBF6;
  --badge-success-header: #E6F8ED;

  --badge-purple-bg: #EDE9FE;
  --badge-purple-fg: #4C1D95;
  --badge-purple-border: #DDD6FE;

  /* Balanced Warm-Alabaster Neutral Surfaces */
  --md-sys-color-background: #FCF9FA;
  --md-sys-color-on-background: #1F191B;
  --md-sys-color-surface: #FCF9FA;
  --md-sys-color-surface-container-lowest: #FFFFFF;
  --md-sys-color-surface-container-low: #F8F1F4;
  --md-sys-color-surface-container: #F2E7EC;
  --md-sys-color-surface-container-high: #EADCE2;
  --md-sys-color-on-surface: #1F191B;
  --md-sys-color-on-surface-variant: #54454A;
  --md-sys-color-outline: #857379;
  --md-sys-color-outline-variant: #DFCFD5;

  /* Unified Shape Scale */
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-pill: 9999px;

  /* Motion & Elevation */
  --spring-easing: cubic-bezier(0.34, 1.56, 0.64, 1);
  --standard-easing: cubic-bezier(0.2, 0, 0, 1);
  --card-shadow: 0 1px 3px rgba(31, 25, 27, 0.04), 0 4px 12px rgba(31, 25, 27, 0.03);
  --card-hover-shadow: 0 8px 20px rgba(185, 28, 104, 0.09), 0 2px 6px rgba(31, 25, 27, 0.04);
  --menu-shadow: 0 16px 38px rgba(31, 25, 27, 0.2), 0 4px 10px rgba(31, 25, 27, 0.08);
  --focus-ring: 0 0 0 3px rgba(185, 28, 104, 0.26);
}

html {
  scroll-behavior: smooth;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  background-color: var(--md-sys-color-background);
  color: var(--md-sys-color-on-background);
  line-height: 1.5;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.font-display {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

button, input, textarea {
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.svg-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ==========================================================================
   EXPRESSIVE HERO HEADER
   ========================================================================== */
.hero-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #B91C68 0%, #D42473 52%, #7F1541 100%);
  color: #FFFFFF;
  border-radius: var(--radius-xl);
  padding: 18px 18px 20px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 12px 28px rgba(185, 28, 104, 0.2);
}

@media (min-width: 768px) {
  .hero-card {
    padding: 22px 28px 24px;
  }
}

.hero-card::before,
.hero-card::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.hero-card::before {
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(255, 222, 167, 0.24) 0%, rgba(255, 222, 167, 0) 70%);
  top: -90px;
  right: -50px;
}

.hero-card::after {
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(167, 243, 208, 0.16) 0%, rgba(167, 243, 208, 0) 70%);
  bottom: -80px;
  right: 120px;
}

.school-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.2;
  min-width: 0;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(22, 13, 17, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 600;
}

.sync-sheet-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #FFFFFF;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.18s var(--standard-easing), transform 0.18s var(--spring-easing);
}

.sync-sheet-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.28);
}

.sync-sheet-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.sync-sheet-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.hero-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(1.3rem, 4vw, 1.8rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.22;
}

/* ==========================================================================
   EXPRESSIVE M3 SURFACE CARDS & CONTAINERS
   ========================================================================== */
.m3-card-xl {
  background-color: var(--md-sys-color-surface-container-lowest);
  border-radius: var(--radius-xl);
  border: 1px solid var(--md-sys-color-outline-variant);
  box-shadow: var(--card-shadow);
}

.m3-tonal-box {
  background-color: var(--md-sys-color-surface-container-low);
  border-radius: var(--radius-md);
  border: 1px solid var(--md-sys-color-outline-variant);
}

.m3-tertiary-box {
  background-color: #F5F3FF;
  border-radius: var(--radius-md);
  border: 1px solid var(--badge-purple-border);
}

/* Custom Refined Scrollbars */
.table-wrapper::-webkit-scrollbar,
#dlSantriChecklist::-webkit-scrollbar,
#dlProcessLog::-webkit-scrollbar,
#sharedDropdownMenu::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

.table-wrapper::-webkit-scrollbar-track,
#dlSantriChecklist::-webkit-scrollbar-track,
#dlProcessLog::-webkit-scrollbar-track,
#sharedDropdownMenu::-webkit-scrollbar-track {
  background: var(--md-sys-color-surface-container-low);
  border-radius: var(--radius-pill);
}

.table-wrapper::-webkit-scrollbar-thumb,
#dlSantriChecklist::-webkit-scrollbar-thumb,
#dlProcessLog::-webkit-scrollbar-thumb,
#sharedDropdownMenu::-webkit-scrollbar-thumb {
  background: #C9B4BC;
  border-radius: var(--radius-pill);
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
  background: #AB929C;
}

/* ==========================================================================
   STICKY TABLE STYLING
   ========================================================================== */
.table-wrapper {
  max-height: 72vh;
  overflow: auto;
  position: relative;
  border-top: 1px solid var(--md-sys-color-outline-variant);
}

table.rapor-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

table.rapor-table thead tr.header-row-1 th {
  position: sticky;
  top: 0;
  height: 50px;
  z-index: 30;
}

table.rapor-table thead tr.header-row-2 th {
  position: sticky;
  top: 50px;
  height: 36px;
  z-index: 30;
}

.sticky-col-1 {
  position: sticky;
  left: 0;
  width: 46px;
  min-width: 46px;
  max-width: 46px;
  z-index: 20;
}

.sticky-col-2 {
  position: sticky;
  left: 46px;
  width: 210px;
  min-width: 210px;
  max-width: 210px;
  z-index: 20;
  box-shadow: 4px 0 12px -4px rgba(31, 25, 27, 0.12);
}

@media (min-width: 640px) {
  .sticky-col-2 {
    width: 276px;
    min-width: 276px;
    max-width: 276px;
  }
}

table.rapor-table thead th.sticky-col-1,
table.rapor-table thead th.sticky-col-2 {
  z-index: 45 !important;
}

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}

input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* ==========================================================================
   M3 EXPRESSIVE FORM INPUTS
   ========================================================================== */
.cell-input {
  width: 100%;
  border: 1.5px solid var(--md-sys-color-outline-variant);
  border-radius: 10px;
  padding: 7px 10px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  line-height: 1.45;
  color: var(--md-sys-color-on-surface);
  background-color: var(--md-sys-color-surface-container-lowest);
  transition: border-color 0.18s var(--standard-easing), box-shadow 0.18s var(--standard-easing), background-color 0.18s;
}

.cell-input::placeholder,
.card-input::placeholder {
  color: var(--md-sys-color-outline);
  font-weight: 400;
}

.cell-input:hover,
.cell-num:hover,
.card-input:hover,
.card-num:hover {
  border-color: var(--md-sys-color-outline);
}

.cell-input:focus {
  outline: none;
  border-color: var(--md-sys-color-primary);
  background-color: #FFFBFD;
  box-shadow: 0 0 0 3px var(--md-sys-color-primary-container);
}

.cell-num {
  width: 100%;
  min-width: 58px;
  border: 1.5px solid var(--md-sys-color-outline-variant);
  border-radius: 10px;
  padding: 7px 4px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--md-sys-color-on-surface);
  background-color: var(--md-sys-color-surface-container-lowest);
  transition: border-color 0.18s var(--standard-easing), box-shadow 0.18s var(--standard-easing);
}

.cell-num::placeholder,
.card-num::placeholder {
  color: #AE9CA2;
  font-weight: 500;
}

.cell-num:focus {
  outline: none;
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 3px var(--md-sys-color-primary-container);
}

.card-input {
  width: 100%;
  border: 1.5px solid var(--md-sys-color-outline-variant);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--md-sys-color-on-surface);
  background-color: var(--md-sys-color-surface-container-lowest);
  transition: border-color 0.18s var(--standard-easing), box-shadow 0.18s var(--standard-easing);
}

.card-input:focus {
  outline: none;
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 3px var(--md-sys-color-primary-container);
}

.card-num {
  width: 100%;
  border: 1.5px solid var(--md-sys-color-outline-variant);
  border-radius: var(--radius-md);
  padding: 10px 4px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 15.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--md-sys-color-on-surface);
  background-color: var(--md-sys-color-surface-container-lowest);
  transition: border-color 0.18s var(--standard-easing), box-shadow 0.18s var(--standard-easing), transform 0.2s var(--spring-easing);
}

.card-num:focus {
  outline: none;
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 3px var(--md-sys-color-primary-container);
  transform: scale(1.015);
}

/* ==========================================================================
   GOOGLE FORM STYLE DROPDOWN TRIGGER
   ========================================================================== */
.dd-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  border: 1.5px solid var(--md-sys-color-outline-variant);
  background-color: var(--md-sys-color-surface-container-lowest);
  color: var(--md-sys-color-on-surface);
  font-family: 'Plus Jakarta Sans', sans-serif;
  text-align: left;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s, transform 0.18s var(--spring-easing);
}

.dd-trigger:hover {
  border-color: var(--md-sys-color-outline);
  background-color: var(--md-sys-color-surface-container-low);
}

.dd-trigger:active {
  transform: scale(0.985);
}

.dd-trigger.is-open {
  border-color: var(--md-sys-color-primary);
  border-width: 2px;
  box-shadow: 0 0 0 3px var(--md-sys-color-primary-container);
}

.dd-trigger.dd-control {
  border-radius: var(--radius-md);
  padding: 9px 13px;
  min-height: 48px;
  font-size: 13.5px;
  font-weight: 700;
  box-shadow: var(--card-shadow);
}

.dd-trigger.dd-cell {
  border-radius: 10px;
  padding: 7px 9px;
  min-height: 36px;
  font-size: 13px;
  font-weight: 600;
}

.dd-trigger.dd-card {
  border-radius: var(--radius-md);
  padding: 10px 14px;
  min-height: 48px;
  font-size: 14px;
  font-weight: 700;
}

.dd-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.dd-chevron {
  width: 20px;
  height: 20px;
  color: var(--md-sys-color-on-surface-variant);
  flex-shrink: 0;
  transition: transform 0.22s var(--spring-easing), color 0.18s;
}

.dd-trigger.is-open .dd-chevron {
  transform: rotate(180deg);
  color: var(--md-sys-color-primary);
}

/* Floating M3 Menu & Modal Animations */
@keyframes m3MenuPop {
  0% {
    opacity: 0;
    transform: scale(0.97) translateY(-6px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.m3-menu-animate {
  animation: m3MenuPop 0.18s var(--standard-easing) forwards;
}

@keyframes m3DialogPop {
  0% {
    opacity: 0;
    transform: scale(0.95) translateY(8px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.m3-dialog-animate {
  animation: m3DialogPop 0.2s var(--standard-easing) forwards;
}

/* ==========================================================================
   M3 EXPRESSIVE BUTTONS (PRIMARY ROSE & SECONDARY/PURPLE ACCENT)
   ========================================================================== */
.m3-fab {
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  border-radius: var(--radius-pill);
  box-shadow: 0 3px 12px rgba(185, 28, 104, 0.26);
  transition: background-color 0.18s var(--standard-easing), box-shadow 0.18s var(--standard-easing), transform 0.18s var(--spring-easing);
}

.m3-fab:hover:not(:disabled) {
  background-color: var(--md-sys-color-primary-hover);
  box-shadow: 0 6px 18px rgba(185, 28, 104, 0.34);
  transform: translateY(-1px);
}

.m3-fab:active:not(:disabled) {
  transform: scale(0.97);
}

.m3-fab:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.m3-btn-tertiary {
  background-color: #5B21B6;
  color: #FFFFFF;
  font-family: 'Plus Jakarta Sans', sans-serif;
  border-radius: var(--radius-pill);
  box-shadow: 0 3px 12px rgba(91, 33, 182, 0.22);
  transition: background-color 0.18s var(--standard-easing), box-shadow 0.18s var(--standard-easing), transform 0.18s var(--spring-easing);
}

.m3-btn-tertiary:hover:not(:disabled) {
  background-color: #4C1D95;
  box-shadow: 0 5px 16px rgba(76, 29, 149, 0.3);
  transform: translateY(-1px);
}

.m3-btn-tertiary:active:not(:disabled) {
  transform: scale(0.97);
}

.m3-btn-tertiary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.santri-card-elevated {
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.santri-card-elevated:hover {
  box-shadow: var(--card-hover-shadow);
}

.mobile-safe-footer {
  bottom: max(0.75rem, env(safe-area-inset-bottom));
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}