:root {
  --bg: #101418;
  --bg-raise: #171d23;
  --bg-panel: #1d242c;
  --line: #2a333d;
  --text: #e8eef3;
  --text-dim: #93a1ad;
  /* Brand / primary action. Status colours live in --ok/--warn/--danger and are
     deliberately NOT derived from the brand: a secure app must read green even
     if the brand changes again. */
  --accent: #8b5cf6;
  --accent-dim: #4c3a8f;
  --ok: #35c28f;
  --ok-dim: #23795b;
  --warn: #e8b04b;
  --danger: #e06459;
  --mono: "Cascadia Code", "JetBrains Mono", Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* The browser's own [hidden] rule is display:none, but any author rule that sets an
   explicit display (e.g. .auth-gate-card label, .auth-gate-forgot) beats it on equal
   specificity and silently re-shows the element — which left the Name and Confirm
   password fields visible on the Log in screen. Every `hidden` toggle in app.js
   depends on this holding, so enforce it once, globally. */
[hidden] { display: none !important; }

/* ---------- auth gate (blocks everything, BYOK included, until signed in) ---------- */
.auth-gate {
  position: fixed; inset: 0; z-index: 1000; background: var(--bg);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.auth-gate-card {
  width: 100%; max-width: 400px; background: var(--bg-panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 32px 28px;
}
.auth-gate-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; color: var(--text-dim); margin-bottom: 22px; }
.auth-gate-brand .brand-mark { color: var(--accent); }
.auth-gate-card h1 { font-size: 20px; margin-bottom: 8px; }
.auth-gate-sub { color: var(--text-dim); font-size: 13px; line-height: 1.6; margin-bottom: 20px; }
.auth-gate-oauth { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.oauth-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.oauth-btn:hover { border-color: var(--text-dim); }
.auth-gate-divider { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; color: var(--text-dim); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.5px; }
.auth-gate-divider::before, .auth-gate-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-gate-card label { display: block; font-size: 12.5px; color: var(--text-dim); margin-bottom: 6px; }
.auth-gate-card input {
  width: 100%; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font-size: 14px; margin-top: 4px;
}
.auth-gate-status { font-size: 12.5px; color: var(--text-dim); margin-top: 12px; min-height: 16px; text-align: center; }
.auth-gate-status.error { color: var(--danger); }
.auth-gate-status.success { color: var(--ok); }
.auth-gate-switch { text-align: center; font-size: 12.5px; color: var(--text-dim); margin-top: 16px; }
.auth-gate-switch a, .auth-gate-forgot { color: var(--accent); text-decoration: none; margin-left: 4px; }
.auth-gate-switch a:hover, .auth-gate-forgot:hover { text-decoration: underline; }
.auth-gate-contact { text-align: center; font-size: 11.5px; color: var(--text-dim); margin-top: 18px; }
.auth-gate-contact a { color: var(--text-dim); text-decoration: underline; margin-left: 4px; }
.auth-gate-contact a:hover { color: var(--accent); }
.auth-gate-forgot { display: block; text-align: center; font-size: 12px; margin-top: 10px; }

body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px 18px;
  background: var(--bg-raise);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-mark { color: var(--accent); font-size: 18px; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: 0.3px; }
.brand-tag { color: var(--text-dim); font-size: 12px; }

.plan-badge {
  display: flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 100px;
  font-size: 12px; font-weight: 700; border: 1px solid var(--line); background: var(--bg-panel);
  white-space: nowrap;
}
.plan-badge .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.plan-badge.pro { color: var(--ok); border-color: var(--ok-dim); }
.plan-badge.pro .dot { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.plan-badge.free { color: var(--warn); border-color: var(--warn); }
.plan-badge.free .dot { background: var(--warn); }
.plan-badge .name { color: var(--text-dim); font-weight: 400; }

.meter { margin-left: auto; min-width: 220px; }
.meter-row { display: flex; align-items: baseline; gap: 6px; font-size: 12px; }
.meter-label { color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.6px; font-size: 10px; }
.meter-value { font-weight: 700; font-family: var(--mono); }
.meter-cap { color: var(--text-dim); }
.meter-bar { height: 4px; background: var(--line); border-radius: 2px; margin-top: 4px; overflow: hidden; }
.meter-fill { height: 100%; width: 0%; background: var(--ok); border-radius: 2px; transition: width 0.3s; }
.meter-fill.hot { background: var(--warn); }
.meter-fill.over { background: var(--danger); }
.meter-wasted { font-size: 11px; color: var(--text-dim); margin-top: 3px; }

/* ---------- layout ---------- */
.layout { flex: 1; display: flex; min-height: 0; }

/* ---------- left icon rail ---------- */
.rail {
  width: 56px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center;
  gap: 6px; padding: 10px 0; background: var(--bg-raise); border-right: 1px solid var(--line);
}
.rail-spacer { flex: 1; }
.rail-btn {
  width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 10px; background: none; cursor: pointer;
  color: var(--text-dim); font-size: 15px; line-height: 1; transition: color .15s, background .15s;
}
.rail-btn:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.rail-btn.active { color: var(--accent); background: rgba(139,92,246,0.14); border-color: rgba(139,92,246,0.35); }
.rail-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.chat {
  width: 380px;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--bg-raise);
}
.messages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }

.msg { padding: 10px 12px; border-radius: 10px; font-size: 13.5px; line-height: 1.5; }
.msg.system { background: var(--bg-panel); color: var(--text-dim); border: 1px dashed var(--line); }
.msg.user { background: var(--accent-dim); color: #f1ecff; align-self: flex-end; max-width: 90%; }
.msg.assistant { background: var(--bg-panel); border: 1px solid var(--line); }
.msg .hint { margin-top: 6px; font-size: 12px; }
.msg .cost-line { display: block; margin-top: 6px; font-size: 11px; color: var(--text-dim); font-family: var(--mono); }
.msg.failed { border-color: var(--danger); }
.msg.failed .cost-line { color: var(--danger); }
.msg.working { color: var(--text-dim); font-style: italic; }

.template-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.template-card {
  background: var(--bg-panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px; color: var(--text); display: flex; flex-direction: column; gap: 6px;
}
.template-card:hover { border-color: var(--accent); }
.template-card .t-main {
  background: none; border: none; padding: 0; margin: 0; text-align: left; cursor: pointer; color: inherit; font: inherit; width: 100%;
}
.template-card .t-icon { font-size: 18px; }
.template-card .t-name { font-size: 12.5px; font-weight: 700; margin-top: 3px; }
.template-card .t-desc { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.template-card .t-use-prompt {
  align-self: flex-start; background: none; border: none; padding: 0; margin: 0;
  font-size: 10.5px; color: var(--text-dim); cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.template-card .t-use-prompt:hover { color: var(--accent); }

.stuck-banner {
  margin: 0 14px 8px;
  padding: 8px 10px;
  font-size: 12px;
  border-radius: 8px;
  background: rgba(232, 176, 75, 0.12);
  border: 1px solid var(--warn);
  color: var(--warn);
}

.composer { padding: 12px 14px; border-top: 1px solid var(--line); }
/* One rounded surface holding the textarea and its controls, so the composer
   reads as a single input rather than a box with a button parked underneath. */
.composer-box {
  background: var(--bg-panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px 10px 8px; transition: border-color .15s;
}
.composer-box:focus-within { border-color: var(--accent); }
.composer textarea {
  width: 100%;
  resize: vertical;
  background: none;
  color: var(--text);
  border: none;
  padding: 2px 4px 0;
  font-size: 13.5px;
  font-family: inherit;
  min-height: 62px;
}
.composer textarea:focus { outline: none; }
.composer-row { display: flex; align-items: center; margin-top: 6px; gap: 8px; }
.estimate { font-size: 12px; color: var(--text-dim); font-family: var(--mono); flex: 1; }
.composer-state { font-size: 12px; color: var(--accent); font-weight: 600; }
.composer-icon {
  width: 30px; height: 30px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 8px; background: none; cursor: pointer;
  color: var(--text-dim); font-size: 14px; line-height: 1;
}
.composer-icon:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.composer-icon.on { color: var(--accent); background: rgba(139,92,246,0.16); }
.btn.send-btn {
  width: 38px; height: 34px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  padding: 0; border-radius: 10px; font-size: 15px;
}
.btn.send-btn:disabled { opacity: 0.5; }
.composer-hint { margin-top: 7px; text-align: center; font-size: 11px; color: var(--text-dim); }
.composer-hint b { color: var(--text-dim); font-weight: 700; }
.estimate.blocked { color: var(--danger); }

/* ---------- buttons ---------- */
.btn {
  border: 1px solid var(--line);
  background: var(--bg-panel);
  color: var(--text);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.btn.primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.ghost { background: transparent; }
.btn.small { padding: 3px 9px; font-size: 11.5px; }

/* ---------- workspace ---------- */
.workspace { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.tabs { display: flex; gap: 2px; padding: 8px 12px 0; border-bottom: 1px solid var(--line); background: var(--bg-raise); }
.tab {
  background: none; border: none; color: var(--text-dim);
  padding: 8px 16px; font-size: 13px; cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.sec-badge {
  display: inline-block; min-width: 16px; padding: 0 4px; margin-left: 4px;
  border-radius: 8px; font-size: 10px; line-height: 16px; text-align: center;
}
.sec-badge.pass { background: var(--ok); color: #06281c; }
.sec-badge.fail { background: var(--danger); color: #fff; }

.panel { flex: 1; display: none; min-height: 0; overflow: auto; }
.panel.active { display: flex; flex-direction: column; }

#panel-preview { background: #fff; }
#previewFrame { flex: 1; width: 100%; border: none; background: #fff; }

.empty { margin: auto; color: var(--text-dim); font-size: 14px; padding: 40px; text-align: center; }
#panel-preview .empty { color: #8a949c; }

.panel-toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--bg-raise); }
.publish-url { font-size: 12px; font-family: var(--mono); color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.publish-url a { color: var(--accent); }
.code {
  flex: 1; overflow: auto; padding: 14px;
  font-family: var(--mono); font-size: 12px; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word;
  background: var(--bg-panel); color: #cfe3d8;
}

/* ---------- versions ---------- */
.versions-split { flex: 1; display: flex; min-height: 0; }
.version-list { list-style: none; width: 260px; overflow-y: auto; border-right: 1px solid var(--line); }
.version-item { padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 12.5px; }
.version-item:hover, .version-item.selected { background: var(--bg-panel); }
.version-item .v-title { font-weight: 600; margin-bottom: 3px; }
.version-item .v-meta { color: var(--text-dim); font-size: 11px; font-family: var(--mono); }
.version-item .v-actions { margin-top: 6px; }
.version-item.current .v-title::after { content: " • current"; color: var(--accent); font-weight: 400; }
.diff-view { flex: 1; overflow: auto; padding: 12px; font-family: var(--mono); font-size: 11.5px; line-height: 1.5; }
.diff-line { white-space: pre-wrap; word-break: break-word; padding: 0 6px; }
.diff-line.add { background: rgba(53, 194, 143, 0.13); color: #9fe8cd; }
.diff-line.del { background: rgba(224, 100, 89, 0.13); color: #f0a9a2; text-decoration: line-through; }
.diff-line.ctx { color: var(--text-dim); }
.diff-gap { color: var(--text-dim); text-align: center; padding: 2px; }
.diff-summary { padding: 6px; margin-bottom: 8px; color: var(--text-dim); font-family: "Segoe UI", system-ui, sans-serif; font-size: 12.5px; }

/* ---------- security ---------- */
#securityReport { flex: 1; padding: 18px; overflow: auto; }
.sec-verdict { font-size: 15px; font-weight: 700; margin-bottom: 14px; }
.sec-verdict.pass { color: var(--ok); }
.sec-verdict.fail { color: var(--danger); }
.sec-item { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; font-size: 13px; }
.sec-item.ok { border-left: 3px solid var(--ok); }
.sec-item.bad { border-left: 3px solid var(--danger); }
.sec-item.warn { border-left: 3px solid var(--warn); }
.sec-item .sec-advice { color: var(--text-dim); font-size: 12px; margin-top: 4px; }

/* ---------- build health ---------- */
#panel-health { flex: 1; display: none; min-height: 0; overflow: auto; }
#panel-health.active { display: flex; flex-direction: column; }
#healthReport { flex: 1; padding: 18px; overflow: auto; }
.health-overall { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.health-overall.good { color: var(--ok); }
.health-overall.warn { color: var(--warn); }
.health-overall.bad { color: var(--danger); }
.health-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; }
.health-row .h-icon { font-size: 16px; line-height: 1.4; }
.health-row .h-body { flex: 1; }
.health-row .h-title { font-weight: 600; font-size: 13.5px; }
.health-row .h-detail { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.health-row .h-action { font-size: 11.5px; margin-top: 6px; }
.health-note { font-size: 11.5px; color: var(--text-dim); margin-top: 14px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 8px; }

/* ---------- launch check ---------- */
#panel-launchcheck { flex: 1; display: none; min-height: 0; overflow: auto; }
#panel-launchcheck.active { display: flex; flex-direction: column; }
.lc-status { font-size: 12px; color: var(--text-dim); }
#launchCheckReport { flex: 1; padding: 18px; overflow: auto; }
.lc-shots { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 16px; }
.lc-shot { flex: 1; min-width: 220px; max-width: 360px; }
.lc-shot .lc-shot-label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.lc-shot img { width: 100%; border-radius: 8px; border: 1px solid var(--line); display: block; }

/* ---------- settings modal ---------- */
dialog {
  margin: auto; border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg-raise); color: var(--text); min-width: 420px; padding: 0;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.settings { padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.settings h2 { font-size: 16px; }
.settings label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.settings input {
  background: var(--bg-panel); border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); padding: 9px 10px; font-size: 13px; font-family: var(--mono);
}
.settings .hint { color: var(--text-dim); font-size: 11.5px; font-weight: 400; }
.settings-actions { display: flex; gap: 10px; justify-content: flex-end; }
.managed-box { background: var(--bg-panel); border: 1px solid var(--accent-dim); border-radius: 10px; padding: 14px; }
.managed-box .btn { font-size: 12.5px; padding: 6px 12px; }

/* ---- Phase 2A: multi-file project file tree ---- */
.code-split { display: flex; gap: 0; height: 100%; min-height: 0; }
.file-tree {
  flex: 0 0 200px; overflow-y: auto; border-right: 1px solid var(--line);
  background: var(--bg); padding: 8px 0;
}
.file-tree .file-item {
  display: block; width: 100%; text-align: left; background: none; border: none;
  color: var(--text-dim); font-family: var(--mono, ui-monospace, monospace); font-size: 12px;
  padding: 5px 12px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.file-tree .file-item:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.file-tree .file-item.active { background: rgba(139,92,246,0.14); color: var(--accent); }
.code-split .code { flex: 1; min-width: 0; overflow: auto; margin: 0; }

/* ---- Phase 2B: visual editor ---- */
.preview-wrap { display: flex; flex: 1; min-height: 0; }
.preview-wrap iframe { flex: 1; min-width: 0; }
.props {
  flex: 0 0 258px; overflow-y: auto; background: var(--bg-raise);
  border-left: 1px solid var(--line); padding: 12px; font-size: 12.5px;
}
.props-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.props-history { display: flex; gap: 4px; }
.btn.mini { padding: 2px 7px; font-size: 12px; line-height: 1.4; }
.props-src { font-family: var(--mono); font-size: 10.5px; color: var(--text-dim); margin-bottom: 12px; word-break: break-all; }
.props-field { display: block; color: var(--text-dim); font-size: 11.5px; margin-bottom: 10px; }
.props-field input[type="text"], .props-field select {
  width: 100%; margin-top: 4px; padding: 6px 8px; border-radius: 7px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text); font-size: 12.5px;
}
.props-field input[type="color"] { width: 100%; height: 30px; margin-top: 4px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); cursor: pointer; }
.props-field input[type="range"] { width: 100%; margin-top: 6px; }
.props-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.props-status { font-size: 11px; color: var(--text-dim); min-height: 15px; margin-top: 6px; }
.props-status.error { color: var(--danger); }
.props-status.ok { color: var(--ok); }
#visualEditBtn.on { border-color: var(--accent); color: var(--accent); }

/* ---- Phase 2C: build status + error reporting ---- */
.build-status {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 100px;
  font-size: 11.5px; font-weight: 700; border: 1px solid var(--line); cursor: default; white-space: nowrap;
}
.build-status.ok { color: var(--ok); border-color: var(--ok-dim); }
.build-status.fail { color: var(--danger); border-color: var(--danger); cursor: pointer; }
.build-status .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.build-errors {
  border-bottom: 1px solid var(--danger); background: rgba(224,100,89,0.08);
  padding: 10px 14px; font-size: 12.5px; max-height: 180px; overflow-y: auto;
}
.build-errors .be-item { display: flex; gap: 8px; align-items: baseline; padding: 3px 0; }
.build-errors .be-file {
  font-family: var(--mono); font-size: 11px; color: var(--accent);
  background: none; border: none; padding: 0; cursor: pointer; text-decoration: underline; flex-shrink: 0;
}
.build-errors .be-msg { color: var(--text); font-family: var(--mono); font-size: 11.5px; word-break: break-word; }
.build-errors .be-phase { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-dim); flex-shrink: 0; }

/* ---- Phase 2D: GitHub sync ---- */
.gh-panel { padding: 18px; max-width: 640px; }
.gh-panel h3 { font-size: 15px; margin-bottom: 8px; }
.gh-panel h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-dim); margin: 18px 0 8px; }
.gh-meta { color: var(--text-dim); font-size: 12px; line-height: 1.6; }
.gh-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.gh-row select {
  flex: 1; min-width: 180px; padding: 7px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text); font-size: 13px;
}
.gh-status { font-size: 12px; color: var(--text-dim); min-height: 16px; margin: 6px 0; }
.gh-status.error { color: var(--danger); }
.gh-status.ok { color: var(--ok); }
.gh-commits { list-style: none; font-size: 12.5px; }
.gh-commits li { padding: 6px 0; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: baseline; }
.gh-commits a { color: var(--accent); font-family: var(--mono); font-size: 11.5px; text-decoration: none; }
.gh-commits .gh-meta { margin-left: auto; flex-shrink: 0; }

/* ---- upgrade CTA (shown only on the Free plan) ---- */
.btn.upgrade {
  background: linear-gradient(135deg, var(--accent), #6d4aec);
  color: #fff; font-weight: 700; border: none; white-space: nowrap;
}
.btn.upgrade:hover { filter: brightness(1.08); }
.btn.upgrade:disabled { filter: none; opacity: .6; cursor: default; }

/* ---------------- Deploy panel (Phase 3A) ---------------- */

.vc-howto {
  background: var(--panel-2, rgba(255, 255, 255, 0.03));
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: 10px;
  padding: 12px 14px;
  margin: 12px 0;
  max-width: 560px;
}
.vc-howto ol { margin: 8px 0 8px 18px; }
.vc-howto li { margin: 4px 0; font-size: 13px; }

/* Token scope and protection are stated in colour as well as words: whether the
   thing you just connected can reach your whole account is worth noticing at a
   glance, not only on a careful read. */
.vc-scope,
.vc-protection {
  border-radius: 8px;
  padding: 10px 12px;
  margin: 10px 0;
  font-size: 13px;
  line-height: 1.5;
  max-width: 560px;
}
.vc-scope.ok,
.vc-protection.open {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
}
.vc-scope.warn,
.vc-protection.locked {
  background: rgba(234, 179, 8, 0.1);
  border: 1px solid rgba(234, 179, 8, 0.35);
}
#vcToken { min-width: 260px; font-family: var(--mono, monospace); }

/* Confirmation for a change that exposes a site to the internet. Styled to be
   read, not clicked past — the confirm button stays disabled until the project
   name is typed. */
.vc-confirm {
  border-radius: 10px;
  padding: 14px 16px;
  margin: 12px 0;
  max-width: 560px;
  font-size: 13px;
  line-height: 1.55;
}
.vc-confirm.danger {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.4);
}
.vc-confirm.safe {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.35);
}
.vc-confirm p { margin: 0 0 8px; }
.vc-confirm label { display: block; margin: 10px 0 6px; }
.vc-confirm input { min-width: 200px; }
.vc-confirm .btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.vc-protection-actions { margin-top: 10px; }

/* Launch Check findings. Colour-coded by severity so the difference between a
   leaked credential and a missing header is visible before reading. */
.vc-findings { list-style: none; margin: 10px 0; padding: 0; }
.vc-finding {
  border-left: 3px solid var(--border, #444);
  padding: 8px 0 8px 10px;
  margin: 8px 0;
}
.vc-finding.critical { border-left-color: #ef4444; }
.vc-finding.high { border-left-color: #f97316; }
.vc-finding.medium { border-left-color: #eab308; }
.vc-finding.info { border-left-color: #3b82f6; }
.vc-snippet {
  font-family: var(--mono, monospace);
  font-size: 12px;
  background: rgba(0, 0, 0, 0.25);
  padding: 6px 8px;
  border-radius: 6px;
  margin: 6px 0;
  overflow-x: auto;
  white-space: pre;
}

/* ---------------- color palette picker ---------------- */
.palette-picker { margin: 4px 0 10px; }
.palette-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: transparent;
  border: 1px solid var(--line, #2a2f36);
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--dim, #8d9aa8);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}
.palette-toggle:hover { border-color: var(--accent, #8b5cf6); }
.palette-toggle-swatch.palette-strip { flex-shrink: 0; }
.palette-chevron { margin-left: auto; opacity: 0.6; }
.palette-panel {
  margin-top: 8px;
  padding: 12px;
  border: 1px solid var(--line, #2a2f36);
  border-radius: 10px;
  background: var(--panel-2, rgba(255, 255, 255, 0.02));
}
.palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  margin: 10px 0;
}
.palette-swatch {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--line, #2a2f36);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  text-align: left;
}
.palette-swatch:hover { border-color: var(--accent, #8b5cf6); }
.palette-swatch-name { font-size: 11.5px; color: var(--dim, #8d9aa8); }
.palette-strip {
  display: flex;
  height: 22px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}
.palette-strip span { flex: 1; }
.palette-toggle .palette-strip { width: 60px; }
.palette-custom { margin: 10px 0; }
.palette-custom summary { cursor: pointer; font-size: 12.5px; color: var(--dim, #8d9aa8); }
.palette-custom-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 10px 0;
}
.palette-custom-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
  color: var(--dim, #8d9aa8);
}
.palette-custom-row input[type="color"] {
  width: 44px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line, #2a2f36);
  border-radius: 6px;
  background: none;
  cursor: pointer;
}

/* ---------------- My Apps ---------------- */
.my-apps-form { max-width: 440px; max-height: 70vh; overflow-y: auto; }
#myAppsList { display: flex; flex-direction: column; gap: 8px; }
.saved-app-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line, #2a2f36);
  border-radius: 10px;
}
.saved-app-name { font-size: 13.5px; font-weight: 600; margin-bottom: 2px; }
.saved-app-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* Per-version security score. Colour carries the same meaning as the tab badges:
   green safe, amber worth a look, red blocking. */
.v-score { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 100px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.2px; }
.v-score.good { background: rgba(53,217,154,0.14); color: var(--ok); }
.v-score.warn { background: rgba(232,176,75,0.15); color: var(--warn); }
.v-score.bad  { background: rgba(224,100,89,0.15); color: var(--danger); }

/* ---------- preview stat bar ----------
   Only metrics that are genuinely measured appear here. Build time and a
   deployment count are deliberately absent until they are actually tracked —
   a placeholder number on a security product is worse than no number. */
.stat-bar { display: flex; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-top: 1px solid var(--line); background: var(--bg-raise); }
.stat { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--bg-panel); border: 1px solid var(--line); border-radius: 12px; min-width: 170px; }
.stat-ico { width: 34px; height: 34px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-radius: 9px; font-size: 13px; }
.stat-ico.code { background: rgba(139,92,246,0.16); color: var(--accent); }
.stat-ico.sec { background: rgba(53,194,143,0.15); color: var(--ok); }
.stat-text { display: flex; flex-direction: column; line-height: 1.25; }
.stat-text b { font-size: 17px; font-weight: 700; }
.stat-text span { font-size: 11.5px; color: var(--text-dim); }
.stat-text b.good { color: var(--ok); }
.stat-text b.warn { color: var(--warn); }
.stat-text b.bad { color: var(--danger); }

/* API-key validation feedback. Three states, because "we couldn't check" is a
   genuinely different answer from "your key is wrong" and must not look the same. */
.key-check { display: flex; align-items: center; gap: 9px; margin-top: 7px; flex-wrap: wrap; }
.key-status { font-size: 12px; line-height: 1.45; flex: 1; min-width: 180px; }
.key-status.ok { color: var(--ok); }
.key-status.bad { color: var(--danger); }
.key-status.unknown { color: var(--warn); }
.key-status.checking { color: var(--text-dim); }
