/* SAM: black and white, in the manner of current component libraries.
 *
 * A neutral grey scale only. Rounded cards, hairline borders, soft shadows, small line icons.
 * The conversation is one centred column: what you say sits in a bubble on the right, what SAM
 * says is plain text on the left, and what SAM does appears on cards. A card's weight says how
 * much it changes: plain border for a look-up, a bar down the side for a change, a bright border
 * and hatching for a risky action. A badge on each card records what became of it.
 */

@font-face { font-family: "Inter"; src: url("fonts/Inter-Regular.otf") format("opentype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-Italic.otf") format("opentype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-Medium.otf") format("opentype"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-SemiBold.otf") format("opentype"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-Bold.otf") format("opentype"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  --sans: "Inter", "Ubuntu Sans", "Ubuntu", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: var(--sans);
  --stamp: var(--sans);
  --mono: "Geist Mono", "Ubuntu Sans Mono", "Ubuntu Mono", "DejaVu Sans Mono", ui-monospace, monospace;
  --radius: 0.625rem;

  /* Black: a neutral scale and nothing else. */
  color-scheme: dark;
  --desk: #09090B;
  --desk-2: #1C1C1F;
  --desk-line: #232326;
  --desk-ink: #FAFAFA;
  --desk-ink-2: #A1A1AA;
  --paper: #09090B;
  --sheet: #131316;
  --ink: #FAFAFA;
  --ink-2: #A1A1AA;
  --rule: #27272A;
  --rule-2: #1C1C1F;
  --margin: transparent;
  --primary: #FAFAFA;
  --primary-ink: #09090B;
  --link: #FAFAFA;
  --focus: #D4D4D8;
  --stamp-blue: #FAFAFA;
  --stamp-red: #FAFAFA;
  --stamp-green: #FAFAFA;
  --canary: #131316;
  --canary-edge: #52525B;
  --pink: #131316;
  --pink-edge: #FAFAFA;
  --code-bg: #1F1F23;
  --scrim: rgba(0, 0, 0, .7);
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 12px 32px -12px rgba(0, 0, 0, .8);
  --glow: rgba(255, 255, 255, .42);
  --grid: rgba(255, 255, 255, .035);
}

:root[data-theme="light"] {
  color-scheme: light;
  --desk: #FAFAFA;
  --desk-2: #EFEFF1;
  --desk-line: #E4E4E7;
  --desk-ink: #09090B;
  --desk-ink-2: #71717A;
  --paper: #FFFFFF;
  --sheet: #F4F4F5;
  --ink: #09090B;
  --ink-2: #71717A;
  --rule: #E4E4E7;
  --rule-2: #F0F0F2;
  --primary: #18181B;
  --primary-ink: #FAFAFA;
  --link: #09090B;
  --focus: #71717A;
  --stamp-blue: #09090B;
  --stamp-red: #09090B;
  --stamp-green: #09090B;
  --canary: #F4F4F5;
  --canary-edge: #A1A1AA;
  --pink: #F4F4F5;
  --pink-edge: #09090B;
  --code-bg: #ECECEF;
  --scrim: rgba(9, 9, 11, .35);
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 12px 32px -12px rgba(0, 0, 0, .18);
  --glow: transparent;
  --grid: rgba(0, 0, 0, .045);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 0.875rem/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.app { display: grid; grid-template-columns: 15.5rem minmax(0, 1fr); height: 100vh; height: 100dvh; }

/* ------------------------------------------------------------- the rail */

.rail { background: var(--desk); color: var(--desk-ink); display: flex; flex-direction: column; min-height: 0; }
.rail :focus-visible { outline-color: var(--desk-ink); }
.brand { font: 700 1.4375rem/1 var(--serif); letter-spacing: -0.01em; padding: 1.25rem 1.125rem 1rem; margin: 0; }
.new-chat {
  margin: 0 0.75rem 0.5rem; padding: 0.5rem 0.75rem; text-align: left; font-weight: 700;
  background: transparent; color: inherit; border: 1px solid var(--desk-line); border-radius: 3px;
}
.new-chat:hover { background: var(--desk-2); }
.chats { flex: 1; overflow-y: auto; padding: 0 0.5rem 0.5rem; min-height: 3rem; }
.chats h2 { font: 400 0.75rem/1 var(--sans); color: var(--desk-ink-2); margin: 1rem 0.625rem 0.375rem; }
.chats .empty { color: var(--desk-ink-2); padding: 0.5rem 0.625rem; margin: 0; }
.chat-row { display: flex; align-items: center; border-radius: 3px; }
.chat-row:hover, .chat-row[aria-current="true"] { background: var(--desk-2); }
.chat-link {
  flex: 1; min-width: 0; text-align: left; background: none; border: 0; color: inherit;
  padding: 0.4375rem 0.625rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 3px;
}
.chat-row.busy .chat-link::before {
  content: ""; display: inline-block; width: 0.4375rem; height: 0.4375rem; border-radius: 50%;
  background: var(--canary-edge); margin-right: 0.4375rem; vertical-align: 0.0625rem;
}
.chat-tools { display: none; padding-right: 0.25rem; }
.chat-row:hover .chat-tools, .chat-row:focus-within .chat-tools { display: flex; }
.chat-tools button {
  background: none; border: 0; color: var(--desk-ink-2); padding: 0.25rem 0.375rem; border-radius: 3px; font-size: 0.75rem;
}
.chat-tools button:hover { color: var(--desk-ink); background: var(--desk-line); }
.chat-rename { flex: 1; min-width: 0; margin: 0.125rem; padding: 0.3125rem 0.5rem; border: 1px solid var(--desk-ink-2); border-radius: 3px; background: var(--desk); color: var(--desk-ink); }

.pc { border-top: 1px solid var(--desk-line); padding: 0.75rem 1.125rem 0.625rem; }
.pc h2 { font: 400 0.75rem/1 var(--sans); color: var(--desk-ink-2); margin: 0 0 0.5rem; }
.meters { margin: 0; }
.meter { display: grid; grid-template-columns: 4.25rem 1fr 2.375rem; align-items: center; gap: 0.5rem; font-size: 0.8125rem; margin: 0.3125rem 0; }
.meter dt, .meter dd { margin: 0; }
.meter .bar { height: 0.375rem; background: var(--desk-2); border-radius: 1px; overflow: hidden; }
.meter .bar i { display: block; height: 100%; width: 0; background: var(--desk-ink-2); transition: width 0.4s; }
.meter .bar i.high { background: var(--canary-edge); }
.meter .bar i.full { background: #E0776C; }
.meter .num { text-align: right; font-variant-numeric: tabular-nums; color: var(--desk-ink-2); }

.rail-nav { display: flex; flex-direction: column; padding: 0.375rem 0.5rem 0.75rem; border-top: 1px solid var(--desk-line); }
.rail-nav button { text-align: left; background: none; border: 0; color: inherit; padding: 0.4375rem 0.625rem; border-radius: 3px; }
.rail-nav button:hover { background: var(--desk-2); }
.rail-nav .count { color: var(--desk-ink-2); margin-left: 0.25rem; }

/* ------------------------------------------------------------ the sheet */

.sheet { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.top { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 1.5rem; border-bottom: 1px solid var(--rule); min-height: 3rem; }
.top h1 { font: 700 1rem/1.25 var(--sans); margin: 0; flex: 1 1 8rem; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-open { display: none; background: none; border: 1px solid var(--rule); border-radius: 3px; padding: 0.3125rem 0.625rem; }
.model-chip { background: none; border: 1px solid var(--rule); border-radius: 3px; padding: 0.3125rem 0.625rem; font-size: 0.8125rem; color: var(--ink-2); max-width: 18rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.model-chip:hover { border-color: var(--ink-2); color: var(--ink); }
.model-chip.warn { border-color: var(--stamp-red); color: var(--stamp-red); }

.log { flex: 1; overflow-y: auto; min-height: 0; }
.log-inner { max-width: 54rem; margin: 0 auto; padding: 1.25rem 1.5rem 2rem; position: relative; min-height: 100%; }
.log-inner::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: calc(1.5rem + 6rem + 0.625rem); width: 1px;
  background: var(--margin);
}
.entry { display: grid; grid-template-columns: 6rem minmax(0, 1fr); column-gap: 1.25rem; padding: 0.5rem 0; }
.entry.you { border-top: 1px solid var(--rule); margin-top: 0.75rem; padding-top: 1.25rem; }
.entry.you:first-child { border-top: 0; margin-top: 0; padding-top: 0.5rem; }
.who { text-align: right; font-size: 0.8125rem; line-height: 1.625rem; color: var(--ink-2); }
.who b { display: block; color: var(--ink); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who time { font-variant-numeric: tabular-nums; display: block; line-height: 1.2; }
.who .via { display: block; font-size: 0.75rem; line-height: 1.5; }
.said { min-width: 0; }
.you .said { font: 400 1rem/1.625 var(--sans); white-space: pre-wrap; overflow-wrap: anywhere; max-width: 40rem; }
.divider { grid-column: 1 / -1; text-align: center; font-size: 0.8125rem; color: var(--ink-2); padding: 0.75rem 0; }

/* what is said */
.prose { font: 400 1rem/1.625 var(--serif); max-width: 40rem; overflow-wrap: anywhere; margin: 0 0 0.625rem; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p { margin: 0 0 0.75rem; }
.prose h2, .prose h3, .prose h4, .prose h5 { font-family: var(--serif); font-weight: 700; line-height: 1.25; margin: 1.375rem 0 0.5rem; }
.prose h2 { font-size: 1.3125rem; }
.prose h3 { font-size: 1.125rem; }
.prose h4, .prose h5 { font-size: 1rem; }
.prose ul, .prose ol { margin: 0 0 0.75rem; padding-left: 1.375rem; }
.prose li { margin: 0.1875rem 0; }
.prose li > ul, .prose li > ol { margin: 0.1875rem 0 0; }
.prose a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
.prose code { font: 0.8125em var(--mono); background: var(--code-bg); padding: 0.0625rem 0.25rem; border-radius: 2px; }
.prose blockquote { margin: 0 0 0.75rem; padding: 0 0 0 0.875rem; border-left: 2px solid var(--rule); color: var(--ink-2); }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 1rem 0; }
.prose .tick { font-family: var(--sans); }
.prose .table-wrap { overflow-x: auto; margin: 0 0 0.75rem; }
.prose table { border-collapse: collapse; font: 0.875rem/1.4 var(--sans); }
.prose th, .prose td { text-align: left; padding: 0.375rem 1rem 0.375rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.prose th { font-weight: 700; border-bottom-color: var(--ink-2); }
.prose .al-right { text-align: right; }
.prose .al-center { text-align: center; }
.prose td code, .prose th code { white-space: nowrap; }
.code { margin: 0 0 0.75rem; border: 1px solid var(--rule); background: var(--sheet); border-radius: 3px; font-family: var(--sans); }
.code-bar { display: flex; justify-content: space-between; align-items: center; font-size: 0.75rem; color: var(--ink-2); padding: 0.1875rem 0.375rem 0.1875rem 0.75rem; border-bottom: 1px solid var(--rule-2); }
.code pre { margin: 0; padding: 0.625rem 0.75rem; overflow-x: auto; }
.code pre code { font: 0.8125rem/1.55 var(--mono); background: none; padding: 0; }
.copy { background: none; border: 0; color: var(--ink-2); padding: 0.1875rem 0.4375rem; border-radius: 2px; font-size: 0.75rem; }
.copy:hover { color: var(--ink); background: var(--rule-2); }
.prose.live > :last-child::after { content: ""; display: inline-block; width: 0.4375rem; height: 1em; margin-left: 0.125rem; background: var(--ink-2); vertical-align: -0.125em; animation: blink 1s steps(2, start) infinite; }

/* what is done: slips */
.slip {
  --slip-bg: var(--sheet); --slip-edge: var(--rule);
  margin: 0.25rem 0 0.75rem; max-width: 40rem; background: var(--slip-bg); border: 1px solid var(--slip-edge); border-radius: 2px;
}
.slip.change { --slip-bg: var(--canary); --slip-edge: var(--canary-edge); }
.slip.danger { --slip-bg: var(--pink); --slip-edge: var(--pink-edge); }
.slip-head { display: flex; align-items: center; gap: 0.75rem; padding: 0.4375rem 0.5rem 0 0.75rem; min-height: 1.875rem; }
.slip-kind { font-size: 0.8125rem; color: var(--ink-2); flex: 1; min-width: 0; }
.slip.change .slip-kind, .slip.danger .slip-kind { color: var(--ink); }
.slip-stamps { display: flex; gap: 0.375rem; align-items: center; }
.slip-body { margin: 0; padding: 0.125rem 0.75rem 0.5625rem; font: 0.8125rem/1.55 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.slip-body.plain { font: 0.9375rem/1.45 var(--sans); }
.slip-extra { margin: 0 0.75rem 0.625rem; border: 1px solid var(--slip-edge); background: var(--sheet); border-radius: 2px; }
.slip-extra summary, .slip-out summary { padding: 0.3125rem 0.625rem; font-size: 0.8125rem; color: var(--ink-2); cursor: pointer; }
.slip-extra pre { margin: 0; padding: 0 0.625rem 0.5rem; font: 0.78125rem/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 16rem; overflow: auto; }
.slip-why { margin: 0; padding: 0 0.75rem 0.625rem; font-size: 0.9375rem; line-height: 1.4; }
.slip-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0 0.75rem 0.75rem; align-items: center; }
.slip-out { border-top: 1px dashed var(--slip-edge); }
.slip-out summary { padding: 0.375rem 0.75rem; }
.slip-out pre { margin: 0; padding: 0 0.75rem 0.625rem; font: 0.78125rem/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 20rem; overflow: auto; }

.stamp {
  font: 700 0.75rem/1 var(--stamp); letter-spacing: 0.09em; text-transform: uppercase; white-space: nowrap;
  border: 1.5px solid currentColor; border-radius: 3px; padding: 0.25rem 0.375rem 0.1875rem; display: inline-block;
  transform: rotate(-3deg); color: var(--ink-2);
}
.stamp.blue { color: var(--stamp-blue); }
.stamp.green { color: var(--stamp-green); }
.stamp.red { color: var(--stamp-red); }
.stamp.pending { transform: none; border-style: dashed; }
.stamp.fresh { animation: press 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.25) both; }
.dots::after { content: "..."; display: inline-block; overflow: hidden; vertical-align: bottom; width: 0; animation: dots 1.4s steps(4, end) infinite; }

.status-line { font: 0.875rem/1.5 var(--sans); color: var(--ink-2); margin: 0.125rem 0 0.5rem; }
.note { margin: 0.25rem 0 0.75rem; padding: 0.5rem 0.75rem; border-left: 3px solid var(--rule); font: 0.875rem/1.45 var(--sans); color: var(--ink-2); max-width: 40rem; }
.note.error { border-left-color: var(--stamp-red); color: var(--ink); background: var(--pink); }
.note .btn { margin-top: 0.5rem; }

/* buttons */
.btn { font: 700 0.875rem/1 var(--sans); padding: 0.5rem 0.875rem; border-radius: 3px; border: 1px solid var(--ink); background: transparent; color: var(--ink); }
.btn:hover { background: color-mix(in srgb, var(--ink) 9%, transparent); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--primary) 88%, black); }
.btn.stop { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn.quiet { border-color: transparent; font-weight: 400; text-decoration: underline; text-underline-offset: 2px; padding-left: 0.25rem; padding-right: 0.25rem; }
.btn:disabled { opacity: 0.5; cursor: default; }

/* the empty sheet */
.welcome { max-width: 54rem; margin: 0 auto; padding: 11vh 1.5rem 2rem calc(1.5rem + 7.25rem); }
.welcome h2 { font: 700 clamp(2.25rem, 5vw, 3.25rem)/1.08 var(--serif); letter-spacing: -0.015em; margin: 0 0 0.875rem; }
.welcome .lead { font: 400 1.0625rem/1.55 var(--serif); color: var(--ink-2); margin: 0 0 2rem; max-width: 33rem; }
.tries { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); max-width: 40rem; }
.tries li { border-bottom: 1px solid var(--rule); }
.tries button { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 1rem; width: 100%; text-align: left; background: none; border: 0; padding: 0.625rem 0.5rem 0.625rem 0; font: 400 1rem/1.4 var(--serif); }
.tries button span { font: 400 0.8125rem/1.72 var(--sans); color: var(--ink-2); }
.tries button:hover { background: var(--sheet); }

/* the composer */
.composer { padding: 0.75rem 0 0.875rem; border-top: 1px solid var(--rule); }
.composer-inner { max-width: 54rem; margin: 0 auto; padding: 0 1.5rem 0 calc(1.5rem + 7.25rem); }
.field { display: flex; align-items: flex-end; gap: 0.5rem; max-width: 40rem; background: var(--sheet); border: 1px solid var(--ink-2); border-radius: 3px; padding: 0.3125rem 0.3125rem 0.3125rem 0.75rem; }
.field:focus-within { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.field textarea { flex: 1; min-width: 0; border: 0; background: transparent; resize: none; outline: none; font: 400 1rem/1.5 var(--sans); padding: 0.3125rem 0; max-height: 12rem; }
.field textarea::placeholder { color: var(--ink-2); opacity: 0.85; }
.brand-full { margin: -0.25rem 1.125rem 0.875rem; font: 400 0.75rem/1.3 var(--sans); color: var(--rail-ink-2, inherit); opacity: 0.75; }
.btn.mic[aria-pressed="true"] { background: var(--stamp-red); border-color: var(--stamp-red); color: var(--sheet); }
.voice-line { display: flex; align-items: center; gap: 0.75rem; max-width: 40rem; min-height: 1.875rem; margin-top: 0.5rem; font-size: 0.875rem; color: var(--ink-2); }
.voice-line[hidden] { display: none; }
.voice-line .stamp.red { border-style: solid; }
.voice-line .vu { flex: none; width: 6rem; height: 0.375rem; background: var(--rule); border-radius: 1px; overflow: hidden; }
.voice-line .vu i { display: block; height: 100%; width: 0; background: var(--stamp-red); transition: width 0.09s linear; }
.voice-line .voice-text { flex: 1; min-width: 0; }
.voice-line button { background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 2px; color: var(--ink-2); font-size: 0.8125rem; white-space: nowrap; }
.voice-line button:hover { color: var(--ink); }
.hands-free { display: inline-flex; align-items: center; gap: 0.375rem; cursor: pointer; white-space: nowrap; }
.hands-free input { margin: 0; accent-color: var(--primary); }
.composer-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem 0.75rem; margin-top: 0.5rem; font-size: 0.8125rem; color: var(--ink-2); max-width: 40rem; }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 3px; margin: 0; padding: 0; min-width: 0; }
.seg label { padding: 0.25rem 0.625rem; cursor: pointer; border-left: 1px solid var(--rule); position: relative; white-space: nowrap; }
.seg label:first-of-type { border-left: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--ink); color: var(--paper); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }
.auto-chip { background: var(--canary); border: 1px solid var(--canary-edge); color: var(--ink); padding: 0.1875rem 0.25rem 0.1875rem 0.5rem; border-radius: 2px; }
.auto-chip button { background: none; border: 0; text-decoration: underline; padding: 0 0.25rem; }
.jump { position: absolute; left: 50%; bottom: 7.5rem; transform: translateX(-50%); background: var(--sheet); border: 1px solid var(--ink-2); border-radius: 3px; padding: 0.375rem 0.75rem; font-size: 0.8125rem; z-index: 5; }

/* dialogs */
dialog { border: 1px solid var(--ink-2); border-radius: 3px; background: var(--paper); color: var(--ink); padding: 0; width: min(40rem, calc(100vw - 2rem)); max-height: calc(100dvh - 3rem); }
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: var(--scrim); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem 0.75rem; border-bottom: 1px solid var(--rule); }
.dlg-head h2 { font: 700 1.375rem/1.2 var(--serif); margin: 0; }
.dlg-close { background: none; border: 1px solid transparent; border-radius: 3px; padding: 0.25rem 0.5rem; font-size: 0.875rem; color: var(--ink-2); }
.dlg-close:hover { border-color: var(--rule); color: var(--ink); }
.dlg-body { padding: 1rem 1.25rem 1.25rem; overflow-y: auto; min-height: 0; }
.dlg-body:focus-visible, dialog:focus-visible { outline: none; }
.dlg-body > p { margin: 0 0 0.75rem; max-width: 34rem; }
.dlg-foot { padding: 0.75rem 1.25rem; border-top: 1px solid var(--rule); display: flex; gap: 0.5rem; justify-content: flex-end; align-items: center; }
.dlg-foot .status, .dlg-foot .quiet { margin-right: auto; }
.dlg-body h3 { font: 700 1rem/1.3 var(--sans); margin: 1.5rem 0 0.375rem; }
.dlg-body h3:first-child { margin-top: 0; }
.dlg-body h3 .step { display: inline-block; min-width: 1.375rem; color: var(--ink-2); font-weight: 400; }
.fld { display: block; margin: 0.625rem 0; font-size: 0.875rem; }
.fld input, .fld textarea, .fld select, .add-row input {
  display: block; width: 100%; margin-top: 0.25rem; padding: 0.4375rem 0.625rem; border: 1px solid var(--ink-2); border-radius: 3px;
  background: var(--sheet); font-size: 0.9375rem;
}
.fld textarea { min-height: 4.5rem; resize: vertical; }
.row { display: flex; gap: 0.5rem; align-items: flex-end; }
.row .fld { flex: 1; margin-bottom: 0; }
.row .btn { margin-bottom: 0.0625rem; white-space: nowrap; }
.choice { display: grid; grid-template-columns: 1.125rem minmax(0, 1fr); gap: 0.5rem; padding: 0.5rem 0.625rem; border: 1px solid var(--rule); border-radius: 3px; margin: 0.375rem 0; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--ink); background: var(--sheet); }
.choice input { margin: 0.1875rem 0 0; accent-color: var(--primary); }
.choice b { display: block; }
.choice small { display: block; color: var(--ink-2); font-size: 0.8125rem; line-height: 1.4; margin-top: 0.125rem; }
.hint { color: var(--ink-2); font-size: 0.8125rem; margin: 0.25rem 0 0; }
.hint a, .dlg-body p a { color: var(--link); }
.status { font-size: 0.875rem; margin: 0.5rem 0 0; min-height: 1.25rem; }
.status.ok { color: var(--stamp-green); }
.status.bad { color: var(--stamp-red); }
.service-fields { margin: 0.25rem 0 0; padding: 0.125rem 0 0 1.625rem; }
.items { list-style: none; margin: 0 0 1rem; padding: 0; border-top: 1px solid var(--rule); }
.items li { display: flex; gap: 0.75rem; align-items: baseline; padding: 0.5rem 0; border-bottom: 1px solid var(--rule); }
.items li .what { flex: 1; min-width: 0; font: 400 1rem/1.45 var(--serif); overflow-wrap: anywhere; }
.items li .when { font-size: 0.8125rem; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.items li button { background: none; border: 0; text-decoration: underline; color: var(--ink-2); padding: 0; font-size: 0.8125rem; white-space: nowrap; }
.items li button:hover { color: var(--stamp-red); }
.items .none { color: var(--ink-2); display: block; }
.items li .what small { display: block; font: 400 0.8125rem/1.4 var(--sans); color: var(--ink-2); }
.items li .acts { display: flex; gap: 0.75rem; }
.items li .acts button:hover { color: var(--ink); }
.items li .acts button.parting:hover { color: var(--stamp-red); }
.kinds { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.kinds li { border-bottom: 1px solid var(--rule); }
.kinds button { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: 1rem; width: 100%; text-align: left; background: none; border: 0; padding: 0.625rem 0.25rem 0.625rem 0; }
.kinds button:hover { background: var(--sheet); }
.kinds b { font: 700 0.9375rem/1.4 var(--sans); }
.kinds span { font-size: 0.8125rem; line-height: 1.45; color: var(--ink-2); }
.steps { margin: 0 0 0.75rem; padding-left: 1.25rem; font-size: 0.875rem; line-height: 1.5; max-width: 34rem; }
.steps li { margin: 0.25rem 0; }
.fld small.hint { display: block; }
.check-row { display: flex; gap: 0.5rem; align-items: center; margin: 0.75rem 0; font-size: 0.875rem; cursor: pointer; }
.check-row input { margin: 0; accent-color: var(--primary); }
.add-row { display: flex; gap: 0.5rem; align-items: flex-end; flex-wrap: wrap; }
.add-row .grow { flex: 1; min-width: 12rem; }
.add-row label { font-size: 0.875rem; }
.add-row input { margin-top: 0.25rem; }
.add-row .narrow { width: 6.5rem; }

/* locked page */
.locked { max-width: 34rem; margin: 14vh auto 0; padding: 0 1.5rem; }
.locked h1 { font: 700 2.25rem/1.1 var(--serif); margin: 0 0 1rem; }
.locked p { font: 400 1.0625rem/1.55 var(--serif); margin: 0 0 1rem; }
.locked code { font: 0.875rem var(--mono); background: var(--code-bg); padding: 0.125rem 0.375rem; border-radius: 2px; }

/* pop-up notes */
.toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: 0.5rem; z-index: 60; width: min(22rem, calc(100vw - 2rem)); }
.toast { background: var(--canary); border: 1px solid var(--canary-edge); color: var(--ink); padding: 0.625rem 0.75rem; border-radius: 2px; }
.toast.plain { background: var(--sheet); border-color: var(--ink-2); }
.toast b { display: block; font-weight: 700; }
.toast p { margin: 0.125rem 0 0.375rem; font: 400 1rem/1.4 var(--serif); overflow-wrap: anywhere; }
.toast button { background: none; border: 0; padding: 0; text-decoration: underline; font-size: 0.8125rem; }

@keyframes press { from { transform: rotate(-3deg) scale(1.4); opacity: 0; } to { transform: rotate(-3deg) scale(1); opacity: 1; } }
@keyframes blink { to { visibility: hidden; } }
@keyframes dots { to { width: 1.3em; } }

@media (prefers-reduced-motion: reduce) {
  .stamp.fresh, .prose.live > :last-child::after { animation: none; }
  .dots::after { animation: none; width: auto; }
  .meter .bar i, .voice-line .vu i { transition: none; }
}

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; inset: 0 auto 0 0; width: 17rem; transform: translateX(-100%); transition: transform 0.2s; z-index: 30; }
  .app.rail-shown .rail { transform: none; }
  .app.rail-shown::after { content: ""; position: fixed; inset: 0; background: var(--scrim); z-index: 20; }
  .rail-open { display: block; }
  .top { padding-left: 1rem; padding-right: 1rem; }
  .log-inner { padding: 1rem 1rem 1.5rem; }
  .log-inner::before { display: none; }
  .entry { grid-template-columns: minmax(0, 1fr); }
  .who { text-align: left; display: flex; gap: 0.5rem; align-items: baseline; }
  .who time { display: inline; }
  .composer-inner { padding: 0 1rem; }
  .welcome { padding: 6vh 1rem 1.5rem; }
  .tries button { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .seg { flex-wrap: wrap; }
  .who .via { display: inline; }
  .kinds button { grid-template-columns: minmax(0, 1fr); gap: 0.125rem; }
}
@media (max-width: 560px) { .model-chip { display: none; } }
@media (prefers-reduced-motion: reduce) { .rail { transition: none; } }

/* ------------------------------------------------------------------ the modern skin */

::selection { background: var(--ink); color: var(--paper); }
* { scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
body { font-size: 0.875rem; letter-spacing: -0.003em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 0.375rem; }
a { text-underline-offset: 3px; }

/* line icons, drawn as masks so they take the colour of the text around them */
:root {
  --i-plus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E");
  --i-plug: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 2v6M15 2v6M6 8h12v3a6 6 0 0 1-12 0zM12 17v5'/%3E%3C/svg%3E");
  --i-note: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 3h10l4 4v14H5zM9 12h6M9 16h6'/%3E%3C/svg%3E");
  --i-bell: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 17V11a6 6 0 0 1 12 0v6l2 2H4zM10 21h4'/%3E%3C/svg%3E");
  --i-gear: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9l2.1 2.1M17 17l2.1 2.1M4.9 19.1 7 17M17 7l2.1-2.1'/%3E%3C/svg%3E");
  --i-mic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='2' width='6' height='12' rx='3'/%3E%3Cpath d='M5 11a7 7 0 0 0 14 0M12 18v4'/%3E%3C/svg%3E");
  --i-up: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 19V5M5 12l7-7 7 7'/%3E%3C/svg%3E");
}
.new-chat::before, .rail-nav button::before, #mic::before, #send:not(.stop)::before {
  content: ""; display: inline-block; flex: none; width: 1rem; height: 1rem; background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat;
}
.new-chat { --icon: var(--i-plus); }
.rail-nav [data-dialog="apps"] { --icon: var(--i-plug); }
.rail-nav [data-dialog="notes"] { --icon: var(--i-note); }
.rail-nav [data-dialog="reminders"] { --icon: var(--i-bell); }
.rail-nav [data-dialog="settings"] { --icon: var(--i-gear); }
#mic { --icon: var(--i-mic); }
#send { --icon: var(--i-up); }

/* the side panel */
.rail { border-right: 1px solid var(--desk-line); }
.brand { font: 700 1.125rem/1 var(--sans); letter-spacing: 0.02em; padding: 1.125rem 1rem 0.25rem; display: flex; align-items: center; gap: 0.5rem; }
.brand::before { content: ""; width: 1.5rem; height: 1.5rem; border-radius: 0.4375rem; background: var(--desk-ink) radial-gradient(circle, var(--desk) 0 22%, transparent 24%); }
.brand-full { margin: 0 1rem 1rem; color: var(--desk-ink-2); opacity: 1; font-size: 0.75rem; }
.new-chat { display: flex; align-items: center; gap: 0.5rem; margin: 0 0.75rem 0.75rem; padding: 0.5rem 0.75rem; border-radius: calc(var(--radius) - 2px); border-color: var(--desk-line); background: var(--desk-2); font-weight: 500; }
.new-chat:hover { background: var(--desk-line); }
.chats { padding: 0 0.5rem 0.5rem; }
.chats h2 { font-weight: 500; }
.chat-row, .chat-link, .rail-nav button { border-radius: calc(var(--radius) - 2px); }
.chat-row[aria-current="true"] { background: var(--desk-2); }
.chat-row.busy .chat-link::before { background: var(--desk-ink); animation: blink 1s steps(2, start) infinite; }
.pc { margin: 0 0.75rem 0.5rem; padding: 0.75rem; border: 1px solid var(--desk-line); border-radius: var(--radius); }
.pc h2 { font-weight: 500; }
.meter { grid-template-columns: 4.25rem 1fr 2.25rem; font-size: 0.75rem; }
.meter .bar { height: 0.25rem; border-radius: 999px; background: var(--desk-line); }
.meter .bar i { border-radius: 999px; }
.meter .bar i, .meter .bar i.high, .meter .bar i.full { background: var(--desk-ink); }
.meter .num { font-family: var(--mono); font-size: 0.6875rem; }
.rail-nav { border-top: 0; padding: 0 0.5rem 0.75rem; gap: 1px; }
.rail-nav button { display: flex; align-items: center; gap: 0.625rem; padding: 0.5rem 0.625rem; color: var(--desk-ink-2); }
.rail-nav button:hover { color: var(--desk-ink); }
.rail-nav .count { margin-left: auto; font: 500 0.6875rem/1 var(--mono); background: var(--desk-2); color: var(--desk-ink); padding: 0.1875rem 0.375rem; border-radius: 999px; }
.rail-nav .count:empty { display: none; }

/* the conversation: one centred column */
.top { border-bottom-color: var(--rule-2); padding: 0.5rem 1.25rem; min-height: 3.25rem; }
.top h1 { font-weight: 500; font-size: 0.875rem; }
.model-chip, .rail-open { border-radius: 999px; padding: 0.3125rem 0.75rem; font-size: 0.75rem; }
.model-chip.warn { border-style: dashed; border-color: var(--ink); color: var(--ink); }
.log-inner { max-width: 48rem; padding: 1.5rem 1.5rem 2rem; }
.log-inner::before { display: none; }
.entry { display: block; padding: 0.375rem 0; }
.entry.you, .entry.you:first-child { border-top: 0; margin-top: 1.25rem; padding-top: 0; }
.entry.you:first-child { margin-top: 0; }
.who { text-align: left; display: flex; align-items: baseline; gap: 0.5rem; line-height: 1.25rem; margin-bottom: 0.25rem; font-size: 0.75rem; }
.who b { display: inline; font-weight: 600; font-size: 0.8125rem; }
.who time, .who .via { display: inline; font-family: var(--sans); font-size: 0.75rem; line-height: inherit; }
.who .via { border: 1px solid var(--rule); border-radius: 999px; padding: 0 0.4375rem; }
.you .who { justify-content: flex-end; }
.you .who b { display: none; }
.you .said { margin-left: auto; width: fit-content; max-width: min(34rem, 85%); background: var(--sheet); border: 1px solid var(--rule); border-radius: 1.125rem 1.125rem 0.25rem 1.125rem; padding: 0.5625rem 0.875rem; font-size: 0.9375rem; line-height: 1.55; }
.prose { font-size: 0.9375rem; line-height: 1.65; max-width: 44rem; }
.prose h2 { font-size: 1.25rem; letter-spacing: -0.02em; font-weight: 600; }
.prose h3 { font-size: 1.0625rem; letter-spacing: -0.01em; font-weight: 600; }
.prose code { border-radius: 0.3125rem; padding: 0.125rem 0.3125rem; }
.prose th { font-weight: 500; color: var(--ink-2); border-bottom-color: var(--rule); }
.prose .table-wrap { border: 1px solid var(--rule); border-radius: var(--radius); }
.prose table { width: 100%; }
.prose th, .prose td { padding: 0.5rem 0.875rem; }
.prose tr:last-child td { border-bottom: 0; }
.code { border-radius: var(--radius); overflow: hidden; background: var(--sheet); }
.copy { border-radius: 0.375rem; }

/* cards for what SAM does */
.slip { max-width: 44rem; border-radius: var(--radius); background: var(--sheet); border-color: var(--rule); overflow: hidden; }
.slip.change { border-color: var(--canary-edge); box-shadow: inset 3px 0 0 var(--ink-2); padding-left: 3px; }
.slip.danger {
  border-color: var(--ink); box-shadow: inset 3px 0 0 var(--ink); padding-left: 3px;
  background-image: repeating-linear-gradient(135deg, color-mix(in srgb, var(--ink) 7%, transparent) 0 1px, transparent 1px 10px);
}
.slip-head { padding: 0.5rem 0.625rem 0 0.875rem; }
.slip-kind { font-size: 0.75rem; font-weight: 500; }
.slip.danger .slip-kind { font-weight: 600; color: var(--ink); }
.slip-body { padding: 0.125rem 0.875rem 0.625rem; }
.slip-body.plain { font-size: 0.875rem; }
.slip-why { padding: 0 0.875rem 0.75rem; font-size: 0.875rem; color: var(--ink-2); }
.slip.danger .slip-why { color: var(--ink); }
.slip-actions { padding: 0 0.875rem 0.875rem; }
.slip-extra { margin: 0 0.875rem 0.75rem; background: var(--paper); border-color: var(--rule); border-radius: calc(var(--radius) - 2px); }
.slip-out { border-top: 1px solid var(--rule-2); }

/* badges */
.stamp { transform: none; font: 500 0.6875rem/1 var(--sans); letter-spacing: 0; text-transform: none; border-width: 1px; border-color: var(--rule); border-radius: 999px; padding: 0.25rem 0.5rem; color: var(--ink-2); }
.stamp.blue { color: var(--ink); }
.stamp.green { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.stamp.red { color: var(--ink); border-color: var(--ink); text-decoration: line-through; }
.stamp.pending, .voice-line .stamp { text-decoration: none; border-style: dashed; border-color: var(--ink-2); }
.voice-line .stamp.red { border-style: solid; background: var(--ink); border-color: var(--ink); color: var(--paper); }
@keyframes press { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: none; } }

.status-line { font-size: 0.8125rem; }
.note { border: 1px solid var(--rule); border-left: 1px solid var(--rule); border-radius: var(--radius); background: var(--sheet); max-width: 44rem; }
.note.error { background: var(--sheet); border-color: var(--ink); color: var(--ink); }
.status.ok::before { content: "✓ "; }
.status.bad { font-weight: 600; }
.status.bad::before { content: "! "; }

/* buttons */
.btn { font: 500 0.8125rem/1 var(--sans); padding: 0.5625rem 0.875rem; border-radius: calc(var(--radius) - 2px); border-color: var(--rule); background: var(--paper); transition: background-color 0.12s, border-color 0.12s, color 0.12s; }
.btn:hover { background: var(--sheet); border-color: var(--ink-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--primary) 85%, var(--paper)); border-color: transparent; }
.btn.stop { background: var(--sheet); border-color: var(--ink); color: var(--ink); }
.btn.quiet { background: none; }
.btn.quiet:hover { background: none; border-color: transparent; color: var(--ink); }

/* the start screen */
.welcome { max-width: 48rem; padding: 14vh 1.5rem 2rem; }
.welcome h2 { font: 600 clamp(2rem, 4.2vw, 2.75rem)/1.1 var(--sans); letter-spacing: -0.035em; margin-bottom: 0.75rem; }
.welcome .lead { font-size: 1rem; line-height: 1.55; max-width: 34rem; margin-bottom: 1.75rem; }
.tries { border-top: 0; max-width: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.625rem; }
.tries li { border-bottom: 0; }
.tries button { display: flex; flex-direction: column; gap: 0.25rem; height: 100%; padding: 0.75rem 0.875rem; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); font: 400 0.875rem/1.4 var(--sans); transition: background-color 0.12s, border-color 0.12s; }
.tries button span { font: 500 0.6875rem/1.4 var(--sans); color: var(--ink-2); }
.tries button:hover { background: var(--sheet); border-color: var(--ink-2); }

/* the message box */
.composer { border-top: 0; padding: 0 0 1rem; background: linear-gradient(transparent, var(--paper) 1.25rem); }
.composer-inner { max-width: 48rem; padding: 0 1.5rem; }
.field { max-width: none; align-items: center; gap: 0.375rem; border-color: var(--rule); border-radius: 1.25rem; padding: 0.4375rem 0.4375rem 0.4375rem 1rem; box-shadow: var(--shadow); }
.field:focus-within { border-color: var(--ink-2); box-shadow: var(--shadow); }
.field textarea { font-size: 0.9375rem; padding: 0.4375rem 0; }
#mic, #send { display: inline-flex; align-items: center; gap: 0.375rem; border-radius: 999px; padding: 0.5625rem 0.875rem; }
#mic { background: transparent; }
#mic:hover { background: var(--paper); }
.btn.mic[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); animation: ring 1.6s ease-out infinite; }
@keyframes ring { from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ink) 50%, transparent); } to { box-shadow: 0 0 0 10px transparent; } }
.voice-line { max-width: none; padding: 0 0.5rem; }
.voice-line .vu { height: 0.25rem; border-radius: 999px; }
.voice-line .vu i { background: var(--ink); border-radius: 999px; }
.composer-foot { max-width: none; padding: 0 0.5rem; margin-top: 0.625rem; font-size: 0.75rem; }
.seg { border: 0; background: var(--sheet); padding: 0.1875rem; border-radius: 0.5625rem; gap: 0.125rem; }
.seg label { border-left: 0; border-radius: 0.4375rem; padding: 0.25rem 0.625rem; transition: background-color 0.12s, color 0.12s; }
.seg label:has(input:checked) { background: var(--paper); color: var(--ink); box-shadow: 0 0 0 1px var(--rule); }
.seg label:has(input:focus-visible) { outline-offset: 0; }
.hands-free { margin-left: auto; gap: 0.5rem; }
.hands-free input, .check-row input {
  appearance: none; -webkit-appearance: none; flex: none; width: 1.875rem; height: 1.125rem; border-radius: 999px;
  background: var(--rule); position: relative; cursor: pointer; transition: background-color 0.15s;
}
.hands-free input::after, .check-row input::after {
  content: ""; position: absolute; top: 0.125rem; left: 0.125rem; width: 0.875rem; height: 0.875rem; border-radius: 50%;
  background: var(--paper); box-shadow: 0 1px 2px rgba(0, 0, 0, .4); transition: transform 0.15s;
}
.hands-free input:checked, .check-row input:checked { background: var(--ink); }
.hands-free input:checked::after, .check-row input:checked::after { transform: translateX(0.75rem); }
.auto-chip { background: var(--sheet); border-color: var(--rule); border-radius: 999px; padding: 0.1875rem 0.375rem 0.1875rem 0.625rem; }
.jump { background: var(--paper); border-color: var(--rule); border-radius: 999px; box-shadow: var(--shadow); }

/* dialogs */
dialog { border-color: var(--rule); border-radius: 0.875rem; background: var(--paper); box-shadow: var(--shadow); overflow: hidden; }
dialog::backdrop { backdrop-filter: blur(4px); }
.dlg-head { border-bottom-color: var(--rule-2); padding: 1.125rem 1.5rem 0.875rem; }
.dlg-head h2 { font: 600 1.125rem/1.2 var(--sans); letter-spacing: -0.015em; }
.dlg-close { border-radius: 0.5rem; }
.dlg-body { padding: 1.125rem 1.5rem 1.5rem; }
.dlg-foot { border-top-color: var(--rule-2); padding: 0.875rem 1.5rem; background: var(--sheet); }
.dlg-body h3 { font-weight: 600; font-size: 0.9375rem; letter-spacing: -0.01em; margin-top: 1.75rem; }
.fld { font-weight: 500; font-size: 0.8125rem; }
.fld input, .fld textarea, .fld select, .add-row input { margin-top: 0.375rem; padding: 0.5rem 0.75rem; border-color: var(--rule); border-radius: calc(var(--radius) - 2px); background: var(--paper); font-size: 0.875rem; font-weight: 400; }
.fld input:focus, .fld textarea:focus, .fld select:focus, .add-row input:focus { border-color: var(--ink-2); outline: 2px solid color-mix(in srgb, var(--focus) 35%, transparent); outline-offset: 0; }
.choice { border-radius: var(--radius); padding: 0.75rem 0.875rem; }
.choice:has(input:checked) { border-color: var(--ink); background: var(--sheet); }
.choice input, .seg input { accent-color: var(--ink); }
.items, .kinds { border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.items li, .kinds li { border-bottom: 1px solid var(--rule-2); }
.items li:last-child, .kinds li:last-child { border-bottom: 0; }
.items li { padding: 0.625rem 0.875rem; align-items: center; }
.items li .what { font: 500 0.875rem/1.45 var(--sans); }
.items li .what small { font-weight: 400; }
.items li button { text-decoration: none; border: 1px solid var(--rule); border-radius: 0.4375rem; padding: 0.25rem 0.5rem; color: var(--ink); font-size: 0.75rem; }
.items li button:hover, .items li .acts button:hover, .items li .acts button.parting:hover { color: var(--ink); background: var(--sheet); border-color: var(--ink-2); }
.items li .acts { gap: 0.375rem; }
.kinds button { padding: 0.75rem 0.875rem; }
.kinds button:hover { background: var(--sheet); }
.kinds b { font: 600 0.875rem/1.4 var(--sans); }
.steps { color: var(--ink-2); }
.toast { background: var(--paper); border-color: var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0.75rem 0.875rem; }
.toast.plain { background: var(--paper); border-color: var(--rule); }
.toast p { font-size: 0.8125rem; color: var(--ink-2); }
.locked h1 { font: 600 2rem/1.1 var(--sans); letter-spacing: -0.03em; }
.locked p { font-size: 1rem; color: var(--ink-2); }

@media (prefers-reduced-motion: reduce) {
  .btn.mic[aria-pressed="true"], .chat-row.busy .chat-link::before { animation: none; }
  .btn, .tries button, .seg label, .hands-free input, .hands-free input::after, .check-row input, .check-row input::after { transition: none; }
}
@media (max-width: 860px) {
  .log-inner, .welcome, .composer-inner { padding-left: 1rem; padding-right: 1rem; }
  .welcome { padding-top: 7vh; }
  .hands-free { margin-left: 0; }
  .who { display: flex; }
}

/* ---------------------------------------------------------------------- the console
 * A machine's own display: a turning core at the centre, a measured grid behind, panels marked at
 * their corners like instrument readouts, small spaced capitals for labels, and a faint light
 * on whatever is live. Still only black and white.
 */

:root { --radius: 2px; --hud: 500 0.6875rem/1.2 var(--mono); }
body { background: #000; }
:root[data-theme="light"] body { background: #fff; }

.sheet {
  background:
    radial-gradient(ellipse 70% 55% at 50% 38%, color-mix(in srgb, var(--ink) 7%, transparent), transparent 70%),
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 44px 44px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 44px 44px;
}
.top, .composer { background: none; }
.composer { background: linear-gradient(transparent, var(--paper) 1.5rem); }

/* corner marks, as on an instrument panel */
.slip, .pc, .tries button, .field, dialog, .you .said, .toast, .prose .table-wrap, .code, .items, .kinds, .choice {
  border-radius: 0;
  --m: var(--ink-2);
  background-image:
    linear-gradient(var(--m), var(--m)), linear-gradient(var(--m), var(--m)), linear-gradient(var(--m), var(--m)), linear-gradient(var(--m), var(--m)),
    linear-gradient(var(--m), var(--m)), linear-gradient(var(--m), var(--m)), linear-gradient(var(--m), var(--m)), linear-gradient(var(--m), var(--m));
  background-repeat: no-repeat;
  background-size: 9px 1px, 1px 9px, 9px 1px, 1px 9px, 9px 1px, 1px 9px, 9px 1px, 1px 9px;
  background-position: 0 0, 0 0, 100% 0, 100% 0, 0 100%, 0 100%, 100% 100%, 100% 100%;
  border-color: var(--rule-2);
}
.slip.change { --m: var(--ink); border-color: var(--rule); }
.slip.danger { --m: var(--ink); border-color: var(--ink); box-shadow: inset 3px 0 0 var(--ink), 0 0 22px -6px var(--glow); }
.slip.danger::after { content: ""; display: block; height: 4px; background: repeating-linear-gradient(135deg, var(--ink) 0 4px, transparent 4px 8px); }
.field, .you .said, .btn, #mic, #send, .seg, .seg label, .model-chip, .rail-open, .new-chat, .chat-row, .chat-link, .rail-nav button, .stamp, .fld input, .fld textarea, .fld select, .add-row input, .auto-chip, .jump, .items li button, .who .via, .rail-nav .count, .copy, .dlg-close { border-radius: 0; }

/* labels: small spaced capitals in the machine's own type */
.chats h2, .pc h2, .slip-kind, .tries button span, .who b, .who time, .who .via, .stamp, .readout, .brand-full, .composer-foot, .meter dt, .model-chip, .dlg-body h3, .status-line, .voice-line {
  font: var(--hud); letter-spacing: 0.14em; text-transform: uppercase;
}
.dlg-body h3 { color: var(--ink-2); margin-top: 2rem; padding-bottom: 0.375rem; border-bottom: 1px solid var(--rule-2); }
.who b { color: var(--ink); }
.stamp { padding: 0.25rem 0.4375rem; letter-spacing: 0.14em; }
.brand { font: 600 1.0625rem/1 var(--sans); letter-spacing: 0.42em; text-shadow: 0 0 16px var(--glow); }
.brand::before { border-radius: 50%; background: none; border: 1.5px solid currentColor; box-shadow: inset 0 0 0 4px var(--desk), inset 0 0 0 9px currentColor, 0 0 12px var(--glow); }
.rail { background: color-mix(in srgb, var(--desk) 92%, transparent); }
.new-chat { background: none; border-color: var(--desk-ink-2); letter-spacing: 0.02em; }
.new-chat:hover { background: var(--desk-ink); color: var(--desk); }
.chat-row[aria-current="true"] { background: none; box-shadow: inset 2px 0 0 var(--desk-ink); }
.meter .bar { height: 0.375rem; background: none; -webkit-mask: repeating-linear-gradient(90deg, #000 0 3px, transparent 3px 5px); mask: repeating-linear-gradient(90deg, #000 0 3px, transparent 3px 5px); box-shadow: inset 0 0 0 99px var(--desk-line); }
.meter .bar i { box-shadow: 0 0 8px var(--glow); }
.rail-nav button:hover { background: none; box-shadow: inset 2px 0 0 var(--desk-ink); }

/* the core */
.core { color: var(--ink); display: block; overflow: visible; filter: drop-shadow(0 0 10px var(--glow)); --spin: 1; }
.core.big { width: clamp(9rem, 22vh, 13.5rem); height: auto; margin: 0 auto 2rem; }
.core.mini { width: 1.75rem; height: 1.75rem; flex: none; filter: drop-shadow(0 0 5px var(--glow)); }
.core circle { transform-origin: 100px 100px; }
.core .r1 { opacity: 0.55; animation: turn calc(90s / var(--spin)) linear infinite; }
.core .r2 { animation: turn calc(24s / var(--spin)) linear infinite; }
.core .r3 { opacity: 0.28; animation: turn calc(38s / var(--spin)) linear infinite reverse; }
.core .r4 { opacity: 0.4; }
.core .r5 { animation: turn calc(7s / var(--spin)) linear infinite; }
.core .r6 { opacity: 0.7; animation: turn calc(12s / var(--spin)) linear infinite reverse; }
.core .heart { transform: scale(calc(1 + var(--level, 0) * 1.3)); transition: transform 0.09s linear; }
.core.mini .r1, .core.mini .r3, .core.mini .r6 { display: none; }
.core.mini .r2, .core.mini .r5 { stroke-width: 9; }
.core.mini .heart { r: 20px; }
body[data-state="working"] .core { --spin: 5; }
body[data-state="working"] .core .heart { animation: beat 0.9s ease-in-out infinite; }
body[data-state="armed"] .core .r4 { animation: beat 2.4s ease-in-out infinite; }
body[data-state="listening"] .core { --spin: 2.5; }
body[data-state="listening"] .core .r4 { opacity: 1; transform: scale(calc(1 + var(--level, 0) * 0.35)); transition: transform 0.09s linear; }
body[data-state="speaking"] .core { --spin: 2; }
body[data-state="speaking"] .core .heart { animation: beat 0.5s ease-in-out infinite; }
body[data-state="speaking"] .core .r4 { animation: wave 1.1s ease-out infinite; }
@keyframes turn { to { transform: rotate(360deg); } }
@keyframes beat { 50% { transform: scale(1.45); } }
@keyframes wave { from { transform: scale(0.6); opacity: 0.9; } to { transform: scale(1.75); opacity: 0; } }

/* the start screen, centred on the core */
.welcome { text-align: center; padding-top: 7vh; }
.welcome h2 { font: 400 clamp(1.25rem, 2.6vw, 1.75rem)/1.3 var(--sans); letter-spacing: 0.3em; text-transform: uppercase; text-shadow: 0 0 22px var(--glow); margin: 0 0 0.875rem; padding-left: 0.3em; }
.welcome .lead { margin: 0 auto 0.75rem; font-size: 0.9375rem; }
.readout { color: var(--ink-2); margin: 0 0 2.25rem; }
.tries { text-align: left; }
.tries button { background-color: color-mix(in srgb, var(--paper) 70%, transparent); }
.tries button:hover { --m: var(--ink); border-color: var(--ink-2); box-shadow: 0 0 20px -8px var(--glow); }

/* messages and the message box */
.you .said { border-radius: 0; --m: var(--ink); background-color: color-mix(in srgb, var(--sheet) 80%, transparent); }
.field { --m: var(--ink); padding: 0.4375rem 0.4375rem 0.4375rem 1rem; background-color: color-mix(in srgb, var(--sheet) 85%, transparent); box-shadow: none; }
.field:focus-within { border-color: var(--ink-2); box-shadow: 0 0 26px -8px var(--glow); }
.btn { letter-spacing: 0.04em; }
.btn.primary { box-shadow: 0 0 18px -4px var(--glow); }
.seg { background: none; box-shadow: inset 0 0 0 1px var(--rule); }
.seg label:has(input:checked) { background: var(--ink); color: var(--paper); box-shadow: none; }
.hands-free input, .check-row input, .hands-free input::after, .check-row input::after { border-radius: 0; }
.hands-free input:checked { box-shadow: 0 0 12px var(--glow); }
.voice-line .vu { -webkit-mask: repeating-linear-gradient(90deg, #000 0 3px, transparent 3px 5px); mask: repeating-linear-gradient(90deg, #000 0 3px, transparent 3px 5px); height: 0.5rem; width: 8rem; }
.prose.live > :last-child::after { box-shadow: 0 0 10px var(--glow); background: var(--ink); }
dialog { box-shadow: 0 0 60px -20px var(--glow), var(--shadow); --m: var(--ink); border-color: var(--rule); }
.dlg-head h2 { font: 500 0.9375rem/1.2 var(--sans); letter-spacing: 0.26em; text-transform: uppercase; }
.dlg-foot { background: none; }
.choice:has(input:checked) { --m: var(--ink); border-color: var(--ink-2); }

@media (prefers-reduced-motion: reduce) {
  .core circle, .core .heart { animation: none !important; transition: none !important; }
}

/* fit */
.composer-foot { letter-spacing: 0.08em; font-size: 0.625rem; }
.brand-full { letter-spacing: 0.06em; font-size: 0.625rem; }
.meter { grid-template-columns: 5.5rem 1fr 2.25rem; }
.meter dt { letter-spacing: 0.08em; }
.core.big { width: clamp(7.5rem, 18vh, 12rem); margin-bottom: 1.5rem; }
.welcome { padding-top: 5vh; }
.readout { margin-bottom: 1.75rem; }
#mic[aria-pressed="true"], #mic[aria-pressed="true"]:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ------------------------------------------------------------------ the console panel
 * On a wide screen SAM keeps a panel of its own on the right: the core, what it is doing, the
 * time, the computer's load, what is connected, and the last few things it did.
 */
.console { display: none; }
@media (min-width: 1180px) {
  .app { grid-template-columns: 15.5rem minmax(0, 1fr) 17.5rem; }
  .console { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; padding: 1.5rem 1.25rem 1rem; border-left: 1px solid var(--rule-2); background: color-mix(in srgb, var(--paper) 92%, transparent); }
  .rail .pc, .welcome .core, #core-mini { display: none; }
  .welcome { padding-top: 16vh; }
}
.console-core .core.big { width: 11.5rem; margin: 0 auto 1.25rem; }
.console-state { margin: 0; text-align: center; font: 500 0.75rem/1.2 var(--mono); letter-spacing: 0.3em; text-transform: uppercase; padding-left: 0.3em; text-shadow: 0 0 14px var(--glow); }
body[data-state="working"] .console-state, body[data-state="listening"] .console-state { animation: blink 1.2s steps(2, start) infinite; }
.console-wave { width: 100%; height: 2.25rem; margin: 0.875rem 0 0; color: var(--ink); }
.console-clock { margin: 1rem 0 0; padding: 0.875rem 0; border-top: 1px solid var(--rule-2); border-bottom: 1px solid var(--rule-2); display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.console-clock b { font: 400 1.375rem/1 var(--mono); letter-spacing: 0.06em; font-variant-numeric: tabular-nums; text-shadow: 0 0 14px var(--glow); }
.console-clock span { font: var(--hud); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); text-align: right; }
.gauges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin: 1.125rem 0 0.25rem; }
.gauges figure { margin: 0; text-align: center; }
.gauges figcaption { font: var(--hud); font-size: 0.5625rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); margin-top: 0.375rem; }
.gauge { width: 100%; max-width: 4.25rem; display: block; margin: 0 auto; overflow: visible; }
.gauge circle { fill: none; stroke-width: 3; transform: rotate(-90deg); transform-origin: 32px 32px; }
.gauge .track { stroke: var(--rule); stroke-dasharray: 1 2; }
.gauge .fill { stroke: var(--ink); stroke-linecap: butt; transition: stroke-dasharray 0.6s; filter: drop-shadow(0 0 4px var(--glow)); }
.gauge.high .fill { stroke-width: 5; }
.gauge .num { fill: var(--ink); font: 500 15px var(--mono); }
.console-block { margin-top: 1.25rem; }
.console-block h2 { font: var(--hud); letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-2); margin: 0 0 0.5rem; display: flex; align-items: center; gap: 0.5rem; }
.console-block h2::after { content: ""; flex: 1; height: 1px; background: var(--rule-2); }
.console-list { list-style: none; margin: 0; padding: 0; font-size: 0.75rem; }
.console-list li { display: flex; gap: 0.5rem; align-items: baseline; padding: 0.25rem 0; min-width: 0; }
.console-list b { font: var(--hud); font-size: 0.625rem; letter-spacing: 0.1em; text-transform: uppercase; flex: none; }
.console-list b::before { content: ""; display: inline-block; width: 0.375rem; height: 0.375rem; background: var(--ink); margin-right: 0.4375rem; box-shadow: 0 0 6px var(--glow); }
.console-list span { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.console-list .none { color: var(--ink-2); }
.feed time { font: var(--hud); font-size: 0.625rem; color: var(--ink-2); flex: none; }
.feed span { color: var(--ink); }
.feed li:first-child { animation: arrive 0.35s ease-out; }
.feed li:nth-child(n+2) span { color: var(--ink-2); }
.console-sound { margin-top: auto; padding-top: 1rem; display: flex; align-items: center; gap: 0.5rem; font: var(--hud); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); cursor: pointer; }
.console-sound input { appearance: none; -webkit-appearance: none; width: 1.875rem; height: 1.125rem; background: var(--rule); position: relative; margin: 0; cursor: pointer; }
.console-sound input::after { content: ""; position: absolute; top: 0.125rem; left: 0.125rem; width: 0.875rem; height: 0.875rem; background: var(--paper); transition: transform 0.15s; }
.console-sound input:checked { background: var(--ink); }
.console-sound input:checked::after { transform: translateX(0.75rem); }
@keyframes arrive { from { opacity: 0; transform: translateX(8px); } }

/* starting up: the panels come in one after another, the core draws itself */
.rail { animation: come 0.5s ease-out both; }
.sheet { animation: come 0.6s 0.12s ease-out both; }
.console { animation: come 0.6s 0.24s ease-out both; }
.core .r2, .core .r5, .core .r3 { stroke-dashoffset: 0; }
.console-core .core, .welcome .core { animation: wake-up 1.1s 0.2s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes come { from { opacity: 0; } }
@keyframes wake-up { from { opacity: 0; transform: scale(0.6) rotate(-90deg); } }
@media (prefers-reduced-motion: reduce) {
  .rail, .sheet, .console, .console-core .core, .welcome .core, .feed li:first-child, .console-state { animation: none !important; }
  .gauge .fill, .console-sound input::after { transition: none; }
}

body[data-state="working"] .console-state, body[data-state="listening"] .console-state { animation: pulse 1.2s ease-in-out infinite; }
.console-clock span { white-space: nowrap; }
@keyframes pulse { 50% { opacity: 0.4; } }

/* ---- signing in ---- */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1.25rem; position: relative; }
.gate-card { width: min(24rem, 100%); position: relative; padding: 2rem 1.75rem 1.75rem; border: 1px solid var(--rule-2); background: var(--sheet); }
.gate-card::before, .gate-card::after { content: ""; position: absolute; width: 14px; height: 14px; border: 1px solid var(--ink); pointer-events: none; }
.gate-card::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.gate-card::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }
.gate-core { display: grid; place-items: center; margin: 0 auto 0.75rem; }
.gate-core .core.big { width: 7.5rem; height: 7.5rem; }
.gate-name { font: 600 1.75rem/1 var(--sans); letter-spacing: 0.32em; text-align: center; margin: 0 0 0.375rem; padding-left: 0.32em; text-shadow: 0 0 18px var(--glow); }
.gate-full { font: var(--hud); letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-2); text-align: center; margin: 0 0 1.5rem; }
.gate h1 { font: 600 1.0625rem/1.3 var(--sans); margin: 0 0 0.5rem; }
.gate .fld input { width: 100%; }
.gate-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }
.gate-actions .primary { flex: 1; justify-content: center; }

/* ---- who is signed in, on the console ---- */
.console-user { margin: 1rem 0 -0.25rem; display: flex; flex-direction: column; gap: 0.25rem; text-align: center; }
.console-user b { font: 500 0.9375rem/1.2 var(--sans); }
.console-user span { font: var(--hud); letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-2); }

/* ---- people, roles, activity, alerts ---- */
dialog.wide { width: min(64rem, calc(100vw - 2rem)); max-width: none; }
.grid { width: 100%; border-collapse: collapse; font-size: 0.8125rem; margin: 0.5rem 0 0.75rem; }
.grid th { font: var(--hud); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); text-align: left; padding: 0.375rem 0.625rem 0.375rem 0; border-bottom: 1px solid var(--rule-2); white-space: nowrap; }
.grid td { padding: 0.5rem 0.625rem 0.5rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; overflow-wrap: anywhere; }
.grid td.nowrap { white-space: nowrap; font-family: var(--mono); font-size: 0.75rem; overflow-wrap: normal; }
.grid td.long { min-width: 14rem; color: var(--ink-2); }
.grid tr.off td { color: var(--ink-2); text-decoration: line-through; }
.grid tr.off td:last-child { text-decoration: none; }
.grid tr.flag td:first-child { box-shadow: inset 2px 0 0 var(--ink); padding-left: 0.5rem; }
.grid tr.flag td { color: var(--ink); font-weight: 500; }
.btn.small { padding: 0.1875rem 0.5rem; font-size: 0.75rem; white-space: nowrap; }
.grid td:has(> .btn) { overflow-wrap: normal; white-space: nowrap; width: 1%; padding-right: 0; }
.filters { margin-bottom: 0.25rem; }
.ticks { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 0.125rem 1rem; margin: 0.375rem 0 0.5rem; }
.rail-nav button.hot { font-weight: 600; }
.rail-nav button.hot .count { color: var(--desk-ink); }
.rail-nav [data-dialog="people"], .rail-nav [data-dialog="password"] { --icon: var(--i-note); }
.rail-nav [data-dialog="activity"], .rail-nav [data-dialog="signout"] { --icon: var(--i-gear); }
.rail-nav [data-dialog="alerts"] { --icon: var(--i-bell); }
[hidden] { display: none !important; }

/* ---- pictures in answers (ad creatives) ---- */
.prose a.pic { display: inline-block; margin: 0.375rem 0.5rem 0.375rem 0; border: 1px solid var(--rule-2); line-height: 0; }
.prose a.pic img { max-width: min(100%, 20rem); max-height: 20rem; display: block; }
@media (max-width: 860px) {
  .grid { display: block; overflow-x: auto; }
}
