/* ==========================================================================
   AgentChat — Material You Expressive (M3 Expressive) Design System
   Organic Tonal Palette • Tactile Geometry • Asymmetric Elevations
   ========================================================================== */

:root {
  /* --- M3 Expressive Tonal Color Roles (Dark Terracotta & Warm Slate) --- */
  --md-sys-color-primary: #FF8A65;
  --md-sys-color-on-primary: #4E1606;
  --md-sys-color-primary-container: #3B1408;
  --md-sys-color-on-primary-container: #FFDBCF;

  --md-sys-color-secondary: #97AFA0;
  --md-sys-color-on-secondary: #132A1C;
  --md-sys-color-secondary-container: #263C2E;
  --md-sys-color-on-secondary-container: #D3EBD9;

  --md-sys-color-tertiary: #F5B942;
  --md-sys-color-on-tertiary: #422C00;
  --md-sys-color-tertiary-container: #4D3500;
  --md-sys-color-on-tertiary-container: #FFE08F;

  --md-sys-color-error: #FFB4AB;
  --md-sys-color-error-container: #4A0005;
  --md-sys-color-on-error-container: #FFDAD6;

  /* --- M3 Surface & Container Hierarchy --- */
  --md-sys-color-surface: #141211;
  --md-sys-color-surface-dim: #0F0E0D;
  --md-sys-color-surface-bright: #292624;
  --md-sys-color-surface-container-lowest: #0C0A09;
  --md-sys-color-surface-container-low: #1B1817;
  --md-sys-color-surface-container: #221F1D;
  --md-sys-color-surface-container-high: #2C2826;
  --md-sys-color-surface-container-highest: #373230;

  /* --- Text & Outlines --- */
  --md-sys-color-on-surface: #F5EAE6;
  --md-sys-color-on-surface-variant: #D4C0BA;
  --md-sys-color-outline: #6E5F5A;
  --md-sys-color-outline-variant: #453A36;

  /* --- Semantic Status --- */
  --status-online: #7BE09B;
  --status-exhausted: #FF8A80;
  --status-checking: #F5B942;

  /* --- Expressive Shape Tokens --- */
  --shape-corner-xs: 4px;
  --shape-corner-sm: 8px;
  --shape-corner-md: 12px;
  --shape-corner-lg: 16px;
  --shape-corner-xl: 20px;
  --shape-corner-xxl: 28px;
  --shape-corner-full: 9999px;

  /* --- Typography --- */
  --font-brand: 'Rubik', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Cascadia Code', Consolas, monospace;
}

/* ==================== Base Reset & Global Styles ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-brand);
  background-color: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background-color: var(--md-sys-color-surface);
}

/* ==================== 1. Material You Navigation Rail ==================== */
.nav-rail {
  width: 72px;
  background-color: var(--md-sys-color-surface-container-low);
  border-right: 1px solid var(--md-sys-color-outline-variant);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  flex-shrink: 0;
  z-index: 40;
}

.rail-top, .rail-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.rail-brand {
  margin-bottom: 8px;
}

.rail-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--shape-corner-md);
  border: 1px solid var(--md-sys-color-outline-variant);
  transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1);
}

.rail-logo:hover {
  transform: scale(1.05);
}

.rail-btn {
  width: 60px;
  background: transparent;
  border: none;
  color: var(--md-sys-color-on-surface-variant);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 4px 0;
  transition: color 0.15s ease;
}

.rail-icon-wrapper {
  width: 54px;
  height: 32px;
  border-radius: var(--shape-corner-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s cubic-bezier(0.2, 0, 0, 1), transform 0.15s ease;
}

.rail-btn:hover .rail-icon-wrapper {
  background-color: var(--md-sys-color-surface-container-high);
}

.rail-btn.active .rail-icon-wrapper {
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-primary);
}

.rail-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2px;
  color: var(--md-sys-color-on-surface-variant);
}

.rail-btn.active .rail-label {
  color: var(--md-sys-color-primary);
  font-weight: 600;
}

.rail-status-pill {
  width: 28px;
  height: 28px;
  border-radius: var(--shape-corner-full);
  background-color: var(--md-sys-color-surface-container);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--md-sys-color-outline-variant);
}

.rail-status {
  width: 8px;
  height: 8px;
  border-radius: var(--shape-corner-full);
  background-color: var(--status-online);
}

/* ==================== 2. Contextual Sub-Sidebar ==================== */
.sub-sidebar {
  width: 270px;
  background-color: var(--md-sys-color-surface-container-low);
  border-right: 1px solid var(--md-sys-color-outline-variant);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.25s cubic-bezier(0.2, 0, 0, 1), margin-left 0.25s cubic-bezier(0.2, 0, 0, 1);
  overflow: hidden;
  z-index: 20;
}

.sub-sidebar.collapsed {
  width: 0;
  margin-left: -1px;
  border-right: none;
}

.sidebar-pane {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 16px;
  overflow: hidden;
}

.sidebar-pane.hidden {
  display: none;
}

.pane-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.pane-header h2 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: var(--md-sys-color-on-surface);
}

/* Search Box */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  background-color: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--shape-corner-xl);
  padding: 8px 12px;
  margin-bottom: 14px;
  gap: 8px;
}

.search-box svg {
  color: var(--md-sys-color-on-surface-variant);
  flex-shrink: 0;
}

.search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--md-sys-color-on-surface);
  font-family: var(--font-brand);
  font-size: 13px;
  width: 100%;
}

.search-box input::placeholder {
  color: var(--md-sys-color-outline);
}

/* Conversation List */
.conversation-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
}

.chat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--shape-corner-lg);
  background-color: transparent;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  border: 1px solid transparent;
}

.chat-item:hover {
  background-color: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface);
}

.chat-item.active {
  background-color: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-primary);
  border-color: var(--md-sys-color-outline-variant);
  font-weight: 500;
}

.chat-item-title {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.chat-item-del {
  opacity: 0;
  background: transparent;
  border: none;
  color: var(--md-sys-color-outline);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--shape-corner-xs);
  font-size: 14px;
  transition: opacity 0.15s, color 0.15s;
}

.chat-item:hover .chat-item-del {
  opacity: 1;
}

.chat-item-del:hover {
  color: var(--md-sys-color-error);
}

/* Models Mini List & Quick Pills */
.quick-filter-pills {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.pill-btn {
  background-color: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface-variant);
  padding: 5px 10px;
  border-radius: var(--shape-corner-sm);
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font-brand);
  transition: all 0.15s ease;
}

.pill-btn:hover {
  background-color: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
}

.pill-btn.active {
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-primary);
  border-color: var(--md-sys-color-primary);
  font-weight: 600;
}

.models-mini-list, .mcp-servers-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.models-mini-card {
  padding: 10px 12px;
  border-radius: var(--shape-corner-lg);
  background-color: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.models-mini-card:hover {
  background-color: var(--md-sys-color-surface-container-high);
  border-color: var(--md-sys-color-outline);
}

.models-mini-card.active-model {
  border-color: var(--md-sys-color-primary);
  background-color: var(--md-sys-color-surface-container-high);
}

.mini-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.mini-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
}

.mini-card-provider {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background-color: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface-variant);
  padding: 2px 6px;
  border-radius: var(--shape-corner-xs);
  font-family: var(--font-mono);
}

.mini-card-desc {
  font-size: 11px;
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 6px;
  line-height: 1.4;
}

.mini-card-stats {
  display: flex;
  gap: 8px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--md-sys-color-tertiary);
}

/* MCP Server Cards */
.mcp-server-card {
  padding: 12px;
  border-radius: var(--shape-corner-lg);
  background-color: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mcp-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mcp-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
}

.mcp-desc {
  font-size: 11px;
  color: var(--md-sys-color-on-surface-variant);
  line-height: 1.4;
}

.mcp-cmd {
  font-family: var(--font-mono);
  font-size: 10px;
  background-color: var(--md-sys-color-surface-container-lowest);
  padding: 4px 6px;
  border-radius: var(--shape-corner-xs);
  color: var(--md-sys-color-secondary);
  overflow-x: auto;
}

/* Toggle Switch (Material 3 Switch) */
.mcp-toggle-switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
}

.mcp-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--md-sys-color-surface-container-highest);
  border: 1px solid var(--md-sys-color-outline-variant);
  transition: 0.2s cubic-bezier(0.2, 0, 0, 1);
  border-radius: 22px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: var(--md-sys-color-on-surface-variant);
  transition: 0.2s cubic-bezier(0.2, 0, 0, 1);
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--md-sys-color-primary);
  border-color: var(--md-sys-color-primary);
}

input:checked + .slider:before {
  transform: translateX(16px);
  background-color: var(--md-sys-color-on-primary);
}

/* ==================== 3. Main Viewport & Top App Bar ==================== */
.main-viewport {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: var(--md-sys-color-surface);
  position: relative;
  overflow: hidden;
}

.chat-topbar {
  height: 58px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  background-color: var(--md-sys-color-surface-container-low);
  flex-shrink: 0;
  z-index: 10;
}

.topbar-left-group, .topbar-right-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-toggle-btn {
  background: transparent;
  border: none;
  color: var(--md-sys-color-on-surface-variant);
  width: 36px;
  height: 36px;
  border-radius: var(--shape-corner-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.icon-toggle-btn:hover {
  background-color: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
}

/* M3 Filter & Assist Chips (Select Pills) */
.select-pill-wrapper {
  position: relative;
}

.select-pill {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--shape-corner-md);
  padding: 6px 28px 6px 12px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-brand);
  color: var(--md-sys-color-on-surface);
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23A89F9A%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpolyline%20points%3D%226%209%2012%2015%2018%209%22%3E%3C%2Fpolyline%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.select-pill:hover {
  background-color: var(--md-sys-color-surface-container-high);
  border-color: var(--md-sys-color-outline);
}

.select-pill:focus {
  outline: 2px solid var(--md-sys-color-primary);
  border-color: transparent;
}

.model-pill {
  font-weight: 600;
  color: #ffb4a2 !important;
  background-color: #2b1710 !important;
  border: 1px solid #6b3425 !important;
  min-width: 190px;
}

.model-pill option,
.model-pill optgroup {
  background-color: #1e222b !important;
  color: #f0f6fc !important;
  font-weight: 500;
}

.tools-status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--md-sys-color-secondary);
  background-color: var(--md-sys-color-secondary-container);
  padding: 5px 10px;
  border-radius: var(--shape-corner-md);
  border: 1px solid rgba(146, 167, 150, 0.3);
}

.tools-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--md-sys-color-secondary);
}

.token-badge {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--md-sys-color-tertiary);
  background-color: var(--md-sys-color-tertiary-container);
  padding: 5px 9px;
  border-radius: var(--shape-corner-md);
  border: 1px solid rgba(245, 185, 66, 0.3);
}

/* ==================== 4. Messages Viewport & Workbench Hub ==================== */
.messages-viewport {
  flex: 1;
  overflow-y: auto;
  padding: 24px 24px 140px 24px;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Workbench Empty State (Real product workbench, zero marketing fluff) */
.welcome-screen {
  max-width: 820px;
  width: 100%;
  margin: 20px auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.workbench-status-card {
  background-color: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--shape-corner-xxl);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.workbench-top-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.status-chip-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-live-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--status-online);
  background-color: rgba(123, 224, 155, 0.12);
  padding: 4px 10px;
  border-radius: var(--shape-corner-full);
}

.live-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--status-online);
}

.status-route-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--md-sys-color-on-surface-variant);
  background-color: var(--md-sys-color-surface-container-high);
  padding: 4px 8px;
  border-radius: var(--shape-corner-sm);
}

.workbench-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--md-sys-color-on-surface);
}

.workbench-desc {
  font-size: 14px;
  color: var(--md-sys-color-on-surface-variant);
  line-height: 1.6;
}

.refill-schedule-board {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--md-sys-color-surface-container-high);
  padding: 10px 14px;
  border-radius: var(--shape-corner-lg);
  flex-wrap: wrap;
  font-size: 12px;
}

.schedule-lead {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--md-sys-color-tertiary);
}

.schedule-slots {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.slot-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  background-color: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface);
  padding: 3px 8px;
  border-radius: var(--shape-corner-xs);
}

/* Asymmetric Action Tiles */
.asymmetric-workbench-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.workbench-tile {
  background-color: var(--md-sys-color-surface-container-low);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--shape-corner-xl);
  padding: 16px 18px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.workbench-tile:hover {
  background-color: var(--md-sys-color-surface-container);
  border-color: var(--md-sys-color-outline);
  transform: translateY(-2px);
}

.workbench-tile.primary-tile {
  background-color: var(--md-sys-color-surface-container);
  border-color: var(--md-sys-color-outline);
}

.workbench-tile.primary-tile:hover {
  background-color: var(--md-sys-color-surface-container-high);
  border-color: var(--md-sys-color-primary);
}

.tile-tag {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 700;
  color: var(--md-sys-color-primary);
}

.tile-title {
  font-size: 13px;
  color: var(--md-sys-color-on-surface);
  line-height: 1.5;
  font-weight: 500;
}

.tile-action-prompt {
  font-size: 11px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface-variant);
}

.workbench-tile:hover .tile-action-prompt {
  color: var(--md-sys-color-primary);
}

/* ==================== 5. Chat Messages Stream (Expressive Asymmetry & Animated Pills) ==================== */
.messages-list {
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px 16px 140px 16px;
}

/* Row containers to cleanly segregate alignment */
.message-row {
  display: flex;
  width: 100%;
}

.message-row.user-row,
.message-row.user {
  justify-content: flex-end;
}

.message-row.assistant-row,
.message-row.assistant {
  justify-content: flex-start;
}

/* Base message bubble: vertical column stacking */
.message-bubble {
  display: flex;
  flex-direction: column; /* Stacks reasoning strictly ABOVE output */
  position: relative;
  line-height: 1.65;
  font-size: 14.5px;
  word-break: break-word;
}

/* User Pill (Right-Aligned, Warm Terracotta, Animated Entrance) */
.user-bubble,
.message-row.user .message-bubble,
.message-row.user-row .message-bubble {
  align-self: flex-end;
  max-width: 80%;
  background: linear-gradient(145deg, #4A1B0B 0%, #2D1006 100%);
  color: var(--md-sys-color-on-primary-container);
  padding: 14px 20px;
  border-radius: 22px 22px 4px 22px;
  border: 1px solid rgba(255, 138, 101, 0.38);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35), 0 0 1px rgba(255, 138, 101, 0.3);
  animation: pillSlideUpUser 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.user-bubble .message-text,
.message-row.user .message-text,
.message-row.user-row .message-text {
  color: #FFE6DE;
  font-weight: 450;
  font-size: 14.5px;
}

/* Assistant Bubble (Left-Aligned, Elevated Surface Container, Animated Entrance) */
.assistant-bubble,
.message-row.assistant .message-bubble,
.message-row.assistant-row .message-bubble {
  align-self: flex-start;
  width: 100%;
  max-width: 100%;
  background-color: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface);
  padding: 20px 24px;
  border-radius: 22px 22px 22px 4px;
  border: 1px solid var(--md-sys-color-outline-variant);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  animation: pillSlideUpAssistant 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.assistant-bubble.error-bubble,
.message-row.assistant .message-bubble.error-bubble,
.message-row.assistant-row .message-bubble.error-bubble {
  background-color: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
  border-color: var(--md-sys-color-error);
}

/* Pill Entrance Animations */
@keyframes pillSlideUpUser {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes pillSlideUpAssistant {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Thought Process / Reasoning Accordion (Strictly Above Output) */
.reasoning-box {
  width: 100%;
  background-color: var(--md-sys-color-surface-container-high);
  border: 1px solid rgba(245, 185, 66, 0.35);
  border-radius: 16px;
  margin-bottom: 16px;
  padding: 10px 14px;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.reasoning-box[open] {
  background-color: var(--md-sys-color-surface-container-highest);
  border-color: rgba(245, 185, 66, 0.5);
}

.reasoning-box summary {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--md-sys-color-tertiary);
  cursor: pointer;
  outline: none;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}

.reasoning-box summary::-webkit-details-marker {
  display: none;
}

.reasoning-box summary::before {
  content: '▶';
  font-size: 9px;
  transition: transform 0.2s ease;
  color: var(--md-sys-color-tertiary);
}

.reasoning-box[open] summary::before {
  transform: rotate(90deg);
}

.reasoning-title {
  font-family: var(--font-brand);
  letter-spacing: 0.02em;
}

.reasoning-badge {
  margin-left: auto;
  font-size: 10.5px;
  font-family: var(--font-mono);
  padding: 2px 8px;
  border-radius: 10px;
  background-color: rgba(245, 185, 66, 0.15);
  color: var(--md-sys-color-tertiary);
  border: 1px solid rgba(245, 185, 66, 0.3);
}

.reasoning-badge.streaming-pulse {
  background-color: rgba(123, 224, 155, 0.2);
  color: #7BE09B;
  border-color: rgba(123, 224, 155, 0.4);
  animation: pulseGlow 1.4s infinite alternate;
}

@keyframes pulseGlow {
  0% { opacity: 0.7; }
  100% { opacity: 1; }
}

.reasoning-content {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
  white-space: pre-wrap;
  line-height: 1.55;
  border-top: 1px dashed var(--md-sys-color-outline-variant);
  padding-top: 10px;
  max-height: 320px;
  overflow-y: auto;
}

/* Formatted Message Content */
.message-text {
  width: 100%;
  line-height: 1.7;
}

.message-text h1, .message-text h2, .message-text h3 {
  margin: 14px 0 8px 0;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
}

.message-text h1 { font-size: 19px; }
.message-text h2 { font-size: 16.5px; }
.message-text h3 { font-size: 15px; }

.message-text p {
  margin: 8px 0;
}

.message-text ul, .message-text ol {
  margin: 8px 0;
  padding-left: 24px;
}

.message-text li {
  margin: 4px 0;
}

/* Code Blocks */
pre {
  background-color: var(--md-sys-color-surface-container-lowest);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--shape-corner-md);
  margin: 12px 0;
  overflow: hidden;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  background-color: var(--md-sys-color-surface-container-high);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--md-sys-color-on-surface-variant);
  text-transform: uppercase;
}

.code-copy-btn {
  background-color: transparent;
  border: 1px solid var(--md-sys-color-outline);
  color: var(--md-sys-color-on-surface-variant);
  padding: 3px 8px;
  border-radius: var(--shape-corner-xs);
  cursor: pointer;
  font-size: 10px;
  font-family: var(--font-brand);
  transition: all 0.15s ease;
}

.code-copy-btn:hover {
  background-color: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface);
}

pre code {
  display: block;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--md-sys-color-on-surface);
  overflow-x: auto;
  line-height: 1.5;
}

/* ==================== 6. Floating Expressive Input Dock ==================== */
.chat-input-wrapper {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0 24px 20px 24px;
  background: linear-gradient(to top, var(--md-sys-color-surface) 75%, transparent);
  pointer-events: none;
  z-index: 30;
}

.attachment-tray {
  max-width: 820px;
  margin: 0 auto 8px auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  pointer-events: auto;
}

.attachment-chip {
  background-color: var(--md-sys-color-surface-container-high);
  border: 1px solid var(--md-sys-color-outline-variant);
  padding: 4px 10px;
  border-radius: var(--shape-corner-full);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--md-sys-color-on-surface);
}

.attachment-thumb {
  width: 18px;
  height: 18px;
  border-radius: var(--shape-corner-xs);
  object-fit: cover;
}

.attachment-chip-remove {
  background: transparent;
  border: none;
  color: var(--md-sys-color-outline);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
}

.attachment-chip-remove:hover {
  color: var(--md-sys-color-error);
}

/* Floating Input Box Capsule */
.chat-input-box {
  max-width: 820px;
  margin: 0 auto;
  background-color: var(--md-sys-color-surface-container-high);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--shape-corner-xxl);
  padding: 8px 12px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  pointer-events: auto;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.chat-input-box:focus-within {
  border-color: var(--md-sys-color-primary);
  background-color: var(--md-sys-color-surface-container-highest);
}

.input-left-buttons, .input-right-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.action-circle-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--shape-corner-full);
  background-color: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface-variant);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.action-circle-btn:hover {
  background-color: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface);
}

.action-pill-btn {
  height: 38px;
  padding: 0 12px;
  border-radius: var(--shape-corner-full);
  background-color: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface-variant);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-family: var(--font-brand);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.action-pill-btn:hover {
  background-color: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface);
}

.action-pill-btn.active {
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-secondary);
  border-color: var(--md-sys-color-secondary);
  font-weight: 600;
}

textarea#user-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--md-sys-color-on-surface);
  font-family: var(--font-brand);
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  max-height: 180px;
  padding: 8px 4px;
}

textarea#user-input::placeholder {
  color: var(--md-sys-color-outline);
}

/* Floating FAB Send Button */
.send-circle-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--shape-corner-full);
  background-color: var(--md-sys-color-primary);
  border: none;
  color: var(--md-sys-color-on-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.send-circle-btn:hover {
  background-color: #FFA285;
  transform: scale(1.05);
}

.send-circle-btn:active,
.action-circle-btn:active,
.button-pressed {
  transform: scale(0.92) !important;
}

/* Ensure child SVGs never swallow or divert click/touch events */
.send-circle-btn svg,
.send-circle-btn svg *,
.stop-circle-btn svg,
.stop-circle-btn svg *,
.action-circle-btn svg,
.action-circle-btn svg *,
.action-pill-btn svg,
.action-pill-btn svg *,
.effort-btn * {
  pointer-events: none !important;
}

/* Attention pulse when send is clicked with empty input */
.input-empty-attention {
  animation: inputShake 0.4s ease-in-out !important;
  border-color: var(--md-sys-color-primary, #e06c4b) !important;
  box-shadow: 0 0 0 3px rgba(255, 180, 162, 0.35) !important;
}

@keyframes inputShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

.stop-circle-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--shape-corner-full);
  background-color: var(--md-sys-color-error);
  border: none;
  color: var(--md-sys-color-surface-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.input-hint-row {
  max-width: 820px;
  margin: 6px auto 0 auto;
  font-size: 11px;
  color: var(--md-sys-color-outline);
  text-align: center;
  font-family: var(--font-mono);
}

/* ==================== 7. Material 3 Dialogs & Modals ==================== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(2px);
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  background-color: var(--md-sys-color-surface-container-high);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--shape-corner-xxl);
  width: 100%;
  max-width: 520px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.modal-header {
  padding: 20px 24px 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 22px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  background-color: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface);
}

.modal-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 70vh;
  overflow-y: auto;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group textarea,
.form-select {
  background-color: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--shape-corner-md);
  padding: 10px 12px;
  color: var(--md-sys-color-on-surface);
  font-family: var(--font-brand);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-select:focus {
  border-color: var(--md-sys-color-primary);
}

.input-with-toggle {
  display: flex;
  position: relative;
}

.input-with-toggle input {
  flex: 1;
  padding-right: 60px;
}

.toggle-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--md-sys-color-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
}

.hint {
  font-size: 11px;
  color: var(--md-sys-color-outline);
}

.checkbox-container {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.checkbox-text {
  font-size: 13px;
  color: var(--md-sys-color-on-surface);
}

.modal-footer {
  padding: 16px 24px 20px 24px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--md-sys-color-outline-variant);
}

/* ==================== 8. M3 Expressive Buttons ==================== */
.btn {
  font-family: var(--font-brand);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: var(--shape-corner-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  transition: all 0.15s ease;
}

.btn-primary {
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.btn-primary:hover {
  background-color: #FFA285;
}

.btn-tonal {
  background-color: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
}

.btn-tonal:hover {
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-primary);
  border-color: var(--md-sys-color-primary);
}

.btn-tonal-tertiary {
  background-color: var(--md-sys-color-tertiary-container);
  color: var(--md-sys-color-on-tertiary-container);
  border: 1px solid rgba(245, 185, 66, 0.3);
}

.btn-tonal-tertiary:hover {
  background-color: #5E4000;
}

.btn-secondary {
  background-color: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface);
}

.btn-secondary:hover {
  background-color: var(--md-sys-color-surface-container-high);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

.btn-xs {
  padding: 4px 10px;
  font-size: 11px;
}

/* Hidden utility */
.hidden {
  display: none !important;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: var(--md-sys-color-outline-variant);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--md-sys-color-outline);
}

/* ==================== 7. Live Provider Credits / Balance Pill ==================== */
.credits-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--shape-corner-full);
  padding: 4px 10px;
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--md-sys-color-on-surface);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  user-select: none;
}

.credits-pill:hover {
  background-color: var(--md-sys-color-surface-container-high);
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.credits-icon {
  font-size: 12px;
}

.credits-amount {
  font-weight: 600;
  color: var(--md-sys-color-primary);
}

.credits-refresh-btn {
  background: transparent;
  border: none;
  color: var(--md-sys-color-outline);
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, transform 0.3s ease;
}

.credits-refresh-btn:hover {
  color: var(--md-sys-color-primary);
}

.credits-refresh-btn.spinning svg {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Topbar helper pills */
.skills-status-pill,
.project-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background-color: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--shape-corner-full);
  padding: 4px 9px;
  font-size: 11px;
  font-family: var(--font-brand);
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  transition: all 0.15s ease;
}

.skills-status-pill:hover,
.project-status-pill:hover {
  border-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-primary);
  background-color: var(--md-sys-color-surface-container-high);
}

/* ==================== 8. Enhanced Chat History Pane ==================== */
.header-action-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-icon-xs {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--shape-corner-xs);
  padding: 3px 6px;
  font-size: 12px;
  cursor: pointer;
  color: var(--md-sys-color-on-surface-variant);
  transition: all 0.15s ease;
}

.btn-icon-xs:hover {
  background-color: var(--md-sys-color-surface-container-highest);
  border-color: var(--md-sys-color-outline-variant);
}

.history-date-header {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--md-sys-color-outline);
  padding: 10px 12px 4px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.history-date-header::after {
  content: "";
  flex: 1;
  height: 1px;
  background-color: var(--md-sys-color-outline-variant);
  opacity: 0.4;
}

.chat-item-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.chat-item-snippet {
  font-size: 11px;
  color: var(--md-sys-color-on-surface-variant);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
  opacity: 0.8;
}

.chat-item-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--md-sys-color-outline);
  margin-top: 2px;
}

.chat-actions-group {
  display: none;
  align-items: center;
  gap: 2px;
}

.chat-item:hover .chat-actions-group {
  display: flex;
}

.chat-action-btn {
  background: transparent;
  border: none;
  color: var(--md-sys-color-outline);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 12px;
  transition: all 0.15s ease;
}

.chat-action-btn:hover {
  color: var(--md-sys-color-on-surface);
  background-color: var(--md-sys-color-surface-container-highest);
}

.chat-action-btn.delete-btn:hover {
  color: var(--md-sys-color-error);
}

/* ==================== 9. Agent Skills System ==================== */
.pane-info-banner {
  background-color: var(--md-sys-color-surface-container-high);
  border-left: 3px solid var(--md-sys-color-primary);
  border-radius: var(--shape-corner-xs);
  padding: 8px 10px;
  margin: 0 10px 10px 10px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--md-sys-color-on-surface-variant);
}

.skills-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 10px 20px 10px;
  overflow-y: auto;
}

.skill-card {
  background-color: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--shape-corner-md);
  padding: 10px 12px;
  transition: all 0.2s ease;
}

.skill-card.active {
  border-color: rgba(235, 94, 63, 0.4);
  background-color: var(--md-sys-color-surface-container-high);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.skill-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.skill-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.skill-icon {
  font-size: 16px;
}

.skill-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.skill-tag {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background-color: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface-variant);
  padding: 2px 6px;
  border-radius: var(--shape-corner-full);
}

/* Custom iOS/Material Switch */
.skill-switch {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 20px;
  flex-shrink: 0;
}

.skill-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--md-sys-color-outline-variant);
  border-radius: 20px;
  transition: 0.2s ease;
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.2s ease;
}

.skill-switch input:checked + .switch-slider {
  background-color: var(--md-sys-color-primary);
}

.skill-switch input:checked + .switch-slider:before {
  transform: translateX(14px);
}

.skill-desc {
  font-size: 11px;
  line-height: 1.35;
  color: var(--md-sys-color-on-surface-variant);
  margin-top: 4px;
}

.skill-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--md-sys-color-outline-variant);
}

/* ==================== 10. Projects & Codebase Explorer ==================== */
.project-active-card {
  background: linear-gradient(135deg, var(--md-sys-color-surface-container-high), var(--md-sys-color-surface-container));
  border: 1px solid var(--md-sys-color-primary);
  border-radius: var(--shape-corner-md);
  padding: 12px;
  margin: 0 10px 12px 10px;
}

.project-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.project-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  display: flex;
  align-items: center;
  gap: 6px;
}

.project-meta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 8px;
}

.project-tech-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.tech-chip {
  font-size: 10px;
  font-family: var(--font-mono);
  background-color: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-primary);
  padding: 2px 7px;
  border-radius: var(--shape-corner-full);
  border: 1px solid rgba(235, 94, 63, 0.2);
}

.project-context-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
  border-top: 1px solid var(--md-sys-color-outline-variant);
  font-size: 11px;
  color: var(--md-sys-color-on-surface);
}

.project-files-section {
  display: flex;
  flex-direction: column;
  padding: 0 10px;
  margin-bottom: 12px;
}

.project-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--md-sys-color-outline);
}

.project-tree-container {
  max-height: 220px;
  overflow-y: auto;
  background-color: var(--md-sys-color-surface-container-lowest);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--shape-corner-sm);
  padding: 6px;
}

.file-tree-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--md-sys-color-on-surface);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.file-tree-item:hover {
  background-color: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-primary);
}

.file-tree-name {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.file-tree-lines {
  font-size: 9.5px;
  color: var(--md-sys-color-outline);
}

.saved-projects-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 10px 16px 10px;
}

.saved-project-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--shape-corner-sm);
  padding: 8px 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.saved-project-item:hover {
  border-color: var(--md-sys-color-primary);
  background-color: var(--md-sys-color-surface-container-high);
}

.saved-project-item.active {
  border-color: var(--md-sys-color-primary);
  background-color: var(--md-sys-color-surface-container-high);
}

.project-scan-status {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.4;
}

/* ==========================================================================
   Mobile Responsive Engine (Smartphones & Tablets <= 768px)
   Drawer Navigation • Touch Geometry • iOS Zoom Prevention • 100dvh Bounds
   ========================================================================== */
@media (max-width: 768px) {
  html, body, .app-layout {
    height: 100dvh;
    max-height: 100dvh;
    width: 100vw;
    overflow: hidden;
    position: fixed;
  }

  /* --- Mobile Drawer Backdrop --- */
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 80;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s cubic-bezier(0.2, 0, 0, 1);
  }

  body.sidebar-mobile-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  /* --- Navigation Rail on Mobile (Drawer Left Strip) --- */
  .nav-rail {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 58px;
    z-index: 100;
    transform: translateX(-340px);
    transition: transform 0.28s cubic-bezier(0.2, 0, 0, 1);
    padding: 12px 0;
  }

  body.sidebar-mobile-open .nav-rail {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.4);
  }

  .rail-btn {
    width: 50px;
  }

  .rail-icon-wrapper {
    width: 42px;
    height: 28px;
  }

  .rail-label {
    font-size: 10px;
  }

  /* --- Sub-Sidebar on Mobile (Drawer Content Pane) --- */
  .sub-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 58px;
    width: calc(100vw - 75px);
    max-width: 290px;
    z-index: 95;
    transform: translateX(-360px);
    transition: transform 0.28s cubic-bezier(0.2, 0, 0, 1);
    border-right: 1px solid var(--md-sys-color-outline-variant);
    box-shadow: 8px 0 28px rgba(0, 0, 0, 0.55);
  }

  body.sidebar-mobile-open .sub-sidebar {
    transform: translateX(0);
  }

  .sub-sidebar.collapsed {
    width: calc(100vw - 75px);
    margin-left: 0;
  }

  /* --- Main Viewport on Mobile --- */
  .main-viewport {
    width: 100vw;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .chat-topbar {
    height: 52px;
    padding: 0 10px;
    gap: 8px;
  }

  .topbar-left-group {
    gap: 6px;
    flex: 1;
    min-width: 0;
  }

  .icon-toggle-btn {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
  }

  .select-pill-wrapper {
    max-width: 175px;
    min-width: 0;
    flex-shrink: 1;
  }

  .select-pill.model-pill {
    max-width: 175px;
    font-size: 12px;
    padding: 5px 22px 5px 8px;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
  }

  /* Hide non-essential badges in mobile topbar */
  .effort-pill,
  #effort-select,
  .provider-pill,
  #provider-select,
  .topbar-right-group .tools-status-pill,
  .topbar-right-group .skills-status-pill,
  .topbar-right-group .project-status-pill,
  .topbar-right-group .token-badge {
    display: none !important;
  }

  /* Mobile AgentRouter bar & Effort Bar */
  .agentrouter-bar-header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .ar-effort-group {
    width: 100%;
    justify-content: space-between;
    margin-left: 0;
  }
  .effort-bar {
    width: 100%;
    display: flex;
  }
  .effort-btn {
    flex: 1;
    text-align: center;
    padding: 6px 3px;
    font-size: 11px;
  }

  /* --- Messages Viewport --- */
  .messages-viewport {
    padding: 10px 10px 130px 10px;
  }

  .welcome-screen {
    margin: 6px auto;
    gap: 12px;
    padding: 0 2px;
  }

  .workbench-status-card {
    padding: 14px 12px;
    border-radius: 16px;
  }

  .workbench-title {
    font-size: 19px;
    line-height: 1.25;
  }

  .workbench-desc {
    font-size: 12px;
    line-height: 1.45;
    margin-bottom: 0;
  }

  .asymmetric-workbench-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .workbench-tile {
    padding: 12px 14px;
    border-radius: 14px;
  }

  .workbench-tile .tile-title {
    font-size: 13px;
  }

  .workbench-tile .tile-tag {
    font-size: 10.5px;
  }

  /* --- Message Bubbles on Phone --- */
  .message-row {
    margin-bottom: 12px;
  }

  .message-row.user-row .message-bubble {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 18px 18px 4px 18px;
  }

  .user-bubble .message-text,
  .message-row.user-row .message-text {
    font-size: 14px;
    line-height: 1.45;
  }

  .assistant-bubble,
  .message-row.assistant-row .message-bubble {
    padding: 14px 14px;
    border-radius: 18px 18px 18px 4px;
  }

  .assistant-bubble .message-text,
  .message-row.assistant-row .message-text {
    font-size: 14px;
    line-height: 1.5;
  }

  /* Code Blocks on Mobile */
  pre {
    margin: 8px 0;
    border-radius: 10px;
    font-size: 11.5px;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* --- Floating Input Dock on Phone --- */
  .chat-input-wrapper {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0 8px max(8px, env(safe-area-inset-bottom)) 8px;
    z-index: 60;
  }

  .chat-input-box {
    border-radius: 24px;
    padding: 6px 8px;
    gap: 6px;
    align-items: flex-end;
  }

  .input-left-buttons, .input-right-buttons {
    gap: 4px;
  }

  .action-circle-btn {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
  }

  /* Mobile WebSearch Toggle: Collapse text, icon-only button */
  .action-pill-btn#websearch-toggle-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .action-pill-btn#websearch-toggle-btn span {
    display: none;
  }

  /* CRITICAL: 16px font prevents iOS Safari auto-zoom */
  #user-input {
    font-size: 16px !important;
    line-height: 20px;
    padding: 7px 4px;
    max-height: 110px;
  }

  /* --- Modals on Mobile --- */
  .modal-overlay {
    padding: 10px;
    align-items: flex-end;
  }

  .modal-content {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 85dvh;
    border-radius: 24px 24px 12px 12px;
    padding: 16px 14px;
  }
}

/* ==========================================================================
   User Profile & Authentication Portal Styles
   ========================================================================== */

.user-auth-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.user-profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--surface-container-high, #21262d);
  border: 1px solid var(--outline-variant, rgba(255, 255, 255, 0.12));
  color: var(--on-surface, #e6edf3);
  font-size: 12.5px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.user-profile-chip:hover {
  background: var(--surface-container-highest, #30363d);
  border-color: var(--primary, #58a6ff);
}

.user-avatar-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary-container, #1f6feb22);
  color: var(--primary, #58a6ff);
  font-weight: 600;
  font-size: 11px;
}

.sync-dot-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3fb950;
  box-shadow: 0 0 6px #3fb95088;
  display: inline-block;
}

.sync-dot-indicator.offline {
  background: #8b949e;
  box-shadow: none;
}

.sync-dot-indicator.syncing {
  background: #d29922;
  animation: pulse-sync 1s infinite alternate;
}

@keyframes pulse-sync {
  from { transform: scale(0.85); opacity: 0.6; }
  to { transform: scale(1.2); opacity: 1; }
}

/* User Dropdown Menu */
.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  background: var(--surface-container-highest, #1c2128);
  border: 1px solid var(--outline-variant, rgba(255, 255, 255, 0.15));
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  padding: 8px 0;
  z-index: 1000;
  backdrop-filter: blur(12px);
}

.user-dropdown-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
}

.user-dropdown-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #238636;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 13px;
  flex-shrink: 0;
}

.user-dropdown-info {
  overflow: hidden;
}

.user-dropdown-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--on-surface, #f0f6fc);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-dropdown-email {
  font-size: 11px;
  color: var(--on-surface-variant, #8b949e);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-dropdown-divider {
  height: 1px;
  background: var(--outline-variant, rgba(255, 255, 255, 0.1));
  margin: 6px 0;
}

.user-dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: transparent;
  border: none;
  color: var(--on-surface, #c9d1d9);
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.user-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.user-dropdown-item.sign-out-item {
  color: #f85149;
}

.user-dropdown-item.sign-out-item:hover {
  background: rgba(248, 81, 73, 0.12);
  color: #ff7b72;
}

/* Auth Modal Card */
.auth-modal-card {
  max-width: 420px;
  width: 92%;
  border-radius: 16px;
  background: var(--surface-container-high, #161b22);
  border: 1px solid var(--outline-variant, rgba(255, 255, 255, 0.15));
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.auth-header-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #1f6feb, #238636);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.auth-modal-subtitle {
  font-size: 12px;
  color: var(--on-surface-variant, #8b949e);
  margin-top: 3px;
  line-height: 1.35;
}

.auth-modal-body {
  padding: 18px 20px 10px;
}

.social-login-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.social-login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid var(--outline-variant, rgba(255, 255, 255, 0.15));
}

.google-login-btn {
  background: #ffffff;
  color: #1f1f1f;
  border: 1px solid #dadce0;
}

.google-login-btn:hover {
  background: #f8f9fa;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.github-login-btn {
  background: #24292f;
  color: #ffffff;
  border: 1px solid #444c56;
}

.github-login-btn:hover {
  background: #2d333b;
  border-color: #768390;
}

.auth-divider {
  display: flex;
  align-items: center;
  margin: 16px 0;
  color: var(--on-surface-variant, #8b949e);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--outline-variant, rgba(255, 255, 255, 0.1));
}

.auth-divider span {
  padding: 0 10px;
}

.auth-input-group {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.auth-input-group label {
  font-size: 12px;
  font-weight: 500;
  color: var(--on-surface, #c9d1d9);
}

.auth-alert {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  margin-bottom: 12px;
  line-height: 1.4;
}

.auth-alert.error {
  background: rgba(248, 81, 73, 0.15);
  border: 1px solid rgba(248, 81, 73, 0.4);
  color: #ff7b72;
}

.auth-alert.success {
  background: rgba(46, 160, 67, 0.15);
  border: 1px solid rgba(46, 160, 67, 0.4);
  color: #3fb950;
}

.auth-submit-btn {
  width: 100%;
  padding: 10px;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: 8px;
  margin-top: 6px;
}

.auth-footer-toggle {
  margin-top: 14px;
  text-align: center;
  font-size: 12.5px;
  color: var(--on-surface-variant, #8b949e);
}

.auth-footer-toggle .link-btn {
  background: transparent;
  border: none;
  color: var(--primary, #58a6ff);
  font-weight: 600;
  cursor: pointer;
  padding: 0 4px;
  text-decoration: underline;
}

.auth-modal-footer {
  padding: 10px 20px 14px;
  border-top: 1px solid var(--outline-variant, rgba(255, 255, 255, 0.08));
  display: flex;
  justify-content: center;
}

/* ==================== Account Modal & Cloud Vault Portal ==================== */
.account-modal-card {
  max-width: 580px;
  width: 94%;
  border-radius: 18px;
  background: var(--surface-container-high, #161b22);
  border: 1px solid var(--outline-variant, rgba(255, 255, 255, 0.15));
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.account-avatar-large {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4285F4, #34A853);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
  overflow: hidden;
}

.account-avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.account-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(66, 133, 244, 0.18);
  color: #58a6ff;
  border: 1px solid rgba(66, 133, 244, 0.35);
  margin-top: 3px;
}

.account-modal-body {
  padding: 16px 22px 20px;
  max-height: 72vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.account-section {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--outline-variant, rgba(255, 255, 255, 0.08));
}

.account-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--on-surface, #f0f6fc);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.account-section-desc {
  font-size: 11.5px;
  color: var(--on-surface-variant, #8b949e);
  line-height: 1.4;
  margin: 0 0 10px 0;
}

.account-identity-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

@media (max-width: 540px) {
  .account-identity-grid {
    grid-template-columns: 1fr;
  }
}

.account-static-value {
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--surface-container, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--outline-variant, rgba(255, 255, 255, 0.1));
  font-size: 12.5px;
  color: var(--on-surface, #e6edf3);
  font-family: var(--font-mono, monospace);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-static-meta {
  font-size: 11.5px;
  color: var(--on-surface-variant, #8b949e);
  padding: 8px 0;
}

/* AI Persona Chips */
.persona-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.persona-chip {
  background: var(--surface-container, rgba(255, 255, 255, 0.05));
  border: 1px solid var(--outline-variant, rgba(255, 255, 255, 0.12));
  color: var(--on-surface-variant, #c9d1d9);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.persona-chip:hover {
  background: var(--surface-container-high, rgba(255, 255, 255, 0.1));
  color: #fff;
  border-color: var(--primary, #58a6ff);
}

.persona-chip.active {
  background: rgba(235, 94, 63, 0.2);
  color: #ff7b72;
  border-color: #eb5e3f;
  font-weight: 600;
}

/* Account Vault Grid */
.account-vault-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.vault-item-card {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-container, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--outline-variant, rgba(255, 255, 255, 0.08));
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.vault-item-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--on-surface, #e6edf3);
}

.vault-item-status {
  font-size: 10px;
  font-family: var(--font-mono, monospace);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Stats Grid */
.account-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 8px;
}

@media (max-width: 480px) {
  .account-stats-grid {
    grid-template-columns: 1fr;
  }
}

.stat-card {
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-container, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--outline-variant, rgba(255, 255, 255, 0.08));
  text-align: center;
}

.stat-num {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-mono, monospace);
  color: var(--on-surface, #f0f6fc);
}

.stat-label {
  font-size: 10.5px;
  color: var(--on-surface-variant, #8b949e);
  margin-top: 3px;
}

/* Stealth Shield Banner */
.stealth-shield-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(35, 134, 54, 0.15);
  border: 1px solid rgba(46, 160, 67, 0.35);
  color: #3fb950;
  font-size: 11.5px;
  line-height: 1.45;
  margin-bottom: 12px;
}

.stealth-shield-banner code {
  background: rgba(0, 0, 0, 0.3);
  padding: 1px 4px;
  border-radius: 4px;
  font-family: var(--font-mono, monospace);
}

/* AgentRouter Interactive Model Picker Bar (Matches AgentRouter Dashboard) */
.agentrouter-bar {
  background: var(--md-sys-color-surface-container, #161b22);
  border-bottom: 1px solid var(--md-sys-color-outline-variant, rgba(255, 255, 255, 0.1));
  padding: 8px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: fadeInDown 0.2s ease-out;
}

.agentrouter-bar.hidden {
  display: none !important;
}

.agentrouter-bar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 6px;
  flex-wrap: wrap;
}

.agentrouter-tabs {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow-x: auto;
  border-bottom: none;
  padding-bottom: 0;
}

/* Effort Bar Segmented Control */
.ar-effort-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.ar-effort-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface-variant, #8b949e);
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.effort-bar {
  display: inline-flex;
  background: var(--md-sys-color-surface-container-high, #21262d);
  border: 1px solid var(--md-sys-color-outline-variant, rgba(255, 255, 255, 0.15));
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.effort-btn {
  background: transparent;
  border: none;
  color: var(--md-sys-color-outline, #8b949e);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  font-family: var(--font-brand, inherit);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

.effort-btn:hover {
  color: var(--md-sys-color-on-surface, #f0f6fc);
  background: rgba(255, 255, 255, 0.08);
}

.effort-btn.active {
  color: #ffffff !important;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.effort-btn[data-effort="low"].active {
  background: #238636 !important;
}

.effort-btn[data-effort="medium"].active {
  background: var(--md-sys-color-primary, #e06c4b) !important;
}

.effort-btn[data-effort="high"].active {
  background: #d97706 !important;
}

.effort-btn[data-effort="extra"].active {
  background: #9333ea !important;
}

.effort-btn[data-effort="max"].active {
  background: #e11d48 !important;
}

.ar-tab {
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant, #8b949e);
  cursor: pointer;
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 6px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.ar-tab:hover {
  color: var(--md-sys-color-on-surface, #f0f6fc);
  background: rgba(255, 255, 255, 0.06);
}

.ar-tab.active {
  color: var(--md-sys-color-on-surface, #f0f6fc);
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
}

.ar-badge {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--md-sys-color-on-surface, #f0f6fc);
}

.ar-tab.active .ar-badge-all {
  background: #ffdedb;
  color: #ba1a1a;
  font-weight: 700;
}

.agentrouter-pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.ar-model-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
  user-select: none;
  line-height: 1.4;
}

.ar-model-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.ar-model-pill.active {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35), 0 3px 10px rgba(0, 0, 0, 0.4);
  transform: scale(1.03);
}

/* Specific pill colors matching AgentRouter Dashboard */
.pill-claude-opus-48 {
  background: #fdf3e2;
  color: #9a5300;
  border-color: #f7cb8d;
}

.pill-claude-opus-5 {
  background: #ede8ff;
  color: #5539ab;
  border-color: #cbbeff;
}

.pill-deepseek-v4-flash {
  background: #e2f1ff;
  color: #14599e;
  border-color: #a7d3fc;
}

.pill-gpt-56-sol {
  background: #fef0e3;
  color: #a44f15;
  border-color: #f5c49b;
}

.pill-gpt-6-astra {
  background: #fde8f1;
  color: #ae225e;
  border-color: #f6abc9;
}

/* Dynamic Provider Model Pills styling */
.pill-anthropic {
  background: #211b3b;
  color: #b9a5fd;
  border-color: #493b77;
}

.pill-openai {
  background: #112d22;
  color: #56d39b;
  border-color: #1c5e44;
}

.pill-deepseek {
  background: #102236;
  color: #6dbafc;
  border-color: #1f456c;
}

.pill-google {
  background: #1f2338;
  color: #8ab4f8;
  border-color: #3b4b75;
}

.pill-free {
  background: #132d1e;
  color: #3fb950;
  border-color: #238636;
}

.pill-generic {
  background: var(--md-sys-color-surface-container, #21262d);
  color: var(--md-sys-color-on-surface, #e6edf3);
  border-color: var(--md-sys-color-outline-variant, rgba(255, 255, 255, 0.15));
}

.ar-free-tag {
  font-size: 9px;
  font-weight: 700;
  background: #238636;
  color: #ffffff;
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: 0.3px;
  margin-left: 2px;
}

.header-refresh-btn {
  background: transparent;
  border: 1px solid var(--md-sys-color-outline-variant, rgba(255, 255, 255, 0.15));
  color: var(--md-sys-color-on-surface-variant, #8b949e);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.header-refresh-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--md-sys-color-primary, #e06c4b);
  border-color: var(--md-sys-color-primary, #e06c4b);
}

.header-refresh-btn.spinning {
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Dark mode palette adjustments */
@media (prefers-color-scheme: dark) {
  .pill-claude-opus-48 {
    background: #2b1f0f;
    color: #f6b450;
    border-color: #593e1b;
  }
  .pill-claude-opus-5 {
    background: #211b3b;
    color: #b9a5fd;
    border-color: #493b77;
  }
  .pill-deepseek-v4-flash {
    background: #102236;
    color: #6dbafc;
    border-color: #1f456c;
  }
  .pill-gpt-56-sol {
    background: #2d1c10;
    color: #f7a465;
    border-color: #5c371d;
  }
  .pill-gpt-6-astra {
    background: #331323;
    color: #f982b0;
    border-color: #692247;
  }
}



