/* The original goku.host look: deep blue-black, a soft blue accent, and a
   monospaced face for names, addresses, labels and anything typed. */
:root {
  --bg: #0c0f14;
  --panel: #12161d;
  --hover: #171c25;
  --fg: #dbe2ec;
  --muted: #8a94a3;
  --faint: #5c6572;
  --line: #232a35;
  --line-strong: #34404f;
  --accent: #7c9eff;
  --accent-soft: rgba(124, 158, 255, 0.12);
  --accent-fg: #0c0f14;
  --teal: #4dd4c4;
  --green: #4ade80; --green-soft: rgba(74, 222, 128, 0.12);
  --amber: #fbbf24; --amber-soft: rgba(251, 191, 36, 0.12);
  --blue: #7c9eff; --blue-soft: rgba(124, 158, 255, 0.12);
  --red: #f87171; --red-soft: rgba(248, 113, 113, 0.12);
  --radius: 12px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-family: var(--sans);
  font-size: 14.5px;
  color: var(--fg);
  background: var(--bg);
  color-scheme: dark;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { line-height: 1.5; min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; letter-spacing: -0.02em; margin: 0 0 6px; line-height: 1.2; }
h2 { font-size: 20px; margin: 0 0 8px; }
h3 { font-size: 16px; margin: 0 0 6px; }
code, .mono { font-family: var(--mono); font-size: 0.88em; }
h1, h2, .brand, .card-top h3, .table-head h3, .detail-head h3, .page-head h1, .project-title h1 { font-family: var(--mono); letter-spacing: -0.01em; }
::selection { background: rgba(124, 158, 255, 0.3); }
.muted { color: var(--muted); }
.error { color: var(--red); }
.warn { background: var(--amber-soft); color: var(--amber); padding: 10px 14px; border-radius: 8px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.loading { color: var(--muted); padding: 24px 0; }
.icon { display: inline-flex; vertical-align: -3px; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 15px; border-radius: 9px; border: 1px solid var(--line-strong);
  background: transparent; color: var(--muted); font: inherit; font-weight: 650;
  cursor: pointer; text-decoration: none !important; white-space: nowrap;
  transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { background: var(--hover); border-color: var(--line-strong); color: var(--fg); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.primary:hover { background: var(--accent); filter: brightness(1.1); color: var(--accent-fg); }
.btn.ghost { background: transparent; }
.btn.danger { background: none; border-color: rgba(248, 113, 113, 0.4); color: var(--red); }
.btn.danger:hover { background: var(--red-soft); color: var(--red); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 7px; }
.btn.lg { padding: 11px 20px; font-size: 16px; border-radius: 10px; }
.btn.provider { width: 100%; padding: 11px; font-weight: 500; }
button.link { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }
button.link.sm { font-size: 13px; }
input[type=text], textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 9px;
  font: inherit; font-family: var(--mono); font-size: 13.5px; background: var(--panel); color: var(--fg); resize: vertical;
}
input[type=text]:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: var(--faint); }
input[type=checkbox] { accent-color: var(--accent); }
label { display: block; font-family: var(--mono); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); margin: 22px 0 7px; }
.chip { border: 1px solid var(--line); background: var(--panel); color: var(--muted); border-radius: 999px; padding: 4px 11px; font: inherit; font-size: 13px; cursor: pointer; margin: 4px 6px 0 0; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.pill { display: inline-block; font-family: var(--mono); font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px; vertical-align: 3px; letter-spacing: 0; }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.blue { background: var(--blue-soft); color: var(--blue); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.grey { background: var(--hover); color: var(--muted); }

/* ---------- chrome ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 24px; background: rgba(12, 15, 20, 0.85); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; color: var(--fg); font-size: 15px; letter-spacing: 0.02em; }
.brand img { width: 26px; height: 26px; }
.brand:hover { text-decoration: none; }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.navlink { color: var(--muted); font-weight: 500; }
.navlink:hover { color: var(--fg); text-decoration: none; }
.avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; display: inline-grid; place-items: center; }
.avatar.blank { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; }
.menu summary::-webkit-details-marker { display: none; }
.menu-body { position: absolute; right: 0; top: 40px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 12px 14px; min-width: 220px; }
.menu-who { display: flex; flex-direction: column; margin-bottom: 10px; }
.menu-who small { color: var(--muted); }
main { max-width: 1080px; margin: 0 auto; padding: 32px 24px 64px; }
main.narrow { max-width: 720px; }
main.wide { max-width: 1320px; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.back { display: inline-block; color: var(--muted); margin-bottom: 14px; font-size: 14px; }
.empty { text-align: center; padding: 48px 20px; }
.empty.big { background: var(--panel); border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 64px 24px; }
.empty.big p { max-width: 460px; margin: 8px auto 24px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); opacity: 0; background: var(--panel); color: var(--fg); border: 1px solid var(--line-strong); padding: 10px 18px; border-radius: 10px; transition: all .25s; z-index: 100; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-color: rgba(248, 113, 113, 0.5); color: var(--red); }
.toast.good { border-color: rgba(74, 222, 128, 0.45); color: var(--green); }

/* ---------- landing ---------- */
.lp { max-width: 1120px; margin: 0 auto; padding: 0 24px 40px; }
.lp::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(124, 158, 255, 0.16), transparent 70%),
              radial-gradient(ellipse 40% 30% at 90% 30%, rgba(77, 212, 196, 0.06), transparent 70%); }
.lp-nav { display: flex; align-items: center; justify-content: space-between; padding: 20px 0; }
.lp-nav .brand { display: inline-flex; align-items: center; gap: 9px; color: var(--fg); font-weight: 700; font-size: 16px; }
.lp-nav .brand img { width: 24px; height: 24px; }
.lp-nav nav { display: flex; align-items: center; gap: 22px; font-size: 14px; }
.lp-nav nav a:not(.btn) { color: var(--muted); }
.lp-nav nav a:not(.btn):hover { color: var(--fg); text-decoration: none; }
.lp-hero { display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: center; padding: 56px 0 40px; }
.lp-eyebrow { font-family: var(--mono); font-size: 12.5px; color: var(--teal); text-transform: uppercase; letter-spacing: 0.12em; margin: 0 0 14px; }
.lp-hero h1 { font-size: 54px; line-height: 1.05; letter-spacing: -0.035em; margin: 0 0 20px; }
.lp-accent { color: var(--accent); }
.lp-lead { font-size: 17px; color: var(--muted); line-height: 1.6; margin: 0 0 26px; max-width: 34em; }
.lp-cta { display: grid; gap: 10px; max-width: 320px; }
.lp-small { font-size: 13px; color: var(--faint); margin-top: 14px; max-width: 34em; }
.lp-terminal { background: #0a0d12; border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: 0 30px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(124, 158, 255, 0.05); overflow: hidden; }
.lp-term-bar { display: flex; align-items: center; gap: 7px; padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--panel); }
.lp-term-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); }
.lp-term-bar span { margin-left: 8px; font-family: var(--mono); font-size: 12px; color: var(--faint); }
.lp-terminal pre { margin: 0; padding: 20px 20px 22px; font-family: var(--mono); font-size: 13px; line-height: 1.7; color: var(--fg); white-space: pre-wrap; }
.lp-terminal .u { color: var(--accent); }
.lp-terminal .c { color: var(--teal); }
.lp-terminal .ok { color: var(--green); }
.lp-terminal .d { color: var(--faint); }
.lp-terminal .l { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.lp-strip { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; padding: 18px 0 8px; }
.lp-strip span { font-family: var(--mono); font-size: 12.5px; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 999px; padding: 6px 14px; background: rgba(18, 22, 29, 0.6); }
.lp-section { padding: 72px 0 8px; scroll-margin-top: 20px; }
.lp-section h2, .lp-end h2 { font-size: 32px; letter-spacing: -0.025em; margin: 0 0 10px; }
.lp-sub { color: var(--muted); font-size: 16px; max-width: 46em; margin: 0 0 30px; }
.lp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.lp-feature { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 22px 18px; transition: border-color 0.15s; }
.lp-feature:hover { border-color: var(--line-strong); }
.lp-tag { font-family: var(--mono); font-size: 11.5px; color: var(--teal); text-transform: uppercase; letter-spacing: 0.08em; }
.lp-feature h3 { font-family: var(--sans); font-size: 17px; margin: 10px 0 8px; letter-spacing: -0.01em; }
.lp-feature p { color: var(--muted); margin: 0; font-size: 14.5px; line-height: 1.6; }
.lp-steps { list-style: none; counter-reset: step; padding: 0; margin: 24px 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.lp-steps li { counter-increment: step; color: var(--muted); font-size: 14.5px; line-height: 1.6; border-top: 2px solid var(--line-strong); padding-top: 16px; }
.lp-steps li::before { content: "0" counter(step); display: block; font-family: var(--mono); color: var(--accent); font-size: 13px; margin-bottom: 8px; }
.lp-steps strong { color: var(--fg); }
.lp-claude { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; }
.lp-claude p { color: var(--muted); font-size: 15.5px; }
.lp-list { padding-left: 0; list-style: none; margin: 14px 0; }
.lp-list li { padding: 5px 0 5px 24px; position: relative; color: var(--fg); }
.lp-list li::before { content: "→"; position: absolute; left: 0; color: var(--teal); font-family: var(--mono); }
.lp-connect { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: grid; gap: 8px; }
.lp-connect small { color: var(--faint); font-size: 12.5px; margin-top: 6px; }
.lp-connect code { display: block; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 12.5px; color: var(--accent); overflow-wrap: anywhere; }
.lp-promises { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 28px; }
.lp-promise { display: flex; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.lp-promise strong { display: block; margin-bottom: 4px; }
.lp-promise p { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.55; }
.lp-mark { flex: none; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: 13px; font-weight: 700; }
.lp-mark.yes { background: var(--green-soft); color: var(--green); }
.lp-mark.no { background: var(--hover); color: var(--faint); }
.lp-box { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-top: 22px; }
.lp-box div { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 13px 15px; }
.lp-box strong { display: block; font-family: var(--mono); font-size: 13.5px; }
.lp-box small { color: var(--muted); font-size: 12.5px; }
.lp-box .soon { background: transparent; border-style: dashed; }
.lp-box .soon strong { color: var(--muted); }
.lp-box .soon small { color: var(--teal); font-family: var(--mono); text-transform: uppercase; font-size: 11px; letter-spacing: 0.08em; }
.lp-end { text-align: center; padding: 96px 0 40px; display: grid; justify-items: center; }
.lp-end p { color: var(--muted); font-size: 17px; margin: 0 0 24px; }
.lp-end .lp-cta { width: 100%; }
.lp-foot { display: flex; gap: 22px; justify-content: center; padding: 30px 0 10px; border-top: 1px solid var(--line); font-size: 13px; color: var(--faint); margin-top: 40px; }
.lp-foot span { font-family: var(--mono); }
@media (max-width: 900px) {
  .lp-hero, .lp-claude { grid-template-columns: 1fr; gap: 32px; }
  .lp-hero { padding-top: 28px; }
  .lp-hero h1 { font-size: 40px; }
  .lp-grid { grid-template-columns: 1fr 1fr; }
  .lp-steps { grid-template-columns: 1fr 1fr; }
  .lp-promises { grid-template-columns: 1fr; }
  .lp-nav nav a:not(.btn) { display: none; }
}
@media (max-width: 600px) {
  .lp-grid, .lp-steps { grid-template-columns: 1fr; }
  .lp-hero h1 { font-size: 34px; }
  .lp-section h2, .lp-end h2 { font-size: 26px; }
  .lp-terminal pre { font-size: 11px; padding: 16px 14px; }
  .lp-box { grid-template-columns: 1fr 1fr; }
  .lp-strip span { font-size: 11.5px; padding: 5px 11px; }
  .lp-cta { max-width: none; }
}

/* ---------- project list ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.project-card { color: var(--fg); display: flex; flex-direction: column; gap: 8px; transition: border-color .12s, box-shadow .12s; min-height: 164px; }
.project-card:hover { text-decoration: none; border-color: var(--line-strong); background: var(--hover); }
.card-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.card-top h3 { margin: 0; font-size: 17px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 0; font-size: 14px; flex: 1; }
.card-foot { display: flex; justify-content: space-between; font-size: 13px; }
.url { font-family: var(--mono); font-size: 12.5px; color: var(--teal); }
.new-card { display: flex; flex-direction: column; align-items: center; justify-content: center; border-style: dashed; color: var(--muted); font-weight: 600; min-height: 164px; }
.new-card:hover { text-decoration: none; color: var(--accent); border-color: var(--accent); }
.plus { font-size: 30px; line-height: 1; }

/* ---------- new project ---------- */
.new-form { margin-top: 8px; }
.slug-row { margin-top: 8px; font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.slug-wrap { font-family: var(--mono); font-size: 13px; background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: 2px 8px; color: var(--muted); }
.slug-input { width: auto !important; min-width: 60px; field-sizing: content; padding: 2px 4px !important; border: 0 !important; font: inherit !important; color: var(--fg) !important; background: transparent !important; }
.slug-note { font-size: 13px; }
.slug-note.ok { color: var(--green); }
.slug-note.bad { color: var(--red); }
.examples { margin-top: 8px; font-size: 13px; }
.form-foot { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 24px; }
.form-foot p { margin: 0; font-size: 13px; max-width: 380px; }

/* ---------- project page ---------- */
.project-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.project-title h1 { margin-bottom: 2px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 20px 0 24px; }
.tabs a { padding: 9px 14px; color: var(--muted); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { text-decoration: none; color: var(--fg); }
.tabs a.active { color: var(--fg); border-bottom-color: var(--accent); }

.plan-layout { display: grid; grid-template-columns: minmax(320px, 5fr) 7fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .plan-layout { grid-template-columns: 1fr; } }
.chat-pane { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; height: calc(100vh - 250px); min-height: 460px; position: sticky; top: 76px; }
.pane-title { padding: 12px 16px; border-bottom: 1px solid var(--line); font-family: var(--mono); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); }
.thread { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 92%; font-size: 14.5px; }
.msg .md > :first-child { margin-top: 0; }
.msg .md > :last-child { margin-bottom: 0; }
.msg.user { align-self: flex-end; background: var(--accent-soft); border: 1px solid rgba(124, 158, 255, 0.25); color: var(--fg); padding: 9px 14px; border-radius: 14px 14px 4px 14px; }
.msg.user a { color: var(--accent); text-decoration: underline; }
.msg.assistant { align-self: flex-start; background: var(--hover); padding: 10px 14px; border-radius: 14px 14px 14px 4px; }
.msg.error { align-self: stretch; background: var(--red-soft); border: 1px solid rgba(248, 113, 113, 0.3); color: #fca5a5; padding: 9px 14px; border-radius: 10px; font-size: 14px; }
.who { display: flex; gap: 5px; align-items: center; font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--accent); margin-bottom: 3px; text-transform: uppercase; letter-spacing: .04em; }
.typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); align-items: flex-end; }
.composer textarea { resize: none; font-size: 14.5px; }

.spec-pane { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-height: 460px; }
.spec-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
.spec-doc { padding: 8px 32px 24px; }
.spec-readonly { max-width: 820px; }
.spec-readonly .spec-doc { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.spec-foot { border-top: 1px solid var(--line); padding: 18px 24px; display: flex; justify-content: space-between; align-items: center; gap: 16px; background: var(--hover); border-radius: 0 0 var(--radius) var(--radius); }
.spec-foot p { margin: 0; font-size: 13px; }
.spec-edit { border: 0 !important; border-radius: 0 0 var(--radius) var(--radius) !important; min-height: 600px; font-family: var(--mono) !important; font-size: 13px !important; padding: 20px 24px !important; outline: none !important; }
.spec-empty, .build-progress { text-align: center; padding: 72px 32px; }
.spec-empty p, .build-progress p { max-width: 400px; margin: 8px auto; }
.build-log { margin: 24px auto 0; max-width: 440px; text-align: left; }
.activity { color: var(--muted); font-size: 13px; padding: 3px 0 3px 18px; position: relative; }
.activity::before { content: ""; position: absolute; left: 4px; top: 11px; width: 5px; height: 5px; border-radius: 50%; background: var(--faint); }
.activity:last-child { color: var(--fg); }
.activity:last-child::before { background: var(--accent); }
.spinner-lg { width: 38px; height: 38px; border: 3px solid var(--accent-soft); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 18px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* rendered markdown */
.md h1 { font-size: 24px; margin: 20px 0 6px; }
.md h2 { font-family: var(--mono); font-size: 15px; color: var(--accent); margin: 26px 0 8px; padding-bottom: 5px; border-bottom: 1px solid var(--line); }
.md h3 { font-family: var(--mono); font-size: 14px; color: var(--teal); margin: 18px 0 6px; }
.md p { margin: 8px 0; }
.md ul, .md ol { padding-left: 22px; margin: 6px 0; }
.md li { margin: 3px 0; }
.md strong { color: #eef2f8; }
.md code { background: var(--hover); color: var(--teal); padding: 1px 5px; border-radius: 4px; }
.md pre { background: var(--bg); border: 1px solid var(--line); padding: 12px; border-radius: 8px; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md blockquote { border-left: 3px solid var(--line-strong); margin: 8px 0; padding-left: 12px; color: var(--muted); }
.md table { border-collapse: collapse; margin: 10px 0; font-size: 14px; }
.md th, .md td { border: 1px solid var(--line); padding: 5px 9px; text-align: left; }

/* ---------- data / schema ---------- */
.intro { max-width: 640px; margin-top: 0; }
.schema-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin: 20px 0; }
.table-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; scroll-margin-top: 90px; }
.table-card:target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.table-head { display: flex; justify-content: space-between; align-items: baseline; }
.table-head h3 { margin: 0; }
.columns { list-style: none; padding: 0; margin: 12px 0 0; border-top: 1px solid var(--line); }
.columns li { display: flex; gap: 8px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.col-name { flex: 1; font-family: var(--mono); font-size: 13px; }
.col-kind { color: var(--muted); font-size: 13px; }
.ref { font-size: 13px; font-weight: 600; }
.req { font-size: 11px; color: var(--amber); background: var(--amber-soft); padding: 0 6px; border-radius: 4px; }
.internal summary { cursor: pointer; margin-top: 24px; }
.table-detail:not(:empty) { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.detail-head { display: flex; gap: 12px; align-items: baseline; margin-bottom: 12px; }
.detail-head h3 { margin: 0; }
.detail-head button { margin-left: auto; }
.table-scroll { overflow-x: auto; }
table.data { border-collapse: collapse; font-family: var(--mono); font-size: 12.5px; width: 100%; }
table.data th { text-align: left; background: var(--hover); font-weight: 600; color: var(--muted); }
table.data th, table.data td { border-bottom: 1px solid var(--line); padding: 6px 10px; white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }

/* ---------- settings ---------- */
.settings { max-width: 720px; display: flex; flex-direction: column; gap: 16px; }
.setting { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.setting h3 { display: flex; align-items: center; gap: 4px; }
.setting p { margin: 4px 0 14px; }
.setting.danger { border-color: rgba(248, 113, 113, 0.35); }
.setting.danger input { max-width: 260px; }
.logs { background: var(--bg); border: 1px solid var(--line); color: var(--muted); font-family: var(--mono); padding: 12px; border-radius: 8px; font-size: 12px; max-height: 360px; overflow: auto; white-space: pre-wrap; margin: 12px 0 0; }
.logs:empty { display: none; }

/* ---------- changes ---------- */
.changes { display: flex; flex-direction: column; gap: 8px; max-width: 980px; }
.change { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.change.unsaved { border-color: rgba(251, 191, 36, 0.4); }
.change.open { border-color: var(--line-strong); }
.change-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 11px 14px; cursor: pointer; }
.change-head:hover { background: var(--hover); }
.change-main { min-width: 0; }
.change-title { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.change-title strong { font-weight: 600; }
.change-meta { font-size: 12.5px; margin-top: 3px; }
.change-meta code { color: var(--faint); }
.diff-add { color: var(--green); font-family: var(--mono); }
.diff-del { color: var(--red); font-family: var(--mono); }
.pill.teal { background: rgba(77, 212, 196, 0.12); color: var(--teal); }
.diff-wrap { border-top: 1px solid var(--line); }
pre.diff { margin: 0; padding: 10px 0; font-family: var(--mono); font-size: 12px; line-height: 1.5; overflow-x: auto; max-height: 560px; overflow-y: auto; background: var(--bg); }
pre.diff span { display: block; padding: 0 14px; white-space: pre; min-height: 1.5em; }
pre.diff .add { background: rgba(74, 222, 128, 0.09); color: #a7f3c4; }
pre.diff .del { background: rgba(248, 113, 113, 0.09); color: #fca5a5; }
pre.diff .hunk { color: var(--accent); }
pre.diff .file { color: var(--fg); font-weight: 700; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 6px; }
pre.diff .meta { color: var(--faint); }

.change-note { font-size: 12.5px; margin-top: 3px; font-style: italic; }
.change { cursor: pointer; transition: border-color .12s; }
.change:hover { border-color: var(--line-strong); }
.change:hover .change-head { background: var(--hover); }
.change-open { font-size: 18px; padding-left: 8px; }
.change:hover .change-open { color: var(--fg); }
.plan-behind { color: var(--amber); font-style: normal; }
.change-plan { border-top: 1px solid var(--line); padding: 4px 14px 10px; position: relative; max-height: 260px; overflow: hidden; }
.change-plan::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 36px; background: linear-gradient(transparent, var(--panel)); pointer-events: none; }

/* What a change did to the plan: the plan itself, new wording marked. */
.plan-change { display: flex; flex-direction: column; gap: 10px; }
.pc-sec { border-radius: 8px; }
.pc-head { display: flex; align-items: center; gap: 8px; margin: 8px 0 4px; }
.pc-name { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--accent); }
.pc-body .md { font-size: 14px; line-height: 1.55; }
.pc-body .md > :first-child { margin-top: 0; }
.pc-body .md > :last-child { margin-bottom: 0; }
.pc-body .md h1 { font-size: 18px; margin: 6px 0; }
.pc-body .md h3 { margin: 10px 0 4px; }
.pc-add, .pc-del { padding: 4px 12px; margin: 2px 0; border-left: 3px solid; border-radius: 0 6px 6px 0; }
.pc-add { background: var(--green-soft); border-color: var(--green); }
.pc-del { background: var(--red-soft); border-color: rgba(248, 113, 113, 0.6); color: #c99; text-decoration: line-through; text-decoration-color: rgba(248, 113, 113, 0.7); }
.pc-del strong, .pc-del code { color: inherit; }
.pc-same { padding: 2px 15px; color: var(--muted); }
.pc-edit { padding: 4px 12px; margin: 2px 0; border-left: 3px solid var(--blue); border-radius: 0 6px 6px 0; background: var(--blue-soft); }
.pc-edit ins { text-decoration: none; background: rgba(74, 222, 128, 0.22); color: #c8f7d9; border-radius: 3px; padding: 0 2px; }
.pc-edit del { color: #e9a3a3; text-decoration-color: rgba(248, 113, 113, 0.8); background: rgba(248, 113, 113, 0.12); border-radius: 3px; padding: 0 2px; margin-right: 2px; }
.pc-same .md strong { color: var(--fg); }
.pc-fold summary { cursor: pointer; font-size: 12px; color: var(--faint); font-family: var(--mono); margin: 4px 0; list-style: none; }
.pc-fold summary::before { content: "⋯ "; }
.pc-fold[open] summary { display: none; }
.plan-change.compact { gap: 4px; }
.plan-change.compact .pc-head { margin: 6px 0 3px; }
.plan-change.compact .pc-name { font-size: 12px; }
.plan-change.compact .pc-body .md { font-size: 13px; }
.plan-change.compact .pc-add, .plan-change.compact .pc-del { padding: 2px 10px; }

/* A change's own page. */
.change-detail { max-width: 920px; }
.cd-head { margin: 10px 0 22px; }
.cd-head h2 { font-size: 22px; margin: 0 0 6px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cd-head h2 .pill { vertical-align: 0; }
.cd-meta { font-size: 13px; margin-bottom: 12px; }
.cd-meta code { color: var(--faint); }
.cd-section { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 22px 20px; margin-bottom: 16px; }
.cd-section h3 { font-size: 13px; font-family: var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; }
.cd-help { font-size: 13px; margin: 0 0 6px; }
.file-list { list-style: none; margin: 0; padding: 0; }
.file-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 12px; align-items: baseline; padding: 6px 0; border-top: 1px solid var(--line); }
.file-list li:first-child { border-top: 0; }
.file-what { grid-column: 1; }
.file-list .pill { grid-column: 2; grid-row: 1; }
.file-stat { grid-column: 3; grid-row: 1; font-size: 12px; white-space: nowrap; }
.file-path { grid-column: 1 / -1; font-size: 11.5px; color: var(--faint); background: none; padding: 0; }
.cd-code { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cd-code summary { padding: 12px 22px; cursor: pointer; font-weight: 600; }
.cd-code[open] summary { border-bottom: 1px solid var(--line); }
.cd-code pre.diff { max-height: none; }
@media (max-width: 600px) {
  .cd-section { padding: 14px 14px 16px; }
  .pc-add, .pc-del { padding: 3px 9px; }
}
.plan-mark { font-size: 10.5px; }
.support-banner { background: var(--accent-soft); border: 1px solid rgba(124, 158, 255, 0.3); color: var(--fg); border-radius: 10px; padding: 9px 14px; margin-bottom: 16px; font-size: 14px; }
h2.everyone-head { margin-top: 40px; }
.build-choice { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.project-title .actions { display: flex; gap: 8px; }

/* ---------- connect ---------- */
.lead-sm { color: var(--muted); font-size: 15px; max-width: 620px; }
.copy-row { display: flex; gap: 8px; align-items: center; margin: 8px 0 4px; }
.copy-box { flex: 1; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; color: var(--teal); font-size: 13px; overflow-x: auto; white-space: nowrap; }
.setting h4 { margin: 18px 0 6px; font-size: 13px; font-family: var(--mono); color: var(--muted); }
ol.steps, ul.can-do { margin: 6px 0 10px; padding-left: 22px; line-height: 1.8; }

/* ---------- modules ---------- */
.modules { display: flex; flex-direction: column; gap: 10px; }
.module { display: flex; gap: 16px; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--bg); }
.module.on { border-color: rgba(74, 222, 128, 0.3); }
.module-name { font-family: var(--mono); font-weight: 600; font-size: 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.module-info p { margin: 4px 0 0; font-size: 13.5px; }
.module-usage { font-family: var(--mono); font-size: 12px !important; color: var(--teal); }

/* ---------- people ---------- */
.invite-box { margin: 20px 0 32px; }
.invite-form { display: flex; gap: 8px; margin: 12px 0; }
.invite-form input { flex: 1; }
.person.invite { background: var(--bg); }
h2.section { font-size: 15px; margin: 0 0 4px; }
.people { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
.person { display: flex; gap: 12px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.person-info { flex: 1; display: flex; flex-direction: column; }
.switch { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 500; font-size: 14px; cursor: pointer; }

/* ---------- workspace ---------- */
body:has(.workspace-root) { height: 100vh; overflow: hidden; }
.workspace { display: flex; flex-direction: column; height: 100vh; }
.ws-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.ws-bar .back { margin: 0; font-weight: 600; color: var(--fg); }
.ws-url { flex: 1; max-width: 480px; background: var(--bg); border: 1px solid var(--line); color: var(--teal); border-radius: 8px; padding: 5px 12px; font-family: var(--mono); font-size: 12.5px; display: flex; gap: 6px; overflow: hidden; white-space: nowrap; }
.lock { font-size: 11px; }
.ws-body { flex: 1; position: relative; background: var(--bg); }
.app-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.agent-panel {
  position: absolute; right: 18px; bottom: 18px; width: 400px; max-width: calc(100vw - 36px);
  height: min(620px, calc(100% - 36px)); background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: 16px; box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(124, 158, 255, 0.08); display: flex; flex-direction: column; overflow: hidden;
  transition: height .2s;
}
.agent-panel.collapsed { height: 46px; width: 200px; cursor: pointer; }
.agent-panel.collapsed > :not(.agent-head) { display: none; }
.agent-head { display: flex; justify-content: space-between; align-items: center; padding: 11px 16px; border-bottom: 1px solid var(--line); background: var(--hover); }
.agent-head strong { color: var(--accent); font-family: var(--mono); font-size: 13px; display: flex; gap: 6px; align-items: center; }
.collapse { color: var(--muted) !important; font-weight: 700; font-size: 16px !important; }
.agent-panel.collapsed .collapse { display: none; }
.agent-thread .msg { max-width: 95%; }
.activities { list-style: none; margin: 0; padding: 2px 4px; align-self: stretch; }
.activities li { color: var(--muted); font-size: 13px; padding: 2px 0 2px 18px; position: relative; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activities li::before { content: "✓"; position: absolute; left: 2px; color: var(--green); font-size: 11px; top: 3px; }
.activities li.current { color: var(--fg); }
.activities li.current::before { content: ""; width: 8px; height: 8px; border: 2px solid var(--accent); border-top-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; top: 6px; }
.agent-status { padding: 6px 14px; border-top: 1px solid var(--line); min-height: 34px; display: flex; align-items: center; font-size: 13px; }
.working { display: flex; align-items: center; gap: 8px; color: var(--muted); width: 100%; }
.working button { margin-left: auto; }
.agent-panel .composer { border-top: 0; padding-top: 4px; }

@media (max-width: 640px) {
  main { padding: 20px 16px 48px; }
  .topbar { padding: 10px 16px; }
  .project-title, .form-foot, .spec-foot { flex-direction: column; align-items: stretch; }
  .spec-doc { padding: 4px 18px 18px; }
  .chat-pane { height: 70vh; position: static; }
  .agent-panel { right: 8px; bottom: 8px; left: 8px; width: auto; max-width: none; height: 55%; }
  .ws-url { display: none; }
}


/* Help */
.help-ask { display: grid; gap: 10px; }
.help-ask select { justify-self: start; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; }
.help-list { display: grid; gap: 12px; }
.help-item { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; scroll-margin-top: 80px; }
.help-item:target { border-color: var(--accent); }
.help-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.help-head .pill { margin-left: auto; }
.help-text { white-space: pre-wrap; margin: 6px 0; }
.help-context { max-height: 320px; overflow: auto; font-family: var(--mono); font-size: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; white-space: pre-wrap; }
.help-reply { border-left: 3px solid var(--accent); padding: 4px 0 4px 12px; margin-top: 10px; }
.help-answer { display: grid; gap: 8px; margin-top: 10px; }
.help-item details summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.help-ask select { background: var(--panel); color: var(--fg); border: 1px solid var(--line-strong); border-radius: 8px; padding: 7px 10px; font: inherit; }

/* ---------- live copy and preview ---------- */
.url-row { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.preview-link { color: var(--amber) !important; }
.live-state { font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; }
.live-state code { color: var(--faint); }
.live-state.busy { color: var(--blue); }
.live-state.bad { color: var(--red); cursor: help; }
.dot-pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
.ws-url { display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 720px; }
.ws-preview { vertical-align: 0; }
.ws-live { margin-left: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill.live-mark { background: var(--green-soft); color: var(--green); font-size: 10.5px; }
.small { font-size: 12.5px; }
.live-error { background: var(--red-soft); border: 1px solid rgba(248, 113, 113, 0.35); border-radius: 10px; padding: 10px 14px; color: #fca5a5; }
.live-error summary { cursor: pointer; font-size: 13.5px; line-height: 1.5; }
.live-error summary strong { color: var(--red); }
.live-error pre { white-space: pre-wrap; font-size: 11.5px; max-height: 320px; overflow: auto; margin: 10px 0 0; color: var(--muted); }
.cd-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.cd-head h2 .pill.live-mark, .cd-head h2 .pill.blue, .cd-head h2 .pill.red { font-size: 11px; }
.restore-choice { margin-top: 14px; background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 16px 20px; max-width: 760px; }
.restore-choice h4 { margin: 0 0 6px; font-size: 15px; }
.restore-choice > p { margin: 0 0 12px; font-size: 13.5px; }
.restore-opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; cursor: pointer; font-size: 14px; line-height: 1.5; }
.restore-opt:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
.restore-opt input { margin-top: 4px; }
.restore-loss { border: 1px solid rgba(248, 113, 113, 0.4); background: var(--red-soft); border-radius: 8px; padding: 10px 14px; margin: 4px 0 12px; font-size: 14px; }
.restore-loss p { margin: 4px 0; }
.restore-loss ul { margin: 4px 0 8px; padding-left: 20px; }
.restore-loss code { color: var(--fg); }
.restore-sure { display: flex; gap: 8px; align-items: center; font-weight: 600; color: var(--red); margin-top: 8px; cursor: pointer; }
.restore-opt, .restore-sure { text-transform: none; font-family: inherit; letter-spacing: normal; font-size: 14px; color: var(--fg); }
.restore-sure { color: var(--red); }

/* ---------- power ---------- */
.power-setting.is-on { border-color: rgba(74, 222, 128, 0.35); }
.power-row { display: flex; gap: 22px; align-items: flex-start; }
.power-row h3 { margin-top: 2px; }
.power-state { margin: 4px 0 6px !important; }
.power-switch { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: none; }
.power { position: relative; width: 72px; height: 38px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--hover); cursor: pointer; padding: 0; transition: background .2s, border-color .2s; }
.power .knob { position: absolute; top: 3px; left: 3px; width: 30px; height: 30px; border-radius: 50%; background: #8a94a3; box-shadow: 0 2px 6px rgba(0, 0, 0, .4); transition: left .2s, background .2s; }
.power.on { background: var(--green); border-color: var(--green); box-shadow: 0 0 18px rgba(74, 222, 128, .25); }
.power.on .knob { left: 37px; background: #fff; }
.power:hover:not(:disabled) { filter: brightness(1.08); }
.power:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.power.busy { opacity: .6; cursor: progress; }
.power.busy .knob { animation: pulse 1s ease-in-out infinite; }
.power-label { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.is-on .power-label { color: var(--green); }

/* ---------- backups, preview data, errors ---------- */
.data-section { margin-top: 18px; max-width: 980px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.backup-list { display: flex; flex-direction: column; }
.backup { border-top: 1px solid var(--line); padding: 9px 0; }
.backup:first-child { border-top: 0; }
.backup-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.backup-compare { border-collapse: collapse; margin: 6px 0 10px; font-size: 13.5px; }
.backup-compare th, .backup-compare td { text-align: left; padding: 4px 18px 4px 0; border-bottom: 1px solid var(--line); }
.backup-compare th { color: var(--muted); font-weight: 600; font-size: 12px; }
.backup-compare tr.differs td { color: var(--amber); }
.errors-panel { background: var(--red-soft); border: 1px solid rgba(248, 113, 113, 0.35); border-radius: 10px; padding: 10px 14px; }
.errors-panel > summary { cursor: pointer; font-size: 13.5px; line-height: 1.5; }
.errors-panel > summary strong { color: var(--red); }
.error-list { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.error-item { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.error-item > summary { cursor: pointer; list-style: none; }
.error-title { font-size: 13.5px; }
.error-title code { color: var(--red); }
.error-trace { white-space: pre-wrap; font-size: 11.5px; color: var(--muted); max-height: 360px; overflow: auto; margin: 8px 0 0; }
.pill.err-mark { font-size: 10.5px; }
