/*
  Hivee - styles.css
  Stage 1: flat dark, 4-color gradient accent, aurora auth-only
*/

/* ===== TOKENS ===== */
:root {
  --bg:       #000000;
  --bg-soft:  #0a0a0a;
  --surface:  #111111;
  --modal-backdrop: rgba(0, 0, 0, 0.88);
  --modal-surface: #0f0f0f;
  --modal-surface-2: #1a1a1a;
  --modal-line: rgba(255, 255, 255, 0.1);
  --line:     rgba(255, 255, 255, 0.07);
  --line-2:   rgba(255, 255, 255, 0.12);
  --text:     #edf1f8;
  --muted:    #4a5468;
  --yellow:   #facc15;
  --red:      #ff4d4d;
  --orange:   #f97316;
  --cyan:     #22d3ee;
  --blue:     #3b82f6;
  --gradient: linear-gradient(135deg, #facc15 0%, #ff4d4d 40%, #22d3ee 70%, #3b82f6 100%);
  --radius:   12px;
  --shadow:   0 24px 56px rgba(0, 0, 0, 0.55);
}

/* ===== RESET ===== */
* { box-sizing: border-box; }

html, body { width: 100%; height: 100%; }

body {
  margin: 0;
  color: var(--text);
  font-family: "Manrope", "Segoe UI", sans-serif;
  background: var(--bg);
}

h1, h2, h3, h4, strong {
  margin: 0;
  font-family: "Space Grotesk", "Manrope", sans-serif;
  letter-spacing: 0.01em;
}

/* ===== SCROLLBARS ===== */
::-webkit-scrollbar            { width: 5px; height: 5px; }
::-webkit-scrollbar-track      { background: transparent; }
::-webkit-scrollbar-thumb      { background: rgba(255,255,255,0.1); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover{ background: rgba(255,255,255,0.2); }
*                              { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.1) transparent; }

/* bg-halo disabled globally - auth uses its own CSS aurora */
.bg-noise { display: none; }
.bg-halo  { display: none; }

.app-shell {
  width: 100%;
  min-height: 100vh;
  position: relative;
  z-index: 1;
  padding: 14px;
}

.view        { display: none; }
.view.active { display: block; animation: fadeUp 200ms ease; }
.hidden      { display: none !important; }

/* ===== AUTH VIEW ===== */
#view_auth {
  min-height: 100dvh;
  overflow: hidden;
  position: fixed;
  inset: 0;
  width: 100vw;
  background: #000000;
}

#aurora-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 90% 45% at 50% 0%,    #facc15 0%, transparent 100%),
    radial-gradient(ellipse 45% 90% at 100% 50%,   #ff4d4d 0%, transparent 100%),
    radial-gradient(ellipse 90% 45% at 50% 100%,   #22d3ee 0%, transparent 100%),
    radial-gradient(ellipse 45% 90% at 0%   50%,   #3b82f6 0%, transparent 100%),
    #000;
}

#aurora-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

#view_auth > .auth-shell { position: relative; z-index: 2; }

#view_auth.active { display: grid; align-items: center; }

/* ===== CARD ===== */
.card {
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: rgba(10, 10, 10, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

/* ===== HELPERS ===== */
.helper {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  min-height: 16px;
}
.helper.error { color: var(--red); }
.helper.ok    { color: var(--cyan); }

/* ===== INPUTS ===== */
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 130ms ease, box-shadow 130ms ease;
  color-scheme: dark;
}

select option {
  background: #1a1a1a;
  color: var(--text);
}

input:focus, textarea:focus, select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}

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

/* ===== BUTTONS ===== */
button {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  color: var(--text);
  background: linear-gradient(var(--bg), var(--bg)) padding-box,
              var(--gradient) border-box;
  cursor: pointer;
  transition: opacity 150ms ease, transform 120ms ease;
}

button:hover  { opacity: 0.82; transform: translateY(-1px); }
button:active { transform: translateY(0); opacity: 1; }

/* Gradient-fill: one primary CTA per context */
button.primary,
button[type="submit"]:not(.secondary):not(.danger) {
  background: var(--gradient);
  color: #fff;
  border: none;
}

button.secondary {
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--muted);
}
button.secondary:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  opacity: 1;
  transform: none;
}
button.secondary:active { transform: none; }

button.danger {
  background: transparent;
  border: 1px solid rgba(255, 77, 77, 0.4);
  color: rgba(255, 150, 150, 0.85);
}
button.danger:hover {
  border-color: var(--red);
  background: rgba(255, 77, 77, 0.08);
  opacity: 1;
  transform: none;
}

label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
  font-weight: 600;
}

/* ===== LAYOUT UTILITIES ===== */
.stack     { display: grid; gap: 8px; }

.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

/* ===== PILL ===== */
.pill {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  color: var(--muted);
  font-size: 12px;
  padding: 5px 11px;
  background: transparent;
}
.pill.neutral { border-color: var(--line); color: var(--muted); }

/* ===== ICON ===== */
.icon-svg {
  width: 16px; height: 16px; flex: 0 0 16px;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

/* ===== AUTH SHELL ===== */
.auth-shell {
  width: 100%;
  min-height: 100dvh;
  display: grid;
  place-items: center;
}

.auth-modern {
  width: min(960px, calc(100vw - 34px));
  display: grid;
  grid-template-columns: 1.1fr minmax(300px, 400px);
  gap: 2px;
  padding: 2px;
  align-items: stretch;
  margin-inline: auto;
}

.auth-brand,
.auth-panel {
  padding: 32px;
  border-radius: 12px;
  background: rgba(8, 11, 20, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.auth-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand-logo {
  width: clamp(96px, 14vw, 136px);
  height: clamp(96px, 14vw, 136px);
  object-fit: contain;
  margin-bottom: 14px;
}

.auth-brand h1 {
  font-size: clamp(28px, 5vw, 40px);
  margin: 10px 0 8px;
  line-height: 1.08;
}

.brand-copy {
  max-width: 440px;
  color: var(--muted);
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
}

.brand-grid { margin-top: 20px; display: grid; gap: 7px; }

.brand-grid span {
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  padding: 9px 12px;
  font-size: 12px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* ===== METHOD CARDS ===== */
.method-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.method-card {
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 12px;
  transition: border-color 130ms ease, color 130ms ease;
}
.method-card:hover:not(.active) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  opacity: 1;
  transform: none;
}
.method-card.active {
  background: linear-gradient(var(--bg-soft), var(--bg-soft)) padding-box,
              var(--gradient) border-box;
  border-color: transparent;
  color: var(--text);
}

/* ===== AUTH INTERNALS ===== */
.auth-method-panel { display: grid; gap: 8px; }

.auth-switch-row {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.tab-link {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: transparent;
  border: none;
  padding: 5px 9px;
  min-height: auto;
  border-radius: 7px;
}
.tab-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  opacity: 1;
  transform: none;
}
.tab-link.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.09);
}

.separator-dot {
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--line-2);
}

/* ===== CLAIM / INVITE CARD ===== */
.claim-connected-card {
  margin-top: 8px;
  margin-bottom: 10px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 12px;
}
.claim-connected-title {
  margin: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}
.claim-connected-identity {
  margin: 4px 0 0;
  font-weight: 700;
  color: var(--text);
  font-size: 14px;
  word-break: break-all;
}
.claim-connected-provider { margin-top: 4px; }

#project_invite_card label       { margin-top: 4px; }
#project_invite_card .action-row { margin-top: 8px; }
#project_invite_card input,
#project_invite_card select      { margin-top: 2px; }
#project_invite_logged_in        { margin-top: 4px; }
#project_invite_card .helper     { overflow-wrap: anywhere; word-break: break-word; }
#project_invite_card .claim-connected-identity { overflow-wrap: anywhere; word-break: break-word; }

/* ===== SOCIAL AUTH ===== */
.social-auth-block { margin-top: 8px; display: grid; gap: 8px; }

.social-divider {
  position: relative;
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.social-divider::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  border-top: 1px solid var(--line);
  transform: translateY(-50%);
}
.social-divider span {
  position: relative;
  padding: 0 8px;
  background: rgba(8, 11, 20, 0.8);
}

.social-grid { display: grid; gap: 8px; }

.social-btn {
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  padding: 9px 12px;
  min-height: 40px;
}
.social-btn:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  transform: none;
  opacity: 1;
}
.social-btn svg { width: 18px; height: 18px; flex: 0 0 18px; }
.social-btn:focus-visible { outline: 1px solid var(--blue); outline-offset: 2px; }
.social-btn span { font-weight: 700; }
.social-btn.is-disabled,
.social-btn:disabled { opacity: 0.32; cursor: not-allowed; }
.social-btn.is-disabled:hover,
.social-btn:disabled:hover {
  transform: none;
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--line-2);
}
.social-auth-hint { margin-top: 0; text-align: left; min-height: 16px; }

/* ===== AGENT GUIDE ===== */
.agent-guide {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  padding: 14px;
}
.agent-guide h3 { font-size: 16px; margin-bottom: 4px; }
.agent-guide code {
  display: block;
  margin: 6px 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  padding: 10px;
  color: var(--text);
  font-size: 12px;
  word-break: break-all;
}
.agent-guide a       { color: var(--blue); word-break: break-all; }
.agent-guide a:hover { color: #93c5fd; }

/* ===== SETUP VIEW ===== */
.setup-wrap { max-width: 660px; margin: 60px auto; }
.setup-card { padding: 28px; }
.setup-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.setup-logo { width: 42px; height: 42px; object-fit: contain; }
.setup-nav-row {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.setup-nav-row .secondary {
  margin-right: auto;
}

/* ===== HOME VIEW ===== */
#view_home {
  height: calc(100dvh - 28px);
  min-height: 0;
  grid-template-rows: auto 1fr;
  gap: 12px;
  overflow: hidden;
}
#view_home.active { display: grid; }

/* ===== TOPBAR ===== */
.workspace-topbar {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 6px 2px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.workspace-brand { display: flex; align-items: center; gap: 10px; }
.workspace-logo  { width: 28px; height: 28px; object-fit: contain; }
.workspace-brand h2 { font-size: 15px; line-height: 1.05; }
.subtitle { margin: 3px 0 0; font-size: 11px; color: var(--muted); }

.top-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
}

/* ===== STATUS DOTS ===== */
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status-dot.connected    { background: var(--cyan); box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.18); }
.status-dot.disconnected { background: var(--muted); }

/* ===== WORKSPACE LAYOUT ===== */
.workspace-layout {
  min-height: 0;
  height: 100%;
  overflow: hidden;
  display: grid;
  /* Default: no context sidebar — nav | center | chat */
  grid-template-columns: 220px minmax(400px, 1fr) 320px;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "nav section chat"
    "nav center  chat";
  gap: 0;
  align-items: stretch;
}
/* When a specific project is open — show context sidebar column */
.workspace-layout.context-active {
  grid-template-columns: 220px 180px minmax(400px, 1fr) 320px;
  grid-template-areas:
    "nav section section chat"
    "nav context  center  chat";
}

/* ===== PRIMARY NAV ===== */
.primary-nav {
  grid-area: nav;
  padding: 4px 8px 4px 0;
  overflow: auto;
  border-right: 1px solid var(--line);
  min-height: 100%;
  align-self: stretch;
  background: transparent;
}

.nav-section + .nav-section { margin-top: 1px; }

.nav-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  min-height: 36px;
}
.nav-toggle:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  opacity: 1;
  transform: none;
}
.nav-toggle.active {
  background: linear-gradient(var(--bg), var(--bg)) padding-box,
              var(--gradient) border-box;
  border: 1px solid transparent;
  color: var(--text);
  font-weight: 700;
}
.nav-toggle.active[data-nav-tab="projects"].project-selected {
  background: linear-gradient(var(--bg), var(--bg)) padding-box,
              var(--gradient) border-box;
  border: 1px solid transparent;
  color: var(--text);
}

.nav-icon { width: 14px; height: 14px; flex: 0 0 14px; opacity: 0.65; }

.nav-content { margin-top: 1px; padding: 1px 0 1px 4px; display: grid; gap: 1px; }

/* Override gradient for all nav-scoped buttons */
.primary-nav button {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  box-shadow: none;
}
.primary-nav button:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  opacity: 1;
  transform: none;
}


/* ===== PROJECT LIST ===== */
.project-list { display: grid; gap: 1px; }

.project-item {
  border: none;
  border-radius: 8px;
  background: transparent;
  padding: 6px 10px;
  text-align: left;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.project-item .meta { margin-top: 3px; font-size: 11px; color: var(--muted); opacity: 0.65; }
.project-item-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.project-item-approval-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18);
  flex: 0 0 auto;
}
.project-item.needs-approval .meta {
  color: #fecaca;
  opacity: 0.95;
}

.project-item.active { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.project-item:hover  { background: rgba(255, 255, 255, 0.05); color: var(--text); opacity: 1; transform: none; }

.primary-nav:not(.projects-mode) .project-item.active { background: transparent; color: var(--muted); }
.nav-toggle.active:hover,
.primary-nav.projects-mode .project-item.active:hover  { background: rgba(255, 255, 255, 0.10); color: var(--text); }

/* ===== WORKSPACE SECTION TITLE ===== */
.workspace-section-title {
  grid-area: section;
  display: flex;
  align-items: flex-end;
  padding: 0 18px 10px;
  border-bottom: 1px solid var(--line);
}
#workspace_section_title { font-size: clamp(26px, 2.4vw, 36px); line-height: 1; }

/* ===== PROJECT HEADBAR ===== */
.project-headbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px 10px;
  background: transparent;
}
.project-head-actions      { display: inline-flex; align-items: center; gap: 8px; }
.project-head-actions .action-row { margin-top: 0; }
.project-headmeta          { display: grid; gap: 3px; min-width: 0; }
#detail_title              { font-size: clamp(20px, 1.6vw, 26px); line-height: 1.05; }
.project-subline           { margin: 0; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== CONTEXT SIDEBAR ===== */
.context-sidebar {
  grid-area: context;
  padding: 12px 12px 12px 18px;
  display: grid;
  align-content: start;
  gap: 3px;
  align-self: start;
  border-right: 1px solid var(--line);
  background: transparent;
}
.context-sidebar h3 {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 5px;
  opacity: 0.6;
}

.context-link {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
}
.context-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  opacity: 1;
  transform: none;
}
.context-link.active {
  background: linear-gradient(var(--bg), var(--bg)) padding-box,
              var(--gradient) border-box;
  border: 1px solid transparent;
  color: var(--text);
  font-weight: 700;
  box-shadow: none;
}
.context-live-link { display: flex; align-items: center; justify-content: space-between; }

/* ===== LIVE STATUS DOT ===== */
.live-status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.live-status-dot.approved { background: var(--cyan);  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.2); }
.live-status-dot.completed{ background: var(--red);   box-shadow: 0 0 0 3px rgba(255, 77,  77,  0.2); }

/* ===== CENTER STAGE ===== */
.center-stage {
  grid-area: center;
  padding: 14px 20px;
  overflow: auto;
  background: transparent;
}

.center-pane        { display: none; }
.center-pane.active { display: block; }

/* ===== EMPTY STATE ===== */
.empty-state {
  min-height: 320px;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 6px;
}
.empty-state h3 { color: var(--muted); font-size: 15px; font-weight: 500; }

/* ===== DETAIL PANELS ===== */
.detail-panels { display: grid; gap: 10px; }

.text-block {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  padding: 12px;
}

.agent-summary h4 {
  margin: 14px 0 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* ===== CHIPS ===== */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border-radius: 999px;
  border: 1px solid var(--line-2);
  padding: 5px 10px;
  font-size: 12px;
  color: var(--muted);
  background: transparent;
}
.chip.primary {
  background: linear-gradient(var(--bg), var(--bg)) padding-box,
              var(--gradient) border-box;
  border-color: transparent;
  color: var(--text);
}
.agent-chip-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.agent-inline-avatar {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  object-fit: contain;
  display: block;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line-2);
}

/* ===== PROJECT PANEL ===== */
.project-panel {
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  padding: 14px;
}

.task-create-form {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(120px, 150px) minmax(140px, 180px) auto;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}
.task-blueprint-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 220px) auto;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}
.task-toolbar {
  margin-top: 8px;
  display: grid;
  grid-template-columns: auto minmax(120px, 160px) auto minmax(120px, 160px) auto minmax(160px, 220px);
  gap: 8px;
  align-items: center;
}
.task-toolbar label {
  color: var(--muted);
  font-size: 12px;
}
.task-inline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}
.task-inline-toggle input[type="checkbox"] {
  width: 14px;
  height: 14px;
}
.task-list {
  margin-top: 10px;
  min-height: 220px;
  max-height: 460px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  padding: 8px;
  display: grid;
  gap: 8px;
}
.task-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.015);
  padding: 10px;
  display: grid;
  gap: 6px;
}
.task-row-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.task-row-head strong {
  font-size: 13px;
}
.task-row-meta {
  font-size: 11px;
  color: var(--muted);
}
.task-row-blockers {
  color: #f59e0b;
}
.task-row-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto auto;
  gap: 8px;
  align-items: center;
}
.task-select {
  min-height: 34px;
  padding: 6px 8px;
}
.task-select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.task-comment-panel {
  margin-top: 4px;
  border: 1px dashed var(--line-2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.015);
  padding: 8px;
  display: grid;
  gap: 8px;
}
.task-comment-list {
  display: grid;
  gap: 6px;
  max-height: 200px;
  overflow: auto;
}
.task-comment-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.01);
  padding: 6px 8px;
  display: grid;
  gap: 4px;
}
.task-comment-author {
  color: var(--muted);
  font-size: 11px;
}
.task-comment-edited {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-size: 10px;
  color: var(--muted);
}
.task-comment-body {
  color: var(--text);
  font-size: 12px;
  line-height: 1.4;
  white-space: pre-wrap;
}
.task-comment-edit {
  display: grid;
  gap: 6px;
}
.task-comment-edit-input {
  width: 100%;
  min-height: 74px;
  resize: vertical;
}
.task-comment-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.task-comment-actions button {
  min-height: 26px;
  padding: 4px 8px;
  font-size: 11px;
}
.task-comment-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}
.task-comment-form input {
  min-height: 34px;
}
.activity-toolbar {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.activity-toolbar label {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
.activity-toolbar select {
  min-height: 34px;
  min-width: 220px;
  padding: 6px 8px;
}
.activity-feed-tail {
  opacity: 0.86;
  border-style: dashed;
}
.activity-feed-tail .meta {
  text-align: center;
}

/* ===== PROGRESS ===== */
.progress-card {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  padding: 12px;
  display: grid;
  gap: 10px;
}
.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
#detail_progress_label { font-size: 13px; font-weight: 700; }
.progress-track {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: var(--cyan);
  transition: width 300ms ease;
}
.progress-fill.complete { background: var(--gradient); }

/* ===== STATUS PILL ===== */
.status-pill {
  border-radius: 999px;
  padding: 4px 10px;
  border: 1px solid var(--line-2);
  font-size: 12px;
  color: var(--muted);
  background: transparent;
}
.status-pill.connected    { color: var(--cyan); border-color: rgba(34, 211, 238, 0.4); background: rgba(34, 211, 238, 0.07); }
.status-pill.disconnected { color: var(--muted); border-color: var(--line-2); background: transparent; }

/* ===== EVENTS ===== */
.events {
  margin-top: 10px;
  min-height: 260px;
  max-height: 460px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  padding: 8px;
}
.events.live-updates { min-height: 80px; max-height: 260px; padding: 6px 8px; display: flex; flex-direction: column; gap: 0; }
.events.live-updates:empty::after { content: "No live updates yet."; font-size: 12px; color: var(--muted); padding: 8px 0; }
.event              { border-bottom: 1px solid var(--line); padding: 8px; }
.event:last-child   { border-bottom: 0; }
.event .meta        { color: var(--orange); font-size: 12px; margin-bottom: 4px; }
.event .text        { white-space: pre-wrap; font-size: 13px; }

/* ===== FILE BROWSER ===== */
.folder-browser {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  padding: 10px;
  min-height: 220px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  color: var(--text);
  white-space: pre-wrap;
}

.file-breadcrumbs { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 8px; }

/* crumb is rendered as <button> by JS - override gradient */
.crumb {
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.crumb:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
  opacity: 1;
  transform: none;
}

.nav-file-breadcrumbs { margin-top: 4px; margin-bottom: 6px; }
.nav-file-list        { min-height: 140px; max-height: 260px; }

.file-list {
  min-height: 180px;
  max-height: 280px;
  overflow: auto;
  padding: 4px;
  display: grid;
  gap: 2px;
  white-space: normal;
  font-family: "Manrope", "Segoe UI", sans-serif;
}

/* file-row rendered as <button> by JS */
.file-row {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
}
.file-row:hover {
  border-color: var(--line-2);
  background: rgba(255, 255, 255, 0.04);
  opacity: 1;
  transform: none;
}
.file-row .meta { color: var(--muted); font-size: 11px; }
.file-row .name { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.file-label     { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.file-kind-icon { width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 16px; }
.file-kind-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.file-preview             { margin-top: 8px; min-height: 160px; max-height: 480px; overflow: auto; display: grid; gap: 8px; }
.file-preview .helper     { margin: 0; }
.file-preview-meta        { color: var(--muted); font-size: 12px; }
.file-preview-pre         { margin: 0; white-space: pre-wrap; color: var(--text); font-size: 13px; line-height: 1.5; }
.file-preview img         { display: block; max-width: 100%; border-radius: 10px; border: 1px solid var(--line); }
.file-preview iframe      { width: 100%; min-height: 460px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.file-preview video       { width: 100%; max-height: 520px; border: 1px solid var(--line); border-radius: 10px; background: #000; }
.workspace-files-panel    { margin-top: 0; }

/* ===== USAGE ===== */
.usage-shell {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  padding: 14px;
  display: grid;
  gap: 14px;
}
.usage-kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.usage-kpi {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: transparent;
}
.usage-kpi .label  { color: var(--muted); font-size: 10px; display: block; margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.06em; }
.usage-kpi .value  { font-size: 17px; font-weight: 700; color: var(--text); }
.usage-chart       { display: grid; gap: 8px; }
.usage-bar-row     { display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.usage-bar-track   { height: 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.usage-bar-fill    { height: 100%; border-radius: 999px; transition: width 300ms ease; }
.usage-bar-fill.prompt     { background: var(--blue); }
.usage-bar-fill.completion { background: var(--cyan); }
.usage-bar-fill.total      { background: var(--orange); }
.usage-footnote    { color: var(--muted); font-size: 11px; }
.usage-project-list {
  display: grid;
  gap: 6px;
}
.usage-project-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.01);
  padding: 8px 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}
.usage-project-row .name {
  color: var(--text);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.usage-project-row .tokens {
  color: var(--muted);
  font-size: 12px;
}
.usage-project-row .cost {
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

/* ===== LIVE PREVIEW ===== */
.live-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.live-preview-stage {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  min-height: 360px;
  max-height: 620px;
  overflow: auto;
  padding: 10px;
}
.live-preview-mount { min-height: 320px; }
.live-preview-mount pre    { margin: 0; white-space: pre-wrap; color: var(--text); font-size: 13px; line-height: 1.5; }
.live-preview-mount img    { display: block; max-width: 100%; border-radius: 8px; border: 1px solid var(--line); }
.live-preview-mount iframe { width: 100%; min-height: 520px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.live-preview-mount video  { width: 100%; max-height: 560px; border: 1px solid var(--line); border-radius: 10px; background: #000; }

/* ===== CONFIG ===== */
.config-grid { margin-top: 12px; display: grid; gap: 10px; max-width: 700px; }
.config-card { border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, 0.02); padding: 12px; display: grid; gap: 8px; }
.config-row  { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.config-row:last-child { border-bottom: 0; padding-bottom: 0; }
.config-row span { color: var(--muted); font-size: 13px; }
.config-row code { color: var(--text); font-size: 12px; background: rgba(255, 255, 255, 0.04); border-radius: 6px; padding: 2px 7px; }

/* ===== ACCOUNT ===== */
.account-grid { margin-top: 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 880px; }
.account-card { border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.02); padding: 16px; display: grid; gap: 10px; }
.account-card h4 { margin: 0; font-size: 14px; }
.account-card h5 { margin: 0; font-size: 13px; }
.account-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.account-card-head .secondary { min-height: 32px; padding: 6px 12px; font-size: 12px; }
.account-sub { margin: 0; color: var(--muted); font-size: 12px; }
.account-stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.account-stat { border: 1px solid var(--line); border-radius: 10px; background: transparent; padding: 12px; display: grid; gap: 4px; }
.account-stat .label { color: var(--muted); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; }
.account-stat strong { font-size: 26px; line-height: 1; }
.account-detail-list { margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: transparent; }
.account-detail-row  { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 10px; align-items: start; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.account-detail-row:last-child { border-bottom: 0; }
.account-detail-row dt { margin: 0; color: var(--muted); font-size: 12px; font-weight: 600; }
.account-detail-row dd { margin: 0; color: var(--text); font-size: 13px; word-break: break-word; }
.account-detail-row code { display: inline-block; border: 1px solid var(--line-2); border-radius: 6px; background: rgba(255, 255, 255, 0.04); padding: 2px 6px; color: var(--text); font-size: 12px; }
.account-inline-actions { margin-top: 4px; }
.account-danger-zone { margin-top: 4px; padding-top: 12px; border-top: 1px dashed rgba(255, 77, 77, 0.22); display: grid; gap: 8px; }
.account-danger-zone h5 { color: rgba(255, 140, 140, 0.75); }
#account_msg { margin-top: 2px; }

/* ===== CHAT PANEL ===== */
.chat-panel {
  grid-area: chat;
  min-height: 0;
  height: 100%;
  padding: 14px;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto auto;
  gap: 8px;
  background: rgba(255, 255, 255, 0.016);
  border-left: 1px solid var(--line);
}
.chat-head              { display: grid; gap: 4px; }
.chat-head strong       { font-size: 14px; }
.chat-head .helper      { margin-top: 2px; }
.chat-context-row       { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.chat-context-row label { font-size: 11px; color: var(--muted); }
.chat-context-row select { min-width: 116px; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--line-2); background: transparent; color: var(--text); font-size: 12px; }
.chat-context-row select:disabled { opacity: 0.45; cursor: not-allowed; }
#chat_context_note { margin-top: 0; }

.chat-agent-list      { display: flex; flex-wrap: wrap; gap: 5px; max-height: 104px; overflow: auto; }

/* agent-mention-chip rendered as <button> by JS */
.agent-mention-chip {
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--muted);
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.agent-mention-avatar {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  object-fit: contain;
  display: block;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line-2);
}
.agent-mention-chip:hover { border-color: var(--blue); color: var(--text); background: transparent; opacity: 1; transform: none; }

/* ===== CHAT MESSAGES ===== */
.chat-messages { overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: transparent; padding: 8px; }
.chat-msg              { margin-bottom: 10px; display: flex; flex-direction: column; gap: 3px; }
.chat-msg:last-child   { margin-bottom: 0; }
.chat-meta             { color: var(--muted); font-size: 11px; }
.chat-bubble           { border-radius: 10px; padding: 8px 11px; line-height: 1.45; white-space: pre-wrap; font-size: 13px; }
.chat-bubble a         { color: var(--blue); text-decoration: underline; text-underline-offset: 2px; word-break: break-all; }
.chat-bubble a:hover   { color: #93c5fd; }
.chat-msg.user .chat-bubble      { background: rgba(59, 130, 246, 0.09); border: 1px solid rgba(59, 130, 246, 0.22); }
.chat-msg.assistant .chat-bubble { background: rgba(249, 115, 22, 0.07); border: 1px solid rgba(249, 115, 22, 0.18); }
.chat-msg.system .chat-bubble    { background: transparent; border: 1px solid var(--line); color: var(--muted); }

/* ===== CHAT AUTOCOMPLETE ===== */
.chat-autocomplete { border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); display: grid; gap: 2px; padding: 6px; max-height: 140px; overflow: auto; }

/* mention-item rendered as <button> by JS */
.mention-item { width: 100%; border: 1px solid transparent; text-align: left; background: transparent; color: var(--muted); padding: 7px 9px; font-size: 12px; border-radius: 7px; }
.mention-item:hover,
.mention-item.active { background: rgba(255, 255, 255, 0.07); color: var(--text); border-color: transparent; opacity: 1; transform: none; }

/* ===== CHAT COMPOSE ===== */
.chat-compose            { display: grid; gap: 8px; }
.chat-compose-row        { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.chat-compose textarea   { min-height: 80px; }
.chat-compose-row button { min-height: 80px; white-space: nowrap; }

/* ===== WIZARD ===== */
.wizard {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: var(--modal-backdrop);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 16px;
}
.wizard.hidden { display: none !important; }

.wizard-card {
  width: min(700px, calc(100vw - 30px));
  border: 1px solid var(--modal-line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--modal-surface) 0%, var(--modal-surface-2) 100%);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.65);
  padding: 20px;
  max-height: calc(100vh - 36px);
  overflow: auto;
}

.wizard-mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }

/* wizard-mode rendered as <button> by JS */
.wizard-mode {
  border: 1px solid var(--line-2);
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  display: grid;
  gap: 5px;
  padding: 14px;
}
.wizard-mode:hover { border-color: rgba(255, 255, 255, 0.16); color: var(--text); background: rgba(255, 255, 255, 0.03); opacity: 1; transform: none; }
.wizard-mode strong { font-size: 14px; }
.wizard-mode span   { font-size: 12px; color: var(--muted); }
.wizard-mode.active {
  background: linear-gradient(var(--modal-surface), var(--modal-surface)) padding-box,
              var(--gradient) border-box;
  border-color: transparent;
  color: var(--text);
}
.wizard-mode.active span { color: rgba(255, 255, 255, 0.5); }

/* ===== WIZARD CHAT ===== */
.wizard-chat-log {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.26);
  min-height: 190px;
  max-height: 290px;
  overflow: auto;
  padding: 10px;
  display: grid;
  gap: 8px;
}
.wizard-chat-msg  { display: grid; gap: 3px; }
.wizard-chat-meta { font-size: 11px; color: var(--muted); }
.wizard-chat-bubble { border-radius: 9px; border: 1px solid var(--line); background: transparent; padding: 8px 11px; white-space: pre-wrap; line-height: 1.45; font-size: 13px; }
.wizard-chat-msg.user .wizard-chat-bubble  { border-color: rgba(59, 130, 246, 0.28); background: rgba(59, 130, 246, 0.07); }
.wizard-chat-msg.agent .wizard-chat-bubble { border-color: rgba(249, 115, 22, 0.22); background: rgba(249, 115, 22, 0.05); }

.wizard-chat-compose       { margin-top: 10px; display: grid; gap: 8px; }
.wizard-chat-input-row     { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.wizard-chat-compose textarea  { min-height: 80px; }
.wizard-chat-input-row button  { min-height: 80px; white-space: nowrap; }

/* ===== AGENT PICK ===== */
.invite-agent-modal-card { width: min(860px, calc(100vw - 30px)); }
.agent-pick-list { display: grid; gap: 8px; max-height: 280px; overflow: auto; }
.agent-pick {
  display: grid;
  grid-template-columns: auto 1fr auto minmax(140px, 210px);
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.015);
}
.agent-pick .small { display: block; color: var(--muted); font-size: 12px; }
.agent-pick [data-agent-role] { min-height: 34px; }
.agent-pick input[type="checkbox"] { width: 16px; height: 16px; }

.wizard-agent-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  padding: 10px;
  display: grid;
  gap: 8px;
}
.wizard-agent-head {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
  align-items: center;
}
.wizard-agent-avatar {
  width: 44px;
  height: 44px;
  border-radius: 9px;
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
  display: grid;
  place-items: center;
}
.wizard-agent-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.wizard-agent-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.wizard-agent-title strong {
  font-size: 13px;
}
.wizard-agent-meta {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.wizard-agent-role {
  display: grid;
  gap: 6px;
}
.wizard-agent-role label {
  margin-top: 0;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.wizard-agent-role input {
  min-height: 34px;
}

.owner-agent-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 10px;
  align-items: center;
  background: rgba(255, 255, 255, 0.015);
}
.owner-agent-row .meta {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

/* ===== WIZARD EXTERNAL ACCESS ===== */
.wizard-external-access { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; display: grid; gap: 10px; }
.wizard-external-access h4 { font-size: 11px; margin: 0; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.wizard-split-grid  { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.wizard-mini-card   { border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, 0.015); padding: 12px; display: grid; gap: 8px; }
.wizard-mini-card h5 { font-size: 11px; margin: 0; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.wizard-simple-list,
.wizard-perm-list   { display: grid; gap: 6px; }
.wizard-list-item   { border: 1px solid var(--line); border-radius: 9px; background: rgba(255, 255, 255, 0.015); padding: 10px; display: grid; gap: 4px; }
.wizard-list-item .meta  { color: var(--muted); font-size: 12px; line-height: 1.4; }
.wizard-list-item .title { font-size: 13px; font-weight: 700; color: var(--text); }
.perm-row           { border: 1px solid var(--line); border-radius: 9px; background: rgba(255, 255, 255, 0.015); padding: 10px; display: grid; gap: 8px; }
.perm-toggles       { display: flex; flex-wrap: wrap; gap: 10px; }
.perm-toggles label { margin-top: 0; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.perm-write-paths   { min-height: 74px; font-size: 12px; }

/* ===== READINESS ===== */
#detail_stage  { margin-top: 0; }
.readiness-list { display: grid; gap: 5px; margin: 4px 0 10px; }
.readiness-item { border-radius: 8px; border: 1px solid var(--line); background: transparent; padding: 6px 10px; font-size: 12px; line-height: 1.4; }
.readiness-item.ok      { border-color: rgba(34, 211, 238, 0.32); background: rgba(34, 211, 238, 0.05); }
.readiness-item.pending { border-color: rgba(249, 115, 22, 0.32); background: rgba(249, 115, 22, 0.05); }
#detail_plan_text { max-height: 280px; overflow: auto; white-space: pre-wrap; }

/* ===== ANIMATIONS ===== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ===== RESPONSIVE ===== */
@media (max-width: 1420px) {
  .workspace-layout                          { grid-template-columns: 200px minmax(340px, 1fr) 280px; }
  .workspace-layout.context-active          { grid-template-columns: 200px 160px minmax(340px, 1fr) 280px; }
}

@media (max-width: 1180px) {
  #view_home { height: auto; min-height: calc(100dvh - 28px); overflow: auto; }

  .workspace-layout {
    height: auto;
    overflow: visible;
    grid-template-columns: 220px 1fr;
    grid-template-areas:
      "nav section"
      "nav center"
      "chat chat";
  }

  .primary-nav { grid-area: nav; min-height: 0; height: auto; }
  .workspace-section-title { grid-area: section; padding: 0 16px 4px; }
  .project-headbar         { padding: 0 16px 4px; }
  .context-sidebar         { display: none !important; }
  .center-stage            { grid-area: center; min-height: 0; height: auto; }
  .chat-panel              { grid-area: chat; min-height: 320px; height: auto; border-left: none; border-top: 1px solid var(--line); }
  .account-grid            { max-width: none; }
}

@media (max-width: 860px) {
  .app-shell  { padding: 8px; }

  .auth-shell { min-height: 100dvh; margin: 0; }
  .auth-modern { width: calc(100vw - 16px); grid-template-columns: 1fr; gap: 2px; padding: 2px; }
  .auth-brand, .auth-panel { padding: 22px; }

  .workspace-layout {
    grid-template-columns: 1fr;
    grid-template-areas: "nav" "section" "center" "chat";
  }

  .primary-nav  { border-right: none; border-bottom: 1px solid var(--line); }
  .center-stage { /* no special border needed */ }

  .usage-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .usage-bar-row  { grid-template-columns: 72px minmax(0, 1fr); }
  .usage-bar-row strong { grid-column: 1 / -1; justify-self: end; }
  .usage-project-row { grid-template-columns: 1fr; }
  .task-create-form { grid-template-columns: 1fr; }
  .task-blueprint-form { grid-template-columns: 1fr; }
  .task-toolbar { grid-template-columns: 1fr; }
  .task-row-controls { grid-template-columns: 1fr; }
  .task-comment-form { grid-template-columns: 1fr; }
  .activity-toolbar { display: grid; gap: 6px; }
  .activity-toolbar select { min-width: 0; width: 100%; }

  .live-preview-stage { min-height: 260px; max-height: 520px; }
  .live-preview-mount iframe { min-height: 360px; }

  .primary-nav, .center-stage, .chat-panel { min-height: auto; }

  .wizard-mode-grid  { grid-template-columns: 1fr; }
  .wizard-split-grid { grid-template-columns: 1fr; }
  .account-grid      { grid-template-columns: 1fr; }
  .account-stat-grid { grid-template-columns: 1fr; }
  .account-detail-row { grid-template-columns: 1fr; gap: 4px; }

  .chat-compose-row,
  .wizard-chat-input-row { grid-template-columns: 1fr; }
  .chat-compose-row button,
  .wizard-chat-input-row button { min-height: 44px; }
}

/* ===== STAGE 4/5: WORKSPACE POLISH ===== */

/* --- Section title: yellow-to-red gradient, project identity --- */
#workspace_section_title {
  background: linear-gradient(90deg, #facc15 0%, #f97316 52%, #ff4d4d 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
}

/* --- New Project button: plain border (no gradient outline) --- */
#btn_new_project {
  background: transparent !important;
  border: 1px solid var(--line-2) !important;
  color: var(--muted) !important;
  font-weight: 600;
}
#btn_new_project:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  color: var(--text) !important;
  opacity: 1;
  border-color: rgba(255, 255, 255, 0.2) !important;
  transform: none;
}

/* --- Center pane h3: secondary label, not competing with section title --- */
.center-pane > h3 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 0 0 14px;
  opacity: 0.7;
}

/* --- Workspace brand h2 --- */
.workspace-brand h2 {
  font-size: 15px;
  line-height: 1;
  letter-spacing: 0.02em;
}

/* --- Live status dot: pulse animation when active --- */
@keyframes pulse-cyan {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.4); }
  50%       { box-shadow: 0 0 0 5px rgba(34, 211, 238, 0); }
}
.live-status-dot.approved {
  animation: pulse-cyan 2s ease-in-out infinite;
}

/* --- Project head title refinement --- */
#detail_title {
  display: flex;
  align-items: center;
  gap: 10px;
}
#detail_title_text {
  background: none;
  -webkit-background-clip: border-box;
  -webkit-text-fill-color: var(--text);
  background-clip: border-box;
  color: var(--text);
}
.approval-indicator {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.14);
  color: #fca5a5;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  -webkit-text-fill-color: currentColor;
}

.summary-grid {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}
.summary-card {
  border: 1px solid var(--line-2);
  border-radius: 12px;
  padding: 14px;
  background: rgba(14, 17, 26, 0.45);
}
.summary-agents-grid {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}
.summary-agent-card {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
}
.summary-agent-avatar {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.04);
}
.summary-agent-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.summary-agent-body {
  min-width: 0;
  display: grid;
  gap: 6px;
}
.summary-agent-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.summary-agent-status {
  font-size: 11px;
  color: var(--muted);
  text-transform: capitalize;
}
.summary-agent-meta {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
.summary-agent-capabilities {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.summary-cap-chip {
  font-size: 11px;
  color: var(--text);
}
@media (max-width: 720px) {
  .summary-agent-card {
    grid-template-columns: 1fr;
  }
  .summary-agent-avatar {
    margin: 0 auto;
  }
  .owner-agent-row {
    grid-template-columns: 1fr;
  }
  .owner-agent-row > button {
    justify-self: start;
  }
  .wizard-agent-head {
    grid-template-columns: 36px 1fr;
  }
}
/* --- Section run/delete buttons: compact in headbar --- */
.project-head-actions button {
  padding: 7px 14px;
  font-size: 12px;
}

/* --- Agent summary section headers: already uppercase, add top spacing --- */
.agent-summary + .agent-summary h4 { margin-top: 18px; }

/* --- Tracker events: slightly better event row --- */
.event .meta { font-weight: 600; }

/* --- File dir rows: folder tint --- */
.file-row.dir { color: var(--text); }
.file-row.dir .file-kind-icon { color: var(--orange); opacity: 0.8; }

/* --- Chat: tighten head area --- */
.chat-head strong {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}

/* --- Agent mention chip: individual agent colors via CSS vars (set inline by JS) --- */
.agent-mention-chip[style*="--agent-color"] {
  border-color: var(--agent-color, var(--line-2));
}
.agent-mention-chip[style*="--agent-color"]:hover {
  border-color: var(--agent-color, var(--blue));
  color: var(--text);
}

/* --- Account stat number refinement --- */
.account-stat strong {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- Config connection status section --- */
.config-grid h3 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 0 0 10px;
  opacity: 0.7;
}

/* --- Workspace topbar: tighter --- */
.workspace-topbar { padding: 4px 2px 10px; }

/* ===== STAGE 3: AUTH + SETUP + WIZARD POLISH ===== */

/* --- Brand grid: no boxes, just icon + text --- */
.brand-grid {
  margin-top: 24px;
  display: grid;
  gap: 14px;
}
.brand-grid span {
  background: transparent;
  border: none;
  padding: 0;
  font-size: 13px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.brand-grid span .icon-svg { opacity: 0.5; }

/* --- Auth pill --- */
.auth-brand .pill {
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-color: var(--line);
}

/* --- Readonly inputs: output/code style --- */
input[readonly],
textarea[readonly] {
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  cursor: text;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  border-color: var(--line);
  user-select: all;
}
input[readonly]:focus,
textarea[readonly]:focus {
  border-color: var(--line-2);
  box-shadow: none;
}

/* --- Wizard delivery card: output-oriented feel --- */
#wizard_external_delivery {
  background: rgba(255, 255, 255, 0.015);
  border-color: var(--line);
}
#wizard_external_delivery .title-row {
  margin-bottom: 4px;
}

/* --- Wizard form: visual section breaks via margin on group-start fields --- */
/* Group 2 starts at Target Users */
#prj_brief,
#prj_goal          { min-height: 80px; }
#prj_target_users  { margin-top: 8px; }
#prj_in_scope      { margin-top: 8px; }
#prj_milestones    { margin-top: 8px; }

/* Optional fields slightly smaller */
#prj_target_users,
#prj_constraints,
#prj_in_scope,
#prj_out_scope,
#prj_milestones,
#prj_required_stack,
#prj_first_output  { min-height: 72px; }

/* --- Wizard chat input --- */
#wizard_chat_input { min-height: 64px; }

/* --- Invite card: accent left border for visual emphasis --- */
#project_invite_card.claim-connected-card {
  border-left: 2px solid rgba(59, 130, 246, 0.45);
}

/* --- Setup page: remove heavy card, just clean center --- */
.setup-card {
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  max-width: 420px;
  margin: 0 auto;
}
.setup-head { border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 4px; }

/* --- Agent guide code block slightly better --- */
.agent-guide code {
  cursor: text;
  user-select: all;
}

/* ===== STAGE 5: REFINEMENTS ===== */

/* --- Chat send button: icon-only, transparent, centered --- */
#btn_chat_send,
#btn_wizard_chat_send {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  align-self: center;
  flex-shrink: 0;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: var(--muted) !important;
}
#btn_chat_send:hover,
#btn_wizard_chat_send:hover {
  background: transparent !important;
  color: var(--text) !important;
  opacity: 1;
  transform: none;
}
#btn_chat_send:active,
#btn_wizard_chat_send:active {
  transform: none;
}
#btn_chat_send:disabled,
#btn_wizard_chat_send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
#btn_chat_send .icon-svg,
#btn_wizard_chat_send .icon-svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  stroke: currentColor;
}

/* --- Chat approval bubble: gradient outline --- */
.chat-msg.needs-approval .chat-bubble {
  background: linear-gradient(var(--bg), var(--bg)) padding-box,
              var(--gradient) border-box !important;
  border-color: transparent !important;
}

/* --- Project cards grid (empty state with projects) --- */
.project-empty-pane {
  padding: 16px;
}
.project-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  padding: 4px;
}
.project-card {
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 16px;
  text-align: left;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  display: grid;
  gap: 4px;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
}
.project-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
  opacity: 1;
  transform: none;
}
.project-card strong { font-size: 14px; font-weight: 700; }
.project-card .meta { color: var(--muted); font-size: 12px; margin: 0; }

/* --- Agents wizard: two-column external invite --- */
.agents-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 0 0 8px;
  opacity: 0.7;
}
.invite-tab-row {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}
.invite-tab {
  background: transparent !important;
  border: 1px solid var(--line-2) !important;
  color: var(--muted) !important;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 130ms, color 130ms;
}
.invite-tab:hover {
  border-color: rgba(255,255,255,0.2) !important;
  color: var(--text) !important;
  opacity: 1;
  transform: none;
}
.invite-tab.active {
  background: linear-gradient(var(--bg), var(--bg)) padding-box,
              var(--gradient) border-box !important;
  border-color: transparent !important;
  color: var(--text) !important;
}
.invite-panel { display: grid; gap: 8px; }
.invite-panel.hidden { display: none !important; }
.external-invite-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}
.external-invite-email-col,
.external-invite-link-col {
  display: grid;
  gap: 8px;
}
@media (max-width: 860px) {
  .external-invite-cols { grid-template-columns: 1fr; }
  #btn_chat_send, #btn_wizard_chat_send { min-height: 44px; }
}


/* ===== AUTH HOMEPAGE: BLENDED (NO SECTION FILL) ===== */
#view_auth .card {
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

#view_auth .auth-modern {
  width: min(1080px, calc(100vw - 48px));
  padding: 0;
  gap: 28px;
  grid-template-columns: minmax(360px, 1fr) minmax(320px, 420px);
  align-items: start;
}

#view_auth .auth-brand,
#view_auth .auth-panel {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 22px 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

#view_auth .auth-brand {
  padding-right: 28px;
  border-right: 1px solid rgba(255, 255, 255, 0.14);
}

#view_auth .auth-panel {
  padding-left: 28px;
}

#view_auth .claim-connected-card,
#view_auth .agent-guide {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
}

#view_auth .social-divider span {
  background: transparent;
  padding-inline: 10px;
}

#view_auth .social-btn,
#view_auth .tab-link.active {
  background: transparent;
}

#view_auth .method-card {
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  border: 1px solid var(--line-2) !important;
  box-shadow: none;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

#view_auth .method-card::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: inherit;
  background: var(--gradient);
  pointer-events: none;
  opacity: 0;
  z-index: 0;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

#view_auth .method-card > * {
  position: relative;
  z-index: 1;
}

#view_auth .method-card:hover:not(.active) {
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
}

#view_auth .method-card.active {
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  box-shadow: none;
  border-radius: 10px;
  border: 1px solid transparent !important;
  color: var(--text);
}

#view_auth .method-card.active:hover {
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  box-shadow: none;
  border: 1px solid transparent !important;
  color: var(--text);
}

#view_auth .method-card.active::before {
  opacity: 1;
}

#view_auth input,
#view_auth select,
#view_auth textarea {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.18);
}

#view_auth input:focus,
#view_auth select:focus,
#view_auth textarea:focus {
  border-color: rgba(147, 197, 253, 0.9);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.14);
}

@media (max-width: 980px) {
  #view_auth .auth-modern {
    width: calc(100vw - 24px);
    gap: 16px;
    grid-template-columns: 1fr;
  }

  #view_auth .auth-brand {
    border-right: none;
    padding-right: 0;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  }

  #view_auth .auth-panel {
    padding-left: 0;
    padding-top: 14px;
  }
}

@media (max-width: 860px) {
  #view_auth .auth-modern {
    width: calc(100vw - 16px);
    padding: 0;
    gap: 12px;
  }

  #view_auth .auth-brand,
  #view_auth .auth-panel {
    padding: 18px 0;
  }
}

/* ===== VISUAL INITIATIVES ===== */

/* --- I6: Rich Project Cards --- */
.pc-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.pc-status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; border: 1px solid;
}
.pc-status-pill.running   { color: var(--cyan);   border-color: rgba(34,211,238,0.4);  background: rgba(34,211,238,0.08); }
.pc-status-pill.planning  { color: var(--yellow); border-color: rgba(250,204,21,0.4);  background: rgba(250,204,21,0.07); }
.pc-status-pill.paused    { color: var(--orange); border-color: rgba(249,115,22,0.4);  background: rgba(249,115,22,0.07); }
.pc-status-pill.stopped,
.pc-status-pill.failed    { color: var(--red);    border-color: rgba(255,77,77,0.4);   background: rgba(255,77,77,0.07);  }
.pc-status-pill.completed { color: var(--cyan);   border-color: rgba(34,211,238,0.4);  background: rgba(34,211,238,0.08); }
.pc-status-pill.idle      { color: var(--muted);  border-color: var(--line-2);          background: transparent; }
.pc-status-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex: 0 0 5px; }
.pc-status-pill.running .pc-status-dot { animation: pcDotPulse 1.4s ease-in-out infinite; }
@keyframes pcDotPulse { 0%,100% { opacity:1; } 50% { opacity:0.3; } }
.pc-title { font-size: 14px; font-weight: 700; color: var(--text); margin: 0 0 4px; line-height: 1.25; }
.pc-brief {
  font-size: 12px; color: var(--muted); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; margin: 0 0 10px; min-height: 34px;
}
.pc-progress-track { height: 3px; border-radius: 999px; background: rgba(255,255,255,0.07); overflow: hidden; margin-bottom: 10px; }
.pc-progress-fill  { height: 100%; border-radius: 999px; background: var(--cyan); transition: width 400ms ease; }
.pc-progress-fill.running   { background: var(--cyan); }
.pc-progress-fill.planning  { background: var(--yellow); }
.pc-progress-fill.paused    { background: var(--orange); }
.pc-progress-fill.completed { background: var(--gradient); }
.pc-progress-fill.stopped   { background: var(--red); }
.pc-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.pc-agents { display: flex; align-items: center; gap: 3px; }
.pc-agent-avatar { width: 18px; height: 18px; border-radius: 5px; object-fit: contain; border: 1px solid var(--line-2); background: rgba(255,255,255,0.06); margin-left: -4px; }
.pc-agent-avatar:first-child { margin-left: 0; }
.pc-tokens { font-size: 11px; color: var(--muted); }

/* --- I1: Execution Pipeline --- */
.exec-pipeline {
  margin-top: 12px; border: 1px solid var(--line); border-radius: 12px;
  background: rgba(255,255,255,0.02); padding: 16px 14px 12px; display: grid; gap: 10px;
}
.exec-pipeline-nodes {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
  align-items: center; gap: 0;
}
.exec-node { display: flex; flex-direction: column; align-items: center; gap: 7px; text-align: center; }
.exec-node-dot {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid;
  display: flex; align-items: center; justify-content: center;
  transition: background 220ms ease, border-color 220ms ease, box-shadow 220ms ease; flex: 0 0 28px;
}
.exec-node-dot.pending  { border-color: var(--line-2);  background: rgba(255,255,255,0.03); }
.exec-node-dot.done     { border-color: var(--cyan);    background: rgba(34,211,238,0.15);  box-shadow: 0 0 0 3px rgba(34,211,238,0.10); }
.exec-node-dot.active   { border-color: var(--yellow);  background: rgba(250,204,21,0.15);  animation: pipelinePulse 1.6s ease-in-out infinite; }
.exec-node-dot.paused   { border-color: var(--orange);  background: rgba(249,115,22,0.15);  }
.exec-node-dot.failed   { border-color: var(--red);     background: rgba(255,77,77,0.12);   }
@keyframes pipelinePulse { 0%,100% { box-shadow: 0 0 0 4px rgba(250,204,21,0.12); } 50% { box-shadow: 0 0 0 8px rgba(250,204,21,0.04); } }
.exec-node-dot::after { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.exec-node-dot.pending::after  { background: var(--muted);  opacity: 0.4; }
.exec-node-dot.done::after     { background: var(--cyan);   opacity: 1; }
.exec-node-dot.active::after   { background: var(--yellow); opacity: 1; }
.exec-node-dot.paused::after   { background: var(--orange); opacity: 1; }
.exec-node-dot.failed::after   { background: var(--red);    opacity: 1; }
.exec-node-label { font-size: 10px; color: var(--muted); letter-spacing: 0.04em; white-space: nowrap; }
.exec-node.done   .exec-node-label { color: var(--cyan);   }
.exec-node.active .exec-node-label { color: var(--yellow); font-weight: 700; }
.exec-node.paused .exec-node-label { color: var(--orange); }
.exec-node.failed .exec-node-label { color: var(--red);    }
.exec-node-connector { height: 2px; background: var(--line-2); width: 100%; transition: background 300ms ease; }
.exec-node-connector.filled { background: var(--cyan); }
.exec-pipeline-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding-top: 8px; border-top: 1px solid var(--line);
}
.exec-pipeline-footer strong { font-size: 13px; font-weight: 700; }
.exec-progress-wrap { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.exec-progress-track { flex: 1; height: 5px; background: var(--line-2); border-radius: 999px; overflow: hidden; }
.exec-progress-bar { height: 100%; border-radius: 999px; background: var(--cyan); transition: width 600ms ease, background 300ms ease; }

/* --- I4: Activity Timeline --- */
.timeline-feed {
  margin-top: 10px; display: grid; gap: 0;
  border: 1px solid var(--line); border-radius: 10px;
  background: rgba(255,255,255,0.02); padding: 10px 8px;
  min-height: 260px; max-height: 500px; overflow: auto;
}
.timeline-item { display: grid; grid-template-columns: 28px 1fr; gap: 10px; min-height: 50px; }
.timeline-dot-col { display: flex; flex-direction: column; align-items: center; padding-top: 3px; }
.timeline-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 10px; border: 2px solid; background: transparent; }
.timeline-line-seg { flex: 1; width: 1px; background: var(--line-2); margin-top: 4px; min-height: 20px; }
.timeline-item:last-child .timeline-line-seg { display: none; }
.timeline-body { padding: 0 0 14px; }
.timeline-header { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.timeline-kind   { font-size: 12px; font-weight: 700; }
.timeline-when   { font-size: 11px; color: var(--muted); margin-left: auto; white-space: nowrap; }
.timeline-who    { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.timeline-summary{ font-size: 12px; color: var(--text); line-height: 1.4; }
.timeline-tail   { padding: 8px 0 0 38px; font-size: 11px; color: var(--muted); text-align: center; }

/* --- I7: Dashboard --- */
.dash-container { display: grid; gap: 20px; padding: 2px; }
.dash-stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; }
.dash-stat-tile {
  border: 1px solid var(--line); border-radius: 12px;
  background: rgba(255,255,255,0.02); padding: 14px; display: grid; gap: 6px;
  position: relative; overflow: hidden;
}
.dash-stat-tile::before { content: ""; position: absolute; top:0; left:0; right:0; height:2px; background: var(--ds-accent, var(--line)); }
.dash-stat-tile .ds-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.dash-stat-tile .ds-value { font-size: 28px; font-weight: 700; line-height: 1; color: var(--text); font-family: "Space Grotesk", sans-serif; }
.dash-stat-tile .ds-sub   { font-size: 11px; color: var(--muted); margin: 0; }
.dash-section-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin: 0 0 8px; opacity: 0.7; }
.dash-project-health { display: grid; gap: 8px; }
.dash-health-row {
  display: grid; grid-template-columns: minmax(0,1fr) 110px 90px; gap: 10px; align-items: center;
  border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,0.015);
  padding: 8px 12px; cursor: pointer; transition: border-color 120ms;
}
.dash-health-row:hover { border-color: rgba(255,255,255,0.14); }
.dash-health-row .dhr-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-health-bar-wrap { display: flex; align-items: center; gap: 6px; }
.dash-health-bar-track { flex: 1; height: 4px; border-radius: 999px; background: rgba(255,255,255,0.07); overflow: hidden; }
.dash-health-bar-fill  { height: 100%; border-radius: 999px; transition: width 400ms ease; }
.dash-health-pct    { font-size: 11px; color: var(--muted); white-space: nowrap; }
.dash-health-status { text-align: right; }
.dash-agents-row { display: flex; flex-wrap: wrap; gap: 8px; }
.dash-agent-chip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line-2); border-radius: 10px; padding: 6px 10px; background: rgba(255,255,255,0.02); font-size: 12px; color: var(--text); }
.dash-agent-chip .dac-avatar { width: 20px; height: 20px; border-radius: 5px; object-fit: contain; }
.dash-agent-chip .dac-name   { font-weight: 600; }
.dash-agent-chip .dac-meta   { color: var(--muted); font-size: 11px; }

/* --- I2: Agent Live Cards --- */
.agent-live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 8px; margin-top: 8px; }
.agent-live-card { border: 1px solid var(--line-2); border-radius: 10px; background: rgba(255,255,255,0.02); padding: 10px; display: grid; gap: 6px; transition: border-color 200ms; }
.agent-live-card.is-active { border-color: rgba(34,211,238,0.3); }
.alc-header { display: flex; align-items: center; gap: 7px; }
.alc-avatar  { width: 22px; height: 22px; border-radius: 6px; object-fit: contain; flex: 0 0 22px; }
.alc-name    { font-size: 12px; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alc-status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); flex: 0 0 6px; margin-left: auto; }
.alc-status-dot.active { background: var(--cyan); box-shadow: 0 0 0 3px rgba(34,211,238,0.16); animation: pcDotPulse 1.4s ease-in-out infinite; }
.alc-task   { font-size: 11px; color: var(--muted); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.alc-note   { font-size: 10px; color: var(--fg); opacity: 0.55; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-style: italic; }
.alc-tokens { font-size: 10px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 5px; }
.live-update-row { display: flex; gap: 8px; align-items: baseline; padding: 3px 0; border-bottom: 1px solid var(--line); font-size: 11px; line-height: 1.4; }
.live-update-row:last-child { border-bottom: none; }
.lu-time { color: var(--muted); flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.lu-text { color: var(--fg); opacity: 0.75; flex: 1; min-width: 0; }

/* --- I5: Task Map --- */
.task-map-wrapper { margin-bottom: 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,0.02); padding: 12px; overflow: hidden; }
.task-map-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.task-map-header h5 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0; }
.task-map-body { display: grid; grid-template-columns: repeat(5, minmax(110px,1fr)); gap: 8px; overflow-x: auto; }
.task-map-lane { display: grid; gap: 6px; align-content: start; }
.task-map-lane-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; padding: 3px 8px; border-radius: 999px; text-align: center; }
.task-map-lane-label.todo        { color: var(--muted);   background: rgba(255,255,255,0.05); }
.task-map-lane-label.in_progress { color: var(--yellow);  background: rgba(250,204,21,0.08);  }
.task-map-lane-label.blocked     { color: var(--red);     background: rgba(255,77,77,0.08);   }
.task-map-lane-label.review      { color: var(--blue);    background: rgba(59,130,246,0.08);  }
.task-map-lane-label.done        { color: var(--cyan);    background: rgba(34,211,238,0.08);  }
.task-map-node { border: 1px solid var(--line-2); border-radius: 8px; background: rgba(255,255,255,0.02); padding: 7px 8px; cursor: pointer; display: grid; gap: 3px; transition: border-color 120ms, background 120ms; }
.task-map-node:hover { background: rgba(255,255,255,0.05); }
.task-map-node.urgent { border-left: 2px solid var(--red);    }
.task-map-node.high   { border-left: 2px solid var(--orange); }
.task-map-node.medium { border-left: 2px solid var(--blue);   }
.task-map-node.low    { border-left: 2px solid var(--muted);  }
.tmn-title { font-size: 11px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tmn-meta  { font-size: 10px; color: var(--muted); }
.task-map-empty { color: var(--muted); font-size: 11px; text-align: center; padding: 8px 0; opacity: 0.5; }

/* --- I8: Enhanced Agent Status Badge --- */
.agent-status-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; padding: 2px 7px; border-radius: 999px; border: 1px solid; }
.agent-status-badge .asd { width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex: 0 0 5px; }
.agent-status-badge.active  { color: var(--cyan);   border-color: rgba(34,211,238,0.35);  background: rgba(34,211,238,0.07);  }
.agent-status-badge.idle    { color: var(--muted);  border-color: var(--line-2);           background: transparent;             }
.agent-status-badge.offline { color: var(--red);    border-color: rgba(255,77,77,0.35);   background: rgba(255,77,77,0.06);   }
.summary-agent-token-bar { display: grid; grid-template-columns: 70px 1fr auto; align-items: center; gap: 8px; margin-top: 4px; }
.summary-agent-token-bar .satb-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.summary-agent-token-bar .satb-track { height: 3px; border-radius: 999px; background: rgba(255,255,255,0.07); overflow: hidden; }
.summary-agent-token-bar .satb-fill  { height: 100%; border-radius: 999px; background: var(--cyan); transition: width 400ms; }
.summary-agent-token-bar .satb-val   { font-size: 10px; color: var(--muted); white-space: nowrap; }

/* --- I9: File tree visual enhancements --- */
.file-row.modified-recent { border-left: 2px solid rgba(250,204,21,0.5); }
.file-row.modified-recent .file-label { color: rgba(250,204,21,0.9); }

/* --- Responsive: collapse stat grid at narrow widths --- */
@media (max-width: 900px) {
  .dash-stat-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .task-map-body  { grid-template-columns: repeat(3, minmax(110px,1fr)); }
}
@media (max-width: 600px) {
  .exec-pipeline-nodes { grid-template-columns: 1fr; gap: 6px; }
  .exec-node-connector { width: 2px; height: 12px; }
}

/* ===== INBOX ===== */
.inbox-container { display: flex; flex-direction: column; height: 100%; }
.inbox-tabs { display: flex; gap: 2px; padding: 16px 20px 0; border-bottom: 1px solid var(--line-1); }
.inbox-tab { background: none; border: none; border-bottom: 2px solid transparent; color: var(--muted); font-size: 13px; font-weight: 500; padding: 8px 14px; cursor: pointer; transition: color 180ms, border-color 180ms; margin-bottom: -1px; }
.inbox-tab:hover { color: var(--text); }
.inbox-tab.active { color: var(--cyan); border-bottom-color: var(--cyan); }
.inbox-tab-pane { flex: 1; overflow-y: auto; padding: 16px 20px; }
.inbox-list { display: flex; flex-direction: column; gap: 8px; }
.inbox-item { background: var(--surface); border: 1px solid var(--line-1); border-radius: 8px; padding: 12px 14px; cursor: pointer; transition: border-color 180ms, background 180ms; }
.inbox-item:hover { border-color: var(--line-2); background: rgba(255,255,255,0.03); }
.inbox-item.unread { border-left: 3px solid var(--cyan); }
.inbox-item-header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.inbox-item-from { font-size: 12px; font-weight: 600; color: var(--text); }
.inbox-item-time { font-size: 11px; color: var(--muted); white-space: nowrap; }
.inbox-item-subject { font-size: 13px; color: var(--text); margin-bottom: 3px; }
.inbox-item-preview { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== ISSUES GLOBAL ===== */
.issues-container { padding: 20px; display: flex; flex-direction: column; gap: 20px; }
.issues-header { display: flex; align-items: baseline; gap: 10px; }
.issues-header h3 { margin: 0; }
.issues-section-label { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding: 4px 0; }
.issue-cards-list { display: flex; flex-direction: column; gap: 8px; }
.issue-card { background: var(--surface); border: 1px solid var(--line-1); border-radius: 8px; padding: 12px 14px; cursor: pointer; transition: border-color 180ms; }
.issue-card:hover { border-color: var(--line-2); }
.issue-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.issue-priority-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.issue-priority-dot.urgent { background: var(--red); }
.issue-priority-dot.high   { background: var(--orange); }
.issue-priority-dot.medium { background: var(--yellow); }
.issue-priority-dot.low    { background: var(--muted); }
.issue-card-title { font-size: 13px; font-weight: 600; color: var(--text); flex: 1; }
.issue-card-status { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); }
.issue-card-status.open        { color: var(--cyan);   border-color: rgba(34,211,238,0.3);  background: rgba(34,211,238,0.06);  }
.issue-card-status.in_progress { color: var(--yellow); border-color: rgba(250,204,21,0.3);  background: rgba(250,204,21,0.06);  }
.issue-card-status.resolved    { color: var(--muted);  border-color: var(--line-2);          background: transparent;             }
.issue-card-desc { font-size: 12px; color: var(--muted); margin-bottom: 6px; line-height: 1.45; }
.issue-card-meta { display: flex; gap: 10px; font-size: 11px; color: var(--muted); align-items: center; }
.issue-card-action { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--cyan); opacity: 0.8; }
.issue-card-status.pending { color: var(--orange); border-color: rgba(251,146,60,0.3); background: rgba(251,146,60,0.06); }

/* ===== ORG TREE (Team) ===== */
.org-tree-wrapper { position: relative; overflow: hidden; width: 100%; height: 420px; border-radius: 8px; border: 1px solid var(--line-1); background: var(--bg); cursor: grab; user-select: none; }
.org-tree-wrapper:active { cursor: grabbing; }
.org-tree-canvas { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.org-tree-svg { position: absolute; top: 0; left: 0; pointer-events: none; overflow: visible; }
.org-tree-nodes { position: relative; }
.org-node { position: absolute; width: 160px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 12px; cursor: pointer; transition: border-color 180ms, box-shadow 180ms; }
.org-node:hover { border-color: var(--cyan); box-shadow: 0 0 0 1px rgba(34,211,238,0.2); }
.org-node.root-node { border-color: var(--yellow); }
.org-node-avatar { width: 32px; height: 32px; border-radius: 50%; margin-bottom: 6px; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; }
.org-node-name { font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-node-role { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-node-status { width: 6px; height: 6px; border-radius: 50%; position: absolute; top: 8px; right: 8px; }
.org-node-status.active  { background: var(--cyan); box-shadow: 0 0 4px var(--cyan); }
.org-node-status.idle    { background: var(--muted); }
.org-node-status.offline { background: var(--red); }
.org-tree-connector { fill: none; stroke: var(--line-2); stroke-width: 1.5; }

/* ===== SETTINGS ===== */
.settings-container { display: flex; flex-direction: column; height: 100%; }
.settings-tabs { display: flex; gap: 2px; padding: 16px 20px 0; border-bottom: 1px solid var(--line-1); }
.settings-tab { background: none; border: none; border-bottom: 2px solid transparent; color: var(--muted); font-size: 13px; font-weight: 500; padding: 8px 14px; cursor: pointer; transition: color 180ms, border-color 180ms; margin-bottom: -1px; }
.settings-tab:hover { color: var(--text); }
.settings-tab.active { color: var(--yellow); border-bottom-color: var(--yellow); }
.settings-tab-pane { flex: 1; overflow-y: auto; padding: 20px; }
.settings-policy-content { display: flex; flex-direction: column; gap: 12px; }

/* ===== PROJECT ISSUES PANEL ===== */
#project_panel_issues .issues-section-label { margin-top: 16px; }

/* ===== NEW PROJECT / NAV TOP ACTION ===== */
.nav-top-actions { padding: 4px 0 4px; }
.new-project-btn { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border-radius: 8px; border: none; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; transition: background 180ms, color 180ms; }
.new-project-btn:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.new-project-btn .icon-svg { flex: 0 0 14px; width: 14px; height: 14px; stroke: currentColor; opacity: 0.65; }

/* ===== TASK MAP — SVG DAG ===== */
.task-map-wrapper { position: relative; }
.tmap-viewport { position: relative; overflow: hidden; width: 100%; height: 480px; border-radius: 8px; border: 1px solid var(--line-1); background: var(--bg); cursor: grab; user-select: none; }
.tmap-viewport:active { cursor: grabbing; }
.tmap-canvas { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.tmap-svg { position: absolute; top: 0; left: 0; pointer-events: none; }
.tmap-nodes { position: relative; }
.tmap-col-header { position: absolute; top: 4px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; }
.tmap-col-count { opacity: 0.6; font-weight: 400; }
.tmap-node { position: absolute; width: 176px; background: var(--surface); border: 1px solid var(--line-2); border-left: 3px solid var(--tnode-accent, var(--muted)); border-radius: 6px; cursor: pointer; display: flex; align-items: stretch; overflow: hidden; transition: box-shadow 180ms, border-color 180ms; }
.tmap-node:hover { box-shadow: 0 0 0 1px var(--tnode-accent, var(--line-2)); border-color: var(--tnode-accent, var(--line-2)); }
.tmap-node-body { padding: 10px 10px 8px; flex: 1; min-width: 0; }
.tmap-node-title { font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px; }
.tmap-node-meta { font-size: 10px; color: var(--muted); }
.tmap-edge { fill: none; stroke: var(--line-2); stroke-width: 1.5; }
.task-highlight { outline: 2px solid var(--yellow); border-radius: 6px; }

/* ===== DASHBOARD CHARTS ===== */
.dash-charts-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; margin-bottom: 20px; }
.dash-chart-card { background: var(--surface); border: 1px solid var(--line-1); border-radius: 8px; padding: 14px 16px; }
.dash-chart-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin-bottom: 10px; }
.dash-chart-sub { font-weight: 400; opacity: 0.6; }
/* Run Activity Bar Chart */
.dash-bar-chart { display: flex; align-items: flex-end; gap: 3px; height: 64px; }
.dbc-col { display: flex; flex-direction: column; align-items: center; flex: 1; }
.dbc-bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.dbc-bar { width: 100%; display: flex; flex-direction: column-reverse; border-radius: 2px 2px 0 0; overflow: hidden; min-height: 2px; }
.dbc-seg { flex-shrink: 0; }
.dbc-label { font-size: 9px; color: var(--muted); margin-top: 3px; white-space: nowrap; }
.dash-bar-legend { display: flex; gap: 12px; margin-top: 8px; }
.dbl-item { font-size: 10px; color: var(--muted); }
.dbl-item::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--dbl-c); margin-right: 4px; vertical-align: middle; }
/* Horizontal bars */
.dash-h-bars { display: flex; flex-direction: column; gap: 8px; }
.dhb-row { display: grid; grid-template-columns: 70px 1fr 28px; align-items: center; gap: 8px; }
.dhb-label { font-size: 11px; color: var(--text); }
.dhb-track { height: 6px; border-radius: 999px; background: rgba(255,255,255,0.06); overflow: hidden; }
.dhb-fill { height: 100%; border-radius: 999px; transition: width 400ms; }
.dhb-val { font-size: 11px; color: var(--muted); text-align: right; }
/* Success rate */
.dash-success-rate-wrap { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.dsr-value { font-size: 36px; font-weight: 800; font-family: var(--font-head); color: var(--text); line-height: 1; }
.dsr-track { width: 100%; height: 8px; border-radius: 999px; background: rgba(255,255,255,0.06); overflow: hidden; }
.dsr-fill { height: 100%; border-radius: 999px; transition: width 600ms; }

/* ===== AGENT DETAIL MODAL ===== */
.agent-modal { background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; padding: 0; width: min(520px, 96vw); max-height: 90vh; overflow: hidden; box-shadow: 0 24px 48px rgba(0,0,0,0.6); color: var(--text); }
.agent-modal::backdrop { background: rgba(0,0,0,0.65); backdrop-filter: blur(4px); }
.agent-modal-inner { display: flex; flex-direction: column; max-height: 90vh; }
.agent-modal-header { display: flex; align-items: center; gap: 14px; padding: 20px 20px 16px; border-bottom: 1px solid var(--line-1); }
.modal-agent-avatar { flex: 0 0 48px; }
.modal-agent-title { flex: 1; min-width: 0; }
.modal-agent-title h3 { margin: 0 0 4px; font-size: 16px; }
.modal-close-btn { background: none; border: none; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 6px; transition: color 180ms, background 180ms; }
.modal-close-btn:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.modal-close-btn .icon-svg { width: 18px; height: 18px; stroke: currentColor; }
.agent-modal-body { overflow-y: auto; padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 16px; }
.agent-detail-dl { display: flex; flex-direction: column; gap: 6px; }
.agent-detail-row { display: grid; grid-template-columns: 100px 1fr; gap: 8px; font-size: 13px; }
.agent-detail-row dt { color: var(--muted); font-weight: 500; }
.agent-detail-row dd { color: var(--text); margin: 0; word-break: break-all; }
.agent-modal-section { display: flex; flex-direction: column; gap: 6px; }
.agent-modal-section-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.agent-modal-project-row { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 4px 0; }
.agent-modal-projects { display: flex; flex-direction: column; gap: 2px; }
.agent-modal-tokens { width: 100%; }

@media (max-width: 900px) {
  .dash-charts-grid { grid-template-columns: 1fr; }
}

/* ===== ORG NODE LIVE LINE ===== */
.org-node-live { display: flex; align-items: center; gap: 4px; margin-top: 5px; border-top: 1px solid var(--line-1); padding-top: 4px; }
.org-node-idle { opacity: 0.5; }

/* ===== PROGRESS MAP ===== */
.pmap-section { margin-bottom: 16px; }
.pmap-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.pmap-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.pmap-viewport { position: relative; overflow: hidden; width: 100%; height: 380px; border: 1px solid var(--line-1); border-radius: 8px; background: var(--bg); cursor: grab; user-select: none; }
.pmap-viewport:active { cursor: grabbing; }
.pmap-canvas { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.pmap-svg { position: absolute; top: 0; left: 0; pointer-events: none; }
.pmap-nodes { position: relative; }
.pmap-edge { fill: none; stroke: var(--line-2); stroke-width: 1.5; }

/* Root project node */
.pmap-root-node { position: absolute; display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line-2); border-top: 3px solid var(--pmap-accent, var(--cyan)); border-radius: 8px; cursor: default; }
.pmap-root-pill { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.pmap-root-title { font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }

/* Task node */
.pmap-node { position: absolute; background: var(--surface); border: 1px solid var(--line-2); border-left: 3px solid var(--pmap-accent, var(--muted)); border-radius: 6px; padding: 9px 10px 8px; cursor: pointer; transition: box-shadow 180ms; }
.pmap-node:hover { box-shadow: 0 0 0 1px var(--pmap-accent, var(--line-2)); }
.pmap-node-title { font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px; }
.pmap-node-agent { font-size: 10px; font-weight: 600; }
.pmap-node-status { position: absolute; bottom: 5px; right: 7px; width: 5px; height: 5px; border-radius: 50%; }

/* Issue indicator dot — pulsing */
.pmap-issue-dot { position: absolute; top: -5px; right: -5px; width: 13px; height: 13px; border-radius: 50%; z-index: 2; cursor: pointer; animation: pmap-pulse 1.2s ease-in-out infinite; border: 2px solid var(--bg); }
@keyframes pmap-pulse {
  0%,100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.35); opacity: 0.7; }
}

/* ===== AGENT LIVE LINE ===== */
.summary-agent-live { display: flex; align-items: center; gap: 5px; margin: 3px 0 5px; }
.sal-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); flex: 0 0 6px; animation: pipelinePulse 1.4s ease-in-out infinite; }
.sal-text { font-size: 11px; color: var(--cyan); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sal-idle { color: var(--muted); }

/* ===== TASK DAG ===== */
.task-dag-wrap { position: relative; width: 100%; height: 220px; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-bottom: 12px; user-select: none; }
.task-dag-viewport { width: 100%; height: 100%; overflow: hidden; position: relative; cursor: grab; }
.task-dag-viewport:active { cursor: grabbing; }
.task-dag-canvas { position: absolute; top: 0; left: 0; }
.task-dag-svg { position: absolute; top: 0; left: 0; pointer-events: none; overflow: visible; }
.task-dag-nodes { position: absolute; top: 0; left: 0; }
.task-dag-hint { position: absolute; bottom: 6px; right: 10px; font-size: 10px; color: var(--muted); pointer-events: none; }
.tdag-node { position: absolute; width: 130px; background: var(--surface3); border: 1.5px solid var(--border); border-radius: 7px; cursor: pointer; transition: border-color 0.15s; display: flex; flex-direction: column; }
.tdag-node:hover { border-color: var(--cyan); }
.tdag-node-bar { height: 3px; border-radius: 7px 7px 0 0; background: var(--tdag-color, var(--border)); }
.tdag-node-body { padding: 6px 8px 5px; }
.tdag-node-title { font-size: 11px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px; }
.tdag-node-meta { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tdag-node-port { position: absolute; right: -7px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; background: var(--surface3); border: 1.5px solid var(--border); border-radius: 50%; cursor: crosshair; z-index: 2; transition: background 0.15s; }
.tdag-node-port:hover { background: var(--cyan); border-color: var(--cyan); }
.tdag-edge { fill: none; stroke: var(--border); stroke-width: 1.5; marker-end: url(#dag-arrow); }
.tdag-drag-line { fill: none; stroke: var(--cyan); stroke-width: 1.5; stroke-dasharray: 4 3; pointer-events: none; }

/* ===== COMPACT TASK ROWS ===== */
.task-srow { border: 1px solid var(--border); border-radius: 7px; margin-bottom: 6px; background: var(--surface2); overflow: hidden; }
.task-srow.expanded { border-color: var(--cyan); }
.task-srow-head { display: flex; align-items: center; gap: 8px; padding: 7px 10px; cursor: default; }
.task-srow-dot { width: 11px; height: 11px; border-radius: 50%; border: none; cursor: pointer; flex: 0 0 11px; padding: 0; }
.task-srow-dot.status-todo        { background: var(--muted); }
.task-srow-dot.status-in_progress { background: var(--cyan); box-shadow: 0 0 5px var(--cyan); animation: pipelinePulse 1.4s ease-in-out infinite; }
.task-srow-dot.status-review      { background: var(--purple); }
.task-srow-dot.status-blocked     { background: var(--red); }
.task-srow-dot.status-done        { background: var(--green); }
.task-srow-title { flex: 1; font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-srow-badges { display: flex; gap: 5px; flex: 0 0 auto; }
.task-srow-pri { font-size: 10px; padding: 1px 6px; border-radius: 10px; font-weight: 600; text-transform: uppercase; }
.task-srow-pri.pri-critical { background: rgba(239,68,68,.18); color: #ef4444; }
.task-srow-pri.pri-high     { background: rgba(249,115,22,.18); color: #f97316; }
.task-srow-pri.pri-medium   { background: rgba(234,179,8,.18);  color: #eab308; }
.task-srow-pri.pri-low      { background: rgba(99,102,241,.18); color: #818cf8; }
.task-srow-agent { font-size: 10px; color: var(--muted); }
.task-srow-toggle { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 10px; padding: 2px 4px; }
.task-srow-toggle:hover { color: var(--text); }
.task-srow-detail { padding: 8px 12px 10px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.task-srow-desc { font-size: 12px; color: var(--text-2, var(--muted)); margin: 0; line-height: 1.5; }
.blocked-desc { color: var(--red) !important; }
.task-srow-controls { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.task-srow-controls select { font-size: 11px; padding: 3px 6px; height: 26px; }
.task-srow-controls button { font-size: 11px; padding: 3px 10px; height: 26px; }

/* ===== NEW TASK MODAL ===== */
.ntask-dialog { background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 0; max-width: 480px; width: 100%; color: var(--text); box-shadow: 0 8px 32px rgba(0,0,0,.45); }
.ntask-dialog::backdrop { background: rgba(0,0,0,.55); }
.ntask-inner { display: flex; flex-direction: column; }
.ntask-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 10px; border-bottom: 1px solid var(--border); }
.ntask-header h3 { margin: 0; font-size: 15px; font-weight: 600; }
.ntask-header button { background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; line-height: 1; padding: 0 2px; }
.ntask-header button:hover { color: var(--text); }
.ntask-body { padding: 14px 18px; display: flex; flex-direction: column; gap: 12px; }
.ntask-row { display: flex; gap: 12px; }
.ntask-col { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.field-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.field-hint  { font-size: 10px; color: var(--muted); margin-top: 2px; }
.ntask-body input, .ntask-body select, .ntask-body textarea { width: 100%; box-sizing: border-box; }
.ntask-body textarea { resize: vertical; min-height: 70px; font-size: 12px; }
.ntask-footer { padding: 10px 18px 14px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.ntask-actions { display: flex; justify-content: flex-end; gap: 8px; }
#ntask_msg { font-size: 12px; min-height: 16px; }
#ntask_msg.error { color: var(--red); }


/* ===== PROJECT MAP — mixed Agent+Task nodes ===== */
.pmap-mnode { position: absolute; border-radius: 8px; border: 1.5px solid var(--border); background: var(--surface3); display: flex; flex-direction: column; overflow: hidden; transition: border-color 0.15s, box-shadow 0.15s; user-select: none; }
.pmap-mnode:hover { border-color: var(--pmap-accent, var(--cyan)); box-shadow: 0 0 0 2px color-mix(in srgb, var(--pmap-accent, var(--cyan)) 25%, transparent); }
.pmap-mnode-agent { border-style: dashed; }
.pmap-mnode-bar { height: 3px; flex: 0 0 3px; background: var(--pmap-accent, var(--border)); }
.pmap-mnode-body { padding: 5px 8px 6px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.pmap-mnode-label { font-size: 11px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pmap-mnode-sub { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pmap-edge { fill: none; stroke: rgba(148,163,184,0.3); stroke-width: 1.5; }
.pmap-edge-dep { stroke: rgba(99,202,255,0.45); stroke-width: 1.5; }

/* ===== TASK DETAIL MODAL ===== */
.tdm-dialog { background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; padding: 0; max-width: 580px; width: 100%; color: var(--text); box-shadow: 0 12px 40px rgba(0,0,0,.55); max-height: 85vh; }
.tdm-dialog[open] { display: flex; flex-direction: column; }
.tdm-dialog::backdrop { background: rgba(0,0,0,.6); }
.tdm-inner { display: flex; flex-direction: column; min-height: 0; flex: 1; overflow: hidden; }
.tdm-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 10px; border-bottom: 1px solid var(--border); flex: 0 0 auto; gap: 10px; }
.tdm-header-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.tdm-header h3 { margin: 0; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tdm-header button { background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; flex: 0 0 auto; }
.tdm-header button:hover { color: var(--text); }
.tdm-status-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 10px; }
.tdm-status-dot.status-todo        { background: var(--muted); }
.tdm-status-dot.status-in_progress { background: var(--cyan); box-shadow: 0 0 6px var(--cyan); animation: pipelinePulse 1.4s ease-in-out infinite; }
.tdm-status-dot.status-blocked     { background: var(--red); }
.tdm-status-dot.status-review      { background: var(--purple); }
.tdm-status-dot.status-done        { background: var(--green); }
.tdm-meta-row { display: flex; gap: 0; border-bottom: 1px solid var(--border); flex: 0 0 auto; }
.tdm-meta-item { display: flex; flex-direction: column; gap: 2px; padding: 8px 14px; flex: 1; border-right: 1px solid var(--border); }
.tdm-meta-item:last-child { border-right: none; }
.tdm-meta-label { font-size: 9px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.tdm-meta-item > span:last-child { font-size: 12px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tdm-io-row { display: flex; gap: 0; border-bottom: 1px solid var(--border); flex: 0 0 auto; }
.tdm-io-col { flex: 1; padding: 8px 14px; border-right: 1px solid var(--border); }
.tdm-io-col:last-child { border-right: none; }
.tdm-section-label { font-size: 9px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 5px; }
.tdm-io-list { display: flex; flex-wrap: wrap; gap: 4px; min-height: 22px; }
.tdm-io-chip { font-size: 10px; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface3); cursor: pointer; white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.tdm-io-chip:hover { border-color: var(--cyan); }
.tdm-io-chip.status-done        { border-color: var(--green); color: var(--green); }
.tdm-io-chip.status-in_progress { border-color: var(--cyan); color: var(--cyan); }
.tdm-io-chip.status-blocked     { border-color: var(--red); color: var(--red); }
.tdm-io-chip.status-review      { border-color: var(--purple); color: var(--purple); }
.tdm-io-empty { font-size: 11px; color: var(--muted); }
.tdm-body { flex: 1; overflow-y: auto; padding: 12px 18px; display: flex; flex-direction: column; gap: 10px; }
.tdm-desc { font-size: 12px; color: var(--text); margin: 0; line-height: 1.6; white-space: pre-wrap; }
.tdm-empty { font-size: 11px; color: var(--muted); margin: 0; }
.tdm-issue-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.tdm-issue-row:last-child { border-bottom: none; }
.tdm-issue-label { font-size: 12px; flex: 1; color: var(--red); }
.tdm-issue-comment { font-size: 11px; padding: 3px 8px; height: 26px; flex: 0 0 180px; }
.tdm-comments-list { display: flex; flex-direction: column; gap: 6px; }
.tdm-comment-row { background: var(--surface3); border-radius: 6px; padding: 6px 10px; }
.tdm-comment-author { font-size: 10px; font-weight: 600; color: var(--muted); display: block; margin-bottom: 2px; }
.tdm-comment-body { font-size: 12px; margin: 0; color: var(--text); line-height: 1.5; }
.tdm-comment-form { display: flex; gap: 6px; }
.tdm-comment-form input { flex: 1; }
.tdm-footer { padding: 8px 18px 12px; border-top: 1px solid var(--border); flex: 0 0 auto; display: flex; flex-direction: column; gap: 4px; }
.tdm-controls { display: flex; flex-wrap: wrap; gap: 6px; }
.tdm-controls select { font-size: 11px; height: 26px; padding: 0 6px; }
#tdm_msg.error { color: var(--red); }
