/* Presentation adapted from QikDeck Desktop's side panel (rightPanel.css) and title bar. */
.sidebar-toggle svg, .right-panel-toggle svg { width: 18px; height: 18px; }
.sidebar-toggle-panel { fill: currentColor; stroke: none; opacity: 0; transition: opacity 120ms ease; }
.sidebar-toggle[aria-expanded="true"] .sidebar-toggle-panel, .right-panel-toggle[aria-expanded="true"] .sidebar-toggle-panel { opacity: 1; }
.window-titlebar .sidebar-toggle:hover, .window-titlebar .right-panel-toggle:hover { color: var(--gold); }
.right-panel-toggle { position: relative; margin-right: 4px; }
.right-panel-toggle.has-attention::after { content: ""; position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 2px #0e0e0e; }

/* The shell's third column; it animates open and closed like the app's. */
.desktop-shell.right-panel-docked { --right-panel-track: calc(var(--right-panel-width) + 6px); --workbench-min: 420px; }
.desktop-shell.right-panel-animating { transition: grid-template-columns 150ms ease-out; }
.right-panel { grid-column: 3; grid-row: 1; min-width: 0; min-height: 0; display: flex; padding: 8px 6px 8px 0; }
.right-panel-card { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #18181b; border: 1px solid #2d2d2d; border-radius: 14px; box-shadow: 0 4px 14px rgba(0, 0, 0, .18); overflow: hidden; }
/* Too narrow to sit beside the panes: a drawer over them. */
/* (Placed automatically, so it's positioned against the whole shell, not the empty third column.) */
.right-panel-overlay .right-panel { grid-column: auto; grid-row: auto; position: absolute; top: 0; right: 0; bottom: 0; z-index: 15; width: min(calc(var(--right-panel-width) + 6px), calc(100% - 56px)); }
.right-panel-overlay .right-panel-card { border-color: #3a3a3a; box-shadow: 0 16px 48px rgba(0, 0, 0, .55); }

.right-panel-tabs { display: flex; flex: none; gap: 2px; padding: 8px 10px 0; border-bottom: 1px solid #2a2a2a; overflow-x: auto; scrollbar-width: none; }
.right-panel-tab { position: relative; flex: none; padding: 7px 10px 9px; color: #a9abb2; font-size: 12px; font-weight: 600; }
.right-panel-tab:hover { color: #e6e7ea; }
.right-panel-tab[aria-selected="true"] { color: #f2f2f3; }
.right-panel-tab[aria-selected="true"]::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--gold); }
.right-panel-tab.has-attention::before { content: ""; position: absolute; top: 7px; right: 2px; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.right-panel-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.right-panel-section { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.right-panel-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 32px 28px; color: #a9abb2; text-align: center; }
.right-panel-empty strong { color: #e6e7ea; font-size: 13px; }
.right-panel-empty p { max-width: 300px; margin: 0; font-size: 12px; line-height: 1.5; }

/* Preview */
.preview-toolbar { display: flex; flex: none; align-items: center; gap: 2px; padding: 6px 8px; border-bottom: 1px solid #2a2a2a; }
.preview-button { width: 28px; height: 28px; display: grid; place-items: center; flex: none; border-radius: 6px; color: #aeb0b7; }
.preview-button svg { width: 16px; height: 16px; stroke-width: 2; }
.preview-button:hover:not(:disabled) { background: #242424; color: #f2f2f3; }
.preview-button:disabled { opacity: .35; }
.preview-form { flex: 1; min-width: 0; margin: 0 4px; }
.preview-address { width: 100%; height: 28px; padding: 0 10px; border: 1px solid #2f2f2f; border-radius: 7px; background: #111111; color: #e6e7ea; font-size: 12px; }
.preview-stage { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.preview-frame { flex: 1; width: 100%; min-height: 0; border: 0; background: #ffffff; }
.preview-message-action { margin-top: 6px; padding: 6px 12px; border: 1px solid #806824; border-radius: 7px; background: var(--gold); color: #17130a; font-size: 12px; font-weight: 700; }
.preview-message-action:hover:not(:disabled) { color: #000; background: #ffc33a; }
.terminal-link { padding: 0; font: inherit; color: #6aace3; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.terminal-link:hover { color: #9ccaf0 !important; }

/* Changes */
.changes-section { overflow: hidden; }
.changes-header { display: flex; flex: none; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid #2a2a2a; }
.changes-heading { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.changes-heading strong { color: #f2f2f3; font-size: 13px; }
.changes-meta { color: #a9abb2; font-size: 11.5px; white-space: nowrap; }
.changes-add { color: #67d391; }
.changes-del { color: #ff7168; }
.changes-actions { display: flex; gap: 6px; }
.changes-action, .canvas-action { padding: 5px 9px; border: 1px solid #333333; border-radius: 6px; background: #222222; color: #d7dae0; font-size: 11.5px; white-space: nowrap; }
.changes-action:hover:not(:disabled), .canvas-action:hover:not(:disabled) { background: #2b2b2b; color: #f2f2f3; }
.changes-action[aria-pressed="true"] { border-color: #806824; color: var(--gold); }
.changes-note { flex: none; margin: 0; padding: 6px 12px; border-bottom: 1px solid #2a2a2a; color: #c9c1aa; font-size: 11.5px; }
.changes-files { flex: 1; min-height: 0; overflow: auto; font: 11.5px/1.5 var(--mono); scrollbar-width: thin; scrollbar-color: #383838 transparent; }
.changes-file { border-bottom: 1px solid #2a2a2a; }
.changes-file > summary { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: #1d1d20; color: #e6e7ea; font: 12px -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; cursor: pointer; list-style: none; }
.changes-file > summary::-webkit-details-marker { display: none; }
.changes-file > summary::before { content: "›"; color: #8b8e96; transition: transform 120ms ease; }
.changes-file[open] > summary::before { transform: rotate(90deg); }
.changes-file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.changes-lines { padding: 4px 0; }
.changes-line { display: grid; grid-template-columns: 3.5em 3.5em 1.4em 1fr; min-width: max-content; }
.changes-wrap .changes-line { min-width: 0; }
.changes-ln { padding-right: 8px; color: #6b6e76; text-align: right; user-select: none; }
.changes-mark { color: #8b8e96; user-select: none; }
.changes-code { white-space: pre; color: #d7dae0; padding-right: 12px; }
.changes-wrap .changes-code { white-space: pre-wrap; overflow-wrap: anywhere; }
.changes-line-add { background: rgba(103, 211, 145, .1); }
.changes-line-add .changes-mark { color: #67d391; }
.changes-line-del { background: rgba(255, 113, 104, .1); }
.changes-line-del .changes-mark { color: #ff7168; }

/* Canvas */
.canvas-section { overflow: hidden; }
.canvas-header { display: flex; flex: none; align-items: center; flex-wrap: wrap; gap: 6px; padding: 8px 10px; border-bottom: 1px solid #2a2a2a; }
.canvas-title { display: flex; flex: 1; flex-direction: column; gap: 1px; min-width: 90px; }
.canvas-title strong { overflow: hidden; color: #f2f2f3; font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.canvas-meta { overflow: hidden; color: #a9abb2; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.canvas-step { min-width: 28px; font-size: 14px; line-height: 1; }
.canvas-action:disabled { opacity: .35; }
.canvas-actions { display: flex; gap: 6px; margin-left: auto; }
.canvas-code { flex: 1; min-height: 0; overflow: auto; padding: 6px 0; font: 11.5px/1.5 var(--mono); color: #d7dae0; scrollbar-width: thin; scrollbar-color: #383838 transparent; }
.canvas-code-line { display: grid; grid-template-columns: 3.5em 1fr; min-width: max-content; }
.canvas-code-line > span:last-child { white-space: pre; padding-right: 12px; }
.canvas-ln { padding-right: 10px; color: #6b6e76; text-align: right; user-select: none; }
.canvas-markdown { flex: 1; min-height: 0; overflow: auto; padding: 14px 18px; color: #d7dae0; font-size: 13px; line-height: 1.6; scrollbar-width: thin; }
.canvas-markdown h1, .canvas-markdown h2, .canvas-markdown h3 { margin: 0 0 8px; color: #f2f2f3; line-height: 1.3; }
.canvas-markdown h1 { font-size: 17px; }
.canvas-markdown h2 { font-size: 15px; }
.canvas-markdown p, .canvas-markdown ul, .canvas-markdown ol { margin: 0 0 10px; }
.canvas-markdown ul, .canvas-markdown ol { padding-left: 20px; }
.canvas-markdown code { padding: 1px 5px; border-radius: 4px; background: #111111; font: 12px var(--mono); }

/* The chat's change card links to the panel too. */
.open-panel-button { width: 26px; height: 26px; }
.open-panel-button svg { width: 15px; height: 15px; }
.open-panel-button .sidebar-toggle-panel { opacity: 1; }
.open-panel-button:hover { color: var(--gold) !important; }

@media (max-width: 700px) {
  .right-panel-toggle { margin-right: 6px; }
  .preview-address { font-size: 16px; }
}
