/* ==========================================================================
   SPCOE E-BIKE SYSTEM - STYLING SYSTEM (Premium Glassmorphic Admin Dashboard)
   ========================================================================== */

:root {
  /* Theme Colors (Glass Dark Mode) */
  --bg-primary: #090b16;
  --bg-secondary: #11132b;
  --bg-card: rgba(22, 25, 56, 0.5);
  --border-color: rgba(255, 255, 255, 0.08);
  --text-primary: #f1f3f9;
  --text-secondary: #9aa2c2;
  
  /* Accent Colors */
  --primary: #007aff;       /* Apple Blue */
  --primary-hover: #005bb5;
  --success: #34c759;       /* Success Green */
  --success-glow: rgba(52, 199, 89, 0.15);
  --danger: #ff3b30;        /* Crimson Red */
  --orange: #ff9500;        /* Orange Accent */
  --violet: #af52de;        /* Violet purple */
  --cyan: #55bef0;          /* Soft Cyan */
  
  /* Glassmorphism Specs */
  --glass-bg: rgba(14, 16, 38, 0.7);
  --glass-border: rgba(255, 255, 255, 0.07);
  --glass-shadow: 0 10px 40px 0 rgba(0, 0, 0, 0.45);
  --backdrop-blur: blur(15px);
  
  /* Font Stack */
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ==========================================================================
   Base Elements
   ========================================================================== */

html {
  overflow-x: hidden;
  max-width: 100%;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  position: relative;
  background-image: radial-gradient(at 0% 0%, rgba(0, 122, 255, 0.15) 0px, transparent 50%),
                    radial-gradient(at 100% 100%, rgba(175, 82, 222, 0.1) 0px, transparent 50%);
}

/* Glow Orbs behind dashboard */
.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  z-index: -1;
  pointer-events: none;
}
.orb-1 {
  top: -15%;
  left: 10%;
  width: 500px;
  height: 500px;
  background: rgba(0, 122, 255, 0.15);
}
.orb-2 {
  bottom: -10%;
  right: 10%;
  width: 450px;
  height: 450px;
  background: rgba(52, 199, 89, 0.12);
}

a {
  color: inherit;
  text-decoration: none;
}

/* Common Classes */
.hidden {
  display: none !important;
}
.margin-bottom {
  margin-bottom: 2rem;
}
.text-center {
  text-align: center;
}

/* ==========================================================================
   CSS Logo
   ========================================================================== */
.logo-mk {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--violet) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.3rem;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 15px rgba(0, 122, 255, 0.4);
  letter-spacing: 1px;
  flex-shrink: 0;
}

.logo-mk-large {
  width: 76px;
  height: 76px;
  border-radius: 20px;
  font-size: 2.1rem;
  margin: 0 auto 1.5rem auto;
  box-shadow: 0 0 25px rgba(0, 122, 255, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.25);
}

/* ==========================================================================
   Login screen overlay
   ========================================================================== */
.login-overlay {
  position: fixed;
  inset: 0;               /* top/right/bottom/left: 0 all at once */
  width: 100%;
  height: 100%;
  background: rgba(4, 5, 12, 0.95);
  backdrop-filter: blur(20px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  overflow-y: auto;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 28px;
  padding: 3rem 2.5rem;
  box-shadow: 0 15px 50px rgba(0,0,0,0.6);
  text-align: center;
  backdrop-filter: var(--backdrop-blur);
  animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
  flex-shrink: 0;
}

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

.login-card h2 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  letter-spacing: 0.5px;
}
.login-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

.form-group {
  text-align: left;
  margin-bottom: 1.5rem;
}
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-group input {
  width: 100%;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.9rem 1.1rem;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(0, 122, 255, 0.2);
}

.error-message {
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  background: rgba(255, 59, 48, 0.1);
  padding: 0.7rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 59, 48, 0.2);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.85rem 1.8rem;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-login {
  width: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, #3a80ff 100%);
  color: white;
  box-shadow: 0 5px 15px rgba(0, 122, 255, 0.3);
}
.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 122, 255, 0.4);
}
.btn-login:active {
  transform: translateY(0);
}

/* Layout Shell — sidebar is sticky so it stays in flex flow */
.app-layout {
  display: flex;
  flex-direction: row;
  min-height: 100vh;
  width: 100%;
  align-items: flex-start;
}

/* Sidebar — sticky keeps it in flex flow, no margin hacks needed */
.sidebar {
  width: 270px;
  min-width: 270px;
  flex-shrink: 0;
  background: var(--glass-bg);
  backdrop-filter: var(--backdrop-blur);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  padding: 2rem 1.3rem;
  z-index: 100;
  box-shadow: var(--glass-shadow);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 3rem;
}
.sidebar-header h2 {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-nav {
  flex-grow: 1;
}
.sidebar-nav ul {
  list-style: none;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.95rem 1.1rem;
  border-radius: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.3s;
}
.nav-link:hover, .nav-link.active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}
.nav-link.active {
  background: linear-gradient(135deg, rgba(0, 122, 255, 0.2) 0%, rgba(0, 122, 255, 0.05) 100%);
  border-left: 3px solid var(--primary);
  padding-left: calc(1.1rem - 3px);
}
.nav-link .icon {
  font-size: 1.2rem;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  margin-top: 1.5rem;
}
.user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--violet) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.1rem;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.15);
}
.user-info {
  flex-grow: 1;
  min-width: 0;
}
.user-name {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.btn-logout {
  background: transparent;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 6px;
  border-radius: 10px;
  transition: background-color 0.2s;
}
.btn-logout:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* Main Content — takes all remaining width naturally via flex */
.main-container {
  flex: 1 1 0;           /* grow to fill remaining space */
  min-width: 0;          /* prevents flex child from overflowing */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
  width: 0;              /* combined with flex:1 forces proper fill */
}

/* Header */
.top-header {
  padding: 2.2rem 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}
.header-title h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.current-date {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 5px;
}

.header-widgets {
  display: flex;
  gap: 1.5rem;
}
.header-widget {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.7rem 1.3rem;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}
.widget-icon {
  font-size: 1.5rem;
}
.widget-value {
  font-weight: 700;
  font-size: 1rem;
}
.widget-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Main Viewport */
.content-viewport {
  padding: 3rem;
  flex-grow: 1;
  overflow-y: auto;
}

/* ==========================================================================
   Cards & Grid
   ========================================================================== */
.grid-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 26px;
  padding: 2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  backdrop-filter: var(--backdrop-blur);
  position: relative;
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s;
}
.grid-card:hover {
  box-shadow: 0 15px 40px rgba(0, 122, 255, 0.08);
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 15px;
}
.card-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.card-desc {
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin-bottom: 1.8rem;
  line-height: 1.5;
}

/* Badges */
.badge {
  padding: 0.35rem 0.8rem;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}
.badge-success {
  background: rgba(52, 199, 89, 0.15);
  color: #30d158;
  border: 1px solid rgba(52, 199, 89, 0.2);
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
}
.col-span-2 {
  grid-column: span 2;
}

/* ==========================================================================
   Metrics Grid
   ========================================================================== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 22px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 18px;
  backdrop-filter: var(--backdrop-blur);
  transition: transform 0.3s, box-shadow 0.3s;
}
.metric-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.25);
}

.metric-icon {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}
.blue-glow { box-shadow: inset 0 0 10px rgba(0,122,255,0.25); color: var(--primary); }
.green-glow { box-shadow: inset 0 0 10px rgba(52,199,89,0.25); color: var(--success); }
.orange-glow { box-shadow: inset 0 0 10px rgba(255,149,0,0.25); color: var(--orange); }
.violet-glow { box-shadow: inset 0 0 10px rgba(175,82,222,0.25); color: var(--violet); }

.metric-details {
  min-width: 0;
}
.metric-label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.metric-card h3 {
  font-size: 1.35rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.metric-sub {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ==========================================================================
   Chart container
   ========================================================================== */
.chart-container {
  position: relative;
  height: 250px;
  width: 100%;
}

/* ==========================================================================
   Upload panel & Drop zone
   ========================================================================== */
.upload-zone {
  border: 2px dashed rgba(255,255,255,0.15);
  border-radius: 20px;
  padding: 3.5rem 2rem;
  text-align: center;
  cursor: pointer;
  background: rgba(0,0,0,0.15);
  transition: all 0.3s;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--primary);
  background: rgba(0, 122, 255, 0.05);
}
.upload-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 1.2rem;
}
.upload-zone h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.upload-zone p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}
.upload-zone code {
  background: rgba(255,255,255,0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: Menlo, Monaco, Consolas, monospace;
}
.file-path-hint {
  font-size: 0.8rem !important;
  opacity: 0.7;
}

/* ==========================================================================
   Export controls & filters
   ========================================================================== */
.action-buttons-group {
  display: flex;
  gap: 12px;
}
.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  border-radius: 10px;
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}
.btn-outline:hover {
  background: rgba(255,255,255,0.05);
}
.btn-excel {
  background: rgba(52, 199, 89, 0.15);
  color: #30d158;
  border: 1px solid rgba(52, 199, 89, 0.2);
}
.btn-excel:hover {
  background: var(--success);
  color: white;
}
.btn-pdf {
  background: rgba(255, 59, 48, 0.15);
  color: #ff453a;
  border: 1px solid rgba(255, 59, 48, 0.2);
}
.btn-pdf:hover {
  background: var(--danger);
  color: white;
}
.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.filters-row {
  display: flex;
  gap: 1.5rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.filter-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-group select, .filter-group input {
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  min-height: 44px;
  color-scheme: dark;
}
.filter-group select option {
  background-color: #0e1220 !important;
  color: #ffffff !important;
}
.filter-group select:focus, .filter-group input:focus {
  outline: none;
  border-color: var(--primary);
}

.filters-inputs-wrapper {
  display: flex;
  gap: 1.5rem;
  flex-grow: 1;
  flex-wrap: wrap;
}

.action-group {
  justify-content: flex-end;
}

/* ==========================================================================
   Table & database
   ========================================================================== */
.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-color);
  border-radius: 18px;
  background: rgba(0,0,0,0.15);
  margin-bottom: 1.5rem;
}
.report-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  min-width: 950px;
}
.report-table th, .report-table td {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}
.report-table th {
  background: rgba(255,255,255,0.03);
  font-weight: 600;
  color: var(--text-secondary);
}
.report-table tbody tr {
  transition: background-color 0.2s;
}
.report-table tbody tr:hover {
  background: rgba(255,255,255,0.02);
}
.report-table tbody tr:last-child td {
  border-bottom: none;
}

.empty-state {
  text-align: center;
  color: var(--text-secondary);
  font-style: italic;
  padding: 3rem 0;
}

/* Pagination */
.pagination-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
}
#page-indicator {
  font-size: 0.92rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ==========================================================================
   Toast Alerts
   ========================================================================== */
.toast-wrapper {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.92rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  backdrop-filter: var(--backdrop-blur);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 400px;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.toast.success { border-left-color: var(--success); }
.toast.danger { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--orange); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(50px); }
  to { opacity: 1; transform: translateX(0); }
}

.toast.fade-out {
  animation: fadeOut 0.3s forwards;
}
@keyframes fadeOut {
  to { opacity: 0; transform: translateY(10px); }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1200px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  /* Stack layout vertically on tablet/phone */
  .app-layout {
    flex-direction: column;
    align-items: stretch;
  }
  /* Sidebar becomes full-width top nav bar */
  .sidebar {
    position: relative;   /* back in flow, no sticky on mobile */
    top: auto;
    width: 100%;
    min-width: unset;
    height: auto;
    min-height: unset;
    padding: 1rem;
    border-right: none;
    border-bottom: 1px solid var(--glass-border);
    box-shadow: none;
    overflow-y: visible;
    flex-shrink: 0;
  }
  .sidebar-header {
    margin-bottom: 0.75rem;
  }
  .sidebar-nav {
    width: 100%;
    flex-grow: 0;
    margin-bottom: 0;
  }
  .sidebar-nav ul {
    display: flex;
    flex-direction: row;
    gap: 6px;
    padding: 0;
    flex-wrap: nowrap;
  }
  .sidebar-nav ul li {
    flex: 1;
  }
  .nav-link {
    justify-content: center;
    padding: 0.65rem 0.5rem;
    font-size: 0.85rem;
    border-radius: 10px;
    gap: 6px;
  }
  .nav-link .icon {
    font-size: 1rem;
  }
  .nav-link.active {
    border-left: none;
    border-bottom: 3px solid var(--primary);
    padding-left: 0.5rem;
    padding-bottom: calc(0.65rem - 3px);
  }
  .sidebar-footer {
    padding-top: 0.75rem;
    margin-top: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }
  /* Main container fills full width naturally */
  .main-container {
    width: 100%;
    min-width: unset;
  }
  .top-header {
    padding: 1rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .header-widgets {
    width: 100%;
    justify-content: flex-start;
  }
  .content-viewport {
    padding: 1rem;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  /* Sidebar nav stacks vertically on phone */
  .sidebar-nav ul {
    flex-direction: column;
    gap: 6px;
  }
  .nav-link {
    font-size: 0.85rem;
    padding: 0.65rem 0.8rem;
  }
  .sidebar {
    padding: 1rem;
  }
  /* Metrics go single column */
  .metrics-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .metric-card {
    padding: 1rem 1.25rem;
  }
  /* Filters stacked */
  .filters-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .filters-inputs-wrapper {
    flex-direction: column;
    gap: 0.75rem;
  }
  .filter-group select,
  .filter-group input {
    width: 100%;
    box-sizing: border-box;
  }
  /* Buttons full width */
  .action-buttons-group {
    width: 100%;
    flex-direction: column;
    gap: 8px;
  }
  .action-buttons-group button,
  .action-buttons-group a {
    width: 100% !important;
    justify-content: center;
  }
  .action-group {
    width: 100%;
  }
  .action-group .btn {
    width: 100%;
  }
  /* Table scrolls sideways on touch */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  /* Tighter header */
  .top-header {
    padding: 1rem;
    gap: 10px;
  }
  .header-title h1 {
    font-size: 1.2rem;
  }
  .current-date {
    font-size: 0.8rem;
  }
  /* Content viewport padding */
  .content-viewport {
    padding: 1rem;
  }
  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .header-actions {
    flex-wrap: wrap;
    gap: 8px;
  }
  /* Pagination */
  .pagination-wrapper {
    flex-direction: row;
    gap: 8px;
  }
  .page-indicator {
    font-size: 0.8rem;
  }
  /* Settings page inputs */
  .filters-row[style] {
    flex-direction: column !important;
  }
  .filter-group[style] {
    min-width: unset !important;
  }
}

/* Ultra-small phones (iPhone SE, Galaxy A series, <430px) */
@media (max-width: 430px) {
  .login-overlay {
    padding: 0;
    align-items: stretch;
  }
  .login-card {
    border-radius: 0;
    min-height: 100dvh;
    padding: 2rem 1.25rem;
    border: none;
    box-shadow: none;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .maulin-pill-badge .badge-text {
    font-size: 0.7rem;
  }
  .sidebar-header h2 {
    font-size: 1rem;
  }
  .report-table th,
  .report-table td {
    padding: 0.5rem 0.6rem;
    font-size: 0.78rem;
  }
  .metric-card h3 {
    font-size: 1.3rem;
  }
  .top-header {
    padding: 0.85rem;
  }
  .content-viewport {
    padding: 0.85rem;
  }
}

/* ==========================================================================
   Loading Spinner & Sync Panels
   ========================================================================== */
.sync-status-wrapper {
  padding: 3rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-left-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.margin-top {
  margin-top: 1.5rem;
}

/* ==========================================================================
   Sliding Settings Drawer
   ========================================================================== */
.settings-drawer {
  position: fixed;
  top: 0;
  right: -420px; /* Hidden off-screen initially */
  width: 400px;
  height: 100%;
  background: var(--bg-card);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border-left: 1px solid var(--border-color);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.settings-drawer.open {
  right: 0; /* Slide in */
}

.drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 1999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-header h3 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--text-primary);
  font-weight: 600;
}

.btn-close-drawer {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.2s;
}

.btn-close-drawer:hover {
  color: var(--danger);
}

.drawer-content {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.drawer-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.4;
}

.settings-section-title {
  margin: 1.8rem 0 0.8rem 0;
  font-size: 0.9rem;
  color: var(--primary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ==========================================================================
   POWERBY Badge and Login Loader Styles
   ========================================================================== */
.maulin-pill-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  cursor: pointer;
}

.maulin-pill-badge:hover {
  background: rgba(0, 122, 255, 0.08);
  border-color: rgba(0, 122, 255, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 122, 255, 0.15);
}

.maulin-pill-badge .badge-icon {
  font-size: 0.9rem;
  animation: badge-bounce 2s infinite;
}

@keyframes badge-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.loading-spinner-sm {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-left-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
}
