#view-playground * { box-sizing: border-box; }
#view-playground { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, monospace; color: #c9d1d9; }

#view-playground .pg-view { display: none; width: 100%; height: 100%; }
#view-playground .pg-view.pg-active { display: flex; }

/* Diagram View */
#pg-diagram-container {
    flex: 1; overflow: hidden; position: relative;
    background:
        radial-gradient(circle at 50% 30%, #161b22 0%, #0d1117 70%);
}
#pg-diagram-svg { width: 100%; height: 100%; }

#pg-diagram-edit-toolbar {
    position: absolute; top: 14px; right: 14px; z-index: 6;
    display: flex; align-items: center; gap: 7px;
    padding: 7px; border: 1px solid #30363d; border-radius: 9px;
    background: rgba(22,27,34,.94); backdrop-filter: blur(6px);
}
#pg-diagram-edit-toolbar button,
#view-playground .pg-primary-btn,
#view-playground .pg-secondary-btn,
#view-playground .pg-danger-btn {
    border: 1px solid #30363d; border-radius: 6px; padding: 6px 10px;
    background: #21262d; color: #c9d1d9; cursor: pointer; font-size: 11px;
}
#pg-diagram-edit-toolbar button:hover,
#view-playground .pg-secondary-btn:hover { background: #30363d; }
#pg-diagram-edit-toolbar #pg-diagram-save,
#view-playground .pg-primary-btn { background: #238636; border-color: #2ea043; color: #fff; }
#pg-diagram-edit-toolbar #pg-diagram-save:disabled { opacity: .45; cursor: default; }
#pg-diagram-edit-status { max-width: 220px; color: #f0883e; font-size: 10px; }

#view-playground .node.pg-node-selected rect,
#view-playground .node.pg-node-selected circle,
#view-playground .node.pg-node-selected polygon,
#view-playground .node.pg-node-selected path { filter: drop-shadow(0 0 7px #58a6ff); }
#view-playground .node.pg-node-editing rect,
#view-playground .node.pg-node-editing circle,
#view-playground .node.pg-node-editing polygon,
#view-playground .node.pg-node-editing path { stroke-width: 3px; }
#view-playground .flow-insert { cursor: pointer; opacity: .38; transition: opacity .15s; }
#view-playground .flow-insert:hover { opacity: 1; }
#view-playground .flow-insert circle { fill: #161b22; stroke: #bc8cff; stroke-width: 1.5; }
#view-playground .flow-insert text { fill: #d2a8ff; font-size: 13px; font-weight: 700; pointer-events: none; }

/* Tools / Context Rail */
#pg-diagram-rail {
    position: absolute; top: 14px; left: 14px;
    width: 260px; max-height: calc(100% - 28px);
    background: rgba(22, 27, 34, 0.92);
    backdrop-filter: blur(6px);
    border: 1px solid #30363d; border-radius: 10px;
    padding: 12px 14px; overflow-y: auto;
    font-size: 12px; color: #c9d1d9;
    transition: transform .25s ease, opacity .2s ease;
    z-index: 5;
}
#pg-diagram-rail.collapsed { transform: translateX(-110%); opacity: 0; pointer-events: none; }

#pg-rail-toggle {
    position: absolute; top: 14px; left: 14px;
    width: 32px; height: 32px; border-radius: 8px;
    background: rgba(22,27,34,0.92); border: 1px solid #30363d;
    color: #58a6ff; cursor: pointer; font-size: 14px;
    z-index: 4; display: none; align-items: center; justify-content: center;
}
#pg-diagram-rail.collapsed ~ #pg-rail-toggle { display: flex; }

#view-playground .rail-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px; padding-bottom: 8px;
    border-bottom: 1px solid #30363d;
}
#view-playground .rail-agent { font-weight: 600; color: #58a6ff; font-size: 13px; font-family: ui-monospace, monospace; }
#view-playground .rail-close {
    background: none; border: none; color: #8b949e; cursor: pointer;
    font-size: 18px; padding: 0 4px; line-height: 1;
}
#view-playground .rail-close:hover { color: #f85149; }

#view-playground .rail-section { margin-bottom: 14px; }
#view-playground .rail-section:last-child { margin-bottom: 0; }
#view-playground .rail-title {
    font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px;
    color: #8b949e; margin-bottom: 6px; font-weight: 600;
}
#view-playground summary.rail-title { cursor: pointer; list-style-position: outside; }
#view-playground details.rail-section[open] > summary.rail-title { color: #c9d1d9; }
#view-playground .rail-chips { display: flex; flex-wrap: wrap; gap: 4px; }
#view-playground .rail-chip {
    font-size: 11px; padding: 3px 8px; border-radius: 10px;
    border: 1px solid; cursor: pointer; transition: all .15s;
    font-family: ui-monospace, monospace;
}
#view-playground .rail-chip.rail-tool-runtime { color: #39d2c0; border-color: #39d2c044; background: #39d2c014; }
#view-playground .rail-chip.rail-tool-std     { color: #ffa657; border-color: #ffa65744; background: #ffa65714; }
#view-playground .rail-chip:hover, .rail-chip.active { filter: brightness(1.4); border-color: currentColor; }
#view-playground .rail-empty { color: #484f58; font-style: italic; font-size: 11px; }

#view-playground .rail-intents { display: flex; flex-direction: column; gap: 6px; }
#view-playground .rail-intent {
    padding: 6px 8px; background: #0d1117; border-radius: 5px;
    border-left: 3px solid #8b949e; cursor: pointer;
    transition: background .15s;
}
.rail-intent:hover { background: #161b22; }
#view-playground .rail-intent-name {
    font-size: 12px; font-weight: 600;
    font-family: ui-monospace, monospace;
    word-break: break-word;
}
#view-playground .rail-intent-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
#view-playground .rail-intent-tag,
#view-playground .rail-audio-tag {
    display: inline-block; font-size: 9px; line-height: 1.2;
    padding: 2px 5px; border-radius: 7px; border: 1px solid;
    font-weight: 600; letter-spacing: .2px; white-space: nowrap;
}
#view-playground .rail-tag-end,
#view-playground .rail-audio-tag-end { color: #f85149; border-color: #f8514966; background: #f8514914; }
#view-playground .rail-tag-transfer,
#view-playground .rail-audio-tag-transfer { color: #ffa657; border-color: #ffa65766; background: #ffa65714; }
#view-playground .rail-tag-insistence,
#view-playground .rail-audio-tag-insistence { color: #bc8cff; border-color: #bc8cff66; background: #bc8cff14; }
#view-playground .rail-audio-tag-intention { color: #58a6ff; border-color: #58a6ff55; background: #58a6ff12; }
#view-playground .rail-audio-tag-flow { color: #bc8cff; border-color: #bc8cff55; background: #bc8cff12; }
#view-playground .rail-audio-tag-fallback { color: #da3633; border-color: #da363355; background: #da363312; }
#view-playground .rail-audio-tag-welcome { color: #3fb950; border-color: #3fb95055; background: #3fb95012; }
#view-playground .rail-audio-tag-agent_mode { color: #39d2c0; border-color: #39d2c055; background: #39d2c012; }
#view-playground .rail-audio-tag-system { color: #8b949e; border-color: #8b949e55; background: #8b949e12; }
/* The audio is a playback reference under the name, not the block's identity. */
#view-playground .rail-intent-audio {
    font-size: 10px; color: #6e7681; margin-top: 2px;
    font-family: ui-monospace, monospace; word-break: break-word;
}
#view-playground .rail-intent-desc { display: none; font-size: 10px; color: #8b949e; margin-top: 5px; }
#view-playground .rail-intent-content {
    display: none; font-size: 10px; color: #6e7681; margin-top: 3px;
    overflow: hidden; text-overflow: ellipsis;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
#view-playground .rail-intent:hover .rail-intent-desc,
#view-playground .rail-intent:hover .rail-intent-content { display: -webkit-box; }
#view-playground .rail-intent.expanded .rail-intent-content { display: none; }
#view-playground .rail-intent-full {
    display: none; font-size: 10px; color: #8b949e; margin-top: 3px;
    white-space: pre-wrap; word-break: break-word;
}
#view-playground .rail-intent.expanded .rail-intent-full { display: block; }
#view-playground .rail-intent-badge {
    font-size: 9px; margin-left: 6px; padding: 0 5px; border-radius: 8px;
    background: #f0883e22; color: #f0883e; border: 1px solid #f0883e44;
    font-weight: 400; vertical-align: middle;
}
#view-playground .rail-intent-opts { margin-top: 5px; display: none; }
#view-playground .rail-intent.expanded .rail-intent-opts { display: block; }
#view-playground .rail-intent-opts-title {
    font-size: 9px; color: #f0883e; text-transform: uppercase;
    letter-spacing: 0.5px; margin-bottom: 3px; font-weight: 600;
}
#view-playground .rail-intent-opt {
    font-size: 10px; padding: 2px 6px; margin-bottom: 2px;
    background: #161b22; border-left: 2px solid #f0883e66; border-radius: 3px;
}
#view-playground .rail-intent-opt-key { color: #f0883e; font-family: ui-monospace, monospace; }
#view-playground .rail-intent-opt-desc { color: #8b949e; margin-left: 6px; }

#view-playground .rail-audio-search-wrap { margin-bottom: 6px; }
#view-playground .rail-audio-search {
    width: 100%; padding: 5px 7px; border-radius: 5px;
    background: #0d1117; border: 1px solid #30363d; color: #e6edf3;
    font: 11px ui-monospace, monospace; outline: none;
}
#view-playground .rail-audio-search:focus { border-color: #58a6ff; }
#view-playground .rail-audio-list {
    display: flex; flex-direction: column; gap: 3px;
    max-height: 300px; overflow-y: auto;
}
#view-playground .rail-audio-item {
    width: 100%; display: flex; align-items: center; gap: 5px;
    padding: 5px 6px; border: 1px solid #21262d; border-radius: 4px;
    background: #0d1117; color: #c9d1d9; text-align: left;
    cursor: pointer; font: inherit;
}
#view-playground .rail-audio-item:hover { background: #161b22; border-color: #58a6ff66; }
#view-playground .rail-audio-item[hidden] { display: none; }
#view-playground .rail-audio-key {
    flex: 1 1 auto; min-width: 0; overflow: hidden;
    color: #e6edf3; font-size: 10px; text-overflow: ellipsis; white-space: nowrap;
}
#view-playground .rail-audio-tags {
    display: flex; flex: 0 0 auto; flex-wrap: wrap;
    justify-content: flex-end; gap: 2px;
}

#view-playground .rail-ctx { display: flex; flex-direction: column; gap: 4px; }
#view-playground .rail-ctx-row {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    padding: 4px 6px; background: #0d1117; border-radius: 4px;
    border-left: 2px solid #1f6feb;
}
#view-playground .rail-ctx-name { color: #58a6ff; font-family: ui-monospace, monospace; font-size: 11px; }
#view-playground .rail-ctx-type { color: #8b949e; font-size: 10px; }
#view-playground .rail-ctx-tag {
    font-size: 9px; padding: 1px 5px; border-radius: 8px;
    background: #30363d; color: #c9d1d9;
}

#pg-detail-panel {
    width: 380px; min-width: 320px; background: #161b22; border-left: 1px solid #30363d;
    display: flex; flex-direction: column; overflow: hidden;
}
#pg-detail-panel.hidden { display: none; }
#pg-detail-panel.pg-hidden { display: none !important; }
#pg-detail-header {
    display: flex; align-items: center; gap: 8px; padding: 12px 16px;
    border-bottom: 1px solid #30363d; background: #1c2128;
}
#pg-detail-header h3 { flex: 1; font-size: 14px; color: #e6edf3; word-break: break-all; }
#pg-detail-type { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: #30363d; color: #8b949e; }
#pg-detail-close { background: none; border: none; color: #8b949e; font-size: 20px; cursor: pointer; padding: 0 4px; }
#pg-detail-body { flex: 1; overflow-y: auto; padding: 16px; }
#pg-detail-content { font-size: 13px; line-height: 1.5; color: #c9d1d9; }
#view-playground .d-meta { display: flex; flex-direction: column; gap: 4px; padding-bottom: 12px; border-bottom: 1px solid #21262d; margin-bottom: 12px; }
#view-playground .d-row { display: flex; gap: 8px; align-items: center; font-size: 12px; }
#view-playground .d-key { color: #8b949e; min-width: 90px; }
#view-playground .d-val { color: #e6edf3; word-break: break-all; }
#view-playground .d-tag { background: #1f6feb33; color: #58a6ff; padding: 1px 6px; border-radius: 8px; font-size: 10px; }
#view-playground .d-section { margin-bottom: 14px; }
#view-playground .d-section-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: #8b949e; margin-bottom: 6px; }
#view-playground .d-options { list-style: none; padding: 0; margin: 0; max-height: 240px; overflow-y: auto;
    border: 1px solid #21262d; border-radius: 6px; background: #0d1117; }
#view-playground .d-options li { padding: 5px 10px; border-bottom: 1px solid #161b22; font-size: 12px; }
#view-playground .d-options li:last-child { border-bottom: none; }
#view-playground .d-options code { background: transparent; color: #f0883e; font-family: 'SF Mono', Menlo, monospace; }
.d-opt-desc { font-size: 11px; color: #8b949e; margin-top: 2px; }
.d-opt-content { white-space: pre-wrap; font-size: 11px; line-height: 1.4; color: #c9d1d9;
    background: #0d1117; border: 1px solid #21262d; border-radius: 4px; padding: 6px 8px; margin: 4px 0 0;
    font-family: 'SF Mono', Menlo, monospace; max-height: 120px; overflow-y: auto; }
#view-playground .d-chips { display: flex; flex-wrap: wrap; gap: 4px; }
#view-playground .d-chip { font-size: 10px; padding: 2px 7px; border-radius: 10px; background: #21262d; color: #c9d1d9; }
#view-playground .d-chip.pre { background: #39d2c022; color: #39d2c0; }
#view-playground .d-chip.post { background: #ffa65722; color: #ffa657; }
#view-playground .d-text { white-space: pre-wrap; font-size: 12px; line-height: 1.5; color: #c9d1d9;
    background: #0d1117; border: 1px solid #21262d; border-radius: 6px; padding: 8px 10px; margin: 0;
    font-family: 'SF Mono', Menlo, monospace; max-height: 280px; overflow-y: auto; }

/* In-diagram editor */
#view-playground .pg-node-preview { display: flex; flex-direction: column; gap: 7px; }
#view-playground .pg-preview-description,
#view-playground .pg-preview-content {
    margin: 0 0 8px; padding: 8px 10px; border: 1px solid #21262d;
    border-radius: 6px; background: #0d1117; color: #c9d1d9;
    white-space: pre-wrap; line-height: 1.45; font-size: 12px;
}
#view-playground .pg-node-editor { display: flex; flex-direction: column; gap: 10px; }
#view-playground .pg-edit-field { display: flex; flex-direction: column; gap: 4px; color: #8b949e; font-size: 10px; }
#view-playground .pg-edit-field > input,
#view-playground .pg-edit-field > textarea,
#view-playground .pg-edit-field > select,
#view-playground .pg-action-head select,
#view-playground .pg-arg-row input,
#view-playground .pg-context-edit-row input,
#view-playground .pg-context-edit-row select,
#view-playground .pg-settings-section > select,
#view-playground .pg-connection > select {
    width: 100%; padding: 7px 8px; border: 1px solid #30363d; border-radius: 5px;
    background: #0d1117; color: #e6edf3; outline: none; font: 12px inherit;
}
#view-playground .pg-edit-field > textarea { resize: vertical; min-height: 74px; }
#view-playground .pg-edit-field > input:focus,
#view-playground .pg-edit-field > textarea:focus,
#view-playground .pg-edit-field > select:focus,
#view-playground .pg-arg-row input:focus { border-color: #58a6ff; }
#view-playground .pg-edit-details,
#view-playground .pg-settings-section {
    border: 1px solid #30363d; border-radius: 7px; background: #0d1117; padding: 8px;
}
#view-playground .pg-edit-details > summary,
#view-playground .pg-settings-section > summary { cursor: pointer; color: #58a6ff; font-size: 11px; font-weight: 600; }
#view-playground .pg-action-list,
#view-playground .pg-context-list { display: flex; flex-direction: column; gap: 7px; margin: 8px 0; }
#view-playground .pg-action-row,
#view-playground .pg-context-edit-row,
#view-playground .pg-connection {
    padding: 8px; border: 1px solid #21262d; border-radius: 6px; background: #161b22;
}
#view-playground .pg-action-head,
#view-playground .pg-arg-row { display: flex; align-items: center; gap: 6px; }
#view-playground .pg-action-head select { flex: 1; }
#view-playground .pg-action-args { margin-top: 7px; color: #8b949e; font-size: 10px; }
#view-playground .pg-args-list { display: flex; flex-direction: column; gap: 5px; margin: 6px 0; }
#view-playground .pg-arg-key { flex: 0 0 36%; }
#view-playground .pg-arg-value { flex: 1; }
#view-playground .pg-registry-arg-label { flex: 0 0 36%; color: #8b949e; font-size: 10px; }
#view-playground .pg-registry-warning {
    padding: 7px 8px; border: 1px solid #d2992255; border-radius: 5px;
    background: #d2992212; color: #d29922; font-size: 10px; line-height: 1.4;
}
#view-playground .pg-icon-danger,
#view-playground .pg-link-btn {
    border: 0; background: transparent; color: #f85149; cursor: pointer; padding: 4px; font-size: 14px;
}
#view-playground .pg-link-btn { color: #58a6ff; font-size: 10px; }
#view-playground .pg-conditions-grid { display: flex; flex-direction: column; gap: 7px; margin-top: 9px; }
#view-playground .pg-editor-footer { display: flex; justify-content: space-between; gap: 8px; }
#view-playground .pg-check-row { display: flex; align-items: center; gap: 6px; color: #c9d1d9; font-size: 11px; }
#view-playground .pg-danger-btn { color: #f85149; border-color: #f8514955; }
#view-playground .pg-settings-section { margin-bottom: 10px; }
#view-playground .pg-settings-hint { color: #8b949e; font-size: 10px; line-height: 1.4; }
#view-playground .pg-settings-tools { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }
#view-playground .pg-tool-chip { display: inline-flex; align-items: stretch; gap: 2px; }
#view-playground .pg-tool-config-button {
    border: 1px solid #58a6ff55; border-radius: 10px 0 0 10px; padding: 3px 8px;
    color: #58a6ff; background: #58a6ff12; cursor: pointer; font-size: 10px;
}
#view-playground .pg-tool-config-button:hover { background: #58a6ff22; border-color: #58a6ff; }
#view-playground .pg-tool-remove {
    border: 1px solid #ffa65755; border-radius: 0 10px 10px 0; padding: 3px 7px;
    color: #ffa657; background: #ffa65712; cursor: pointer; font-size: 10px;
}
#view-playground .pg-tool-remove:hover { background: #ffa65722; border-color: #ffa657; }
#view-playground .pg-tool-config-modal {
    position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center;
    justify-content: center; padding: 20px; background: rgba(1, 4, 9, .78);
}
#view-playground .pg-tool-config-dialog {
    width: min(560px, calc(100vw - 32px)); max-height: min(760px, calc(100vh - 32px));
    display: flex; flex-direction: column; overflow: hidden;
    border: 1px solid #484f58; border-radius: 10px; background: #161b22;
    box-shadow: 0 20px 70px rgba(0, 0, 0, .55);
}
#view-playground .pg-tool-config-header {
    display: flex; align-items: flex-start; gap: 12px; padding: 16px 18px;
    border-bottom: 1px solid #30363d; background: #1c2128;
}
#view-playground .pg-tool-config-heading { min-width: 0; flex: 1; }
#view-playground .pg-tool-config-heading h3 {
    margin: 0; color: #e6edf3; font-size: 15px; font-weight: 600; overflow-wrap: anywhere;
}
#view-playground .pg-tool-config-heading p {
    margin: 5px 0 0; color: #8b949e; font-size: 11px; line-height: 1.4;
}
#view-playground .pg-tool-config-close {
    flex: 0 0 auto; border: 0; background: transparent; color: #8b949e;
    cursor: pointer; font-size: 22px; line-height: 1; padding: 0 2px;
}
#view-playground .pg-tool-config-close:hover { color: #e6edf3; }
#view-playground .pg-tool-config-body { overflow-y: auto; padding: 16px 18px; }
#view-playground .pg-tool-config-guided > .pg-connection { margin-top: 0; }
#view-playground .pg-tool-config-raw {
    margin-top: 12px; padding-top: 12px; border-top: 1px solid #30363d;
    color: #8b949e; font-size: 10px;
}
#view-playground .pg-tool-config-raw > summary { cursor: pointer; color: #58a6ff; }
#view-playground .pg-tool-config-raw > p { margin: 7px 0; }
#view-playground .pg-tool-config-raw > textarea {
    width: 100%; box-sizing: border-box; resize: vertical; padding: 8px;
    border: 1px solid #30363d; border-radius: 5px; background: #0d1117;
    color: #e6edf3; font: 11px ui-monospace, monospace;
}
#view-playground .pg-tool-config-raw > textarea:focus { outline: none; border-color: #58a6ff; }
#view-playground .pg-tool-config-status { display: block; min-height: 15px; margin-top: 4px; }
#view-playground .pg-tool-config-footer {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 12px 18px; border-top: 1px solid #30363d; background: #1c2128;
}
#view-playground .pg-tool-config-attached { color: #8b949e; font-size: 10px; }
#view-playground .pg-context-edit-row { display: grid; grid-template-columns: 1fr 70px; gap: 6px; }
#view-playground .pg-context-edit-row > input { grid-column: 1 / -1; }
#view-playground .pg-context-edit-row > input:first-child { grid-column: auto; }
#view-playground .pg-context-more { grid-column: 1 / -1; color: #8b949e; font-size: 10px; }
#view-playground .pg-context-more > summary { cursor: pointer; color: #58a6ff; }
#view-playground .pg-context-more-fields { display: flex; flex-direction: column; gap: 6px; margin-top: 7px; }
#view-playground .pg-context-remove { grid-column: 2; justify-self: end; }
#view-playground .pg-context-flags { grid-column: 1 / -1; }
#view-playground .pg-context-flags { display: flex; flex-wrap: wrap; gap: 8px; color: #8b949e; font-size: 9px; }
#view-playground .pg-context-flags label { display: flex; align-items: center; gap: 3px; }
#view-playground .pg-connection { margin-top: 8px; }
#view-playground .pg-connection strong { display: block; margin-bottom: 6px; color: #ffa657; }
#view-playground .pg-connection-fields { display: flex; flex-direction: column; gap: 6px; margin-top: 7px; }
#view-playground .pg-tool-config-advanced { margin-top: 9px; color: #8b949e; font-size: 10px; }
#view-playground .pg-tool-config-advanced > summary { cursor: pointer; margin-bottom: 7px; }
#view-playground .pg-tool-config-advanced select,
#view-playground .pg-tool-config-advanced textarea {
    width: 100%; margin-bottom: 6px; padding: 7px; border: 1px solid #30363d;
    border-radius: 5px; background: #0d1117; color: #e6edf3; font: 11px ui-monospace, monospace;
}
#view-playground .pg-hardcoded-list { display: flex; flex-direction: column; gap: 5px; }
#view-playground .pg-hardcoded-row { display: grid; grid-template-columns: 34% 1fr; align-items: center; gap: 6px; }
#view-playground .pg-hardcoded-row > span { color: #8b949e; font-size: 10px; }
#view-playground .pg-hardcoded-row > input {
    min-width: 0; padding: 6px 7px; border: 1px solid #30363d; border-radius: 5px;
    background: #0d1117; color: #e6edf3; font-size: 11px;
}

#view-playground .pg-cluster-head { margin-bottom: 12px; }
#view-playground .pg-cluster-head p { margin: 0 0 8px; color: #8b949e; font-size: 11px; }
#view-playground .pg-cluster-actions { display: flex; gap: 7px; }
#view-playground .pg-audio-defaults .pg-cluster-actions { align-items: center; flex-wrap: wrap; }
#view-playground .pg-audio-defaults .pg-settings-hint { flex: 1 1 100%; }
#view-playground .pg-cluster-section {
    margin-bottom: 10px; padding: 8px; border: 1px solid #30363d;
    border-radius: 7px; background: #0d1117;
}
#view-playground .pg-cluster-section > summary { cursor: pointer; color: #58a6ff; font-size: 11px; font-weight: 600; }
#view-playground .pg-cluster-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
#view-playground .pg-cluster-row {
    width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 8px; text-align: left; border: 1px solid #21262d; border-radius: 6px;
    background: #161b22; color: #c9d1d9; cursor: pointer;
}
#view-playground .pg-cluster-row:hover { border-color: #58a6ff; background: #1c2430; }
#view-playground .pg-cluster-row > span:first-child { min-width: 0; display: flex; flex-direction: column; }
#view-playground .pg-cluster-row strong { color: #e6edf3; font: 11px ui-monospace, monospace; overflow-wrap: anywhere; }
#view-playground .pg-cluster-row small { color: #8b949e; font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#view-playground .pg-cluster-kind { flex: 0 0 auto; font-size: 8px; padding: 2px 5px; border-radius: 8px; color: #58a6ff; background: #58a6ff22; }
#view-playground .pg-cluster-kind-info_intention { color: #f0883e; background: #f0883e22; }
#view-playground .pg-cluster-kind-termination { color: #f85149; background: #f8514922; }
#view-playground .pg-cluster-empty { margin: 4px; color: #6e7681; font-size: 10px; }
#view-playground .pg-info-entries { display: flex; flex-direction: column; gap: 8px; }
#view-playground .pg-info-entry { padding: 8px; border: 1px solid #30363d; border-radius: 6px; background: #161b22; }
#view-playground .pg-info-entry .pg-edit-field { margin-bottom: 7px; }
#view-playground .pg-info-entry-delete { display: block; margin-left: auto; }

/* Editor View */
#pg-editor-view { flex-direction: column; }
#pg-editor-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 20px; background: #161b22; border-bottom: 1px solid #30363d;
}
#pg-editor-agent-name { font-weight: 600; color: #58a6ff; }
#pg-btn-save { background: #238636; color: #fff; border: 1px solid #238636; padding: 6px 16px; border-radius: 6px; cursor: pointer; font-size: 13px; }
#pg-btn-save:hover { background: #2ea043; }
#pg-btn-save:disabled { opacity: 0.5; cursor: default; }

#pg-editor-records {
    flex: 1; overflow-y: auto; padding: 16px 20px;
    display: flex; flex-direction: column; gap: 12px;
}
#view-playground .record-card {
    background: #161b22; border: 1px solid #30363d; border-radius: 8px;
    padding: 12px 16px;
}
#view-playground .record-card.preload { border-left: 3px solid #8957e5; }
#view-playground .record-card.agent { border-left: 3px solid #1f6feb; }
#view-playground .record-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;
}
#view-playground .record-key { font-family: monospace; font-size: 14px; color: #58a6ff; font-weight: 600; }
#view-playground .record-badge { font-size: 11px; padding: 2px 8px; border-radius: 10px; }
#view-playground .record-badge.preload { background: #8957e522; color: #8957e5; }
#view-playground .record-badge.agent { background: #1f6feb22; color: #58a6ff; }
#view-playground .record-desc { font-size: 12px; color: #8b949e; margin-bottom: 6px; }
#view-playground .record-content {
    width: 100%; background: #0d1117; color: #e6edf3; border: 1px solid #30363d;
    border-radius: 6px; padding: 8px 10px; font-family: inherit; font-size: 13px;
    resize: vertical; min-height: 60px; line-height: 1.5;
}
#view-playground .record-content:focus { outline: none; border-color: #58a6ff; }

#view-playground .record-actions {
    display: flex; gap: 6px; margin-top: 8px; justify-content: flex-end;
}
#view-playground .record-actions button {
    padding: 4px 10px; border-radius: 5px; font-size: 11px; cursor: pointer;
    border: 1px solid #30363d; background: #21262d; color: #c9d1d9;
}
#view-playground .record-actions button:hover { background: #30363d; }
#view-playground .record-actions .btn-delete { color: #f85149; border-color: #f8514944; }
#view-playground .record-actions .btn-delete:hover { background: #f8514922; }
#view-playground .record-actions .btn-edit-key { color: #58a6ff; border-color: #58a6ff44; }
#view-playground .record-actions .btn-edit-key:hover { background: #58a6ff22; }

#view-playground .record-key-input {
    font-family: monospace; font-size: 14px; color: #58a6ff; font-weight: 600;
    background: #0d1117; border: 1px solid #58a6ff; border-radius: 4px;
    padding: 2px 6px; outline: none;
}
#view-playground .record-desc-input {
    font-size: 12px; color: #8b949e;
    background: #0d1117; border: 1px solid #58a6ff; border-radius: 4px;
    padding: 2px 6px; outline: none; width: 100%; margin-bottom: 6px;
}

#pg-editor-add-bar {
    display: flex; gap: 8px; padding: 12px 20px; background: #161b22;
    border-top: 1px solid #30363d; align-items: center;
}
#pg-editor-add-bar button {
    padding: 6px 14px; border-radius: 6px; font-size: 13px; cursor: pointer;
    border: 1px solid #30363d; background: #21262d; color: #c9d1d9;
}
#pg-editor-add-bar button:hover { background: #30363d; }
#pg-editor-add-bar .btn-add-intention { color: #1f6feb; border-color: #1f6feb44; }
#pg-editor-add-bar .btn-add-intention:hover { background: #1f6feb22; }
#pg-editor-add-bar .btn-add-flow { color: #bc8cff; border-color: #bc8cff44; }
#pg-editor-add-bar .btn-add-flow:hover { background: #bc8cff22; }
#pg-editor-add-bar .btn-add-info { color: #f0883e; border-color: #f0883e44; }
#pg-editor-add-bar .btn-add-info:hover { background: #f0883e22; }

#view-playground .flow-editor-section {
    display: flex; flex-direction: column; gap: 8px;
    padding: 12px; border: 1px solid #bc8cff44; border-radius: 8px;
    background: #bc8cff09;
}
#view-playground .flow-editor-title {
    color: #bc8cff; font-size: 13px; font-weight: 600;
    text-transform: uppercase; letter-spacing: .5px;
}
#view-playground .flow-editor-hint,
#view-playground .flow-editor-empty { color: #8b949e; font-size: 11px; }
#view-playground .flow-editor-cards { display: flex; flex-direction: column; gap: 8px; }
#view-playground .flow-intention { border-left: 3px solid #bc8cff; }
#view-playground .record-badge.flow { background: #bc8cff22; color: #bc8cff; }
#view-playground .flow-name {
    color: #d2a8ff; font-family: ui-monospace, monospace;
    font-size: 11px; margin: -2px 0 6px;
}
#view-playground .flow-name-input {
    width: 100%; margin: -2px 0 6px; padding: 4px 6px;
    color: #d2a8ff; background: #0d1117; border: 1px solid #bc8cff;
    border-radius: 4px; outline: none; font-family: ui-monospace, monospace;
    font-size: 12px;
}
#view-playground .flow-actions-summary {
    color: #ffa657; font-size: 10px; margin: -2px 0 6px;
    white-space: pre-wrap; word-break: break-word;
}

#view-playground .record-card.deleted { opacity: 0.4; }
#view-playground .record-card.deleted textarea { text-decoration: line-through; }
#view-playground .record-card.new-record { border-color: #238636; box-shadow: 0 0 0 1px #23863644; }

#view-playground .record-card.rotative { border-left: 3px solid #bc8cff; }
#view-playground .record-badge.rotative { background: #bc8cff22; color: #bc8cff; }
#view-playground .record-badge.variant { background: #bc8cff14; color: #bc8cff; border: 1px solid #bc8cff44; }
#view-playground .record-card.variant-child {
    border: 1px solid #30363d;
    border-left: 2px solid #bc8cff66;
    background: #0d1117;
    padding: 10px 12px;
    margin-top: 8px;
}
#view-playground .btn-rotative-toggle {
    width: 100%; text-align: left;
    background: #21262d; border: 1px solid #30363d; border-radius: 5px;
    color: #bc8cff; font-size: 12px; padding: 5px 10px; margin-top: 8px;
    cursor: pointer;
}
#view-playground .btn-rotative-toggle:hover { background: #30363d; }
#view-playground .btn-add-variant {
    width: 100%;
    background: #bc8cff22; border: 1px dashed #bc8cff66; border-radius: 5px;
    color: #bc8cff; font-size: 12px; padding: 5px 10px; margin-top: 6px;
    cursor: pointer;
}
#view-playground .btn-add-variant:hover { background: #bc8cff33; }
#view-playground .record-card.rotative.deleted .btn-add-variant { display: none; }
#view-playground .rotative-variants { display: none; margin-top: 6px; }
#view-playground .record-card.rotative.expanded .rotative-variants { display: block; }
#view-playground .variant-actions { margin-top: 6px; justify-content: flex-end; }

#view-playground .rail-intent-rotative { margin-top: 5px; display: none; }
#view-playground .rail-intent.expanded .rail-intent-rotative { display: block; }
#view-playground .rail-intent-rotative-title {
    font-size: 9px; color: #bc8cff; text-transform: uppercase;
    letter-spacing: 0.5px; margin-bottom: 3px; font-weight: 600; cursor: pointer;
}
#view-playground .rail-intent-rotative-title:hover { color: #d2a8ff; }
#view-playground .rail-intent-rotative-opts { display: none; }
#view-playground .rail-intent.rotative-expanded .rail-intent-rotative-opts { display: block; }
#view-playground .rail-intent-rotative-opt {
    font-size: 10px; padding: 3px 6px; margin-bottom: 2px;
    background: #161b22; border-left: 2px solid #bc8cff66; border-radius: 3px;
}
#view-playground .rail-intent-rotative-key { color: #bc8cff; font-family: ui-monospace, monospace; }
#view-playground .rail-intent-rotative-desc { color: #8b949e; margin-left: 6px; }
#view-playground .rail-intent-rotative-content {
    color: #6e7681; margin-top: 2px; white-space: pre-wrap; word-break: break-word;
}

#view-playground .add-child-bar {
    display: flex; gap: 6px; margin-top: 8px; align-items: center;
}
#view-playground .add-child-bar input {
    background: #0d1117; border: 1px solid #30363d; border-radius: 4px;
    color: #c9d1d9; padding: 4px 8px; font-size: 12px; flex: 1; outline: none;
}
#view-playground .add-child-bar input:focus { border-color: #58a6ff; }
#view-playground .add-child-bar button {
    padding: 4px 10px; border-radius: 5px; font-size: 11px; cursor: pointer;
    border: 1px solid #238636; background: #238636; color: #fff;
}
#view-playground .add-child-bar button:hover { background: #2ea043; }

/* Legend */
#pg-legend {
    display: flex; gap: 16px; padding: 8px 20px; background: #161b22;
    border-top: 1px solid #30363d; font-size: 12px; flex-wrap: wrap;
}
.legend-item { display: flex; align-items: center; gap: 4px; color: #8b949e; }
.dot {
    width: 10px; height: 10px; border-radius: 50%; display: inline-block;
}
.dot.welcome { background: #3fb950; }
.dot.router { background: #d29922; }
.dot.intention { background: #58a6ff; }
.dot.flow_step { background: #bc8cff; }
.dot.second_pass { background: #f0883e; }
.dot.insistence { background: #f85149; }
.dot.transfer { background: #ffa657; }
.dot.termination { background: #8b949e; }
.dot.agent_mode { background: #39d2c0; }
.dot.end { background: #484f58; }
.dot.preload { background: #8957e5; border: 2px dashed #8957e5; background-clip: content-box; }
.legend-badge {
    width: 8px; height: 8px; border-radius: 50%; display: inline-block;
    box-shadow: 0 0 0 2px #0d1117;
}
.legend-badge.pre { background: #39d2c0; }
.legend-badge.post { background: #ffa657; }

/* Node styles in SVG */
#view-playground .node { cursor: pointer; transition: opacity .2s; }
#view-playground .node rect, .node circle, .node polygon, .node path { cursor: pointer; }
#view-playground .node text { pointer-events: none; font-size: 11px; fill: #e6edf3; }
.node:hover rect, .node:hover circle, .node:hover polygon, .node:hover path {
    filter: brightness(1.3) drop-shadow(0 0 6px currentColor);
}
#view-playground .node.dim { opacity: 0.18; }
#view-playground .node.hot rect, .node.hot circle, .node.hot polygon, .node.hot path {
    filter: drop-shadow(0 0 10px #ffa657);
}

#view-playground .link { fill: none; transition: opacity .2s; }

/* Edge importance tiers: lw0 = primary path spine, lw1 = normal branch,
   lw2 = minor/terminal (insistence, terminations, return edges). */
#view-playground .link.lw0 { stroke-width: 3;   stroke-opacity: 0.95; }
#view-playground .link.lw1 { stroke-width: 1.6; stroke-opacity: 0.6;  }
#view-playground .link.lw2 { stroke-width: 1.1; stroke-opacity: 0.35; }

#view-playground .link.dim { opacity: 0.06; }
#view-playground .link-label.dim { opacity: 0.06; }
#view-playground .link-label { transition: opacity .2s; }

.link-label {
    paint-order: stroke; stroke: #0d1117; stroke-width: 3;
    stroke-linecap: butt; stroke-linejoin: miter;
}

/* Outline drawn around a manually expanded flow chain. */
#view-playground .fam-hull {
    fill: rgba(188, 140, 255, 0.05);
    stroke: #bc8cff44;
    stroke-width: 1;
    stroke-dasharray: 5, 4;
    pointer-events: none;
}
#view-playground .fam-hull-label {
    font-size: 10px;
    fill: #bc8cff;
    cursor: pointer;
    font-weight: 600;
}
#view-playground .fam-hull-label:hover { fill: #d2a8ff; }

#view-playground .node.focused rect,
#view-playground .node.focused circle,
#view-playground .node.focused polygon,
#view-playground .node.focused path {
    filter: drop-shadow(0 0 8px currentColor);
}

#view-playground .node-flow_group { cursor: pointer; }

#view-playground .tooltip {
    position: fixed; background: #1c2128; border: 1px solid #30363d;
    border-radius: 6px; padding: 8px 12px; font-size: 12px; color: #c9d1d9;
    pointer-events: none; width: max-content; max-width: min(300px, calc(100vw - 24px));
    z-index: 100; box-sizing: border-box;
    white-space: pre-wrap; line-height: 1.4;
}

/* Call View */
#pg-call-view { flex-direction: column; align-items: center; justify-content: center; }
#pg-call-container { max-width: 520px; width: 100%; padding: 24px; }

.call-card {
    background: #161b22; border: 1px solid #30363d; border-radius: 12px;
    padding: 20px; margin-bottom: 16px;
}

#view-playground .call-status { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; font-size: 14px; color: #8b949e; }

#view-playground .call-status-dot {
    width: 10px; height: 10px; border-radius: 50%; background: #484f58; flex-shrink: 0;
}
#view-playground .call-status-dot.active { background: #3fb950; animation: pulse 1.5s infinite; }
#view-playground .call-status-dot.error { background: #f85149; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

#pg-call-agent-label {
    font-size: 13px; color: #58a6ff; margin-bottom: 12px; font-weight: 600;
}

#view-playground .call-vu { display: flex; gap: 2px; align-items: flex-end; height: 32px; margin-bottom: 16px; }
#view-playground .vu-bar { width: 4px; background: #3fb950; border-radius: 2px; transition: height 60ms; min-height: 2px; }

#view-playground .call-controls { display: flex; gap: 12px; }
#view-playground .call-controls button {
    flex: 1; padding: 12px 0; border: none; border-radius: 8px;
    font-size: 14px; font-weight: 600; cursor: pointer; transition: all .15s;
}

#pg-btn-call-start { background: #238636; color: #fff; }
#pg-btn-call-start:hover { background: #2ea043; }
#pg-btn-call-start:disabled { background: #21262d; color: #484f58; cursor: not-allowed; }

#pg-btn-call-end { background: #da3633; color: #fff; }
#pg-btn-call-end:hover { background: #f85149; }
#pg-btn-call-end:disabled { background: #21262d; color: #484f58; cursor: not-allowed; }

#view-playground .call-log-header {
    font-size: 13px; font-weight: 600; color: #8b949e; margin-bottom: 8px;
    text-transform: uppercase; letter-spacing: 0.5px;
}

#view-playground .call-log {
    background: #0d1117; border-radius: 8px; padding: 12px;
    height: 240px; overflow-y: auto; font-family: monospace;
    font-size: 12px; line-height: 1.6; color: #484f58;
}
#view-playground .call-log .call-in { color: #58a6ff; }
#view-playground .call-log .call-out { color: #bc8cff; }
#view-playground .call-log .call-sys { color: #d29922; }
#view-playground .call-log .call-err { color: #f85149; }

#view-playground .meta-header {
    display: flex; justify-content: space-between; align-items: center;
    cursor: pointer; user-select: none;
}
#view-playground .meta-header-title {
    font-size: 13px; font-weight: 600; color: #8b949e;
    text-transform: uppercase; letter-spacing: 0.5px;
}
#view-playground .meta-toggle-icon {
    font-size: 10px; color: #8b949e; transition: transform .2s;
}
#pg-meta-fields {
    display: flex; flex-direction: column; gap: 8px;
    margin-top: 12px; max-height: 400px; overflow-y: auto;
    transition: max-height .25s ease, opacity .2s ease, margin .2s ease;
}
#pg-meta-fields.collapsed {
    max-height: 0; opacity: 0; margin-top: 0; overflow: hidden; pointer-events: none;
}
#view-playground .meta-row {
    display: flex; gap: 8px; align-items: center;
}
#view-playground .meta-label {
    flex: 0 0 40%; font-size: 12px; color: #58a6ff;
    font-family: ui-monospace, monospace; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}
#view-playground .meta-val {
    flex: 1; background: #0d1117; color: #e6edf3;
    border: 1px solid #30363d; border-radius: 6px;
    padding: 6px 10px; font-size: 12px; outline: none;
    font-family: ui-monospace, monospace;
}
#view-playground .meta-val:focus { border-color: #58a6ff; }
#view-playground .meta-empty {
    font-size: 11px; color: #484f58; font-style: italic;
}

/* Chat View */
#pg-chat-view { flex-direction: row; min-width: 0; }
#view-playground .pg-chat-sidebar {
    width: 360px; min-width: 300px; flex: 0 0 360px;
    overflow-y: auto; border-right: 1px solid #30363d; background: #161b22;
}
#view-playground .pg-chat-panel { padding: 18px; display: flex; flex-direction: column; gap: 8px; }
#view-playground .pg-chat-panel-title {
    color: #e6edf3; font-size: 15px; font-weight: 600; margin-bottom: 2px;
}
#view-playground .pg-chat-agent-label { color: #58a6ff; font-size: 12px; font-weight: 600; margin-bottom: 6px; }
#view-playground .pg-chat-label {
    color: #8b949e; font-size: 11px; margin-top: 3px;
}
#view-playground .pg-chat-input {
    width: 100%; background: #0d1117; color: #e6edf3; border: 1px solid #30363d;
    border-radius: 6px; padding: 8px 10px; outline: none; font: 12px ui-monospace, monospace;
}
#view-playground .pg-chat-input:focus { border-color: #58a6ff; }
#view-playground .pg-chat-textarea { resize: vertical; font-family: inherit; }
#view-playground .pg-chat-checkbox {
    display: flex; align-items: center; gap: 8px; color: #c9d1d9; font-size: 12px;
    margin: 4px 0 2px; cursor: pointer;
}
#view-playground .pg-chat-checkbox small { color: #6e7681; }
#view-playground .pg-chat-divider { height: 1px; background: #30363d; margin: 8px 0 4px; }
#view-playground .pg-chat-section-title {
    color: #8b949e; font-size: 10px; text-transform: uppercase; letter-spacing: .6px; font-weight: 600;
}
#view-playground .pg-chat-tabs { display: flex; gap: 4px; }
#view-playground .pg-chat-tabs button {
    flex: 1; border: 1px solid #30363d; border-radius: 5px; padding: 6px 4px;
    color: #8b949e; background: #21262d; cursor: pointer; font-size: 11px;
}
#view-playground .pg-chat-tabs button:hover { border-color: #58a6ff; color: #e6edf3; }
#view-playground .pg-chat-tabs button.pg-chat-tab-active { background: #1f6feb; border-color: #1f6feb; color: #fff; }
#view-playground .pg-chat-tabs button.pg-chat-tab-inactive { background: #21262d; color: #8b949e; }
#view-playground .pg-chat-compose-panel { display: flex; flex-direction: column; gap: 7px; }
#view-playground .pg-chat-compose-panel.hidden { display: none; }
#view-playground .pg-chat-compose-panel p { color: #8b949e; font-size: 11px; line-height: 1.35; margin: 0; }
#view-playground .pg-chat-file-picker {
    display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 54px;
    border: 1px dashed #30363d; border-radius: 6px; color: #8b949e; font-size: 11px; cursor: pointer;
}
#view-playground .pg-chat-file-picker:hover { border-color: #58a6ff; color: #c9d1d9; }
#view-playground .pg-chat-file-picker input { display: none; }
#view-playground .pg-chat-file-picker .material-icons { font-size: 16px; }
#view-playground #pg-chat-image-preview { max-height: 120px; max-width: 100%; border-radius: 6px; border: 1px solid #30363d; align-self: center; }
#view-playground .pg-chat-field-error { min-height: 15px; color: #f85149; font-size: 11px; margin: 0; }
#view-playground .pg-chat-record-row { display: flex; align-items: center; gap: 8px; }
#view-playground #pg-chat-audio-record-btn {
    flex: 1; border: 0; border-radius: 6px; padding: 8px; background: #da3633; color: #fff;
    display: flex; justify-content: center; align-items: center; gap: 6px; cursor: pointer; font-size: 11px; font-weight: 600;
}
#view-playground #pg-chat-audio-record-btn:hover { background: #f85149; }
#view-playground #pg-chat-audio-record-btn.recording { background: #484f58; }
#view-playground #pg-chat-audio-record-btn .material-icons { font-size: 15px; }
#view-playground #pg-chat-audio-timer { color: #8b949e; font: 11px ui-monospace, monospace; width: 34px; text-align: right; }
#view-playground #pg-chat-audio-level { height: 5px; border-radius: 4px; overflow: hidden; background: #21262d; }
#view-playground #pg-chat-audio-level-bar { height: 100%; width: 0; background: #3fb950; }
#view-playground #pg-chat-audio-preview { width: 100%; height: 30px; }
#view-playground .pg-chat-runtime-card {
    border: 1px solid #30363d; border-radius: 7px; background: #0d1117; padding: 10px; margin-top: 5px;
}
#view-playground .pg-chat-runtime-header {
    display: flex; justify-content: space-between; gap: 8px; color: #8b949e;
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px;
}
#view-playground .pg-chat-runtime-header span:last-child { color: #484f58; font-size: 9px; font-weight: 400; text-transform: none; letter-spacing: 0; }
#view-playground #pg-chat-meta-fields { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; max-height: 260px; overflow-y: auto; }
#view-playground #pg-chat-meta-fields:empty { display: none; }
#view-playground #pg-chat-meta-fields .meta-label { flex-basis: 38%; font-size: 11px; }
#view-playground #pg-chat-meta-fields .meta-val { padding: 5px 7px; font-size: 11px; }
#view-playground .pg-chat-send-btn,
#view-playground .pg-chat-secondary-btn,
#view-playground .pg-chat-danger-btn {
    width: 100%; border: 1px solid transparent; border-radius: 6px; padding: 9px;
    cursor: pointer; font-size: 12px; font-weight: 600; transition: background .15s, border-color .15s;
}
#view-playground .pg-chat-send-btn { display: flex; justify-content: center; align-items: center; gap: 6px; background: #238636; color: #fff; }
#view-playground .pg-chat-send-btn:hover { background: #2ea043; }
#view-playground .pg-chat-send-btn:disabled,
#view-playground #pg-chat-clean-btn:disabled { opacity: .5; cursor: not-allowed; }
#view-playground .pg-chat-send-btn .material-icons { font-size: 15px; }
#view-playground .pg-chat-secondary-btn { background: #21262d; border-color: #30363d; color: #8b949e; }
#view-playground .pg-chat-secondary-btn:hover { background: #30363d; color: #e6edf3; }
#view-playground .pg-chat-danger-btn { background: #3d1d22; border-color: #8e3039; color: #fdaeb7; }
#view-playground .pg-chat-danger-btn:hover { background: #5a232b; }
#view-playground .pg-chat-tools { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
#view-playground .pg-chat-tools > button { align-self: flex-start; border: 0; padding: 0; background: none; color: #6e7681; cursor: pointer; font-size: 11px; }
#view-playground .pg-chat-tools > button:hover { color: #c9d1d9; }
#view-playground #pg-chat-raw-payload,
#view-playground #pg-chat-diagnostics-box { margin: 0; padding: 8px; background: #0d1117; border-radius: 5px; color: #3fb950; font: 10px ui-monospace, monospace; white-space: pre-wrap; word-break: break-word; max-height: 180px; overflow: auto; }
#view-playground .pg-chat-diag-row { display: flex; gap: 6px; line-height: 1.5; }
#view-playground .pg-chat-diag-row .ok { color: #3fb950; }
#view-playground .pg-chat-diag-row .bad { color: #f85149; }
#view-playground .pg-chat-status-text { color: #6e7681; font-size: 10px; min-height: 14px; margin-top: 3px; }
#view-playground .pg-chat-conversation { min-width: 0; flex: 1; display: flex; flex-direction: column; background: #0d1117; }
#view-playground .pg-chat-conversation-header { display: flex; justify-content: space-between; gap: 12px; padding: 13px 18px; border-bottom: 1px solid #30363d; color: #8b949e; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
#view-playground .pg-chat-conversation-header span:last-child { color: #484f58; font-size: 10px; text-transform: none; letter-spacing: 0; }
#view-playground #pg-chat-messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 18px; }
#view-playground .pg-chat-empty { color: #484f58; text-align: center; font-size: 12px; margin-top: 32px; }
#view-playground .pg-chat-row { display: flex; }
#view-playground .pg-chat-row.user { justify-content: flex-start; }
#view-playground .pg-chat-row.agent { justify-content: flex-end; }
#view-playground .pg-chat-bubble { max-width: min(560px, 82%); border-radius: 10px; padding: 9px 11px; color: #fff; }
#view-playground .pg-chat-bubble.user { background: #21262d; }
#view-playground .pg-chat-bubble.agent { background: #176b42; }
#view-playground .pg-chat-bubble p { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; font-size: 13px; line-height: 1.4; }
#view-playground .pg-chat-bubble small { display: block; margin-top: 5px; color: rgba(255,255,255,.6); font-size: 10px; text-align: right; }
#view-playground .pg-chat-bubble-image { display: block; max-width: 100%; max-height: 240px; border-radius: 7px; margin-bottom: 6px; }
#view-playground .pg-chat-bubble-audio { display: block; width: 240px; height: 30px; margin-bottom: 5px; }
#view-playground .pg-chat-tts { border: 0; border-radius: 5px; padding: 6px 8px; margin-bottom: 5px; background: rgba(0,0,0,.2); color: #fff; cursor: pointer; font-size: 10px; }
#view-playground .pg-chat-status-bubble,
#view-playground .pg-chat-error-bubble { align-self: center; border-radius: 12px; padding: 5px 10px; font-size: 10px; }
#view-playground .pg-chat-status-bubble { color: #8b949e; background: #21262d; }
#view-playground .pg-chat-error-bubble { color: #fdaeb7; background: #3d1d22; }

@media (max-width: 760px) {
    #pg-chat-view { flex-direction: column; overflow-y: auto; }
    #view-playground .pg-chat-sidebar { width: 100%; min-width: 0; flex-basis: auto; max-height: 58%; border-right: 0; border-bottom: 1px solid #30363d; }
    #view-playground .pg-chat-conversation { min-height: 320px; }
    #view-playground .pg-chat-conversation-header span:last-child { display: none; }
}
