:root {
  /* Brand palette */
  --midnight: #0B1020;
  --azure: #2563EB;
  --azure-dark: #1d4fc4;
  --cyan: #06B6D4;
  --purple: #8B5CF6;
  --cloud: #E5E7EB;
  --snow: #F8FAFC;
  --gradient: linear-gradient(90deg, var(--azure), var(--cyan) 55%, var(--purple));

  --ground: var(--snow);
  --surface: #ffffff;
  --ink: var(--midnight);
  --muted: #5b6475;
  --line: var(--cloud);
  --action: var(--azure);
  --action-dark: var(--azure-dark);
  --tray: #fde68a;
  --tray-ink: #3b2a00;
  --danger: #b4231b;
  --serif: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --sans: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
h1, h2, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h2 { font: 700 17px/1.3 var(--serif); letter-spacing: -0.01em; }
time { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; }

/* Each agent keeps one colour everywhere, so a busy log stays readable. */
.hue-0 { --hue: #0e6b74; }
.hue-1 { --hue: #6f3f97; }
.hue-2 { --hue: #a44a14; }
.hue-3 { --hue: #2562a8; }
.hue-4 { --hue: #3f6b1c; }
.hue-5 { --hue: #9a2f60; }
.hue-6 { --hue: #6b5630; }
.hue-7 { --hue: #3a4aa0; }
.who { font-weight: 600; color: var(--hue, var(--ink)); }

/* Controls */
button, input, select, textarea { font: inherit; color: inherit; }
button {
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
button:hover { border-color: var(--muted); }
button:disabled { opacity: 0.5; cursor: default; }
button.primary { background: var(--action); border-color: var(--action); color: #fff; }
button.primary:hover { background: var(--action-dark); border-color: var(--action-dark); }
button.small { padding: 4px 10px; font-size: 13px; }
button.quiet { background: none; border-color: transparent; color: var(--muted); }
button.quiet:hover { color: var(--ink); border-color: transparent; text-decoration: underline; }
button.danger { color: var(--danger); border-color: var(--danger); background: none; }
button.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--action);
  font-size: 13px;
}
button.link:hover { text-decoration: underline; }

input, select, textarea {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #b9c3be;
  border-radius: 4px;
  background: var(--surface);
}
textarea { resize: vertical; line-height: 1.45; }
label { display: block; font-size: 13px; font-weight: 600; }
label > input, label > select, label > textarea { margin-top: 4px; font-size: 15px; font-weight: 400; }
.hint { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; font-weight: 400; }
.model-id { overflow-wrap: anywhere; font-size: 12px; }
.form-error { color: var(--danger); font-size: 14px; font-weight: 600; }
.empty { color: var(--muted); font-size: 14px; max-width: 46ch; }

/* Sign-in */
.signin { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.signin-form {
  width: min(360px, 100%);
  display: grid;
  gap: 14px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.signin-logo { vertical-align: -8px; margin-right: 8px; }
.signin-form h1 { font: 600 28px/1.15 var(--serif); }
.signin-lede { color: var(--muted); margin-top: -8px; }

/* Frame */
.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  flex-wrap: wrap;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
}
.bar-left { display: flex; align-items: baseline; gap: 14px; min-width: 0; }
.brand { display: inline-flex; align-items: center; gap: 8px; padding-right: 14px; border-right: 1px solid var(--line); color: var(--ink); font-size: 15px; font-weight: 800; letter-spacing: -0.02em; }
.brand img { width: 22px; height: 22px; }
.company-name {
  padding: 2px 0;
  border: 0;
  background: none;
  font: 600 24px/1.2 var(--serif);
  text-align: left;
}
.company-name:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.bar-right { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }
.usage { font-size: 13px; color: var(--muted); min-width: 170px; }
.meter { display: block; height: 4px; margin-top: 3px; background: var(--line); border-radius: 2px; overflow: hidden; }
.meter > span { display: block; height: 100%; width: 0; background: var(--action); }
.usage-high { color: var(--danger); font-weight: 600; }
.usage-high .meter > span { background: var(--danger); }
.banner { padding: 8px 20px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 600; }
.banner-warn { background: var(--danger); }

.desk {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(230px, 290px) minmax(0, 1fr) minmax(290px, 360px);
}
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* Team */
.team { padding: 18px 16px 24px 20px; overflow-y: auto; }
.team-list { margin-top: 14px; }
.agent { display: flex; gap: 10px; padding: 9px 0; }
.agent.depth-1 { margin-left: 16px; padding-left: 14px; border-left: 1px solid #b9c3be; }
.agent.depth-2 { margin-left: 32px; padding-left: 14px; border-left: 1px solid #b9c3be; }
.agent.depth-3 { margin-left: 48px; padding-left: 14px; border-left: 1px solid #b9c3be; }
.plate {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  background: var(--hue, var(--ink));
  color: #fff;
  font: 600 18px/1 var(--serif);
}
.agent-main { min-width: 0; }
.agent-name { font: 600 17px/1.25 var(--serif); }
.agent-role { font-size: 14px; }
.agent-meta { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-actions { display: flex; gap: 12px; margin-top: 3px; }
.working {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px 1px 18px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font: 600 11.5px/1.5 var(--sans);
  vertical-align: 2px;
  position: relative;
}
.working::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: var(--tray);
}
@media (prefers-reduced-motion: no-preference) {
  .working::before { animation: pulse 1.1s ease-in-out infinite alternate; }
  @keyframes pulse { from { opacity: 0.25; } to { opacity: 1; } }
}

/* Activity: a log of who said what to whom */
.activity {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
.activity > .section-head { padding: 18px 22px 10px; }
.activity > .empty { padding: 4px 22px 18px; flex: 1; }
.feed { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 12px; }
.day { padding: 14px 22px 4px; color: var(--muted); font-size: 13px; font-weight: 600; }
.entry {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 0 12px;
  padding: 9px 22px 9px 19px;
  border-left: 3px solid transparent;
}
.entry > time { padding-top: 2px; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.entry-head { font-size: 14px; }
.entry-text { max-width: 74ch; white-space: pre-wrap; overflow-wrap: anywhere; }
.entry-text.clamped { max-height: 12em; overflow: hidden; }
.entry.for-you { border-left-color: var(--tray); background: #fffaea; }
.entry.type-note .entry-text,
.entry.type-lesson .entry-text { color: var(--muted); font-size: 14px; }
.entry.type-system { background: var(--ground); }
.entry.type-system .entry-text { font-size: 14px; }

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 10px;
  align-items: end;
  padding: 12px 22px 16px;
  border-top: 1px solid var(--line);
}
.composer-to { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; }
.composer-to select { width: auto; min-width: 160px; margin-top: 0; padding: 5px 8px; }
.composer textarea { min-height: 62px; }

/* Right column */
.side { min-height: 0; overflow-y: auto; }

/* The in-tray is the one loud thing on the page, and only when something is waiting. */
.tray { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.tray > .empty { margin-top: 8px; }
.tray.has-items { background: var(--tray); color: var(--tray-ink); border-bottom-color: var(--tray-ink); }
.tray.has-items .who { color: var(--tray-ink); }
.question { display: grid; gap: 8px; padding: 14px 0; border-top: 1px solid rgba(42, 33, 3, 0.35); }
.question:first-child { margin-top: 10px; }
.question:last-child { padding-bottom: 2px; }
.question-from { display: flex; gap: 5px; align-items: baseline; font-size: 14px; }
.question-from time { margin-left: auto; font-size: 12.5px; }
.question-text { font: 16px/1.45 var(--serif); white-space: pre-wrap; overflow-wrap: anywhere; }
.question textarea { border-color: var(--tray-ink); }
.question-actions { display: flex; gap: 8px; }
.question button { border-color: var(--tray-ink); }
.question button.primary { background: var(--tray-ink); border-color: var(--tray-ink); }
.question .form-error { color: #7a1408; }

.tasks { padding: 18px 20px 28px; }
.task-list { margin-top: 8px; }
.agenda { padding: 18px 20px; border-top: 1px solid var(--line); }
.agenda-entry .pill { white-space: nowrap; }
.task { padding: 10px 0; border-top: 1px solid var(--line); }
.task:first-child { border-top: 0; }
.task-top { display: flex; align-items: baseline; gap: 8px; }
.task-id { flex: none; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.task-title { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.pill {
  flex: none;
  padding: 1px 8px;
  border: 1px solid var(--muted);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.status-in_progress .pill { background: var(--action); border-color: var(--action); color: #fff; }
.status-blocked .pill { background: var(--danger); border-color: var(--danger); color: #fff; }
.status-done .pill, .status-cancelled .pill { border-color: var(--line); color: var(--muted); }
.status-done .task-title, .status-cancelled .task-title { color: var(--muted); font-weight: 400; }
.status-cancelled .task-title { text-decoration: line-through; }
.task-meta { color: var(--muted); font-size: 13px; }
.task-note { font-size: 14px; margin-top: 2px; }
.task details { font-size: 14px; margin-top: 2px; }
.task summary { color: var(--muted); font-size: 13px; cursor: pointer; }
.task-details { white-space: pre-wrap; overflow-wrap: anywhere; }
.task-actions { display: flex; gap: 14px; margin-top: 4px; }
#closed-toggle { margin-top: 6px; padding-left: 0; }

/* Dialogs */
dialog {
  width: min(580px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 64px rgba(23, 37, 43, 0.28);
}
dialog::backdrop { background: rgba(23, 37, 43, 0.5); }
dialog > form, .dialog-body { display: grid; gap: 14px; padding: 24px; }
.dialog-body > form { display: grid; gap: 14px; }
dialog h2 { font-size: 21px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.spacer { flex: 1; }
.lesson-list li { padding: 10px 0; border-top: 1px solid var(--line); }
.lesson-text { overflow-wrap: anywhere; }
.lesson-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 16px;
  border-radius: 4px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  z-index: 10;
}

/* One column: what needs the director first, then the log, the team, the tasks. */
@media (max-width: 1080px) {
  .app { height: auto; min-height: 100vh; }
  .desk { display: flex; flex-direction: column; }
  .side { display: contents; }
  .tray { order: 1; }
  .activity { order: 2; border-left: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .team { order: 3; overflow: visible; padding: 18px 16px; border-bottom: 1px solid var(--line); }
  .tasks { order: 4; padding: 18px 16px 28px; }
  .tray { padding: 16px; }
  .feed { max-height: 62vh; }
  .bar { padding: 10px 16px; }
  .activity > .section-head { padding: 16px 16px 8px; }
  .activity > .empty { padding: 4px 16px 16px; }
  .day { padding-left: 16px; }
  .entry { padding: 9px 16px 9px 13px; }
  .composer { padding: 12px 16px 16px; }
}
@media (max-width: 520px) {
  .field-row { grid-template-columns: 1fr; }
  .composer { grid-template-columns: 1fr; }
  .usage { min-width: 0; flex: 1; }
}

/* ---------- home page ---------- */
.home { display: flex; flex-direction: column; min-height: 100vh; background: var(--midnight); color: var(--snow); }
.home-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 32px; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 800; font-size: 22px; letter-spacing: -0.03em; }
.logo i { font-style: normal; position: relative; }
.logo i::after { content: ''; position: absolute; left: 0.1em; top: -0.05em; width: 0.28em; height: 0.28em; border-radius: 50%; background: var(--purple); }
.home-nav { display: flex; align-items: center; gap: 22px; }
.home-nav a { color: var(--cloud); text-decoration: none; font-weight: 500; }
.home-nav a:hover { color: #fff; }
.home-nav a.button { color: #fff; }
.hero { display: grid; grid-template-columns: 1.2fr 1fr; align-items: center; gap: 32px; max-width: 1100px; margin: 0 auto; padding: 56px 32px 24px; }
.hero h1 { font-size: 54px; line-height: 1.05; font-weight: 800; letter-spacing: -0.03em; margin: 0 0 18px; }
.gradient-text { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .lede { font-size: 20px; color: var(--cloud); margin-bottom: 26px; }
.hero-actions { margin-bottom: 14px; }
.hero-note { color: #9aa3b8; font-size: 14px; max-width: 460px; }
.hero-art { justify-self: end; max-width: 100%; overflow: hidden; }
.hero-art svg { display: block; max-width: 100%; height: auto; }
.button { display: inline-block; text-decoration: none; border: 1px solid transparent; border-radius: 8px; padding: 9px 16px; font-weight: 600; }
.button.primary { background: var(--azure); color: #fff; }
.button.primary:hover { background: var(--azure-dark); }
.button.large { padding: 13px 22px; font-size: 17px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; max-width: 1100px; margin: 0 auto; padding: 24px 32px 48px; }
.feature { background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 14px; padding: 22px; }
.feature h2 { color: #fff; font-size: 18px; margin: 14px 0 6px; }
.feature p { margin: 0; color: #b4bccb; font-size: 15px; }
.feature-icon { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; color: #fff; }
.icon-azure { background: var(--azure); }
.icon-purple { background: var(--purple); }
.icon-cyan { background: var(--cyan); }
.icon-violet { background: linear-gradient(135deg, var(--purple), var(--azure)); }
.how { max-width: 760px; margin: 0 auto; padding: 8px 32px 64px; }
.how h2 { font-size: 13px; letter-spacing: 0.22em; text-transform: uppercase; color: #9aa3b8; margin-bottom: 18px; }
.how ol { list-style: decimal; padding-left: 22px; color: var(--cloud); display: grid; gap: 10px; font-size: 17px; }
.how strong { color: #fff; }
.home-foot { display: flex; align-items: center; justify-content: space-between; padding: 18px 32px; border-top: 1px solid rgba(255, 255, 255, 0.1); color: #9aa3b8; font-size: 14px; margin-top: auto; }
.home-foot a { color: var(--cloud); }
@media (max-width: 760px) {
  .home-bar, .hero, .features, .how, .home-foot { padding-left: 16px; padding-right: 16px; }
  .hero { grid-template-columns: 1fr; padding-top: 32px; }
  .hero h1 { font-size: 36px; }
  .hero-art { display: none; }
  .home-nav a:not(.button) { display: none; }
}

/* ---------- the model wizard ---------- */
.field { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-weight: 600; font-size: 14px; }
.model-pick { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.model-name { font-weight: 600; overflow-wrap: anywhere; }
.wizard-step { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 12px 0; display: grid; gap: 8px; }
.wizard-step legend { font-weight: 600; padding: 0 4px; }
.radio { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.radio input { margin: 4px 0 0; flex: none; width: auto; }
.radio > span { flex: 1; font-weight: 400; font-size: 14px; }
.radio .hint { display: inline; }
#model-dialog h3 { font-size: 14px; margin: 10px 0 4px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.model-list li { padding: 10px 0; border-top: 1px solid var(--line); }
.model-row-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.model-row-name { font-weight: 600; }
.pill-ok { background: #dcfce7; color: #166534; }
.pill-warn { background: #fef3c7; color: #92400e; }
.pill-bad { background: #fee2e2; color: #991b1b; }
.model-custom { margin-top: 14px; }
#model-dialog details { margin-top: 10px; }
#model-dialog summary { cursor: pointer; color: var(--muted); }

/* ---------- the hiring assistant ---------- */
.hiring .chat { max-height: 40vh; overflow-y: auto; display: grid; gap: 10px; padding: 4px 0; }
.chat li { max-width: 85%; padding: 8px 12px; border-radius: 12px; }
.chat-user { justify-self: end; background: var(--azure); color: #fff; }
.chat-user .entry-text { color: #fff; }
.chat-assistant { justify-self: start; background: var(--ground); }
.chat-busy { color: var(--muted); font-style: italic; }
.composer-plain { margin-top: 10px; }
.proposal { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--azure); border-radius: 10px; background: #eff4ff; }
.proposal h3 { margin: 0 0 4px; font-size: 16px; }
.proposal h4 { margin: 10px 0 4px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.plain-list { list-style: disc; padding-left: 20px; font-size: 14px; }
.caveat { margin-top: 10px; padding: 8px 10px; background: var(--tray); color: var(--tray-ink); border-radius: 6px; font-size: 14px; }
.composer-plain { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 0; border: 0; }
.composer-plain .form-error { grid-column: 1 / -1; margin: 0; }

/* ---------- mailboxes ---------- */
.mailboxes { padding: 18px 20px; border-top: 1px solid var(--line); }
.grant-list { display: grid; gap: 6px; }
.grant-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 400; }
.grant-row select { width: auto; margin: 0; }
.grant-name { overflow-wrap: anywhere; }
