/* Fireteam frontend styles */

:root {
  --bg: #fafafa;
  --fg: #1a1a1a;
  --muted: #666;
  --border: #e0e0e0;
  --kern: #6b4eff;     /* purple — Architect */
  --lattice: #2d8f4e;  /* green — Builder */
  --veer: #d97706;     /* amber — Synthesizer */
  --draft-bg: #f0f0ff;
  --critique-bg: #fff4f0;
  --revise-bg: #f0fff4;
  --error: #c62828;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
}

header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
  background: white;
}

header h1 {
  margin: 0 0 0.25rem 0;
  font-size: 1.5rem;
}

.tagline {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

#app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 90px);
}

#sidebar {
  border-right: 1px solid var(--border);
  padding: 1.5rem;
  background: white;
}

#sidebar h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1rem 0;
  letter-spacing: 0.05em;
}

#session-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.85rem;
}

#session-list li {
  padding: 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  margin-bottom: 0.25rem;
  border-left: 3px solid transparent;
}

#session-list li:hover {
  background: var(--bg);
}

#session-list li.empty {
  color: var(--muted);
  font-style: italic;
  cursor: default;
}

#session-list li .session-id {
  font-family: ui-monospace, "SF Mono", monospace;
  color: var(--muted);
  font-size: 0.75rem;
}

#session-list li .session-status {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.7rem;
  text-transform: uppercase;
  margin-left: 0.25rem;
}

#session-list li .session-status.active { background: #fff4e0; color: #b45309; }
#session-list li .session-status.complete { background: #e0f7e0; color: #2d8f4e; }
#session-list li .session-status.failed { background: #ffe0e0; color: #c62828; }

#main-panel {
  padding: 2rem;
  max-width: 1000px;
}

.phase {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.phase h2 {
  margin-top: 0;
}

form label {
  display: block;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}

form label > select,
form label > textarea,
form label > input {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.95rem;
  background: white;
  color: var(--fg);
}

form textarea {
  resize: vertical;
  font-family: inherit;
}

fieldset {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem;
  margin-bottom: 1rem;
}

fieldset legend {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0 0.5rem;
}

.model-row {
  display: grid;
  grid-template-columns: 140px 200px 1fr;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.model-row label {
  margin: 0;
  font-weight: 500;
  color: var(--fg);
}

button {
  background: #1a1a1a;
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
}

button:hover { background: #333; }
button:disabled { background: #999; cursor: not-allowed; }

.live-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.live-header h2 { margin: 0; }

.status-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 600;
}

.status-badge.active { background: #fff4e0; color: #b45309; }
.status-badge.complete { background: #e0f7e0; color: #2d8f4e; }

.meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.message {
  border-left: 4px solid;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border-radius: 0 4px 4px 0;
}

.message.kern { border-color: var(--kern); background: rgba(107, 78, 255, 0.05); }
.message.lattice { border-color: var(--lattice); background: rgba(45, 143, 78, 0.05); }
.message.veer { border-color: var(--veer); background: rgba(217, 119, 6, 0.05); }

.message.draft { background: var(--draft-bg); }
.message.critique { background: var(--critique-bg); }
.message.revise { background: var(--revise-bg); }

.message-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.message-persona {
  font-family: ui-monospace, "SF Mono", monospace;
}

.message-persona.kern { color: var(--kern); }
.message-persona.lattice { color: var(--lattice); }
.message-persona.veer { color: var(--veer); }

.message-content {
  white-space: pre-wrap;
  font-size: 0.95rem;
  line-height: 1.55;
}

.message-content.error {
  color: var(--error);
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 0.85rem;
}

.round-marker {
  margin: 1.5rem 0 0.5rem 0;
  padding: 0.4rem 0.75rem;
  background: var(--fg);
  color: white;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 4px;
  display: inline-block;
}

#synthesis-text {
  white-space: pre-wrap;
  padding: 1.5rem;
  background: var(--bg);
  border-left: 4px solid var(--veer);
  border-radius: 0 4px 4px 0;
  margin-bottom: 2rem;
  font-size: 1rem;
  line-height: 1.6;
}

.followup-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-top: 0.5rem;
}

.followup-controls label {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
  color: var(--fg);
}

.followup-controls button {
  margin-left: auto;
}

.hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

#new-session-button {
  background: white;
  color: var(--fg);
  border: 1px solid var(--border);
  margin-top: 1.5rem;
}

#new-session-button:hover { background: var(--bg); }

#error-message {
  background: #ffe0e0;
  color: var(--error);
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
}