/* ==========================================================================
   ĀTMAN Pure Application Shell & Dual-Mode Workspace
   First-Principles Adaptive Design Language (ADL) Compliant
   ========================================================================== */

:root {
  --app-bg: #060709;
  --app-surface: #0d0f14;
  --app-surface-hover: #141720;
  --app-surface-raised: #181c26;
  --app-border: rgba(255, 255, 255, 0.07);
  --app-border-hover: rgba(255, 255, 255, 0.15);
  --app-border-gold: rgba(212, 175, 55, 0.3);
  --app-gold: #d4af37;
  --app-gold-glow: rgba(212, 175, 55, 0.15);
  --app-gold-light: #f5deb3;
  --app-text: #ededed;
  --app-text-muted: #8b929e;
  --app-text-faint: #4c525f;
  --app-success: #10b981;
  --app-header-h: 56px;
  --app-nav-h: 60px;
  --app-radius-sm: 8px;
  --app-radius-md: 12px;
  --app-radius-lg: 16px;
  --app-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --app-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --app-font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--app-bg);
  color: var(--app-text);
  font-family: var(--app-font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
}

/* Base App Shell Layout */
#atman-app-root {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at 50% 0%, rgba(212, 175, 55, 0.03) 0%, transparent 60%),
              radial-gradient(circle at 100% 100%, rgba(16, 185, 129, 0.02) 0%, transparent 50%),
              var(--app-bg);
}

/* ─────────────────────────────────────────────────────────────────────────────
   App Header (Minimalist Obsidian Beacon)
   ───────────────────────────────────────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: calc(var(--app-header-h) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: max(16px, env(safe-area-inset-left, 16px));
  padding-right: max(16px, env(safe-area-inset-right, 16px));
  background: rgba(6, 7, 9, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--app-border);
  z-index: 50;
  flex-shrink: 0;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.brand-glyph {
  font-size: 16px;
  color: var(--app-gold);
  text-shadow: 0 0 10px var(--app-gold-glow);
}

.brand-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--app-text);
}

.sync-beacon {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--app-border);
  border-radius: 999px;
  font-size: 11px;
  color: var(--app-text-muted);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease;
}

.sync-beacon:hover,
.sync-beacon:focus-visible,
.sync-beacon.popover-open {
  outline: none;
  border-color: var(--app-border-gold);
  background: rgba(212, 175, 55, 0.08);
  box-shadow: 0 0 14px rgba(212, 175, 55, 0.15);
}

.beacon-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--app-gold);
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.6);
  animation: beaconBreathCalm 5.28s infinite ease-in-out;
  will-change: transform, opacity;
}

.beacon-glyph {
  font-size: 8px;
  color: var(--app-gold);
  opacity: 0.85;
  transition: transform 0.3s ease;
}

.sync-beacon:hover .beacon-glyph {
  transform: scale(1.2) rotate(45deg);
}

/* Presence Luminescence States */
.sync-beacon[data-presence="calm"] .beacon-pulse {
  background: var(--app-gold);
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.6);
  animation: beaconBreathCalm 5.28s infinite ease-in-out;
}

.sync-beacon[data-presence="listening"] .beacon-pulse {
  background: #a78bfa;
  box-shadow: 0 0 10px rgba(167, 139, 250, 0.7);
  animation: beaconBreathFast 1.8s infinite ease-in-out;
}

.sync-beacon[data-presence="reflecting"] .beacon-pulse {
  background: #f59e0b;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.85);
  animation: beaconBreathFast 1.2s infinite ease-in-out;
}

.sync-beacon[data-presence="deep"] .beacon-pulse {
  background: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.7);
  animation: beaconBreathCalm 3.6s infinite ease-in-out;
}

@keyframes beaconBreathCalm {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.35); opacity: 1; }
}

@keyframes beaconBreathFast {
  0%, 100% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.45); opacity: 1; }
}

/* Beacon Telemetry Popover */
.beacon-telemetry-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  padding: 12px 14px;
  background: rgba(13, 15, 20, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--app-border-gold);
  border-radius: 12px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.7), 0 0 20px rgba(212, 175, 55, 0.1);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 1000;
  font-family: var(--app-font-sans);
}

.sync-beacon:hover .beacon-telemetry-popover,
.sync-beacon:focus-within .beacon-telemetry-popover,
.sync-beacon.popover-open .beacon-telemetry-popover {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.b-pop-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--app-gold);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 6px;
  margin-bottom: 8px;
}

.b-pop-glyph {
  font-size: 10px;
}

.b-pop-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.b-pop-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
}

.b-lbl {
  color: var(--app-text-muted);
}

.b-val {
  color: var(--app-text);
  font-weight: 500;
  font-family: var(--app-font-mono);
  font-size: 10.5px;
}

.b-pop-footer {
  font-size: 9.5px;
  color: var(--app-text-faint);
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
}

/* Modal Stacking & Mascot Shielding */
body.atmi-modal-suppressed #atmi-mobile-companion,
body:has(.preview-modal-backdrop.open) #atmi-mobile-companion {
  display: none !important;
  pointer-events: none !important;
}

@media (max-width: 1024px) {
  #atmi-mobile-companion {
    bottom: calc(72px + env(safe-area-inset-bottom)) !important;
  }
}

/* Segmented Control (Mobile & Tablet) */
.header-segmented-switch {
  display: none;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}

.seg-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--app-text-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s var(--app-spring);
  min-height: 32px;
}

.seg-btn.active {
  background: var(--app-surface-raised);
  color: var(--app-text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--app-border-gold);
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--app-radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--app-border);
  color: var(--app-text-muted);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 34px;
}

.app-icon-btn:hover {
  background: var(--app-surface-hover);
  color: var(--app-text);
  border-color: var(--app-border-hover);
}

.app-icon-btn.active {
  background: var(--app-gold-dim);
  border-color: var(--app-border-gold);
  color: var(--app-gold-light);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Dual-Mode Workspace Layout
   ───────────────────────────────────────────────────────────────────────────── */
.workspace-container {
  display: flex;
  flex: 1;
  width: 100%;
  height: calc(100% - var(--app-header-h) - var(--app-nav-h));
  position: relative;
  overflow: hidden;
}

.workspace-pane {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
  position: relative;
  background: var(--app-bg);
  overflow: hidden;
  transition: flex 0.3s var(--app-spring), opacity 0.2s ease;
}

.pane-sandbox {
  border-right: 1px solid var(--app-border);
}

.pane-companion {
  background: radial-gradient(circle at 100% 0%, rgba(212, 175, 55, 0.02) 0%, transparent 50%),
              var(--app-bg);
}

/* Desktop Focus Maximize Modes */
.workspace-container.focus-sandbox .pane-companion {
  display: none;
}
.workspace-container.focus-sandbox .pane-sandbox {
  flex: 1 1 100%;
  border-right: none;
}

.workspace-container.focus-companion .pane-sandbox {
  display: none;
}
.workspace-container.focus-companion .pane-companion {
  flex: 1 1 100%;
}

/* Pane Toolbars */
.pane-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--app-border);
  background: rgba(13, 15, 20, 0.6);
  flex-shrink: 0;
  min-height: 44px;
}

.toolbar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--app-text-muted);
}

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pane-meta {
  font-family: var(--app-font-mono);
  font-size: 11px;
  color: var(--app-text-faint);
}

.mini-btn {
  padding: 3px 8px;
  border-radius: var(--app-radius-sm);
  background: transparent;
  border: 1px solid var(--app-border);
  color: var(--app-text-muted);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mini-btn:hover {
  background: var(--app-surface-hover);
  color: var(--app-text);
  border-color: var(--app-border-hover);
}

.mini-btn.active {
  background: var(--app-gold-dim);
  border-color: var(--app-border-gold);
  color: var(--app-gold);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Sandbox Canvas
   ───────────────────────────────────────────────────────────────────────────── */
.sandbox-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  position: relative;
  overflow: hidden;
}

.sandbox-textarea {
  flex: 1;
  width: 100%;
  height: 100%;
  padding: 20px 24px;
  background: transparent;
  border: none;
  color: var(--app-text);
  font-family: var(--app-font-sans);
  font-size: 15px;
  line-height: 1.7;
  resize: none;
  outline: none;
  user-select: text;
  tab-size: 2;
}

.sandbox-textarea::placeholder {
  color: var(--app-text-faint);
  font-style: italic;
  font-weight: 300;
}

.sandbox-preview {
  display: none;
  flex: 1;
  width: 100%;
  height: 100%;
  padding: 24px;
  overflow-y: auto;
  user-select: text;
  line-height: 1.8;
  color: #d1d5db;
}

.sandbox-preview.visible {
  display: block;
}

.sandbox-preview h1, .sandbox-preview h2, .sandbox-preview h3 {
  color: var(--app-text);
  margin-top: 1.2em;
  margin-bottom: 0.5em;
  font-weight: 600;
}
.sandbox-preview h1 { font-size: 1.6em; border-bottom: 1px solid var(--app-border); padding-bottom: 0.3em; }
.sandbox-preview h2 { font-size: 1.3em; }
.sandbox-preview p { margin-bottom: 1em; }
.sandbox-preview ul, .sandbox-preview ol { margin-left: 1.5em; margin-bottom: 1em; }
.sandbox-preview code { font-family: var(--app-font-mono); background: var(--app-surface-subtle); padding: 2px 6px; border-radius: 4px; font-size: 0.9em; }
.sandbox-preview blockquote { border-left: 3px solid var(--app-gold); padding-left: 14px; color: var(--app-text-muted); font-style: italic; }

.sandbox-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  border-top: 1px solid var(--app-border);
  background: rgba(13, 15, 20, 0.4);
  flex-shrink: 0;
}

.save-indicator {
  font-size: 11px;
  color: var(--app-text-faint);
  display: flex;
  align-items: center;
  gap: 6px;
}

.save-indicator.saving {
  color: var(--app-gold);
}

.btn-reflect {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.15) 0%, rgba(212, 175, 55, 0.05) 100%);
  border: 1px solid var(--app-border-gold);
  color: var(--app-gold-light);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 0.25s var(--app-spring);
}

.btn-reflect:hover {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.25) 0%, rgba(212, 175, 55, 0.12) 100%);
  border-color: var(--app-gold);
  box-shadow: 0 0 16px rgba(212, 175, 55, 0.2);
  transform: translateY(-1px);
}

.btn-reflect:active {
  transform: translateY(1px);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Companion Canvas
   ───────────────────────────────────────────────────────────────────────────── */
.companion-feed {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  user-select: text;
}

.feed-quiet-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
  text-align: center;
  color: var(--app-text-muted);
}

.quiet-yantra {
  font-size: 32px;
  color: var(--app-gold);
  opacity: 0.6;
  margin-bottom: 12px;
  animation: beaconBreath 4s infinite ease-in-out;
}

.quiet-heading {
  font-size: 16px;
  font-weight: 600;
  color: var(--app-text);
  margin-bottom: 6px;
}

.quiet-caption {
  font-size: 13px;
  color: var(--app-text-muted);
  max-width: 360px;
  line-height: 1.6;
}

.chat-bubble {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  border-radius: var(--app-radius-md);
  padding: 12px 16px;
  line-height: 1.6;
  font-size: 14px;
  animation: fadeInBubble 0.25s var(--app-spring);
}

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

.chat-bubble.user {
  align-self: flex-end;
  background: var(--app-surface-raised);
  border: 1px solid var(--app-border-hover);
  color: var(--app-text);
  border-bottom-right-radius: 4px;
}

.chat-bubble.atman {
  align-self: flex-start;
  background: rgba(13, 15, 20, 0.7);
  border: 1px solid var(--app-border-gold);
  color: #e5e7eb;
  border-bottom-left-radius: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.bubble-sender {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.chat-bubble.user .bubble-sender {
  color: var(--app-text-faint);
  text-align: right;
}

.chat-bubble.atman .bubble-sender {
  color: var(--app-gold);
}

.bubble-content {
  white-space: pre-wrap;
  word-break: break-word;
}

.companion-dock {
  padding: 12px 18px;
  border-top: 1px solid var(--app-border);
  background: rgba(6, 7, 9, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  flex-shrink: 0;
}

.dock-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-lg);
  padding: 8px 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.dock-input-wrap:focus-within {
  border-color: var(--app-border-gold);
  box-shadow: 0 0 16px rgba(212, 175, 55, 0.1);
}

.companion-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--app-text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  max-height: 120px;
  min-height: 24px;
  user-select: text;
}

.companion-input::placeholder {
  color: var(--app-text-faint);
}

.btn-send-message {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--app-gold);
  color: #000;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.2s var(--app-spring), opacity 0.2s ease;
  flex-shrink: 0;
}

.btn-send-message:hover {
  transform: scale(1.08);
}

.btn-send-message:active {
  transform: scale(0.95);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Native Bottom Navigation (Mobile & Tablet)
   ───────────────────────────────────────────────────────────────────────────── */
.mobile-bottom-nav {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: calc(var(--app-nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(6, 7, 9, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--app-border);
  z-index: 50;
  flex-shrink: 0;
}

.nav-tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 1;
  height: 100%;
  background: transparent;
  border: none;
  color: var(--app-text-muted);
  cursor: pointer;
  transition: color 0.2s ease;
  font-family: inherit;
}

.nav-tab-btn:hover {
  color: var(--app-text);
}

.nav-tab-btn.active {
  color: var(--app-gold);
}

.nav-tab-icon {
  font-size: 16px;
  line-height: 1;
}

.nav-tab-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Sensory Preview Modal (Atlas / Telemetry / Vault preview cards)
   ───────────────────────────────────────────────────────────────────────────── */
.preview-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--app-spring);
}

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

.preview-card {
  width: 100%;
  max-width: 440px;
  background: var(--app-surface);
  border: 1px solid var(--app-border-gold);
  border-radius: var(--app-radius-lg);
  padding: 24px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  transform: translateY(16px);
  transition: transform 0.25s var(--app-spring);
}

.preview-modal-backdrop.open .preview-card {
  transform: translateY(0);
}

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

.preview-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--app-text);
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--app-text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
}

.preview-desc {
  font-size: 13px;
  color: var(--app-text-muted);
  line-height: 1.6;
  margin-bottom: 16px;
}

.preview-stats-box {
  background: var(--app-surface-subtle);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-sm);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-family: var(--app-font-mono);
  font-size: 11px;
  color: var(--app-text-faint);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.preview-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--app-gold-dim);
  border: 1px solid var(--app-border-gold);
  color: var(--app-gold);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Responsive Breakpoints
   ───────────────────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .header-segmented-switch {
    display: flex;
  }

  /* On mobile/tablets, only show the active pane */
  .workspace-container .workspace-pane {
    display: none;
    flex: 1 1 100%;
    border-right: none;
  }

  .workspace-container[data-mobile-active="sandbox"] .pane-sandbox {
    display: flex;
  }

  .workspace-container[data-mobile-active="companion"] .pane-companion {
    display: flex;
  }

  #btn-focus-toggle {
    display: none;
  }
}

@media (min-width: 1025px) {
  .mobile-bottom-nav {
    display: none;
  }
  .workspace-container {
    height: calc(100% - var(--app-header-h));
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Phase 6: 6-Layer Living Brain Atlas Visualizer
   ───────────────────────────────────────────────────────────────────────────── */
.atlas-view-container {
  display: flex;
  flex-direction: column;
  flex: 1 1 100%;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  background: radial-gradient(circle at 50% 30%, rgba(212, 175, 55, 0.04) 0%, transparent 60%),
              var(--app-bg);
  padding: 16px 24px;
  animation: fadeInBubble 0.3s var(--app-spring);
  z-index: 10;
}

.atlas-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--app-border);
  margin-bottom: 20px;
  flex-shrink: 0;
}

.atlas-heading {
  font-size: 17px;
  font-weight: 700;
  color: var(--app-text);
  letter-spacing: 0.02em;
}

.atlas-subheading {
  font-size: 12px;
  color: var(--app-text-muted);
  margin-top: 2px;
}

.atlas-content-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: center;
  flex: 1;
}

.atlas-canvas-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(13, 15, 20, 0.5);
  border: 1px solid var(--app-border-gold);
  border-radius: var(--app-radius-lg);
  padding: 24px;
  min-height: 380px;
  position: relative;
}

#atlas-radar-canvas {
  width: 100%;
  max-width: 380px;
  height: 340px;
  cursor: crosshair;
}

.atlas-canvas-hint {
  font-size: 11px;
  color: var(--app-text-faint);
  margin-top: 10px;
  text-align: center;
}

.atlas-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  overflow-y: auto;
  max-height: 100%;
}

.atlas-dimension-card {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-md);
  padding: 14px;
  transition: all 0.2s var(--app-spring);
}

.atlas-dimension-card:hover {
  border-color: var(--app-border-gold);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--app-text);
}

.card-score {
  font-family: var(--app-font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--app-gold);
}

.card-axis {
  font-size: 10px;
  color: var(--app-text-faint);
  margin-bottom: 8px;
}

.card-bar-bg {
  width: 100%;
  height: 4px;
  background: var(--app-surface-subtle);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}

.card-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s var(--app-spring);
}

.card-status {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  background: var(--app-surface-raised);
  color: var(--app-text-muted);
}

@media (max-width: 1024px) {
  .atlas-content-split {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .atlas-cards-grid {
    grid-template-columns: 1fr;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Phase 7: Open Telemetry Gateway Styles
   ───────────────────────────────────────────────────────────────────────────── */
.telemetry-view-container {
  display: flex;
  flex-direction: column;
  flex: 1 1 100%;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  background: radial-gradient(circle at 80% 20%, rgba(56, 189, 248, 0.04) 0%, transparent 60%),
              var(--app-bg);
  padding: 16px 24px;
  animation: fadeInBubble 0.3s var(--app-spring);
  z-index: 10;
}

.telemetry-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--app-border);
  margin-bottom: 24px;
  flex-shrink: 0;
}

.telemetry-heading {
  font-size: 17px;
  font-weight: 700;
  color: var(--app-text);
  letter-spacing: 0.02em;
}

.telemetry-subheading {
  font-size: 12px;
  color: var(--app-text-muted);
  margin-top: 2px;
}

.telemetry-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-sync-telemetry {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.15) 0%, rgba(56, 189, 248, 0.05) 100%);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #7dd3fc;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s var(--app-spring);
}

.btn-sync-telemetry:hover {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.25) 0%, rgba(56, 189, 248, 0.12) 100%);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.2);
  transform: translateY(-1px);
}

.btn-sync-telemetry:active {
  transform: translateY(1px);
}

.sync-icon {
  font-size: 14px;
  display: inline-block;
  transition: transform 0.5s ease;
}

.btn-sync-telemetry.syncing .sync-icon {
  animation: spinSync 0.8s linear infinite;
}

@keyframes spinSync {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.telemetry-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  flex: 1;
}

.telemetry-card {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.2s var(--app-spring);
}

.telemetry-card:hover {
  border-color: rgba(56, 189, 248, 0.3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

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

.tel-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--app-text);
}

.tel-card-value {
  font-family: var(--app-font-mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--app-text);
  line-height: 1;
}

.tel-card-unit {
  font-size: 14px;
  font-weight: 400;
  color: var(--app-text-muted);
}

.tel-card-desc {
  font-size: 12px;
  color: var(--app-text-muted);
  line-height: 1.5;
}

.tel-bar-wrap {
  display: flex;
  height: 8px;
  background: var(--app-surface-subtle);
  border-radius: 4px;
  overflow: hidden;
  gap: 2px;
}

.tel-bar-segment {
  height: 100%;
  transition: width 0.3s ease;
}

.tel-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 11px;
  color: var(--app-text-faint);
}

.tel-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

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

/* ─────────────────────────────────────────────────────────────────────────────
   Phase 8: Biological & Lab Ingestion Styles
   ───────────────────────────────────────────────────────────────────────────── */
.biomarker-section-wrap {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--app-border);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.biomarker-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.biomarker-heading {
  font-size: 15px;
  font-weight: 600;
  color: var(--app-text);
  letter-spacing: 0.02em;
}

.biomarker-subheading {
  font-size: 12px;
  color: var(--app-text-muted);
  margin-top: 2px;
}

.biomarker-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.biomarker-card {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s var(--app-spring);
}

.biomarker-card:hover {
  border-color: var(--app-border-gold);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.bio-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bio-card-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--app-text);
}

.bio-card-val {
  font-family: var(--app-font-mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--app-text);
}

.bio-card-ref {
  font-size: 11px;
  color: var(--app-text-faint);
}

.bio-card-impact {
  font-size: 11px;
  color: var(--app-text-muted);
  line-height: 1.4;
  margin-top: 4px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Phase 10: Infinite Skill Tree & Conditional Pathways Styles
   ───────────────────────────────────────────────────────────────────────────── */
.skilltree-view-container {
  display: flex;
  flex-direction: column;
  flex: 1 1 100%;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  background: radial-gradient(circle at 50% 20%, rgba(212, 175, 55, 0.05) 0%, transparent 60%),
              var(--app-bg);
  padding: 16px 24px;
  animation: fadeInBubble 0.3s var(--app-spring);
  z-index: 10;
  gap: 16px;
}

.skilltree-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  border-bottom: 1px solid var(--app-border);
  padding-bottom: 12px;
}

.skilltree-title-group {
  display: flex;
  flex-direction: column;
}

.skilltree-heading {
  font-size: 18px;
  font-weight: 700;
  color: var(--app-text);
  letter-spacing: -0.01em;
}

.skilltree-subheading {
  font-size: 13px;
  color: var(--app-text-muted);
  margin-top: 2px;
}

.skilltree-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.pathway-goal-select {
  background: var(--app-surface);
  border: 1px solid var(--app-border-gold);
  border-radius: var(--app-radius-sm);
  color: var(--app-text);
  font-size: 12px;
  padding: 6px 12px;
  outline: none;
  font-family: var(--app-font-sans);
}

.btn-calc-pathway {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid var(--app-border-gold);
  border-radius: var(--app-radius-sm);
  color: var(--app-gold);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-calc-pathway:hover {
  background: rgba(212, 175, 55, 0.2);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.25);
  transform: translateY(-1px);
}

/* Pathway Recommendation Card */
.pathway-summary-card {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-md);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.pathway-summary-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.pathway-metric-chip {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--app-border);
  padding: 6px 12px;
  border-radius: var(--app-radius-sm);
}

.pathway-chip-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--app-text-faint);
}

.pathway-chip-val {
  font-family: var(--app-font-mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--app-gold);
}

.pathway-rationale-text {
  font-size: 12.5px;
  color: var(--app-text-muted);
  line-height: 1.45;
  flex: 1 1 300px;
}

.pathway-steps-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.pathway-step-node {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(212, 175, 55, 0.08);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  color: var(--app-text);
}

.pathway-arrow {
  color: var(--app-gold);
  font-size: 12px;
  opacity: 0.8;
}

/* Canvas Wrapper */
.skilltree-canvas-wrap {
  flex: 1;
  min-height: 440px;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-md);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#skilltree-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.skilltree-canvas-hint {
  position: absolute;
  bottom: 12px;
  font-size: 11px;
  color: var(--app-text-faint);
  background: rgba(10, 11, 14, 0.75);
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--app-border);
  pointer-events: none;
}

/* ─── Public Shield: Cognitive Workspace Private Preview / Coming Soon Gate ─── */
.app-coming-soon-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(6, 7, 9, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.app-coming-soon-card {
  max-width: 480px;
  width: 100%;
  background: rgba(18, 16, 13, 0.95);
  border: 1px solid rgba(198, 170, 112, 0.35);
  border-radius: 20px;
  padding: 2.5rem 2rem;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 35px rgba(198, 170, 112, 0.15);
  position: relative;
  overflow: hidden;
}

.app-coming-soon-card .gate-emblem {
  width: 56px;
  height: 56px;
  margin: 0 auto 1.25rem;
  border-radius: 16px;
  background: rgba(198, 170, 112, 0.12);
  border: 1px solid var(--accent-gold, #c6aa70);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  color: var(--accent-gold, #c6aa70);
  box-shadow: 0 0 20px rgba(198, 170, 112, 0.2);
}

.app-coming-soon-card .gate-badge {
  display: inline-block;
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fbbf24;
  margin-bottom: 1rem;
}

.app-coming-soon-card .gate-title {
  font-family: var(--font-display, 'Bricolage Grotesque', sans-serif);
  font-size: 1.55rem;
  font-weight: 700;
  color: #f5f0e6;
  margin-bottom: 0.75rem;
  line-height: 1.25;
}

.app-coming-soon-card .gate-desc {
  font-size: 0.95rem;
  color: #a69b83;
  line-height: 1.6;
  margin-bottom: 2rem;
}

.app-coming-soon-card .gate-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.app-coming-soon-card .gate-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.75rem;
  border-radius: 10px;
  background: linear-gradient(135deg, #fce5b2 0%, #c6aa70 50%, #9e7f3e 100%);
  color: #0b0a08;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.app-coming-soon-card .gate-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(198, 170, 112, 0.35);
}

.app-coming-soon-card .gate-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: #f5f0e6;
  border: 1px solid rgba(198, 170, 112, 0.25);
  font-size: 0.9rem;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.app-coming-soon-card .gate-btn-secondary:hover {
  background: rgba(198, 170, 112, 0.12);
  border-color: #c6aa70;
}

.app-coming-soon-card .gate-footnote {
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  color: #6a6252;
}

/* ==========================================================================
   ĀTMAN Phase 3: Memory Inspector Drawer & Telemetry Controls
   Adaptive Design Language (ADL) Compliant & Hardware Accelerated
   ========================================================================== */

.beacon-drawer-link {
  display: block;
  width: 100%;
  padding: 6px 10px;
  margin-bottom: 8px;
  background: var(--app-gold-dim);
  border: 1px solid var(--app-border-gold);
  border-radius: var(--app-radius-sm);
  color: var(--app-gold);
  font-family: var(--app-font-sans);
  font-size: 11.5px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.beacon-drawer-link:hover {
  background: rgba(212, 175, 55, 0.2);
  border-color: var(--app-gold);
  color: #fff;
}

.b-pop-tip {
  font-size: 11px;
  color: var(--app-text-muted);
  text-align: center;
}

/* ── Memory Inspector Backdrop ── */
.memory-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 4, 6, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* ── Slide-Out Memory Inspector Drawer ── */
.memory-inspector-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 580px;
  max-width: 100vw;
  background: var(--app-surface);
  border-left: 1px solid var(--app-border);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  transform: translate3d(100%, 0, 0);
  transition: transform 0.35s var(--app-spring);
  will-change: transform;
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.6);
  outline: none;
}

.memory-inspector-drawer.open {
  transform: translate3d(0, 0, 0);
}

/* ── Drawer Header ── */
.memory-drawer-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--app-border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  background: rgba(13, 15, 20, 0.95);
  backdrop-filter: blur(12px);
}

.memory-drawer-badge {
  display: inline-block;
  font-family: var(--app-font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--app-gold);
  background: var(--app-gold-dim);
  border: 1px solid var(--app-border-gold);
  border-radius: 4px;
  padding: 2px 7px;
  margin-bottom: 6px;
}

.memory-drawer-title {
  font-family: var(--font-display, 'Bricolage Grotesque', var(--app-font-sans));
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--app-text);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.memory-drawer-caption {
  font-size: 12.5px;
  color: var(--app-text-muted);
  line-height: 1.45;
}

.memory-drawer-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.memory-drawer-btn-icon {
  background: var(--app-surface-raised);
  border: 1px solid var(--app-border);
  color: var(--app-text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--app-radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.memory-drawer-btn-icon:hover {
  border-color: var(--app-border-hover);
  color: var(--app-text);
  background: var(--app-surface-hover);
}

/* ── Telemetry Strip ── */
.memory-telemetry-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 24px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--app-border);
  font-family: var(--app-font-mono);
  font-size: 11px;
  gap: 12px;
}

.memory-telemetry-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.mem-telemetry-lbl {
  color: var(--app-text-faint);
}

.mem-telemetry-val {
  color: var(--app-gold);
  font-weight: 500;
}

/* ── Search & Filter Controls ── */
.memory-drawer-controls {
  padding: 14px 24px 10px;
  border-bottom: 1px solid var(--app-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--app-surface);
}

.memory-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.memory-search-glyph {
  position: absolute;
  left: 12px;
  font-size: 13px;
  color: var(--app-text-faint);
  pointer-events: none;
}

.memory-search-input {
  width: 100%;
  padding: 9px 34px 9px 34px;
  background: var(--app-bg);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-sm);
  color: var(--app-text);
  font-family: var(--app-font-sans);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.memory-search-input:focus {
  border-color: var(--app-gold);
  box-shadow: 0 0 0 2px var(--app-gold-glow);
}

.memory-search-clear {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--app-text-faint);
  cursor: pointer;
  font-size: 12px;
  padding: 4px;
  border-radius: 50%;
}

.memory-search-clear:hover {
  color: var(--app-text);
}

.memory-status-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}

.memory-status-tabs::-webkit-scrollbar {
  display: none;
}

.memory-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 20px;
  background: var(--app-surface-raised);
  border: 1px solid var(--app-border);
  color: var(--app-text-muted);
  font-family: var(--app-font-sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.memory-tab-btn:hover {
  border-color: var(--app-border-hover);
  color: var(--app-text);
}

.memory-tab-btn.active {
  background: var(--app-gold-dim);
  border-color: var(--app-border-gold);
  color: var(--app-gold);
}

.tab-badge {
  font-family: var(--app-font-mono);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
}

.memory-tab-btn.active .tab-badge {
  background: rgba(212, 175, 55, 0.25);
  color: var(--app-gold-light);
}

/* ── Drawer Body & State Views ── */
.memory-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}

.memory-state-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  margin: auto;
}

.memory-spinner {
  font-size: 28px;
  color: var(--app-gold);
  animation: atman-spin 2.2s infinite linear;
  margin-bottom: 14px;
}

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

.memory-state-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.memory-state-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--app-text);
  margin-bottom: 6px;
}

.memory-state-msg {
  font-size: 13px;
  color: var(--app-text-muted);
  line-height: 1.5;
  max-width: 320px;
}

.memory-retry-btn {
  margin-top: 16px;
  padding: 8px 18px;
  border-radius: var(--app-radius-sm);
  background: var(--app-gold-dim);
  border: 1px solid var(--app-border-gold);
  color: var(--app-gold);
  font-weight: 500;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.memory-retry-btn:hover {
  background: rgba(212, 175, 55, 0.25);
  border-color: var(--app-gold);
}

/* ── Content List & Category Groups ── */
.memory-list-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.memory-category-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.memory-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-sm);
}

.memory-category-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--app-gold-light);
  display: flex;
  align-items: center;
  gap: 6px;
}

.memory-category-count {
  font-family: var(--app-font-mono);
  font-size: 11px;
  color: var(--app-text-muted);
}

/* ── Memory Card ── */
.memory-card {
  background: var(--app-bg);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.memory-card:hover {
  border-color: var(--app-border-hover);
  background: var(--app-surface-hover);
}

.memory-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.memory-card-key-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.memory-card-key {
  font-family: var(--app-font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--app-text);
  word-break: break-all;
}

.memory-card-epistemic {
  font-family: var(--app-font-mono);
  font-size: 10.5px;
  color: var(--app-text-faint);
  text-transform: lowercase;
}

.memory-status-badge {
  font-family: var(--app-font-mono);
  font-size: 10.5px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: capitalize;
  white-space: nowrap;
}

.badge-status-current {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-status-contested {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-status-historical {
  background: rgba(99, 102, 241, 0.12);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.badge-status-superseded {
  background: rgba(148, 163, 184, 0.1);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.badge-status-retracted {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
  text-decoration: line-through;
}

/* Status variations on card */
.memory-card.status-retracted {
  opacity: 0.65;
  border-style: dashed;
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.02);
}

.memory-card.status-retracted .memory-card-content {
  text-decoration: line-through;
  color: var(--app-text-muted);
  font-style: italic;
}

.memory-card.status-contested {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.025);
}

.memory-card.status-superseded {
  opacity: 0.72;
  border-color: rgba(148, 163, 184, 0.2);
}

.memory-card-content {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--app-text);
  word-break: break-word;
  user-select: text;
}

.memory-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-family: var(--app-font-mono);
  font-size: 11px;
  color: var(--app-text-muted);
  padding-top: 4px;
}

.memory-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.memory-meta-item .lbl {
  color: var(--app-text-faint);
}

/* Action Buttons Row */
.memory-actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-memory-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--app-radius-sm);
  border: 1px solid var(--app-border);
  background: var(--app-surface-raised);
  color: var(--app-text);
  font-family: var(--app-font-sans);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-memory-action:hover {
  border-color: var(--app-border-hover);
  background: var(--app-surface-hover);
}

.btn-memory-retract {
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.25);
}

.btn-memory-retract:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.45);
}

.btn-memory-contest {
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.25);
}

.btn-memory-contest:hover {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.45);
}

.btn-memory-edit {
  color: var(--app-text-muted);
}

.btn-memory-edit:hover {
  color: var(--app-text);
}

.btn-memory-restore {
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.25);
}

.btn-memory-restore:hover {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.45);
}

/* ── Toast Notification ── */
.memory-drawer-toast {
  position: absolute;
  bottom: 58px;
  left: 24px;
  right: 24px;
  background: #151821;
  border: 1px solid var(--app-border-gold);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  border-radius: var(--app-radius-sm);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--app-text);
  z-index: 10;
  animation: memory-toast-in 0.25s ease;
}

@keyframes memory-toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.memory-toast-icon {
  font-size: 14px;
}

/* ── Drawer Footer ── */
.memory-drawer-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--app-border);
  background: rgba(13, 15, 20, 0.95);
  backdrop-filter: blur(12px);
}

.memory-footer-note {
  font-family: var(--app-font-mono);
  font-size: 11px;
  color: var(--app-text-faint);
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
}

.memory-footer-note .bullet {
  color: var(--app-border);
}

/* ── Mobile Responsiveness & Safe Area Insets ── */
@media (max-width: 768px) {
  .memory-inspector-drawer {
    width: 100vw;
    border-left: none;
  }
  .memory-drawer-header {
    padding: 16px 18px 12px;
    padding-top: max(16px, env(safe-area-inset-top));
  }
  .memory-drawer-controls {
    padding: 12px 18px 8px;
  }
  .memory-drawer-body {
    padding: 14px 18px;
  }
  .memory-drawer-footer {
    padding: 12px 18px;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }
  .memory-drawer-btn-icon {
    width: 44px;
    height: 44px;
    font-size: 16px;
  }
  .btn-memory-action {
    min-height: 38px;
    padding: 6px 12px;
  }
}

/* ── Privacy Shield Dock Indicator ── */
.dock-privacy-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: center;
  margin-bottom: 8px;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  font-family: var(--app-font-sans);
  font-size: 11.5px;
  color: #34d399;
  animation: fadeInPill 0.25s ease;
}

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

.privacy-pill-icon {
  font-size: 12px;
}

/* ── Memory Submodals (Detail, Correction, Confirmation) ── */
.memory-submodal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 5, 8, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeInSubmodal 0.2s ease;
}

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

.memory-submodal-card {
  width: 100%;
  max-width: 480px;
  background: var(--app-surface-raised);
  border: 1px solid var(--app-border-gold);
  border-radius: var(--app-radius-md);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 90%;
}

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

.memory-submodal-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--app-text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.memory-submodal-close {
  background: transparent;
  border: none;
  color: var(--app-text-muted);
  cursor: pointer;
  font-size: 15px;
  padding: 4px;
}
.memory-submodal-close:hover {
  color: var(--app-text);
}

.memory-submodal-body {
  padding: 20px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.6;
  color: var(--app-text);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.memory-submodal-desc {
  font-size: 12.5px;
  color: var(--app-text-muted);
  line-height: 1.5;
}

.memory-correct-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--app-gold);
  margin-top: 6px;
}

.memory-correct-textarea {
  width: 100%;
  background: var(--app-bg);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-sm);
  color: var(--app-text);
  padding: 12px;
  font-family: var(--app-font-sans);
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  outline: none;
}
.memory-correct-textarea:focus {
  border-color: var(--app-gold);
}

.memory-submodal-actions {
  padding: 14px 20px;
  border-top: 1px solid var(--app-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: rgba(13, 15, 20, 0.6);
}

.btn-submodal-secondary {
  padding: 8px 16px;
  border-radius: var(--app-radius-sm);
  background: transparent;
  border: 1px solid var(--app-border);
  color: var(--app-text-muted);
  font-size: 12.5px;
  cursor: pointer;
}
.btn-submodal-secondary:hover {
  color: var(--app-text);
  border-color: var(--app-border-hover);
}

.btn-submodal-primary {
  padding: 8px 18px;
  border-radius: var(--app-radius-sm);
  background: var(--app-gold-dim);
  border: 1px solid var(--app-border-gold);
  color: var(--app-gold);
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
}
.btn-submodal-primary:hover {
  background: rgba(212, 175, 55, 0.25);
  color: #fff;
}

.btn-submodal-danger {
  padding: 8px 18px;
  border-radius: var(--app-radius-sm);
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
}
.btn-submodal-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

/* Detail Table inside Body */
.detail-prop-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--app-bg);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-sm);
  padding: 12px;
}
.detail-prop-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--app-font-mono);
  font-size: 11.5px;
  gap: 12px;
}
.detail-prop-lbl {
  color: var(--app-text-faint);
}
.detail-prop-val {
  color: var(--app-text);
  word-break: break-all;
  text-align: right;
}

/* Atlas Truthful Card Styling */
.atlas-dimension-card .card-insufficient-notice {
  font-family: var(--app-font-mono);
  font-size: 10.5px;
  color: var(--app-text-faint);
  margin-top: 4px;
}
.atlas-dimension-card .card-exploratory-badge {
  font-size: 9.5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--app-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-memory-detail {
  color: var(--app-gold);
  border-color: rgba(212, 175, 55, 0.25);
}

.btn-memory-detail:hover {
  background: rgba(212, 175, 55, 0.12);
  border-color: rgba(212, 175, 55, 0.45);
}

.memory-terminal-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--app-font-mono);
  font-size: 11px;
  color: var(--app-text-faint);
  font-style: italic;
  padding: 3px 8px;
  border-radius: var(--app-radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--app-border);
}

.card-detail-content {
  margin-top: 12px;
  padding: 12px;
  background: var(--app-bg);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-sm);
  font-size: 13px;
  line-height: 1.5;
  color: var(--app-text);
  white-space: pre-wrap;
  word-break: break-word;
}

.atlas-dimension-card.dimension-insufficient {
  opacity: 0.85;
}

.atlas-disclaimer-card {
  grid-column: 1 / -1;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--app-border-gold);
  border-radius: var(--app-radius-sm);
  font-size: 11px;
  color: var(--app-text-faint);
  text-align: center;
}

/* ── Phase 3 Hardened: Pending Mutation State & Indicators ── */
.memory-card.is-pending {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.03);
}

.memory-pending-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--app-font-mono);
  font-size: 10.5px;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.12);
  border: 1px dashed rgba(245, 158, 11, 0.35);
  padding: 2px 7px;
  border-radius: var(--app-radius-sm);
  animation: memory-pulse 1.8s ease-in-out infinite;
}

@keyframes memory-pulse {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 1; }
}

/* ── Accessibility: Reduced Motion Preferences ── */
@media (prefers-reduced-motion: reduce) {
  .memory-inspector-drawer,
  .memory-submodal-backdrop,
  .memory-submodal-card,
  .dock-privacy-pill,
  .memory-pending-badge,
  .memory-spinner {
    transition: none !important;
    animation: none !important;
  }
}
