:root {
  --bg-primary: #080a10;
  --bg-surface: #0e121d;
  --bg-card: rgba(18, 24, 38, 0.7);
  --bg-card-hover: rgba(26, 34, 52, 0.85);
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: #00f5ff;
  --text-main: #f1f5f9;
  --text-muted: #8e9bb0;
  --cyan: #00f5ff;
  --cyan-glow: rgba(0, 245, 255, 0.25);
  --purple: #9d4edd;
  --indigo: #6366f1;
  --emerald: #10b981;
  --amber: #f59e0b;
  --rose: #f43f5e;
  --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 9999px;
  --sidebar-w: 260px;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

.cortex-ambient-bg {
  position: fixed;
  top: -20%;
  left: 10%;
  width: 80vw;
  height: 60vh;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, rgba(0, 245, 255, 0.06) 40%, transparent 70%);
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}

/* ==========================================================================
   CHATBOT WORLD-CLASS VIEWPORT (ChatGPT / Claude Style)
   ========================================================================== */

.chat-app-body {
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

.chat-viewport {
  display: flex;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  position: relative;
  z-index: 1;
  overflow: hidden;
}

/* SIDEBAR DRAWER OVERLAY (MOBILE) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 90;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* LEFT SIDEBAR */
.chat-main-sidebar {
  width: var(--sidebar-w);
  height: 100%;
  background: #0b0e17;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 95;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-top {
  padding: 16px 14px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 0 4px;
}

.sidebar-brand .logo-text {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.version-tag {
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(0, 245, 255, 0.12);
  color: var(--cyan);
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid rgba(0, 245, 255, 0.25);
}

.btn-new-chat {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-new-chat:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
}

.shortcut-kbd {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* SESSIONS LIST */
.sidebar-history-section {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 6px 8px 8px;
}

.btn-clear-history {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
  padding: 2px;
}

.btn-clear-history:hover {
  opacity: 1;
  color: var(--rose);
}

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

.no-sessions {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 16px 8px;
  text-align: center;
  opacity: 0.7;
}

.session-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.18s ease;
  position: relative;
  user-select: none;
}

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

.session-item.active {
  background: rgba(99, 102, 241, 0.15);
  color: #fff;
  font-weight: 500;
  border-left: 2px solid var(--cyan);
}

.session-icon {
  flex-shrink: 0;
  opacity: 0.7;
}

.session-title {
  flex: 1;
  font-size: 0.84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-delete-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  opacity: 0;
  cursor: pointer;
  padding: 2px;
  transition: opacity 0.2s, color 0.2s;
}

.session-item:hover .session-delete-btn {
  opacity: 0.8;
}

.session-delete-btn:hover {
  color: var(--rose);
}

/* SIDEBAR FOOTER */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(0, 0, 0, 0.2);
}

.sidebar-admin-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  color: var(--text-main);
  text-decoration: none;
  transition: all 0.2s ease;
}

.sidebar-admin-link:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(0, 245, 255, 0.3);
}

.admin-link-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pulse-bubble-mini {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
  animation: pulse 1.5s infinite;
}

.admin-link-text {
  display: flex;
  flex-direction: column;
}

.admin-title {
  font-size: 0.82rem;
  font-weight: 700;
}

.admin-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.model-badge-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 6px;
  font-size: 0.72rem;
}

.model-dot {
  width: 6px;
  height: 6px;
  background: var(--cyan);
  border-radius: 50%;
}

.model-name {
  font-weight: 700;
  color: var(--text-main);
  margin-right: 4px;
}

.model-arch {
  color: var(--text-muted);
}

/* ==========================================================================
   MAIN CHAT CANVAS
   ========================================================================== */

.chat-main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #080a10;
  position: relative;
  overflow: hidden;
}

/* TOP HEADER */
.chat-header {
  height: 56px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(11, 14, 23, 0.82);
  backdrop-filter: blur(12px);
  z-index: 20;
  flex-shrink: 0;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-sidebar-toggle {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-sidebar-toggle:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

.model-indicator-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}

.status-dot {
  width: 7px;
  height: 7px;
  background: var(--emerald);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--emerald);
}

.model-pill-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.model-pill-badge {
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(0, 245, 255, 0.1);
  color: var(--cyan);
  font-weight: 600;
}

.chat-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-action-btn, .btn-admin-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chat-action-btn:hover, .btn-admin-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

/* CHAT STREAM CONTAINER */
.chat-stream-container {
  flex: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* WELCOME EMPTY SCREEN */
.chat-welcome-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px 80px;
  text-align: center;
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}

.welcome-emblem {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(0, 245, 255, 0.15) 0%, rgba(99, 102, 241, 0.2) 100%);
  border: 1px solid rgba(0, 245, 255, 0.3);
  box-shadow: 0 0 35px rgba(0, 245, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 22px;
  color: var(--cyan);
}

.welcome-title {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
  background: linear-gradient(180deg, #fff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 500px;
  line-height: 1.5;
  margin-bottom: 36px;
}

.prompt-starters-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
}

.starter-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(18, 23, 36, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  transition: all 0.22s ease;
}

.starter-card:hover {
  background: rgba(28, 36, 56, 0.85);
  border-color: rgba(0, 245, 255, 0.35);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.starter-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.starter-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.starter-text strong {
  font-size: 0.85rem;
  font-weight: 600;
}

.starter-text span {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* MESSAGES FEED */
.chat-messages-feed {
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px 140px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.chat-message-row {
  width: 100%;
  display: flex;
  animation: fadeIn 0.25s ease forwards;
}

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

.msg-container {
  display: flex;
  gap: 14px;
  max-width: 100%;
  width: 100%;
}

.chat-message-row.user {
  justify-content: flex-end;
}

.chat-message-row.user .msg-container {
  flex-direction: row-reverse;
  max-width: 80%;
  width: auto;
}

.msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bot-avatar {
  background: linear-gradient(135deg, rgba(0, 245, 255, 0.2) 0%, rgba(99, 102, 241, 0.3) 100%);
  border: 1px solid rgba(0, 245, 255, 0.35);
  color: var(--cyan);
}

.user-avatar {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
}

.msg-content-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.chat-message-row.user .msg-content-wrapper {
  align-items: flex-end;
}

.msg-meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.msg-author-name {
  font-weight: 700;
  color: var(--text-main);
}

.msg-tag {
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(0, 245, 255, 0.1);
  color: var(--cyan);
  font-weight: 600;
}

.msg-bubble-body {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #e2e8f0;
  word-break: break-word;
}

.chat-message-row.user .msg-bubble-body {
  background: #1b2030;
  border: 1px solid rgba(99, 102, 241, 0.25);
  padding: 10px 16px;
  border-radius: 18px 4px 18px 18px;
  color: #f8fafc;
}

.msg-bubble-body code {
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.35);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.88em;
  color: var(--cyan);
}

.msg-actions-row {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.msg-copy-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 4px;
  transition: all 0.15s ease;
  opacity: 0.7;
}

.msg-copy-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-main);
}

/* TYPING INDICATOR */
.typing-dots-bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  width: fit-content;
}

.typing-dots-bubble .dot {
  width: 6px;
  height: 6px;
  background: var(--cyan);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dots-bubble .dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dots-bubble .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1.1); opacity: 1; }
}

.typing-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-left: 8px;
}

/* BOTTOM FLOATING INPUT DOCK */
.chat-input-dock-wrapper {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 18px max(18px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent 0%, rgba(8, 10, 16, 0.85) 30%, #080a10 100%);
  pointer-events: none;
  z-index: 30;
}

.chat-input-dock {
  pointer-events: auto;
  max-width: 780px;
  width: 100%;
  background: rgba(16, 21, 33, 0.88);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 22px;
  display: flex;
  align-items: flex-end;
  padding: 8px 12px 8px 18px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 245, 255, 0.05);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input-dock:focus-within {
  border-color: rgba(0, 245, 255, 0.4);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 245, 255, 0.15);
}

.chat-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #f8fafc;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  resize: none;
  max-height: 160px;
  padding: 6px 0;
}

.chat-textarea::placeholder {
  color: #64748b;
}

.btn-send-message {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan) 0%, var(--indigo) 100%);
  color: #07090e;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: 10px;
  transition: all 0.2s ease;
}

.btn-send-message:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 0 14px var(--cyan);
}

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

.chat-dock-disclaimer {
  font-size: 0.72rem;
  color: #64748b;
  margin-top: 8px;
  text-align: center;
  pointer-events: auto;
}

/* ==========================================================================
   ADMIN COCKPIT STYLES (/admin)
   ========================================================================== */

.admin-body {
  overflow-y: auto;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

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

.logo-text {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.brand-glow {
  background: linear-gradient(135deg, var(--cyan) 0%, var(--purple) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-pulse {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
  animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.6; }
}

.badge-recurrent {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  padding: 4px 10px;
  background: rgba(0, 245, 255, 0.08);
  border: 1px solid rgba(0, 245, 255, 0.2);
  border-radius: 20px;
  color: var(--cyan);
}

.badge-dot {
  width: 6px;
  height: 6px;
  background: var(--cyan);
  border-radius: 50%;
}

.btn-return-chat {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 245, 255, 0.12);
  border: 1px solid rgba(0, 245, 255, 0.3);
  color: var(--cyan);
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-return-chat:hover {
  background: rgba(0, 245, 255, 0.22);
  box-shadow: 0 0 14px rgba(0, 245, 255, 0.2);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.cpu-cap-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
}

.cpu-label { color: var(--text-muted); }
.cpu-value { font-family: var(--font-mono); font-weight: 700; color: var(--cyan); }
.cpu-limit-tag { color: var(--amber); font-weight: 700; font-size: 0.72rem; text-transform: uppercase; }

.icon-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover { background: rgba(255, 255, 255, 0.12); }

.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  position: relative;
  z-index: 1;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  width: 100%;
  box-sizing: border-box;
}

.dash-card {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(16px);
  overflow: hidden;
}

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

.title-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dash-card h3 {
  font-size: 1rem;
  font-weight: 700;
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-indicator.live { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.status-indicator.ram { background: var(--purple); box-shadow: 0 0 8px var(--purple); }
.status-indicator.model { background: var(--emerald); box-shadow: 0 0 8px var(--emerald); }

.sub-badge {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.gauge-container {
  display: flex;
  align-items: center;
  gap: 22px;
}

.circular-meter {
  position: relative;
  width: 110px;
  height: 110px;
  flex-shrink: 0;
}

.gauge-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.gauge-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 8;
}

.gauge-limit-marker {
  fill: none;
  stroke: rgba(245, 158, 11, 0.35);
  stroke-width: 10;
  stroke-dasharray: 132 264;
}

.gauge-fill {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 264;
  stroke-dashoffset: 264;
  transition: stroke-dashoffset 0.5s ease;
}

.gauge-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gauge-number {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--cyan);
}

.gauge-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.gauge-meta, .ram-visualizer { flex: 1; }

.meta-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.85rem;
}

.meta-row:last-child { margin-bottom: 0; }

.bar-track {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  overflow: hidden;
  margin: 12px 0 16px;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan) 0%, var(--purple) 100%);
  border-radius: 6px;
  transition: width 0.4s ease;
}

.chart-card { grid-column: span 2; }

.chart-legend {
  display: flex;
  gap: 16px;
  font-size: 0.8rem;
}

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

.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.legend-color.val { background: var(--cyan); }
.legend-color.ppl { background: var(--purple); }

.chart-wrapper {
  position: relative;
  width: 100%;
  height: 240px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  overflow: hidden;
}

#training-canvas { width: 100%; height: 100%; }

.chart-empty {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-muted);
  font-size: 0.85rem;
  pointer-events: none;
}

.control-card { grid-column: span 1; }

.control-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.input-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.input-field input, .input-field select {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
}

.input-field.checkbox-field {
  grid-column: span 2;
  margin-top: 4px;
}

.input-field.checkbox-field label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-main);
  cursor: pointer;
}

.action-buttons-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.btn-primary, .btn-secondary, .btn-danger {
  flex: 1 1 160px;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-primary { background: var(--cyan); color: #000; }
.btn-primary:hover:not(:disabled) { background: #55f8ff; box-shadow: 0 0 16px var(--cyan-glow); }

.btn-secondary { background: rgba(255, 255, 255, 0.08); color: var(--text-main); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: rgba(255, 255, 255, 0.15); }

.btn-danger { background: rgba(244, 63, 94, 0.15); border: 1px solid var(--rose); color: var(--rose); }
.btn-danger:hover:not(:disabled) { background: var(--rose); color: #fff; }

button:disabled { opacity: 0.4; cursor: not-allowed; }

.badge-active {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--emerald);
  color: var(--emerald);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
}

.badge-idle {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
}

.progress-container { margin-top: 10px; }
.progress-labels { display: flex; justify-content: space-between; font-size: 0.8rem; margin-bottom: 6px; }
.progress-track { width: 100%; height: 8px; background: rgba(255, 255, 255, 0.08); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--cyan); border-radius: 4px; transition: width 0.3s ease; }

.logs-card { grid-column: 1 / -1; }
.terminal-box {
  height: 280px;
  background: rgba(3, 6, 12, 0.95);
  border: 1px solid rgba(0, 245, 255, 0.2);
  border-radius: var(--radius-sm);
  padding: 14px;
  overflow-y: auto;
  overflow-x: hidden;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 4px;
  word-break: break-all;
  white-space: pre-wrap;
}

.log-line { color: var(--text-muted); }

/* MODALS */
.modal-backdrop {
  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: 200;
}

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 500px;
  padding: 24px;
}

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.close-btn { background: none; border: none; font-size: 1.5rem; color: var(--text-muted); cursor: pointer; }
.modal-body textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  color: #fff;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
}

.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.text-cyan { color: var(--cyan); }
.text-purple { color: var(--purple); }
.text-emerald { color: var(--emerald); }
.text-amber { color: var(--amber); }
.text-rose { color: var(--rose); }
.hidden { display: none !important; }

/* ==========================================================================
   RESPONSIVE MEDIA QUERIES (Mobile, Tablet, Desktop)
   ========================================================================== */

/* TABLET & MOBILE (< 1024px) */
@media (max-width: 1023px) {
  .chat-main-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.6);
  }

  .chat-main-sidebar.open {
    transform: translateX(0);
  }

  .btn-sidebar-toggle {
    display: flex;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .chart-card, .control-card, .logs-card, .telemetry-card {
    grid-column: span 1;
  }
}

@media (max-width: 1240px) and (min-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .chart-card {
    grid-column: span 2;
  }
  .control-card {
    grid-column: span 2;
  }
  .logs-card {
    grid-column: span 2;
  }
}

/* DESKTOP (>= 1024px) */
@media (min-width: 1024px) {
  .btn-sidebar-toggle {
    display: none;
  }

  .sidebar-overlay {
    display: none !important;
  }
}

/* MOBILE (< 640px) */
@media (max-width: 639px) {
  .prompt-starters-grid {
    grid-template-columns: 1fr;
  }

  .welcome-title {
    font-size: 1.45rem;
  }

  .welcome-subtitle {
    font-size: 0.85rem;
    margin-bottom: 24px;
  }

  .btn-text-desktop {
    display: none;
  }

  .chat-header {
    padding: 0 12px;
  }

  .chat-messages-feed {
    padding: 16px 12px 120px;
  }

  .chat-input-dock-wrapper {
    padding: 0 10px max(12px, env(safe-area-inset-bottom));
  }

  .chat-input-dock {
    padding: 6px 8px 6px 14px;
    border-radius: 18px;
  }

  .chat-textarea {
    font-size: 0.9rem;
  }

  .btn-send-message {
    width: 32px;
    height: 32px;
  }

  .app-header {
    padding: 12px 16px;
  }

  .app-container {
    padding: 14px;
  }

  .control-form-grid {
    grid-template-columns: 1fr;
  }

  .input-field.checkbox-field {
    grid-column: span 1;
  }
}

/* ==========================================================================
   ARTIFACTS / PROJECT STUDIO STYLES (Claude & v0 Style)
   ========================================================================== */

.artifact-card {
  margin-top: 14px;
  background: rgba(18, 24, 38, 0.9);
  border: 1px solid rgba(0, 245, 255, 0.25);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.artifact-card:hover {
  background: rgba(26, 34, 52, 0.95);
  border-color: #00f5ff;
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 245, 255, 0.15);
}

.artifact-card-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.artifact-card-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: rgba(0, 245, 255, 0.1);
  border: 1px solid rgba(0, 245, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #00f5ff;
  flex-shrink: 0;
}

.artifact-card-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 3px;
}

.artifact-card-meta {
  font-size: 0.8rem;
  color: #8e9bb0;
}

.artifact-card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.artifact-action-btn {
  background: rgba(0, 245, 255, 0.15);
  border: 1px solid rgba(0, 245, 255, 0.3);
  color: #00f5ff;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.artifact-action-btn:hover {
  background: #00f5ff;
  color: #080a10;
}

/* THE STUDIO BACKDROP */
.studio-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  z-index: 400;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.studio-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* THE STUDIO PANEL - HIGH PERFORMANCE SLIDING DRAWER */
.artifacts-studio {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(880px, 92vw);
  height: 100vh;
  height: 100dvh;
  background: #0a0d16;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(105%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
  opacity: 0;
  pointer-events: none;
  z-index: 500;
  box-shadow: -16px 0 50px rgba(0, 0, 0, 0.85);
}

.artifacts-studio.open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.studio-header {
  height: 56px;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0e121d;
  flex-shrink: 0;
  gap: 12px;
}

.studio-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.studio-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.studio-tabs {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.3);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.studio-tab-btn {
  background: transparent;
  border: none;
  color: #8e9bb0;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.studio-tab-btn.active {
  background: #1e293b;
  color: #00f5ff;
}

.studio-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.studio-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.studio-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #00f5ff;
}

.studio-download-btn {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.3);
  color: #10b981;
}

.studio-download-btn:hover {
  background: #10b981;
  color: #080a10;
}

.studio-close-btn {
  padding: 6px;
}

.studio-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: calc(100% - 56px);
}

.studio-file-tabs {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  background: #090c15;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  overflow-x: auto;
  white-space: nowrap;
}

.file-tab {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #8e9bb0;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.2s;
}

.file-tab:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
}

.file-tab.active {
  background: rgba(0, 245, 255, 0.12);
  border-color: rgba(0, 245, 255, 0.3);
  color: #00f5ff;
}

.studio-editor-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #06080e;
}

.editor-toolbar {
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.current-filename {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #64748b;
}

.editor-copy-btn {
  background: transparent;
  border: none;
  color: #8e9bb0;
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.editor-copy-btn:hover {
  color: #00f5ff;
}

.studio-code-pre {
  flex: 1;
  margin: 0;
  padding: 16px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  color: #e2e8f0;
}

.studio-preview-body {
  height: 100%;
  flex: 1;
}

.studio-preview-frame {
  width: 100%;
  height: 100%;
  border: none;
  background: #000;
}

@media (max-width: 768px) {
  .artifacts-studio {
    width: 100vw;
    border-left: none;
  }
}

