/* RunpodBrain — Antigravity-Web Twin Daylight UI (Pure #FFFFFF + Optional OLED #0A0A0A Dark Mode) */

:root {
  --bg: #ffffff;
  --bg-elevated: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-pill: #f1f5f9;
  --bg-hover: #f1f5f9;
  --ink: #0f172a;
  --ink-secondary: #475569;
  --ink-muted: #64748b;
  --border: #e2e8f0;
  --border-subtle: #f1f5f9;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff6ff;
  --green: #10b981;
  --green-soft: #ecfdf5;
  --green-ink: #047857;
  --amber: #f59e0b;
  --red: #ef4444;
  --red-soft: #fef2f2;
  --red-ink: #b91c1c;
  --code-bg: #f1f5f9;
  --pre-bg: #f8fafc;
  --shadow-composer: 0 4px 20px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-popover: 0 12px 32px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.06);
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-elevated: #141416;
  --bg-subtle: #111113;
  --bg-pill: #1c1c20;
  --bg-hover: #1e1e24;
  --ink: #f8fafc;
  --ink-secondary: #cbd5e1;
  --ink-muted: #94a3b8;
  --border: #26262b;
  --border-subtle: #1c1c20;
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-soft: rgba(59, 130, 246, 0.16);
  --green: #10b981;
  --green-soft: rgba(16, 185, 129, 0.14);
  --green-ink: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --red-soft: rgba(239, 68, 68, 0.16);
  --red-ink: #fca5a5;
  --code-bg: #1e1e24;
  --pre-bg: #121215;
  --shadow-composer: 0 6px 24px rgba(0, 0, 0, 0.45);
  --shadow-popover: 0 14px 36px rgba(0, 0, 0, 0.55);
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.min-w-0 {
  min-width: 0;
}

.muted {
  color: var(--ink-muted);
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

/* ---------- Auth Overlay ---------- */

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: var(--shadow-popover);
  text-align: center;
}

.auth-logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  margin: 0 auto 14px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card h1 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.auth-sub {
  margin: 0 0 18px;
  font-size: 13.5px;
  color: var(--ink-muted);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-form input {
  width: 100%;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  outline: none;
}

.auth-form input:focus {
  border-color: var(--accent);
}

.btn-primary-full {
  width: 100%;
  padding: 11px 16px;
  border-radius: 12px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
  font-size: 14.5px;
}

.btn-primary-full:hover {
  background: var(--accent-hover);
}

.auth-error {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--red-ink);
}

/* ---------- App Shell Layout ---------- */

.app-shell {
  display: flex;
  width: 100%;
  height: 100dvh;
  padding-top: env(safe-area-inset-top);
  background: var(--bg);
  overflow: hidden;
}

.home-pane {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: var(--bg);
  min-width: 0;
}

.chat-pane {
  display: none;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: var(--bg);
  min-width: 0;
  position: relative;
}

.app-shell.view-chat .home-pane {
  display: none;
}

.app-shell.view-chat .chat-pane {
  display: flex;
}

.desktop-only {
  display: none !important;
}

@media (min-width: 900px) {
  .mobile-only {
    display: none !important;
  }
  .desktop-only {
    display: inline-flex !important;
  }
  .home-pane {
    display: flex !important;
    width: 280px;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    background: var(--bg-subtle);
  }
  .app-shell.sidebar-collapsed .home-pane {
    display: none !important;
  }
  .chat-pane {
    display: flex !important;
    flex: 1;
  }
}

/* ---------- Single 48px Top Bar ---------- */

.topbar {
  height: 48px;
  flex-shrink: 0;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg);
  min-width: 0;
}

@media (min-width: 900px) {
  .home-topbar {
    background: var(--bg-subtle);
  }
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.brand-mark {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}

.node-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-width: 0;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  background: transparent;
}

.node-pill:hover {
  background: var(--bg-hover);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
}

.status-dot.online {
  background: var(--green);
}

.chev {
  color: var(--ink-muted);
  flex-shrink: 0;
}

.gpu-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.gpu-pill:hover {
  background: var(--bg-hover);
}

.gpu-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
}

.gpu-pill.active {
  border-color: rgba(16, 185, 129, 0.35);
  background: var(--green-soft);
  color: var(--green-ink);
}

.gpu-pill.active .gpu-dot {
  background: var(--green);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-secondary);
  flex-shrink: 0;
  position: relative;
}

.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--ink);
}

.diff-btn {
  width: auto;
  padding: 0 7px;
  gap: 4px;
}

.diff-count {
  font-size: 11px;
  font-weight: 700;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.chat-title {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  min-width: 0;
}

.project-badge {
  font-size: 11.5px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--bg-pill);
  color: var(--ink-muted);
  max-width: 110px;
  flex-shrink: 0;
}

/* ---------- Home Search & Borderless Lists ---------- */

.search-row {
  padding: 8px 12px 4px;
}

.search-row input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 14px;
  outline: none;
}

.search-row input:focus {
  border-color: var(--accent);
}

.home-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 10px 10px 28px;
}

.nav-section {
  margin-bottom: 18px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 6px;
}

.section-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-muted);
  letter-spacing: 0.01em;
}

.section-toggle[aria-expanded="false"] .chev {
  transform: rotate(-90deg);
}

.text-action-btn {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 6px;
}

.text-action-btn:hover {
  background: var(--accent-soft);
}

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

.project-group {
  display: flex;
  flex-direction: column;
}

.project-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 7px 8px;
  border-radius: 10px;
  min-width: 0;
}

.project-row:hover,
.project-row.selected {
  background: var(--bg-hover);
}

.project-row-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}

.folder-icon {
  color: var(--ink-muted);
  flex-shrink: 0;
}

.row-plus-btn {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
  flex-shrink: 0;
}

.row-plus-btn:hover {
  background: var(--border);
  color: var(--ink);
}

.project-subchats {
  display: flex;
  flex-direction: column;
  padding-left: 22px;
  gap: 1px;
  margin-bottom: 4px;
}

.conv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 10px;
  min-width: 0;
  text-align: left;
  width: 100%;
}

.conv-row:hover {
  background: var(--bg-hover);
}

.conv-row.active {
  background: var(--bg-pill);
  font-weight: 600;
}

.conv-row-main {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.conv-row-title {
  font-size: 14px;
  color: var(--ink);
  min-width: 0;
  flex: 1;
}

.conv-row-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--ink-muted);
}

.conv-del-btn {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
  opacity: 0.65;
}

.conv-del-btn:hover {
  background: var(--red-soft);
  color: var(--red-ink);
  opacity: 1;
}

.live-spinner {
  width: 12px;
  height: 12px;
  border: 1.8px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

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

.empty-list-hint {
  padding: 8px 10px;
  font-size: 13px;
  color: var(--ink-muted);
}

/* ---------- Airy Conversation Timeline ---------- */

.timeline {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 16px 24px;
}

.timeline-inner {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
}

.empty-state {
  padding: 64px 12px 32px;
  text-align: center;
}

.empty-spark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  margin: 0 auto 14px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state h2 {
  margin: 0 0 6px;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.empty-sub {
  margin: 0;
  font-size: 14px;
  color: var(--ink-muted);
}

.messages-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* User message — subtle clean surface, never heavy colored box */
.msg-user-wrap {
  display: flex;
  justify-content: flex-end;
}

.msg-user {
  max-width: 88%;
  background: var(--bg-pill);
  color: var(--ink);
  padding: 10px 15px;
  border-radius: 18px;
  font-size: 15px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.msg-user-atts {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.att-tag {
  font-size: 11.5px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--ink-muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Assistant message — full-bleed airy directly on white canvas */
.msg-assistant {
  width: 100%;
  min-width: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.msg-assistant p {
  margin: 0 0 11px;
}

.msg-assistant p:last-child {
  margin-bottom: 0;
}

.msg-assistant h1, .msg-assistant h2, .msg-assistant h3, .msg-assistant h4 {
  margin: 16px 0 8px;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.msg-assistant h1 { font-size: 19px; }
.msg-assistant h2 { font-size: 17px; }
.msg-assistant h3 { font-size: 15.5px; }

.msg-assistant ul, .msg-assistant ol {
  margin: 0 0 12px;
  padding-left: 22px;
}

.msg-assistant li {
  margin-bottom: 4px;
}

.msg-assistant a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.msg-assistant code {
  font-family: var(--font-mono);
  font-size: 0.87em;
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 6px;
  overflow-wrap: anywhere;
}

.code-block {
  margin: 12px 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--pre-bg);
  overflow: hidden;
  max-width: 100%;
}

.code-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--ink-muted);
}

.code-copy-btn {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-muted);
  padding: 2px 7px;
  border-radius: 6px;
}

.code-copy-btn:hover {
  background: var(--bg-hover);
  color: var(--ink);
}

.code-block pre {
  margin: 0;
  padding: 12px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  max-width: 100%;
}

.code-block pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  overflow-wrap: normal;
  white-space: pre;
}

.msg-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-muted);
}

.msg-act-btn {
  color: var(--ink-muted);
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 6px;
}

.msg-act-btn:hover {
  background: var(--bg-hover);
  color: var(--ink);
}

/* Collapsible Thinking, Status & Tool Accordions */
.disclosure {
  width: 100%;
  min-width: 0;
  font-size: 13.5px;
  color: var(--ink-muted);
}

.disclosure summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 3px 8px 3px 2px;
  border-radius: 8px;
  max-width: 100%;
  user-select: none;
}

.disclosure summary::-webkit-details-marker {
  display: none;
}

.disclosure summary:hover {
  background: var(--bg-hover);
  color: var(--ink);
}

.disclosure-chev {
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.disclosure[open] > summary .disclosure-chev {
  transform: rotate(90deg);
}

.disclosure-body {
  margin-top: 6px;
  padding: 10px 12px;
  border-left: 2px solid var(--border);
  font-size: 13px;
  color: var(--ink-secondary);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 320px;
  overflow-y: auto;
}

.tool-item {
  padding: 6px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.tool-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.tool-item-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.tool-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}

.tool-dot.running {
  background: var(--accent);
}

.tool-dot.failed, .tool-dot.blocked {
  background: var(--red);
}

.tool-preview {
  margin: 4px 0 0 13px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--pre-bg);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 150px;
  overflow-y: auto;
}

.msg-error {
  padding: 10px 13px;
  border-radius: 12px;
  background: var(--red-soft);
  color: var(--red-ink);
  font-size: 13.5px;
  overflow-wrap: anywhere;
}

/* Jump to bottom pill */
.scroll-bottom-btn {
  position: absolute;
  right: 18px;
  bottom: 128px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--ink);
  box-shadow: var(--shadow-composer);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

/* ---------- Floating Rounded Bottom Composer Card ---------- */

.composer-dock {
  flex-shrink: 0;
  padding: 6px 12px max(12px, env(safe-area-inset-bottom));
  background: var(--bg);
}

.composer-wrap {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  position: relative;
}

.composer-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow-composer);
  padding: 10px 12px 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.composer-card:focus-within {
  border-color: var(--accent);
}

.attachment-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 2px;
}

.att-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg-pill);
  font-size: 12px;
  color: var(--ink-secondary);
  max-width: 100%;
}

.att-chip-rm {
  color: var(--ink-muted);
  font-weight: 700;
  line-height: 1;
}

.prompt-input {
  width: 100%;
  border: none;
  background: transparent;
  resize: none;
  outline: none;
  font-size: 15px;
  line-height: 1.45;
  max-height: 160px;
  padding: 2px 0;
  color: var(--ink);
}

.prompt-input::placeholder {
  color: var(--ink-muted);
}

.composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.composer-left {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.composer-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.composer-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-secondary);
  flex-shrink: 0;
}

.composer-icon-btn:hover {
  background: var(--bg-hover);
  color: var(--ink);
}

.model-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-secondary);
  min-width: 0;
  max-width: 100%;
}

.model-pill:hover {
  background: var(--bg-hover);
  color: var(--ink);
}

.spark-glyph {
  color: var(--accent);
  font-size: 13px;
  flex-shrink: 0;
}

.stop-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--red-soft);
  color: var(--red-ink);
  font-size: 12.5px;
  font-weight: 600;
}

.stop-sq {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: currentColor;
}

.send-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.send-btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

.send-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* Slash Command Popover */
.slash-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-popover);
  padding: 6px;
  z-index: 40;
  max-width: 340px;
}

.slash-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  text-align: left;
  font-size: 13.5px;
}

.slash-item:hover {
  background: var(--bg-hover);
}

.slash-cmd {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent);
}

.slash-desc {
  font-size: 12.5px;
  color: var(--ink-muted);
}

/* ---------- Popovers (Constrained Strictly Inside >= 375px Viewports) ---------- */

.popover-backdrop {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: transparent;
}

.popover {
  position: fixed;
  z-index: 50;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-popover);
  padding: 6px;
  min-width: 210px;
  max-width: calc(100vw - 24px);
}

.menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 10px;
  text-align: left;
  font-size: 13.5px;
  color: var(--ink);
}

.menu-item:hover {
  background: var(--bg-hover);
}

.menu-item.selected {
  background: var(--accent-soft);
}

.menu-item-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.menu-item-title {
  font-weight: 500;
  color: var(--ink);
}

.menu-item-sub {
  font-size: 12px;
  color: var(--ink-muted);
}

.tag-ro {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--bg-pill);
  color: var(--ink-muted);
  white-space: nowrap;
}

.model-popover {
  width: 300px;
}

.gpu-popover {
  width: 320px;
  padding: 14px;
}

.gpu-pop-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.gpu-pop-title {
  font-size: 14.5px;
  font-weight: 650;
}

.gpu-pop-sub {
  font-size: 12.5px;
  color: var(--ink-muted);
}

.badge-muted {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-pill);
  color: var(--ink-muted);
}

.badge-live {
  background: var(--green-soft);
  color: var(--green-ink);
}

.badge-booting {
  background: var(--accent-soft);
  color: var(--accent);
}

.gpu-roles-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.gpu-role-card {
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  font-size: 12.5px;
}

.gpu-role-top {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  color: var(--ink);
}

.gpu-role-meta {
  color: var(--ink-muted);
  font-size: 11.5px;
  margin-top: 2px;
}

.gpu-budget-box {
  margin-bottom: 12px;
}

.gpu-budget-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 5px;
}

.budget-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--bg-pill);
  overflow: hidden;
}

.budget-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.25s ease;
}

.budget-fill.warn {
  background: var(--amber);
}

.budget-fill.danger {
  background: var(--red);
}

.gpu-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gpu-act-btn {
  width: 100%;
  padding: 8px 11px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  color: var(--ink);
}

.gpu-act-btn:hover {
  background: var(--bg-hover);
}

.gpu-act-btn.danger {
  border-color: rgba(239, 68, 68, 0.35);
  background: var(--red-soft);
  color: var(--red-ink);
  font-weight: 600;
}

/* ---------- Slide-Over Diff Drawer ---------- */

.drawer {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(15, 23, 42, 0.35);
  display: flex;
  justify-content: flex-end;
}

.drawer-panel {
  width: 100%;
  max-width: 560px;
  height: 100%;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-popover);
  padding-top: env(safe-area-inset-top);
}

.drawer-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.drawer-title {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
}

.drawer-sub {
  font-size: 12.5px;
  color: var(--ink-muted);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.diff-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  max-width: 100%;
  flex-shrink: 0;
}

.diff-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.diff-stats {
  display: inline-flex;
  gap: 6px;
  flex-shrink: 0;
  font-weight: 600;
}

.stat-add { color: var(--green-ink); }
.stat-del { color: var(--red-ink); }

.diff-pre {
  margin: 0;
  padding: 8px 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  background: var(--bg);
}

.diff-line {
  display: block;
  padding: 0 12px;
  white-space: pre;
}

.diff-line.add {
  background: var(--green-soft);
  color: var(--green-ink);
}

.diff-line.del {
  background: var(--red-soft);
  color: var(--red-ink);
}

.diff-line.hunk {
  color: var(--accent);
  background: var(--accent-soft);
}

/* ---------- Modals ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(15, 23, 42, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 460px;
  max-height: calc(100dvh - 32px);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-popover);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-sm {
  max-width: 390px;
}

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

.modal-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-group label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.field-group input,
.field-group select,
.field-group textarea {
  width: 100%;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  outline: none;
  font-size: 14px;
}

.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
  border-color: var(--accent);
}

.settings-divider {
  height: 1px;
  background: var(--border-subtle);
}

.settings-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-secondary,
.btn-secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  text-align: center;
}

.btn-secondary:hover,
.btn-secondary-link:hover {
  background: var(--bg-hover);
}

.btn-primary {
  padding: 8px 16px;
  border-radius: 10px;
  background: var(--accent);
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-ghost-danger {
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--red-ink);
  font-size: 13.5px;
  font-weight: 500;
}

.btn-ghost-danger:hover {
  background: var(--red-soft);
}

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

.modal-foot-inline {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 130;
  background: var(--ink);
  color: var(--bg);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  max-width: calc(100vw - 32px);
  text-align: center;
  box-shadow: var(--shadow-popover);
}
