:root {
  --bg: #0d1117;
  --bg-2: #010409;
  --surface: #161b22;
  --surface-2: #1c2128;
  --surface-3: #21262d;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #58a6ff;
  --accent-2: #388bfd;
  --success: #3fb950;
  --warning: #d29922;
  --danger: #f85149;
  --info: #39c5cf;
  --purple: #a371f7;
  --radius: 8px;
  --activity-w: 52px;
  --sidebar-w: 240px;
  --status-h: 26px;
  --titlebar-h: 38px;
  --font: "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  overflow: hidden;
}

.shell {
  display: grid;
  grid-template-rows: var(--titlebar-h) 1fr var(--status-h);
  height: 100vh;
}

.titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}

.titlebar .brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
}

.titlebar .brand .logo {
  width: 18px;
  height: 18px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 4px;
}

.titlebar .actions { display: flex; gap: 0.5rem; align-items: center; }

.kbd {
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 0.15rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  background: var(--surface);
}

.workspace {
  display: grid;
  grid-template-columns: var(--activity-w) var(--sidebar-w) 1fr;
  min-height: 0;
}

.activity-bar {
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0;
  gap: 0.35rem;
}

.activity-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.12s;
}

.activity-btn:hover, .activity-btn.active {
  color: var(--text);
  background: var(--surface-2);
}

.activity-btn.active { border-left: 2px solid var(--accent); }

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}

.nav { padding: 0.5rem; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }

.nav button, .nav a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: none;
  color: var(--muted);
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  text-decoration: none;
  transition: 0.12s;
}

.nav button:hover, .nav a:hover, .nav button.active, .nav a.active {
  background: var(--surface-2);
  color: var(--text);
}

.nav .tag {
  margin-left: auto;
  font-size: 0.68rem;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  background: var(--surface-3);
}

.main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
}

.tabs {
  display: flex;
  gap: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.tab {
  padding: 0.55rem 1rem;
  font-size: 0.82rem;
  color: var(--muted);
  border: none;
  background: transparent;
  cursor: pointer;
  border-right: 1px solid var(--border);
  white-space: nowrap;
}

.tab.active {
  background: var(--bg);
  color: var(--text);
  border-top: 2px solid var(--accent);
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem 2rem;
}

.panel { display: none; }
.panel.active { display: block; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
  gap: 1rem;
}

.topbar h2 { font-size: 1.35rem; font-weight: 600; }
.topbar .meta { color: var(--muted); font-size: 0.82rem; max-width: 520px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}

.card h3 {
  font-size: 0.75rem;
  margin-bottom: 0.65rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value { font-size: 1.75rem; font-weight: 700; }
.stat-sub { color: var(--muted); font-size: 0.8rem; margin-top: 0.2rem; }

textarea, input, select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.65rem 0.85rem;
  font: inherit;
  font-size: 0.9rem;
}

textarea:focus, input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.2);
}

textarea { min-height: 120px; resize: vertical; }

.btn {
  border: none;
  border-radius: 6px;
  padding: 0.55rem 1rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.12s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-primary { background: var(--accent-2); color: #fff; }
.btn-launch-project {
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.85rem 2rem;
  min-width: 11rem;
  justify-content: center;
}
.built-project-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  min-width: 11rem;
}
.project-card-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  margin-top: 0.85rem;
}
.project-card-actions .btn-launch-project { width: 100%; }
.project-bell {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0.15rem 0.25rem;
  border-radius: 6px;
  opacity: 0.85;
  transition: transform 0.1s ease, opacity 0.1s ease, background 0.1s ease;
}
.project-bell:hover { opacity: 1; transform: scale(1.12); background: rgba(255,255,255,0.06); }
.project-bell-dash { cursor: pointer; }
.built-project-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  cursor: pointer;
  user-select: none;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 0.75rem;
  background: rgba(255,255,255,0.02);
}
.built-project-row:last-child { margin-bottom: 0; }
.built-project-info { flex: 1; min-width: 200px; }
.built-project-info h4 { margin: 0.35rem 0 0.25rem; }
.project-preview-card { margin-bottom: 1rem; }

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.preview-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.preview-mode-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.preview-mode-btn {
  border: none !important;
  border-radius: 0 !important;
  padding: 0.25rem 0.75rem !important;
  font-size: 0.72rem !important;
}

.preview-mode-btn.active {
  background: var(--accent) !important;
  color: #0d1117 !important;
}

.preview-live-tag { white-space: nowrap; }

.preview-viewport {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 0.5rem 0;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 480px;
}

.preview-device-shell {
  width: 100%;
  height: 460px;
  transition: width 0.2s ease, height 0.2s ease;
}

.preview-viewport.preview-mode-mobile {
  background: radial-gradient(circle at 50% 0%, #2a2a2a 0%, #111 55%);
  padding: 1.25rem 1rem 1.5rem;
}

.preview-viewport.preview-mode-mobile .preview-device-shell {
  width: 390px;
  max-width: calc(100% - 1rem);
  height: min(844px, 72vh);
  min-height: 560px;
  border: 3px solid #2d2d2d;
  border-radius: 40px;
  padding: 14px 10px 18px;
  background: linear-gradient(180deg, #1c1c1e 0%, #0a0a0a 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 24px 48px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  position: relative;
}

.preview-viewport.preview-mode-mobile .preview-device-shell::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 110px;
  height: 26px;
  background: #000;
  border-radius: 0 0 16px 16px;
  z-index: 2;
  pointer-events: none;
}

.preview-viewport.preview-mode-mobile .preview-device-shell::after {
  content: "";
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  z-index: 2;
  pointer-events: none;
}

.preview-viewport.preview-mode-mobile .project-preview-frame {
  border-radius: 28px;
  height: 100% !important;
}

.preview-viewport:fullscreen {
  background: #0d1117;
  border: none;
  border-radius: 0;
  padding: 0;
  min-height: 100%;
  align-items: stretch;
}

.preview-viewport:fullscreen.preview-mode-desktop .preview-device-shell {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
}

.preview-viewport:fullscreen.preview-mode-desktop .project-preview-frame {
  height: 100% !important;
  border-radius: 0;
  border: none;
}

.preview-viewport:fullscreen.preview-mode-mobile {
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 20%, #333 0%, #0d1117 60%);
  padding: 1.5rem;
}

.preview-viewport:fullscreen.preview-mode-mobile .preview-device-shell {
  width: min(390px, calc(100vw - 2rem));
  height: min(844px, calc(100vh - 2rem));
  max-height: none;
}

.project-preview-card .staging-frame { min-height: 420px; }
.project-dash-panels { align-items: stretch; }
.project-dashboard textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 0.65rem 0.75rem;
  font: inherit;
  resize: vertical;
}

.change-attach-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.change-attach-btn {
  cursor: pointer;
  margin: 0 !important;
}

.change-image-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 0.25rem;
}

.change-image-thumb {
  position: relative;
  width: 96px;
  flex-shrink: 0;
}

.change-image-thumb img {
  width: 96px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  display: block;
}

.change-image-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.change-image-name {
  display: block;
  font-size: 0.62rem;
  color: var(--muted);
  margin-top: 0.2rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 96px;
}
.btn-success { background: var(--success); color: #0d1117; }
.btn-warning { background: var(--warning); color: #0d1117; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn:hover { filter: brightness(1.08); }

.actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.85rem; }

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-planning { background: #30363d; color: #c9d1d9; }
.badge-queued { background: #3d2e1f; color: #f0b86e; }
.badge-building { background: #1f3a5f; color: #79c0ff; }
.badge-review { background: #3d2e00; color: #e3b341; }
.badge-testing { background: #1a3a2a; color: #56d364; }
.badge-done { background: #1a3a2a; color: #3fb950; }
.badge-shipped { background: #2d1f4e; color: #bc8cff; }
.badge-pass { background: rgba(63, 185, 80, 0.15); color: var(--success); }
.badge-fail { background: rgba(248, 81, 73, 0.15); color: var(--danger); }
.badge-partial { background: rgba(210, 153, 34, 0.15); color: var(--warning); }
.badge-live {
  background: rgba(63, 185, 80, 0.18);
  color: #3fb950;
  border: 1px solid rgba(63, 185, 80, 0.35);
  animation: badge-live-pulse 2s ease-in-out infinite;
}
.badge-deployed {
  background: #1f3a5f;
  color: #79c0ff;
  border: 1px solid rgba(121, 192, 255, 0.25);
}
@keyframes badge-live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

.staging-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 0.5rem;
}

@media (max-width: 1100px) {
  .staging-layout { grid-template-columns: 1fr; }
}

.version-history-card {
  max-height: 520px;
  overflow-y: auto;
}

.version-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 0.6rem;
  background: var(--bg);
}

.version-card.active {
  border-color: var(--success);
  background: rgba(63, 185, 80, 0.06);
}

.version-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.version-files {
  margin-top: 0.5rem;
  font-size: 0.75rem;
}

.version-file-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.2rem 0;
  font-family: var(--mono);
}

.version-file-row .change-type {
  min-width: 4rem;
  color: var(--info);
}

.version-notes {
  margin: 0.4rem 0 0 1rem;
  padding: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.version-notes li { margin-bottom: 0.2rem; }

.version-actions {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.card-header-row h3 { margin: 0; }

.uat-mode-toggle { flex-shrink: 0; }

.uat-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-size: 0.75rem;
  user-select: none;
}

.uat-toggle input {
  accent-color: var(--success);
}

.uat-toggle-label {
  color: var(--muted);
  white-space: nowrap;
}

.uat-toggle input:checked + .uat-toggle-label {
  color: var(--success);
}

.next-request-card {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(88,166,255,0.08), rgba(163,113,247,0.06));
}

.active-project-row, .queue-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.queue-row { cursor: default; }
.active-project-row { cursor: pointer; }
.active-project-row:hover { opacity: 0.85; }

.queue-row-body { flex: 1; min-width: 0; }
.queue-row-actions { display: flex; gap: 0.35rem; flex-shrink: 0; }
.queue-date { flex-shrink: 0; min-width: 5rem; text-align: right; }

.queue-row-editing {
  flex-direction: column;
  align-items: stretch;
  padding: 0.75rem 0;
}

.queue-edit-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.queue-edit-form input,
.queue-edit-form textarea,
.queue-edit-form select {
  width: 100%;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
}

.queue-edit-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.queue-edit-meta select { width: auto; min-width: 8rem; }
.queue-edit-actions { display: flex; gap: 0.35rem; margin-left: auto; }

.btn-sm {
  font-size: 0.72rem;
  padding: 0.25rem 0.55rem;
}

.active-project-row:last-child, .queue-row:last-child { border-bottom: none; }

.active-task {
  color: var(--accent);
  font-size: 0.82rem;
  margin-top: 0.25rem;
  line-height: 1.4;
}

.active-task .pulse {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  margin-right: 0.35rem;
  animation: pulse 1.5s infinite;
  vertical-align: middle;
}

.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  margin-left: 0.35rem;
  animation: pulse 1.5s infinite;
  vertical-align: middle;
}

.activity-feed {
  margin-top: 0.55rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border);
}

.activity-feed-item {
  font-size: 0.72rem;
  padding: 0.2rem 0;
  display: flex;
  gap: 0.5rem;
}

.activity-feed-item .time {
  min-width: 3.5rem;
  color: var(--muted);
  font-family: var(--mono);
}

.activity-feed-item .task {
  flex: 1;
  color: var(--text);
}

.badge-language {
  background: rgba(88, 166, 255, 0.12);
  border: 1px solid rgba(88, 166, 255, 0.35);
  color: var(--info);
  font-size: 0.68rem;
  margin-left: 0.25rem;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.language-select {
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
}

.build-features-list {
  margin-top: 0.6rem;
  padding: 0.5rem 0;
}

.build-feature-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0;
  font-size: 0.78rem;
}

.build-feature-item .progress-bar {
  width: 72px;
  height: 4px;
}

.build-eta-banner {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  background: rgba(63, 185, 80, 0.1);
  border: 1px solid rgba(63, 185, 80, 0.3);
  color: var(--success);
  font-size: 0.75rem;
  font-weight: 600;
}

.review-fix-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.review-fix-bar.review-fix-active {
  border-color: rgba(163, 113, 247, 0.45);
  background: rgba(163, 113, 247, 0.08);
}
.review-fix-status {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.review-fix-pulse {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #a371f7;
  margin-right: 0.45rem;
  box-shadow: 0 0 0 0 rgba(163, 113, 247, 0.6);
  animation: review-fix-pulse 1.6s infinite;
  vertical-align: middle;
}
@keyframes review-fix-pulse {
  0% { box-shadow: 0 0 0 0 rgba(163, 113, 247, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(163, 113, 247, 0); }
  100% { box-shadow: 0 0 0 0 rgba(163, 113, 247, 0); }
}

.add-task-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--border);
}

.add-task-row input {
  flex: 1;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
}

.active-build-card {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}

.active-build-card:last-child { border-bottom: none; }

.next-request-body h4 { font-size: 1.05rem; margin-bottom: 0.35rem; }
.next-request-body p { color: var(--muted); font-size: 0.88rem; margin-bottom: 0.75rem; }

.project-tabs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.project-tab {
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  white-space: nowrap;
}

.project-tab:hover { color: var(--text); background: var(--surface-2); }
.project-tab.active {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #fff;
}

.project-tab.new-tab {
  border-style: dashed;
  color: var(--accent);
}

.approval-progress {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.approval-step {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
}

.approval-step:last-child { border-bottom: none; }

.approval-step .step-icon {
  width: 1.5rem;
  text-align: center;
  font-size: 1rem;
}

.approval-step.done .step-icon { color: var(--success); }
.approval-step.active .step-icon { color: var(--accent); animation: pulse 1.2s infinite; }
.approval-step.pending .step-icon { color: var(--muted); }

.approval-banner {
  background: rgba(63, 185, 80, 0.12);
  border: 1px solid var(--success);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  color: var(--success);
  font-weight: 600;
}

.feature-request-success {
  background: rgba(88, 166, 255, 0.1);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  color: var(--text);
}

.inquiry-thread {
  max-height: 340px;
  overflow-y: auto;
  margin: 0.75rem 0;
  padding: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ChatGPT-style planning chat */
.chat-panel {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 220px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.chat-header h3 { font-size: 0.95rem; margin-bottom: 0.15rem; }

.chat-head-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.chat-user-select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
  max-width: 12rem;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 280px;
}

.chat-msg {
  display: flex;
  gap: 0.75rem;
  max-width: 92%;
  animation: chatIn 0.2s ease;
}

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

.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg.assistant { align-self: flex-start; }

.chat-avatar {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.chat-msg.user .chat-avatar { background: var(--accent-2); }
.chat-msg.assistant .chat-avatar { background: linear-gradient(135deg, var(--purple), var(--accent)); }

.chat-bubble {
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.55;
}

.chat-msg.user .chat-bubble {
  background: rgba(88, 166, 255, 0.15);
  border: 1px solid rgba(88, 166, 255, 0.25);
  border-bottom-right-radius: 4px;
}

.chat-msg.assistant .chat-bubble {
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.chat-meta {
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 0.3rem;
}

.chat-typing {
  display: flex;
  gap: 0.75rem;
  align-self: flex-start;
  padding: 0 1rem 0.5rem;
}

.chat-typing-dots {
  display: flex;
  gap: 4px;
  padding: 0.85rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.chat-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: chatDot 1.2s infinite;
}

.chat-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes chatDot {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

.chat-starters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0 1rem 0.75rem;
  justify-content: center;
}

.chat-starters.hidden { display: none; }

.chat-starter {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

.chat-starter:hover {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(88, 166, 255, 0.08);
}

.chat-composer {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.chat-composer textarea {
  flex: 1;
  resize: none;
  min-height: 2.5rem;
  max-height: 8rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.4;
}

.chat-composer textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.chat-composer-actions {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.chat-send {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: 10px;
  font-size: 1.1rem;
  line-height: 1;
}

.inquiry-msg {
  margin-bottom: 0.85rem;
  padding: 0.7rem 0.85rem;
  border-radius: 8px;
  font-size: 0.88rem;
  line-height: 1.5;
}

.inquiry-msg.user {
  background: rgba(88, 166, 255, 0.1);
  border: 1px solid rgba(88, 166, 255, 0.25);
  margin-left: 1.5rem;
}

.inquiry-msg.assistant {
  background: var(--surface-2);
  border: 1px solid var(--border);
  margin-right: 1.5rem;
}

.inquiry-msg .inquiry-meta {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.inquiry-suggestions {
  margin-top: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.inquiry-suggestions li {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0.2rem 0 0.2rem 1rem;
}

.project-tab.inquiry-tab {
  border-color: var(--accent);
  color: var(--accent);
}

.project-tab.inquiry-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  cursor: pointer;
  transition: 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.project-card:hover {
  border-color: var(--accent);
  background: var(--surface-2);
  transform: translateY(-2px);
}

.project-card h4 { font-size: 1rem; }

.project-card .progress-ring {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.project-card .pct {
  font-size: 1.5rem;
  font-weight: 700;
  min-width: 3.5rem;
}

.project-feature-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.project-feature-row:last-child { border-bottom: none; }

.project-feature-row .progress-bar { flex: 1; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.feature-card h4 { font-size: 0.95rem; }
.feature-card .progress-bar {
  background: var(--surface-3);
  border-radius: 4px;
  height: 5px;
  overflow: hidden;
}
.feature-card .progress-bar > div {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.pipeline-step {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.35rem;
  text-align: center;
  font-size: 0.68rem;
}

.pipeline-step.active { border-color: var(--accent); background: rgba(88, 166, 255, 0.1); }
.pipeline-step.done { border-color: var(--success); background: rgba(63, 185, 80, 0.08); }

.staging-frame {
  width: 100%;
  height: 460px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0 0.75rem;
  background: var(--accent-2);
  color: #fff;
  font-size: 0.72rem;
  border-top: 1px solid var(--border);
  min-height: var(--status-h);
}

.footer-access {
  display: flex;
  gap: 0.5rem;
  flex: 1;
  justify-content: center;
  min-width: 0;
  overflow-x: auto;
  padding: 0.25rem 0;
}

.copy-link-box {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 0.2rem 0.35rem;
  min-width: 0;
}

.copy-link-box .copy-link-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  opacity: 0.85;
  white-space: nowrap;
}

.copy-link-box input {
  width: 11rem;
  max-width: 14vw;
  padding: 0.2rem 0.4rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  font: inherit;
  font-size: 0.68rem;
  font-family: var(--mono);
}

.copy-link-box .btn-copy {
  padding: 0.15rem 0.45rem;
  font-size: 0.65rem;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
  white-space: nowrap;
}

.copy-link-box .btn-copy:hover { background: rgba(255, 255, 255, 0.12); }

.deploy-links-card h3 { margin-bottom: 0.25rem; }

.deploy-link-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.deploy-link-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.deploy-link-row .copy-link-label {
  min-width: 5.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

.deploy-link-row input {
  flex: 1;
  min-width: 12rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  font-family: var(--mono);
}

.deploy-link-row .btn { font-size: 0.78rem; padding: 0.35rem 0.65rem; }

.active-deploy-link {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border);
}

.active-deploy-link .copy-link-box {
  background: var(--bg);
  border-color: var(--border);
}

.active-deploy-link .copy-link-box input {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  width: 100%;
  max-width: none;
  flex: 1;
}

.active-deploy-link .copy-link-box {
  width: 100%;
}

.statusbar .left, .statusbar .right { display: flex; gap: 1rem; align-items: center; flex-shrink: 0; }
.statusbar .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--success); display: inline-block; margin-right: 0.3rem;
}

.muted { color: var(--muted); }
.small { font-size: 0.8rem; }
.mono { font-family: var(--mono); font-size: 0.78rem; }

.toast {
  position: fixed;
  bottom: calc(var(--status-h) + 1rem);
  right: 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  opacity: 0;
  transform: translateY(8px);
  transition: 0.2s;
  z-index: 200;
  font-size: 0.85rem;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* Command palette */
.palette-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  z-index: 300;
}
.palette-overlay.open { display: flex; }

.palette {
  width: min(560px, 92vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
  overflow: hidden;
}

.palette input {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 0.9rem 1rem;
  font-size: 0.95rem;
  background: var(--surface);
}

.palette-results { max-height: 320px; overflow-y: auto; }

.palette-item {
  padding: 0.65rem 1rem;
  cursor: pointer;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
}
.palette-item:hover, .palette-item.selected { background: var(--surface-2); }
.palette-item .hint { color: var(--muted); font-size: 0.75rem; }

.voice-btn.recording {
  background: var(--danger) !important;
  animation: pulse 1.2s infinite;
}
@keyframes pulse { 50% { opacity: 0.7; } }

/* Feature tracker page */
.tracker-page .content { padding: 1rem 1.25rem 2rem; }

.compliance-ring {
  width: 120px; height: 120px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  border: 4px solid var(--accent);
  font-weight: 700;
}
.compliance-ring span { font-size: 1.6rem; }
.compliance-ring small { font-size: 0.7rem; color: var(--muted); font-weight: 400; }

.req-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.req-table th, .req-table td {
  padding: 0.55rem 0.65rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.req-table th { color: var(--muted); font-weight: 600; font-size: 0.72rem; text-transform: uppercase; }

.feature-detail {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: hidden;
}
.feature-detail-header {
  padding: 0.85rem 1rem;
  background: var(--surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.feature-detail-header:hover { background: var(--surface-2); }
.feature-detail-body {
  display: none;
  padding: 1rem;
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.feature-detail.open .feature-detail-body { display: block; }

.filter-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.filter-bar button {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}
.filter-bar button.active {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #fff;
}

.release-list { display: flex; flex-direction: column; gap: 0.6rem; }
.release-item {
  padding: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}

/* Auth overlay */
.auth-overlay { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 50% -10%, #161b22 0%, var(--bg-2) 70%); }
.auth-card { width: 360px; max-width: 92vw; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 1.8rem 1.6rem; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.auth-brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; margin-bottom: 1.2rem; }
.auth-card h2 { margin: 0 0 0.3rem; }
.auth-sub { color: var(--muted); font-size: 0.85rem; margin: 0 0 1.2rem; }
.auth-label { display: block; font-size: 0.78rem; color: var(--muted); margin-bottom: 0.85rem; }
.auth-label input { width: 100%; margin-top: 0.3rem; padding: 0.6rem 0.7rem; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg-2); color: var(--text); font: inherit; box-sizing: border-box; }
.auth-label input:focus { outline: none; border-color: var(--accent); }
.auth-error { color: var(--danger); font-size: 0.8rem; min-height: 1.1rem; margin-bottom: 0.5rem; }
.auth-info { color: var(--accent); font-size: 0.8rem; min-height: 0; margin-bottom: 0.5rem; }
.auth-info:empty { display: none; }
.auth-submit { width: 100%; justify-content: center; }
.auth-toggle { display: block; width: 100%; margin-top: 0.9rem; background: transparent; border: 0; color: var(--accent); font-size: 0.8rem; cursor: pointer; }
.auth-toggle:hover { text-decoration: underline; }

/* User Access (admin) */
.users-group { margin-bottom: 1.4rem; }
.users-group-head { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 0.6rem; display: flex; align-items: center; gap: 0.5rem; }
.users-list { display: flex; flex-direction: column; gap: 0.5rem; }
.user-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0.65rem 0.85rem; }
.user-main { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.user-name { font-weight: 600; }
.user-role { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.05em; background: rgba(88,166,255,0.13); color: var(--accent); border: 1px solid rgba(88,166,255,0.35); border-radius: 999px; padding: 0.05rem 0.45rem; }
.user-meta { font-size: 0.72rem; }
.user-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }
.user-actions .btn { font-size: 0.74rem; padding: 0.3rem 0.7rem; }

/* Ticket Manager */
.ticket-create { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.ticket-create input { flex: 1; min-width: 140px; padding: 0.55rem 0.7rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; }
.ticket-create select { padding: 0.55rem 0.7rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; }
.ticket-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.85rem; align-items: start; }
.ticket-col { background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 0.6rem; }
.ticket-col-head { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 0.6rem; display: flex; justify-content: space-between; }
.ticket-count { background: var(--surface-3); border-radius: 999px; padding: 0 0.5rem; color: var(--text); }
.ticket-col-body { display: flex; flex-direction: column; gap: 0.55rem; }
.ticket-empty { color: var(--muted); text-align: center; padding: 0.5rem; font-size: 0.85rem; }
.ticket-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0.65rem; }
.ticket-card-top { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.4rem; }
.ticket-prio { font-size: 0.65rem; font-weight: 600; padding: 0.1rem 0.45rem; border-radius: 999px; text-transform: uppercase; }
.ticket-id { font-size: 0.65rem; color: var(--muted); flex: 1; }
.ticket-del { background: transparent; border: 0; color: var(--muted); cursor: pointer; font-size: 0.8rem; }
.ticket-del:hover { color: var(--danger); }
.ticket-title { font-weight: 600; font-size: 0.88rem; margin-bottom: 0.25rem; }
.ticket-desc { font-size: 0.78rem; color: var(--muted); margin-bottom: 0.45rem; }
.ticket-meta { display: flex; justify-content: space-between; font-size: 0.72rem; margin-bottom: 0.5rem; }
.ticket-moves { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.ticket-move { font-size: 0.66rem; padding: 0.18rem 0.4rem; border-radius: 6px; border: 1px solid var(--border); background: transparent; color: var(--accent); cursor: pointer; }
.ticket-move:hover { background: var(--surface-3); }
@media (max-width: 1100px) { .ticket-board { grid-template-columns: 1fr 1fr; } }
/* ---- Resources tab ---- */
.res-headline { padding: .6rem .9rem; border-radius: 8px; margin-bottom: 1rem; font-size: .9rem;
  background: rgba(63,185,80,.1); border: 1px solid rgba(63,185,80,.3); color: var(--success); }
.res-headline-warn { background: rgba(248,81,73,.12); border-color: rgba(248,81,73,.45); color: var(--danger); }
.res-section { margin: 1.4rem 0 .6rem; font-size: 1rem; }
.res-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.res-gpus { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.res-card { padding: 1rem 1.1rem; }
.res-card-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .4rem; }
.res-title { font-weight: 600; font-size: .9rem; }
.res-big { font-size: 1.9rem; font-weight: 700; line-height: 1.1; margin: .1rem 0 .5rem; }
.res-unit { font-size: .8rem; font-weight: 400; color: var(--muted); margin-left: .35rem; }
.res-meter { height: 8px; border-radius: 5px; background: rgba(255,255,255,.08); overflow: hidden; margin: .35rem 0; }
.res-meter-fill { height: 100%; border-radius: 5px; transition: width .4s ease; }
.res-temp { font-size: .8rem; font-weight: 600; padding: .12rem .5rem; border-radius: 999px; border: 1px solid transparent; }
.res-temp.muted { color: var(--muted); }
.res-gpu-row { display: flex; justify-content: space-between; font-size: .82rem; margin-top: .5rem; }
.res-gpu.res-critical { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger) inset; }
.res-gpu.res-warn { border-color: var(--warning); }
.res-emergency { margin-top: 1.5rem; border: 1px solid rgba(248,81,73,.35); }
.res-emg-buttons { display: flex; flex-wrap: wrap; gap: .6rem; }
.btn-warn { background: var(--warning); color: #0d1117; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warn:disabled, .btn-danger:disabled { opacity: .45; cursor: not-allowed; }
.res-emg-helper code, #res-emg-helper code { background: rgba(255,255,255,.1); padding: .1rem .35rem; border-radius: 4px; }

.tab-access { margin: 0 0 1rem .2rem; }
.tab-access > summary { cursor: pointer; color: var(--accent); font-size: .82rem; padding: .2rem 0; }
.tab-access-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .35rem .8rem; margin: .5rem 0; }
.tab-access-item { display: flex; align-items: center; gap: .45rem; font-size: .82rem; color: var(--text); }
.tab-access-item input { accent-color: var(--accent); }

.ticket-desc-input { grid-column: 1 / -1; width: 100%; box-sizing: border-box; resize: vertical;
  padding: 0.55rem 0.65rem; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-2); color: var(--text); font: inherit; }
.ticket-desc-input:focus { outline: none; border-color: var(--accent); }
.ticket-card { cursor: pointer; transition: border-color .12s ease, transform .12s ease; }
.ticket-card:hover { border-color: var(--accent); }
.ticket-card[draggable="true"] { cursor: grab; }
.ticket-card.dragging { opacity: 0.45; }
.ticket-col.drag-over { border-color: var(--accent); background: #10233d; }
.ticket-card-foot { display: flex; gap: 0.6rem; align-items: center; font-size: 0.7rem; color: var(--muted); margin-top: 0.35rem; }

/* Ticket detail modal */
.ticket-modal { position: fixed; inset: 0; z-index: 9998; display: none; align-items: center; justify-content: center;
  background: rgba(1,4,9,0.7); backdrop-filter: blur(3px); padding: 1.5rem; }
.ticket-modal.open { display: flex; }
.ticket-modal-card { position: relative; width: 620px; max-width: 95vw; max-height: 88vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 1.5rem 1.6rem;
  box-shadow: 0 24px 70px rgba(0,0,0,0.6); }
.ticket-modal-close { position: absolute; top: 0.8rem; right: 0.9rem; background: transparent; border: 0;
  color: var(--muted); font-size: 1.1rem; cursor: pointer; }
.ticket-modal-close:hover { color: var(--text); }
.tm-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.2rem; flex-wrap: wrap; }
.tm-id { font-size: 0.72rem; color: var(--muted); }
.tm-title { font-size: 1.15rem; font-weight: 650; margin: 0.1rem 0 0.6rem; }
.tm-desc { background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; padding: 0.7rem 0.85rem;
  font-size: 0.85rem; color: var(--text); white-space: pre-wrap; margin-bottom: 0.9rem; }
.tm-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.7rem; margin-bottom: 1rem; }
.tm-field { font-size: 0.72rem; color: var(--muted); }
.tm-field select, .tm-field input { width: 100%; margin-top: 0.25rem; padding: 0.45rem 0.55rem; border-radius: 7px;
  border: 1px solid var(--border); background: var(--bg-2); color: var(--text); font: inherit; box-sizing: border-box; }
.tm-section-head { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 0.5rem 0 0.5rem; }
.tm-comments { display: flex; flex-direction: column; gap: 0.55rem; margin-bottom: 0.8rem; }
.tm-comment { background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; padding: 0.55rem 0.7rem; }
.tm-comment-head { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--muted); margin-bottom: 0.2rem; }
.tm-comment-author { color: var(--accent); font-weight: 600; }
.tm-comment-text { font-size: 0.85rem; white-space: pre-wrap; }
.tm-empty { color: var(--muted); font-size: 0.82rem; padding: 0.3rem 0; }
.tm-reply { display: flex; flex-direction: column; gap: 0.5rem; }
.tm-reply textarea { width: 100%; box-sizing: border-box; resize: vertical; padding: 0.55rem 0.65rem; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg-2); color: var(--text); font: inherit; }
.tm-reply textarea:focus { outline: none; border-color: var(--accent); }
.tm-actions { display: flex; gap: 0.5rem; justify-content: flex-end; align-items: center; }
.tm-actions #tm-attach-btn { margin-right: auto; }

/* --- ticket screenshot attachments --- */
.tm-att-row { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.5rem; }
.tm-att { display: block; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; line-height: 0;
  background: var(--bg-1); transition: border-color .15s ease; }
.tm-att:hover { border-color: var(--accent); }
.tm-att img { width: 128px; height: 96px; object-fit: cover; display: block; }

.tm-reply { position: relative; }
.tm-reply.tm-drop-hot { outline: 2px dashed var(--accent); outline-offset: 4px; border-radius: 10px; }
.tm-drop-hint { display: none; position: absolute; inset: 0; align-items: center; justify-content: center;
  pointer-events: none; background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-radius: 10px; color: var(--accent); font-weight: 600; font-size: 0.9rem; z-index: 2; }
.tm-reply.tm-drop-hot .tm-drop-hint { display: flex; }

.tm-att-preview { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.tm-att-preview:empty { display: none; }
.tm-att-chip { position: relative; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; line-height: 0; }
.tm-att-chip img { width: 84px; height: 64px; object-fit: cover; display: block; }
.tm-att-remove { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%;
  border: none; cursor: pointer; background: rgba(0,0,0,0.65); color: #fff; font-size: 0.7rem; line-height: 1;
  display: flex; align-items: center; justify-content: center; }
.tm-att-remove:hover { background: var(--danger, #e5484d); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.78rem; }

/* --- right-click tab context menu --- */
.tab-context-menu {
  position: fixed; z-index: 4000; min-width: 190px; padding: 0.3rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.45); display: flex; flex-direction: column; gap: 2px;
}
.tab-context-menu .tcm-title {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted);
  padding: 0.3rem 0.55rem 0.35rem; border-bottom: 1px solid var(--border); margin-bottom: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px;
}
.tab-context-menu button {
  text-align: left; background: transparent; border: none; color: var(--text);
  padding: 0.45rem 0.6rem; border-radius: 6px; cursor: pointer; font: inherit; font-size: 0.85rem;
}
.tab-context-menu button:hover { background: var(--bg-2); color: var(--accent); }

.sys-summary { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.25rem; border-radius: 10px; margin-bottom: 1rem; border: 1px solid var(--border); background: var(--surface); }
.sys-summary.sys-ok { border-color: rgba(63,185,80,0.5); }
.sys-summary.sys-warn { border-color: rgba(210,153,34,0.5); }
.sys-summary-ring { font-size: 1.3rem; font-weight: 700; min-width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; border-radius: 50%; border: 3px solid var(--border); }
.sys-ok .sys-summary-ring { border-color: var(--success); color: var(--success); }
.sys-warn .sys-summary-ring { border-color: var(--warning); color: var(--warning); }
.sys-summary-head { font-weight: 600; font-size: 1rem; margin-bottom: 0.15rem; }
.sys-group { margin-bottom: 1rem; }
.sys-group h3 { margin: 0 0 0.75rem; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.sys-row { display: flex; align-items: center; gap: 0.85rem; padding: 0.7rem 0; border-top: 1px solid var(--border); }
.sys-row:first-of-type { border-top: 0; }
.sys-dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.sys-row-main { flex: 1; min-width: 0; }
.sys-name { font-weight: 600; font-size: 0.9rem; }
.sys-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 0.1rem; text-align: right; }
.sys-state { font-weight: 600; font-size: 0.82rem; }
.sys-link { color: var(--accent); font-size: 0.72rem; text-decoration: none; }
.sys-link:hover { text-decoration: underline; }

.ai-status { display: inline-flex; align-items: center; gap: 0.35rem; white-space: pre-line; cursor: default; }
.ai-status .ai-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.ai-status.ai-up .ai-dot { background: var(--success); box-shadow: 0 0 6px var(--success); }
.ai-status.ai-partial .ai-dot { background: var(--warning); box-shadow: 0 0 6px var(--warning); }
.ai-status.ai-down .ai-dot { background: var(--danger); }
.ai-status.ai-up { color: var(--success); }
.ai-status.ai-partial { color: var(--warning); }

.build-badge { font-size: 0.72rem; font-weight: 600; padding: 0.2rem 0.6rem; border-radius: 999px; }
.build-note {
  margin: 0.75rem 0 0; padding: 0.6rem 0.8rem; border-radius: 6px;
  background: rgba(210, 153, 34, 0.12); border: 1px solid rgba(210, 153, 34, 0.4);
  color: #e3b341; font-size: 0.82rem;
}
.build-steps { display: flex; flex-direction: column; gap: 0.6rem; }
.build-step { border: 1px solid var(--border); border-radius: 6px; background: var(--bg-2); overflow: hidden; }
.build-step-head { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.8rem; flex-wrap: wrap; }
.build-step-name { font-weight: 600; font-size: 0.85rem; }
.build-step-cmd { color: var(--muted); font-size: 0.72rem; }
.build-output {
  margin: 0; padding: 0.7rem 0.9rem; background: #010409; border-top: 1px solid var(--border);
  color: #c9d1d9; font-size: 0.72rem; line-height: 1.45; max-height: 280px; overflow: auto; white-space: pre-wrap; word-break: break-word;
}

@media (max-width: 1100px) {
  .workspace { grid-template-columns: var(--activity-w) 1fr; }
  .sidebar { display: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .pipeline { grid-template-columns: repeat(4, 1fr); }
}

/* ============================================================
   Collaborative Kanban board (matches the dark portal theme)
   ============================================================ */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(200px, 1fr));
  gap: 0.7rem;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}
.kanban-col {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem;
  min-height: 120px;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.kanban-col.drag-over { border-color: var(--accent); background: #10233d; }
.kanban-col-head {
  font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); margin-bottom: 0.55rem; display: flex; justify-content: space-between; align-items: center;
}
.kanban-col-head .ticket-count { background: var(--surface-3); }
.kanban-col-body { display: flex; flex-direction: column; gap: 0.5rem; min-height: 40px; }
.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 0.6rem 0.65rem;
  cursor: grab;
  transition: border-color 0.12s ease, transform 0.08s ease, box-shadow 0.12s ease;
}
.kanban-card:hover { border-color: var(--accent); box-shadow: 0 3px 12px rgba(0,0,0,0.35); }
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: 0.45; }
.kanban-card-title { font-size: 0.86rem; font-weight: 600; margin-bottom: 0.25rem; }
.kanban-card-desc { font-size: 0.76rem; color: var(--muted); margin-bottom: 0.4rem; white-space: pre-wrap; word-break: break-word; }
.kanban-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; font-size: 0.7rem; color: var(--muted); }
.kanban-assignee { display: inline-flex; align-items: center; gap: 0.3rem; }
.kanban-avatar {
  width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.62rem; font-weight: 700; color: #fff; text-transform: uppercase;
}
.kanban-empty { color: var(--muted); font-size: 0.75rem; text-align: center; padding: 0.6rem 0; opacity: 0.7; }
.kanban-color-row { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.3rem; }
.kanban-swatch { width: 22px; height: 22px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.kanban-swatch.selected { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg); }
@media (max-width: 1100px) { .kanban-board { grid-template-columns: repeat(5, minmax(180px, 1fr)); } }

/* ============================================================
   Facebook 2010–2014 era sitewide chat
   ============================================================ */
.fbchat {
  position: fixed;
  right: 16px;
  bottom: 0;
  z-index: 9990;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  font-family: "lucida grande", tahoma, verdana, arial, sans-serif;
  font-size: 11px;
  color: #1c2028;
}
.fbchat-bar {
  width: 168px;
  height: 27px;
  background: #f7f7f7;
  border: 1px solid #b3b3b3;
  border-bottom: none;
  border-radius: 3px 3px 0 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  cursor: pointer;
  font-weight: bold;
  color: #3b5998;
  user-select: none;
}
.fbchat-bar:hover { background: #fff; }
.fbchat-bar-icon { font-size: 12px; }
.fbchat-bar-label { flex: 1; }
.fbchat-online { display: inline-flex; align-items: center; gap: 4px; color: #6d6f73; font-weight: normal; }
.fbchat-online-dot { width: 8px; height: 8px; border-radius: 50%; background: #7bb026; box-shadow: 0 0 3px #7bb026; display: inline-block; }
.fbchat-bar-caret { color: #6d6f73; font-size: 9px; transition: transform 0.15s ease; }
.fbchat.roster-open .fbchat-bar-caret { transform: rotate(180deg); }

/* Buddy list popup */
.fbchat-roster {
  position: absolute;
  right: 0;
  bottom: 27px;
  width: 200px;
  max-height: 340px;
  background: #fff;
  border: 1px solid #b3b3b3;
  border-radius: 3px 3px 0 0;
  box-shadow: 0 1px 6px rgba(0,0,0,0.3);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.fbchat.roster-open .fbchat-roster { display: flex; }
.fbchat-roster-search { padding: 6px; border-bottom: 1px solid #e5e5e5; background: #f7f7f7; }
.fbchat-roster-search input {
  width: 100%; border: 1px solid #bdc7d8; border-radius: 3px; padding: 4px 6px; font-size: 11px; outline: none;
  font-family: inherit; color: #1c2028; background: #fff;
}
.fbchat-roster-list { overflow-y: auto; padding: 2px 0; }
.fbchat-roster-section {
  padding: 4px 8px 2px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.03em; color: #999; font-weight: bold;
}
.fbchat-buddy {
  display: flex; align-items: center; gap: 7px; padding: 5px 9px; cursor: pointer;
}
.fbchat-buddy:hover { background: #e9ebee; }
.fbchat-buddy-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.fbchat-buddy-dot.on { background: #7bb026; box-shadow: 0 0 3px #7bb026; }
.fbchat-buddy-dot.off { background: #ccc; }
.fbchat-buddy-name { flex: 1; color: #1c2028; font-weight: bold; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fbchat-buddy-name .me-tag { color: #999; font-weight: normal; }
.fbchat-buddy.room { border-bottom: 1px solid #e5e5e5; }
.fbchat-buddy.room .fbchat-buddy-name { color: #3b5998; }

/* Chat windows docked along the bottom */
.fbchat-windows { display: flex; align-items: flex-end; gap: 8px; }
.fbchat-win {
  width: 220px;
  background: #fff;
  border: 1px solid #b3b3b3;
  border-bottom: none;
  border-radius: 3px 3px 0 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.28);
  display: flex;
  flex-direction: column;
}
.fbchat-win-head {
  height: 27px; background: #6d84b4; color: #fff; display: flex; align-items: center; gap: 6px;
  padding: 0 6px 0 9px; cursor: pointer; border-radius: 3px 3px 0 0; font-weight: bold;
}
.fbchat-win-head .fbchat-win-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.fbchat-win-head .fbchat-win-dot.on { background: #b6ff6b; }
.fbchat-win-head .fbchat-win-dot.off { background: #d8dde8; }
.fbchat-win-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fbchat-win-btn { color: #dfe3ee; cursor: pointer; padding: 0 3px; font-weight: bold; }
.fbchat-win-btn:hover { color: #fff; }
.fbchat-win-body {
  height: 260px; display: flex; flex-direction: column; background: #fff;
}
.fbchat-win.min .fbchat-win-body { display: none; }
.fbchat-win.min .fbchat-win-head { border-radius: 3px 3px 0 0; }
.fbchat-msgs {
  flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px;
  background: #fff;
}
.fbchat-msg { line-height: 1.35; }
.fbchat-msg-author { font-weight: bold; color: #3b5998; }
.fbchat-msg-author.self { color: #444; }
.fbchat-msg-text { color: #1c2028; word-break: break-word; }
.fbchat-msg-time { color: #aaa; font-size: 9px; margin-left: 4px; }
.fbchat-day { text-align: center; color: #999; font-size: 9px; margin: 2px 0; }
.fbchat-empty { color: #999; text-align: center; padding: 10px; }
.fbchat-compose { border-top: 1px solid #e5e5e5; padding: 6px; background: #f7f7f7; }
.fbchat-compose textarea {
  width: 100%; resize: none; border: 1px solid #bdc7d8; border-radius: 3px; padding: 5px 6px;
  font-family: inherit; font-size: 11px; color: #1c2028; outline: none; height: 34px; background: #fff;
}
.fbchat-compose textarea:focus { border-color: #6d84b4; }
@media (max-width: 720px) { .fbchat-windows { display: none; } }

/* ---- Codebase ingestion: drag-and-drop folder ---- */
.ingest-dropzone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: var(--bg);
  padding: 2.4rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .05s ease;
}
.ingest-dropzone:hover, .ingest-dropzone:focus { border-color: var(--accent); background: rgba(255,255,255,0.02); outline: none; }
.ingest-dropzone.dragover { border-color: var(--accent); background: rgba(90,140,255,0.08); transform: scale(1.01); }
.ingest-dropzone-icon { font-size: 2.6rem; line-height: 1; margin-bottom: 0.6rem; }
.ingest-dropzone-title { font-size: 1.05rem; font-weight: 600; margin-bottom: 0.35rem; }
.ingest-dropzone-sub { color: var(--muted); font-size: 0.85rem; }
.ingest-dropzone-sub code { background: var(--panel); padding: 0.05rem 0.3rem; border-radius: 4px; font-size: 0.8rem; }
.ingest-link { color: var(--accent); text-decoration: underline; }

.ingest-staging { margin-top: 1rem; }
.ingest-staging-head { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.ingest-staging-head input { flex: 1; min-width: 200px; }
.ingest-staging-stats { flex-shrink: 0; }

.ingest-progress { height: 6px; border-radius: 4px; background: var(--panel); overflow: hidden; margin: 0.8rem 0; }
.ingest-progress-bar { height: 100%; width: 0%; background: var(--accent); transition: width .1s linear; }

.ingest-report { margin-top: 1.25rem; }
.ingest-report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.ingest-stat { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 0.85rem; }
.ingest-stat .n { font-size: 1.5rem; font-weight: 700; color: var(--accent); }
.ingest-stat .l { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.ingest-section { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 1rem; margin-bottom: 1rem; }
.ingest-section h4 { margin: 0 0 0.6rem; font-size: 0.95rem; }
.ingest-langbar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; margin-bottom: 0.75rem; background: var(--panel); }
.ingest-langbar span { height: 100%; }
.ingest-lang-legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; font-size: 0.82rem; }
.ingest-lang-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 0.35rem; vertical-align: middle; }
.ingest-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.ingest-chip { background: var(--panel); border: 1px solid var(--border); border-radius: 999px; padding: 0.2rem 0.7rem; font-size: 0.8rem; }
.ingest-findings { list-style: none; padding: 0; margin: 0; }
.ingest-findings li { padding: 0.45rem 0.6rem; border-left: 3px solid var(--accent); background: var(--panel); border-radius: 0 6px 6px 0; margin-bottom: 0.45rem; font-size: 0.85rem; }
.ingest-findings li.warn { border-left-color: var(--danger); }
.ingest-approval { display: flex; align-items: center; gap: 0.75rem; background: rgba(240,180,40,0.08); border: 1px solid rgba(240,180,40,0.35); border-radius: 10px; padding: 0.85rem 1rem; }
.ingest-claude { max-height: 320px; overflow: auto; background: var(--panel); border-radius: 8px; padding: 0.85rem; font-size: 0.8rem; white-space: pre-wrap; }

/* Components + file directory tree */
.ingest-components { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.5rem; }
.ingest-comp { display: flex; flex-direction: column; gap: 0.15rem; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 0.55rem 0.7rem; }
.ingest-comp-name { font-size: 0.85rem; font-weight: 600; word-break: break-all; }
.ingest-comp-meta { font-size: 0.75rem; color: var(--muted); }
.ingest-tree-wrap { max-height: 420px; overflow: auto; background: var(--panel); border-radius: 8px; padding: 0.6rem 0.8rem; font-size: 0.82rem; }
ul.ingest-tree { list-style: none; margin: 0; padding-left: 1.1rem; }
.ingest-tree-wrap > ul.ingest-tree { padding-left: 0.2rem; }
ul.ingest-tree li { padding: 0.08rem 0; line-height: 1.5; }
ul.ingest-tree li.file { color: var(--text); }
ul.ingest-tree .ti { display: inline-block; width: 1.25rem; }
ul.ingest-tree details > summary { cursor: pointer; list-style: none; user-select: none; }
ul.ingest-tree details > summary::-webkit-details-marker { display: none; }
ul.ingest-tree details > summary:hover { color: var(--accent); }
