/* ==========================================================================
   AI Station Hub - Cyber Dark Glassmorphic Theme & Comprehensive Mobile Engine
   ========================================================================== */

:root {
  --bg-base: #0a0d14;
  --bg-surface: rgba(16, 22, 36, 0.85);
  --bg-surface-hover: rgba(24, 33, 53, 0.95);
  --bg-card: rgba(18, 26, 43, 0.72);
  --bg-card-subtle: rgba(0, 0, 0, 0.28);
  --bg-modal: #111726;
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.16);
  --border-glow: rgba(99, 102, 241, 0.38);

  --text-primary: #f3f4f6;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  
  --accent-primary: #6366f1;       /* Electric Indigo */
  --accent-primary-hover: #4f46e5;
  --accent-cyan: #06b6d4;          /* Cyan Glow */
  --accent-emerald: #10b981;       /* Emerald */
  --accent-amber: #f59e0b;         /* Amber */
  --accent-crimson: #ef4444;       /* Crimson */
  --accent-purple: #a855f7;

  --sidebar-width: 250px;
  --header-height-mobile: 56px;
  --bottom-bar-height: 60px;
  
  --radius-xs: 5px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --shadow-card: 0 8px 24px -6px rgba(0, 0, 0, 0.6), 0 0 1px 1px var(--border-subtle);
  --shadow-glow: 0 0 24px -4px rgba(99, 102, 241, 0.4);
  --shadow-modal: 0 24px 60px -12px rgba(0, 0, 0, 0.85);
  
  --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.55;
  touch-action: manipulation;
}

h1, h2, h3, h4, .kpi-value, .stat-num {
  font-family: 'Outfit', sans-serif;
}

.font-mono {
  font-family: 'JetBrains Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Custom Smooth Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Ambient Glow Blobs */
.glow-bg {
  position: fixed;
  border-radius: 50%;
  filter: blur(140px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.25;
}
.glow-1 {
  width: min(550px, 80vw);
  height: min(550px, 80vw);
  background: radial-gradient(circle, #6366f1, transparent);
  top: -100px;
  right: 5%;
}
.glow-2 {
  width: min(500px, 70vw);
  height: min(500px, 70vw);
  background: radial-gradient(circle, #06b6d4, transparent);
  bottom: 5%;
  left: 10%;
}
.glow-3 {
  width: min(350px, 60vw);
  height: min(350px, 60vw);
  background: radial-gradient(circle, #a855f7, transparent);
  top: 45%;
  right: -50px;
}

/* Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  z-index: 1;
}

/* ==========================================================================
   Mobile Header Bar (Visible on mobile screens)
   ========================================================================== */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--header-height-mobile) + var(--safe-area-top));
  padding-top: var(--safe-area-top);
  background: rgba(10, 13, 20, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 40;
  align-items: center;
  justify-content: space-between;
  padding-left: 1rem;
  padding-right: 1rem;
}

.mobile-header-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.mobile-logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #fff;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
}

.mobile-logo-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  background: linear-gradient(to right, #fff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.mobile-ver {
  font-size: 0.68rem;
  padding: 1px 5px;
}

.mobile-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-mobile-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
}
.btn-mobile-icon:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.15);
}
.btn-mobile-primary {
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  color: #fff;
  border: none;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
}

/* Mobile Sidebar Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}
.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ==========================================================================
   Sidebar Navigation
   ========================================================================== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  padding: 1.35rem 1rem;
  z-index: 10;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding: 0 0.25rem;
}

.sidebar-close-btn {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.sidebar-close-btn:active {
  transform: scale(0.92);
  color: #fff;
}

.logo-box {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.logo-text h2 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #fff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.version-tag {
  font-size: 0.7rem;
  color: var(--accent-cyan);
  font-weight: 600;
  background: rgba(6, 182, 212, 0.14);
  padding: 2px 7px;
  border-radius: 5px;
  display: inline-block;
  margin-top: 1px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.72rem 0.95rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
  text-align: left;
}

.nav-item i {
  font-size: 1.05rem;
  width: 20px;
  text-align: center;
  transition: var(--transition);
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.nav-item:active {
  transform: scale(0.98);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.18), rgba(6, 182, 212, 0.09));
  border-color: rgba(99, 102, 241, 0.35);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.nav-item.active i {
  color: var(--accent-cyan);
}

.nav-item .badge {
  margin-left: auto;
  font-size: 0.75rem;
  background: rgba(99, 102, 241, 0.22);
  color: #a5b4fc;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 0.85rem;
}

.status-indicator-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.pulse-dot {
  width: 9px;
  height: 9px;
  background-color: var(--accent-emerald);
  border-radius: 50%;
  position: relative;
  box-shadow: 0 0 8px var(--accent-emerald);
  flex-shrink: 0;
}

.pulse-dot.active::after {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  border-radius: 50%;
  border: 2px solid var(--accent-emerald);
  animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.5); opacity: 0.8; }
  100% { transform: scale(1.8); opacity: 0; }
}

.status-info {
  display: flex;
  flex-direction: column;
}

.status-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}

.status-desc {
  font-size: 0.73rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Mobile Bottom Navigation Bar (Fixed at bottom on small screens)
   ========================================================================== */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--bottom-bar-height) + var(--safe-area-bottom));
  padding-bottom: var(--safe-area-bottom);
  background: rgba(12, 16, 26, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  z-index: 40;
  align-items: center;
  justify-content: space-around;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 0;
  position: relative;
  transition: var(--transition);
}

.bottom-nav-item i {
  font-size: 1.15rem;
  transition: var(--transition);
}

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

.bottom-nav-item.active {
  color: var(--accent-cyan);
  font-weight: 600;
}

.bottom-nav-item.active i {
  transform: translateY(-2px);
  filter: drop-shadow(0 0 8px rgba(6, 182, 212, 0.6));
}

.bottom-badge {
  position: absolute;
  top: 3px;
  right: calc(50% - 16px);
  background: var(--accent-primary);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--radius-full);
  min-width: 15px;
  text-align: center;
}

/* ==========================================================================
   Main Content & Top Bar
   ========================================================================== */
.main-content {
  flex: 1;
  padding: 1.6rem 2.25rem;
  max-width: 1680px;
  margin: 0 auto;
  width: 100%;
  min-width: 0;
}

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

.top-left h1 {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.48);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--border-subtle);
  color: var(--text-primary);
  backdrop-filter: blur(10px);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--border-medium);
  transform: translateY(-1px);
}

.btn-accent {
  background: linear-gradient(135deg, #06b6d4, #0891b2);
  color: #fff;
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.28);
}
.btn-accent:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(6, 182, 212, 0.45);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.btn-text {
  background: none;
  border: none;
  color: var(--accent-cyan);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition);
  padding: 4px;
}
.btn-text:hover {
  color: #38bdf8;
  gap: 0.5rem;
}
.btn-text:active {
  transform: scale(0.94);
}

.btn-sm {
  padding: 0.42rem 0.8rem;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
}

/* Tabs */
.tab-panel {
  display: none;
  animation: fadeIn 0.25s ease-in-out;
}
.tab-panel.active {
  display: block;
}

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

/* ==========================================================================
   KPI Cards Grid (Desktop & Mobile Optimized)
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.15rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.4rem;
  display: flex;
  align-items: flex-start;
  gap: 1.05rem;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--card-glow-color, #6366f1), transparent);
  opacity: 0;
  transition: var(--transition);
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-medium);
}
.kpi-card:hover::before {
  opacity: 1;
}

.kpi-card.glow-cyan { --card-glow-color: var(--accent-cyan); }
.kpi-card.glow-indigo { --card-glow-color: var(--accent-primary); }
.kpi-card.glow-emerald { --card-glow-color: var(--accent-emerald); }
.kpi-card.glow-amber { --card-glow-color: var(--accent-amber); }

.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: var(--card-glow-color, var(--accent-primary));
  flex-shrink: 0;
}

.kpi-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.kpi-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-value-row {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  margin: 0.25rem 0;
  flex-wrap: wrap;
}

.kpi-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.kpi-cny {
  font-size: 0.88rem;
  color: var(--accent-cyan);
  font-weight: 600;
}

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

.kpi-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.text-emerald { color: var(--accent-emerald) !important; }
.text-cyan { color: var(--accent-cyan) !important; }
.text-indigo { color: var(--accent-primary) !important; }
.text-amber { color: var(--accent-amber) !important; }
.text-crimson { color: var(--accent-crimson) !important; }

/* Badges */
.badge-success, .kpi-badge.badge-success {
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
}
.badge-danger, .kpi-badge.badge-danger {
  background: rgba(239, 68, 68, 0.16);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
}
.badge-warning, .kpi-badge.badge-warning {
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
}
.badge-info, .kpi-badge.badge-info {
  background: rgba(6, 182, 212, 0.16);
  color: #38bdf8;
  border: 1px solid rgba(6, 182, 212, 0.35);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
}

/* ==========================================================================
   Generic Card Component
   ========================================================================== */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.5rem;
  box-shadow: var(--shadow-card);
  margin-bottom: 1.35rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.15rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  gap: 0.75rem;
  flex-wrap: wrap;
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.card-title-group i {
  color: var(--accent-cyan);
  font-size: 1.15rem;
}
.card-title-group h3 {
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.tag-pill {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 9px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}

/* Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.35rem;
}

@media (max-width: 1024px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

.chart-container {
  position: relative;
  height: 280px;
  width: 100%;
}
.doughnut-container {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 2-Column Grid */
.grid-2col {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.25rem;
}
@media (max-width: 1024px) {
  .grid-2col {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Overview Site Matrix & Activity Stream
   ========================================================================== */
.site-quick-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.site-quick-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card-subtle);
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  transition: var(--transition);
  gap: 0.75rem;
}
.site-quick-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-medium);
}

.site-quick-main {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.site-quick-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: rgba(99, 102, 241, 0.16);
  color: #a5b4fc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.site-quick-title {
  font-weight: 600;
  font-size: 0.96rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.site-quick-url {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-quick-right {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  flex-shrink: 0;
}

.site-quick-balance {
  text-align: right;
}
.site-quick-balance-val {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}
.site-quick-balance-cny {
  font-size: 0.78rem;
  color: var(--accent-cyan);
}

/* Timeline Stream */
.timeline-stream {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}

.timeline-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-card-subtle);
  border-left: 3px solid var(--accent-primary);
}
.timeline-item.success { border-left-color: var(--accent-emerald); }
.timeline-item.already { border-left-color: var(--accent-cyan); }
.timeline-item.failed { border-left-color: var(--accent-crimson); }

.timeline-icon {
  font-size: 0.95rem;
  margin-top: 3px;
}

.timeline-content {
  flex: 1;
  min-width: 0;
}

.timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
  gap: 0.5rem;
}

.timeline-site {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.timeline-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.timeline-msg {
  font-size: 0.84rem;
  color: var(--text-secondary);
  word-break: break-all;
}

/* ==========================================================================
   Sites Management Cards Grid
   ========================================================================== */
.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.7rem 1.1rem;
  width: 360px;
  transition: var(--transition);
}
.search-box:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}
.search-box i {
  color: var(--text-muted);
  font-size: 0.95rem;
}
.search-box input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  width: 100%;
}

/* Horizontal Strip & Mobile Card Layout */
.site-strip-container {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  width: 100%;
}

.site-strip-item {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1rem 1.35rem;
  display: grid;
  grid-template-columns: 2.3fr 1.5fr 1.5fr auto;
  align-items: center;
  gap: 1.25rem;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.site-strip-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--accent-primary), var(--accent-cyan));
  opacity: 0;
  transition: var(--transition);
}

.site-strip-item:hover {
  border-color: var(--border-glow);
  background: var(--bg-surface-hover);
  transform: translateX(3px);
  box-shadow: var(--shadow-glow);
}
.site-strip-item:hover::before {
  opacity: 1;
}

/* Col 1: Identity */
.strip-col-identity {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.strip-avatar {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(6, 182, 212, 0.2));
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  color: var(--accent-cyan);
  flex-shrink: 0;
}

.strip-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.strip-title-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.strip-title-row h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

.strip-url {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

.strip-badges {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.15rem;
  flex-wrap: wrap;
}

/* Col 2: Balance & Quota */
.strip-col-quota {
  display: flex;
  align-items: center;
  gap: 1.4rem;
}

.strip-quota-box {
  display: flex;
  flex-direction: column;
}

.strip-quota-label {
  font-size: 0.74rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.strip-quota-val {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  margin: 1px 0;
}

.strip-quota-cny {
  font-size: 0.78rem;
  color: var(--accent-cyan);
  font-weight: 500;
}

/* Col 3: Checkin Status */
.strip-col-checkin {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.strip-checkin-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.strip-checkin-msg {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 250px;
}

.strip-checkin-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Col 4: Actions Toolbar */
.strip-col-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  justify-content: flex-end;
}

/* ==========================================================================
   Data Table & Mobile Tip
   ========================================================================== */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-scroll-tip {
  display: none;
  padding: 0.4rem 0.75rem;
  background: rgba(6, 182, 212, 0.08);
  border: 1px dashed rgba(6, 182, 212, 0.25);
  border-radius: var(--radius-sm);
  color: var(--accent-cyan);
  font-size: 0.75rem;
  margin-bottom: 0.85rem;
  align-items: center;
  gap: 0.45rem;
}

.table-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.checkin-actions-bar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

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

.data-table th {
  padding: 0.85rem 1rem;
  color: var(--text-secondary);
  font-weight: 600;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.data-table td {
  padding: 0.95rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
  white-space: nowrap;
}

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

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem 0 0 0;
  font-size: 0.88rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ==========================================================================
   AI Gateway Tab Styles
   ========================================================================== */
.header-status-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.gateway-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.15rem;
}

.gateway-param-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.param-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.param-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.param-value {
  font-size: 1.1rem;
  font-weight: 700;
  word-break: break-all;
}

.param-input-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.param-input-group input {
  padding: 0.45rem 0.75rem;
  font-size: 0.9rem;
}

.param-desc {
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.gateway-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  padding: 0.85rem 1.1rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.stat-box {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.stat-num {
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
}

.stat-val {
  font-size: 1.02rem;
  font-weight: 600;
}

.gateway-guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.guide-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.guide-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.guide-header h4 {
  font-size: 1rem;
  color: #fff;
}

.guide-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.code-block {
  background: #000;
  padding: 0.7rem 0.85rem;
  border-radius: 6px;
  font-size: 0.84rem;
  color: #cbd5e1;
  line-height: 1.6;
  word-break: break-all;
  border: 1px solid var(--border-subtle);
}

/* ==========================================================================
   Forms & Settings
   ========================================================================== */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.full-width-card {
  grid-column: 1 / -1;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.form-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.label-helper {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: normal;
}

.form-input, .form-select, .form-textarea {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.72rem 1rem;
  color: var(--text-primary);
  font-size: 0.92rem;
  outline: none;
  transition: var(--transition);
  width: 100%;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.form-tip {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.form-row {
  display: flex;
  gap: 1rem;
}
.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

.solver-box {
  background: rgba(0, 0, 0, 0.2);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  margin-bottom: 0.85rem;
}

.input-with-presets {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.preset-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-preset {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 4px 11px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: var(--transition);
}
.btn-preset:hover, .btn-preset:active {
  background: rgba(99, 102, 241, 0.25);
  color: #fff;
  border-color: var(--accent-primary);
}

/* Switch & Toggle */
.switch-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card-subtle);
  padding: 0.95rem 1.15rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  gap: 1rem;
}

.switch-label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.switch-label strong {
  font-size: 0.95rem;
  color: var(--text-primary);
}
.switch-label span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255, 255, 255, 0.16);
  transition: .3s;
  border-radius: 34px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: var(--accent-primary);
}
input:checked + .slider:before {
  transform: translateX(22px);
}

/* Auth Tabs Radio */
.auth-tabs {
  display: flex;
  gap: 0.65rem;
}
.auth-tab-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.72rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.9rem;
  transition: var(--transition);
}
.auth-tab-option input {
  margin-right: 0.5rem;
}
.auth-tab-option:has(input:checked) {
  background: rgba(99, 102, 241, 0.18);
  border-color: var(--accent-primary);
  color: #fff;
  font-weight: 600;
}

.advanced-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.15rem;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.form-actions-wrap {
  flex-wrap: wrap;
}

/* ==========================================================================
   Modals & Bottom Sheets
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1.25rem;
}
.modal-backdrop.active {
  display: flex;
  animation: fadeIn 0.2s ease-out;
}

.modal-dialog {
  background: var(--bg-modal);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 620px;
  box-shadow: var(--shadow-modal), var(--shadow-glow);
  overflow: hidden;
  max-height: 90vh;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
}

.modal-dialog-sm {
  max-width: 460px;
}

.modal-dialog-lg {
  max-width: 960px;
}

.modal-drag-handle {
  display: none;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.modal-title-box {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.modal-title-box h3 {
  font-size: 1.2rem;
  font-weight: 700;
}

.btn-close {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
}
.btn-close:hover, .btn-close:active {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
}

.modal-body {
  padding: 1.4rem 1.5rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  flex: 1;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border-subtle);
  margin-top: 0.5rem;
  gap: 0.75rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.modal-footer-between {
  justify-content: space-between;
}

.footer-right {
  display: flex;
  gap: 0.65rem;
}

.test-result-box {
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  border: 1px solid var(--border-subtle);
  line-height: 1.5;
}
.test-result-box.success {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: #34d399;
}
.test-result-box.error {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: #f87171;
}

.tip-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  text-align: left;
}

/* Models Modal Internal Layout */
.models-modal-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.25rem;
}

.panel-sub-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
}
.panel-sub-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.models-search-box {
  width: 100%;
  margin-bottom: 0.65rem;
  padding: 0.45rem 0.75rem;
}

.models-scroll-box {
  max-height: 380px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-right: 4px;
}

.models-test-panel {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
}

.test-output-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 130px;
}

.output-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.output-content {
  flex: 1;
  background: #000;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  font-size: 0.78rem;
  color: #e2e8f0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-height: 180px;
  white-space: pre-wrap;
  line-height: 1.5;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  z-index: 1000;
  pointer-events: none;
}

.toast {
  background: rgba(17, 24, 39, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 0.9rem;
  min-width: 280px;
  max-width: 420px;
  animation: slideInRight 0.28s ease-out;
  pointer-events: auto;
}

.toast.success { border-left: 4px solid var(--accent-emerald); }
.toast.error { border-left: 4px solid var(--accent-crimson); }
.toast.info { border-left: 4px solid var(--accent-cyan); }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ==========================================================================
   COMPREHENSIVE RESPONSIVE ENGINE FOR MOBILE & TABLET
   ========================================================================== */

/* Tablets & Small Desktops (<= 1024px) */
@media (max-width: 1024px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .models-modal-grid {
    grid-template-columns: 1fr;
  }
}

/* Mobile Devices (<= 900px) */
@media (max-width: 900px) {
  /* Show Mobile Header & Bottom Navigation */
  .mobile-header {
    display: flex;
  }
  .mobile-bottom-nav {
    display: flex;
  }
  .sidebar-overlay {
    display: block;
  }
  .sidebar-close-btn {
    display: inline-flex;
  }

  /* Transform Sidebar into Smooth Drawer */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 82vw);
    height: 100vh;
    height: 100dvh;
    z-index: 100;
    transform: translateX(-100%);
    box-shadow: 12px 0 35px rgba(0, 0, 0, 0.8);
    padding-top: calc(1rem + var(--safe-area-top));
    padding-bottom: calc(1rem + var(--safe-area-bottom));
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }

  /* Main Content Layout Adjustments */
  .app-layout {
    flex-direction: column;
  }
  .main-content {
    padding-top: calc(var(--header-height-mobile) + var(--safe-area-top) + 0.95rem);
    padding-bottom: calc(var(--bottom-bar-height) + var(--safe-area-bottom) + 1.25rem);
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* Top Bar Adaptation */
  .top-bar {
    margin-bottom: 1.15rem;
  }
  .top-left h1 {
    font-size: 1.35rem;
  }
  .page-subtitle {
    font-size: 0.84rem;
  }
  .top-actions {
    display: none; /* Accessible via Mobile Header */
  }

  /* Sites Search Toolbar */
  .search-box {
    width: 100%;
  }
  .section-toolbar {
    margin-bottom: 1rem;
  }

  /* Gateway Stats Grid */
  .gateway-stats-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  /* Show horizontal table scroll tips */
  .mobile-scroll-tip {
    display: flex;
  }

  /* Toast Notification positioning on mobile */
  .toast-container {
    bottom: calc(var(--bottom-bar-height) + var(--safe-area-bottom) + 1rem);
    right: 1rem;
    left: 1rem;
  }
  .toast {
    min-width: 100%;
    max-width: 100%;
  }
}

/* Phones & Compact Screens (<= 768px) */
@media (max-width: 768px) {
  /* Forms mobile font-size to prevent iOS Safari auto-zoom */
  .form-input, .form-select, .form-textarea, .search-box input {
    font-size: 16px !important;
  }

  .form-row {
    flex-direction: column;
    gap: 0.85rem;
  }
  .solver-box {
    padding: 0.75rem;
  }

  /* Site Cards Transformation */
  .site-strip-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
    padding: 1.05rem 1.15rem;
  }

  .strip-col-identity {
    width: 100%;
  }
  .strip-url {
    max-width: 100%;
  }

  .strip-col-quota {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
    background: var(--bg-card-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.65rem 0.85rem;
  }

  .strip-col-checkin {
    width: 100%;
  }
  .strip-checkin-msg {
    max-width: 100%;
    white-space: normal;
    word-break: break-all;
  }

  .strip-col-actions {
    width: 100%;
    justify-content: space-between;
    border-top: 1px solid var(--border-subtle);
    padding-top: 0.85rem;
    flex-wrap: wrap;
    gap: 0.45rem;
  }
  .strip-col-actions .btn {
    flex: 1 1 auto;
  }

  /* Modals as Bottom Sheets on Mobile */
  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }
  .modal-dialog {
    max-width: 100% !important;
    border-radius: 20px 20px 0 0;
    max-height: 88vh;
    max-height: 88dvh;
    border-bottom: none;
    animation: slideUpBottom 0.28s cubic-bezier(0.33, 1, 0.68, 1);
  }
  .modal-drag-handle {
    display: block;
    width: 38px;
    height: 4px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 2px;
    margin: 8px auto 0 auto;
  }
  .modal-header {
    padding: 0.85rem 1.25rem;
  }
  .modal-body {
    padding: 1.15rem 1.25rem calc(1.15rem + var(--safe-area-bottom)) 1.25rem;
  }

  @keyframes slideUpBottom {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  /* Table Filters Stack */
  .flex-col-sm {
    flex-direction: column;
    align-items: stretch !important;
  }
  .table-filter-bar {
    width: 100%;
  }
  .table-filter-bar .form-select,
  .table-filter-bar .form-input,
  .table-filter-bar .btn {
    width: 100%;
  }
  .checkin-actions-bar {
    width: 100%;
  }
  .checkin-actions-bar .btn {
    flex: 1;
  }
}

/* Small Smart Phones (<= 640px) */
@media (max-width: 640px) {
  /* 2x2 Clean Grid for KPI Cards on Mobile */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
    margin-bottom: 1.15rem;
  }
  .kpi-card {
    padding: 0.8rem 0.85rem;
    gap: 0.55rem;
    flex-direction: column;
    border-radius: var(--radius-md);
  }
  .kpi-icon {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }
  .kpi-label {
    font-size: 0.68rem;
  }
  .kpi-value {
    font-size: 1.35rem;
  }
  .kpi-cny {
    font-size: 0.76rem;
  }
  .kpi-sub {
    font-size: 0.68rem;
  }

  /* Chart height adjust */
  .chart-container {
    height: 220px;
  }
  .card {
    padding: 1.05rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
  }
  .card-title-group h3 {
    font-size: 1rem;
  }
}

/* ==========================================================================
   Admin Authentication, Login Screen & Password Management Styles
   ========================================================================== */

/* Password Input with Eye Toggle */
.input-with-eye {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.input-with-eye .form-input {
  width: 100%;
  padding-right: 42px !important;
}
.btn-toggle-eye {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}
.btn-toggle-eye:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

/* Sidebar User Box */
.sidebar-user-box {
  margin-top: 0.85rem;
  padding: 0.75rem 0.85rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transition: var(--transition);
}
.sidebar-user-box:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(99, 102, 241, 0.25);
}
.user-info-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(6, 182, 212, 0.25));
  border: 1px solid rgba(99, 102, 241, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
  font-size: 0.95rem;
  flex-shrink: 0;
}
.user-meta {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.user-role {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.1;
}
.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-actions-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.btn-sidebar-user-action {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: var(--transition);
}
.btn-sidebar-user-action:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}
.btn-sidebar-user-action.btn-danger-hover:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.35);
}

/* Login Modal / Full Backdrop */
.login-modal-backdrop {
  background: rgba(5, 8, 15, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 99999;
}
.login-modal-dialog {
  max-width: 420px;
  border: 1px solid rgba(99, 102, 241, 0.35);
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.9), 0 0 35px -5px rgba(99, 102, 241, 0.25);
  background: linear-gradient(180deg, #131929 0%, #0d121f 100%);
  animation: loginDialogFade 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes loginDialogFade {
  0% { opacity: 0; transform: scale(0.94) translateY(12px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.login-header-banner {
  text-align: center;
  padding: 2rem 1.5rem 1rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  background: radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.15), transparent 70%);
}
.login-logo-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: #fff;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
  margin-bottom: 0.35rem;
}
.login-header-banner h2 {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.login-modal-body {
  padding: 1.5rem 1.75rem 1.75rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.login-alert-box {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  animation: shakeAlert 0.35s ease-in-out;
}
@keyframes shakeAlert {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.login-options-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.login-remember-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  user-select: none;
}
.login-remember-label input[type="checkbox"] {
  accent-color: var(--accent-primary);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.btn-login-submit {
  width: 100%;
  padding: 0.85rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
  cursor: pointer;
  transition: var(--transition);
}
.btn-login-submit:hover {
  box-shadow: 0 6px 22px rgba(99, 102, 241, 0.5);
  transform: translateY(-1px);
}
.btn-login-submit:active {
  transform: translateY(0);
}

