/* ═══════════════════════════════════════════════════════════════
   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;

  /* ─── Provider accent tokens ──────────────────────────────────
     Per-provider visual identity, layered on top of the Catppuccin
     palette tokens above. Every theme overrides --mauve, --green,
     --blue (etc.), so these provider accents inherit the theme's
     hue automatically; no per-theme override is required.

     The 6%-opacity tint variants use color-mix so the tint hue is
     theme-derived (mixes with the theme's transparent slot) rather
     than hardcoded rgba. Pitfall 7 forbids hardcoded rgba here.

     Gemini is reserved for v1.3; the token exists so future CSS
     selectors do not need a theme cascade rewrite when wired. */
  --provider-claude-accent: var(--mauve);
  --provider-codex-accent:  var(--green);
  --provider-gemini-accent: var(--blue);
  --provider-claude-tint:   color-mix(in srgb, var(--mauve) 10%, transparent);
  --provider-codex-tint:    color-mix(in srgb, var(--green) 10%, transparent);
  --provider-gemini-tint:   color-mix(in srgb, var(--blue) 10%, transparent);

  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;
}

.session-badge-tag {
  font-size: 9px;
  padding: 0 4px;
  border-radius: 2px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.session-badge-pr {
  font-size: 10px;
  font-weight: 600;
  border-radius: 3px;
}

/* ─── Task Spinoff Modal ─── */

@keyframes spinoff-dot {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.2); }
}

.spinoff-task-card {
  border: 1px solid var(--surface1);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  background: var(--mantle);
  transition: border-color 0.15s ease, opacity 0.15s ease;
}
.spinoff-task-card:hover {
  border-color: var(--surface2);
}
.spinoff-task-card.spinoff-deselected {
  opacity: 0.45;
  border-color: var(--surface0);
}
.spinoff-task-card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}
.spinoff-task-card-header input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
}
.spinoff-task-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  flex: 1;
  line-height: 1.3;
}
.spinoff-task-title input {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  padding: 2px 4px;
  border-radius: 4px;
}
.spinoff-task-title input:focus {
  border-color: var(--lavender);
  outline: none;
  background: var(--surface0);
}
.spinoff-task-branch {
  font-size: 11px;
  color: var(--overlay0);
  font-family: var(--font-mono);
  background: var(--surface0);
  padding: 1px 6px;
  border-radius: 3px;
  white-space: nowrap;
}
.spinoff-task-desc {
  font-size: 12px;
  color: var(--subtext0);
  line-height: 1.45;
  margin-bottom: 6px;
}
.spinoff-task-desc textarea {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  color: var(--subtext0);
  font-size: 12px;
  line-height: 1.45;
  padding: 4px 6px;
  border-radius: 4px;
  resize: vertical;
  min-height: 40px;
  font-family: inherit;
}
.spinoff-task-desc textarea:focus {
  border-color: var(--lavender);
  outline: none;
  background: var(--surface0);
}
.spinoff-task-files {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}
.spinoff-task-file {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--sapphire);
  background: color-mix(in srgb, var(--sapphire) 10%, transparent);
  padding: 1px 6px;
  border-radius: 3px;
}
.spinoff-task-criteria {
  font-size: 11px;
  color: var(--overlay1);
  padding-left: 16px;
  margin: 0;
}
.spinoff-task-criteria li {
  margin-bottom: 2px;
}
.spinoff-select-all {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0 12px 0;
  font-size: 12px;
  color: var(--subtext0);
  border-bottom: 1px solid var(--surface0);
  margin-bottom: 12px;
}


/* ═══════════════════════════════════════════════════════════════
   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 Launch Button ──────────────────────────── */
.sidebar-launch-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: calc(100% - 24px);
  margin: 8px 12px 4px;
  padding: 6px 10px;
  border: 1px dashed var(--surface2);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--overlay0);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-launch-btn:hover {
  background: var(--surface0);
  color: var(--lavender);
  border-color: var(--lavender);
  border-style: solid;
}

.sidebar-launch-btn:active {
  transform: scale(0.98);
}

.sidebar-launch-btn svg {
  flex-shrink: 0;
}

/* Collapsed sidebar: show just the icon */
.sidebar.collapsed .sidebar-launch-btn {
  width: 32px;
  height: 32px;
  margin: 8px auto 4px;
  padding: 0;
  justify-content: center;
}

.sidebar.collapsed .sidebar-launch-btn-label {
  display: none;
}

.sidebar.collapsed .sidebar-view-toggle {
  display: none;
}

/* ─── Sidebar view toggle (Projects/Tasks) ──────────── */
.sidebar-view-toggle {
  display: flex;
  padding: 8px 12px 4px;
  gap: 2px;
}

.sidebar-view-btn {
  flex: 1;
  padding: 4px 8px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--overlay0);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.sidebar-view-btn:hover {
  color: var(--text-primary);
}

.sidebar-view-btn.active {
  background: var(--surface0);
  color: var(--text-primary);
}

.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);
}

/* Highlight the workspace list itself when dragging a workspace out of a group */
.sidebar-list.workspace-list-drop-target {
  background: color-mix(in srgb, var(--blue) 5%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--blue) 25%, transparent);
  border-radius: var(--radius-sm);
}

/* 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(--ws-color, var(--accent));
}

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

.workspace-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  line-height: 1;
}

.workspace-icon svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
}

.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;
}

.ws-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  color: var(--overlay1);
  background: var(--surface1);
  border-radius: 10px;
  padding: 1px 5px;
  margin-left: 6px;
  vertical-align: middle;
  flex-shrink: 0;
}

.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;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  padding: 5px 10px 5px 24px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
  font-size: 12px;
  color: var(--text-tertiary);
}

.ws-session-meta-row {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding-left: 12px;
}

.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;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
}

.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;
  flex-shrink: 0;
  margin-left: auto;
}

.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;
}

.vkb-toggle-btn .vkb-slash { display: none; }
.vkb-toggle-btn.active { color: var(--mauve) !important; }
.vkb-toggle-btn.active .vkb-slash { display: inline; }


/* ─── 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;
}

/* alpha.9: left-side category rail. Builds from the settingsRegistry's
   `category` field. Clicking an item smooth-scrolls the body to the
   matching section; a scroll-spy keeps the active item highlighted as
   the user scrolls naturally. Theme-safe via existing tokens. */
.settings-content {
  display: grid;
  grid-template-columns: 152px 1fr;
  gap: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.settings-nav {
  border-right: 1px solid var(--surface-2);
  padding: 8px 6px 12px;
  overflow-y: auto;
  background: color-mix(in srgb, var(--bg-secondary) 50%, transparent);
}
.settings-nav-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 10px;
  margin-bottom: 2px;
  border-radius: 6px;
  background: transparent;
  border: 0;
  font-size: 12px;
  font-family: inherit;
  color: var(--text-muted);
  cursor: pointer;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  transition: background 150ms ease, color 150ms ease, opacity 150ms ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.settings-nav-item:hover {
  background: var(--surface-1);
  color: var(--text-base);
}
.settings-nav-item.is-active {
  background: color-mix(in srgb, var(--mauve) 18%, var(--surface-1));
  color: var(--text-base);
  font-weight: 500;
  border-left: 2px solid var(--mauve);
  padding-left: 8px; /* compensate for the 2px border so text doesn't jump */
}
.settings-nav-item.is-dimmed {
  opacity: 0.35;
  pointer-events: none;
}
/* When the rail is empty (no categories yet), collapse the column to
   keep the body full-width during loading. */
.settings-nav:empty {
  display: none;
}
.settings-content:has(.settings-nav:empty) {
  grid-template-columns: 1fr;
}

.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;
}

/* Number input for settings (e.g., quota limits) */
.settings-number-input {
  width: 72px;
  height: 30px;
  padding: 0 8px;
  background: var(--surface0);
  border: 1px solid var(--surface1);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-variant-numeric: tabular-nums;
  text-align: right;
  flex-shrink: 0;
  transition: border-color var(--transition-fast);
  -moz-appearance: textfield;
}

.settings-number-input::-webkit-inner-spin-button,
.settings-number-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.settings-number-input:focus {
  outline: none;
  border-color: var(--accent);
}

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

/* Hidden items in settings panel */
.settings-hidden-item:hover {
  background: var(--surface1) !important;
}
.settings-hidden-item .settings-unhide-btn:hover {
  opacity: 1 !important;
  color: var(--green);
}

/* Sidebar: hidden items shown via "Show hidden" toggle get a dim visual */
.workspace-group.hidden-item {
  opacity: 0.45;
}
.workspace-accordion.hidden-item {
  opacity: 0.45;
}

.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;
  padding: 2px 6px;
  border-radius: 3px;
}

/* Command palette type-specific badge colors */
.qs-result-type-session   { color: var(--green);  background: rgba(166, 227, 161, 0.12); }
.qs-result-type-workspace { color: var(--blue);   background: rgba(137, 180, 250, 0.12); }
.qs-result-type-action    { color: var(--mauve);  background: rgba(203, 166, 247, 0.12); }
.qs-result-type-feature   { color: var(--peach);  background: rgba(250, 179, 135, 0.12); }
.qs-result-type-setting   { color: var(--teal);   background: rgba(148, 226, 213, 0.12); }
.qs-result-type-shortcut  { color: var(--yellow); background: rgba(249, 226, 175, 0.12); }

/* Command palette icon tints per type */
.qs-result-icon-action  { color: var(--mauve); background: rgba(203, 166, 247, 0.10); }
.qs-result-icon-feature { color: var(--peach); background: rgba(250, 179, 135, 0.10); }
.qs-result-icon-setting { color: var(--teal);  background: rgba(148, 226, 213, 0.10); }
.qs-result-icon-shortcut { color: var(--yellow); background: rgba(249, 226, 175, 0.10); }

/* Keyboard shortcut badge in command palette results */
.qs-result-shortcut {
  font-size: 10px;
  font-family: var(--font-mono, monospace);
  padding: 2px 6px;
  background: var(--surface0);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-muted);
  margin-left: auto;
  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;
}


/* ═══════════════════════════════════════════════════════════════
   WORKTREE TASK REVIEW BANNER
   ═══════════════════════════════════════════════════════════════ */

.wt-review-banner {
  background: var(--surface0);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 12px;
}

.wt-review-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.wt-review-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.wt-review-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wt-review-branch {
  font-size: 10px;
  font-family: var(--font-mono, monospace);
  padding: 2px 6px;
  background: var(--surface1);
  border-radius: 3px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.wt-review-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.wt-review-btn {
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--surface1);
  color: var(--text-primary);
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.wt-review-btn:hover {
  background: var(--surface2);
}

.wt-review-btn-merge {
  background: rgba(166, 227, 161, 0.15);
  border-color: var(--green);
  color: var(--green);
}

.wt-review-btn-merge:hover {
  background: rgba(166, 227, 161, 0.25);
}

.wt-review-btn-reject {
  background: rgba(243, 139, 168, 0.10);
  border-color: var(--red);
  color: var(--red);
}

.wt-review-btn-reject:hover {
  background: rgba(243, 139, 168, 0.20);
}

.wt-review-btn-diff {
  background: rgba(137, 180, 250, 0.10);
  border-color: var(--blue);
  color: var(--blue);
}

.wt-review-btn-diff:hover {
  background: rgba(137, 180, 250, 0.20);
}

.wt-review-btn-resume {
  background: rgba(249, 226, 175, 0.10);
  border-color: var(--yellow);
  color: var(--yellow);
}

.wt-review-btn-resume:hover {
  background: rgba(249, 226, 175, 0.20);
}

.wt-review-btn-push {
  background: rgba(148, 226, 213, 0.10);
  border-color: var(--teal);
  color: var(--teal);
}

.wt-review-btn-push:hover {
  background: rgba(148, 226, 213, 0.20);
}

.wt-review-status {
  font-size: 11px;
  font-weight: 500;
}


/* ═══════════════════════════════════════════════════════════════
   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; }
  .terminal-mobile-toolbar .toolbar-reader {
    background: var(--surface1);
    color: var(--blue);
    font-weight: 500;
  }
  .terminal-mobile-toolbar .toolbar-reader:active { opacity: 0.8; }
}

/* ─── Terminal Reader Overlay (mobile full-screen scrollable view) ─── */
.terminal-reader-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

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

.terminal-reader-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.terminal-reader-close {
  background: transparent !important;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  -webkit-appearance: none;
  appearance: none;
}

.terminal-reader-close:hover {
  color: var(--text-primary);
  background: var(--surface0) !important;
}

.terminal-reader-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 16px;
  margin: 0;
  font-family: 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-wrap: break-word;
  touch-action: pan-y;
  overscroll-behavior: contain;
  tab-size: 4;
}

/* ─── Mobile: xterm scrollbar + scroll behavior ─────────────
   Show a thin, themed scrollbar on mobile for draggable scrolling.
   Native touch scroll works via pointer-events passthrough to .xterm-viewport.
   Long-press activates text selection (handled in terminal.js).
   Also prevent the page itself from scrolling under the terminal. */
@media (max-width: 768px) {
  /* Show a thin scrollbar on mobile — touch-draggable for precise positioning */
  .xterm .xterm-viewport {
    overflow-y: scroll;
    scrollbar-width: thin;                /* Firefox: thin scrollbar */
    scrollbar-color: var(--surface1) transparent;  /* thumb + track */
  }
  .xterm .xterm-viewport::-webkit-scrollbar {
    width: 6px;                           /* thin scrollbar */
  }
  .xterm .xterm-viewport::-webkit-scrollbar-track {
    background: transparent;
  }
  .xterm .xterm-viewport::-webkit-scrollbar-thumb {
    background: var(--surface1);
    border-radius: 3px;
  }
  .xterm .xterm-viewport::-webkit-scrollbar-thumb:active {
    background: var(--overlay0);
  }

  /* Prevent terminal scroll from chaining to page scroll (bounce effect) */
  .terminal-pane .terminal-container {
    overscroll-behavior: contain;
  }
  .xterm {
    touch-action: pan-y;             /* allow vertical scroll, block horizontal/zoom */
    overscroll-behavior: contain;    /* don't chain to parent */
  }

  /* Ensure the app never exceeds viewport — no page-level scrollbar */
  .app {
    overflow: hidden;
    position: fixed;
    inset: 0;
  }
}

/* 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;
}

/* During a drag, let elementFromPoint fall through to drop targets behind
   the backdrop (otherwise the touch polyfill can't hit terminal panes). */
body.cwm-dragging .sidebar-backdrop {
  pointer-events: 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%;
}

/* ─── Icon Picker ──────────────────────────────────────────── */

.icon-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.icon-picker-search {
  font-size: 12px;
  padding: 5px 8px;
  height: 30px;
}

.icon-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 30px);
  gap: 3px;
  max-height: 210px;
  overflow-y: auto;
  padding: 2px 1px;
  scrollbar-width: thin;
}

.icon-picker-cat-sep {
  grid-column: 1 / -1;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--overlay0);
  padding: 6px 2px 2px;
  margin-top: 2px;
}

/* Top-level icon set separator (Lucide / Material) */
.icon-picker-set-sep {
  grid-column: 1 / -1;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mauve);
  padding: 10px 2px 3px;
  margin-top: 6px;
  border-top: 1px solid var(--surface2);
}
.icon-picker-set-sep:first-child {
  border-top: none;
  margin-top: 0;
  padding-top: 2px;
}

.icon-swatch {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1.5px solid transparent;
  color: var(--subtext0);
  transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
  flex-shrink: 0;
}

.icon-swatch svg {
  width: 14px;
  height: 14px;
  pointer-events: none;
}

.icon-swatch:hover {
  background: var(--surface0);
  color: var(--text);
}

.icon-swatch.selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
}

.icon-swatch-none {
  opacity: 0.5;
}

.icon-swatch-none.selected {
  opacity: 1;
}

.field-optional {
  font-size: 10px;
  color: var(--overlay0);
  font-weight: 400;
  margin-left: 4px;
}

/* ─── 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;
}

/* Section label on separator (e.g. "Environment") */
.context-menu-sep .ctx-sep-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  padding: 4px 4px 0;
  margin-top: -2px;
}

/* Current/active item in a radio-style group (e.g. active shell) */
.context-item-current {
  opacity: 0.55;
  cursor: default;
}
.context-item-current:hover {
  background: none;
}

.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: 8px;
  cursor: row-resize;
  background: transparent;
  flex-shrink: 0;
  position: relative;
  margin: 2px 12px;
  border-radius: 3px;
  transition: background var(--transition-fast);
}

/* Visible divider line so users can find the drag target */
.sidebar-section-resize::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border-subtle);
  transition: background var(--transition-fast);
}

.sidebar-section-resize:hover,
.sidebar-section-resize.active {
  background: color-mix(in srgb, var(--mauve) 20%, transparent);
}

.sidebar-section-resize:hover::before,
.sidebar-section-resize.active::before {
  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 Session Modal (AI-powered) */
.find-convo-modal {
  width: min(640px, 90vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.find-convo-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}
.find-convo-search-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.find-convo-input {
  flex: 1;
  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-search-btn {
  width: 38px;
  min-width: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  font-size: 12px;
}
.find-convo-hint {
  font-size: 11px;
  color: var(--overlay0);
  padding: 0 2px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.find-convo-mode-ai {
  color: var(--mauve);
  font-weight: 500;
}
.find-convo-mode-keyword {
  color: var(--overlay0);
}
.find-convo-setup-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 11px;
}
.find-convo-setup-link:hover {
  text-decoration: underline;
}
.find-convo-fallback-hint {
  font-size: 11px;
  color: var(--overlay0);
  background: var(--surface0);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  margin-bottom: 4px;
}
.find-convo-results {
  overflow-y: auto;
  max-height: calc(80vh - 180px);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.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;
}

/* AI Find Result Cards */
.ai-find-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  background: var(--surface0);
  border: 1px solid var(--surface1);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 150ms ease;
}
.ai-find-card:hover {
  background: var(--surface1);
  border-color: var(--accent);
}
.ai-find-card.ai-find-card-opened {
  border-color: var(--green);
  opacity: 0.7;
}
.ai-find-card.ai-find-card-opened::after {
  content: 'opened';
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 10px;
  color: var(--green);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.ai-find-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ai-find-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-find-card-badge {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--surface1);
  color: var(--subtext0);
}
.ai-find-card-confidence {
  font-size: 12px;
  font-weight: 600;
  color: var(--green);
  font-family: var(--font-mono);
  white-space: nowrap;
}
.ai-find-card-summary {
  font-size: 12px;
  color: var(--subtext0);
  line-height: 1.45;
}
.ai-find-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 11px;
  color: var(--overlay0);
  font-family: var(--font-mono);
}
.ai-find-card-path {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-find-card-status {
  font-size: 10px;
  font-weight: 500;
  padding: 0 5px;
  border-radius: 3px;
}
.ai-find-card-status-running {
  color: var(--green);
  background: rgba(166, 218, 149, 0.1);
}
.ai-find-card-open {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: var(--accent);
  color: var(--base);
  border: none;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  opacity: 0;
  transition: opacity 150ms ease;
}
.ai-find-card:hover .ai-find-card-open {
  opacity: 1;
}
.ai-find-card-open:hover {
  filter: brightness(1.15);
}
.ai-find-card.ai-find-card-opened .ai-find-card-open {
  display: none;
}

/* Skeleton loading animation for AI find cards */
.ai-find-card-skeleton {
  pointer-events: none;
}
.skeleton-line {
  display: inline-block;
  height: 12px;
  background: linear-gradient(90deg, var(--surface1) 25%, var(--surface2) 50%, var(--surface1) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 3px;
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* 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);
}

.doc-pin-btn {
  opacity: 0.4;
  transition: opacity 0.15s;
  flex-shrink: 0;
  cursor: pointer;
}

.doc-pin-btn:hover,
.doc-pin-btn.pinned {
  opacity: 1;
  color: var(--mauve);
}

/* 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;
}

/* ── td Issues section ─────────────────────────────────── */

.td-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--blue);
  color: var(--base);
  vertical-align: middle;
  margin-left: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.td-issue-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
  transition: background 0.12s;
}

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

.td-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid currentColor;
}

.td-status-dot.open        { background: transparent; color: var(--overlay1); }
.td-status-dot.in_progress { background: var(--yellow); color: var(--yellow); }
.td-status-dot.in_review   { background: var(--mauve); color: var(--mauve); }
.td-status-dot.blocked     { background: var(--red); color: var(--red); }
.td-status-dot.closed      { background: var(--green); color: var(--green); }

.td-issue-id {
  font-size: 10px;
  color: var(--overlay0);
  font-family: var(--font-mono, monospace);
  flex-shrink: 0;
}

.td-issue-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.td-issue-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.12s;
}

.td-issue-item:hover .td-issue-actions {
  opacity: 1;
}

.td-start-worktree-btn {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--surface1);
  color: var(--text);
  border: 1px solid var(--surface2);
  cursor: pointer;
  white-space: nowrap;
}

.td-start-worktree-btn:hover {
  background: var(--blue);
  color: var(--base);
  border-color: var(--blue);
}

.td-setup-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  font-size: 11px;
  color: var(--overlay1);
  border-top: 1px solid var(--surface0);
  flex-wrap: wrap;
}

.td-setup-msg {
  flex: 1;
  min-width: 0;
}

/* ── td Issue Detail Modal ─────────────────────────────── */

.td-issue-modal {
  max-width: 660px;
  width: 92%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.td-issue-modal-header-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.td-issue-modal-id {
  font-size: 11px;
  color: var(--overlay0);
  font-family: var(--font-mono, monospace);
  flex-shrink: 0;
}

.td-issue-modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.td-issue-modal-loading {
  color: var(--overlay0);
  font-size: 13px;
  padding: 12px 0;
}

.td-issue-modal-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.td-issue-modal-meta-item {
  font-size: 12px;
  color: var(--text);
}

.td-issue-modal-meta-item strong {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--overlay1);
  margin-bottom: 2px;
}

.td-issue-modal-section {
  margin-bottom: 14px;
}

.td-issue-modal-section-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--overlay1);
  margin-bottom: 6px;
}

.td-issue-modal-content {
  font-size: 12px;
  color: var(--text);
  white-space: pre-wrap;
  background: var(--mantle);
  border-radius: 6px;
  padding: 10px 12px;
  font-family: var(--font-mono, monospace);
  line-height: 1.55;
  overflow-x: auto;
  max-height: 280px;
  overflow-y: auto;
}

/* ── Sidebar Tasks Mode Toggle ─────────────────────────── */

.sidebar-tasks-header {
  padding: 6px 8px 0;
  flex-shrink: 0;
}

.sidebar-tasks-mode-toggle {
  display: flex;
  gap: 2px;
  background: var(--mantle);
  border-radius: 6px;
  padding: 2px;
}

.sidebar-tasks-mode-btn {
  flex: 1;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--overlay1);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.sidebar-tasks-mode-btn.active {
  background: var(--surface1);
  color: var(--text);
}

.sidebar-tasks-mode-btn:hover:not(.active) {
  background: var(--surface0);
  color: var(--text);
}

/* td issue items in sidebar (compact variant) */
.sidebar-td-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  cursor: pointer;
  transition: background 0.12s;
}

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

.sidebar-td-item .td-issue-id {
  font-size: 9px;
  flex-shrink: 0;
}

.sidebar-td-item .td-issue-title {
  font-size: 12px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.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-grid[data-panes="4"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.terminal-grid[data-panes="5"] { grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr 1fr; }
.terminal-grid[data-panes="6"] { grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr 1fr; }
.terminal-pane {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--base); overflow: hidden;
  min-height: 0;
}
/* Ensure hidden attribute works - author display:flex overrides UA [hidden] rule */
.terminal-pane[hidden] { display: none !important; }
/* Mobile-only input row - hidden on desktop, shown via styles-mobile.css */
.terminal-mobile-input-row { display: none; }
.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; }

/* Expand button - between mic and close, hidden until pane is active */
.terminal-pane-expand {
  opacity: 0.5;
  transition: opacity 0.15s, color 0.15s;
}
.terminal-pane-expand:hover {
  opacity: 1;
}
/* Stage 1: expand button turns green (advance to stage 2) */
.terminal-pane-expand-stage1 {
  color: var(--green);
  opacity: 1;
}
/* Stage 2: expand button hidden — already at max, no further expansion */
.terminal-pane-expand-stage2 {
  display: none !important;
}

/* Collapse button — inward arrows, always red, shown at stage1 + stage2 */
.terminal-pane-collapse {
  color: var(--red);
  opacity: 0.8;
  transition: opacity 0.15s;
}
.terminal-pane-collapse:hover {
  opacity: 1;
}

/* Stage 1: pane overlays entire terminal grid */
.terminal-pane.pane-expanded-stage1 {
  position: absolute;
  inset: 0;
  z-index: 10;
  width: 100% !important;
  height: 100% !important;
}

/* Stage 2: pane overlays entire browser viewport (covers sidebar too) */
/* z-index 900: below all overlay panels (1000+) so modals/overlays remain accessible */
.terminal-pane.pane-expanded-stage2 {
  position: fixed;
  inset: 0;
  z-index: 900;
  width: 100vw !important;
  height: 100vh !important;
}

/* Smooth expand/collapse transitions */
.terminal-pane.pane-expanded-stage1,
.terminal-pane.pane-expanded-stage2 {
  transition: all 150ms ease;
}

/* Voice input mic button - in terminal pane header, between activity and close */
.terminal-pane-mic {
  opacity: 0.5;
  transition: opacity 0.15s, color 0.15s;
}
.terminal-pane-mic:hover {
  opacity: 1;
}
.terminal-pane-mic.mic-active {
  color: var(--red);
  opacity: 1;
  animation: mic-pulse 1.5s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
/* Respect reduced motion for mic pulse */
@media (prefers-reduced-motion: reduce) {
  .terminal-pane-mic.mic-active { animation: none; }
}
.pane-pin-count {
  font-size: 10px;
  background: var(--mauve);
  color: var(--base);
  border-radius: 8px;
  padding: 0 4px;
  margin-left: 2px;
  font-weight: 600;
}
/* Voice interim transcript overlay - shown at bottom of terminal pane during recording */
.voice-interim-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 12px;
  background: color-mix(in srgb, var(--mantle) 90%, transparent);
  color: var(--subtext0);
  font-size: 13px;
  font-style: italic;
  z-index: 10;
  border-top: 1px solid var(--surface0);
  pointer-events: none;
}
/* 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;
  filter: blur(4px) brightness(0.7);
  transition: filter 150ms ease;
}
.terminal-pane.image-drag-over::after {
  content: 'Drop image to send to this session'; 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;
  background: var(--base); padding: 8px 16px; border-radius: 8px;
  border: 1px solid var(--blue); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.terminal-container { flex: 1; overflow: hidden; transition: filter 150ms ease; }
.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);
}

/* ─── Pane View Container, Badge, Back Button ──────────── */
.pane-view-container {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  background: var(--base);
}

.pane-view-badge {
  font-size: 11px;
  padding: 2px 6px;
  background: var(--surface1);
  color: var(--subtext0);
  border-radius: 4px;
  font-weight: 600;
  margin-right: 4px;
}

.pane-view-back {
  opacity: 0.6;
}

.pane-view-back:hover {
  opacity: 1;
}

/* Terminal pane drag-to-reposition */
.terminal-pane-header {
  cursor: grab;
  /* Touch: let DragDropTouch polyfill do long-press-to-drag without the
     browser claiming the gesture for scroll/zoom on the underlying terminal. */
  touch-action: none;
}
.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);
}
html.pane-colors-enabled .terminal-pane:not(.terminal-pane-empty)[data-slot="4"] > .terminal-pane-header {
  border-left: 3px solid var(--red);
}
html.pane-colors-enabled .terminal-pane:not(.terminal-pane-empty)[data-slot="5"] > .terminal-pane-header {
  border-left: 3px solid var(--pink);
}

/* ─── Sidebar Session Instance Indicator ───────────────── */
.instance-indicator-row {
  display: inline-flex;
  gap: 0;                /* per-pip 2px padding provides spacing */
  margin-left: 4px;
  flex-shrink: 0;
}
.instance-indicator {
  padding: 2px;          /* invisible 2px hit-area extension; also growth room */
  cursor: pointer;
  display: inline-block;
  line-height: 0;
  flex-shrink: 0;
}
.instance-indicator-square {
  width: 10px;
  height: 10px;
  border-radius: 1px;
  background: var(--c-outer);
  position: relative;
  overflow: hidden;
  display: inline-block;
  transition: transform 120ms ease, box-shadow 120ms ease;
  transform-origin: center center;
}
.instance-indicator:hover .instance-indicator-square {
  transform: scale(1.1);
}
/* Hover ring around the visible square — disabled for now.
.instance-indicator:hover .instance-indicator-square {
  box-shadow: 0 0 0 1.5px var(--c-outer);
}
*/
.instance-indicator-inner {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 7px;
  background: var(--c-inner);
  border-top: 1px solid #000;
  box-sizing: border-box;
}
html:not(.pane-colors-enabled) .instance-indicator-row {
  display: none;
}

/* Pane pulse — short flash when navigating from a sidebar pip */
@keyframes pane-nav-pulse {
  0%   { background-color: rgba(205, 214, 244, 0.05); box-shadow: inset 0 0 0 3px var(--text), 0 0 16px rgba(205, 214, 244, 0.4); }
  100% { background-color: transparent; box-shadow: inset 0 0 0 0 transparent, 0 0 0 transparent; }
}
.pane-nav-pulse::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  animation: pane-nav-pulse 700ms ease-out forwards;
}

/* ─── Tri-State Dots (Worktree Tasks) ─────────────────── */
.ws-session-dot[data-tristate="busy"] {
  animation: tristate-pulse 1.5s ease-in-out infinite;
}
.ws-session-dot[data-tristate="waiting"] {
  opacity: 0.7;
}
.ws-session-dot[data-tristate="ready"] {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  position: relative;
}
.ws-session-dot[data-tristate="ready"]::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 2px;
  width: 3px;
  height: 5px;
  border: solid var(--base);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}
@keyframes tristate-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* ─── Needs Input Badge ───────────────────────────────── */
.terminal-pane-header[data-needs-input="true"]::after {
  content: 'Needs input';
  position: absolute;
  right: 120px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(249, 226, 175, 0.15);
  color: var(--peach);
  animation: pulse-needs-input 2s ease-in-out infinite;
}
@keyframes pulse-needs-input {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ─── 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;
  touch-action: none;
}
/* Wider invisible hit area for touch — visual stays at the handle's own width. */
.terminal-resize-handle::before {
  content: "";
  position: absolute;
  inset: -8px 0;
}
.terminal-resize-col {
  top: 0;
  width: 6px;
  height: 100%;
  cursor: col-resize;
}
.terminal-resize-col::before { inset: 0 -8px; }
.terminal-resize-row {
  left: 0;
  width: 100%;
  height: 6px;
  cursor: row-resize;
}
.terminal-resize-row::before { inset: -8px 0; }
.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: 2px 8px;
  cursor: pointer;
  color: var(--overlay0);
  font-size: 10px;
  font-family: var(--font-mono);
  font-style: italic;
  user-select: none;
  transition: color var(--transition-fast);
  margin: 2px 0;
}

.ws-project-group-header:hover {
  color: var(--subtext0);
}

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

.ws-project-group-chevron.open {
  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);
  flex-shrink: 0;
}

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

/* Sidebar section divider between categories and uncategorized projects */
.sidebar-section-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 4px;
  margin-top: 4px;
}

.sidebar-section-divider::before,
.sidebar-section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--surface1);
}

.sidebar-section-divider-label {
  font-size: 10px;
  color: var(--overlay0);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════ */
/* 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;
  /* Touch: let DragDropTouch polyfill handle long-press-to-drag without the
     browser claiming the gesture for the scrollable tab strip.
  */
  touch-action: none;
}

.terminal-group-tab::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 2px;
  transform: translateX(-50%);
  width: 85%;
  height: 2px;
  border-radius: 2px;
  background: var(--tab-color);
  pointer-events: none;
}

.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(--tab-color);
  flex-shrink: 0;
}

.terminal-group-tab-dot.inactive {
  opacity: 0.4;
}

.terminal-group-tab-name {
  color: var(--tab-color);
}

.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; }
}

/* ═══════════════════════════════════════════════════════════ */
/* TASKS PANEL (Worktree Tasks View)                           */
/* ═══════════════════════════════════════════════════════════ */

.tasks-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.tasks-panel-header {
  display: flex;
  flex-direction: column;
  padding: 0;
  flex-shrink: 0;
}

.tasks-panel-header .tasks-header-actions {
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
}

.tasks-panel-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

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

/* ─── Task status group sections ─────────────────────── */
.tasks-group {
  margin-bottom: 12px;
}

.tasks-group-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--overlay0);
}

.tasks-group-count {
  font-size: 10px;
  color: var(--overlay0);
  font-weight: 400;
}

/* ─── Task item (two-line layout) ────────────────────── */
.task-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}

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

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

.task-item-dot.busy {
  background: var(--green);
  animation: tristate-pulse 1.5s ease-in-out infinite;
}

.task-item-dot.waiting {
  background: var(--peach);
  opacity: 0.7;
}

.task-item-dot.ready {
  background: var(--blue);
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.task-item-dot.review {
  background: var(--mauve);
}

.task-item-dot.completed {
  background: var(--overlay0);
  opacity: 0.5;
}

.task-item-branch {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

.task-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding-left: 14px;
  font-size: 10px;
  color: var(--overlay0);
}

.task-item-changes {
  font-family: var(--font-mono);
}

.task-item-changes .added { color: var(--green); }
.task-item-changes .removed { color: var(--red); }

.task-item-actions {
  display: flex;
  gap: 4px;
  width: 100%;
  padding-left: 14px;
  padding-top: 4px;
}

.task-item-actions .btn {
  font-size: 10px;
  padding: 2px 8px;
}

/* Completed tasks - muted */
.tasks-group-completed .task-item {
  opacity: 0.5;
}

.tasks-group-completed .task-item:hover {
  opacity: 0.8;
}

/* ─── Task empty state ───────────────────────────────── */
.tasks-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--overlay0);
}

.tasks-empty-icon {
  font-size: 32px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.tasks-empty-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.tasks-empty-desc {
  font-size: 12px;
  max-width: 280px;
  line-height: 1.5;
}

/* ─── Tasks header actions ───────────────────────────── */
.tasks-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tasks-search-input {
  width: 160px;
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
  border: 1px solid var(--surface1);
  border-radius: var(--radius-sm);
  background: var(--surface0);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast);
}

.tasks-search-input:focus {
  border-color: var(--blue);
}

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

.tasks-layout-toggle {
  display: flex;
  background: var(--surface0);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 1px;
}

.tasks-layout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 24px;
  border: none;
  border-radius: var(--radius-xs, 3px);
  background: transparent;
  color: var(--overlay0);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tasks-layout-btn:hover {
  color: var(--text-primary);
}

.tasks-layout-btn.active {
  background: var(--surface1);
  color: var(--text-primary);
}

/* ─── Kanban Board ───────────────────────────────────── */
.kanban-board {
  flex: 1;
  display: flex;
  gap: 10px;
  padding: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  min-height: 0;
}

.kanban-column {
  flex: 1;
  min-width: 220px;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  background: var(--mantle);
  border-radius: var(--radius-md);
  border: 1px solid var(--surface0);
  overflow: hidden;
}

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

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

.kanban-column-dot.backlog { background: var(--overlay0); }
.kanban-column-dot.planning { background: var(--mauve); }
.kanban-column-dot.running { background: var(--green); animation: tristate-pulse 1.5s ease-in-out infinite; }
.kanban-column-dot.review { background: var(--peach); }
.kanban-column-dot.completed { background: var(--blue); }

.kanban-column-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.kanban-column-count {
  font-size: 11px;
  color: var(--overlay0);
  margin-left: auto;
  background: var(--surface0);
  padding: 1px 6px;
  border-radius: 10px;
}

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

/* Drop zone highlighting during drag */
.kanban-column-body.drag-over {
  background: color-mix(in srgb, var(--blue) 8%, transparent);
  border: 1px dashed var(--blue);
  border-radius: var(--radius-sm);
}

/* ─── Kanban Card (GitHub-inspired) ──────────────────── */
.kanban-card {
  background: var(--base);
  border: 1px solid var(--surface0);
  border-left: 3px solid var(--overlay0);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: grab;
  transition: all var(--transition-fast);
  position: relative;
}

/* Status-colored left border accent */
.kanban-column[data-status="backlog"] .kanban-card { border-left-color: var(--overlay0); }
.kanban-column[data-status="planning"] .kanban-card { border-left-color: var(--mauve); }
.kanban-column[data-status="running"] .kanban-card { border-left-color: var(--green); }
.kanban-column[data-status="review"] .kanban-card { border-left-color: var(--peach); }
.kanban-column[data-status="completed"] .kanban-card { border-left-color: var(--blue); }

.kanban-card:hover {
  border-color: var(--surface1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

/* Preserve left border color on hover */
.kanban-column[data-status="backlog"] .kanban-card:hover { border-left-color: var(--overlay0); }
.kanban-column[data-status="planning"] .kanban-card:hover { border-left-color: var(--mauve); }
.kanban-column[data-status="running"] .kanban-card:hover { border-left-color: var(--green); }
.kanban-column[data-status="review"] .kanban-card:hover { border-left-color: var(--peach); }
.kanban-column[data-status="completed"] .kanban-card:hover { border-left-color: var(--blue); }

.kanban-card.dragging {
  opacity: 0.4;
  cursor: grabbing;
  transform: rotate(2deg);
}

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

.kanban-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  font-size: 10px;
  color: var(--overlay0);
}

.kanban-card-meta .session-badge {
  font-size: 9px;
  padding: 1px 5px;
}

.kanban-card-changes {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  margin-top: 6px;
  color: var(--overlay0);
}

.kanban-card-changes .added { color: var(--green); }
.kanban-card-changes .removed { color: var(--red); }

.kanban-card-preview {
  margin-top: 6px;
  padding: 4px 6px;
  background: var(--mantle);
  border-radius: var(--radius-xs, 3px);
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 10px;
  line-height: 1.3;
  color: var(--overlay1, var(--text-secondary));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.kanban-card-actions {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--surface0);
}

.kanban-card-actions .btn {
  font-size: 10px;
  padding: 2px 8px;
}

/* Blocked card indicator */
.kanban-card-blocked {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  font-size: 10px;
  color: var(--red);
  opacity: 0.9;
}

.kanban-card-blocked svg {
  flex-shrink: 0;
}

.kanban-card-blocked-state {
  opacity: 0.65;
}

/* Stage progress dots (workflow progression) */
.kanban-card-stages {
  margin-top: 4px;
  font-size: 11px;
  letter-spacing: 2px;
}

/* Task timeline (compact audit trail) */
.kanban-card-timeline {
  margin-top: 6px;
  font-size: 10px;
  color: var(--overlay0);
  font-style: italic;
}

/* Empty column state */
.kanban-column-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: var(--overlay0);
  font-size: 11px;
  font-style: italic;
  opacity: 0.6;
  min-height: 40px;
}

/* ── Tasks sub-navigation ────────────────────────────── */
.tasks-tab-strip {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0;
  border-bottom: 1px solid var(--surface1);
  flex-shrink: 0;
}

.tasks-tab {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--subtext0);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}

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

.tasks-tab.active {
  color: var(--text);
  border-bottom-color: var(--blue);
}

/* ── Tasks tab panels ────────────────────────────────── */
.tasks-tab-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.tasks-tab-panel[hidden] { display: none; }

.tasks-inner-panel {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
/* td panel needs its toolbar fixed at top, list scrolls below */
#tasks-td-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#tasks-td-panel .tasks-td-toolbar { flex-shrink: 0; }
#tasks-td-panel .tasks-td-group-header,
#tasks-td-panel .tasks-td-row,
#tasks-td-panel .tasks-placeholder {
  flex-shrink: 0;
}

/* ── Placeholder / empty states ──────────────────────── */
.tasks-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 120px;
  color: var(--overlay0);
  font-size: 13px;
  text-align: center;
  padding: 16px;
}

.tasks-placeholder--error {
  color: var(--red);
}

/* ── td issues in Tasks panel ───────────────────────── */
.tasks-td-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--subtext0);
  border-bottom: 1px solid var(--surface1);
  margin-top: 4px;
}

.tasks-td-group-header:first-child { margin-top: 0; }

.tasks-td-group-count {
  background: var(--surface1);
  color: var(--subtext0);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 9px;
  font-weight: 500;
  letter-spacing: 0;
}

.tasks-td-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--surface1);
  font-size: 13px;
  transition: background 0.1s;
}

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

.td-priority-badge {
  margin-left: auto;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface1);
  color: var(--subtext0);
  flex-shrink: 0;
}

.td-priority-badge.priority-p0 { background: var(--red);    color: var(--base); }
.td-priority-badge.priority-p1 { background: var(--peach);  color: var(--base); }
.td-priority-badge.priority-p2 { background: var(--yellow); color: var(--base); }
.td-priority-badge.priority-p3 { background: var(--surface2); color: var(--text); }

/* ── td panel project switcher toolbar ───────────────── */
.tasks-td-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--surface1);
  background: var(--mantle);
  flex-shrink: 0;
}
.tasks-td-toolbar-label {
  font-size: 11px;
  color: var(--subtext0);
  font-weight: 600;
  white-space: nowrap;
}
.tasks-td-project-select {
  flex: 1;
  font-size: 12px;
  background: var(--surface0);
  color: var(--text);
  border: 1px solid var(--surface2);
  border-radius: 4px;
  padding: 2px 6px;
  min-width: 0;
  cursor: pointer;
}
.tasks-td-project-select:focus { outline: none; border-color: var(--mauve); }
.tasks-td-refresh {
  font-size: 14px;
  padding: 2px 6px;
  flex-shrink: 0;
}

/* ─── New Task Dialog form elements ──────────────────── */
.form-group {
  margin-bottom: 14px;
}

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

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  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);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--mauve);
}

.form-textarea {
  resize: vertical;
  min-height: 60px;
}

.form-hint {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--overlay0);
  margin-top: 4px;
  min-height: 16px;
}

.form-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.form-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
  accent-color: var(--mauve);
}

/* ─── Workspace hover button for new task ────────────── */
.workspace-item {
  position: relative;
}

.ws-new-task-btn {
  position: absolute;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border-radius: 3px;
  background: transparent;
  border: 1px solid var(--surface1);
  color: var(--overlay0);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  opacity: 0;
  transition: opacity var(--transition-fast), background var(--transition-fast);
}

.workspace-item:hover .ws-new-task-btn {
  opacity: 1;
}

.ws-new-task-btn:hover {
  background: var(--surface1);
  color: var(--text-primary);
  border-color: var(--mauve);
}

/* ═══════════════════════════════════════════════════════════ */
/* DIFF VIEWER                                                 */
/* ═══════════════════════════════════════════════════════════ */

.diff-viewer {
  display: flex;
  flex-direction: column;
  width: 92vw;
  max-width: 1100px;
  height: 80vh;
  background: var(--bg-primary);
  border: 1px solid var(--surface1);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

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

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

.diff-viewer-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.diff-viewer-stats {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--subtext0);
  white-space: nowrap;
}

.diff-viewer-stats .added { color: var(--green); }
.diff-viewer-stats .removed { color: var(--red); }

.diff-viewer-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ─── File list sidebar ──────────────────────────────── */

.diff-viewer-files {
  width: 260px;
  min-width: 200px;
  border-right: 1px solid var(--surface0);
  overflow-y: auto;
  flex-shrink: 0;
}

.diff-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  cursor: pointer;
  transition: background var(--transition-fast);
  border-left: 2px solid transparent;
}

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

.diff-file-item.active {
  background: var(--surface0);
  border-left-color: var(--mauve);
}

.diff-file-status {
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  flex-shrink: 0;
}

.diff-file-status.status-M { color: var(--yellow); background: rgba(249, 226, 175, 0.1); }
.diff-file-status.status-A { color: var(--green); background: rgba(166, 227, 161, 0.1); }
.diff-file-status.status-D { color: var(--red); background: rgba(243, 139, 168, 0.1); }
.diff-file-status.status-R { color: var(--blue); background: rgba(137, 180, 250, 0.1); }

.diff-file-name {
  font-size: 12px;
  color: var(--text-primary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.diff-file-dir {
  color: var(--subtext0);
}

.diff-file-counts {
  display: flex;
  gap: 4px;
  font-size: 10px;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.diff-file-counts .added { color: var(--green); }
.diff-file-counts .removed { color: var(--red); }

/* ─── Diff content pane ──────────────────────────────── */

.diff-viewer-content {
  flex: 1;
  overflow: auto;
  min-width: 0;
}

.diff-viewer-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 13px;
  color: var(--subtext0);
}

.diff-viewer-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 13px;
  color: var(--subtext0);
}

.diff-hunk {
  border-bottom: 1px solid var(--surface0);
}

.diff-hunk-header {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--blue);
  background: rgba(137, 180, 250, 0.06);
  padding: 4px 12px;
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 1px solid var(--surface0);
}

.diff-line {
  display: flex;
  font-size: 12px;
  font-family: var(--font-mono);
  line-height: 20px;
  white-space: pre;
}

.diff-line-num {
  width: 48px;
  min-width: 48px;
  text-align: right;
  padding-right: 8px;
  color: var(--overlay0);
  user-select: none;
  flex-shrink: 0;
}

.diff-line-content {
  flex: 1;
  padding-left: 8px;
  min-width: 0;
}

.diff-line.diff-add {
  background: rgba(166, 227, 161, 0.08);
}

.diff-line.diff-add .diff-line-content {
  color: var(--green);
}

.diff-line.diff-del {
  background: rgba(243, 139, 168, 0.08);
}

.diff-line.diff-del .diff-line-content {
  color: var(--red);
}

.diff-line.diff-ctx .diff-line-content {
  color: var(--subtext0);
}

/* ─── Changed files section in detail panel ──────────── */

.detail-changes {
  margin-top: 12px;
  border-top: 1px solid var(--surface0);
  padding-top: 10px;
}

.detail-changes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 4px 0;
  user-select: none;
}

.detail-changes-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--subtext0);
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-changes-toggle {
  font-size: 10px;
  color: var(--overlay0);
  transition: transform var(--transition-fast);
}

.detail-changes-header[aria-expanded="true"] .detail-changes-toggle {
  transform: rotate(90deg);
}

.detail-changes-list {
  margin-top: 6px;
}

.detail-change-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}

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

.detail-change-status {
  font-size: 9px;
  font-weight: 700;
  width: 14px;
  text-align: center;
  flex-shrink: 0;
}

.detail-change-status.status-M { color: var(--yellow); }
.detail-change-status.status-A { color: var(--green); }
.detail-change-status.status-D { color: var(--red); }
.detail-change-status.status-R { color: var(--blue); }

.detail-change-path {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-change-counts {
  font-size: 10px;
  flex-shrink: 0;
  display: flex;
  gap: 3px;
}

.detail-change-counts .added { color: var(--green); }
.detail-change-counts .removed { color: var(--red); }


/* ═══════════════════════════════════════════════════════════ */
/* 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;
  }
}

/* ─── Per-Pane Conflict Badge (JSONL-based) ─────────────── */
/* Small amber badge on terminal pane headers showing count  */
/* of files this session shares with other active sessions.  */

.pane-conflict-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 6px;
  border-radius: 9px;
  background: var(--yellow);
  color: var(--base);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  flex-shrink: 0;
  animation: conflict-pulse 2s ease-in-out infinite;
}

@keyframes conflict-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Amber text for conflict details in context menu */
.conflict-warning {
  color: var(--yellow) !important;
}

/* ═══════════════════════════════════════════════════════════ */
/* 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); }

/* ═══════════════════════════════════════════════════════════════
   SESSION LAUNCHER MODAL
   ═══════════════════════════════════════════════════════════════ */

.launcher-panel {
  width: 100%;
  max-width: 520px;
  max-height: 75vh;
  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;
}

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

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

.launcher-search-wrap {
  position: relative;
  padding: 12px 16px 8px;
}

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

.launcher-search {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--surface1);
  border-radius: var(--radius-sm);
  background: var(--surface0);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition-fast);
  box-sizing: border-box;
}

.launcher-search:focus {
  border-color: var(--lavender);
}

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

.launcher-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
  min-height: 100px;
  max-height: 340px;
}

.launcher-section-label {
  padding: 10px 16px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--overlay0);
  user-select: none;
}

.launcher-project-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background var(--transition-fast);
  border-left: 2px solid transparent;
}

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

.launcher-project-row.selected {
  background: color-mix(in srgb, var(--lavender) 10%, transparent);
  border-left-color: var(--lavender);
}

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

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

.launcher-project-path {
  font-size: 11px;
  color: var(--overlay0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.launcher-project-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.launcher-project-time {
  font-size: 11px;
  color: var(--overlay0);
  white-space: nowrap;
}

.launcher-project-badge {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--teal) 15%, transparent);
  color: var(--teal);
  font-weight: 500;
  white-space: nowrap;
}

.launcher-pin-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--overlay0);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  font-size: 14px;
  opacity: 0;
}

.launcher-project-row:hover .launcher-pin-btn {
  opacity: 1;
}

.launcher-pin-btn.pinned {
  opacity: 1;
  color: var(--yellow);
}

.launcher-pin-btn:hover {
  color: var(--yellow);
  background: color-mix(in srgb, var(--yellow) 12%, transparent);
}

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

/* Launcher bottom form */
.launcher-form {
  border-top: 1px solid var(--border-subtle);
  padding: 12px 16px;
  background: var(--mantle);
}

.launcher-form-selected {
  font-size: 12px;
  color: var(--subtext0);
  margin-bottom: 10px;
  padding: 6px 10px;
  background: var(--surface0);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.launcher-form-selected strong {
  color: var(--text);
  font-weight: 600;
}

.launcher-form-fields {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.launcher-form-group {
  flex: 1;
  min-width: 0;
}

.launcher-form-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--overlay0);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.launcher-form-input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--surface1);
  border-radius: var(--radius-sm);
  background: var(--surface0);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition-fast);
  box-sizing: border-box;
}

.launcher-form-input:focus {
  border-color: var(--lavender);
}

.launcher-form-submit {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Scrollbar styling for launcher list */
.launcher-list::-webkit-scrollbar {
  width: 6px;
}

.launcher-list::-webkit-scrollbar-track {
  background: transparent;
}

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

.launcher-list::-webkit-scrollbar-thumb:hover {
  background: var(--overlay0);
}

/* ═══════════════════════════════════════════════════════════════
   Pair Mobile Modal
   ═══════════════════════════════════════════════════════════════ */

/* Badge on header button showing paired device count */
.pair-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 14px;
  height: 14px;
  background: var(--accent, var(--mauve));
  color: var(--base);
  border-radius: 7px;
  border: 2px solid var(--base);
  font-size: 9px;
  font-weight: 700;
  line-height: 10px;
  text-align: center;
  padding: 0 3px;
}

/* Modal sizing */
.pair-mobile-modal {
  max-width: 480px;
  width: 90vw;
}

/* Tab strip in modal header */
.pair-modal-tabs {
  display: flex;
  gap: 2px;
  margin-left: auto;
  margin-right: 8px;
}

.pair-tab {
  background: none;
  border: none;
  color: var(--subtext0);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: var(--radius-sm, 4px);
  cursor: pointer;
  transition: color var(--transition-fast, 150ms), background var(--transition-fast, 150ms);
  position: relative;
}

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

.pair-tab.active {
  color: var(--accent, var(--mauve));
  background: var(--surface0);
}

.pair-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 8px;
  right: 8px;
  height: 2px;
  background: var(--accent, var(--mauve));
  border-radius: 1px;
}

/* Modal body */
.pair-modal-body {
  padding: 20px;
}

/* QR container */
.pair-qr-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  padding: 16px;
}

.pair-qr-container svg {
  max-width: 256px;
  max-height: 256px;
  width: 100%;
  height: auto;
}

.pair-qr-placeholder {
  color: var(--subtext0);
  font-size: 13px;
}

/* Connection URLs */
.pair-urls {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

.pair-url-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--surface0);
  border-radius: var(--radius-sm, 4px);
  font-size: 12px;
}

.pair-url-label {
  color: var(--subtext0);
  font-weight: 500;
  min-width: 64px;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.5px;
}

.pair-url-value {
  flex: 1;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.pair-url-copy {
  background: none;
  border: none;
  color: var(--subtext0);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm, 4px);
  font-size: 11px;
  transition: color var(--transition-fast, 150ms), background var(--transition-fast, 150ms);
}

.pair-url-copy:hover {
  color: var(--text);
  background: var(--surface1);
}

/* Countdown timer */
.pair-timer {
  text-align: center;
  margin-top: 12px;
  font-size: 11px;
  color: var(--subtext0);
}

/* Devices list */
.pair-devices-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pair-devices-empty {
  text-align: center;
  color: var(--subtext0);
  padding: 40px 16px;
  font-size: 13px;
}

/* Device card */
.pair-device-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface0);
  border-radius: var(--radius-md, 8px);
  transition: background var(--transition-fast, 150ms);
}

.pair-device-card:hover {
  background: var(--surface1);
}

.device-icon {
  font-size: 24px;
  flex-shrink: 0;
  width: 36px;
  text-align: center;
}

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

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

.device-online-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--surface2);
  flex-shrink: 0;
}

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

.device-meta {
  font-size: 11px;
  color: var(--subtext0);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-push-status {
  font-size: 11px;
  color: var(--overlay1);
}

.device-push-status .push-registered {
  color: var(--green);
}

.device-push-status .push-none {
  color: var(--overlay0);
}

/* Device action buttons */
.device-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.device-actions .btn-sm {
  font-size: 11px;
  padding: 3px 8px;
}

.device-actions .btn-danger {
  color: var(--red);
}

.device-actions .btn-danger:hover {
  background: rgba(243, 139, 168, 0.1);
}

.device-actions .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Git Tab ─────────────────────────────────────────── */
.git-panel-container {
  display: flex;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.git-panel-left {
  width: 260px;
  flex-shrink: 0;
  border-right: 1px solid var(--surface1);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.git-panel-right {
  flex: 1;
  overflow: auto;
  min-width: 0;
}

.git-branch-bar {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--subtext0);
  border-bottom: 1px solid var(--surface1);
  display: flex;
  align-items: center;
  gap: 4px;
}

.git-branch-name {
  color: var(--green);
  font-weight: 500;
}

.git-group-header {
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--subtext0);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--surface0);
  border-bottom: 1px solid var(--surface1);
}

.git-file-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12px;
  border-bottom: 1px solid var(--surface0);
  transition: background 0.1s;
}

.git-file-row:hover { background: var(--surface0); }
.git-file-row.active { background: var(--surface1); }

.git-file-state {
  font-size: 10px;
  font-weight: 700;
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}

.git-state-staged   { color: var(--green); }
.git-state-modified { color: var(--yellow); }
.git-state-untracked { color: var(--blue); }
.git-state-deleted  { color: var(--red); }

.git-file-name {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.git-diff-viewer {
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
  padding: 12px;
  overflow: auto;
  white-space: pre;
  tab-size: 4;
}

.diff-add  { color: var(--green); display: block; }
.diff-del  { color: var(--red);   display: block; }
.diff-hunk { color: var(--blue);  display: block; }
.diff-ctx  { color: var(--subtext0); display: block; }
.diff-meta { color: var(--text); display: block; font-weight: 500; }

/* ── Commit log ─────────────────────────────────────── */
.git-log-section {
  margin-top: 8px;
}

.git-commit-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 12px;
  border-bottom: 1px solid var(--surface0);
  transition: background 0.1s;
}
.git-commit-row:hover { background: var(--surface0); }
.git-commit-row.selected { background: var(--surface1); }

.git-commit-hash {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: var(--blue);
  flex-shrink: 0;
  cursor: pointer;
}

.git-commit-hash:hover { text-decoration: underline; }

.git-commit-msg {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.git-commit-meta {
  font-size: 11px;
  color: var(--subtext0);
  flex-shrink: 0;
  white-space: nowrap;
}

/* ── Files Tab ────────────────────────────────────────────────────────── */
.files-container {
  display: flex;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.files-sidebar {
  width: 240px;
  flex-shrink: 0;
  border-right: 1px solid var(--surface1);
  overflow-y: auto;
  font-size: 12px;
}

.files-editor-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.files-tree-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: background 0.1s;
}

.files-tree-row:hover { background: var(--surface0); }
.files-tree-row.active { background: var(--surface1); }

.files-tree-icon {
  font-size: 8px;
  color: var(--subtext0);
  width: 10px;
  text-align: center;
  flex-shrink: 0;
}

.files-tree-name {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.files-tree-file .files-tree-name { color: var(--text); }
.files-tree-dir .files-tree-name { color: var(--blue); font-weight: 500; }

.files-tree-children {
  padding-left: 16px;
}

.files-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  border-bottom: 1px solid var(--surface1);
  flex-shrink: 0;
  background: var(--surface0);
}

.files-editor-filename {
  font-size: 12px;
  color: var(--text);
  font-family: var(--font-mono, monospace);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.files-save-btn {
  padding: 4px 12px;
  font-size: 12px;
  background: var(--surface1);
  color: var(--text);
  border: 1px solid var(--surface2);
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.1s;
}

.files-save-btn:hover:not(:disabled) { background: var(--surface2); }
.files-save-btn:disabled { opacity: 0.5; cursor: default; }
.files-save-btn.dirty { background: var(--blue); color: var(--base); border-color: var(--blue); }

.files-cm-container {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.files-cm-container .cm-editor {
  height: 100%;
  font-size: 13px;
}

.files-cm-container .cm-scroller {
  overflow: auto;
}

/* ─── Schedule clock button ────────────────────────────── */
/* Floating bottom-right of terminal pane, immediately to the left of the upload button. */
.terminal-pane-schedule {
  position: absolute; bottom: 12px; right: 52px; 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-schedule,
.terminal-pane-schedule:focus-visible { opacity: 0.7; }
.terminal-pane-schedule:hover { opacity: 1 !important; background: var(--surface1); color: var(--text); }
.terminal-pane-schedule .pane-schedule-count {
  position: absolute; top: -2px; right: -2px;
  min-width: 14px; height: 14px; padding: 0 3px;
  background: var(--mauve); color: var(--base);
  border-radius: 7px; font-size: 9px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
/* On mobile, keep the schedule button visible (unlike upload which uses the toolbar). */

/* ─── Schedule popover ─────────────────────────────────── */
.schedule-popover {
  position: absolute;
  z-index: 10004;
  width: 360px; max-width: calc(100vw - 16px);
  background: var(--surface0);
  border: 1px solid var(--surface1);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  font-family: var(--font-sans, "Plus Jakarta Sans"), sans-serif;
  font-size: 13px;
  color: var(--text);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.schedule-popover-tabs {
  display: flex; border-bottom: 1px solid var(--surface1);
  background: var(--mantle);
}
.schedule-popover-tab {
  flex: 1; padding: 8px 12px; text-align: center;
  background: transparent; border: 0; color: var(--subtext0);
  cursor: pointer; font-size: 12px; font-weight: 600;
  transition: background 150ms, color 150ms;
}
.schedule-popover-tab:hover { background: var(--surface1); color: var(--text); }
.schedule-popover-tab.active {
  color: var(--mauve);
  box-shadow: inset 0 -2px 0 var(--mauve);
}
.schedule-popover-body {
  padding: 12px;
  max-height: 60vh;
  overflow-y: auto;
}

/* ─── Schedule popover form (Task 7) ──────────────────── */
.schedule-form { display: flex; flex-direction: column; gap: 8px; }
.schedule-form label { font-size: 11px; color: var(--subtext1); }
/* Stack a wrapping label's caption above its input with a small gap so the
   focus-state border does not crowd the label text. */
.schedule-form > label:not(.row) { display: flex; flex-direction: column; gap: 6px; }
/* Radio labels inside .row need the same in-label gap that the Repeat
   checkbox label gets from its parent .row's flex gap. */
.schedule-form .row label { display: inline-flex; align-items: center; gap: 6px; }
.schedule-form input[type="text"],
.schedule-form input[type="number"],
.schedule-form input[type="date"],
.schedule-form input[type="time"],
.schedule-form input[type="datetime-local"],
.schedule-form select {
  width: 100%; padding: 6px 8px;
  background: var(--base); color: var(--text);
  border: 1px solid var(--surface1); border-radius: var(--radius-sm);
  font: inherit;
}
.schedule-form .row { display: flex; gap: 6px; align-items: center; }
.schedule-form .row > * { flex: 0 0 auto; }
.schedule-form .row .num { width: 64px; }
.schedule-form .row .unit { width: 80px; }
.schedule-form .row .date { width: 140px; }
.schedule-form .row .time { width: 100px; }
.schedule-form .actions {
  display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px;
}

/* ─── Schedule list rows ──────────────────────────────── */
.schedule-list { margin-top: 12px; border-top: 1px solid var(--surface1); padding-top: 8px; }
.schedule-list-header {
  font-size: 11px; color: var(--subtext0); text-transform: uppercase;
  letter-spacing: 0.05em; margin-bottom: 4px;
}
.schedule-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 4px; border-radius: var(--radius-sm);
}
.schedule-row:hover { background: var(--surface1); }
.schedule-row .glyph { width: 14px; text-align: center; opacity: 0.8; }
.schedule-row .label { flex: 1; font-family: var(--font-mono, "JetBrains Mono"), monospace; font-size: 12px; }
.schedule-row .when { color: var(--subtext0); font-size: 11px; }
.schedule-row .trash {
  background: transparent; border: 0; color: var(--subtext0);
  cursor: pointer; padding: 2px 4px; border-radius: 4px;
}
.schedule-row .trash:hover { color: var(--red); background: var(--surface2); }
.schedule-empty { color: var(--subtext0); font-size: 12px; padding: 8px 0; text-align: center; }

/* ─── Schedule indicators (sidebar + pane title) ───────── */
.session-schedule-clock,
.pane-title-clock {
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--mauve);
  vertical-align: middle;
}
/* Sidebar icon is prepended (icon → text), so margin sits on the right. */
.session-schedule-clock { margin-right: 6px; }
/* Pane-title icon sits inside the title span after the text. */
.pane-title-clock { margin-left: 6px; opacity: 0.85; }

/* ─── Provider accents (Phase 18 foundation) ──────────────────────
   Selectors target [data-provider] attributes rendered by app.js on
   the matching DOM nodes. All values reference theme-derived tokens
   (--provider-{id}-accent / --provider-{id}-tint at :root) so accents
   cascade through every Catppuccin theme without per-theme code.

   The terminal-pane background uses a 24px-tall linear gradient that
   fades to transparent before reaching the xterm canvas; the xterm
   canvas paints over the pane background, so text contrast is never
   reduced by the tint (Pitfall F mitigation). */
/* Per-design 2026-05-11: pane-provider visual treatment bumped to be
   noticeable at-a-glance for mixed-provider grids. Combines a 3px solid
   accent strip at top (was 1px), a deeper top-fade tint (was 24px), and
   a 2px bottom accent. Whole-pane subtle background tint via color-mix
   (12% saturation) sits BEHIND the xterm canvas; xterm paints opaque
   over its own area so text contrast is never reduced (Pitfall F). */
.terminal-pane[data-provider="claude"]:not(.terminal-pane-empty) {
  border-top: 4px solid var(--provider-claude-accent);
  border-bottom: 2px solid var(--provider-claude-accent);
  background:
    linear-gradient(180deg, var(--provider-claude-tint) 0, transparent 64px),
    color-mix(in srgb, var(--mauve) 8%, var(--bg-primary));
}
.terminal-pane[data-provider="codex"]:not(.terminal-pane-empty) {
  border-top: 4px solid var(--provider-codex-accent);
  border-bottom: 2px solid var(--provider-codex-accent);
  background:
    linear-gradient(180deg, var(--provider-codex-tint) 0, transparent 64px),
    color-mix(in srgb, var(--green) 8%, var(--bg-primary));
}

/* alpha.7 follow-up: per-provider stripes on the workspace sidebar
   session items only. User asked to drop the per-provider markers from
   the Discovered Projects section (project accordions and their session
   items) — that section already conveys provider via tab filtering, so
   the stripes there were noise. Theme-safe via --provider-*-accent. */
.ws-session-item[data-provider="claude"] {
  box-shadow: inset 3px 0 0 var(--provider-claude-accent);
  padding-left: 11px;
}
.ws-session-item[data-provider="codex"] {
  box-shadow: inset 3px 0 0 var(--provider-codex-accent);
  padding-left: 11px;
}

/* Codex pane bottom status strip (Plan 22-01). Absolute-positioned along
   the bottom edge of any Codex pane. Hidden on Claude panes (only
   inserted into the DOM when data-provider="codex"). Chips are clickable
   and open the matching submenu from _buildCodexPaneMenu. */
.terminal-pane[data-provider="codex"]:not(.terminal-pane-empty) {
  padding-bottom: 28px; /* room for the strip */
}
.codex-pane-status {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 26px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  background: color-mix(in srgb, var(--bg-secondary) 92%, var(--green));
  border-top: 1px solid color-mix(in srgb, var(--green) 30%, transparent);
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  z-index: 5;
  overflow-x: auto;
  scrollbar-width: none;
}
.codex-pane-status::-webkit-scrollbar { display: none; }
.codex-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--surface-1);
  border: 1px solid color-mix(in srgb, var(--green) 25%, transparent);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: background 120ms ease, border-color 120ms ease;
}
.codex-status-chip:hover {
  background: color-mix(in srgb, var(--green) 12%, var(--surface-1));
  border-color: var(--green);
}
.codex-status-chip-label {
  color: var(--text-muted);
  font-weight: 500;
}
.codex-status-chip-value { color: var(--text-base); }
.codex-status-chip-value.is-default {
  color: var(--text-muted);
  font-style: italic;
}
.codex-status-chip-bypass {
  background: color-mix(in srgb, var(--red) 18%, var(--surface-1));
  border-color: var(--red);
  color: var(--red);
  font-weight: 600;
  letter-spacing: 0.08em;
}
.codex-status-chip-bypass:hover {
  background: color-mix(in srgb, var(--red) 28%, var(--surface-1));
}

/* Pane header provider label pill (Plan 22-02). Hidden via [hidden]
   when the pane is empty. Sits left of the title; uses --surface-2 for
   the background and the matching --provider-*-accent for the dot. */
.pane-provider-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  margin-right: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  user-select: none;
  flex-shrink: 0;
}
.pane-provider-pill[data-provider="claude"]::before,
.pane-provider-pill[data-provider="codex"]::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.pane-provider-pill[data-provider="claude"]::before {
  background: var(--provider-claude-accent);
}
.pane-provider-pill[data-provider="codex"]::before {
  background: var(--provider-codex-accent);
}

/* Plan 22-05: workspace group UX.
   Each grouped workspace row carries data-group-id + --ws-group-color
   (set inline from the group's stored color). The left-edge stripe and
   the chip's background are both driven by that custom property so a
   color change propagates without a re-render.
   The × remove button hides when not hovered to keep the chip clean. */
.workspace-item[data-group-id] {
  box-shadow: inset 4px 0 0 var(--ws-group-color, var(--surface-2));
}
.ws-group-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--ws-group-color, var(--surface-1)) 18%, var(--surface-1));
  border: 1px solid color-mix(in srgb, var(--ws-group-color, transparent) 40%, transparent);
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  user-select: none;
  max-width: 110px;
}
.ws-group-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80px;
}
.ws-group-chip-remove {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  font-size: 13px;
  opacity: 0;
  transition: opacity 120ms ease, color 120ms ease;
}
.ws-group-chip:hover .ws-group-chip-remove {
  opacity: 1;
}
.ws-group-chip-remove:hover {
  color: var(--red);
}


/* ─── Cost disclosure + search provider accent (Phase 18-04) ──────
   Three render surfaces consume the :root provider tokens from
   Plan 18-01:

   1. .session-badge-cost-na — the em-dash badge rendered in place of
      a $-value when a session's provider does not support cost
      tracking (Codex today). The dashed border + tertiary color
      signal a deliberate "not tracked" state; cursor:help cues the
      native tooltip from the title attribute.

   2. .cost-cell-na — the cost-table column mirror of the badge,
      same semantics applied to the Costs dashboard sessions table.

   3. .search-result-provider — the uppercase chip rendered inside
      every search-result header. Color is driven by the parent
      .search-result[data-provider="..."] selector so every theme
      cascades the right accent through the provider token layer. */
.session-badge-cost-na {
  background: transparent;
  color: var(--subtext0);
  border: 1px dashed var(--surface2);
  cursor: help;
}

.cost-cell-na {
  color: var(--subtext0);
  cursor: help;
  font-style: italic;
}

.search-result-provider {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 4px;
  border: 1px solid currentColor;
  background: transparent;
  /* Default color: tertiary text so an unknown-provider chip is still
     legible without depending on a per-provider selector below. */
  color: var(--subtext0);
}

.search-result[data-provider="claude"] .search-result-provider {
  color: var(--provider-claude-accent);
}

.search-result[data-provider="codex"] .search-result-provider {
  color: var(--provider-codex-accent);
}

.search-result[data-provider="gemini"] .search-result-provider {
  color: var(--provider-gemini-accent);
}

/* ─── Sidebar provider tab strip (Phase 18-02) ────────────────────
   Tab strip rendered above #sidebar-projects-header by
   renderProviderTabs(). Each tab carries data-provider and the active
   tab takes a 2px bottom border in its provider's accent colour
   (--provider-{id}-accent). The "all" tab uses --accent so it tracks
   the theme's neutral accent. The badge bubble holds the session
   count for that provider, updated in-place by _patchProviderTabBadges
   on SSE events so scroll position is preserved (Pitfall B). */
.sidebar-tabs {
  display: flex;
  gap: 2px;
  padding: 6px 8px 4px 8px;
  border-bottom: 1px solid var(--border-subtle);
}
.sidebar-tabs:empty {
  /* When the tab strip is empty (initial paint, before loadProviders
     resolves), collapse to zero height so there is no visual gap
     between the view-toggle and the projects header. */
  display: none;
}
.sidebar-tab {
  flex: 0 1 auto;
  padding: 6px 10px;
  font-size: 12px;
  font-family: var(--font-sans);
  color: var(--text-tertiary);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}
.sidebar-tab:hover {
  color: var(--text-secondary);
}
.sidebar-tab.active {
  color: var(--text-primary);
}
.sidebar-tab.active[data-provider="claude"] {
  border-bottom-color: var(--provider-claude-accent);
}
.sidebar-tab.active[data-provider="codex"] {
  border-bottom-color: var(--provider-codex-accent);
}
.sidebar-tab.active[data-provider="gemini"] {
  border-bottom-color: var(--provider-gemini-accent);
}
.sidebar-tab.active[data-provider="all"] {
  border-bottom-color: var(--accent, var(--mauve));
}
.sidebar-tab-badge {
  display: inline-block;
  min-width: 16px;
  padding: 0 4px;
  margin-left: 6px;
  font-size: 10px;
  color: var(--text-tertiary);
  background: var(--surface0);
  border-radius: 8px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ─── Settings Providers section (Phase 18-03) ────────────────────
   One tile per registered provider in the Settings overlay. Accent
   swatch is a 10x28 stripe coloured per data-provider attribute via
   the :root provider tokens from Plan 18-01 so every Catppuccin
   theme inherits the correct accent automatically. */
.settings-providers-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface0);
  border: 1px solid var(--surface1);
  border-radius: var(--radius-md, 8px);
  margin-bottom: 8px;
}
.settings-providers-tile:last-child {
  margin-bottom: 0;
}
.settings-providers-swatch {
  width: 10px;
  height: 28px;
  border-radius: 2px;
  background: var(--overlay0);
  flex-shrink: 0;
}
.settings-providers-tile[data-provider="claude"] .settings-providers-swatch {
  background: var(--provider-claude-accent);
}
.settings-providers-tile[data-provider="codex"] .settings-providers-swatch {
  background: var(--provider-codex-accent);
}
.settings-providers-tile[data-provider="gemini"] .settings-providers-swatch {
  background: var(--provider-gemini-accent);
}
.settings-providers-info {
  flex: 1 1 auto;
  min-width: 0;
}
.settings-providers-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}
.settings-providers-status {
  font-size: 11px;
  color: var(--subtext0);
  margin-top: 2px;
}
.settings-providers-status[data-available="false"] {
  color: var(--peach);
}
.settings-providers-install-hint {
  font-size: 11px;
  color: var(--subtext0);
  margin-top: 4px;
  font-family: var(--font-mono, monospace);
  user-select: text;
  word-break: break-all;
}
