/* ============================================
   RUBIX — Shell Styles (Skeleton)
   All colors use CSS variables — swap later
   ============================================ */

:root {
  /* === THEME TOKENS — 9 Ruby Brand === */
  --bg-primary: #0a0a0a;
  --bg-secondary: #141414;
  --bg-tertiary: #1e1e1e;
  --bg-hover: #2a2a2a;
  --bg-active: #333333;
  --text-primary: #e0e0e0;
  --text-secondary: #999999;
  --text-muted: #555555;
  --accent: #C41A3B;          /* Ruby Red */
  --accent-hover: #d92045;
  --accent-dim: #5a1020;
  --border: #222222;
  --danger: #c42b1c;
  --success: #2ea043;
  --warning: #d29922;
  --radius: 8px;
  --radius-sm: 4px;
  --sidebar-width: 52px;
  --sidebar-width-expanded: 200px;
  --titlebar-height: 38px;
  --tabbar-height: 40px;
  --addressbar-height: 42px;
  --statusbar-height: 26px;
  --ai-panel-width: 380px;

  /* 9 Ruby Brand Fonts */
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', monospace;
}

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

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

/* ── Inline-Style Replacements ───────────── */

.u-rel { position: relative; }

.u-title-mini {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  user-select: none;
}

.u-badge-mini {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: 6px;
}

.u-btn-mini-mr {
  font-size: 12px;
  margin-right: 8px;
}

.u-fs10 { font-size: 10px; }

.u-fs10-muted {
  font-size: 10px;
  color: var(--text-muted);
}

.u-zoom-status {
  font-size: 10px;
  color: var(--text-muted);
  min-width: 30px;
  text-align: center;
}

.ai-lode-btn {
  font-size: 12px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
}

.tone-accent { color: var(--accent); }
.tone-muted { color: var(--text-muted); }
.tone-cyan { color: #26c6da; }
.tone-violet { color: #ab47bc; }
.tone-blue { color: #42a5f5; }
.tone-green { color: #66bb6a; }
.tone-orange { color: #ffa726; }
.tone-gray { color: #888; }
.tone-red { color: #ea4335; }
.tone-drive { color: #4285f4; }
.tone-white { color: #fff; }

/* ── Title Bar ────────────────────────────── */

#titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--titlebar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  -webkit-app-region: drag;
  flex-shrink: 0;
}

#titlebar-drag {
  flex: 1;
  padding-left: 16px;
  font-size: 13px;
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  -webkit-app-region: drag;
  display: flex;
  align-items: center;
}

#titlebar-drag img {
  filter: drop-shadow(0 0 6px rgba(196, 26, 59, 0.25));
}

#titlebar-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--text-secondary);
  text-transform: uppercase;
}

#titlebar.incognito {
  background: linear-gradient(90deg, var(--bg-secondary), #1a1030);
}
#titlebar.incognito #titlebar-title::after {
  content: ' (Incognito)';
  font-size: 11px;
  color: var(--warning);
  font-style: italic;
}

#titlebar-tools {
  display: flex;
  gap: 2px;
  -webkit-app-region: no-drag;
}

#titlebar-tools button {
  height: 28px;
  padding: 0 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
}

#titlebar-tools button:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

#titlebar-tools button.active {
  color: var(--accent);
}

#titlebar-controls {
  display: flex;
  -webkit-app-region: no-drag;
}

#titlebar-controls button {
  width: 46px;
  height: var(--titlebar-height);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}

#titlebar-controls button:hover {
  background: var(--bg-hover);
}

#btn-close:hover {
  background: var(--danger) !important;
  color: white;
}

/* ── Shell Layout ─────────────────────────── */

#shell {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Activity Bar (VS Code style — left icon strip) ── */

#activity-bar {
  width: 48px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  padding: 0;
  z-index: 10;
}

.ab-rubix-btn {
  width: 48px;
  height: 48px;
  border: none;
  background: var(--bg-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
  padding: 0;
}

.ab-rubix-btn:hover {
  background: var(--accent-dim);
}

.ab-rubix-btn.active {
  background: var(--accent);
}

.ab-rubix-icon {
  width: 30px;
  height: 30px;
  filter: brightness(0.9);
  transition: filter 0.15s, transform 0.15s;
}

.ab-rubix-btn:hover .ab-rubix-icon {
  filter: brightness(1.3);
  transform: scale(1.08);
}

.ab-rubix-btn.active .ab-rubix-icon {
  filter: brightness(1.5);
}

.ab-separator {
  width: 24px;
  height: 1px;
  background: var(--border);
  margin: 4px 0;
  flex-shrink: 0;
}

.ab-item {
  width: 48px;
  height: 44px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
  position: relative;
  flex-shrink: 0;
}

.ab-item:hover {
  color: var(--text-primary);
}

.ab-item.active {
  color: var(--text-primary);
}

.ab-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 25%;
  height: 50%;
  width: 2px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.ab-icon {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
}

.ab-spacer {
  flex: 1;
}

/* ── Titlebar Button (visible) ──────────── */

.tb-btn {
  height: 28px;
  padding: 0 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
}

.tb-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.tb-btn.active {
  color: var(--accent);
}

/* ── Bottom Panel (Terminal — VS Code style) ── */

#bottom-panel {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 250px;
  min-height: 100px;
  max-height: 60vh;
  position: relative;
}

#bottom-panel.maximized {
  height: 80vh;
}

#bottom-panel-resize {
  position: absolute;
  top: -3px;
  left: 0;
  right: 0;
  height: 6px;
  cursor: ns-resize;
  z-index: 5;
}

#bottom-panel-resize:hover {
  background: var(--accent);
  opacity: 0.3;
}

#bottom-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  height: 34px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#bottom-panel-tabs {
  display: flex;
  gap: 2px;
}

.bp-tab {
  padding: 4px 12px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 12px;
  cursor: pointer;
  transition: color 0.15s;
}

.bp-tab:hover {
  color: var(--text-secondary);
}

.bp-tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}

#bottom-panel-controls {
  display: flex;
  gap: 4px;
}

#bottom-panel-controls button {
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

#bottom-panel-controls button:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

#bottom-panel-content {
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* ── Ruby Bar divider ──────────────────────── */

.rb-divider {
  width: 1px;
  height: 16px;
  background: var(--border);
  margin: 0 4px;
  flex-shrink: 0;
}

/* ── Sidebar ──────────────────────────────── */

#sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
  overflow: hidden;
  overflow-y: auto;
  transition: width 0.2s ease, opacity 0.2s ease;
}

#sidebar::-webkit-scrollbar { width: 0; }

#sidebar.sidebar-hidden {
  width: 0;
  border-right-color: transparent;
  pointer-events: none;
  opacity: 0;
}

#sidebar:not(.sidebar-hidden):hover {
  width: var(--sidebar-width-expanded);
}

#sidebar-modules {
  display: flex;
  flex-direction: column;
  padding: 8px 0;
  gap: 2px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 38px;
  padding: 0 18px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  transition: background 0.15s, color 0.15s;
}

.sidebar-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-item.active {
  background: var(--bg-active);
  color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.sidebar-label {
  font-family: var(--font-body);
  opacity: 0;
  transition: opacity 0.15s;
}

#sidebar:hover .sidebar-label {
  opacity: 1;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 12px;
}

#sidebar-footer {
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

/* ── Content Area ─────────────────────────── */

#content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* ── Loading Progress Bar ─────────────────── */

#loading-bar {
  height: 3px;
  width: 100%;
  background: transparent;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
  transition: opacity 0.3s ease;
}

#loading-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--accent), #ff6b8a, var(--accent));
  background-size: 200% 100%;
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 10px var(--accent), 0 0 4px var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease, opacity 0.3s ease;
  will-change: transform, background-position;
}

#loading-bar.loading #loading-bar-fill {
  animation: loading-progress 2.5s cubic-bezier(0.4, 0, 0.2, 1) infinite,
             loading-shimmer 1.5s ease-in-out infinite;
}

#loading-bar.loaded #loading-bar-fill {
  transform: scaleX(1);
  transition: transform 0.15s ease;
}

#loading-bar.loading-bar-hidden {
  opacity: 0;
  pointer-events: none;
}

#loading-bar.loading-bar-hidden #loading-bar-fill {
  transform: scaleX(0);
}

@keyframes loading-progress {
  0%   { transform: scaleX(0); }
  15%  { transform: scaleX(0.35); }
  40%  { transform: scaleX(0.6); }
  65%  { transform: scaleX(0.78); }
  85%  { transform: scaleX(0.88); }
  100% { transform: scaleX(0.93); }
}

@keyframes loading-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Tab Bar ──────────────────────────────── */

#tabbar {
  display: flex;
  align-items: center;
  height: var(--tabbar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0 8px;
  gap: 4px;
  flex-shrink: 0;
  overflow-x: auto;
}

#tabbar::-webkit-scrollbar { display: none; }
#tabbar { scroll-behavior: smooth; }

.tab {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 12px;
  max-width: 200px;
  border-radius: var(--radius);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: max-width 0.2s ease, padding 0.2s ease, opacity 0.2s ease, background 0.15s;
  flex-shrink: 0;
  position: relative;
}

.tab:hover { background: var(--bg-hover); }
.tab.active { background: var(--bg-tertiary); color: var(--text-primary); }

.tab.tab-closing {
  max-width: 0;
  padding: 0;
  margin: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transition: max-width 0.2s ease, padding 0.2s ease, margin 0.2s ease, opacity 0.15s ease;
}

.tab-close {
  margin-left: auto;
  width: 16px;
  height: 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tab-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.tab-dragging {
  opacity: 0.35;
  transform: scale(0.95);
  transition: opacity 0.15s, transform 0.15s;
}

.tab-drag-over {
  border-left: 3px solid var(--accent);
  box-shadow: -4px 0 12px rgba(196, 26, 59, 0.3);
}

.tab-group-label {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  margin: 4px 2px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  -webkit-user-select: none;
  user-select: none;
  opacity: 0.9;
}
.tab-group-label:hover { opacity: 1; }

.tab-favicon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border-radius: 3px;
  object-fit: contain;
  transition: opacity 0.2s ease;
}

.tab-favicon-fallback {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-hover);
  text-transform: uppercase;
  line-height: 1;
}

.tab-audio-icon {
  font-size: 10px;
  color: var(--accent);
  flex-shrink: 0;
}

.tab-muted-icon {
  color: var(--text-muted);
}

/* Pinned tabs: compact, favicon-only, no close button */
.tab.pinned {
  max-width: 36px;
  min-width: 36px;
  padding: 0;
  justify-content: center;
}
.tab.pinned .tab-close { display: none; }
.tab.pinned .tab-title { display: none; }
.tab.pinned .tab-audio-icon { display: none; }

#btn-new-tab {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  border-radius: var(--radius);
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s, transform 0.1s;
}

#btn-new-tab:hover { background: var(--bg-hover); color: var(--text-primary); }
#btn-new-tab:active { transform: scale(0.85); }

/* ── Address Bar ──────────────────────────── */

#addressbar {
  display: flex;
  align-items: center;
  height: var(--addressbar-height);
  padding: 0 8px;
  gap: 4px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
}

#addressbar button {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  border-radius: var(--radius);
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s, transform 0.1s;
}

#addressbar button:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

#addressbar button:active {
  transform: scale(0.9);
}

#url-input {
  flex: 1;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-mono);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

#url-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(196, 26, 59, 0.15);
}

#security-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

#security-indicator.secure { background: var(--success); }
#security-indicator.insecure { background: var(--warning); }

/* ── URL Autocomplete ────────────────────── */

.url-suggestions {
  position: absolute;
  top: 100%;
  left: 48px;
  right: 80px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  z-index: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.url-suggestions.hidden {
  display: flex !important;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
}

.url-suggestion-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.1s;
  overflow: hidden;
}

.url-suggestion-item:hover,
.url-suggestion-item.selected {
  background: var(--bg-hover);
}

.url-sug-title {
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.url-sug-url {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* ── Workspace (viewport + AI panel horizontal) ── */

#workspace {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* ── Viewport ─────────────────────────────── */

#viewport-container {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

.viewport-pane {
  flex: 1;
  position: relative;
  background: var(--bg-primary);
  min-width: 0;
  transition: opacity 0.1s ease;
}

.viewport-pane webview,
.viewport-pane > div:not(.rubix-page) {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  opacity: 1;
  transition: opacity 0.12s ease;
}

.viewport-pane webview.hidden,
.viewport-pane > div.hidden {
  opacity: 0;
  pointer-events: none;
  position: absolute;
  z-index: -1;
}

#split-divider {
  width: 4px;
  background: var(--border);
  cursor: col-resize;
  flex-shrink: 0;
  transition: background 0.15s;
}

#split-divider:hover { background: var(--accent); }

/* ── Internal Pages ──────────────────────── */

.rubix-page {
  padding: 40px;
  height: 100%;
  overflow-y: auto;
}

.rubix-page h1 {
  font-family: var(--font-display);
  font-size: 28px;
  margin-bottom: 16px;
}

.rubix-page p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

/* ── AI Panel ─────────────────────────────── */

#ai-panel {
  width: var(--ai-panel-width);
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  transition: width 0.2s ease, opacity 0.2s ease;
}

#ai-panel.hidden {
  display: flex !important;  /* override global .hidden — use width collapse instead */
  width: 0;
  opacity: 0;
  border-left: none;
  pointer-events: none;
  overflow: hidden;
}

#ai-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
}

#ai-panel-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
}

#ai-panel-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

#ai-provider-select {
  height: 26px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 11px;
  outline: none;
  cursor: pointer;
}

#ai-panel-close {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  border-radius: var(--radius-sm);
}

#ai-panel-close:hover { background: var(--bg-hover); color: var(--text-primary); }

#ai-panel-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
}

#ai-context-toggle {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
}

#ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-message {
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.5;
  max-width: 95%;
  word-wrap: break-word;
}

.ai-message.user {
  align-self: flex-end;
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.ai-message.assistant {
  align-self: flex-start;
  background: var(--bg-primary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* Markdown inside AI messages */
.ai-message.assistant code {
  background: var(--bg-tertiary);
  padding: 2px 5px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.ai-message.assistant pre {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  overflow-x: auto;
  margin: 8px 0;
  font-size: 12px;
  line-height: 1.5;
}

.ai-message.assistant pre code {
  background: none;
  padding: 0;
}

.ai-message.assistant h1,
.ai-message.assistant h2,
.ai-message.assistant h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 8px 0 4px;
  color: var(--text-primary);
}

.ai-message.assistant ul,
.ai-message.assistant ol {
  padding-left: 18px;
  margin: 4px 0;
}

.ai-message.assistant li { margin: 2px 0; }

.ai-message.assistant blockquote {
  border-left: 3px solid var(--accent-dim);
  padding-left: 10px;
  margin: 6px 0;
  color: var(--text-muted);
  font-style: italic;
}

.ai-message.assistant strong { color: var(--text-primary); }

.ai-message.assistant a {
  color: var(--accent);
  text-decoration: none;
}

.ai-message.assistant a:hover { text-decoration: underline; }

.ai-message.assistant hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 8px 0;
}

.ai-typing-indicator {
  display: inline-flex;
  gap: 4px;
  padding: 4px 0;
}

.ai-typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing-dot 1.2s infinite;
}

.ai-typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-dot {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1); }
}

.ai-message.system {
  align-self: center;
  color: var(--text-muted);
  font-size: 11px;
  font-style: italic;
}

#ai-input-area {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
}

#ai-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-body);
  resize: none;
  outline: none;
}

#ai-input:focus { border-color: var(--accent); }

#ai-send {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--accent-dim);
  color: var(--text-primary);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 16px;
  align-self: flex-end;
  transition: background 0.15s;
}

#ai-send:hover { background: var(--accent); }

/* ── Bookmarks Bar ────────────────────────── */

#bookmarks-bar {
  display: flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  gap: 4px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
}

#bookmarks-bar::-webkit-scrollbar { display: none; }

.bookmark-item {
  height: 24px;
  padding: 0 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  flex-shrink: 0;
}

.bookmark-item:hover { background: var(--bg-hover); color: var(--text-primary); }

#btn-manage-bookmarks {
  margin-left: auto;
  height: 24px;
  padding: 0 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

/* ── Downloads Panel ──────────────────────── */

#downloads-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 340px;
  height: 100%;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform 0.2s ease;
}

#downloads-panel.hidden {
  display: flex !important;
  transform: translateX(100%);
  pointer-events: none;
}

#downloads-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
}

#downloads-header button {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
}

#downloads-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.download-item {
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 8px;
  font-size: 13px;
}

.dl-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.dl-filename {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.dl-status {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.dl-complete { color: #4caf50; }
.dl-cancelled { color: #f44336; }
.dl-interrupted { color: #ff9800; }

.dl-bar {
  height: 3px;
  background: var(--bg-active);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 6px;
}

.dl-bar-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}

.dl-actions {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.dl-btn {
  border: none;
  background: var(--bg-active);
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.dl-btn:hover {
  background: var(--border);
  color: var(--text-primary);
}

.empty-state {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  margin-top: 40px;
}

/* ── History Panel ────────────────────────── */

#history-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 400px;
  height: 100%;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform 0.2s ease;
}

#history-panel.hidden {
  display: flex !important;
  transform: translateX(100%);
  pointer-events: none;
}

#history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  padding: 0 12px 0 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
  gap: 8px;
}

#history-header > div {
  display: flex;
  align-items: center;
  gap: 6px;
}

#history-header button {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

#history-header button:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

#history-close {
  font-size: 18px !important;
}

#history-search {
  width: 140px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 12px;
}

#history-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
}

.history-date-group {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 4px 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.1s;
}

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

.history-item-time {
  color: var(--text-muted);
  font-size: 11px;
  flex-shrink: 0;
  width: 44px;
}

.history-item-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
}

.history-item-url {
  color: var(--text-muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 120px;
}

/* ── Tab Preview ──────────────────────────── */

#tab-preview {
  position: absolute;
  z-index: 200;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  max-width: 300px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

#tab-preview-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

#tab-preview-url {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 6px;
}

#tab-preview-summary {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ── Page Action Menu ─────────────────────── */

#page-action-menu {
  position: absolute;
  top: calc(var(--tabbar-height) + var(--addressbar-height) + 4px);
  right: 8px;
  z-index: 300;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  min-width: 200px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transform-origin: top right;
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.1s ease, transform 0.1s ease;
}

#page-action-menu.hidden {
  display: block !important;
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
}

#page-action-menu hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 4px 0;
}

.page-action {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.page-action:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ── Tab Context Menu ─────────────────────── */

#tab-context-menu {
  position: fixed;
  z-index: 500;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  min-width: 200px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.1s ease, transform 0.1s ease;
}

#tab-context-menu.hidden {
  display: block !important;
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
}

#tab-context-menu hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 4px 0;
}

.ctx-action {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.ctx-action:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ── Page Context Menu (right-click webview) ── */

#page-context-menu {
  position: fixed;
  z-index: 500;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  min-width: 200px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.1s ease, transform 0.1s ease;
}

#page-context-menu.hidden {
  display: block !important;
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
}

#page-context-menu hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 4px 0;
}

/* ── Command Bar (Cmd+K) ─────────────────── */

#command-bar {
  position: fixed;
  bottom: 44px;
  left: 50%;
  transform: translateX(-50%);
  width: 480px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
  z-index: 9999;
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.1s ease, transform 0.1s ease;
}

#command-bar.hidden {
  display: block !important;
  opacity: 0;
  transform: translateX(-50%) translateY(4px);
  pointer-events: none;
}

#command-input {
  width: 100%;
  height: 32px;
  padding: 0 12px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-mono);
  outline: none;
  border-bottom: 1px solid var(--border);
}

#command-input::placeholder {
  color: var(--text-muted);
  font-size: 12px;
}

#command-results {
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
}

.command-result {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--font-body);
  color: var(--text-secondary);
}

.command-result:hover,
.command-result.selected {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-left-color: var(--accent);
}

.command-result-hint {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.command-result-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.command-type-tag {
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  flex-shrink: 0;
  padding: 1px 5px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  min-width: 64px;
}

.command-type-tag[data-type="command"] { color: #ab47bc; }
.command-type-tag[data-type="module"]  { color: #42a5f5; }
.command-type-tag[data-type="tab"]     { color: #66bb6a; }
.command-type-tag[data-type="bookmark"]{ color: #ffa726; }
.command-type-tag[data-type="closed"]  { color: #ef5350; }

/* ── Find Bar ─────────────────────────────── */

#find-bar {
  position: absolute;
  top: calc(var(--tabbar-height) + var(--addressbar-height));
  right: 16px;
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transform: translateY(0);
  opacity: 1;
  transition: opacity 0.12s ease, transform 0.12s ease;
}

#find-bar.hidden {
  display: flex !important;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}

#find-input {
  width: 200px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}

#find-count {
  font-size: 11px;
  color: var(--text-muted);
  min-width: 32px;
  text-align: center;
}

#find-bar button {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

#find-bar button:hover { background: var(--bg-hover); }

/* ── Ruby Command Bar (Bottom) ────────────── */

#ruby-bar {
  display: flex;
  align-items: center;
  height: 40px;
  padding: 0 4px 0 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
  gap: 6px;
  position: relative;
}

/* ── Hide titlebar tool buttons (moved to Start Menu) */
.tb-hidden {
  display: none !important;
}

/* ── Start Button (THE button — bottom-left corner) */

#ruby-start {
  width: 48px;
  height: 40px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
  border-right: 1px solid var(--border);
  padding: 0;
}

#ruby-start:hover {
  background: var(--accent-dim);
}

#ruby-start.active {
  background: var(--accent);
}

#ruby-start-icon {
  width: 26px;
  height: 26px;
  filter: brightness(0.9);
  transition: filter 0.15s, transform 0.15s;
}

#ruby-start:hover #ruby-start-icon {
  filter: brightness(1.3);
  transform: scale(1.08);
}

#ruby-start.active #ruby-start-icon {
  filter: brightness(1.5);
}

/* ── Start Menu (THE hub — pops up from bottom-left) */

#ruby-start-menu {
  position: fixed;
  bottom: 42px;
  left: 48px;
  width: 340px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 -12px 48px rgba(0,0,0,0.7);
  z-index: 9999;
  backdrop-filter: blur(16px);
}

#ruby-start-menu.hidden { display: none; }

#rsm-header {
  padding: 16px 20px 6px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

#rsm-title {
  font-family: var(--font-display);
  font-size: 24px;
  color: var(--accent);
  letter-spacing: -0.5px;
}

#rsm-crystal-info {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

#rsm-section-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 6px 20px 4px;
  font-family: var(--font-body);
}

#rsm-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  padding: 2px 10px;
}

.rsm-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 4px 8px;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 10px;
  cursor: pointer;
  transition: background 0.12s;
}

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

.rsm-icon {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  transition: border-color 0.12s;
}

.rsm-item:hover .rsm-icon {
  border-color: var(--accent);
}

#rsm-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 16px;
}

/* Quick Actions — 2-column list */
#rsm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 2px 10px;
}

.rsm-action {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 11px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, color 0.12s;
}

.rsm-action:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.rsm-action span:first-child {
  font-size: 13px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

#rsm-footer {
  display: flex;
  justify-content: space-between;
  padding: 8px 20px 12px;
  font-family: var(--font-mono);
}

#ruby-bar-center {
  flex: 1;
  position: relative;
  max-width: 600px;
  margin: 0 auto;
}

#ruby-bar-input {
  width: 100%;
  height: 24px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 0 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

#ruby-bar-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(196, 26, 59, 0.15);
}

#ruby-bar-input::placeholder {
  color: var(--text-muted);
  font-size: 11px;
}

#ruby-bar-results {
  position: absolute;
  bottom: 32px;
  left: 0;
  right: 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 400px;
  overflow-y: auto;
  z-index: 9999;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.5);
}

#ruby-bar-results.hidden { display: none; }

.rb-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-body);
}

.rb-result:last-child { border-bottom: none; }

.rb-result:hover, .rb-result.active {
  background: var(--bg-hover);
}

.rb-result-icon {
  width: 20px;
  text-align: center;
  color: var(--accent);
  font-size: 13px;
  flex-shrink: 0;
}

.rb-result-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rb-result-hint {
  color: var(--text-muted);
  font-size: 10px;
  flex-shrink: 0;
}

.rb-result-category {
  padding: 6px 14px 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#ruby-bar-right {
  display: flex;
  align-items: center;
  gap: 2px;
}

.rb-toggle {
  display: flex;
  align-items: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.rb-toggle:hover {
  color: var(--text-secondary);
  background: var(--bg-hover);
}

.rb-toggle.active {
  color: var(--accent);
  background: var(--accent-dim);
}

.rb-icon {
  font-size: 12px;
}

.rb-label {
  font-size: 10px;
}

/* ── Google Apps Panel ───────────────────────── */

#google-apps-panel {
  position: absolute;
  top: calc(var(--titlebar-height) + 4px);
  right: 80px;
  width: 480px;
  max-height: 600px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  transform-origin: top right;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

#google-apps-panel.hidden {
  display: flex !important;
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
}

#google-apps-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

#google-apps-header > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

#google-apps-search {
  width: 160px;
  padding: 4px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
}

#google-apps-search:focus {
  border-color: var(--accent);
}

#google-apps-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
}

#services-tabs {
  display: flex;
  gap: 2px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.services-tab {
  padding: 6px 10px;
  white-space: nowrap;
  flex-shrink: 0;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.services-tab:hover {
  color: var(--text-secondary);
  background: var(--bg-tertiary);
}

.services-tab.active {
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border-color: var(--border);
}

#google-apps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 12px;
  overflow-y: auto;
  max-height: 480px;
}

.google-app-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 11px;
  transition: background 0.15s;
}

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

.google-app-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.google-app-label {
  text-align: center;
  line-height: 1.2;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.google-app-category {
  grid-column: 1 / -1;
  padding: 8px 4px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.google-app-category:first-child {
  border-top: none;
  margin-top: 0;
}

/* ── Extensions Panel ─────────────────────────── */

#extensions-panel {
  position: absolute;
  top: calc(var(--titlebar-height) + 4px);
  right: 120px;
  width: 340px;
  max-height: 480px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  transform-origin: top right;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

#extensions-panel.hidden {
  display: flex !important;
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
}

#extensions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

#extensions-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
}

#extensions-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.extension-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
}

.extension-card .ext-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.extension-card .ext-info {
  flex: 1;
  min-width: 0;
}

.extension-card .ext-name {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
}

.extension-card .ext-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.extension-card .ext-toggle {
  width: 36px;
  height: 20px;
  border-radius: 10px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s;
}

.extension-card .ext-toggle.active {
  background: var(--accent);
}

.extension-card .ext-toggle::after {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-primary);
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
}

.extension-card .ext-toggle.active::after {
  transform: translateX(16px);
}

#extensions-footer {
  padding: 8px 12px;
  border-top: 1px solid var(--border);
}

#btn-create-extension {
  width: 100%;
  padding: 8px;
  background: var(--bg-tertiary);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

#btn-create-extension:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--accent);
}

/* ── Toast Notifications ─────────────────── */

#toast-container {
  position: fixed;
  bottom: 40px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  font-size: 13px;
  color: var(--text-primary);
  pointer-events: auto;
  animation: toast-in 0.25s ease-out;
  max-width: 360px;
}

.toast.toast-out {
  animation: toast-out 0.2s ease-in forwards;
}

.toast-icon {
  flex-shrink: 0;
  font-size: 15px;
}

.toast-success .toast-icon { color: var(--success, #2ea043); }
.toast-error .toast-icon { color: var(--danger, #c42b1c); }
.toast-info .toast-icon { color: var(--accent); }
.toast-warning .toast-icon { color: var(--warning, #d29922); }

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

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(12px); }
}

/* ── Cookie List (Settings) ─────────────────── */

.settings-cookie-list {
  max-height: 300px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
}

.settings-cookie-list.hidden {
  display: none;
}

/* ── Tab Sleep ─────────────────────────────── */

.tab-sleeping {
  opacity: 0.5;
}

.tab-sleeping .tab-title {
  font-style: italic;
}

.tab-sleep-icon {
  font-size: 10px;
  margin-right: 2px;
  opacity: 0.6;
}

/* ── Content Blocker Status ─────────────────── */

.status-blocker {
  cursor: pointer;
  padding: 0 6px;
  border-radius: var(--radius-sm);
  transition: color 0.2s;
}

.blocker-on {
  color: var(--success);
}

.blocker-off {
  color: var(--danger);
}

/* ── Settings Page ─────────────────────────── */

.settings-page {
  padding: 32px 40px;
  max-width: 720px;
  margin: 0 auto;
}

.settings-page h1 {
  font-size: 28px;
  margin-bottom: 28px;
  font-weight: 600;
}

.settings-container {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.settings-section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 600;
}

.settings-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

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

.settings-row:last-child {
  border-bottom: none;
}

.settings-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.settings-name {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
}

.settings-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.settings-select {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 6px 10px;
  font-size: 12px;
  min-width: 160px;
  cursor: pointer;
  outline: none;
}

.settings-select:focus {
  border-color: var(--accent);
}

.settings-toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
  cursor: pointer;
}

.settings-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.settings-toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-tertiary);
  border-radius: 11px;
  border: 1px solid var(--border);
  transition: background 0.2s, border-color 0.2s;
}

.settings-toggle-slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-secondary);
  left: 2px;
  top: 2px;
  transition: transform 0.2s, background 0.2s;
}

.settings-toggle input:checked + .settings-toggle-slider {
  background: var(--success);
  border-color: var(--success);
}

.settings-toggle input:checked + .settings-toggle-slider::before {
  transform: translateX(18px);
  background: #fff;
}

.settings-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

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

.settings-btn-danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
}

.settings-btn-danger:hover {
  background: color-mix(in srgb, var(--danger) 15%, transparent);
}

.settings-kbd {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ── Notification Center ───────────────────── */

#notifications-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 380px;
  height: 100%;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  z-index: 90;
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform 0.2s ease;
}

#notifications-panel.hidden {
  display: flex !important;
  transform: translateX(100%);
  pointer-events: none;
}

#notifications-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
}

#notifications-header div {
  display: flex;
  align-items: center;
}

#notifications-header button {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: inherit;
}

#notifications-header button:hover {
  color: var(--text-primary);
}

#notifications-list {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.notif-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

.notif-badge.hidden {
  display: none;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}

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

.notif-unread {
  background: rgba(255, 255, 255, 0.02);
}

.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 5px;
}

.notif-dot-read {
  background: transparent;
}

.notif-content {
  flex: 1;
  min-width: 0;
}

.notif-title {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-body {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-meta {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Tab Search Overlay ────────────────────── */

.tab-search-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 80px;
}

.tab-search-overlay.hidden {
  display: none;
}

.tab-search-input {
  width: 480px;
  max-width: 90%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: 12px 16px;
  font-size: 15px;
  outline: none;
}

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

.tab-search-results {
  width: 480px;
  max-width: 90%;
  max-height: 400px;
  overflow-y: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
}

.tab-search-item {
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.tab-search-item:last-child {
  border-bottom: none;
}

.tab-search-item:hover,
.tab-search-item.selected {
  background: var(--bg-hover);
}

.tab-search-title {
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab-search-url {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab-search-empty {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ============================================
   RUBIX — Module Design System
   Luxury-industrial cockpit aesthetic
   ============================================ */

/* ── Ambient Noise Texture ──────────────────
   Adds subtle grain to backgrounds — makes
   flat dark surfaces feel physical, not digital */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* ── Module Page Foundations ────────────────── */

.rubix-page {
  scrollbar-width: thin;
  scrollbar-color: var(--bg-active) transparent;
}

.rubix-page::-webkit-scrollbar { width: 6px; }
.rubix-page::-webkit-scrollbar-track { background: transparent; }
.rubix-page::-webkit-scrollbar-thumb {
  background: var(--bg-active);
  border-radius: 3px;
}
.rubix-page::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.rubix-page h1 {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
  color: var(--text-primary);
  position: relative;
}

/* Ruby underline accent on page titles */
.rubix-page h1::after {
  content: '';
  display: block;
  width: 40px;
  height: 2px;
  background: var(--accent);
  margin-top: 12px;
  border-radius: 1px;
  box-shadow: 0 0 8px rgba(196, 26, 59, 0.3);
}

/* ── Dashboard Stats Row ───────────────────── */

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  border-color: var(--accent-dim);
  box-shadow: 0 0 20px rgba(196, 26, 59, 0.06);
}

/* Subtle top-edge glow on stat cards */
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.stat-card:hover::before { opacity: 0.6; }

.stat-value {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.stat-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 6px;
}

.stat-accent .stat-value { color: var(--accent); }
.stat-success .stat-value { color: var(--success); }

/* ── Module Tab Switcher ───────────────────── */

.module-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 24px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 3px;
  width: fit-content;
  border: 1px solid var(--border);
}

.module-tab {
  padding: 8px 20px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-family: var(--font-body);
  font-weight: 500;
  cursor: pointer;
  border-radius: calc(var(--radius) - 2px);
  transition: all 0.15s;
  white-space: nowrap;
}

.module-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.module-tab.active {
  background: var(--bg-active);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ── Kanban Board ──────────────────────────── */

.kanban-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
  flex: 1;
  min-height: 0;
}

.kanban-board::-webkit-scrollbar { height: 4px; }
.kanban-board::-webkit-scrollbar-thumb { background: var(--bg-active); border-radius: 2px; }

.kanban-column {
  min-width: 260px;
  max-width: 300px;
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.kanban-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.kanban-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: 10px;
}

.kanban-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kanban-body::-webkit-scrollbar { width: 3px; }
.kanban-body::-webkit-scrollbar-thumb { background: var(--bg-active); border-radius: 2px; }

.kanban-card {
  padding: 12px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s, box-shadow 0.15s;
  position: relative;
}

.kanban-card:hover {
  border-color: var(--accent-dim);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.kanban-card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.3;
}

.kanban-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Priority & Status Badges ──────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge-urgent { background: rgba(196, 26, 59, 0.15); color: #ff4d6a; }
.badge-high { background: rgba(255, 152, 0, 0.15); color: #ffa726; }
.badge-medium { background: rgba(255, 235, 59, 0.12); color: #c9a400; }
.badge-low { background: rgba(120, 120, 120, 0.15); color: #888; }

.badge-lead { background: rgba(66, 165, 245, 0.15); color: #42a5f5; }
.badge-prospect { background: rgba(255, 183, 77, 0.15); color: #ffb74d; }
.badge-active { background: rgba(76, 175, 80, 0.15); color: #66bb6a; }
.badge-churned { background: rgba(244, 67, 54, 0.15); color: #ef5350; }

.badge-won { background: rgba(76, 175, 80, 0.15); color: #66bb6a; }
.badge-lost { background: rgba(244, 67, 54, 0.12); color: #ef5350; }
.badge-paid { background: rgba(76, 175, 80, 0.15); color: #66bb6a; }
.badge-overdue { background: rgba(244, 67, 54, 0.15); color: #ef5350; }
.badge-draft { background: rgba(120, 120, 120, 0.12); color: #888; }
.badge-sent { background: rgba(66, 165, 245, 0.12); color: #42a5f5; }

/* ── Data Table ────────────────────────────── */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.data-table th:hover { color: var(--text-secondary); }

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background 0.1s;
}

.data-table tbody tr:hover {
  background: var(--bg-hover);
}

.data-table .td-muted {
  color: var(--text-muted);
  font-size: 12px;
}

.data-table .td-mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

/* ── File Tree ─────────────────────────────── */

.file-tree {
  font-size: 13px;
  font-family: var(--font-body);
  user-select: none;
}

.file-tree-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.1s;
  white-space: nowrap;
}

.file-tree-item:hover { background: var(--bg-hover); }
.file-tree-item.selected { background: var(--bg-active); color: var(--accent); }

.file-tree-icon {
  flex-shrink: 0;
  width: 16px;
  text-align: center;
  font-size: 12px;
}

.file-tree-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-tree-children {
  padding-left: 16px;
  border-left: 1px solid var(--border);
  margin-left: 11px;
}

/* ── Breadcrumb ────────────────────────────── */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.breadcrumb-item {
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: background 0.1s, color 0.1s;
}

.breadcrumb-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.breadcrumb-sep { color: var(--text-muted); opacity: 0.5; }

/* ── Bot Cards ─────────────────────────────── */

.bot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.bot-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: border-color 0.2s, box-shadow 0.2s;
  position: relative;
}

.bot-card:hover {
  border-color: var(--accent-dim);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.bot-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.bot-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.bot-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.bot-status-dot.online {
  background: var(--success);
  box-shadow: 0 0 6px rgba(46, 160, 67, 0.5);
  animation: pulse-dot 2s infinite;
}

.bot-status-dot.offline { background: var(--text-muted); }
.bot-status-dot.error { background: var(--danger); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.bot-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 12px;
}

.bot-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Service Health Indicators ─────────────── */

.service-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: background 0.1s;
}

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

.service-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.service-dot.online { background: var(--success); box-shadow: 0 0 4px rgba(46, 160, 67, 0.4); }
.service-dot.offline { background: var(--danger); }
.service-dot.degraded { background: var(--warning); }

.service-name {
  flex: 1;
  font-size: 13px;
  color: var(--text-primary);
}

.service-latency {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Quick Access Buttons ──────────────────── */

.quick-access {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.quick-access-btn {
  padding: 6px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.quick-access-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--accent-dim);
}

/* ── Offline / Empty States ────────────────── */

.module-offline {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 60%;
  text-align: center;
  gap: 16px;
}

.module-offline-icon {
  font-size: 48px;
  opacity: 0.15;
}

.module-offline-title {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--text-secondary);
}

.module-offline-desc {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 320px;
  line-height: 1.5;
}

.module-retry-btn {
  padding: 8px 24px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}

.module-retry-btn:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 16px rgba(196, 26, 59, 0.3);
}

/* ── RUBIX Home — Premium New Tab ─────────── */

.rubix-home {
  position: relative;
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 24px 32px;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Ambient red glow behind hero */
.rubix-home-glow {
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 500px;
  height: 300px;
  background: radial-gradient(ellipse, rgba(196, 26, 59, 0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.rubix-home-hero {
  position: relative;
  z-index: 1;
  text-align: center;
  margin-bottom: 32px;
}

.rubix-home-logo {
  width: 80px;
  height: auto;
  margin: 0 auto 16px;
  opacity: 0;
  animation: rubix-logo-enter 0.8s ease-out 0.1s forwards;
}

.rubix-home-logo img {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 0 20px rgba(196, 26, 59, 0.2));
}

@keyframes rubix-logo-enter {
  from { opacity: 0; transform: translateY(12px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.rubix-home-greeting {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  margin-bottom: 6px;
  opacity: 0;
  animation: rubix-fade-up 0.6s ease-out 0.25s forwards;
}

@keyframes rubix-fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.rubix-home-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  opacity: 0;
  animation: rubix-fade-up 0.5s ease-out 0.4s forwards;
}

.rubix-home-separator { opacity: 0.4; }

.rubix-home-time {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
}

/* Search Bar — premium glass style */
.rubix-search-container {
  position: relative;
  width: 100%;
  max-width: 640px;
  margin: 0 auto 36px;
  opacity: 0;
  animation: rubix-fade-up 0.5s ease-out 0.5s forwards;
  z-index: 1;
}

.rubix-search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  display: flex;
  pointer-events: none;
}

.rubix-search {
  width: 100%;
  height: 48px;
  padding: 0 80px 0 44px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(20, 20, 20, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}

.rubix-search::placeholder {
  color: var(--text-muted);
  transition: color 0.2s;
}

.rubix-search:focus {
  border-color: var(--accent);
  background: rgba(20, 20, 20, 0.95);
  box-shadow: 0 0 0 3px rgba(196, 26, 59, 0.12), 0 4px 24px rgba(196, 26, 59, 0.08), 0 0 60px rgba(196, 26, 59, 0.04);
}

.rubix-search:focus::placeholder { color: var(--text-secondary); }

.rubix-search-hint {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 3px;
  pointer-events: none;
  opacity: 0.4;
  transition: opacity 0.2s;
}

.rubix-search:focus ~ .rubix-search-hint { opacity: 0.2; }

.rubix-search-hint kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  line-height: 1.4;
}

/* Quick Links — refined grid */
.rubix-links {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 40px;
  flex-wrap: wrap;
  max-width: 640px;
  opacity: 0;
  animation: rubix-fade-up 0.5s ease-out 0.6s forwards;
  z-index: 1;
}

.rubix-link {
  width: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 4px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  color: inherit;
}

.rubix-link:hover {
  background: rgba(255, 255, 255, 0.04);
  transform: translateY(-2px);
}

.rubix-link:active { transform: translateY(0) scale(0.97); }

.rubix-link-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.rubix-link:hover .rubix-link-icon {
  border-color: var(--accent-dim);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.rubix-link-label {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  transition: color 0.2s;
}

.rubix-link:hover .rubix-link-label { color: var(--text-secondary); }

/* Dashboard section */
.rubix-dashboard {
  width: 100%;
  max-width: 640px;
  opacity: 0;
  animation: rubix-fade-up 0.5s ease-out 0.7s forwards;
  z-index: 1;
}

.rubix-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.rubix-stat {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.rubix-stat:hover {
  border-color: var(--accent-dim);
  box-shadow: 0 0 16px rgba(196, 26, 59, 0.06);
}

.rubix-stat::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.rubix-stat:hover::before { opacity: 0.5; }

.rubix-stat-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 4px;
}

.rubix-stat-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.rubix-stat.stat-accent .rubix-stat-value { color: var(--accent); }
.rubix-stat.stat-success .rubix-stat-value { color: var(--success); }

/* Health section */
.rubix-health {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.rubix-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.rubix-health-content {
  color: var(--text-muted);
  font-size: 13px;
}

.rubix-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 10px;
  margin-bottom: 10px;
}

.rubix-status-badge.online {
  background: rgba(76, 175, 80, 0.1);
  color: #66bb6a;
}

.rubix-status-badge.offline {
  background: rgba(120, 120, 120, 0.1);
  color: #888;
}

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

.rubix-status-badge.online .rubix-status-dot { background: #66bb6a; }
.rubix-status-badge.offline .rubix-status-dot { background: #888; }

.rubix-status-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.rubix-services-grid {
  margin-top: 8px;
}

/* Footer branding */
.rubix-home-footer {
  margin-top: auto;
  padding-top: 40px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  opacity: 0.2;
  transition: opacity 0.3s;
  z-index: 1;
}

.rubix-home-footer:hover { opacity: 0.4; }

.rubix-footer-brand {
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-primary);
}

.rubix-footer-sep { color: var(--text-muted); }

.rubix-footer-nine {
  font-family: var(--font-display);
  color: var(--accent);
  letter-spacing: 0.02em;
}

/* ── Toggle Switch ─────────────────────────── */

.toggle-switch {
  width: 36px;
  height: 20px;
  background: var(--bg-active);
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  transition: background 0.2s;
  border: none;
  flex-shrink: 0;
}

.toggle-switch.on { background: var(--accent); }

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-switch.on::after { transform: translateX(16px); }

/* ── Code Preview ──────────────────────────── */

.code-preview {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
}

.code-preview pre {
  margin: 0;
  padding: 16px;
  color: var(--text-secondary);
  white-space: pre;
  tab-size: 2;
}

.code-line-numbers {
  padding: 16px 12px;
  text-align: right;
  color: var(--text-muted);
  user-select: none;
  border-right: 1px solid var(--border);
  font-size: 11px;
  line-height: 1.6;
  min-width: 40px;
}

/* ── Utility ───────────────────────────────── */

.fade-in {
  animation: fadeIn 0.3s ease forwards;
}

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

.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }

/* ── Global Selection Color ────────────────── */

::selection {
  background: rgba(196, 26, 59, 0.3);
  color: var(--text-primary);
}

/* ── Keyboard Shortcuts Overlay ──────────── */

#shortcuts-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: shortcutsFadeIn 0.2s ease forwards;
}

#shortcuts-overlay.hidden {
  display: none !important;
}

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

#shortcuts-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 500px;
  width: 90%;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  animation: shortcutsSlideIn 0.2s ease forwards;
}

@keyframes shortcutsSlideIn {
  from { opacity: 0; transform: scale(0.95) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

#shortcuts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--text-primary);
  flex-shrink: 0;
}

#shortcuts-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
}

#shortcuts-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

#shortcuts-list {
  overflow-y: auto;
  padding: 12px 20px;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.shortcut-row:last-child {
  border-bottom: none;
}

.shortcut-keys {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.shortcut-keys kbd {
  display: inline-block;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-primary);
  line-height: 1.4;
  white-space: nowrap;
}

.shortcut-action {
  color: var(--text-secondary);
  font-size: 13px;
  text-align: right;
  margin-left: 16px;
}

/* ============================================
   MODULE STYLES — Extracted from inline JS
   ============================================ */

/* -- CRM Module Styles -- */

.crm-root {
  padding: 24px 28px;
  height: 100%;
  overflow-y: auto;
  font-family: var(--font-body);
  color: var(--text-primary);
}

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

.crm-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.crm-title span {
  color: var(--accent);
}

.crm-status {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.crm-status-dot.online { background: var(--success); }
.crm-status-dot.offline { background: var(--danger); }

/* ── CRM Tabs ── */
.crm-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.crm-tab {
  padding: 8px 20px;
  font-size: 13px;
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.crm-tab:hover {
  color: var(--text-primary);
}

.crm-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.crm-tab .tab-count {
  font-size: 11px;
  font-family: var(--font-mono);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 6px;
}

/* ── CRM Stats ── */
.crm-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.crm-stat {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.crm-stat-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.crm-stat-value {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.crm-stat-value.accent {
  color: var(--accent);
}

.crm-stat-value.success {
  color: var(--success);
}

/* ── CRM Table ── */
.crm-table-wrap {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.crm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.crm-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.crm-table th:hover {
  color: var(--text-primary);
}

.crm-table th .sort-arrow {
  margin-left: 4px;
  font-size: 10px;
  opacity: 0.4;
}

.crm-table th .sort-arrow.active {
  opacity: 1;
  color: var(--accent);
}

.crm-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

.crm-table tr:last-child td {
  border-bottom: none;
}

.crm-table tr:hover td {
  background: var(--bg-hover);
}

.crm-table .client-name {
  font-weight: 500;
}

.crm-table .client-email {
  color: var(--text-secondary);
  font-size: 12px;
  font-family: var(--font-mono);
}

.crm-table .client-company {
  color: var(--text-secondary);
}

/* ── CRM Status Badge ── */
.crm-root .status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ── CRM Kanban ── */
.crm-kanban {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  min-height: 300px;
}

.crm-kanban .kanban-column {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-height: 200px;
}

.crm-kanban .kanban-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.crm-kanban .kanban-stage {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.crm-kanban .kanban-count {
  font-size: 11px;
  font-family: var(--font-mono);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  padding: 1px 7px;
  border-radius: 8px;
}

.crm-kanban .kanban-cards {
  padding: 8px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.crm-kanban .kanban-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: grab;
  transition: border-color 0.15s, transform 0.1s;
}

.crm-kanban .kanban-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.crm-kanban .kanban-card:active {
  cursor: grabbing;
  transform: scale(0.98);
}

.crm-kanban .kanban-card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.3;
}

.crm-kanban .kanban-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
}

.kanban-card-client {
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60%;
}

.kanban-card-value {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
}

/* ── CRM Invoices Table ── */
.invoice-amount {
  font-family: var(--font-mono);
  font-weight: 500;
}

.invoice-due {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

/* ── CRM States ── */
.crm-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 60%;
  gap: 12px;
  color: var(--text-secondary);
}

.crm-loading .spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: crm-spin 0.7s linear infinite;
}

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

.crm-offline {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 60%;
  gap: 14px;
  color: var(--text-secondary);
}

.crm-offline-icon {
  font-size: 36px;
  opacity: 0.3;
}

.crm-offline p {
  font-size: 14px;
  text-align: center;
  max-width: 320px;
  line-height: 1.5;
}

.crm-retry-btn {
  margin-top: 4px;
  padding: 8px 20px;
  font-size: 13px;
  font-family: var(--font-body);
  font-weight: 500;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.crm-retry-btn:hover {
  background: var(--accent-hover, #d92045);
}

/* ── CRM Empty ── */
.crm-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ── CRM Panel Section ── */
.crm-panel {
  display: none;
}

.crm-panel.active {
  display: block;
}

/* ── CRM Search ── */
.crm-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.crm-search input {
  flex: 1;
  padding: 7px 12px;
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s;
}

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

.crm-search input::placeholder {
  color: var(--text-muted);
}

/* -- Tasks Module Styles -- */

.tasks-page {
  padding: 24px;
  height: 100%;
  overflow-y: auto;
  font-family: var(--font-body);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Tasks Header ── */
.tasks-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.tasks-header h1 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.tasks-header h1 span {
  color: var(--accent);
}

/* ── Tasks Project Filter ── */
.project-filter {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.project-tab {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 12px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.project-tab:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.project-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ── Tasks Stats Row ── */
.stats-row {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}
.tasks-page .stat-card {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tasks-page .stat-value {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-mono);
}
.tasks-page .stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Tasks Kanban Board ── */
.tasks-page .kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.tasks-page .kanban-column {
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 0;
  overflow: hidden;
}
.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.kanban-column-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}
.kanban-column-count {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted, #555);
  background: var(--bg-tertiary);
  padding: 2px 7px;
  border-radius: 10px;
}
.kanban-column-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kanban-column-body::-webkit-scrollbar {
  width: 4px;
}
.kanban-column-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* ── Tasks Task Card ── */
.task-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s ease, background 0.15s ease;
  cursor: default;
}
.task-card:hover {
  border-color: #333;
  background: var(--bg-hover);
}
.task-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.task-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.35;
  flex: 1;
}
.priority-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  color: #fff;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.3px;
}
.task-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.task-meta-item {
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 3px;
}
.task-meta-project {
  background: var(--bg-primary);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  color: var(--text-secondary);
}
.task-due-soon {
  color: var(--warning) !important;
}
.task-overdue {
  color: var(--danger) !important;
}

/* ── Tasks Status Pill (clickable) ── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-secondary);
  transition: all 0.15s ease;
  white-space: nowrap;
}
.status-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.status-pill .arrow {
  font-size: 8px;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.status-pill:hover .arrow {
  opacity: 1;
}
.status-pill.transitioning {
  opacity: 0.5;
  pointer-events: none;
}

/* ── Tasks Column accent lines ── */
.kanban-column[data-status="TODO"] .kanban-column-header {
  border-top: 2px solid var(--text-secondary);
}
.kanban-column[data-status="IN_PROGRESS"] .kanban-column-header {
  border-top: 2px solid #3b82f6;
}
.kanban-column[data-status="REVIEW"] .kanban-column-header {
  border-top: 2px solid var(--warning);
}
.kanban-column[data-status="DONE"] .kanban-column-header {
  border-top: 2px solid var(--success);
}

/* ── Tasks Loading / Offline states ── */
.tasks-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 16px;
  color: var(--text-secondary);
  font-size: 14px;
}
.tasks-state-icon {
  font-size: 36px;
  opacity: 0.4;
}
.tasks-state-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
}
.tasks-retry-btn {
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.15s ease;
}
.tasks-retry-btn:hover {
  background: var(--accent);
  color: #fff;
}
.tasks-page .spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: tasks-spin 0.8s linear infinite;
}
@keyframes tasks-spin {
  to { transform: rotate(360deg); }
}

/* ── Tasks Empty column ── */
.kanban-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 60px;
  color: var(--text-muted, #555);
  font-size: 12px;
  font-style: italic;
}

/* -- Files Module Styles -- */

.rubix-files {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-primary, #0a0a0a);
  color: var(--text-primary, #e4e4e7);
  font-family: var(--font-body, 'DM Sans', sans-serif);
  font-size: 13px;
  overflow: hidden;
}
.rf-toolbar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 14px;
  background: var(--bg-secondary, #141414);
  border-bottom: 1px solid var(--border, #2a2a2a);
  flex-shrink: 0;
}
.rf-breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  min-height: 22px;
}
.rf-breadcrumb-seg {
  background: none;
  border: none;
  color: var(--text-secondary, #a1a1aa);
  font-family: var(--font-body, 'DM Sans', sans-serif);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: var(--radius-sm, 4px);
  transition: background 0.15s, color 0.15s;
}
.rf-breadcrumb-seg:hover {
  background: var(--bg-hover, #252525);
  color: var(--text-primary, #e4e4e7);
}
.rf-breadcrumb-seg.active {
  color: var(--accent, #C41A3B);
  font-weight: 600;
}
.rf-breadcrumb-sep {
  color: var(--text-secondary, #a1a1aa);
  font-size: 10px;
  user-select: none;
}
.rf-path-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.rf-path-input {
  flex: 1;
  background: var(--bg-tertiary, #1e1e1e);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: var(--radius-sm, 4px);
  color: var(--text-primary, #e4e4e7);
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 12px;
  padding: 5px 10px;
  outline: none;
  transition: border-color 0.15s;
}
.rf-path-input:focus {
  border-color: var(--accent, #C41A3B);
}
.rf-quick-btns {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.rf-quick-btn {
  background: var(--bg-tertiary, #1e1e1e);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: var(--radius-sm, 4px);
  color: var(--text-secondary, #a1a1aa);
  font-family: var(--font-body, 'DM Sans', sans-serif);
  font-size: 11px;
  padding: 4px 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.rf-quick-btn:hover {
  background: var(--bg-hover, #252525);
  color: var(--text-primary, #e4e4e7);
  border-color: var(--accent, #C41A3B);
}
.rf-main {
  display: flex;
  flex: 1;
  overflow: hidden;
}
.rf-tree {
  width: 250px;
  min-width: 200px;
  max-width: 400px;
  background: var(--bg-secondary, #141414);
  border-right: 1px solid var(--border, #2a2a2a);
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
}
.rf-tree::-webkit-scrollbar { width: 6px; }
.rf-tree::-webkit-scrollbar-track { background: transparent; }
.rf-tree::-webkit-scrollbar-thumb {
  background: var(--border, #2a2a2a);
  border-radius: 3px;
}
.rf-tree-node {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: var(--radius-sm, 4px);
  margin: 1px 4px;
  transition: background 0.12s;
  user-select: none;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rf-tree-node:hover {
  background: var(--bg-hover, #252525);
}
.rf-tree-node.selected {
  background: rgba(196, 26, 59, 0.15);
  color: var(--accent, #C41A3B);
}
.rf-tree-chevron {
  width: 14px;
  font-size: 10px;
  text-align: center;
  flex-shrink: 0;
  color: var(--text-secondary, #a1a1aa);
  transition: transform 0.15s;
}
.rf-tree-chevron.open {
  transform: rotate(90deg);
}
.rf-tree-icon {
  flex-shrink: 0;
  font-size: 14px;
  width: 18px;
  text-align: center;
}
.rf-tree-label {
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12.5px;
}
.rf-tree-children {
  padding-left: 16px;
}
.rf-tree-children.collapsed {
  display: none;
}
.rf-tree-loading {
  color: var(--text-secondary, #a1a1aa);
  font-size: 11px;
  padding: 4px 8px 4px 38px;
  font-style: italic;
}
.rf-preview {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-primary, #0a0a0a);
}
.rf-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--bg-secondary, #141414);
  border-bottom: 1px solid var(--border, #2a2a2a);
  flex-shrink: 0;
}
.rf-preview-path {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 11.5px;
  color: var(--text-secondary, #a1a1aa);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rf-preview-size {
  font-size: 11px;
  color: var(--text-secondary, #a1a1aa);
  flex-shrink: 0;
  margin-left: 12px;
}
.rf-preview-content {
  flex: 1;
  overflow: auto;
  padding: 0;
}
.rf-preview-content::-webkit-scrollbar { width: 8px; height: 8px; }
.rf-preview-content::-webkit-scrollbar-track { background: transparent; }
.rf-preview-content::-webkit-scrollbar-thumb {
  background: var(--border, #2a2a2a);
  border-radius: 4px;
}
.rf-code-table {
  border-collapse: collapse;
  width: 100%;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 12px;
  line-height: 1.6;
}
.rf-code-table td {
  padding: 0 12px;
  white-space: pre;
  vertical-align: top;
}
.rf-line-num {
  color: var(--text-secondary, #a1a1aa);
  opacity: 0.4;
  text-align: right;
  user-select: none;
  width: 1%;
  padding-right: 16px;
  border-right: 1px solid var(--border, #2a2a2a);
}
.rf-line-content {
  color: var(--text-primary, #e4e4e7);
  padding-left: 16px;
}
.rf-preview-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: var(--text-secondary, #a1a1aa);
  font-size: 14px;
  flex-direction: column;
  gap: 8px;
}
.rf-preview-empty-icon {
  font-size: 40px;
  opacity: 0.3;
}
.rf-git-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 6px 14px;
  background: var(--bg-secondary, #141414);
  border-top: 1px solid var(--border, #2a2a2a);
  font-size: 11.5px;
  color: var(--text-secondary, #a1a1aa);
  flex-shrink: 0;
}
.rf-git-branch {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--accent, #C41A3B);
  font-weight: 600;
}
.rf-git-stat {
  display: flex;
  align-items: center;
  gap: 3px;
}
.rf-git-staged { color: #4ade80; }
.rf-git-unstaged { color: #facc15; }
.rf-git-untracked { color: #a1a1aa; }
.rf-state {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  flex-direction: column;
  gap: 14px;
  color: var(--text-secondary, #a1a1aa);
}
.rf-state-icon {
  font-size: 48px;
  opacity: 0.3;
}
.rf-state-msg {
  font-size: 15px;
}
.rf-state-sub {
  font-size: 12px;
  opacity: 0.6;
}
.rf-retry-btn {
  background: var(--accent, #C41A3B);
  color: #fff;
  border: none;
  border-radius: var(--radius, 8px);
  padding: 8px 20px;
  font-family: var(--font-body, 'DM Sans', sans-serif);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.rf-retry-btn:hover { opacity: 0.85; }
.rf-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border, #2a2a2a);
  border-top-color: var(--accent, #C41A3B);
  border-radius: 50%;
  animation: rf-spin 0.7s linear infinite;
}
@keyframes rf-spin {
  to { transform: rotate(360deg); }
}
.rf-resize-handle {
  width: 4px;
  cursor: col-resize;
  background: transparent;
  flex-shrink: 0;
  transition: background 0.15s;
}
.rf-resize-handle:hover,
.rf-resize-handle.active {
  background: var(--accent, #C41A3B);
}

/* -- Bots Module Styles -- */

.bots-page {
  padding: 32px;
  max-width: 1200px;
  margin: 0 auto;
  font-family: var(--font-body, 'DM Sans', sans-serif);
  color: var(--text-primary, #e0e0e0);
  height: 100%;
  overflow-y: auto;
}
.bots-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}
.bots-title {
  font-family: var(--font-display, 'Instrument Serif', serif);
  font-size: 28px;
  font-weight: 400;
  color: var(--text-primary, #e0e0e0);
}
.bots-title-accent { color: var(--accent, #C41A3B); }
.bots-subtitle {
  font-size: 13px;
  color: var(--text-secondary, #999);
  margin-top: 4px;
}
.bots-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius, 8px);
  background: var(--bg-secondary, #141414);
  border: 1px solid var(--border, #222);
  font-size: 12px;
  color: var(--text-secondary, #999);
}
.bots-header-badge .dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}
.bots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}
.bot-card {
  background: var(--bg-secondary, #141414);
  border: 1px solid var(--border, #222);
  border-radius: var(--radius, 8px);
  padding: 20px;
  transition: border-color 0.15s, background 0.15s;
}
.bot-card:hover {
  border-color: var(--accent, #C41A3B);
  background: var(--bg-tertiary, #1e1e1e);
}
.bot-card-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.bot-status-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.bot-card-name {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 15px; font-weight: 500;
  color: var(--text-primary, #e0e0e0);
}
.bot-card-desc {
  font-size: 13px; color: var(--text-secondary, #999);
  line-height: 1.5; margin-bottom: 16px; min-height: 40px;
}
.bot-card-meta {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
  margin-bottom: 16px; padding-top: 12px;
  border-top: 1px solid var(--border, #222);
}
.bot-meta-item { display: flex; flex-direction: column; gap: 2px; }
.bot-meta-label {
  font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-muted, #555);
}
.bot-meta-value {
  font-size: 12px;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  color: var(--text-secondary, #999);
}
.bot-toggle-btn {
  width: 100%; padding: 8px 0;
  border: 1px solid var(--border, #222);
  border-radius: var(--radius-sm, 4px);
  background: var(--bg-tertiary, #1e1e1e);
  color: var(--text-primary, #e0e0e0);
  font-family: var(--font-body, 'DM Sans', sans-serif);
  font-size: 13px; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.bot-toggle-btn:hover { background: var(--bg-hover, #2a2a2a); }
.bot-btn-run {
  border-color: var(--success, #2ea043);
  color: var(--success, #2ea043);
}
.bot-btn-run:hover { background: rgba(46, 160, 67, 0.1); }
.bot-btn-stop {
  border-color: var(--danger, #c42b1c);
  color: var(--danger, #c42b1c);
}
.bot-btn-stop:hover { background: rgba(196, 43, 28, 0.1); }
.bots-section-title {
  font-family: var(--font-display, 'Instrument Serif', serif);
  font-size: 20px; font-weight: 400;
  color: var(--text-primary, #e0e0e0);
  margin-bottom: 16px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border, #222);
}
.agent-runs-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.agent-runs-table th {
  text-align: left; padding: 10px 12px;
  font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-muted, #555);
  border-bottom: 1px solid var(--border, #222);
  font-weight: 500;
}
.agent-runs-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  color: var(--text-secondary, #999);
  vertical-align: top;
}
.agent-runs-table tbody tr:hover { background: var(--bg-tertiary, #1e1e1e); }
.ar-type {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  color: var(--text-primary, #e0e0e0); font-weight: 500;
}
.ar-status-badge { font-weight: 500; }
.ar-duration, .ar-date {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 12px; white-space: nowrap;
}
.ar-input, .ar-output {
  max-width: 200px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.bots-empty-state {
  text-align: center; padding: 32px;
  color: var(--text-muted, #555); font-size: 13px;
}
.bots-loading {
  display: flex; align-items: center; justify-content: center;
  padding: 40px; color: var(--text-muted, #555); font-size: 13px;
}
.bots-loading::after {
  content: ''; width: 16px; height: 16px;
  border: 2px solid var(--border, #222);
  border-top-color: var(--accent, #C41A3B);
  border-radius: 50%; margin-left: 10px;
  animation: botsSpin 0.6s linear infinite;
}
@keyframes botsSpin { to { transform: rotate(360deg); } }

/* ── Google AI Hub ── */
.rubix-google-ai { padding: 24px 32px; max-width: 1200px; margin: 0 auto; overflow-y: auto; height: 100%; }
.gai-header { margin-bottom: 24px; }
.gai-title { font-family: var(--font-display, 'Instrument Serif', serif); font-size: 28px; color: var(--text-primary, #fff); margin: 0 0 4px; }
.gai-subtitle { font-size: 13px; color: var(--text-muted, #888); margin: 0 0 16px; }
.gai-search-wrap { max-width: 360px; }
.gai-search {
  width: 100%; padding: 8px 14px; font-size: 13px;
  background: var(--bg-tertiary, #1e1e1e); border: 1px solid var(--border, #333);
  border-radius: 8px; color: var(--text-primary, #fff); outline: none;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
}
.gai-search:focus { border-color: var(--accent, #C41A3B); }
.gai-search::placeholder { color: var(--text-muted, #666); }
.gai-grid { display: flex; flex-direction: column; gap: 20px; }
.gai-section { }
.gai-cat-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--text-muted, #888); margin-bottom: 8px; padding-left: 2px;
}
.gai-tools-row {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px;
}
.gai-tool-btn {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--bg-secondary, #141414); border: 1px solid var(--border, #222);
  border-radius: 10px; cursor: pointer; text-align: left;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.15s;
  width: 100%;
}
.gai-tool-btn:hover { background: var(--bg-tertiary, #1e1e1e); }
.gai-tool-icon {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; min-width: 34px;
  border-radius: 8px; font-size: 16px;
}
.gai-tool-text { display: flex; flex-direction: column; gap: 1px; overflow: hidden; }
.gai-tool-name { font-size: 13px; font-weight: 500; color: var(--text-primary, #fff); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gai-tool-desc { font-size: 11px; color: var(--text-muted, #888); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
