@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@500;600;700;800&display=swap');

:root {
  --bg: #071419;
  --panel: rgba(10, 24, 30, 0.88);
  --panel-strong: #0b1e25;
  --panel-soft: rgba(16, 34, 41, 0.9);
  --line: rgba(137, 176, 186, 0.18);
  --line-strong: rgba(137, 176, 186, 0.32);
  --text: #e9f4f4;
  --muted: #99afb5;
  --faint: #6e8790;
  --accent: #00d0aa;
  --accent-2: #7ce8c8;
  --danger: #ff7c93;
  --warning: #ffd36a;
  --good: #7ef1a3;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  --radius: 22px;
  --radius-sm: 16px;
  --max: 1600px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  background:
    radial-gradient(circle at top left, rgba(0, 208, 170, 0.18), transparent 28%),
    radial-gradient(circle at 90% 10%, rgba(124, 232, 200, 0.12), transparent 24%),
    linear-gradient(180deg, #091a21 0%, #061116 100%);
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; text-decoration: none; }

.skip {
  position: absolute;
  left: -999px;
  top: 1rem;
  background: white;
  color: #072127;
  padding: 0.8rem 1rem;
  border-radius: 999px;
  z-index: 100;
}
.skip:focus { left: 1rem; }

.shell {
  max-width: var(--max);
  margin: 0 auto;
  padding: 18px;
}

.panel {
  background: linear-gradient(180deg, rgba(12, 28, 35, 0.92), rgba(9, 20, 26, 0.94));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.topbar {
  border-radius: 28px;
  padding: 18px 22px;
  display: grid;
  grid-template-columns: minmax(280px, 1.2fr) auto auto;
  gap: 18px;
  align-items: center;
}

.brand-wrap { display: grid; gap: 8px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  letter-spacing: -0.05em;
  font-size: 1.15rem;
}
.brand img { display: block; }
.brand-wrap p,
.board-copy,
.summary-text,
.section-note,
.muted {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.topbar-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(68px, auto));
  gap: 10px;
}
.topbar-stats div {
  min-width: 88px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}
.topbar-stats strong {
  display: block;
  font-family: 'Manrope', sans-serif;
  font-size: 1.18rem;
  letter-spacing: -0.04em;
}
.topbar-stats span {
  font-size: 0.82rem;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

button,
.ghost,
.primary,
.chip,
.file-button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, border-color .18s ease, color .18s ease, opacity .18s ease;
}
button:hover,
.ghost:hover,
.primary:hover,
.chip:hover,
.file-button:hover {
  transform: translateY(-1px);
}

.ghost,
.primary,
.chip,
.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 42px;
  padding: 0 15px;
  text-align: center;
}

.ghost,
.file-button {
  background: rgba(255,255,255,.03);
  color: var(--text);
  border: 1px solid var(--line);
}
.primary {
  background: linear-gradient(135deg, var(--accent), #1fbfef);
  color: #042029;
  font-weight: 800;
}
.chip {
  background: rgba(255,255,255,.04);
  color: var(--text);
  border: 1px solid var(--line);
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.92rem;
}
.file-button input { display: none; }

.workspace-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 380px;
  gap: 20px;
  align-items: start;
}

.sidebar,
.main,
.inspector {
  border-radius: 28px;
  padding: 18px;
}

.sidebar,
.inspector {
  position: sticky;
  top: 18px;
}

.sidebar {
  display: grid;
  gap: 16px;
}

.subpanel {
  padding: 16px;
  border-radius: 22px;
  background: rgba(255,255,255,.02);
  border: 1px solid var(--line);
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}
.section-head h2,
.section-head h3,
.board-head h1,
.board-head p,
.subpanel h3,
.subpanel h4 { margin: 0; }
.section-head h2,
.section-head h3,
.board-head h1,
.subpanel h3 {
  font-family: 'Manrope', sans-serif;
  letter-spacing: -0.04em;
}
.section-head h2,
.subpanel h3 { font-size: 1.02rem; }

.company-list {
  display: grid;
  gap: 10px;
}
.company-card {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255,255,255,.02);
  border: 1px solid transparent;
  text-align: left;
}
.company-card.active {
  border-color: color-mix(in srgb, var(--company-color, var(--accent)) 60%, white 10%);
  background: linear-gradient(135deg, rgba(0,208,170,.14), rgba(255,255,255,.03));
}
.company-marker {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--company-color, var(--accent));
  box-shadow: 0 0 0 4px rgba(255,255,255,.03);
}
.company-card strong {
  display: block;
  font-size: 1rem;
}
.company-card small {
  color: var(--muted);
}
.company-chip {
  align-self: start;
  white-space: nowrap;
  color: var(--text);
  opacity: .9;
}

.form-grid {
  display: grid;
  gap: 10px;
}
.form-grid.compact { gap: 10px; }
.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.92rem;
}
.form-grid label.full { grid-column: 1 / -1; }
.form-grid input,
.form-grid select,
.form-grid textarea,
.toolbar select,
.toolbar input {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(137, 176, 186, 0.16);
  background: rgba(4, 13, 17, 0.75);
  color: var(--text);
  padding: 12px 14px;
  outline: none;
}
.form-grid textarea { resize: vertical; min-height: 112px; }
.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus,
.toolbar select:focus,
.toolbar input:focus {
  border-color: rgba(0,208,170,.5);
  box-shadow: 0 0 0 4px rgba(0,208,170,.1);
}

.main {
  display: grid;
  gap: 18px;
  min-width: 0;
}
.toolbar {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
}
.search-wrap { flex: 1; }
.filters {
  display: flex;
  gap: 10px;
}
.filters select { min-width: 150px; }

.board-head {
  display: grid;
  gap: 10px;
}
.board-head h1 {
  font-size: clamp(1.8rem, 2.4vw, 3rem);
}
.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.17em;
  font-size: 0.76rem;
  color: var(--accent-2);
}

.board {
  display: grid;
  grid-template-columns: repeat(6, minmax(240px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 6px;
}
.column {
  min-width: 220px;
  border-radius: 22px;
  background: rgba(255,255,255,.02);
  border: 1px solid var(--line);
  display: grid;
  grid-template-rows: auto 1fr;
}
.column-head {
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--line);
}
.column-head strong {
  font-size: 0.98rem;
  display: block;
}
.column-head span {
  color: var(--muted);
  font-size: 0.82rem;
}
.column-body {
  padding: 12px;
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 120px;
}
.empty-state {
  border: 1px dashed rgba(137,176,186,.22);
  color: var(--muted);
  border-radius: 18px;
  padding: 14px;
  line-height: 1.5;
}
.task-card {
  padding: 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(10, 24, 30, 0.94), rgba(8, 19, 24, 0.92));
  border: 1px solid rgba(137,176,186,.16);
  display: grid;
  gap: 10px;
  cursor: pointer;
}
.task-card.selected {
  outline: 2px solid rgba(0,208,170,.55);
}
.task-card:hover { border-color: rgba(0,208,170,.45); }
.task-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
}
.task-top h4 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.35;
}
.task-desc {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.5;
}
.task-meta,
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.badge,
.status-badge,
.priority-badge,
.agent-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  border: 1px solid rgba(137,176,186,.16);
  background: rgba(255,255,255,.03);
  color: var(--text);
}
.priority-urgent { color: #2a050f; background: #ffd0db; }
.priority-high { color: #2a2000; background: #ffe39d; }
.priority-medium { color: #042029; background: #91dffd; }
.priority-low { color: #072127; background: #bdeed1; }
.status-badge[data-status="blocked"] { background: rgba(255,124,147,.15); color: #ffc3cf; }
.status-badge[data-status="review"] { background: rgba(255,211,106,.14); color: #ffe5a5; }
.status-badge[data-status="doing"] { background: rgba(124,232,200,.13); color: #b7f8e8; }
.status-badge[data-status="done"] { background: rgba(126,241,163,.13); color: #caf6d5; }
.column.drag-over {
  border-color: rgba(124,232,200,.55);
  box-shadow: 0 0 0 1px rgba(124,232,200,.18) inset, 0 0 0 1px rgba(124,232,200,.1);
  background: rgba(124,232,200,.06);
}

.column {
  min-width: 240px;
  border-radius: 24px;
  background: rgba(255,255,255,.02);
  border: 1px solid var(--line);
  padding: 12px;
  display: grid;
  gap: 10px;
}
.column-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
  color: var(--muted);
}
.column-body {
  display: grid;
  gap: 10px;
  align-content: start;
}
.task-card[draggable="true"] {
  cursor: grab;
}
.task-card.is-dragging {
  opacity: .55;
  cursor: grabbing;
  transform: scale(.99);
}
.task-card .task-actions,
.task-card .badge-row,
.task-card .task-meta {
  pointer-events: auto;
}
.task-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.task-actions button {
  min-height: 34px;
  padding: 0 11px;
  font-size: 0.82rem;
}
.mini {
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(137,176,186,.16);
  color: var(--text);
}
.danger {
  background: rgba(255,124,147,.1);
  border: 1px solid rgba(255,124,147,.24);
  color: #ffbfd0;
}

.detail-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 20px;
  border: 1px solid rgba(137,176,186,.16);
  background: rgba(255,255,255,.02);
}
.detail-card h3,
.detail-card h4 {
  margin: 0;
  font-family: 'Manrope', sans-serif;
  letter-spacing: -0.04em;
}
.detail-card .meta-row,
.detail-card .action-row,
.agent-row,
.activity-item {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.detail-card textarea { min-height: 92px; }
.detail-card .split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.detail-card .split.compact {
  grid-template-columns: minmax(0, 1fr) 150px;
}
.detail-card .split.compact {
  grid-template-columns: minmax(0, 1fr) 150px;
}
.detail-card .checklist {
  display: grid;
  gap: 8px;
}
.detail-card .checklist label {
  display: flex;
  align-items: start;
  gap: 10px;
  color: var(--text);
}
.detail-card .checklist input { width: 18px; height: 18px; margin-top: 3px; }

.agent-list,
.activity-feed {
  display: grid;
  gap: 10px;
}
.agent-card,
.activity-item {
  padding: 12px;
  border-radius: 18px;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--line);
}
.agent-card {
  display: grid;
  gap: 10px;
}
.agent-card.active { border-color: rgba(0,208,170,.45); }
.agent-group { display: grid; gap: 10px; }
.company-brain-card { display: grid; gap: 10px; padding: 12px; border-radius: 18px; background: rgba(255,255,255,.02); border: 1px solid rgba(137,176,186,.16); }
.company-brain-card p { margin: 0; color: var(--muted); line-height: 1.5; }
.company-brain-themes { display: flex; flex-wrap: wrap; gap: 7px; }
.agent-task-summary { display: grid; gap: 4px; padding: 10px 12px; border-radius: 16px; background: rgba(255,255,255,.03); border: 1px solid rgba(137,176,186,.12); }
.agent-task-summary strong { font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; color: var(--accent-2); }
.agent-task-summary span { color: var(--text); line-height: 1.45; }
.agent-task-summary small { color: var(--muted); line-height: 1.45; }
.agent-card header,
.activity-item header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}
.agent-card p,
.activity-item p { margin: 0; color: var(--muted); line-height: 1.5; }
.agent-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.agent-controls button { min-height: 34px; padding: 0 11px; }
.activity-item time {
  color: var(--faint);
  font-size: 0.83rem;
  white-space: nowrap;
}
.activity-item strong { display: block; }



.empty-panel {
  color: var(--muted);
  background: rgba(255,255,255,.02);
  border: 1px dashed rgba(137,176,186,.2);
  border-radius: 18px;
  padding: 14px;
  line-height: 1.55;
}

.shell[hidden] { display: none !important; }

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 18px;
}

.auth-card {
  width: min(680px, 100%);
  padding: 28px;
  border-radius: 30px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.auth-brand h1 {
  margin: 0;
  font-family: 'Manrope', sans-serif;
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  letter-spacing: -0.05em;
}

.auth-brand img {
  flex: 0 0 auto;
}

.auth-copy {
  margin: 0 0 22px;
  color: var(--muted);
  max-width: 56ch;
  line-height: 1.6;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-weight: 600;
}

.auth-form input {
  width: 100%;
}

.auth-error {
  margin: 0;
  color: var(--danger);
  font-weight: 600;
}

.auth-hint {
  margin-top: 18px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(0, 208, 170, 0.12);
  color: var(--accent-2);
  border: 1px solid rgba(0, 208, 170, 0.22);
  font-weight: 700;
  white-space: nowrap;
}

body.authenticated .auth-screen { display: none; }
body.locked .shell { filter: blur(12px) saturate(0.7); pointer-events: none; user-select: none; }
body.locked .topbar-actions { pointer-events: auto; }
body.locked .shell[hidden] { display: none !important; }

@media (max-width: 1400px) {
  .workspace-grid {
    grid-template-columns: 280px minmax(0, 1fr);
  }
  .inspector {
    grid-column: 1 / -1;
    position: static;
  }
  .board { grid-template-columns: repeat(6, minmax(210px, 1fr)); }
}

@media (max-width: 1080px) {
  .topbar {
    grid-template-columns: 1fr;
  }
  .topbar-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .workspace-grid {
    grid-template-columns: 1fr;
  }
  .sidebar,
  .inspector {
    position: static;
  }
}

@media (max-width: 760px) {
  .shell { padding: 12px; }
  .topbar,
  .sidebar,
  .main,
  .inspector,
  .auth-card { border-radius: 22px; }
  .topbar-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .filters {
    flex-direction: column;
  }
  .filters select { min-width: 0; }
  .detail-card .split,
  .detail-card .split.compact {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
