/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  /* Color Palette - Slate & Deep Space */
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-card: rgba(30, 41, 59, 0.45);
  --bg-card-hover: rgba(30, 41, 59, 0.65);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-focus: rgba(14, 165, 233, 0.5);
  
  /* Accent Colors */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  /* Status Colors (Glowing HSL) */
  --color-excellent: #10b981;
  --color-excellent-glow: rgba(16, 185, 129, 0.15);
  --color-good: #0ea5e9;
  --color-good-glow: rgba(14, 165, 233, 0.15);
  --color-caution: #f59e0b;
  --color-caution-glow: rgba(245, 158, 11, 0.15);
  --color-critical: #ef4444;
  --color-critical-glow: rgba(239, 68, 68, 0.15);

  --gradient-excellent: linear-gradient(135deg, #059669 0%, #10b981 100%);
  --gradient-good: linear-gradient(135deg, #0284c7 0%, #0ea5e9 100%);
  --gradient-caution: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
  --gradient-critical: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
  
  /* Fonts & Shadows */
  --font-title: 'Outfit', 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  --shadow-sm: 0 2px 8px -2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 20px -4px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 10px 30px -10px rgba(0, 0, 0, 0.8);
  --shadow-glow-blue: 0 0 15px rgba(14, 165, 233, 0.3);
  
  --transition-fast: 0.2s ease;
  --transition-normal: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  
  --sidebar-width: 260px;
}

/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(14, 165, 233, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(16, 185, 129, 0.04) 0%, transparent 50%);
  background-attachment: fixed;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* App Layout */
.app-container {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* Sidebar Menu */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
  transition: var(--transition-normal);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.sidebar-brand {
  padding: 2rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
  width: 38px;
  height: 38px;
  background: var(--gradient-good);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow-blue);
}

.sidebar-logo svg {
  width: 22px;
  height: 22px;
  color: white;
}

.brand-text {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-menu {
  list-style: none;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-grow: 1;
}

.menu-item a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  transition: var(--transition-fast);
}

.menu-item a:hover {
  background-color: var(--bg-card);
  color: var(--text-primary);
}

.menu-item.active a {
  background: rgba(14, 165, 233, 0.1);
  color: var(--color-good);
  border-left: 3px solid var(--color-good);
  box-shadow: inset 5px 0 10px rgba(14, 165, 233, 0.05);
}

.menu-item a svg {
  width: 20px;
  height: 20px;
}

.sidebar-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

/* Main Content Area */
.main-content {
  margin-left: var(--sidebar-width);
  flex-grow: 1;
  padding: 1.25rem 1.5rem;
  min-height: 100vh;
  transition: var(--transition-normal);
  display: flex;
  flex-direction: column;
  width: calc(100% - var(--sidebar-width));
  max-width: calc(100% - var(--sidebar-width));
  box-sizing: border-box;
}

/* Header Section (Selalu di bagian paling atas halaman) */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  width: 100%;
  flex-shrink: 0;
}

.header-title h1 {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.85rem;
  margin-bottom: 0.25rem;
}

.header-title p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.unit-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.unit-select-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.95rem;
  transition: var(--transition-fast);
}

.unit-select-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-color-focus);
}

.unit-select-btn.active {
  background: var(--gradient-good);
  color: white;
  border: none;
  box-shadow: var(--shadow-glow-blue);
}

/* Views Container */
.view-section {
  display: none;
  animation: fadeIn 0.4s ease;
}

.view-section.active {
  display: block;
}

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

/* Metrics Grid / Cards */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.metrics-grid .card {
  padding: 1rem 0.75rem;
}

.metrics-grid .card-value {
  font-size: 1.4rem;
  margin-bottom: 0.25rem;
}

.metrics-grid .card-title {
  font-size: 0.75rem;
}

.metrics-grid .card-subtext {
  font-size: 0.65rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-md);
  transition: var(--transition-normal);
}

.card:hover {
  transform: translateY(-4px);
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: var(--shadow-lg);
}

.card-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-icon.blue { background: rgba(14, 165, 233, 0.15); color: var(--color-good); }
.card-icon.green { background: rgba(16, 185, 129, 0.15); color: var(--color-excellent); }
.card-icon.orange { background: rgba(245, 158, 11, 0.15); color: var(--color-caution); }
.card-icon.red { background: rgba(239, 68, 68, 0.15); color: var(--color-critical); }

.card-icon svg {
  width: 22px;
  height: 22px;
}

.card-title {
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.card-value {
  font-family: var(--font-title);
  font-size: 1.85rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.card-subtext {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.card-subtext.up { color: var(--color-excellent); }
.card-subtext.down { color: var(--color-critical); }

/* Dashboard Specific Layout */
.dashboard-row-2 {
  display: grid;
  grid-template-columns: 1.7fr 1.3fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.dashboard-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.chart-card {
  min-height: 350px;
  display: flex;
  flex-direction: column;
}

.chart-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.chart-card-title {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 600;
}

.chart-container {
  position: relative;
  flex-grow: 1;
  width: 100%;
  height: 280px;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-excellent {
  background-color: var(--color-excellent-glow);
  color: var(--color-excellent);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-good {
  background-color: var(--color-good-glow);
  color: var(--color-good);
  border: 1px solid rgba(14, 165, 233, 0.3);
}

.badge-caution {
  background-color: var(--color-caution-glow);
  color: var(--color-caution);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-critical {
  background-color: var(--color-critical-glow);
  color: var(--color-critical);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-standby {
  background-color: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

/* Pulsing dot */
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-excellent { background-color: var(--color-excellent); box-shadow: 0 0 8px var(--color-excellent); animation: pulseGreen 2s infinite; }
.dot-good { background-color: var(--color-good); box-shadow: 0 0 8px var(--color-good); }
.dot-caution { background-color: var(--color-caution); box-shadow: 0 0 8px var(--color-caution); animation: pulseOrange 2s infinite; }
.dot-critical { background-color: var(--color-critical); box-shadow: 0 0 8px var(--color-critical); animation: pulseRed 2s infinite; }
.dot-standby { background-color: #94a3b8; box-shadow: 0 0 8px #94a3b8; }

@keyframes pulseGreen {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes pulseOrange {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

@keyframes pulseRed {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Forms Styling */
.form-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.dashboard-detail-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.chart-column-wrapper {
  display: flex;
  flex-direction: column;
  height: calc((100vh - 280px) / 2);
  min-height: 180px;
}

.recom-column-wrapper {
  display: flex;
  flex-direction: column;
  height: calc((100vh - 320px) / 2);
  min-height: 140px;
}

.chart-column-wrapper .chart-card {
  height: 100% !important;
  margin-bottom: 0 !important;
}

.recom-column-wrapper .card {
  height: 100% !important;
  margin-bottom: 0 !important;
  padding: 0.75rem 1rem !important;
}

/* Mobile Navigation Button Styles (Desktop Hidden) */
.mobile-menu-btn {
  display: none;
}

.mobile-close-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 6px;
  transition: var(--transition-fast);
  align-items: center;
  justify-content: center;
}

.mobile-close-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-overlay {
  display: none;
}

@media(max-width: 1200px) {
  .metrics-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
  }
  .metrics-grid .card {
    padding: 1.25rem 1rem;
  }
  .metrics-grid .card-value {
    font-size: 1.65rem;
    margin-bottom: 0.4rem;
  }
  .metrics-grid .card-title {
    font-size: 0.8rem;
  }
  .metrics-grid .card-subtext {
    font-size: 0.75rem;
  }
}

@media(max-width: 1200px) and (min-width: 993px) {
  .chart-column-wrapper,
  .recom-column-wrapper {
    height: calc((100vh - 360px) / 2);
    min-height: 170px;
  }
}

@media(max-width: 992px) {
  .form-container {
    grid-template-columns: 1fr;
  }
  .dashboard-row-2, .dashboard-row-3 {
    grid-template-columns: 1fr;
  }
  .dashboard-detail-row {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
  .chart-column-wrapper,
  .recom-column-wrapper {
    height: auto;
    min-height: auto;
  }
  .chart-column-wrapper .chart-card {
    min-height: 320px !important;
  }
  .recom-column-wrapper .card {
    height: auto !important;
    min-height: 200px !important;
  }
  body {
    flex-direction: column;
  }
  
  /* Mobile Menu Toggle Button Display */
  .mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 42px;
    height: 42px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-fast);
  }
  
  .mobile-menu-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-color-focus);
    box-shadow: 0 0 10px rgba(14, 165, 233, 0.2);
  }

  .mobile-menu-btn svg {
    width: 22px;
    height: 22px;
  }

  .mobile-close-btn {
    display: inline-flex;
  }
  
  /* Sidebar Drawer styling for Mobile */
  .sidebar {
    position: fixed;
    top: 0;
    left: -260px; /* Hidden state */
    width: 260px;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height */
    z-index: 1000;
    border-right: 1px solid var(--border-color);
    box-shadow: none;
    transition: transform var(--transition-normal);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .sidebar.show {
    transform: translateX(260px);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
  }

  /* Overlay backdrop for mobile menu */
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(11, 15, 25, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    transition: opacity var(--transition-normal);
  }

  .sidebar-overlay.show {
    display: block;
    opacity: 1;
  }

  .sidebar-menu {
    flex-direction: column;
    overflow-x: visible;
    padding: 1.5rem 1rem;
    gap: 0.5rem;
  }
  
  .main-content {
    margin-left: 0;
    padding: 1.25rem;
    width: 100%;
  }
  
  .main-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
  }
  
  .unit-selector-wrapper {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    width: 100%;
    gap: 0.5rem;
    padding: 0.25rem 0.1rem 0.5rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
  }

  .unit-selector-wrapper::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
  }

  .unit-selector-wrapper span {
    display: none !important; /* Hide "PILIH UNIT:" label to save screen space */
  }

  .unit-select-btn {
    flex-shrink: 0; /* Prevents buttons from shrinking */
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 6px;
  }
  
  .header-title h1 {
    font-size: 1.5rem;
  }
  
  .header-title p {
    font-size: 0.8rem;
  }
}

@media(max-width: 600px) {
  .grid-inputs {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .form-submit-row {
    flex-direction: column;
    width: 100%;
    gap: 0.75rem;
  }
  
  .form-submit-row .btn {
    width: 100%;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.75rem;
  }

  .metrics-grid .card {
    padding: 0.75rem;
  }

  .metrics-grid .card-value {
    font-size: 1.25rem;
    margin-bottom: 0.15rem;
  }

  .metrics-grid .card-title {
    font-size: 0.65rem;
  }

  .metrics-grid .card-subtext {
    font-size: 0.6rem;
  }

  .card-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
  }

  .card-icon svg {
    width: 16px;
    height: 16px;
  }
}

.form-group-card {
  background: rgba(15, 23, 42, 0.3);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1.25rem;
}

.form-group-title {
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--color-good);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.grid-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.input-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.input-field label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.input-control {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  transition: var(--transition-fast);
}

.input-control:focus {
  outline: none;
  border-color: var(--color-good);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.input-control::placeholder {
  color: var(--text-muted);
}

.input-control[readonly] {
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-muted);
  cursor: not-allowed;
}

.form-submit-row {
  grid-column: span 2;
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 1rem;
}

@media(max-width: 992px) {
  .form-submit-row {
    grid-column: span 1;
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  font-family: var(--font-title);
  transition: var(--transition-fast);
}

.btn-primary {
  background: var(--gradient-good);
  color: white;
  box-shadow: var(--shadow-glow-blue);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(14, 165, 233, 0.5);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

/* History / Table Section */
.table-card {
  overflow: hidden;
}

.table-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.table-filters {
  display: flex;
  gap: 0.75rem;
}

.table-container {
  width: 100%;
  overflow-x: auto;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.custom-table th {
  padding: 0.85rem 1rem;
  color: var(--text-secondary);
  font-weight: 600;
  background: rgba(15, 23, 42, 0.4);
  border-bottom: 1px solid var(--border-color);
}

.custom-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  white-space: nowrap;
}

.custom-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.custom-table td.actions {
  white-space: nowrap;
}

.action-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: var(--transition-fast);
}

.action-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.action-btn.delete:hover {
  color: var(--color-critical);
  background: rgba(239, 68, 68, 0.1);
}

.action-btn svg {
  width: 16px;
  height: 16px;
}

/* Toast Notifications */
.toast-notification {
  position: fixed;
  bottom: 5.5rem; /* Shifted up to prevent overlap with floating theme toggle */
  right: -450px;
  max-width: 400px;
  background: #1e293b;
  border: 1px solid var(--color-good);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: var(--shadow-lg), var(--shadow-glow-blue);
  z-index: 1002; /* Float above everything including theme switcher */
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 500;
  transition: right 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast-notification.show {
  right: 1.5rem;
}

.toast-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(14, 165, 233, 0.2);
  color: var(--color-good);
}

/* Parameter Grid (For Lubricant Analysis and Engine Test Details) */
.parameter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.parameter-value-card {
  background: rgba(15, 23, 42, 0.25);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  position: relative;
  overflow: hidden;
}

.parameter-value-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--color-good);
}

.parameter-value-card.excellent::before { background: var(--color-excellent); }
.parameter-value-card.good::before { background: var(--color-good); }
.parameter-value-card.caution::before { background: var(--color-caution); }
.parameter-value-card.critical::before { background: var(--color-critical); }

.param-name {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
}

.param-value-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 0.25rem;
}

.param-val {
  font-family: var(--font-title);
  font-size: 1.35rem;
  font-weight: 700;
}

.param-unit {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.param-limit {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.05);
  padding-top: 0.25rem;
}

/* Radar & Detail Grid */
.detail-grid-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media(max-width: 992px) {
  .detail-grid-container {
    grid-template-columns: 1fr;
  }
}

/* Recommendations Card */
.recom-item {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.2);
  border-radius: 8px;
  border-left: 4px solid var(--color-good);
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  line-height: 1.4;
}

.recom-item.recom-critical { border-left-color: var(--color-critical); }
.recom-item.recom-caution { border-left-color: var(--color-caution); }
.recom-item.recom-excellent { border-left-color: var(--color-excellent); }

.recom-item-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.recom-critical .recom-item-icon { background: rgba(239, 68, 68, 0.15); color: var(--color-critical); }
.recom-caution .recom-item-icon { background: rgba(245, 158, 11, 0.15); color: var(--color-caution); }
.recom-excellent .recom-item-icon { background: rgba(16, 185, 129, 0.15); color: var(--color-excellent); }

.recom-text-wrapper h4 {
  font-family: var(--font-title);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}
.recom-text-wrapper p {
  color: var(--text-secondary);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}
.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Excel Import styling */
.excel-import-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1.25rem;
}

.upload-zone {
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  padding: 2.25rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-fast);
  background: rgba(15, 23, 42, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--color-good);
  background: rgba(14, 165, 233, 0.05);
}

.upload-zone svg {
  width: 44px;
  height: 44px;
  color: var(--text-muted);
  transition: var(--transition-fast);
}

.upload-zone:hover svg {
  color: var(--color-good);
  transform: translateY(-4px);
}

.upload-zone p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.upload-zone span {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.excel-instructions {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.excel-instructions ul {
  padding-left: 1.2rem;
  margin-top: 0.5rem;
  color: var(--text-muted);
}

@media(max-width: 992px) {
  #view-input > div {
    grid-template-columns: 1fr !important;
  }
}

/* Assets Grid styling */
.assets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.asset-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.asset-status-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
}

.asset-status-running { background: rgba(16, 185, 129, 0.15); color: var(--color-excellent); border: 1px solid rgba(16, 185, 129, 0.2); }
.asset-status-maintenance { background: rgba(245, 158, 11, 0.15); color: var(--color-caution); border: 1px solid rgba(245, 158, 11, 0.2); }
.asset-status-breakdown { background: rgba(239, 68, 68, 0.15); color: var(--color-critical); border: 1px solid rgba(239, 68, 68, 0.2); }
.asset-status-standby { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.2); }

.asset-svg-wrapper {
  height: 100px;
  width: 100%;
  margin: 1rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.2);
  border-radius: 8px;
  border: 1px dashed var(--border-color);
  padding: 0.5rem;
}

.asset-svg-wrapper svg,
.asset-svg-wrapper img {
  height: 70px;
  max-width: 90%;
  color: var(--text-muted);
  object-fit: contain;
  border-radius: 4px;
}

.asset-details-list {
  list-style: none;
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 1.25rem;
  flex-grow: 1;
}

.asset-detail-row {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
  padding-bottom: 0.25rem;
}

.asset-detail-row strong {
  color: var(--text-primary);
}

/* Modal overlay styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-content-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 90%;
  max-width: 550px;
  padding: 2rem;
  box-shadow: var(--shadow-lg), var(--shadow-glow-blue);
  transform: translateY(-20px);
  transition: transform var(--transition-normal);
}

.modal-overlay.show .modal-content-card {
  transform: translateY(0);
}

/* KPI Border Glow Styles */
.card.kpi-excellent {
  border-color: var(--color-excellent);
  box-shadow: 0 0 15px var(--color-excellent-glow);
}
.card.kpi-good {
  border-color: var(--color-good);
  box-shadow: 0 0 15px var(--color-good-glow);
}
.card.kpi-caution {
  border-color: var(--color-caution);
  box-shadow: 0 0 15px var(--color-caution-glow);
}
.card.kpi-critical {
  border-color: var(--color-critical);
  box-shadow: 0 0 15px var(--color-critical-glow);
}
.card.kpi-standby {
  border-color: #94a3b8;
  box-shadow: 0 0 15px rgba(148, 163, 184, 0.15);
}

/* Fullscreen mode overrides */
.app-container.fullscreen-mode .sidebar {
  display: none !important;
}

.app-container.fullscreen-mode .main-content {
  margin-left: 0 !important;
  padding: 2rem !important;
  width: 100% !important;
  max-width: 100% !important;
}

/* Auto Display Active State */
.btn-auto-display-playing {
  background: var(--gradient-excellent) !important;
  color: white !important;
  border-color: var(--color-excellent) !important;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.4) !important;
}

/* CN Status Cards & Progress Bar */
.cmi-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  margin: 0.8rem 0;
}

.cmi-progress-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}

/* Color codes for progress bar */
.cmi-progress-bar.excellent { background: var(--gradient-excellent); }
.cmi-progress-bar.good { background: var(--gradient-good); }
.cmi-progress-bar.caution { background: var(--gradient-caution); }
.cmi-progress-bar.critical { background: var(--gradient-critical); }
.cmi-progress-bar.standby { background: linear-gradient(135deg, #64748b 0%, #94a3b8 100%); }

.cn-card-detail-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
  border-bottom: 1px dashed rgba(255, 255, 255, 0.03);
  padding-bottom: 0.35rem;
  margin-bottom: 0.35rem;
}

.cn-card-detail-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

/* Floating Theme Switcher Button */
.theme-toggle-floating-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg), var(--shadow-glow-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1001; /* Float above general layout */
  transition: all var(--transition-fast) ease;
}

.theme-toggle-floating-btn:hover {
  transform: scale(1.1);
  border-color: var(--color-good);
  box-shadow: var(--shadow-lg), 0 0 12px rgba(14, 165, 233, 0.4);
}

.theme-btn-icon {
  width: 20px;
  height: 20px;
  transition: all var(--transition-fast) ease;
}

/* Default state (dark mode): show moon icon, hide sun icon */
.theme-toggle-floating-btn .sun {
  display: none;
}
.theme-toggle-floating-btn .moon {
  display: block;
  color: #38bdf8; /* Sky blue moon */
  filter: drop-shadow(0 0 3px rgba(56, 189, 248, 0.4));
}

/* Light mode state: show sun icon, hide moon icon */
body.light-mode .theme-toggle-floating-btn .moon {
  display: none;
}
body.light-mode .theme-toggle-floating-btn .sun {
  display: block;
  color: #f59e0b; /* Golden yellow sun */
  filter: drop-shadow(0 0 3px rgba(245, 158, 11, 0.4));
}

body.light-mode .theme-toggle-floating-btn {
  box-shadow: var(--shadow-md);
}

@media print {
  .theme-toggle-floating-btn {
    display: none !important;
  }
}

/* ==========================================================================
   LIGHT MODE OVERRIDES
   ========================================================================== */
body.light-mode {
  --bg-primary: #f1f5f9;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.7);
  --bg-card-hover: rgba(255, 255, 255, 0.9);
  --border-color: rgba(15, 23, 42, 0.08);
  --border-color-focus: rgba(14, 165, 233, 0.5);
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(14, 165, 233, 0.03) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(16, 185, 129, 0.03) 0%, transparent 50%);
}

/* Specific element overrides for Light Mode readability */
body.light-mode .form-group-card {
  background: rgba(241, 245, 249, 0.4);
}

body.light-mode .input-control {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.12);
  color: #0f172a;
}

body.light-mode .input-control:focus {
  border-color: var(--color-good);
}

body.light-mode .input-control[readonly] {
  background: #f1f5f9;
  color: #94a3b8;
}

body.light-mode .brand-text {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

body.light-mode .sidebar-logo {
  box-shadow: 0 4px 10px rgba(14, 165, 233, 0.25);
}

body.light-mode .custom-table th {
  background: rgba(241, 245, 249, 0.9);
  color: #475569;
}

body.light-mode .custom-table tr:hover td {
  background: rgba(15, 23, 42, 0.015);
}

body.light-mode .parameter-value-card {
  background: rgba(255, 255, 255, 0.65);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

body.light-mode .cn-recom-group {
  border-bottom: 1px dashed rgba(15, 23, 42, 0.06);
}

body.light-mode .recom-item {
  background: rgba(255, 255, 255, 0.65);
}

body.light-mode .asset-svg-wrapper {
  background: rgba(241, 245, 249, 0.5);
}

body.light-mode .upload-zone {
  background: rgba(241, 245, 249, 0.5);
}

body.light-mode .toast-notification {
  background: #ffffff;
  color: #0f172a;
  border-color: var(--color-good);
  box-shadow: var(--shadow-lg), 0 0 15px rgba(0, 0, 0, 0.05);
}

/* ==========================================================================
   REPORT VIEW & PRINT STYLES
   ========================================================================== */
.report-print-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 2.5rem;
  box-shadow: var(--shadow-md);
  margin-top: 1rem;
  font-family: var(--font-body);
}

.report-doc-header {
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  border-bottom: 2px solid var(--color-good); 
  padding-bottom: 1.25rem; 
  margin-bottom: 1.5rem;
}

.report-doc-title {
  font-family: var(--font-title); 
  font-size: 1.6rem; 
  font-weight: 800; 
  margin: 0; 
  letter-spacing: 0.5px; 
  color: var(--color-good);
}

.report-doc-subtitle {
  font-size: 0.8rem; 
  color: var(--text-secondary); 
  font-weight: 600;
  letter-spacing: 1px;
}

.report-doc-cn {
  font-weight: 800; 
  font-family: var(--font-title); 
  font-size: 1.3rem; 
  color: var(--text-primary);
}

.report-doc-print-date {
  font-size: 0.75rem; 
  color: var(--text-muted);
}

.report-grid-half {
  display: grid; 
  grid-template-columns: 1fr 1fr; 
  gap: 1.5rem; 
  margin-bottom: 1.5rem;
}

.report-section-card {
  padding: 1.25rem; 
  background: rgba(255, 255, 255, 0.01) !important; 
  border: 1px solid var(--border-color) !important;
  box-shadow: none !important;
}

.report-section-title {
  font-family: var(--font-title); 
  font-size: 0.95rem; 
  margin-bottom: 0.85rem; 
  color: var(--color-good); 
  border-bottom: 1px solid var(--border-color); 
  padding-bottom: 0.35rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.report-metadata-table {
  width: 100%; 
  font-size: 0.8rem; 
  border-collapse: collapse; 
  line-height: 1.75;
}

.report-metadata-table td:first-child {
  color: var(--text-secondary); 
  width: 45%;
}

.report-metadata-table td:last-child {
  font-weight: 600;
  color: var(--text-primary);
}

.report-content-section {
  margin-bottom: 1.75rem;
}

.report-chart-card {
  padding: 1.25rem; 
  height: 280px; 
  display: flex; 
  flex-direction: column; 
  background: rgba(255, 255, 255, 0.01) !important; 
  border: 1px solid var(--border-color) !important;
  box-shadow: none !important;
}

.report-sign-off {
  margin-top: 3.5rem; 
  display: flex; 
  justify-content: space-between; 
  align-items: flex-end; 
  font-size: 0.8rem; 
  border-top: 1px solid var(--border-color); 
  padding-top: 1.5rem;
  page-break-inside: avoid;
}

/* Follow Up Instruction (FUI) Laporan Styles */
.fui-pap-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 1024px) {
  .fui-pap-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.fui-pap-item {
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.fui-pap-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}
.fui-pap-title {
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}
.fui-pap-chart-wrapper {
  height: 220px;
  position: relative;
  width: 100%;
}
.signature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}
@media (min-width: 768px) {
  .signature-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
.sig-box {
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 150px;
  background: rgba(255, 255, 255, 0.01);
}
.sig-title {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-align: center;
}
.sig-line {
  border-bottom: 1px dashed var(--text-muted);
  width: 80%;
  margin: 2rem auto 0.5rem auto;
}
.sig-name {
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
  color: var(--text-primary);
}
.sig-role {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
}
.sig-date {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
}
.followup-manual-table th {
  font-weight: 600;
}

/* Light mode modifications for print report */
body.light-mode .report-print-container {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.1);
  color: #000000;
}

body.light-mode .report-section-card,
body.light-mode .report-chart-card,
body.light-mode .fui-pap-item,
body.light-mode .sig-box {
  background: #ffffff !important;
  border-color: rgba(15, 23, 42, 0.1) !important;
}

/* Print Layout rules */
@page {
  size: A4 portrait;
  margin: 10mm 12mm 10mm 12mm;
}

@media print {
  :root, html, body {
    --text-primary: #090d16 !important;
    --text-secondary: #334155 !important;
    --text-muted: #64748b !important;
    --border-color: #cbd5e1 !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    color: #000000 !important;
  }

  /* Hide UI elements */
  .sidebar,
  .main-header,
  .theme-switch-item,
  .report-filters-card,
  .btn,
  .toast-notification,
  .asset-actions,
  .no-print {
    display: none !important;
  }

  details.asset-components-details > *:not(summary) {
    display: block !important;
  }
  details.asset-components-details summary span:last-child {
    display: none !important;
  }
  /* Ensure components div inside print target is fully expanded without scroll */
  details.asset-components-details > div {
    max-height: none !important;
    overflow: visible !important;
  }

  /* Single asset card print layout */
  body.printing-single-asset {
    background: #ffffff !important;
  }
  body.printing-single-asset .view-section:not(#view-assets) {
    display: none !important;
  }
  body.printing-single-asset #view-assets > div:first-child {
    display: none !important;
  }
  body.printing-single-asset .asset-group-header {
    display: none !important;
  }
  body.printing-single-asset .assets-grid {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  body.printing-single-asset .asset-card:not(.print-target) {
    display: none !important;
  }
  body.printing-single-asset .asset-card.print-target {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: none !important;
    padding: 1.5rem !important;
    background: #ffffff !important;
    color: #000000 !important;
    page-break-inside: avoid !important;
  }

  .app-container {
    width: 100% !important;
    display: block !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }
  
  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    display: block !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    flex-grow: 0 !important;
  }
  
  .report-print-container,
  .followup-print-container {
    border: none !important;
    box-shadow: none !important;
    background: #ffffff !important;
    color: #000000 !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .card, 
  .report-section-card,
  .report-chart-card,
  .parameter-value-card,
  .fui-pap-item,
  .sig-box {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #000000 !important;
    box-shadow: none !important;
    page-break-inside: avoid !important;
  }

  .signature-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 0.5rem !important;
  }

  .sig-line {
    border-bottom: 1px solid #000000 !important;
  }

  .followup-manual-table td, 
  .followup-manual-table th {
    border: 1px solid #64748b !important;
    color: #000000 !important;
  }

  .param-name,
  .param-unit,
  .param-limit {
    color: #334155 !important;
  }

  .param-val {
    color: #0f172a !important;
  }

  .report-metadata-table td:first-child {
    color: #334155 !important;
  }

  .report-metadata-table td:last-child {
    color: #000000 !important;
  }

  .report-section-title {
    border-bottom-color: #94a3b8 !important;
  }

  .report-sign-off {
    border-top-color: #94a3b8 !important;
  }

  /* Prevent page cuts inside report blocks */
  .report-grid-half {
    page-break-inside: avoid;
  }
  .report-content-section {
    page-break-inside: auto !important;
  }

  /* Allow natural page breaks between sections, but keep individual items intact */
  .followup-print-container .report-content-section {
    page-break-inside: auto !important;
  }
  
  .followup-print-container .card,
  .followup-print-container .report-section-card,
  .followup-print-container .report-chart-card,
  .followup-print-container .fui-pap-item,
  .followup-print-container .fui-engine-chart-wrapper,
  .followup-print-container .signature-grid {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* Prevent individual table rows from breaking across pages, but allow tables to break between rows */
  .report-print-container table tr,
  .followup-print-container table tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* Ensure repeating header works cleanly on print */
  .report-print-container > table,
  .followup-print-container > table {
    width: 100% !important;
    table-layout: fixed !important;
    border-collapse: collapse !important;
    border: none !important;
    background: transparent !important;
    display: table !important;
  }
  .report-print-container > table > thead,
  .followup-print-container > table > thead {
    display: table-header-group !important;
  }
  .report-print-container > table > tbody,
  .followup-print-container > table > tbody {
    display: table-row-group !important;
  }

  /* Prevent page cuts inside outer table rows by default */
  .report-print-container > table > tbody > tr,
  .followup-print-container > table > tbody > tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
  
  /* Exceptions: Allow page break inside specific rows that are designed to split across pages */
  .report-print-container > table > tbody > tr:nth-child(3) {
    page-break-inside: auto !important;
    break-inside: auto !important;
  }
  .followup-print-container > table > tbody > tr:nth-child(2) {
    page-break-inside: auto !important;
    break-inside: auto !important;
  }

  /* Reset white-space nowrap on tables under print to prevent horizontal overflow */
  .report-print-container table td,
  .followup-print-container table td,
  .report-print-container table th,
  .followup-print-container table th {
    white-space: normal !important;
    word-break: break-word !important;
  }

  /* Force Section II PAP charts to display as 2 columns on print */
  .followup-print-container .fui-pap-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
    width: 100% !important;
  }

  .followup-print-container .fui-pap-item {
    padding: 0.65rem !important;
    margin-bottom: 0 !important; /* Managed by grid gap */
  }

  .followup-print-container .fui-pap-header {
    margin-bottom: 0.4rem !important;
    padding-bottom: 0.25rem !important;
  }
  .followup-print-container .fui-pap-title {
    font-size: 0.75rem !important;
  }
  .followup-print-container .fui-pap-chart-wrapper {
    height: 125px !important;
  }

  /* Specific column widths for 4-column specifications table in followup report */
  .followup-print-container .report-metadata-table {
    width: 100% !important;
    table-layout: fixed !important;
  }
  .followup-print-container .report-metadata-table td {
    width: auto !important;
  }
  .followup-print-container .report-metadata-table td:nth-child(odd) {
    width: 24% !important;
    color: #334155 !important;
  }
  .followup-print-container .report-metadata-table td:nth-child(even) {
    width: 26% !important;
    font-weight: 600 !important;
    color: #000000 !important;
  }

  /* Force all print charts to fit within their parent containers without overflow or cut-off */
  .report-print-container canvas,
  .followup-print-container canvas {
    max-width: 100% !important;
    max-height: 100% !important;
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    box-sizing: border-box !important;
  }

  /* Shrunk sizes for main report chart cards to optimize page counts */
  .report-chart-card {
    display: block !important;
    height: 190px !important;
    padding: 0.65rem !important;
    position: relative !important;
  }
  .report-chart-card h4 {
    font-size: 0.7rem !important;
    margin-bottom: 0.25rem !important;
  }
  .report-chart-card > div {
    height: 140px !important;
    position: relative !important;
    width: 100% !important;
  }

  /* Shrunk sizes for followup Pareto chart card */
  .followup-print-container .report-section-card[style*="height: 320px"] {
    display: block !important;
    height: 220px !important;
    padding: 0.75rem !important;
    position: relative !important;
  }
  .followup-print-container .report-section-card[style*="height: 320px"] > div {
    height: 170px !important;
    position: relative !important;
    width: 100% !important;
  }

  /* Shrunk followup engine chart wrapper */
  .followup-print-container .fui-engine-chart-wrapper {
    height: 135px !important;
    margin-top: 0.75rem !important;
  }

  /* Font-sizes, spacing and padding optimizations to look neat on print and reduce pages */
  .report-doc-title {
    font-size: 1.25rem !important;
  }
  .report-doc-subtitle {
    font-size: 0.7rem !important;
  }
  .report-doc-cn {
    font-size: 1.1rem !important;
  }
  .report-doc-print-date {
    font-size: 0.65rem !important;
  }
  .report-doc-header {
    padding-bottom: 0.75rem !important;
    margin-bottom: 0.85rem !important;
  }
  .report-section-title {
    font-size: 0.8rem !important;
    margin-bottom: 0.5rem !important;
    padding-bottom: 0.25rem !important;
  }

  .report-metadata-table {
    font-size: 0.72rem !important;
    line-height: 1.5 !important;
  }
  .custom-table {
    font-size: 0.72rem !important;
  }
  .custom-table th, 
  .custom-table td {
    padding: 0.4rem 0.6rem !important;
  }
  .followup-manual-table td {
    height: 30px !important;
  }

  .parameter-value-card {
    padding: 0.5rem !important;
  }
  .param-name {
    font-size: 0.65rem !important;
  }
  .param-val {
    font-size: 0.9rem !important;
  }
  .param-limit {
    font-size: 0.55rem !important;
  }

  .report-content-section {
    margin-bottom: 0.85rem !important;
  }
  .report-grid-half {
    gap: 0.75rem !important;
    margin-bottom: 0.85rem !important;
  }
  .report-section-card {
    padding: 0.75rem !important;
  }
  .sig-box {
    padding: 0.5rem !important;
    font-size: 0.7rem !important;
  }
  .sig-box p {
    margin-bottom: 0.25rem !important;
  }
  .sig-line {
    margin: 1rem 0 0.25rem 0 !important;
  }
}

/* ==========================================================================
   AUTHENTICATION & ROLE-BASED ACCESS CONTROL (LOGIN PAGE)
   ========================================================================== */

/* Hiding Admin-Only elements when user role is 'user' */
body.user-role .admin-only-menu,
body.user-role .admin-only {
  display: none !important;
}

/* Login Overlay View */
.login-overlay-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 99999; /* Highest priority overlay */
  background: #090d16;
  background-image: radial-gradient(circle at 50% 50%, #111a2e 0%, #06090f 100%);
  display: none; /* Controlled dynamically by JS */
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow-y: auto;
}

.login-overlay-container.active {
  display: flex;
}

/* Glassmorphism Login Card */
.login-card {
  width: 100%;
  max-width: 420px;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 2.75rem 2.25rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 
              0 0 40px rgba(56, 189, 248, 0.1);
  text-align: center;
  animation: loginFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* Logo animation and styling */
.login-logo-container {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(56, 189, 248, 0.08);
  border: 2px solid rgba(56, 189, 248, 0.25);
  border-radius: 50%;
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.15);
  transition: transform 0.3s ease;
}

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

.login-logo-svg {
  color: #38bdf8;
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.6));
}

.login-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.85rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 0.25rem;
  letter-spacing: 3px;
  background: linear-gradient(135deg, #ffffff 40%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.5px;
  margin-bottom: 2.25rem;
  text-transform: uppercase;
}

/* Inputs styling overrides for Login Card */
.login-card .input-field {
  text-align: left;
}

.login-card .input-field label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.45rem;
  display: block;
}

.login-card .input-control {
  background: rgba(15, 23, 42, 0.6);
  border-color: rgba(255, 255, 255, 0.1);
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: #ffffff;
}

.login-card .input-control:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
  background: rgba(15, 23, 42, 0.8);
}

/* Premium Login Button */
.login-btn {
  font-weight: 700;
  letter-spacing: 1px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(14, 165, 233, 0.25);
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(14, 165, 233, 0.4);
}

.login-footer {
  margin-top: 2.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 1.25rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.login-footer p:first-child {
  opacity: 0.75;
}

/* Adaptability for Light Mode */
body.light-mode .login-overlay-container {
  background: #f1f5f9;
  background-image: radial-gradient(circle at 50% 50%, #f8fafc 0%, #e2e8f0 100%);
}

body.light-mode .login-card {
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.08), 
              0 0 30px rgba(14, 165, 233, 0.05);
}

body.light-mode .login-title {
  background: linear-gradient(135deg, #0f172a 40%, #0284c7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

body.light-mode .login-card .input-control {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(15, 23, 42, 0.12);
  color: #0f172a;
}

body.light-mode .login-card .input-control:focus {
  background: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 0 10px rgba(14, 165, 233, 0.15);
}

body.light-mode .login-footer {
  border-top-color: rgba(15, 23, 42, 0.05);
}

/* Sidebar styling adjustment */
#btn-logout-sidebar a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  transition: background 0.2s ease;
}

#btn-logout-sidebar a:hover {
  background: rgba(248, 113, 113, 0.08);
}

/* ==================== RIWAYAT BREAKDOWN STYLE ==================== */
.badge-scheduled {
  background-color: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-unscheduled {
  background-color: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Adaptability for Light Mode */
body.light-mode .badge-scheduled {
  background-color: rgba(14, 165, 233, 0.1);
  color: #0284c7;
  border: 1px solid rgba(14, 165, 233, 0.2);
}

body.light-mode .badge-unscheduled {
  background-color: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.excel-upload-container:hover, .excel-upload-container.dragover {
  border-color: var(--color-active) !important;
  background: rgba(56, 189, 248, 0.05) !important;
  box-shadow: var(--shadow-glow-blue);
}

body.light-mode .excel-upload-container {
  background: #f8fafc !important;
}

body.light-mode .excel-upload-container:hover, body.light-mode .excel-upload-container.dragover {
  background: rgba(14, 165, 233, 0.05) !important;
}

/* Media query for very small mobile screens (width <= 480px) */
@media (max-width: 480px) {
  .table-filters {
    width: 100%;
    flex-direction: column;
    gap: 0.5rem;
  }

  .table-filters input, .table-filters button {
    width: 100% !important;
  }

  .card {
    padding: 0.75rem;
  }

  .unit-select-btn {
    padding: 0.5rem 0.85rem;
    font-size: 0.8rem;
  }

  .main-header h1 {
    font-size: 1.5rem;
  }
  
  .parameter-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ==================== VHMS HD785-7 THEME-ADAPTIVE STYLING ==================== */
#view-vhms-hd785 {
  transition: background 0.3s ease, border-color 0.3s ease;
}

body.light-mode #view-vhms-hd785 {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
}

body.light-mode #view-vhms-hd785 .vhms-top-bar {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04) !important;
}

body.light-mode #view-vhms-hd785 .vhms-title {
  color: #0f172a !important;
}

body.light-mode #view-vhms-hd785 .vhms-subtitle {
  color: #475569 !important;
}

body.light-mode #view-vhms-hd785 .vhms-location-tabs {
  background: #e2e8f0 !important;
  border-color: #cbd5e1 !important;
}

body.light-mode #view-vhms-hd785 .vhms-location-tabs .btn-tab {
  color: #334155 !important;
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
}

body.light-mode #view-vhms-hd785 .vhms-location-tabs .btn-tab.active {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0284c7 !important;
}

body.light-mode #view-vhms-hd785 .vhms-card {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04) !important;
}

body.light-mode #view-vhms-hd785 .vhms-gauge-title {
  color: #334155 !important;
}

body.light-mode #view-vhms-hd785 .vhms-gauge-limit {
  color: #64748b !important;
}

body.light-mode #view-vhms-hd785 .vhms-trend-select {
  background: #f8fafc !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}



