:root {
  color-scheme: light;
  --bg: #f3f5ef;
  --surface: #fbfcf8;
  --surface-strong: #ffffff;
  --surface-soft: #edf2e8;
  --ink: #121610;
  --muted: #5f695d;
  --faint: #879184;
  --line: rgba(31, 54, 29, .14);
  --line-strong: rgba(31, 54, 29, .25);
  --green: #2f6b3d;
  --green-bright: #397b48;
  --green-soft: #edf2e8;
  --blue: #2f6b3d;
  --blue-soft: #e4eddc;
  --amber: #a45c20;
  --amber-soft: #f8ede1;
  --red: #b9473b;
  --sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --content-width: 1180px;
  --radius: 18px;
  --shadow: 0 30px 80px rgba(31, 48, 29, .13);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 58% -12%, rgba(111, 170, 66, .13), transparent 36rem),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
::selection { color: #fff; background: var(--green); }
#localWorkerHosts {
  position: fixed;
  z-index: -1;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}
#localWorkerHosts iframe { width: 1px; height: 1px; border: 0; }

.accountScreen {
  min-height: calc(100vh - 91px);
  display: grid;
  place-items: start center;
  padding: 32px 0 44px;
}
.accountBoot {
  min-height: min(420px, calc(100vh - 190px));
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: .9rem;
}
.accountBootSpinner {
  width: 28px;
  height: 28px;
  border: 3px solid #d7dfdb;
  border-top-color: var(--green);
  border-radius: 50%;
  animation: join-spinner .7s linear infinite;
}
.accountDashboard { place-items: start center; }
.accountCard {
  width: min(460px, 100%);
  padding: clamp(26px, 4vw, 38px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(251, 252, 248, .94);
  box-shadow: var(--shadow);
}
.accountCardWide { width: 100%; padding: 0; border: 0; background: transparent; box-shadow: none; }
.accountCard h1 { margin: 0 0 8px; font-size: clamp(1.6rem, 4vw, 2rem); font-weight: 600; letter-spacing: -.04em; }
.accountBeta {
  display: inline-block;
  margin-left: 5px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .08em;
  line-height: 1;
  text-transform: uppercase;
  vertical-align: .2em;
}
.accountCard > p { margin: 0 0 22px; color: var(--muted); }
#accountForm { display: grid; gap: 15px; }
.accountField { text-transform: none; font-size: .8rem; }
.accountConsent { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 9px; align-items: start; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.accountConsent input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--green); }
.accountConsent a { color: var(--green-dark); font-weight: 700; }
.siteFooter { width: min(100% - 32px, 1440px); margin: 22px auto 28px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 18px; color: var(--muted); font-size: .78rem; }
.siteFooter nav { display: flex; gap: 16px; }
.siteFooter a { color: inherit; font-weight: 700; }
.accountLinks { display: flex; justify-content: flex-end; gap: 12px; margin-top: 12px; }
.accountLinks a { padding: 4px 0; color: var(--blue); font-size: .8rem; font-weight: 650; }
.accountAlternative { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); text-align: center; }
.accountAlternative p { margin: 0 0 10px; color: var(--muted); font-size: .82rem; }
.accountAlternative .button { width: 100%; border-color: var(--line-strong); background: var(--surface-strong); color: var(--ink); font-size: .9rem; }
.accountNotice, .accountError { margin: 16px 0 0; padding: 10px 12px; border-radius: 9px; font-size: .82rem; }
.accountNotice { background: var(--green-soft); color: var(--green); }
.accountError { background: #f9e8ea; color: var(--red); }
.accountDashboardHead { display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.accountDashboardHead h1 { margin: 5px 0; font-size: clamp(1.55rem, 3vw, 2.2rem); letter-spacing: -.035em; }
.accountDashboardDescription { max-width: 720px; margin: 0; color: var(--muted); font-size: .94rem; line-height: 1.5; }
.accountSetupSteps { display: grid; gap: 12px; margin-top: 20px; }
.accountSetupStep { position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.accountSetupStep.complete { border-color: #a7cdbf; background: #f4faf7; }
.accountStepMarker { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: white; font-weight: 900; }
.accountStepComplete { position: absolute; top: 12px; right: 12px; width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; background: var(--green); color: white; font-size: .9rem; font-weight: 900; }
.accountSetupStep.locked { opacity: .58; }
.accountSetupStep.locked .accountStepMarker { background: var(--muted); }
.accountStepContent { min-width: 0; }
.accountStepContent header { padding-right: 30px; }
.accountStepContent header h2 { margin: 1px 0 3px; font-size: 1rem; }
.accountStepContent header p { margin: 0; color: var(--muted); font-size: .78rem; }
.accountStepContent header p em { display: block; margin-top: 3px; color: var(--amber); }
.accountStepForm { display: grid; grid-template-columns: minmax(180px, 1fr) auto; align-items: end; gap: 10px; margin-top: 13px; }
.accountCapacityForm { grid-template-columns: minmax(180px, 1fr) auto auto; }
.accountStepForm .button { min-height: 40px; }
.accountRoomEntry { margin-top: 12px; background: var(--surface); }
.accountRoomEntry.ready { border-color: var(--green); }
.accountRoomEntry .accountInlineForm { margin-top: 14px; }
.accountInlineForm {
  display: grid; grid-template-columns: minmax(220px, 1fr) auto; align-items: end; gap: 12px;
  margin-top: 20px; padding: 16px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg);
}
.accountInvite { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; margin-top: 18px; padding: 16px; border: 1px solid var(--green); border-radius: 7px; background: var(--green-soft); }
.accountInvite strong, .accountInvite small { grid-column: 1 / -1; }
.accountInvite small { color: var(--muted); }
.accountRooms { display: grid; gap: 10px; margin-top: 22px; }
.accountRoom { display: grid; grid-template-columns: minmax(180px, 1fr) auto; gap: 16px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 7px; cursor: pointer; }
.accountRoom:hover { border-color: #aebbb5; background: #fbfcfb; }
.accountRoomLocked { cursor: default; opacity: .72; }
.accountRoomLocked:hover { border-color: var(--line); background: transparent; }
.accountRoom strong, .accountRoom small { display: block; }
.accountRoom small { margin-top: 4px; color: var(--muted); overflow-wrap: anywhere; }
.accountRoomActions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.accountRoomActions button { min-height: 34px; padding: 0 10px; border-color: var(--line); background: var(--surface); font-size: .72rem; }
.accountRoomActions button.primary { border-color: var(--green); background: var(--green); }
.accountRoomActions button.danger { border-color: #d7a6aa; background: #fff7f7; }
.accountEmailInvite { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(220px, 1fr) auto; align-items: end; gap: 9px 12px; padding-top: 14px; border-top: 1px solid var(--line); cursor: default; }
.accountEmailInvite small { grid-column: 1 / -1; margin-top: 0; }
.accountLegacyJoin { margin-top: 16px; color: var(--muted); font-size: .8rem; }
.accountLegacyJoin summary { cursor: pointer; color: var(--blue); font-weight: 750; }
.accountLegacyJoin .accountInlineForm { margin-top: 10px; }
.accountEmpty { color: var(--muted); }
.accountToolbar { display: flex; align-items: center; justify-content: flex-end; gap: 8px; color: var(--muted); font-size: .72rem; }
.accountToolbar button { min-height: 30px; padding: 0 8px; border-color: var(--line); background: var(--surface); font-size: .7rem; }
.accountToolbar .accountNameButton { display: inline-flex; align-items: center; gap: 5px; max-width: min(240px, 32vw); min-width: 0; color: var(--muted); }
.accountNameButton span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.accountProfileDialog { width: min(430px, calc(100% - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.accountProfileDialog::backdrop { background: rgba(18, 22, 16, .38); backdrop-filter: blur(2px); }
.accountProfileForm { display: grid; gap: 18px; padding: 26px; }
.accountProfileForm h2 { margin: 3px 0 4px; font-size: 1.25rem; letter-spacing: -.025em; }
.accountProfileForm > div:first-child > p:last-child { margin: 0; color: var(--muted); font-size: .82rem; }
.accountProfileError { margin: -4px 0 0; padding: 9px 11px; border-radius: 8px; background: #f9e8ea; color: var(--red); font-size: .78rem; }
.accountProfileActions { display: flex; justify-content: flex-end; gap: 8px; }
.accountPendingInvitations { display: grid; gap: 10px; margin-top: 20px; padding: 16px; border: 1px solid #b9d7cc; border-radius: 9px; background: #f4faf7; }
.accountPendingInvitations h2 { margin: 3px 0 4px; font-size: 1rem; }
.accountPendingInvitation { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 14px; border: 1px solid #d6e4de; border-radius: 7px; background: var(--surface); }
.accountPendingInvitation strong, .accountPendingInvitation small { display: block; }
.accountPendingInvitation small { margin-top: 3px; color: var(--muted); font-size: .72rem; }
.accountPendingInvitation > div:last-child { display: flex; gap: 7px; }
.accountPendingInvitation button { min-height: 34px; padding-inline: 11px; font-size: .72rem; }

.appShell { width: min(var(--content-width), 100%); margin: 0 auto; padding: 0 clamp(20px, 5vw, 64px) 56px; }

.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand > div { min-width: 0; line-height: 1; }
.brandMark {
  position: relative; width: 38px; height: 38px; display: grid; place-items: center; overflow: hidden;
  border: 1px solid var(--green); border-radius: 11px; background: var(--green); color: white;
  box-shadow: inset 0 1px rgba(255, 255, 255, .18);
}
.brandMark b { position: relative; z-index: 2; font-size: 18px; font-weight: 700; }
.brandMark i { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: #b9ee70; }
.brandMark i:nth-child(1) { left: 6px; top: 7px; }
.brandMark i:nth-child(2) { right: 6px; top: 9px; }
.brandMark i:nth-child(3) { right: 7px; bottom: 7px; }
.brand h1 { display: inline; margin: 0; font-size: 1.12rem; font-weight: 650; letter-spacing: -.04em; line-height: 1; }
.brandDot { color: var(--green); font-size: 1.12rem; font-weight: 650; letter-spacing: -.04em; line-height: 1; }
.brand p { margin: 3px 0 0; color: var(--muted); font-size: .8rem; line-height: 1.15; }

.connectionState { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .82rem; font-weight: 750; }
.connectionState span { width: 8px; height: 8px; border-radius: 50%; background: #9ba5a1; }
.connectionState.online { color: var(--green); }
.connectionState.online span { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.connectionState.joining { color: var(--blue); }
.connectionState.joining span { background: var(--blue); box-shadow: 0 0 0 4px var(--blue-soft); }
.topbarActions { display: flex; align-items: center; gap: 22px; }
body.accountSurface .manageRoomBtn, body.accountSurface [data-account-action="rooms"] { display: none !important; }
.pageIntro { margin: 34px 0 22px; }
.pageIntro h1 { margin: 5px 0 5px; font-size: clamp(1.55rem, 3vw, 2.2rem); letter-spacing: -.035em; }
.pageIntro > p:last-child { max-width: 720px; margin: 0; color: var(--muted); font-size: .94rem; line-height: 1.5; }
.pageIntro + .capacitySaved, .pageIntro + .compatibilityGrid, .pageIntro + .workspace { margin-top: 0; }
.toolNav { display: flex; align-items: center; gap: 4px; }
.toolNav a {
  min-height: 34px; display: inline-flex; align-items: center; padding: 0 10px;
  border-radius: 8px; color: var(--muted); font-size: .76rem; font-weight: 600; text-decoration: none;
}
.toolNav a:hover { color: var(--ink); }
.toolNav a.active { background: var(--surface-strong); color: var(--ink); box-shadow: 0 1px 5px rgba(31, 47, 41, .12); }
.labNav {
  min-height: 58px;
  overflow-x: auto;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}

.joinBand {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(150px, auto) minmax(220px, 1fr) auto auto minmax(180px, 1fr) auto auto auto auto;
  gap: 12px;
  align-items: end;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.roomIdentity { display: grid; gap: 5px; align-self: center; min-width: 0; }
.roomIdentity span { color: var(--muted); font-size: .67rem; font-weight: 900; text-transform: uppercase; }
.roomIdentity strong { overflow: hidden; font-size: .95rem; text-overflow: ellipsis; white-space: nowrap; }
.coordinatorStatus { display: grid; gap: 5px; align-self: center; min-width: 0; }
.coordinatorStatus span { color: var(--muted); font-size: .67rem; font-weight: 900; text-transform: uppercase; }
.coordinatorStatus strong { overflow: hidden; font-size: .82rem; text-overflow: ellipsis; white-space: nowrap; }
.roomModelDisplay { display: grid; gap: 5px; align-self: center; min-width: 0; }
.roomModelDisplay span { color: var(--muted); font-size: .67rem; font-weight: 900; text-transform: uppercase; }
.roomModelDisplay strong { overflow: hidden; font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.accountsEnabled .legacyJoinControl { display: none; }
.accountsEnabled .joinBand { grid-template-columns: minmax(180px, 1fr) minmax(150px, auto) minmax(220px, 1fr) auto auto auto auto auto; }

label { display: grid; gap: 6px; color: var(--muted); font-family: var(--mono); font-size: .68rem; font-weight: 500; letter-spacing: .055em; text-transform: uppercase; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-strong);
  color: var(--ink); padding: 0 11px; outline: none; text-transform: none;
}
input, select { height: 40px; }
textarea { min-height: 96px; padding: 11px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: rgba(47, 107, 61, .75); box-shadow: 0 0 0 3px rgba(47, 107, 61, .09); }

button, .button { min-height: 40px; border: 1px solid transparent; border-radius: 9px; padding: 0 15px; font-weight: 650; transition: transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease; }
.button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.button.disabled { cursor: not-allowed; opacity: .45; }
.primary { background: var(--green); color: white; box-shadow: 0 10px 24px rgba(47, 107, 61, .14); }
.primary:hover:not(:disabled) { background: var(--green-bright); transform: translateY(-1px); box-shadow: 0 14px 30px rgba(47, 107, 61, .19); }
.secondary:hover:not(:disabled) { border-color: var(--line-strong); background: var(--surface-soft); }
button:focus-visible, .button:focus-visible, .toolNav a:focus-visible, summary:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
.primary.joining { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.primary.joining:disabled { opacity: .8; }
.primary.joining::before {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: white;
  border-radius: 50%;
  content: "";
  animation: join-spinner .7s linear infinite;
}
@keyframes join-spinner { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .primary.joining::before, .accountBootSpinner, .roomBootSpinner { animation-duration: 1.4s; }
}
.secondary { background: var(--surface-strong); border-color: var(--line); color: var(--ink); }
.danger { background: #fff7f7; border-color: #d7a6aa; color: var(--red); }
.secondary.attention { border-color: var(--amber); color: var(--amber); background: var(--amber-soft); }
.textButton { min-height: auto; padding: 3px 0; border: 0; background: transparent; color: var(--blue); font-size: .78rem; }

.roleSwitch { display: grid; grid-template-columns: 1fr 1fr; background: #e2e8e4; border-radius: 6px; padding: 3px; }
.roleSwitch button { min-height: 34px; padding: 0 12px; border: 0; background: transparent; color: var(--muted); }
.roleSwitch button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(31, 47, 41, .12); }

.notice { margin-top: 18px; padding: 10px 12px; border-left: 3px solid var(--amber); background: var(--amber-soft); color: #70421e; font-size: .82rem; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 26px; margin-top: 22px; }
.mainColumn, .sideColumn { min-width: 0; }
.sectionBlock { padding: 0 0 24px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.sideSection { padding: 0 0 22px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.sectionHead { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.sectionHead.compact { align-items: center; margin-bottom: 12px; }
.sectionHead h2 { margin: 2px 0 0; font-size: 1.15rem; letter-spacing: 0; }
.sectionHead > span { color: var(--muted); font-size: .78rem; text-align: right; }
.eyebrow { margin: 0; color: var(--muted); font-family: var(--mono); font-size: .67rem; font-weight: 500; letter-spacing: .11em; text-transform: uppercase; }

.pipeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; min-height: 112px; }
.pipelineEmpty { display: grid; place-items: center; min-height: 112px; border: 1px dashed #bdc8c3; color: var(--muted); font-size: .84rem; }
.shard {
  position: relative; min-height: 112px; padding: 14px; border: 1px solid var(--line);
  border-top: 3px solid var(--blue); border-radius: 6px; background: var(--surface);
}
.shard.active { border-top-color: var(--amber); background: #fffdf9; }
.shard.loading { border-top-color: var(--amber); background: #fffdf9; }
.shard.done { border-top-color: var(--green); }
.shard.failed { border-top-color: var(--red); }
.shardIndex { color: var(--muted); font-size: .68rem; font-weight: 850; text-transform: uppercase; }
.shard strong { display: block; margin-top: 12px; font-size: 1.15rem; }
.shard small { display: block; margin-top: 5px; color: var(--muted); }
.shardProgress { display: block; width: 100%; height: 8px; margin-top: 10px; accent-color: var(--green); }

.capacityBlock[hidden] { display: none; }
.capacityControls { display: flex; flex-wrap: wrap; gap: 12px; margin: 14px 0 8px; }
.capacityControls > label { width: 150px; }
.capacityProbeNote { margin: 0 0 14px; color: var(--muted); font-size: .75rem; }
.capacityRequirements { margin-bottom: 14px; }
.capacityRequirementGrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.capacityRequirement { min-height: 92px; padding: 12px; border-right: 1px solid var(--line); }
.capacityRequirement:last-child { border-right: 0; }
.capacityRequirement span, .capacityRequirement small { display: block; color: var(--muted); font-size: .7rem; }
.capacityRequirement span { font-weight: 850; text-transform: uppercase; }
.capacityRequirement strong { display: block; margin: 7px 0 4px; font-size: 1.05rem; }
.capacityRequirement .capacityDeficit { color: var(--red); }
.capacityRequirement .capacityMet { color: var(--green); }
.suffixInput { position: relative; }
.suffixInput input { width: 100%; padding-right: 32px; }
.suffixInput span { position: absolute; right: 11px; top: 50%; color: var(--muted); transform: translateY(-50%); }
.capacityPlan { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.capacityStage { padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.capacityStage span, .capacityStage small { display: block; color: var(--muted); font-size: .72rem; }
.capacityStage strong { display: block; margin: 5px 0; }
.capacityEmpty { padding: 18px; border: 1px dashed #bdc8c3; color: var(--muted); font-size: .82rem; }

@media (max-width: 760px) {
  .capacityRequirement { border-right: 0; border-bottom: 1px solid var(--line); }
  .capacityRequirement:last-child { border-bottom: 0; }
}

.runControls { display: grid; grid-template-columns: 80px 100px 90px 100px 140px 150px minmax(130px, auto); gap: 12px; align-items: end; margin-top: 14px; }
.runButton { justify-self: start; }
.generationEstimate { margin: 10px 0 0; color: var(--muted); font-size: .75rem; }
.generationEstimate.error, .codingGenerateControls > span.error { color: var(--red); font-weight: 750; }
.codingWorkspaceActions { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.codingWorkspaceActions p { margin: 0 0 0 auto; max-width: 520px; color: var(--muted); font-size: .75rem; line-height: 1.45; text-align: right; }
.codingWorkspaceGrid, .codingOutputGrid { display: grid; grid-template-columns: minmax(240px, .72fr) minmax(0, 1.28fr); gap: 12px; }
.codingFilePane, .codingFilePreviewPane, .codingOutputGrid > section { min-width: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); overflow: hidden; }
.codingFileTools { display: grid; grid-template-columns: minmax(120px, 1fr) auto auto; align-items: center; gap: 10px; padding: 9px 10px; border-bottom: 1px solid var(--line); }
.codingFileTools input { height: 34px; }
.codingFileList { height: 250px; overflow: auto; }
.codingFileList > p { margin: 0; padding: 18px; color: var(--muted); font-size: .8rem; }
.codingFileRow { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 6px; padding: 7px 10px; border-bottom: 1px solid #edf0ee; }
.codingFileRow:hover { background: #f8faf8; }
.codingFileRow input { width: 16px; height: 16px; }
.codingFileName { min-height: auto; padding: 0; border: 0; background: transparent; color: var(--ink); font: .75rem/1.4 var(--mono); font-weight: 650; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.codingFileRow small { color: var(--muted); font-size: .65rem; }
.codingSelectedSummary { margin: 0; padding: 8px 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: .7rem; }
.codingPaneLabel { padding: 9px 11px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .67rem; font-weight: 850; text-transform: uppercase; }
.codingPatchHead { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.codingEditPatchBtn { min-width: 28px; min-height: 28px; padding: 0 8px; border: 1px solid var(--line); background: var(--surface); color: var(--blue); font-size: 1rem; line-height: 1; }
.codingEditPatchBtn.saving { min-width: 52px; font-size: .7rem; }
#codingFilePreview { height: 250px; margin: 0; padding: 12px; overflow: auto; white-space: pre; color: #35423e; font: .72rem/1.55 var(--mono); }
.codingTaskLabel { margin-top: 14px; }
.codingPromptTemplates { margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.codingPromptTemplates summary { cursor: pointer; color: var(--blue); font-size: .76rem; font-weight: 800; }
.codingTemplateGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.codingTemplateGrid textarea { min-height: 190px; font: .7rem/1.45 var(--mono); }
.codingTemplateFooter { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 10px; color: var(--muted); font-size: .7rem; }
.codingTemplateFooter code { color: var(--ink); }
.codingGenerateControls { display: grid; grid-template-columns: 130px 120px auto minmax(180px, 1fr); align-items: end; gap: 12px; margin: 12px 0 16px; }
.codingGenerateControls > span { align-self: center; color: var(--muted); font-size: .74rem; text-align: right; }
.codingOutputGrid { grid-template-columns: 1fr 1fr; }
.codingOutputGrid > section { min-height: 310px; }
#codingPatchEditor { width: 100%; height: 310px; min-height: 310px; border: 0; border-radius: 0; padding: 12px; resize: vertical; white-space: pre; font: .72rem/1.5 var(--mono); }
#codingPatchEditor[readonly] { background: #f8faf9; color: #46534e; }
#codingPatchEditor:focus { box-shadow: inset 0 0 0 2px var(--blue); }
.codingDiff { height: 310px; overflow: auto; font: .72rem/1.5 var(--mono); }
.codingDiff > p { margin: 0; padding: 18px; color: var(--muted); font-family: var(--sans); }
.codingDiffFile { border-bottom: 1px solid var(--line); }
.codingDiffFile:last-child { border-bottom: 0; }
.codingDiffFile h3 { position: sticky; top: 0; z-index: 1; margin: 0; padding: 8px 11px; background: #f5f7f5; border-bottom: 1px solid var(--line); font-size: .72rem; }
.codingDiffLine { display: grid; grid-template-columns: 22px minmax(0, 1fr); padding: 1px 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.codingDiffLine.add { background: var(--green-soft); color: #125845; }
.codingDiffLine.remove { background: #f8e7e9; color: #8a303b; }
.codingDiffLine.meta { color: var(--muted); font-style: italic; }
.codingDiffLine span:first-child { user-select: none; color: inherit; opacity: .75; }
.codingReviewBar { display: grid; grid-template-columns: auto minmax(120px, 1fr) auto; align-items: center; gap: 16px; margin-top: 12px; }
.codingReviewBar > strong { font-size: .82rem; }
.codingReviewBar > span { color: var(--muted); font-size: .72rem; }
.codingReviewBar > div { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.outputBlock { border-bottom: 0; }
.generationResult { padding: 18px 20px; border: 1px solid var(--line); background: var(--surface); }
.generationResult > span, .resultValue span { color: var(--muted); font-size: .67rem; font-weight: 850; text-transform: uppercase; }
.generationResult > strong { display: block; margin-top: 11px; white-space: pre-wrap; font-size: 1.05rem; line-height: 1.65; overflow-wrap: anywhere; }
.resultSummary, .resultAdvancedGrid { display: grid; gap: 1px; background: var(--line); }
.resultSummary { grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-top: 0; }
.resultAdvanced { margin-top: 14px; border: 1px solid var(--line); background: var(--surface); }
.resultAdvanced > summary { padding: 14px 16px; color: #4f5c57; cursor: pointer; font-size: .76rem; font-weight: 800; }
.resultAdvanced[open] > summary { border-bottom: 1px solid var(--line); }
.resultAdvancedGrid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.resultValue { min-height: 84px; padding: 14px; background: var(--surface); }
.resultValue strong { display: block; margin-top: 9px; font-size: 1.15rem; overflow-wrap: anywhere; }
.resultValue strong.resultGood { color: var(--green); }
.resultValue strong.resultBad { color: var(--red); }
.resultAdvanced .stageMetrics { padding: 0 14px 12px; border-top: 1px solid var(--line); }
.metricRow { display: grid; grid-template-columns: minmax(120px, 1fr) 90px 90px; gap: 12px; padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: .8rem; }
.metricRow span:not(:first-child) { text-align: right; color: var(--muted); }
.metricRow.microshardMetric { display: block; padding-left: 18px; color: var(--muted); }

.peerList { display: grid; gap: 8px; }
.participantList { display: grid; gap: 7px; }
.participantSectionActions { display: flex; align-items: center; gap: 9px; }
.participantSectionActions span { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.participantSectionActions button { min-height: 30px; padding: 0 10px; font-size: .7rem; }
.participantMachineGroup { padding: 11px 0 3px; border-bottom: 1px solid var(--line); }
.participantMachineGroup:last-child { border-bottom: 0; }
.participantMachineGroup > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 4px; }
.participantMachineGroup > header strong, .participantMachineGroup > header small { display: block; }
.participantMachineGroup > header strong { font-size: .86rem; }
.participantMachineGroup > header small, .participantMachineGroup > header > span { color: var(--muted); font-size: .68rem; }
.participantMachineGroup .participantRow { padding-left: 12px; }
.participantRow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.participantRow:last-child { border-bottom: 0; }
.participantRow strong, .participantRow small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.participantRow strong { font-size: .82rem; }
.participantRow small { margin-top: 2px; color: var(--muted); font-size: .7rem; }
.participantNameLine { display: flex; align-items: center; gap: 6px; min-width: 0; }
.participantNameLine strong { min-width: 0; }
.participantBadge { flex: 0 0 auto; padding: 2px 6px; border-radius: 99px; background: #e9f2ee; color: var(--green); font-size: .62rem; font-weight: 850; white-space: nowrap; }
.participantStatus { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 4px; padding: 2px 6px; border-radius: 99px; font-size: .62rem; font-weight: 850; white-space: nowrap; }
.participantStatus.ready, .participantStatus.online { background: var(--green-soft); color: var(--green); }
.participantStatus.pending { background: var(--amber-soft); color: var(--amber); }
.participantStatus.blocked { background: #f9e8ea; color: var(--red); }
.participantStatus.offline { background: #eef1ef; color: var(--muted); }
.participantStatusSpinner { width: 8px; height: 8px; border: 1.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: modelPrepareSpin .8s linear infinite; }
.participantActions { display: flex; align-items: center; gap: 6px; }
.participantActions button { min-height: 30px; padding: 0 8px; border-color: var(--line); background: var(--surface); font-size: .68rem; }
.participantActions .danger { border-color: #d7a6aa; background: #fff7f7; color: var(--red); }
.participantRole { color: var(--blue); font-size: .66rem; font-weight: 850; text-transform: uppercase; }
.peerEmpty { padding: 18px 0; color: var(--muted); font-size: .82rem; }
.peerRow { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.peerDot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.peerDot.bad { background: var(--red); }
.peerRow strong { display: block; font-size: .82rem; overflow: hidden; text-overflow: ellipsis; }
.peerRow small { color: var(--muted); }
.peerRow .shardProgress { height: 6px; margin-top: 6px; }
.peerCapacity { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 3px; }
.peerCapacity label { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: .68rem; }
.peerCapacity input { width: 66px; height: 28px; padding: 4px 6px; font-size: .72rem; }
.peerBadge { color: var(--blue); font-size: .66rem; font-weight: 850; text-transform: uppercase; }

.runtimeDetails { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 9px; margin: 0; font-size: .78rem; }
.runtimeDetails dt { color: var(--muted); }
.runtimeDetails dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.artifactSourceControls { display: grid; gap: 8px; }
.artifactSourceControls p { margin: 0; color: var(--muted); font-size: .76rem; overflow-wrap: anywhere; }
.artifactSourceControls .artifactSourceStatus { color: var(--green); font-weight: 700; }
.artifactSourceControls .artifactSourceStatus.permissionNeeded { display: flex; align-items: flex-start; gap: 6px; color: var(--red); }
.artifactSourceControls .artifactSourceStatus.permissionNeeded::before { width: 15px; height: 15px; display: inline-grid; flex: 0 0 15px; place-items: center; margin-top: 1px; border-radius: 50%; background: var(--red); color: #fff; content: "!"; font-size: .65rem; font-weight: 900; line-height: 1; }
.artifactSourceControls > div { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.artifactSourceControls .secondary { min-height: 34px; padding: 7px 10px; font-size: .76rem; }
.logSection { border-bottom: 0; }
.logActions { display: flex; align-items: center; gap: 14px; }
#eventLog { height: 260px; margin: 0; overflow: auto; white-space: pre-wrap; color: #43504b; font: .7rem/1.55 var(--mono); }

.compatibilityGrid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 26px; margin-top: 22px; }
.compatibilityMain { min-width: 0; }
.compatibilitySide { min-width: 0; }
.modelControls { display: grid; grid-template-columns: 220px minmax(220px, 1fr) minmax(260px, 1fr); gap: 12px; }
.compatibilityPrompt { margin-top: 14px; }
.compatibilityActions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.downloadRow { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; margin-top: 16px; color: var(--muted); font-size: .76rem; }
.downloadRow progress { width: 100%; height: 8px; accent-color: var(--green); }
.compatibilityResults .resultValue:nth-child(4n) { border-right: 0; }
.capacityTestShell { width: min(var(--content-width), 100%); }
.capacityTestShell > .pageIntro, .capacityTestShell > .capacityRunner, .capacityTestShell > .capacityDisclosure { width: min(920px, 100%); margin-left: auto; margin-right: auto; }
.capacityTestShell .pageIntro { margin-bottom: 24px; }
.capacityRunner { padding: clamp(20px, 4vw, 30px); border: 1px solid var(--line-strong); border-radius: 12px; background: rgba(251, 252, 248, .88); box-shadow: 0 18px 44px rgba(31, 48, 29, .08); }
.capacityRunnerHead { display: flex; justify-content: space-between; align-items: start; gap: 24px; }
.capacitySaved span, .capacitySaved strong { display: block; }
.capacitySaved span { color: var(--muted); font-size: .68rem; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.capacitySaved strong { margin-top: 5px; font-size: clamp(1.55rem, 4vw, 2.15rem); letter-spacing: -.035em; }
.capacitySaved p { margin: 3px 0 0; color: var(--muted); font-size: .82rem; }
.capacityReady { flex: 0 0 auto; padding: 5px 9px; border-radius: 999px; background: var(--surface-soft); color: var(--muted); font-size: .72rem; font-weight: 750; }
.capacityReady.good { background: var(--green-soft); color: var(--green); }
.capacityReady.warn { background: var(--amber-soft); color: var(--amber); }
.capacityReady.bad { background: #f9e8ea; color: var(--red); }
.capacityWarning { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 11px; margin-top: 22px; border-radius: 0 7px 7px 0; }
.capacityWarningIcon { width: 22px; height: 22px; display: grid; place-items: center; margin-top: 1px; border-radius: 50%; background: var(--amber); color: white; font-size: .78rem; font-weight: 900; line-height: 1; }
.capacityWarning strong { display: block; margin-bottom: 2px; }
.capacityTestControls { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 12px; align-items: end; }
.capacityTestActions, .capacityCustomActions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.capacityStop { color: var(--red); border-color: rgba(185, 71, 59, .35); }
.capacityProgress { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; margin-top: 18px; color: var(--muted); font-size: .76rem; }
.capacityProgress progress { width: 100%; height: 8px; accent-color: var(--green); }
.capacityDisclosure { margin-top: 14px; border: 1px solid var(--line); border-radius: 9px; background: rgba(251, 252, 248, .66); overflow: hidden; }
.capacityDisclosure > summary { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 16px 18px; cursor: pointer; list-style-position: inside; font-weight: 750; }
.capacityDisclosure > summary::marker { color: var(--green); }
.capacityDisclosure > summary small { color: var(--muted); font-size: .72rem; font-weight: 500; text-align: right; }
.capacityDisclosure[open] > summary { border-bottom: 1px solid var(--line); }
.capacityDisclosureBody { padding: 20px; }
.capacityProbeNote { margin: 12px 0 0; color: var(--muted); font-size: .76rem; }
.capacityDetailSection + .capacityDetailSection { margin-top: 26px; padding-top: 24px; border-top: 1px solid var(--line); }
.resultGrid.capacityTestResults { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; border: 1px solid var(--line); background: var(--line); }
.capacityTestResults .resultValue { min-height: 92px; }
.capacityCycleList { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-top: 14px; }
.capacityCycle { padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.capacityCycle span, .capacityCycle small { display: block; color: var(--muted); font-size: .72rem; }
.capacityCycle strong { display: block; margin: 6px 0; }
.capacityCycle small + small { margin-top: 4px; }
.capacityCycle .capacityError { color: var(--red); }
.capacityHistory { display: grid; gap: 8px; }
.capacityHistoryHead { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 8px; }
.capacityHistoryHead p { margin: 0; color: var(--muted); font-size: .78rem; }
.capacityHistoryRow { display: grid; grid-template-columns: 58px minmax(150px, .7fr) minmax(220px, 1fr) auto; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .78rem; }
.capacityHistoryRow > span, .capacityHistoryRow > small { color: var(--muted); }
.capacityChartWrap { position: relative; min-height: 300px; margin-top: 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); overflow: hidden; }
.capacityChart { display: block; width: 100%; min-height: 280px; }
.capacityChartWrap > .capacityEmpty { position: absolute; inset: 0; display: grid; place-items: center; border: 0; text-align: center; }
.capacityChartWrap > .capacityEmpty[hidden] { display: none; }
.capacityChartLegend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 10px; color: var(--muted); font-size: .72rem; }
.capacityChartLegend span { display: inline-flex; align-items: center; gap: 6px; }
.chartSwatch { width: 18px; height: 3px; border-radius: 2px; background: var(--green); }
.chartSwatch.random { background: #2b62a3; }
.chartInterrupted { color: var(--red); font-size: 1rem; font-weight: 800; line-height: .7; }
.chartGrid { stroke: #dbe2de; stroke-width: 1; }
.chartAxisLabel, .chartAxisTitle { fill: var(--muted); font: 11px var(--mono); }
.chartYAxis { text-anchor: end; }
.chartXAxis { text-anchor: end; }
.chartAxisTitle { font-weight: 750; }
.chartLine { fill: none; stroke: var(--green); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chartLine.random { stroke: #2b62a3; }
.chartPoint { fill: var(--surface); stroke: var(--green); stroke-width: 3; }
.chartPoint.random { stroke: #2b62a3; }
.chartCliff { stroke: var(--green); stroke-width: 1.5; stroke-dasharray: 5 5; opacity: .75; }
.chartCliff.random { stroke: #2b62a3; }
.chartFailure { fill: none; stroke: var(--red); stroke-width: 3; stroke-linecap: round; }
.capacityRuntimeDetails { grid-template-columns: 120px minmax(0, 1fr); }
.resultGood { color: var(--green); }
.resultBad { color: var(--red); }
.outputComparison { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.outputComparison article { min-width: 0; border: 1px solid var(--line); background: var(--surface); }
.outputComparison article > span { display: block; padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .67rem; font-weight: 850; text-transform: uppercase; }
.outputComparison pre { min-height: 120px; margin: 0; padding: 12px; overflow: auto; white-space: pre-wrap; font: .78rem/1.55 var(--mono); }
#status.good { color: var(--green); }
#status.warn { color: var(--amber); }
#status.bad { color: var(--red); }

body.worker .runBlock, body.worker .codingBlock, body.worker .outputBlock { display: none; }
body.worker .mainColumn .sectionBlock:first-child { border-bottom: 0; }

@media (max-width: 960px) {
  .workspace { grid-template-columns: 1fr; }
  .sideColumn { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
  .logSection { grid-column: 1 / -1; }
  .resultAdvancedGrid { grid-template-columns: repeat(2, 1fr); }
  .resultValue { border-bottom: 1px solid var(--line); }
  .compatibilityGrid { grid-template-columns: 1fr; }
  .capacityTestControls { grid-template-columns: repeat(2, 1fr); }
  .resultGrid.capacityTestResults { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modelControls { grid-template-columns: 1fr 1fr; }
  .modelControls label:last-child { grid-column: 1 / -1; }
  .codingWorkspaceGrid { grid-template-columns: 1fr; }
  .codingTemplateGrid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .accountScreen { padding: 14px; place-items: start center; }
  .accountCard { padding: 20px; }
  .accountInlineForm, .accountRoom, .accountInvite, .accountEmailInvite, .accountStepForm, .accountCapacityForm { grid-template-columns: 1fr; }
  .capacityRunnerHead, .capacityHistoryHead { align-items: flex-start; flex-direction: column; }
  .accountRoomActions { justify-content: flex-start; }
  .accountPendingInvitation { align-items: flex-start; flex-direction: column; }
  .accountInvite strong, .accountInvite small, .accountEmailInvite small { grid-column: auto; }
  .appShell { padding: 0 16px 32px; }
  .topbar { align-items: flex-start; padding: 18px 0; }
  .brand p { display: none; }
  .topbarActions { gap: 8px; }
  .accountToolbar { flex-wrap: wrap; gap: 6px; }
  .accountToolbar .accountNameButton { max-width: 132px; }
  .accountProfileForm { padding: 21px; }
  .connectionState { display: none; }
  .joinBand { grid-template-columns: 1fr 1fr; }
  .accountsEnabled .joinBand { grid-template-columns: 1fr 1fr; }
  .joinBand label { grid-column: 1 / -1; }
  .runControls { grid-template-columns: 1fr 1fr; }
  .capacityControls { display: grid; grid-template-columns: 1fr 1fr; }
  .capacityControls > label { width: auto; }
  .runButton { width: 100%; }
  .sideColumn { grid-template-columns: 1fr; }
  .logSection { grid-column: auto; }
  .modelControls, .outputComparison { grid-template-columns: 1fr; }
  .codingOutputGrid { grid-template-columns: 1fr; }
  .codingWorkspaceActions { align-items: stretch; flex-wrap: wrap; }
  .codingWorkspaceActions p { flex-basis: 100%; margin-left: 0; text-align: left; }
  .codingGenerateControls, .codingReviewBar { grid-template-columns: 1fr; }
  .codingGenerateControls > span { text-align: left; }
  .codingReviewBar > div { justify-content: flex-start; }
  .capacityTestControls { grid-template-columns: 1fr 1fr; }
  .capacityHistoryRow { grid-template-columns: 52px minmax(0, 1fr) auto; }
  .capacityHistoryRow > small { grid-column: 2 / -1; }
  .modelControls label:last-child { grid-column: auto; }
}

@media (max-width: 440px) {
  .topbar { flex-direction: column; align-items: stretch; gap: 12px; }
  .topbar > .toolNav { width: 100%; }
  .topbar > .toolNav a { flex: 1; justify-content: center; }
  .connectionState { font-size: 0; }
  .joinBand, .runControls { grid-template-columns: 1fr; }
  .joinBand label { grid-column: auto; }
  .resultSummary, .resultAdvancedGrid { grid-template-columns: 1fr; }
  .resultValue { border-right: 0; }
  .capacityTestControls, .capacityProgress, .capacityHistoryRow, .resultGrid.capacityTestResults { grid-template-columns: 1fr; }
  .capacityHistoryRow > small { grid-column: auto; }
  .capacityDisclosure > summary { align-items: flex-start; flex-direction: column; gap: 2px; }
  .capacityDisclosure > summary small { text-align: left; }
}

/* Coordinator flow */
.roomBoot {
  min-height: min(420px, calc(100vh - 190px));
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: .9rem;
}
.roomBoot[hidden] { display: none; }
.roomBootSpinner {
  width: 28px;
  height: 28px;
  border: 3px solid #d7dfdb;
  border-top-color: var(--green);
  border-radius: 50%;
  animation: join-spinner .7s linear infinite;
}
#labApp.roomInitializing > :not(.roomBoot) { display: none; }

.coordinatorFlow {
  width: 100%;
  margin: 34px auto 0;
}
.flowIntro { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin: 0 0 22px; }
.flowIntro h2 { margin: 5px 0 5px; font-size: clamp(1.55rem, 3vw, 2.2rem); letter-spacing: -.035em; }
.flowRoomActions { flex: 0 0 auto; display: grid; justify-items: end; gap: 7px; }
.flowRoomActions > span { max-width: 280px; color: var(--green); font-size: .72rem; text-align: right; }
.flowRoomActions > span:empty { display: none; }
.flowRoomActions > span.error { color: var(--red); }
.flowCards { display: grid; gap: 14px; }
.setupBanner {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  padding: 15px 17px;
  border: 1px solid #e0cf9e;
  border-radius: 10px;
  background: #fffaf0;
}
.setupBanner.ready { border-color: #b9d7cc; background: var(--green-soft); }
.setupBannerIcon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: #936f20; color: white; font-weight: 900; line-height: 1; }
.setupBanner.ready .setupBannerIcon { background: var(--green); }
.setupBanner.ready .setupBannerIcon { font-size: 0; }
.setupBanner.ready .setupBannerIcon::before { width: 7px; height: 13px; border: solid white; border-width: 0 2px 2px 0; content: ""; transform: translate(-1px, -1px) rotate(45deg); }
.setupBanner > div strong, .setupBanner > div span { display: block; }
.setupBanner > div > span { margin-top: 3px; color: var(--muted); font-size: .74rem; }
.setupBanner button { white-space: nowrap; }
.flowCard {
  scroll-margin-top: 18px;
  border: 1px solid #d2dbd6;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(20, 42, 34, .035);
  overflow: clip;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.flowCard[open] { border-color: var(--line-strong); box-shadow: 0 18px 45px rgba(31, 48, 29, .09); }
.flowCard > summary {
  min-height: 82px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 28px 18px;
  align-items: center;
  gap: 15px;
  padding: 18px 22px;
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.flowCard > summary::-webkit-details-marker { display: none; }
.flowCard > summary:focus-visible { outline: 3px solid var(--blue-soft); outline-offset: -3px; }
.flowCard > summary strong { display: block; }
.flowCard > summary strong { color: var(--ink); font-size: 1rem; }
.flowNumber, .flowCheck {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: .86rem;
  font-weight: 900;
}
.flowNumber { border: 1px solid #b7c2bd; color: #58645f; background: #f9fbfa; }
.flowCheck { visibility: hidden; background: var(--green); color: white; }
.flowCard.complete .flowNumber { border-color: #b9d7cc; color: var(--green); background: var(--green-soft); }
.flowCard.complete .flowCheck { visibility: visible; }
.flowChevron { width: 10px; height: 10px; border-right: 2px solid #77827e; border-bottom: 2px solid #77827e; transform: rotate(45deg) translate(-2px, 2px); transition: transform .15s ease; }
.flowCard[open] .flowChevron { transform: rotate(225deg) translate(-1px, -1px); }
.flowBody { padding: 4px 24px 24px 77px; border-top: 1px solid #e5ebe8; }
.modelChoiceIntro { margin: 20px 0 0; max-width: 720px; color: var(--muted); font-size: .8rem; line-height: 1.55; }
.flowModelControl { padding-top: 22px; }
.flowModelControl > .roomModelControl, .flowModelControl > .roomModelDisplay { width: 100%; }
#flowModelControl > label { height: 100%; }
#flowModelControl select { margin-top: auto; }
#flowModelControl[hidden] + .roomModelDisplay { display: grid; }
.flowModelNoticesLink { display: inline-block; margin-top: 8px; font-size: .78rem; font-weight: 700; }
.modelSetupStage { margin-top: 20px; padding-top: 20px; border-top: 1px solid #e5ebe8; }
.modelSetupStage.modelSelectionStage { margin-top: 0; padding-top: 0; border-top: 0; }
.modelSetupStage h3 { margin: 0 0 10px; font-size: .9rem; }
.modelSetupStage > p { margin: 8px 0 0; color: var(--muted); font-size: .76rem; line-height: 1.5; }
.modelDownloadLink { min-height: auto; padding: 2px 0; border: 0; border-radius: 0; background: transparent; color: var(--blue); font-size: .82rem; font-weight: 800; text-align: left; }
.modelDownloadLink:hover:not(:disabled) { background: transparent; text-decoration: underline; }
.modelSetupFeedback { display: block; margin-top: 8px; color: var(--green); font-size: .72rem; }
.modelSetupFeedback:empty { display: none; }
.modelSetupFeedback.error { color: var(--red); }
.modelPreparation { margin-top: 24px; padding: 20px; border: 1px solid #dce4e0; border-radius: 9px; background: #f8faf9; }
.modelPreparationHead h3 { margin: 0; font-size: 1rem; }
.modelPreparationHead p { margin: 6px 0 0; color: var(--muted); font-size: .76rem; line-height: 1.5; }
.modelPreparation .modelSetupStage { border-color: #dce4e0; }
.modelRequirementStrip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 18px;
  border: 1px solid #dce4e0;
  border-radius: 9px;
  background: #f8faf9;
}
.modelRequirementStrip > div { padding: 13px 16px; border-right: 1px solid #dce4e0; }
.modelRequirementStrip > div:last-child { border-right: 0; }
.modelRequirementStrip strong, .modelRequirementStrip span { display: block; }
.modelRequirementStrip strong { font-size: .9rem; }
.modelRequirementStrip span { margin-top: 2px; color: var(--muted); font-size: .68rem; }
.openSourceNotices { margin: 18px 0 0; }
.openSourceNotices > div { padding: 14px 0; border-top: 1px solid #e5ebe8; }
.openSourceNotices dt { font-weight: 800; }
.openSourceNotices dd { margin: 5px 0 0; color: var(--muted); line-height: 1.55; }
.flowDisclosure { margin-top: 16px; border-top: 1px solid #e5ebe8; }
.flowDisclosure > summary, .manageDiagnostics > summary { padding: 14px 0 4px; color: #4f5c57; cursor: pointer; font-size: .76rem; font-weight: 800; }
.flowDisclosure[open] > summary { margin-bottom: 12px; }
.legacyFlowControls { display: none; }
.flowFooter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid #e5ebe8;
}
.flowFooter > span { color: var(--muted); font-size: .78rem; }
.flowFooter button { flex: 0 0 auto; }
.modelPrepareStatus { display: grid; gap: 5px; color: var(--muted); font-size: .78rem; }
.modelPrepareStatus > span { color: var(--muted); }
.modelPrepareStatus > span:first-of-type { color: var(--ink); font-weight: 750; }
.modelPrepareStatus > span.error { color: var(--red); }
.modelPrepareIndicator { display: grid; grid-template-columns: 24px minmax(220px, 360px); align-items: center; gap: 11px; color: var(--ink); }
.modelPrepareIndicator[hidden] { display: none; }
.modelPrepareIndicator strong, .modelPrepareIndicator span { display: block; }
.modelPrepareIndicator strong { font-size: .82rem; }
.modelPrepareIndicator > div > span { margin-top: 3px; color: var(--muted); font-size: .72rem; }
.modelPrepareSpinner { width: 22px; height: 22px; border: 3px solid #d9e3dd; border-top-color: var(--green); border-radius: 50%; animation: modelPrepareSpin .8s linear infinite; }
.modelPrepareTrack { width: 100%; height: 5px; margin-top: 7px; border-radius: 99px; background: #e4eae7; overflow: hidden; }
.modelPrepareTrack > span { width: 0; height: 100%; border-radius: inherit; background: var(--green); transition: width .2s ease; }
.modelPrepareTrack > span.indeterminate { animation: modelPrepareIndeterminate 1.25s ease-in-out infinite; }
@keyframes modelPrepareSpin { to { transform: rotate(360deg); } }
@keyframes modelPrepareIndeterminate { 0% { transform: translateX(-120%); } 50% { transform: translateX(90%); } 100% { transform: translateX(300%); } }
#flowModelAdvanced > .assignmentSettings { margin-top: 4px; }
#flowModelAdvanced > .assignmentAdvancedGrid { margin-top: 16px; }
#flowModelAdvanced > #flowAssignmentContent:not(:empty), #flowModelAdvanced > #flowCapacityDetails, #flowModelAdvanced > #flowExecutionGraph { margin-top: 20px; }
.workerProgressFooter { margin-top: 18px; }
.workerProgressHead { display: flex; justify-content: space-between; gap: 16px; font-size: .8rem; }
.workerProgressHead span { color: var(--muted); }
.workerProgressTrack { height: 7px; margin-top: 9px; border-radius: 99px; background: #e4eae7; overflow: hidden; }
.workerProgressTrack span { width: 0; height: 100%; display: block; border-radius: inherit; background: var(--green); transition: width .2s ease; }
.inviteLinkPanel {
  display: grid;
  gap: 13px;
  margin-top: 20px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}
.workerSetupIntro { margin: 20px 0 14px; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.inviteLinkHead { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.inviteLinkHead strong, .inviteLinkHead small { display: block; }
.inviteLinkHead strong { font-size: .86rem; }
.inviteLinkHead small { margin-top: 4px; color: var(--muted); font-size: .7rem; line-height: 1.4; }
.inviteLinkHead > span { flex: 0 0 auto; color: var(--green); font-size: .7rem; font-weight: 800; }
.inviteLinkAccess { min-width: 0; }
.inviteLinkDisclosure { min-width: 0; }
.inviteLinkDisclosure summary { color: var(--muted); cursor: pointer; font-size: .72rem; font-weight: 750; }
.inviteLinkDisclosure[open] summary { margin-bottom: 8px; }
.inviteLinkValue input { width: 100%; min-width: 0; font-family: var(--mono); font-size: .72rem; }
.inviteLinkActions { display: flex; gap: 8px; }
.inviteFeedback { grid-column: 1 / -1; min-height: 0; color: var(--green); font-size: .72rem; }
.inviteFeedback:empty { display: none; }
.inviteFeedback.error { color: var(--red); }
.workerActions { display: flex; align-items: center; gap: 14px; margin-top: 14px; padding: 14px 17px; border: 1px solid #dce4e0; border-radius: 9px; }
.workerActions span { color: var(--muted); font-size: .74rem; }
.workerActions .localWorkerStatus.error { color: var(--red); }
.flowAddLocalWorker { flex: 0 0 auto; }
.flowAddLocalWorker.joining { display: inline-flex; align-items: center; justify-content: center; gap: 8px; opacity: .8; }
.flowAddLocalWorker.joining::before { width: 13px; height: 13px; border: 2px solid rgba(24, 94, 72, .3); border-top-color: var(--green); border-radius: 50%; content: ""; animation: join-spinner .7s linear infinite; }
@media (prefers-reduced-motion: reduce) { .flowAddLocalWorker.joining::before { animation-duration: 1.4s; } }
.flowSectionGrid { display: grid; grid-template-columns: 1fr; gap: 18px; margin-top: 20px; }
.flowSectionGrid .sideSection { margin: 0; padding: 16px 18px; border: 1px solid #dce4e0; border-radius: 9px; }
.flowSectionGrid .sectionHead { margin-bottom: 8px; }
#flowHardwareDetails .sideSection { margin: 0; padding: 4px 0 0; border: 0; }
#flowHardwareDetails .hardwareProbeSettings { margin-bottom: 18px; padding-bottom: 18px; border-bottom: 1px solid #e5ebe8; }
.hardwareProbeSettings h3, .advancedCapacityDetails h3 { margin: 0 0 12px; font-size: .82rem; }
.hardwareProbeGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hardwareProbeGrid input, .hardwareProbeGrid select { width: 100%; }
#flowAssignmentContent .capacityBlock .sectionHead { margin: 0; }
#flowAssignmentContent > .sectionBlock, #flowExecutionGraph > .sectionBlock, #promptingPane > .sectionBlock, #codingPane > .sectionBlock { margin: 0; padding: 0; border: 0; }
#flowAssignmentContent > .capacityBlock:not([hidden]) { margin-top: 16px; padding: 14px 18px; border: 1px solid #dce4e0; border-radius: 9px; background: #f8faf9; }
#flowExecutionGraph { margin-top: 24px; padding-top: 22px; border-top: 1px solid #e5ebe8; }
.assignmentSettings { margin-top: 20px; padding: 17px 18px 18px; border: 1px solid #dce4e0; border-radius: 9px; background: #f8faf9; }
.assignmentSettingsHead { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.assignmentSettingsHead strong, .assignmentSettingsHead span { display: block; }
.assignmentSettingsHead strong { font-size: .86rem; }
.assignmentSettingsHead div > span { margin-top: 4px; color: var(--muted); font-size: .7rem; line-height: 1.4; }
.assignmentSettingsHead > span { flex: 0 0 auto; color: var(--green); font-size: .7rem; font-weight: 800; }
.assignmentSettingsGrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: end; margin-top: 15px; }
.assignmentSettingsGrid label { min-width: 0; }
.assignmentSettingsGrid input, .assignmentSettingsGrid select { width: 100%; }
.advancedConfiguration { margin-top: 18px; }
.assignmentAdvancedGrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: end; }
.assignmentAdvancedGrid input, .assignmentAdvancedGrid select { width: 100%; }
.modelDetailValue { display: flex; align-items: center; min-height: 40px; color: var(--ink); font-size: .95rem; font-weight: 850; }
.advancedCapacityDetails { margin-top: 20px; padding-top: 18px; border-top: 1px solid #e5ebe8; }
.flowRunBody { padding-top: 14px; }
.workbenchCard > summary { display: none; }
.workbenchCard[open] { box-shadow: 0 18px 45px rgba(31, 48, 29, .09); }
.workbenchCard .flowRunBody { padding: 24px; border-top: 0; }
.workbenchGate { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; padding: 14px 16px; border: 1px solid #e0cf9e; border-radius: 9px; background: #fffaf0; }
.workbenchGate[hidden] { display: none; }
.workbenchGate strong, .workbenchGate span { display: block; }
.workbenchGate span { margin-top: 3px; color: var(--muted); font-size: .72rem; }
.promptPrimaryAction { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.generationSettings { margin-top: 18px; }
.generationSettings > summary { padding-bottom: 10px; }
.generationSettingsBody { display: grid; gap: 14px; padding: 0 0 4px; }
.generationSettingsBody .promptLabel { margin: 0; }
.generationSettingsBody .promptRunControls { justify-content: flex-start; margin-top: 0; }
.emptyResult #promptingPane .outputBlock { display: none; }
.promptRunControls { display: flex; align-items: flex-end; justify-content: flex-end; gap: 12px; margin-top: 16px; }
.promptRunControls .contextTokensControl, .promptRunControls .maxTokensControl { width: 150px; }
.maxTokensControl small { font-size: inherit; font-weight: inherit; }
.stopGenerationButton { min-width: 138px; }
.runTabs { display: flex; gap: 4px; margin: 0 0 22px; padding: 6px; border-radius: 8px; background: #edf1ef; }
.runTabs button { flex: 1; min-height: 38px; border: 0; background: transparent; color: var(--muted); }
.runTabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 5px rgba(20, 42, 34, .13); }
.runTabs button:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
#promptingPane, #codingPane { min-width: 0; }
#promptingPane .outputBlock { margin-top: 28px; padding-top: 24px; border-top: 1px solid #e5ebe8; }
.manageRoomBtn::before { margin-right: 7px; content: "⚙"; font-size: .95rem; }
body.drawerOpen { overflow: hidden; }
.setupLayer { position: fixed; z-index: 110; inset: 0; }
.setupScrim { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; border-radius: 0; background: rgba(13, 24, 20, .34); cursor: default; }
.setupDrawer { position: absolute; top: 0; right: 0; width: min(720px, 100%); height: 100%; padding: 0 24px 32px; background: #f4f6f3; box-shadow: -18px 0 50px rgba(14, 30, 24, .18); overflow: auto; }
.setupDrawer > header { position: sticky; z-index: 2; top: 0; display: flex; align-items: center; justify-content: space-between; min-height: 88px; margin-bottom: 18px; border-bottom: 1px solid var(--line); background: #f4f6f3; }
.setupDrawer > header p, .setupDrawer > header h2 { margin: 0; }
.setupDrawer > header h2 { margin-top: 4px; font-size: 1.25rem; }
.setupDrawerCards { display: grid; gap: 14px; }
.setupDrawerCards .flowCard > summary { min-height: 68px; }
.setupDrawerCards .flowBody { padding-left: 24px; }
.setupDrawerCards #flowStep3 .modelPreparation { margin: 0; padding: 0; border: 0; background: transparent; }
.setupDrawerCards #flowStep3 .modelPreparationHead { display: none; }
.manageRoomLayer { position: fixed; z-index: 100; inset: 0; }
.manageScrim { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; border-radius: 0; background: rgba(13, 24, 20, .34); cursor: default; }
.manageDrawer {
  position: absolute;
  top: 0;
  right: 0;
  width: min(430px, 100%);
  height: 100%;
  padding: 0 26px 30px;
  background: var(--surface);
  box-shadow: -18px 0 50px rgba(14, 30, 24, .18);
  overflow: auto;
}
.manageDrawer > header { position: sticky; z-index: 2; top: 0; display: flex; align-items: center; justify-content: space-between; min-height: 76px; border-bottom: 1px solid var(--line); background: var(--surface); }
.manageDrawer > header h2 { margin: 0; font-size: 1.2rem; }
.drawerClose { width: 38px; min-height: 38px; padding: 0; border: 1px solid var(--line); background: var(--surface); color: #53605b; font-size: 1.5rem; font-weight: 400; }
.manageSection { padding: 22px 0; border-bottom: 1px solid var(--line); }
.manageSection h3 { margin: 0 0 12px; font-size: .88rem; }
.manageSection > small { display: block; margin-top: 8px; color: var(--muted); font-size: .7rem; line-height: 1.45; }
.manageSectionHead { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.manageSectionHead span, .manageSectionHead strong, .manageSectionHead small { display: block; }
.manageSectionHead span { color: var(--muted); font-size: .64rem; font-weight: 850; text-transform: uppercase; }
.manageSectionHead strong { margin-top: 5px; }
.manageSectionHead small { margin-top: 5px; color: #77827e; font-size: .7rem; }
.manageSectionHead small.online { color: var(--green); }
.manageParticipants .participantRow { grid-template-columns: minmax(0, 1fr) auto; }
.manageParticipants .participantActions { flex-wrap: wrap; justify-content: flex-end; }
#manageClaimCoordinator > button { width: 100%; margin-top: 12px; }
.manageDiagnostics { margin: 0; }
.manageDiagnostics .sideSection { margin: 14px 0 0; padding: 14px; border: 1px solid var(--line); border-radius: 8px; }
.manageDanger { border-bottom: 0; }
.manageDanger .danger { width: 100%; }
#manageResetRoom { display: grid; gap: 7px; margin-bottom: 10px; }
#manageResetRoom > span { color: var(--muted); font-size: .7rem; }
#manageResetRoom > span:empty { display: none; }

@media (max-width: 800px) {
  .coordinatorFlow { margin-top: 22px; }
  .flowCard > summary { grid-template-columns: 34px minmax(0, 1fr) 24px 14px; gap: 11px; padding: 16px; }
  .flowBody { padding: 2px 16px 20px; }
  .modelRequirementStrip { grid-template-columns: 1fr; }
  .modelRequirementStrip > div { border-right: 0; border-bottom: 1px solid #dce4e0; }
  .modelRequirementStrip > div:last-child { border-bottom: 0; }
  .pageIntro { margin-top: 22px; }
  .assignmentSettingsHead { display: block; }
  .assignmentSettingsHead > span { margin-top: 8px; }
  .assignmentSettingsGrid { grid-template-columns: 1fr 1fr; }
  .assignmentAdvancedGrid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .flowIntro { align-items: stretch; flex-direction: column; }
  .flowRoomActions { justify-items: stretch; }
  .flowRoomActions > span { max-width: none; text-align: left; }
  .flowCard > summary { grid-template-columns: 32px minmax(0, 1fr) 12px; }
  .flowCheck { display: none; }
  .flowFooter, .workerProgressHead, .workerActions { align-items: stretch; flex-direction: column; }
  .flowFooter button, .workerActions button { width: 100%; }
  .inviteLinkHead, .inviteLinkActions { align-items: stretch; flex-direction: column; }
  .assignmentSettingsGrid, .assignmentAdvancedGrid, .hardwareProbeGrid { grid-template-columns: 1fr; }
  .promptRunControls { align-items: stretch; flex-direction: column; }
  .promptPrimaryAction, .workbenchGate { align-items: stretch; flex-direction: column; }
  .promptPrimaryAction button, .workbenchGate button { width: 100%; }
  .setupBanner { grid-template-columns: 32px minmax(0, 1fr); }
  .setupBanner button { grid-column: 1 / -1; width: 100%; }
  .setupDrawer { padding-inline: 14px; }
  .setupDrawerCards .flowBody { padding-inline: 14px; }
  .promptRunControls .contextTokensControl, .promptRunControls .maxTokensControl { width: 100%; }
  .promptRunControls .stopGenerationButton { width: 100%; }
  .inviteLinkPanel button { width: 100%; }
  .topbarActions { flex: 0 0 auto; }
  .manageRoomBtn { padding: 0 11px; font-size: .72rem; }
  .manageDrawer { padding-inline: 18px; }
}
