:root {
  scrollbar-gutter: stable;
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: #25231f;
  background: #f6f4ef;
  --paper: #f6f4ef;
  --surface: #fffdf9;
  --ink: #25231f;
  --muted: #655e53;
  --line: #ded7cb;
  --accent: #9a4223;
  --selected: #fff0e5;
  --tools: #f3e5d8;
  --skills: #eae7ee;
  --context: #e7ebdf;
  --mono: Menlo, Consolas, "DejaVu Sans Mono", monospace;
}

* { box-sizing: border-box; }
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
}
h1, h2, h3, p { margin: 0; }
button, input { font: inherit; }
[hidden] { display: none !important; }

:where(button, summary, a, input):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.frame {
  width: min(1280px, calc(100% - 2 * clamp(12px, 3.4vw, 52px)));
  margin-inline: auto;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.header-row {
  display: flex;
  min-height: 52px;
  align-items: center;
  gap: clamp(10px, 2vw, 20px);
  padding-block: 8px;
}

.site-brand {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 8px;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 18px;
  font-weight: 760;
  letter-spacing: -0.025em;
}

.viewer-version {
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

.brand-mark {
  width: 24px;
  height: 15px;
  border: 1.5px solid var(--ink);
  border-radius: 100% 100% 45% 45%;
  background: #ffbe6b;
  transform: rotate(-13deg);
  box-shadow: inset 0 -3px #e89753;
}

.header-row h1 {
  min-width: 0;
  padding-inline-start: clamp(10px, 2vw, 20px);
  border-inline-start: 1px solid var(--line);
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.25;
}

.page-nav {
  display: flex;
  flex-shrink: 0;
  gap: 4px;
  margin-inline-start: auto;
}

.page-nav a {
  display: flex;
  min-height: 36px;
  align-items: center;
  padding: 4px clamp(6px, 1.2vw, 12px);
  border-radius: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}

.page-nav a:hover { background: var(--paper); }
.page-nav a[aria-current="page"] {
  background: var(--selected);
  color: var(--accent);
}
.page-nav a:focus-visible {
  outline: 2px dashed var(--muted);
  outline-offset: -3px;
}

@media (forced-colors: active) {
  .page-nav a[aria-current="page"] { text-decoration: underline; }
}

main.frame { padding-block: 16px 24px; }

.workspace {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: clamp(14px, 1.6vw, 22px);
}

.map-column {
  min-width: 0;
  container-type: inline-size;
}

.board {
  position: relative;
  display: grid;
  grid-template:
    "tools skills" auto
    "agent agent" auto
    "context context" auto
    / minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: clamp(20px, 3.2cqw, 30px) clamp(14px, 6cqw, 64px);
  padding: clamp(20px, 4.3cqw, 32px) clamp(11px, 4.5cqw, 36px) clamp(22px, 4.3cqw, 32px);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f0ece4;
}

.board-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.board-lines path {
  fill: none;
  stroke: #c0b6a6;
  stroke-width: 1;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.map-section {
  position: relative;
  min-width: 0;
}

.map-section h2 {
  margin-bottom: 10px;
  color: #4d463c;
  font-size: clamp(14px, 3cqw, 19px);
  font-weight: 720;
  line-height: 1.22;
  letter-spacing: -0.017em;
}

.tools-section {
  --entry-tone: var(--tools);
  grid-area: tools;
  justify-self: end;
}

.skills-section {
  --entry-tone: var(--skills);
  grid-area: skills;
}

.context-section {
  --entry-tone: var(--context);
  grid-area: context;
  justify-self: center;
  width: min(100%, 565px);
}

.tools-section, .skills-section { width: min(100%, 350px); }

.context-section h2 {
  width: fit-content;
  margin-inline: auto;
  text-align: center;
}

.entry-list {
  display: grid;
  gap: 7px;
}

.context-section .entry-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.context-section .entry-title { overflow-wrap: normal; }

.context-section .entry-list:has(> .entry:only-child) {
  grid-template-columns: minmax(0, 1fr);
  width: min(100%, 248px);
  margin-inline: auto;
}

.entry {
  display: grid;
  grid-template-columns: 31px minmax(0, 1fr);
  gap: 3px 9px;
  align-items: center;
  min-width: 0;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  text-align: start;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.entry:hover {
  border-color: #ab9e8e;
  background: #faf7f0;
}

.entry[aria-current="true"] {
  border-color: var(--accent);
  background: #fbe2d0;
  box-shadow: inset 0 0 0 1px var(--accent);
  transition: none;
}

.entry-title {
  font-size: clamp(13px, 2.4cqw, 15px);
  font-weight: 680;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.entry-filename {
  grid-column: 2;
  color: var(--muted);
  font: 11px ui-monospace, monospace;
  overflow-wrap: anywhere;
}

.entry-icon {
  position: relative;
  display: grid;
  grid-row: 1 / span 2;
  align-self: center;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 6px;
  background: var(--entry-tone, #eeeae1);
}

.entry:not(:has(.entry-filename)) .entry-icon { grid-row: 1; }

.entry-icon::before, .entry-icon::after { content: ""; }

.entry-icon::before {
  width: 11px;
  height: 11px;
  border: 1.5px solid currentColor;
}

.entry-icon::after { position: absolute; }

.icon-circle::before, .icon-search::before { border-radius: 50%; }

.icon-file::before, .icon-book::before, .icon-chat::before {
  width: 11px;
  height: 14px;
  border-radius: 2px;
}

.icon-file::after, .icon-book::after {
  width: 6px;
  border-top: 1px solid currentColor;
  box-shadow: 0 4px currentColor;
  translate: 0 -2px;
}

.icon-book::before { border-left-width: 3px; }

.icon-chat::before {
  width: 14px;
  height: 10px;
  border-radius: 4px;
}

.icon-chat::after {
  width: 4px;
  height: 3px;
  border-left: 1px solid currentColor;
  translate: -3px 7px;
}

.icon-search::before { translate: -2px -2px; }

.icon-search::after {
  width: 6px;
  border-top: 1.5px solid currentColor;
  rotate: 45deg;
  translate: 6px 6px;
}

.agent {
  --agent-orb-size: clamp(84px, 17cqw, 110px);
  grid-area: agent;
  justify-self: center;
  display: grid;
  justify-items: center;
  max-width: 100%;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  text-align: center;
}

.agent:enabled { cursor: pointer; }
.agent:enabled:hover .agent-orb { border-color: var(--accent); }

.agent[aria-current="true"] .agent-orb {
  border-color: var(--accent);
  background: #fbe2d0;
  box-shadow: inset 0 0 0 2px var(--accent);
}

.agent-orb {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  place-items: center;
  width: var(--agent-orb-size);
  aspect-ratio: 1;
  padding-block: 7% 19%;
  border: 1px solid #d8cab5;
  border-radius: 50%;
  background: #fffbf3;
}

.agent-artwork {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 0;
}

#agent-name {
  display: -webkit-box;
  width: 74%;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  font-size: calc(var(--agent-orb-size) * 0.083);
  font-weight: 700;
  line-height: 1.1;
  overflow-wrap: anywhere;
  text-transform: lowercase;
  text-wrap: balance;
}

.mascot {
  display: grid;
  width: 64%;
  aspect-ratio: 1.18;
  place-items: center;
  container-type: inline-size;
  filter: drop-shadow(0 4px #241a1318);
}

.mascot-body {
  display: grid;
  width: 100%;
  height: 95%;
  place-items: center;
  rotate: -9deg;
  border: 1px solid #b66a33;
  border-radius: 53% 47% 51% 49% / 62% 61% 39% 38%;
  background:
    radial-gradient(ellipse at 34% 29%, #fff3bd 0%, transparent 58%),
    linear-gradient(145deg, #ffcb71 29%, #f2a050 78%);
  box-shadow: inset 0 -5cqw #cc7136, inset 0 0 0 2cqw #fff4c062;
}

.mascot i {
  position: relative;
  width: 4cqw;
  height: 6cqw;
  margin-left: -17cqw;
  border-radius: 50%;
  background: #392b23;
  box-shadow: 17cqw 0 #392b23;
}

.mascot i::after {
  content: "";
  position: absolute;
  top: 8cqw;
  left: 8cqw;
  width: 5cqw;
  height: 3cqw;
  border-bottom: 1.5px solid #392b23;
  border-radius: 0 0 90% 90%;
}

.agent-versions {
  margin-top: 9px;
  font-size: 13px;
}

.agent-versions summary { width: fit-content; cursor: pointer; color: var(--accent); }
.agent-versions select {
  max-width: 100%;
  margin-top: 6px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}
#agent-version-status:not(:empty) { margin-top: 6px; color: var(--muted); }

#inspector {
  position: sticky;
  top: 14px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  max-height: calc(100dvh - 28px);
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  overflow: hidden;
}

.inspector-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 18px clamp(14px, 2vw, 24px) 15px;
  border-bottom: 1px solid var(--line);
}

.inspector-header div { min-width: 0; }

.inspector-label {
  margin-bottom: 6px;
  color: var(--muted);
  font: 12px ui-monospace, monospace;
  overflow-wrap: anywhere;
}

.inspector-header h2 {
  outline: none;
  font-size: clamp(22px, 2.6vw, 31px);
  line-height: 1.17;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.close-button {
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.close-button::before, .close-button::after,
.history-filter-remove::before, .history-filter-remove::after {
  grid-area: 1 / 1;
  width: var(--cross-width, 14px);
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  content: "";
}

.close-button::before, .history-filter-remove::before { rotate: 45deg; }
.close-button::after, .history-filter-remove::after { rotate: -45deg; }

.close-button:hover { background: var(--line); }

.inspector-content {
  padding: 18px clamp(14px, 2vw, 26px) 23px;
  font-size: 15px;
  line-height: 1.5;
  overflow: auto;
  overscroll-behavior: contain;
}

.markdown-preview > * + * { margin-top: 12px; }
.markdown-preview h3, .related h3 { font-size: 17px; }

.markdown-preview ul, .markdown-preview blockquote {
  margin-inline: 0;
  margin-bottom: 0;
  padding-inline-start: 18px;
}

.markdown-preview blockquote {
  padding-block: 6px;
  border-inline-start: 3px solid #a6aa96;
  color: var(--muted);
}

.markdown-preview :not(pre) > code {
  padding-inline: 3px;
  border-radius: 4px;
  background: #ecebe2;
  overflow-wrap: anywhere;
}

#inspector-empty { color: var(--muted); }

.document-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 14px;
}

.document-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.document-modes button {
  min-height: 36px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.document-modes button[aria-pressed="true"] {
  border-color: var(--line);
  background: var(--selected);
  color: var(--accent);
}

.file-link {
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  text-underline-offset: 3px;
}

#logs-page {
  display: grid;
  gap: 14px;
}

.logs-panel {
  min-width: 0;
  padding: clamp(14px, 2.4vw, 24px);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  font-size: 15px;
  line-height: 1.5;
}

.logs-panel h2 {
  margin-bottom: 12px;
  font-size: clamp(18px, 2.2vw, 24px);
  line-height: 1.25;
}

#history-empty { color: var(--muted); }

#history-hint {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.history-filter-trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.history-filter-trigger::after {
  width: 5px;
  height: 5px;
  border: solid currentColor;
  border-width: 0 1px 1px 0;
  transform: rotate(45deg);
  content: "";
}

.history-table th:has(.history-filter-popover:popover-open) .history-filter-trigger::after { transform: rotate(225deg); }
.history-filter-trigger:hover,
.history-table th.is-filtered .history-filter-trigger { color: var(--accent); }
.history-table th.is-filtered .history-filter-trigger { text-decoration: underline; text-underline-offset: 3px; }

.history-filter-popover {
  --filter-width: min(320px, calc(100% - 16px));
  position: fixed;
  inset: auto;
  top: calc(var(--filter-top) + 6px);
  left: clamp(8px, var(--filter-left), calc(100% - var(--filter-width) - 8px));
  width: var(--filter-width);
  max-height: max(64px, calc(var(--filter-room) - 14px));
  overflow: auto;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 6px 20px rgb(38 29 20 / 16%);
}

.history-filter-popover.opens-above {
  top: auto;
  bottom: calc(var(--filter-bottom) + 6px);
}

.history-filter-popover input[type="search"] {
  display: block;
  width: 100%;
  min-height: 32px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  font-weight: 400;
}

.history-filter-options {
  display: grid;
  gap: 2px;
  max-height: 174px;
  margin-top: 7px;
  overflow: auto;
  font-size: 13px;
  font-weight: 400;
  white-space: normal;
}

.history-filter-options label {
  display: flex;
  align-items: start;
  gap: 7px;
  padding: 6px;
  border-radius: 5px;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.history-filter-options label:hover,
.history-filter-options label:has(:checked) { background: var(--selected); }
.history-filter-options input { margin: 2px 0 0; accent-color: var(--accent); }
.history-filter-options p { padding: 6px; color: var(--muted); }
.history-filter-add { margin: 7px 6px 2px; font-size: 12px; }

.history-filters, #history-filter-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}

.history-filters { margin-bottom: 12px; }
#history-filter-tags { min-width: 0; margin: 0; padding: 0; list-style: none; }

#history-filter-tags li {
  display: flex;
  max-width: 100%;
  border: 1px solid #d7b29b;
  border-radius: 8px;
  background: var(--selected);
  color: var(--accent);
}

#history-filter-tags button {
  min-width: 0;
  padding: 4px 8px;
  overflow: hidden;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: inherit;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

#history-filter-tags button:hover { background: #fbe2d0; }

#history-filter-tags .history-filter-remove {
  --cross-width: 9px;
  display: grid;
  flex: 0 0 26px;
  place-items: center;
  padding: 0;
}

.history-id, .history-outcome {
  padding: 2px 4px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.history-id { font: 12px var(--mono); }
.history-id:hover, .history-outcome:hover { background: var(--selected); }
.history-outcome { margin-inline-start: -4px; text-align: start; }
#history-clear-filters { font-size: 13px; }

#history-result {
  --result-padding: clamp(14px, 3vw, 24px);
  width: min(600px, calc(100% - 24px));
  max-height: 85dvh;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  white-space: normal;
  overflow-wrap: anywhere;
}

#history-result[open] {
  display: flex;
  flex-direction: column;
}

#history-result::backdrop { background: rgb(38 29 20 / 35%); }
.history-result-header {
  display: flex;
  flex: none;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  padding: var(--result-padding) var(--result-padding) 12px;
  border-bottom: 1px solid var(--line);
}

.history-result-body {
  min-height: 0;
  padding: 8px var(--result-padding) var(--result-padding);
  overflow: auto;
  overscroll-behavior: contain;
}

#history-result-context, #history-result-status { color: var(--muted); font-size: 13px; }
#history-result-context { margin-top: 6px; }
#history-result-summary { margin-top: 10px; font-weight: 650; }
#history-result-status:not(:empty), #history-result-output:not(:empty) { margin-top: 8px; }
#history-result-signin { margin-top: 8px; }
.history-output-text { white-space: pre-wrap; }

#history-result :is(#history-result-request, #history-result-response) { margin-top: 14px; }
#history-result h4 { margin: 0 0 6px; font-size: 13px; }
#history-request-json { max-height: 215px; overflow: auto; }

.history-plan {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  overflow-wrap: anywhere;
}

.history-plan ol { margin-block: 6px 0; padding-inline-start: 22px; }
.history-plan ol:empty { display: none; }

.history-scroll {
  overflow-x: auto;
}

.history-scroll:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  text-align: start;
  white-space: nowrap;
}

.history-table :is(th, td) {
  padding: 5px 16px 5px 0;
  text-align: start;
}

.history-table tr > :last-child { padding-inline-end: 0; }
.history-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  vertical-align: top;
}

.history-table td { border-top: 1px solid var(--line); }
.history-table td:nth-child(2) { color: var(--accent); }
.history-table td:nth-child(3) { font-weight: 650; }
.history-table td:nth-child(5), .history-table time { color: var(--muted); }
.history-table time { font-variant-numeric: tabular-nums; }

.history-agent {
  display: flex;
  align-items: center;
  gap: 7px;
}

.history-agent .cheburek-portrait { width: 25px; }

.history-table code {
  padding: 3px 6px;
  border-radius: 5px;
  background: var(--tools);
  color: var(--accent);
  font: 12px var(--mono);
}

.connections-page {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr);
  align-items: start;
  gap: 14px;
}

.connections-viewport {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: radial-gradient(circle, var(--surface), var(--paper));
}

.connections-stage {
  position: relative;
  min-width: var(--stage-min);
  width: min(100%, 610px);
  aspect-ratio: 1;
  margin-inline: auto;
  container-type: inline-size;
}

.connections-lines, .connection-agents {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#connection-edges path, .connection-pulse {
  fill: none;
  stroke: #a99a88;
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}

#connection-arrow path { fill: #8b7c69; }
#connection-arrow-highlight path { fill: var(--accent); }
#connection-edges .is-highlighted { stroke: var(--accent); stroke-width: 2.2; }
#connection-edges .is-muted { opacity: 0.28; }
.connections-lines .connection-pulse { stroke: var(--accent); stroke-width: 2; }

#connection-point {
  position: absolute;
  z-index: 1;
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  translate: -50% -50%;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

#connection-point:disabled { pointer-events: none; }

#connection-point::before {
  width: 13px;
  height: 13px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: #aa401d;
  content: "";
}

#connection-point:enabled::before {
  width: 17px;
  height: 17px;
  box-shadow: 0 0 0 2px var(--accent);
}

.connection-agents { margin: 0; padding: 0; list-style: none; }

.connection-agent {
  --portrait-width: min(var(--node-size), 65px);
  position: absolute;
  width: var(--label-size);
  text-align: center;
  transform: translate(-50%, calc(var(--portrait-width) / -2));
  font-size: clamp(10px, 2.4cqi, 13px);
  font-weight: 680;
  line-height: 1.2;
}

.connection-agent-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.connection-agent-button:hover .connection-portrait,
.connection-agent-button[aria-pressed="true"] .connection-portrait {
  border-color: var(--accent);
  background: var(--selected);
}

.connection-agent-button[aria-pressed="true"] .connection-portrait,
.connection-agent-button.is-transferring .connection-portrait {
  box-shadow: 0 0 0 2px var(--accent);
  background: var(--selected);
}

.connection-agent-button[aria-pressed="true"] .connection-name {
  background: var(--selected);
  color: var(--accent);
}

.connection-portrait {
  display: grid;
  place-items: center;
  width: var(--portrait-width);
  aspect-ratio: 1;
  margin-inline: auto;
  border: 1px solid #d8c7b0;
  border-radius: 50%;
  background: var(--surface);
}

.connection-portrait .cheburek-portrait { width: 82%; }
.connection-name {
  display: inline-block;
  margin-top: 4px;
  padding: 1px 3px;
  border-radius: 4px;
  background: var(--surface);
  overflow-wrap: anywhere;
}

#connections-status {
  color: var(--muted);
  font-size: 13px;
}

#connections-status[data-state="online"] { color: #3c6546; }

#connections-status[data-state="online"]::before {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-inline-end: 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.connections-controls {
  display: grid;
  gap: 9px;
  justify-items: start;
}

.connections-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
}

#connections-transaction {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

#connections-play {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#connections-play:disabled { opacity: 0.55; cursor: default; }

#connections-play::before {
  border: 5px solid transparent;
  border-right: 0;
  border-left: 8px solid currentColor;
  content: "";
}

#connections-play[data-playing]::before {
  width: 8px;
  height: 10px;
  border: 0;
  background: linear-gradient(to right, currentColor 0 34%, transparent 34% 66%, currentColor 66%);
}

#connections-progress {
  color: var(--accent);
  font-size: 13px;
  overflow-wrap: anywhere;
}

#connections-progress:not(:empty), #connections-status:not(:empty) { margin-top: 10px; }

#connection-details {
  display: grid;
  gap: 5px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  overflow-wrap: anywhere;
}

#connection-details h3 { font-size: 14px; }
#connection-details time { color: var(--muted); font-size: 13px; }
#connection-details-log { justify-self: start; }

.agent-traces {
  display: grid;
  gap: 6px;
  margin: 0;
  margin-top: 12px;
  padding: 0;
  list-style: none;
}

.agent-traces a { color: var(--accent); overflow-wrap: anywhere; }

.markdown-file {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #faf7f0;
  font: 13px/1.75 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.markdown-file code { font: inherit; }

#mcp-server-details { margin-top: 8px; }
#mcp-server-details h3 { margin-top: 16px; font-size: 17px; }

#mcp-tools {
  display: grid;
  gap: 10px;
  margin: 8px 0 0;
}

.mcp-tool-card {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  overflow-wrap: anywhere;
}

.mcp-tool-card dt code {
  display: inline-block;
  max-width: 100%;
  padding: 3px 7px;
  border-radius: 5px;
  background: var(--tools);
  color: var(--accent);
  font: 650 13px/1.45 var(--mono);
}

.mcp-tool-card dd { margin: 6px 0 0; }

.mcp-tool-card details {
  margin-top: 8px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.mcp-tool-card summary {
  width: fit-content;
  padding-block: 4px;
  border-radius: 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.mcp-tool-card summary:hover,
.mcp-tool-card details[open] summary { color: var(--accent); }

.mcp-tool-card .markdown-file {
  margin-top: 4px;
  background: var(--surface);
}

.source-view {
  margin-top: 16px;
  padding-block: 9px;
  border-block: 1px solid var(--line);
}

.source-view summary {
  font-weight: 680;
  cursor: pointer;
}

.source-view pre {
  margin: 9px 0 0;
  padding: 10px;
  border-radius: 6px;
  background: #edede5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 2;
}

.related {
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.related h3 {
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 14px;
}

.related .entry-list {
  display: flex;
  flex-wrap: wrap;
}

.related .entry {
  display: inline-flex;
  flex-wrap: wrap;
  min-height: 39px;
  gap: 6px;
  padding: 5px 9px;
}

.related .entry-icon {
  width: 24px;
  height: 24px;
}

.related .entry-title { font-size: 13px; }

.tool-form {
  display: grid;
  grid-template-columns: minmax(75px, 1fr) auto auto;
  align-items: end;
  gap: 8px;
  margin-top: 16px;
}

.tool-form label {
  display: grid;
  min-width: 0;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
}

.tool-form input {
  height: 44px;
  padding: 5px 8px;
  border: 1px solid #777a6e;
  border-radius: 6px;
  background: white;
  color: var(--ink);
}

.tool-form input[type="color"] { width: 44px; padding: 4px; }

.action-button {
  min-height: 44px;
  padding: 6px 11px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  font-weight: 690;
  cursor: pointer;
}

.action-button:hover { background: #404537; }

.canvas {
  position: relative;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff radial-gradient(#d9dacd 0.7px, transparent 0.7px) center / 13px 13px;
}

.canvas svg { display: block; width: 100%; }

.canvas > p {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 14px;
  pointer-events: none;
}

.canvas-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.text-button {
  min-height: 40px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 650;
  text-decoration: underline;
  cursor: pointer;
}

.text-button:disabled {
  color: var(--muted);
  opacity: 0.65;
  cursor: default;
}

@container (max-width: 600px) {
  .context-section { width: min(72%, 272px); }
  .context-section .entry-list { grid-template-columns: 1fr; }
}

@container (max-width: 450px) {
  .map-section h2 { margin-bottom: 9px; }
  .map-section .entry { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; padding-block: 6px; }
  .map-section .entry-icon { display: none; }
  .context-section .entry { align-items: center; text-align: center; }
  .entry-filename { font-size: 10px; }
}

@media (max-width: 760px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .connections-page { grid-template-columns: minmax(0, 1fr); }
  .connections-player { order: -1; }

  #inspector {
    position: static;
    min-height: 0;
    max-height: none;
    scroll-margin-top: 12px;
  }
}

@media (max-height: 480px) {
  #inspector { position: static; max-height: none; }
}

@media (prefers-reduced-motion: reduce) {
  .entry { transition: none; }
}

.agent-choice {
  min-inline-size: 0;
  margin: 0 0 14px;
  padding: 0;
  border: 0;
}

.agent-choice legend {
  margin-bottom: 9px;
  padding: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 680;
}

.baker-targets { margin-top: 16px; }
.baker-targets h3 {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 680;
  text-align: center;
}
.baker-targets ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.baker-targets .entry {
  height: 100%;
  text-decoration: none;
}
.baker-targets .entry-title {
  overflow-wrap: anywhere;
}
.baker-targets .cheburek-portrait { width: 31px; }

.agent-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.agent-option {
  position: relative;
  display: grid;
  min-width: 0;
  max-width: 100%;
}

.agent-option input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.agent-option-card {
  display: flex;
  min-height: 43px;
  align-items: center;
  gap: 7px;
  padding: 4px 12px 4px 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 660;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.agent-option:hover .agent-option-card { border-color: #ab9e8e; }

.agent-option input:checked + .agent-option-card {
  border-color: #bd7755;
  background: var(--selected);
  color: var(--accent);
}

.agent-option input:focus-visible + .agent-option-card {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.cheburek-portrait {
  display: block;
  flex: 0 0 auto;
  width: 30px;
  height: auto;
}

.agent-orb .cheburek-portrait { width: 72%; max-height: 100%; }
.cheburek-avatar { aspect-ratio: 1; object-fit: contain; }
.cheburek-avatar-initials {
  display: grid;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background: hsl(var(--avatar-hue) 55% 87%);
  color: hsl(var(--avatar-hue) 45% 24%);
  font-weight: 750;
}

#bakery-avatar-launch, .bakery-avatar-shortcut { margin-top: 8px; }

#bakery-avatar {
  width: min(480px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
}
#bakery-avatar::backdrop { background: #1a140c80; }
#bakery-avatar-target, #bakery-avatar-status, #bakery-avatar-form label span { color: var(--muted); font-size: 13px; }
#bakery-avatar-form { display: grid; gap: 14px; padding: 16px; }
#bakery-avatar-form label { display: block; }
#bakery-avatar-description {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 8px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}
#bakery-avatar-image { justify-self: center; object-fit: contain; }
#bakery-avatar-status:empty { display: none; }
.bakery-avatar-actions { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 520px) {
  .header-row { flex-wrap: wrap; row-gap: 4px; }
  .site-brand { flex-direction: column; align-items: flex-end; gap: 2px; }
  .header-row:not(.embed .header-row) h1 { flex: 1; }
  .page-nav { flex-basis: 100%; gap: 0; order: 2; }
  .agent-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .agent-option-card {
    gap: 4px;
    padding-inline: 5px;
    font-size: 12px;
  }

  .agent-option-card .cheburek-portrait { width: 22px; }
}

.empty-group, #catalog-status {
  color: var(--muted);
  font-size: 14px;
}

.embed .site-header { border: 0; background: none; }
.embed .header-row { min-height: 0; padding-block: 8px 0; }
.embed .site-brand { order: 1; }
.embed .wordmark { display: none; }
.embed .header-row h1 { border: 0; padding: 0; }
.embed main.frame { padding-block: 8px 12px; }

#bakery-launch {
  position: fixed;
  z-index: 5;
  right: max(clamp(14px, 3vw, 44px), env(safe-area-inset-right));
  bottom: max(16px, calc(env(safe-area-inset-bottom) + 10px));
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border: 1px solid var(--accent);
  border-radius: 24px;
  background: var(--selected);
  box-shadow: 0 5px 16px #19120733;
  color: var(--accent);
  font-weight: 750;
  cursor: pointer;
}

.bakery-chat-mark {
  position: relative;
  width: 17px;
  height: 14px;
  border: 1.5px solid currentColor;
  border-radius: 4px;
}

.bakery-chat-mark::after {
  position: absolute;
  bottom: -4px;
  left: 2px;
  width: 4px;
  height: 5px;
  border-left: 1.5px solid currentColor;
  background: var(--selected);
  content: "";
  transform: skewY(-34deg);
}

body:has(#bakery-launch:not([hidden])) main.frame { padding-bottom: 84px; }

#bakery-chat {
  width: min(540px, calc(100% - 2rem));
  max-width: none;
  max-height: min(760px, calc(100dvh - 32px - env(safe-area-inset-bottom)));
  inset: auto 0 max(16px, env(safe-area-inset-bottom)) auto;
  margin: 0 max(clamp(12px, 3vw, 44px), env(safe-area-inset-right)) 0 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 10px 32px #12090640;
  overflow: hidden;
}

#bakery-chat[open] { display: flex; flex-direction: column; }
#bakery-chat::backdrop { background: #1a140c80; }
:is(#bakery-chat, #bakery-comparison) :is(select, textarea, input):focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.bakery-header,
.bakery-form,
.bakery-history,
#bakery-status { padding-inline: 16px; }

.bakery-header {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.bakery-header { padding-block: 10px; border-bottom: 1px solid var(--line); }
.bakery-header h2 { font-size: 18px; }
.bakery-header .close-button { width: 40px; height: 40px; }

#bakery-comparison-changes label {
  display: grid;
  min-width: 0;
  gap: 4px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 640;
}

:is(#bakery-chat, #bakery-comparison) :is(select, textarea, input) {
  width: 100%;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}

:is(#bakery-chat, #bakery-comparison) textarea { resize: vertical; }
#bakery-auth { align-self: flex-end; flex-shrink: 0; margin-inline: 16px; }

.bakery-history {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px 10px;
  padding-block: 8px;
}

#bakery-chat-history { position: relative; min-width: 0; }

#bakery-chat-history-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 36px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
  font-weight: 650;
}

#bakery-chat-history-toggle::-webkit-details-marker { display: none; }
#bakery-chat-history-toggle::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 2px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

#bakery-chat-history[open] summary { border-color: var(--accent); color: var(--accent); }
#bakery-chat-history[open] summary::after { transform: translateY(2px) rotate(225deg); }
#bakery-chat-history-toggle[aria-disabled="true"] { cursor: default; color: var(--muted); }
#bakery-chat-list {
  position: absolute;
  z-index: 2;
  inset: calc(100% + 6px) 0 auto;
  margin: 0;
  padding: 5px;
  max-height: min(270px, 42dvh);
  overflow: auto;
  overscroll-behavior: contain;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 10px 24px #19120722;
}

#bakery-chat-list button {
  display: grid;
  gap: 3px;
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

#bakery-chat-list button:hover, #bakery-chat-list button:focus-visible { background: var(--paper); }
#bakery-chat-list button[aria-current="true"] { background: var(--selected); }
.bakery-chat-list-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 650; }
#bakery-chat-list time, .bakery-chat-list-empty { color: var(--muted); font-size: 12px; }
.bakery-chat-list-empty { padding: 8px 10px; }

#bakery-history-status {
  grid-column: 1 / -1;
  font-size: 13px;
  color: var(--muted);
}

.bakery-scroll {
  flex: 1 1 20rem;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 12px 16px;
  border-block: 1px solid var(--line);
  background: var(--paper);
}

.bakery-message, #bakery-draft {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 12px;
}

.bakery-message { margin-bottom: 10px; background: var(--surface); overflow-wrap: anywhere; }
.bakery-message p { margin-top: 5px; white-space: pre-wrap; }
.bakery-message-user { margin-left: 18px; background: var(--selected); }

#bakery-draft { margin-top: 12px; background: var(--surface); }
#bakery-draft h3 { font-size: 16px; }
#bakery-draft-agent { margin-top: 4px; color: var(--muted); font-size: 13px; }
#bakery-draft .action-button { margin-top: 12px; }
#bakery-view-changes { margin-block: 8px 2px; }

#bakery-comparison {
  position: fixed;
  inset: 0;
  width: min(1120px, calc(100% - 24px));
  max-height: min(85dvh, calc(100dvh - 24px));
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 10px 32px #12090640;
}

#bakery-comparison[open] { display: flex; flex-direction: column; }
#bakery-comparison::backdrop { background: #1a140c80; }
#bakery-comparison .bakery-header { flex: none; padding: 12px clamp(12px, 3vw, 32px); border-bottom: 1px solid var(--line); }
#bakery-comparison-agent { color: var(--muted); font-size: 13px; }
.bakery-comparison-actions { display: flex; align-items: center; gap: 8px; }
.bakery-comparison-actions .close-button { flex-shrink: 0; }
.bakery-comparison-scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 0 clamp(12px, 3vw, 32px) 24px; }
.bakery-comparison-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(8px, 2vw, 24px); }
.bakery-comparison-scroll > .bakery-comparison-columns {
  position: sticky;
  top: 0;
  padding-block: 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

#bakery-comparison-changes section { margin-top: 16px; }
#bakery-comparison-changes h3 { margin: 0 0 8px; font-size: 15px; }
.bakery-diff { row-gap: 0; }
.bakery-diff pre {
  display: grid;
  grid-template-columns: 1ch minmax(0, 1fr);
  align-content: start;
  gap: 6px;
  margin: 0;
  padding: 2px clamp(4px, 1vw, 10px);
  background: var(--paper);
  font: 13px/1.5 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.bakery-diff .bakery-diff-removed { background: #fbe4e1; color: #861f20; }
.bakery-diff .bakery-diff-added { background: #e4f2e6; color: #225b36; }
.bakery-diff span { font-weight: 700; }
#bakery-comparison-changes h4 { margin: 12px 0 4px; color: var(--muted); font-size: 12px; }
#bakery-open-map { display: inline-block; margin-top: 8px; }

#bakery-status {
  padding-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

#bakery-status:empty { display: none; }
.bakery-form { padding-block: 10px 14px; }

.bakery-composer {
  display: grid;
  gap: 4px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
}

.bakery-composer:focus-within { border-color: var(--accent); }
.bakery-composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bakery-composer-tools { display: flex; align-items: center; gap: 6px; min-width: 0; }

#bakery-chat #bakery-input {
  max-height: 140px;
  border: 0;
  background: transparent;
  outline: 0;
}

#bakery-chat #bakery-model {
  width: auto;
  max-width: 100%;
  min-height: 36px;
  appearance: none;
  padding: 4px 23px 4px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 640;
  text-overflow: ellipsis;
  cursor: pointer;
}

.bakery-model-control { position: relative; display: flex; min-width: 0; color: var(--muted); }
.bakery-model-control::after {
  position: absolute;
  inset: calc(50% - 4px) 9px auto auto;
  width: 6px;
  height: 6px;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
  pointer-events: none;
  content: "";
}

#bakery-attach {
  display: grid;
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

#bakery-attach span { position: relative; width: 12px; height: 12px; }
#bakery-attach span::before,
#bakery-attach span::after { position: absolute; background: currentColor; content: ""; }
#bakery-attach span::before { inset: 5px 0; }
#bakery-attach span::after { inset: 0 5px; }

#bakery-chat :is(#bakery-attach, #bakery-model):hover:not(:disabled) { background: var(--selected); color: var(--accent); }
.bakery-attachments { display: flex; gap: 10px; padding: 4px; }
.bakery-attachments > div { position: relative; }
.bakery-attachments img { display: block; width: 62px; height: 62px; border: 1px solid var(--line); border-radius: 8px; object-fit: cover; }
.bakery-attachments button {
  position: absolute;
  inset: 1px 1px auto auto;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.bakery-message-images { margin-top: 5px; }

#bakery-send {
  display: grid;
  flex: none;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--surface);
  cursor: pointer;
}

#bakery-send span { position: relative; width: 2px; height: 15px; background: currentColor; }
#bakery-send span::before {
  position: absolute;
  top: 1px;
  left: -4px;
  width: 8px;
  height: 8px;
  border-block-start: 2px solid currentColor;
  border-inline-start: 2px solid currentColor;
  transform: rotate(45deg);
  content: "";
}
#bakery-chat :disabled { opacity: .62; cursor: default; }

@media (max-width: 600px) {
  #bakery-chat { width: calc(100% - 20px); margin-inline: 0 10px; }
  #bakery-chat #bakery-model { font-size: 16px; }
}

.bakery-account-menu {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px 12px;
}

.bakery-account-menu button { flex-shrink: 0; font-size: 13px; }

.header-auth-button {
  min-height: 36px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 650;
  cursor: pointer;
}

.header-auth-button:hover:not(:disabled) {
  background: var(--selected);
  color: var(--accent);
}

.header-auth-button:disabled { opacity: .65; cursor: default; }

.bakery-profile { position: relative; min-width: 0; }

.bakery-profile summary {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: min(255px, 85vw);
  list-style: none;
  font-size: 13px;
}

.bakery-profile summary::-webkit-details-marker { display: none; }

.bakery-profile summary span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bakery-profile summary::after {
  width: 6px;
  height: 6px;
  flex: none;
  border-inline-end: 1.5px solid currentColor;
  border-block-end: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  content: "";
}

.bakery-profile[open] summary { background: var(--selected); color: var(--accent); }

.bakery-profile-actions {
  position: absolute;
  z-index: 8;
  inset: calc(100% + 6px) 0 auto auto;
  display: grid;
  min-width: 144px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: 0 5px 16px #19120722;
}

.bakery-profile-actions button {
  padding: 9px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  text-align: start;
  cursor: pointer;
}

.bakery-profile-actions button:hover:not(:disabled) { background: var(--selected); color: var(--accent); }

#bakers-auth-status { width: 100%; color: var(--muted); font-size: 12px; text-align: right; }
#bakers-auth-status:empty, #bakery-admin-status:empty { display: none; }

@media (max-width: 760px) {
  .header-row:has(.bakery-account-menu:not([hidden])) { flex-wrap: wrap; row-gap: 4px; }
  .bakery-account-menu { order: 1; margin-inline-start: auto; }
  .header-auth-button { min-height: 40px; }
  .header-row:has(.bakery-account-menu:not([hidden])) .page-nav { flex-basis: 100%; order: 2; }
}

@media (max-width: 520px) {
  .bakery-profile summary { max-width: 52vw; }
  .header-row:has(.bakery-profile:not([hidden])) h1 {
    order: 2;
    flex: 0 0 100%;
    padding-inline-start: 0;
    border-inline-start: 0;
  }
  .header-row:has(.bakery-profile:not([hidden])) .page-nav { order: 3; }
}

body:has(#bakery-chat[open]:not(:modal)) #bakery-launch { visibility: hidden; }

#bakery-chat[open]:not(:modal) {
  position: fixed;
  z-index: 10;
  inset: 0 0 0 auto;
  width: clamp(420px, 36vw, 660px);
  height: 100dvh;
  max-height: none;
  margin: 0;
  border: 0;
  border-inline-start: 1px solid var(--line);
  border-radius: 0;
  box-shadow: -16px 0 40px #19120722;
}

#bakery-chat[open]:not(:modal) :is(.bakery-header, .bakery-history, .bakery-scroll, .bakery-form, #bakery-status) {
  padding-inline: clamp(18px, 1.8vw, 28px);
}

@media (prefers-reduced-motion: no-preference) {
  #bakery-chat[open]:not(:modal) { animation: bakery-slide-in 230ms ease-out; }
  @keyframes bakery-slide-in { from { transform: translateX(100%); } }
}

#bakery-admin {
  width: min(460px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
}

#bakery-admin::backdrop { background: #1a140c80; }
#bakery-admin :is(#bakery-admin-form, #bakery-models-form) { display: grid; justify-items: start; gap: 10px; padding: 16px; }
#bakery-admin-form label { font-weight: 640; }
#bakery-api-key { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); font-size: 16px; }
#bakery-models-form { border-top: 1px solid var(--line); }
#bakery-model-options { width: 100%; min-width: 0; margin: 0; padding: 0; border: 0; }
#bakery-model-options legend { padding: 0; font-weight: 640; }
#bakery-model-list { display: grid; gap: 2px; max-height: 240px; margin-top: 6px; overflow-y: auto; }
#bakery-model-list label { display: flex; align-items: center; gap: 8px; min-height: 32px; overflow-wrap: anywhere; }
#bakery-model-list input { flex: none; margin: 0; width: 16px; height: 16px; accent-color: var(--accent); }
#bakery-admin p { color: var(--muted); font-size: 13px; }
#bakery-admin-status { margin: 0; padding: 0 16px 16px; }
#bakery-admin .action-button:disabled { opacity: .62; cursor: default; }
