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

:root {
  --bg-base: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #ffffff;
  --border-subtle: #e2e8f0;
  --border-glow: rgba(99, 102, 241, 0.15);
  
  --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  --cyan-gradient: linear-gradient(135deg, #0284c7 0%, #0ea5e9 100%);
  --emerald-gradient: linear-gradient(135deg, #059669 0%, #10b981 100%);
  --amber-gradient: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  --color-success: #059669;
  --color-warning: #d97706;
  --color-danger: #dc2626;
  --color-info: #0284c7;
  --color-primary: #4f46e5;

  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  --shadow-glass: 0 4px 20px -2px rgba(15, 23, 42, 0.05);

  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* Subtle light mesh background */
body::before {
  content: '';
  position: fixed;
  top: -10vw;
  left: -10vw;
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.04) 0%, rgba(99, 102, 241, 0) 70%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  bottom: -10vw;
  right: -10vw;
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.04) 0%, rgba(56, 189, 248, 0) 70%);
  pointer-events: none;
  z-index: 0;
}

/* Clean Light Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ==========================================================================
   APP LAYOUT ARCHITECTURE (Sidebar + Header + Main Area)
   ========================================================================== */
.app-container {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* SLEEK WHITE SIDEBAR */
.sidebar {
  width: 260px;
  background: #ffffff;
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: width 0.3s ease;
  z-index: 100;
  box-shadow: 1px 0 3px rgba(0, 0, 0, 0.02);
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 24px 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
  font-size: 18px;
  color: #fff;
}

.brand-text {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.brand-badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  background: #eef2ff;
  border: 1px solid #e0e7ff;
  border-radius: 6px;
  color: #4f46e5;
  font-weight: 700;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 20px;
  flex-grow: 1;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 8px 12px 4px 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.nav-item svg, .nav-item .nav-icon {
  font-size: 16px;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.nav-item:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.nav-item:hover svg, .nav-item:hover .nav-icon {
  opacity: 1;
}

.nav-item.active {
  background: #eef2ff;
  color: #4f46e5;
  border: 1px solid #e0e7ff;
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 15%;
  bottom: 15%;
  width: 3px;
  background: var(--color-primary);
  border-radius: 0 4px 4px 0;
}

.nav-item.active svg, .nav-item.active .nav-icon {
  opacity: 1;
  color: #4f46e5;
}

/* User & System Status in Sidebar footer */
.sidebar-footer {
  border-top: 1px solid var(--border-subtle);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.user-profile-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: white;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
}

.btn-sidebar-logout {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s;
  font-size: 16px;
}

.btn-sidebar-logout:hover {
  color: var(--color-danger);
  transform: translateX(2px);
}

/* ==========================================================================
   MAIN CONTENT AREA & COMMAND HEADER
   ========================================================================== */
.main-wrapper {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* TOP HEADER */
.top-header {
  height: 64px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-title-badge {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Live Operational Status Pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 30px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-success);
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* MAIN VIEW CONTAINER */
.page-content {
  padding: 32px;
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
}

.hero-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 28px;
}

.hero-header h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.hero-header p {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

/* ==========================================================================
   METRIC KPI CARDS (4 Clean Stats)
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.kpi-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px;
  position: relative;
  overflow: hidden;
  transition: all 0.25s ease;
  box-shadow: var(--shadow-card);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  transition: background 0.3s;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: #cbd5e1;
  box-shadow: var(--shadow-hover);
}

.kpi-card.glow-purple:hover::before { background: var(--primary-gradient); }
.kpi-card.glow-cyan:hover::before { background: var(--cyan-gradient); }
.kpi-card.glow-emerald:hover::before { background: var(--emerald-gradient); }
.kpi-card.glow-amber:hover::before { background: var(--amber-gradient); }

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

.kpi-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.kpi-icon-wrapper {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.icon-purple { background: #eef2ff; color: #4f46e5; border: 1px solid #e0e7ff; }
.icon-cyan { background: #f0f9ff; color: #0284c7; border: 1px solid #bae6fd; }
.icon-emerald { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
.icon-amber { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #0f172a;
  margin-bottom: 6px;
}

.kpi-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.kpi-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 11px;
}

.tag-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.tag-info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ==========================================================================
   CARDS & SECTIONS
   ========================================================================== */
.glass-panel {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-card);
  margin-bottom: 32px;
}

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

.panel-header h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #0f172a;
}

/* ==========================================================================
   HIGH-END DATA TABLE
   ========================================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.modern-table {
  width: 100%;
  min-width: 650px;
  border-collapse: collapse;
  text-align: left;
}

.modern-table th {
  padding: 14px 18px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--border-subtle);
}

.modern-table td {
  padding: 16px 18px;
  font-size: 14px;
  color: var(--text-secondary);
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.2s;
}

.modern-table tbody tr {
  transition: all 0.2s;
}

.modern-table tbody tr:hover {
  background: #f8fafc;
}

.modern-table tbody tr:hover td {
  color: var(--text-primary);
}

.table-title-cell {
  font-weight: 600;
  color: #0f172a !important;
}

.table-site-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #f1f5f9;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-primary);
}

.table-filename {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #4f46e5;
}

/* STATUS HALO BADGES */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}
.status-success .status-dot {
  background: #059669;
}

.status-pending {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}
.status-pending .status-dot {
  background: #d97706;
}

.status-failed {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}
.status-failed .status-dot {
  background: #dc2626;
}

/* ==========================================================================
   BUTTONS & FORM ELEMENTS
   ========================================================================== */
.btn-gradient {
  background: var(--primary-gradient);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

.btn-gradient:hover {
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.btn-secondary {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}

.form-group {
  margin-bottom: 22px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-control::placeholder {
  color: #94a3b8;
}

/* ==========================================================================
   DRAG & DROP INTERACTIVE UPLOAD DROPZONE
   ========================================================================== */
.dropzone-container {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-lg);
  padding: 40px 20px;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.dropzone-container:hover, .dropzone-container.dragover {
  border-color: var(--color-primary);
  background: #eef2ff;
}

.dropzone-icon {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: #e0e7ff;
  color: #4f46e5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin: 0 auto 16px auto;
  transition: transform 0.3s;
}

.dropzone-container:hover .dropzone-icon {
  transform: translateY(-2px);
}

.dropzone-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 6px;
}

.dropzone-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

/* File Selected Preview Card */
.file-preview-card {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-md);
  margin-top: 16px;
}

.file-preview-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.file-preview-icon {
  font-size: 24px;
}

.file-preview-name {
  font-size: 14px;
  font-weight: 600;
  color: #065f46;
}

.file-preview-size {
  font-size: 12px;
  color: #059669;
}

.btn-remove-file {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  transition: color 0.2s;
}

.btn-remove-file:hover {
  color: var(--color-danger);
}

/* ==========================================================================
   SATELLITE WEBSITES CARDS GRID
   ========================================================================== */
.satellite-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.satellite-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all 0.25s ease;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.satellite-card:hover {
  transform: translateY(-2px);
  border-color: #cbd5e1;
  box-shadow: var(--shadow-hover);
}

.satellite-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.satellite-name {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.satellite-url {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  word-break: break-all;
  margin-bottom: 16px;
  background: #f8fafc;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.satellite-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
  padding-top: 14px;
  margin-top: 14px;
}

/* ==========================================================================
   AUTH / LOGIN PAGE
   ========================================================================== */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  z-index: 1;
  background: #f8fafc;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

.auth-logo-center {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin: 0 auto 20px auto;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
  color: #fff;
}

.auth-title {
  text-align: center;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
  margin-bottom: 6px;
}

.auth-desc {
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 30px;
}

.captcha-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.captcha-img-holder {
  background: #f8fafc;
  border-radius: var(--radius-sm);
  cursor: pointer;
  height: 46px;
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid #cbd5e1;
}

.btn-refresh-captcha {
  width: 44px;
  height: 44px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s;
}

.btn-refresh-captcha:hover {
  color: #0f172a;
  background: #eef2ff;
  border-color: #c7d2fe;
}

/* Toast Notifications */
.toast-msg {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: none;
  z-index: 9999;
  animation: slide-in 0.3s ease;
}

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

.toast-success {
  background: #059669;
  color: white;
  border: 1px solid #047857;
}

.toast-danger {
  background: #dc2626;
  color: white;
  border: 1px solid #b91c1c;
}

/* Mobile Navigation Drawer & Toggle */
/* ==========================================================================
   MULTI-DEVICE RESPONSIVE SYSTEM (iOS, Android, Tablet, Desktop)
   ========================================================================== */

/* Touch Target Sizes & iOS Smoothing */
button, input, select, textarea, a {
  touch-action: manipulation;
}

.mobile-nav-toggle {
  display: none;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  color: #0f172a;
  font-size: 22px;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.mobile-nav-toggle:hover, .mobile-nav-toggle:active {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

/* Close button inside sidebar for mobile/tablet */
.btn-close-sidebar {
  display: none;
  background: #f1f5f9;
  border: 1px solid var(--border-subtle);
  color: #0f172a;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  transition: background 0.2s;
  flex-shrink: 0;
}

.btn-close-sidebar:hover {
  background: #e2e8f0;
}

/* Dimmed backdrop when mobile sidebar is open */
.sidebar-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 998;
  display: none;
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-backdrop.active {
  display: block;
  opacity: 1;
}

body.sidebar-open {
  overflow: hidden;
}

/* Quick Navigation Pills (Mobile/Tablet Swipe Bar) */
.mobile-quick-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 4px 14px 4px;
  margin-bottom: 20px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}

.mobile-quick-nav::-webkit-scrollbar {
  display: none;
}

.quick-pill {
  white-space: nowrap;
  padding: 8px 14px;
  min-height: 38px;
  border-radius: 9999px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.quick-pill:hover, .quick-pill:active {
  background: #f8fafc;
  color: #0f172a;
  border-color: #cbd5e1;
}

.quick-pill.active {
  background: #eef2ff;
  color: #4f46e5;
  border-color: #c7d2fe;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.12);
}

/* Table Horizontal Touch Scrolling */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  scrollbar-width: thin;
}

.modern-table {
  min-width: 680px;
}

/* ==========================================================================
   MEDIA QUERIES: TABLETS & IPADS (769px - 1024px)
   ========================================================================== */
@media (max-width: 1024px) {
  .mobile-nav-toggle {
    display: inline-flex;
  }

  .btn-close-sidebar {
    display: flex;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    width: 290px;
    max-width: 82vw;
    height: 100vh;
    height: 100dvh;
    z-index: 999;
    box-shadow: 12px 0 40px rgba(15, 23, 42, 0.18);
    transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar.open {
    left: 0;
  }

  .main-wrapper {
    width: 100%;
    min-width: 0;
  }

  .top-header {
    padding: 10px 20px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .satellite-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   MEDIA QUERIES: SMARTPHONES (iOS & ANDROID <= 768px)
   ========================================================================== */
@media (max-width: 768px) {
  /* iOS Input Zoom Prevention */
  input, select, textarea, .form-control {
    font-size: 16px !important; /* Prevents iOS Safari from auto-zooming on focus */
  }

  .app-container {
    flex-direction: column;
    width: 100%;
    overflow-x: hidden;
  }

  .top-header {
    padding: 12px 16px;
    height: auto;
    min-height: 56px;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: max(12px, env(safe-area-inset-top));
  }

  .header-left, .header-right {
    gap: 10px;
    width: 100%;
    justify-content: space-between;
  }

  .page-content {
    padding: 14px 14px max(24px, env(safe-area-inset-bottom)) 14px;
  }

  .hero-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 20px;
  }

  .hero-header h1 {
    font-size: 20px;
    line-height: 1.3;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 20px;
  }

  .glass-panel {
    padding: 20px 16px;
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
  }

  .panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .panel-header input, .panel-header select {
    max-width: 100% !important;
    width: 100% !important;
  }

  /* Bottom-Sheet Style Modals on Mobile */
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .modal-card {
    width: 100%;
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: calc(100dvh - 28px);
    padding: 24px 18px max(24px, env(safe-area-inset-bottom)) 18px;
    border-bottom: none;
    -webkit-overflow-scrolling: touch;
  }

  /* Form groups */
  .form-group {
    margin-bottom: 16px;
  }

  /* Subject Entry Row in Uniraj Modal */
  .subject-entry-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px;
  }

  .subject-entry-row input:first-child {
    grid-column: 1 / -1;
  }

  .btn-remove-subject {
    grid-column: 1 / -1;
    text-align: center;
    width: 100%;
  }

  /* Button touch height & tap feedback */
  .btn-gradient, .btn-secondary {
    min-height: 42px;
    touch-action: manipulation;
  }
  .btn-gradient:active, .btn-secondary:active {
    transform: scale(0.98);
  }

  .mobile-nav-toggle {
    min-width: 44px;
    min-height: 44px;
    font-size: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
  }

  /* Toast Notification mobile centering */
  #toast-notification {
    left: 16px !important;
    right: 16px !important;
    bottom: 16px !important;
    width: auto !important;
    max-width: calc(100% - 32px) !important;
    text-align: center;
    justify-content: center;
  }
}

/* ==========================================================================
   MEDIA QUERIES: EXTRA SMALL SMARTPHONES (<= 480px, iPhone SE / Mini)
   ========================================================================== */
@media (max-width: 480px) {
  .kpi-card {
    padding: 16px 14px;
  }

  .kpi-value {
    font-size: 22px;
  }

  .status-pill {
    font-size: 10px;
    padding: 4px 10px;
  }

  .page-title-badge {
    font-size: 13px;
  }

  .hero-header h1 {
    font-size: 18px;
  }

  .hero-header p {
    font-size: 12px;
  }

  .auth-card {
    padding: 26px 18px;
    border-radius: var(--radius-lg);
  }

  .auth-wrapper {
    padding: 16px 12px;
  }

  .captcha-box {
    flex-wrap: wrap;
  }

  .captcha-box input {
    width: 100% !important;
    min-width: 100% !important;
  }
}

/* ==========================================================================
   STAFF AUTHORITY & PERMISSIONS SYSTEM
   ========================================================================== */
.authority-badge-all {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, #fef3c7 0%, #fef9c3 100%);
  color: #b45309;
  border: 1px solid #fde68a;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 1px 2px rgba(217, 119, 6, 0.1);
}

.authority-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  margin-right: 4px;
  margin-bottom: 4px;
}

.authority-master-card {
  background: #f8fafc;
  border: 2px solid #cbd5e1;
  border-radius: 16px;
  padding: 16px 20px;
  margin-bottom: 20px;
  transition: all 0.25s ease;
  cursor: pointer;
}

.authority-master-card.active {
  background: #eef2ff;
  border-color: #818cf8;
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.15);
}

.authority-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.authority-item-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.authority-item-card:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.authority-item-card.active {
  border-color: #a5b4fc;
  background: #faf5ff;
}

.authority-checkbox {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  cursor: pointer;
  accent-color: #4f46e5;
  flex-shrink: 0;
}

/* OVERVIEW DASHBOARD UNIFIED TABS & SHORTCUTS */
.overview-tab-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.overview-tab-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.overview-tab-btn:hover {
  border-color: #94a3b8;
  color: var(--text-primary);
  background: #f8fafc;
}

.overview-tab-btn.active {
  background: #4f46e5;
  border-color: #4f46e5;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
}

.overview-quick-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.overview-quick-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  transition: all 0.15s ease;
}

.overview-quick-chip:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #4f46e5;
  transform: translateY(-1px);
}

.diagnostics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.diagnostic-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.diagnostic-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

