/* ═══════════════════════════════════════════════════════════════════════════
   Claude Terminal Remote — "Obsidian Terminal" Design System
   Premium dark-mode PWA with frosted glass surfaces, depth, and spring motion
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* Surfaces — layered depth with subtle warm undertone */
  --bg:            #09090b;
  --bg2:           #131316;
  --bg3:           #1a1a1f;
  --bg4:           #232329;
  --bg-elevated:   #1e1e24;

  /* Borders — barely visible, hinted edges */
  --border:        rgba(255,255,255,0.06);
  --border-light:  rgba(255,255,255,0.1);
  --border-accent: rgba(217,119,6,0.25);

  /* Glass */
  --glass:         rgba(20,20,26,0.75);
  --glass-border:  rgba(255,255,255,0.08);

  /* Text */
  --text:          #f0f0f2;
  --text-dim:      #a1a1aa;
  --text-muted:    #52525b;

  /* Accent — warm amber with glow variants */
  --accent:        #d97706;
  --accent-hover:  #f59e0b;
  --accent-dim:    rgba(217,119,6,0.1);
  --accent-glow:   rgba(217,119,6,0.2);
  --accent-text:   #fbbf24;

  /* Status */
  --success:       #22c55e;
  --success-dim:   rgba(34,197,94,0.12);
  --danger:        #ef4444;
  --danger-dim:    rgba(239,68,68,0.1);
  --warning:       #eab308;
  --warning-dim:   rgba(234,179,8,0.1);
  --info:          #3b82f6;

  /* Radius — slightly tighter for modern feel */
  --radius:        14px;
  --radius-sm:     10px;
  --radius-xs:     6px;
  --radius-pill:   999px;

  /* Layout */
  --nav-height:    60px;
  --header-height: 50px;

  /* Typography */
  --font-sans:     'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono:     'DM Mono', 'Space Mono', 'SF Mono', 'JetBrains Mono', monospace;

  /* Motion */
  --ease-out:      cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring:   cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth:   cubic-bezier(0.4, 0, 0.2, 1);

  /* Shadow */
  --shadow-sm:     0 1px 2px rgba(0,0,0,0.4);
  --shadow-md:     0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg:     0 8px 30px rgba(0,0,0,0.5);
  --shadow-glow:   0 0 20px rgba(217,119,6,0.15);
}

/* ─── Reset ─────────────────────────────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

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

#app {
  height: 100%;
  position: relative;
}

/* Scrollbar — thin, unobtrusive */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.08) transparent; }

.hidden { display: none !important; }

/* Noise overlay — subtle grain texture */
.noise-layer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.025;
  z-index: 9998;
}

/* ─── Screen System ─────────────────────────────────────────────────────── */

.screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ═══════════════════════════════════════════════════════════════════════════
   AUTH SCREEN
   ═══════════════════════════════════════════════════════════════════════════ */

#screen-auth {
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  background:
    radial-gradient(ellipse 80% 60% at 50% 30%, rgba(217,119,6,0.06) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 80% 70%, rgba(59,130,246,0.03) 0%, transparent 60%);
}

.auth-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 40px 32px;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 8px 40px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.04);
  animation: authIn 0.7s var(--ease-out) both;
}

@keyframes authIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-logo {
  margin-bottom: 8px;
  position: relative;
}

.auth-logo img {
  display: block;
  box-shadow: 0 4px 20px rgba(217,119,6,0.15), 0 0 0 1px rgba(255,255,255,0.06);
}

.auth-title {
  font-family: var(--font-sans);
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
}

.auth-subtitle {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.35em;
  margin-top: -2px;
}

.auth-message {
  color: var(--text-muted);
  font-size: 13px;
  max-width: 280px;
  line-height: 1.7;
  text-align: center;
  margin-top: 12px;
}

/* PIN Input */
.pin-input-row {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  align-items: center;
}

.pin-field-wrapper { position: relative; }

.pin-input {
  width: 148px;
  height: 54px;
  background: var(--bg2);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1.75rem;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.4em;
  outline: none;
  font-family: var(--font-mono);
  -webkit-appearance: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.pin-input::placeholder {
  color: var(--text-muted);
  opacity: 0.3;
  letter-spacing: 0.3em;
}

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

.pin-submit-btn {
  width: 54px;
  height: 54px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s var(--ease-spring), background 0.15s;
  box-shadow: var(--shadow-sm);
}

.pin-submit-btn:active { transform: scale(0.92); }
.pin-submit-btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

.pin-error {
  color: var(--danger);
  font-size: 13px;
  text-align: center;
  max-width: 280px;
  margin-top: 6px;
  animation: shake 0.4s var(--ease-out);
}

/* Cloud key input */
.cloud-key-input-row {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  align-items: center;
}

.cloud-key-input {
  width: 240px;
  height: 54px;
  background: var(--bg2);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.85rem;
  font-family: var(--font-mono);
  padding: 0 16px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.cloud-key-input::placeholder { color: var(--text-muted); opacity: 0.4; }

.cloud-key-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim), var(--shadow-glow);
}

.auth-mode-switch {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-family: var(--font-sans);
  cursor: pointer;
  margin-top: 16px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  transition: color 0.2s, background 0.2s;
}

.auth-mode-switch:active {
  color: var(--accent);
  background: var(--accent-dim);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

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

#screen-main {
  display: flex;
  flex-direction: column;
  height: 100%;
}

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

.app-header {
  height: calc(var(--header-height) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--glass);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 14px;
  padding-right: 14px;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.header-back {
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: var(--radius-xs);
  transition: color 0.15s, background 0.15s;
  margin-left: -8px;
}

.header-back:active {
  background: var(--accent-dim);
  color: var(--accent);
}

.header-title {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

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

/* Git quick actions */
.header-git-actions {
  display: flex;
  gap: 6px;
}

.header-git-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-sans);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg2);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.header-git-btn svg { width: 13px; height: 13px; flex-shrink: 0; }

.header-git-btn:active:not(.busy) {
  background: var(--bg3);
  border-color: var(--accent);
  color: var(--text);
  transform: scale(0.95);
}

.header-git-label { line-height: 1; }

.header-git-badge {
  font-size: 9px;
  padding: 1px 5px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-family: var(--font-mono);
  line-height: 1.3;
}

.header-git-badge.ahead { background: var(--success-dim); color: var(--success); }
.header-git-badge.behind { background: var(--danger-dim); color: var(--danger); }

.header-git-btn.busy { pointer-events: none; opacity: 0.5; }
.header-git-btn.flash-ok { border-color: var(--success); color: var(--success); background: var(--success-dim); }
.header-git-btn.flash-err { border-color: var(--danger); color: var(--danger); background: var(--danger-dim); }

/* Connection status */
.connection-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(34,197,94,0.08);
  border: 1px solid rgba(34,197,94,0.15);
  transition: background 0.3s, border-color 0.3s;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px rgba(34,197,94,0.4);
  transition: background 0.3s, box-shadow 0.3s;
}

.status-label {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.connection-status.disconnected {
  background: rgba(239,68,68,0.06);
  border-color: rgba(239,68,68,0.12);
}

.connection-status.disconnected .status-dot {
  background: var(--danger);
  box-shadow: 0 0 6px rgba(239,68,68,0.4);
}

.connection-status.reconnecting {
  background: rgba(234,179,8,0.06);
  border-color: rgba(234,179,8,0.12);
}

.connection-status.reconnecting .status-dot {
  background: var(--warning);
  box-shadow: 0 0 6px rgba(234,179,8,0.4);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

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

/* Reconnecting banner */
.reconnecting-banner {
  background: rgba(217,119,6,0.05);
  border-bottom: 1px solid rgba(217,119,6,0.12);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: center;
  padding: 8px 16px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.reconnecting-pulse {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1s ease-in-out infinite;
}

/* ─── Headless Cloud Banner ─────────────────────────────────────────────── */

.headless-banner {
  background: linear-gradient(135deg, rgba(59,130,246,0.06) 0%, rgba(139,92,246,0.06) 100%);
  border-bottom: 1px solid rgba(59, 130, 246, 0.1);
  color: var(--info, #3b82f6);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  padding: 10px 16px;
  padding-top: calc(env(safe-area-inset-top, 0px) + 10px);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  letter-spacing: -0.01em;
}

.headless-banner-icon {
  display: flex;
  align-items: center;
  opacity: 0.7;
}

.headless-banner-icon svg {
  color: var(--info, #3b82f6);
}

.headless-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: rgba(59, 130, 246, 0.12);
  color: var(--info, #3b82f6);
}

/* ─── Cloud Popup (desktop offline) ────────────────────────────────────── */

.cloud-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: popupFadeIn 0.25s var(--ease-out) both;
}

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

@keyframes popupSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.cloud-popup {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 36px 28px 28px;
  max-width: 320px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(59,130,246,0.08);
  animation: popupSlideUp 0.3s var(--ease-spring) 0.05s both;
}

.cloud-popup-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(59,130,246,0.12) 0%, rgba(139,92,246,0.12) 100%);
  border: 1px solid rgba(59,130,246,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--info);
}

.cloud-popup-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.cloud-popup-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.55;
  margin-bottom: 24px;
}

.cloud-popup-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  letter-spacing: -0.01em;
  box-shadow: 0 2px 16px rgba(59,130,246,0.3), inset 0 1px 0 rgba(255,255,255,0.15);
}

.cloud-popup-cta:active {
  transform: scale(0.97);
  box-shadow: 0 1px 8px rgba(59,130,246,0.25);
}

.cloud-popup-dismiss {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: var(--bg3);
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.cloud-popup-dismiss:active {
  background: var(--bg4);
  color: var(--text-dim);
}

/* ─── Views ─────────────────────────────────────────────────────────────── */

.view {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#view-chat {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.view-inner {
  padding: 24px 18px;
  padding-top: calc(env(safe-area-inset-top, 0px) + 24px);
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 40px);
}

.chat-view-inner {
  padding: 0;
  padding-bottom: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* View header */
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.view-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text);
  background: linear-gradient(135deg, var(--text) 30%, var(--text-dim) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.view-count {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.02em;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BOTTOM NAVIGATION
   ═══════════════════════════════════════════════════════════════════════════ */

.bottom-nav {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
  left: 14px;
  right: 14px;
  height: var(--nav-height);
  background: rgba(18,18,22,0.85);
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 22px;
  z-index: 100;
  display: flex;
  align-items: stretch;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.04);
}

.nav-group {
  display: flex;
  flex: 1;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
  color: var(--text-muted);
  transition: color 0.2s var(--ease-smooth);
  font-family: var(--font-sans);
}

.nav-item span {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.nav-item svg {
  width: 21px;
  height: 21px;
  transition: transform 0.2s var(--ease-spring);
}

.nav-item.active {
  color: var(--accent-text);
}

.nav-item.active svg {
  transform: scale(1.08);
  filter: drop-shadow(0 0 4px var(--accent-glow));
}

.nav-item.active span {
  font-weight: 600;
}

.nav-item.active::after {
  content: '';
  position: absolute;
  bottom: 6px;
  width: 18px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

.nav-badge {
  position: absolute;
  top: 6px;
  right: calc(50% - 14px);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 4px rgba(239,68,68,0.5);
}

.nav-pill {
  display: none; /* unused but kept for app.js compat */
}

/* ═══════════════════════════════════════════════════════════════════════════
   PROJECTS VIEW
   ═══════════════════════════════════════════════════════════════════════════ */

.projects-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.project-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  min-height: 62px;
  border-radius: var(--radius);
  background: var(--bg2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s var(--ease-out);
  animation: slideUp 0.35s var(--ease-out) both;
  margin-bottom: 6px;
}

.project-card:nth-child(1)  { animation-delay: 0.00s; }
.project-card:nth-child(2)  { animation-delay: 0.02s; }
.project-card:nth-child(3)  { animation-delay: 0.04s; }
.project-card:nth-child(4)  { animation-delay: 0.06s; }
.project-card:nth-child(5)  { animation-delay: 0.08s; }
.project-card:nth-child(6)  { animation-delay: 0.10s; }
.project-card:nth-child(7)  { animation-delay: 0.12s; }
.project-card:nth-child(8)  { animation-delay: 0.14s; }
.project-card:nth-child(9)  { animation-delay: 0.16s; }
.project-card:nth-child(10) { animation-delay: 0.18s; }

.project-card:active { background: var(--bg3); border-color: var(--border-light); transform: scale(0.98); }

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

/* Folders */
.folder-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  min-height: 48px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.15s;
  margin-bottom: 4px;
  background: rgba(255,255,255,0.02);
}

.folder-row:active { background: var(--bg3); }

.folder-chevron {
  color: var(--text-muted);
  transition: transform 0.2s var(--ease-out);
  flex-shrink: 0;
}

.folder-row:not(.collapsed) .folder-chevron { transform: rotate(90deg); }

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

.folder-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  letter-spacing: -0.01em;
}

.folder-count {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg3);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

/* Project icon */
.project-icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  flex-shrink: 0;
  line-height: 1;
}

.project-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

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

.project-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

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

.project-arrow {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  opacity: 0.4;
  flex-shrink: 0;
  transition: opacity 0.15s, transform 0.15s;
}

.project-card:active .project-arrow {
  opacity: 0.7;
  transform: translateX(2px);
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 20px;
  gap: 12px;
  color: var(--text-dim);
  font-size: 14px;
}

.empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bg3) 0%, var(--bg4) 100%);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  margin-bottom: 4px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CHAT VIEW
   ═══════════════════════════════════════════════════════════════════════════ */

/* Session selector */
.session-bar {
  padding: 8px 14px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}

.session-select {
  width: 100%;
  background: var(--bg2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  padding: 8px 32px 8px 12px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2352525b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

/* Messages container */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 12px;
  padding-bottom: 8px;
}

/* Message bubbles */
.chat-msg {
  max-width: 88%;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
  flex-shrink: 0;
  animation: msgIn 0.25s var(--ease-out) both;
}

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

/* User bubble */
.chat-msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-radius: 20px 20px 6px 20px;
  font-weight: 400;
  box-shadow: 0 2px 8px rgba(217,119,6,0.2);
}

/* Assistant bubble */
.chat-msg.assistant {
  align-self: flex-start;
  background: var(--bg3);
  color: var(--text);
  border-radius: 20px 20px 20px 6px;
  border: 1px solid var(--border);
}

.chat-msg.assistant code {
  background: rgba(255,255,255,0.06);
  color: var(--accent-text);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.88em;
}

.chat-msg.assistant pre {
  margin: 8px -4px;
}

.chat-msg.assistant pre code {
  display: block;
  background: rgba(0,0,0,0.3);
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  overflow-x: auto;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre;
}

/* Tool cards */
.tool-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  max-width: 100%;
  align-self: flex-start;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  animation: msgIn 0.25s var(--ease-out) both;
}

.tool-card.expandable { cursor: pointer; }
.tool-card.expandable:active { background: var(--bg3); }

.tool-card-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  min-height: 44px;
}

.tool-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  background: var(--accent-dim);
  color: var(--accent);
  flex-shrink: 0;
}

.tool-icon svg { width: 14px; height: 14px; }

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

.tool-name {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
}

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

.tool-status { flex-shrink: 0; display: flex; align-items: center; }

.tool-check {
  color: var(--success);
  display: flex;
}

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

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

/* Tool expand content — hidden when empty, shown when card is expanded */
.tool-expand-content {
  display: none;
}

.tool-card.expanded .tool-expand-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding: 10px 14px;
  background: rgba(0,0,0,0.15);
  font-size: 12px;
}

.label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.tool-code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 200px;
  overflow-y: auto;
  background: rgba(0,0,0,0.2);
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  line-height: 1.5;
}

.tool-output {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 160px;
  overflow-y: auto;
  background: rgba(0,0,0,0.2);
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  line-height: 1.5;
}

.tool-diff {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 200px;
  overflow-y: auto;
}

.diff-add { color: var(--success); background: rgba(34,197,94,0.06); }
.diff-del { color: var(--danger); background: rgba(239,68,68,0.06); }

/* Streaming cursor */
.chat-msg.streaming::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: cursorBlink 1s steps(2) infinite;
}

@keyframes cursorBlink {
  50% { opacity: 0; }
}

/* Inline permission */
.perm-inline {
  align-self: flex-start;
  max-width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  animation: msgIn 0.25s var(--ease-out) both;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.perm-inline.resolved { opacity: 0.5; }

.perm-inline-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.perm-inline-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}

.perm-inline-icon svg { width: 14px; height: 14px; }

.perm-inline-body {
  flex: 1;
  min-width: 0;
}

.perm-inline-tool {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
}

.perm-inline-desc {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.perm-inline-detail {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  background: rgba(0,0,0,0.2);
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  max-height: 100px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  border: 1px solid var(--border);
}

.perm-inline-actions {
  display: flex;
  gap: 8px;
}

.perm-inline-actions .btn-action {
  flex: 1;
  min-height: 40px;
  border: none;
  border-radius: var(--radius-xs);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s var(--ease-spring), opacity 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.perm-inline-actions .btn-action:active { transform: scale(0.96); }

.btn-allow {
  background: var(--accent);
  color: #fff;
}

.btn-deny {
  background: var(--bg3);
  color: var(--text-dim);
  border: 1px solid var(--border-light) !important;
}

/* Scroll FAB */
.scroll-fab {
  position: absolute;
  bottom: 72px;
  right: 14px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg3);
  border: 1px solid var(--border-light);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  box-shadow: var(--shadow-md);
  transition: transform 0.15s var(--ease-spring);
}

.scroll-fab:active { transform: scale(0.9); }

.scroll-fab:not(.hidden) {
  animation: fabIn 0.2s var(--ease-spring) both;
}

@keyframes fabIn {
  from { opacity: 0; transform: scale(0.6); }
  to   { opacity: 1; transform: scale(1); }
}

/* Error message */
.error-msg {
  align-self: flex-start;
  max-width: 100%;
  background: var(--danger-dim);
  border: 1px solid rgba(239,68,68,0.15);
  border-radius: var(--radius-sm);
  color: var(--danger);
  padding: 10px 14px;
  font-size: 13px;
  animation: msgIn 0.25s var(--ease-out) both;
}

/* Code blocks in messages */
.msg-code-block {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 10px 14px;
  overflow-x: auto;
  white-space: pre;
  color: var(--text-dim);
  margin: 6px 0;
}

.code-block-lang {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 4px 14px;
  border-bottom: 1px solid var(--border);
  margin: -10px -14px 8px;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

/* Syntax highlighting */
.syn-kw  { color: #c586c0; }
.syn-str { color: #ce9178; }
.syn-cmt { color: #6a9955; font-style: italic; }
.syn-num { color: #b5cea8; }
.syn-fn  { color: #dcdcaa; }

/* Thinking indicator */
.thinking-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  flex-shrink: 0;
  animation: fadeIn 0.2s var(--ease-out);
}

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

.thinking-brain {
  display: flex;
  gap: 4px;
  padding: 6px 10px;
  background: var(--accent-dim);
  border-radius: var(--radius-pill);
}

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

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

@keyframes thinkPulse {
  0%, 100% { transform: scale(0.7); opacity: 0.4; }
  40% { transform: scale(1.2); opacity: 1; }
}

.thinking-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

/* ─── Chat Input Area ───────────────────────────────────────────────────── */

.chat-input-area {
  flex-shrink: 0;
  position: relative;
  background: linear-gradient(to top, var(--bg) 60%, rgba(9,9,11,0.85));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 10px);
}

.chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
}

/* Plus menu button */
.plus-menu-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg3);
  border: 1px solid var(--border-light);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}

.plus-menu-btn:active,
.plus-menu-btn.open {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* Plus menu popup */
.plus-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 10px;
  min-width: 200px;
  max-width: 240px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 8px;
  z-index: 50;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: menuIn 0.15s var(--ease-out) both;
}

@keyframes menuIn {
  from { opacity: 0; transform: translateY(4px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.plus-menu-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 6px 8px 4px;
}

.plus-menu-options {
  display: flex;
  flex-direction: column;
}

.plus-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px;
  min-height: 40px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-sans);
  font-size: 13px;
  cursor: pointer;
  border-radius: var(--radius-xs);
  transition: background 0.1s, color 0.1s;
}

.plus-option:active { background: var(--accent-dim); }
.plus-option.selected { color: var(--accent); }

.plus-option-name { font-weight: 500; }
.plus-option-check { display: flex; }

.plus-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.plus-action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  min-height: 40px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-sans);
  font-size: 13px;
  cursor: pointer;
  border-radius: var(--radius-xs);
  width: 100%;
  transition: background 0.1s;
}

.plus-action-btn:active { background: var(--accent-dim); }

/* Autocomplete */
.autocomplete-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border-light);
  z-index: 50;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
}

.ac-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  min-height: 42px;
  cursor: pointer;
  transition: background 0.1s;
  font-size: 13px;
}

.ac-item:active,
.ac-item.active {
  background: var(--accent-dim);
}

.ac-item-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

.ac-item-body { flex: 1; min-width: 0; }

.ac-item-name {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.ac-item-desc {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Mention chips */
.mention-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
}

.mention-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-dim);
  border: 1px solid rgba(217,119,6,0.2);
  border-radius: var(--radius-pill);
  padding: 3px 8px 3px 6px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--accent);
}

.mention-chip-icon {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
}

.mention-chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
}

.mention-chip-remove {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  opacity: 0.5;
  margin-left: 2px;
}

.mention-chip-remove:active { opacity: 1; }

/* Image preview */
.image-preview-bar {
  display: flex;
  padding: 6px 12px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}

.image-preview-thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-xs);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border-light);
}

.image-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-preview-remove {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--bg);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Chat input */
.input-wrapper { flex: 1; min-width: 0; }

.chat-input {
  width: 100%;
  background: var(--bg2);
  color: var(--text);
  border: 1px solid var(--border-light);
  border-radius: 22px;
  padding: 11px 18px;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.45;
  resize: none;
  outline: none;
  max-height: 120px;
  overflow-y: auto;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.chat-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.chat-input:focus {
  border-color: rgba(217,119,6,0.3);
  box-shadow: 0 0 0 3px rgba(217,119,6,0.08);
  background: var(--bg3);
}

/* Send / Interrupt buttons */
.send-btn,
.interrupt-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s var(--ease-spring), opacity 0.15s, box-shadow 0.2s;
}

.send-btn {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #fff;
  box-shadow: 0 2px 12px rgba(217,119,6,0.3), inset 0 1px 0 rgba(255,255,255,0.15);
}

.send-btn:active { transform: scale(0.88); }
.send-btn:disabled { opacity: 0.3; cursor: not-allowed; transform: none; box-shadow: none; background: var(--accent); }

.interrupt-btn {
  background: linear-gradient(135deg, var(--danger) 0%, #f87171 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(239,68,68,0.25);
}

.interrupt-btn:active { transform: scale(0.88); }

/* No session state — new chat welcome */
.no-session {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px 40px;
  gap: 8px;
  color: var(--text-dim);
  font-size: 14px;
  flex: 1;
}

.no-session-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-dim) 0%, rgba(217,119,6,0.05) 100%);
  border: 1px solid var(--border-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  margin-bottom: 8px;
}

.no-session-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DASHBOARD VIEW
   ═══════════════════════════════════════════════════════════════════════════ */

.dashboard-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dash-section-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-top: 14px;
  margin-bottom: 4px;
}

.dash-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
  animation: slideUp 0.35s var(--ease-out) both;
}

/* Hero card — full width with accent glow */
.dash-card-hero {
  border-color: var(--border-accent);
  padding: 24px 20px;
  background: linear-gradient(135deg, rgba(217,119,6,0.06) 0%, var(--bg2) 60%);
}

.dash-card-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 20% 40%, rgba(217,119,6,0.08) 0%, transparent 65%);
  pointer-events: none;
}

/* Bento 2-column grid */
.dash-bento {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Mini cards for bento grid — stack vertically */
.dash-card-mini {
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
}

.dash-card-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.dash-card-icon-sm {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.dash-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dash-card-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.dash-card-value {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.dash-card-hero .dash-card-value {
  color: var(--accent-text);
}

.dash-card-value-sm {
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font-sans);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Projects status */
.projects-status-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.project-status-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideUp 0.3s var(--ease-out) both;
}

.project-status-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
  line-height: 1;
}

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

.dash-empty-hint {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 20px;
}

.git-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.git-badge.clean { color: var(--success); background: var(--success-dim); }
.git-badge.dirty { color: var(--warning); background: var(--warning-dim); }

/* ═══════════════════════════════════════════════════════════════════════════
   GIT VIEW
   ═══════════════════════════════════════════════════════════════════════════ */

.git-content {
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.git-loading {
  display: flex;
  justify-content: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 13px;
}

.git-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
  gap: 10px;
  color: var(--text-muted);
  font-size: 14px;
}

.git-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideUp 0.3s var(--ease-out) both;
}

.git-branch-card {
  border-color: var(--border-accent);
  background: linear-gradient(135deg, rgba(217,119,6,0.05) 0%, var(--bg2) 60%);
}

.git-branch-name {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}

.git-branch-meta {
  display: flex;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

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

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

.git-commit-hash {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.git-section-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.git-changes-count {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: var(--accent-dim);
  color: var(--accent);
}

.git-file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg2);
  border-radius: var(--radius-xs);
  overflow: hidden;
  border-left: 3px solid transparent;
}

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

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

.git-file.staged { border-left-color: var(--success); }
.git-file.staged .git-file-status { color: var(--success); }
.git-file.modified { border-left-color: var(--warning); }
.git-file.modified .git-file-status { color: var(--warning); }
.git-file.untracked { border-left-color: var(--text-muted); }
.git-file.untracked .git-file-status { color: var(--text-muted); }

.git-clean {
  color: var(--success);
  text-align: center;
  padding: 12px;
  font-size: 13px;
}

.git-commit-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 6px 10px;
  background: var(--bg2);
  border-radius: var(--radius-xs);
  font-size: 12px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SESSIONS VIEW
   ═══════════════════════════════════════════════════════════════════════════ */

.sessions-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sessions-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 14px;
  gap: 8px;
  flex: 1;
  min-height: 40vh;
}

.sessions-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--bg3) 0%, var(--bg4) 100%);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.sessions-empty-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.sessions-empty-hint {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
  max-width: 240px;
}

.session-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s var(--ease-out);
  border: 1px solid var(--border);
  background: var(--bg2);
  animation: slideUp 0.3s var(--ease-out) both;
}

.session-card:active { background: var(--bg3); transform: scale(0.98); }
.session-card.selected { background: var(--accent-dim); border-color: var(--border-accent); }
.session-card-permission { border-left: 3px solid var(--warning) !important; background: rgba(234,179,8,0.04) !important; }
.session-card-error { border-left: 3px solid var(--danger) !important; background: rgba(239,68,68,0.04) !important; }
.session-card-active { border-left: 3px solid var(--success); }
.session-card-idle { opacity: 0.75; }

.session-card-left { flex-shrink: 0; }

.session-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.session-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.session-status-dot.active { background: var(--success); box-shadow: 0 0 6px rgba(34,197,94,0.4); }
.session-status-dot.permission { background: var(--warning); animation: pulse 1.5s ease-in-out infinite; }
.session-status-dot.error { background: var(--danger); }
.session-status-dot.idle { background: var(--text-muted); opacity: 0.4; }

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

.session-tab-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.session-card-activity {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}

.session-status-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Past sessions */
.past-sessions-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 8px;
  padding: 0 4px;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: var(--font-mono);
}
.past-sessions-divider::before,
.past-sessions-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.session-card-past { opacity: 0.7; }
.session-card-past:active { opacity: 1; }
.past-session-icon { color: var(--text-muted); flex-shrink: 0; margin-top: 2px; }
.past-session-time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  font-family: var(--font-mono);
}
.past-sessions-show-more {
  width: 100%;
  padding: 10px;
  margin-top: 4px;
  background: transparent;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.past-sessions-show-more:active {
  color: var(--accent);
  border-color: var(--accent);
}

.new-session-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin: 16px auto 0;
  transition: all 0.2s var(--ease-out);
  letter-spacing: -0.01em;
  box-shadow: 0 4px 16px rgba(217,119,6,0.3), inset 0 1px 0 rgba(255,255,255,0.15);
}

.new-session-btn:active {
  opacity: 0.9;
  transform: scale(0.96);
  box-shadow: 0 1px 6px rgba(217,119,6,0.2);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MISSION CONTROL
   ═══════════════════════════════════════════════════════════════════════════ */

.control-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 20px;
  color: var(--text-dim);
  font-size: 14px;
  gap: 12px;
}

.control-empty .empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bg3) 0%, var(--bg4) 100%);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
}

.control-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s var(--ease-out);
  border: 1px solid var(--border);
  background: var(--bg2);
  animation: slideUp 0.3s var(--ease-out) both;
}

.control-card:active { background: var(--bg3); transform: scale(0.98); }
.control-card-permission { border-left: 3px solid var(--warning) !important; background: rgba(234,179,8,0.04) !important; }
.control-card-error { border-left: 3px solid var(--danger) !important; background: rgba(239,68,68,0.04) !important; }
.control-card-active { border-left: 3px solid var(--success); }
.control-card-idle { opacity: 0.75; }

.control-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
  transition: background 0.2s, box-shadow 0.2s;
}

.control-status-dot.active { background: var(--success); box-shadow: 0 0 8px rgba(34,197,94,0.5), 0 0 2px rgba(34,197,94,0.8); }
.control-status-dot.permission { background: var(--warning); box-shadow: 0 0 8px rgba(234,179,8,0.4); animation: pulse 1.5s ease-in-out infinite; }
.control-status-dot.error { background: var(--danger); box-shadow: 0 0 6px rgba(239,68,68,0.4); }
.control-status-dot.idle { background: var(--text-muted); opacity: 0.4; }

.control-card-body { flex: 1; min-width: 0; }

.control-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-project-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.control-status-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.control-status-badge.active,
.session-status-badge.active { color: var(--success); background: var(--success-dim); }
.control-status-badge.permission,
.session-status-badge.permission { color: var(--warning); background: var(--warning-dim); }
.control-status-badge.error,
.session-status-badge.error { color: var(--danger); background: var(--danger-dim); }
.control-status-badge.idle,
.session-status-badge.idle { color: var(--text-muted); background: var(--bg3); }

.control-card-activity {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PWA INSTALL BANNER
   ═══════════════════════════════════════════════════════════════════════════ */

.pwa-install-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: var(--bg2);
  border-bottom: 1px solid var(--border-light);
  padding: 10px 16px;
  padding-top: calc(env(safe-area-inset-top, 0px) + 10px);
  animation: slideDown 0.35s var(--ease-out) both;
}

@keyframes slideDown {
  from { transform: translateY(-100%); }
  to   { transform: translateY(0); }
}

.pwa-install-content {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 500px;
  margin: 0 auto;
}

.pwa-install-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
}

.pwa-install-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.pwa-install-text strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.pwa-install-text span {
  font-size: 12px;
  color: var(--text-dim);
}

.pwa-install-btn {
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-xs);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s var(--ease-spring);
}

.pwa-install-btn:active { transform: scale(0.95); }

.pwa-install-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  flex-shrink: 0;
  padding: 4px;
  line-height: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MISSING CLASSES — app.js dynamic innerHTML compatibility
   ═══════════════════════════════════════════════════════════════════════════ */

/* No-session hint */
.no-session-hint {
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.4;
}

/* Chat user image (attached images in user messages) */
.chat-user-image {
  max-width: 100%;
  max-height: 200px;
  border-radius: var(--radius-xs);
  margin-top: 6px;
  display: block;
}

/* Chat user mentions */
.chat-user-mentions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 4px;
}

.chat-user-mention {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
}

/* Tool expand sections */
.tool-expand-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.tool-output-empty {
  color: var(--text-muted);
  font-style: italic;
}

/* Diff lines */
.diff-line {
  display: flex;
  gap: 4px;
  padding: 0 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
}

.diff-sign {
  flex-shrink: 0;
  width: 12px;
  text-align: center;
  user-select: none;
}

.diff-text {
  flex: 1;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Autocomplete items */
.ac-cmd {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.ac-desc {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ac-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

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

.ac-empty {
  color: var(--text-muted);
  font-style: italic;
  cursor: default;
  justify-content: center;
}


/* Control card left (status dot wrapper) */
.control-card-left { flex-shrink: 0; }

/* Git card icon & body */
.git-card-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  flex-shrink: 0;
  color: var(--text-muted);
}

.git-card-icon svg { width: 16px; height: 16px; }

.git-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Git file name */
.git-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-dim);
  flex: 1;
}

/* Git commit text */
.git-commit-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  flex: 1;
  font-size: 12px;
}

/* Git ahead/behind/synced badges */
.git-ahead {
  color: var(--success);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}

.git-behind {
  color: var(--danger);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}

.git-synced {
  color: var(--success);
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.7;
}

/* Session/control card dynamic status — overrides defined earlier */
