/* Every color, face and radius used below comes from these tokens. The light theme is here;
   the dark theme below swaps the colors when <html data-theme="dark">. */
:root {
  --paper: #efeee9;
  --paper-2: #e7e6e0;
  --sheet: #f8f8f5;
  --sunk: #e0dfd8;
  --rule: #d3d2ca;
  --rule-strong: #b3b2a9;
  --ink: #151515;
  --ink-2: #4f4e48;
  --ink-3: #7d7c73;
  --accent: #2a3cf0;
  --accent-soft: #dcdff7;
  --danger: #a8281d;
  --danger-soft: #f3dfda;
  /* The avatar tiles' other two primaries, for the thinking glyph. */
  --tile-red: #e4572e;
  --tile-yellow: #f2b134;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  --sans: "Geist", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --radius: 3px;
  --radius-soft: 8px;
  --measure: 816px;
  --panel: 320px;
  --computer-panel: 420px;
  /* The computer view's terminal, matching the site's. */
  --term: #0d0f15;
  --term-ink: #ecebe6;
  --term-dim: #8d8d86;
  --term-prompt: #8fb8e8;
  --term-ok: #7fd6a4;
  --term-bad: #f08a7e;
  /* Shadows and the dialog scrim are --shade at each rule's alpha times --shade-depth,
     so dark paper can deepen them all at once. */
  --shade: 21 21 21;
  --shade-depth: 1;

  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  color-scheme: light;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  scrollbar-color: var(--rule-strong) transparent;
}
/* Warm charcoal paper with the same hierarchy: the sidebar sits a step darker, sheets and hovers a
   step lighter. The accent and danger lighten to stay readable; the terminal is already dark. */
:root[data-theme="dark"] {
  --paper: #191918;
  --paper-2: #141413;
  --sheet: #20201e;
  --sunk: #2a2a27;
  --rule: #31312e;
  --rule-strong: #4a4945;
  --ink: #ecebe6;
  --ink-2: #b5b4ac;
  --ink-3: #8b8a82;
  --accent: #7d89ff;
  --accent-soft: #2b3270;
  --danger: #f08a7e;
  --danger-soft: #3b211d;
  --shade: 0 0 0;
  --shade-depth: 2.5;
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
}
::selection {
  background: var(--accent-soft);
}
[hidden] {
  display: none !important;
}
h1,
h2,
h3,
p {
  margin: 0;
}
a {
  color: var(--accent);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
}
button:disabled {
  cursor: default;
  opacity: 0.4;
}
button,
a,
input,
textarea,
select {
  -webkit-tap-highlight-color: transparent;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
kbd {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-2);
  border: 1px solid var(--rule-strong);
  border-bottom-width: 2px;
  border-radius: var(--radius);
  padding: 0 5px;
  line-height: 17px;
  white-space: nowrap;
}

/* Controls */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  transition:
    background-color 0.12s,
    border-color 0.12s,
    color 0.12s;
}
.button.primary {
  background: var(--ink);
  color: var(--sheet);
}
.button.primary:not(:disabled):hover {
  background: var(--accent);
}
.button.secondary {
  border: 1px solid var(--rule-strong);
  color: var(--ink);
}
.button.secondary:not(:disabled):hover {
  border-color: var(--ink);
}
.button.ghost {
  color: var(--ink-2);
}
.button.ghost:not(:disabled):hover {
  color: var(--ink);
  background: var(--sunk);
}
.button.small {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
}
.icon-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: var(--radius);
  color: var(--ink-2);
}
.icon-button:hover {
  color: var(--ink);
  background: var(--sunk);
}
input:not([type="checkbox"]),
textarea,
select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 9px 11px;
  background: var(--sheet);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  line-height: 1.5;
  resize: vertical;
  transition: border-color 0.12s;
}
input:not([type="checkbox"]):focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--ink);
}
::placeholder {
  color: var(--ink-3);
  opacity: 1;
}
label {
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
}
label input:not([type="checkbox"]),
label textarea,
label select {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
}
.muted {
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.6;
}
.error {
  color: var(--danger);
  font-size: 13px;
}
.error:empty {
  display: none;
}

/* Frame */
.app {
  display: flex;
  height: 100dvh;
  min-height: 420px;
}
.sidebar {
  display: flex;
  flex-direction: column;
  width: 264px;
  flex-shrink: 0;
  padding: 10px 12px 12px;
  background: var(--paper-2);
  border-right: 1px solid var(--rule);
}
.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 56px;
  padding: 0 4px 0 2px;
  margin-bottom: 12px;
}
.wordmark {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.mark {
  width: 42px;
  height: 42px;
}
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 2px;
  padding: 0 8px 0 0;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.search:focus-within {
  border-color: var(--ink);
}
.search input {
  margin: 0;
  border: 0;
  background: transparent;
  padding: 7px 10px;
  font-size: 13px;
  min-width: 0;
}
.search input:focus {
  outline: none;
}
.section-label {
  display: flex;
  justify-content: space-between;
  margin: 22px 8px 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}
#bot-list {
  overflow-y: auto;
  scrollbar-width: thin;
  margin: 0 -4px;
  padding: 0 4px 12px;
}
.bot-list-item {
  position: relative;
}
.bot-list-item .bot-row {
  padding-right: 44px;
}
.bot-edit {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  opacity: 0;
  transition: opacity 0.12s;
}
.bot-time {
  position: absolute;
  top: 10px;
  right: 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  pointer-events: none;
  transition: opacity 0.12s;
}
/* The edit button replaces the time on hover, focus and the open bot. */
.bot-list-item:hover .bot-edit,
.bot-list-item:focus-within .bot-edit,
.bot-row.active ~ .bot-edit {
  opacity: 1;
}
.bot-list-item:hover .bot-time,
.bot-list-item:focus-within .bot-time,
.bot-row.active ~ .bot-time {
  opacity: 0;
}
@media (hover: none) {
  .bot-edit {
    opacity: 1;
  }
  .bot-time {
    display: none;
  }
}
.bot-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius);
  text-align: left;
}
.bot-row:hover {
  background: var(--sunk);
}
.bot-row.active {
  background: var(--sheet);
  box-shadow: inset 0 0 0 1px var(--rule);
}
.bot-row.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--accent);
}
.bot-copy {
  flex: 1;
  min-width: 0;
}
.bot-copy strong,
.bot-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bot-copy strong {
  font-size: 13px;
  font-weight: 500;
}
/* The chief of staff gets its own card above the other bots. */
.chief-card {
  position: relative;
  margin-top: 4px;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-top: 2px solid var(--accent);
  border-radius: var(--radius);
}
.chief-card.active {
  border-color: var(--rule-strong);
  border-top-color: var(--accent);
  box-shadow: 3px 3px 0 rgb(var(--shade) / calc(0.08 * var(--shade-depth)));
}
.chief-main {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  column-gap: 10px;
  width: 100%;
  padding: 10px 40px 10px 10px;
  text-align: left;
}
.chief-main:hover {
  background: var(--paper);
}
.chief-main .bot-copy strong {
  font-size: 14px;
}
.chief-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}
.chief-team {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}
.chief-team > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chief-team .live {
  color: var(--accent);
}
.chief-faces {
  display: flex;
  flex-shrink: 0;
}
.chief-faces:empty {
  display: none;
}
.chief-faces .avatar + .avatar {
  margin-left: -5px;
}
.chief-faces .avatar {
  box-shadow: 0 0 0 2px var(--sheet);
}
.chief-faces .avatar.working {
  box-shadow: 0 0 0 2px var(--sheet), 0 0 0 3px var(--accent);
  animation: blink 1.1s steps(2, jump-none) infinite;
}
.chief-card .bot-edit {
  top: 22px;
}
.chief-card:hover .bot-edit,
.chief-card:focus-within .bot-edit,
.chief-card.active .bot-edit {
  opacity: 1;
}
.bot-copy small {
  margin-top: 1px;
  font-size: 12px;
  color: var(--ink-3);
}
.avatar {
  display: block;
  flex-shrink: 0;
  border-radius: var(--radius);
  outline: 1px solid color-mix(in srgb, var(--ink) 10%, transparent);
  outline-offset: -1px;
}
.bot-state {
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  background: var(--accent);
}
.bot-state.running {
  animation: blink 1.1s steps(2, jump-none) infinite;
}
.empty-list {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--ink-3);
}
.workspace-nav {
  display: grid;
  gap: 1px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
}
.workspace-nav a,
.profile-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius);
  color: var(--ink-2);
  text-decoration: none;
  font-size: 13px;
}
.workspace-nav a:hover,
.profile-link:hover {
  color: var(--ink);
  background: var(--sunk);
}
.workspace-nav a[aria-current],
.profile-link[aria-current] {
  color: var(--ink);
  background: var(--sheet);
  box-shadow: inset 0 0 0 1px var(--rule);
}
.profile-link {
  margin-top: 1px;
}
.profile-copy {
  min-width: 0;
}
.profile-copy strong,
.profile-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-copy strong {
  font-weight: 500;
}
.profile-copy small {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}
.profile-initial {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
}
main {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  flex-shrink: 0;
  padding: 0 12px;
  border-bottom: 1px solid var(--rule);
}
#heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
}
#heading .avatar {
  align-self: center;
}
#heading strong,
#heading span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#heading strong {
  font-weight: 500;
  flex-shrink: 0;
  max-width: 100%;
}
#heading span {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-3);
}
.panel-toggles {
  display: flex;
  gap: 2px;
  margin-left: auto;
}
#notice {
  padding: 10px 20px;
  background: var(--danger-soft);
  border-bottom: 1px solid var(--rule);
  color: var(--danger);
  font-size: 13px;
}

/* Empty workspace */
.sign-in {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 100vh;
  padding: 18vh max(16px, calc((100% - 440px) / 2)) 48px;
}
.sign-in h1 {
  margin-top: 20px;
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.sign-in > p {
  margin: 10px 0 0;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.6;
}
.sign-in .error {
  margin: 12px 0 0;
}
.sign-in .button {
  margin-top: 24px;
  text-decoration: none;
}
.welcome {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12vh max(24px, calc((100% - 600px) / 2)) 48px;
}
.welcome h1 {
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.welcome > p {
  margin: 10px 0 22px;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.6;
  max-width: 52ch;
}
.list-label {
  margin: 48px 0 8px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-3);
}
.templates {
  border-top: 1px solid var(--rule);
}
.templates button {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 4px 20px;
  width: 100%;
  padding: 14px 8px;
  border-bottom: 1px solid var(--rule);
  text-align: left;
}
.templates button:hover {
  background: var(--paper-2);
}
.templates strong {
  font-weight: 500;
}
.templates span {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  padding-top: 2px;
}
.templates small {
  grid-column: 2;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.55;
}

/* Conversation */
#conversation {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 0;
}
.chat-column {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
#transcript {
  flex: 1;
  overflow-y: auto;
  padding: 36px max(24px, calc((100% - var(--measure)) / 2)) 24px;
  scroll-behavior: smooth;
}
.chat-intro {
  padding: 4vh 0 24px;
}
.intro-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 28px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--rule);
}
.intro-hero .avatar {
  border-radius: 6px;
}
.chat-intro h2 {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.chat-intro .role {
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
}
.typing {
  display: flex;
  gap: 5px;
  padding: 10px 0;
}
.typing span {
  width: 6px;
  height: 6px;
  background: var(--ink-3);
  animation: typing 1.2s ease-in-out infinite;
}
.typing span:nth-child(2) {
  animation-delay: 0.15s;
}
.typing span:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes typing {
  0%, 60%, 100% { opacity: 0.25; transform: none; }
  30% { opacity: 1; transform: translateY(-3px); }
}
.suggestions {
  display: grid;
  gap: 8px;
  margin-top: 20px;
}
.suggestion {
  display: flex;
  align-items: baseline;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 12px 40px 12px 16px;
  position: relative;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  text-align: left;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  transition: border-color 0.12s, background 0.12s;
}
.suggestion:not(.placeholder)::after {
  content: "→";
  position: absolute;
  right: 16px;
  top: 12px;
  color: var(--ink-3);
  transition: transform 0.12s, color 0.12s;
}
.suggestion:not(.placeholder):hover {
  border-color: var(--ink);
}
.suggestion:not(.placeholder):hover::after {
  color: var(--ink);
  transform: translateX(3px);
}
.suggestion-label {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
}
.suggestion-text {
  min-width: 0;
  overflow-wrap: anywhere;
}
.suggestion.placeholder {
  background: linear-gradient(90deg, var(--sheet) 0%, var(--paper-2) 50%, var(--sheet) 100%) 0 0 / 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer {
  to { background-position: -200% 0; }
}
.refresh-ideas {
  margin: 12px 0 0 -10px;
}
.field-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}
.message {
  margin-top: 14px;
}
.message.user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin-top: 28px;
}
.message:first-child {
  margin-top: 0;
}
.message-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}
.message-meta .avatar {
  margin-right: -4px;
}
.message-meta strong {
  font-weight: 500;
  color: var(--ink-2);
}
/* Alignment already says who sent it, so your own name and time wait for hover. */
.user .message-meta {
  opacity: 0;
  transition: opacity 0.12s;
}
.message.user:hover .message-meta,
.message.user:focus-within .message-meta,
.message.delegated .message-meta {
  opacity: 1;
}
.message-body {
  font-size: 15px;
  line-height: 1.62;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.user .message-body {
  max-width: min(80%, 540px);
  padding: 10px 15px;
  background: var(--sunk);
  border-radius: var(--radius-soft) var(--radius-soft) var(--radius) var(--radius-soft);
  line-height: 1.55;
}
.message-actions {
  display: flex;
  margin-top: 2px;
  opacity: 0;
  transition: opacity 0.12s;
}
.message.assistant .message-actions,
.message.error .message-actions {
  /* Lines the icon up with the text instead of the button's edge. */
  margin-left: -8px;
}
.message:hover .message-actions,
.message:focus-within .message-actions {
  opacity: 1;
}
@media (hover: none) {
  .message-actions {
    opacity: 1;
  }
}
.copy-message {
  width: 28px;
  height: 28px;
  color: var(--ink-3);
}
.message-trail {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}
.output-cards {
  display: grid;
  gap: 6px;
}
.output-card {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 440px;
  padding: 9px 12px 9px 9px;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius-soft);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.12s;
}
a.output-card:hover {
  border-color: var(--ink);
}
.output-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  background: var(--ink);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--sheet);
}
.output-copy {
  flex: 1;
  min-width: 0;
}
.output-copy strong,
.output-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.output-copy strong {
  font-size: 13px;
  font-weight: 500;
}
.output-copy small {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}
.output-open {
  color: var(--ink-3);
}
a.output-card:hover .output-open {
  color: var(--ink);
}
.tools-used {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}
.tool-chip {
  padding: 1px 6px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  color: var(--ink-2);
}
.tool-chip.failed {
  border-color: var(--danger-soft);
  color: var(--danger);
}
.message.error .message-body {
  padding-left: 14px;
  border-left: 2px solid var(--danger);
  color: var(--danger);
}
.run-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
}

/* A running reply. Looping animations start at var(--sync), the page clock, so redraws don't restart them,
   and entrances start at var(--enter), so they finish across redraws. */
.message.enter,
.message-trail.enter {
  animation: rise 0.35s var(--ease-out) var(--enter, 0s) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
}
.shimmer {
  --shimmer-base: var(--ink-3);
  --shimmer-peak: var(--ink);
  color: transparent;
  background: linear-gradient(100deg, var(--shimmer-base) 0 40%, var(--shimmer-peak) 50%, var(--shimmer-base) 60% 100%) 0 0 / 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: shimmer-text 2.4s linear var(--sync, 0s) infinite;
}
@keyframes shimmer-text {
  from { background-position: 100% 0; }
  to { background-position: 0 0; }
}
.live-steps {
  display: grid;
  max-width: 560px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}
.message-body + .live-steps {
  margin-top: 14px;
}
.live-step {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  height: 28px;
  position: relative;
  font-size: 13px;
  color: var(--ink-3);
}
/* A hairline joins each step to the next, so the list reads as one timeline. */
.live-step:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 21px;
  bottom: -7px;
  width: 1px;
  background: var(--rule);
}
.live-step.enter {
  animation: step-in 0.3s var(--ease-out) var(--enter, 0s) both;
}
@keyframes step-in {
  from { opacity: 0; transform: translateX(-6px); }
}
.live-step.earlier {
  padding-left: 23px;
  font-family: var(--mono);
  font-size: 11px;
}
.step-mark {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 13px;
  height: 13px;
}
.step-mark svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.live-step.running .step-mark::before {
  content: "";
  width: 7px;
  height: 7px;
  background: var(--accent);
  animation: tumble 1.2s var(--ease-in-out) var(--sync, 0s) infinite;
}
@keyframes tumble {
  0%, 15% { transform: none; }
  50% { transform: rotate(45deg) scale(0.7); }
  85%, 100% { transform: rotate(90deg); }
}
.live-step.done .step-mark.enter path {
  stroke-dasharray: 1;
  animation: draw 0.4s var(--ease-out) var(--enter, 0s) both;
}
@keyframes draw {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
.live-step.failed .step-mark {
  color: var(--danger);
}
.live-step.failed .step-mark.enter svg {
  animation: pop 0.4s cubic-bezier(0.3, 1.6, 0.5, 1) var(--enter, 0s) both;
}
@keyframes pop {
  from { opacity: 0; transform: scale(0.3); }
}
.step-name {
  flex-shrink: 0;
  white-space: nowrap;
}
.live-step.running .step-name {
  --shimmer-base: var(--ink-2);
}
.live-step.failed .step-name {
  color: var(--danger);
}
.step-hint {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  opacity: 0.85;
}
.live-clock {
  flex-shrink: 0;
  margin-left: auto;
  padding-left: 12px;
  font-family: var(--mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
}
.live-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--ink-3);
}
.live-steps + .live-line {
  margin-top: 6px;
}
.live-line.enter {
  animation: fade-in 0.3s ease-out var(--enter, 0s) both;
}
@keyframes fade-in {
  from { opacity: 0; }
}
.live-line .live-clock {
  margin-left: 0;
  padding-left: 0;
}
/* The thinking glyph turns through the avatar tiles: a red square, a blue circle, a yellow quarter. */
.tile-glyph {
  flex-shrink: 0;
  width: 9px;
  height: 9px;
  margin: 0 2px;
  background: var(--accent);
  animation: tile 3.6s var(--ease-in-out) var(--sync, 0s) infinite;
}
@keyframes tile {
  0%, 22% { border-radius: 0; background: var(--tile-red); transform: none; }
  33%, 55% { border-radius: 50%; background: var(--accent); transform: rotate(90deg); }
  66%, 88% { border-radius: 0 0 100% 0; background: var(--tile-yellow); transform: rotate(180deg); }
  100% { border-radius: 0; background: var(--tile-red); transform: rotate(270deg); }
}
.live-line.waiting {
  color: var(--accent);
}
.live-line.waiting .tile-glyph {
  animation: blink 1.1s steps(2, jump-none) var(--sync, 0s) infinite;
}
/* A block caret follows text as it streams. Each token redraws it, so it holds still while text
   arrives and blinks only when the bot pauses. */
.writing .message-body > :is(p, h1, h2, h3, h4, h5, h6, blockquote):last-child::after,
.writing .message-body > :is(ul, ol):last-child > li:last-child::after {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 1.05em;
  margin-left: 3px;
  vertical-align: -0.17em;
  background: var(--accent);
  animation: caret 1.06s steps(1) infinite;
}
@keyframes caret {
  50% { opacity: 0; }
}
.delegation-line {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  margin-top: 8px;
  padding: 6px 10px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--ink-2);
  text-decoration: none;
}
.delegation-line:hover {
  background: var(--sunk);
}
.delegation-line strong {
  font-weight: 500;
  color: var(--ink);
}
.delegation-line span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  color: var(--ink-3);
}
.delegation-line.live span {
  color: var(--accent);
}
.delegation-line .shimmer {
  --shimmer-base: var(--accent);
  --shimmer-peak: var(--ink);
  color: transparent;
}
/* The chief of staff handing work to another bot. */
#handoff-dialog {
  width: min(620px, calc(100vw - 32px));
  border-top: 3px solid var(--accent);
}
#handoff-title {
  gap: 8px;
}
#handoff-title > span:last-child {
  margin-left: 4px;
}
.handoff-arrow {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink-3);
}
.handoff-arrow.live {
  color: var(--accent);
  animation: blink 1.1s steps(2, jump-none) infinite;
}
.handoff-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  vertical-align: middle;
  background: var(--accent);
  animation: blink 1.1s steps(2, jump-none) infinite;
}
.handoff-label {
  margin: 18px 0 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}
#handoff-content > .handoff-label:first-child {
  margin-top: 4px;
}
.handoff-brief {
  max-height: 140px;
  overflow-y: auto;
  padding: 10px 14px;
  background: var(--sunk);
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.handoff-work {
  min-height: 96px;
  max-height: min(340px, 45dvh);
  overflow-y: auto;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.handoff-work .message-body {
  font-size: 14px;
}
.handoff-work .tools-used {
  margin-top: 10px;
}
.handoff-work > :is(.run-status, .live-line, .live-steps):first-child {
  margin-top: 0;
}
.run-status.live {
  color: var(--accent);
}
.run-status.live::before {
  content: "";
  width: 8px;
  height: 8px;
  background: currentColor;
  animation: tile 3.6s var(--ease-in-out) infinite;
}
@keyframes blink {
  50% {
    opacity: 0.15;
  }
}
.composer-area {
  width: 100%;
  max-width: calc(var(--measure) + 48px);
  margin: 0 auto;
  padding: 8px 24px 16px;
}
#composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 8px 8px 8px 16px;
  background: var(--sheet);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-soft);
  box-shadow: 0 1px 0 rgb(var(--shade) / calc(0.03 * var(--shade-depth))), 0 10px 28px -16px rgb(var(--shade) / calc(0.28 * var(--shade-depth)));
  transition: border-color 0.12s;
}
#composer:focus-within {
  border-color: var(--ink);
}
/* While the bot works, a short line sweeps along the composer's top edge. */
#composer {
  position: relative;
}
#composer.running::after {
  content: "";
  position: absolute;
  top: -1px;
  left: var(--radius-soft);
  right: var(--radius-soft);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent) no-repeat -50% 0 / 30% 100%;
  animation: scan 2.4s var(--ease-in-out) infinite;
  pointer-events: none;
}
@keyframes scan {
  to { background-position: 150% 0; }
}
#task {
  flex: 1;
  margin: 0;
  padding: 5px 0;
  min-height: 34px;
  max-height: 200px;
  border: 0;
  background: transparent;
  font-size: 15px;
  line-height: 1.6;
  resize: none;
}
#send {
  flex-shrink: 0;
  border-radius: 5px;
}
.composer-note {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  padding: 6px 2px 0;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  opacity: 0;
  transition: opacity 0.12s;
}
.composer-area:focus-within .composer-note {
  opacity: 1;
}

/* Bot panel: an overview of the bot, with each setting opening in place of it. */
.context-panel {
  width: var(--panel);
  flex-shrink: 0;
  overflow-y: auto;
  padding: 22px 16px 28px;
  background: var(--paper-2);
  border-left: 1px solid var(--rule);
  scrollbar-width: thin;
}
.context-panel.overlay {
  position: absolute;
  inset: 0 0 0 auto;
  z-index: 4;
  width: min(var(--panel), 92%);
  box-shadow: -8px 0 0 rgb(var(--shade) / calc(0.06 * var(--shade-depth)));
}
.context-about {
  display: flex;
  align-items: center;
  gap: 12px;
}
.context-about .avatar {
  flex-shrink: 0;
  border-radius: 6px;
}
.context-about div {
  min-width: 0;
}
.context-about h2 {
  overflow-wrap: anywhere;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.context-tag {
  display: inline-block;
  margin-top: 3px;
  padding: 0 6px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 17px;
  color: var(--ink-2);
}
.context-role {
  display: -webkit-box;
  margin-top: 12px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.context-settings {
  display: grid;
  margin-top: 18px;
  overflow: hidden;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius-soft);
}
.setting-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 10px 10px 14px;
  text-align: left;
  transition: background-color 0.12s;
}
.setting-row + .setting-row {
  border-top: 1px solid var(--rule);
}
.setting-row:hover {
  background: var(--paper);
}
.setting-row:focus-visible {
  outline-offset: -2px;
}
.setting-copy {
  flex: 1;
  min-width: 0;
}
.setting-copy strong,
.setting-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.setting-copy strong {
  font-size: 13px;
  font-weight: 500;
}
.setting-copy small {
  font-size: 12px;
  color: var(--ink-3);
}
.setting-row svg {
  flex-shrink: 0;
  color: var(--ink-3);
  transition: color 0.12s, transform 0.12s var(--ease-out);
}
.setting-row:hover svg {
  color: var(--ink);
  transform: translateX(2px);
}
.context-section {
  margin-top: 26px;
}
.context-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 24px;
  margin-bottom: 6px;
}
.context-section h3 {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-3);
}
.context-add {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-right: -6px;
  padding: 3px 7px;
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-2);
  text-decoration: none;
}
.context-add:not(:disabled):hover {
  color: var(--ink);
  background: var(--sunk);
}
.context-add.danger:not(:disabled):hover {
  color: var(--danger);
}
.context-list {
  display: grid;
  gap: 2px;
  margin: 0 -8px;
}
.context-row {
  display: block;
  padding: 6px 8px;
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
}
.context-row:hover {
  background: var(--sunk);
}
.context-row strong,
.context-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.context-row strong {
  font-size: 13px;
  font-weight: 500;
}
.context-row small {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}
.context-empty {
  padding: 6px 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-3);
}
/* The chat's cards, flattened into rows to fit the panel. */
.context-panel .output-card {
  gap: 10px;
  max-width: none;
  padding: 6px 8px;
  background: none;
  border: 0;
  border-radius: var(--radius);
}
.context-panel a.output-card:hover {
  background: var(--sunk);
}
.context-panel .output-icon {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  font-size: 12px;
}
.link-card .output-icon {
  background: var(--sheet);
  border: 1px solid var(--rule);
  color: var(--ink-2);
}
.context-usage {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 26px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}
.context-usage span:last-child {
  text-align: right;
  color: var(--ink-2);
}
/* An open setting keeps its heading in place while the form scrolls. */
.context-panel.setting {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px 12px 8px;
  border-bottom: 1px solid var(--rule);
}
.panel-head div {
  min-width: 0;
}
.panel-head h2 {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.panel-head p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}
.panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 16px 28px;
  font-size: 13px;
  line-height: 1.6;
  scrollbar-width: thin;
}
.panel-body > .loading {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
}
.panel-body form > label + label {
  margin-top: 16px;
}
.panel-body label textarea,
.panel-body label input:not([type="checkbox"]) {
  font-size: 13px;
}
.panel-body .form-actions {
  margin-top: 14px;
}
.panel-body .detail-note {
  color: var(--ink-3);
}
.memory-file label small {
  display: block;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-3);
}
.danger-zone {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}
.danger-zone .muted {
  font-size: 12px;
  color: var(--ink-3);
}
.danger-zone .button {
  margin-top: 12px;
}
.danger-zone .form-status:not(:empty) {
  margin-top: 8px;
}

/* Computer view */
#computer {
  position: relative;
}
/* A dot on the toggle while the bot's computer is on, so it can be found mid-task. */
#computer.live::after {
  content: "";
  position: absolute;
  top: 5px;
  right: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--paper);
  animation: computer-pulse 1.6s var(--ease-in-out) infinite;
}
@keyframes computer-pulse {
  50% { opacity: 0.35; }
}
.computer-panel {
  display: flex;
  flex-direction: column;
  width: var(--computer-panel);
  min-height: 0;
  flex-shrink: 0;
  padding: 22px 20px 20px;
  background: var(--paper-2);
  border-left: 1px solid var(--rule);
}
.computer-panel.overlay {
  position: absolute;
  inset: 0 0 0 auto;
  z-index: 4;
  width: min(var(--computer-panel), 92%);
  box-shadow: -8px 0 0 rgb(var(--shade) / calc(0.06 * var(--shade-depth)));
}
.computer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.computer-head div {
  min-width: 0;
}
.computer-head h2 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.computer-head p {
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}
.computer-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 1px 8px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}
.computer-state::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--rule-strong);
}
.computer-state.on {
  border-color: var(--accent-soft);
  background: var(--sheet);
  color: var(--accent);
}
.computer-state.on::before {
  background: var(--accent);
  animation: computer-pulse 1.6s var(--ease-in-out) infinite;
}
.computer-note {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-3);
}
.computer-tabs {
  display: flex;
  gap: 18px;
  margin: 12px 0 14px;
  border-bottom: 1px solid var(--rule);
}
.computer-tabs button {
  margin-bottom: -1px;
  padding: 8px 0;
  border-bottom: 2px solid transparent;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
}
.computer-tabs button:hover {
  color: var(--ink);
}
.computer-tabs .active {
  color: var(--ink);
  border-color: var(--accent);
}
.computer-screen {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px;
  background: var(--term);
  border-radius: var(--radius-soft);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--term-ink);
  scrollbar-width: thin;
  scrollbar-color: var(--ink-2) transparent;
}
.computer-screen.empty {
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.55;
  color: var(--term-dim);
}
.computer-screen.empty p:first-child {
  color: var(--term-ink);
}
.screen-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 10px;
  font-size: 11px;
  color: var(--term-dim);
}
.screen-note:first-child {
  margin-top: 0;
}
.screen-note::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgb(236 235 230 / 0.12);
}
.screen-command,
.screen-file {
  margin: 0 0 10px;
}
.command-line,
.screen-file {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.command-line code {
  flex: 1;
  min-width: 0;
  font: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.computer-screen .prompt {
  flex-shrink: 0;
  color: var(--term-prompt);
}
.computer-screen .live-clock {
  color: var(--term-dim);
}
/* A waiting cursor under a command that hasn't finished. */
.screen-command.running::after {
  content: "";
  display: block;
  width: 7px;
  height: 13px;
  margin: 5px 0 0 16px;
  background: var(--term-dim);
  animation: cursor-blink 1s steps(1) var(--sync, 0s) infinite;
}
@keyframes cursor-blink {
  50% { opacity: 0; }
}
.command-cwd {
  display: block;
  margin-left: 16px;
  font-size: 11px;
  color: var(--term-dim);
}
.command-output {
  margin: 4px 0 0 16px;
  font: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: rgb(236 235 230 / 0.72);
}
.command-output.error,
.command-exit,
.screen-file.failed {
  color: var(--term-bad);
}
.command-exit {
  display: block;
  margin: 4px 0 0 16px;
  font-size: 11px;
}
.screen-more {
  margin: 4px 0 0 16px;
  font-size: 11px;
  color: var(--term-prompt);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.screen-file {
  color: var(--term-dim);
}
.screen-command .screen-file {
  margin: 0;
}
.screen-file code {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: inherit;
  color: var(--term-ink);
}
.screen-file .file-size {
  flex-shrink: 0;
}
.computer-files {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin: 0 -8px;
  padding: 0;
  list-style: none;
  scrollbar-width: thin;
}
.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 8px;
  border-radius: var(--radius);
  text-align: left;
}
.file-row:hover,
.computer-file.open .file-row {
  background: var(--sunk);
}
.file-name {
  flex: 1;
  min-width: 0;
}
.file-name strong,
.file-name small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-name strong {
  font-size: 13px;
  font-weight: 500;
}
.file-name small {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}
.file-action {
  flex-shrink: 0;
  padding: 1px 6px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-2);
}
.file-row time {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}
.file-content,
.file-diff {
  max-height: 340px;
  margin: 6px 8px 12px;
  overflow: auto;
  padding: 10px 12px;
  background: var(--term);
  border-radius: var(--radius-soft);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--term-ink);
  scrollbar-width: thin;
}
.file-diff .removed {
  color: var(--term-bad);
}
.file-diff .added {
  color: var(--term-ok);
}
.computer-empty {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-3);
}
.computer-file .computer-empty {
  margin: 6px 8px 12px;
  font-size: 12px;
}

/* Markdown answers */
.markdown {
  white-space: normal;
  min-width: 0;
}
.markdown > :first-child {
  margin-top: 0;
}
.markdown > :last-child {
  margin-bottom: 0;
}
.markdown p {
  margin: 0 0 0.9em;
}
.markdown h1,
.markdown h2,
.markdown h3,
.markdown h4,
.markdown h5,
.markdown h6 {
  margin: 1.5em 0 0.5em;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.markdown h1 {
  font-size: 1.45em;
}
.markdown h2 {
  font-size: 1.25em;
}
.markdown h3 {
  font-size: 1.08em;
}
.markdown h4,
.markdown h5,
.markdown h6 {
  font-size: 1em;
}
.markdown ul,
.markdown ol {
  margin: 0.5em 0 1em;
  padding-left: 1.5em;
}
.markdown li {
  margin: 0.4em 0;
}
.markdown strong {
  font-weight: 600;
}
.markdown li::marker {
  color: var(--ink-3);
}
.markdown li > p {
  margin: 0.3em 0;
}
.markdown li > ul,
.markdown li > ol {
  margin: 0.2em 0;
}
.markdown blockquote {
  margin: 1em 0;
  padding: 0 0 0 14px;
  border-left: 2px solid var(--rule-strong);
  color: var(--ink-2);
}
.markdown code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--sunk);
  border-radius: 2px;
  padding: 0.12em 0.35em;
}
.markdown pre {
  margin: 1em 0;
  padding: 14px 16px;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow-x: auto;
  white-space: pre;
  line-height: 1.55;
  scrollbar-width: thin;
}
.markdown pre code {
  padding: 0;
  background: transparent;
  font-size: 13px;
}
.markdown table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 14px;
}
.markdown th,
.markdown td {
  padding: 7px 18px 7px 0;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
  overflow-wrap: normal;
}
.markdown th {
  border-bottom-color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
}
.markdown hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 1.5em 0;
}
.markdown input[type="checkbox"] {
  margin-right: 0.5em;
  accent-color: var(--accent);
}

/* Pages */
.pages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 44px max(24px, calc((100% - 640px) / 2)) 64px;
}
.page-heading {
  margin-bottom: 28px;
}
.page-heading h1 {
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.page-heading h1:focus {
  outline: none;
}
.page-heading p {
  margin-top: 6px;
  color: var(--ink-2);
  font-size: 14px;
}
.panel-section {
  padding: 22px 0 28px;
  border-top: 1px solid var(--ink);
}
.panel-section + .panel-section {
  margin-top: 8px;
}
.panel-section h2 {
  margin-bottom: 10px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
}
.panel-section > label:not(.preference-row) {
  margin-top: 18px;
}
.panel-section > label:first-child {
  margin-top: 0;
}
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 22px;
}
.form-status {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
}
.info-note {
  font-size: 13px;
  color: var(--ink-3);
}
.pages.profile-page {
  padding-inline: max(24px, calc((100% - 960px) / 2));
}
.profile-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}
.profile-summary {
  padding: 28px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-soft);
  background: var(--sheet);
  overflow-wrap: anywhere;
}
.profile-avatar {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin-bottom: 24px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 30px;
  font-weight: 500;
}
.profile-summary h2 {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.profile-bio {
  margin-top: 20px;
  white-space: pre-wrap;
  color: var(--ink-2);
}
.profile-badge {
  display: inline-block;
  margin-top: 28px;
  font: 11px var(--mono);
  color: var(--ink-2);
  padding: 5px 8px;
  background: var(--paper-2);
  border-radius: var(--radius);
}
.profile-summary .info-note {
  margin-top: 12px;
  line-height: 1.6;
}
.profile-editor { min-width: 0; }
.profile-editor .panel-section h2 {
  font: 500 17px var(--sans);
  color: var(--ink);
}
.field-hint, .profile-field-footer {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 8px;
}
.profile-field-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}
#profile-bio-count { white-space: nowrap; }
.profile-buttons { display: flex; gap: 8px; }
.profile-editor .form-actions { flex-wrap: wrap; }
.profile-editor .form-status { flex: 1 1 100%; }
@media (max-width: 1000px) {
  .profile-layout { grid-template-columns: 1fr; gap: 28px; }
  .profile-summary { padding: 24px; }
  .profile-avatar { width: 56px; height: 56px; margin-bottom: 16px; font-size: 24px; }
  .profile-badge { margin-top: 20px; }
}
@media (max-width: 600px) {
  .profile-buttons { flex-wrap: wrap; width: 100%; }
  .profile-buttons .button { flex: 1; }
}
.preference-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
  cursor: pointer;
}
.preference-row strong {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}
.preference-row small {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  color: var(--ink-2);
}
.preference-row input[type="checkbox"] {
  appearance: none;
  position: relative;
  flex-shrink: 0;
  width: 34px;
  height: 18px;
  margin: 0;
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  background: var(--sunk);
  cursor: pointer;
  transition:
    background-color 0.12s,
    border-color 0.12s;
}
.preference-row input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 1px;
  background: var(--ink-3);
  transition: transform 0.12s;
}
.preference-row input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.preference-row input[type="checkbox"]:checked::after {
  background: var(--sheet);
  transform: translateX(16px);
}
/* A row of radio choices, such as the theme. */
.segmented {
  display: inline-flex;
  flex-shrink: 0;
  padding: 2px;
  background: var(--sunk);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.preference-row[role="radiogroup"] {
  cursor: default;
}
.segmented label {
  position: relative;
}
/* The radio covers its whole label, so the browser still handles clicks and arrow keys. */
.segmented input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.segmented span {
  display: block;
  padding: 3px 10px;
  border-radius: 2px;
  transition: color 0.12s, background-color 0.12s;
}
.segmented label:hover span {
  color: var(--ink);
}
.segmented input:checked + span {
  background: var(--sheet);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--rule-strong);
}
.segmented input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.panel-section details {
  border-bottom: 1px solid var(--rule);
}
.panel-section details:first-of-type {
  margin-top: 12px;
  border-top: 1px solid var(--rule);
}
.panel-section summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
}
.panel-section summary::-webkit-details-marker {
  display: none;
}
.panel-section summary::after {
  content: "+";
  font-family: var(--mono);
  color: var(--ink-3);
}
.panel-section details[open] summary::after {
  content: "\2212";
}
.panel-section details p {
  padding-bottom: 14px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink-2);
}
.shortcut {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 13px;
  color: var(--ink-2);
}
.activity-summary {
  margin-bottom: 10px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
}
#activity-list {
  border-top: 1px solid var(--ink);
}
.activity-row {
  display: block;
  padding: 14px 8px;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  text-decoration: none;
}
a.activity-row:hover {
  background: var(--paper-2);
}
.activity-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}
.activity-meta strong {
  font-weight: 500;
  color: var(--ink-2);
}
.activity-row p {
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.activity-empty {
  padding: 28px 8px;
}
.activity-empty h2 {
  font-size: 15px;
  font-weight: 500;
}
.activity-empty p {
  margin-top: 4px;
}
.activity-more {
  padding: 14px 8px;
}

/* Dialogs */
dialog {
  width: min(540px, calc(100vw - 32px));
  max-height: 85dvh;
  padding: 22px 24px 24px;
  background: var(--paper);
  color: inherit;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 6px 6px 0 rgb(var(--shade) / calc(0.12 * var(--shade-depth)));
}
dialog::backdrop {
  background: rgb(var(--shade) / calc(0.28 * var(--shade-depth)));
}
.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 -6px 8px 0;
}
.dialog-heading h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
#create-form > p.muted {
  margin-bottom: 20px;
}
#create-form label {
  margin-top: 16px;
}
#create-form .error {
  margin-top: 14px;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
}
.detail-tabs {
  display: flex;
  gap: 18px;
  margin: 12px 0 18px;
  border-bottom: 1px solid var(--rule);
}
.detail-tabs button {
  margin-bottom: -1px;
  padding: 8px 0;
  border-bottom: 2px solid transparent;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
}
.detail-tabs button:hover {
  color: var(--ink);
}
.detail-tabs .active {
  color: var(--ink);
  border-color: var(--accent);
}
.detail-field + .detail-field {
  margin-top: 18px;
}
.detail-field p {
  margin-top: 4px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.memory-file + .memory-file {
  margin-top: 22px;
}
.memory-file textarea {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
}
.memory-file .form-actions {
  margin-top: 8px;
}
.detail-list {
  border-top: 1px solid var(--rule);
}
.detail-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
}
.detail-row h3 {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 14px;
  font-weight: 500;
}
.detail-row h3 span {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  color: var(--ink-3);
}
.detail-row p {
  margin-top: 2px;
  font-size: 13px;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.detail-row p.error {
  color: var(--danger);
}
.detail-note {
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--ink-2);
}

/* Preferences */
.compact .message {
  margin-top: 8px;
}
.compact .message.user {
  margin-top: 22px;
}
.compact .message:first-child {
  margin-top: 0;
}
.compact .message-body {
  line-height: 1.55;
}
.compact .user .message-body {
  padding: 8px 12px;
}
.reduce-motion *,
.reduce-motion *::before,
.reduce-motion *::after {
  scroll-behavior: auto !important;
  transition: none !important;
  animation: none !important;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

/* Layout */
.rail-actions {
  display: none;
}
/* Collapsed on desktop, the sidebar becomes a rail of bot avatars. */
@media (min-width: 601px) {
  .sidebar.collapsed {
    width: 72px;
    padding: 10px 10px 12px;
  }
  .sidebar.collapsed .brand {
    justify-content: center;
    height: auto;
    padding: 2px 0 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--rule);
  }
  .sidebar.collapsed .wordmark span,
  .sidebar.collapsed #new-bot,
  .sidebar.collapsed .search,
  .sidebar.collapsed .section-label,
  .sidebar.collapsed .bot-edit,
  .sidebar.collapsed .workspace-nav,
  .sidebar.collapsed .bot-time {
    display: none;
  }
  .sidebar.collapsed #bot-list {
    display: grid;
    gap: 6px;
    scrollbar-width: none;
  }
  .sidebar.collapsed .bot-list-item .bot-row {
    justify-content: center;
    padding: 7px;
  }
  .sidebar.collapsed .bot-row .avatar {
    width: 36px;
    height: 36px;
  }
  /* In the rail, the chief is a larger, accented avatar above a divider. */
  .sidebar.collapsed .chief-card {
    margin: 0 0 10px;
    padding-bottom: 10px;
    background: none;
    border: 0;
    border-bottom: 1px solid var(--rule);
    border-radius: 0;
    box-shadow: none;
  }
  .sidebar.collapsed .chief-main {
    display: flex;
    justify-content: center;
    padding: 4px;
  }
  .sidebar.collapsed .chief-main > .avatar {
    width: 40px;
    height: 40px;
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }
  .sidebar.collapsed .chief-card.active .chief-main {
    background: var(--sheet);
    box-shadow: inset 0 0 0 1px var(--rule);
  }
  .sidebar.collapsed .chief-team {
    display: none;
  }
  .sidebar.collapsed .bot-copy,
  .sidebar.collapsed .profile-copy {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .sidebar.collapsed .bot-state {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    box-shadow: 0 0 0 2px var(--paper-2);
  }
  .sidebar.collapsed .rail-actions {
    display: grid;
    justify-items: center;
    gap: 4px;
    margin-top: auto;
    padding-top: 10px;
  }
  .sidebar.collapsed .rail-actions .icon-button {
    width: 40px;
    height: 40px;
  }
  .sidebar.collapsed .rail-actions [aria-current] {
    color: var(--ink);
    background: var(--sheet);
    box-shadow: inset 0 0 0 1px var(--rule);
  }
  .sidebar.collapsed .profile-link {
    justify-content: center;
    margin-top: 8px;
    padding: 6px;
  }
  .sidebar.collapsed .profile-initial {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }
}
@media (max-width: 850px) {
  .sidebar {
    width: 232px;
  }
  .templates button {
    grid-template-columns: 1fr;
  }
  .templates small {
    grid-column: 1;
  }
}
@media (max-width: 600px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 5;
    width: min(288px, 86vw);
    display: none;
    box-shadow: 8px 0 0 rgb(var(--shade) / calc(0.08 * var(--shade-depth)));
  }
  .sidebar.open {
    display: flex;
  }
  .topbar {
    padding: 0 8px;
  }
  #heading span {
    display: none;
  }
  .welcome {
    padding: 40px 16px 32px;
  }
  .list-label {
    margin-top: 36px;
  }
  #transcript {
    padding: 24px 16px 16px;
  }
  .suggestion {
    flex-direction: column;
    gap: 2px;
  }
  .composer-area {
    padding: 8px 16px 12px;
  }
  .composer-note span:last-child {
    display: none;
  }
  .message-body {
    font-size: 14px;
  }
  .pages {
    padding: 28px 16px 48px;
  }
  .form-actions {
    align-items: flex-start;
  }
  .form-actions button {
    flex-shrink: 0;
  }
  dialog {
    padding: 18px 16px 18px;
  }
}
.plugin-card { margin-top: 24px; }
.plugin-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; margin-bottom: 22px; }
.plugin-heading h2 { margin: 0; }
.plugin-icon { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid var(--ink); border-radius: 6px; font: bold 28px Georgia, serif; }
.plugin-state { margin-left: auto; padding: 5px 9px; border: 1px solid var(--rule); border-radius: 4px; color: var(--ink-2); font-family: var(--mono); font-size: 11px; }
.plugin-state.enabled { color: var(--accent); border-color: var(--accent); }
.plugin-workspace { margin-top: 16px; font-size: 13px; overflow-wrap: anywhere; }
.plugin-setup { margin-top: 20px; padding: 16px; border: 1px solid var(--rule); font-size: 13px; line-height: 1.7; }
.plugin-setup code { overflow-wrap: anywhere; }
.plugin-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.plugin-card .info-note { margin-top: 18px; }
#plugin-status:not(:empty) { display: block; margin-top: 18px; }
#theme-status:not(:empty) { margin-top: 10px; }

/* Scheduled */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.nav-count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}
.scheduled {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  flex: 1;
  min-height: 0;
}
.schedule-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 16px 12px 12px;
  border-right: 1px solid var(--rule);
}
.schedule-new {
  justify-content: flex-start;
  margin: 0 2px;
}
.schedule-filter {
  margin: 18px 0 6px;
}
.schedule-filter select {
  width: auto;
  margin: 0;
  padding: 2px 4px;
  border-color: transparent;
  background: transparent;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  cursor: pointer;
}
.schedule-filter select:hover {
  color: var(--ink);
}
#schedule-list {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  margin: 0 -4px;
  padding: 0 4px 12px;
}
.schedule-row {
  color: var(--ink);
  text-decoration: none;
}
.bot-state.failed {
  background: var(--danger);
}
.scheduler-status {
  padding: 10px 8px 0;
  border-top: 1px solid var(--rule);
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-3);
}
.scheduler-status:empty {
  display: none;
}
.scheduler-status strong {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--danger);
}
.scheduler-status strong::before {
  content: "";
  width: 6px;
  height: 6px;
  background: currentColor;
}
.scheduler-status.running strong {
  color: var(--accent);
}
.scheduler-status span {
  display: block;
  margin-top: 2px;
  overflow-wrap: anywhere;
}
.scheduler-status code {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-2);
}
.schedule-pane {
  overflow-y: auto;
  padding: 44px max(24px, calc((100% - 680px) / 2)) 64px;
}
.schedule-pane:focus,
.schedule-pane h1:focus {
  outline: none;
}
.schedule-intro {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 8vh 0 36px;
  text-align: center;
}
.schedule-intro h1 {
  margin-top: 12px;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.schedule-intro p {
  max-width: 46ch;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.6;
}
.schedule-icon .block {
  fill: var(--accent);
}
.schedule-icon .face {
  fill: var(--sheet);
  stroke: var(--ink);
  stroke-width: 2;
}
.schedule-icon .hands {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.5;
  stroke-linecap: square;
}
.schedule-templates {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.schedule-template {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.12s;
}
.schedule-template:hover {
  border-color: var(--ink);
}
.schedule-template strong {
  display: block;
  font-size: 14px;
  font-weight: 500;
}
.schedule-template small {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-2);
}
.schedule-form > label,
.schedule-fields {
  margin-top: 18px;
}
.schedule-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.schedule-custom {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--ink-2);
}
.schedule-custom input,
.schedule-custom select {
  width: auto;
  margin: 0;
}
.schedule-custom input {
  width: 90px;
}
.schedule-zone {
  margin-top: 12px;
}
.schedule-form .error {
  margin-top: 14px;
}
.schedule-back {
  display: none;
  margin-bottom: 20px;
  font-size: 13px;
  text-decoration: none;
}
.schedule-heading {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.schedule-heading h1 {
  min-width: 0;
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.schedule-badge {
  flex-shrink: 0;
  margin-top: 6px;
}
.schedule-badge.pending,
.schedule-badge.running {
  color: var(--accent);
  border-color: var(--accent);
}
.schedule-badge.failed {
  color: var(--danger);
  border-color: var(--danger);
}
.schedule-facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px 24px;
  margin: 24px 0 0;
  padding: 18px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.schedule-facts dt {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}
.schedule-facts dd {
  margin: 2px 0 0;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.schedule-bot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
}
.schedule-pane > .plugin-actions {
  margin-top: 18px;
}
.schedule-pane > .form-status:not(:empty) {
  margin-top: 10px;
}
.schedule-pane > .panel-section:first-of-type {
  margin-top: 32px;
}
.schedule-task {
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.schedule-pane .panel-section .markdown + .run-status,
.schedule-pane .panel-section .error + .markdown {
  margin-top: 12px;
}
.button.danger {
  color: var(--danger);
}
.button.danger:not(:disabled):hover {
  color: var(--danger);
  background: var(--danger-soft);
}
@media (max-width: 850px) {
  .scheduled {
    grid-template-columns: 220px minmax(0, 1fr);
  }
  .schedule-templates,
  .schedule-fields {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 700px) {
  .scheduled {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
  }
  .schedule-sidebar {
    flex-shrink: 0;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
    padding: 16px;
  }
  #schedule-list {
    overflow: visible;
  }
  .schedule-pane {
    flex-shrink: 0;
    overflow: visible;
    padding: 28px 16px 48px;
  }
  .scheduled[data-view="new"] .schedule-sidebar,
  .scheduled[data-view="detail"] .schedule-sidebar {
    display: none;
  }
  .schedule-back {
    display: inline-block;
  }
  .schedule-intro {
    padding-top: 12px;
  }
}

.pages.plugin-page {
  padding: 0;
  background: var(--sheet);
}
.plugin-page > .page-heading { display: none; }
.plugin-layout {
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  min-height: 100%;
}
.plugin-sidebar {
  padding: 32px 16px;
  border-right: 1px solid var(--rule);
  background: var(--paper);
}
.plugin-sidebar h2 {
  margin: 0 12px 22px;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -.02em;
}
.plugin-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  text-align: left;
  color: var(--ink-2);
}
.plugin-nav.active { background: var(--sunk); color: var(--ink); }
.plugin-nav:hover, .plugin-installed-link:hover { background: var(--paper-2); }
.plugin-nav span { color: var(--ink-3); font-size: 12px; }
.plugin-sidebar h3 {
  margin: 30px 12px 10px;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 500;
}
.plugin-installed-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  width: 100%;
  border-radius: 8px;
  text-align: left;
}
.plugin-page .plugin-installed-link .plugin-icon { width: 22px; height: 22px; padding: 0; border: 0; background: transparent; }
.plugin-sidebar #plugin-installed-empty { margin: 0 12px; font-size: 12px; line-height: 1.7; }
.plugin-sidebar-note { margin: 48px 12px 0; color: var(--ink-3); font-size: 11px; line-height: 1.8; }
.plugin-catalog { width: 100%; max-width: 1240px; padding: 44px clamp(24px, 4vw, 72px) 64px; margin: 0 auto; }
.plugin-toolbar { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 24px; }
.plugin-toolbar h1 { font-size: 28px; font-weight: 500; letter-spacing: -.035em; }
.plugin-toolbar h1:focus { outline: none; }
.plugin-toolbar p { color: var(--ink-3); margin-top: 8px; }
.plugin-toolbar-actions { display: flex; align-items: center; gap: 12px; padding-top: 3px; }
.plugin-search { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--rule); border-radius: 24px; color: var(--ink-3); }
.plugin-search:focus-within { border-color: var(--ink-2); }
.plugin-search input { width: 180px; min-width: 0; margin: 0; padding: 0; height: 24px; border: 0; outline: none; background: transparent; font-size: 13px; }
.plugin-group { margin-top: 52px; }
.plugin-group > h2 { font-size: 16px; font-weight: 500; margin-bottom: 24px; }
.plugin-group > h2 span { color: var(--ink-3); margin-left: 6px; font-size: 14px; }
.plugin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 36px; align-items: start; }
.plugin-page .plugin-card { margin: 0; min-width: 0; border-radius: 12px; }
.plugin-details > .plugin-heading {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 14px;
  margin: 0;
  padding: 16px 10px;
  cursor: pointer;
  list-style: none;
  border-radius: 12px;
}
.plugin-heading::-webkit-details-marker { display: none; }
.plugin-details > .plugin-heading:hover { background: var(--paper); }
.plugin-details[open] { background: var(--paper); border-radius: 12px; }
.plugin-page .plugin-icon { flex-shrink: 0; width: 44px; height: 44px; padding: 7px; border: 1px solid var(--rule); background: var(--sheet); border-radius: 10px; }
.plugin-icon svg { display: block; width: 100%; height: 100%; }
/* Notion's mark is a page in the theme's paper, so its currentColor strokes show in both themes. */
.notion-icon rect { fill: var(--sheet); }
.plugin-heading > div { flex: 1; min-width: 0; }
.plugin-page .plugin-heading h2 { font-size: 15px; font-weight: 500; margin-bottom: 3px; }
.plugin-heading .muted { font-size: 12px; color: var(--ink-3); line-height: 1.6; }
.plugin-heading .plugin-state { border: 0; padding: 0; font-family: var(--sans); font-size: 10px; max-width: 75px; text-align: right; }
.plugin-expand { color: var(--ink-3); font-size: 24px; font-weight: 300; width: 20px; text-align: center; }
.plugin-details[open] .plugin-expand { font-size: 0; }
.plugin-details[open] .plugin-expand::after { content: '−'; font-size: 24px; }
.plugin-detail-body { padding: 6px 20px 22px; font-size: 13px; line-height: 1.7; }
.plugin-detail-body .preference-row { gap: 16px; }
.plugin-detail-body .plugin-setup { border-radius: 8px; background: var(--sheet); }
.plugin-detail-body .plugin-actions { margin-top: 18px; }
.plugin-catalog-note { margin-top: 64px; padding-top: 20px; border-top: 1px solid var(--rule); color: var(--ink-3); font-size: 12px; }
.plugin-empty { padding: 64px 16px; text-align: center; }
.plugin-empty h2 { font-size: 18px; font-weight: 500; }
.plugin-empty p { margin: 8px 0 20px; color: var(--ink-3); }
@media (max-width: 1200px) {
  .plugin-layout { grid-template-columns: 170px minmax(0, 1fr); }
  .plugin-grid { gap: 12px; }
  .plugin-heading .plugin-state { display: none; }
  .plugin-details[open] .plugin-state { display: inline; }
}
@media (max-width: 950px) {
  .plugin-layout { grid-template-columns: 1fr; }
  .plugin-sidebar { display: flex; align-items: center; gap: 8px; padding: 12px 24px; border-right: 0; border-bottom: 1px solid var(--rule); }
  .plugin-sidebar h2, .plugin-sidebar h3, .plugin-sidebar-note, #plugin-installed, #plugin-installed-empty { display: none; }
  .plugin-nav { width: auto; gap: 16px; }
}
@media (max-width: 600px) {
  .plugin-catalog { padding: 28px 16px 40px; }
  .plugin-sidebar { padding: 10px 16px; }
  .plugin-toolbar-actions { width: 100%; }
  .plugin-search { flex: 1; }
  .plugin-search input { width: 100%; }
  .plugin-grid { grid-template-columns: 1fr; }
  .plugin-group { margin-top: 32px; }
  .plugin-group > h2 { margin-bottom: 12px; }
  .plugin-heading .plugin-state { display: inline; }
  .plugin-catalog-note { margin-top: 40px; }
}
.permission-card {
  margin: 16px 0;
  padding: 18px;
  border: 1px solid #be8b3c;
  border-radius: 12px;
  background: rgba(190, 139, 60, 0.07);
}
.permission-card p { margin: 10px 0; }
.permission-tool { font-weight: 500; }
.permission-arguments {
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
}
.permission-actions { display: flex; gap: 12px; }

.message-queue {
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-soft);
  background: var(--sheet);
  font-size: 13px;
}
.queue-item { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.queue-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-item .button { padding: 4px 8px; font-size: 12px; }
#stop { flex-shrink: 0; }
