/* WorkMate Agents — WorkMate OS module look.
   Typography: Inter everywhere (white, readable); JetBrains Mono only for
   console output and file editors; Anton SC watermark only.
   Canvas: dark navy hsl(220 25% 9%); accents cyan-300; banner = canonical
   ModuleBanner (dark red → deep blue, porthole, starfield — no agent). */

:root {
  --bg: hsl(220, 25%, 9%);
  --panel: hsla(220, 25%, 13%, 0.85);
  --panel-2: hsl(220, 22%, 16%);
  --border: rgba(103, 232, 249, 0.16);
  --border-strong: rgba(103, 232, 249, 0.32);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.8);
  --faint: rgba(255, 255, 255, 0.6);
  --cyan: #67e8f9;
  --cyan-soft: rgba(103, 232, 249, 0.1);
  --cyan-mid: rgba(103, 232, 249, 0.2);
  --violet: #c4b5fd;
  --violet-soft: rgba(196, 181, 253, 0.14);
  --green: #4ade80;
  --amber: #fbbf24;
  --red: #f87171;
}

* { box-sizing: border-box; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(125, 211, 252, 0.35); }
* { scrollbar-width: thin; scrollbar-color: rgba(103, 232, 249, 0.4) transparent; }

h1, h2, h3, h4 { font-weight: 700; letter-spacing: 0; }

.mono {
  font-family: "JetBrains Mono", Menlo, monospace;
}
/* Labels — WorkMate OS typography: Inter, readable white, no mono/uppercase. */
.label {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.88);
}

/* ============ Canonical module banner (copied from ModuleBanner.tsx) ============ */
.banner {
  position: relative;
  overflow: hidden;
  border-top: 1px solid rgba(103, 232, 249, 0.2);
  border-bottom: 1px solid rgba(103, 232, 249, 0.2);
  background: linear-gradient(120deg, #3b071a 0%, #160713 38%, #050817 62%, #071c4a 100%);
  padding: 24px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
}
@keyframes wmWindowTwinkle { 0%, 100% { transform: scale(0.72); opacity: 0.28; } 48% { transform: scale(1.65); opacity: 0.92; } }
@keyframes wmWindowSkyBreath { 0%, 100% { filter: saturate(1) brightness(0.92); } 50% { filter: saturate(1.16) brightness(1.08); } }

.banner .watermark {
  pointer-events: none;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  font-family: "Anton SC", Impact, sans-serif;
  font-size: clamp(76px, 17vw, 210px);
  line-height: 0.8;
  color: rgba(255, 255, 255, 0.055);
}
.banner .porthole-ring {
  pointer-events: none;
  position: absolute;
  right: -128px;
  top: 50%;
  height: 420px;
  width: 420px;
  transform: translateY(-50%);
  border-radius: 9999px;
  border: 1px solid rgba(11, 28, 61, 0.9);
  box-shadow: 0 0 0 58px rgba(2, 9, 24, 0.96), 0 0 0 122px rgba(3, 16, 42, 0.94),
    0 0 46px 132px rgba(67, 97, 238, 0.48), inset 0 0 80px rgba(67, 97, 238, 0.12);
}
.banner .porthole-sky {
  pointer-events: none;
  position: absolute;
  right: -128px;
  top: 50%;
  z-index: 1;
  height: 420px;
  width: 420px;
  transform: translateY(-50%);
  overflow: hidden;
  border-radius: 9999px;
  opacity: 0.95;
  animation: wmWindowSkyBreath 9s ease-in-out infinite;
  background: radial-gradient(circle at 36% 26%, rgba(97, 217, 255, 0.22), transparent 22%),
    radial-gradient(circle at 68% 36%, rgba(245, 198, 109, 0.13), transparent 20%),
    radial-gradient(circle at 44% 62%, rgba(64, 100, 214, 0.24), transparent 28%),
    linear-gradient(145deg, #061225 0%, #0a1d3d 48%, #03060e 100%);
  box-shadow: inset 0 0 82px rgba(97, 217, 255, 0.16), inset 0 0 150px rgba(2, 6, 23, 0.72),
    0 0 54px rgba(97, 217, 255, 0.08);
}
.banner .star {
  position: absolute;
  border-radius: 9999px;
  background: #ecfeff;
  animation: wmWindowTwinkle 6s ease-in-out infinite;
}
.banner .inner {
  position: relative;
  z-index: 10;
  max-width: 1100px;
}
.banner .eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: rgba(207, 250, 254, 0.8);
  margin: 0;
}
.banner h1 {
  margin: 4px 0 0;
  font-size: clamp(30px, 4.5vw, 46px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: #fff;
}
.banner .subtitle {
  margin: 12px 0 0;
  max-width: 620px;
  font-size: 15px;
  line-height: 1.7;
  color: #ecfeff;
}

/* ============ Shell ============ */
.shell { max-width: 1160px; margin: 0 auto; padding: 0 24px 80px; }

nav.tabs {
  display: flex;
  gap: 6px;
  margin: 22px 0 26px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
nav.tabs button {
  appearance: none;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: rgba(255, 255, 255, 0.85);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 10px 16px;
  cursor: pointer;
}
nav.tabs button:hover { color: #fff; }
nav.tabs button.active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
}

/* ============ Panels, controls ============ */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.panel + .panel { margin-top: 16px; }

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--cyan-soft);
  color: #cffafe;
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  padding: 9px 16px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn:hover { background: var(--cyan-mid); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.violet { border-color: rgba(196, 181, 253, 0.35); background: var(--violet-soft); color: #ede9fe; }
.btn.danger { border-color: rgba(248, 113, 113, 0.4); background: rgba(248, 113, 113, 0.1); color: #fecaca; }
.btn.ghost { border-color: var(--border); background: transparent; color: var(--muted); }

input[type="text"], input[type="number"], textarea, select {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(103, 232, 249, 0.25);
  background: rgba(103, 232, 249, 0.07);
  color: #ecfeff;
  font: inherit;
  padding: 9px 12px;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: rgba(165, 243, 252, 0.7); }
textarea { resize: vertical; min-height: 80px; }
textarea.file-edit { font-family: "JetBrains Mono", Menlo, monospace; font-size: 12px; min-height: 180px; }
select option { background: var(--panel-2); }

.field { margin-bottom: 14px; }
.field > .label { display: block; margin-bottom: 6px; }

.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }

/* ============ Forge chat ============ */
.chat { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.msg {
  max-width: 720px;
  border-radius: 12px;
  padding: 12px 16px;
  white-space: pre-wrap;
}
.msg.user { align-self: flex-end; background: var(--cyan-soft); border: 1px solid var(--border); }
.msg.builder { align-self: flex-start; background: var(--panel-2); border: 1px solid rgba(255, 255, 255, 0.07); }
.msg .label { margin-bottom: 6px; display: block; }

.step-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.chip {
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  color: rgba(255, 255, 255, 0.7);
}
.chip.on { color: var(--cyan); border-color: var(--border-strong); background: var(--cyan-soft); }

/* ============ Agent cards ============ */
.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.agent-card { display: flex; flex-direction: column; gap: 10px; }
.agent-card h3 { margin: 0; font-size: 18px; }
.agent-card .role { color: var(--muted); font-size: 13px; margin: 0; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 999px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  color: rgba(255, 255, 255, 0.85);
}
.badge.stage-1 { color: var(--amber); border-color: rgba(251, 191, 36, 0.35); }
.badge.stage-2 { color: var(--amber); border-color: rgba(251, 191, 36, 0.35); }
.badge.stage-3 { color: var(--cyan); border-color: var(--border-strong); }
.badge.stage-4 { color: var(--green); border-color: rgba(74, 222, 128, 0.35); }
.badge.hb { color: var(--violet); border-color: rgba(196, 181, 253, 0.35); }

/* ============ Run console ============ */
.console {
  font-family: "JetBrains Mono", Menlo, monospace;
  font-size: 11.5px;
  line-height: 1.6;
  background: #05070c;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  max-height: 420px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.console .err { color: var(--red); }
.console .meta { color: var(--violet); }
.console .done { color: var(--green); }

.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.hint { color: var(--faint); font-size: 12px; }
.error-text { color: var(--red); font-size: 13px; }
