/*
  Caelion workspace · v5 · the agent's two pages

  The OpenAI connection page and the agent settings page, styled exactly as before: these
  rules are copied from static/assistant.css, which v5 no longer loads because its agent
  window has a stylesheet of its own (agent.css). Regenerate with the script that made this
  file if assistant.css changes; do not edit by hand.
*/

.assistant-emblem {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--s-2);
  color: var(--t-2);
}

/* ── OpenAI connection (assistant_connection.html) ───────────────────────── */

.connection-pane {
  max-width: 640px;
  margin: 0 0 1rem
}

.connection-heading,
.connection-actions {
  display: flex;
  align-items: center;
  gap: .8rem
}

.connection-heading {
  margin-bottom: 1.3rem
}

.connection-pane p {
  color: var(--secondary);
  font-size: .91rem
}

.connection-pane input[type="password"] {
  width: 100%;
  margin: .35rem 0 .6rem
}

.connection-pane .actions {
  margin-top: 1rem;
  gap: 1rem
}

.connection-actions {
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  gap: 1rem
}

.connection-actions .text-link {
  background: transparent;
  border: 0
}

.connection-pane .connection-problem {
  margin: 0 0 .85rem;
  color: var(--red)
}

.connection-models>div {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: .5rem 1rem;
  justify-content: space-between;
  padding: .8rem 0;
  border-bottom: 1px solid var(--line)
}

.connection-models dd {
  font-size: .84rem;
  color: var(--secondary)
}

.worker-picker,
.worker-config {
  display: grid;
  gap: .8rem;
  margin-top: 1rem
}

.worker-picker select,
.worker-picker .field {
  min-width: 0;
  max-width: 100%
}

.worker-picker .btn {
  justify-self: start
}

.worker-config {
  padding-top: 1rem;
  border-top: 1px solid var(--line)
}

.worker-feedback {
  margin-top: 1rem
}

.assistant-emblem {
  display: inline-grid;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: var(--r-md);
  color: var(--gold-ink);
  background: var(--gold-soft)
}

.assistant-record-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .5rem;
  margin-block: .65rem
}

/* ── Caelion settings (agent_settings.html) ──────────────────────────────── */

.agent-settings {
  display: grid;
  gap: 1.4rem;
  max-width: 880px
}

.settings-block {
  padding: clamp(18px, 2vw, 26px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
  scroll-margin-top: calc(var(--top-h) + 24px)
}

.settings-block>header {
  display: flex;
  align-items: flex-start;
  gap: .8rem;
  margin-bottom: 1rem
}

.settings-block>header>.icon {
  width: 22px;
  height: 22px;
  margin-top: .1rem;
  color: var(--gold-ink);
  flex: none
}

.settings-block h2 {
  font-size: 1.08rem;
  letter-spacing: -.02em
}

.settings-block>header p {
  margin: .25rem 0 0;
  color: var(--secondary);
  font-size: .88rem;
  max-width: 62ch
}

.mode-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: .55rem
}

.mode-option {
  display: grid;
  gap: .3rem;
  align-content: start;
  width: 100%;
  height: 100%;
  padding: .85rem .9rem;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background-color .15s
}

.mode-option:hover {
  border-color: var(--line-strong);
  background: var(--hover)
}

.mode-option[aria-pressed="true"] {
  border-color: var(--gold-deep);
  background: color-mix(in oklch, var(--gold-soft) 70%, var(--panel));
  box-shadow: 0 0 0 1px var(--gold-deep) inset
}

.mode-option .icon {
  width: 19px;
  height: 19px;
  color: var(--sub)
}

.mode-option[aria-pressed="true"] .icon {
  color: var(--gold-ink)
}

.mode-option[data-mode="auto"] .icon {
  color: var(--red)
}

.mode-option b {
  font-size: .9rem
}

.mode-option small {
  color: var(--secondary);
  font-size: .8rem;
  line-height: 1.45
}

.rule-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: .4rem 1.2rem;
  padding: .85rem 0;
  border-top: 1px solid var(--line-soft)
}

.rule-row b {
  font-size: .9rem;
  font-weight: 600
}

.rule-row p {
  margin: .15rem 0 0;
  color: var(--secondary);
  font-size: .82rem
}

.rule-row .now {
  display: block;
  margin-top: .3rem;
  color: var(--sub);
  font-size: .76rem
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2)
}

.segmented button {
  padding: .32rem .75rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--secondary);
  font: inherit;
  font-size: .78rem;
  font-weight: 580;
  white-space: nowrap;
  cursor: pointer
}

.segmented button:hover {
  color: var(--ink)
}

.segmented button[aria-pressed="true"] {
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow)
}

.segmented button[aria-pressed="true"][value="runs"] {
  color: var(--gold-ink)
}

.limits {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none
}

.limits li {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .28rem .65rem;
  border-radius: 999px;
  background: var(--hover);
  color: var(--secondary);
  font-size: .78rem
}

.limits .icon {
  width: 14px;
  height: 14px;
  color: var(--red)
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .75rem 0;
  border-top: 1px solid var(--line-soft)
}

.toggle-row>.icon {
  width: 19px;
  height: 19px;
  color: var(--sub);
  flex: none
}

.toggle-text {
  flex: 1;
  min-width: 0
}

.toggle-row b {
  display: block;
  font-size: .9rem;
  font-weight: 600
}

.toggle-row small {
  color: var(--secondary);
  font-size: .8rem
}

.toggle-row form {
  margin: 0
}

.switch-btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .2rem;
  border: 0;
  background: transparent;
  color: var(--secondary);
  font: inherit;
  font-size: .78rem;
  cursor: pointer
}

.settings-subhead {
  margin: 1.2rem 0 .2rem;
  color: var(--sub);
  font-size: .78rem;
  font-weight: 650
}

.outside-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .7rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line)
}

.outside-form label {
  display: grid;
  gap: .3rem;
  font-size: .82rem;
  font-weight: 560
}

.outside-form .wide,
.outside-form .actions {
  grid-column: 1 / -1
}

.outside-form .actions {
  display: flex;
  justify-content: flex-end
}

@media (max-width: 640px) {
  .rule-row,
  .outside-form {
    grid-template-columns: minmax(0, 1fr)
  }

  /* on a phone the three answers share the row; a long one takes two lines rather than running off the card */
  .rule-row .segmented {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    border-radius: 14px
  }

  .rule-row .segmented button {
    min-height: 32px;
    padding-inline: .4rem;
    border-radius: 11px;
    line-height: 1.2;
    white-space: normal;
    text-wrap: balance
  }
}

.settings-note {
  margin: .35rem 0 .2rem;
  color: var(--sub);
  font-size: .8rem;
  line-height: 1.45
}

.outside-form .field {
  margin: 0
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem
}
