/* Deep Space Midnight + Glassmorphism 2.0 Theme */

:root {
  /* Ultra Dark Base */
  --bg-abyss: #050508;
  --bg-surface: rgba(13, 15, 22, 0.7);
  --bg-surface-hover: rgba(22, 25, 36, 0.85);

  /* Glass Effects */
  --glass-blur: blur(24px);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-border-bright: rgba(255, 255, 255, 0.15);
  
  /* Typography */
  --text-pure: #ffffff;
  --text-primary: #e2e8f0;
  --text-secondary: #8b949e;
  --font-sans: 'Inter', -apple-system, sans-serif;
  
  /* Cyberpunk Accents */
  --accent-cyan: #00f0ff;
  --accent-blue: #3b82f6;
  
  /* Status Colors */
  --status-online: #10b981; /* Emerald */
  --status-busy: #f59e0b;   /* Amber */
  --status-offline: #ef4444; /* Rose */
}

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

body {
  background-color: var(--bg-abyss);
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  overflow: hidden; /* App-like layout */
  position: relative;
}

/* Ambient Deep Space Glows */
.ambient-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  z-index: 0;
  pointer-events: none;
  opacity: 0.15;
}

.glow-1 { top: -10%; left: -5%; width: 50vw; height: 50vh; background: var(--accent-blue); }
.glow-2 { bottom: -20%; right: -10%; width: 60vw; height: 60vh; background: var(--accent-cyan); opacity: 0.08; }
.glow-3 { top: 40%; left: 40%; width: 30vw; height: 30vh; background: var(--status-online); opacity: 0.05; }

/* Dashboard Shell */
.dashboard-layout {
  position: relative;
  z-index: 1;
  display: flex;
  height: 100vh;
}

/* Glassmorphism 2.0 Utility */
.glass-panel {
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 8px 32px rgba(0,0,0,0.4);
}

/* Sidebar */
.sidebar {
  width: 260px;
  margin: 16px;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 32px 8px;
}

.logo {
  color: var(--accent-cyan);
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
}

.sidebar-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-pure);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s;
}

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

.nav-item.active {
  background: linear-gradient(90deg, rgba(0, 240, 255, 0.1), transparent);
  color: var(--accent-cyan);
}

.nav-icon { font-size: 1.2rem; }

.active-indicator {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent-cyan);
  border-radius: 0 4px 4px 0;
  box-shadow: 0 0 8px var(--accent-cyan);
}

.sidebar-footer {
  padding: 16px 8px 0 8px;
  border-top: 1px solid var(--glass-border);
}

.api-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-family: monospace;
}

/* Main Content Wrapper */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 24px 16px 0;
  overflow-y: auto;
  scroll-behavior: smooth;
}

/* Custom Scrollbar */
.main-content::-webkit-scrollbar { width: 8px; }
.main-content::-webkit-scrollbar-track { background: transparent; }
.main-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
.main-content::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* Header */
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 8px 24px 8px;
}

.header-titles h1 {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text-pure);
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 4px;
}

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

.glass-button.icon-only {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  padding: 0;
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s;
}

.glass-button.icon-only:hover {
  background: var(--glass-border-bright);
  color: var(--text-pure);
  transform: rotate(30deg);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px 8px 8px;
  border-radius: 30px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--glass-border-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-pure);
}

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

.user-name { font-size: 0.9rem; font-weight: 600; color: var(--text-pure); }
.user-role { font-size: 0.75rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }

/* Content Body */
.content-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 1600px;
}

/* Quick Stats Row */
.quick-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 8px;
}

.stat-card {
  padding: 12px 16px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

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

.stat-icon-wrapper.neutral { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.stat-icon-wrapper.success { background: rgba(16, 185, 129, 0.1); color: var(--status-online); box-shadow: inset 0 0 12px rgba(16, 185, 129, 0.2); }
.stat-icon-wrapper.warning { background: rgba(245, 158, 11, 0.1); color: var(--status-busy); box-shadow: inset 0 0 12px rgba(245, 158, 11, 0.2); }
.stat-icon-wrapper.danger { background: rgba(239, 68, 68, 0.1); color: var(--status-offline); box-shadow: inset 0 0 12px rgba(239, 68, 68, 0.2); }

.stat-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-title {
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-content {
  display: flex;
  flex-direction: column;
  margin-left: auto;
  align-items: flex-end;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  font-family: monospace;
}

.text-success { color: var(--status-online); text-shadow: 0 0 12px rgba(16, 185, 129, 0.4); }
.text-warning { color: var(--status-busy); text-shadow: 0 0 12px rgba(245, 158, 11, 0.4); }
.text-danger  { color: var(--status-offline); text-shadow: 0 0 12px rgba(239, 68, 68, 0.4); }

/* Decorative Sparklines inside cards */
.sparkline {
  height: 4px;
  width: 40px;
  border-radius: 2px;
  margin-top: 8px;
}
.neutral-spark { background: linear-gradient(90deg, rgba(255,255,255,0.1), rgba(255,255,255,0.5)); }
.success-spark { background: linear-gradient(90deg, rgba(16,185,129,0.1), var(--status-online)); }
.warning-spark { background: linear-gradient(90deg, rgba(245,158,11,0.1), var(--status-busy)); }
.danger-spark { background: linear-gradient(90deg, rgba(239,68,68,0.1), var(--status-offline)); }


/* Compact Command Bar */
.controls-row.compact-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  gap: 16px;
}

.action-grid {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.cyber-button {
  background: var(--glass-border);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  white-space: nowrap;
}

.cyber-button:hover {
  background: var(--glass-border-bright);
}

.cyber-button.primary {
  background: rgba(0, 240, 255, 0.1);
  border-color: rgba(0, 240, 255, 0.3);
  color: var(--accent-cyan);
}
.cyber-button.primary:hover {
  background: rgba(0, 240, 255, 0.2);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
}

.cyber-button.danger {
  color: var(--status-offline);
  background: rgba(239, 68, 68, 0.05);
  border-color: rgba(239, 68, 68, 0.2);
}
.cyber-button.danger:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--status-offline);
}

.search-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.search-wrapper i {
  position: absolute;
  left: 12px;
  color: var(--text-secondary);
}

.glass-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  color: var(--text-pure);
  padding: 10px 16px 10px 36px;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  outline: none;
  transition: all 0.2s;
}

.glass-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px rgba(0, 240, 255, 0.2);
}

/* Custom Dropdown */
.custom-dropdown {
  position: relative;
  width: 100%;
  z-index: 100;
}

.custom-dropdown.open {
  z-index: 9999;
}

.automation-config .form-group {
  position: relative;
  z-index: 1;
}

.automation-config .form-group:has(.custom-dropdown.open) {
  z-index: 9999;
}

.dropdown-trigger {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  color: var(--text-pure);
  padding: 10px 14px;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s ease;
  text-align: left;
}

.dropdown-trigger:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.04);
}

.dropdown-trigger:focus,
.custom-dropdown.open .dropdown-trigger {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px rgba(0, 240, 255, 0.15);
  outline: none;
}

.dropdown-arrow {
  font-size: 1.1rem;
  color: var(--text-secondary);
  transition: transform 0.2s ease;
}

.custom-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
  color: var(--accent-cyan);
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #0d1117;
  border: 1px solid var(--glass-border-bright);
  border-radius: 8px;
  z-index: 9999;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0,0,0,0.8);
  animation: dropdownSlide 0.15s ease;
}

.custom-dropdown.open .dropdown-menu {
  display: block;
}

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

.dropdown-item {
  padding: 9px 14px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.12s ease;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  background: #0d1117;
}

.dropdown-item:last-child {
  border-bottom: none;
}

.dropdown-item:hover {
  background: rgba(0, 240, 255, 0.08);
  color: var(--text-pure);
}

.dropdown-item.active {
  color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.05);
}

.dropdown-menu::-webkit-scrollbar {
  width: 4px;
}
.dropdown-menu::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
}


/* Device Grid Layer */
.device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding-bottom: 40px;
}

.device-card {
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
}

.device-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.15);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255,255,255,0.1);
}

.card-header {
  padding: 12px 14px 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(0,0,0,0.2);
  gap: 8px;
}

.device-identity {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.device-identity > div {
  min-width: 0;
  overflow: hidden;
}

.card-header > div:last-child {
  flex-shrink: 0;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.pulse-dot.green { background: var(--status-online); box-shadow: 0 0 8px var(--status-online); }
.pulse-dot.amber { background: var(--status-busy); box-shadow: 0 0 8px var(--status-busy); }
.pulse-dot.red { background: var(--status-offline); }

.card-remark {
  font-size: 0.72rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
  line-height: 1.2;
  margin-top: 1px;
}

.device-identity h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-pure);
}

.badge-id {
  font-family: monospace;
  font-size: 0.65rem;
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid var(--glass-border);
}

.card-body {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.data-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.data-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.data-value {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-pure);
  font-family: monospace;
  text-align: right;
  word-break: break-all;
}
.data-value.status-text {
    text-transform: capitalize;
}

.card-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.02);
  display: flex;
  gap: 8px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.device-card:hover .card-footer {
  opacity: 1;
}

.card-footer .cyber-button {
  flex: 1;
  justify-content: center;
  padding: 8px;
  font-size: 0.85rem;
}

/* Loaders */
.loading-state {
  grid-column: 1 / -1;
  padding: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-secondary);
}

.loader-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--glass-border);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 9999;
}

.cyber-toast {
  background: var(--bg-surface-hover);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border-bright);
  border-left: 4px solid var(--accent-cyan);
  border-radius: 8px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-pure);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  animation: slideInRight 0.3s ease forwards;
  max-width: 350px;
}

.cyber-toast.error {
  border-left-color: var(--status-offline);
}

.cyber-toast.success {
  border-left-color: var(--status-online);
}

.toast-icon {
  font-size: 1.5rem;
}
.cyber-toast.error .toast-icon { color: var(--status-offline); }
.cyber-toast.success .toast-icon { color: var(--status-online); }
.cyber-toast.info .toast-icon { color: var(--accent-cyan); }

.toast-message {
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.4;
}

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

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

/* Boot Progress Bar */
.boot-progress-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px;
}

.boot-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-pure);
  font-weight: 600;
}

.boot-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
  overflow: hidden;
}

.boot-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan));
  border-radius: 3px;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px var(--accent-cyan);
}

/* Accent Button */
.cyber-button.accent {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.4);
  color: #a78bfa;
}
.cyber-button.accent:hover {
  background: rgba(139, 92, 246, 0.25);
  border-color: #a78bfa;
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-panel {
  width: 420px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--glass-border);
}

.modal-header h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-pure);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
}
.modal-close-btn:hover {
  color: var(--text-pure);
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.modal-body .glass-input,
.modal-body .glass-select {
  width: 100%;
  padding-left: 12px;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--glass-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Proxy Toggle Tabs */
.proxy-toggle {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}

.proxy-tab {
  flex: 1;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-sans);
}

.proxy-tab.active {
  background: rgba(0, 240, 255, 0.1);
  border-color: rgba(0, 240, 255, 0.3);
  color: var(--accent-cyan);
}

.proxy-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Terminal Log Panel */
.terminal-panel {
  background: #0a0d12;
  border: 1px solid rgba(0, 240, 255, 0.15);
  border-radius: 8px;
  padding: 14px;
  font-family: 'Courier New', Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.6;
  max-height: 320px;
  min-height: 280px;
  overflow-y: auto;
  color: var(--text-secondary);
}

.terminal-panel::-webkit-scrollbar { width: 4px; }
.terminal-panel::-webkit-scrollbar-thumb {
  background: rgba(0, 240, 255, 0.15);
  border-radius: 4px;
}

.terminal-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.terminal-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent-cyan);
  animation: termBlink 1.5s infinite;
}

@keyframes termBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.terminal-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
}

.log-line {
  padding: 2px 0;
  display: flex;
  gap: 8px;
}

.log-time {
  color: rgba(255,255,255,0.2);
  flex-shrink: 0;
}

.log-msg { flex: 1; }

.log-line.success .log-msg { color: #22c55e; }
.log-line.error .log-msg { color: #ef4444; }
.log-line.warning .log-msg { color: #f59e0b; }
.log-line.info .log-msg { color: var(--text-secondary); }

.terminal-done {
  margin-top: 10px;
  text-align: center;
}

.terminal-done .cyber-button {
  font-size: 0.8rem;
}

/* Page View Switching */
.page-view { display: none; }
.page-view.active { display: block; }

/* Automation Page */
.automation-section { padding: 0; }

.automation-header {
  margin-bottom: 24px;
}
.automation-header h2 {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-pure);
  display: flex;
  align-items: center;
  gap: 8px;
}
.automation-header h2 i { color: var(--accent-cyan); }
.automation-header .subtitle {
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.automation-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.automation-config {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: visible;
  position: relative;
  z-index: 10;
}
.automation-config h3,
.automation-terminal h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-pure);
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 4px 0;
}
.automation-config h3 i,
.automation-terminal h3 i {
  color: var(--accent-cyan);
  font-size: 1rem;
}

.automation-terminal {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.automation-terminal .terminal-panel {
  flex: 1;
  min-height: 350px;
}

/* Profile Selection Grid */
.profile-select-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
  padding: 4px 2px;
}

.profile-select-grid::-webkit-scrollbar { width: 4px; }
.profile-select-grid::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
}

.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 0.78rem;
  color: var(--text-secondary);
  user-select: none;
  white-space: nowrap;
}

.profile-chip:hover {
  border-color: rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.06);
}

.profile-chip.selected {
  border-color: rgba(139, 92, 246, 0.6);
  background: rgba(139, 92, 246, 0.12);
  color: #c4b5fd;
}

.profile-chip.assigned {
  border-color: rgba(16, 185, 129, 0.25);
  background: rgba(16, 185, 129, 0.05);
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

.profile-chip .chip-check {
  width: 14px;
  height: 14px;
  border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: 3px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  color: transparent;
  transition: all 0.15s;
}

.profile-chip.selected .chip-check {
  border-color: #a78bfa;
  background: #7c3aed;
  color: #fff;
}

.profile-chip.assigned .chip-check {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.3);
  color: #fff;
}

.profile-chip .chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.profile-chip .chip-dot.online { background: var(--status-online); box-shadow: 0 0 4px var(--status-online); }
.profile-chip .chip-dot.busy { background: var(--status-busy); }
.profile-chip .chip-dot.offline { background: var(--status-offline); }

.profile-chip .chip-name {
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.01em;
}

.profile-chip .chip-email {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.3);
  font-weight: 400;
}

.automation-config .glass-input {
  padding-left: 12px;
}

/* Cyber Checkboxes */
.task-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cyber-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
  user-select: none;
}

.cyber-checkbox:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.03);
}

.cyber-checkbox input[type="checkbox"] {
  display: none;
}

.cyber-checkbox .checkmark {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 2px solid var(--glass-border-bright);
  background: rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
  position: relative;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cyber-checkbox input:checked ~ .checkmark {
  background: rgba(0, 240, 255, 0.2);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.3);
}

.cyber-checkbox input:checked ~ .checkmark::after {
  content: '✓';
  color: var(--accent-cyan);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.cyber-checkbox input:checked ~ span:last-child {
  color: var(--accent-cyan);
}

/* Report reason sub-options */
.report-reasons {
  margin-left: 28px;
  padding-left: 12px;
  border-left: 2px solid rgba(0, 255, 200, 0.15);
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 2px;
  margin-bottom: 4px;
}
.report-reasons .sub-option {
  font-size: 0.82rem;
}
.report-reasons .sub-option .checkmark {
  width: 14px;
  height: 14px;
}

/* Field group transitions */
#gmail-fields,
#report-fields {
  transition: opacity 0.2s ease;
}

/* Side-by-side field rows */
.fields-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.fields-row .glass-input {
  padding-left: 14px;
}

/* ======================
   MODAL SYSTEM
   ====================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}
.modal-box {
  width: 420px;
  max-width: 90vw;
  padding: 24px;
  border-radius: 16px;
  animation: scaleIn 0.2s ease;
}
.modal-box h3 {
  margin: 0 0 16px 0;
  font-size: 1.1rem;
  color: var(--text-pure);
}
.modal-box h3 i { margin-right: 6px; color: var(--accent-primary); }
.modal-box textarea.glass-input {
  resize: vertical;
  min-height: 60px;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}
@keyframes scaleIn {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ======================
   CARD 3-DOT MENU
   ====================== */
.card-menu-wrapper {
  position: relative;
}
.card-menu-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: all 0.15s ease;
  line-height: 1;
}
.card-menu-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-pure);
}
.card-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: rgba(18, 20, 30, 0.95);
  border: 1px solid var(--glass-border-bright);
  border-radius: 10px;
  min-width: 160px;
  padding: 6px;
  z-index: 100;
  backdrop-filter: var(--glass-blur);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  animation: scaleIn 0.12s ease;
}
.card-dropdown-menu .menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.12s ease;
}
.card-dropdown-menu .menu-item:hover {
  background: var(--bg-surface-hover);
}
.card-dropdown-menu .menu-item i {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* ======================
   CARD SELECT CHECKBOX
   ====================== */
.card-select-check {
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--glass-border-bright);
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
  accent-color: var(--accent-primary);
  flex-shrink: 0;
  opacity: 0.3;
}
.device-card:hover .card-select-check {
  opacity: 0.7;
}
.card-select-check:checked {
  border-color: var(--accent-primary);
  opacity: 1;
}
.device-card.selected {
  border-color: var(--accent-primary) !important;
  box-shadow: 0 0 0 1px var(--accent-primary), inset 0 0 20px rgba(0, 255, 231, 0.05);
}

/* ======================
   CARD REMARK
   ====================== */
.card-remark {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 4px;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ======================
   BULK CREATE INFO BANNER
   ====================== */
.bulk-info-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(0, 240, 255, 0.06);
  border: 1px solid rgba(0, 240, 255, 0.15);
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.bulk-info-banner i {
  color: var(--accent-cyan);
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ======================
   STEP TESTER
   ====================== */
.step-tester-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--glass-border);
}

.step-tester-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 12px;
}

.step-tester-panel {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: visible;
}

.step-tester-panel h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-pure);
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.step-tester-panel h3 i {
  color: #a78bfa;
  font-size: 1rem;
}

.step-tester-subtitle {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin: -8px 0 0 0;
}

.step-tester-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.step-tester-controls .form-group {
  position: relative;
  z-index: 1;
}

.step-tester-controls .form-group:has(.custom-dropdown.open) {
  z-index: 9999;
}

/* Step List (radio buttons) */
.step-tester-steps {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}

.step-tester-steps::-webkit-scrollbar { width: 4px; }
.step-tester-steps::-webkit-scrollbar-thumb {
  background: rgba(167, 139, 250, 0.2);
  border-radius: 4px;
}

.step-tester-step {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.84rem;
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
  user-select: none;
}

.step-tester-step:hover {
  border-color: rgba(167, 139, 250, 0.3);
  background: rgba(167, 139, 250, 0.05);
}

.step-tester-step input[type="radio"] {
  display: none;
}

.step-tester-step input[type="radio"]:checked ~ .step-num {
  background: rgba(139, 92, 246, 0.3);
  border-color: #a78bfa;
  color: #c4b5fd;
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.3);
}

.step-tester-step input[type="radio"]:checked ~ .step-label {
  color: var(--text-pure);
}

.step-num {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1.5px solid var(--glass-border-bright);
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: all 0.2s ease;
  font-family: monospace;
}

.step-label {
  flex: 1;
  transition: color 0.2s ease;
}

.step-status-indicator {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.step-status-indicator.st-running {
  color: var(--accent-cyan);
}

.step-status-indicator.st-done {
  color: var(--status-online);
}

.step-status-indicator.st-error {
  color: var(--status-offline);
}

/* Step Tester Terminal */
.step-tester-terminal {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.step-tester-terminal h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-pure);
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.step-tester-terminal h3 i {
  color: #a78bfa;
  font-size: 1rem;
}

.step-tester-terminal .terminal-panel {
  flex: 1;
  min-height: 350px;
}

/* Responsive: stack on smaller screens */
@media (max-width: 900px) {
  .step-tester-inner {
    grid-template-columns: 1fr;
  }
  .step-tester-controls {
    grid-template-columns: 1fr;
  }
}

/* =============================================
   SCREENSHOTS PAGE
   ============================================= */
.screenshots-page {
  padding: 20px;
}

.screenshots-header h2 {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.screenshots-header h2 i {
  color: var(--accent-primary);
  margin-right: 8px;
}
.screenshots-subtitle {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 12px;
}

/* Screenshot type tabs */
.screenshots-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.ss-tab {
  padding: 8px 18px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}
.ss-tab:hover {
  border-color: var(--glass-border-bright);
  color: var(--text-primary);
}
.ss-tab.active {
  background: rgba(0, 255, 200, 0.08);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  font-weight: 600;
}

/* Loading & Empty States */
.screenshots-loading,
.screenshots-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  font-size: 1rem;
  gap: 12px;
}
.screenshots-empty i {
  font-size: 3rem;
  opacity: 0.3;
}
.screenshots-hint {
  font-size: 0.8rem;
  opacity: 0.6;
}
.screenshots-error {
  color: var(--status-error);
  padding: 20px;
  text-align: center;
}

/* Profile Card Grid */
.screenshots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.screenshot-profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  cursor: pointer;
  transition: all 0.25s ease;
  border: 1px solid var(--glass-border);
}
.screenshot-profile-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0, 255, 200, 0.08);
}

.profile-card-icon {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(0, 255, 200, 0.08);
  color: var(--accent-primary);
  font-size: 1.3rem;
  flex-shrink: 0;
}

.profile-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.profile-card-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
}
.profile-card-count {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.profile-card-preview {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.preview-thumb {
  width: 32px;
  height: 56px;
  object-fit: cover;
  border-radius: 4px;
  opacity: 0.7;
  border: 1px solid var(--glass-border);
}

.profile-card-arrow {
  font-size: 1.2rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* Gallery View */
.screenshots-gallery {
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.gallery-back {
  background: none;
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
  margin-bottom: 16px;
}
.gallery-back:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}
.gallery-back i {
  margin-right: 6px;
}

.gallery-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.gallery-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.gallery-image-card {
  padding: 12px;
  border: 1px solid var(--glass-border);
  transition: all 0.25s ease;
  overflow: hidden;
}
.gallery-image-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.gallery-image-wrapper {
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.3);
  margin-bottom: 10px;
  cursor: pointer;
}
.gallery-image-wrapper img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.3s ease;
}
.gallery-image-wrapper img:hover {
  transform: scale(1.03);
}

.gallery-image-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-align: center;
  font-weight: 500;
  line-height: 1.3;
}

/* Lightbox */
.screenshot-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  backdrop-filter: blur(10px);
}
.screenshot-lightbox img {
  max-width: 90vw;
  max-height: 80vh;
  border-radius: 8px;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
}
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: none;
  border: none;
  color: white;
  font-size: 1.8rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.lightbox-close:hover {
  opacity: 1;
}
.lightbox-label {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  font-weight: 500;
}


/* ========== RESPONSIVE / MOBILE ========== */

/* Mobile menu button — hidden on desktop */
.mobile-menu-btn {
  display: none;
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-size: 1.3rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}
.mobile-menu-btn:hover {
  background: var(--glass-border-bright);
  color: var(--text-pure);
}

/* Sidebar overlay backdrop */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 998;
  backdrop-filter: blur(4px);
}
.sidebar-overlay.active {
  display: block;
}

/* ---- Tablet breakpoint (≤ 900px) ---- */
@media (max-width: 900px) {
  .mobile-menu-btn { display: flex; }

  /* Sidebar becomes slide-in overlay */
  .sidebar {
    position: fixed;
    left: -300px;
    top: 0;
    bottom: 0;
    width: 270px;
    margin: 0;
    border-radius: 0;
    z-index: 999;
    transition: left 0.3s ease;
    background: rgba(10, 12, 18, 0.98);
    border-right: 1px solid var(--glass-border);
  }
  .sidebar.mobile-open {
    left: 0;
  }

  /* Main content fills full width */
  .main-content {
    padding: 12px 16px;
  }

  /* Stats grid — 2 columns */
  .quick-stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  /* Device grid — smaller minmax */
  .device-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
  }

  /* Top header */
  .top-header {
    padding: 0 4px 16px 4px;
  }
  .header-titles h1 {
    font-size: 1.3rem;
  }

  /* User profile — hide text */
  .user-info { display: none; }

  /* Modals — less padding */
  .modal-panel {
    width: 95vw;
    max-width: 500px;
    max-height: 90vh;
  }
  .modal-body {
    max-height: 60vh;
    overflow-y: auto;
  }

  /* Controls bar wrap */
  .controls-row.compact-bar {
    flex-wrap: wrap;
    gap: 10px;
  }
  .action-grid {
    flex-wrap: wrap;
  }

  /* Automation page — single column */
  .automation-layout {
    flex-direction: column;
  }
  .automation-config,
  .automation-output {
    width: 100%;
    min-width: 0;
  }

  /* Screenshots grid */
  .screenshots-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

/* ---- Phone breakpoint (≤ 480px) ---- */
@media (max-width: 480px) {
  body {
    overflow: auto;
  }
  .dashboard-layout {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }
  .main-content {
    padding: 10px 12px;
    overflow-y: visible;
    height: auto;
  }

  /* Stats — single column */
  .quick-stats-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* Stat cards smaller */
  .stat-value {
    font-size: 1.2rem;
  }
  .stat-card {
    padding: 10px 12px;
  }

  /* Device grid — single column */
  .device-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* Header */
  .top-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding-bottom: 12px;
  }
  .header-titles h1 {
    font-size: 1.15rem;
  }
  .subtitle {
    font-size: 0.78rem;
  }
  .header-actions {
    width: 100%;
    justify-content: flex-end;
  }

  /* Buttons — touch-friendly */
  .cyber-button {
    padding: 10px 14px;
    font-size: 0.78rem;
  }

  /* Glass inputs — larger tap targets */
  .glass-input {
    padding: 12px 14px;
    font-size: 0.95rem;
  }

  /* Modals — full width */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal-panel {
    width: 100%;
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 85vh;
  }

  /* Controls bar */
  .controls-row.compact-bar {
    padding: 8px 10px;
  }
  .action-grid {
    gap: 6px;
    width: 100%;
    justify-content: space-between;
  }

  /* Search bar */
  .search-box {
    width: 100%;
  }

  /* Settings page padding */
  #page-settings > div {
    padding: 16px !important;
  }
  #page-settings .glass-panel {
    padding: 20px 16px !important;
  }

  /* Terminal panel height */
  .terminal-panel {
    max-height: 50vh;
  }

  /* Screenshots */
  .screenshots-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
}
