/* Layout: a fixed step rail on the left, one working pane on the right; the chat step splits
   into conversation + the live setup sheet it fills. Phone: rail becomes a step strip. */
:root {
  --bg: #f3f5f7;
  --panel: #ffffff;
  --ink: #15202b;
  --muted: #5b6876;
  --line: #dde3e9;
  --accent: #0b6e74;
  --accent-ink: #ffffff;
  --accent-soft: #e2f1f1;
  --rdg: #6a5a2e;
  --rdg-soft: #f4efdf;
  --you: #1f5fa8;
  --you-soft: #e5eef9;
  --open: #8a4b10;
  --open-soft: #fbeedd;
  --ok: #1d7a46;
  --code-bg: #f0f3f6;
  --shadow: 0 1px 2px rgba(21, 32, 43, .06), 0 6px 20px rgba(21, 32, 43, .05);
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f151b; --panel: #161e26; --ink: #e6edf3; --muted: #93a1af; --line: #26323d;
    --accent: #3fb8bd; --accent-ink: #062224; --accent-soft: #123134;
    --rdg: #d8c48a; --rdg-soft: #2b2617; --you: #7fb3f0; --you-soft: #172a40;
    --open: #f0b06a; --open-soft: #33230f; --ok: #5fd08f; --code-bg: #0c1217;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f151b; --panel: #161e26; --ink: #e6edf3; --muted: #93a1af; --line: #26323d;
  --accent: #3fb8bd; --accent-ink: #062224; --accent-soft: #123134;
  --rdg: #d8c48a; --rdg-soft: #2b2617; --you: #7fb3f0; --you-soft: #172a40;
  --open: #f0b06a; --open-soft: #33230f; --ok: #5fd08f; --code-bg: #0c1217;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font: 15px/1.55 var(--body); }
h1, h2, h3 { font-family: var(--display); text-wrap: balance; margin: 0; letter-spacing: -.01em; }
code, pre, .mono { font-family: var(--mono); }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.topbar { background: var(--panel); border-bottom: 1px solid var(--line);
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.topbar-in { max-width: 1240px; margin: 0 auto; padding-block: 12px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.mark { width: 34px; height: 34px; border-radius: 8px; background: var(--ink); color: var(--bg); display: grid; place-items: center;
  font: 700 12px/1 var(--display); letter-spacing: .04em; }
.brand { display: flex; flex-direction: column; line-height: 1.2; }
.brand b { font-family: var(--display); font-size: 16px; }
.brand span { color: var(--muted); font-size: 12.5px; }
.spacer { flex: 1; }
.who { font-size: 13px; color: var(--muted); text-align: right; line-height: 1.3; }
.who b { color: var(--ink); font-weight: 600; }
.badge-proto { font: 500 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--open);
  background: var(--open-soft); padding: 6px 8px; border-radius: 6px; }

.shell { max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 28px;
  padding-block: 28px 56px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

.rail { position: sticky; top: 20px; align-self: start; display: flex; flex-direction: column; gap: 6px; }
.rail .client { padding: 0 10px 14px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.rail .client small { display: block; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; }
.rail .client b { font-family: var(--display); font-size: 18px; }
.step-btn { all: unset; box-sizing: border-box; display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start;
  padding: 10px; border-radius: 10px; cursor: pointer; }
.step-btn:hover:not([aria-disabled="true"]) { background: var(--panel); }
.step-btn[aria-current="step"] { background: var(--panel); box-shadow: var(--shadow); }
.step-btn[aria-disabled="true"] { cursor: not-allowed; opacity: .55; }
.step-btn:focus-visible { outline: 2px solid var(--accent); }
.num { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center;
  font: 600 12px/1 var(--mono); color: var(--muted); background: var(--panel); }
.step-btn.done .num { background: var(--ok); border-color: var(--ok); color: var(--panel); }
.step-btn[aria-current="step"] .num { border-color: var(--accent); color: var(--accent); }
.step-btn .t { font-weight: 600; line-height: 1.3; }
.step-btn .d { font-size: 12.5px; color: var(--muted); line-height: 1.35; margin-top: 2px; }
.rail .later { margin-top: 10px; padding: 12px 10px 0; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.rail .later b { color: var(--ink); display: block; margin-bottom: 2px; font-size: 13px; }

.pane { min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.pane-head { display: flex; flex-direction: column; gap: 6px; }
.eyebrow { font: 500 11.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.pane-head h1 { font-size: 30px; line-height: 1.15; }
.pane-head p { margin: 0; color: var(--muted); max-width: 68ch; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); }
.card h2 { font-size: 18px; margin-bottom: 4px; }
.card > p { margin: 0 0 14px; color: var(--muted); }

.btn { border: 1px solid transparent; border-radius: 9px; padding: 10px 16px; cursor: pointer; font-weight: 600; font-size: 14.5px;
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--muted); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Step 1: confirmations */
.checks { display: flex; flex-direction: column; gap: 10px; }
.check { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 14px; padding: 16px; border: 1px solid var(--line);
  border-radius: 12px; cursor: pointer; background: var(--panel); }
.check:hover { border-color: var(--muted); }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--ok); }
.check b { display: block; margin-bottom: 2px; }
.check span { color: var(--muted); font-size: 14px; }
.check.on { border-color: var(--ok); }
.holds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.holds h3 { font-size: 14px; font-family: var(--body); font-weight: 600; margin-bottom: 6px; }
.holds ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 14px; }
.holds li { margin-bottom: 4px; }

/* Step 2: chat + sheet */
.split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.chat { display: flex; flex-direction: column; height: min(680px, 78vh); padding: 0; overflow: hidden; }
.chat-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.chat-head b { font-family: var(--display); font-size: 16px; }
.pill { font: 500 11.5px/1 var(--mono); padding: 5px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.msgs { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.ai { background: var(--code-bg); align-self: flex-start; border-top-left-radius: 4px; }
.msg.me { background: var(--accent); color: var(--accent-ink); align-self: flex-end; border-top-right-radius: 4px; }
.msg.sys { align-self: center; max-width: 100%; font-size: 13px; color: var(--muted); background: none; padding: 2px 0; text-align: center; }
.msg .upd { display: block; margin-top: 8px; font: 12px/1.4 var(--mono); color: var(--you); }
.thinking { color: var(--muted); font-style: italic; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 18px 10px; }
.chip { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 99px; padding: 6px 12px; cursor: pointer; font-size: 13px; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.composer textarea { flex: 1; min-width: 0; resize: none; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font: inherit; background: var(--bg); color: var(--ink); height: 46px; }
.composer textarea:focus { outline: none; border-color: var(--accent); }
.privacy-note { font-size: 12.5px; color: var(--muted); padding: 0 18px 12px; }
.ours { font-size: 13px; color: var(--ink); background: var(--rdg-soft); padding: 10px 18px; line-height: 1.45; }
.ours b { font-weight: 600; }
.linkbtn { all: unset; color: var(--accent); text-decoration: underline; cursor: pointer; }
.linkbtn:focus-visible { outline: 2px solid var(--accent); }
.modes { display: grid; grid-template-columns: repeat(2, minmax(0, 220px)); gap: 8px; }
.mode { all: unset; box-sizing: border-box; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 14px; cursor: pointer;
  background: var(--panel); display: flex; flex-direction: column; gap: 2px; }
.mode b { font-size: 14.5px; }
.mode span { font-size: 12.5px; color: var(--muted); }
.mode[aria-selected="true"] { border-color: var(--accent); background: var(--accent-soft); }
.mode:focus-visible { outline: 2px solid var(--accent); }
.own { padding: 0; overflow: hidden; }
.own-body { display: flex; flex-direction: column; gap: 18px; padding-bottom: 18px; }
.own-body .ours { border-radius: 0; }
.own-body .stepper { padding: 0 18px; }
.paste { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: 13px/1.5 var(--mono);
  background: var(--bg); color: var(--ink); resize: vertical; }
.paste:focus { outline: none; border-color: var(--accent); }

.sheet { padding: 0; overflow: hidden; }
.sheet-head { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.sheet-head b { font-family: var(--display); font-size: 16px; display: block; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: 0; }
.meter { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: 10px; }
.meter > div { height: 100%; background: var(--ok); width: 0; transition: width .4s ease; }
.groups { max-height: min(560px, 62vh); overflow-y: auto; }
.grp { padding: 10px 18px 4px; font: 500 11px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 8px 18px; border-top: 1px solid var(--line); align-items: center; }
.field label { font-size: 13px; color: var(--muted); grid-column: 1 / -1; }
.field input, .field select { min-width: 0; width: 100%; border: 1px solid transparent; background: transparent; color: var(--ink);
  font: 14px var(--body); padding: 4px 6px; margin-left: -6px; border-radius: 6px; }
.field input:hover, .field select:hover { border-color: var(--line); }
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); background: var(--bg); }
.field input::placeholder { color: var(--open); opacity: .9; }
.src { font: 500 10.5px/1 var(--mono); padding: 4px 7px; border-radius: 99px; white-space: nowrap; }
.src.rdg { background: var(--rdg-soft); color: var(--rdg); }
.src.you { background: var(--you-soft); color: var(--you); }
.src.open { background: var(--open-soft); color: var(--open); }
.field.flash { animation: flash 1.2s ease; }
@keyframes flash { from { background: var(--you-soft); } to { background: transparent; } }

/* Step 3: where to build */
.choices { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.choice { all: unset; box-sizing: border-box; border: 1.5px solid var(--line); border-radius: 12px; padding: 14px; cursor: pointer;
  background: var(--panel); display: flex; flex-direction: column; gap: 4px; }
.choice:hover { border-color: var(--muted); }
.choice[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.choice:focus-visible { outline: 2px solid var(--accent); }
.choice b { font-family: var(--display); font-size: 16px; }
.choice span { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.choice em { font-style: normal; font: 500 10.5px/1 var(--mono); color: var(--accent); text-transform: uppercase; letter-spacing: .06em; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; margin: 6px 0 16px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.form input, .form select { border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; font: 14px var(--body); background: var(--bg); color: var(--ink); }
.form input:focus, .form select:focus { outline: none; border-color: var(--accent); }
.form .wide { grid-column: 1 / -1; }
.perm { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: var(--bg); display: flex; flex-direction: column; gap: 10px; }
.perm h3 { font-size: 15px; }
.perm ul { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.perm li::before { content: "✓"; color: var(--ok); font-weight: 700; margin-right: 8px; }
.perm li.no::before { content: "✕"; color: var(--open); }
.log { font: 13px/1.7 var(--mono); background: var(--code-bg); border-radius: 10px; padding: 12px 14px; margin: 0; overflow-x: auto; }
.log .ok { color: var(--ok); }
.cmd-tabs { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.cmd-tab { all: unset; cursor: pointer; font-size: 13px; padding: 6px 10px; border-radius: 8px; color: var(--muted); border: 1px solid transparent; }
.cmd-tab[aria-selected="true"] { color: var(--ink); border-color: var(--line); background: var(--panel); }
.cmd-tab:focus-visible { outline: 2px solid var(--accent); }
.cmd { position: relative; }
.cmd pre { background: var(--code-bg); border-radius: 10px; padding: 14px 16px; padding-right: 76px; margin: 0; overflow-x: auto;
  font-size: 13px; line-height: 1.65; white-space: pre; }
.cmd pre .c { color: var(--muted); }
.copy { position: absolute; top: 8px; right: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  border-radius: 7px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
.stepper { display: flex; flex-direction: column; gap: 16px; }
.stepper > div { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; }
.stepper .n { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font: 600 13px var(--mono); }
.stepper h3 { font-size: 15px; font-family: var(--body); font-weight: 600; margin: 3px 0 6px; }
.stepper p { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.linkline { font: 13px var(--mono); background: var(--code-bg); padding: 8px 10px; border-radius: 8px; overflow-x: auto; white-space: nowrap; user-select: all; }
.note { font-size: 13px; color: var(--muted); }
.note.warn { color: var(--open); }

/* Step 4 */
.later-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.later-list div { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.later-list b { display: block; font-size: 14px; }
.later-list span { font-size: 13px; color: var(--muted); }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: calc(100vw - 32px); z-index: 20; }

@media (max-width: 980px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); gap: 18px; padding-block: 16px 40px; }
  .rail { position: static; flex-direction: row; overflow-x: auto; gap: 4px; }
  .rail .client, .rail .later { display: none; }
  .step-btn { grid-template-columns: 26px auto; min-width: max-content; }
  .step-btn .d { display: none; }
  .holds, .form, .later-list { grid-template-columns: minmax(0, 1fr); }
  .who { display: none; }
  .pane-head h1 { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---- additions for the working portal ---- */
body { margin: 0; }
[hidden] { display: none !important; }
.plain { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.plain-card { max-width: 620px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 28px; box-shadow: var(--shadow); }
.plain-card h1 { font-size: 26px; margin-bottom: 10px; }
.plain-card h2 { font-size: 18px; margin: 22px 0 6px; }
.plain-card form { display: flex; flex-direction: column; gap: 12px; margin: 12px 0; }
.plain-card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.plain-card input { border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; font: 14px var(--body);
  background: var(--bg); color: var(--ink); }
.plain-card .ok { color: var(--ok); }
.error-box { background: var(--open-soft); color: var(--open); border-radius: 10px; padding: 12px 14px; white-space: pre-wrap;
  font-size: 14px; }
.src.later { background: var(--line); color: var(--muted); }
.signout { all: unset; cursor: pointer; color: var(--accent); font-size: 12.5px; text-decoration: underline; }
.acct-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.acct { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.acct input { accent-color: var(--accent); }
.acct small { color: var(--muted); }

/* Shown on step 3 once files are delivered, so the last step can't be missed. */
.handoff { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 14px; padding: 14px 18px; }
.handoff span { color: var(--muted); }
