:root {
  color-scheme: light;
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: #1e1c2a;
  background: #f5f4fa;
  --ink: #1e1c2a;
  --muted: #605c72;
  --line: #dedbea;
  --white: #fff;
  --surface: #eeedf7;
  --accent: #563bac;
  --accent-hover: #412988;
  --soft: #e9e3f9;
  --night: #211735;
  --error: #963334;
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 18rem; }
[hidden] { display: none !important; }
main { min-height: 100svh; }
h1, h2, p { margin: 0; }
h1, h2 { line-height: 1.13; letter-spacing: -0.035em; text-wrap: balance; }
h1 { font-size: 2.75rem; font-weight: 680; }
h2 { font-size: 1.26rem; font-weight: 680; }
p, li { line-height: 1.55; }
p { color: var(--muted); }
a { color: var(--accent); text-underline-offset: .22em; }
::selection { background: #daccfa; color: var(--ink); }
:focus-visible { outline: 3px solid #7c62d9; outline-offset: 3px; }

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .6; }
button, input, select, textarea { border-radius: .5rem; }
button { min-height: 2.72rem; padding: .58rem .92rem; font-weight: 650; border: 1px solid transparent; transition: background-color 160ms, border-color 160ms; }
button:active:not(:disabled) { border-color: currentColor; }
.primary { color: var(--white); background: var(--accent); }
.primary:hover:not(:disabled) { background: var(--accent-hover); }
.secondary { color: var(--accent-hover); background: var(--white); border-color: var(--line); }
.secondary:hover:not(:disabled), .quiet:hover:not(:disabled) { background: var(--soft); }
.quiet { color: var(--muted); background: transparent; }
input, select, textarea { width: 100%; min-height: 2.8rem; border: 1px solid #8a829f; background: var(--white); color: var(--ink); padding: .62rem .78rem; caret-color: var(--accent); }
input::placeholder, textarea::placeholder { color: #686479; opacity: 1; }
input[readonly] { background: #faf9ff; }
select { appearance: none; padding-right: 2.4rem; background-image: linear-gradient(45deg, transparent 50%, #575165 50%), linear-gradient(135deg, #575165 50%, transparent 50%); background-position: calc(100% - 1rem) 50%, calc(100% - .68rem) 50%; background-size: .32rem .32rem; background-repeat: no-repeat; }
textarea { resize: vertical; }
label { font-size: .92rem; font-weight: 650; }
form { display: grid; gap: .55rem; }
form > :is(input, textarea, select) + label { margin-top: .5rem; }
form > button { margin-top: .7rem; }
.status { font-size: .94rem; margin-top: .75rem; }
.status:empty { display: none; }
.copy-status { font-size: .94rem; }
.copy-status:not(:empty) { margin-top: .55rem; }
.status[data-error], .copy-status[data-error] { color: var(--error); }
.loading { padding: 2rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

.brand { display: inline-flex; align-items: center; gap: .72rem; text-decoration: none; color: inherit; font-size: 1.125rem; font-weight: 740; letter-spacing: -.026em; width: fit-content; white-space: nowrap; }
.mark { display: inline-block; width: 1.9rem; height: 1.9rem; position: relative; background: var(--accent); border-radius: .48rem; }
.mark::before, .mark::after { content: ''; position: absolute; width: .73rem; height: .51rem; border: 1.5px solid #fff; border-radius: .2rem; top: .69rem; transform: rotate(-38deg); }
.mark::before { left: .35rem; }
.mark::after { left: .81rem; }

.login-layout { min-height: 100svh; display: grid; grid-template-columns: minmax(0, 1.13fr) minmax(0, 1fr); }
.login-story { display: flex; flex-direction: column; background: var(--night); color: #f8f5ff; padding: 2.35rem clamp(1.5rem, 6vw, 6rem); }
.login-story .brand { margin-bottom: 4rem; }
.login-story .mark { background: #7757d2; }
.story-inner { max-width: 35rem; margin-block: auto; padding-bottom: 2.8rem; }
.story-inner h1 { font-size: 3.8rem; font-weight: 640; }
.story-inner p { color: #d9cfea; margin-top: 1rem; max-width: 32ch; font-size: 1.08rem; }
.conversation-example { margin-top: 2.35rem; border-top: 1px solid #534568; }
.conversation-example div { display: grid; grid-template-columns: 7.2rem 1fr; gap: .7rem; padding: .9rem 0; border-bottom: 1px solid #534568; font-size: .95rem; line-height: 1.45; }
.conversation-example span { color: #e5dbf4; }
.conversation-example div:nth-child(2) strong { color: #d5c5ff; }
.login-panel, .consent-layout { display: grid; align-items: center; justify-items: center; padding: 2rem; }
.login-content { width: min(100%, 24rem); }
.login-content h2 { font-size: 2.13rem; margin-top: 1.45rem; }
.login-content > p { margin-top: .7rem; }
.login-content form { margin-top: 1.6rem; }
.segments { width: fit-content; max-width: 100%; display: flex; flex-wrap: wrap; gap: .16rem; padding: .2rem; border-radius: .6rem; background: #e9e6f3; }
.segments button { background: transparent; color: var(--muted); min-height: 2.28rem; padding: .42rem .75rem; border-radius: .4rem; font-size: .925rem; }
.segments button:hover { color: var(--accent); }
.segments button[aria-pressed='true'] { background: var(--white); color: var(--accent-hover); border-color: #d8d2e9; }

.shell { min-height: 100svh; }
.topbar { min-height: 4.4rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: var(--white); padding: .7rem max(1.4rem, calc((100vw - 84rem) / 2)); border-bottom: 1px solid var(--line); }
.identity { display: flex; align-items: center; gap: .55rem; min-width: 0; color: var(--muted); font-size: .9rem; }
.identity span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.identity-status { padding-inline: 1.4rem; text-align: right; }
.workspace { display: grid; grid-template-columns: 14rem minmax(0, 1fr); max-width: 87rem; margin: 0 auto; min-height: calc(100svh - 4.4rem); }
.workspace-nav { display: flex; flex-direction: column; gap: .25rem; background: var(--surface); border-right: 1px solid var(--line); padding: 2.55rem 1rem; }
.workspace-nav button { color: var(--muted); background: transparent; text-align: left; white-space: nowrap; }
.workspace-nav button:hover, .workspace-nav button[aria-current='page'] { color: var(--accent-hover); background: #ded6f2; }
.workspace-content { padding: 3.1rem clamp(1.3rem, 3.7vw, 4rem); min-width: 0; }
.view { max-width: 68rem; margin-inline: auto; }
.page-heading { margin-bottom: 2.15rem; }
.page-heading p { margin-top: .57rem; max-width: 66ch; }
.notice { padding: .72rem .98rem; background: #e9e3f9; border-radius: .55rem; margin-bottom: 1.1rem; color: #493875; }
.connection-grid, .settings-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 1.1rem; align-items: start; }
.connect-card, .prompt-card { padding: 1.35rem; background: var(--white); border: 1px solid var(--line); border-radius: .9rem; min-width: 0; }
.copy-row, .button-row { display: flex; align-items: center; gap: .6rem; margin-top: .95rem; }
.copy-row button { flex-shrink: 0; }
.copy-row code { flex: 1; min-width: 0; padding: .75rem; border: 1px solid #c9c5d9; border-radius: .5rem; background: #faf9ff; font: .91rem ui-monospace, Consolas, monospace; overflow-wrap: anywhere; user-select: all; }
.agent-tabs { margin-top: 1.55rem; }
.steps { padding-left: 1.38rem; margin-block: .92rem .72rem; }
.steps li { padding-left: .18rem; margin-bottom: .42rem; }
.steps li::marker { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.help-link { font-size: .93rem; }
.prompt-card { background: #ebe5fa; border-color: #d9cfef; }
.prompt-card p { margin-top: .55rem; color: #534265; }
.prompt-card .copy-status:empty { margin: 0; }
.prompt-card .copy-status[data-error] { color: var(--error); }
blockquote { margin: 1rem 0; padding: .8rem; font-size: .94rem; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; background: #f8f5ff; border: 1px solid #ddd3f1; border-radius: .55rem; }

.memory-actions { display: flex; gap: 1rem; justify-content: space-between; align-items: start; }
.memory-actions form { display: flex; width: min(100%, 32rem); }
.memory-actions form button { margin: 0; }
.memory-actions > button { flex-shrink: 0; }
.editor { margin-top: 1.15rem; }
.editor form, .settings-grid form { margin-top: 1rem; }
.optional { color: var(--muted); font-weight: 400; }
fieldset { border: 1px solid var(--line); display: grid; gap: .45rem; min-width: 0; border-radius: .55rem; margin: .65rem 0 0; padding: .75rem; }
legend { color: var(--muted); font-size: .94rem; padding: 0 .28rem; }
fieldset div { display: grid; gap: .35rem; }
.memory-item { border-bottom: 1px solid var(--line); padding: 1rem 0; display: flex; align-items: start; justify-content: space-between; gap: 1rem; }
.memory-item p { color: var(--ink); overflow-wrap: anywhere; white-space: pre-wrap; }
.meta { color: var(--muted); font-size: .875rem; display: block; margin-top: .28rem; overflow-wrap: anywhere; }
.item-actions { display: flex; gap: .24rem; flex-wrap: wrap; justify-content: flex-end; }
.item-actions button { min-height: 2.4rem; font-size: .9rem; }
.empty { padding-block: 1.45rem; }
.consent-layout { min-height: 100svh; }
.consent-card { max-width: 35rem; padding: 1.8rem; }
.consent-card h1 { font-size: 2rem; margin-top: 1.6rem; }
.consent-card p { margin-top: .65rem; overflow-wrap: anywhere; }

@media (max-width: 64rem) {
  .workspace { grid-template-columns: 11.7rem minmax(0, 1fr); }
  .connection-grid, .settings-grid { grid-template-columns: 1fr; }
  .story-inner h1 { font-size: 3.2rem; }
}
@media (max-width: 46rem) {
  .login-layout { grid-template-columns: 1fr; }
  .login-story { padding: 1.3rem 1.2rem; }
  .login-story .brand { margin-bottom: 1.35rem; }
  .story-inner { padding-bottom: 0; }
  .story-inner h1 { font-size: 2.47rem; }
  .story-inner p { margin-top: .62rem; }
  .conversation-example { display: none; }
  .login-panel, .consent-layout { padding: 1.45rem 1.2rem 2.25rem; }
  .login-content h2 { font-size: 1.85rem; margin-top: 1.2rem; }
  .workspace { grid-template-columns: 1fr; }
  .workspace-nav { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); padding: .52rem .68rem; }
  .workspace-nav button { font-size: .87rem; padding-inline: .62rem; }
  .workspace-content { padding: 1.6rem 1rem 2.3rem; }
  .page-heading { margin-bottom: 1.25rem; }
  h1 { font-size: 2rem; }
  .topbar { padding-inline: .85rem; gap: .65rem; }
  .connect-card, .prompt-card { padding: 1rem; }
  .copy-row { align-items: stretch; flex-direction: column; }
  .copy-row button { align-self: start; }
  .memory-actions { flex-wrap: wrap; gap: .65rem; }
  .memory-item { display: block; }
  .item-actions { justify-content: start; margin-top: .4rem; }
}
@media (prefers-reduced-motion: reduce) { button { transition: none; } }
