@font-face { font-family: 'MAIA Mono'; src: url('/assets/fonts/JetBrainsMono.ttf') format('truetype'); font-weight: 100 800; font-display: swap; }
@font-face { font-family: 'MAIA Text'; src: url('/assets/fonts/Inter.ttf') format('truetype'); font-weight: 100 900; font-display: swap; }
:root { --bg: #edf3f1; --text: #142a2b; --muted: #425d60; --structure: #276c73; --accent: #41620c; --user: #81540c; --neural: #9134b6; --line: #adc6c6; --surface: rgb(248 253 251 / .94); --message: rgb(255 255 255 / .85); }
:root[data-theme=dark] { color-scheme: dark; --bg: #0d1113; --text: #def0ed; --muted: #9eb7b7; --structure: #81c9ce; --accent: #c1ed67; --user: #f3c16d; --neural: #cc89f1; --line: #30494c; --surface: rgb(13 21 23 / .95); --message: rgb(16 27 29 / .84); }
:root[data-theme=light] { color-scheme: light; }
:root { --neuron-rest: #754995; --neuron-processing: #9a4e00; --neuron-language: #1458a8; --neuron-speech: #c21878; --neuron-memory: #b34f00; --neuron-sensory: #7027bd; }
:root[data-theme=dark] { --neuron-rest: #d3a0ff; --neuron-processing: #ffd36a; --neuron-language: #74c9ff; --neuron-speech: #ff70d4; --neuron-memory: #ffbd70; --neuron-sensory: #d291ff; }
:root[data-theme=dark] { --success-text: #bbf7d0; --success-bg: #11351f; --success-border: #4ade80; --failure-text: #fecaca; --failure-bg: #411a1a; --failure-border: #f87171; --warning-text: #fef08a; --warning-bg: #3b2f0b; --warning-border: #facc15; --info-text: #e9d5ff; --info-bg: #2e1747; --info-border: #c084fc; }
:root[data-theme=light] { --success-text: #14532d; --success-bg: #dcfce7; --success-border: #15803d; --failure-text: #7f1d1d; --failure-bg: #fee2e2; --failure-border: #b91c1c; --warning-text: #713f12; --warning-bg: #fef9c3; --warning-border: #a16207; --info-text: #5b21b6; --info-bg: #f3e8ff; --info-border: #7e22ce; }
.maia-shell { height: 100dvh; overflow: hidden; background: var(--bg); color: var(--text); font-family: 'MAIA Text', sans-serif; }
.maia-shell [hidden] { display: none !important; }
.maia-shell:not(:has(.interface-frame)) { overflow: auto; }
html:not([data-theme-ready]) .interface-frame { visibility: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.maia-shell #maia-visuals, .maia-shell #maia-spectrum { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; opacity: 0; transition: opacity 600ms ease; }
.maia-shell #maia-visuals[data-active=true], .maia-shell #maia-spectrum[data-active=true] { opacity: 1; }
.maia-shell #maia-spectrum[data-active=true] { opacity: .35; }
:root[data-theme=light] .maia-shell #maia-spectrum[data-active=true] { opacity: .45; }
.maia-shell #maia-spectrum { z-index: 1; }
.maia-shell::before { content: ''; position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 37% 43%, transparent 5%, var(--bg) 88%); z-index: 1; }
.interface-frame { --shell-gap: 1rem; position: relative; z-index: 2; height: 100dvh; display: grid; grid-template-rows: auto auto minmax(0, 1fr); padding: clamp(1rem, 2.7vw, 2.8rem); padding-top: clamp(.6rem, 1vw, 1rem); padding-bottom: calc(2 * var(--shell-gap)); gap: var(--shell-gap); }
.maia-shell[data-entered=false] .interface-frame { opacity: 0; visibility: hidden; }
.maia-shell[data-revealing=true] .identity-bar { animation: reveal-header 650ms 400ms ease-out both; }
.maia-shell[data-revealing=true] #chat-workspace { animation: reveal-workspace 850ms 600ms cubic-bezier(.2,.8,.2,1) both; }
.maia-shell[data-revealing=true] .utility-rail { animation: reveal-rail 850ms 500ms cubic-bezier(.2,.8,.2,1) both; }
.maia-shell[data-revealing=true] .identity-bar > *, .maia-shell[data-revealing=true] .utility-group,
.maia-shell[data-revealing=true] .rail-heading, .maia-shell[data-revealing=true] #chat-workspace form > * {
  animation: populate-interface 650ms 950ms ease-out both;
}
.maia-shell[data-revealing=true] .utility-group:nth-of-type(2n) { animation-delay: 1100ms; }
#entry-outlines { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; overflow: hidden; }
#entry-outlines path { fill: none; stroke: var(--structure); stroke-width: 1; stroke-dasharray: 1; stroke-dashoffset: 1;
  animation: trace-interface 1800ms ease-out both; filter: drop-shadow(0 0 4px var(--structure)); }
#entry-outlines path:nth-child(2n) { animation-delay: 120ms; stroke: var(--accent); }
@keyframes trace-interface { 0% { stroke-dashoffset: 1; opacity: 0; } 12% { opacity: .85; }
  55% { stroke-dashoffset: 0; opacity: .65; } 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes populate-interface { from { opacity: 0; filter: blur(3px); } to { opacity: 1; filter: none; } }
@keyframes reveal-header { from { opacity: 0; transform: translateY(-1rem); } to { opacity: 1; transform: none; } }
@keyframes reveal-workspace { from { opacity: 0; transform: translateY(1.5rem); clip-path: inset(0 0 100% 0); } to { opacity: 1; transform: none; clip-path: inset(0); } }
@keyframes reveal-rail { from { opacity: 0; translate: 1.5rem 0; } to { opacity: 1; translate: 0 0; } }
.maia-shell .intro-panel { text-align: center; padding: clamp(1.5rem, 5vw, 4rem); max-width: 38rem; border-top: 2px solid var(--accent); box-shadow: 0 0 5rem rgb(129 201 206 / .08); }
.maia-shell .surface-panel.intro-panel h2 { font: 600 clamp(2.5rem, 8vw, 4rem) 'MAIA Mono', monospace; letter-spacing: .25em; color: var(--accent); margin: 1rem 0; }
.maia-shell .intro-panel p { line-height: 1.8; }
.maia-shell .surface-panel.intro-panel .eyebrow { display: block; font: .65rem/1.8 'MAIA Mono', monospace; color: var(--structure); }
.intro-detail { color: var(--muted); font-size: .85rem; }
.maia-shell #activate-interface { border-color: var(--accent); color: var(--accent); margin-top: 1rem; min-width: 15rem; }
.identity-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); padding-bottom: 1.3rem; }
.brand { display: flex; align-items: center; gap: 1.2rem; }
.identity-mark { width: 2.3rem; height: 2.3rem; border: 1px solid var(--accent); display: grid; place-items: center; transform: rotate(45deg); }
.identity-mark::after { content: ''; width: .6rem; height: .6rem; background: var(--accent); box-shadow: 0 0 1rem var(--accent); }
.maia-mark { width: clamp(3rem, 5vw, 4.6rem); height: clamp(3rem, 5vw, 4.6rem); flex: 0 0 auto; overflow: visible; }
.maia-shell .header-mark { width: 3.8rem; height: 3.8rem; }
.maia-mark path, .maia-mark .mark-orbit circle { fill: none; stroke-linejoin: round; stroke-linecap: round; }
.mark-frame { stroke: var(--structure); stroke-width: 1.5; opacity: .75; }
.mark-circuit { stroke: var(--structure); stroke-width: 2; stroke-dasharray: 7 5; animation: mark-flow 5s linear infinite; }
.mark-core { stroke: var(--accent); stroke-width: 4.5; }
.mark-nodes { fill: var(--accent); animation: mark-pulse 3s ease-in-out infinite; }
.maia-mark .mark-nodes path { fill: var(--accent); stroke: none; }
.mark-orbit { transform-origin: 48px 48px; animation: mark-orbit 24s linear infinite; }
.mark-orbit circle { stroke: var(--neural); stroke-width: 1.6; stroke-dasharray: 24 68 8 35; opacity: .7; }
.maia-shell .intro-mark { display: block; width: 6rem; height: 6rem; margin: 1rem auto; }
.maia-shell[data-page-hidden=true] .mark-orbit, .maia-shell[data-page-hidden=true] .mark-circuit,
.maia-shell[data-page-hidden=true] .mark-nodes { animation-play-state: paused; }
.maia-shell[data-state=thinking] .mark-orbit, .maia-shell[data-state=synthesising] .mark-orbit { animation-duration: 5s; }
@keyframes mark-orbit { to { transform: rotate(360deg); } }
@keyframes mark-flow { to { stroke-dashoffset: -48; } }
@keyframes mark-pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
.maia-shell .identity-bar h1 { font: 600 clamp(1.8rem, 3.6vw, 3rem)/1 'MAIA Mono', monospace; letter-spacing: .3em; color: var(--accent); margin: 0; }
.identity-bar h1 { white-space: nowrap; }
.brand-domain { color: var(--text); font: 400 .8rem/1 'MAIA Mono', monospace; letter-spacing: .035em; }
.identity-expanded { margin: .55rem 0 0; font: .69rem 'MAIA Mono', monospace; color: var(--muted); letter-spacing: .035em; }
.identity-state { font: .75rem 'MAIA Mono', monospace; color: var(--structure); text-align: right; }
.identity-state { flex: 1 1 28rem; min-width: 0; max-width: min(55%, 42rem); margin-left: auto; line-height: 1.8; min-height: 2.7rem; }
#maia-tagline { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 1; transition: opacity 300ms ease; }
#maia-tagline[data-visible=false] { opacity: 0; }
.tagline-subliminal { color: var(--bg); }
.tagline-subliminal::selection { color: var(--bg); background: var(--accent); }
.identity-state small { display: block; color: var(--muted); margin-top: .5rem; }
.header-actions { display: none; }
.voice-controls { display: flex; align-items: center; gap: .5rem; margin-right: auto; }
.maia-shell .voice-controls button { min-width: 2.75rem; padding: .45rem; font-size: 1.15rem; }
.maia-shell #mute-voice[aria-pressed=true] { color: var(--warning-text); border-color: var(--warning-border); background: var(--warning-bg); }
.maia-shell #stop-voice { color: var(--user); border-color: var(--user); }
.maia-shell .workspace { display: grid; grid-template-columns: minmax(0, 4fr) minmax(15rem, 1fr); min-height: 0; gap: 2rem; max-width: none; margin: 0; padding: 0; width: 100%; }
#chat-workspace { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.maia-shell #visitor-chat, .maia-shell #saved-conversations { flex: 1; display: flex; flex-direction: column; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 0; }
.chat-scroll { flex: 1; min-height: 0; overflow: auto; padding: 1.2rem 1rem 1.2rem 0; scrollbar-color: var(--line) transparent; scrollbar-width: thin; }
.chat-action-card { padding: 1rem; margin: 1rem 0; border: 1px solid var(--line); border-left: 2px solid var(--structure); background: var(--surface); }
.chat-action-card h3 { color: var(--structure); font: .85rem 'MAIA Mono', monospace; }
.chat-action-card [data-inline-account] { margin: 0; padding: 0; border: 0; }
.chat-action-card [data-inline-account] > h2 { display: none; }
.chat-action-card #status:empty { display: none; }
#knowledge-editor textarea[id^=knowledge-content] { min-height: 12rem; max-height: 30rem; }
.chat-action-card p { font-size: .85rem; line-height: 1.7; }
.chat-action-card button { margin: .35rem .5rem .35rem 0; }
#chat-action-menu > summary { cursor: pointer; color: var(--structure); font: .72rem 'MAIA Mono', monospace; }
.maia-shell .transcript { max-height: none; overflow: visible; }
.maia-shell .transcript article { width: fit-content; max-width: min(90%, 52rem); padding: 1.2rem 1.5rem; margin: 0 0 1rem; background: var(--message); border: 1px solid var(--line); border-left: 2px solid var(--accent); border-radius: 0 .55rem .55rem .55rem; text-align: left; }
.maia-shell .transcript article strong { font: .72rem 'MAIA Mono', monospace; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; }
.maia-shell .transcript article p { font-size: .97rem; line-height: 1.8; margin: .6rem 0 0; }
.maia-shell .transcript article[data-role=user] { margin-left: auto; border-left-color: var(--user); }
.maia-shell .transcript article[data-role=user] strong { color: var(--user); }
.maia-shell .live-response:not(:empty) { padding: 1rem 1.5rem; background: var(--message); border-left: 2px solid var(--neural); line-height: 1.8; }
.maia-shell form#visitor-form, .maia-shell form#conversation-form { border-top: 1px solid var(--line); padding-top: 1rem; margin-top: auto; }
.maia-shell input, .maia-shell textarea, .maia-shell select { background: var(--surface); border: 1px solid var(--line); color: var(--text); border-radius: .2rem; font-size: .85rem; }
.maia-shell textarea { min-height: 4rem; max-height: 9rem; resize: vertical; font: .9rem/1.5 'MAIA Mono', monospace; border-color: var(--user); width: 100%; }
.maia-shell textarea::placeholder { color: var(--muted); opacity: 1; }
.maia-shell textarea:focus::placeholder { opacity: 0; }
.maia-shell label { font: .73rem 'MAIA Mono', monospace; color: var(--muted); }
.maia-shell label:has(input[type=checkbox]) { line-height: 1.7; }
.maia-shell button { border: 1px solid var(--line); background: var(--surface); color: var(--text); font: .73rem/1.4 'MAIA Mono', monospace; border-radius: .2rem; padding: .8rem 1rem; min-height: 2.75rem; }
.maia-shell button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.maia-shell button[type=submit] { border-color: var(--accent); color: var(--accent); }
.maia-shell button:disabled { opacity: .5; }
.maia-shell :focus-visible { outline: 2px solid var(--user); outline-offset: 4px; }
.maia-shell .actions { margin-top: .65rem; gap: .7rem; }
.maia-shell #visitor-form .actions, .maia-shell #conversation-form .actions { justify-content: flex-end; }
.maia-shell #visitor-status { padding: .25rem .6rem; background: transparent; border-left-width: 2px; font: .73rem/1.6 'MAIA Mono', monospace; margin: .25rem 0; }
.maia-shell #shell-status .status[data-state=info], .maia-shell #shell-status .status[data-state=success] { display: none; }
.maia-shell #shell-status .status { margin: 0; padding: .45rem .8rem; font: .7rem/1.5 'MAIA Mono', monospace; }
.maia-shell #shell-status { max-height: 4.5rem; overflow: auto; }
.maia-shell #conversation-selection, .maia-shell #conversation-read-only-note { font: .72rem 'MAIA Mono', monospace; color: var(--muted); margin: .4rem 0; overflow-wrap: anywhere; }
.maia-shell audio { display: none !important; }
.maia-shell #visitor-audio-state, .maia-shell #reply-audio-state { font: .68rem 'MAIA Mono', monospace; color: var(--muted); margin: .4rem 0; }
.utility-rail { min-height: 0; min-width: 0; overflow: auto; border-left: 1px solid var(--line); padding: .4rem 1.25rem; scrollbar-width: thin; scrollbar-gutter: stable; }
.utility-rail :focus-visible { outline-offset: -3px; }
.rail-heading { display: flex; justify-content: space-between; align-items: center; }
.rail-heading h2, .utility-rail .utility-group h3 { font: .72rem 'MAIA Mono', monospace; text-transform: uppercase; letter-spacing: .15em; color: var(--structure); }
.rail-heading h2 { margin: 0; }
.rail-tools { display: flex; align-items: center; gap: .5rem; }
.maia-shell #theme-mode { padding: .3rem; min-width: 2.75rem; font-size: 1.3rem; }
.telemetry { display: grid; grid-template-columns: 1fr auto; gap: .65rem; font: .7rem 'MAIA Mono', monospace; margin: 0; }
.telemetry dt { color: var(--muted); } .telemetry dd { margin: 0; color: var(--text); text-align: right; }
.system-status { list-style: none; margin: 0; padding: 0; font: .67rem/1.7 'MAIA Mono', monospace; }
.system-status li { display: flex; justify-content: space-between; gap: .5rem; padding: .22rem 0; color: var(--muted); }
.system-status [data-state=healthy], #service-state[data-state=ready] { color: var(--success-border); }
.system-status [data-state=unhealthy], .system-status [data-state=stopped] { color: var(--failure-border); }
.system-status [data-state=degraded], .system-status [data-state=starting], #service-state:not([data-state=ready]) { color: var(--warning-border); }
.utility-group #telemetry-note { font-size: .62rem; }
.utility-rail .workspace-tools { display: grid; gap: .5rem; }
.workspace-tools button { min-width: 0; margin: 0; font-size: .73rem; }
.utility-rail .utility-group { margin: 1.2rem 0 0; padding: 1.2rem 0 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; }
.utility-rail .rail-heading + .utility-group { border-top: 0; padding-top: 0; margin-top: .8rem; }
.utility-rail .rail-heading + .utility-group > :first-child { margin-top: 0; }
.utility-group h3 { margin: 0 0 .8rem; }
.utility-rail .utility-group > h3 + * { margin-top: 0; }
.system-status li:first-child { padding-top: 0; }
.utility-group p { font-size: .73rem; line-height: 1.7; color: var(--muted); }
.memory-note { font: .67rem/1.7 'MAIA Mono', monospace; color: var(--muted); }
.memory-note p { font-family: 'MAIA Text', sans-serif; }
.utility-group button, .utility-group select { width: 100%; margin-bottom: .5rem; }
.utility-group #rail-state { text-transform: uppercase; color: var(--accent); font-family: 'MAIA Mono', monospace; }
.utility-group #rail-regions { color: var(--structure); font: .64rem/1.6 'MAIA Mono', monospace; text-transform: uppercase; }
.utility-group #rail-identity { color: var(--text); }
.utility-rail #open-history { margin-bottom: 0; }
.utility-rail #history-access-note { margin: .2rem 0 0; font-size: .67rem; line-height: 1.45; }
.preview-note { font: .62rem/1.7 'MAIA Mono', monospace; color: var(--muted); margin-top: 2rem; }
.maia-shell .surface-panel { color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: .5rem; width: min(45rem, calc(100vw - 2rem)); max-height: calc(100dvh - 3rem); padding: 1.5rem; }
.surface-panel::backdrop { background: rgb(0 0 0 / .65); backdrop-filter: blur(8px); }
.panel-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.2rem; gap: 1rem; }
.maia-shell .panel-top h2 { font: 1rem 'MAIA Mono', monospace; margin: 0; color: var(--accent); }
.maia-shell .surface-panel section { border-color: var(--line); }
.maia-shell .surface-panel h1 { font-size: 1.5rem; }
.maia-shell .surface-panel h2 { color: var(--structure); }
.maia-shell .surface-panel .eyebrow { display: none; }
.maia-shell .surface-panel .hint { color: var(--muted); }
.maia-shell .surface-panel .transcript { display: none; }
.maia-shell .surface-panel a { color: var(--structure); }
#toggle-utilities, #close-utilities { display: none; }
#drawer-backdrop { position: fixed; inset: 0; background: rgb(0 0 0 / .6); z-index: 8; border: 0; width: 100%; height: 100%; }
.maia-shell[data-signed-in=true] #visitor-options, .maia-shell:not([data-signed-in=true]) #account-options { display: none; }
@media (max-width: 850px) {
  .interface-frame { --shell-gap: .65rem; padding: .9rem; padding-top: .5rem; padding-bottom: calc(2 * var(--shell-gap)); }
  .maia-shell .identity-bar h1 { font-size: clamp(1.1rem, 6vw, 1.5rem); letter-spacing: .18em; }
  .identity-bar { padding-bottom: .85rem; }
  .identity-mark { display: none; }
  .maia-shell .header-mark { width: 2.5rem; height: 2.5rem; }
  .brand { gap: .7rem; }
  .identity-expanded { font-size: .53rem; max-width: 9rem; }
  .brand-domain { font-size: .62rem; }
  .identity-bar { display: grid; grid-template-columns: 1fr auto; }
  .identity-state { display: block; grid-column: 1 / -1; width: 100%; text-align: right; font-size: .65rem; max-width: 100%; margin-left: 0; }
  .identity-state small { display: none; }
  .header-actions { display: flex; align-items: center; grid-column: 2; grid-row: 1; gap: .35rem; }
  .maia-shell #toggle-utilities { padding: .6rem; }
  .maia-shell .workspace { display: flex; min-height: 0; }
  #chat-workspace { width: 100%; }
  #toggle-utilities, #close-utilities { display: inline-block; }
  .utility-rail { position: fixed; z-index: 9; right: 0; top: 0; bottom: 0; width: min(23rem, 90vw); background: var(--surface); padding: 1.2rem; transform: translateX(105%); visibility: hidden; }
  .utility-rail[data-open=true] { transform: translateX(0); visibility: visible; }
  .chat-scroll { padding-right: .2rem; }
  .maia-shell .transcript article { max-width: 98%; padding: .9rem 1rem; }
  .maia-shell .transcript article p { font-size: .9rem; }
  .maia-shell .actions button { width: auto; }
  .maia-shell #visitor-form .actions, .maia-shell #conversation-form .actions { justify-content: space-between; }
}
@media (prefers-reduced-motion: reduce) { .maia-shell *, .maia-shell *::before, .maia-shell *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
/* Chat selection excludes interface labels and action controls. */
#chat-workspace .chat-scroll { user-select: none; }
#chat-workspace article[data-role] > p { user-select: text; }
#chat-workspace article[data-role] > strong { user-select: none; }
#chat-workspace article[data-role] { position: relative; }
.maia-shell .transcript article > :is(.copy-message, .report-message) { position: absolute; top: .45rem; right: .45rem; display: grid; place-items: center; width: 1.8rem; height: 1.8rem; min-width: 0; min-height: 0; padding: .25rem; margin: 0; border: 0; background: transparent; color: var(--muted); opacity: 0; transition: opacity .15s; }
.maia-shell .transcript article > .report-message { right: 2.45rem; cursor: not-allowed; }
.maia-shell .transcript article:hover > .report-message, .maia-shell .transcript article:focus-within > .report-message { opacity: .55; }
.maia-shell .transcript article > .copy-message[data-result=success] { color: var(--accent); }
.maia-shell .transcript article:hover > .copy-message, .maia-shell .transcript article:focus-within > .copy-message { opacity: 1; }
article:hover > .copy-message, article:focus-within > .copy-message { opacity: 1; }
@media (hover: none) { .maia-shell .transcript article > .copy-message { opacity: 1; } .maia-shell .transcript article > .report-message { opacity: .55; } }
.message-time { margin-left: .7rem; font: .7rem 'MAIA Mono', monospace; color: var(--muted); user-select: none; }
.system-status :is(.skill-unavailable, .status-unavailable) { opacity: .45; }
.system-status .skill-available > span:last-child { color: var(--accent); }
