/* ==========================================================================
   Deep Sky Chile AI Observatory Assistant - Modern Cosmic Theme
   ========================================================================== */

:root {
  --bg-cosmic: #070913;
  --bg-surface: #0e1322;
  --bg-surface-elevated: #151d33;
  --bg-card: rgba(21, 29, 51, 0.7);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(0, 229, 255, 0.25);
  
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-cyan: #00e5ff;
  --accent-cyan-glow: rgba(0, 229, 255, 0.35);
  --accent-purple: #8b5cf6;
  --accent-purple-glow: rgba(139, 92, 246, 0.3);
  
  --status-green: #10b981;
  --status-green-glow: rgba(16, 185, 129, 0.3);
  --status-yellow: #f59e0b;
  --status-red: #ef4444;

  --font-heading: 'Space Grotesk', -apple-system, sans-serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --sidebar-width: 290px;
  --header-height: 60px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
}

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

/* Utilities */
.d-none { display: none !important; }
.d-flex { display: flex !important; }
.align-center { align-items: center !important; }
.justify-between { justify-content: space-between !important; }
.gap-2 { gap: 8px !important; }
.font-mono { font-family: var(--font-mono) !important; }

html {
  height: 100%;
  height: 100dvh;
}

body.dark-theme {
  background-color: var(--bg-cosmic);
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(139, 92, 246, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 85% 75%, rgba(0, 229, 255, 0.06) 0%, transparent 45%);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Main Layout */
.app-layout {
  display: flex;
  height: 100%;
  height: 100dvh;
  width: 100vw;
  width: 100dvw;
  overflow: hidden;
  position: relative;
}

/* Sidebar Backdrop (Mobile) */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 15, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 25;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

/* ==========================================================================
   Sidebar
   ========================================================================== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.25s ease;
  z-index: 20;
}

.sidebar-header {
  padding: 18px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.2), rgba(139, 92, 246, 0.3));
  border: 1px solid var(--border-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
}

.brand-text h2 {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}

.badge-mcp {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.1);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(0, 229, 255, 0.25);
}

.btn-new-chat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glow);
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.12), rgba(139, 92, 246, 0.12));
  color: #fff;
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-new-chat:hover {
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.22), rgba(139, 92, 246, 0.22));
  box-shadow: 0 0 15px var(--accent-cyan-glow);
  transform: translateY(-1px);
}

.sidebar-section {
  padding: 14px 16px;
}

.history-section {
  flex: 1;
  overflow-y: auto;
  padding-top: 6px;
}

.section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.quick-prompts {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.prompt-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}

.prompt-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateX(3px);
}

.chip-icon {
  font-size: 14px;
}

.chat-history-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.history-item:hover, .history-item.active {
  background: var(--bg-surface-elevated);
  color: #fff;
  border-color: var(--border-subtle);
}

.history-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
}

.btn-del-history {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}

.history-item:hover .btn-del-history {
  opacity: 1;
}

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(0, 0, 0, 0.2);
}

.footer-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.footer-btn:hover {
  background: var(--bg-surface-elevated);
  color: var(--accent-cyan);
  border-color: var(--border-subtle);
}

/* ==========================================================================
   Header & Live Telemetry Ribbon
   ========================================================================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  height: 100dvh;
  min-height: 0;
  min-width: 0;
  position: relative;
  overflow: hidden;
  background: transparent;
}

.telemetry-bar {
  height: var(--header-height);
  flex-shrink: 0;
  background: rgba(14, 19, 34, 0.75);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 16px;
  z-index: 10;
}

.telemetry-items {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}

.telemetry-items::-webkit-scrollbar {
  display: none;
}

.telemetry-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.telemetry-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-glow);
  transform: translateY(-1px);
}

.pill-label {
  color: var(--text-muted);
}

.pill-value {
  color: #fff;
  font-family: var(--font-mono);
  font-size: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.pulse-green {
  background: var(--status-green);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-ring 2s infinite;
}

.pulse-red {
  background: var(--status-red);
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.lang-switcher {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.lang-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lang-btn:hover {
  color: #fff;
}

.lang-btn.active {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  color: #070913;
  box-shadow: 0 0 10px var(--accent-cyan-glow);
}

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

.last-updated {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-icon:hover {
  background: var(--bg-surface-elevated);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.mobile-only {
  display: none;
}

/* ==========================================================================
   Chat Flow & Welcome
   ========================================================================== */
.chat-container {
  flex: 1 1 0%;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
}

.welcome-screen {
  max-width: 760px;
  margin: auto;
  text-align: center;
  padding: 40px 20px;
  animation: fadeIn 0.4s ease;
}

.welcome-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid var(--border-glow);
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 16px;
}

.welcome-screen h1 {
  font-family: var(--font-heading);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #fff 40%, var(--accent-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-subtitle {
  color: var(--text-muted);
  font-size: 15px;
  max-width: 600px;
  margin: 0 auto 36px;
  line-height: 1.6;
}

.welcome-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  text-align: left;
}

.welcome-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.welcome-card:hover {
  border-color: var(--border-glow);
  transform: translateY(-3px);
  box-shadow: 0 10px 25px -5px rgba(0, 229, 255, 0.1);
}

.card-icon {
  font-size: 22px;
  margin-bottom: 10px;
}

.welcome-card h3 {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 6px;
}

.welcome-card p {
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.4;
}

/* Messages List */
.messages-list {
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding-bottom: 20px;
}

.message {
  display: flex;
  gap: 14px;
  animation: fadeIn 0.3s ease;
}

.message.user {
  flex-direction: row-reverse;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 15px;
}

.message.user .avatar {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  color: #fff;
}

.message.assistant .avatar {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-glow);
  color: var(--accent-cyan);
}

.message-body {
  max-width: 82%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.message-bubble {
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
}

.message.user .message-bubble {
  background: linear-gradient(135deg, #182848, #2a3d66);
  border: 1px solid rgba(0, 229, 255, 0.25);
  color: #fff;
  border-top-right-radius: 4px;
}

.message.assistant .message-bubble {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  border-top-left-radius: 4px;
}

/* Markdown styling in messages */
.message-bubble p {
  margin-bottom: 10px;
}
.message-bubble p:last-child {
  margin-bottom: 0;
}
.message-bubble strong {
  color: #fff;
}
.message-bubble ul, .message-bubble ol {
  margin: 8px 0 10px 20px;
}
.message-bubble li {
  margin-bottom: 4px;
}
.message-bubble table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
}
.message-bubble th, .message-bubble td {
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: left;
}
.message-bubble th {
  background: rgba(255, 255, 255, 0.05);
  color: var(--accent-cyan);
}
.message-bubble pre {
  background: #040711;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  overflow-x: auto;
  margin: 10px 0;
  font-family: var(--font-mono);
  font-size: 12px;
}
.message-bubble code {
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--accent-cyan);
}

/* Tool execution pills in chat */
.tool-call-card {
  background: rgba(0, 229, 255, 0.05);
  border: 1px solid rgba(0, 229, 255, 0.2);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  overflow: hidden;
  font-size: 12px;
}

.tool-header {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.2);
}

.tool-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
}

.spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(0, 229, 255, 0.3);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.tool-content {
  padding: 10px 12px;
  background: #050813;
  max-height: 200px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   Input Area
   ========================================================================== */
.input-area {
  flex-shrink: 0;
  padding: 14px 20px 18px;
  background: linear-gradient(to top, var(--bg-cosmic) 70%, transparent);
  position: relative;
  z-index: 10;
}

.chat-form {
  max-width: 820px;
  margin: 0 auto;
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 8px 12px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.input-wrapper:focus-within {
  border-color: var(--border-glow);
  box-shadow: 0 0 20px var(--accent-cyan-glow);
}

.input-wrapper textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.4;
  resize: none;
  min-height: 24px;
  max-height: 140px;
  padding: 6px 8px;
  outline: none;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.input-wrapper textarea::placeholder {
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.input-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.char-counter {
  font-size: 11px;
  color: var(--text-dim);
}

.btn-send {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  color: #070913;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-send:hover {
  transform: scale(1.05);
  box-shadow: 0 0 15px var(--accent-cyan-glow);
}

.btn-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.input-disclaimer {
  max-width: 820px;
  margin: 6px auto 0;
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
}

/* ==========================================================================
   Modals & Drawers
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

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

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 480px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  transform: scale(0.95);
  transition: transform 0.2s ease;
  overflow: hidden;
}

.modal-card.modal-lg {
  max-width: 850px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.modal-overlay.open .modal-card {
  transform: scale(1);
}

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

.modal-header h3 {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 600;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: rgba(0, 0, 0, 0.2);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-main);
}

.form-group small {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: var(--font-body);
  font-size: 13px;
  outline: none;
}

.form-group input[type="range"] {
  width: 100%;
  accent-color: var(--accent-cyan);
}

.input-password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.btn-toggle-visibility {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  color: #070913;
  border: none;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 15px var(--accent-cyan-glow);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

/* Telemetry Dashboard Tabs & Grids */
.telemetry-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-heading);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.tab-btn.active {
  background: rgba(0, 229, 255, 0.1);
  color: var(--accent-cyan);
  border-color: var(--border-glow);
}

.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}

.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.telemetry-metric-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
}

.metric-title {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  color: #fff;
}

.metric-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Observatories visual grid */
.observatories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.obs-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.obs-card-name {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 14px;
  color: #fff;
}

.obs-badge {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-closed {
  background: rgba(16, 185, 129, 0.15);
  color: var(--status-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-open {
  background: rgba(245, 158, 11, 0.15);
  color: var(--status-yellow);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-locked {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar-backdrop {
    display: block;
  }
  .sidebar-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100%;
    height: 100dvh;
    max-width: 85vw;
    width: 290px;
    transform: translateX(-100%);
    z-index: 30;
    box-shadow: 10px 0 35px rgba(0, 0, 0, 0.7);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .mobile-only {
    display: flex;
  }
  .telemetry-bar {
    padding: 0 10px;
    gap: 8px;
    height: 54px;
    flex-shrink: 0;
  }
  .telemetry-items {
    flex: 1;
    min-width: 0;
    max-width: none;
    gap: 6px;
    padding: 2px 0;
  }
  .telemetry-pill {
    padding: 4px 8px;
    font-size: 11px;
    gap: 5px;
  }
  .pill-label,
  .desktop-only {
    display: none !important;
  }
  .telemetry-actions {
    gap: 6px;
    flex-shrink: 0;
  }
  .last-updated {
    display: none;
  }
  .btn-icon {
    width: 30px;
    height: 30px;
  }
  .lang-switcher {
    padding: 2px;
    gap: 1px;
  }
  .lang-btn {
    padding: 2px 5px;
    font-size: 10px;
  }
  .chat-container {
    padding: 14px 12px;
  }
  .welcome-screen {
    margin: 0 auto;
    padding: 12px 6px 20px;
  }
  .welcome-screen h1 {
    font-size: 24px;
    margin-bottom: 8px;
  }
  .welcome-subtitle {
    font-size: 12.5px;
    margin-bottom: 16px;
    line-height: 1.45;
  }
  .welcome-cards-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .welcome-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    text-align: left;
  }
  .welcome-card .card-icon {
    font-size: 20px;
    margin-bottom: 0;
    flex-shrink: 0;
    margin-top: 1px;
  }
  .welcome-card h3 {
    font-size: 13px;
    margin-bottom: 2px;
  }
  .welcome-card p {
    font-size: 11.5px;
    line-height: 1.35;
  }
  .input-area {
    padding: 8px 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
    flex-shrink: 0;
  }
  .input-wrapper {
    padding: 6px 10px;
    border-radius: var(--radius-md);
  }
  .input-wrapper textarea {
    padding: 6px 6px;
    font-size: 13.5px;
  }
  .btn-send {
    width: 32px;
    height: 32px;
  }
}
