:root {
  /* App-local layout colours only; all token colours (--bg, --text, --muted, --focus, --accent*, status) come
     from standalone-ui.css so C1 can check contrast against the real values. */
  --line: #30363d;
  --panel: #161b22;
  --panel-2: #1f2937;
  --panel-3: #111827;
  --info-bg: #172534;
  --info-text: #7dd3fc;
  --info-border: #3b82f6;
  --info-accent: #93c5fd;
}

:root[data-font-step="14px"] { font-size: 14px; }
:root[data-font-step="16px"] { font-size: 16px; }
:root[data-font-step="18px"] { font-size: 18px; }

* {
  box-sizing: border-box;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* P3: the centred max-width content frame the standard asks for. */
.frame {
  max-width: 2200px;
  margin: 0 auto;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* P1: the shared shell bar replaces the old .topbar header. The banner sits inside it. */
.shell-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  margin: 0 -16px;
  background: var(--box-dark);
  color: var(--on-box);
  border-bottom: 3px solid transparent;
  border-image: var(--accent-gradient) 1;
}

.shell-bar .banner {
  flex: 1 1 320px;
  margin: 0;
}

.top-menu--framed {
  background: var(--box-dark);
  color: var(--on-box);
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
}

.shell-bar h1 {
  margin: 0;
  font-size: 20px;
}

.topbar h1 {
  margin: 0;
  font-size: 20px;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.pill {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  background: var(--panel);
}

/* C1: primary boundary on the page background must be 3:1 — the shared --focus blue is 2.44:1 here, so the
   primary reads the fixed accent gradient pair from the shared sheet instead of a faint outline. */
button.primary {
  background: var(--accent-gradient);
  border-color: var(--accent-deep);
  color: var(--on-accent);
  font-weight: 600;
}

button.primary:disabled {
  opacity: 0.6;
}

.layout {
  height: calc(100vh - 70px);
  display: grid;
  grid-template-columns: 320px 1fr 360px;
  gap: 12px;
  padding: 12px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  overflow: hidden;
}

/* The side columns scroll as page regions, so full-view JSON panes (Rule 24) are never clipped by the fixed-height layout. */
.sidebar,
.inspector {
  overflow-y: auto;
}

h2 {
  margin: 0 0 8px;
  font-size: 16px;
}

h3 {
  margin: 10px 0 6px;
  font-size: 14px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--muted);
}

input,
textarea,
select,
button {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  font: inherit;
}

textarea {
  min-height: 80px;
  resize: vertical;
}

button {
  cursor: pointer;
}

button:hover {
  border-color: var(--focus);
}

.buttons {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

pre {
  margin: 0;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.4;
}

/* JSON panes (Rule 24) are full view: no max-height, no overflow scroll; they grow to their content.
   The page-wide `button { width: 100% }` must not stretch the pane's Form | JSON toggle. */
.jsonbox__toggle button {
  width: auto;
}

.chatPanel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chatMessages {
  flex: 1;
  overflow: auto;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bubble {
  max-width: 92%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  font-size: 13px;
  line-height: 1.4;
}

.bubble.user {
  align-self: flex-end;
  background: var(--panel-2);
}

.bubble.assistant {
  align-self: flex-start;
  background: var(--panel-3);
}

.bubble.system {
  align-self: center;
  background: var(--info-bg);
  color: var(--info-text);
  font-size: 12px;
}

.thinking {
  border: 1px dashed var(--info-border);
  border-radius: 8px;
  padding: 8px;
  color: var(--info-accent);
  font-size: 12px;
}

.hidden {
  display: none;
}

.composer {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 8px;
}

.composer textarea {
  min-height: 70px;
}

.inspector {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#eventLog {
  flex: 1;
  min-height: 220px;
  max-height: 340px;
  overflow: auto;
}

details {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}

details summary {
  cursor: pointer;
  color: var(--info-accent);
  margin-bottom: 6px;
}

.banner {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent, var(--focus));
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
  max-width: 60ch;
}

.pill-ok { color: var(--status-ok); border-color: var(--status-ok); }
.pill-bad { color: var(--danger-text); border-color: var(--danger-text); }

.shell-theme {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text);
}
.shell-theme select {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 6px;
  font: inherit;
}
