/* ═══════════════════════════════════════════════════════════════
   Claude Multi-Session — Modern UI Theme
   ═══════════════════════════════════════════════════════════════ */

/* ─── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Surface colors */
  --bg:            #0a0a0f;
  --bg-raised:     #12121a;
  --bg-surface:    #16161f;
  --bg-hover:      #1e1e2a;
  --bg-active:     #252535;
  --bg-overlay:    rgba(0, 0, 0, 0.5);

  /* Border colors */
  --border:        #1e1e2e;
  --border-subtle: #161625;
  --border-focus:  #6366f1;

  /* Text colors */
  --text:          #e2e8f0;
  --text-secondary:#94a3b8;
  --text-dim:      #64748b;
  --text-bright:   #f8fafc;

  /* Brand / accent */
  --accent:        #818cf8;
  --accent-dim:    #6366f1;
  --accent-glow:   rgba(99, 102, 241, 0.15);
  --accent-surface:rgba(99, 102, 241, 0.08);

  /* Semantic colors */
  --green:         #34d399;
  --green-dim:     rgba(52, 211, 153, 0.15);
  --orange:        #fbbf24;
  --orange-dim:    rgba(251, 191, 36, 0.12);
  --red:           #f87171;
  --red-dim:       rgba(248, 113, 113, 0.12);

  /* Typography */
  --font-sans:     'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:     'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;

  /* Sizing */
  --content-max:   800px;
  --radius-sm:     6px;
  --radius-md:     10px;
  --radius-lg:     14px;
  --radius-xl:     18px;

  /* Shadows */
  --shadow-sm:     0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md:     0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg:     0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow:   0 0 20px rgba(99, 102, 241, 0.1);

  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-med:  0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);

  /* Sidebar */
  --sidebar-width: 340px;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  display: flex;
  flex-direction: column;
  padding-right: var(--sidebar-width);
}


/* ═══════════════════════════════════════════════════════════════
   TOP BAR
   ═══════════════════════════════════════════════════════════════ */
#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 52px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

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

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

/* Brand */
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-bright);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.brand-icon {
  color: var(--accent);
  transition: color 0.4s ease, filter 0.4s ease;
  filter: drop-shadow(0 0 3px rgba(99, 102, 241, 0.3));
  animation: brand-breathe 4s ease-in-out infinite;
}

@keyframes brand-breathe {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 3px rgba(99, 102, 241, 0.3)); }
  50%      { transform: scale(1.06); filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.5)); }
}

/* Brand icon reflects connection status (v1.4.2) */
.brand-icon.connected {
  color: var(--green);
  filter: drop-shadow(0 0 4px rgba(34, 197, 94, 0.4));
  animation: brand-connected-glow 3s ease-in-out infinite;
}

@keyframes brand-connected-glow {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(34, 197, 94, 0.3)); transform: scale(1); }
  50%      { filter: drop-shadow(0 0 10px rgba(34, 197, 94, 0.6)); transform: scale(1.04); }
}

.brand-icon.disconnected {
  color: var(--red);
  animation: brand-disconnected-pulse 1.5s ease-in-out infinite;
}

@keyframes brand-disconnected-pulse {
  0%, 100% { filter: drop-shadow(0 0 3px rgba(239, 68, 68, 0.3)); transform: scale(1); opacity: 1; }
  50%      { filter: drop-shadow(0 0 10px rgba(239, 68, 68, 0.6)); transform: scale(1.08); opacity: 0.7; }
}

.brand-icon.reconnecting {
  color: var(--yellow, #eab308);
  animation: brand-reconnecting-spin 2s linear infinite;
}

@keyframes brand-reconnecting-spin {
  0%   { filter: drop-shadow(0 0 4px rgba(234, 179, 8, 0.4)); transform: rotate(0deg); }
  100% { filter: drop-shadow(0 0 8px rgba(234, 179, 8, 0.6)); transform: rotate(360deg); }
}

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

.topbar-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 4px;
}

/* New Session button */
#btn-new {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--accent-dim);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
  white-space: nowrap;
  transition: all var(--transition-fast);
  box-shadow: 0 1px 3px rgba(99, 102, 241, 0.3);
}

#btn-new:hover {
  background: var(--accent);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}

#btn-new:active {
  transform: translateY(0);
}


/* Connection dot (hidden — brand icon now reflects status) */
.status-dot {
  display: none;
}

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


/* ═══════════════════════════════════════════════════════════════
   TAB BAR
   ═══════════════════════════════════════════════════════════════ */
#tab-bar-wrapper {
  display: flex;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-height: 38px;
  align-items: center;
}

#tab-search {
  width: 120px;
  padding: 0 8px;
  margin: 0 0 0 8px;
  height: 26px;
  font-size: 12px;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  outline: none;
  transition: border-color 0.2s ease, width 0.2s ease;
  flex-shrink: 0;
}

#tab-search:focus {
  width: 160px;
  border-color: var(--accent-dim);
}

#tab-search::placeholder {
  color: var(--text-dim);
  font-size: 11px;
}

#tab-bar {
  display: flex;
  overflow-x: auto;
  flex: 1;
  min-height: 38px;
  padding: 0 12px;
  gap: 2px;
}

/* Hide scrollbar on tab bar */
#tab-bar::-webkit-scrollbar { height: 0; }

.tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  height: 38px;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  user-select: none;
  position: relative;
  transition: color var(--transition-fast),
              background var(--transition-fast),
              border-color var(--transition-fast);
}

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

.tab.active {
  color: var(--text-bright);
  border-bottom-color: var(--accent);
  background: var(--bg-surface);
}

/* Pane color indicator on legacy tabs (multi-pane mode) */
.tab.has-pane-color {
  border-left: 2px solid color-mix(in srgb, var(--tab-pane-color, transparent) 40%, transparent);
  background: color-mix(in srgb, var(--tab-pane-color, transparent) 12%, transparent);
}
.tab.has-pane-color:hover {
  background: color-mix(in srgb, var(--tab-pane-color, transparent) 18%, transparent);
}
.tab.has-pane-color.active {
  border-bottom-color: var(--tab-pane-color, var(--accent));
  background: color-mix(in srgb, var(--tab-pane-color, transparent) 15%, transparent);
}

.tab .tab-status {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background var(--transition-fast);
}

.tab-status.idle     { background: #34d399; }
.tab-status.thinking { background: var(--accent); animation: pulse-thinking 1.2s ease-in-out infinite; }
.tab-status.tool     { background: #fbbf24; animation: pulse-tool 1.5s ease-in-out infinite; }
.tab-status.error    { background: var(--red); }
.tab-status.closed   { background: #64748b; }

@keyframes pulse-thinking {
  0%, 100% { opacity: 1; box-shadow: 0 0 4px rgba(99, 102, 241, 0.6); }
  50%      { opacity: 0.3; box-shadow: 0 0 0px rgba(99, 102, 241, 0); }
}

@keyframes pulse-tool {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.3; }
}

/* ─── Sidebar Version Footer (v1.5) ──────────────────────────── */
.sidebar-version {
  padding: 6px 14px;
  font-size: 11px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  text-align: center;
  flex-shrink: 0;
}

/* ─── Version Upgrade Banner (v1.5) ──────────────────────────── */
.version-upgrade-banner {
  background: #f59e0b;
  color: #1a1a2e;
  padding: 8px 16px;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  position: relative;
}
.version-upgrade-banner a {
  color: #1a1a2e;
  font-weight: 700;
  text-decoration: underline;
  margin-left: 6px;
}

/* ─── Keep-Alive Heartbeat Indicator (v1.5) ──────────────────── */
.tab-keepalive {
  font-size: 8px;
  color: #f472b6;
  margin-left: 3px;
  opacity: 0.6;
  transition: opacity 0.3s ease, transform 0.3s ease;
  display: inline-block;
}
.tab-keepalive.pulse-now {
  opacity: 1;
  animation: heartbeat-pulse 1.5s ease-in-out;
}
@keyframes heartbeat-pulse {
  0%   { transform: scale(1);   opacity: 0.6; color: #f472b6; }
  15%  { transform: scale(1.4); opacity: 1;   color: #fb7185; }
  30%  { transform: scale(1);   opacity: 0.8; }
  45%  { transform: scale(1.3); opacity: 1;   color: #fb7185; }
  60%  { transform: scale(1);   opacity: 0.6; }
  100% { transform: scale(1);   opacity: 0.6; color: #f472b6; }
}

/* ─── Global Activity Indicator ─────────────────────────────── */
.activity-indicator {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  transition: background var(--transition-fast), border-color var(--transition-fast);
  user-select: none;
}
.activity-indicator:hover {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.4);
}
.activity-indicator.hidden { display: none; }
.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse-thinking 1.2s ease-in-out infinite;
}
.activity-indicator.has-tool .activity-dot {
  background: var(--orange);
  animation: pulse-tool 1.5s ease-in-out infinite;
}
.activity-count {
  min-width: 12px;
  text-align: center;
}

.activity-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 280px;
  max-width: 360px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  overflow: hidden;
}
.activity-dropdown.hidden { display: none; }

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

.btn-stop-all {
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--red);
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 4px;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.btn-stop-all:hover {
  background: rgba(239, 68, 68, 0.2);
}

.activity-list {
  max-height: 300px;
  overflow-y: auto;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.activity-item:hover {
  background: var(--bg-hover);
}
.activity-item-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.activity-item-dot.thinking {
  background: var(--accent);
  animation: pulse-thinking 1.2s ease-in-out infinite;
}
.activity-item-dot.tool {
  background: var(--orange);
  animation: pulse-tool 1.5s ease-in-out infinite;
}
.activity-item-name {
  flex: 1;
  font-size: 13px;
  color: var(--text-bright);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.activity-item-status {
  font-size: 11px;
  color: var(--text-dim);
  flex-shrink: 0;
}
.activity-item-abort {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: rgba(239, 68, 68, 0.1);
  color: var(--red);
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition-fast);
}
.activity-item-abort:hover {
  background: rgba(239, 68, 68, 0.25);
}

.tab .tab-close {
  margin-left: 4px;
  opacity: 0;
  font-size: 16px;
  line-height: 1;
  transition: opacity var(--transition-fast), color var(--transition-fast);
  border-radius: 4px;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tab:hover .tab-close { opacity: 0.5; }
.tab .tab-close:hover {
  opacity: 1;
  color: var(--red);
  background: var(--red-dim);
}


/* ═══════════════════════════════════════════════════════════════
   CONVERSATION AREA
   ═══════════════════════════════════════════════════════════════ */
#conversation {
  flex: 1;
  overflow-y: auto;
  padding: 24px 24px;
  scroll-behavior: smooth;
  position: relative;
}

/* Empty state (no-session and per-session welcome) */
#empty-state,
.session-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-dim);
  gap: 8px;
  opacity: 0.7;
  user-select: none;
}

.empty-state-icon {
  color: var(--text-dim);
  opacity: 0.25;
  margin-bottom: 8px;
}

#empty-state .empty-state-title,
.session-empty-state .empty-state-title,
#empty-state h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
  margin: 0;
}

#empty-state .empty-state-subtitle,
.session-empty-state .empty-state-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0 0 4px 0;
}

.empty-state-tips {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.empty-state-tip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-secondary);
  min-width: 160px;
}

.empty-state-tip kbd {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  white-space: nowrap;
}

.empty-state-tip span {
  color: var(--text-dim);
}

/* Session panels */
.session-panel {
  display: none;
  padding-bottom: 24px;
}

.session-panel.active {
  display: block;
  animation: fadeInPanel 0.2s ease-out;
}

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


/* ═══════════════════════════════════════════════════════════════
   MESSAGES
   ═══════════════════════════════════════════════════════════════ */

/* Base message */
.msg {
  margin-bottom: 20px;
  animation: fadeInMsg 0.25s ease-out;
}

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

/* User message */
.msg-user {
  background: linear-gradient(135deg, var(--accent-dim) 0%, #4f46e5 100%);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-lg) var(--radius-lg) 6px var(--radius-lg);
  margin-left: auto;
  max-width: 680px;
  width: fit-content;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.55;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
  position: relative;
  contain: content;
}

/* Assistant message */
.msg-assistant {
  padding: 6px 0;
  position: relative;
  contain: layout style;
}

.msg-assistant .markdown-body {
  color: var(--text);
  line-height: 1.7;
  font-size: 14.5px;
}

/* ─── Markdown rendering overrides ─── */
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
  margin-top: 20px;
  margin-bottom: 10px;
  border-bottom: none;
  color: var(--text-bright);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.markdown-body h1 { font-size: 1.5em; }
.markdown-body h2 { font-size: 1.3em; }
.markdown-body h3 { font-size: 1.1em; }

.markdown-body p {
  margin-bottom: 10px;
}

.markdown-body pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 12px 0;
  box-shadow: var(--shadow-sm);
}

.markdown-body code {
  font-family: var(--font-mono);
  font-size: 13px;
}

.markdown-body :not(pre) > code {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent);
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 0.9em;
}

.markdown-body ul, .markdown-body ol {
  padding-left: 24px;
  margin-bottom: 10px;
}

.markdown-body li {
  margin-bottom: 4px;
}

.markdown-body a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition-fast);
}

.markdown-body a:hover {
  border-bottom-color: var(--accent);
}

.markdown-body blockquote {
  border-left: 3px solid var(--accent-dim);
  padding-left: 16px;
  color: var(--text-secondary);
  margin: 12px 0;
}

.markdown-body table {
  border-collapse: collapse;
  margin: 12px 0;
  width: 100%;
}

.markdown-body th, .markdown-body td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
}

.markdown-body th {
  background: var(--bg-surface);
  font-weight: 600;
}

.markdown-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}


/* ═══════════════════════════════════════════════════════════════
   TOOL CARDS
   ═══════════════════════════════════════════════════════════════ */
.tool-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin: 12px 0;
  overflow: hidden;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  contain: content;
}

.tool-card:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.tool-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--orange);
  user-select: none;
  transition: background var(--transition-fast);
}

.tool-card-header:hover {
  background: var(--bg-hover);
}

.tool-card-header .arrow {
  transition: transform var(--transition-med);
  font-size: 10px;
  opacity: 0.6;
}

.tool-card.open .arrow {
  transform: rotate(90deg);
}

.tool-card-header .tool-name {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-secondary);
}

.tool-card-header .tool-status {
  margin-left: auto;
  font-size: 11px;
  font-weight: 500;
}

.tool-card-body {
  display: none;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  max-height: 350px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.5;
  background: var(--bg);
}

.tool-card.open .tool-card-body {
  display: block;
  animation: expandBody 0.2s ease-out;
}

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

.tool-card-body .tool-input {
  color: var(--text-dim);
  margin-bottom: 4px;
}

.tool-card-body .tool-output {
  color: var(--text);
}


/* ═══════════════════════════════════════════════════════════════
   STATUS PILL & DONE MESSAGE
   ═══════════════════════════════════════════════════════════════ */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  margin: 6px 0;
}

.status-pill-retry {
  margin-left: 8px;
  padding: 2px 10px;
  border-radius: 10px;
  border: 1px solid var(--red);
  background: transparent;
  color: var(--red);
  font-size: 11px;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.status-pill-retry:hover {
  background: var(--red);
  color: #fff;
}

.msg-done {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-dim);
  padding: 8px 0;
  border-top: 1px solid var(--border-subtle);
  margin-top: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.done-metric {
  color: var(--text-dim);
}

.done-sep {
  margin: 0 8px;
  color: var(--border);
  font-weight: 400;
}

/* Tab metrics badge */
.tab-metrics {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-dim);
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 4px;
  white-space: nowrap;
  cursor: default;
}


/* ═══════════════════════════════════════════════════════════════
   INPUT BAR
   ═══════════════════════════════════════════════════════════════ */
#input-bar {
  padding: 16px 24px 20px;
  background: linear-gradient(to top, var(--bg-raised) 0%, var(--bg-raised) 80%, transparent 100%);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

#input-wrapper {
  display: flex;
  gap: 0;
  align-items: flex-end;
  max-width: var(--content-max);
  margin: 0 auto;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 4px 4px 4px 8px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: var(--shadow-md);
}

#input-wrapper:focus-within {
  border-color: var(--accent-dim);
  box-shadow: var(--shadow-md), 0 0 0 3px var(--accent-glow);
}

#prompt-input {
  flex: 1;
  resize: none;
  padding: 10px 4px;
  background: transparent;
  color: var(--text);
  border: none;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  max-height: 200px;
  overflow: hidden;
  outline: none;
}

#prompt-input::placeholder {
  color: var(--text-dim);
}

.input-actions {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding-bottom: 2px;
}

#btn-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: var(--accent-dim);
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition-fast);
}

#btn-send:hover {
  background: var(--accent);
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

#btn-send:active {
  transform: scale(0.97);
}

#btn-abort {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(248, 113, 113, 0.2);
  border-radius: 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
  white-space: nowrap;
  transition: all var(--transition-fast);
}

#btn-abort:hover {
  background: rgba(248, 113, 113, 0.2);
  border-color: rgba(248, 113, 113, 0.3);
}


/* ═══════════════════════════════════════════════════════════════
   TOPBAR ICON BUTTONS (Task #5 + #6)
   ═══════════════════════════════════════════════════════════════ */
.topbar-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  background: var(--bg);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.topbar-icon-btn:hover {
  color: var(--text-bright);
  background: var(--bg-hover);
  border-color: var(--text-dim);
}

.topbar-icon-btn.active {
  color: var(--accent);
  background: var(--accent-surface);
  border-color: var(--accent-dim);
}


/* ═══════════════════════════════════════════════════════════════
   SIDEBAR (Task #5 + #6)
   ═══════════════════════════════════════════════════════════════ */
#sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--sidebar-width);
  height: 100%;
  background: var(--bg-raised);
  border-left: 1px solid var(--border);
  z-index: 20;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
}

/* Sidebar resize handle */
.sidebar-resize-handle {
  position: absolute;
  left: -3px;
  top: 0;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  z-index: 25;
  background: transparent;
  transition: background 0.15s;
}
.sidebar-resize-handle:hover,
.sidebar-resize-handle.dragging {
  background: var(--accent);
  opacity: 0.5;
}
@media (max-width: 768px) {
  .sidebar-resize-handle { display: none; }
}

/* Sidebar header with tabs */
.sidebar-header {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  padding: 0;
  padding-top: 8px;
}

.sidebar-tabs {
  display: flex;
  flex: 1;
  gap: 0;
}

.sidebar-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

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

/* Sidebar content */
.sidebar-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sidebar-panel {
  display: none;
  padding: 12px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.sidebar-panel.active {
  display: block;
  animation: fadeInPanel 0.15s ease-out;
}

.sidebar-empty {
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
  padding: 24px 16px;
}

.sidebar-loading {
  animation: pulse-loading 1.2s ease-in-out infinite;
}

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

/* ─── Sidebar sections ─── */
.sidebar-section {
  margin-bottom: 16px;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  padding: 0 4px 6px;
  border-bottom: none;
  margin-bottom: 6px;
}

.sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ─── History items (Task #5) ─── */
.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}

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

.history-item-info {
  flex: 1;
  min-width: 0;
}

.history-item-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item-meta {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.history-item-status {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.history-item-status.active {
  background: var(--green);
}

.history-item-status.closed {
  background: var(--text-dim);
}

.history-item-reopen {
  padding: 4px 10px;
  background: var(--accent-surface);
  color: var(--accent);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.history-item-reopen:hover {
  background: var(--accent-dim);
  color: #fff;
}

/* ─── MCP Servers (Task #6) ─── */
.mcp-server-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

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

.mcp-server-dot.connected {
  background: var(--green);
  box-shadow: 0 0 6px rgba(52, 211, 153, 0.4);
}

.mcp-server-dot.failed {
  background: var(--red);
  box-shadow: 0 0 6px rgba(248, 113, 113, 0.4);
}

.mcp-server-dot.pending {
  background: var(--orange);
  box-shadow: 0 0 6px rgba(251, 191, 36, 0.4);
  animation: pulse-dot 2s ease-in-out infinite;
}

.mcp-server-name {
  color: var(--text);
  font-weight: 500;
}

.mcp-server-status-text {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-dim);
}

/* ─── Tool list items (Task #6) ─── */
.tool-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

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

.tool-list-name {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tool-list-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-surface);
  padding: 1px 7px;
  border-radius: 10px;
  flex-shrink: 0;
}

/* ─── Tool group headers ─── */
.tool-group-header {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  padding: 8px 12px 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}


/* ═══════════════════════════════════════════════════════════════
   FILE ATTACHMENTS & DRAG-DROP (Task #7)
   ═══════════════════════════════════════════════════════════════ */

/* Attachments preview bar */
#attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: var(--content-max);
  margin: 0 auto 8px;
  padding: 8px 4px;
}

.attachment-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.attachment-item:hover {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.attachment-thumb {
  width: 60px;
  height: 60px;
  object-fit: cover;
  display: block;
  border-radius: var(--radius-sm);
}

.attachment-file-badge {
  padding: 8px 12px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  background: rgba(0, 0, 0, 0.7);
  color: var(--text);
  border: none;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-fast), background var(--transition-fast);
}

.attachment-item:hover .attachment-remove {
  opacity: 1;
}

.attachment-remove:hover {
  background: var(--red);
  color: #fff;
}

/* Drag-over glow on input wrapper */
#input-wrapper.drag-over {
  border-color: var(--accent);
  box-shadow: var(--shadow-md), 0 0 0 3px var(--accent-glow), 0 0 20px rgba(99, 102, 241, 0.15);
}


/* ═══════════════════════════════════════════════════════════════
   UTILITY CLASSES
   ═══════════════════════════════════════════════════════════════ */
.hidden { display: none !important; }


/* ═══════════════════════════════════════════════════════════════
   SCROLLBAR
   ═══════════════════════════════════════════════════════════════ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}


/* ═══════════════════════════════════════════════════════════════
   SETTINGS PANEL (Task #3)
   ═══════════════════════════════════════════════════════════════ */
.settings-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 260px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  overflow: hidden;
  animation: fadeInPanel 0.15s ease-out;
}

.settings-header {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}

.settings-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

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

.settings-label select,
.settings-label input {
  padding: 6px 10px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.settings-label select:focus,
.settings-label input:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.settings-label select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.settings-label select option {
  background: var(--bg-raised);
  color: var(--text);
}

.settings-label input[type="number"] {
  font-family: var(--font-mono);
  font-size: 12px;
}


/* ═══════════════════════════════════════════════════════════════
   MINIMAP (Sidebar Overview)
   ═══════════════════════════════════════════════════════════════ */
.minimap-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
}

.minimap-entry {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 8px 5px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
  font-size: 12px;
  color: var(--text-secondary);
  position: relative;
  border-left: 2px solid var(--border-subtle);
  margin-left: 8px;
}

.minimap-entry:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-left-color: var(--accent);
}

.minimap-entry.nested {
  margin-left: 24px;
  font-size: 11px;
  padding: 3px 8px 3px 10px;
  opacity: 0.85;
}

.minimap-entry-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  border-radius: 4px;
  font-weight: 700;
}

.minimap-entry-icon.user { background: var(--accent-surface); color: var(--accent); }
.minimap-entry-icon.queued { background: var(--orange-dim); color: var(--orange); }
.minimap-entry-icon.assistant { background: var(--green-dim); color: var(--green); }
.minimap-entry-icon.tool { background: var(--orange-dim); color: var(--orange); }
.minimap-entry-icon.system { background: var(--bg-surface); color: var(--text-dim); }

.minimap-entry.minimap-queued {
  opacity: 0.6;
}
.minimap-entry.minimap-queued .minimap-entry-text {
  font-style: italic;
}

.minimap-entry-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.minimap-entry-time {
  flex-shrink: 0;
  font-size: 9px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  min-width: 42px;
  text-align: right;
}

.minimap-day-separator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.minimap-day-separator::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}


/* ═══════════════════════════════════════════════════════════════
   TOOL SPINNER
   ═══════════════════════════════════════════════════════════════ */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.tool-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}


/* ═══════════════════════════════════════════════════════════════
   TOOL CARD DESCRIPTION PREVIEW
   ═══════════════════════════════════════════════════════════════ */
.tool-desc-preview {
  font-size: 11px;
  color: var(--text-dim);
  margin-left: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
  flex: 1;
}


/* ═══════════════════════════════════════════════════════════════
   OVERVIEW SIDEBAR — UNIFIED COLLAPSIBLE SECTIONS
   ═══════════════════════════════════════════════════════════════ */

/* All overview sections: consistent collapsible style */
#sidebar-overview .sidebar-section {
  border-bottom: none;
}
#sidebar-overview .collapsible-body {
  max-height: 200px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Active Tasks */
.active-tasks-list {
  padding: 0;
}
.active-task-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 20px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast);
}
.active-task-item:hover {
  background: var(--bg-hover);
}
.active-task-item.expanded .active-task-details {
  display: block;
}
.active-task-details {
  display: none;
  padding: 4px 12px 8px 36px;
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  max-height: 100px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.active-task-item .tool-spinner {
  flex-shrink: 0;
}
.active-task-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.active-task-time {
  font-size: 10px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.sidebar-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 8px;
  padding: 0 4px;
  margin-left: 4px;
}


/* ═══════════════════════════════════════════════════════════════
   FOLDER PICKER MODAL
   ═══════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay.hidden { display: none; }

.modal-content {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 500px;
  max-width: 700px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

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

.modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-bright);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

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

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

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}

.btn-primary {
  padding: 8px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

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

.btn-secondary {
  padding: 8px 20px;
  background: var(--bg);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
}

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

.folder-path-input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-mono);
  margin-bottom: 12px;
  box-sizing: border-box;
}

.folder-path-input:focus {
  border-color: var(--accent-dim);
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.folder-tree {
  max-height: 400px;
  overflow-y: auto;
}

.folder-tree-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
  transition: background var(--transition-fast);
}

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

.folder-tree-item .folder-icon {
  color: var(--orange);
  flex-shrink: 0;
}

.folder-tree-item .folder-arrow {
  width: 16px;
  text-align: center;
  color: var(--text-dim);
  font-size: 10px;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.folder-tree-item .folder-arrow.expanded {
  transform: rotate(90deg);
}

.folder-tree-children {
  padding-left: 20px;
}

.cwd-browse-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.cwd-browse-btn:hover {
  color: var(--accent);
  border-color: var(--accent-dim);
  background: var(--accent-surface);
}


/* ═══════════════════════════════════════════════════════════════
   SESSION CREATION MODAL
   ═══════════════════════════════════════════════════════════════ */
.session-modal { width: 500px; min-width: auto; }

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

.modal-form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.modal-form-group input,
.modal-form-group select,
.modal-form-group textarea {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  box-sizing: border-box;
}

.modal-form-group input:focus,
.modal-form-group select:focus,
.modal-form-group textarea:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.modal-form-group select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.modal-form-group select option {
  background: var(--bg-raised);
  color: var(--text);
}

.modal-form-group textarea {
  font-family: var(--font-mono);
  font-size: 12px;
  resize: vertical;
  min-height: 60px;
}

.modal-cwd-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.modal-cwd-row input { flex: 1; }

.modal-advanced {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0;
}

.modal-advanced summary {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}

.modal-advanced summary:hover {
  color: var(--text);
}

.modal-advanced > .modal-form-group {
  padding: 0 12px 12px;
}


/* ═══════════════════════════════════════════════════════════════
   OVERVIEW NESTED COLLAPSE
   ═══════════════════════════════════════════════════════════════ */
.minimap-nested-group { overflow: hidden; }
.minimap-nested-group.collapsed { display: none; }
.minimap-expand-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 16px;
  font-size: 10px;
  font-weight: 700;
  background: var(--orange-dim);
  color: var(--orange);
  border-radius: 8px;
  padding: 0 5px;
  margin-left: auto;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}
.minimap-expand-toggle:hover { background: var(--orange); color: #fff; }


/* ═══════════════════════════════════════════════════════════════
   HISTORY DAY SEPARATOR
   ═══════════════════════════════════════════════════════════════ */
.history-day-separator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.history-day-separator::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}


/* ═══════════════════════════════════════════════════════════════
   FILE EXPLORER TREE
   ═══════════════════════════════════════════════════════════════ */
.file-explorer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 8px;
}
.file-explorer {
  max-height: 300px;
  overflow-y: auto;
}
.file-tree-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}
.file-tree-item:hover { background: var(--bg-hover); }
.file-tree-item.is-dir { color: var(--text); font-weight: 500; }
.file-tree-children { padding-left: 16px; }
.file-ext-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--bg-active);
  color: var(--text-dim);
  text-transform: uppercase;
}
.file-size {
  font-size: 10px;
  color: var(--text-dim);
  margin-left: auto;
}


/* ═══════════════════════════════════════════════════════════════
   UPLOAD BUTTON
   ═══════════════════════════════════════════════════════════════ */
.upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  color: var(--text-dim);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  align-self: center;
  margin-top: -2px;
  transition: all var(--transition-fast);
}
.upload-btn:hover { color: var(--accent); background: var(--accent-surface); }


/* ═══════════════════════════════════════════════════════════════
   FILES / ATTACHMENTS PANEL
   ═══════════════════════════════════════════════════════════════ */
.file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast);
}

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

.file-item-actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.file-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 10px;
  transition: all var(--transition-fast);
}

.file-action-btn:hover {
  color: var(--accent);
  border-color: var(--accent-dim);
}

.file-item-thumb {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

.file-item-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

.file-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* ═══════════════════════════════════════════════════════════════
   OVERVIEW STATS & SCROLL-TO-BOTTOM (v0.4.1)
   ═══════════════════════════════════════════════════════════════ */
#sidebar-overview {
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

#sidebar-overview.active {
  display: flex;
}

#sidebar-overview .minimap-list {
  max-height: 300px;
  overflow-y: auto;
}

.overview-stats {
  padding: 8px 16px;
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.overview-stats:empty {
  display: none;
}

.overview-stats-header {
  border-top: 1px solid var(--border);
}

.overview-stats-id {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 10px;
  color: var(--text-dim);
  background: var(--bg-secondary);
  padding: 1px 6px;
  border-radius: 3px;
  cursor: default;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stats-id-value {
  font-family: 'SF Mono', 'Fira Code', monospace;
  cursor: pointer;
}

.stats-id-value:hover {
  color: var(--accent);
}

.stats-id-copyable {
  font-family: var(--font-mono);
  font-size: 10px;
  cursor: pointer;
  word-break: break-all;
  max-width: none;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.3;
}

.stats-id-copyable:hover {
  color: var(--accent);
}

.stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stats-label {
  color: var(--text-secondary);
}

.stats-value {
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.stats-model-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
}

.stats-model-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--accent-surface);
  color: var(--accent);
}

.overview-bottom-controls {
  position: sticky;
  bottom: 0;
  display: flex;
  border-top: 1px solid var(--border);
  background: var(--bg-raised);
}

.overview-ctrl-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.overview-ctrl-btn:hover {
  color: var(--accent);
  background: var(--bg-hover);
}

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

.overview-ctrl-btn + .overview-ctrl-btn {
  border-left: 1px solid var(--border);
}

/* Collapse-by-day: day separators become clickable toggles */
.minimap-day-separator.collapsible {
  cursor: pointer;
  user-select: none;
}

.minimap-day-separator.collapsible::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--text-dim);
  transition: transform 0.15s ease;
  margin-right: 2px;
}

.minimap-day-separator.collapsed::before {
  transform: rotate(-90deg);
}

.minimap-day-group.collapsed .minimap-entry,
.minimap-day-group.collapsed .minimap-nested-group,
.minimap-day-group.collapsed .minimap-load-more {
  display: none;
}


/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */
.sidebar-toggle-btn { display: none; }

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 15;
  opacity: 0;
  transition: opacity var(--transition-med);
}
.sidebar-overlay.visible { opacity: 1; }

@media (max-width: 768px) {
  body { padding-right: 0 !important; }

  #sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    right: auto;
    width: 280px;
    height: 100vh;
    height: 100dvh;
    z-index: 1000;
    transition: left 0.3s ease;
    display: flex;
    transform: none;
    pointer-events: auto;
    opacity: 1;
    border-left: none;
    border-right: 1px solid var(--border);
  }

  #sidebar.mobile-open {
    left: 0;
  }

  .sidebar-resize-handle { display: none !important; }

  .sidebar-overlay {
    z-index: 999;
  }

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

  #topbar { padding: 0 12px; gap: 8px; }
  .topbar-brand { display: none; }
  .topbar-divider { display: none; }

  #conversation { padding: 16px 12px; }
  #input-bar { padding: 12px; }
  .msg-user { max-width: 90%; }
  #input-wrapper { border-radius: var(--radius-lg); }

  .modal-content { min-width: auto; width: 95vw; max-width: 95vw; }

  /* Terminal: fullscreen on mobile */
  .terminal-panel {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100vw;
    height: 100vh; /* fallback for older browsers */
    height: 100dvh; /* dynamic viewport height — accounts for mobile address bar */
    z-index: 200;
    border-top: none;
    border-radius: 0;
    display: flex;
    flex-direction: column;
  }
  .terminal-panel .terminal-container {
    flex: 1;
    min-height: 0; /* allow flex shrink */
    overflow: hidden;
  }
  .terminal-header {
    padding: 10px 14px;
    padding-top: max(10px, env(safe-area-inset-top, 0px));
    min-height: 48px;
    flex-shrink: 0;
  }
  .terminal-close {
    font-size: 26px;
    padding: 4px 10px;
    min-width: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    -webkit-tap-highlight-color: transparent;
  }
  .terminal-close:hover,
  .terminal-close:active {
    background: rgba(239, 68, 68, 0.25);
    color: var(--red);
  }
  .terminal-title {
    font-size: 14px;
  }
  /* Hide everything else when terminal is open on mobile */
  body:has(.terminal-panel:not(.hidden)) #conversation,
  body:has(.terminal-panel:not(.hidden)) #input-bar,
  body:has(.terminal-panel:not(.hidden)) #topbar,
  body:has(.terminal-panel:not(.hidden)) #tab-bar-wrapper,
  body:has(.terminal-panel:not(.hidden)) .sidebar,
  body:has(.terminal-panel:not(.hidden)) #empty-state,
  body:has(.terminal-panel:not(.hidden)) .todo-tasks-container {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .topbar-left { gap: 8px; }
  #btn-new { padding: 7px 10px; font-size: 12px; }
  .brand-text { display: none; }
}

/* ─── AskUserQuestion Cards ──────────────────────────────────── */

.question-card {
  background: var(--bg-surface);
  border: 1px solid var(--accent-dim);
  border-radius: 12px;
  padding: 16px 18px;
  margin: 12px 0;
  animation: fadeIn 0.3s ease-out;
}

.question-card.answered {
  border-color: var(--border);
  opacity: 0.75;
}

.question-card-icon {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 14px;
}

.question-card-icon svg {
  color: var(--accent);
  flex-shrink: 0;
}

.question-block {
  margin-bottom: 16px;
}

.question-block:last-of-type {
  margin-bottom: 12px;
}

.question-header {
  display: inline-block;
  background: var(--accent-dim);
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
}

.question-text {
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.5;
  margin-bottom: 10px;
}

.question-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.question-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
}

.question-option:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--accent-dim);
}

.question-option.selected {
  background: rgba(99, 102, 241, 0.12);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-dim);
}

.question-option:disabled {
  cursor: default;
  opacity: 0.6;
}

.option-label {
  font-weight: 500;
  color: var(--text);
}

.question-option.selected .option-label {
  color: var(--accent);
}

.option-desc {
  font-size: 11.5px;
  color: var(--text-dim);
  margin-top: 2px;
  line-height: 1.4;
}

.question-other {
  margin-top: 6px;
}

.question-other-input {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition-fast);
}

.question-other-input:focus {
  border-color: var(--accent-dim);
}

.question-other-input:disabled {
  opacity: 0.5;
}

.question-submit {
  display: block;
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-top: 4px;
}

.question-submit:hover:not(:disabled) {
  background: var(--accent-dim);
}

.question-submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.question-answered-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--success);
}

.answered-check {
  font-size: 14px;
  font-weight: 700;
}


/* ═══════════════════════════════════════════════════════════════
   DROP OVERLAY (v0.3)
   ═══════════════════════════════════════════════════════════════ */
#drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease-out;
}

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

.drop-overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: var(--accent);
  font-size: 18px;
  font-weight: 600;
  padding: 48px;
  border: 2px dashed var(--accent-dim);
  border-radius: var(--radius-xl);
  background: var(--accent-surface);
}

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


/* ─── Tab rename input (v0.3) ─── */
.tab-rename-input {
  background: var(--bg);
  color: var(--text-bright);
  border: 1px solid var(--accent-dim);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  outline: none;
  width: 120px;
  box-shadow: 0 0 0 2px var(--accent-glow);
}


/* ─── Login Overlay ─────────────────────────────────────────── */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 30% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
              radial-gradient(ellipse at 70% 80%, rgba(168, 85, 247, 0.1) 0%, transparent 50%),
              var(--bg);
  overflow: hidden;
}

.login-overlay.hidden {
  display: none;
}

/* Floating particles */
.login-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.login-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  animation: login-float 8s ease-in-out infinite;
}

.login-particle:nth-child(1) { left: 10%; animation-delay: 0s; animation-duration: 7s; }
.login-particle:nth-child(2) { left: 25%; animation-delay: 1.5s; animation-duration: 9s; }
.login-particle:nth-child(3) { left: 40%; animation-delay: 3s; animation-duration: 6s; }
.login-particle:nth-child(4) { left: 55%; animation-delay: 0.5s; animation-duration: 10s; }
.login-particle:nth-child(5) { left: 70%; animation-delay: 2s; animation-duration: 8s; }
.login-particle:nth-child(6) { left: 85%; animation-delay: 4s; animation-duration: 7.5s; }
.login-particle:nth-child(7) { left: 15%; animation-delay: 5s; animation-duration: 9s; width: 3px; height: 3px; }
.login-particle:nth-child(8) { left: 60%; animation-delay: 3.5s; animation-duration: 11s; width: 5px; height: 5px; }

@keyframes login-float {
  0%   { bottom: -10%; opacity: 0; transform: translateX(0) scale(1); }
  10%  { opacity: 0.6; }
  50%  { opacity: 0.3; transform: translateX(30px) scale(1.2); }
  90%  { opacity: 0.5; }
  100% { bottom: 110%; opacity: 0; transform: translateX(-20px) scale(0.8); }
}

/* Animated ring behind logo */
.login-ring {
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 1px solid rgba(99, 102, 241, 0.15);
  animation: login-ring-pulse 4s ease-in-out infinite;
  pointer-events: none;
}

.login-ring:nth-child(2) {
  width: 280px;
  height: 280px;
  animation-delay: 1s;
  border-color: rgba(168, 85, 247, 0.1);
}

@keyframes login-ring-pulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50%      { transform: scale(1.1); opacity: 0.2; }
}

.login-box {
  background: rgba(18, 18, 26, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 20px;
  padding: 48px 40px;
  width: 380px;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 0 40px rgba(99, 102, 241, 0.08);
  animation: login-entrance 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
  position: relative;
  z-index: 1;
}

@keyframes login-entrance {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-brand {
  margin-bottom: 32px;
  position: relative;
}

.login-brand svg {
  color: var(--accent);
  margin-bottom: 12px;
  filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.4));
  animation: login-icon-float 3s ease-in-out infinite;
}

.login-brand svg path {
  stroke: url(#login-icon-gradient);
}

@keyframes login-icon-float {
  0%, 100% {
    filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.4));
    transform: translateY(0);
  }
  50% {
    filter: drop-shadow(0 0 18px rgba(99, 102, 241, 0.6));
    transform: translateY(-3px);
  }
}

/* Typing dots inside the login chat bubble */
.login-typing-dots {
  display: flex;
  gap: 5px;
  justify-content: center;
  margin-top: -8px;
  margin-bottom: 10px;
}

.login-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.4;
  animation: login-typing-bounce 1.4s ease-in-out infinite;
}

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

@keyframes login-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-6px); opacity: 1; }
}

.login-brand h2 {
  font-size: 22px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent) 0%, #a78bfa 50%, var(--accent) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: login-title-shimmer 4s linear infinite;
  margin: 0;
}

@keyframes login-title-shimmer {
  0%   { background-position: 0% center; }
  100% { background-position: 200% center; }
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 6px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-form input {
  padding: 12px 16px;
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 10px;
  background: rgba(10, 10, 15, 0.6);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.login-form .btn-primary {
  background: linear-gradient(135deg, var(--accent-dim), #7c3aed);
  border: none;
  padding: 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.login-form .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

.login-form .btn-primary:active {
  transform: translateY(0);
}

.login-error {
  margin-top: 12px;
  color: #f87171;
  font-size: 13px;
  animation: login-shake 0.4s ease;
}

@keyframes login-shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-6px); }
  75%      { transform: translateX(6px); }
}

/* ─── Login: Light Theme Overrides ─────────────────────────── */
[data-theme="light"] .login-overlay {
  background: radial-gradient(ellipse at 30% 20%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
              radial-gradient(ellipse at 70% 80%, rgba(168, 85, 247, 0.08) 0%, transparent 50%),
              var(--bg);
}

[data-theme="light"] .login-particle {
  background: var(--accent-dim);
  opacity: 0;
}

[data-theme="light"] .login-ring {
  border-color: rgba(99, 102, 241, 0.2);
}
[data-theme="light"] .login-ring:nth-child(2) {
  border-color: rgba(168, 85, 247, 0.15);
}

[data-theme="light"] .login-box {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(99, 102, 241, 0.18);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1), 0 0 40px rgba(99, 102, 241, 0.06);
}

[data-theme="light"] .login-brand svg {
  filter: drop-shadow(0 0 6px rgba(99, 102, 241, 0.25));
}

[data-theme="light"] .login-typing-dots span {
  background: #6366f1;
}

[data-theme="light"] .brand-icon {
  filter: drop-shadow(0 0 2px rgba(99, 102, 241, 0.2));
}

[data-theme="light"] .brand-icon.connected {
  filter: drop-shadow(0 0 3px rgba(34, 197, 94, 0.3));
}

[data-theme="light"] .login-subtitle {
  color: var(--text-dim);
}

[data-theme="light"] .login-form input {
  background: rgba(241, 245, 249, 0.8);
  border-color: #d1d5db;
  color: var(--text);
}

[data-theme="light"] .login-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

[data-theme="light"] .login-form .btn-primary {
  background: linear-gradient(135deg, #6366f1, #7c3aed);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

[data-theme="light"] .login-form .btn-primary:hover {
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

[data-theme="light"] .login-error {
  color: #dc2626;
}


/* ─── Toast Notification (Stacking) ────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  z-index: 10000;
  pointer-events: none;
}

.toast-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: inherit;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  pointer-events: auto;
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.3s, transform 0.3s;
  max-width: 380px;
}

.toast-item.show {
  opacity: 1;
  transform: translateX(0);
}

.toast-item.removing {
  opacity: 0;
  transform: translateX(40px);
}

.toast-message { flex: 1; }

.toast-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  flex-shrink: 0;
  transition: color var(--transition-fast);
}
.toast-close:hover { color: var(--text); }

.toast-item.toast-warning {
  border-color: var(--orange);
  background: color-mix(in srgb, var(--orange) 10%, var(--bg-surface));
}

.toast-item.toast-error {
  border-color: var(--red);
  background: color-mix(in srgb, var(--red) 10%, var(--bg-surface));
}

.toast-item.toast-success {
  border-color: var(--green);
  background: color-mix(in srgb, var(--green) 10%, var(--bg-surface));
}

[data-theme="light"] .toast-item {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}
[data-theme="light"] .toast-item.toast-warning {
  background: color-mix(in srgb, var(--orange) 8%, #ffffff);
}
[data-theme="light"] .toast-item.toast-error {
  background: color-mix(in srgb, var(--red) 8%, #ffffff);
}
[data-theme="light"] .toast-item.toast-success {
  background: color-mix(in srgb, var(--green) 8%, #ffffff);
}


/* ─── File Path Links ───────────────────────────────────────── */
.file-path-link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed var(--accent);
  cursor: pointer;
  padding: 0 2px;
  border-radius: 2px;
  transition: background 0.15s;
}

.file-path-link:hover {
  background: rgba(129, 140, 248, 0.15);
}


/* ═══════════════════════════════════════════════════════════════
   LIGHT THEME (v0.3)
   ═══════════════════════════════════════════════════════════════ */
[data-theme="light"] {
  --bg:            #f8f9fb;
  --bg-raised:     #ffffff;
  --bg-surface:    #f1f3f5;
  --bg-hover:      #e9ecef;
  --bg-active:     #dee2e6;
  --bg-overlay:    rgba(255, 255, 255, 0.5);

  --border:        #d1d5db;
  --border-subtle: #e5e7eb;
  --border-focus:  #6366f1;

  --text:          #111827;
  --text-secondary:#374151;
  --text-dim:      #6b7280;
  --text-bright:   #030712;

  --accent:        #6366f1;
  --accent-dim:    #4f46e5;
  --accent-glow:   rgba(99, 102, 241, 0.12);
  --accent-surface:rgba(99, 102, 241, 0.06);

  --green:         #16a34a;
  --green-dim:     rgba(22, 163, 74, 0.1);
  --orange:        #d97706;
  --orange-dim:    rgba(217, 119, 6, 0.1);
  --red:           #dc2626;
  --red-dim:       rgba(220, 38, 38, 0.08);

  --shadow-sm:     0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md:     0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg:     0 8px 32px rgba(0, 0, 0, 0.1);
  --shadow-glow:   0 0 20px rgba(99, 102, 241, 0.06);
}

[data-theme="light"] .msg-user {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}

[data-theme="light"] .markdown-body pre {
  background: #f1f3f5;
  border-color: #dee2e6;
}

[data-theme="light"] .markdown-body :not(pre) > code {
  background: rgba(99, 102, 241, 0.08);
}

[data-theme="light"] .brand-text {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: #cbd5e1;
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

[data-theme="light"] #sidebar {
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .tool-card-body {
  background: #f1f3f5;
}

[data-theme="light"] #drop-overlay {
  background: rgba(248, 249, 251, 0.9);
}

[data-theme="light"] .modal-content {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .minimap-entry {
  border-left-color: #dee2e6;
}
[data-theme="light"] .minimap-entry:hover {
  background: #e9ecef;
  border-left-color: var(--accent);
}
[data-theme="light"] .active-task-details {
  background: #f1f3f5;
}

[data-theme="light"] .folder-tree-item:hover {
  background: #e9ecef;
}


/* ═══════════════════════════════════════════════════════════════
   SEARCH BAR (v0.3)
   ═══════════════════════════════════════════════════════════════ */
#search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#search-input {
  flex: 1;
  max-width: 300px;
  padding: 6px 10px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color var(--transition-fast);
}

#search-input:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

#search-count {
  font-size: 12px;
  color: var(--text-dim);
  min-width: 40px;
  text-align: center;
}

.search-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--bg);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  transition: all var(--transition-fast);
}

.search-nav-btn:hover {
  color: var(--text-bright);
  background: var(--bg-hover);
  border-color: var(--text-dim);
}

mark.search-highlight {
  background: rgba(251, 191, 36, 0.3);
  color: inherit;
  border-radius: 2px;
  padding: 1px 0;
}

mark.search-highlight.search-active {
  background: rgba(251, 191, 36, 0.6);
  outline: 2px solid var(--orange);
  outline-offset: 1px;
}


/* ─── Queued message (v0.3) ─── */
.msg-queued {
  opacity: 0.5;
  position: relative;
}

.msg-queued::after {
  content: "queued";
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  background: var(--bg-surface);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
}


/* ─── Settings textarea (v0.3) ─── */
.settings-label textarea {
  padding: 6px 10px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--font-mono);
  outline: none;
  resize: vertical;
  min-height: 60px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.settings-label textarea:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 2px var(--accent-glow);
}


/* ═══════════════════════════════════════════════════════════════
   GIT STATUS IN FILE EXPLORER
   ═══════════════════════════════════════════════════════════════ */
.git-status-section {
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.git-status-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
}

.git-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.git-badge.clean {
  background: var(--green-dim);
  color: var(--green);
}

.git-badge.dirty {
  background: var(--orange-dim);
  color: var(--orange);
}

.git-diff-toggle {
  margin-left: auto;
  font-size: 12px !important;
  font-weight: 700;
}

.git-diff-pre {
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.4;
  padding: 8px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text-dim);
  margin: 4px 8px;
}


/* ═══════════════════════════════════════════════════════════════
   COLLAPSIBLE SECTION TITLE
   ═══════════════════════════════════════════════════════════════ */
.collapsible-title {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.collapsible-title:hover {
  color: var(--text);
}


/* ═══════════════════════════════════════════════════════════════
   FILE TREE HOVER ACTIONS
   ═══════════════════════════════════════════════════════════════ */
.file-tree-item:not(.is-dir):hover {
  background: var(--bg-hover);
  color: var(--text);
}

.file-tree-item:not(.is-dir) {
  cursor: pointer;
}

[data-theme="light"] .git-diff-pre {
  background: #f1f3f5;
}

[data-theme="light"] .git-badge.clean {
  background: rgba(22, 163, 74, 0.08);
}

[data-theme="light"] .git-badge.dirty {
  background: rgba(217, 119, 6, 0.08);
}

/* ─── Collapsible section animation ─── */
.collapsed-section {
  max-height: 0 !important;
  overflow: hidden !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  transition: max-height 0.2s ease;
}

.collapse-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-size: 10px;
  flex-shrink: 0;
  color: var(--text-dim);
  transition: transform 0.15s ease, color 0.15s;
  line-height: 1;
}

.collapse-arrow.collapsed {
  transform: rotate(-90deg);
}

/* File explorer inside settings: constrain height */
.settings-section .file-explorer {
  max-height: 300px;
  overflow-y: auto;
}


/* ─── Thinking Indicator ──────────────────────────────────── */
.thinking-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin: 8px 0;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  animation: fadeInMsg 0.25s ease-out;
}

.thinking-dots {
  display: flex;
  gap: 4px;
}

.thinking-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: thinking-bounce 1.4s ease-in-out infinite;
}

.thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.thinking-dot:nth-child(3) { animation-delay: 0.4s; }

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

.thinking-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.thinking-timer {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}


/* ─── Floating scroll-to-bottom button ─── */
.scroll-to-bottom-btn {
  position: sticky;
  bottom: 16px;
  float: right;
  margin-top: -44px;
  margin-right: 8px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s, background 0.15s;
  z-index: 5;
  pointer-events: none;
}

.scroll-to-bottom-btn.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.scroll-to-bottom-btn:hover {
  background: var(--bg-hover);
  color: var(--accent);
  border-color: var(--accent-dim);
}

.scroll-to-bottom-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

.scroll-to-bottom-btn.has-new .scroll-to-bottom-badge {
  display: flex;
  animation: pulse-dot 1.5s ease-in-out infinite;
}

.new-content-dot {
  display: none;
}

/* ─── v0.7: Copy code blocks ────────────────────────────── */
.code-copy-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  font-size: 11px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 1;
  font-family: var(--font-sans);
}
pre:hover .code-copy-btn { opacity: 1; }
.code-copy-btn:hover { background: var(--bg-active); color: var(--text); }
.code-copy-btn.copied { color: var(--green); }

/* ─── Code block language header ────────────────────────── */
.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-active);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  padding: 4px 10px;
  font-size: 11px;
}
.code-block-header + pre {
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
  margin-top: 0 !important;
}
.code-lang-label {
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  font-size: 10px;
  color: var(--text-dim);
}
.code-block-header .code-copy-btn {
  position: static;
  opacity: 1;
  background: transparent;
  border: none;
  padding: 2px 6px;
}
.code-block-header .code-copy-btn:hover {
  background: var(--bg-hover);
}
[data-theme="light"] .code-block-header {
  background: #f1f5f9;
  border-color: #e2e8f0;
}
[data-theme="light"] .code-lang-label {
  color: #6b7280;
}
[data-theme="light"] .code-block-header .code-copy-btn {
  color: #64748b;
}
[data-theme="light"] .code-block-header .code-copy-btn:hover {
  background: #e2e8f0;
  color: #334155;
}

/* ─── v0.7: Copy assistant message ──────────────────────── */
.msg-assistant { position: relative; }
.msg-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
  font-size: 12px;
  line-height: 1;
}
.msg-assistant:hover .msg-copy-btn { opacity: 1; }
.msg-copy-btn:hover { background: var(--bg-active); color: var(--text); }

/* ─── v0.7: Collapsible messages ────────────────────────── */
.msg-collapsed .markdown-body {
  max-height: 500px;
  overflow: hidden;
  position: relative;
}
.msg-collapsed .markdown-body::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(transparent, var(--bg-surface));
  pointer-events: none;
}
.msg-expand-btn {
  display: block;
  width: 100%;
  margin-top: 4px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 12px;
  padding: 6px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  text-align: center;
}
.msg-expand-btn:hover { background: var(--accent-surface); }

/* Light theme overrides for v0.7 message features */
[data-theme="light"] .code-copy-btn { background: #f1f5f9; border-color: #e2e8f0; color: #64748b; }
[data-theme="light"] pre:hover .code-copy-btn { opacity: 1; }
[data-theme="light"] .code-copy-btn:hover { background: #e2e8f0; color: #334155; }
[data-theme="light"] .msg-copy-btn { background: #f1f5f9; border-color: #e2e8f0; color: #64748b; }
[data-theme="light"] .msg-copy-btn:hover { background: #e2e8f0; color: #334155; }
[data-theme="light"] .msg-collapsed .markdown-body::after { background: linear-gradient(transparent, #ffffff); }
[data-theme="light"] .msg-expand-btn { border-color: #e2e8f0; }

/* ─── v0.7: Draggable tabs ──────────────────────────────── */
.tab { position: relative; }
.tab.dragging { opacity: 0.4; }
.tab.drag-over-left { box-shadow: -2px 0 0 0 var(--accent); }
.tab.drag-over-right { box-shadow: 2px 0 0 0 var(--accent); }

/* ─── v0.7: Tab unread highlight ────────────────────────── */
.tab.tab-unread { border-bottom: 2px solid var(--accent); }
.tab.tab-unread .tab-label { color: var(--accent); }
.tab.tab-unread::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 24px;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  animation: tab-pulse 2s infinite;
}
@keyframes tab-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ─── v0.7: Slash commands ──────────────────────────────── */
.slash-command-popup {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 4px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.3);
}
.slash-command-item {
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.slash-command-item:last-child { border-bottom: none; }
.slash-command-item:hover,
.slash-command-item.active { background: var(--bg-hover); }
.slash-command-name { font-weight: 500; color: var(--accent); font-family: var(--font-mono); font-size: 13px; }
.slash-command-desc { font-size: 12px; color: var(--text-secondary); }

/* ─── v0.7: Export button ───────────────────────────────── */
.stats-export-btn {
  width: 100%;
  padding: 6px 12px;
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-family: var(--font-sans);
}
.stats-export-btn:hover { background: var(--bg-active); color: var(--text); }

/* Light theme */
[data-theme="light"] .slash-command-popup { background: #fff; border-color: #e2e8f0; box-shadow: 0 -4px 16px rgba(0,0,0,0.1); }
[data-theme="light"] .slash-command-item:hover,
[data-theme="light"] .slash-command-item.active { background: #f1f5f9; }
[data-theme="light"] .stats-export-btn { background: #f1f5f9; border-color: #e2e8f0; }
[data-theme="light"] .stats-export-btn:hover { background: #e2e8f0; }

/* ─── v0.7: Keyboard shortcuts modal ────────────────────── */
.shortcuts-modal { max-width: 480px; }
.shortcuts-grid { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; }
.shortcut-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent);
  padding: 10px 4px 4px;
}
.shortcut-section-label:first-child { padding-top: 0; }
.shortcut-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}
.shortcut-row:hover { background: var(--bg-hover); }
.shortcut-keys { display: flex; align-items: center; gap: 4px; }
.shortcut-keys span { color: var(--text-dim); font-size: 12px; }
.shortcut-desc { color: var(--text-secondary); font-size: 13px; }
kbd {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  min-width: 24px;
  text-align: center;
}

/* ─── v0.7: Subagent tree view ──────────────────────────── */
.agent-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 500;
  margin-right: 4px;
  white-space: nowrap;
}
.agent-badge.explore { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.agent-badge.plan { background: rgba(168, 85, 247, 0.2); color: #c084fc; }
.agent-badge.bash { background: rgba(52, 211, 153, 0.2); color: #34d399; }
.agent-badge.general { background: rgba(148, 163, 184, 0.2); color: #94a3b8; }
.active-task-item.completed { opacity: 0.4; }
.active-task-item.completed .tool-spinner { display: none; }

/* Light theme overrides for v0.7 UX features */
[data-theme="light"] kbd { background: #f1f5f9; border-color: #e2e8f0; color: #334155; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
[data-theme="light"] .shortcut-row:hover { background: #f1f5f9; }
[data-theme="light"] .shortcut-section-label { color: #4f46e5; }

/* ─── v0.8: Thinking Toggle (Feature 7) ──────────────────── */
.thinking-toggle { position: relative; }
.thinking-toggle svg { opacity: 0.45; transition: opacity 0.2s, color 0.2s; }
.thinking-toggle.active svg { opacity: 1; color: var(--accent); }
.thinking-hidden .thinking-indicator { display: none !important; }
.thinking-hidden .thinking-content { display: none !important; }

/* ─── v0.8: Usage Dropdown (Feature 12) ──────────────────── */
.topbar-right { position: relative; }
.usage-dropdown {
  position: absolute;
  top: 100%;
  right: 40px;
  margin-top: 4px;
  min-width: 280px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 1000;
  overflow: hidden;
}
.usage-dropdown-content { padding: 0; }
.usage-section { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.usage-section:last-child { border-bottom: none; }
.usage-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.usage-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  font-size: 13px;
}
.usage-info-label { color: var(--text-dim); }
.usage-info-value { color: var(--text-bright); font-weight: 500; font-variant-numeric: tabular-nums; }
.usage-info-value.usage-cost { color: var(--accent); }
.usage-footer { background: var(--bg-dark); }

/* Light theme overrides for v0.8 */
[data-theme="light"] .usage-dropdown { background: #fff; border-color: #e2e8f0; box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
[data-theme="light"] .usage-footer { background: #f8fafc; }

/* ─── v0.8: @filename Autocomplete Popup (Feature 4) ─────── */
#input-wrapper { position: relative; }
.file-suggestions-popup {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  margin-bottom: 4px;
  max-height: 300px;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.3);
  z-index: 200;
  padding: 4px 0;
}
.file-suggestion-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: background 0.1s;
}
.file-suggestion-item:hover,
.file-suggestion-item.active {
  background: var(--bg-hover, rgba(99, 102, 241, 0.15));
  color: var(--text-bright);
}
.file-suggestion-item svg {
  flex-shrink: 0;
  opacity: 0.6;
}
.file-suggestion-item.active svg { opacity: 1; }
.file-suggestion-empty {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  font-style: italic;
}

/* Light theme overrides for @file autocomplete */
[data-theme="light"] .file-suggestions-popup {
  background: #fff;
  border-color: #e2e8f0;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
}
[data-theme="light"] .file-suggestion-item:hover,
[data-theme="light"] .file-suggestion-item.active {
  background: rgba(99, 102, 241, 0.08);
}

/* ─── v0.8 Feature 11: File Search Bar ─────────────────────────── */
.file-search-bar {
  position: relative;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.file-search-bar input {
  width: 100%;
  padding: 6px 28px 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 12px;
  font-family: var(--font-main);
  outline: none;
  box-sizing: border-box;
}
.file-search-bar input:focus {
  border-color: var(--accent);
}
.file-search-bar input::placeholder {
  color: var(--text-dim);
}
.file-search-clear-btn {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.file-search-clear-btn:hover {
  color: var(--text);
}

/* ─── v0.8 Feature 8: .claude Folder Section ──────────────── */
.claude-folder-section {
  margin-top: 0;
}
.claude-folder-section .sidebar-section-title {
  color: var(--accent);
  font-size: 11px;
}

/* ─── v0.8 Feature 9: Create New File ─────────────────────── */
.new-file-input-container {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}
.new-file-input {
  flex: 1;
  padding: 4px 8px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 12px;
  font-family: var(--font-mono);
  outline: none;
}
.new-file-input::placeholder {
  color: var(--text-dim);
}
.new-file-confirm {
  color: #34d399;
}
.new-file-cancel {
  color: #f87171;
}

/* ─── v0.8 Feature 11: Filtered file nodes ────────────────── */
.filtered-out {
  display: none !important;
}

/* Light theme overrides for v0.8 file explorer features */
[data-theme="light"] .file-search-bar input {
  background: #fff;
  border-color: #e2e8f0;
  color: #334155;
}
[data-theme="light"] .file-search-bar input:focus {
  border-color: var(--accent);
}
[data-theme="light"] .new-file-input {
  background: #fff;
  border-color: var(--accent);
  color: #334155;
}
[data-theme="light"] .new-file-input-container {
  background: #f8fafc;
  border-color: #e2e8f0;
}
/* light theme .claude-folder-section — no border needed after merge into settings */

/* ─── v0.8: File Tab System (Features 1, 2, 3) ──────────── */

/* File tabs in tab bar — visually distinct from session tabs */
.file-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
  background: rgba(20, 184, 166, 0.08);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  position: relative;
}
.file-tab:hover {
  background: rgba(20, 184, 166, 0.15);
  color: var(--text);
}
.file-tab.active {
  background: rgba(20, 184, 166, 0.18);
  color: #14b8a6;
  border-bottom-color: #14b8a6;
}
.file-tab-icon {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(20, 184, 166, 0.2);
  color: #14b8a6;
  letter-spacing: 0.5px;
}
.file-tab-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-tab-modified {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f59e0b;
  flex-shrink: 0;
}
.file-tab-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  border-radius: 3px;
}
.file-tab-close:hover {
  background: var(--bg-hover);
  color: var(--text);
}

/* File panel — fills conversation area */
.file-panel {
  display: none;
  flex-direction: column;
  position: absolute;
  inset: 0;
  background: var(--bg);
  z-index: 1;
}
.file-panel.active {
  display: flex;
}

/* File panel toolbar */
.file-panel-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-height: 40px;
}
.file-panel-path {
  flex: 1;
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
}
.file-panel-modified-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
  flex-shrink: 0;
}
.file-panel-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}
.file-panel-save-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 12px;
  background: rgba(20, 184, 166, 0.15);
  color: #14b8a6;
  border: 1px solid rgba(20, 184, 166, 0.3);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}
.file-panel-save-btn:hover {
  background: rgba(20, 184, 166, 0.25);
}
.file-panel-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 12px;
  background: rgba(20, 184, 166, 0.15);
  color: #14b8a6;
  border: 1px solid rgba(20, 184, 166, 0.3);
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}
.file-panel-download-btn:hover {
  background: rgba(20, 184, 166, 0.25);
}

/* CodeMirror editor container */
.file-panel-editor {
  flex: 1;
  overflow: hidden;
  position: relative;
}
.file-panel-editor .CodeMirror {
  height: 100%;
  font-family: var(--font-mono);
  font-size: 13px;
}

/* Image preview */
.file-preview-image {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 24px;
  background: var(--bg);
}
.file-preview-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* PDF preview */
.file-preview-pdf {
  flex: 1;
  overflow: hidden;
}
.file-preview-pdf iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Binary file info */
.file-preview-binary {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px;
  color: var(--text-dim);
}
.file-preview-binary-icon {
  font-size: 48px;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--bg-hover);
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
}
.file-preview-binary-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.file-preview-binary-info {
  font-size: 13px;
  color: var(--text-dim);
}

/* Light theme overrides for file tabs */
[data-theme="light"] .file-tab {
  background: rgba(13, 148, 136, 0.06);
}
[data-theme="light"] .file-tab:hover {
  background: rgba(13, 148, 136, 0.12);
}
[data-theme="light"] .file-tab.active {
  background: rgba(13, 148, 136, 0.12);
  color: #0d9488;
  border-bottom-color: #0d9488;
}
[data-theme="light"] .file-tab-icon {
  background: rgba(13, 148, 136, 0.15);
  color: #0d9488;
}
[data-theme="light"] .file-panel-toolbar {
  background: #f8fafc;
  border-color: #e2e8f0;
}
[data-theme="light"] .file-panel-save-btn {
  background: rgba(13, 148, 136, 0.1);
  color: #0d9488;
  border-color: rgba(13, 148, 136, 0.25);
}
[data-theme="light"] .file-panel-save-btn:hover {
  background: rgba(13, 148, 136, 0.18);
}
[data-theme="light"] .file-panel-download-btn {
  background: rgba(13, 148, 136, 0.1);
  color: #0d9488;
  border-color: rgba(13, 148, 136, 0.25);
}
[data-theme="light"] .file-panel-download-btn:hover {
  background: rgba(13, 148, 136, 0.18);
}
[data-theme="light"] .file-preview-image img {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}
[data-theme="light"] .file-preview-binary-icon {
  background: #f1f5f9;
  color: #475569;
}

/* ─── v0.8: History Sidebar Overhaul ──────────────────────── */

/* Search bar */
.history-search-bar {
  position: relative;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.history-search-bar input {
  width: 100%;
  padding: 6px 28px 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 12px;
  font-family: var(--font-mono);
  outline: none;
  box-sizing: border-box;
}
.history-search-bar input:focus {
  border-color: var(--accent);
}
.history-search-bar input::placeholder {
  color: var(--text-muted);
}
.history-search-clear {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.history-search-clear:hover {
  color: var(--text);
}

/* Section container */
.history-section {
  border-bottom: 1px solid var(--border);
}

/* Section header */
.history-section-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.history-section-header:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}
.history-section-arrow {
  font-size: 9px;
  width: 12px;
  text-align: center;
  flex-shrink: 0;
}
.history-section-title {
  flex: 1;
}
.history-section-count {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 500;
  min-width: 16px;
  text-align: center;
}

/* Section body */
.history-section-body {
  padding: 0;
}
.history-section.collapsed .history-section-body {
  display: none;
}

/* Day labels inside sections */
.history-day-label {
  padding: 4px 12px 2px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* History entry */
.history-entry {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}
.history-entry:hover {
  background: rgba(255, 255, 255, 0.05);
}
.history-entry.active-session {
  background: rgba(99, 102, 241, 0.1);
  border-left: 2px solid var(--accent);
  padding-left: 10px;
}

/* Star button */
.history-star-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
  padding: 0;
  flex-shrink: 0;
  line-height: 1;
  opacity: 0.4;
  transition: opacity 0.15s, color 0.15s;
}
.history-entry:hover .history-star-btn {
  opacity: 0.8;
}
.history-star-btn:hover {
  opacity: 1 !important;
  color: #f59e0b;
}
.history-star-btn.filled {
  color: #f59e0b;
  opacity: 1;
}

/* Status indicator for active sessions */
.history-entry-status {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.history-entry-status.idle {
  background: #6b7280;
}
.history-entry-status.running {
  background: #22c55e;
  animation: pulse-green 1.5s infinite;
}
@keyframes pulse-green {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Entry info */
.history-entry-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.history-entry-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-entry-subtitle {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* Close button */
.history-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-muted);
  padding: 0 2px;
  flex-shrink: 0;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}
.history-entry:hover .history-close-btn {
  opacity: 0.6;
}
.history-close-btn:hover {
  opacity: 1 !important;
  color: #ef4444;
}

/* Light theme overrides for history sidebar */
[data-theme="light"] .history-search-bar input {
  background: #fff;
  border-color: #e2e8f0;
  color: #1e293b;
}
[data-theme="light"] .history-search-bar input:focus {
  border-color: #6366f1;
}
[data-theme="light"] .history-section-header:hover {
  background: rgba(0, 0, 0, 0.03);
}
[data-theme="light"] .history-section-count {
  background: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .history-entry:hover {
  background: rgba(0, 0, 0, 0.04);
}
[data-theme="light"] .history-entry.active-session {
  background: rgba(99, 102, 241, 0.06);
}
[data-theme="light"] .history-entry-name {
  color: #1e293b;
}
[data-theme="light"] .history-entry-subtitle {
  color: #64748b;
}

/* ─── Collapsible sidebar sections (unified) ───────────────── */
.collapsible-header {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  transition: background var(--transition-fast);
}
.collapsible-header:hover {
  background: var(--bg-hover);
}
.collapsible-header .collapse-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  font-size: 9px;
  flex-shrink: 0;
  color: var(--text-dim);
  transition: transform 0.15s, color 0.15s;
  line-height: 1;
}
.collapsible-header:hover .collapse-arrow {
  color: var(--text-secondary);
}
.collapsible-header .sidebar-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-bright);
  margin: 0;
  padding: 0;
  border-bottom: none;
  line-height: 1.3;
  text-transform: none;
  letter-spacing: normal;
}
.collapsible-section.collapsed .collapsible-body {
  display: none;
}

/* ─── Settings collapsible sections (v1.2.1) ─────────────────── */
.settings-section {
  border-top: none;
}
.settings-section-header {
  /* Inherits from .collapsible-header, just override padding */
  padding: 10px 14px;
}
.settings-section-header .sidebar-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-bright);
}
.settings-section-body {
  padding: 0;
}
.webhook-settings-indicator {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.webhook-settings-indicator.active {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}
.webhook-settings-indicator.inactive {
  background: rgba(100, 116, 139, 0.15);
  color: var(--text-dim);
}

/* ─── Office file preview (xlsx, docx) ─────────────────────── */
.file-preview-office {
  flex: 1;
  overflow: auto;
  padding: 12px;
  background: var(--bg-primary);
}
.xlsx-sheet-tabs {
  display: flex;
  gap: 4px;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.xlsx-sheet-btn {
  padding: 4px 12px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}
.xlsx-sheet-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.xlsx-sheet-content table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
}
.xlsx-sheet-content td, .xlsx-sheet-content th {
  border: 1px solid var(--border);
  padding: 4px 8px;
  text-align: left;
  white-space: nowrap;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.xlsx-sheet-content th {
  background: var(--bg-tertiary);
  font-weight: 600;
}
.xlsx-sheet-content tr:nth-child(even) td {
  background: var(--bg-secondary);
}
.docx-content {
  max-width: 800px;
  line-height: 1.6;
  font-size: 14px;
}
.docx-content img { max-width: 100%; }
.docx-content table { border-collapse: collapse; margin: 8px 0; }
.docx-content td, .docx-content th { border: 1px solid var(--border); padding: 4px 8px; }

/* ═══════════════════════════════════════════════════════════════
   v0.8.1 — Bug Fixes & Enhancements
   ═══════════════════════════════════════════════════════════════ */

/* ─── Issue 2: File delete button ─────────────────────────── */
.file-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  color: var(--text-muted);
  flex-shrink: 0;
  line-height: 1;
}
.file-tree-item:hover .file-delete-btn {
  opacity: 0.5;
}
.file-delete-btn:hover {
  opacity: 1 !important;
  color: #ef4444;
}

/* ─── Issue 5: Tools search bar ───────────────────────────── */
.tools-search-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.tools-search-bar input {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  color: var(--text);
  font-size: 12px;
  outline: none;
}
.tools-search-bar input:focus {
  border-color: var(--accent);
}
.tools-search-clear-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  padding: 0 4px;
  line-height: 1;
}
.tools-search-clear-btn:hover {
  color: var(--text);
}
.tools-section-count {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  flex-shrink: 0;
}
.tool-group-arrow {
  font-size: 9px;
  color: var(--text-dim);
  margin-right: 2px;
}
.tool-group-body {
  padding-left: 8px;
}

/* ─── Issue 8: Usage account links ────────────────────────── */
.usage-account-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  color: var(--accent);
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s;
}
.usage-account-link:hover {
  color: var(--accent-hover, #818cf8);
  text-decoration: underline;
}
.usage-account-link svg {
  flex-shrink: 0;
  opacity: 0.6;
}

/* ─── Light theme overrides for v0.8.1 ────────────────────── */
[data-theme="light"] .tools-search-bar input {
  background: #fff;
  border-color: #e2e8f0;
  color: #1e293b;
}
[data-theme="light"] .tools-search-bar input:focus {
  border-color: #6366f1;
}
[data-theme="light"] .tools-section-count {
  background: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .usage-account-link {
  color: #4f46e5;
}
[data-theme="light"] .usage-account-link:hover {
  color: #6366f1;
}
[data-theme="light"] .file-delete-btn:hover {
  color: #dc2626;
}

/* ═══════════════════════════════════════════════════════════════
   v0.9 — New Feature Styles
   ═══════════════════════════════════════════════════════════════ */

/* ─── Context Meter (topbar) ──────────────────────────────── */
.context-meter {
  display: inline-flex;
  align-items: center;
  margin-right: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
}
.context-meter-text {
  font-size: 11px;
  font-family: var(--font-mono);
}
.context-meter.warning .context-meter-text {
  color: #f59e0b;
}
.context-meter.danger .context-meter-text {
  color: #ef4444;
}

/* ─── Compaction Indicator ────────────────────────────────── */
.compaction-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
  border-radius: 12px;
  font-size: 11px;
  margin: 8px auto;
}
.tab-compacted-icon {
  color: #f59e0b;
  font-size: 10px;
  margin-left: 2px;
}

/* ─── Skills Panel ────────────────────────────────────────── */
.skill-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.skill-card:hover {
  background: var(--bg-tertiary);
}
.skill-card-name {
  font-size: 13px;
  color: var(--text-bright);
  font-weight: 500;
}
.skill-card-actions {
  display: flex;
  gap: 4px;
}
.skill-card-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 2px 4px;
  font-size: 12px;
  transition: color 0.15s;
}
.skill-card-btn:hover {
  color: var(--text-bright);
}
.skill-card-btn.delete:hover {
  color: #ef4444;
}

/* ─── Projects Panel ──────────────────────────────────────── */
.project-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.project-card:hover {
  background: var(--bg-tertiary);
}
.project-card-icon {
  font-size: 16px;
  flex-shrink: 0;
}
.project-card-info {
  flex: 1;
  min-width: 0;
}
.project-card-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-card-path {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-card-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}
.project-start-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.project-start-btn:hover {
  background: var(--accent-hover, #818cf8);
}
.project-remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 2px;
  font-size: 14px;
  transition: color 0.15s;
}
.project-remove-btn:hover {
  color: #ef4444;
}

/* ─── MCP Server Buttons ──────────────────────────────────── */
.mcp-server-item {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.mcp-server-actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.mcp-reconnect-btn,
.mcp-toggle-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
}
.mcp-reconnect-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.mcp-toggle-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.mcp-toggle-btn:hover {
  border-color: var(--accent);
}

/* ─── Browse Folder Modal z-index Fix ─────────────────────── */
#folder-modal {
  z-index: 1100;
}
#session-modal {
  z-index: 1000;
}

/* ─── Historical Usage Pill ───────────────────────────────── */
.historical-usage-pill {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 8px 16px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  margin: 8px 16px;
  font-size: 11px;
  color: var(--text-muted);
}
.historical-usage-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.historical-usage-label {
  opacity: 0.7;
}
.historical-usage-value {
  color: var(--text-bright);
  font-weight: 500;
}

/* ─── Skill Editor Modal ──────────────────────────────────── */
#skill-editor-area .CodeMirror {
  height: 300px;
  border-radius: 6px;
}
#skill-editor-name {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  outline: none;
}
#skill-editor-name:focus {
  border-color: var(--accent);
}

/* ─── Light Theme Overrides (v0.9) ────────────────────────── */
[data-theme="light"] .context-meter-bar {
  background: #e2e8f0;
}
[data-theme="light"] .compaction-pill {
  background: rgba(245, 158, 11, 0.08);
}
[data-theme="light"] .skill-card:hover {
  background: #f1f5f9;
}
[data-theme="light"] .project-card:hover {
  background: #f1f5f9;
}
[data-theme="light"] .project-start-btn {
  background: #4f46e5;
}
[data-theme="light"] .project-start-btn:hover {
  background: #6366f1;
}
[data-theme="light"] .mcp-reconnect-btn:hover {
  color: #4f46e5;
  border-color: #4f46e5;
}
[data-theme="light"] .mcp-toggle-btn.active {
  background: #4f46e5;
  border-color: #4f46e5;
}
[data-theme="light"] .historical-usage-pill {
  background: #f1f5f9;
}
[data-theme="light"] #skill-editor-name {
  background: #fff;
  border-color: #e2e8f0;
  color: #1e293b;
}
[data-theme="light"] #skill-editor-name:focus {
  border-color: #6366f1;
}

/* ═══════════════════════════════════════════════════════════════
   v1.0 — File Checkpoints & Rewind
   ═══════════════════════════════════════════════════════════════ */
.overview-checkpoints {
  border-top: 1px solid var(--border);
  padding: 8px 0;
}
/* Legacy: overview-section-header replaced by collapsible-header */
.overview-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
}
.checkpoint-timeline {
  max-height: 200px;
  overflow-y: auto;
}
.checkpoint-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.checkpoint-entry:hover {
  background: var(--bg-tertiary);
}
.checkpoint-entry-icon {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.checkpoint-entry-info {
  flex: 1;
  min-width: 0;
}
.checkpoint-entry-file {
  color: var(--text-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.checkpoint-entry-tool {
  color: var(--text-muted);
  font-size: 11px;
}
.checkpoint-entry-time {
  color: var(--text-muted);
  font-size: 10px;
  flex-shrink: 0;
}
.checkpoint-rewind-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
  flex-shrink: 0;
  opacity: 0;
}
.checkpoint-entry:hover .checkpoint-rewind-btn {
  opacity: 1;
}
.checkpoint-rewind-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Checkpoint diff modal */
.checkpoint-diff {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
}
.checkpoint-diff-header {
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border-radius: 6px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.diff-line-add {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
}
.diff-line-remove {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}
.diff-line-context {
  color: var(--text-muted);
}

/* Tool card rewind/fork buttons */
.tool-card-actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
  opacity: 0;
  transition: opacity 0.15s;
}
.tool-card-header:hover .tool-card-actions {
  opacity: 1;
}
.tool-action-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
}
.tool-action-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.tool-action-btn.rewind:hover {
  color: #f59e0b;
  border-color: #f59e0b;
}
.tool-action-btn.fork:hover {
  color: #22c55e;
  border-color: #22c55e;
}

/* ═══════════════════════════════════════════════════════════════
   v1.0 — Team Monitoring
   ═══════════════════════════════════════════════════════════════ */
.overview-team {
  /* Uses collapsible-section pattern now */
}
.team-members-list {
  /* max-height/overflow handled by #sidebar-overview .collapsible-body */
}
.team-member-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  font-size: 12px;
}
.team-member-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.team-member-status.running { background: #22c55e; }
.team-member-status.idle { background: #f59e0b; }
.team-member-status.done { background: var(--text-muted); }
.team-member-status.error { background: #ef4444; }
.team-member-info {
  flex: 1;
  min-width: 0;
}
.team-member-name {
  color: var(--text-bright);
  font-weight: 500;
}
.team-member-desc {
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.team-member-time {
  color: var(--text-muted);
  font-size: 10px;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   v1.0 — Session Groups
   ═══════════════════════════════════════════════════════════════ */
.group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-bright);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.group-header:hover {
  background: var(--bg-tertiary);
}
.group-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.group-session-count {
  color: var(--text-muted);
  font-weight: 400;
  margin-left: auto;
}
.group-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.group-header:hover .group-actions {
  opacity: 1;
}
.group-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 2px;
  font-size: 12px;
  transition: color 0.15s;
}
.group-action-btn:hover {
  color: var(--text-bright);
}
.group-action-btn.delete:hover {
  color: #ef4444;
}

/* Tab group indicator */
.tab-group-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   v1.0 — Session Templates
   ═══════════════════════════════════════════════════════════════ */
.template-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.template-card:hover {
  background: var(--bg-tertiary);
}
.template-card-icon {
  font-size: 14px;
  flex-shrink: 0;
  color: var(--accent);
}
.template-card-info {
  flex: 1;
  min-width: 0;
}
.template-card-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-bright);
}
.template-card-detail {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.template-card-actions {
  display: flex;
  gap: 4px;
}
.template-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 2px;
  font-size: 14px;
  transition: color 0.15s;
}
.template-delete-btn:hover {
  color: #ef4444;
}

/* ═══════════════════════════════════════════════════════════════
   v1.0 — Agent Definitions
   ═══════════════════════════════════════════════════════════════ */
.agent-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.agent-card:hover {
  background: var(--bg-tertiary);
}
.agent-card-icon {
  font-size: 14px;
  flex-shrink: 0;
}
.agent-card-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-bright);
}
.agent-card-actions {
  display: flex;
  gap: 4px;
}
.agent-card-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 2px 4px;
  font-size: 12px;
  transition: color 0.15s;
}
.agent-card-btn:hover {
  color: var(--text-bright);
}
.agent-card-btn.delete:hover {
  color: #ef4444;
}

#agent-editor-area .CodeMirror {
  height: 300px;
  border-radius: 6px;
}
#agent-editor-name {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  outline: none;
}
#agent-editor-name:focus {
  border-color: var(--accent);
}

/* Fork indicator */
.fork-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 16px;
  background: rgba(99, 102, 241, 0.05);
  border-left: 2px solid var(--accent);
  margin: 8px 16px;
  border-radius: 0 6px 6px 0;
}

/* Message fork button */
.message-fork-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 2px 4px;
  font-size: 11px;
  opacity: 0;
  transition: all 0.15s;
}
.assistant-message:hover .message-fork-btn,
.user-message:hover .message-fork-btn {
  opacity: 1;
}
.message-fork-btn:hover {
  color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════════
   v1.0 — Light Theme Overrides
   ═══════════════════════════════════════════════════════════════ */
[data-theme="light"] .checkpoint-entry:hover { background: #f1f5f9; }
[data-theme="light"] .team-member-name { color: #1e293b; }
[data-theme="light"] .group-header:hover { background: #f1f5f9; }
[data-theme="light"] .template-card:hover { background: #f1f5f9; }
[data-theme="light"] .agent-card:hover { background: #f1f5f9; }
[data-theme="light"] .fork-indicator { background: rgba(79, 70, 229, 0.05); border-left-color: #4f46e5; }
[data-theme="light"] .diff-line-add { background: rgba(34, 197, 94, 0.08); }
[data-theme="light"] .diff-line-remove { background: rgba(239, 68, 68, 0.08); }
[data-theme="light"] #agent-editor-name { background: #f8fafc; color: #1e293b; }
[data-theme="light"] .checkpoint-diff-header { background: #f1f5f9; }

/* ═══════════════════════════════════════════════════════════════
   v1.1 — Terminal Panel
   ═══════════════════════════════════════════════════════════════ */
.terminal-panel {
  position: fixed;
  bottom: 70px;
  left: 0;
  right: var(--sidebar-width);
  height: 300px;
  min-height: 120px;
  max-height: 80vh;
  background: var(--bg);
  border-top: 2px solid var(--accent);
  z-index: 50;
  display: flex;
  flex-direction: column;
}

/* Resize handle on top of terminal */
.terminal-resize-handle {
  position: absolute;
  top: -4px;
  left: 0;
  right: 0;
  height: 8px;
  cursor: ns-resize;
  z-index: 51;
  background: transparent;
  transition: background 0.15s;
}

.terminal-resize-handle:hover,
.terminal-resize-handle.active {
  background: var(--accent-dim);
}
.terminal-panel.hidden {
  display: none;
}
.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-bright);
}
.terminal-title {
  display: flex;
  align-items: center;
  gap: 6px;
}
.terminal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.terminal-close:hover {
  color: var(--red);
}
.terminal-container {
  flex: 1;
  overflow: hidden;
  padding: 4px;
}
/* Adjust main content when terminal is open */
body:has(.terminal-panel:not(.hidden)) #conversation {
  bottom: 370px;
}
body:has(.terminal-panel:not(.hidden)) #input-bar {
  bottom: 300px;
}

/* ═══════════════════════════════════════════════════════════════
   v1.1 — Todo Tasks Panel
   ═══════════════════════════════════════════════════════════════ */
.todo-tasks-container {
  /* Uses collapsible-section pattern now */
}
.todo-tasks-list {
  /* max-height/overflow handled by #sidebar-overview .collapsible-body */
}
.todo-task-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 16px;
  font-size: 12px;
  transition: background 0.15s;
}
.todo-task-item:hover {
  background: var(--bg-hover);
}
.todo-checkbox {
  font-size: 14px;
  flex-shrink: 0;
  color: var(--text-dim);
}
.todo-task-item.completed .todo-checkbox {
  color: var(--green);
}
.todo-task-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
.todo-task-item.completed .todo-task-text {
  text-decoration: line-through;
  color: var(--text-dim);
}
.todo-task-item.in-progress .todo-task-text {
  color: var(--accent);
}
.todo-status-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  flex-shrink: 0;
  text-transform: uppercase;
  font-weight: 500;
  letter-spacing: 0.03em;
}
.todo-status-badge.pending {
  background: var(--bg-hover);
  color: var(--text-dim);
}
.todo-status-badge.in_progress {
  background: var(--accent-glow);
  color: var(--accent);
}
.todo-status-badge.completed {
  background: var(--green-dim);
  color: var(--green);
}

/* ─── v1.1 Light theme additions ──────────────────────────── */
[data-theme="light"] .terminal-panel {
  background: #fff;
}
[data-theme="light"] .terminal-header {
  background: #f8f9fb;
}
[data-theme="light"] .todo-task-item:hover {
  background: #f1f5f9;
}
[data-theme="light"] .collapse-arrow {
  color: #6b7280;
}
/* Fix light theme tool card readability */
[data-theme="light"] .tool-card-header {
  color: #1e293b;
}
[data-theme="light"] .tool-name {
  color: #4f46e5;
}
[data-theme="light"] .tool-desc-preview {
  color: #374151;
}
[data-theme="light"] .active-task-item {
  color: #1e293b;
}
[data-theme="light"] .sidebar-section-title {
  color: #111827;
}
[data-theme="light"] .settings-label {
  color: #374151;
}

/* ═══════════════════════════════════════════════════════════════
   v1.2 — Sidebar Tooltips
   ═══════════════════════════════════════════════════════════════ */

.sidebar-tab[data-tooltip] {
  position: relative;
}

.sidebar-tab[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-active);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  border: 1px solid var(--border-bright, var(--border));
  z-index: 1000;
  pointer-events: none;
  animation: tooltipFadeIn 0.15s ease;
  backdrop-filter: blur(8px);
}

.sidebar-tab[data-tooltip]:hover::before {
  content: "";
  position: absolute;
  right: calc(100% + 4px);
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-left-color: var(--bg-active);
  z-index: 1001;
  pointer-events: none;
}

@keyframes tooltipFadeIn {
  from { opacity: 0; transform: translateY(-50%) translateX(4px); }
  to { opacity: 1; transform: translateY(-50%) translateX(0); }
}

/* ═══════════════════════════════════════════════════════════════
   v1.2 — Cron System Styles
   ═══════════════════════════════════════════════════════════════ */

/* Cron Overview in Sidebar — uses collapsible-section pattern */
.cron-overview-container {
  /* Inherits from collapsible-section */
}

.cron-overview-list {
  padding: 4px 12px;
}

.cron-overview-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}

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

.cron-overview-item.disabled {
  opacity: 0.5;
}

.cron-schedule {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-surface);
  padding: 1px 6px;
  border-radius: 3px;
  flex-shrink: 0;
}

.cron-message {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.cron-status-dot.active {
  background: #22c55e;
}

.cron-status-dot.inactive {
  background: var(--text-dim);
}

/* Cron Management Panel */
.cron-list {
  padding: 4px 12px;
}

.cron-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  transition: border-color 0.15s;
}

.cron-card:hover {
  border-color: var(--accent);
}

.cron-card.disabled {
  opacity: 0.6;
}

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

.cron-card-schedule {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-surface);
  padding: 2px 8px;
  border-radius: 4px;
}

.cron-card-session {
  font-size: 11px;
  color: var(--text-dim);
}

/* Clickable session link on cron cards */
a.cron-session-link {
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s, text-decoration 0.15s;
}
a.cron-session-link:hover {
  color: var(--accent-hover, var(--accent));
  text-decoration: underline;
}
a.cron-session-link.cron-session-reopen {
  font-style: italic;
  opacity: 0.8;
}
a.cron-session-link.cron-session-reopen::after {
  content: " ↗";
  font-size: 9px;
}

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

.cron-card-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.cron-error {
  color: #ef4444;
}

.cron-card-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.cron-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
}

.cron-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  color: var(--accent);
}

.cron-btn.run {
  color: #22c55e;
  border-color: rgba(34, 197, 94, 0.3);
}
.cron-btn.run:hover {
  background: rgba(34, 197, 94, 0.1);
  border-color: #22c55e;
}
.cron-btn.delete:hover {
  border-color: #ef4444;
  color: #ef4444;
}

.history-cron-card {
  margin: 4px 8px 8px;
}

/* ═══════════════════════════════════════════════════════════════
   v1.2 — Webhook Styles
   ═══════════════════════════════════════════════════════════════ */

.webhook-overview-container {
  /* Uses collapsible-section pattern now */
}
.webhook-overview-body {
  padding: 4px 12px 8px;
}
.webhook-overview-body .webhook-url {
  font-size: 11px;
  color: var(--text-dim);
  word-break: break-all;
  margin-bottom: 6px;
}
.webhook-overview-actions {
  display: flex;
  gap: 6px;
}
.webhook-overview-actions .btn-secondary {
  font-size: 11px;
  padding: 3px 8px;
}

.webhook-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--accent-surface);
  color: var(--accent);
}

.webhook-url {
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.webhook-log-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.webhook-log-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

.webhook-log-item.error {
  border-left: 3px solid #ef4444;
}

.webhook-log-item.completed {
  border-left: 3px solid #22c55e;
}

.webhook-log-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.webhook-log-mode {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--accent-surface);
  color: var(--accent);
}

.webhook-log-mode.async {
  background: rgba(234, 179, 8, 0.15);
  color: #eab308;
}

.webhook-log-status {
  font-size: 11px;
  color: var(--text-dim);
}

.webhook-log-status.completed {
  color: #22c55e;
}

.webhook-log-status.error {
  color: #ef4444;
}

.webhook-log-time {
  font-size: 11px;
  color: var(--text-dim);
  margin-left: auto;
}

.webhook-log-body {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: 'SF Mono', 'Fira Code', monospace;
  background: var(--bg-primary);
  padding: 6px 8px;
  border-radius: 4px;
  max-height: 80px;
  overflow: hidden;
  margin-bottom: 4px;
}

.webhook-log-duration {
  font-size: 11px;
  color: var(--text-dim);
  text-align: right;
}

/* ═══════════════════════════════════════════════════════════════
   v1.4.3 — Full-screen Help
   ═══════════════════════════════════════════════════════════════ */
.help-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: var(--bg);
  display: flex;
  align-items: stretch;
  justify-content: stretch;
}
.help-fullscreen.hidden { display: none; }

.help-fullscreen-inner {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.help-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.help-topbar h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-bright);
  margin: 0;
}

.help-close-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 24px;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
.help-close-btn:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.help-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.help-nav {
  width: 220px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--bg-raised);
  overflow-y: auto;
  padding: 12px 0;
}

.help-nav-item {
  display: block;
  width: 100%;
  padding: 8px 20px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  border: none;
  background: none;
  text-align: left;
  font-family: inherit;
  transition: all var(--transition-fast);
  border-left: 3px solid transparent;
}

.help-nav-item:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.help-nav-item.active {
  color: var(--accent);
  background: var(--accent-surface);
  border-left-color: var(--accent);
  font-weight: 600;
}

.help-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 40px;
  max-width: 800px;
}

#help-content {
  line-height: 1.7;
}

.help-section {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
  scroll-margin-top: 20px;
}

.help-section:last-child {
  border-bottom: none;
}

.help-section h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 10px;
}

.help-section p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.help-section ul {
  padding-left: 20px;
  margin: 8px 0;
}

.help-section li {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.help-section li b {
  color: var(--text);
}

.help-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
}

.help-table td {
  padding: 4px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-subtle);
}

.help-table td:first-child {
  font-family: var(--font-mono);
  color: var(--accent);
  white-space: nowrap;
}

.help-table kbd {
  display: inline-block;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
}

.help-code-block {
  margin: 8px 0;
}

.help-code-block b {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.help-code-block pre {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text);
  overflow-x: auto;
  line-height: 1.5;
}

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

.help-version {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: 4px;
}

.help-version b {
  color: var(--accent);
}

.help-version:hover {
  background: var(--bg-hover);
}

/* Mobile help: nav becomes horizontal scrollable strip */
@media (max-width: 768px) {
  .help-layout { flex-direction: column; }
  .help-nav {
    width: 100%;
    flex-shrink: 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-wrap: nowrap;
    padding: 8px;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--bg-raised);
  }
  .help-nav::-webkit-scrollbar { display: none; }
  .help-nav-item {
    padding: 6px 12px;
    border-left: none;
    border-radius: 6px;
    white-space: nowrap;
    font-size: 12px;
    flex-shrink: 0;
  }
  .help-nav-item.active {
    border-left-color: transparent;
    background: var(--accent-dim);
    color: #fff;
  }
  .help-body {
    padding: 16px;
    flex: 1;
    overflow-y: auto;
  }
}

/* ═══════════════════════════════════════════════════════════════
   v1.2 — Light Theme Additions
   ═══════════════════════════════════════════════════════════════ */

[data-theme="light"] .sidebar-tab[data-tooltip]:hover::after {
  background: #ffffff;
  color: #1a1a2e;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
  border: 1px solid #d0d0d8;
}

[data-theme="light"] .sidebar-tab[data-tooltip]:hover::before {
  border-left-color: #ffffff;
}

[data-theme="light"] .cron-card {
  background: #ffffff;
}

[data-theme="light"] .webhook-log-item {
  background: #ffffff;
}

[data-theme="light"] .webhook-log-body {
  background: #f8f9fb;
}

[data-theme="light"] .help-code-block pre {
  background: #f8f9fb;
}

/* ═══════════════════════════════════════════════════════════════
   v1.3 — History Load More Button
   ═══════════════════════════════════════════════════════════════ */
.history-load-more-btn {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: var(--bg-surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  margin-bottom: 16px;
  transition: all var(--transition-fast);
}
.history-load-more-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent-dim);
  color: var(--accent);
}
.history-older-container {
  opacity: 0.7;
  border-left: 2px solid var(--border);
  padding-left: 8px;
  margin-bottom: 12px;
}

/* ═══════════════════════════════════════════════════════════════
   v1.3 — Message Timestamps (hover)
   ═══════════════════════════════════════════════════════════════ */
.msg {
  position: relative;
}
.msg-timestamp {
  display: none;
  position: absolute;
  top: 4px;
  right: 8px;
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg-surface);
  padding: 1px 6px;
  border-radius: 3px;
  opacity: 0.85;
  pointer-events: none;
  z-index: 5;
  white-space: nowrap;
  font-family: 'SF Mono', 'Fira Code', monospace;
  border: 1px solid var(--border);
}
.msg-user .msg-timestamp {
  right: auto;
  left: 8px;
  color: rgba(255,255,255,0.6);
  background: rgba(0,0,0,0.15);
  border-color: transparent;
}
.msg:hover .msg-timestamp {
  display: block;
}

/* ═══════════════════════════════════════════════════════════════
   v1.3 — Todo Task Descriptions
   ═══════════════════════════════════════════════════════════════ */
.todo-task-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.todo-task-desc {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.todo-task-item.in-progress .todo-task-desc {
  color: var(--accent-dim);
}

/* ═══════════════════════════════════════════════════════════════
   v1.3 — Team Member Activity
   ═══════════════════════════════════════════════════════════════ */
.team-member-activity {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.team-member-entry.clickable {
  cursor: pointer;
}
.team-member-entry.clickable:hover {
  background: var(--bg-hover);
  border-radius: 4px;
}
.team-summary {
  font-size: 10px;
  color: var(--text-dim);
  padding: 4px 12px 6px;
  text-align: right;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

/* ═══════════════════════════════════════════════════════════════
   v1.3 — Session Info Fix (no truncation)
   ═══════════════════════════════════════════════════════════════ */
.stats-value {
  word-break: break-all;
  overflow-wrap: break-word;
  text-align: right;
  max-width: 60%;
}
.stats-row {
  flex-wrap: wrap;
  gap: 4px;
}

/* ═══════════════════════════════════════════════════════════════
   v1.3 — Split Screen: Pane Container & Grid Layouts
   ═══════════════════════════════════════════════════════════════ */

#pane-container {
  display: grid;
  flex: 1;
  gap: 1px;
  overflow: hidden;
  background: var(--border-subtle);
}

/* Layout modes */
#pane-container.layout-single {
  grid-template: 1fr / 1fr;
  gap: 0;
  background: var(--bg);
}
#pane-container.layout-2col {
  grid-template: 1fr / 1fr 1fr;
}
#pane-container.layout-2row {
  grid-template: 1fr 1fr / 1fr;
}
#pane-container.layout-quad {
  grid-template: 1fr 1fr / 1fr 1fr;
}

/* ─── Pane ──────────────────────────────────────────────────── */
.pane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  background: var(--bg);
  position: relative;
  border-top: 2px solid transparent;
  transition: border-color var(--transition-fast);
}

.pane.focused {
  border-top: 3px solid var(--pane-accent, var(--accent-dim));
  box-shadow: 0 2px 8px var(--pane-accent-glow, rgba(99, 102, 241, 0.1));
}

.pane.pane-thinking {
  border-top-color: var(--pane-accent, var(--accent));
  animation: pane-pulse 2s ease-in-out infinite;
}

@keyframes pane-pulse {
  0%, 100% { box-shadow: 0 2px 8px var(--pane-accent-glow, rgba(99, 102, 241, 0.1)); }
  50% { box-shadow: 0 2px 16px var(--pane-accent-glow, rgba(99, 102, 241, 0.3)); }
}

.pane-empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 13px;
  background: var(--bg);
}

/* ─── Pane Colors ───────────────────────────────────────────── */
.pane[data-pane-color="1"] { --pane-accent: #6366f1; --pane-accent-glow: rgba(99, 102, 241, 0.15); --pane-accent-surface: rgba(99, 102, 241, 0.08); }
.pane[data-pane-color="2"] { --pane-accent: #10b981; --pane-accent-glow: rgba(16, 185, 129, 0.15); --pane-accent-surface: rgba(16, 185, 129, 0.08); }
.pane[data-pane-color="3"] { --pane-accent: #f59e0b; --pane-accent-glow: rgba(245, 158, 11, 0.15); --pane-accent-surface: rgba(245, 158, 11, 0.08); }
.pane[data-pane-color="4"] { --pane-accent: #f43f5e; --pane-accent-glow: rgba(244, 63, 94, 0.15); --pane-accent-surface: rgba(244, 63, 94, 0.08); }

/* ─── Pane Tab Bar ──────────────────────────────────────────── */
.pane-tab-bar {
  display: flex;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
  min-height: 32px;
  padding: 0 8px;
  gap: 1px;
}
.pane-tab-bar::-webkit-scrollbar { height: 0; }

.pane-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  height: 32px;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  user-select: none;
  position: relative;
  transition: color var(--transition-fast),
              background var(--transition-fast),
              border-color var(--transition-fast);
}

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

.pane-tab.active {
  color: var(--text-bright);
  border-bottom: 3px solid var(--pane-accent, var(--accent));
  background: var(--pane-accent-surface, var(--bg-surface));
  text-shadow: 0 0 8px var(--pane-accent-glow, rgba(99, 102, 241, 0.15));
}

.pane-tab .pane-tab-status {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pane-tab-status.idle     { background: #34d399; }
.pane-tab-status.thinking { background: var(--pane-accent, var(--accent)); animation: pulse-thinking 1.2s ease-in-out infinite; }
.pane-tab-status.tool     { background: #fbbf24; animation: pulse-tool 1.5s ease-in-out infinite; }
.pane-tab-status.error    { background: var(--red); }
.pane-tab-status.closed   { background: #64748b; }

.pane-tab .pane-tab-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-dim);
  opacity: 0;
  cursor: pointer;
  transition: opacity var(--transition-fast), background var(--transition-fast);
}
.pane-tab:hover .pane-tab-close { opacity: 0.5; }
.pane-tab .pane-tab-close:hover {
  opacity: 1;
  background: var(--bg-active);
  color: var(--red);
}

.pane-tab.dragging { opacity: 0.4; }
.pane-tab.drag-over-left { box-shadow: -2px 0 0 0 var(--pane-accent, var(--accent)); }
.pane-tab.drag-over-right { box-shadow: 2px 0 0 0 var(--pane-accent, var(--accent)); }

/* ─── Pane Conversation Area ────────────────────────────────── */
.pane-conversation {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 24px 24px;
  scroll-behavior: smooth;
  position: relative;
  background: var(--bg);
}

/* ─── Pane Input Bar ────────────────────────────────────────── */
.pane-input-bar {
  padding: 10px 16px 14px;
  background: linear-gradient(to top, var(--bg-raised) 0%, var(--bg-raised) 80%, transparent 100%);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.pane-input-wrapper {
  display: flex;
  gap: 0;
  align-items: flex-end;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 3px 3px 3px 8px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.pane-input-wrapper:focus-within {
  border-color: var(--pane-accent, var(--accent-dim));
  box-shadow: var(--shadow-sm), 0 0 0 3px var(--pane-accent-glow, var(--accent-glow));
}

.pane-prompt-input {
  flex: 1;
  resize: none;
  padding: 8px 4px;
  background: transparent;
  color: var(--text);
  border: none;
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  max-height: 120px;
  overflow: hidden;
  outline: none;
}

.pane-prompt-input::placeholder {
  color: var(--text-dim);
}

.pane-input-actions {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  padding-bottom: 2px;
}

.pane-btn-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  background: var(--pane-accent, var(--accent-dim));
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.pane-btn-send:hover {
  filter: brightness(1.15);
  transform: scale(1.05);
  box-shadow: 0 2px 8px var(--pane-accent-glow, rgba(99, 102, 241, 0.4));
}

.pane-btn-send:active {
  transform: scale(0.97);
}

.pane-btn-abort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(248, 113, 113, 0.2);
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-sans);
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.pane-btn-abort:hover {
  background: rgba(248, 113, 113, 0.2);
  border-color: rgba(248, 113, 113, 0.3);
}

/* ─── Resize Handles ────────────────────────────────────────── */
.pane-resize-handle {
  position: absolute;
  z-index: 10;
  background: transparent;
  transition: background var(--transition-fast);
}

.pane-resize-handle:hover,
.pane-resize-handle.active {
  background: var(--accent-dim);
}

.pane-resize-handle.horizontal,
.pane-resize-handle.pane-resize-horizontal {
  height: 6px;
  width: 100%;
  left: 0;
  cursor: row-resize;
}

.pane-resize-handle.vertical,
.pane-resize-handle.pane-resize-vertical {
  width: 6px;
  height: 100%;
  top: 0;
  cursor: col-resize;
}

/* ═══════════════════════════════════════════════════════════════
   v1.3 — Split Screen: Layout Picker (Topbar)
   ═══════════════════════════════════════════════════════════════ */

.split-picker {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.split-picker-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 26px;
  padding: 0;
  background: transparent;
  color: var(--text-dim);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.split-picker-btn:hover {
  color: var(--text-secondary);
  background: var(--bg-hover);
}

.split-picker-btn.active {
  color: var(--accent);
  background: var(--accent-surface);
}

/* Layout icons inside picker buttons */
.split-icon {
  display: grid;
  gap: 1px;
  width: 14px;
  height: 12px;
}
.split-icon span {
  background: currentColor;
  border-radius: 1px;
  opacity: 0.7;
}
.split-icon.icon-single {
  grid-template: 1fr / 1fr;
}
.split-icon.icon-2col {
  grid-template: 1fr / 1fr 1fr;
}
.split-icon.icon-2row {
  grid-template: 1fr 1fr / 1fr;
}
.split-icon.icon-quad {
  grid-template: 1fr 1fr / 1fr 1fr;
}

/* ─── Pane Drop Zones (for tab dragging between panes) ────── */
.pane.drag-target {
  outline: 2px dashed var(--pane-accent, var(--accent));
  outline-offset: -2px;
}

/* ─── Single-pane backward compatibility ────────────────────── */
#pane-container.layout-single .pane {
  border-top-color: transparent;
}

/* ─── Light theme overrides ─────────────────────────────────── */
[data-theme="light"] .pane {
  background: #ffffff;
}
[data-theme="light"] .pane-tab-bar {
  background: #f8fafc;
}
[data-theme="light"] .pane-input-wrapper {
  background: #f8fafc;
  border-color: #e2e8f0;
}
[data-theme="light"] .split-picker {
  background: #f1f5f9;
  border-color: #e2e8f0;
}
[data-theme="light"] .tab.has-pane-color {
  background: color-mix(in srgb, var(--tab-pane-color, transparent) 8%, transparent);
}
[data-theme="light"] .tab.has-pane-color:hover {
  background: color-mix(in srgb, var(--tab-pane-color, transparent) 14%, transparent);
}
[data-theme="light"] .tab.has-pane-color.active {
  background: color-mix(in srgb, var(--tab-pane-color, transparent) 10%, transparent);
}
[data-theme="light"] .pane-tab.active {
  background: color-mix(in srgb, var(--pane-accent, #6366f1) 6%, #ffffff);
}
[data-theme="light"] .pane.focused {
  box-shadow: 0 2px 6px color-mix(in srgb, var(--pane-accent, #6366f1) 10%, transparent);
}

/* ═══════════════════════════════════════════════════════════════
   MINIMAP LOAD MORE (v1.3)
   ═══════════════════════════════════════════════════════════════ */
.minimap-load-more {
  display: block;
  width: 100%;
  padding: 6px 12px;
  background: var(--bg-surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: 11px;
  cursor: pointer;
  text-align: center;
  margin-bottom: 4px;
}
.minimap-load-more:hover {
  background: var(--bg-hover);
  border-color: var(--accent-dim);
}

/* ─── Collapsible Sidebar (desktop only) ──────────────────── */
@media (min-width: 769px) {
  body.sidebar-collapsed {
    padding-right: 0 !important;
  }
  body.sidebar-collapsed #sidebar {
    transform: translateX(100%);
    pointer-events: none;
    opacity: 0;
  }
  #sidebar {
    transition: transform 0.25s ease, opacity 0.2s ease;
  }
}

/* ─── Pane Upload Button ───────────────────────────────────── */
.pane-btn-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  background: transparent;
  color: var(--text-dim);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  transition: color var(--transition-fast), background var(--transition-fast);
}
.pane-btn-upload:hover {
  color: var(--text);
  background: var(--bg-hover);
}

/* ═══════════════════════════════════════════════════════════════
   COMMAND PALETTE (v1.4 — Ctrl+P)
   ═══════════════════════════════════════════════════════════════ */
.command-palette-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 20vh;
}
.command-palette-overlay.hidden { display: none; }

.command-palette {
  width: 100%;
  max-width: 580px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.command-palette-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.command-palette-icon {
  color: var(--text-dim);
  flex-shrink: 0;
}

.command-palette-input-row input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-bright);
  font-size: 15px;
  font-family: var(--font-sans);
}
.command-palette-input-row input::placeholder {
  color: var(--text-dim);
}

.command-palette-esc {
  font-size: 10px;
  padding: 2px 6px;
  background: var(--bg-surface);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--font-sans);
}

.command-palette-results {
  max-height: 320px;
  overflow-y: auto;
  padding: 4px 0;
}

.command-palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  cursor: pointer;
  color: var(--text);
  font-size: 13px;
  transition: background var(--transition-fast);
}
.command-palette-item:hover,
.command-palette-item.active {
  background: var(--accent-surface);
}

.command-palette-item-icon {
  color: var(--text-dim);
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.command-palette-item-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.command-palette-item-shortcut {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}

.command-palette-group {
  padding: 6px 16px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}


/* ═══════════════════════════════════════════════════════════════
   SEARCH MODAL (v1.4 — session search)
   ═══════════════════════════════════════════════════════════════ */
.search-modal-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
}

.search-modal-input-row input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-bright);
  font-size: 14px;
  font-family: var(--font-sans);
}
.search-modal-input-row input::placeholder {
  color: var(--text-dim);
}

.search-modal-results {
  max-height: 50vh;
  overflow-y: auto;
}

.search-result-item {
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background var(--transition-fast);
}
.search-result-item:hover {
  background: var(--bg-hover);
}
.search-result-item:last-child {
  border-bottom: none;
}

.search-result-session {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-result-session .search-result-date {
  font-weight: 400;
  font-size: 11px;
  color: var(--text-dim);
}

.search-result-snippet {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-snippet mark {
  background: var(--orange-dim);
  color: var(--orange);
  border-radius: 2px;
  padding: 0 2px;
}


/* ═══════════════════════════════════════════════════════════════
   SNIPPET CARDS (v1.4 — Skills sidebar)
   ═══════════════════════════════════════════════════════════════ */
.snippet-card {
  padding: 8px 12px;
  margin: 4px 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition-fast);
}
.snippet-card:hover {
  border-color: var(--border);
}

.snippet-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.snippet-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-bright);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.snippet-card-category {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  background: var(--accent-surface);
  color: var(--accent);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.snippet-card-preview {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-mono);
  margin-bottom: 6px;
}

.snippet-card-actions {
  display: flex;
  gap: 4px;
}

.snippet-action-btn {
  padding: 2px 8px;
  font-size: 11px;
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all var(--transition-fast);
}
.snippet-action-btn:hover {
  background: var(--bg-active);
  color: var(--text);
}
.snippet-action-btn.insert {
  background: var(--accent-surface);
  color: var(--accent);
  border-color: transparent;
}
.snippet-action-btn.insert:hover {
  background: var(--accent-dim);
  color: #fff;
}


/* ═══════════════════════════════════════════════════════════════
   DASHBOARD PANEL (v1.4 — Analytics sidebar)
   ═══════════════════════════════════════════════════════════════ */
.dashboard-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px;
}

.dashboard-stats-grid .dashboard-stat-card:nth-child(4),
.dashboard-stats-grid .dashboard-stat-card:nth-child(5) {
  /* Last 2 cards span wider in a 3-col grid */
}

.dashboard-stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}

.dashboard-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-bright);
  line-height: 1.2;
}

.dashboard-stat-label {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dashboard-section {
  padding: 8px 12px;
}

.dashboard-section .sidebar-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.dashboard-bar-chart {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dashboard-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.dashboard-bar-label {
  width: 80px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.dashboard-bar-track {
  flex: 1;
  height: 16px;
  background: var(--bg-surface);
  border-radius: 3px;
  overflow: hidden;
}

.dashboard-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  border-radius: 3px;
  transition: width 0.4s ease;
  min-width: 2px;
}

.dashboard-bar-value {
  width: 40px;
  text-align: right;
  font-size: 11px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.dashboard-table-container {
  max-height: 200px;
  overflow-y: auto;
}

.dashboard-table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
}

.dashboard-table thead th {
  text-align: left;
  padding: 6px 8px;
  color: var(--text-dim);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-raised);
}

.dashboard-table tbody td {
  padding: 5px 8px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

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


/* ═══════════════════════════════════════════════════════════════
   GIT PANEL (v1.4 — sidebar)
   ═══════════════════════════════════════════════════════════════ */
.git-branch-section {
  padding: 8px 12px;
}

.git-branch-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--green-dim);
  color: var(--green);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-mono);
}

.git-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.git-file-item:hover {
  background: var(--bg-hover);
}

.git-file-status {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.git-file-status.M  { background: var(--orange-dim); color: var(--orange); }
.git-file-status.A  { background: var(--green-dim); color: var(--green); }
.git-file-status.D  { background: var(--red-dim); color: var(--red); }
.git-file-status.R  { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.git-file-status.MM { background: var(--orange-dim); color: var(--orange); }
.git-file-status     { background: rgba(148,163,184,0.1); color: var(--text-dim); }

.git-file-name {
  flex: 1;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.git-commit-entry {
  padding: 6px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.git-commit-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.git-commit-sha {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 11px;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.git-commit-sha:hover {
  color: var(--accent-bright, var(--accent));
  text-decoration: underline;
}

.git-commit-date {
  font-size: 11px;
  color: var(--text-dim);
}

.git-commit-message {
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* ═══════════════════════════════════════════════════════════════
   PINNED MESSAGES (v1.4 — Overview sidebar)
   ═══════════════════════════════════════════════════════════════ */
.pinned-messages-container {
  /* Uses collapsible-section pattern now */
}
.pinned-messages-list {
  /* max-height/overflow handled by #sidebar-overview .collapsible-body */
}

.pinned-message-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 12px;
  transition: background var(--transition-fast);
}
.pinned-message-item:hover {
  background: var(--bg-hover);
}

.pinned-message-icon {
  color: var(--orange);
  font-size: 12px;
  flex-shrink: 0;
  margin-top: 1px;
}

.pinned-message-text {
  flex: 1;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.pinned-message-unpin {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 12px;
  padding: 0 2px;
  opacity: 0;
  transition: opacity 0.15s;
}
.pinned-message-item:hover .pinned-message-unpin {
  opacity: 1;
}
.pinned-message-unpin:hover {
  color: var(--red);
}


/* ─── Pin button on messages (v1.4) ─────────────────────── */
.msg-pin-btn {
  position: absolute;
  top: 8px;
  right: 36px;
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
  font-size: 12px;
  line-height: 1;
}
.msg-assistant:hover .msg-pin-btn { opacity: 1; }
.msg-user:hover .msg-pin-btn { opacity: 1; }
.msg-pin-btn:hover { background: var(--bg-active); color: var(--orange); }
.msg-pin-btn.pinned {
  opacity: 1;
  color: var(--orange);
  background: var(--orange-dim);
  border-color: transparent;
}

/* Position pin button on user messages differently */
.msg-user .msg-pin-btn {
  right: 8px;
  top: 8px;
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.7);
}
.msg-user .msg-pin-btn:hover {
  background: rgba(255,255,255,0.25);
  color: #fbbf24;
}
.msg-user .msg-pin-btn.pinned {
  background: rgba(251,191,36,0.25);
  color: #fbbf24;
  border-color: transparent;
}


/* ═══════════════════════════════════════════════════════════════
   RECONNECTING BANNER (v1.4)
   ═══════════════════════════════════════════════════════════════ */
.reconnecting-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1100;
  height: 32px;
  background: linear-gradient(90deg, #b45309, #d97706, #b45309);
  background-size: 200% 100%;
  animation: reconnect-shimmer 2s linear infinite;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reconnecting-banner.hidden { display: none; }

.reconnecting-banner-content {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.reconnecting-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

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


/* ═══════════════════════════════════════════════════════════════
   ENHANCED DIFF VIEW (v1.4 — side-by-side)
   ═══════════════════════════════════════════════════════════════ */
.diff-side-by-side {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
}

.diff-pane {
  flex: 1;
  overflow-x: auto;
  min-width: 0;
}

.diff-pane:first-child {
  border-right: 1px solid var(--border);
}

.diff-pane-header {
  padding: 6px 10px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
}

.diff-pane-header.old {
  color: var(--red);
}
.diff-pane-header.new {
  color: var(--green);
}

.diff-pane-content {
  white-space: pre;
  padding: 0;
}

.diff-pane-line {
  display: flex;
  min-height: 20px;
}

.diff-pane-line-number {
  width: 40px;
  text-align: right;
  padding: 0 8px 0 4px;
  color: var(--text-dim);
  user-select: none;
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
}

.diff-pane-line-text {
  flex: 1;
  padding: 0 8px;
  white-space: pre;
}

.diff-pane-line.added {
  background: rgba(34, 197, 94, 0.1);
}
.diff-pane-line.added .diff-pane-line-text {
  color: #22c55e;
}

.diff-pane-line.removed {
  background: rgba(239, 68, 68, 0.1);
}
.diff-pane-line.removed .diff-pane-line-text {
  color: #ef4444;
}

.diff-pane-line.empty {
  background: var(--bg-surface);
}

.diff-view-toggle {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}

.diff-view-toggle-btn {
  padding: 4px 10px;
  font-size: 11px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all var(--transition-fast);
}
.diff-view-toggle-btn.active {
  background: var(--accent-surface);
  color: var(--accent);
  border-color: var(--accent-dim);
}
.diff-view-toggle-btn:hover {
  background: var(--bg-hover);
}


/* ═══════════════════════════════════════════════════════════════
   TEAM MESSAGE FEED (v1.4 — Overview sidebar)
   ═══════════════════════════════════════════════════════════════ */
.team-feed-container {
  border-top: 1px solid var(--border-subtle);
  margin-top: 4px;
}

.team-feed-message {
  display: flex;
  gap: 8px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
}

.team-feed-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-surface);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

.team-feed-body {
  flex: 1;
  min-width: 0;
}

.team-feed-sender {
  font-weight: 600;
  color: var(--text-bright);
  font-size: 11px;
}

.team-feed-text {
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-feed-time {
  font-size: 10px;
  color: var(--text-dim);
  flex-shrink: 0;
}


/* ═══════════════════════════════════════════════════════════════
   v1.4 LIGHT THEME OVERRIDES
   ═══════════════════════════════════════════════════════════════ */
[data-theme="light"] .command-palette {
  background: #fff;
  border-color: #e2e8f0;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15);
}
[data-theme="light"] .command-palette-input-row input {
  color: #111827;
}
[data-theme="light"] .command-palette-item:hover,
[data-theme="light"] .command-palette-item.active {
  background: #f1f5f9;
}
[data-theme="light"] .command-palette-esc {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #6b7280;
}

[data-theme="light"] .search-result-snippet mark {
  background: rgba(217, 119, 6, 0.15);
  color: #b45309;
}

[data-theme="light"] .snippet-card {
  background: #f8f9fb;
  border-color: #e2e8f0;
}
[data-theme="light"] .snippet-action-btn {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #374151;
}

[data-theme="light"] .dashboard-stat-card {
  background: #f8f9fb;
  border-color: #e2e8f0;
}
[data-theme="light"] .dashboard-bar-track {
  background: #f1f5f9;
}

[data-theme="light"] .git-branch-badge {
  background: rgba(22, 163, 74, 0.08);
  color: #16a34a;
}

[data-theme="light"] .reconnecting-banner {
  background: linear-gradient(90deg, #d97706, #f59e0b, #d97706);
}

[data-theme="light"] .diff-pane-line.added {
  background: rgba(34, 197, 94, 0.08);
}
[data-theme="light"] .diff-pane-line.removed {
  background: rgba(239, 68, 68, 0.08);
}

[data-theme="light"] .msg-pin-btn {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #6b7280;
}
[data-theme="light"] .msg-pin-btn:hover {
  background: #e2e8f0;
  color: #d97706;
}
[data-theme="light"] .msg-pin-btn.pinned {
  background: rgba(217, 119, 6, 0.1);
  color: #d97706;
}

[data-theme="light"] .pinned-message-item:hover {
  background: #f1f5f9;
}

[data-theme="light"] .team-feed-message {
  border-bottom-color: #e2e8f0;
}

/* ─── Light theme overrides for v1.4.3 features ────────────── */

/* Conversation search bar (Ctrl+F) */
[data-theme="light"] #search-bar {
  background: #fff;
  border-bottom-color: #e2e8f0;
}
[data-theme="light"] #search-input {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #1e293b;
}
[data-theme="light"] #search-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.12);
}
[data-theme="light"] #search-count {
  color: #64748b;
}
[data-theme="light"] .search-nav-btn {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #64748b;
}
[data-theme="light"] .search-nav-btn:hover {
  background: #e2e8f0;
  color: #334155;
  border-color: #cbd5e1;
}
[data-theme="light"] mark.search-highlight {
  background: rgba(251, 191, 36, 0.25);
}
[data-theme="light"] mark.search-highlight.search-active {
  background: rgba(251, 191, 36, 0.5);
  outline-color: #d97706;
}

/* Scroll-to-bottom button */
[data-theme="light"] .scroll-to-bottom-btn {
  background: #fff;
  border-color: #e2e8f0;
  color: #64748b;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .scroll-to-bottom-btn:hover {
  background: #f1f5f9;
  color: #4f46e5;
  border-color: #c7d2fe;
}

/* Tab status dots — use slightly darker shades on light background */
[data-theme="light"] .tab-status.idle     { background: #22c55e; }
[data-theme="light"] .tab-status.thinking { background: #6366f1; }
[data-theme="light"] .tab-status.tool     { background: #f59e0b; }
[data-theme="light"] .tab-status.error    { background: #ef4444; }
[data-theme="light"] .tab-status.closed   { background: #94a3b8; }
[data-theme="light"] .pane-tab-status.idle     { background: #22c55e; }
[data-theme="light"] .pane-tab-status.thinking { background: #6366f1; }
[data-theme="light"] .pane-tab-status.tool     { background: #f59e0b; }
[data-theme="light"] .pane-tab-status.error    { background: #ef4444; }
[data-theme="light"] .pane-tab-status.closed   { background: #94a3b8; }
[data-theme="light"] .tab-keepalive { color: #e11d48; opacity: 0.5; }


/* ═══════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE (v1.3)
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Force single-pane, hide split picker */
  .split-picker { display: none !important; }

  /* Sidebar mobile handled by RESPONSIVE section above — using .mobile-open class */

  /* Tab bar scrolls horizontally */
  #tab-bar { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  #tab-bar::-webkit-scrollbar { height: 0; }
  #tab-search { display: none; }

  /* Compact topbar */
  #topbar { padding: 0 8px; gap: 4px; }
  .topbar-brand { font-size: 14px; }
  #btn-new-session span { display: none; }

  /* Full-width input */
  #input-wrapper, .pane-input-wrapper { max-width: 100%; }

  /* Command palette full-width on mobile */
  .command-palette { max-width: calc(100vw - 32px); }
  .command-palette-overlay { padding-top: 10vh; }

  /* Dashboard grid single column */
  .dashboard-stats-grid { grid-template-columns: 1fr 1fr; }

  /* Queue button - visible only on mobile */
  .mobile-queue-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    background: var(--bg-surface);
    color: var(--accent);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
  }
  .mobile-queue-btn:hover { background: var(--bg-hover); }
}

/* Queue button hidden on desktop */
@media (min-width: 769px) {
  .mobile-queue-btn { display: none !important; }
}
