/* ==========================================================================
   FEBI-UIN Madura Edition - Design Tokens & Styling
   Baba Gas CertifyPro - Enterprise Certificate Studio
   ========================================================================== */

:root {
  /* M3 Dark Theme Tonal Palette (Indigo / Violet Baseline) */
  --md-sys-color-primary: #bac3ff;
  --md-sys-color-on-primary: #08218a;
  --md-sys-color-primary-container: #2b3b9f;
  --md-sys-color-on-primary-container: #dee0ff;

  --md-sys-color-secondary: #c6c4dd;
  --md-sys-color-on-secondary: #2f2f42;
  --md-sys-color-secondary-container: #454559;
  --md-sys-color-on-secondary-container: #e2e0f9;

  --md-sys-color-tertiary: #e9b9d3;
  --md-sys-color-on-tertiary: #46263b;
  --md-sys-color-tertiary-container: #5f3c52;
  --md-sys-color-on-tertiary-container: #ffd8ec;

  --md-sys-color-surface: #121318;
  --md-sys-color-on-surface: #e4e1e9;
  --md-sys-color-surface-dim: #121318;
  --md-sys-color-surface-bright: #39393f;
  --md-sys-color-surface-container-lowest: #0d0e13;
  --md-sys-color-surface-container-low: #1b1b21;
  --md-sys-color-surface-container: #1f1f25;
  --md-sys-color-surface-container-high: #29292f;
  --md-sys-color-surface-container-highest: #34343a;

  --md-sys-color-outline: #90909a;
  --md-sys-color-outline-variant: #46464f;
  --md-sys-color-error: #ffb4ab;
  --md-sys-color-on-error: #690005;
  --md-sys-color-error-container: #93000a;
  --md-sys-color-on-error-container: #ffdad6;

  /* Custom Functional Accents */
  --md-sys-color-success: #7cd992;
  --md-sys-color-on-success: #003915;
  --md-sys-color-success-container: #005322;
  --md-sys-color-gold: #ffd976;
  --md-sys-color-on-gold: #432c00;
  --md-sys-color-gold-container: #604100;

  /* M3 Typography Scale */
  --md-sys-typescale-display-large-font: 'Plus Jakarta Sans', 'Outfit', sans-serif;
  --md-sys-typescale-headline-medium-font: 'Plus Jakarta Sans', sans-serif;
  --md-sys-typescale-title-medium-font: 'Plus Jakarta Sans', sans-serif;
  --md-sys-typescale-body-medium-font: 'Inter', -apple-system, sans-serif;
  --md-sys-typescale-label-large-font: 'Plus Jakarta Sans', sans-serif;

  /* M3 Shape System */
  --md-sys-shape-corner-none: 0px;
  --md-sys-shape-corner-extra-small: 4px;
  --md-sys-shape-corner-small: 8px;
  --md-sys-shape-corner-medium: 12px;
  --md-sys-shape-corner-large: 16px;
  --md-sys-shape-corner-extra-large: 28px;
  --md-sys-shape-corner-full: 9999px;

  /* M3 Motion & Easing */
  --md-sys-motion-easing-emphasized: cubic-bezier(0.2, 0.0, 0, 1.0);
  --md-sys-motion-duration-short: 150ms;
  --md-sys-motion-duration-medium: 300ms;
  --md-sys-motion-duration-long: 500ms;

  /* Tonal Elevation Shadows */
  --md-sys-elevation-1: 0px 1px 3px 1px rgba(0, 0, 0, 0.25), 0px 1px 2px 0px rgba(0, 0, 0, 0.35);
  --md-sys-elevation-2: 0px 2px 6px 2px rgba(0, 0, 0, 0.3), 0px 1px 2px 0px rgba(0, 0, 0, 0.4);
  --md-sys-elevation-3: 0px 4px 8px 3px rgba(0, 0, 0, 0.35), 0px 1px 3px 0px rgba(0, 0, 0, 0.45);
}

/* Base HTML & Mobile Density Scaling */
html {
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
}

@media (max-width: 768px) {
  html {
    font-size: 13.5px; /* Scales down mobile fonts by ~15%, fitting much more UI content on screen */
  }
}

@media (max-width: 380px) {
  html {
    font-size: 12.5px;
  }
}

/* Base Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--md-sys-typescale-body-medium-font);
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Material Symbols Integration */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
  font-size: 20px;
}

.material-symbols-outlined.filled {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ==========================================================================
   M3 Top App Bar & Responsive Actions (Solid & Elegant Glass Edition)
   ========================================================================== */
.m3-top-app-bar {
  position: sticky;
  top: 0;
  z-index: 90;
  height: 64px;
  min-height: 64px;
  background-color: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  gap: 1rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  box-sizing: border-box;
}

.m3-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  flex-shrink: 0;
}

.m3-brand-avatar {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
  background-color: #0f172a;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.m3-brand-avatar:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 22px rgba(99, 102, 241, 0.6), 0 0 0 1.5px rgba(255, 255, 255, 0.28);
}

.m3-brand-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.m3-brand-title {
  font-family: var(--md-sys-typescale-display-large-font);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--md-sys-color-on-surface);
  line-height: 1.1;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.m3-brand-badge {
  font-size: 0.625rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(99, 102, 241, 0.18);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.35);
  line-height: 1;
}

.m3-brand-subtext {
  font-size: 0.675rem;
  color: var(--md-sys-color-outline);
  letter-spacing: 0.02em;
  line-height: 1.1;
  white-space: nowrap;
}

/* M3 Navigation Segmented Pill Tabs */
.m3-nav-pill-group,
.m3-nav-tabs {
  display: flex !important;
  align-items: center;
  background-color: rgba(30, 41, 59, 0.85);
  backdrop-filter: blur(12px);
  padding: 3px 4px;
  border-radius: var(--md-sys-shape-corner-full);
  border: 1px solid rgba(255, 255, 255, 0.12);
  gap: 3px;
  flex-shrink: 0 !important;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.m3-nav-tab,
.m3-tab-btn {
  background: transparent;
  border: none;
  color: var(--md-sys-color-on-surface-variant, #cbd5e1);
  padding: 7px 16px;
  border-radius: var(--md-sys-shape-corner-full);
  font-family: var(--md-sys-typescale-label-large-font);
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
  transition: all var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-emphasized);
  user-select: none;
}

.m3-nav-tab:hover,
.m3-tab-btn:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--md-sys-color-on-surface);
}

.m3-nav-tab.active,
.m3-tab-btn.active {
  background-color: var(--md-sys-color-primary);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
}

/* Categorized Header Dropdown Nav Groups */
.m3-header-nav-group {
  position: relative;
  display: inline-flex;
}

.m3-tab-text-short {
  display: none;
}

.m3-header-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  min-width: 280px;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.08);
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10500;
  backdrop-filter: blur(20px);
  pointer-events: none;
}

/* DESKTOP PENUH: Nonaktifkan popup dropdown */
@media (min-width: 1180px) {
  .m3-header-dropdown {
    display: none !important;
  }
  .m3-nav-arrow {
    display: none !important;
  }
  .m3-desktop-only-nav {
    display: inline-flex !important;
  }
}

/* LAYAR DIPERSEMPIT: Aktifkan popup dropdown HANYA saat diklik / berstatus .open (Bukan hover) */
@media (max-width: 1179px) {
  .m3-header-nav-group.open .m3-header-dropdown {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateX(-50%) translateY(0) !important;
    pointer-events: auto !important;
    display: block !important;
  }
  .m3-nav-arrow {
    display: inline-block !important;
  }
  .m3-desktop-only-nav {
    display: none !important;
  }
}

.m3-header-dropdown-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 8px 10px;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--md-sys-color-outline, #94a3b8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 4px;
}

.m3-header-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--md-sys-color-on-surface, #f8fafc);
  transition: all 0.15s ease;
  cursor: pointer;
}

.m3-header-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(2px);
}

.m3-header-dropdown-item.active {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.m3-hdd-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.m3-hdd-icon .material-symbols-outlined {
  font-size: 18px;
}

.m3-hdd-text {
  flex: 1;
  min-width: 0;
}

.m3-hdd-title {
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--md-sys-color-on-surface, #f8fafc);
}

.m3-hdd-desc {
  font-size: 0.68rem;
  color: var(--md-sys-color-outline, #94a3b8);
  line-height: 1.25;
  margin-top: 2px;
  white-space: normal;
}

.m3-top-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.m3-top-actions::-webkit-scrollbar {
  display: none;
}

.m3-top-divider {
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, 0.12);
  margin: 0 2px;
  flex-shrink: 0;
}

.m3-top-btn {
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0 14px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
}

.m3-btn-group {
  display: inline-flex;
  align-items: center;
  background: rgba(30, 41, 59, 0.7);
  padding: 2px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.m3-btn-group .m3-top-btn {
  border-radius: 999px;
  height: 34px;
  padding: 0 13px;
  border: none;
}

.m3-btn-hero-dist {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(245, 158, 11, 0.4) !important;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.35);
}

.m3-btn-hero-dist:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(217, 119, 6, 0.5);
}

.m3-global-bottom-bar {
  display: none;
}

/* Responsive Breakpoints for Header and Navigation (Adaptive 2-Tier Architecture) */
@media (min-width: 1180px) {
  .m3-top-app-bar {
    height: 60px;
    min-height: 60px;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    gap: 1rem;
  }
  .m3-brand {
    order: 1;
    flex-shrink: 0;
  }
  .m3-nav-pill-group {
    order: 2;
    flex-shrink: 0;
  }
  .m3-top-actions {
    order: 3;
    flex-shrink: 0;
  }
}

@media (max-width: 1179px) {
  .m3-top-app-bar {
    height: auto;
    min-height: auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 1rem 0.65rem 1rem;
    gap: 0.5rem 0.75rem;
    background-color: rgba(15, 23, 42, 0.97);
  }
  .m3-brand {
    order: 1;
    flex-shrink: 0;
  }
  .m3-top-actions {
    order: 2;
    flex-shrink: 0;
    margin-left: auto;
  }
  .m3-nav-pill-group {
    order: 3;
    width: 100%;
    display: flex !important;
    justify-content: center;
    align-items: center;
    margin-top: 2px;
    padding: 4px;
    flex-shrink: 0;
    overflow: visible !important;
    background: rgba(30, 41, 59, 0.9);
    border-radius: var(--md-sys-shape-corner-full);
  }
  .m3-nav-tab {
    padding: 7px 16px;
    font-size: 0.82rem;
    gap: 0.4rem;
  }
  .m3-brand-subtext {
    display: none;
  }
}

@media (max-width: 768px) {
  .m3-top-app-bar {
    padding: 0.45rem 0.65rem 0.55rem 0.65rem;
    gap: 0.45rem 0.5rem;
  }
  .m3-brand {
    gap: 0.45rem;
  }
  .m3-brand-avatar {
    width: 30px;
    height: 30px;
    border-radius: 8px;
  }
  .m3-brand-title {
    font-size: 0.95rem;
  }
  .m3-brand-badge {
    font-size: 0.52rem;
    padding: 2px 4px;
  }
  
  /* Mobile Tab Texts */
  .m3-tab-text-full {
    display: none !important;
  }
  .m3-tab-text-short {
    display: inline !important;
  }

  /* Full-width 3-tab symmetric segmented bar */
  .m3-nav-pill-group {
    width: 100% !important;
    display: flex !important;
    justify-content: space-between !important;
    padding: 3px !important;
    gap: 3px !important;
    overflow: visible !important;
    box-sizing: border-box !important;
  }
  .m3-header-nav-group {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    display: flex !important;
  }
  .m3-nav-tab {
    width: 100% !important;
    flex: 1 1 0 !important;
    padding: 6px 3px !important;
    font-size: 0.72rem !important;
    justify-content: center !important;
    gap: 3px !important;
    text-align: center !important;
    min-width: 0 !important;
  }
  .m3-nav-tab .material-symbols-outlined:first-child {
    font-size: 16px !important;
  }
  .m3-nav-tab .m3-nav-arrow {
    font-size: 14px !important;
    margin-left: -2px !important;
  }

  /* Dropdown positioned naturally right below the tab button */
  .m3-header-dropdown {
    position: absolute !important;
    top: calc(100% + 6px) !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) translateY(4px) !important;
    min-width: 270px !important;
    max-width: 90vw !important;
    border-radius: 14px !important;
  }
  .m3-header-nav-group:last-child .m3-header-dropdown {
    left: auto !important;
    right: 0 !important;
    transform: translateY(4px) !important;
  }
  .m3-header-nav-group:first-child .m3-header-dropdown {
    left: 0 !important;
    right: auto !important;
    transform: translateY(4px) !important;
  }
  .m3-header-nav-group.open .m3-header-dropdown {
    transform: translateX(-50%) translateY(0) !important;
  }
  .m3-header-nav-group:last-child.open .m3-header-dropdown,
  .m3-header-nav-group:first-child.open .m3-header-dropdown {
    transform: translateY(0) !important;
  }

  #btn-open-shortcuts span:last-child {
    display: none;
  }
  .m3-btn-group .m3-top-btn span:last-child {
    display: none;
  }
  .m3-topbar-user #topbar-user-name,
  .m3-topbar-user #topbar-user-role {
    display: none;
  }

  .m3-top-divider {
    display: none;
  }

  /* Global Bottom Navigation Bar (Docked) */
  .m3-global-bottom-bar {
    display: flex;
    align-items: center;
    justify-content: space-around;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.5);
    z-index: 150;
    padding: 2px 4px env(safe-area-inset-bottom, 2px) 4px;
    box-sizing: border-box;
  }

  .m3-bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--md-sys-color-on-surface-variant, #94a3b8);
    padding: 4px 6px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
    flex: 1;
    min-width: 0;
    gap: 2px;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  .m3-bottom-nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 26px;
    border-radius: 999px;
    transition: all 0.2s ease;
  }

  .m3-bottom-nav-icon .material-symbols-outlined {
    font-size: 20px;
    transition: transform 0.2s ease;
  }

  .m3-bottom-nav-label {
    font-family: var(--md-sys-typescale-label-large-font);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
    transition: color 0.2s ease;
  }

  .m3-bottom-nav-item:active .m3-bottom-nav-icon {
    transform: scale(0.92);
  }

  .m3-bottom-nav-item.active {
    color: #ffffff;
  }

  .m3-bottom-nav-item.active .m3-bottom-nav-icon {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.35), rgba(67, 56, 202, 0.35));
    border: 1px solid rgba(99, 102, 241, 0.5);
    color: #818cf8;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
  }

  .m3-bottom-nav-item.active .m3-bottom-nav-label {
    color: #818cf8;
    font-weight: 800;
  }

  /* Main Viewport Spacing on Mobile */
  .m3-main-container {
    height: calc(100vh - 114px);
    margin-bottom: 60px;
  }

  .m3-batch-container {
    padding: 0.85rem !important;
  }
  .m3-distribution-grid {
    grid-template-columns: 1fr !important;
    gap: 0.85rem !important;
  }
  .m3-card {
    padding: 1rem !important;
  }
}

/* M3 Chip / Status Badge */
.m3-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 6px 14px;
  border-radius: var(--md-sys-shape-corner-full);
  background-color: var(--md-sys-color-surface-container-high);
  border: 1px solid var(--md-sys-color-outline-variant);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
}

.m3-status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--md-sys-color-success);
  box-shadow: 0 0 10px var(--md-sys-color-success);
}

/* ==========================================================================
   M3 Button System (Filled, Tonal, Outlined, FAB)
   ========================================================================== */
.m3-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 10px 20px;
  border-radius: var(--md-sys-shape-corner-full);
  font-family: var(--md-sys-typescale-label-large-font);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: all var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-emphasized);
  border: 1px solid transparent;
  text-decoration: none;
  user-select: none;
}

.m3-btn:active {
  transform: scale(0.97);
}

.m3-btn-filled {
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  box-shadow: var(--md-sys-elevation-1);
}

.m3-btn-filled:hover {
  background-color: #d8deff;
  box-shadow: var(--md-sys-elevation-2);
}

.m3-btn-tonal {
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.m3-btn-tonal:hover {
  background-color: #555569;
}

.m3-btn-outlined {
  background-color: transparent;
  color: var(--md-sys-color-primary);
  border-color: var(--md-sys-color-outline);
}

.m3-btn-outlined:hover {
  background-color: rgba(186, 195, 255, 0.08);
}

.m3-btn-gold {
  background-color: var(--md-sys-color-gold);
  color: var(--md-sys-color-on-gold);
  box-shadow: var(--md-sys-elevation-1);
}

.m3-btn-gold:hover {
  background-color: #ffe499;
  box-shadow: var(--md-sys-elevation-2);
}

.m3-btn-success {
  background-color: var(--md-sys-color-success);
  color: var(--md-sys-color-on-success);
}

.m3-btn-success:hover {
  background-color: #9cf0ae;
}

.m3-btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
  border-radius: var(--md-sys-shape-corner-medium);
}

/* ==========================================================================
   M3 Cards & Surfaces
   ========================================================================== */
.m3-card {
  background-color: var(--md-sys-color-surface-container);
  border-radius: var(--md-sys-shape-corner-large);
  border: 1px solid var(--md-sys-color-outline-variant);
  box-shadow: var(--md-sys-elevation-1);
  padding: 1.5rem;
  transition: all var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized);
}

.m3-card-elevated {
  background-color: var(--md-sys-color-surface-container-high);
  box-shadow: var(--md-sys-elevation-2);
}

.m3-card:hover {
  border-color: var(--md-sys-color-outline);
}

/* ==========================================================================
   M3 Form Controls & Text Fields
   ========================================================================== */
.m3-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.m3-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--md-sys-color-outline);
  letter-spacing: 0.02em;
}

.m3-input, .m3-select, .m3-textarea {
  width: 100%;
  padding: 9px 12px;
  background-color: var(--md-sys-color-surface-container-lowest);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-small);
  color: var(--md-sys-color-on-surface);
  font-size: 0.85rem;
  font-family: inherit;
  transition: border-color var(--md-sys-motion-duration-short) ease, box-shadow var(--md-sys-motion-duration-short) ease;
}

.m3-input:focus, .m3-select:focus, .m3-textarea:focus {
  outline: none;
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 3px rgba(186, 195, 255, 0.2);
}

/* ==========================================================================
   M3 Layout & Views
   ========================================================================== */
.m3-main-content,
.m3-main-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  height: calc(100vh - 64px);
  overflow: hidden;
}

.m3-view-section,
.m3-view {
  display: none;
  width: 100%;
  height: 100%;
  flex: 1;
  overflow: hidden;
}

.m3-view-section.active,
.m3-view.active {
  display: flex;
  flex-direction: column;
}

#view-batch,
#view-settings {
  overflow-y: auto;
}

/* ==========================================================================
   M3 Dialog / Modal System (Signature Pad & Popups)
   ========================================================================== */
.m3-dialog-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 150;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.m3-dialog-backdrop.active {
  display: flex;
}

.m3-dialog {
  background-color: var(--md-sys-color-surface-container-high);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-extra-large);
  box-shadow: var(--md-sys-elevation-3);
  width: 100%;
  max-width: 520px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: m3DialogIn 0.25s var(--md-sys-motion-easing-emphasized);
}

@keyframes m3DialogIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.m3-dialog-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.m3-dialog-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.m3-dialog-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--md-sys-color-outline-variant);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

.signature-canvas-container {
  background-color: #ffffff;
  border: 2px dashed var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  overflow: hidden;
  touch-action: none;
  cursor: crosshair;
}

#signature-pad-canvas {
  width: 100%;
  height: 180px;
  display: block;
  background-color: #ffffff;
}

/* ==========================================================================
   M3 Snackbar / Toast Notifications
   ========================================================================== */
#toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.m3-toast {
  background-color: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  padding: 12px 18px;
  border-radius: var(--md-sys-shape-corner-medium);
  box-shadow: var(--md-sys-elevation-3);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: m3ToastIn 0.3s var(--md-sys-motion-easing-emphasized);
}

@keyframes m3ToastIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ==========================================================================
/* ==========================================================================
   Help & Settings Master-Detail (VS Code Style Left-to-Right Layout)
   ========================================================================== */
.m3-settings-container {
  display: flex;
  width: 100%;
  overflow: hidden;
}

.m3-settings-sidebar {
  width: 255px;
  min-width: 240px;
  flex-shrink: 0;
  background-color: var(--md-sys-color-surface-container);
  border-right: 1px solid var(--md-sys-color-outline-variant);
  padding: 1.25rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.m3-settings-sidebar-label {
  font-size: 0.675rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--md-sys-color-outline);
  padding: 0 0.5rem 0.5rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 4px;
}

.m3-settings-nav-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 10px 12px;
  border-radius: var(--md-sys-shape-corner-medium);
  border: 1px solid transparent;
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  text-align: left;
  cursor: pointer;
  width: 100%;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
}

.m3-settings-nav-item .material-symbols-outlined {
  font-size: 22px;
  color: var(--md-sys-color-on-surface-variant);
  flex-shrink: 0;
  transition: color 0.2s;
}

.m3-settings-nav-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.m3-settings-nav-text .m3-nav-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.m3-settings-nav-text .m3-nav-desc {
  font-size: 0.7rem;
  color: var(--md-sys-color-outline);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.m3-settings-nav-item:hover {
  background-color: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  transform: translateX(3px);
}

.m3-settings-nav-item:hover .material-symbols-outlined {
  color: var(--md-sys-color-primary);
}

.m3-settings-nav-item.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(79, 70, 229, 0.25));
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.m3-settings-nav-item.active .material-symbols-outlined {
  color: #818cf8;
}

.m3-settings-nav-item.active .m3-settings-nav-text .m3-nav-title {
  color: #c7d2fe;
}

.m3-settings-content {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  background-color: var(--md-sys-color-surface-container-low);
}

/* Backward compatibility tab styles */
.m3-help-tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background-color: var(--md-sys-color-surface-container);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  overflow-x: auto;
}

.m3-help-tab-btn {
  padding: 8px 16px;
  border-radius: var(--md-sys-shape-corner-full);
  border: 1px solid transparent;
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.825rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.m3-help-tab-btn:hover {
  background-color: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
}

.m3-help-tab-btn.active {
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  border-color: var(--md-sys-color-primary);
}

.m3-step-card {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background-color: var(--md-sys-color-surface-container-lowest);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.m3-step-card:hover {
  border-color: var(--md-sys-color-primary);
  transform: translateY(-2px);
}

.m3-step-badge {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #4338ca);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.35);
}

/* Responsive Master-Detail for smaller screens */
@media (max-width: 768px) {
  .m3-settings-container {
    flex-direction: column;
  }
  .m3-settings-sidebar {
    width: 100%;
    min-width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    flex-direction: row;
    overflow-x: auto;
    padding: 0.5rem;
  }
  .m3-settings-sidebar-label {
    display: none;
  }
  .m3-settings-nav-text .m3-nav-desc {
    display: none;
  }
  .m3-settings-nav-item {
    padding: 8px 12px;
    white-space: nowrap;
    width: auto;
  }
}

/* ==========================================================================
   Execution & Distribution Actions (3-Card Balanced Grid)
   ========================================================================== */
.m3-distribution-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.15rem;
  margin-top: 0.5rem;
}

.m3-distribution-card {
  background-color: var(--md-sys-color-surface-container-low);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.15rem;
  position: relative;
  transition: all 0.25s cubic-bezier(0.2, 0, 0, 1);
  overflow: hidden;
}

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

.m3-distribution-card.card-zip::before {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

.m3-distribution-card.card-gas::before {
  background: linear-gradient(90deg, #6366f1, #3b82f6);
}

.m3-distribution-card.card-edge::before {
  background: linear-gradient(90deg, #10b981, #059669);
}

.m3-distribution-card.card-email::before {
  background: linear-gradient(90deg, #8b5cf6, #7c3aed);
}

.m3-distribution-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--md-sys-elevation-2);
  border-color: var(--md-sys-color-outline);
}

.m3-distribution-header {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.m3-distribution-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-zip .m3-distribution-icon {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.card-gas .m3-distribution-icon {
  background: rgba(99, 102, 241, 0.15);
  color: #6366f1;
}

.card-edge .m3-distribution-icon {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.card-email .m3-distribution-icon {
  background: rgba(139, 92, 246, 0.15);
  color: #8b5cf6;
}

.m3-distribution-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.m3-distribution-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--md-sys-color-on-surface);
  line-height: 1.3;
}

.m3-distribution-desc {
  font-size: 0.775rem;
  color: var(--md-sys-color-outline);
  line-height: 1.45;
}

.m3-distribution-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.m3-dist-chip {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
  border: 1px solid var(--md-sys-color-outline-variant);
}

/* ==========================================================================
   Multi-Channel Auto-Dispatcher Suite & Live Delivery Tracker
   ========================================================================== */
.m3-dispatcher-suite-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.m3-dispatcher-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--md-sys-color-surface-container);
  padding: 6px;
  border-radius: var(--md-sys-shape-corner-medium);
  border: 1px solid var(--md-sys-color-outline-variant);
  overflow-x: auto;
}

.m3-dispatcher-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 8px 16px;
  border-radius: var(--md-sys-shape-corner-small);
  border: none;
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  font-family: var(--md-sys-typescale-label-large-font);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
}

.m3-dispatcher-nav-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--md-sys-color-on-surface);
}

.m3-dispatcher-nav-btn.active {
  background: var(--md-sys-color-surface-container-highest);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.m3-dispatcher-tab-pane {
  display: none;
}

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

/* KPI Tracker Grid */
.m3-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.m3-kpi-card {
  background: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  padding: 1.1rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  position: relative;
  overflow: hidden;
}

.m3-kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.m3-kpi-card.kpi-total::before { background: #6366f1; }
.m3-kpi-card.kpi-wa::before { background: #10b981; }
.m3-kpi-card.kpi-email::before { background: #8b5cf6; }
.m3-kpi-card.kpi-pending::before { background: #f59e0b; }

.m3-kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-total .m3-kpi-icon { background: rgba(99, 102, 241, 0.18); color: #818cf8; }
.kpi-wa .m3-kpi-icon { background: rgba(16, 185, 129, 0.18); color: #34d399; }
.kpi-email .m3-kpi-icon { background: rgba(139, 92, 246, 0.18); color: #a78bfa; }
.kpi-pending .m3-kpi-icon { background: rgba(245, 158, 11, 0.18); color: #fbbf24; }

.m3-kpi-val {
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1.1;
  color: var(--md-sys-color-on-surface);
}

.m3-kpi-label {
  font-size: 0.725rem;
  font-weight: 700;
  color: var(--md-sys-color-outline);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

/* Chat & Email Preview Bubble */
.m3-chat-preview-card {
  background: #0b141a;
  border: 1px solid #222e35;
  border-radius: 12px;
  padding: 1rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #e9edef;
  font-size: 0.85rem;
  line-height: 1.5;
  position: relative;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.m3-chat-bubble {
  background: #005c4b;
  color: #e9edef;
  padding: 12px 14px;
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 100%;
}

/* Row Action Buttons in Attendee Table */
.m3-row-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.m3-row-action-btn.btn-row-wa {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.m3-row-action-btn.btn-row-wa:hover {
  background: #10b981;
  color: #ffffff;
}

.m3-row-action-btn.btn-row-email {
  background: rgba(139, 92, 246, 0.18);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.35);
}

.m3-row-action-btn.btn-row-email:hover {
  background: #8b5cf6;
  color: #ffffff;
}

/* Status Badges */
.m3-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.m3-status-badge.status-pending {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.m3-status-badge.status-sent-wa {
  background: rgba(16, 185, 129, 0.18);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.m3-status-badge.status-sent-email {
  background: rgba(139, 92, 246, 0.18);
  color: #8b5cf6;
  border: 1px solid rgba(139, 92, 246, 0.35);
}

.m3-status-badge.status-failed {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

/* --- ADVANCED TABLE PREVIEW & PAGINATION STYLES --- */
.m3-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.m3-sheet-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--md-sys-color-surface-container-high);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--md-sys-color-outline-variant);
  overflow-x: auto;
}

.m3-sheet-tab-btn {
  padding: 4px 12px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--md-sys-color-outline);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.m3-sheet-tab-btn:hover {
  color: var(--md-sys-color-on-surface);
  background: rgba(255, 255, 255, 0.05);
}

.m3-sheet-tab-btn.active {
  background: var(--md-sys-color-primary);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.m3-table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--md-sys-color-outline-variant);
  font-size: 0.82rem;
  color: var(--md-sys-color-outline);
}

.m3-page-btn-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.m3-page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface);
  font-size: 0.78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.m3-page-btn:hover:not(:disabled) {
  background: var(--md-sys-color-surface-container-high);
  border-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-primary);
}

.m3-page-btn.active {
  background: var(--md-sys-color-primary);
  color: #ffffff;
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.35);
}

.m3-page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* =========================================================================
   UNIVERSAL EXECUTION PROGRESS & EDUCATIONAL TERMINAL MODAL (M3)
   ========================================================================= */
.progress-spinner-orbital {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 4px solid rgba(99, 102, 241, 0.18);
  border-top-color: var(--md-sys-color-primary);
  border-right-color: #10b981;
  animation: orbitalSpin 0.9s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.3);
}

@keyframes orbitalSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.progress-bar-wrapper {
  background: var(--md-sys-color-surface-container-lowest);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 9999px;
  height: 12px;
  overflow: hidden;
  position: relative;
}

.progress-bar-animated-fill {
  height: 100%;
  width: 0%;
  border-radius: 9999px;
  background: linear-gradient(90deg, #6366f1 0%, #10b981 50%, #f59e0b 100%);
  background-size: 200% 100%;
  animation: progressGradientMove 2s linear infinite;
  transition: width 0.35s ease;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

@keyframes progressGradientMove {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.progress-log-terminal {
  background: #090d16;
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 10px;
  padding: 10px 14px;
  font-family: 'Fira Code', 'Consolas', 'Courier New', monospace;
  font-size: 0.76rem;
  color: #e2e8f0;
  max-height: 160px;
  overflow-y: auto;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5);
}

.progress-log-terminal::-webkit-scrollbar {
  width: 6px;
}
.progress-log-terminal::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.4);
  border-radius: 3px;
}

.log-entry {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  word-break: break-word;
}
.log-entry.info { color: #93c5fd; }
.log-entry.success { color: #86efac; }
.log-entry.warning { color: #fde047; }
.log-entry.error { color: #fca5a5; }
.log-time { color: #64748b; font-size: 0.7rem; flex-shrink: 0; }

/* Interactive Sheet Selector Cards */
.m3-sheet-source-card {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.m3-sheet-source-card:hover {
  background: var(--md-sys-color-surface-container-high) !important;
  border-color: #0ea5e9 !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.15);
}
.m3-sheet-source-card:active {
  transform: translateY(0);
}
.m3-sheet-source-card.active {
  border-color: #0ea5e9 !important;
  background: rgba(14, 165, 233, 0.1) !important;
}

/* M3 Modern Accordion */
.m3-accordion {
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(139, 92, 246, 0.04);
}
.m3-accordion-header {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  background: rgba(139, 92, 246, 0.05);
  transition: background 0.2s ease;
}
.m3-accordion-header:hover {
  background: rgba(139, 92, 246, 0.12);
}
.m3-acc-body {
  display: none;
  padding: 12px 14px;
  border-top: 1px solid rgba(139, 92, 246, 0.2);
  flex-direction: column;
  gap: 0.75rem;
}
.m3-acc-body.active {
  display: flex !important;
}
.m3-acc-icon {
  transition: transform 0.25s ease;
}
.m3-acc-icon.rotated {
  transform: rotate(180deg);
}

/* ========================================================
   AUTHENTICATION & LANDING PAGE SUITE (M3 ENTERPRISE)
   ======================================================== */
.m3-landing-auth-container {
  min-height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at 50% 10%, rgba(99, 102, 241, 0.18), transparent 45%),
              radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.14), transparent 40%),
              radial-gradient(circle at 10% 90%, rgba(16, 185, 129, 0.12), transparent 40%),
              #090d16;
  color: #f8fafc;
  font-family: 'Plus Jakarta Sans', var(--md-ref-typeface-brand);
  position: relative;
  overflow-x: hidden;
}

.m3-landing-header {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(9, 13, 22, 0.8);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.m3-landing-hero {
  max-width: 1280px;
  margin: 0 auto;
  padding: 3rem 2rem 5rem 2rem;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 3.5rem;
  align-items: center;
  width: 100%;
}

@media (max-width: 960px) {
  .m3-landing-hero {
    grid-template-columns: 1fr;
    padding: 2rem 1.25rem;
    gap: 2.5rem;
  }
}

.m3-landing-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #a5b4fc;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
}

.m3-landing-title {
  font-size: 2.75rem;
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 1.25rem 0;
  background: linear-gradient(135deg, #ffffff 30%, #cbd5e1 70%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.m3-landing-title span {
  background: linear-gradient(135deg, #818cf8, #c084fc, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.m3-landing-subtitle {
  font-size: 1.02rem;
  color: #94a3b8;
  line-height: 1.6;
  margin-bottom: 2rem;
}

.m3-landing-features {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 2.5rem;
}

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

.m3-feature-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 12px 14px;
  border-radius: 12px;
  transition: all 0.2s ease;
}

.m3-feature-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(99, 102, 241, 0.3);
  transform: translateY(-2px);
}

.m3-feature-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.m3-feature-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: #f1f5f9;
  margin-bottom: 2px;
}

.m3-feature-desc {
  font-size: 0.75rem;
  color: #94a3b8;
  line-height: 1.4;
}

/* Auth Card Glass */
.m3-auth-card {
  background: rgba(18, 24, 38, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 2.25rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(24px);
}

.m3-auth-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.m3-auth-tab {
  flex: 1;
  text-align: center;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  color: #94a3b8;
  transition: all 0.2s ease;
  border: none;
  background: transparent;
}

.m3-auth-tab.active {
  background: #6366f1;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* Quick Login Grid (10 Accounts) */
.m3-quick-login-container {
  max-height: 380px;
  overflow-y: auto;
  padding-right: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.m3-quick-login-container::-webkit-scrollbar {
  width: 5px;
}
.m3-quick-login-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
}

.m3-quick-user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.m3-quick-user-card:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateX(4px);
}

.m3-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.92rem;
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.m3-user-info {
  flex: 1;
  min-width: 0;
}

.m3-user-name {
  font-weight: 800;
  font-size: 0.88rem;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.m3-user-dept {
  font-size: 0.72rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.m3-user-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.m3-badge {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  letter-spacing: 0.03em;
}

.m3-user-email {
  font-size: 0.68rem;
  color: #64748b;
  font-family: monospace;
}

.m3-quick-login-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f1f5f9;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
  pointer-events: none;
}

.m3-quick-user-card:hover .m3-quick-login-btn {
  background: #6366f1;
  border-color: #6366f1;
  color: #ffffff;
}

/* Topbar User Widget & Dropdown */
.m3-top-app-bar,
.m3-top-actions {
  overflow: visible !important;
}

.m3-topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 9999px;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  user-select: none;
}

.m3-topbar-user:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(99, 102, 241, 0.6);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.m3-user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 290px;
  background: #0f172a !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1) !important;
  display: none;
  flex-direction: column;
  gap: 12px;
  z-index: 999999 !important;
  pointer-events: auto;
}

.m3-user-dropdown.active {
  display: flex !important;
  animation: m3DropdownSlide 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes m3DropdownSlide {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}


