/* ==========================================================================
   WERRALEM CYBERNETIC PORTAL STYLESHEET (v3.0 - Mobile Ergonomics & PWA)
   Sovereign Epigenetic Workspace for Werracle
   ========================================================================== */

:root {
  --bg-primary: #070a0e;
  --bg-secondary: #0c1017;
  --bg-surface: #121824;
  --bg-surface-elevated: #161e2e;
  --bg-glass: rgba(18, 24, 36, 0.85);

  --border-subtle: #1e293b;
  --border-glow: #10b98133;
  --border-cyan-glow: #06b6d433;

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-emerald: #10b981;
  --accent-emerald-light: #34d399;
  --accent-cyan: #06b6d4;
  --accent-cyan-light: #38bdf8;
  --accent-violet: #8b5cf6;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

/* Hide floating Google reCAPTCHA v3 badge to prevent blocking UI interactions */
.grecaptcha-badge {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  z-index: -999 !important;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  user-select: none;
  -webkit-user-select: none;
}

button:active {
  transform: scale(0.97);
}

/* ==========================================================================
   🛡️ HARD VAULT GATEKEEPER LOCK SCREEN
   ========================================================================== */
.vault-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #0f172a 0%, #030712 100%);
  backdrop-filter: blur(14px);
  padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  overflow-y: auto;
}

.vault-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.vault-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  border: 1px solid var(--border-glow);
  box-shadow: 0 0 50px rgba(16, 185, 129, 0.15), 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  border-radius: var(--radius-xl);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
  margin: auto;
}

.vault-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-emerald), var(--accent-cyan), var(--accent-violet));
}

.vault-brand {
  margin-bottom: 16px;
}

.vault-icon-ring {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid var(--accent-emerald);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  color: var(--accent-emerald);
  animation: pulse-ring 2.5s infinite;
}

.vault-shield-svg {
  width: 30px;
  height: 30px;
}

.vault-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 3px;
  background: linear-gradient(135deg, #fff 30%, var(--accent-emerald) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 4px;
}

.vault-subtitle {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 2px;
  color: var(--accent-cyan-light);
  font-weight: 600;
}

.vault-security-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 9999px;
  padding: 5px 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.8px;
  color: var(--accent-emerald-light);
  margin-bottom: 16px;
}

.pulse-beacon {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pulse-beacon.green {
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
}

.vault-description {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
  margin-bottom: 20px;
}

.vault-form {
  width: 100%;
}

.input-group {
  position: relative;
  width: 100%;
}

.vault-input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 13px 46px 13px 14px;
  font-size: 14px;
  color: #fff;
  font-family: var(--font-mono);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.vault-input:focus {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.btn-toggle-eye {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 18px;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vault-error-msg {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid var(--accent-rose);
  color: #fecdd3;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  margin-top: 12px;
  margin-bottom: 16px;
  animation: shake 0.4s ease;
  line-height: 1.4;
}

.vault-error-msg.success {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--accent-emerald);
  color: #a7f3d0;
}

.vault-submit-btn {
  width: 100%;
  min-height: 48px;
  background: linear-gradient(135deg, var(--accent-emerald), #059669);
  color: #03130c;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.8px;
  border: none;
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.vault-submit-btn:hover {
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.vault-footer-meta {
  margin-top: 20px;
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.vault-footer-meta code {
  color: var(--accent-cyan-light);
}

/* ==========================================================================
   🔑 CHANGE PASSWORD MODAL
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 7, 18, 0.85);
  backdrop-filter: blur(8px);
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 480px;
  background: var(--bg-surface);
  border: 1px solid rgba(139, 92, 246, 0.3);
  box-shadow: 0 0 40px rgba(139, 92, 246, 0.2), 0 20px 40px rgba(0, 0, 0, 0.7);
  border-radius: var(--radius-xl);
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  animation: slide-in 0.2s ease-out;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 10px;
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-title-wrap h3 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: #fff;
}

.modal-icon { font-size: 18px; }

.modal-close-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-dim);
  font-size: 16px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close-btn:hover { color: #fff; }

.modal-description {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}

.form-field label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.btn-secondary {
  flex: 0 0 84px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: var(--radius-md);
  padding: 12px;
  font-weight: 600;
  cursor: pointer;
}
.btn-secondary:hover { color: #fff; }

/* ==========================================================================
   🚀 MAIN WORKSPACE LAYOUT
   ========================================================================== */
.app-container {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  overflow: hidden;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

/* Header */
.app-header {
  height: 56px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
  flex-shrink: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.organism-avatar-glow {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  border: 1.5px solid var(--accent-emerald);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.organism-nucleus {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-emerald);
  animation: pulse-ring 2s infinite;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 1.2px;
  background: linear-gradient(90deg, #fff, var(--accent-emerald));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

.brand-tag {
  font-size: 9.5px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* Ticker Ribbon */
.header-ticker {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 0;
  -webkit-overflow-scrolling: touch;
}
.header-ticker::-webkit-scrollbar { display: none; }

.ticker-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 3px 9px;
  border-radius: 9999px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.status-chip {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.08);
  color: var(--accent-emerald-light);
  font-weight: 600;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 6px var(--accent-emerald);
}

.chip-label { color: var(--text-dim); }
.chip-val { font-weight: 600; color: var(--text-main); }
.chip-val.cyan { color: var(--accent-cyan-light); }
.chip-val.emerald { color: var(--accent-emerald-light); }

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.header-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 6px 10px;
  min-height: 36px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  transition: all var(--transition-fast);
}

.header-btn:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--accent-emerald);
}

.btn-radar {
  border-color: rgba(6, 182, 212, 0.3);
  color: var(--accent-cyan-light);
}
.btn-radar:hover {
  background: rgba(6, 182, 212, 0.12);
  border-color: var(--accent-cyan);
}

.btn-key {
  border-color: rgba(139, 92, 246, 0.3);
  color: #c4b5fd;
}
.btn-key:hover {
  background: rgba(139, 92, 246, 0.15);
  border-color: var(--accent-violet);
  color: #fff;
}

.btn-fin {
  border-color: rgba(245, 158, 11, 0.4);
  color: #fcd34d;
  text-decoration: none;
}
.btn-fin:hover {
  background: rgba(245, 158, 11, 0.15);
  border-color: #f59e0b;
  color: #fef3c7;
}

.btn-lock {
  border-color: rgba(244, 63, 94, 0.3);
  color: #fda4af;
}
.btn-lock:hover {
  background: rgba(244, 63, 94, 0.15);
  border-color: var(--accent-rose);
}

/* ==========================================================================
   MAIN DUAL-STAGE LAYOUT
   ========================================================================== */
.main-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 360px;
  overflow: hidden;
  height: calc(100% - 56px);
  position: relative;
}

/* Dialogue Stage (Left) */
.dialogue-stage {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border-right: 1px solid var(--border-subtle);
  background: var(--bg-primary);
  min-width: 0;
}

.messages-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* Message Cards */
.message-card {
  width: 100%;
  max-width: 860px;
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  animation: slide-in 0.2s ease-out;
}

/* System Briefing Card (Frontend Welcome) */
.system-briefing-card {
  background: rgba(18, 24, 36, 0.85);
  border: 1px solid rgba(6, 182, 212, 0.3);
  box-shadow: 0 0 25px rgba(6, 182, 212, 0.08);
}

.avatar-ring.system-ring {
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan-light);
}

.step-badge-system {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.25);
  color: var(--accent-cyan-light);
}

.briefing-intro {
  font-size: 13.5px;
  line-height: 1.6;
  color: #e2e8f0;
  margin-bottom: 10px;
}

.briefing-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.briefing-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-muted);
}

.briefing-item strong { color: #fff; }
.b-icon { font-size: 14px; flex-shrink: 0; margin-top: 1px; }

.user-card {
  align-self: flex-end;
  background: var(--bg-surface-elevated);
  border-color: rgba(6, 182, 212, 0.25);
  max-width: 760px;
}

.organism-card {
  align-self: flex-start;
  border-color: rgba(16, 185, 129, 0.25);
  background: rgba(18, 24, 36, 0.95);
}

.msg-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-ring {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.avatar-ring.user {
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid var(--accent-cyan);
}

.avatar-ring.organism {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--accent-emerald);
}

.msg-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sender-name {
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.organism-card .sender-name { color: var(--accent-emerald-light); }
.user-card .sender-name { color: var(--accent-cyan-light); }

.msg-time {
  font-size: 9.5px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.step-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 9.5px;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--accent-emerald-light);
  flex-shrink: 0;
}

.msg-body {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-main);
  word-break: break-word;
}

.voice-text {
  font-size: 13.5px;
  line-height: 1.65;
  color: #e2e8f0;
}

/* Copy button on response */
.card-actions-bar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.btn-card-action {
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #c4b5fd;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.btn-card-action:hover {
  background: rgba(139, 92, 246, 0.25);
  border-color: #a78bfa;
  color: #fff;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.35);
  transform: translateY(-1px);
}
.btn-card-action:active {
  transform: translateY(0);
}
.btn-card-action.cyan {
  background: rgba(6, 182, 212, 0.12);
  border-color: rgba(6, 182, 212, 0.4);
  color: #67e8f9;
}
.btn-card-action.cyan:hover {
  background: rgba(6, 182, 212, 0.25);
  border-color: #22d3ee;
  color: #fff;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.35);
}
.btn-card-action.emerald {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
}
.btn-card-action.emerald:hover {
  background: rgba(16, 185, 129, 0.25);
  border-color: #34d399;
  color: #fff;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.35);
}

/* Collapsible Telemetry Accordion inside Organism Card */
.telemetry-accordion {
  margin-top: 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.accordion-toggle {
  width: 100%;
  background: none;
  border: none;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
}

.accordion-content {
  display: none;
  padding: 12px;
  border-top: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 11px;
}

.accordion-content.open { display: block; }

.grid-telemetry {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.tel-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.tel-title {
  color: var(--accent-cyan-light);
  font-weight: 600;
  margin-bottom: 5px;
  font-size: 10px;
  letter-spacing: 0.5px;
}

.tel-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
  color: var(--text-muted);
}
.tel-row .val { color: #fff; font-weight: 500; }

/* Control Deck (Bottom Input Area - Ergonomic Pinned) */
.control-deck {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.preset-ribbon {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 1px 0;
}
.preset-ribbon::-webkit-scrollbar { display: none; }

.ribbon-label {
  font-size: 10.5px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  white-space: nowrap;
}

.preset-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 11px;
  padding: 5px 11px;
  min-height: 32px;
  border-radius: 9999px;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.preset-btn:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--accent-emerald);
  color: #fff;
}

.btn-clear {
  margin-left: auto;
  border-color: rgba(244, 63, 94, 0.2);
}
.btn-clear:hover {
  border-color: var(--accent-rose);
  color: var(--accent-rose);
}

.shock-regulator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  overflow-x: auto;
}

.regulator-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  white-space: nowrap;
}
.reg-label { color: var(--text-dim); }
.reg-val { color: var(--accent-cyan-light); font-weight: 600; }

.shock-preset-chips {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}

.shock-chip {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 8px;
  min-height: 28px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.shock-chip.active {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan-light);
  font-weight: 600;
}

.input-bar-wrap {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.message-textarea {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  resize: none;
  outline: none;
  min-height: 44px;
  max-height: 120px;
  transition: border-color var(--transition-fast);
}

.message-textarea:focus {
  border-color: var(--accent-emerald);
}

.send-action-btn {
  height: 44px;
  padding: 0 16px;
  background: linear-gradient(135deg, var(--accent-emerald), #059669);
  color: #03130c;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.send-action-btn:hover {
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

.send-btn-content {
  display: flex;
  align-items: center;
  gap: 6px;
}

.send-svg-icon {
  width: 18px;
  height: 18px;
}

/* ==========================================================================
   TELEMETRY SIDEBAR (RIGHT)
   ========================================================================== */
.telemetry-sidebar {
  background: var(--bg-secondary);
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  -webkit-overflow-scrolling: touch;
}

.telemetry-backdrop {
  display: none;
}

.sidebar-drawer-header {
  display: none;
}

.telemetry-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}

.card-title {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #fff;
}

.live-indicator, .shield-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.live-indicator {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan-light);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.shield-badge {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald-light);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.crypto-ticker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.ticker-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 7px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.ticker-box .sym {
  font-family: var(--font-mono);
  font-size: 8.5px;
  color: var(--text-dim);
}

.ticker-box .val {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  color: #fff;
  margin-top: 2px;
}

.telemetry-kv-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.kv-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kv-row .k { color: var(--text-muted); }
.kv-row .v { color: #fff; font-weight: 600; }
.kv-row .v.cyan { color: var(--accent-cyan-light); }
.kv-row .v.emerald { color: var(--accent-emerald-light); }
.kv-row .v.amber { color: var(--accent-amber); }

/* ==========================================================================
   📱 MOBILE & TABLET ERGONOMICS (max-width: 960px)
   ========================================================================== */
@media (max-width: 960px) {
  /* Prevent iOS zoom */
  input, textarea, select {
    font-size: 16px !important;
  }

  .main-layout {
    grid-template-columns: 1fr;
  }

  /* Telemetry Off-Canvas Drawer */
  .telemetry-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(3, 7, 18, 0.7);
    backdrop-filter: blur(4px);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .telemetry-backdrop.open {
    opacity: 1;
    pointer-events: all;
  }

  .telemetry-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 88vw;
    max-width: 380px;
    z-index: 250;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.8);
    border-left: 1px solid var(--border-glow);
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }

  .telemetry-sidebar.open {
    transform: translateX(0);
  }

  .sidebar-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--border-subtle);
  }

  .drawer-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .drawer-title-wrap h3 {
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: #fff;
    letter-spacing: 0.5px;
  }

  .drawer-close-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-subtle);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }

  /* Header compact mode */
  .app-header {
    padding: 0 12px;
  }
  .brand-tag { display: none; }
  .btn-text-full { display: none; }
  .header-btn {
    padding: 6px 9px;
    min-width: 38px;
    justify-content: center;
  }

  /* Compact Messages */
  .messages-scroll {
    padding: 12px;
    gap: 12px;
  }

  .message-card {
    padding: 14px 14px;
    border-radius: var(--radius-md);
  }

  .grid-telemetry {
    grid-template-columns: 1fr;
  }

  /* Compact Input */
  .control-deck {
    padding: 10px 12px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .send-action-btn {
    padding: 0 12px;
    min-width: 52px;
  }
}

/* ==========================================================================
   ANIMATIONS & KEYFRAMES
   ========================================================================== */
@keyframes pulse-ring {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

@keyframes slide-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.btn-spinner, .send-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   🖥️ SERVER & HARDWARE TELEMETRY STYLES
   ========================================================================== */
.btn-server {
  border-color: rgba(6, 182, 212, 0.35) !important;
  color: var(--accent-cyan-light) !important;
}

.btn-server:hover {
  background: rgba(6, 182, 212, 0.15) !important;
  border-color: var(--accent-cyan) !important;
  box-shadow: 0 0 14px rgba(6, 182, 212, 0.25);
}

/* Radar Tab Switcher inside Sidebar */
.radar-tab-nav {
  display: flex;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(12, 16, 23, 0.7);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
}

.radar-tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.radar-tab-btn.active {
  background: rgba(6, 182, 212, 0.12);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan-light);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.15);
}

.radar-tab-pane {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Modal Wide */
.modal-card-wide {
  max-width: 860px !important;
  max-height: 88dvh;
  overflow-y: auto;
  padding: 24px;
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.live-indicator-pulse {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--accent-emerald-light);
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 9999px;
  padding: 3px 9px;
  display: inline-flex;
  align-items: center;
}

/* Server Stats Grid */
.server-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.server-stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color var(--transition-fast);
}

.server-stat-card:hover {
  border-color: rgba(6, 182, 212, 0.3);
}

.s-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.s-card-icon {
  font-size: 16px;
}

.s-card-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--text-main);
  flex: 1;
}

.s-badge {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}

.s-badge.emerald {
  color: var(--accent-emerald-light);
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
}

.s-badge.cyan {
  color: var(--accent-cyan-light);
  background: rgba(6, 182, 212, 0.12);
  border-color: rgba(6, 182, 212, 0.3);
}

.s-badge.violet {
  color: #c084fc;
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.3);
}

.s-badge.amber {
  color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
}

/* Progress Bars */
.s-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.s-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-primary);
  border-radius: 9999px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.s-progress-bar.small {
  height: 6px;
}

.s-progress-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.4s ease;
}

.s-progress-fill.cyan {
  background: linear-gradient(90deg, var(--accent-cyan), #38bdf8);
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.4);
}

.s-progress-fill.emerald {
  background: linear-gradient(90deg, #059669, var(--accent-emerald-light));
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.s-progress-fill.amber {
  background: linear-gradient(90deg, #d97706, #fbbf24);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.s-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* Meta List */
.s-meta-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 8px;
}

.s-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
}

.s-meta-row strong {
  font-family: var(--font-mono);
  font-weight: 600;
}

/* Storage Sub-bars */
.s-storage-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.storage-sub-bar {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.s-bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-main);
}

.s-bar-sub {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-dim);
}

/* Network Grid */
.net-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.net-box {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.net-label {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.net-val {
  font-size: 12px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-main);
}

/* Mobile Responsiveness for Server Stats */
@media (max-width: 768px) {
  .server-stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .modal-card-wide {
    padding: 16px;
    max-height: 92dvh;
  }

  .btn-server .btn-text-full {
    display: none;
  }
}

/* ==========================================================================
   WERRALEM CYBERNETIC COMMAND DECK (v4.0 - Sci-Fi Bio-Neural Architecture)
   ========================================================================== */

/* 🎛️ CYBER-NAV BAR (Top Tabbed Navigation) */
.cyber-nav-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(12, 16, 23, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  position: relative;
  z-index: 40;
}
.cyber-nav-bar::-webkit-scrollbar {
  display: none;
}

.cyber-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  background: rgba(18, 24, 36, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  text-align: left;
}
.cyber-nav-btn:hover {
  background: rgba(22, 30, 46, 0.9);
  border-color: rgba(16, 185, 129, 0.3);
  color: var(--text-main);
  transform: translateY(-1px);
}
.cyber-nav-btn.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(6, 182, 212, 0.12));
  border-color: var(--accent-emerald);
  color: #fff;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
}
.cyber-nav-btn .c-nav-icon {
  font-size: 1.25rem;
  line-height: 1;
}
.cyber-nav-btn .c-nav-text {
  display: flex;
  flex-direction: column;
}
.cyber-nav-btn .c-nav-title {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.cyber-nav-btn .c-nav-sub {
  font-size: 0.68rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}
.cyber-nav-btn.active .c-nav-sub {
  color: var(--accent-emerald-light);
}

/* 🚀 MAIN VIEWPORT & TAB PANES */
.cyber-main-viewport {
  flex: 1;
  overflow-y: auto;
  position: relative;
  background: radial-gradient(circle at 50% 0%, rgba(16, 185, 129, 0.04) 0%, rgba(7, 10, 14, 0.98) 75%);
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

.cyber-tab-pane {
  display: none;
  animation: paneFadeIn 0.25s ease-out forwards;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}
.cyber-tab-pane.active {
  display: block;
}

@keyframes paneFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   TAB 1: ANA DASHBOARD (KONTROL KÖPRÜSÜ)
   -------------------------------------------------------------------------- */
.dash-stage-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

/* 🏥 ICU PATIENT MONITOR (HASTA BAŞI MONİTÖRÜ) */
.icu-card {
  background: rgba(10, 14, 20, 0.85);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(16, 185, 129, 0.05);
  display: flex;
  flex-direction: column;
  position: relative;
}
.icu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.icu-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.icu-title-text {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: #fff;
}
.icu-subtitle {
  font-size: 0.7rem;
  color: var(--accent-emerald-light);
  font-family: var(--font-mono);
}
.icu-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-sound-toggle {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}
.btn-sound-toggle.active {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--accent-emerald);
  color: var(--accent-emerald-light);
}

.icu-body {
  display: grid;
  grid-template-columns: 1fr 180px;
  min-height: 260px;
  background: #020704;
  position: relative;
}
.icu-screen-container {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 260px;
  background: #010804;
  overflow: hidden;
}
.icu-canvas {
  width: 100%;
  height: 100%;
  display: block;
}
/* Phosphor Medical Grid Overlay */
.icu-grid-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  background-image: 
    linear-gradient(rgba(16, 185, 129, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 185, 129, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(16, 185, 129, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 185, 129, 0.03) 1px, transparent 1px);
  background-size: 40px 40px, 40px 40px, 8px 8px, 8px 8px;
}
/* CRT Scanline Effect */
.icu-scanlines {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.15),
    rgba(0, 0, 0, 0.15) 1px,
    transparent 1px,
    transparent 2px
  );
  opacity: 0.8;
}

/* ICU Vitals Sidebar Column */
.icu-vitals-sidebar {
  background: rgba(5, 10, 16, 0.95);
  border-left: 1px solid rgba(16, 185, 129, 0.2);
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}
.vital-box {
  background: rgba(12, 18, 28, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  position: relative;
}
.vital-box.pulse-active {
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: inset 0 0 10px rgba(16, 185, 129, 0.15);
}
.vital-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.vital-tag {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.vital-status {
  font-size: 0.6rem;
  font-family: var(--font-mono);
}
.vital-val {
  font-size: 1.45rem;
  font-family: var(--font-mono);
  font-weight: 800;
  line-height: 1.1;
  margin-top: 2px;
}
.vital-unit {
  font-size: 0.7rem;
  font-weight: 400;
  margin-left: 3px;
  color: var(--text-dim);
}

/* Neon Medical Colors */
.vital-box.v-hr { border-left: 3px solid #10b981; }
.vital-box.v-hr .vital-tag { color: #10b981; }
.vital-box.v-hr .vital-val { color: #34d399; text-shadow: 0 0 10px rgba(16, 185, 129, 0.4); }

.vital-box.v-vm { border-left: 3px solid #06b6d4; }
.vital-box.v-vm .vital-tag { color: #06b6d4; }
.vital-box.v-vm .vital-val { color: #38bdf8; text-shadow: 0 0 10px rgba(6, 182, 212, 0.4); }

.vital-box.v-spo2 { border-left: 3px solid #f59e0b; }
.vital-box.v-spo2 .vital-tag { color: #f59e0b; }
.vital-box.v-spo2 .vital-val { color: #fbbf24; text-shadow: 0 0 10px rgba(245, 158, 11, 0.4); }

.vital-box.v-gaba { border-left: 3px solid #8b5cf6; }
.vital-box.v-gaba .vital-tag { color: #8b5cf6; }
.vital-box.v-gaba .vital-val { color: #c4b5fd; text-shadow: 0 0 10px rgba(139, 92, 246, 0.4); }

/* 🧠 INTERACTIVE 158K SYNAPTIC CONNECTOME ATLAS */
.connectome-card {
  background: rgba(10, 14, 20, 0.85);
  border: 1px solid rgba(6, 182, 212, 0.25);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(6, 182, 212, 0.05);
  display: flex;
  flex-direction: column;
  position: relative;
}
.connectome-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.connectome-canvas-container {
  position: relative;
  width: 100%;
  height: 260px;
  background: radial-gradient(circle at center, #07101e 0%, #020610 80%);
  overflow: hidden;
}
.connectome-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}
.connectome-tooltip {
  position: absolute;
  display: none;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--accent-cyan);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  color: #fff;
  pointer-events: none;
  z-index: 20;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}
.connectome-hud-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: rgba(8, 12, 20, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.72rem;
  color: var(--text-muted);
}
.connectome-actions {
  display: flex;
  gap: 8px;
}
.btn-c-action {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: var(--accent-cyan-light);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-c-action:hover {
  background: rgba(6, 182, 212, 0.25);
  border-color: var(--accent-cyan);
  color: #fff;
}

/* 🎯 DASHBOARD 4 SUMMARY CARDS */
.dash-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.dash-stat-card {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all var(--transition-fast);
  backdrop-filter: blur(10px);
}
.dash-stat-card:hover {
  border-color: rgba(16, 185, 129, 0.3);
  transform: translateY(-2px);
  background: rgba(22, 30, 46, 0.75);
}
.ds-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.ds-icon-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.88rem;
  color: #fff;
}
.ds-badge {
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 600;
  text-transform: uppercase;
}
.ds-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.ds-kv {
  display: flex;
  justify-content: space-between;
}
.ds-val-hi {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #fff;
}
.ds-action-btn {
  margin-top: 14px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all var(--transition-fast);
}
.ds-action-btn:hover {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--accent-emerald);
  color: var(--accent-emerald-light);
}

/* --------------------------------------------------------------------------
   TAB 3: DEDICATED FULL SERVER DECK
   -------------------------------------------------------------------------- */
.server-full-deck {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.server-hero-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 16px 20px;
}
.server-core-matrix {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
  padding: 10px;
  background: rgba(7, 10, 14, 0.8);
  border-radius: var(--radius-sm);
  margin-top: 10px;
}
.core-box {
  height: 28px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  color: var(--accent-emerald-light);
}
.core-box.werracle-owned {
  background: rgba(6, 182, 212, 0.25);
  border-color: var(--accent-cyan);
  color: #fff;
  box-shadow: 0 0 6px rgba(6, 182, 212, 0.4);
}

/* --------------------------------------------------------------------------
   TAB 4: DEDICATED FULL EVOLUTION DECK
   -------------------------------------------------------------------------- */
.evolution-full-deck {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.evo-hero-banner {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(139, 92, 246, 0.1));
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.evo-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}
.section-card {
  background: rgba(18, 24, 36, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  transition: border-color var(--transition-fast), transform var(--transition-fast);
}
.section-card:hover {
  border-color: rgba(16, 185, 129, 0.3);
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 12px;
}
.metric-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px;
  background: rgba(12, 16, 23, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
}
.metric-item .m-key {
  font-size: 0.68rem;
  color: var(--text-muted);
  letter-spacing: 0.2px;
}
.metric-item .m-val {
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--font-mono);
}
.metric-item .m-val.green { color: var(--accent-emerald-light); }
.metric-item .m-val.cyan { color: var(--accent-cyan-light); }
.metric-item .m-val.amber { color: var(--accent-amber); }

/* Responsive Overrides */
@media (max-width: 900px) {
  .dash-stage-grid {
    grid-template-columns: 1fr;
  }
  .icu-body {
    grid-template-columns: 1fr;
  }
  .icu-vitals-sidebar {
    border-left: none;
    border-top: 1px solid rgba(16, 185, 129, 0.2);
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
  .connectome-canvas-container {
    height: 220px;
  }
}

/* ==========================================================================
   BROKER & CRYPTO EXCHANGE COCKPIT STYLES (v4.5 - Gainers/Losers, PnL & Charts)
   ========================================================================== */

/* 📊 1. BROKER TOP TICKER RIBBON (Artanlar & Azalanlar Şeridi) */
.broker-ticker-tape {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: rgba(10, 15, 26, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}
.broker-ticker-tape::-webkit-scrollbar { display: none; }

.tape-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
}
.tape-sym { font-weight: 700; color: #fff; }
.tape-price { font-family: var(--font-mono); color: var(--text-muted); }
.tape-chg {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 4px;
}
.tape-chg.up {
  color: var(--accent-emerald-light);
  background: rgba(16, 185, 129, 0.15);
}
.tape-chg.down {
  color: var(--accent-rose);
  background: rgba(244, 63, 94, 0.15);
}

/* 💰 2. REALIZED PnL HERO CARDS */
.broker-hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.b-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 18px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.b-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 4px; height: 100%;
  background: var(--b-accent, var(--accent-emerald));
}
.b-card.pnl { --b-accent: var(--accent-emerald); }
.b-card.win { --b-accent: var(--accent-cyan); }
.b-card.fuel { --b-accent: var(--accent-amber); }
.b-card.vault { --b-accent: var(--accent-violet); }

.b-card-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.b-card-val {
  font-size: 1.85rem;
  font-family: var(--font-mono);
  font-weight: 800;
  color: #fff;
  margin: 6px 0;
  line-height: 1.1;
}
.b-card-sub {
  font-size: 0.75rem;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* 📈 3. INTERACTIVE BROKER PnL & VOLUME CHART CARD */
.broker-chart-card {
  background: rgba(10, 15, 26, 0.85);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
  position: relative;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}
.b-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.b-chart-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.b-chart-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}
.b-chart-timeframes {
  display: flex;
  gap: 6px;
  background: rgba(0, 0, 0, 0.4);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.b-tf-btn {
  padding: 4px 10px;
  border-radius: 4px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.b-tf-btn.active, .b-tf-btn:hover {
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent-emerald-light);
}

.b-canvas-wrap {
  position: relative;
  width: 100%;
  height: 280px;
  background: radial-gradient(circle at top, rgba(16, 185, 129, 0.05) 0%, rgba(2, 6, 15, 0.95) 80%);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.04);
}
.b-pnl-canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.b-chart-tooltip {
  position: absolute;
  display: none;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--accent-emerald);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: #fff;
  pointer-events: none;
  z-index: 25;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
}

/* 🔄 4. BROKER SPLIT GRID (GAINERS/LOSERS & LIVE TRADES) */
.broker-split-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 20px;
  margin-bottom: 24px;
}

/* Gainers / Losers Table Card */
.broker-movers-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
}
.b-movers-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 10px;
}
.b-filter-tabs {
  display: flex;
  gap: 6px;
}
.b-filt-btn {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.b-filt-btn.active {
  background: rgba(6, 182, 212, 0.18);
  border-color: var(--accent-cyan);
  color: #fff;
}

.b-movers-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.b-movers-table th {
  padding: 8px 10px;
  font-size: 0.68rem;
  color: var(--text-dim);
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: right;
}
.b-movers-table th:first-child { text-align: left; }
.b-movers-table td {
  padding: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-family: var(--font-mono);
  text-align: right;
}
.b-movers-table td:first-child { text-align: left; }
.b-movers-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Live Execution Stream (Recent Trades) */
.broker-trades-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
}
.b-trade-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 0.78rem;
  transition: all var(--transition-fast);
}
.b-trade-item:hover {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.3);
}
.b-trade-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.b-trade-type {
  font-weight: 700;
  color: #fff;
}
.b-trade-net {
  font-size: 0.68rem;
  color: var(--text-dim);
}
.b-trade-profit {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.b-trade-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-emerald-light);
}
.b-trade-status {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent-emerald-light);
  font-weight: 600;
}

@media (max-width: 900px) {
  .broker-split-grid {
    grid-template-columns: 1fr;
  }
}

/* 🤖 40 vCPU Multi-Agent Swarm Deck Styles */
.swarm-cockpit-card {
  background: rgba(10, 15, 26, 0.9);
  border: 1px solid rgba(6, 182, 212, 0.35);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), inset 0 0 25px rgba(6, 182, 212, 0.06);
}
.swarm-agents-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 10px;
}
.swarm-agent-box {
  background: rgba(3, 7, 18, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all var(--transition-fast);
}
.swarm-agent-box:hover {
  background: rgba(6, 182, 212, 0.08);
  border-color: rgba(6, 182, 212, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(6, 182, 212, 0.2);
}
.swarm-agent-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.swarm-agent-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.8rem;
  color: #fff;
  letter-spacing: 0.5px;
}
.swarm-spec-tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(6, 182, 212, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(6, 182, 212, 0.3);
}
.swarm-spec-tag.amber {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}
.swarm-spec-tag.violet {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border-color: rgba(168, 85, 247, 0.3);
}
.swarm-agent-role {
  font-size: 0.72rem;
  color: #cbd5e1;
  font-weight: 600;
}
.swarm-agent-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 2px;
}
.swarm-agent-sub {
  font-size: 0.65rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 4px;
  margin-top: 2px;
}

@media (max-width: 900px) {
  .swarm-agents-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
}
@media (max-width: 640px) {
  .swarm-agents-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

/* ==========================================================================
   SCI-FI EPIGENETICS & EVOLUTION LABORATORY (v5.0 - Holographic Bio-Deck)
   ========================================================================== */

.evo-sci-fi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

/* 🧬 Holographic DNA Helix Card */
.holo-dna-card {
  background: rgba(10, 14, 24, 0.85);
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), inset 0 0 25px rgba(139, 92, 246, 0.08);
}
.dna-canvas-wrap {
  position: relative;
  width: 100%;
  height: 240px;
  background: radial-gradient(circle at center, rgba(139, 92, 246, 0.08) 0%, rgba(3, 7, 18, 0.95) 80%);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.dna-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* 📈 Fitness Evolution Landscape Card */
.fitness-landscape-card {
  background: rgba(10, 14, 24, 0.85);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), inset 0 0 25px rgba(16, 185, 129, 0.08);
}
.fitness-canvas-wrap {
  position: relative;
  width: 100%;
  height: 240px;
  background: radial-gradient(circle at center, rgba(16, 185, 129, 0.08) 0%, rgba(3, 7, 18, 0.95) 80%);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.fitness-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ⚡ Hodgkin-Huxley Ion Flux Card */
.ion-flux-card {
  background: rgba(10, 14, 24, 0.85);
  border: 1px solid rgba(6, 182, 212, 0.35);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), inset 0 0 25px rgba(6, 182, 212, 0.08);
}
.ion-canvas-wrap {
  position: relative;
  width: 100%;
  height: 220px;
  background: radial-gradient(circle at center, rgba(6, 182, 212, 0.08) 0%, rgba(3, 7, 18, 0.95) 80%);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.ion-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* 🐝 16 Colony Swarm Matrix */
.colony-swarm-card {
  background: rgba(10, 14, 24, 0.85);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), inset 0 0 25px rgba(245, 158, 11, 0.08);
}
.colony-grid-matrix {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.colony-node-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all var(--transition-fast);
}
.colony-node-box:hover {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--accent-amber);
  transform: translateY(-2px);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.25);
}
.colony-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
}
.colony-atp-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}
.colony-atp-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #10b981);
  border-radius: 2px;
}

@media (max-width: 900px) {
  .evo-sci-fi-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .colony-grid-matrix {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .broker-hero-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .broker-split-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .dash-stage-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .icu-body {
    grid-template-columns: 1fr;
  }
  .icu-vitals-sidebar {
    border-left: none;
    border-top: 1px solid rgba(16, 185, 129, 0.2);
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==========================================================================
   📱 100% COMPLETE MOBILE RESPONSIVE ENGINE (< 640px / PHONES)
   ========================================================================== */
@media (max-width: 640px) {
  body, html {
    overflow-x: hidden !important;
    width: 100% !important;
  }
  
  .cyber-main-viewport {
    padding: 10px 10px 24px 10px;
    max-width: 100vw;
    box-sizing: border-box;
  }

  /* Compact App Header */
  .app-header {
    height: 50px;
    padding: 0 10px;
    gap: 8px;
  }
  .brand-text .brand-tag {
    display: none;
  }
  .brand-text .brand-name {
    font-size: 14px;
    letter-spacing: 1px;
  }
  .header-ticker {
    gap: 6px;
    padding: 2px 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .header-ticker::-webkit-scrollbar {
    display: none;
  }
  .ticker-chip {
    padding: 3px 7px;
    font-size: 10px;
  }
  .header-btn {
    padding: 5px 8px;
    min-height: 34px;
  }
  .header-btn .btn-text-full {
    display: none;
  }

  /* Cybernetic Tab Navigation (Swipeable Mobile Ribbon) */
  .cyber-nav-bar {
    padding: 6px 10px;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    background: rgba(10, 14, 24, 0.98);
  }
  .cyber-nav-bar::-webkit-scrollbar {
    display: none;
  }
  .cyber-nav-btn {
    padding: 6px 12px;
    gap: 6px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
  }
  .cyber-nav-btn .c-nav-icon {
    font-size: 1.1rem;
  }
  .cyber-nav-btn .c-nav-title {
    font-size: 0.74rem;
  }
  .cyber-nav-btn .c-nav-sub {
    display: none !important;
  }

  /* Dashboard View on Mobile */
  .dash-hero-banner {
    padding: 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .dash-hero-stats {
    width: 100%;
    justify-content: space-between;
  }
  .icu-monitor-card {
    padding: 12px;
  }
  .icu-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .icu-monitor-canvas-wrap {
    height: 190px;
  }
  .connectome-canvas-container {
    height: 200px;
  }

  /* Chat View on Mobile */
  .chat-view-container {
    height: calc(100dvh - 110px) !important;
  }
  .messages-scroll {
    padding: 10px;
    gap: 10px;
  }
  .message-card {
    padding: 12px;
    max-width: 95%;
  }
  .control-deck {
    padding: 8px 10px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
  .prompt-input {
    font-size: 14px;
    min-height: 42px;
  }

  /* Server Radar View on Mobile */
  .server-hero-banner {
    padding: 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .server-stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .server-core-matrix, .core-grid {
    grid-template-columns: repeat(8, 1fr) !important;
    gap: 4px !important;
  }
  .core-box, .core-node {
    height: 26px !important;
    font-size: 8.5px !important;
  }

  /* Evolution Deck on Mobile */
  .evo-hero-banner {
    padding: 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .evo-metric-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .evo-sci-fi-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .holo-dna-card, .fitness-landscape-card, .ion-flux-card, .colony-swarm-card {
    padding: 14px 12px;
  }
  .sec-header {
    flex-wrap: wrap;
    gap: 8px;
  }
  .dna-canvas-wrap, .fitness-canvas-wrap {
    height: 200px;
  }
  .ion-canvas-wrap {
    height: 190px;
  }
  .colony-grid-matrix {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  /* Phase 4 Live Banner Mobile Optimization */
  .phase4-live-banner {
    padding: 12px !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }
  .phase4-live-banner > div:last-child {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 4px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 10px;
  }
  .phase4-live-banner > div:last-child > div {
    text-align: center !important;
    border-left: none !important;
    padding-left: 0 !important;
  }
  .phase4-live-banner > div:last-child > div:not(:last-child) {
    border-right: 1px solid rgba(255, 255, 255, 0.08);
  }

  /* Header ticker compacting */
  .header-ticker .ticker-chip:nth-child(4),
  .header-ticker .ticker-chip:nth-child(5) {
    display: none !important;
  }

  /* Kâr Kokpiti (Broker Deck) on Mobile */
  .broker-ticker-tape {
    margin-bottom: 14px;
    padding: 8px 12px;
  }
  .broker-hero-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }
  .b-card {
    padding: 10px !important;
  }
  .b-card-val {
    font-size: clamp(0.95rem, 3.8vw, 1.2rem) !important;
  }
  .b-card-sub {
    font-size: 0.65rem !important;
  }
  .b-chart-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .b-chart-timeframes {
    width: 100%;
    display: flex;
    justify-content: space-between;
  }
  .b-tf-btn {
    flex: 1;
    text-align: center;
    padding: 4px 6px;
    font-size: 11px;
  }
  .b-canvas-wrap {
    height: 240px;
  }
  .broker-movers-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .b-filter-tabs {
    width: 100%;
    display: flex;
    justify-content: space-between;
  }
  .b-filt-btn {
    flex: 1;
    text-align: center;
    padding: 4px 6px;
    font-size: 11px;
  }
  
  /* Text & Hash Break Protection */
  .mono-hex, .address-strip, code, .tx-hash {
    word-break: break-all !important;
    overflow-wrap: break-word !important;
    font-size: 0.72rem;
  }

  /* Tables Responsive Horizontal Scrolling */
  .b-movers-table, .server-proc-table {
    font-size: 0.72rem;
  }
  .b-movers-table th, .b-movers-table td {
    padding: 8px 6px;
  }
}

/* Extra Compact for Tiny Phones (< 380px) */
@media (max-width: 380px) {
  .broker-hero-grid {
    grid-template-columns: 1fr;
  }
  .colony-grid-matrix {
    grid-template-columns: 1fr;
  }
  .core-grid {
    grid-template-columns: repeat(5, 1fr) !important;
  }
}
