:root {
  /* ScriptPilot brand palette (from assets-src/2026): orange is the primary
     accent, mint is secondary, on a near-black surface. Legacy --indigo/--teal
     names are kept as aliases so existing rules pick up the brand colors. */
  --surface: #1a1a1a;
  --surface-2: #242424;
  --orange: #ff8a4c;
  --mint: #46e0c0;
  --indigo: var(--orange);
  --teal: var(--mint);
  --bg: var(--surface);
  --panel: var(--surface-2);
  --text: #ececec;
  --muted: #9aa3c7;
  --danger: #f87171;
  --ok: var(--mint);
  --line: #2e2e2e;
}
/* Colored wordmark — orange brackets, muted "Script", mint "Pilot" (the asset). */
.logo .lb { color: var(--orange); }
.logo .ls { color: var(--muted); }
.logo .lp { color: var(--mint); }
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.5 -apple-system, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}
#app { height: 100vh; display: flex; flex-direction: column; }
.logo { font-family: ui-monospace, monospace; font-weight: 700; }
h1 { font-size: 22px; margin: 0 0 8px; }
h2 { font-size: 13px; margin: 0 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.pad { padding: 16px; }

button, .btn {
  background: var(--orange); color: #1a1a1a; border: 0; border-radius: 6px;
  padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  display: inline-block;
}
button.ghost, .ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
button.alt, .btn.alt { background: var(--teal); }
button:disabled { opacity: .5; cursor: default; }

input, textarea {
  width: 100%; background: #0b1222; color: var(--text);
  border: 1px solid var(--line); border-radius: 6px; padding: 8px; font: inherit;
}
textarea { min-height: 90px; resize: vertical; }
.row { display: flex; gap: 8px; margin-top: 8px; }

.banner { border-radius: 6px; padding: 10px 14px; margin: 10px; }
.banner.error { background: rgba(248,113,113,.12); border: 1px solid var(--danger); color: #fecaca; }
.banner.ok { background: rgba(52,211,153,.12); border: 1px solid var(--ok); color: #bbf7d0; }
.banner a { color: inherit; font-weight: 700; }

/* inline busy bar shown under the topbar while an action runs (IDE stays up) */
.busybar {
  padding: 7px 14px; font-size: 13px; color: #1967d2;
  background: #e8f0fe; border-bottom: 1px solid #d2e3fc;
}
.busybar::before {
  content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px;
  border: 2px solid #1967d2; border-right-color: transparent; border-radius: 50%;
  vertical-align: -1px; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* centered (login / key) */
.center { flex: 1; display: grid; place-items: center; padding: 24px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 20px; max-width: 460px; width: 100%; }
.card.hero { text-align: center; }
.card.hero .logo { font-size: 18px; margin-bottom: 10px; }
.card .btn { margin-top: 12px; }

/* Privacy / Terms footer on the centered (login / key) screens. */
.legal { margin-top: 16px; text-align: center; font-size: 13px; }
.legal a { color: var(--muted); text-decoration: none; }
.legal a:hover { color: var(--text); text-decoration: underline; }
.legal-sep { margin: 0 8px; color: var(--muted); opacity: .6; }

/* ============================================================
   Landing page (logged-out marketing view)
   Dark surface, orange/mint accents — matches the 2026 brand.
   ============================================================ */
.landing {
  flex: 1; min-height: 0; overflow-y: auto;
  background:
    radial-gradient(900px 500px at 78% -8%, rgba(70,224,192,.12), transparent 60%),
    radial-gradient(820px 460px at 12% 4%, rgba(255,138,76,.10), transparent 60%),
    var(--surface);
  scroll-behavior: smooth;
}
.landing section { width: 100%; }
.lp-nav, .lp-hero, .lp-section, .lp-providers, .lp-final, .lp-footer {
  max-width: 1080px; margin: 0 auto; padding-left: 24px; padding-right: 24px;
}
.brand-mark { display: block; border-radius: 8px; }

/* nav */
.lp-nav {
  display: flex; align-items: center; gap: 20px;
  padding-top: 18px; padding-bottom: 18px;
}
.lp-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.lp-brand .logo { font-size: 17px; }
.lp-links { display: flex; gap: 22px; margin-left: 18px; }
.lp-links a { color: var(--muted); text-decoration: none; font-size: 14px; }
.lp-links a:hover { color: var(--text); }
.lp-nav-cta { margin-left: auto; padding: 8px 16px; }

/* hero */
.lp-hero {
  display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; align-items: center;
  padding-top: 56px; padding-bottom: 56px;
}
.lp-eyebrow {
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--mint);
  border: 1px solid rgba(70,224,192,.35); border-radius: 999px; padding: 5px 12px;
  background: rgba(70,224,192,.08); margin-bottom: 18px;
}
.lp-h1 { font-size: 44px; line-height: 1.1; letter-spacing: -.02em; margin: 0 0 16px; }
.lp-lead { font-size: 17px; line-height: 1.6; color: var(--muted); margin: 0 0 26px; max-width: 36em; }
.lp-cta-row { display: flex; flex-wrap: wrap; gap: 12px; }
.lp-btn-lg { padding: 12px 22px; font-size: 15px; border-radius: 8px; }
.lp-cta-note { margin-top: 14px; font-size: 13px; }
.lp-hero-visual img {
  width: 100%; height: auto; display: block; border-radius: 16px;
  border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(0,0,0,.45);
}

/* providers strip */
.lp-providers { text-align: center; padding-top: 12px; padding-bottom: 28px; }
.lp-providers-label { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 14px; }
.lp-provider-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 28px; }
.lp-provider {
  font-family: ui-monospace, monospace; font-weight: 600; font-size: 15px;
  color: var(--text); opacity: .8;
}

/* section scaffolding */
.lp-section { padding-top: 64px; padding-bottom: 8px; text-align: center; }
.lp-h2 { font-size: 30px; line-height: 1.15; letter-spacing: -.01em; margin: 0 0 12px; text-transform: none; color: var(--text); }
.lp-section-lead { font-size: 16px; max-width: 44em; margin: 0 auto 36px; }

/* feature grid */
.lp-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; text-align: left;
}
.lp-card {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px; transition: border-color .15s ease, transform .15s ease;
}
.lp-card:hover { transform: translateY(-3px); }

/* Respect the OS-level reduced-motion preference (the a11y widget's "Pause
   animations" toggle covers the manual case). */
@media (prefers-reduced-motion: reduce) {
  .busybar::before { animation: none; }
  .lp-card { transition: none; }
  .lp-card:hover { transform: none; }
}
.lp-card-orange:hover { border-color: rgba(255,138,76,.5); }
.lp-card-mint:hover { border-color: rgba(70,224,192,.5); }
.lp-card-dot { width: 26px; height: 26px; border-radius: 8px; margin-bottom: 14px; }
.lp-card-orange .lp-card-dot { background: rgba(255,138,76,.18); border: 1px solid var(--orange); }
.lp-card-mint .lp-card-dot { background: rgba(70,224,192,.18); border: 1px solid var(--mint); }
.lp-card-title { font-size: 16px; margin: 0 0 8px; color: var(--text); }
.lp-card-body { font-size: 14px; line-height: 1.6; margin: 0; }

/* how it works */
.lp-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; text-align: left; }
.lp-step { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 24px; }
.lp-step-n {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  font-family: ui-monospace, monospace; font-weight: 700; font-size: 16px;
  color: #1a1a1a; background: var(--orange); margin-bottom: 14px;
}
.lp-step-title { font-size: 16px; margin: 0 0 8px; color: var(--text); }
.lp-step-body { font-size: 14px; line-height: 1.6; margin: 0; }

/* pricing */
.lp-plans { display: grid; grid-template-columns: repeat(2, minmax(0, 320px)); gap: 18px; justify-content: center; text-align: left; }
.lp-plan {
  position: relative; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 16px; padding: 26px; display: flex; flex-direction: column; gap: 14px;
}
.lp-plan-featured { border-color: var(--orange); box-shadow: 0 0 0 1px var(--orange); }
.lp-plan-badge {
  position: absolute; top: -11px; left: 26px; font-size: 11px; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase; color: #1a1a1a;
  background: var(--orange); padding: 3px 10px; border-radius: 999px;
}
.lp-plan-name { font-size: 18px; margin: 0; color: var(--text); }
.lp-plan-price { display: flex; align-items: baseline; gap: 4px; }
.lp-plan-amount { font-size: 30px; font-weight: 700; }
.lp-plan-cadence { font-size: 14px; }
.lp-plan-perks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.lp-plan-perks li { position: relative; padding-left: 24px; font-size: 14px; color: var(--muted); }
.lp-plan-perks li::before { content: "✓"; position: absolute; left: 0; color: var(--mint); font-weight: 700; }
.lp-plan-cta { margin-top: 6px; text-align: center; padding: 10px 16px; }

/* final CTA */
.lp-final { text-align: center; padding-top: 72px; padding-bottom: 72px; }
.lp-final .brand-mark { margin: 0 auto 18px; }

/* footer */
.lp-footer {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  border-top: 1px solid var(--line); margin-top: 24px;
  padding-top: 26px; padding-bottom: 40px;
}
.lp-footer-brand { display: inline-flex; align-items: center; gap: 9px; }
.lp-footer-brand .logo { font-size: 14px; }
.lp-footer-links { display: flex; gap: 18px; margin-left: auto; }
.lp-footer-links a { color: var(--muted); text-decoration: none; font-size: 13px; }
.lp-footer-links a:hover { color: var(--text); }
.lp-footer-copy { width: 100%; margin: 0; font-size: 12px; }

/* responsive */
@media (max-width: 860px) {
  .lp-hero { grid-template-columns: 1fr; gap: 32px; padding-top: 36px; }
  .lp-hero-visual { order: -1; }
  .lp-h1 { font-size: 34px; }
  .lp-links { display: none; }
  .lp-grid, .lp-steps { grid-template-columns: 1fr; }
  .lp-plans { grid-template-columns: minmax(0, 360px); }
}

/* topbar (branded, slim) */
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.topbar .spacer { flex: 1; }
.topbar small { color: rgba(255,255,255,.9); }
.topbar .proj { color: rgba(255,255,255,.95); font-family: ui-monospace, monospace; font-size: 12px; }
.ghost.sm { padding: 4px 8px; font-size: 12px; }

/* open screen (no project yet) — the "open a project" card, centered */
.open-screen { flex: 1; min-height: 0; display: flex; justify-content: center; align-items: flex-start; padding: 24px; overflow: auto; }
.card.dash { max-width: 560px; width: 100%; }
.card.dash h1 { font-size: 24px; }

/* prominent open-by-link field */
.openbar { display: flex; align-items: center; gap: 8px; margin: 14px 0 4px;
  background: #0b1222; border: 1px solid var(--line); border-radius: 10px; padding: 4px 10px; }
/* Focus shows on the whole bar (the visual control), so the bare input itself
   drops its own outline without losing a visible keyboard indicator. */
.openbar:focus-within { border-color: var(--orange); box-shadow: 0 0 0 2px rgba(255, 138, 76, .5); }
.open-icon { font-size: 15px; opacity: .8; flex: 0 0 auto; }
.open-input { flex: 1; background: transparent; border: 0; padding: 9px 4px; color: var(--text); }
.open-input:focus { outline: none; }
.open-kbd { flex: 0 0 auto; font: 11px ui-monospace, monospace; color: var(--muted);
  border: 1px solid var(--line); border-radius: 5px; padding: 3px 7px; background: #0f172a; }

/* workspace: Files sidebar | editor | chat — light, like the Apps Script IDE */
.workspace {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: 220px 1fr 360px;
  background: #fff; color: #202124;
}

/* Files sidebar */
.sidebar { background: #f8f9fa; border-right: 1px solid #e0e0e0; min-height: 0; overflow: auto; }
.files-head {
  padding: 12px 16px; font-size: 12px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: #5f6368; border-bottom: 1px solid #e8eaed;
}
.filelist { display: flex; flex-direction: column; padding: 6px; gap: 2px; }
.file {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  background: transparent; border: 0; border-radius: 6px; padding: 7px 10px;
  color: #3c4043; font-weight: 500; cursor: pointer; font-size: 13px;
}
.file:hover { background: #eceff1; }
.file.active { background: #e8f0fe; color: #1967d2; }
.file .fdot { width: 7px; height: 7px; border-radius: 2px; background: #9aa0a6; flex: 0 0 auto; }
.file.active .fdot { background: #1a73e8; }
/* changeset status tag on a file row */
.file .tag {
  margin-left: auto; flex: 0 0 auto; font: 700 10px/1 ui-monospace, monospace;
  width: 16px; height: 16px; border-radius: 4px; display: grid; place-items: center; color: #fff;
}
.tag-modified { background: #1a73e8; }
.tag-added { background: #188038; }
.tag-deleted { background: #d93025; }
.tag-renamed { background: #b06000; }

/* CodeMirror merge (diff) view fills the editor pane */
.editor .cm-mergeView, .editor .cm-merge-revert { height: 100%; }
.editor .cm-mergeViewEditors { height: 100%; }

/* editor (white) */
.editor { min-height: 0; overflow: hidden; background: #fff; }
.editor .cm-editor { height: 100%; }
.editor .pad { color: #5f6368; }

/* chat — a VS Code-style chat window: fixed header, scrolling thread, pinned composer */
.chat {
  display: flex; flex-direction: column; min-height: 0;
  background: #fbfbfd; border-left: 1px solid #e0e0e0; color: #202124;
}
.chat-head {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-bottom: 1px solid #e8eaed;
}
.chat-head h2 { margin: 0; color: #5f6368; }
.chat-head .spacer { flex: 1; }
.thread-switcher { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.thread-select {
  border: 1px solid #dadce0; border-radius: 8px; background: #fff; color: #3c4043;
  padding: 4px 8px; font-size: 12px; max-width: 160px; cursor: pointer;
}
.thread-select:disabled { opacity: .6; cursor: default; }
.chat .hint { font-size: 12px; color: #5f6368; }
.spinner { color: var(--muted); }
small { color: var(--muted); }

/* scrolling message thread */
.chat-thread {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px; padding: 14px;
}
.chat-empty { margin: auto 0; color: #5f6368; text-align: center; }
.chat-empty p { margin: 0 0 6px; }

.msg { display: flex; flex-direction: column; max-width: 100%; }
.msg.user { align-items: flex-end; }
.msg.assistant { align-items: flex-start; }
.bubble {
  white-space: pre-wrap; word-break: break-word; border-radius: 12px;
  padding: 9px 12px; font-size: 13px; line-height: 1.5; max-width: 92%;
}
.msg.user .bubble { background: #1a1a1a; color: #fff; border-bottom-right-radius: 4px; }
.msg.assistant .bubble { background: #fff; color: #202124; border: 1px solid #e0e0e0; border-bottom-left-radius: 4px; }
.bubble.typing { color: #9aa0a6; letter-spacing: 2px; }

/* inline review actions under an assistant turn */
.review {
  align-self: stretch; margin-top: 8px; padding: 10px 12px;
  border: 1px solid #d2e3fc; background: #f6f9ff; border-radius: 10px;
}
.review-meta { margin: 0 0 8px; font-size: 12px; color: #3c4043; }
.review .hint.ok { color: #188038; font-weight: 600; }
.review .row { margin: 0; gap: 8px; }
.btn.sm { padding: 5px 10px; font-size: 12px; }

/* pinned composer */
.composer { flex: 0 0 auto; padding: 10px 14px 12px; border-top: 1px solid #e8eaed; background: #fff; }
.composer-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.composer-bar .spacer { flex: 1; }
.model-select {
  border: 1px solid #dadce0; border-radius: 8px; background: #fff; color: #3c4043;
  padding: 4px 8px; font-size: 12px; font-weight: 600; cursor: pointer; max-width: 60%;
}
.model-select:disabled { opacity: .6; cursor: default; }
.composer-modes { display: inline-flex; gap: 2px; background: #f1f3f4; border-radius: 8px; padding: 2px; }
.composer-modes .mode {
  background: transparent; color: #5f6368; border: 0; border-radius: 6px;
  padding: 4px 14px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.composer-modes .mode.active { background: #fff; color: #1967d2; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.composer-input {
  background: #fff; color: #202124; border: 1px solid #dadce0; border-radius: 10px;
  padding: 9px 11px; min-height: 44px; max-height: 160px;
}
/* Keep the blue border on focus; the global :focus-visible ring (a11y.css) still
   draws for keyboard users since we no longer suppress the outline. */
.composer-input:focus { border-color: #1a73e8; }
.composer .hint { margin: 6px 2px 0; }

/* history panel (inside the thread) */
.history { border: 1px solid #e8eaed; border-radius: 10px; padding: 10px 12px; background: #fff; }
.history h2 { color: #5f6368; margin: 0 0 8px; }
.cs-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid #f1f3f4; }
.cs-meta { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.cs-id { font: 12px ui-monospace, monospace; color: #5f6368; }
.cs-status {
  font: 700 10px/1 -apple-system, system-ui, sans-serif; text-transform: uppercase; letter-spacing: .03em;
  padding: 3px 6px; border-radius: 4px; background: #e8eaed; color: #3c4043; white-space: nowrap;
}
.cs-applied { background: #e6f4ea; color: #188038; }
.cs-rolled_back { background: #fce8e6; color: #c5221f; }
.cs-proposed, .cs-approved { background: #e8f0fe; color: #1967d2; }
.cs-rejected, .cs-stale, .cs-rollback_failed { background: #fef7e0; color: #b06000; }
