/* ═══════════════════════════════════════════════════════════════
   Claude Workspace Manager - Catppuccin Mocha Theme
   Linear/Raycast/Vercel-inspired design language
   ═══════════════════════════════════════════════════════════════ */

/* ─── Reset & Base ──────────────────────────────────────────── */

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

/* Ensure hidden attribute works even when CSS sets display */
[hidden] {
  display: none !important;
}

:root {
  /* Catppuccin Mocha palette */
  --base: #1e1e2e;
  --mantle: #181825;
  --crust: #11111b;
  --surface0: #313244;
  --surface1: #45475a;
  --surface2: #585b70;
  --overlay0: #6c7086;
  --overlay1: #7f849c;
  --text: #cdd6f4;
  --subtext0: #a6adc8;
  --subtext1: #bac2de;
  --mauve: #cba6f7;
  --blue: #89b4fa;
  --green: #a6e3a1;
  --yellow: #f9e2af;
  --red: #f38ba8;
  --peach: #fab387;
  --teal: #94e2d5;
  --sky: #89dceb;
  --pink: #f5c2e7;
  --lavender: #b4befe;
  --flamingo: #f2cdcd;
  --rosewater: #f5e0dc;
  --sapphire: #74c7ec;

  /* Semantic tokens */
  --bg-primary: var(--base);
  --bg-secondary: var(--mantle);
  --bg-tertiary: var(--crust);
  --bg-elevated: var(--surface0);
  --border-subtle: rgba(69, 71, 90, 0.5);
  --border-default: var(--surface1);
  --text-primary: var(--text);
  --text-secondary: var(--subtext1);
  --text-tertiary: var(--subtext0);
  --text-muted: var(--overlay1);
  --accent: var(--mauve);

  /* UI Scale (overridden by localStorage-based inline style) */
  --ui-scale: 1;

  /* Dimensions */
  --sidebar-width: 280px;
  --header-height: 80px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 200ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 300ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2), 0 1px 3px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.25), 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.35), 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-xl: 0 16px 50px rgba(0, 0, 0, 0.45), 0 8px 20px rgba(0, 0, 0, 0.3);

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;

  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body {
  height: 100%;
  overflow: hidden;
}

::selection {
  background: rgba(203, 166, 247, 0.25);
  color: var(--text);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

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

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

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


/* ─── Typography ────────────────────────────────────────────── */

h1, h2, h3, h4 {
  font-weight: 600;
  letter-spacing: -0.01em;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.9em;
}


/* ─── Buttons ───────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  position: relative;
}

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

.btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

.btn svg {
  flex-shrink: 0;
}

/* Primary - mauve accent */
.btn-primary {
  background: var(--mauve);
  color: var(--crust);
}

.btn-primary:hover {
  background: #d4b4fa;
  box-shadow: 0 0 0 3px rgba(203, 166, 247, 0.2);
}

/* Danger */
.btn-danger {
  background: var(--red);
  color: var(--crust);
}

.btn-danger:hover {
  box-shadow: 0 0 0 3px rgba(243, 139, 168, 0.2);
}

/* Ghost - transparent */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--surface0);
  color: var(--text-primary);
}

/* Icon button */
.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
}

/* Small */
.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-sm.btn-icon {
  padding: 5px;
}

/* Full width */
.btn-full {
  width: 100%;
}

/* Danger hover variant (ghost that turns red on hover) */
.btn-danger-hover:hover {
  color: var(--red);
  background: rgba(243, 139, 168, 0.1);
}

/* Button loader */
.btn-loader {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.btn.loading .btn-text {
  opacity: 0.5;
}

.btn.loading .btn-loader {
  display: block;
}


/* ─── Inputs ────────────────────────────────────────────────── */

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input-wrapper {
  position: relative;
}

.input {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface0);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  transition: all var(--transition-fast);
}

.input::placeholder {
  color: var(--overlay0);
}

.input:hover {
  border-color: var(--surface2);
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(203, 166, 247, 0.15);
}

/* Password input with toggle - extra padding-right for the eye icon */
.input.input-has-toggle {
  padding-right: 40px;
}

/* Password show/hide toggle button */
.password-toggle-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--overlay1);
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
  z-index: 1;
}

.password-toggle-btn:hover {
  color: var(--text-primary);
  background: rgba(69, 71, 90, 0.4);
}

.password-toggle-btn:active {
  transform: translateY(-50%) scale(0.92);
}

textarea.input {
  resize: vertical;
  min-height: 72px;
}


/* ─── Status Badges ─────────────────────────────────────────── */

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

.status-dot-running {
  background: var(--green);
  box-shadow: 0 0 6px rgba(166, 227, 161, 0.5);
  animation: pulse-green 2s ease-in-out infinite;
}

.status-dot-stopped {
  background: var(--overlay0);
}

.status-dot-error {
  background: var(--red);
  box-shadow: 0 0 6px rgba(243, 139, 168, 0.4);
}

.status-dot-idle {
  background: var(--yellow);
  box-shadow: 0 0 6px rgba(249, 226, 175, 0.35);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  text-transform: capitalize;
}

.status-badge-running {
  background: rgba(166, 227, 161, 0.1);
  color: var(--green);
}

.status-badge-stopped {
  background: rgba(108, 112, 134, 0.15);
  color: var(--overlay1);
}

.status-badge-error {
  background: rgba(243, 139, 168, 0.1);
  color: var(--red);
}

.status-badge-idle {
  background: rgba(249, 226, 175, 0.1);
  color: var(--yellow);
}

/* ─── Session List Inline Badges ───────────────────────────── */

.session-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 500;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.3;
  margin-left: 4px;
  flex-shrink: 0;
}

.session-badge-port {
  background: rgba(137, 180, 250, 0.15);
  color: var(--blue);
}

.session-badge-warn {
  background: rgba(249, 226, 175, 0.15);
  color: var(--yellow);
}

.session-badge-model {
  background: rgba(203, 166, 247, 0.15);
  color: var(--mauve);
}

.session-badge-cost {
  background: rgba(166, 227, 161, 0.1);
  color: var(--green);
  font-family: 'JetBrains Mono', monospace;
}

.session-badge-agents {
  background: rgba(203, 166, 247, 0.15);
  color: var(--mauve);
}
.session-badge-agents::before {
  content: '\1F916 ';
  font-size: 9px;
}


/* ═══════════════════════════════════════════════════════════════
   LOGIN SCREEN
   ═══════════════════════════════════════════════════════════════ */

.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--crust);
  position: relative;
  overflow: hidden;
}

.login-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(203, 166, 247, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(203, 166, 247, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse 60% 50% at 50% 50%, black 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 60% 50% at 50% 50%, black 30%, transparent 100%);
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  padding: 40px 36px;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  animation: login-enter 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-brand {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.login-logo-img {
  width: 420px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 20px rgba(203, 166, 247, 0.3)) drop-shadow(0 0 60px rgba(203, 166, 247, 0.1));
  animation: logo-float 4s ease-in-out infinite, logo-glow 3s ease-in-out infinite alternate;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.login-logo-img:hover {
  transform: scale(1.05) translateY(-2px);
  filter: drop-shadow(0 0 30px rgba(203, 166, 247, 0.5)) drop-shadow(0 0 80px rgba(203, 166, 247, 0.2));
}

@keyframes logo-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes logo-glow {
  0% { filter: drop-shadow(0 0 15px rgba(203, 166, 247, 0.2)) drop-shadow(0 0 50px rgba(203, 166, 247, 0.05)); }
  100% { filter: drop-shadow(0 0 25px rgba(203, 166, 247, 0.4)) drop-shadow(0 0 70px rgba(203, 166, 247, 0.15)); }
}

@media (prefers-reduced-motion: reduce) {
  .login-logo-img {
    animation: none;
  }
  .login-logo-img:hover {
    transform: none;
  }
}

.login-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

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

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

.login-error {
  font-size: 13px;
  color: var(--red);
  min-height: 0;
  overflow: hidden;
  transition: all var(--transition-normal);
}

.login-error:empty {
  display: none;
}

.login-error:not(:empty) {
  padding: 10px 14px;
  background: rgba(243, 139, 168, 0.08);
  border: 1px solid rgba(243, 139, 168, 0.2);
  border-radius: var(--radius-sm);
}

.login-footer {
  text-align: center;
  font-size: 11px;
  color: var(--overlay0);
  margin-top: 24px;
}


/* ═══════════════════════════════════════════════════════════════
   APP LAYOUT
   ═══════════════════════════════════════════════════════════════ */

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh; /* Dynamic viewport height - adjusts for mobile browser chrome */
}

/* ─── Header ────────────────────────────────────────────────── */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  z-index: 20;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  flex-shrink: 1;
  min-width: 0;
}

.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
  background: var(--surface0);
  color: var(--text-primary);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: visible;
  position: relative;
  z-index: 1;
}

.header-logo-icon {
  width: 28px;
  height: 28px;
}

.header-logo-img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(203, 166, 247, 0.3));
  transition: filter 0.3s ease;
  pointer-events: auto;
}

.header-logo-img:hover {
  filter: drop-shadow(0 0 14px rgba(203, 166, 247, 0.45));
}

.header-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.header-center {
  display: flex;
  align-items: center;
}

/* View Mode Tabs */
.view-tabs {
  display: flex;
  align-items: center;
  background: var(--surface0);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}

.view-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.view-tab:hover {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
}

.view-tab.active {
  background: var(--bg-primary);
  box-shadow: var(--shadow-sm);
}

.view-tab.active[data-mode="workspace"] {
  color: var(--mauve);
}

.view-tab.active[data-mode="costs"] {
  color: var(--green);
}

.view-tab.active[data-mode="recent"] {
  color: var(--peach);
}

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

/* Stats chips */
.header-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 4px;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: var(--surface0);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.stat-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.stat-dot-running {
  background: var(--green);
  box-shadow: 0 0 4px rgba(166, 227, 161, 0.5);
}

.stat-chip svg {
  color: var(--overlay1);
}

.header-search-btn {
  position: relative;
}

/* ─── App Body (Sidebar + Main) ─────────────────────────────── */

.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}


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

.sidebar {
  width: var(--sidebar-width);
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  overflow: hidden;
  transition: width var(--transition-normal);
  flex-shrink: 0;
}

/* Sidebar Collapse Button Bar */
.sidebar-collapse-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sidebar-collapse-btn:hover {
  background: var(--surface0);
  color: var(--text-primary);
  border-color: var(--surface2);
}

/* Collapsed sidebar */
.sidebar.collapsed {
  width: 48px !important;
}

.sidebar.collapsed .sidebar-header,
.sidebar.collapsed .sidebar-list,
.sidebar.collapsed .sidebar-footer,
.sidebar.collapsed .sidebar-divider,
.sidebar.collapsed #projects-header,
.sidebar.collapsed #projects-list {
  display: none;
}

.sidebar.collapsed .sidebar-collapse-bar {
  padding: 8px 4px;
}

.sidebar.collapsed .sidebar-collapse-btn svg {
  transform: rotate(180deg);
}

/* Sidebar Resize Handle */
.sidebar-resize-handle {
  width: 4px;
  cursor: col-resize;
  background: transparent;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  transition: background var(--transition-fast);
}

.sidebar-resize-handle:hover,
.sidebar-resize-handle.active {
  background: var(--mauve);
}

/* Hide resize handle when sidebar is collapsed */
.sidebar.collapsed + .sidebar-resize-handle {
  display: none;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 8px;
}

.sidebar-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
}

.sidebar-meta {
  font-size: 11px;
  color: var(--overlay0);
}

/* Workspace Item */
.workspace-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  border: 1px solid transparent;
  margin-bottom: 2px;
}

.workspace-item:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border-subtle);
}

.workspace-item.active {
  background: var(--surface0);
  border-color: var(--border-subtle);
}

.workspace-item.workspace-drop-target {
  background: rgba(137, 180, 250, 0.1);
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px var(--blue);
}

/* Workspace reorder drop indicators */
.workspace-item.ws-drop-before {
  box-shadow: 0 -2px 0 0 var(--mauve);
}
.workspace-item.ws-drop-after {
  box-shadow: 0 2px 0 0 var(--mauve);
}
.workspace-item.dragging {
  opacity: 0.4;
}

.workspace-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.workspace-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

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

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

.workspace-session-count {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.workspace-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.workspace-item:hover .workspace-actions {
  opacity: 1;
}

.workspace-actions .btn {
  padding: 3px;
}

/* Workspace Accordion */
.workspace-accordion {
  margin-bottom: 1px;
}

.ws-chevron {
  font-size: 8px;
  color: var(--overlay0);
  transition: transform var(--transition-fast);
  display: inline-block;
  width: 12px;
  text-align: center;
  flex-shrink: 0;
}

.ws-chevron.open {
  transform: rotate(90deg);
}

.workspace-accordion-body {
  padding: 0 0 4px 0;
}

/* ─── Nested Workspace Tree ──────────────────────────── */
.ws-children {
  padding-left: 0;
}

.ws-item-child {
  padding-left: 28px !important;
}

.ws-item-child .workspace-name::before {
  content: '\2514\00a0';
  color: var(--surface2);
  font-size: 11px;
}

.ws-item-child.workspace-accordion {
  margin-bottom: 0;
}

.ws-item-child .workspace-accordion-body {
  padding-left: 12px;
}

.ws-session-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 34px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
  font-size: 12px;
  color: var(--text-tertiary);
}

.ws-session-item:hover {
  background: var(--surface0);
  color: var(--text-primary);
}

.ws-session-item.dragging {
  opacity: 0.4;
}

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

.ws-session-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-mono);
  font-size: 11px;
}

.ws-session-size {
  font-size: 10px;
  color: var(--subtext0);
  white-space: nowrap;
  margin-left: auto;
  padding: 0 4px;
}

.ws-session-time {
  font-size: 10px;
  color: var(--overlay0);
  white-space: nowrap;
}

.ws-session-empty {
  padding: 6px 12px 6px 34px;
  font-size: 11px;
  color: var(--overlay0);
}
.ws-session-hidden {
  opacity: 0.4;
}
.toggle-hidden-btn {
  font-size: 11px !important;
  gap: 4px;
  color: var(--overlay0) !important;
}
.toggle-hidden-btn.active {
  color: var(--mauve) !important;
}


/* ─── Main Content ──────────────────────────────────────────── */

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-primary);
}

/* Session List Panel */
.session-list-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px 12px;
  flex-shrink: 0;
}

.panel-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.session-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px 16px;
}

/* Session Item */
.session-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  margin-bottom: 4px;
}

.session-item:hover {
  background: rgba(255, 255, 255, 0.025);
  border-color: var(--border-subtle);
}

.session-item.active {
  background: var(--surface0);
  border-color: var(--border-default);
}

.session-status {
  flex-shrink: 0;
}

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

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

.session-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
}

.session-dir {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

.session-topic {
  font-size: 12px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.session-time {
  font-size: 11px;
  color: var(--overlay0);
  white-space: nowrap;
  margin-left: auto;
  flex-shrink: 0;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  text-align: center;
}

.empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 16px;
}

.empty-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}


/* ─── Session Detail Panel ──────────────────────────────────── */

.session-detail-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  animation: fade-in 0.15s ease;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 24px 12px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.detail-back-btn {
  display: none;
}

.detail-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

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

.detail-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

/* Meta */
.detail-meta {
  display: grid;
  gap: 1px;
  background: var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 20px;
}

.meta-row {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  background: var(--bg-primary);
}

.meta-row:first-child {
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.meta-row:last-child {
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.meta-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  width: 100px;
  flex-shrink: 0;
}

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

.meta-mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

/* Detail Control Bar */
.detail-control-bar {
  display: flex;
  gap: 8px;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

/* Logs */
.detail-logs {
  margin-top: 8px;
}

.detail-logs-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.logs-container {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 300px;
  overflow-y: auto;
  padding: 12px;
  background: var(--crust);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.log-entry {
  display: flex;
  gap: 10px;
  font-size: 12px;
  line-height: 1.6;
  font-family: var(--font-mono);
}

.log-time {
  color: var(--overlay0);
  flex-shrink: 0;
  font-size: 11px;
}

.log-message {
  color: var(--text-secondary);
  word-break: break-word;
}

.logs-empty {
  text-align: center;
  padding: 20px;
  font-size: 12px;
  color: var(--overlay0);
}

/* ─── Workspace Analytics ─────────────────────────────────── */

.detail-analytics {
  padding: 12px 16px;
  border-top: 1px solid var(--surface0);
}

.detail-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.analytics-card {
  background: var(--surface0);
  border-radius: 8px;
  padding: 10px 12px;
}

.analytics-card-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--overlay1);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.analytics-card-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  font-family: var(--font-mono);
  margin-top: 2px;
}

.analytics-card-value.cost-value {
  color: var(--green);
}

.analytics-top-sessions {
  margin-top: 12px;
}

.analytics-top-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--overlay1);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.analytics-top-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 12px;
}

.analytics-top-name {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}

.analytics-top-cost {
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 11px;
  flex-shrink: 0;
  margin-left: 8px;
}

/* ─── Cost Tracking Display ─────────────────────────────────── */

.cost-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--mantle);
  border-radius: var(--radius-md);
  border: 1px solid var(--surface0);
}

.cost-total {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
}

.cost-total-label {
  font-size: 11px;
  color: var(--subtext0);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cost-breakdown {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.cost-item {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--subtext1);
  padding: 4px 8px;
  background: var(--surface0);
  border-radius: var(--radius-sm);
}

.cost-item-value {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text);
  font-weight: 500;
}

.token-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--surface1);
  overflow: hidden;
  margin-top: 4px;
}

.token-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}

.token-bar-input { background: var(--blue); }
.token-bar-output { background: var(--peach); }
.token-bar-cache { background: var(--green); }

/* ─── Subagent Tracking ───────────────────────────────── */

.subagent-section {
  padding: 8px 16px;
  border-top: 1px solid var(--surface0);
}

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

.subagent-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--subtext0);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.subagent-count {
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--mauve);
  background: rgba(203, 166, 247, 0.1);
  padding: 1px 6px;
  border-radius: 8px;
}

.subagent-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 12px;
}

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

.subagent-dot-running {
  background: var(--green);
  box-shadow: 0 0 4px rgba(166, 227, 161, 0.5);
  animation: subagent-pulse 2s infinite;
}

.subagent-dot-completed {
  background: var(--surface2);
}

.subagent-name {
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subagent-type {
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--subtext0);
  background: var(--surface0);
  padding: 1px 4px;
  border-radius: 3px;
}

.subagent-status {
  font-size: 10px;
  color: var(--subtext0);
}

@keyframes subagent-pulse {
  0%, 100% { box-shadow: 0 0 4px rgba(166, 227, 161, 0.3); }
  50% { box-shadow: 0 0 10px rgba(166, 227, 161, 0.6); }
}

/* ─── Session Template Styles ───────────────────────────────── */

.template-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--surface0);
  border: 1px solid var(--surface1);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--subtext1);
  cursor: pointer;
  transition: all 0.15s ease;
}

.template-chip:hover {
  background: var(--surface1);
  color: var(--text);
  border-color: var(--mauve);
}

.template-chip-icon {
  font-size: 14px;
}

.template-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 0;
}


/* ═══════════════════════════════════════════════════════════════
   MODALS
   ═══════════════════════════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10002; /* Must be above .context-menu (z-index: 10000) so modals are never obscured */
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  background: rgba(17, 17, 27, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: overlay-in 0.15s ease;
}

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

/* ═══════════════════════════════════════════════════════════════
   SETTINGS OVERLAY
   ═══════════════════════════════════════════════════════════════ */

.settings-panel {
  width: 100%;
  max-width: 520px;
  max-height: 70vh;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  animation: modal-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

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

.settings-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.settings-search {
  position: relative;
  padding: 8px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.settings-search-icon {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--overlay0);
  pointer-events: none;
}

.settings-search-input {
  width: 100%;
  padding: 6px 8px 6px 26px;
  background: transparent;
  border: none;
  outline: none;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
}

.settings-search-input::placeholder {
  color: var(--overlay0);
}

.settings-body {
  overflow-y: auto;
  padding: 8px 0 12px;
  flex: 1;
  min-height: 0;
}

.settings-category {
  padding: 0 20px;
}

.settings-category + .settings-category {
  margin-top: 8px;
}

.settings-category-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--overlay0);
  padding: 8px 0 4px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.12s ease;
}

.settings-row:hover {
  background: var(--surface0);
}

.settings-row-info {
  flex: 1;
  min-width: 0;
}

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

.settings-row-desc {
  font-size: 11px;
  color: var(--subtext0);
  margin-top: 1px;
}

/* Toggle switch — Linear-style */
.settings-toggle {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
  cursor: pointer;
}

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

.settings-toggle-track {
  position: absolute;
  inset: 0;
  background: var(--surface1);
  border-radius: 10px;
  transition: background 0.15s ease;
}

.settings-toggle input:checked + .settings-toggle-track {
  background: var(--mauve);
}

.settings-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: var(--text);
  border-radius: 50%;
  transition: transform 0.15s ease;
  pointer-events: none;
}

.settings-toggle input:checked ~ .settings-toggle-thumb {
  transform: translateX(16px);
}

.settings-scale-control {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.settings-scale-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--surface1);
  background: var(--surface0);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}

.settings-scale-btn:hover {
  background: var(--surface1);
  border-color: var(--surface2);
}

.settings-scale-value {
  min-width: 40px;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.settings-empty {
  padding: 24px 20px;
  text-align: center;
  color: var(--overlay0);
  font-size: 13px;
}

.modal {
  width: 100%;
  max-width: 440px;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  animation: modal-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-body {
  padding: 20px 24px;
}

.modal-body .input-group {
  margin-bottom: 12px;
}

.modal-body .input-group:last-child {
  margin-bottom: 0;
}

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

.modal-body p strong {
  color: var(--text-primary);
  font-weight: 600;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px 20px;
}


/* ─── Quick Switcher ────────────────────────────────────────── */

.quick-switcher {
  width: 100%;
  max-width: 560px;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  animation: modal-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.qs-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.qs-icon {
  color: var(--overlay1);
  flex-shrink: 0;
}

.qs-search-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  outline: none;
}

.qs-search-input::placeholder {
  color: var(--overlay0);
}

.qs-shortcut {
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 2px 6px;
  background: var(--surface0);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-muted);
}

.qs-results {
  max-height: 340px;
  overflow-y: auto;
  padding: 6px;
}

.qs-result-group {
  padding: 6px 12px 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--overlay0);
}

.qs-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.qs-result:hover,
.qs-result.highlighted {
  background: var(--surface0);
}

.qs-result-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface0);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.qs-result.highlighted .qs-result-icon {
  background: var(--surface1);
}

.qs-result-info {
  flex: 1;
  min-width: 0;
}

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

.qs-result-detail {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qs-result-type {
  font-size: 10px;
  font-weight: 500;
  color: var(--overlay0);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

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

.qs-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  border-top: 1px solid var(--border-subtle);
}

.qs-hint {
  font-size: 11px;
  color: var(--overlay0);
}

.qs-hint kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 5px;
  background: var(--surface0);
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  margin-right: 2px;
}


/* ═══════════════════════════════════════════════════════════════
   TOASTS
   ═══════════════════════════════════════════════════════════════ */

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 12px 18px;
  background: var(--surface0);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  color: var(--text-primary);
  pointer-events: auto;
  animation: toast-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 380px;
  cursor: grab;
  user-select: none;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.toast.toast-dragging {
  cursor: grabbing;
  transition: none;
}

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

.toast.toast-swipe-exit {
  transition: transform 0.2s ease, opacity 0.2s ease;
  transform: translateX(120%);
  opacity: 0;
}

.toast-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-info .toast-icon { color: var(--blue); }
.toast-success .toast-icon { color: var(--green); }
.toast-warning .toast-icon { color: var(--yellow); }
.toast-error .toast-icon { color: var(--red); }

.toast-message {
  flex: 1;
  min-width: 0;
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: break-word;
  margin-right: 4px;
}

.toast-close {
  background: none;
  border: none;
  color: var(--overlay0);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  min-width: 20px;
  min-height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-close:hover {
  color: var(--text-primary);
  background: var(--surface1);
}


/* ═══════════════════════════════════════════════════════════════
   FALLBACK BANNER
   ═══════════════════════════════════════════════════════════════ */

.fallback-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  padding: 8px 16px;
  background: rgba(249, 226, 175, 0.12);
  border-bottom: 1px solid var(--yellow);
  color: var(--yellow);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.fallback-dismiss {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--yellow);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 14px;
}

.fallback-dismiss:hover {
  background: rgba(249, 226, 175, 0.15);
}


/* ═══════════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════════ */

@keyframes login-enter {
  0% {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-in {
  0% {
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-in {
  0% {
    opacity: 0;
    transform: translateX(24px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(24px) scale(0.95);
  }
}

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 4px rgba(166, 227, 161, 0.3); }
  50% { box-shadow: 0 0 10px rgba(166, 227, 161, 0.6); }
}

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

@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.06; }
  50% { opacity: 0.12; }
}

/* Skeleton loader */
.skeleton {
  background: var(--text-primary);
  border-radius: var(--radius-sm);
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.skeleton-line {
  height: 12px;
  margin-bottom: 8px;
}

.skeleton-line:last-child {
  width: 60%;
}


/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Tablet */
@media (max-width: 1024px) {
  .header-stats {
    display: none;
  }
}

/* Mobile */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 100%;
    --header-height: 50px;
  }

  .sidebar-toggle {
    display: flex;
  }

  .app-body {
    position: relative;
  }

  .sidebar {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    min-width: 280px;
    z-index: 30;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

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

  .header-brand {
    display: flex;
  }

  .header-logo-img {
    width: 38px;
    height: 38px;
  }

  .view-tabs {
    display: none;
  }

  /* Show view tabs as a row below header on mobile */
  .app-header {
    flex-wrap: wrap;
    height: auto;
    min-height: var(--header-height);
    padding-bottom: 8px;
  }

  .header-center {
    order: 3;
    width: 100%;
    padding: 0 4px;
  }

  .header-center .view-tabs {
    display: flex;
    width: 100%;
  }

  .header-center .view-tab {
    flex: 1;
    justify-content: center;
  }

  .session-dir {
    max-width: 160px;
  }

  .detail-back-btn {
    display: flex;
  }

  .session-list-panel.detail-active {
    display: none;
  }

  .modal {
    max-width: calc(100% - 32px);
    margin: 0 16px;
  }

  .quick-switcher {
    max-width: calc(100% - 32px);
    margin: 0 16px;
  }

  .toast-container {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }

  .toast {
    max-width: 100%;
  }

  /* Mobile terminal - detailed rules in styles-mobile.css (Phase 4).
     Keep minimal overrides here for base layout. */
  .terminal-resize-handle { display: none; }

  /* Larger sidebar section resize handle for touch */
  .sidebar-section-resize {
    height: 20px;
    margin: 4px 8px;
  }
  .sidebar-section-resize::after {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: var(--surface1);
    border-radius: 2px;
    margin: 8px auto 0;
  }

  .app {
    height: var(--vh, 100vh);
    height: var(--vh, 100dvh);
  }

  #workspace-list { min-height: 0; overflow-y: auto; }
  #projects-list { min-height: 0; max-height: 200px; overflow-y: auto; }

  .sidebar-resize-handle { display: none; }
  .sidebar-collapse-bar { display: none; }
}

/* ─── Mobile Terminal Tab Strip ──────────────────────────────── */

.terminal-tab-strip {
  display: none;
}

@media (max-width: 768px) {
  .terminal-tab-strip {
    display: flex;
    gap: 2px;
    padding: 4px 6px;
    background: var(--crust);
    border-bottom: 1px solid var(--surface0);
    overflow-x: auto;
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
  }
}

.terminal-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--mantle);
  border: 1px solid var(--surface0);
  border-radius: var(--radius-sm);
  color: var(--subtext0);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.terminal-tab.active {
  background: var(--surface0);
  color: var(--text);
  font-weight: 600;
  border-color: var(--mauve);
}

.terminal-tab-close {
  background: none;
  border: none;
  color: var(--overlay0);
  font-size: 16px;
  padding: 0 2px;
  cursor: pointer;
  line-height: 1;
}

.terminal-tab-close:hover {
  color: var(--red);
}

.terminal-tab-add {
  color: var(--overlay0);
  font-size: 16px;
  font-weight: 600;
  padding: 6px 14px;
}

.terminal-tab-add:hover {
  color: var(--green);
  border-color: var(--green);
}

/* ─── Mobile Terminal Toolbar ──────────────────────────────── */

.terminal-mobile-toolbar {
  display: none;
}

@media (max-width: 768px) {
  .terminal-mobile-toolbar {
    display: flex;
    gap: 4px;
    padding: 6px 8px;
    background: var(--crust);
    border-top: 1px solid var(--surface0);
    overflow-x: auto;
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
  }

  .terminal-mobile-toolbar button {
    padding: 8px 12px;
    background: var(--surface0);
    border: 1px solid var(--surface1);
    border-radius: var(--radius-sm);
    color: var(--subtext0);
    font-size: 12px;
    font-family: 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;
    white-space: nowrap;
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
  }

  .terminal-mobile-toolbar button:active {
    background: var(--surface1);
    color: var(--text);
  }

  .terminal-mobile-toolbar .toolbar-send {
    background: var(--green);
    color: var(--base);
    border-color: var(--green);
    font-weight: 600;
  }

  .terminal-mobile-toolbar .toolbar-send:active {
    opacity: 0.8;
  }
  .terminal-mobile-toolbar .toolbar-upload {
    min-width: 44px; font-size: 13px; color: var(--blue); border-color: var(--blue);
  }
  .terminal-mobile-toolbar .toolbar-upload:active { opacity: 0.8; }
}

/* Small mobile */
@media (max-width: 480px) {
  .panel-header {
    padding: 12px 16px 8px;
  }

  .session-list {
    padding: 0 8px 8px;
  }

  .detail-body {
    padding: 16px;
  }

  .detail-meta {
    display: flex;
    flex-direction: column;
  }

  .meta-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .meta-label {
    width: auto;
  }
}


/* ─── Sidebar overlay on mobile ─────────────────────────────── */

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: rgba(17, 17, 27, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: overlay-in 0.15s ease;
}

.sidebar-backdrop[hidden] {
  display: none;
}


/* ─── Workspace color picker in modal ───────────────────────── */

.color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0;
}

.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.color-swatch:hover {
  transform: scale(1.15);
}

.color-swatch.selected {
  border-color: var(--text-primary);
  box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 4px currentColor;
}

.color-swatch.selected::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  background: var(--crust);
  border-radius: 50%;
}

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

.context-menu {
  position: fixed;
  z-index: 10000;
  min-width: 180px;
  /* overflow must be visible so submenus (position: absolute, left: 100%)
     aren't clipped - scrolling is on the inner .context-menu-items instead */
  overflow: visible;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: ctx-in 0.12s ease-out;
}

.context-menu > .context-menu-items {
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--surface2) transparent;
}

.context-menu > .context-menu-items::-webkit-scrollbar {
  width: 6px;
}

.context-menu > .context-menu-items::-webkit-scrollbar-track {
  background: transparent;
}

.context-menu > .context-menu-items::-webkit-scrollbar-thumb {
  background: var(--surface2);
  border-radius: 3px;
}

@keyframes ctx-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.context-menu[hidden] {
  display: none !important;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: none;
  background: none;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  border-radius: 6px;
  width: 100%;
  text-align: left;
  white-space: nowrap;
}

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

.context-menu-item .ctx-icon {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.7;
}

.context-menu-item .ctx-check {
  margin-left: auto;
  opacity: 0.4;
  font-size: 12px;
}

/* Checked items get bright green checkmark and slightly highlighted text */
.context-menu-item.ctx-checked .ctx-check {
  color: var(--green);
  opacity: 1;
  font-weight: 700;
}

.context-menu-item.ctx-checked {
  color: var(--text);
}

/* Danger items (e.g. bypass permissions when active) - red text and bright red check */
.context-menu-item.ctx-danger {
  color: var(--red);
}

.context-menu-item.ctx-danger.ctx-checked {
  color: var(--red);
  background: rgba(243, 139, 168, 0.08);
}

.context-menu-item.ctx-danger.ctx-checked .ctx-check {
  color: var(--red);
  opacity: 1;
  font-weight: 700;
}

.context-menu-item.ctx-danger:hover {
  background: rgba(243, 139, 168, 0.15);
}

.context-menu-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 8px;
}

.context-menu-item[disabled] {
  opacity: 0.35;
  pointer-events: none;
}

/* ─── Context Menu Submenus ─────────────────────────────── */
.ctx-item-wrapper {
  position: relative;
}

.ctx-has-submenu {
  justify-content: flex-start;
}

.ctx-hint {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-secondary);
  opacity: 0.6;
  padding-right: 4px;
}

.ctx-arrow {
  font-size: 10px;
  opacity: 0.5;
  flex-shrink: 0;
}

.ctx-submenu {
  display: none;
  /* Use fixed positioning so submenus escape all ancestor overflow contexts.
     Actual top/left values are computed in JS when submenu opens. */
  position: fixed;
  min-width: 160px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 10001;
}

.ctx-submenu.ctx-submenu-visible {
  display: block;
  animation: ctx-in 0.1s ease-out;
}

/* ─── Discover Sessions ───────────────────────────────────── */

.discover-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  margin-bottom: 6px;
  transition: background 0.15s ease;
}

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

.discover-check {
  flex-shrink: 0;
}

.discover-cb {
  width: 16px;
  height: 16px;
  accent-color: var(--mauve);
  cursor: pointer;
}

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

.discover-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.discover-path {
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.discover-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}

.discover-count {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

.discover-time {
  font-size: 11px;
  color: var(--text-tertiary);
}

.discover-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 1px 5px;
  border-radius: 3px;
}

.discover-badge-claude {
  background: rgba(203, 166, 247, 0.15);
  color: var(--mauve);
}

.discover-badge-missing {
  background: rgba(243, 139, 168, 0.15);
  color: var(--red);
}


/* ═══════════════════════════════════════════════════════════════
   SIDEBAR PROJECTS & DIVIDER
   ═══════════════════════════════════════════════════════════════ */

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

/* Vertical resize handle between Workspaces and Projects */
.sidebar-section-resize {
  height: 6px;
  cursor: row-resize;
  background: transparent;
  flex-shrink: 0;
  position: relative;
  margin: 0 8px;
  border-radius: 3px;
  transition: background var(--transition-fast);
}

.sidebar-section-resize:hover,
.sidebar-section-resize.active {
  background: var(--mauve);
}

/* Project search bar */
.projects-search-bar {
  padding: 4px 8px;
}
.projects-search-input {
  width: 100%;
  padding: 5px 8px;
  font-size: 12px;
  font-family: var(--font-mono);
  background: var(--surface0);
  color: var(--text-primary);
  border: 1px solid var(--surface1);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition-fast);
}
.projects-search-input:focus {
  border-color: var(--accent);
}
.projects-search-input::placeholder {
  color: var(--overlay0);
}

/* Find a Conversation button */
.find-conversation-btn {
  display: flex;
  align-items: center;
  width: 100%;
  margin-top: 4px;
  padding: 5px 8px;
  font-size: 11px;
  color: var(--subtext0);
  border: 1px dashed var(--surface1);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  justify-content: center;
}
.find-conversation-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(203, 166, 247, 0.05);
}

/* Find Conversation Modal */
.find-convo-modal {
  width: min(600px, 90vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.find-convo-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}
.find-convo-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  font-family: var(--font-mono);
  background: var(--surface0);
  color: var(--text-primary);
  border: 1px solid var(--surface1);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition-fast);
}
.find-convo-input:focus {
  border-color: var(--accent);
}
.find-convo-input::placeholder {
  color: var(--overlay0);
}
.find-convo-hint {
  font-size: 11px;
  color: var(--overlay0);
  padding: 0 2px;
}
.find-convo-results {
  overflow-y: auto;
  max-height: calc(80vh - 160px);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.find-convo-result {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  background: var(--surface0);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.find-convo-result:hover {
  background: var(--surface1);
  border-color: var(--accent);
}
.find-convo-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.find-convo-result-project {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.find-convo-result-meta {
  font-size: 10px;
  color: var(--overlay0);
  white-space: nowrap;
  font-family: var(--font-mono);
}
.find-convo-result-topic {
  font-size: 12px;
  color: var(--text-primary);
  line-height: 1.4;
}
.find-convo-result-preview {
  font-size: 11px;
  color: var(--subtext0);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.find-convo-result-id {
  font-size: 10px;
  color: var(--overlay0);
  font-family: var(--font-mono);
}
.find-convo-loading {
  text-align: center;
  padding: 24px;
  color: var(--overlay0);
  font-size: 12px;
}
.find-convo-empty {
  text-align: center;
  padding: 24px;
  color: var(--overlay0);
  font-size: 12px;
}

/* Project accordion */
.project-accordion { margin: 0 4px; }
.project-accordion.missing { opacity: 0.4; }
.project-accordion.project-hidden { opacity: 0.45; }
.project-accordion-header {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: var(--radius-sm);
  cursor: pointer; transition: background var(--transition-fast);
  font-size: 13px; color: var(--text-secondary);
}
.project-accordion-header:hover { background: var(--surface0); color: var(--text-primary); }
.project-accordion-header .project-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.project-accordion-header .project-size { font-size: 11px; color: var(--overlay0); font-family: var(--font-mono); }
.project-accordion-header .project-session-count {
  font-size: 10px; color: var(--overlay0); background: var(--surface0);
  padding: 1px 5px; border-radius: 8px; font-family: var(--font-mono);
}
.project-accordion-chevron {
  font-size: 8px; color: var(--overlay0); transition: transform var(--transition-fast);
  display: inline-block; width: 12px; text-align: center;
}
.project-accordion-chevron.open { transform: rotate(90deg); }
.project-accordion-body { padding: 0 0 4px 0; }

/* Session sub-items inside projects */
.project-session-item {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 28px; border-radius: var(--radius-sm);
  cursor: grab; transition: background var(--transition-fast);
  font-size: 12px; color: var(--text-tertiary);
}
.project-session-item:hover { background: var(--surface0); color: var(--text-primary); }
.project-session-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-session-size { font-size: 10px; color: var(--overlay0); font-family: var(--font-mono); }
.project-session-time { font-size: 10px; color: var(--overlay0); }
.project-session-item.dragging { opacity: 0.4; }

/* Legacy flat project item (keep for compatibility) */
.project-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; margin: 2px 8px; border-radius: var(--radius-sm);
  cursor: grab; transition: background var(--transition-fast);
  font-size: 13px; color: var(--text-secondary);
}
.project-item:hover { background: var(--surface0); color: var(--text-primary); }
.project-item.missing { opacity: 0.4; cursor: not-allowed; }
.project-item .project-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.project-item .project-size { font-size: 11px; color: var(--overlay0); font-family: var(--font-mono); }
.project-item .project-time { font-size: 11px; color: var(--overlay0); }
.project-item.dragging { opacity: 0.4; }


/* ═══════════════════════════════════════════════════════════════
   WORKSPACE GROUPS
   ═══════════════════════════════════════════════════════════════ */

.workspace-group {
  margin-bottom: 8px;
}

.workspace-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin: 0 6px 3px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--subtext1);
  /* Subtle tinted background - lighter than active workspace to avoid confusion */
  background: color-mix(in srgb, var(--group-color, var(--mauve)) 6%, var(--mantle));
  border: 1px solid color-mix(in srgb, var(--group-color, var(--mauve)) 15%, var(--surface1));
  border-left: 3px solid var(--group-color, var(--mauve));
  border-radius: 6px;
  transition: all 0.15s ease;
  user-select: none;
}

.workspace-group-header:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--group-color, var(--mauve)) 10%, var(--mantle));
  border-color: color-mix(in srgb, var(--group-color, var(--mauve)) 25%, var(--surface2));
  border-left-color: var(--group-color, var(--mauve));
}

.workspace-group-header:active {
  transform: scale(0.99);
}

.workspace-group-header .group-chevron {
  transition: transform 0.15s ease;
  font-size: 10px;
  display: inline-block;
  color: var(--overlay0);
  flex-shrink: 0;
}

.workspace-group-header .group-chevron.open {
  transform: rotate(180deg);
}

.workspace-group-header .group-color-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 5px color-mix(in srgb, var(--group-color, var(--mauve)) 40%, transparent);
}

.workspace-group-header .group-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-group-header .group-count {
  margin-left: auto;
  font-size: 10px;
  color: var(--overlay0);
  background: color-mix(in srgb, var(--group-color, var(--mauve)) 10%, var(--surface0));
  padding: 1px 6px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-weight: 600;
  flex-shrink: 0;
}

/* Indent grouped workspaces more so they visually nest under the header */
.workspace-group .workspace-group-items {
  padding-left: 16px;
  margin-left: 6px;
  border-left: 1px solid color-mix(in srgb, var(--group-color, var(--mauve)) 15%, var(--surface1));
}

.workspace-group-empty {
  padding: 8px 16px;
  font-size: 11px;
  color: var(--overlay0);
}

.workspace-group-header.group-drop-target {
  background: color-mix(in srgb, var(--group-color, var(--mauve)) 15%, var(--mantle));
  border-color: var(--group-color, var(--mauve));
  border-left-color: var(--group-color, var(--mauve));
  color: var(--text);
}


/* ═══════════════════════════════════════════════════════════════
   DRAG & DROP STATES
   ═══════════════════════════════════════════════════════════════ */

.drag-over {
  outline: 2px dashed var(--mauve) !important;
  outline-offset: -2px;
  background: rgba(203, 166, 247, 0.05) !important;
}
.dragging { opacity: 0.4 !important; }
.drop-indicator {
  height: 2px; background: var(--mauve);
  margin: 0 8px; border-radius: 1px;
  animation: dropPulse 1s ease-in-out infinite alternate;
}
@keyframes dropPulse { 0% { opacity: 0.5; } 100% { opacity: 1; } }


/* ═══════════════════════════════════════════════════════════════
   WORKSPACE DOCUMENTATION
   ═══════════════════════════════════════════════════════════════ */

.docs-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

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

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

.docs-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.docs-workspace-name {
  font-size: 12px;
  color: var(--subtext0);
  padding: 2px 8px;
  background: var(--surface0);
  border-radius: 4px;
}

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

#docs-toggle-raw.active {
  background: var(--surface1);
  color: var(--text);
}

.docs-structured {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.docs-section {
  margin-bottom: 24px;
}

.docs-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  cursor: pointer;
  user-select: none;
}

.docs-section-chevron {
  font-size: 10px;
  color: var(--overlay0);
  transition: transform 150ms ease;
  display: inline-block;
}

.docs-section-chevron.open {
  transform: rotate(90deg);
}

.docs-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--subtext1);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0;
}

.docs-section-count {
  font-size: 11px;
  color: var(--overlay0);
  background: var(--surface0);
  padding: 1px 6px;
  border-radius: 8px;
  font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
}

.docs-add-btn {
  margin-left: auto;
  font-size: 16px;
  line-height: 1;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.docs-section-body {
  padding-left: 4px;
}

.docs-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  transition: background 150ms ease;
}

.docs-item:hover {
  background: var(--surface0);
}

.docs-item-done .docs-item-text {
  text-decoration: line-through;
  color: var(--overlay0);
}

.docs-note-time {
  font-size: 11px;
  font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
  color: var(--overlay0);
  white-space: nowrap;
  flex-shrink: 0;
  padding-top: 1px;
}

.docs-item-text,
.docs-note-text {
  font-size: 13px;
  color: var(--text);
  flex: 1;
  line-height: 1.4;
}

.docs-checkbox {
  display: flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
  padding-top: 2px;
}

.docs-checkbox input[type="checkbox"] {
  accent-color: var(--mauve);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.docs-item-delete {
  opacity: 0;
  transition: opacity 150ms ease;
  flex-shrink: 0;
  font-size: 12px;
  padding: 2px 4px;
  color: var(--overlay0);
}

.docs-item:hover .docs-item-delete {
  opacity: 0.6;
}

.docs-item-delete:hover {
  opacity: 1 !important;
  color: var(--red);
}

/* Roadmap items */
.roadmap-status-dot {
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.roadmap-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  transition: background 150ms ease, box-shadow 150ms ease;
}

.roadmap-planned .roadmap-dot {
  background: var(--overlay0);
}

.roadmap-active .roadmap-dot {
  background: var(--yellow);
  box-shadow: 0 0 4px rgba(249, 226, 175, 0.4);
}

.roadmap-done .roadmap-dot {
  background: var(--green);
}

.roadmap-done .docs-item-text {
  text-decoration: line-through;
  opacity: 0.5;
}

.roadmap-status-label {
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 8px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.roadmap-planned .roadmap-status-label {
  color: var(--overlay1);
  background: var(--surface0);
}

.roadmap-active .roadmap-status-label {
  color: var(--yellow);
  background: rgba(249, 226, 175, 0.1);
}

.roadmap-done .roadmap-status-label {
  color: var(--green);
  background: rgba(166, 227, 161, 0.1);
}

/* Latte overrides for roadmap */
:root[data-theme="latte"] .roadmap-active .roadmap-dot {
  box-shadow: 0 0 4px rgba(223, 142, 29, 0.4);
}

:root[data-theme="latte"] .roadmap-active .roadmap-status-label {
  background: rgba(223, 142, 29, 0.1);
}

:root[data-theme="latte"] .roadmap-done .roadmap-status-label {
  background: rgba(64, 160, 43, 0.1);
}

/* Rules items */
.docs-rule-item {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  border-left: 2px solid var(--yellow);
  margin-bottom: 4px;
  background: rgba(249, 226, 175, 0.05);
  border-radius: 0 4px 4px 0;
}

.docs-rule-item .docs-item-text {
  flex: 1;
  font-size: 12px;
}

.docs-rule-icon {
  color: var(--yellow);
  margin-right: 6px;
  flex-shrink: 0;
  font-size: 13px;
}

:root[data-theme="latte"] .docs-rule-item {
  background: rgba(223, 142, 29, 0.05);
  border-left-color: var(--yellow);
}

.docs-empty {
  font-size: 12px;
  color: var(--overlay0);
  padding: 8px;
  font-style: italic;
}

.docs-raw {
  flex: 1;
  display: flex;
  padding: 16px 20px;
  min-height: 0;
}

.docs-raw-editor {
  flex: 1;
  background: var(--mantle);
  color: var(--text);
  border: 1px solid var(--surface0);
  border-radius: 8px;
  padding: 16px;
  font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
  font-size: 13px;
  line-height: 1.6;
  resize: none;
  outline: none;
}

.docs-raw-editor:focus {
  border-color: var(--mauve);
}

/* ─── Feature Board (Kanban) ────────────────────────────── */

.docs-tabs {
  display: flex;
  gap: 2px;
  padding: 0 16px;
  border-bottom: 1px solid var(--surface0);
  flex-shrink: 0;
}

.docs-tab {
  background: none;
  border: none;
  color: var(--subtext0);
  font-size: 12px;
  font-weight: 500;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}

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

.docs-tab.active {
  color: var(--mauve);
  border-bottom-color: var(--mauve);
}

.feature-board {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.board-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 8px 12px;
  border-bottom: 1px solid var(--surface0);
}

.board-columns {
  display: flex;
  gap: 8px;
  padding: 12px;
  overflow-x: auto;
  flex: 1;
}

.board-column {
  flex: 1;
  min-width: 180px;
  max-width: 280px;
  display: flex;
  flex-direction: column;
  background: var(--mantle);
  border-radius: 8px;
  overflow: hidden;
}

.board-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid var(--surface0);
}

.board-column-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--subtext0);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.board-column-count {
  font-size: 10px;
  font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
  color: var(--overlay0);
  background: var(--surface0);
  padding: 1px 6px;
  border-radius: 8px;
}

.board-column-body {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  min-height: 80px;
}

.board-card {
  background: var(--base);
  border: 1px solid var(--surface0);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 6px;
  cursor: grab;
  transition: border-color 0.15s, box-shadow 0.15s;
}

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

.board-card.dragging {
  opacity: 0.5;
}

.board-card-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}

.board-card-desc {
  font-size: 11px;
  color: var(--subtext0);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.board-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.board-card-priority {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 500;
}

.board-card-priority-urgent { background: rgba(210, 15, 57, 0.15); color: var(--red); }
.board-card-priority-high { background: rgba(254, 100, 11, 0.15); color: var(--peach); }
.board-card-priority-normal { background: rgba(30, 102, 245, 0.15); color: var(--blue); }
.board-card-priority-low { background: rgba(172, 176, 190, 0.15); color: var(--overlay0); }

.board-card-sessions {
  font-size: 10px;
  color: var(--subtext0);
  font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
}

/* Drop target highlight */
.board-column-body.drag-over {
  background: rgba(203, 166, 247, 0.05);
  border-radius: 4px;
}

/* ═══════════════════════════════════════════════════════════════
   TERMINAL GRID
   ═══════════════════════════════════════════════════════════════ */

.terminal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 2px;
  flex: 1;
  min-height: 0;
  background: var(--crust);
}
.terminal-grid[data-panes="1"] { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.terminal-grid[data-panes="2"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
.terminal-grid[data-panes="3"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.terminal-pane {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--base); overflow: hidden;
  min-height: 0;
}
.terminal-pane-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 12px; background: var(--mantle);
  border-bottom: 1px solid var(--surface0);
  font-size: 13px; color: var(--subtext0);
  flex-shrink: 0;
}
.terminal-pane-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; color: var(--text); }
.terminal-pane:not(.terminal-pane-empty) .terminal-pane-title {
  cursor: text;
}

/* Activity indicator - shows real-time Claude Code activity (Reading, Writing, etc.) */
.terminal-pane-activity {
  font-size: 11px;
  color: var(--overlay1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
  transition: opacity 150ms ease;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 1;
}

.terminal-pane-activity:empty {
  display: none;
}

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

.activity-dot-thinking { background: var(--mauve); animation: activityPulse 1.5s ease-in-out infinite; }
.activity-dot-reading { background: var(--blue); }
.activity-dot-writing { background: var(--green); }
.activity-dot-running { background: var(--peach); animation: activityPulse 1.5s ease-in-out infinite; }
.activity-dot-searching { background: var(--yellow); }
.activity-dot-delegating { background: var(--teal); }
.activity-dot-idle { background: var(--overlay0); }

@keyframes activityPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Respect reduced motion for activity pulse */
@media (prefers-reduced-motion: reduce) {
  .activity-dot-thinking, .activity-dot-running { animation: none; }
}

.terminal-pane-close { width: 20px; height: 20px; padding: 0; }
/* Upload image button - floating bottom-right of terminal pane */
.terminal-pane-upload {
  position: absolute; bottom: 12px; right: 12px; z-index: 5;
  width: 32px; height: 32px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface0); border: 1px solid var(--surface1);
  border-radius: 8px; color: var(--subtext0); cursor: pointer;
  opacity: 0; transition: opacity 0.15s, background 0.15s;
}
.terminal-pane:not(.terminal-pane-empty):hover .terminal-pane-upload,
.terminal-pane-upload:focus-visible { opacity: 0.7; }
.terminal-pane-upload:hover { opacity: 1 !important; background: var(--surface1); color: var(--text); }
/* On mobile, hide floating upload button - mobile toolbar has its own upload btn */
@media (max-width: 768px) {
  .terminal-pane-upload { display: none; }
}
/* Image file drag indicator - blue dashed (vs mauve for sessions) */
.terminal-pane.image-drag-over { position: relative; }
.terminal-pane.image-drag-over .terminal-container {
  outline: 2px dashed var(--blue); outline-offset: -2px;
}
.terminal-pane.image-drag-over::after {
  content: 'Drop image here'; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%); color: var(--blue);
  font-size: 14px; font-weight: 600; pointer-events: none; z-index: 10;
}
.terminal-container { flex: 1; overflow: hidden; }
.terminal-pane-empty .terminal-container {
  display: flex; align-items: center; justify-content: center;
  border: 2px dashed var(--surface1); margin: 8px;
  border-radius: var(--radius-md); color: var(--overlay0);
  font-size: 13px;
}
.terminal-pane-empty .terminal-container::after { content: 'Drop a session here'; }
.terminal-pane-empty.drag-over .terminal-container {
  border-color: var(--mauve); color: var(--mauve);
  background: rgba(203, 166, 247, 0.05);
}

/* Terminal pane drag-to-reposition */
.terminal-pane-header {
  cursor: grab;
}
.terminal-pane-empty .terminal-pane-header {
  cursor: default;
}
.terminal-pane-dragging {
  opacity: 0.5;
}
.terminal-pane:not(.terminal-pane-dragging).drag-over {
  box-shadow: inset 0 0 0 2px var(--mauve);
}

/* Active terminal pane highlight */
.terminal-pane-active {
  box-shadow: inset 0 0 0 1px var(--mauve);
}
.terminal-pane-active > .terminal-pane-header {
  background: var(--surface0);
  border-bottom-color: var(--mauve);
  color: var(--text);
}

/* ─── Pane Color Highlights ────────────────────────────── */
/* Subtle left-border accent per slot when enabled */
html.pane-colors-enabled .terminal-pane:not(.terminal-pane-empty)[data-slot="0"] > .terminal-pane-header {
  border-left: 3px solid var(--mauve);
}
html.pane-colors-enabled .terminal-pane:not(.terminal-pane-empty)[data-slot="1"] > .terminal-pane-header {
  border-left: 3px solid var(--blue);
}
html.pane-colors-enabled .terminal-pane:not(.terminal-pane-empty)[data-slot="2"] > .terminal-pane-header {
  border-left: 3px solid var(--green);
}
html.pane-colors-enabled .terminal-pane:not(.terminal-pane-empty)[data-slot="3"] > .terminal-pane-header {
  border-left: 3px solid var(--peach);
}

/* ─── Sidebar Pane Color Pip ───────────────────────────── */
.pane-color-pip {
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-left: 2px;
}
html:not(.pane-colors-enabled) .pane-color-pip {
  display: none;
}

/* ─── Activity Indicators toggle ───────────────────────── */
html.activity-indicators-disabled .terminal-pane-activity {
  display: none !important;
}

/* Terminal grid resize handles */
.terminal-grid {
  position: relative;
}
.terminal-resize-handle {
  position: absolute;
  z-index: 10;
  background: transparent;
  transition: background 0.15s ease;
}
.terminal-resize-col {
  top: 0;
  width: 6px;
  height: 100%;
  cursor: col-resize;
}
.terminal-resize-row {
  left: 0;
  width: 100%;
  height: 6px;
  cursor: row-resize;
}
.terminal-resize-handle:hover {
  background: rgba(203, 166, 247, 0.4);
}
.terminal-resize-handle.active {
  background: var(--mauve);
}

/* Terminal view tab active color */
.view-tab.active[data-mode="terminal"] {
  color: var(--green);
}

/* ═══════════════════════════════════════════════════════════ */
/* PHASE 2: Nested Session Display (Project Groups)           */
/* ═══════════════════════════════════════════════════════════ */

.ws-project-group {
  margin-left: 8px;
  border-left: 1px solid var(--surface1);
}

.ws-project-group-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  cursor: pointer;
  color: var(--subtext0);
  font-size: 11px;
  font-family: var(--font-mono);
  user-select: none;
  transition: color var(--transition-fast);
  border-radius: 4px;
  margin: 2px 0;
}

.ws-project-group-header:hover {
  color: var(--text);
  background: var(--surface0);
}

.ws-project-group-chevron {
  font-size: 8px;
  transition: transform var(--transition-fast);
  color: var(--overlay0);
  flex-shrink: 0;
}

.ws-project-group-chevron.collapsed {
  transform: rotate(-90deg);
}

.ws-project-group-path {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.ws-project-group-count {
  font-size: 10px;
  color: var(--overlay0);
  background: var(--surface1);
  padding: 0 5px;
  border-radius: 8px;
  flex-shrink: 0;
}

.ws-project-group-body {
  padding-left: 4px;
}

.ws-project-group-body.collapsed {
  display: none;
}

/* ═══════════════════════════════════════════════════════════ */
/* PHASE 3: Inline Session Rename                             */
/* ═══════════════════════════════════════════════════════════ */

.inline-rename-input {
  background: var(--surface0);
  border: 1px solid var(--mauve);
  color: var(--text);
  font-size: inherit;
  font-family: inherit;
  padding: 1px 4px;
  border-radius: 4px;
  outline: none;
  width: 100%;
  box-shadow: 0 0 0 2px rgba(203, 166, 247, 0.2);
}

.ws-session-item .ws-session-name,
.session-item .session-name {
  cursor: default;
}

@keyframes rename-flash {
  0% { background: rgba(166, 227, 161, 0.2); }
  100% { background: transparent; }
}

.rename-flash {
  animation: rename-flash 0.6s ease;
}

/* ═══════════════════════════════════════════════════════════ */
/* PHASE 4: Terminal Tab Groups Bar                           */
/* ═══════════════════════════════════════════════════════════ */

.terminal-groups-bar {
  display: flex;
  align-items: center;
  padding: 4px 12px;
  background: var(--mantle);
  border-bottom: 1px solid var(--surface0);
  flex-shrink: 0;
}

.terminal-groups-tabs {
  display: flex;
  gap: 2px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
  align-items: center;
}

.terminal-groups-tabs::-webkit-scrollbar {
  display: none;
}

.terminal-group-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--subtext0);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
  position: relative;
}

.terminal-group-tab:hover {
  color: var(--text);
  background: var(--surface0);
}

.terminal-group-tab.active {
  color: var(--green);
  background: var(--surface0);
}

.terminal-group-tab-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}

.terminal-group-tab-dot.inactive {
  background: var(--surface2);
}

.terminal-group-tab-count {
  font-size: 10px;
  color: var(--overlay0);
  background: var(--surface1);
  padding: 0 4px;
  border-radius: 6px;
}

.terminal-group-tab-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-size: 14px;
  line-height: 1;
  border-radius: 4px;
  opacity: 0;
  color: var(--subtext0);
  transition: all 0.12s;
  margin-left: 2px;
  flex-shrink: 0;
}

.terminal-group-tab:hover .terminal-group-tab-close {
  opacity: 0.7;
}

.terminal-group-tab-close:hover {
  opacity: 1 !important;
  color: var(--red);
  background: rgba(243, 139, 168, 0.15);
}

.terminal-groups-add {
  position: sticky;
  right: 0;
  flex-shrink: 0;
  padding: 4px 6px;
  background: var(--mantle);
  border: none;
  border-radius: 6px;
  color: var(--overlay0);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  margin-left: 4px;
}

.terminal-groups-add:hover {
  color: var(--text);
  background: var(--surface0);
}

/* ── Tab Group Folders ── */

.tab-folder {
  display: flex;
  align-items: center;
  gap: 1px;
  position: relative;
}

.tab-folder::after {
  content: '';
  width: 1px;
  height: 16px;
  background: var(--surface1);
  margin: 0 4px;
  flex-shrink: 0;
}

.tab-folder-header {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--folder-color, var(--mauve));
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.tab-folder-header:hover {
  background: color-mix(in srgb, var(--folder-color, var(--mauve)) 10%, transparent);
}

.tab-folder-header.tab-drag-over {
  background: color-mix(in srgb, var(--folder-color, var(--mauve)) 20%, transparent);
  box-shadow: inset 0 0 0 1px var(--folder-color, var(--mauve));
}

.tab-folder-chevron {
  font-size: 9px;
  line-height: 1;
  opacity: 0.7;
}

.tab-folder-name {
  line-height: 1;
}

.tab-folder-count {
  font-size: 9px;
  color: var(--folder-color, var(--mauve));
  opacity: 0.6;
  background: color-mix(in srgb, var(--folder-color, var(--mauve)) 10%, transparent);
  padding: 0 3px;
  border-radius: 4px;
}

/* Tabs inside a folder get a subtle left border accent */
.tab-folder:not(.collapsed) .terminal-group-tab {
  border-left: 2px solid color-mix(in srgb, var(--folder-color, var(--mauve)) 30%, transparent);
  border-radius: 0 6px 6px 0;
  margin-left: 0;
}

.tab-folder.collapsed .terminal-group-tab {
  display: none;
}

/* ═══════════════════════════════════════════════════════════ */
/* PHASE 5: Notes Editor Modal                                */
/* ═══════════════════════════════════════════════════════════ */

.notes-editor-modal {
  width: min(60vw, 800px);
  min-width: 400px;
  height: 55vh;
  min-height: 300px;
  background: var(--base);
  border: 1px solid var(--surface1);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
}

.notes-editor-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--surface0);
  flex-shrink: 0;
}

.notes-editor-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.notes-editor-toolbar {
  display: flex;
  gap: 2px;
}

.notes-toolbar-btn {
  font-size: 12px !important;
  padding: 3px 8px !important;
  min-width: 28px;
}

.notes-editor-textarea {
  flex: 1;
  padding: 16px;
  background: var(--mantle);
  border: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  resize: none;
  outline: none;
}

.notes-editor-textarea::placeholder {
  color: var(--overlay0);
}

.notes-editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid var(--surface0);
  flex-shrink: 0;
}

.notes-editor-hint {
  font-size: 11px;
  color: var(--overlay0);
}

.notes-editor-actions {
  display: flex;
  gap: 8px;
}

#notes-editor-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
}

#notes-editor-overlay[hidden] {
  display: none;
}

@media (max-width: 768px) {
  .notes-editor-modal {
    width: 95vw;
    min-width: unset;
    height: 70vh;
  }
}

/* ═══════════════════════════════════════════════════════════ */
/* PHASE 6: AI Insights                                       */
/* ═══════════════════════════════════════════════════════════ */

.docs-ai-section {
  border-top: 1px solid var(--surface0);
  margin-top: 8px;
  padding-top: 4px;
}

.docs-ai-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-insights-empty {
  padding: 16px;
  text-align: center;
  color: var(--overlay0);
  font-size: 12px;
  font-style: italic;
}

.ai-insight-card {
  background: var(--surface0);
  border: 1px solid var(--surface1);
  border-radius: 8px;
  padding: 10px 12px;
  transition: border-color var(--transition-fast);
}

.ai-insight-card:hover {
  border-color: var(--surface2);
}

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

.ai-insight-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.ai-insight-badge {
  font-size: 10px;
  color: var(--subtext0);
  background: var(--surface1);
  padding: 1px 6px;
  border-radius: 4px;
}

.ai-insight-theme {
  font-size: 11px;
  color: var(--subtext1);
  margin-bottom: 4px;
  line-height: 1.4;
}

.ai-insight-theme strong {
  color: var(--subtext0);
  font-weight: 500;
}

.ai-insight-recent {
  font-size: 11px;
  color: var(--overlay1);
  line-height: 1.4;
}

.ai-insight-recent strong {
  color: var(--subtext0);
  font-weight: 500;
}

.ai-insight-skeleton {
  background: var(--surface0);
  border-radius: 8px;
  padding: 12px;
  animation: skeleton-pulse 1.5s ease infinite;
}

.ai-insight-skeleton-line {
  height: 10px;
  background: var(--surface1);
  border-radius: 4px;
  margin-bottom: 6px;
}

.ai-insight-skeleton-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--subtext0);
  margin-bottom: 8px;
}

.ai-insight-skeleton-line:nth-child(2) { width: 60%; }
.ai-insight-skeleton-line:nth-child(3) { width: 90%; }
.ai-insight-skeleton-line:nth-child(4) { width: 75%; }

/* Loading header with spinner */
.ai-insights-loading-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface0);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--blue);
  margin-bottom: 4px;
}

.ai-loading-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--surface2);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: ai-spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

/* Refresh button spinning state */
#docs-ai-refresh.ai-loading svg {
  animation: ai-spin 0.8s linear infinite;
}
#docs-ai-refresh.ai-loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Error card styling */
.ai-insight-error {
  border-left: 3px solid var(--red);
}
.ai-badge-error {
  background: var(--red) !important;
  color: var(--base) !important;
}

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

/* ═══════════════════════════════════════════════════════════ */
/* COSTS DASHBOARD                                             */
/* ═══════════════════════════════════════════════════════════ */

.costs-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 0;
}

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

.costs-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.costs-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.costs-period-selector {
  display: flex;
  gap: 2px;
  background: var(--surface0);
  border-radius: 6px;
  padding: 2px;
}

.costs-period-btn {
  font-size: 11px;
  font-weight: 500;
  color: var(--subtext0);
  background: transparent;
  border: none;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.costs-period-btn:hover {
  color: var(--text);
}

.costs-period-btn.active {
  background: var(--surface2);
  color: var(--text);
}

.costs-refresh-btn {
  color: var(--subtext0);
}

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

.costs-loading {
  text-align: center;
  color: var(--subtext0);
  padding: 48px 0;
  font-size: 13px;
}

/* Summary Cards */
.costs-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.costs-card {
  background: var(--surface0);
  border: 1px solid var(--surface1);
  border-radius: 8px;
  padding: 14px 16px;
}

.costs-card-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--subtext0);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.costs-card-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.costs-card-value.green { color: var(--green); }
.costs-card-value.blue { color: var(--blue); }
.costs-card-value.mauve { color: var(--mauve); }
.costs-card-value.peach { color: var(--peach); }

.costs-card-sub {
  font-size: 11px;
  color: var(--subtext0);
  margin-top: 2px;
}

/* Timeline Chart */
.costs-chart-section {
  background: var(--surface0);
  border: 1px solid var(--surface1);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
}

.costs-chart-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 12px;
}

.costs-chart-container {
  position: relative;
  width: 100%;
  height: 180px;
}

.costs-chart-container svg {
  width: 100%;
  height: 100%;
}

.costs-chart-container .chart-line {
  fill: none;
  stroke: var(--green);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.costs-chart-container .chart-area {
  fill: var(--green);
  opacity: 0.08;
}

.costs-chart-container .chart-dot {
  fill: var(--green);
  cursor: pointer;
  transition: r 0.15s ease;
}

.costs-chart-container .chart-dot:hover {
  r: 5;
}

.costs-chart-container .chart-grid {
  stroke: var(--surface1);
  stroke-width: 0.5;
}

.costs-chart-container .chart-label {
  fill: var(--subtext0);
  font-size: 10px;
  font-family: inherit;
}

.costs-chart-container .chart-label-y {
  text-anchor: end;
}

.costs-chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 180px;
  color: var(--subtext0);
  font-size: 13px;
}

/* Chart Tooltip */
.costs-chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--crust);
  border: 1px solid var(--surface2);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 11px;
  color: var(--text);
  white-space: nowrap;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.costs-chart-tooltip.visible {
  opacity: 1;
}

.costs-chart-tooltip-date {
  color: var(--subtext0);
  font-size: 10px;
}

.costs-chart-tooltip-value {
  font-weight: 600;
  color: var(--green);
}

/* Breakdown Section */
.costs-breakdown {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.costs-breakdown-card {
  background: var(--surface0);
  border: 1px solid var(--surface1);
  border-radius: 8px;
  padding: 16px;
}

.costs-breakdown-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 12px;
}

.costs-breakdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.costs-breakdown-bar-track {
  flex: 1;
  height: 6px;
  background: var(--surface1);
  border-radius: 3px;
  overflow: hidden;
}

.costs-breakdown-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.costs-breakdown-label {
  font-size: 12px;
  color: var(--text);
  min-width: 80px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.costs-breakdown-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--subtext1);
  font-variant-numeric: tabular-nums;
  min-width: 50px;
  text-align: right;
}

.costs-breakdown-empty {
  color: var(--subtext0);
  font-size: 12px;
  padding: 8px 0;
}

/* Session Cost Table */
.costs-sessions-section {
  background: var(--surface0);
  border: 1px solid var(--surface1);
  border-radius: 8px;
  overflow: hidden;
}

.costs-sessions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
}

.costs-sessions-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.costs-sessions-search {
  background: var(--mantle);
  border: 1px solid var(--surface1);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--text);
  outline: none;
  width: 180px;
  transition: border-color 0.15s;
}

.costs-sessions-search::placeholder {
  color: var(--overlay0);
}

.costs-sessions-search:focus {
  border-color: var(--green);
}

.costs-sessions-table {
  width: 100%;
  border-collapse: collapse;
}

.costs-sessions-table th {
  font-size: 10px;
  font-weight: 600;
  color: var(--subtext0);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--surface1);
  cursor: pointer;
  user-select: none;
}

.costs-sessions-table th:hover {
  color: var(--text);
}

.costs-sessions-table th.sort-active {
  color: var(--green);
}

.costs-sessions-table th.sort-active::after {
  content: ' ▾';
}

.costs-sessions-table th.sort-active.sort-asc::after {
  content: ' ▴';
}

.costs-sessions-table td {
  font-size: 12px;
  color: var(--text);
  padding: 8px 12px;
  border-bottom: 1px solid var(--surface0);
}

.costs-sessions-table tr {
  transition: background 0.1s;
}

.costs-sessions-table tbody tr:hover {
  background: var(--mantle);
}

.costs-sessions-table .cost-cell {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--green);
}

.costs-sessions-table .model-cell {
  font-size: 11px;
  color: var(--subtext0);
}

.costs-sessions-table .workspace-cell {
  font-size: 11px;
  color: var(--subtext0);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.costs-sessions-table .name-cell {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.costs-sessions-empty {
  text-align: center;
  color: var(--subtext0);
  padding: 24px;
  font-size: 12px;
}

/* Responsive: stack cards on narrow screens */
@media (max-width: 768px) {
  .costs-summary {
    grid-template-columns: repeat(2, 1fr);
  }
  .costs-breakdown {
    grid-template-columns: 1fr;
  }
  .costs-card-value {
    font-size: 18px;
  }
}

/* ═══════════════════════════════════════════════════════════ */
/* PHASE 7: Resources Panel                                   */
/* ═══════════════════════════════════════════════════════════ */

.resources-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 0;
}

.resources-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  flex-shrink: 0;
}

.resources-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.resources-refresh-indicator {
  font-size: 11px;
  color: var(--overlay0);
}

.resources-body {
  flex: 1;
  padding: 0 20px 20px;
  overflow-y: auto;
}

.resources-loading {
  padding: 40px;
  text-align: center;
  color: var(--overlay0);
  font-size: 13px;
}

.resources-system-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.resource-card {
  background: var(--surface0);
  border: 1px solid var(--surface1);
  border-radius: 10px;
  padding: 14px 16px;
}

.resource-card-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--overlay1);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.resource-card-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  font-family: var(--font-mono);
  margin-bottom: 6px;
}

.resource-bar {
  height: 6px;
  background: var(--surface1);
  border-radius: 3px;
  overflow: hidden;
}

.resource-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease, background 0.3s ease;
}

.resource-bar-fill.level-ok {
  background: var(--green);
}

.resource-bar-fill.level-warn {
  background: var(--yellow);
}

.resource-bar-fill.level-danger {
  background: var(--red);
}

.resources-claude-section {
  margin-top: 8px;
}

.resources-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.resources-section-title .total-badge {
  font-size: 11px;
  font-weight: 500;
  color: var(--mauve);
  background: rgba(203, 166, 247, 0.1);
  padding: 2px 8px;
  border-radius: 6px;
}

.claude-session-table {
  width: 100%;
  border-collapse: collapse;
}

.claude-session-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  color: var(--overlay1);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--surface1);
}

.claude-session-table td {
  font-size: 12px;
  color: var(--text);
  padding: 8px 10px;
  border-bottom: 1px solid var(--surface0);
}

.claude-session-table tr:hover td {
  background: var(--surface0);
}

.claude-session-table .session-name-cell {
  font-weight: 500;
}

.claude-session-table .pid-cell {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--subtext0);
}

.claude-session-table .mem-cell,
.claude-session-table .cpu-cell {
  font-family: var(--font-mono);
  font-size: 12px;
}

.resources-empty {
  padding: 24px;
  text-align: center;
  color: var(--overlay0);
  font-size: 12px;
}

.resources-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.resources-refresh-btn {
  padding: 4px 6px !important;
  color: var(--overlay1);
  transition: color 150ms ease, transform 150ms ease;
}
.resources-refresh-btn:hover {
  color: var(--text);
}
.resources-refresh-btn.refreshing svg {
  animation: spin 0.8s linear infinite;
}

/* Session action buttons in resources table */
.resource-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: flex-end;
}

.resource-action-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
  transition: all 150ms ease;
  white-space: nowrap;
}

.resource-action-btn:hover {
  background: var(--surface1);
}

.resource-action-btn.action-stop {
  color: var(--yellow);
}
.resource-action-btn.action-stop:hover {
  border-color: var(--yellow);
  background: rgba(249, 226, 175, 0.1);
}

.resource-action-btn.action-restart {
  color: var(--blue);
}
.resource-action-btn.action-restart:hover {
  border-color: var(--blue);
  background: rgba(137, 180, 250, 0.1);
}

.resource-action-btn.action-kill {
  color: var(--red);
}
.resource-action-btn.action-kill:hover {
  border-color: var(--red);
  background: rgba(243, 139, 168, 0.1);
}

.resource-action-btn.action-start {
  color: var(--green);
}
.resource-action-btn.action-start:hover {
  border-color: var(--green);
  background: rgba(166, 227, 161, 0.1);
}

/* CPU cell styling */
.cpu-cell {
  font-family: var(--font-mono);
  font-size: 12px;
}

.cpu-high { color: var(--red); }
.cpu-medium { color: var(--yellow); }
.cpu-low { color: var(--green); }

/* Workspace label */
.resource-workspace-label {
  font-size: 10px;
  color: var(--overlay0);
  display: block;
  margin-top: 1px;
}

/* Stopped sessions section */
.resources-stopped-section {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--surface0);
}

.resources-stopped-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--overlay1);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 0;
  transition: color 150ms ease;
}
.resources-stopped-toggle:hover {
  color: var(--text);
}
.resources-stopped-toggle svg {
  transition: transform 150ms ease;
}
.resources-stopped-toggle.expanded svg {
  transform: rotate(90deg);
}

/* Resources view tab active color */
.view-tab.active[data-mode="resources"] {
  color: var(--peach);
}

/* ═══════════════════════════════════════════════════════════
   PORT LINKS & GIT BADGES
   ═══════════════════════════════════════════════════════════ */

.port-link {
  color: var(--blue);
  text-decoration: none;
  font-family: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;
  font-size: 12px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(137, 180, 250, 0.08);
  transition: background 150ms ease;
}
.port-link:hover {
  background: rgba(137, 180, 250, 0.18);
  text-decoration: underline;
}

.ports-cell {
  font-family: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;
  font-size: 12px;
}

.git-branch-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(166, 227, 161, 0.1);
  color: var(--green);
  font-family: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;
  margin-left: 6px;
  white-space: nowrap;
  vertical-align: middle;
}
.git-branch-badge.dirty {
  background: rgba(249, 226, 175, 0.1);
  color: var(--yellow);
}

/* ═══════════════════════════════════════════════════════════
   TUNNEL MANAGEMENT
   ═══════════════════════════════════════════════════════════ */

.resources-tunnel-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--surface0);
}

.expose-port-btn {
  font-size: 10px !important;
  padding: 1px 5px !important;
  color: var(--blue);
  opacity: 0.6;
  transition: opacity 150ms ease;
  margin-left: 2px;
  vertical-align: middle;
}
.expose-port-btn:hover {
  opacity: 1;
}

.copy-tunnel-url {
  font-size: 11px !important;
  padding: 2px 6px !important;
  margin-left: 4px;
}

/* ═══════════════════════════════════════════════════════════ */
/* Terminal loading animation - subtle RGB border glow         */
/* ═══════════════════════════════════════════════════════════ */

@keyframes rgb-border-glow {
  0%   { border-color: var(--mauve); box-shadow: inset 0 0 0 1px var(--mauve), 0 0 8px rgba(203, 166, 247, 0.15); }
  33%  { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue), 0 0 8px rgba(137, 180, 250, 0.15); }
  66%  { border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal), 0 0 8px rgba(148, 226, 213, 0.15); }
  100% { border-color: var(--mauve); box-shadow: inset 0 0 0 1px var(--mauve), 0 0 8px rgba(203, 166, 247, 0.15); }
}

.terminal-pane-loading {
  animation: rgb-border-glow 3s ease-in-out infinite;
}

.terminal-pane-loading .terminal-pane-title::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-left: 6px;
  vertical-align: middle;
  animation: rgb-border-glow 3s ease-in-out infinite;
  background: var(--mauve);
}

@keyframes loading-dot-pulse {
  0%, 100% { background: var(--mauve); }
  33% { background: var(--blue); }
  66% { background: var(--teal); }
}

.terminal-pane-loading .terminal-pane-title::after {
  animation: loading-dot-pulse 3s ease-in-out infinite;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .terminal-pane-loading { animation: none; border-color: var(--mauve); }
  .terminal-pane-loading .terminal-pane-title::after { animation: none; }
}

/* Terminal pane done - green flash when Claude finishes working */
@keyframes pane-done-flash {
  0% { box-shadow: inset 0 0 0 2px var(--green), 0 0 12px rgba(166, 227, 161, 0.3); }
  100% { box-shadow: none; }
}

.terminal-pane-done {
  animation: pane-done-flash 4s ease-out forwards;
}

/* Tab group notification badge - pulsing green dot on inactive group tabs */
.terminal-group-tab.tab-notify {
  position: relative;
}
.terminal-group-tab.tab-notify::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: loading-dot-pulse 2s ease-in-out infinite;
}

/* Respect reduced motion for completion notifications */
@media (prefers-reduced-motion: reduce) {
  .terminal-pane-done { animation: none; box-shadow: inset 0 0 0 2px var(--green); }
  .terminal-group-tab.tab-notify::after { animation: none; }
}

/* Tab group drag-and-drop reorder */
.terminal-group-tab.tab-dragging {
  opacity: 0.4;
  outline: 1px dashed var(--overlay0);
}
.terminal-group-tab.tab-drag-over {
  background: var(--surface1);
  box-shadow: inset 0 0 0 1px var(--mauve);
}

.terminal-group-tab.tab-drag-merge {
  box-shadow: 0 0 8px var(--mauve), inset 0 0 0 1px var(--mauve);
  background: color-mix(in srgb, var(--mauve) 15%, var(--surface0));
  animation: drag-merge-pulse 0.8s ease-in-out infinite;
}

@keyframes drag-merge-pulse {
  0%, 100% { box-shadow: 0 0 4px var(--mauve), inset 0 0 0 1px var(--mauve); }
  50% { box-shadow: 0 0 12px var(--mauve), inset 0 0 0 1px var(--mauve); }
}

/* ═══════════════════════════════════════════════════════════ */
/* CATPPUCCIN LATTE (Light Theme)                              */
/* ═══════════════════════════════════════════════════════════ */

:root[data-theme="latte"] {
  /* Catppuccin Latte palette */
  --base: #eff1f5;
  --mantle: #e6e9ef;
  --crust: #dce0e8;
  --surface0: #ccd0da;
  --surface1: #bcc0cc;
  --surface2: #acb0be;
  --overlay0: #9ca0b0;
  --overlay1: #8c8fa1;
  --text: #4c4f69;
  --subtext0: #6c6f85;
  --subtext1: #5c5f77;
  --mauve: #8839ef;
  --blue: #1e66f5;
  --green: #40a02b;
  --yellow: #df8e1d;
  --red: #d20f39;
  --peach: #fe640b;
  --teal: #179299;
  --sky: #04a5e5;
  --pink: #ea76cb;
  --lavender: #7287fd;
  --flamingo: #dd7878;
  --rosewater: #dc8a78;
  --sapphire: #209fb5;

  /* Semantic overrides */
  --border-subtle: rgba(172, 176, 190, 0.5);

  /* Shadows - lighter for light theme */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.1), 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 16px 50px rgba(0, 0, 0, 0.12), 0 8px 20px rgba(0, 0, 0, 0.1);
}

/* Theme toggle icon visibility */
:root[data-theme="latte"] .theme-icon-moon { display: none; }
:root[data-theme="latte"] .theme-icon-sun { display: block !important; }

/* ═══════════════════════════════════════════════════════════ */
/* UI Scale Controls                                           */
/* ═══════════════════════════════════════════════════════════ */

html {
  zoom: var(--ui-scale, 1);
}

/* Old header scale controls removed - now in Settings */

/* Theme picker dropdown */
.theme-picker {
  position: relative;
}

.theme-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--mantle);
  border: 1px solid var(--surface0);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  min-width: 140px;
  padding: 4px;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  border: none;
  background: none;
  color: var(--subtext1);
  font-size: 12px;
  font-family: inherit;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
}

.theme-option:hover {
  background: var(--surface0);
  color: var(--text);
}

.theme-option.active {
  color: var(--mauve);
  font-weight: 600;
}

.theme-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}


/* Latte-specific overrides for hardcoded rgba values in Mocha */
:root[data-theme="latte"] ::selection {
  background: rgba(136, 57, 239, 0.2);
  color: var(--text);
}

:root[data-theme="latte"] .stat-dot-running {
  background: var(--green);
  box-shadow: 0 0 4px rgba(64, 160, 43, 0.5);
}

:root[data-theme="latte"] .terminal-pane-empty.drag-over .terminal-container {
  background: rgba(136, 57, 239, 0.05);
}

:root[data-theme="latte"] .terminal-resize-handle:hover {
  background: rgba(136, 57, 239, 0.4);
}


/* ═══════════════════════════════════════════════════════════ */
/* CATPPUCCIN FRAPPE (Medium-Dark Theme)                       */
/* ═══════════════════════════════════════════════════════════ */

:root[data-theme="frappe"] {
  /* Catppuccin Frappe palette */
  --base: #303446;
  --mantle: #292c3c;
  --crust: #232634;
  --surface0: #414559;
  --surface1: #51576d;
  --surface2: #626880;
  --overlay0: #737994;
  --overlay1: #838ba7;
  --text: #c6d0f5;
  --subtext0: #a5adce;
  --subtext1: #b5bfe2;
  --mauve: #ca9ee6;
  --blue: #8caaee;
  --green: #a6d189;
  --yellow: #e5c890;
  --red: #e78284;
  --peach: #ef9f76;
  --teal: #81c8be;
  --sky: #99d1db;
  --pink: #f4b8e4;
  --lavender: #babbf1;
  --flamingo: #eebebe;
  --rosewater: #f2d5cf;
  --sapphire: #85c1dc;

  /* Semantic overrides */
  --border-subtle: rgba(98, 104, 128, 0.5);

  /* Shadows - dark theme */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.25);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.3);
  --shadow-xl: 0 16px 50px rgba(0,0,0,0.35);
}

/* Frappe theme icon visibility (dark theme - show moon, hide sun) */
:root[data-theme="frappe"] .theme-icon-moon { display: inline; }
:root[data-theme="frappe"] .theme-icon-sun { display: none; }

/* Frappe-specific overrides for hardcoded rgba values */
:root[data-theme="frappe"] ::selection {
  background: rgba(202, 158, 230, 0.25);
  color: var(--text);
}

:root[data-theme="frappe"] .stat-dot-running {
  background: var(--green);
  box-shadow: 0 0 4px rgba(166, 209, 137, 0.5);
}

:root[data-theme="frappe"] .terminal-pane-empty.drag-over .terminal-container {
  background: rgba(202, 158, 230, 0.05);
}

:root[data-theme="frappe"] .terminal-resize-handle:hover {
  background: rgba(202, 158, 230, 0.4);
}


/* ═══════════════════════════════════════════════════════════ */
/* CATPPUCCIN MACCHIATO (Dark-Warm Theme)                      */
/* ═══════════════════════════════════════════════════════════ */

:root[data-theme="macchiato"] {
  /* Catppuccin Macchiato palette */
  --base: #24273a;
  --mantle: #1e2030;
  --crust: #181926;
  --surface0: #363a4f;
  --surface1: #494d64;
  --surface2: #5b6078;
  --overlay0: #6e738d;
  --overlay1: #8087a2;
  --text: #cad3f5;
  --subtext0: #a5adcb;
  --subtext1: #b8c0e0;
  --mauve: #c6a0f6;
  --blue: #8aadf4;
  --green: #a6da95;
  --yellow: #eed49f;
  --red: #ed8796;
  --peach: #f5a97f;
  --teal: #8bd5ca;
  --sky: #91d7e3;
  --pink: #f5bde6;
  --lavender: #b7bdf8;
  --flamingo: #f0c6c6;
  --rosewater: #f4dbd6;
  --sapphire: #7dc4e4;

  /* Semantic overrides */
  --border-subtle: rgba(91, 96, 120, 0.5);

  /* Shadows - dark theme */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.25);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.3);
  --shadow-xl: 0 16px 50px rgba(0,0,0,0.35);
}

/* Macchiato theme icon visibility (dark theme - show moon, hide sun) */
:root[data-theme="macchiato"] .theme-icon-moon { display: inline; }
:root[data-theme="macchiato"] .theme-icon-sun { display: none; }

/* Macchiato-specific overrides for hardcoded rgba values */
:root[data-theme="macchiato"] ::selection {
  background: rgba(198, 160, 246, 0.25);
  color: var(--text);
}

:root[data-theme="macchiato"] .stat-dot-running {
  background: var(--green);
  box-shadow: 0 0 4px rgba(166, 218, 149, 0.5);
}

:root[data-theme="macchiato"] .terminal-pane-empty.drag-over .terminal-container {
  background: rgba(198, 160, 246, 0.05);
}

:root[data-theme="macchiato"] .terminal-resize-handle:hover {
  background: rgba(198, 160, 246, 0.4);
}

/* ═══════════════════════════════════════════════════════════ */
/* CHERRY (Rose-Tinted Dark Theme)                             */
/* ═══════════════════════════════════════════════════════════ */

:root[data-theme="cherry"] {
  --base: #221a22;
  --mantle: #1c141c;
  --crust: #161018;
  --surface0: #382e3a;
  --surface1: #4c404e;
  --surface2: #605464;
  --overlay0: #786c80;
  --overlay1: #908498;
  --text: #f0ddf0;
  --subtext0: #c8b4cc;
  --subtext1: #dcc8e0;
  --mauve: #e890c8;
  --blue: #90b0ea;
  --green: #a0d890;
  --yellow: #f0d098;
  --red: #f07888;
  --peach: #f0a088;
  --teal: #80d8c0;
  --sky: #90c8ea;
  --pink: #f5a0d0;
  --lavender: #c0a8f0;
  --flamingo: #f0b8b8;
  --rosewater: #f5d0c8;
  --sapphire: #80c0e0;

  --border-subtle: rgba(96, 84, 100, 0.5);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.25);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.3);
  --shadow-xl: 0 16px 50px rgba(0,0,0,0.35);
}

:root[data-theme="cherry"] .theme-icon-moon { display: inline; }
:root[data-theme="cherry"] .theme-icon-sun { display: none; }

:root[data-theme="cherry"] ::selection {
  background: rgba(245, 160, 208, 0.25);
  color: var(--text);
}

:root[data-theme="cherry"] .stat-dot-running {
  background: var(--green);
  box-shadow: 0 0 4px rgba(160, 216, 144, 0.5);
}

:root[data-theme="cherry"] .terminal-pane-empty.drag-over .terminal-container {
  background: rgba(245, 160, 208, 0.05);
}

:root[data-theme="cherry"] .terminal-resize-handle:hover {
  background: rgba(245, 160, 208, 0.4);
}


/* ═══════════════════════════════════════════════════════════ */
/* OCEAN (Cool Navy Dark Theme)                                */
/* ═══════════════════════════════════════════════════════════ */

:root[data-theme="ocean"] {
  --base: #1a1e28;
  --mantle: #141822;
  --crust: #10141c;
  --surface0: #283040;
  --surface1: #384254;
  --surface2: #4a5668;
  --overlay0: #607080;
  --overlay1: #788898;
  --text: #d8e4f5;
  --subtext0: #a0b4cc;
  --subtext1: #b8ccdc;
  --mauve: #b0a0ea;
  --blue: #70a8f0;
  --green: #80d8a0;
  --yellow: #f0d880;
  --red: #f08888;
  --peach: #f0b088;
  --teal: #60d8d0;
  --sky: #80c8f0;
  --pink: #ea9cc8;
  --lavender: #a0b0f0;
  --flamingo: #f0c0c0;
  --rosewater: #f0d8d0;
  --sapphire: #68c0f0;

  --border-subtle: rgba(74, 86, 104, 0.5);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.25);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.3);
  --shadow-xl: 0 16px 50px rgba(0,0,0,0.35);
}

:root[data-theme="ocean"] .theme-icon-moon { display: inline; }
:root[data-theme="ocean"] .theme-icon-sun { display: none; }

:root[data-theme="ocean"] ::selection {
  background: rgba(112, 168, 240, 0.25);
  color: var(--text);
}

:root[data-theme="ocean"] .stat-dot-running {
  background: var(--green);
  box-shadow: 0 0 4px rgba(128, 216, 160, 0.5);
}

:root[data-theme="ocean"] .terminal-pane-empty.drag-over .terminal-container {
  background: rgba(112, 168, 240, 0.05);
}

:root[data-theme="ocean"] .terminal-resize-handle:hover {
  background: rgba(112, 168, 240, 0.4);
}


/* ═══════════════════════════════════════════════════════════ */
/* AMBER (Warm Gold Dark Theme)                                */
/* ═══════════════════════════════════════════════════════════ */

:root[data-theme="amber"] {
  --base: #211e1a;
  --mantle: #1b1816;
  --crust: #151210;
  --surface0: #38322a;
  --surface1: #4c4438;
  --surface2: #605848;
  --overlay0: #787060;
  --overlay1: #8e8878;
  --text: #f0e8d8;
  --subtext0: #ccc0a8;
  --subtext1: #dcd4bc;
  --mauve: #d0a8d8;
  --blue: #88b4d8;
  --green: #a0d090;
  --yellow: #f0d070;
  --red: #e08878;
  --peach: #f0b870;
  --teal: #78c8b8;
  --sky: #88c0d8;
  --pink: #e0a8c0;
  --lavender: #b0a8d0;
  --flamingo: #e8c0a8;
  --rosewater: #f0d8c0;
  --sapphire: #78b8d0;

  --border-subtle: rgba(96, 88, 72, 0.5);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.25);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.3);
  --shadow-xl: 0 16px 50px rgba(0,0,0,0.35);
}

:root[data-theme="amber"] .theme-icon-moon { display: inline; }
:root[data-theme="amber"] .theme-icon-sun { display: none; }

:root[data-theme="amber"] ::selection {
  background: rgba(240, 208, 112, 0.25);
  color: var(--text);
}

:root[data-theme="amber"] .stat-dot-running {
  background: var(--green);
  box-shadow: 0 0 4px rgba(160, 208, 144, 0.5);
}

:root[data-theme="amber"] .terminal-pane-empty.drag-over .terminal-container {
  background: rgba(240, 184, 112, 0.05);
}

:root[data-theme="amber"] .terminal-resize-handle:hover {
  background: rgba(240, 184, 112, 0.4);
}


/* ═══════════════════════════════════════════════════════════ */
/* MINT (Cool Green-Tinted Dark Theme)                         */
/* ═══════════════════════════════════════════════════════════ */

:root[data-theme="mint"] {
  --base: #1a2120;
  --mantle: #161b1a;
  --crust: #101514;
  --surface0: #2a3634;
  --surface1: #3c4a48;
  --surface2: #4e5e5c;
  --overlay0: #647676;
  --overlay1: #7c8e8e;
  --text: #d8f0e8;
  --subtext0: #a8ccc0;
  --subtext1: #c0dcd4;
  --mauve: #c0a0e0;
  --blue: #80b4e0;
  --green: #78e0a0;
  --yellow: #e0d890;
  --red: #e09090;
  --peach: #e8b890;
  --teal: #60e0c8;
  --sky: #80d0ea;
  --pink: #e0a8c8;
  --lavender: #a8a8e0;
  --flamingo: #e8c0c0;
  --rosewater: #f0d8d0;
  --sapphire: #70c0e0;

  --border-subtle: rgba(78, 94, 92, 0.5);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.25);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.3);
  --shadow-xl: 0 16px 50px rgba(0,0,0,0.35);
}

:root[data-theme="mint"] .theme-icon-moon { display: inline; }
:root[data-theme="mint"] .theme-icon-sun { display: none; }

:root[data-theme="mint"] ::selection {
  background: rgba(120, 224, 160, 0.25);
  color: var(--text);
}

:root[data-theme="mint"] .stat-dot-running {
  background: var(--green);
  box-shadow: 0 0 4px rgba(120, 224, 160, 0.5);
}

:root[data-theme="mint"] .terminal-pane-empty.drag-over .terminal-container {
  background: rgba(96, 224, 200, 0.05);
}

:root[data-theme="mint"] .terminal-resize-handle:hover {
  background: rgba(96, 224, 200, 0.4);
}


/* ─── Update Button & Modal ─────────────────────────────── */

.update-btn {
  position: relative;
}

.update-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 50%;
  border: 2px solid var(--base);
}

.update-modal {
  max-width: 480px;
}

.update-status {
  padding: 12px 0;
  font-size: 14px;
  color: var(--text);
}

.update-version {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--mauve);
}

.update-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 0;
}

.update-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--mantle);
  border-radius: 6px;
  font-size: 13px;
}

.update-step-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}

.update-step-pending .update-step-icon { color: var(--surface2); }
.update-step-running .update-step-icon { color: var(--blue); }
.update-step-done .update-step-icon { color: var(--green); }
.update-step-error .update-step-icon { color: var(--red); }

.update-step-label {
  flex: 1;
  color: var(--text);
}

.update-step-detail {
  font-size: 11px;
  color: var(--subtext0);
  font-family: 'JetBrains Mono', monospace;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.update-step-running .update-step-icon::after {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid var(--blue);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ─── Folder Browser ───────────────────────────────────────── */

.folder-browser-overlay {
  position: fixed; inset: 0; z-index: 10003;
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 10vh;
  background: rgba(17, 17, 27, 0.65);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  animation: overlay-in 0.15s ease;
}
.folder-browser-overlay[hidden] { display: none; }

.folder-browser {
  width: 100%; max-width: 520px; max-height: 70vh;
  background: var(--mantle); border: 1px solid var(--surface0);
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
  animation: modal-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex; flex-direction: column; overflow: hidden;
}

.folder-browser-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 0; flex-shrink: 0;
}
.folder-browser-title {
  font-size: 15px; font-weight: 600; color: var(--text);
}

.folder-browser-breadcrumb {
  display: flex; align-items: center; gap: 2px;
  padding: 10px 20px; font-size: 12px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  color: var(--subtext0); overflow-x: auto; white-space: nowrap;
  flex-shrink: 0; scrollbar-width: none;
}
.folder-browser-breadcrumb::-webkit-scrollbar { display: none; }

.folder-browser-crumb {
  padding: 2px 6px; border-radius: 4px; cursor: pointer;
  color: var(--subtext1); transition: all 0.15s; flex-shrink: 0;
}
.folder-browser-crumb:hover { background: var(--surface0); color: var(--text); }
.folder-browser-crumb.active { color: var(--mauve); font-weight: 600; }

.folder-browser-sep {
  color: var(--overlay0); font-size: 10px; flex-shrink: 0; user-select: none;
}

.folder-browser-list {
  flex: 1; overflow-y: auto; padding: 0 8px;
  min-height: 200px; max-height: 400px;
  scrollbar-width: thin; scrollbar-color: var(--surface2) transparent;
}

.folder-browser-empty,
.folder-browser-loading {
  display: flex; align-items: center; justify-content: center;
  height: 120px; color: var(--subtext0); font-size: 13px;
}

.folder-browser-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 8px; cursor: pointer;
  color: var(--subtext1); font-size: 13px;
  transition: all 0.15s; user-select: none;
  border: 1px solid transparent;
}
.folder-browser-item:hover { background: var(--surface0); color: var(--text); }

.folder-browser-item-icon { font-size: 16px; flex-shrink: 0; width: 20px; text-align: center; }
.folder-browser-item-name {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.folder-browser-item-parent { color: var(--mauve); font-weight: 500; }

.folder-browser-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 20px 16px; border-top: 1px solid var(--surface0); flex-shrink: 0;
}
.folder-browser-path-display {
  flex: 1; font-size: 11px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  color: var(--subtext0); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.folder-browser-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ─── Session Manager Overlay ─────────────────────────────── */

.session-manager-overlay {
  position: fixed;
  top: 48px;
  right: 120px;
  width: 420px;
  max-height: 70vh;
  background: var(--mantle);
  border: 1px solid var(--surface0);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: sm-slide-in 0.15s ease-out;
}

@keyframes sm-slide-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.session-manager-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.session-manager-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.session-manager-filters {
  display: flex;
  gap: 4px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--surface0);
  flex-shrink: 0;
}

.sm-filter {
  padding: 4px 12px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--subtext0);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.sm-filter:hover {
  background: var(--surface0);
  color: var(--text);
}

.sm-filter.active {
  background: var(--surface0);
  color: var(--text);
}

.session-manager-list {
  overflow-y: auto;
  flex: 1;
  padding: 8px;
  min-height: 60px;
  max-height: calc(70vh - 120px);
}

.session-manager-list::-webkit-scrollbar { width: 6px; }
.session-manager-list::-webkit-scrollbar-track { background: transparent; }
.session-manager-list::-webkit-scrollbar-thumb { background: var(--surface1); border-radius: 3px; }

.sm-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 80px;
  color: var(--subtext0);
  font-size: 13px;
}

.sm-session-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
  user-select: none;
}

.sm-session-row:hover {
  background: var(--surface0);
}

.sm-session-row.selected {
  background: color-mix(in srgb, var(--blue) 12%, var(--mantle));
}

.sm-session-checkbox {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--surface2);
  background: transparent;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  position: relative;
  transition: all 0.12s;
}

.sm-session-checkbox:checked {
  background: var(--blue);
  border-color: var(--blue);
}

.sm-session-checkbox:checked::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 5px;
  width: 4px;
  height: 8px;
  border: solid var(--base);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

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

.sm-status-dot.running { background: var(--green); box-shadow: 0 0 6px var(--green); }
.sm-status-dot.stopped { background: var(--surface2); }
.sm-status-dot.error { background: var(--red); box-shadow: 0 0 6px var(--red); }

.sm-session-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.sm-session-meta {
  font-size: 11px;
  color: var(--subtext0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sm-workspace-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--surface0);
  color: var(--subtext1);
  white-space: nowrap;
  flex-shrink: 0;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sm-session-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.12s;
}

.sm-session-row:hover .sm-session-actions {
  opacity: 1;
}

.sm-action-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--subtext0);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.12s;
}

.sm-action-btn:hover {
  background: var(--surface1);
  color: var(--text);
}

.sm-action-btn.terminal-btn:hover { color: var(--blue); }
.sm-action-btn.stop-btn:hover { color: var(--red); }
.sm-action-btn.start-btn:hover { color: var(--green); }

/* Responsive: on smaller screens, make overlay full-width */
@media (max-width: 600px) {
  .session-manager-overlay {
    right: 8px;
    left: 8px;
    width: auto;
  }
}

/* ─── Conflict Center ─────────────────────────────────────── */

.conflict-indicator {
  position: relative;
  color: var(--yellow);
}

.conflict-indicator:hover { color: var(--red); }

.conflict-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  background: var(--red);
  color: var(--base);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

.conflict-center-overlay {
  position: fixed;
  top: 48px;
  right: 160px;
  width: 440px;
  max-height: 70vh;
  background: var(--mantle);
  border: 1px solid var(--surface0);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: sm-slide-in 0.15s ease-out;
}

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

.conflict-center-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.conflict-center-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.conflict-center-info {
  padding: 8px 16px;
  font-size: 12px;
  color: var(--subtext0);
  border-bottom: 1px solid var(--surface0);
  flex-shrink: 0;
}

.conflict-center-list {
  overflow-y: auto;
  flex: 1;
  padding: 8px;
  min-height: 60px;
  max-height: calc(70vh - 120px);
}

.conflict-center-list::-webkit-scrollbar { width: 6px; }
.conflict-center-list::-webkit-scrollbar-track { background: transparent; }
.conflict-center-list::-webkit-scrollbar-thumb { background: var(--surface1); border-radius: 3px; }

.conflict-file-card {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--base);
  border: 1px solid var(--surface0);
  margin-bottom: 6px;
}

.conflict-file-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.conflict-file-path {
  font-size: 13px;
  font-weight: 500;
  color: var(--yellow);
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  word-break: break-all;
}

.conflict-auto-resolve-btn {
  flex-shrink: 0;
  padding: 3px 10px;
  border-radius: 4px;
  background: var(--red);
  color: var(--base);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.12s;
  white-space: nowrap;
}

.conflict-auto-resolve-btn:hover {
  filter: brightness(1.15);
}

.conflict-auto-resolve-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.conflict-auto-resolve-protected {
  flex-shrink: 0;
  padding: 3px 8px;
  font-size: 10px;
  color: var(--subtext0);
  font-style: italic;
}

.conflict-session-protected {
  border: 1px solid var(--green) !important;
  opacity: 0.8;
}

.conflict-protected-icon {
  font-size: 10px;
  margin-left: 2px;
}

.conflict-sessions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.conflict-session-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--surface0);
  color: var(--subtext1);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.12s;
  border: none;
}

.conflict-session-chip:hover {
  background: var(--surface1);
  color: var(--text);
}

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

.conflict-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 80px;
  color: var(--subtext0);
  font-size: 13px;
}

@media (max-width: 600px) {
  .conflict-center-overlay {
    right: 8px;
    left: 8px;
    width: auto;
  }
}

/* ═══════════════════════════════════════════════════════════ */
/* Theme Dropdown Section Headers + Catppuccin Badge          */
/* ═══════════════════════════════════════════════════════════ */

/* Theme dropdown section headers */
.theme-dropdown-section {
  padding: 4px 12px 2px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--overlay1);
  pointer-events: none;
  user-select: none;
}
.theme-dropdown-section:not(:first-child) {
  margin-top: 4px;
  border-top: 1px solid var(--surface0);
  padding-top: 6px;
}
.theme-catppuccin-badge {
  margin-left: auto;
  font-size: 10px;
  color: var(--yellow);
  opacity: 0.7;
}

/* ═══════════════════════════════════════════════════════════ */
/* NORD (Dark — Polar Night & Aurora)                         */
/* ═══════════════════════════════════════════════════════════ */

:root[data-theme="nord"] {
  --base: #2e3440;
  --mantle: #292e39;
  --crust: #242933;
  --surface0: #3b4252;
  --surface1: #434c5e;
  --surface2: #4c566a;
  --overlay0: #616e88;
  --overlay1: #6e7e99;
  --text: #eceff4;
  --subtext0: #a5b1c2;
  --subtext1: #d8dee9;
  --mauve: #b48ead;
  --blue: #81a1c1;
  --green: #a3be8c;
  --yellow: #ebcb8b;
  --red: #bf616a;
  --peach: #d08770;
  --teal: #8fbcbb;
  --sky: #88c0d0;
  --pink: #b48ead;
  --lavender: #9db2cf;
  --flamingo: #d08770;
  --rosewater: #d8b4a0;
  --sapphire: #5e81ac;
  --border-subtle: rgba(67, 76, 94, 0.5);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.25);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.3);
  --shadow-xl: 0 16px 50px rgba(0,0,0,0.35);
}
:root[data-theme="nord"] .theme-icon-moon { display: inline; }
:root[data-theme="nord"] .theme-icon-sun { display: none; }
:root[data-theme="nord"] ::selection { background: rgba(129, 161, 193, 0.25); color: var(--text); }
:root[data-theme="nord"] .stat-dot-running { background: var(--green); box-shadow: 0 0 4px rgba(163, 190, 140, 0.5); }
:root[data-theme="nord"] .terminal-pane-empty.drag-over .terminal-container { background: rgba(129, 161, 193, 0.05); }
:root[data-theme="nord"] .terminal-resize-handle:hover { background: rgba(129, 161, 193, 0.4); }

/* ═══════════════════════════════════════════════════════════ */
/* DRACULA (Dark — Iconic Purple & Neon)                      */
/* ═══════════════════════════════════════════════════════════ */

:root[data-theme="dracula"] {
  --base: #282a36;
  --mantle: #21222c;
  --crust: #191a21;
  --surface0: #343746;
  --surface1: #44475a;
  --surface2: #545768;
  --overlay0: #6272a4;
  --overlay1: #7283b5;
  --text: #f8f8f2;
  --subtext0: #b8b8b0;
  --subtext1: #d8d8d0;
  --mauve: #bd93f9;
  --blue: #8be9fd;
  --green: #50fa7b;
  --yellow: #f1fa8c;
  --red: #ff5555;
  --peach: #ffb86c;
  --teal: #8be9fd;
  --sky: #8be9fd;
  --pink: #ff79c6;
  --lavender: #caa9fa;
  --flamingo: #ff79c6;
  --rosewater: #ffd0e0;
  --sapphire: #6cb6ff;
  --border-subtle: rgba(68, 71, 90, 0.5);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.25);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.3);
  --shadow-xl: 0 16px 50px rgba(0,0,0,0.35);
}
:root[data-theme="dracula"] .theme-icon-moon { display: inline; }
:root[data-theme="dracula"] .theme-icon-sun { display: none; }
:root[data-theme="dracula"] ::selection { background: rgba(189, 147, 249, 0.25); color: var(--text); }
:root[data-theme="dracula"] .stat-dot-running { background: var(--green); box-shadow: 0 0 4px rgba(80, 250, 123, 0.5); }
:root[data-theme="dracula"] .terminal-pane-empty.drag-over .terminal-container { background: rgba(189, 147, 249, 0.05); }
:root[data-theme="dracula"] .terminal-resize-handle:hover { background: rgba(189, 147, 249, 0.4); }

/* ═══════════════════════════════════════════════════════════ */
/* TOKYO NIGHT (Dark — Neon City Lights)                      */
/* ═══════════════════════════════════════════════════════════ */

:root[data-theme="tokyo-night"] {
  --base: #1a1b26;
  --mantle: #16161e;
  --crust: #12121a;
  --surface0: #292e42;
  --surface1: #3b4261;
  --surface2: #545c7e;
  --overlay0: #565f89;
  --overlay1: #6b7394;
  --text: #c0caf5;
  --subtext0: #9aa5ce;
  --subtext1: #a9b1d6;
  --mauve: #bb9af7;
  --blue: #7aa2f7;
  --green: #9ece6a;
  --yellow: #e0af68;
  --red: #f7768e;
  --peach: #ff9e64;
  --teal: #73daca;
  --sky: #7dcfff;
  --pink: #ff79c6;
  --lavender: #b4befe;
  --flamingo: #f7768e;
  --rosewater: #ffc0cb;
  --sapphire: #2ac3de;
  --border-subtle: rgba(59, 66, 97, 0.5);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.25);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.3);
  --shadow-xl: 0 16px 50px rgba(0,0,0,0.35);
}
:root[data-theme="tokyo-night"] .theme-icon-moon { display: inline; }
:root[data-theme="tokyo-night"] .theme-icon-sun { display: none; }
:root[data-theme="tokyo-night"] ::selection { background: rgba(122, 162, 247, 0.25); color: var(--text); }
:root[data-theme="tokyo-night"] .stat-dot-running { background: var(--green); box-shadow: 0 0 4px rgba(158, 206, 106, 0.5); }
:root[data-theme="tokyo-night"] .terminal-pane-empty.drag-over .terminal-container { background: rgba(122, 162, 247, 0.05); }
:root[data-theme="tokyo-night"] .terminal-resize-handle:hover { background: rgba(122, 162, 247, 0.4); }

/* ═══════════════════════════════════════════════════════════ */
/* ROSE PINE DAWN (Light — Soft Warm Rose)                    */
/* ═══════════════════════════════════════════════════════════ */

:root[data-theme="rose-pine-dawn"] {
  --base: #faf4ed;
  --mantle: #f2e9e1;
  --crust: #ebe0d6;
  --surface0: #f4ede8;
  --surface1: #dfdad9;
  --surface2: #cecacd;
  --overlay0: #9893a5;
  --overlay1: #797593;
  --text: #575279;
  --subtext0: #6e6a86;
  --subtext1: #635f7b;
  --mauve: #907aa9;
  --blue: #286983;
  --green: #56949f;
  --yellow: #ea9d34;
  --red: #b4637a;
  --peach: #d7827e;
  --teal: #56949f;
  --sky: #56949f;
  --pink: #d7827e;
  --lavender: #907aa9;
  --flamingo: #d7827e;
  --rosewater: #d7827e;
  --sapphire: #286983;
  --border-subtle: rgba(206, 202, 205, 0.5);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.1), 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 16px 50px rgba(0, 0, 0, 0.12), 0 8px 20px rgba(0, 0, 0, 0.1);
}
:root[data-theme="rose-pine-dawn"] .theme-icon-moon { display: none; }
:root[data-theme="rose-pine-dawn"] .theme-icon-sun { display: block !important; }
:root[data-theme="rose-pine-dawn"] ::selection { background: rgba(144, 122, 169, 0.2); color: var(--text); }
:root[data-theme="rose-pine-dawn"] .stat-dot-running { background: var(--green); box-shadow: 0 0 4px rgba(86, 148, 159, 0.5); }
:root[data-theme="rose-pine-dawn"] .terminal-pane-empty.drag-over .terminal-container { background: rgba(144, 122, 169, 0.05); }
:root[data-theme="rose-pine-dawn"] .terminal-resize-handle:hover { background: rgba(144, 122, 169, 0.4); }

/* ═══════════════════════════════════════════════════════════ */
/* GRUVBOX LIGHT (Light — Warm Retro Earthy)                  */
/* ═══════════════════════════════════════════════════════════ */

:root[data-theme="gruvbox-light"] {
  --base: #fbf1c7;
  --mantle: #f2e5bc;
  --crust: #ebdbb2;
  --surface0: #d5c4a1;
  --surface1: #bdae93;
  --surface2: #a89984;
  --overlay0: #928374;
  --overlay1: #7c6f64;
  --text: #3c3836;
  --subtext0: #504945;
  --subtext1: #453e3a;
  --mauve: #8f3f71;
  --blue: #076678;
  --green: #79740e;
  --yellow: #b57614;
  --red: #9d0006;
  --peach: #af3a03;
  --teal: #427b58;
  --sky: #076678;
  --pink: #8f3f71;
  --lavender: #8f3f71;
  --flamingo: #af3a03;
  --rosewater: #c8956c;
  --sapphire: #458588;
  --border-subtle: rgba(168, 153, 132, 0.5);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.1), 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 16px 50px rgba(0, 0, 0, 0.12), 0 8px 20px rgba(0, 0, 0, 0.1);
}
:root[data-theme="gruvbox-light"] .theme-icon-moon { display: none; }
:root[data-theme="gruvbox-light"] .theme-icon-sun { display: block !important; }
:root[data-theme="gruvbox-light"] ::selection { background: rgba(175, 58, 3, 0.2); color: var(--text); }
:root[data-theme="gruvbox-light"] .stat-dot-running { background: var(--green); box-shadow: 0 0 4px rgba(121, 116, 14, 0.5); }
:root[data-theme="gruvbox-light"] .terminal-pane-empty.drag-over .terminal-container { background: rgba(175, 58, 3, 0.05); }
:root[data-theme="gruvbox-light"] .terminal-resize-handle:hover { background: rgba(175, 58, 3, 0.4); }
