/* SAFES Design System & Component Styles */
:root {
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --primary-50: #eff6ff;
  --success-600: #16a34a;
  --success-50: #f0fdf4;
  --warning-600: #d97706;
  --warning-50: #fffbeb;
  --danger-600: #dc2626;
  --danger-50: #fef2f2;
  --info-600: #0284c7;
  --info-50: #f0f9ff;
  --neutral-900: #0f172a;
  --neutral-800: #1e293b;
  --neutral-700: #334155;
  --neutral-600: #475569;
  --neutral-400: #94a3b8;
  --neutral-200: #e2e8f0;
  --neutral-100: #f1f5f9;
  --neutral-50: #f8fafc;
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
  --card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
  --glass-bg: rgba(255, 255, 255, 0.95);
  --border-radius: 12px;
  --transition-fast: all 0.2s ease;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--neutral-100);
  color: var(--neutral-900);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Header & Top Bar */
.safes-header,
.safes-navbar,
#safes-navbar,
#navbar,
.top-bar {
  background: var(--neutral-900);
  color: #fff;
  padding: 0.65rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative !important;
  top: auto !important;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.brand-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo-badge {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
  font-weight: 800;
  font-size: 1.2rem;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  letter-spacing: 1px;
}

.brand-text-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: #f8fafc;
}

.brand-text-sub {
  font-size: 0.75rem;
  color: var(--neutral-400);
}

.role-switcher-banner {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  padding: 0.25rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.role-switcher-banner label {
  font-size: 0.8rem;
  color: #cbd5e1;
  font-weight: 500;
}

.role-select-dropdown {
  background: var(--neutral-800);
  color: #fff;
  border: 1px solid #475569;
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  max-width: 100%;
  text-overflow: ellipsis;
  overflow: hidden;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-600);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

/* Layout Wrapper */
.safes-app-container,
.app-container,
.main-layout {
  display: flex;
  flex: 1;
  position: relative;
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  min-height: 0;
}

#safes-sidebar,
.safes-sidebar {
  width: 260px;
  min-width: 260px;
  max-width: 260px;
  background: var(--sb-bg);
  border-right: 1px solid var(--sb-edge);
  color: var(--sb-text);
  padding: 1.25rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 1050;
  flex-shrink: 0;
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  bottom: 0 !important;
  height: 100vh !important;
  height: 100dvh !important;
  margin-left: 0;
  opacity: 1;
  visibility: visible;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, margin-left, opacity;
}

#safes-sidebar.hidden,
.safes-sidebar.hidden {
  margin-left: -260px !important;
  transform: translateX(-100%);
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.safes-content-wrapper,
.main-layout-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0 !important;
  width: 100%;
  box-sizing: border-box;
}

/* Desktop Alignment: Dynamic Content Width Adjustment */
@media (min-width: 993px) {
  /* Dynamic Header Width */
  .safes-header,
  .safes-navbar,
  #safes-navbar,
  #navbar,
  .top-bar {
    margin-left: 260px;
    width: calc(100% - 260px);
    max-width: calc(100% - 260px);
    box-sizing: border-box;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* When sidebar is visible: dynamically contract content area */
  #safes-sidebar:not(.hidden) ~ .safes-content-wrapper,
  #safes-sidebar:not(.hidden) ~ .main-layout-content,
  #safes-sidebar:not(.hidden) ~ .main-content,
  #safes-sidebar:not(.hidden) ~ #view-container,
  body.has-sidebar .safes-content-wrapper,
  body.has-sidebar #view-container,
  body.has-sidebar .main-content,
  body:not(.sidebar-collapsed) .safes-content-wrapper,
  body:not(.sidebar-collapsed) #view-container,
  body:not(.sidebar-collapsed) .main-content {
    margin-left: 260px;
    width: calc(100% - 260px);
    max-width: calc(100% - 260px);
    box-sizing: border-box;
    min-width: 0 !important;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* When view-container is nested inside safes-content-wrapper, avoid double margin */
  .safes-content-wrapper #view-container,
  .safes-content-wrapper .main-content,
  .safes-content-wrapper .safes-main-content,
  .main-layout-content #view-container,
  .main-layout-content .main-content,
  .main-layout-content .safes-main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
  }

  /* When sidebar is hidden: expand to 100% */
  #safes-sidebar.hidden ~ .safes-content-wrapper,
  #safes-sidebar.hidden ~ .main-layout-content,
  #safes-sidebar.hidden ~ .main-content,
  #safes-sidebar.hidden ~ #view-container,
  body.sidebar-collapsed .safes-header,
  body.sidebar-collapsed .safes-navbar,
  body.sidebar-collapsed #safes-navbar,
  body.sidebar-collapsed .safes-content-wrapper,
  body.sidebar-collapsed .main-layout-content,
  body.sidebar-collapsed #view-container,
  body.sidebar-collapsed .main-content,
  body:not(.has-sidebar) .safes-header,
  body:not(.has-sidebar) .safes-content-wrapper,
  body:not(.has-sidebar) .main-layout-content,
  body:not(.has-sidebar) #view-container,
  body:not(.has-sidebar) .main-content,
  body:has(#safes-sidebar.hidden) .safes-header,
  body:has(#safes-sidebar.hidden) .safes-content-wrapper,
  body:has(#safes-sidebar.hidden) #view-container,
  body:not(:has(#safes-sidebar:not(.hidden))) .safes-header,
  body:not(:has(#safes-sidebar:not(.hidden))) .safes-content-wrapper,
  body:not(:has(#safes-sidebar:not(.hidden))) #view-container {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }
}

/* Justified and Indented Text Helper Styles */
.justified-text {
  text-align: justify;
  text-justify: inter-word;
  text-indent: 1.5rem;
  line-height: 1.7;
}

.justified-text-no-indent {
  text-align: justify;
  text-justify: inter-word;
  line-height: 1.7;
}

/* ---- Side menu: calm, low-contrast base with a single gold highlight for "where am I" ---- */
:root {
  --sb-bg: #15233a;
  --sb-edge: rgba(255, 255, 255, 0.06);
  --sb-text: #b4c0d3;
  --sb-text-strong: #ffffff;
  --sb-section: #7a88a1;
  --sb-hover: rgba(255, 255, 255, 0.05);
  --sb-active-bg: rgba(255, 255, 255, 0.08);
  --sb-gold: #e9b44c;
}

.nav-section-title {
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  color: var(--sb-section);
  font-weight: 600;
  margin: 1.1rem 0.75rem 0.35rem;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.75rem;
  color: var(--sb-text);
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.3;
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-item svg,
.nav-item i {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke-width: 1.75;
  opacity: 0.8;
}

.nav-item:hover {
  background: var(--sb-hover);
  color: var(--sb-text-strong);
}

.nav-item:focus-visible {
  outline: 2px solid var(--sb-gold);
  outline-offset: 1px;
}

.nav-item.active {
  background: var(--sb-active-bg);
  color: var(--sb-text-strong);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -0.85rem;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--sb-gold);
}

.nav-item.active svg,
.nav-item.active i {
  color: var(--sb-gold);
  opacity: 1;
}

.nav-section-admin {
  color: #b9a3e3;
  border-top: 1px solid var(--sb-edge);
  padding-top: 0.85rem;
}

.nav-item-admin { color: #cdbcf0; }

.nav-footer {
  border-top: 1px solid var(--sb-edge);
  padding-top: 0.5rem;
}

.nav-item-logout { color: #e8a5a5; }
.nav-item-logout:hover { background: rgba(239, 68, 68, 0.1); color: #fecaca; }

@media (prefers-reduced-motion: reduce) {
  .nav-item { transition: none; }
}

html, body {
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.safes-main-content,
#view-container,
.main-content {
  flex: 1;
  padding: 0.35rem 1.5rem 1.5rem 1.5rem !important;
  padding-top: 0.35rem !important;
  background: var(--neutral-100);
  overflow-y: visible;
  scroll-behavior: smooth;
  opacity: 1 !important;
  color: var(--neutral-900);
}

/* Top Progress Accent Loader */
#safes-top-loader {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, #2563eb, #3b82f6, #facc15, #16a34a);
  z-index: 99999;
  pointer-events: none;
  transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.22s ease;
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.8);
}

/* Professional View Entrance Transitions */
@keyframes safesViewFadeIn {
  0% {
    opacity: 0;
    transform: translateY(6px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.safes-view-enter {
  animation: safesViewFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
  will-change: opacity, transform;
}

/* Common UI Components */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--neutral-900);
}

.page-subtitle {
  font-size: 0.9rem;
  color: var(--neutral-600);
  margin-top: 0.25rem;
}

.card {
  background: #fff;
  border-radius: var(--border-radius);
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--neutral-200);
  margin-bottom: 1.5rem;
}

/* Fix Grid & Table Blowout */
.grid-4,
.grid-3,
.grid-2 {
  display: grid;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.grid-4 > *,
.grid-3 > *,
.grid-2 > *,
.grid-4 > div,
.grid-3 > div,
.grid-2 > div {
  min-width: 0 !important;
  max-width: 100%;
  box-sizing: border-box;
}

.main-content,
.safes-main-content,
#view-container,
.safes-content-wrapper,
.main-layout-content,
.card,
.card-body {
  min-width: 0 !important;
  box-sizing: border-box;
}

/* Form Controls & Labels */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--neutral-800);
  margin-bottom: 0.35rem;
}

.form-control {
  width: 100%;
  padding: 0.55rem 0.75rem;
  font-size: 0.88rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--neutral-900);
  background-color: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

.form-control:focus {
  border-color: var(--primary-600);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

select.form-control {
  appearance: auto;
  cursor: pointer;
}

/* Dedicated Responsive Grid for Landing User Level Portals */
.safes-portal-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  margin-bottom: 0.65rem;
}

@media (max-width: 1023px) and (min-width: 640px) {
  .safes-portal-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.6rem;
  }
}

@media (max-width: 639px) {
  .safes-portal-grid {
    grid-template-columns: 1fr !important;
    gap: 0.6rem;
  }
}

@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-draft { background: #e2e8f0; color: #475569; }
.badge-submitted, .badge-under-verification { background: var(--warning-50); color: var(--warning-600); border: 1px solid #fcd34d; }
.badge-verified, .badge-approved, .badge-active { background: var(--success-50); color: var(--success-600); border: 1px solid #86efac; }
.badge-returned { background: var(--danger-50); color: var(--danger-600); border: 1px solid #fca5a5; }
.badge-locked { background: #f3e8ff; color: #7e22ce; border: 1px solid #d8b4fe; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition-fast);
  text-decoration: none;
}

.btn-primary { background: var(--primary-600); color: #fff; }
.btn-primary:hover { background: var(--primary-700); }
.btn-success { background: var(--success-600); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-warning { background: var(--warning-600); color: #fff; }
.btn-danger { background: var(--danger-600); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-secondary { background: var(--neutral-200); color: var(--neutral-800); }
.btn-secondary:hover { background: #cbd5e1; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

/* Tables and horizontal scroll containment */
.table-responsive,
.table-container,
.responsive-table,
.table-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  margin-top: 1rem;
  margin-bottom: 1rem;
}

table,
.table,
.report-table,
.data-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
  box-sizing: border-box;
}

.table th {
  background: var(--neutral-50);
  color: var(--neutral-600);
  font-weight: 600;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--neutral-200);
}

.table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--neutral-200);
  color: var(--neutral-800);
}

.table tbody tr:hover {
  background: var(--neutral-50);
}

/* Stepper Component */
.stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1.5rem 0;
  position: relative;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  z-index: 2;
  position: relative;
  flex: 1;
}

.step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--neutral-200);
  color: var(--neutral-600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  transition: var(--transition-fast);
}

.step-item.active .step-circle {
  background: var(--primary-600);
  color: white;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
}

.step-item.completed .step-circle {
  background: var(--success-600);
  color: white;
}

.step-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--neutral-600);
}

.step-item.active .step-label {
  color: var(--primary-600);
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: #fff;
  border-radius: var(--border-radius);
  max-width: 780px;
  width: 92%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--neutral-200);
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--neutral-400);
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 1.5rem;
  border-left: 2px solid var(--neutral-200);
  margin-top: 1rem;
}

.timeline-item {
  position: relative;
  margin-bottom: 1.25rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.95rem;
  top: 0.2rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary-600);
  border: 2px solid white;
}

.timeline-title {
  font-size: 0.875rem;
  font-weight: 700;
}

.timeline-meta {
  font-size: 0.75rem;
  color: var(--neutral-600);
}

.timeline-desc {
  font-size: 0.85rem;
  margin-top: 0.25rem;
  color: var(--neutral-700);
  background: var(--neutral-50);
  padding: 0.5rem;
  border-radius: 6px;
}

/* ========================================= */
/*       GLOBAL RESPONSIVE DESIGN SYSTEM     */
/* ========================================= */

:root {
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

/* Touch & Mobile Reset */
* {
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

body {
  padding-top: var(--sat);
  padding-bottom: var(--sab);
  padding-left: var(--sal);
  padding-right: var(--sar);
  -webkit-text-size-adjust: 100%;
}

.safes-app-container {
  display: flex;
  flex: 1;
  min-height: calc(100vh - 60px);
  min-height: calc(100dvh - 60px);
  position: relative;
  width: 100%;
}

.safes-header {
  padding-top: max(0.6rem, var(--sat));
  padding-left: max(1rem, var(--sal));
  padding-right: max(1rem, var(--sar));
}

#sidebar-toggle-btn {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}
#sidebar-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.22) !important;
  transform: scale(1.05);
}
#sidebar-toggle-btn:active {
  transform: scale(0.95);
}

/* Mobile Sidebar Backdrop Overlay */
.safes-sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1040;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.safes-sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.safes-main-content,
#view-container,
.main-content {
  flex: 1;
  padding: 0.35rem 1.5rem 1.5rem 1.5rem !important;
  padding-top: 0.35rem !important;
  background: var(--neutral-100);
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
  width: 100%;
}

/* Tablet & Mobile Breakpoints (< 992px) */
@media (max-width: 992px) {
  body {
    overflow-x: hidden;
  }

  .safes-header,
  .safes-navbar,
  #safes-navbar,
  #navbar,
  .top-bar {
    position: relative !important;
    top: auto !important;
    z-index: 100;
    padding: 0.6rem 0.85rem;
    background: var(--neutral-900);
  }

  .safes-header,
  .safes-navbar,
  #safes-navbar,
  #navbar,
  .top-bar,
  .safes-app-container,
  .app-container,
  .main-layout,
  .safes-content-wrapper,
  .main-layout-content,
  #view-container,
  .main-content,
  .safes-main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    min-width: 0 !important;
  }

  /* Off-Canvas Slide-Out Mobile Drawer Sidebar */
  #safes-sidebar,
  .safes-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 280px;
    min-width: 280px;
    max-width: 85vw;
    height: 100vh !important;
    height: 100dvh !important;
    margin-left: 0 !important;
    padding-top: max(1.5rem, var(--sat));
    padding-bottom: max(1.5rem, var(--sab));
    overflow-y: auto;
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.45);
    z-index: 1050;
    display: flex !important;
    transform: translateX(0);
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.35s ease !important;
  }

  #safes-sidebar.hidden,
  .safes-sidebar.hidden {
    margin-left: 0 !important;
    transform: translateX(-100%) !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: none !important;
    box-shadow: none !important;
  }

  .safes-main-content,
  #view-container,
  .main-content {
    padding: 0.4rem 0.85rem 1.15rem 0.85rem !important;
    padding-top: 0.4rem !important;
    overflow-y: visible;
    width: 100%;
    min-width: 0 !important;
    box-sizing: border-box;
  }

  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem; }
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem; }
}

/* Compact Mobile Breakpoints (< 640px) */
@media (max-width: 640px) {
  .safes-header,
  .safes-navbar,
  #safes-navbar,
  #navbar,
  .top-bar {
    padding: 0.5rem 0.65rem;
  }

  .safes-main-content,
  #view-container,
  .main-content {
    padding: 0.35rem 0.5rem 0.75rem 0.5rem !important;
    padding-top: 0.35rem !important;
    overflow-y: visible;
    min-width: 0 !important;
    box-sizing: border-box;
  }

  /* Single Column Layout on Phones */
  .grid-4, .grid-3, .grid-2 {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
    margin-bottom: 0.85rem;
  }

  .page-header > div {
    width: 100%;
  }

  .page-header .btn {
    width: 100%;
    justify-content: center;
  }

  .card {
    padding: 0.85rem;
    margin-bottom: 0.85rem;
    border-radius: 8px;
  }

  .page-title {
    font-size: 1.15rem;
  }

  .page-subtitle {
    font-size: 0.78rem;
  }

  /* Minimum Touch Target Sizes & iOS Auto-Zoom Prevention */
  button, .btn, .nav-item {
    min-height: 44px;
    touch-action: manipulation;
  }

  input[type="text"], 
  input[type="password"], 
  input[type="number"], 
  input[type="email"], 
  select, 
  textarea {
    font-size: 16px !important; /* Prevents auto-zoom on iOS Safari */
    min-height: 44px;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
  }

  /* Responsive Tables */
  .table-responsive, .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    margin-top: 0.5rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--neutral-200);
    border-radius: 8px;
  }

  .table th, .table td {
    padding: 0.55rem 0.5rem;
    font-size: 0.78rem;
    white-space: nowrap;
  }

  /* Modals on Mobile */
  .modal-box {
    width: 96%;
    max-width: 96vw;
    max-height: 92vh;
    max-height: 92dvh;
    padding: 0.85rem;
    border-radius: 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .modal-header {
    margin-bottom: 0.75rem;
  }

  .modal-title {
    font-size: 1rem;
  }

  /* Iframe Wrapper Container Fix for iOS Safari */
  iframe {
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
}

/* ========================================= */
/*   HERO BANNER COMPONENT & MOBILE RESPONSIVE  */
/* ========================================= */
.hero-banner-card {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.72) 0%, rgba(30, 27, 75, 0.62) 100%), url('../assets/scert_building_bg.jpg?v=20261007_v1338') !important;
  background-size: cover !important;
  background-position: center 38% !important;
  background-repeat: no-repeat !important;
  color: white;
  padding: 1.6rem 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--card-shadow);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 230px;
  margin-top: 0 !important;
  margin-bottom: 1.2rem;
}

.hero-bana-kaih-box {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  z-index: 10;
}

.bana-kaih-badge {
  background: rgba(255, 255, 255, 0.96);
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.bana-kaih-logo {
  height: 50px;
  max-width: 190px;
  object-fit: contain;
}

.bana-kaih-slogan {
  font-family: 'Brush Script MT', 'Dancing Script', 'Georgia', cursive, serif;
  font-size: 1.2rem;
  color: #ffffff;
  text-shadow: 0 2px 6px rgba(0,0,0,0.9);
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.hero-subtitle {
  font-size: 0.85rem;
  font-weight: 800;
  color: #93c5fd;
  letter-spacing: 0.5px;
  margin-bottom: 0.2rem;
}

.hero-title {
  font-size: 1.85rem;
  font-weight: 900;
  line-height: 1.2;
  color: white;
  margin-top: 0.15rem;
  margin-bottom: 0.5rem;
  letter-spacing: -0.3px;
}

.hero-description {
  font-size: 0.88rem;
  color: #e2e8f0;
  line-height: 1.48;
  margin-bottom: 0;
  font-weight: 500;
}

@media (max-width: 768px) {
  .hero-banner-card {
    padding: 1.15rem 0.9rem;
    min-height: auto;
  }

  .hero-bana-kaih-box {
    position: relative;
    top: 0;
    right: 0;
    align-items: flex-start;
    margin-bottom: 0.85rem;
  }

  .bana-kaih-badge {
    padding: 0.3rem 0.6rem;
  }

  .bana-kaih-logo {
    height: 38px;
    max-width: 140px;
  }

  .bana-kaih-slogan {
    font-size: 0.95rem;
    text-shadow: 0 1px 4px rgba(0,0,0,0.9);
  }

  .hero-subtitle {
    font-size: 0.72rem;
    line-height: 1.35;
  }

  .hero-title {
    font-size: 1.35rem;
    margin-top: 0.3rem;
    margin-bottom: 0.4rem;
  }

  .hero-description {
    font-size: 0.8rem;
    line-height: 1.4;
  }
}

/* ===================================================== */
/*   OFFICIAL WEBSITE DECLARATION FOOTER COMPONENT       */
/* ===================================================== */
.safes-official-declaration-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
  background: linear-gradient(90deg, #1d4b8f 0%, #29569b 25%, #464098 55%, #68349a 85%, #562187 100%);
  color: #ffffff;
  padding: 0.6rem 1rem 0.5rem 1rem;
  border-radius: 0;
  margin: 0;
  text-align: center;
  box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.15);
  position: relative;
  overflow: hidden;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.declaration-links-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  margin-bottom: 0.3rem;
  flex-wrap: wrap;
}

.decl-link {
  color: #ffffff;
  text-decoration: underline;
  transition: opacity 0.2s ease;
}

.decl-link:hover {
  opacity: 0.85;
}

.decl-badge-helpline {
  color: #ffffff;
  font-weight: 800;
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  letter-spacing: 0.3px;
}

.decl-divider {
  color: rgba(255, 255, 255, 0.6);
  font-weight: 400;
}

.declaration-main-text {
  font-size: 0.82rem;
  font-weight: 500;
  color: #ffffff;
  margin-bottom: 0.25rem;
  letter-spacing: 0.2px;
  text-align: center;
  width: 100%;
}

.declaration-main-text strong {
  font-weight: 800;
}

.declaration-sub-details {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.92);
  margin-bottom: 0.3rem;
  line-height: 1.25;
  flex-wrap: wrap;
}

.decl-powered-by {
  font-weight: 700;
}

.decl-lms-info {
  text-align: center;
}

.decl-dept-info {
  font-weight: 600;
  text-align: center;
}

.decl-browser-info {
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.82);
  margin-top: 0.1rem;
  text-align: center;
  width: 100%;
}

.declaration-emblem-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 90%;
  max-width: 480px;
  margin: 0.2rem auto 0 auto;
}

.emblem-line {
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.35);
}

.emblem-badge-safes {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.emblem-badge-safes:hover {
  transform: scale(1.08);
}

@media (max-width: 640px) {
  .safes-official-declaration-footer {
    padding: 0.5rem 0.5rem 0.4rem 0.5rem;
    margin-top: 0.5rem;
  }
    border-radius: 8px;
  }

  .declaration-main-text {
    font-size: 0.82rem;
  }

  .declaration-sub-details {
    font-size: 0.74rem;
  }

  .decl-browser-info {
    font-size: 0.68rem;
  }
}


