/* Sidebar Copilot. Tokens come from app.css; z-index sits below modals (100) and toasts (200). */

/* The app's --text-muted (#888) is below WCAG AA on the tinted surfaces used here; the Copilot uses a darker muted. */
.cp-panel, .cp-handle { --cp-muted: #5f6368; }
html[data-theme="dark"] .cp-panel { --cp-muted: #b4b9bf; }

.cp-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- the one entry point: a slim handle on the right edge ---- */
.cp-handle {
  position: fixed; right: 0; top: 42%; z-index: 55;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px 8px; border-radius: 12px 0 0 12px;
  background: var(--red); color: #fff; border: none;
  box-shadow: -2px 4px 14px rgba(0, 0, 0, 0.18);
  transition: padding 0.15s ease, transform 0.18s ease, opacity 0.15s ease;
}
.cp-handle:hover:not(:disabled) { padding-left: 12px; background: var(--red-hover, #9C0606); }
.cp-handle-label { writing-mode: vertical-rl; transform: rotate(180deg); font-family: var(--font-mono, monospace); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; }
.cp-handle.cp-handle-away { transform: translateX(110%); opacity: 0; pointer-events: none; }
.cp-badge { position: absolute; top: -6px; left: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--black, #111); color: #fff; font-size: 10px; line-height: 18px; text-align: center; border: 2px solid var(--bg-page); }

/* ---- the drawer ---- */
.cp-panel {
  position: fixed; right: 0; top: 0; bottom: 0; z-index: 60;
  width: var(--cp-w, 440px); max-width: 100vw;
  display: flex; flex-direction: column;
  background: var(--bg-surface); color: var(--text-primary);
  border-left: 1px solid var(--border-color);
  box-shadow: -8px 0 28px rgba(0, 0, 0, 0.14);
  transform: translateX(104%); visibility: hidden;
  transition: transform 0.22s cubic-bezier(0.2, 0.7, 0.2, 1), visibility 0s linear 0.22s;
}
.cp-panel.open { transform: translateX(0); visibility: visible; transition: transform 0.22s cubic-bezier(0.2, 0.7, 0.2, 1); }
body.cp-resizing { user-select: none; cursor: col-resize; }
body.cp-resizing .cp-panel { transition: none; }
/* Pinned: the workspace gives up the panel's width instead of being covered. */
body.cp-pinned #screen3 .body,
body.cp-pinned #screen2 { margin-right: var(--cp-w, 440px); }
body.cp-pinned .cp-panel { box-shadow: none; }

.cp-resize { position: absolute; left: -3px; top: 0; bottom: 0; width: 7px; cursor: col-resize; z-index: 2; }
.cp-resize:hover, .cp-resize:focus-visible { background: linear-gradient(90deg, transparent 2px, var(--red) 2px, var(--red) 4px, transparent 4px); outline: none; }

.cp-head { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--border-color); }
.cp-title { display: flex; flex-direction: column; min-width: 0; }
.cp-title-name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.cp-ctx { font-family: var(--font-mono, monospace); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cp-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 250px; }
.cp-head-actions { display: flex; gap: 4px; }
.cp-icon { width: 30px; height: 30px; padding: 0; border-radius: 8px; background: transparent; color: var(--cp-muted); border: 1px solid transparent; font-size: 16px; line-height: 1; }
.cp-icon:hover:not(:disabled) { background: var(--bg-surface-alt); color: var(--text-primary); }
.cp-menu { position: absolute; right: 12px; top: 46px; z-index: 5; min-width: 190px; display: flex; flex-direction: column; padding: 6px; background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16); }
.cp-menu button { text-align: left; background: transparent; color: var(--text-primary); padding: 8px 10px; font-size: 13px; border-radius: 6px; }
.cp-menu button:hover { background: var(--bg-surface-alt); }

.cp-body { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }
.cp-view { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; }

/* ---- Launchpad ---- */
.cp-hello-title { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.cp-action { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 9px 10px; background: transparent; color: var(--text-primary); text-align: left; border-radius: 8px; }
.cp-action:hover { background: var(--bg-surface-alt); }
.cp-action-label { font-size: 13.5px; font-weight: 600; }
.cp-action-hint { font-size: 12px; color: var(--cp-muted); font-weight: 400; }
.cp-empty { font-size: 13px; color: var(--cp-muted); padding: 8px 2px; }
.cp-link { background: transparent; color: var(--cp-muted); padding: 6px 0; font-size: 12.5px; }
.cp-link:hover { color: var(--text-primary); }

/* ---- heads-up: one card, dismissible ---- */

/* ---- guided form ---- */
.cp-form-title { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; margin: 6px 0 12px; }
.cp-label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; font-family: var(--font-mono, monospace); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--cp-muted); }
.cp-label .cp-field { font-family: var(--font-sans, inherit); letter-spacing: normal; text-transform: none; resize: vertical; }
.cp-cta { width: 100%; padding: 11px; }

/* ---- conversation ---- */
.cp-thread { display: flex; flex-direction: column; gap: 14px; }
.cp-msg { max-width: 100%; font-size: 13.5px; line-height: 1.55; }
.cp-user { align-self: flex-end; max-width: 88%; background: var(--bg-surface-3, var(--bg-surface-alt)); border: 1px solid var(--border-color); border-radius: 12px 12px 4px 12px; padding: 9px 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.cp-assistant { align-self: stretch; }
.cp-error .cp-msg-body { color: var(--red); background: var(--err-bg); border-radius: 8px; padding: 9px 12px; }
.cp-msg-body > :first-child { margin-top: 0; }
.cp-msg-body > :last-child { margin-bottom: 0; }
.cp-msg-body p { margin: 0 0 9px; overflow-wrap: anywhere; }
.cp-msg-body ul, .cp-msg-body ol { margin: 0 0 9px; padding-left: 20px; }
.cp-msg-body li { margin: 2px 0; }
.cp-msg-body a { color: var(--red); }
.cp-msg-body code { font-family: var(--font-mono, monospace); font-size: 12px; background: var(--bg-surface-alt); padding: 1px 5px; border-radius: 4px; }
.cp-msg-body blockquote { margin: 0 0 9px; padding: 2px 0 2px 12px; border-left: 2px solid var(--border-color); color: var(--cp-muted); }
.cp-h { margin: 12px 0 6px; font-size: 14px; letter-spacing: -0.01em; }
.cp-status { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-family: var(--font-mono, monospace); font-size: 11px; color: var(--cp-muted); }
.cp-stopped { margin-top: 6px; font-family: var(--font-mono, monospace); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--cp-muted); }
.cp-extras { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }

/* ---- code ---- */
.cp-code { margin: 0 0 9px; border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; background: var(--bg-surface-alt); }
.cp-code-bar { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px; border-bottom: 1px solid var(--border-color); }
.cp-code-lang { font-family: var(--font-mono, monospace); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--cp-muted); }
.cp-code pre { margin: 0; padding: 10px 12px; overflow-x: auto; font-size: 12px; line-height: 1.5; }
.cp-code pre code { background: transparent; padding: 0; }
.cp-mini { padding: 3px 9px; font-size: 11.5px; background: var(--bg-surface); color: var(--text-primary); border: 1px solid var(--border-color); border-radius: 6px; }
.cp-mini:hover { background: var(--bg-surface-alt); }

/* ---- blocks ---- */
.cp-block { border: 1px solid var(--border-color); border-radius: 10px; padding: 10px 12px; background: var(--bg-surface); }
.cp-block-title { font-family: var(--font-mono, monospace); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--cp-muted); margin-bottom: 8px; }
.cp-block-foot { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; }
.cp-stat { padding: 8px 10px; background: var(--bg-surface-alt); border-radius: 8px; }
.cp-stat-v { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.cp-stat-l { font-size: 11.5px; color: var(--cp-muted); margin-top: 1px; }
.cp-tablewrap { overflow-x: auto; margin: 0 0 4px; }
.cp-md-table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.cp-md-table th, .cp-md-table td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--border-color); vertical-align: top; }
.cp-md-table th { font-family: var(--font-mono, monospace); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cp-muted); cursor: pointer; white-space: nowrap; user-select: none; }
.cp-md-table th:hover { color: var(--text-primary); }
.cp-source { margin-top: 8px; font-size: 11.5px; color: var(--cp-muted); }
.cp-source summary { cursor: pointer; }
.cp-source div { margin-top: 4px; font-family: var(--font-mono, monospace); font-size: 11px; overflow-wrap: anywhere; }
.cp-bars { display: flex; flex-direction: column; gap: 5px; }
.cp-bar-row { display: grid; grid-template-columns: minmax(70px, 30%) 1fr 34px; align-items: center; gap: 8px; font-size: 12px; }
.cp-bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--cp-muted); }
.cp-bar-track { height: 10px; background: var(--bg-surface-alt); border-radius: 5px; overflow: hidden; display: block; }
.cp-bar-fill { display: block; height: 100%; background: var(--red); border-radius: 5px; }
.cp-bar-val { text-align: right; font-family: var(--font-mono, monospace); font-size: 11px; }
.cp-chart-svg { width: 100%; height: auto; }
.cp-chart-ends { display: flex; justify-content: space-between; font-family: var(--font-mono, monospace); font-size: 10px; color: var(--cp-muted); }

/* ---- artifacts ---- */
.cp-artifact { border: 1px solid var(--border-color); border-left: 2px solid var(--red); border-radius: 10px; padding: 9px 11px; background: var(--bg-surface); }
.cp-artifact-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.cp-artifact-title { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; }
.cp-artifact-actions { display: flex; gap: 6px; }
.cp-artifact-body { margin-top: 8px; }
.cp-pill { font-family: var(--font-mono, monospace); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; background: var(--bg-surface-alt); color: var(--cp-muted); }

/* ---- footer / composer ---- */
.cp-foot { padding: 8px 12px 10px; border-top: 1px solid var(--border-color); background: var(--bg-surface); position: relative; }
.cp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cp-chips:not(:empty) { margin-bottom: 8px; }
.cp-chip { padding: 5px 11px; font-size: 12.5px; background: var(--bg-surface); color: var(--text-primary); border: 1px solid var(--border-color); border-radius: 999px; text-align: left; }
.cp-chip:hover { border-color: var(--red); color: var(--red); background: var(--bg-surface); }
.cp-chip-act { border-color: var(--red); color: var(--red); }
.cp-actions-row { display: flex; flex-wrap: wrap; gap: 6px; }
.cp-toggle { display: block; margin-bottom: 8px; padding: 4px 10px; font-size: 12px; background: transparent; color: var(--cp-muted); border: 1px dashed var(--border-color); border-radius: 999px; }
.cp-toggle.on { color: var(--red); border-color: var(--red); border-style: solid; }
.cp-composer { display: flex; align-items: flex-end; gap: 6px; padding: 6px; background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 12px; }
.cp-composer:focus-within { border-color: var(--red); box-shadow: 0 0 0 3px var(--ring, rgba(191, 4, 4, 0.2)); }
.cp-composer textarea { flex: 1; min-width: 0; resize: none; border: none; background: transparent; color: var(--text-primary); padding: 7px 4px; font-size: 13.5px; line-height: 1.4; max-height: 140px; outline: none; box-shadow: none; }
.cp-composer textarea:focus { border: none; box-shadow: none; }
.cp-msg-actions { display: flex; gap: 6px; margin-top: 6px; opacity: 0.75; }
.cp-msg:hover .cp-msg-actions, .cp-msg-actions:focus-within { opacity: 1; }
.cp-notice { padding: 8px 10px; font-size: 12px; background: var(--sys-bg, var(--bg-surface-alt)); border-radius: 8px; color: var(--sys-text, var(--cp-muted)); }
.cp-hist-list { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.cp-hist-row { display: flex; align-items: stretch; gap: 4px; }
.cp-hist-row .cp-hist-item { flex: 1; }
.cp-hist-del { align-self: center; }
.cp-hist-item { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 8px 10px; background: transparent; color: var(--text-primary); text-align: left; border-radius: 8px; }
.cp-hist-item:hover { background: var(--bg-surface-alt); }
.cp-hist-title { font-size: 13.5px; font-weight: 600; }
.cp-hist-meta { font-size: 11.5px; color: var(--cp-muted); font-weight: 400; }
.cp-hist-preview { font-size: 12px; color: var(--cp-muted); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.cp-files { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.cp-file { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 3px 4px 3px 9px; font-size: 12px; background: var(--bg-surface-alt); border: 1px solid var(--border-color); border-radius: 999px; }
.cp-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 190px; }
.cp-file button { width: 18px; height: 18px; padding: 0; line-height: 1; font-size: 11px; border-radius: 50%; background: transparent; color: var(--cp-muted); }
.cp-file button:hover { background: var(--err-bg); color: var(--red); }
.cp-panel.cp-drop { outline: 2px dashed var(--red); outline-offset: -6px; }
.cp-sent-files { margin-top: 6px; font-size: 11.5px; color: var(--cp-muted); }
.cp-send { width: 32px; height: 32px; padding: 0; border-radius: 8px; background: var(--red); color: #fff; font-size: 16px; line-height: 1; flex: none; }
.cp-send.stop { background: var(--black, #111); font-size: 12px; }
.cp-note { margin-top: 6px; text-align: center; font-family: var(--font-mono, monospace); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--cp-muted); }
.cp-slash { position: absolute; left: 12px; right: 12px; bottom: 100%; margin-bottom: 4px; padding: 4px; background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16); }
.cp-slash-item { width: 100%; display: flex; gap: 10px; align-items: baseline; padding: 7px 10px; background: transparent; color: var(--text-primary); text-align: left; border-radius: 6px; }
.cp-slash-item.sel, .cp-slash-item:hover { background: var(--bg-surface-alt); }
.cp-slash-cmd { font-family: var(--font-mono, monospace); font-size: 12px; color: var(--red); }
.cp-slash-desc { font-size: 12.5px; color: var(--cp-muted); }

/* ---- API Lab ---- */
.cp-panel.cp-in-lab #cpChips, .cp-panel.cp-in-lab .cp-composer, .cp-panel.cp-in-lab #cpChatToggle, .cp-panel.cp-in-lab #cpSlash { display: none; }
.cp-panel.cp-in-lab .cp-foot { padding-top: 4px; border-top: none; }
.cp-sticky { position: sticky; bottom: -16px; margin: 0 -16px -16px; padding: 10px 16px 16px; background: linear-gradient(to bottom, transparent, var(--bg-surface) 28%); }
.cp-lab-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.cp-steps { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; font-family: var(--font-mono, monospace); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; }
.cp-step { padding: 3px 7px; border-radius: 999px; color: var(--cp-muted); border: 1px solid var(--border-color); }
.cp-step.on { color: #fff; background: var(--red); border-color: var(--red); }
.cp-step.done { color: var(--text-primary); }
.cp-lab-lead, .cp-hint { margin: 0 0 10px; font-size: 12.5px; color: var(--cp-muted); line-height: 1.5; }
.cp-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; align-items: center; }
.cp-adv { margin: 4px 0 6px; font-size: 12.5px; color: var(--cp-muted); }
.cp-adv summary { cursor: pointer; margin-bottom: 8px; }
.cp-lab-error { margin: 8px 0; padding: 9px 12px; font-size: 12.5px; color: var(--red); background: var(--err-bg); border-radius: 8px; }
.cp-lab-sum { margin-bottom: 10px; }
.cp-lab-sum strong { margin-right: 8px; }
.cp-chiprow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0; }
.cp-chip.on { background: var(--red); border-color: var(--red); color: #fff; }
.cp-count { margin-left: auto; font-family: var(--font-mono, monospace); font-size: 11px; color: var(--cp-muted); }
.cp-mut { display: flex; gap: 8px; align-items: center; margin: 6px 0 10px; padding: 8px 10px; font-size: 12.5px; border: 1px dashed var(--border-color); border-radius: 8px; cursor: pointer; }
.cp-eplist { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.cp-tag { display: flex; align-items: center; gap: 8px; padding: 8px 4px 4px; }
.cp-tag-name { flex: 1; display: flex; justify-content: space-between; background: transparent; color: var(--text-primary); padding: 2px 0; font-family: var(--font-mono, monospace); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; text-align: left; border-radius: 0; }
.cp-ep { display: flex; align-items: flex-start; gap: 8px; padding: 6px 6px; border-radius: 8px; cursor: pointer; font-size: 12.5px; }
.cp-ep:hover { background: var(--bg-surface-alt); }
.cp-ep.locked { opacity: 0.5; cursor: not-allowed; }
.cp-ep.dep .cp-ep-path { text-decoration: line-through; }
.cp-ep input { margin-top: 3px; }
.cp-ep-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cp-ep-path { font-family: var(--font-mono, monospace); font-size: 12px; overflow-wrap: anywhere; }
.cp-ep-sum { color: var(--cp-muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-m { flex: none; min-width: 46px; text-align: center; padding: 1px 0; border-radius: 4px; font-family: var(--font-mono, monospace); font-size: 10px; font-weight: 600; color: #fff; background: #5b6472; }
.cp-m-get { background: #15803d; } .cp-m-post { background: #1d4ed8; } .cp-m-put { background: #a16207; } .cp-m-patch { background: #6d28d9; } .cp-m-delete { background: #b91c1c; }
.cp-flag { flex: none; padding: 0 6px; font-family: var(--font-mono, monospace); font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; border-radius: 999px; border: 1px solid var(--border-color); color: var(--cp-muted); }
.cp-flag.warn { color: #8a5a00; border-color: #a16207; }
html[data-theme="dark"] .cp-flag.warn { color: #e0a82e; border-color: #e0a82e; }

/* ---- API Lab: setup + script ---- */
.cp-label-text { margin: 12px 0 6px; font-family: var(--font-mono, monospace); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--cp-muted); }
.cp-seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.cp-seg-btn { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 4px; background: var(--bg-surface); color: var(--text-primary); border: 1px solid var(--border-color); border-radius: 8px; font-size: 13px; }
.cp-seg-btn small { color: var(--cp-muted); font-size: 10.5px; font-weight: 400; }
.cp-seg-btn.on, .cp-profile.on { border-color: var(--red); background: var(--err-bg); }
.cp-seg.two { grid-template-columns: repeat(2, 1fr); }
.cp-verdict { padding: 12px 14px; border-radius: 10px; font-weight: 700; font-size: 14px; margin: 8px 0; }
.cp-verdict.pass { background: rgba(31,157,85,0.14); color: #136a38; }
.cp-verdict.fail { background: var(--err-bg); color: var(--red); }
.cp-verdict.unknown { background: var(--bg-surface-alt); color: var(--cp-muted); }
.cp-reasons { margin: 4px 0 10px; padding-left: 18px; font-size: 12.5px; }
.cp-mono { font-family: var(--font-mono, monospace); font-size: 12px; }
.cp-flags { max-width: 90px; }
.cp-regex-row { grid-template-columns: 1fr 100px; }
.cp-tool-pane { margin-top: 10px; }
.cp-tool-out { margin-top: 10px; }
.cp-tool-out .cp-code { margin-bottom: 8px; }
.cp-check-ok { padding: 10px 12px; border-radius: 8px; background: rgba(31,157,85,0.14); color: #1f9d55; font-weight: 600; font-size: 13px; }
.cp-check-bad { padding: 10px 12px; border-radius: 8px; background: var(--err-bg); color: var(--red); font-weight: 600; font-size: 13px; }
.cp-check-out { margin-top: 12px; }
.cp-problems { margin: 8px 0; padding-left: 18px; font-size: 12.5px; }
.cp-problems li { margin: 4px 0; }
.cp-problems code { font-family: var(--font-mono, monospace); font-size: 11.5px; background: var(--bg-surface-alt); padding: 1px 5px; border-radius: 4px; }
.cp-profiles { display: flex; flex-direction: column; gap: 6px; }
.cp-profile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 10px; background: var(--bg-surface); color: var(--text-primary); text-align: left; border: 1px solid var(--border-color); border-radius: 8px; }
.cp-profile-name { font-weight: 600; font-size: 13px; }
.cp-profile-blurb { font-size: 11.5px; color: var(--cp-muted); font-weight: 400; }
.cp-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.cp-half { margin-bottom: 4px; }
.cp-safety { margin: 12px 0; padding: 10px 12px; border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-surface-alt); }
.cp-safety.prod { border-color: var(--sys-border, #f0d878); background: var(--sys-bg, #fff8e1); }
.cp-safety-title { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.cp-ack { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; font-size: 12.5px; cursor: pointer; }
.cp-ack input { margin-top: 2px; }
.cp-lab-warn { margin: 6px 0; padding: 8px 10px; font-size: 12px; background: var(--sys-bg, #fff8e1); border-radius: 8px; color: var(--sys-text, inherit); }
.cp-wrow { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: 12px; }
.cp-wrow .cp-ep-path { flex: 1; min-width: 0; }
.cp-weight { width: 64px; padding: 4px 6px; }
.cp-env td { vertical-align: top; }
.cp-scroll { max-height: 320px; overflow: auto; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-surface-alt); }
.cp-scroll pre { margin: 0; padding: 10px 12px; font-size: 11.5px; line-height: 1.5; }
.cp-scroll code { font-family: var(--font-mono, monospace); background: transparent; padding: 0; }
.cp-row .cp-field { flex: 1; min-width: 160px; }

/* ---- small screens: a full-height sheet; the handle stays out of the composer's way ---- */
@media (max-width: 899px) {
  .cp-panel { width: 100vw; }
  .cp-resize { display: none; }
  .cp-handle { top: auto; bottom: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  .cp-panel, .cp-panel.open, .cp-handle { transition: none; }
}
.cp-modes { display: flex; margin: 0 0 10px; border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; }
.cp-mode-btn { flex: 1; padding: 6px 8px; font-size: 12.5px; background: var(--bg-surface); color: var(--text-primary); border: 0; border-radius: 0; }
.cp-mode-btn + .cp-mode-btn { border-left: 1px solid var(--border-color); }
.cp-mode-btn.on { background: var(--red); color: #fff; }
.cp-msg-btn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; background: transparent; color: var(--cp-muted); border: 1px solid transparent; border-radius: 6px; }
.cp-msg-btn:hover { background: var(--bg-surface-alt); color: var(--text-primary); }

/* Tabs: AI chat and Tools are separate places */

/* Loading: anything that waits on the server or Drive shows it */
@keyframes cp-spin { to { transform: rotate(360deg); } }
.cp-spin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--border-color); border-top-color: var(--red); border-radius: 50%; animation: cp-spin 0.8s linear infinite; flex: none; }
.cp-loading { display: flex; align-items: center; gap: 10px; padding: 14px 4px; font-size: 13px; color: var(--cp-muted); }
.cp-overlay { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; gap: 10px; background: color-mix(in srgb, var(--bg-surface) 82%, transparent); font-size: 13px; color: var(--text-primary); }
.cp-overlay.hidden { display: none; }
.is-loading { position: relative; opacity: 0.75; cursor: progress; }
@media (prefers-reduced-motion: reduce) { .cp-spin { animation-duration: 2.4s; } }

/* Chat history groups, the chat's download button, AI badges and panels */
.cp-thread-bar { position: sticky; top: 0; z-index: 2; align-self: flex-end; margin-bottom: -6px; }
.cp-thread-bar .cp-msg-btn { background: var(--bg-surface); border-color: var(--border-color); }
.cp-ai-badge { display: inline-block; margin: 0 6px 0 6px; padding: 0 5px; font-size: 9px; font-weight: 700; letter-spacing: 0.05em; line-height: 15px; border-radius: 4px; color: #fff; background: var(--red); vertical-align: 1px; }
.cp-ai-opt { margin-top: 10px; }
.cp-review { margin: 12px 0; padding: 12px; border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-surface-alt); }
.cp-review .cp-verdict { margin: 4px 0 6px; padding: 8px 10px; font-size: 13px; }
.cp-rv-line { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin: 4px 0; font-size: 12.5px; }
.cp-rv-line.ok { color: #1f7a45; } .cp-rv-line.bad { color: var(--red); }
.cp-askai { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.cp-status { padding: 8px 0; border-bottom: 1px solid var(--border-color); font-size: 13px; }
.cp-status-head { display: flex; align-items: center; gap: 8px; }
.cp-status-code { padding: 1px 6px; border-radius: 5px; font-weight: 700; background: var(--bg-surface-alt); }
.cp-status-code.c4, .cp-status-code.c5 { color: var(--red); }
.cp-status-code.c2 { color: #1f7a45; }
button.cp-step { font: inherit; letter-spacing: inherit; text-transform: inherit; background: transparent; cursor: pointer; }
button.cp-step:disabled { opacity: 0.45; cursor: not-allowed; }
button.cp-step.on { background: var(--red); }
.cp-panel.cp-in-tools .cp-foot { display: none; }
html[data-theme="dark"] .cp-status-code.c2, html[data-theme="dark"] .cp-rv-line.ok, html[data-theme="dark"] .cp-verdict.pass { color: #5fd08a; }
html[data-theme="dark"] .cp-status-code.c4, html[data-theme="dark"] .cp-status-code.c5, html[data-theme="dark"] .cp-rv-line.bad { color: #ff7b84; }
.cp-datarow { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--border-color); }
.cp-datarow-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.cp-datarow-value { font-family: var(--font-mono, monospace); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: none; padding: 0; }
.cp-datarow-note { font-size: 11.5px; color: var(--cp-muted); }
.cp-rep { margin: 8px 0; }
.cp-rep-title { font-size: 12px; font-weight: 700; margin-bottom: 2px; }
.cp-rep ul { margin: 0; padding-left: 18px; font-size: 12.5px; }
.cp-rep li { margin: 2px 0; }

.cp-cat-actions { display: flex; flex-direction: column; gap: 2px; padding: 4px 6px 8px; }
.cp-chev { color: var(--cp-muted); font-size: 12px; }
.cp-search { width: 100%; padding: 10px 12px; font-size: 13.5px; background: var(--bg-surface); color: var(--text-primary); border: 1px solid var(--border-color); border-radius: 8px; margin-bottom: 10px; }
.cp-hello { margin-bottom: 12px; }
.cp-hello-sub { margin-top: 6px; font-size: 13px; color: var(--cp-muted); }

/* ---- clean home: centred greeting, nothing else ---- */
#cpLaunchpad:not(.hidden) { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 4px; padding-bottom: 8vh; }
.cp-home-mark { width: 44px; height: 44px; display: grid; place-items: center; margin-bottom: 10px; border-radius: 50%; background: var(--err-bg); color: var(--red); font-size: 20px; }
#cpLaunchpad .cp-hello-title { font-size: 22px; }
#cpLaunchpad kbd { display: inline-block; min-width: 18px; padding: 0 5px; font: 12px var(--font-mono, monospace); color: var(--text-primary); background: var(--bg-surface-alt); border: 1px solid var(--border-color); border-radius: 5px; }
.cp-headsup { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin-top: 18px; }
.cp-headsup-item { padding: 4px 11px; font-size: 12px; color: var(--sys-text, var(--text-primary)); background: var(--sys-bg, var(--bg-surface-alt)); border: 1px solid var(--sys-border, var(--border-color)); border-radius: 999px; }
.cp-headsup-item:hover { color: var(--red); border-color: var(--red); }
.cp-headsup-x { width: 22px; height: 22px; padding: 0; font-size: 11px; line-height: 1; border-radius: 50%; background: transparent; color: var(--cp-muted); }
.cp-headsup-x:hover { background: var(--err-bg); color: var(--red); }

/* ---- earlier chats: collapsible project groups ---- */
.cp-hist-group { width: 100%; display: flex; align-items: center; gap: 8px; margin-top: 6px; padding: 6px 4px; background: transparent; color: var(--text-primary); font-size: 12.5px; font-weight: 700; text-align: left; border-radius: 6px; }
.cp-hist-group:hover { background: var(--bg-surface-alt); }
.cp-hist-group-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-hist-count { font-weight: 500; font-size: 11px; color: var(--cp-muted); }

/* ---- composer: rounder, roomier ---- */
.cp-foot { border-top: none; padding: 6px 14px 12px; }
.cp-composer { padding: 8px; border-radius: 18px; }

/* ---- full screen: content stays a readable column ---- */
.cp-panel.cp-full { left: 0; right: 0; width: auto; border-left: none; box-shadow: none; }
.cp-panel.cp-full .cp-resize, .cp-panel.cp-full #cpPinBtn, .cp-panel.cp-full #cpWideBtn { display: none; }
.cp-panel.cp-full .cp-view, .cp-panel.cp-full .cp-foot { padding-left: max(16px, calc((100% - 820px) / 2)); padding-right: max(16px, calc((100% - 820px) / 2)); }
.cp-panel.cp-full .cp-head { padding-left: max(16px, calc((100% - 820px) / 2 - 4px)); padding-right: max(12px, calc((100% - 820px) / 2 - 4px)); }
.cp-icon[aria-pressed="true"] { color: var(--red); background: var(--err-bg); }
@media (max-width: 899px) { #cpFullBtn { display: none; } }
