/* Server mode (API key, budget) and agent runs. Loaded after studio.css. */

.account { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; }
#account-name { opacity: .72; max-width: 18ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#account-budget { font-variant-numeric: tabular-nums; padding: 3px 9px; border-radius: 999px; background: #eef0e6; color: #5d6a50; }
#account-budget[data-state="low"] { background: #f8e7dc; color: #a5492b; }
#account-budget[data-state="empty"] { background: #f6dcd3; color: #a5361f; }

.auth-panel { max-width: 440px; margin: 9vh auto 48px; padding: 0 16px; }
.auth-form { display: grid; gap: 8px; padding: 34px 32px 30px; border: 1px solid rgba(40, 40, 30, .08); border-radius: 18px; background: #fffdf8; box-shadow: 0 1px 2px rgba(40, 40, 30, .04), 0 18px 48px rgba(51, 65, 36, .08); }
.auth-form .intro-tag { margin: 0 0 6px; }
.auth-form h1 { margin: 0 0 2px; font-size: 28px; line-height: 1.2; letter-spacing: -.6px; font-weight: 600; }
.auth-lede { margin: 0 0 14px; color: #6b6d63; line-height: 1.55; font-size: 14px; }
.auth-form label { margin-top: 4px; font-size: 12px; font-weight: 600; color: #55574e; }
.auth-form code { font-size: .92em; padding: 1px 5px; border-radius: 5px; background: #f1efe7; }
.auth-form input { font: inherit; font-size: 15px; padding: 11px 13px; border: 1px solid rgba(40, 40, 30, .16); border-radius: 10px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.auth-form input:focus { outline: none; border-color: #e58a68; box-shadow: 0 0 0 3px rgba(236, 112, 76, .14); }
.auth-form button { margin-top: 12px; font: inherit; font-weight: 600; padding: 11px 16px; border: 0; border-radius: 999px; background: #2c2a24; color: #fffaf1; cursor: pointer; transition: background .15s; }
.auth-form button:hover { background: #45423a; }
.auth-form button:disabled { opacity: .5; cursor: progress; }
.auth-note { margin: 14px 0 0; text-align: center; font-size: 12px; color: #9a9c92; }
/* Until a key is accepted there is nothing to send: show only the sign-in card. */
body.signed-out #composer, body.signed-out .request-settings, body.signed-out footer,
body.signed-out #queue-status, body.signed-out #new-chat { display: none; }
.auth-message { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: rgba(236, 112, 76, .1); line-height: 1.45; }

.turn-step + .turn-step { margin-top: 10px; }
.tool-calls:empty { display: none; }
.tool-calls { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin: 8px 0; }
.tool-call { border: 1px solid rgba(40, 40, 30, .14); border-radius: 10px; background: rgba(255, 255, 255, .45); font-size: 13.5px; }
.tool-call > summary { display: flex; align-items: baseline; gap: 8px; padding: 8px 12px; cursor: pointer; list-style: none; min-width: 0; }
.tool-call > summary::-webkit-details-marker { display: none; }
.tool-icon { width: 1.1em; text-align: center; color: #8d9484; }
.tool-verb { font-weight: 600; white-space: nowrap; }
.tool-subject { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .8; }
.tool-meta { white-space: nowrap; opacity: .6; font-variant-numeric: tabular-nums; }
.tool-call[data-state="running"] .tool-verb::after { content: "…"; }
.tool-call[data-state="running"] .tool-icon { animation: tool-pulse 1.2s ease-in-out infinite; }
.tool-call[data-state="error"] .tool-meta, .tool-call[data-state="error"] .tool-icon { color: #c2492b; opacity: 1; }
.tool-call[data-state="stopped"] { opacity: .65; }
@keyframes tool-pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .tool-call[data-state="running"] .tool-icon { animation: none; } }

.tool-body { padding: 0 12px 10px 32px; }
.tool-hits { margin: 0; padding: 0; list-style: none; display: grid; max-height: 240px; overflow: auto; }
.tool-hits li { display: flex; align-items: baseline; gap: 10px; min-width: 0; padding: 4px 0; font-size: 12.5px; }
.tool-hits li + li { border-top: 1px solid rgba(40, 40, 30, .06); }
.tool-hit-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; text-decoration: none; }
.tool-hit-title:hover { text-decoration: underline; text-decoration-color: rgba(236, 112, 76, .6); }
.tool-source a { color: inherit; text-decoration-color: rgba(236, 112, 76, .6); overflow-wrap: anywhere; }
.tool-host { flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; opacity: .5; }
.tool-source { margin: 0 0 6px; }
.tool-text { margin: 0; max-height: 280px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12.5px; line-height: 1.45; padding: 8px 10px; border-radius: 8px; background: rgba(40, 40, 30, .05); }
.tool-error { margin: 0; color: #c2492b; }
.tool-call[data-outcome="fail"] .tool-meta { color: #c2492b; opacity: 1; }
.tool-call[data-outcome="ok"] .tool-meta { color: #5d7a4b; opacity: 1; }
.tool-terminal { background: #23251f; color: #e7e9df; }
.tool-prompt { color: #a9c48f; }
.tool-stderr { color: #f0a58c; }
.tool-diff .tool-del { display: block; background: rgba(194, 73, 43, .1); color: #8f3218; }
.tool-diff .tool-add { display: block; background: rgba(93, 122, 75, .13); color: #3f5a30; }
.tool-body .artifact { margin-top: 8px; }
.tool-empty { margin: 6px 0 0; opacity: .6; font-size: 12.5px; }

@media (max-width: 640px) {
  #account-name { display: none; }
  .tool-body { padding-left: 12px; }
}
.tool-live { max-height: 360px; }
.tool-call[data-fixed="true"] { border-color: rgba(93, 122, 75, .55); box-shadow: 0 0 0 3px rgba(93, 122, 75, .12); animation: tool-fixed 1.2s ease-out; }
@keyframes tool-fixed { from { box-shadow: 0 0 0 8px rgba(93, 122, 75, .35); } }
@media (prefers-reduced-motion: reduce) { .tool-call[data-fixed="true"] { animation: none; } }
.tool-terminal .tool-bad { color: #ff8f73; }
.tool-terminal .tool-good { color: #a9d68b; }

/* Canvas: what the agent is making, beside the chat. */
:root { --canvas-w: min(56vw, calc(100vw - 440px)); }
body.has-canvas { padding-right: var(--canvas-w); }
body.has-canvas .topbar { padding: 0 28px; }
body.has-canvas .topbar-actions { gap: 12px; white-space: nowrap; }
body.has-canvas #connection, body.has-canvas #account-name { display: none; }
body.has-canvas .topbar .quiet { padding: 7px 10px; }
body.has-canvas main { padding: 0 28px; }
body.has-canvas .welcome { display: none; }
body.has-canvas .composer { position: sticky; bottom: 12px; z-index: 3; box-shadow: 0 10px 30px #3341241a; }
.canvas-panel { position: fixed; top: 12px; right: 12px; bottom: 12px; width: calc(var(--canvas-w) - 24px); display: flex; flex-direction: column; overflow: hidden; background: #fbfaf6; color: #30312c; border: 1px solid #e4e4dc; border-radius: 16px; box-shadow: 0 18px 50px #2a2f2216, 0 2px 8px #2a2f220d; z-index: 4; animation: canvas-in .35s ease-out; }
@keyframes canvas-in { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.canvas-bar { display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 10px 0 18px; border-bottom: 1px solid #ecebe4; background: #fbfaf6; font-size: 12.5px; }
.canvas-file { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.canvas-version { padding: 2px 8px; border-radius: 999px; background: #eef0e6; color: #5d6a50; font-variant-numeric: tabular-nums; }
.canvas-version:empty { display: none; }
.canvas-nav { min-width: 26px; width: 26px; height: 26px; padding: 0; font-size: 16px; line-height: 1; }
.canvas-nav:disabled { opacity: .35; cursor: default; }
.canvas-status { color: #8a8d80; white-space: nowrap; font-variant-numeric: tabular-nums; }
.canvas-panel[data-state="writing"] .canvas-status, .canvas-panel[data-state="editing"] .canvas-status { color: #c45a35; }
.canvas-panel[data-state="writing"] .canvas-status::before, .canvas-panel[data-state="editing"] .canvas-status::before { content: "●"; margin-right: 6px; animation: tool-pulse 1s ease-in-out infinite; }
.canvas-actions { margin-left: auto; display: flex; gap: 4px; }
.canvas-save { position: relative; display: inline-flex; }
.canvas-save-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 5; min-width: 190px; padding: 5px; border: 1px solid #e3e3dc; border-radius: 10px; background: #fff; box-shadow: 0 8px 24px rgba(40, 40, 30, .12); }
.canvas-save-item { display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: 7px; background: none; color: #3d3f37; font-size: 12.5px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.canvas-save-item:hover:not(:disabled) { background: #f0f1eb; }
.canvas-save-item:disabled { color: #b4b5ac; }
.canvas-button { min-width: 32px; height: 30px; padding: 0 8px; border: 1px solid #e3e3dc; border-radius: 8px; background: #fff; color: #5f6357; font-size: 13px; }
.canvas-button:hover, .canvas-button[aria-pressed="true"] { background: #f0f1eb; }
.canvas-stage { position: relative; flex: 1; min-height: 0; background: #f2f1ec; }
/* The back buffer keeps its size while it loads, so pages measure a real viewport from the start. */
.canvas-stage .canvas-frame[hidden] { display: block !important; visibility: hidden; }
.canvas-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: white; }
.canvas-ticker { position: absolute; inset: 0; margin: 0; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; padding: 18px 22px; background: #f6f5f0; color: #55634a; font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; mask-image: linear-gradient(to bottom, transparent, #000 35%); }
.canvas-stamp { padding: 2px 9px; border-radius: 999px; background: #fbe9e1; color: #b5502f; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.canvas-flash { animation: canvas-flash 1.4s ease-out; }
@keyframes canvas-flash { 0% { background: #ec704c; color: #fff; transform: scale(1.12); } 100% { background: #fbe9e1; transform: none; } }
.canvas-error { position: absolute; left: 14px; right: 14px; bottom: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 12px 14px; border-radius: 12px; background: #fff4f0; border: 1px solid #f0c4b5; color: #8f3218; font-size: 13px; box-shadow: 0 8px 24px #2a2f2214; }
.canvas-error span { flex: 1; min-width: 12em; font-family: ui-monospace, monospace; font-size: 12px; overflow-wrap: anywhere; }
.canvas-error .canvas-button { background: #ec704c; border-color: #ec704c; color: #fff; font-weight: 700; padding: 0 14px; }
.canvas-code { flex: 0 0 42%; margin: 0; overflow: auto; padding: 12px 16px; border-top: 1px solid #ecebe4; background: #f6f5f0; color: #3b4034; font: 12px/1.5 ui-monospace, monospace; white-space: pre; }
.canvas-report { position: absolute; inset: 0; overflow: auto; padding: 28px 36px 60px; background: #fbfaf6; color: #2f302b; line-height: 1.65; font-size: 15px; }
.canvas-sources { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 22px; padding: 0; list-style: none; counter-reset: source; }
.canvas-sources li { counter-increment: source; display: flex; gap: 6px; align-items: baseline; max-width: 100%; padding: 5px 10px; border: 1px dashed #d5d7cc; border-radius: 999px; font-size: 12px; animation: canvas-in .3s ease-out; }
.canvas-sources li::before { content: counter(source); color: #a0a395; font-variant-numeric: tabular-nums; }
.canvas-sources li.source-read { border-style: solid; border-color: #ec704c88; background: #fff3ee; }
.canvas-sources a { max-width: 26ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; }
.canvas-sources span { opacity: .5; }
.canvas-sources li.canvas-sources-toggle { counter-increment: none; padding: 0; border: 0; }
.canvas-sources li.canvas-sources-toggle::before { content: none; }
.canvas-sources-more { padding: 5px 12px; border: 1px solid #e3e3dc; border-radius: 999px; background: #fff; color: #b5502f; font-size: 12px; cursor: pointer; }
.canvas-sources-more:hover { background: #fff3ee; }
.canvas-report-body h1, .canvas-report-body h2, .canvas-report-body h3 { letter-spacing: -.4px; line-height: 1.25; }
.canvas-report-body h1 { font-size: 28px; margin: 0 0 14px; }
.canvas-report-body a { color: #b5502f; }
.canvas-pointer { margin: 6px 0; }
.canvas-chip { border: 1px solid rgba(40, 40, 30, .14); border-radius: 10px; background: rgba(255, 255, 255, .45); font-size: 13.5px; margin: 8px 0; }
.canvas-chip > summary { display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; list-style: none; }
.canvas-chip > summary::-webkit-details-marker { display: none; }
.canvas-chip-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.canvas-chip > .tool-text { margin: 0 12px 10px; }
.canvas-chip-show { padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; background: white; color: #5d6252; font-size: 12px; }
.canvas-chip-show:hover { background: #f0f1eb; }
.canvas-link { display: flex; align-items: center; gap: 8px; }
@media (max-width: 1000px) {
  :root { --canvas-w: 100vw; }
  body.has-canvas { padding-right: 0; padding-bottom: 58vh; }
  .canvas-panel { top: auto; left: 8px; right: 8px; bottom: 8px; height: calc(58vh - 16px); width: auto; }
  body.has-canvas .composer { position: static; }
}
@media (prefers-reduced-motion: reduce) { .canvas-panel, .canvas-flash, .canvas-sources li { animation: none; } }
.canvas-report-body table { border-collapse: collapse; margin: 6px 0 14px; font-size: 14px; }
.canvas-report-body th, .canvas-report-body td { padding: 7px 12px; border-bottom: 1px solid #e6e4da; text-align: left; vertical-align: top; }
.canvas-report-body th { border-bottom-color: #c9c6b8; }
.canvas-reading { color: #9a9c8f; animation: tool-pulse 1.2s ease-in-out infinite; }
.canvas-panel[data-state="report"] .canvas-actions .canvas-button:not(:last-child) { display: none; }

.canvas-tail { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 11.5px/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: #9a9d90; }
.canvas-tail[data-tone="add"] { color: #4f7a3c; }
.canvas-tail[data-tone="del"] { color: #b5502f; }
.canvas-tail:not([hidden]) + .canvas-actions { margin-left: 0; }
.canvas-panel[data-state="writing"] .canvas-stage::after, .canvas-panel[data-state="editing"] .canvas-stage::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; z-index: 2; background: linear-gradient(90deg, transparent, #ec704c, transparent); background-size: 40% 100%; background-repeat: no-repeat; animation: canvas-scan 1.1s linear infinite; }
@keyframes canvas-scan { from { background-position: -40% 0; } to { background-position: 140% 0; } }
@media (prefers-reduced-motion: reduce) { .canvas-stage::after { animation: none !important; } }

.canvas-close { font-size: 17px; line-height: 1; }
.canvas-opener { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; margin: 0 0 12px; padding: 14px 20px; border: 1px solid #e4e4dc; border-radius: 14px; background: #fff; color: #30312c; font-size: 14.5px; font-weight: 600; box-shadow: 0 8px 26px #2a2f2214; animation: canvas-in .25s ease-out; }
.canvas-opener:hover { background: #fffaf7; border-color: #ecc5b5; }
.canvas-opener-icon { color: #ec704c; font-size: 18px; }
.canvas-opener-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.canvas-opener[data-pending="true"] { border-color: #ec704c; }
.canvas-opener[data-pending="true"] .canvas-opener-icon { animation: tool-pulse 1.2s ease-in-out infinite; }
.turn-canvas { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.turn-canvas-open { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 8px 14px; border: 1px solid #e4e4dc; border-radius: 12px; background: #fff; color: #30312c; font-size: 13.5px; font-weight: 600; }
.turn-canvas-open:hover { background: #fffaf7; border-color: #ecc5b5; }
.turn-canvas-open[aria-pressed="true"] { border-color: #ec704c; }
.turn-canvas-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.step-retry { margin: 4px 0 0; font-size: 12px; color: #a6a89e; cursor: default; }
.thinking-tail { display: block; max-width: 100%; margin: 8px 0 0; padding: 0; border: 0; background: none; font: inherit; font-size: 12px; color: #9a9d90; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.thinking-tail:hover { color: #6f7366; }

.turn-speed { padding: 0; border: 0; background: none; font: inherit; color: inherit; text-decoration: underline dotted; text-underline-offset: 2px; cursor: pointer; font-variant-numeric: tabular-nums; }
.turn-speed:hover, .turn.metrics-shown .turn-speed { color: #ec704c; }
.turn-reseed { padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; }
.turn-reseed:hover { color: #ec704c; }
.turn-reseed:disabled { cursor: default; opacity: .5; }
.curve-turn { margin-left: auto; padding: 0; border: 0; background: none; font: inherit; font-size: 11px; color: #92988a; font-variant-numeric: tabular-nums; }
.curve-turn:not(:disabled) { color: #ec704c; cursor: pointer; }
.curve-turn:disabled { cursor: default; }

.file-ref { font-weight: 600; }
