:root {
  color-scheme: light dark;
  --bg: #f4f4f0;
  --surface: #ffffff;
  --subtle: #f4f4f0;
  --ink: #15161a;
  --muted: #5e626b;
  --line: #e3e3de;
  --field: #c9cbc4;
  --accent: #15161a;
  --hl: #ffd60a;
  --hl-soft: #fff6cc;
  --on-hl: #15161a;
  --shadow: #15161a;
  --ok: #1e7a4c;
  --danger: #c2371a;
  --sans: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --radius: 6px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121316;
    --surface: #1a1c20;
    --subtle: #23262b;
    --ink: #eceef1;
    --muted: #a3a7af;
    --line: #2d3036;
    --field: #3d4148;
    --accent: #ffd60a;
    --hl-soft: #3a3210;
    --shadow: #000000;
    --ok: #5cc28d;
    --danger: #ff8a7a;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--bg); font: .92rem/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a { touch-action: manipulation; }
a { color: inherit; font-weight: 600; text-underline-offset: .2em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
.shell { width: min(76rem, calc(100% - 2.5rem)); margin-inline: auto; }
@media (max-width: 31rem) { .shell { width: calc(100% - 2rem); } }

/* Masthead + hero share the white band */
.masthead { background: var(--surface); }
.masthead-inner { min-height: 3.9rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.wordmark { display: flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.2rem; letter-spacing: -.04em; color: inherit; text-decoration: none; }
.wordmark svg { width: 1.9rem; height: 1.9rem; flex: none; }
.text-button { padding: .35rem .2rem; border: 0; background: transparent; font-weight: 600; cursor: pointer; }
.text-button:hover { text-decoration: underline; text-underline-offset: .2em; }
.hero { background: var(--surface); border-bottom: 1px solid var(--line); margin-bottom: 2rem; }
.intro { padding: 2rem 0 2.25rem; }
h1 { font-size: clamp(2.2rem, 6vw, 4rem); font-weight: 800; letter-spacing: -.05em; line-height: 1; }
mark { background: var(--hl); color: var(--on-hl); padding: 0 .14em; border-radius: .08em .25em .1em .3em; }
.hero-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; }
.footnote { width: 9.5rem; height: 9.5rem; flex: none; }
@media (max-width: 40rem) { .footnote { display: none; } }
.intro p { margin-top: .9rem; max-width: 38rem; color: var(--muted); font-size: 1rem; line-height: 1.6; }
h2 { font-size: 1rem; font-weight: 650; }
h3 { font-size: .92rem; font-weight: 600; }
.label { font: .72rem/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

/* Panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1.5rem; }
.panel p, dialog p { margin-top: .45rem; color: var(--muted); }
.sign-in { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.workspace, .with-aside { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(16rem, 1fr); gap: 1.75rem; align-items: start; }
.workspace { grid-template-columns: minmax(0, 1.5fr) minmax(16rem, 1fr); grid-template-areas: "directory setup"; }
.setup { grid-area: setup; display: grid; gap: 1.25rem; }
.directory { grid-area: directory; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.count { min-width: 1.75rem; padding: .05rem .5rem; border-radius: var(--radius); background: var(--ink); color: var(--surface); font: .78rem/1.6 var(--mono); text-align: center; }
.empty { margin-top: 1rem; padding: 2rem 1rem; border: 1px dashed var(--field); border-radius: 8px; text-align: center; }
.agent-list { list-style: none; padding: 0; margin: .75rem 0 0; }
.agent-list:empty { display: none; }
.agent-row { display: flex; align-items: center; justify-content: space-between; gap: .9rem; padding: .9rem 0; border-top: 1px solid var(--line); }
.agent-row:last-child { padding-bottom: 0; }
.agent-row p { margin-top: .1rem; font-size: .82rem; }
.agent-row h3 { overflow-wrap: anywhere; }
.agent-actions, .dialog-actions, .token-footer, .actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem; }

/* Numbered steps */
.steps { display: grid; gap: 2rem; }
.step { display: grid; grid-template-columns: 2.25rem minmax(0, 1fr); gap: 0 1rem; }
.step-number { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: var(--radius); background: var(--ink); color: var(--surface); font: 600 .8rem var(--mono); }
.step:first-child .step-number { background: var(--hl); color: var(--on-hl); box-shadow: inset 0 0 0 2px var(--on-hl); }
.step h2 { align-self: center; font-size: 1.05rem; }
.step > :not(.step-number, h2) { grid-column: 2; }

/* Shared / not shared list */
.checks { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: .7rem; }
.checks li { display: grid; grid-template-columns: 1rem 1fr; gap: .6rem; }
.checks li::before { content: '✓'; color: var(--ok); font-weight: 700; }
.checks li.no::before { content: '✕'; color: var(--danger); }

/* Buttons */
.primary, .secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 2.5rem; padding: 0 1rem; border-radius: var(--radius);
  font-weight: 600; font-size: .87rem; cursor: pointer; text-decoration: none;
  transition: transform .08s, box-shadow .08s;
}
.primary { color: var(--on-hl); background: var(--hl); border: 2px solid var(--on-hl); box-shadow: 3px 3px 0 var(--shadow); }
.primary:hover { background: #ffe14d; }
.primary:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--shadow); }
.secondary { background: var(--surface); border: 1px solid var(--ink); min-height: 2.25rem; font-size: .84rem; }
.secondary:hover { background: var(--subtle); }
.secondary.danger { color: var(--danger); border-color: currentColor; }
:disabled { opacity: .55; cursor: wait; }

/* Forms */
.name, .field { display: grid; gap: .35rem; margin-top: 1rem; font-size: .85rem; font-weight: 600; }
input:not([type="checkbox"]), select, textarea {
  width: 100%; min-height: 2.5rem; padding: .5rem .7rem; border: 1px solid var(--field); border-radius: var(--radius);
  background: var(--surface); font-weight: 400;
}
fieldset { min-width: 0; margin: 1rem 0 1.25rem; padding: 0; border: 0; }
legend { margin-bottom: .3rem; padding: 0; font-size: .85rem; font-weight: 600; }
.permission { display: flex; align-items: center; gap: .55rem; min-height: 2rem; }
.permission input { width: 1rem; height: 1rem; margin: 0; accent-color: var(--accent); }
.link .primary { width: 100%; }
.credential code, pre, textarea.prompt {
  display: block; width: 100%; margin-top: .9rem; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); font: .8rem/1.7 var(--mono); overflow-wrap: anywhere; white-space: pre-wrap;
}
.credential code { background: var(--subtle); }
.note { margin-top: .9rem; font-size: .82rem; color: var(--muted); }
.token-footer { margin-top: .9rem; font-size: .8rem; color: var(--muted); }
.step .actions { margin-top: .9rem; }
#status { margin: 0 0 1rem; color: var(--muted); }
#status:empty, #copy-status:empty { display: none; }

dialog { width: min(26rem, calc(100% - 2rem)); border: 1px solid var(--ink); border-radius: 10px; padding: 1.4rem; background: var(--surface); color: var(--ink); box-shadow: 5px 5px 0 var(--shadow); }
dialog::backdrop { background: #11121799; }
.dialog-actions { justify-content: flex-end; margin-top: 1.2rem; gap: .5rem; }
.footer { margin-top: 3rem; padding: 1.25rem 0 2rem; border-top: 1px solid var(--line); font-size: .85rem; color: var(--muted); }

@media (max-width: 52rem) {
  .with-aside { grid-template-columns: 1fr; }
  .workspace { grid-template-columns: 1fr; grid-template-areas: "setup" "directory"; }
}
@media (max-width: 31rem) {
  .sign-in, .agent-row { align-items: flex-start; flex-direction: column; }
  .panel { padding: 1.15rem; }
  .step { grid-template-columns: 1fr; gap: .6rem; }
  .step > :not(.step-number, h2) { grid-column: 1; }
}

/* Pilot */
.pilot { max-width: 48rem; gap: 1.25rem; }
.row { display: flex; flex-wrap: wrap; align-items: end; gap: .6rem; margin-top: 1rem; }
.row .field { flex: 1 1 14rem; margin-top: 0; }
main { padding-bottom: 3rem; }
