/* Pressvik Studio – the console. Plain CSS, no frameworks, light and dark. */

:root {
  --paper: #f2f4f6;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --ink: #16202a;
  --ink-2: #4e5b69;
  --line: #d3d9e0;
  --line-strong: #77838f;
  --accent: #0b6e6e;
  --accent-ink: #ffffff;
  --accent-soft: #e2f0ef;
  --accent-strong: #08514f;
  --warn: #8f4300;
  --warn-soft: #fff1de;
  --stop: #a61b1b;
  --stop-soft: #fdecec;
  --ok: #1d6a3b;
  --ok-soft: #e7f4ec;
  --focus: #1f5fd1;
  --code-bg: #eef1f4;
  --radius: 6px;
  --radius-lg: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.5625rem;
  --step-3: 1.953rem;
  --gap: 1rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e1318;
    --surface: #151c23;
    --surface-2: #1a222a;
    --ink: #e6ebf0;
    --ink-2: #a8b3be;
    --line: #2b3640;
    --line-strong: #7d8a97;
    --accent: #5cc0bb;
    --accent-ink: #062423;
    --accent-soft: #12302f;
    --accent-strong: #8ad6d1;
    --warn: #f0a24b;
    --warn-soft: #2e2213;
    --stop: #ff8a80;
    --stop-soft: #321617;
    --ok: #73d39a;
    --ok-soft: #12291c;
    --focus: #8ab4ff;
    --code-bg: #1d262f;
  }
}

*, *::before, *::after { box-sizing: border-box; }

/* The hidden attribute always wins, also over components that set display. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.55;
}

a { color: var(--accent-strong); text-underline-offset: 0.15em; }
a:hover { color: var(--ink); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

h1, h2, h3, h4 { line-height: 1.2; font-weight: 650; letter-spacing: -0.012em; margin: 0 0 0.6em; }
h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
p { margin: 0 0 1em; }
code, pre, .mono { font-family: var(--mono); font-size: 0.92em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); font-weight: 400; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: 0.5rem; top: -3rem; z-index: 10;
  background: var(--surface); color: var(--ink); padding: 0.6rem 1rem; border: 2px solid var(--focus);
}
.skip:focus { top: 0.5rem; }

/* ---------------------------------------------------------------- top bar and the month's meter */

.topbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0 1.25rem;
  padding: 0.35rem clamp(1rem, 3vw, 2rem);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
/* Small screens: the brand and Sign out on the first row, the menu and the month's spend below. */
.topbar .brand { order: 1; }
.topbar .signout { order: 2; margin-left: auto; }
.topbar .topnav { order: 3; flex: 1 1 auto; margin-left: -0.75rem; overflow-x: auto; }
.topbar .meter { order: 4; }
@media (min-width: 56rem) {
  .topbar { gap: 0.5rem 1.25rem; padding: 0.6rem clamp(1rem, 3vw, 2rem); }
  .topbar .brand, .topbar .topnav, .topbar .meter, .topbar .signout { order: 0; }
  .topbar .topnav { margin-left: 0; }
  .topbar .signout { margin-left: 0; }
}

.brand {
  display: inline-flex; align-items: center; gap: 0.5rem; min-height: 44px;
  color: var(--ink); text-decoration: none; font-weight: 500; letter-spacing: -0.01em; white-space: nowrap;
}
.brand b { font-weight: 750; }
.brand__mark {
  width: 1.05rem; height: 1.05rem; border-radius: 3px; background: var(--accent);
  box-shadow: inset 0 -0.32rem 0 0 var(--accent-strong);
}
.brand--large { font-size: var(--step-1); margin-bottom: 1.5rem; }

.topnav { display: flex; gap: 0.25rem; }
.topnav a, .tabs a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.75rem;
  color: var(--ink); text-decoration: none; border-radius: var(--radius);
}
.topnav a:hover, .tabs a:hover { background: var(--surface-2); }
.topnav a[aria-current="page"], .tabs a[aria-current="page"] { font-weight: 650; box-shadow: inset 0 -3px 0 var(--accent); border-radius: 0; }

.meter {
  display: inline-flex; align-items: center; gap: 0.75rem; min-height: 44px;
  color: var(--ink); text-decoration: none; padding: 0.25rem 0.5rem; border-radius: var(--radius);
}
.meter:hover { background: var(--surface-2); color: var(--ink); }
.meter__text { display: flex; flex-direction: column; line-height: 1.2; }
.meter__label { font-size: 0.75rem; color: var(--ink-2); }
.meter__value { font-weight: 650; font-variant-numeric: tabular-nums; }
.meter__of { font-weight: 400; color: var(--ink-2); }

/* The budget bar reads like a measuring tape: ticks every tenth, filled up to the month's spend. */
meter {
  -webkit-appearance: none; appearance: none;
  width: 9rem; height: 0.6rem; border: 1px solid var(--line-strong); border-radius: 2px;
  background: var(--surface) repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), var(--line) calc(10% - 1px) 10%);
}
meter::-webkit-meter-bar { background: transparent; border: 0; height: 100%; }
meter::-webkit-meter-optimum-value { background: var(--accent); }
meter::-webkit-meter-suboptimum-value { background: var(--warn); }
meter::-webkit-meter-even-less-good-value { background: var(--stop); }
meter:-moz-meter-optimum::-moz-meter-bar { background: var(--accent); }
meter:-moz-meter-sub-optimum::-moz-meter-bar { background: var(--warn); }
meter:-moz-meter-sub-sub-optimum::-moz-meter-bar { background: var(--stop); }
.meter--warn .meter__value { color: var(--warn); }
.meter--stop .meter__value { color: var(--stop); }

.signout { margin: 0; }
.link-button {
  background: none; border: 0; padding: 0 0.5rem; min-height: 44px; font: inherit; color: var(--accent-strong);
  text-decoration: underline; text-underline-offset: 0.15em; cursor: pointer;
}

/* ---------------------------------------------------------------- the project bar */

.project-bar {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 0.25rem 1.5rem;
  padding: 1rem clamp(1rem, 3vw, 2rem) 0;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.project-bar__name { padding-bottom: 0.6rem; min-width: 0; }
.project-bar__title { font-size: var(--step-2); margin: 0; }
.project-bar__url { font-size: var(--step--1); color: var(--ink-2); }
.tabs { display: flex; gap: 0.25rem; overflow-x: auto; max-width: 100%; scrollbar-width: thin; }
.tabs a { white-space: nowrap; }

/* ---------------------------------------------------------------- page structure */

.page { max-width: 76rem; margin: 0 auto; padding: 1.5rem clamp(1rem, 3vw, 2rem) 4rem; }
.page:focus { outline: none; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.page-head h1, .page-head h2 { margin: 0; }
.lead { color: var(--ink-2); max-width: 70ch; font-size: 1.05rem; }
.narrow { max-width: 40rem; }
.columns { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 1.25rem clamp(1rem, 2.5vw, 1.5rem); margin-bottom: var(--gap);
}
.panel > :last-child { margin-bottom: 0; }
.panel--attention { border-color: var(--warn); box-shadow: inset 4px 0 0 var(--warn); }

.stack > * + * { margin-top: 1rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.inline-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0; }
.crumbs { color: var(--ink-2); }

.empty { max-width: 36rem; padding: 3rem 0; }

/* ---------------------------------------------------------------- buttons */

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 44px; padding: 0 1rem; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.button:hover { background: var(--surface-2); color: var(--ink); }
.button--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.button--primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--accent-ink); }
.button--ghost { background: transparent; border-color: transparent; color: var(--accent-strong); }
.button--ghost:hover { background: var(--accent-soft); }
.button--small { min-height: 36px; padding: 0 0.75rem; font-size: var(--step--1); }
.button--wide { width: 100%; }
.button[disabled], .button[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }

/* ---------------------------------------------------------------- forms */

.field { display: flex; flex-direction: column; gap: 0.3rem; max-width: 40rem; border: 0; padding: 0; margin: 0 0 1rem; }
.field--short { max-width: 18rem; }
.field label, .field legend, .field .label { font-weight: 600; padding: 0; }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea {
  width: 100%; min-height: 44px; padding: 0.55rem 0.7rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); font: inherit;
}
textarea { resize: vertical; line-height: 1.5; }
select { padding-right: 2rem; }
input[type="file"] { font: inherit; padding: 0.4rem 0; }
input[type="checkbox"], input[type="radio"] { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); margin: 0; flex: none; }
.choice { display: flex; align-items: center; gap: 0.6rem; min-height: 44px; font-weight: 400 !important; }
.choice > span { min-width: 0; }
.choice--off { color: var(--ink-2); }
.help { color: var(--ink-2); font-size: var(--step--1); margin: 0; }
.field--error input, .field--error textarea, .field--error select, [aria-invalid="true"] { border-color: var(--stop); border-width: 2px; }
.field__error, .form-error { color: var(--stop); font-weight: 600; margin: 0; }

/* ---------------------------------------------------------------- notices */

.notice, .flash {
  padding: 0.75rem 1rem; border-radius: var(--radius); border-left: 4px solid var(--accent);
  background: var(--accent-soft); color: var(--ink); max-width: 70ch;
}
.notice--warning { border-color: var(--warn); background: var(--warn-soft); }
.notice--error, .flash--error { border-color: var(--stop); background: var(--stop-soft); }
.flash--success { border-color: var(--ok); background: var(--ok-soft); }
.badge { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 0.05rem 0.45rem; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--ink-2); vertical-align: middle; }
.badge--ok { border-color: var(--ok); color: var(--ok); }
.badge--warn { border-color: var(--warn); color: var(--warn); }
.count { display: inline-block; min-width: 1.6rem; text-align: center; border-radius: 999px; background: var(--warn); color: var(--surface); font-size: var(--step--1); padding: 0 0.4rem; }

/* ---------------------------------------------------------------- sign-in */

.gate .gate__main { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; }
.gate__card {
  width: 100%; max-width: 28rem; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: clamp(1.25rem, 5vw, 2.25rem);
  box-shadow: 0 1px 0 var(--line), 0 18px 40px -28px rgba(10, 30, 40, 0.45);
}
.gate__aside { margin-top: 1.25rem; }
.gate__lang { margin-top: 1.5rem; display: flex; gap: 1rem; font-size: var(--step--1); }
.command { background: var(--code-bg); padding: 0.75rem 1rem; border-radius: var(--radius); overflow-x: auto; }

/* ---------------------------------------------------------------- projects */

.project-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.project-row {
  display: grid; gap: 0.25rem 1.5rem; align-items: center; padding: 1rem 0; border-bottom: 1px solid var(--line);
  grid-template-columns: 1fr;
}
.project-row__link { display: flex; flex-direction: column; text-decoration: none; color: var(--ink); min-width: 0; }
.project-row__name { font-size: var(--step-1); font-weight: 650; }
.project-row__link:hover .project-row__name { text-decoration: underline; }
.project-row__url, .project-row__facts { color: var(--ink-2); font-size: var(--step--1); }
.project-row__facts { display: flex; gap: 1rem; flex-wrap: wrap; }
.project-row__cost { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
@media (min-width: 52rem) {
  .project-row { grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr) auto; }
  .project-row__cost { justify-content: flex-end; }
}

/* ---------------------------------------------------------------- code */

.facts { display: grid; gap: 0.5rem 1.5rem; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); margin: 0 0 1rem; }
.facts dt { color: var(--ink-2); font-size: var(--step--1); }
.facts dd { margin: 0; font-weight: 600; }
.upload { border-top: 1px solid var(--line); padding-top: 1rem; }
.file-list { columns: 18rem; column-gap: 2rem; padding-left: 1.1rem; margin: 0; }
.file-list li { break-inside: avoid; padding: 0.15rem 0; }
.code-view { overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); max-height: 80vh; }
.code-lines { border-collapse: collapse; font-family: var(--mono); font-size: 0.85rem; line-height: 1.5; width: 100%; }
.code-lines__n { color: var(--ink-2); text-align: right; padding: 0 0.75rem; user-select: none; vertical-align: top; border-right: 1px solid var(--line); background: var(--surface-2); }
.code-lines__c { padding: 0 1rem; white-space: pre; }
.code-lines code { font-size: inherit; }
.pager { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; align-items: center; margin: 0.75rem 0; color: var(--ink-2); }
.pager a { min-height: 44px; display: inline-flex; align-items: center; }

/* ---------------------------------------------------------------- tables */

/* Positioned, so that a visually hidden heading inside (absolutely positioned) scrolls with the table, not the page. */
.table-wrap { overflow-x: auto; position: relative; }
table.data, .prose table { border-collapse: collapse; width: 100%; font-size: var(--step--1); }
.data th, .data td, .prose th, .prose td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.data thead th, .prose thead th { font-weight: 650; color: var(--ink-2); border-bottom: 2px solid var(--line); }
.data .num { text-align: right; }
.budget { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; margin: 0 0 0.5rem; }
.budget__numbers { margin: 0; }
.budget__spent { font-size: var(--step-3); font-weight: 700; letter-spacing: -0.02em; }
.budget__bar { width: min(100%, 22rem); height: 0.9rem; }

/* ---------------------------------------------------------------- settings */

.model-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: 0 1.5rem; }
.price-list { list-style: none; padding: 0; margin: 0; }
.price { border-top: 1px solid var(--line); padding: 0.9rem 0; }
.price__name { margin: 0 0 0.25rem; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.price__fields { display: flex; flex-wrap: wrap; gap: 0.5rem 0.75rem; align-items: flex-end; margin-top: 0.4rem; }
.price__field { display: flex; flex-direction: column; font-size: var(--step--1); color: var(--ink-2); }
.price__field input { width: 7.5rem; min-height: 36px; padding: 0.3rem 0.5rem; font-variant-numeric: tabular-nums; }
.price__tier { border: 0; border-left: 3px solid var(--line); margin: 0.6rem 0 0; padding: 0 0 0 0.75rem; }
.price__tier legend { padding: 0; font-size: var(--step--1); font-weight: 650; color: var(--ink-2); }
.price .actions { margin-top: 0.6rem; }
.passkeys { list-style: none; padding: 0; margin: 0 0 1rem; }
.passkeys li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
.passkeys form { margin: 0; }
.sessions { border-top: 1px solid var(--line); margin-top: 1.25rem; padding-top: 1rem; display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; }
.sessions p, .sessions form { margin: 0; }

/* ---------------------------------------------------------------- memory */

.proposals { list-style: none; padding: 0; margin: 0; }
.proposal { padding: 1rem 0; border-top: 1px solid var(--line); }
.proposal__kind { font-weight: 650; margin-bottom: 0.5rem; }
.proposal__text { background: var(--surface-2); border-radius: var(--radius); padding: 0.75rem 1rem; margin-bottom: 0.75rem; }
.versions { list-style: none; padding: 0; margin: 0; }
.versions li { border-top: 1px solid var(--line); padding: 0.5rem 0; }
.versions summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 0.5rem; }

/* ---------------------------------------------------------------- prose (Markdown from Studio) */

.prose { max-width: 72ch; overflow-wrap: anywhere; }
.prose > :last-child { margin-bottom: 0; }
.prose h3, .prose h4, .prose h5, .prose h6 { font-size: 1.05rem; margin: 1.2em 0 0.5em; }
.prose ul, .prose ol { padding-left: 1.4rem; margin: 0 0 1em; }
.prose li + li { margin-top: 0.25em; }
.prose blockquote { margin: 0 0 1em; padding-left: 1rem; border-left: 3px solid var(--line-strong); color: var(--ink-2); }
.prose code { background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 4px; }
.prose pre { background: var(--code-bg); padding: 0.85rem 1rem; border-radius: var(--radius); overflow-x: auto; margin: 0 0 1em; line-height: 1.45; position: relative; }
.prose pre code { background: none; padding: 0; font-size: 0.85rem; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 1.5em 0; }
.copy-button {
  position: absolute; top: 0.4rem; right: 0.4rem; min-height: 32px; padding: 0 0.6rem;
  font: inherit; font-size: 0.75rem; border-radius: var(--radius); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); cursor: pointer; opacity: 0.85;
}

/* ---------------------------------------------------------------- the chat */

/* The chat fills the window: the conversation scrolls by itself, and the composer stays in view. */
body.has-chat { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
body.has-chat > .topbar, body.has-chat > .project-bar { flex: none; }
/* width: the page's auto margins would otherwise shrink it to its content in the column. */
body.has-chat > main { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; width: 100%; }
body.has-chat > main > .flash { margin: 0.75rem clamp(1rem, 3vw, 2rem) 0; flex: none; }
.page--chat { max-width: none; padding: 0; }
.chat { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.chat__side { flex: none; background: var(--surface); border-bottom: 1px solid var(--line); padding: 0.25rem clamp(1rem, 3vw, 2rem);
  max-height: 40vh; overflow-y: auto; }
.chat__list summary { cursor: pointer; font-weight: 650; min-height: 44px; display: flex; align-items: center; }
.chat__reqs { border-top: 1px solid var(--line); margin-top: 0.25rem; }
.conv-list, .conv-reqs { list-style: none; margin: 0; padding: 0; }
.conv-list a { display: flex; flex-direction: column; padding: 0.5rem 0.6rem; border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.conv-list a:hover { background: var(--surface-2); }
.conv-list a[aria-current="page"] { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.conv-list__title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-list__meta { font-size: 0.8rem; color: var(--ink-2); }
.conv-reqs li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; padding: 0.35rem 0.6rem 0.5rem; }
.conv-reqs a { color: var(--ink); text-decoration: none; min-width: 0; flex: 1 1 10rem; display: inline-flex; gap: 0.4rem; align-items: baseline; min-height: 32px; padding-top: 0.25rem; }
.conv-reqs a:hover .conv-reqs__title { text-decoration: underline; }
.conv-reqs__title { font-weight: 600; overflow-wrap: anywhere; }
.chat__main { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; min-width: 0; padding: 0 clamp(1rem, 3vw, 2rem); }
.chat__notice { margin: 0.75rem 0 0; flex: none; }
@media (min-width: 60rem) {
  .chat { display: grid; grid-template-columns: 17rem minmax(0, 1fr); }
  .chat__side { border-bottom: 0; border-right: 1px solid var(--line); max-height: none; padding-top: 0.5rem; }
}

.thread { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column;
  gap: 1.25rem; padding: 1rem 0.25rem 1.5rem 0; max-width: 52rem; width: 100%; }
.thread:focus-visible { outline-offset: -3px; }
.thread__empty { padding: 1rem 0; max-width: 40rem; }
.thread__empty h2 { font-size: var(--step-2); }
/* Shown just above the composer when a new answer arrives while the person reads further up. */
.thread__jump {
  position: absolute; z-index: 2; left: 50%; bottom: calc(100% + 0.75rem); transform: translateX(-50%);
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 1rem; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600;
  cursor: pointer; box-shadow: 0 6px 18px -10px rgba(10, 30, 40, 0.45);
}

.msg { display: flex; flex-direction: column; gap: 0.5rem; }
.msg__head { display: flex; flex-wrap: wrap; gap: 0.35rem 0.75rem; align-items: baseline; font-size: var(--step--1); color: var(--ink-2); }
.msg__who { font-weight: 700; color: var(--ink); letter-spacing: 0.01em; }
.msg--user .msg__body { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 0.75rem 1rem; }
.msg--assistant { padding-left: 1rem; border-left: 3px solid var(--accent); }
.msg--error, .msg--stopped { border-left-color: var(--line-strong); }
.msg__thinking summary, .msg__thinking { color: var(--ink-2); font-size: var(--step--1); }
.msg__thinking summary { cursor: pointer; min-height: 32px; display: inline-flex; align-items: center; }
.msg__thinking .prose { border-left: 2px solid var(--line); padding-left: 0.75rem; margin-top: 0.25rem; }
.msg__tools { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35rem; font-size: 0.8rem; color: var(--ink-2); }
.msg__tools li { border: 1px solid var(--line); border-radius: 999px; padding: 0.1rem 0.6rem; background: var(--surface); }
.msg__tools li.is-failed { border-color: var(--stop); }
.msg__wait { color: var(--ink-2); margin: 0; }
.msg__wait::after { content: ""; display: inline-block; width: 0.6rem; height: 0.6rem; margin-left: 0.5rem; border-radius: 50%; background: var(--accent); animation: pulse 1.2s ease-in-out infinite; vertical-align: middle; }
.msg__error { color: var(--stop); font-weight: 600; margin: 0; }
.msg__cost { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; font-size: 0.8rem; color: var(--ink-2); margin: 0; }
.msg__price { font-weight: 700; color: var(--ink); }
.msg__tag { font-size: 0.75rem; font-weight: 650; padding: 0.05rem 0.5rem; border-radius: 999px; border: 1px solid var(--accent); color: var(--accent-strong); }
/* Make it a requirement turns what the conversation arrived at into a requirement, so it belongs under the latest answer. */
.msg__actions { display: none; flex-wrap: wrap; gap: 0.5rem; }
.thread > .msg:last-child .msg__actions { display: flex; }
.msg__images { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.75rem; }
.msg__image { max-width: min(100%, 18rem); }
.msg__image figure { margin: 0; }
.msg__image img, .image-list img {
  display: block; max-width: 100%; height: auto; max-height: 14rem; width: auto; object-fit: contain;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2);
}
.msg__image figcaption, .image-list__caption { font-size: 0.8rem; color: var(--ink-2); margin: 0.3rem 0 0; display: flex; flex-wrap: wrap; gap: 0 0.4rem; }
.msg__image-name { overflow-wrap: anywhere; color: var(--ink); }
.msg__image-note { font-size: 0.8rem; color: var(--ink-2); margin: 0.2rem 0 0; }
.msg__image-form { margin: 0.1rem 0 0; }
.msg__image-actions { display: flex; flex-wrap: wrap; gap: 0 0.9rem; align-items: baseline; }
.msg__image--gone { max-width: 18rem; padding: 0.5rem 0.75rem; border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.msg__image--gone .msg__image-note { margin: 0; }
.link-button--small { font-size: 0.8rem; min-height: 32px; padding: 0; }
.req-card {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.75rem; margin: 0; padding: 0.6rem 0.85rem;
  border: 1px solid var(--line); border-left: 4px solid var(--warn); border-radius: var(--radius); background: var(--surface);
}
.req-card__label { font-size: 0.8rem; font-weight: 650; color: var(--ink-2); }
.req-card__link { font-weight: 600; color: var(--ink); min-height: 32px; display: inline-flex; align-items: center; gap: 0.4rem; }

@keyframes pulse { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }

.composer {
  position: relative; flex: none; background: var(--paper); padding: 0.75rem 0 0.75rem; max-width: 52rem; width: 100%;
  border-top: 1px solid var(--line);
}
.composer.is-dropping { outline: 3px dashed var(--accent); outline-offset: 4px; }
.composer textarea { min-height: 4.5rem; max-height: 30vh; background: var(--surface); }
.composer__row { display: flex; flex-wrap: wrap; gap: 0.5rem 0.75rem; align-items: flex-end; margin-top: 0.6rem; }
.composer__attach { display: flex; align-items: flex-end; }
.composer__choice { display: flex; flex-direction: column; gap: 0.2rem; font-size: var(--step--1); flex: 1 1 9rem; min-width: 0; }
.composer__choice label { font-weight: 600; }
.composer__actions { display: flex; gap: 0.5rem; margin-left: auto; }
.composer__hint { font-size: 0.8rem; color: var(--ink-2); margin: 0.5rem 0 0; }
.attachments { list-style: none; margin: 0.5rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.attachment {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 0.6rem;
  align-items: center; padding: 0.35rem 0.4rem 0.35rem 0.35rem; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); max-width: 17rem; min-width: 12rem;
}
.attachment__thumb { grid-row: 1 / 3; width: 48px; height: 48px; object-fit: cover; border-radius: 4px; background: var(--surface-2); }
.attachment__name { font-size: 0.8rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment__state { grid-column: 2; font-size: 0.75rem; color: var(--ink-2); }
.attachment--failed { border-color: var(--stop); }
.attachment--failed .attachment__state { color: var(--stop); font-weight: 600; }
.attachment--ready .attachment__state { color: var(--ok); }
.attachment__remove {
  grid-column: 3; grid-row: 1 / 3; width: 36px; height: 36px; border-radius: 50%; border: 1px solid transparent;
  background: transparent; color: var(--ink-2); font-size: 1.2rem; line-height: 1; cursor: pointer;
}
.attachment__remove:hover { background: var(--surface-2); color: var(--ink); }

/* Phones and very low windows: the whole page scrolls, so the header gives way to the conversation. On a phone held
   upright the composer stays at the bottom of the screen; held sideways it would cover everything, so it does not. */
@media (max-width: 47.99rem), (max-height: 32rem) {
  body.has-chat { display: block; height: auto; overflow: visible; }
  body.has-chat > main, .chat { display: block; }
  .chat__side { max-height: none; }
  .thread { overflow: visible; }
}
@media (max-width: 47.99rem) and (min-height: 32.01rem) {
  .composer { position: sticky; bottom: 0; z-index: 3; box-shadow: 0 -10px 18px -16px rgba(10, 30, 40, 0.5); }
  .composer textarea { min-height: 3rem; }
  .composer__hint { display: none; }
}

/* ---------------------------------------------------------------- requirements, builds and versions */

.status {
  display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; font-weight: 650; padding: 0.1rem 0.6rem;
  border-radius: 999px; border: 1px solid var(--line-strong); color: var(--ink-2); background: var(--surface); white-space: nowrap;
}
.status--approved, .status--ready, .status--done { border-color: var(--ok); color: var(--ok); background: var(--ok-soft); }
.status--draft, .status--warn, .status--stopped { border-color: var(--warn); color: var(--warn); background: var(--warn-soft); }
.status--failed { border-color: var(--stop); color: var(--stop); background: var(--stop-soft); }
.status--queued, .status--running, .status--stop_requested, .status--checking { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }

.req-list, .build-list, .version-list { list-style: none; margin: 0 0 1rem; padding: 0; border-top: 1px solid var(--line); }
.req-list__item, .build-list li, .version-list li {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 1rem; padding: 0.6rem 0; border-bottom: 1px solid var(--line);
}
.req-list__link { display: flex; align-items: center; gap: 0.75rem; flex: 1 1 18rem; min-width: 0; min-height: 44px; color: var(--ink); text-decoration: none; }
.req-list__link:hover .req-list__title { text-decoration: underline; }
.req-list__code, .req-code { font-family: var(--mono); font-size: 0.85em; color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.req-list__title { font-weight: 600; }
.req-list__meta { font-size: var(--step--1); }

.panel--quiet { background: var(--surface-2); }
.image-list { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-wrap: wrap; gap: 1rem; }
.image-list__item { max-width: min(100%, 16rem); }
.image-list__item form { margin: 0.1rem 0 0; }
.upload-inline { align-items: flex-end; }
details.panel > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 650; }
.actions--end { justify-content: flex-end; margin-top: 1rem; }
.edit > summary { cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; font-weight: 600; color: var(--accent-strong); }
.field--inline { display: flex; flex-direction: column; gap: 0.2rem; margin: 0; max-width: 18rem; flex: 1 1 12rem; }
.field--inline label { font-weight: 600; font-size: var(--step--1); }
.inline-form.model-form, .model-form .inline-form { align-items: flex-end; }

.build-state { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.spinner { width: 0.75rem; height: 0.75rem; border-radius: 50%; background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.build-steps summary { cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; font-weight: 600; }
.build-steps ol { margin: 0.25rem 0 0.75rem; padding-left: 1.6rem; font-size: var(--step--1); color: var(--ink-2); }
.build-steps li.is-failed { color: var(--stop); }
.build-narrative { border-left: 3px solid var(--accent); padding-left: 0.85rem; color: var(--ink-2); max-height: 18rem; overflow: auto; margin-bottom: 1rem; }

.findings { list-style: none; margin: 0 0 1rem; padding: 0; }
.finding {
  display: grid; gap: 0.15rem; padding: 0.6rem 0.75rem; margin-bottom: 0.5rem;
  border-left: 4px solid var(--stop); background: var(--stop-soft); border-radius: var(--radius);
}
.finding--warning { border-left-color: var(--warn); background: var(--warn-soft); }
.finding--old { border-left-color: var(--line-strong); background: var(--surface-2); }
.finding__sev { font-size: 0.8rem; font-weight: 700; color: var(--ink-2); }
.finding__where { font-weight: 600; overflow-wrap: anywhere; }
.finding__snippet { display: block; background: var(--code-bg); padding: 0.3rem 0.5rem; border-radius: 4px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.8rem; }
.css-detail { background: var(--code-bg); padding: 0.5rem 0.75rem; border-radius: 4px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.8rem; max-height: 16rem; overflow: auto; }
.php-versions { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.php-versions > li { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.35rem 0.7rem; background: var(--surface); }
.php-versions > li.is-ok { border-color: var(--ok); }
.php-versions > li.is-failed { border-color: var(--stop); flex-basis: 100%; }
.php-versions ul { margin: 0.35rem 0 0; padding-left: 1.2rem; font-size: var(--step--1); }
.site-zips { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: 0.5rem; }
.site-zips > li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.75rem; border: 1px solid var(--line); border-radius: var(--radius); padding: 0.5rem 0.75rem; background: var(--surface); }
.site-zips__name { font-weight: 600; overflow-wrap: anywhere; }
.site-zips .inline-form { margin-left: auto; }

/* The preview (Studio 1.0): tests, pages with their screenshots before and after. */
.preview-tests, .preview-pages { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: 0.5rem; }
.preview-tests > li, .preview-page { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 0.5rem 0.75rem; }
.preview-tests > li.is-ok { border-left: 4px solid var(--ok); }
.preview-tests > li.is-failed { border-left: 4px solid var(--stop); }
.preview-tests summary, .preview-page summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; min-height: 2.75rem; }
.preview-steps { margin: 0.5rem 0; padding-left: 1.5rem; font-size: var(--step--1); }
.preview-steps .is-failed { color: var(--stop); font-weight: 600; }
.preview-page__title { font-weight: 600; }
.preview-page__open { margin: 0.5rem 0 0; }
.confirm-pages { margin: 1rem 0; padding: 0.75rem 1rem; border: 1px solid var(--warn); border-left-width: 4px; border-radius: var(--radius); background: var(--warn-soft); }
.confirm-pages h4 { margin-top: 0; }
.confirm-pages--done { border-color: var(--ok); background: var(--ok-soft); }
.confirm-pages__list { list-style: none; margin: 0.5rem 0; padding: 0; display: grid; gap: 0.5rem; }
.confirm-pages__item { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; min-height: 44px; }
.confirm-pages__choice { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 44px; cursor: pointer; }
.confirm-pages__choice input { width: 24px; height: 24px; margin: 0; flex-shrink: 0; }
.confirm-pages__name code { overflow-wrap: anywhere; }
.preview-shots { display: grid; gap: 1.25rem; margin-top: 0.75rem; }
.preview-view__title { margin: 0 0 0.35rem; font-weight: 600; }
.preview-shot { margin: 0; }
.preview-shot figcaption { font-size: var(--step--1); color: var(--ink-2); margin-bottom: 0.25rem; }
.preview-shot--single { max-width: 40rem; }
.preview-view--mobile .preview-shot--single { max-width: 16rem; }
.preview-shot--single img { display: block; width: 100%; height: auto; max-height: 32rem; object-fit: cover; object-position: top; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.preview-shot__links { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin: 0.35rem 0 0; font-size: var(--step--1); }
/* Before and after side by side, the build's screenshot as it is, with the changed areas as frames on top. */
.preview-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; align-items: start; }
.preview-view--mobile .preview-pair { max-width: 34rem; }
.preview-shot__frame { max-height: 36rem; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.preview-shot__frame:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.preview-shot__canvas { position: relative; display: block; }
.preview-shot__canvas img { display: block; width: 100%; height: auto; }
.preview-marks { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; filter: drop-shadow(0 0 1.5px rgba(255, 255, 255, 0.95)); }
.preview-marks rect { fill: rgba(222, 109, 0, 0.08); stroke: #c25400; stroke-width: 2px; vector-effect: non-scaling-stroke; }
.preview-marks-toggle { width: 1.25rem; height: 1.25rem; margin: 0 0.4rem 0 0; vertical-align: middle; accent-color: var(--accent); }
.preview-marks-label { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0 0.35rem; max-width: calc(100% - 1.75rem); min-height: 2.75rem; vertical-align: middle; cursor: pointer; font-size: var(--step--1); }
.preview-marks-toggle:not(:checked) ~ .preview-pair .preview-marks { display: none; }
.preview-warnings { margin-bottom: 1rem; }
.preview-status { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; }
.preview-open { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin: 1rem 0 1.25rem; }
.preview-setup ul { margin: 0.5rem 0 0; padding-left: 1.25rem; }
.check-progress { margin: 0.5rem 0 0; padding-left: 1.25rem; font-size: var(--step--1); color: var(--ink-2); }
@media (max-width: 40rem) {
  .preview-view--desktop .preview-pair { grid-template-columns: minmax(0, 1fr); }
}


.changes { list-style: none; margin: 0; padding: 0; }
.change { border-top: 1px solid var(--line); padding: 0.4rem 0; }
.change summary { cursor: pointer; min-height: 44px; display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; }
.change summary code { overflow-wrap: anywhere; font-weight: 600; }
.change__kind { font-size: 0.8rem; color: var(--ink-2); }
.change__stat .plus { color: var(--ok); }
.change__stat .minus { color: var(--stop); }
.removals { margin: 0.5rem 0 0; padding-left: 1.25rem; }
.removals code { overflow-wrap: anywhere; }
.diff { overflow: auto; max-height: 70vh; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.diff pre { margin: 0; padding: 0.5rem 0; font-size: 0.8rem; line-height: 1.45; }
.diff pre > span { display: block; padding: 0 0.85rem; white-space: pre; }
.diff__add { background: var(--ok-soft); }
.diff__del { background: var(--stop-soft); }
.diff__hunk { color: var(--accent-strong); background: var(--surface-2); }
.diff__cut { color: var(--ink-2); }
.diff__note { color: var(--ink-2); font-style: italic; }

/* Disclosure marks for summaries that are laid out as flex rows (they lose the browser's own marker). */
details.panel > summary::before, .change summary::before, .build-steps summary::before, .edit > summary::before {
  content: "▸"; display: inline-block; width: 1em; color: var(--ink-2); flex: none;
}
details[open].panel > summary::before, .change details[open] > summary::before, details[open].build-steps > summary::before,
details[open].edit > summary::before { content: "▾"; }
.blocking { margin: 0 0 1rem; padding-left: 1.2rem; }
.blocking li { margin-bottom: 0.35rem; }
.steps { padding-left: 1.4rem; margin: 0 0 1rem; max-width: 70ch; }
.steps > li { margin-bottom: 0.75rem; }
.steps .button { margin: 0.25rem 0.5rem 0.25rem 0; }
code.wrap { overflow-wrap: anywhere; word-break: break-all; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

@media (forced-colors: active) {
  .button--primary, .msg--assistant { border: 1px solid ButtonText; }
  meter { border: 1px solid CanvasText; }
}

/* Studio 1.1: what a connected site reported about an installation. */
.site-report__message { white-space: pre-line; overflow-wrap: anywhere; }
.checks-list { list-style: none; padding: 0; margin: 0.5rem 0 0; display: grid; gap: 0.25rem; }
.checks-list li { overflow-wrap: anywhere; }
.approvers { margin: 0.5rem 0 1rem; padding-left: 1.25rem; }
