:root {
  color-scheme: dark;
  --bg: #08111f;
  --bg-2: #0e1a2d;
  --panel: rgba(12, 24, 42, 0.78);
  --panel-strong: #12233d;
  --line: rgba(137, 171, 214, 0.16);
  --line-strong: rgba(137, 171, 214, 0.3);
  --ink: #edf4ff;
  --muted: #8ca2c0;
  --accent: #4dd6c6;
  --accent-2: #ff9e57;
  --accent-3: #89b4ff;
  --danger: #ff6a7a;
  --success: #6de28a;
  --warning: #ffd166;
  --shadow: 0 24px 80px rgba(2, 8, 19, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100vh;
}

body {
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 14%, rgba(77, 214, 198, 0.14), transparent 22%),
    radial-gradient(circle at 88% 12%, rgba(255, 158, 87, 0.12), transparent 24%),
    radial-gradient(circle at 50% 100%, rgba(137, 180, 255, 0.1), transparent 30%),
    linear-gradient(180deg, #07101b 0%, var(--bg) 50%, #040912 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(137, 171, 214, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(137, 171, 214, 0.04) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(circle at center, black 45%, transparent 90%);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 16px;
  padding: 0.8rem 1rem;
  color: #04131c;
  background: linear-gradient(135deg, var(--accent), #6fe3d7);
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease, box-shadow 140ms ease;
  box-shadow: 0 10px 30px rgba(77, 214, 198, 0.22);
}

button:hover {
  transform: translateY(-1px);
}

button.ghost {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  box-shadow: none;
}

button.small {
  padding: 0.45rem 0.75rem;
  border-radius: 12px;
  font-size: 0.88rem;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.9rem 1rem;
  color: var(--ink);
  background: rgba(6, 14, 26, 0.8);
}

textarea {
  resize: vertical;
}

.app-shell {
  width: min(1800px, calc(100vw - 1.5rem));
  margin: 0.75rem auto;
}

.workspace-shell {
  display: grid;
  gap: 1rem;
  grid-template-columns: 350px minmax(0, 1fr);
}

.left-rail {
  display: grid;
  gap: 1rem;
  align-content: start;
}

.board-layout {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(540px, 1.2fr) minmax(420px, 0.95fr);
  min-width: 0;
}

.board-panel,
.detail-panel,
.panel,
.brand-card,
.detail-card,
.auth-card {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.panel,
.brand-card,
.detail-card,
.auth-card {
  padding: 1.15rem;
}

.board-panel {
  padding: 1.15rem;
  overflow: hidden;
}

.detail-panel {
  padding: 0;
  overflow: hidden;
}

.auth-card {
  max-width: 620px;
  margin: 8vh auto;
}

.brand-card h1,
.auth-card h1,
.section-head h2,
.detail-card h2,
.detail-card h3 {
  margin: 0;
  font-family: "Avenir Next Condensed", "Arial Narrow", sans-serif;
  letter-spacing: 0.01em;
}

.lede,
.project-summary,
.panel p,
.detail-card p {
  color: var(--muted);
  line-height: 1.5;
}

.eyebrow,
.field-label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--accent);
}

.field-label {
  display: block;
  margin-bottom: 0.45rem;
}

.muted {
  color: var(--muted);
}

.small-copy {
  font-size: 0.86rem;
}

.stack {
  display: grid;
  gap: 0.85rem;
}

.compact {
  gap: 0.7rem;
}

.section-head,
.composer-actions,
.head-stats,
.meta-grid,
.agent-meta,
.thread-meta,
.project-stats,
.identity-block,
.session-meta,
.composer-tools,
.top-head {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.section-head {
  justify-content: space-between;
}

.tight {
  align-items: flex-start;
}

.top-head,
.composer-actions {
  justify-content: space-between;
}

.head-stats,
.agent-meta,
.thread-meta,
.project-stats,
.session-meta,
.composer-tools {
  flex-wrap: wrap;
}

.board-panel .top-head {
  margin-bottom: 1rem;
}

.project-board {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(5, minmax(200px, 1fr));
  overflow-x: auto;
  padding-bottom: 0.4rem;
}

.board-column {
  min-width: 0;
  border: 1px solid rgba(137, 171, 214, 0.08);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.02);
  padding: 0.9rem;
}

.column-stack,
.agent-list,
.automation-list,
.activity-stream {
  display: grid;
  gap: 0.75rem;
}

.project-card,
.agent-card,
.automation-card,
.activity-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 0.95rem;
  background: rgba(255, 255, 255, 0.035);
}

.project-card {
  cursor: pointer;
}

.project-card.selected {
  border-color: rgba(77, 214, 198, 0.55);
  box-shadow: inset 0 0 0 1px rgba(77, 214, 198, 0.4);
}

.project-card p,
.agent-card p,
.automation-card p,
.activity-card p {
  margin: 0.55rem 0 0;
}

.status-pill,
.stat-chip,
.mini-chip,
.thread-pill,
.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.38rem 0.7rem;
  font-size: 0.82rem;
}

.status-pill,
.stat-chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
}

.status-pill.critical {
  color: #111;
  background: linear-gradient(135deg, #ffb284, #ff7b6b);
}

.status-pill.high {
  color: #111;
  background: linear-gradient(135deg, #ffd166, #ffb84d);
}

.status-pill.medium,
.status-pill.active {
  color: #04131c;
  background: linear-gradient(135deg, var(--accent), #7de7da);
}

.status-pill.low,
.status-pill.idle,
.status-pill.planning,
.status-pill.review {
  color: var(--ink);
  background: rgba(137, 180, 255, 0.14);
}

.status-pill.blocked,
.status-pill.paused,
.status-pill.offline {
  color: #ffd9df;
  background: rgba(255, 106, 122, 0.18);
}

.status-pill.cooldown {
  color: #ffedbf;
  background: rgba(255, 209, 102, 0.18);
}

.status-pill.done {
  color: #d6ffe1;
  background: rgba(109, 226, 138, 0.18);
}

.live-dot {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}

.live-dot.connected {
  color: #04131c;
  background: linear-gradient(135deg, var(--success), #9df0b0);
}

.mini-chip,
.selectable-chip,
.thread-pill {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
}

.selectable-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
}

.selectable-chip input {
  width: auto;
}

.thread-pill-row,
.mini-chip-row,
.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.thread-pill {
  cursor: pointer;
  padding: 0.5rem 0.8rem;
}

.thread-pill.selected {
  border-color: rgba(77, 214, 198, 0.5);
  background: rgba(77, 214, 198, 0.1);
}

.pill-suffix {
  color: var(--accent);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.meta-grid {
  justify-content: space-between;
  align-items: flex-start;
  margin-top: 1rem;
}

.meta-grid > div {
  flex: 1 1 30%;
  min-width: 0;
}

.detail-shell,
.detail-panel {
  height: 100%;
}

#detail-shell {
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.activity-panel {
  min-height: 280px;
}

.activity-stream {
  max-height: 46vh;
  overflow: auto;
  padding-right: 0.35rem;
}

.activity-card.user {
  border-color: rgba(77, 214, 198, 0.24);
}

.activity-card.agent {
  border-color: rgba(137, 180, 255, 0.24);
}

.activity-card.system {
  border-color: rgba(255, 209, 102, 0.24);
}

.message-attachments,
.pending-list {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.attachment-card,
.pending-attachment {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem 0.85rem;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.attachment-card {
  color: inherit;
  text-decoration: none;
}

.attachment-card span {
  color: var(--muted);
}

.upload-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1rem;
  border: 1px dashed rgba(77, 214, 198, 0.4);
  border-radius: 16px;
  background: rgba(77, 214, 198, 0.06);
  cursor: pointer;
}

.upload-trigger input {
  display: none;
}

.toggle-row {
  display: inline-flex;
  gap: 0.55rem;
  align-items: center;
  color: var(--muted);
}

.toggle-row input {
  width: auto;
}

.inline-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-stack {
  display: grid;
  gap: 0.4rem;
}

.command-box {
  display: block;
  margin-top: 0.6rem;
  padding: 0.9rem;
  border-radius: 18px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: rgba(5, 11, 22, 0.85);
  border: 1px solid var(--line);
  color: #c7d8f2;
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.82rem;
}

.empty-column,
.empty-detail {
  border: 1px dashed var(--line);
  border-radius: 20px;
  padding: 1rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
}

@media (max-width: 1280px) {
  .workspace-shell,
  .board-layout {
    grid-template-columns: 1fr;
  }

  .project-board {
    grid-template-columns: repeat(5, minmax(240px, 1fr));
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100vw, calc(100vw - 0.8rem));
  }

  .inline-grid {
    grid-template-columns: 1fr;
  }

  .project-board {
    grid-template-columns: repeat(5, minmax(220px, 1fr));
  }

  .top-head,
  .section-head,
  .composer-actions {
    align-items: flex-start;
    flex-direction: column;
  }
}
