/* One adaptive workspace; no skin system, downloaded fonts or animation library. */
:root { color-scheme: dark; font: 14px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif; background: #111416; color: #e8edef; --bg: #111416; --panel: #171b1e; --raised: #20272a; --line: #2b3337; --muted: #9ca9ae; --accent: #a9e4c0; --accent-bg: #22372c; --error: #ffc4b7; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
button, input, textarea { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button, .icon-button { min-height: 44px; border: 1px solid transparent; border-radius: 9px; padding: 8px 12px; background: var(--raised); color: inherit; cursor: pointer; }
button:hover, .icon-button:hover { background: #2a3438; }
button:disabled { opacity: .45; cursor: default; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.35; }
/* Route focus announces the heading, without drawing a control-sized ring around static text. */
h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus { outline: none; }
.muted { color: var(--muted); }
.icon { width: 18px; height: 18px; display: block; flex: 0 0 auto; }
[data-icon] { display: inline-flex; align-items: center; }
.icon-button { width: 44px; height: 44px; flex: 0 0 44px; padding: 0; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; background: transparent; color: var(--muted); }
.icon-button:hover { color: #eef4f1; }
.text-button { background: transparent; color: var(--accent); }
.text-button:hover { background: var(--accent-bg); }
.skip-link { position: fixed; top: 8px; left: 8px; transform: translateY(-200%); z-index: 10; background: var(--accent); color: #112519; padding: 10px; border-radius: 8px; }
.skip-link:focus { transform: none; }
.app-header { flex: 0 0 auto; min-height: 68px; display: flex; align-items: center; gap: 22px; padding: 10px 24px; border-bottom: 1px solid var(--line); background: var(--bg); }
.brand { min-height: 44px; display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-size: 17px; letter-spacing: -.4px; white-space: nowrap; }
.brand strong { font-weight: 700; }
.brand-mark { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; background: var(--accent); color: #162c20; font: 700 27px/1 Georgia, serif; }
.header-divider { height: 20px; border-left: 1px solid var(--line); }
.header-caption { color: var(--muted); font-size: 12px; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.connection { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; margin-right: 8px; }
.connection::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #7b888d; flex: 0 0 auto; }
.connection[data-status="online"]::before { background: var(--accent); box-shadow: 0 0 0 3px #a9e4c00d; }
.connection[data-status="reconnecting"]::before, .connection[data-status="connecting"]::before { background: #edc985; }
.notice { flex: 0 0 auto; padding: 10px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid #65463c; background: #2c211e; color: var(--error); font-size: 13px; overflow-wrap: anywhere; max-height: 28dvh; overflow: auto; }
.notice button { flex-shrink: 0; background: #463029; }
/* Neutral locked shell, including before JavaScript and during reconnect/login. */
body[data-unlocked="false"] > .app-header,
body[data-unlocked="false"] > .skip-link,
body[data-unlocked="false"] > #notice { display: none; }
.login { flex: 1; min-height: 0; overflow: auto; padding: 24px; display: flex; }
.login-card { width: 100%; max-width: 320px; margin: auto; }
.login form { margin: 0; gap: 14px; }
.login .primary-button { margin: 0; background: #dce1e3; color: #171b1e; }
.login .primary-button:hover { background: #f1f4f5; }
.login .token-field:focus-within { border-color: #aab5bb; box-shadow: 0 0 0 3px #aab5bb18; }
.login .primary-button:focus-visible { outline-color: #dce1e3; }
#owner-change-token { color: var(--muted); font-size: 12px; background: transparent; }
#owner-change-token:hover { color: #e8edef; }
#vault-error { text-align: center; }
#owner-history-setting { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; margin: 16px 0; }
#vault-error { color: var(--error); margin-top: 12px; font-size: 13px; }
#vault-error:empty, #vault-feedback:empty { display: none; }
#vault-forget { margin-top: 10px; }
.eyebrow { color: var(--accent); font-size: 10px; letter-spacing: 1.8px; font-weight: 650; }
form { margin-top: 32px; display: grid; gap: 10px; }
form label { font-size: 13px; font-weight: 550; }
form label span { font-weight: 400; }
input { min-width: 0; width: 100%; border: 0; background: transparent; color: inherit; outline-offset: -2px; }
input::placeholder { color: #849298; }
.token-field { display: flex; align-items: center; border: 1px solid #3a464b; background: var(--panel); border-radius: 10px; padding: 2px 4px 2px 14px; }
.token-field:focus-within, .search-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px #a9e4c018; }
/* The rounded container owns field focus; keep native focus rings on buttons/links. */
.token-field input:focus, .search-field input:focus { outline: none; }
.token-field input, .search-field input { border-radius: 0; padding: 0; box-shadow: none; }
input[type="search"] { appearance: none; -webkit-appearance: none; }
.token-field input { height: 44px; font-size: 16px; }
small { color: var(--muted); font-size: 12px; }
.primary-button { margin-top: 14px; min-height: 50px; background: var(--accent); color: #152c1f; font-weight: 650; display: flex; align-items: center; justify-content: center; gap: 12px; }
.primary-button:hover { background: #c1efd1; }
main { flex: 1; min-height: 0; display: grid; grid-template-columns: 296px minmax(0, 1fr); }
aside { min-height: 0; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.sidebar-head { padding: 22px 18px 10px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.section-heading h2 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.count { color: var(--muted); background: var(--raised); padding: 2px 6px; border-radius: 5px; font-size: 11px; font-weight: 500; }
.search-field { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 10px; margin-top: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--muted); }
.search-field input { height: 42px; font-size: 13px; }
kbd { font: 11px ui-monospace, monospace; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.filters { display: flex; gap: 4px; margin-top: 10px; }
.filters button { background: transparent; min-height: 44px; padding: 5px 12px; font-size: 12px; color: var(--muted); }
.filters button[aria-pressed="true"] { color: var(--accent); background: var(--accent-bg); }
#rooms { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 12px 16px; }
.device-group + .device-group { margin-top: 12px; }
.device-heading { padding: 12px 10px 8px; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 500; }
.device-heading span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device-heading .icon { width: 14px; height: 14px; }
.room { display: block; border: 1px solid transparent; border-radius: 9px; text-decoration: none; padding: 12px 12px 11px; margin: 3px 0; min-height: 72px; }
.room:hover { background: var(--raised); }
.room[aria-current="page"] { background: var(--accent-bg); border-color: #365443; }
.room-title { font-size: 13px; font-weight: 550; display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.room-meta { margin-top: 5px; display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; min-width: 0; }
.room-meta .path { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.room-status { flex: 0 0 auto; }
.room-status[data-busy="true"] { color: #edc985; }
.room[aria-current="page"] .room-title { color: #d1f4de; }
.sidebar-empty { padding: 30px 10px; }
.sidebar-empty strong { display: block; margin-bottom: 6px; font-size: 13px; }
.sidebar-empty p { color: var(--muted); font-size: 12px; }
.sidebar-empty button { margin-top: 12px; }
.sidebar-footer { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 8px; font-size: 11px; }
.sidebar-footer .icon { width: 15px; height: 15px; color: var(--muted); }
.conversation { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.conversation-head { flex-shrink: 0; display: flex; align-items: center; gap: 12px; min-height: 84px; padding: 16px clamp(20px, 3vw, 40px); border-bottom: 1px solid var(--line); }
.conversation-heading { min-width: 0; flex: 1; }
.conversation-head h1 { font-size: 16px; letter-spacing: -.25px; overflow-wrap: anywhere; }
.conversation-head p { font-size: 12px; margin-top: 4px; overflow-wrap: anywhere; }
.transcript { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 32px clamp(20px, 4vw, 64px) 40px; scrollbar-gutter: stable; }
#messages { max-width: 840px; margin: 0 auto; }
.empty-state { height: 100%; min-height: 210px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; max-width: 360px; margin: auto; padding-bottom: 40px; }
.empty-symbol { width: 56px; height: 56px; display: grid; place-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; color: var(--accent); font: 32px Georgia, serif; margin-bottom: 20px; }
.empty-state h2 { font-size: 18px; letter-spacing: -.4px; }
.empty-state p { margin-top: 10px; font-size: 13px; color: var(--muted); }
.message { margin-bottom: 28px; min-width: 0; }
.message-head { display: flex; align-items: center; gap: 10px; min-height: 36px; margin-bottom: 10px; }
.avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--accent); background: var(--accent-bg); }
.message[data-role="user"] .avatar { background: #303b4d; color: #bdcde5; }
.message-head h3 { font-size: 12px; font-weight: 650; }
.message-head time { font-size: 11px; color: var(--muted); }
.message-head .icon-button { margin-left: auto; width: 44px; height: 44px; }
.message-body { padding-left: 38px; font-size: 14px; line-height: 1.8; overflow-wrap: anywhere; }
.message[data-role="user"] .message-body { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px; margin-left: 38px; }
.message-body p { white-space: pre-wrap; margin: 10px 0; }
.message-body p:first-child { margin-top: 0; }
.message-body h4 { margin: 20px 0 10px; font-size: 16px; }
.message-body ul { padding-left: 20px; margin: 12px 0; }
.message-body li { margin: 4px 0; }
.message-body code { font: 12px/1.7 ui-monospace, "Cascadia Code", Consolas, monospace; background: var(--raised); padding: 2px 5px; border-radius: 4px; }
.code-block { border: 1px solid #334047; border-radius: 10px; background: #151b1e; margin: 16px 0; overflow: hidden; }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 0 12px; background: #1e272b; color: var(--muted); font: 11px ui-monospace, monospace; }
.code-head button { font-size: 11px; background: transparent; }
.code-block pre { margin: 0; padding: 16px; overflow-x: auto; white-space: pre; overscroll-behavior: contain; }
.code-block pre code { background: none; padding: 0; color: #c7e5d5; }
.tool-result { margin-left: 38px; border: 1px solid var(--line); border-radius: 9px; padding: 0 14px; background: var(--panel); }
.tool-result summary { cursor: pointer; min-height: 44px; padding: 10px 0; font-size: 12px; color: var(--muted); }
.tool-result pre { white-space: pre-wrap; overflow-wrap: anywhere; font: 12px/1.7 ui-monospace, monospace; }
.tool-result[data-error="true"] { border-color: #805146; }
.tool-result[data-error="true"] summary { color: var(--error); }
.conversation-footer { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex-shrink: 0; min-height: 58px; padding: 6px clamp(20px, 3vw, 40px); border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.conversation-footer .icon { width: 14px; height: 14px; }
.conversation-footer button { margin-left: auto; font-size: 11px; }
.jump-container { position: absolute; bottom: 70px; left: 0; right: 0; text-align: center; pointer-events: none; }
#jump-latest { pointer-events: auto; box-shadow: 0 4px 24px #0008; background: var(--accent-bg); border-color: #48785b; display: inline-flex; gap: 8px; align-items: center; font-size: 12px; }
dialog { background: var(--panel); color: inherit; border: 1px solid #3b494f; border-radius: 16px; padding: 24px; width: min(580px, calc(100% - 32px)); max-height: calc(100dvh - 40px); overflow-y: auto; box-shadow: 0 24px 100px #0008; }
dialog::backdrop { background: #070b0dcc; }
dialog h2 { margin: 20px 0 16px; font-size: 23px; letter-spacing: -.5px; }
dialog p { margin: 14px 0; font-size: 13px; overflow-wrap: anywhere; }
.help-section { border-top: 1px solid var(--line); padding: 6px 0; }
.help-section summary { min-height: 44px; padding: 10px 0; cursor: pointer; font-size: 13px; font-weight: 600; }
.help-section code { font: 12px/1.7 ui-monospace, Consolas, monospace; color: #c7e5d5; }
.help-command { display: flex; align-items: center; min-width: 0; gap: 4px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); padding: 4px 8px; }
.help-command pre { flex: 1; min-width: 0; overflow-x: auto; white-space: pre; margin: 0; padding: 8px 2px; }
.help-command > span { flex-shrink: 0; }
.privacy-note { display: flex; align-items: center; gap: 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--accent); }
.toast { position: fixed; z-index: 5; bottom: max(24px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 12px 18px; background: #d9eee0; color: #183123; border-radius: 10px; box-shadow: 0 6px 30px #0006; font-size: 13px; }
.mobile-only { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.composer-panel { flex-shrink: 0; padding: 10px clamp(20px, 3vw, 40px) 14px; border-top: 1px solid var(--line); background: var(--bg); max-height: 48dvh; overflow-y: auto; }
.composer-top { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; font-size: 11px; color: var(--muted); }
.preview-badge { flex: 0 0 auto; font-size: 9px; font-weight: 650; letter-spacing: .5px; color: #edc985; border: 1px solid #5c5139; background: #2e281b; border-radius: 5px; padding: 2px 6px; }
.composer-examples { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.composer-examples button { border: 1px solid var(--line); background: transparent; font-size: 11px; }
.composer-form { margin: 0; gap: 0; border: 1px solid #3a464b; border-radius: 12px; background: var(--panel); overflow: hidden; }
.composer-form:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px #a9e4c018; }
#prompt { resize: none; width: 100%; min-height: 68px; max-height: 136px; padding: 14px 16px 6px; border: 0; background: transparent; color: inherit; outline: none; font-size: 15px; line-height: 1.6; }
#prompt::placeholder { color: #849298; }
.composer-actions { display: flex; align-items: center; gap: 8px; padding: 4px 8px 8px 14px; }
.composer-actions small { flex: 1; font-size: 10px; }
.send-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--accent); color: #152c1f; font-size: 12px; font-weight: 650; }
.send-button:hover { background: #c1efd1; }
.stop-button { border: 1px solid #6a4b43; background: #352721; color: var(--error); font-size: 12px; }
.stop-button:hover { background: #4a302a; }
.composer-error { margin-top: 8px; color: var(--error); font-size: 12px; overflow-wrap: anywhere; }
#delivery-details { color: var(--muted); margin-bottom: 8px; font-size: 11px; }
#delivery-details summary { cursor: pointer; min-height: 32px; padding: 6px 0; }
#delivery-list { max-height: 144px; overflow-y: auto; }
.delivery-row { display: flex; gap: 8px; align-items: center; padding: 4px 0; border-top: 1px solid var(--line); }
.delivery-row span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.delivery-row button { background: transparent; color: var(--accent); flex-shrink: 0; font-size: 11px; }
.delivery-row[data-status="cancelled"], .delivery-row[data-status="unknown"] { color: #edc985; }
.live-message { max-width: 840px; margin: 24px auto 0; }
#stream-text { white-space: pre-wrap; }
.stream-label { color: var(--accent); font-size: 11px; }
.message-outcome { margin: 10px 0 0 38px; font-size: 12px; color: #edc985; }
.error-outcome { color: var(--error); overflow-wrap: anywhere; }
.live-tool { max-width: 840px; margin: 12px auto; font-size: 12px; color: var(--accent); }
.has-composer .conversation-footer { min-height: 36px; }
.has-composer .jump-container { position: relative; bottom: auto; height: 0; z-index: 1; }
.has-composer #jump-latest { transform: translateY(-54px); }
@media (max-height: 500px) { .has-composer .conversation-head { min-height: 54px; padding-top: 6px; padding-bottom: 6px; } .has-composer .conversation-footer { display: none; } .composer-top { display: none; } #prompt { min-height: 44px; } }
@media (min-width: 1600px) { main { grid-template-columns: 320px minmax(0, 1fr); } }
@media (max-width: 760px) {
  .composer-panel { padding: 8px 12px 10px; }
  #prompt { font-size: 16px; }
  .composer-actions small { display: none; }
  .composer-actions { justify-content: flex-end; }
  .composer-top { gap: 6px; font-size: 10px; }
  .has-composer .conversation-footer { font-size: 10px; }
  .app-header { min-height: 60px; padding: 8px 16px; gap: 8px; }
  .header-caption, .header-divider { display: none; }
  .brand { font-size: 15px; }
  .brand-mark { width: 28px; height: 28px; font-size: 24px; }
  .header-actions { gap: 0; }
  .connection { font-size: 11px; margin-right: 2px; max-width: 70px; line-height: 1.3; }
  main { display: block; }
  aside, .conversation { height: 100%; }
  aside { border-right: 0; }
  body[data-view="conversation"] aside, body[data-view="list"] .conversation { display: none; }
  .mobile-only { display: inline-flex; }
  .sidebar-head { padding: 16px 20px 10px; }
  .search-field input { font-size: 16px; }
  .search-field kbd { display: none; }
  #rooms { padding: 0 12px 16px; }
  .room { min-height: 80px; }
  .room-title { font-size: 15px; }
  .room-meta { font-size: 12px; }
  .conversation-head { padding: 12px 12px 12px 8px; min-height: 76px; gap: 6px; }
  .conversation-head h1 { font-size: 14px; }
  .conversation-head p { font-size: 11px; }
  .transcript { padding: 24px 16px 32px; scrollbar-gutter: auto; }
  .message-body { padding-left: 0; font-size: 15px; }
  .message[data-role="user"] .message-body, .tool-result { margin-left: 0; }
  .conversation-footer { padding: 6px 16px; gap: 6px; }
  #history-note { display: none; }
  .notice { padding: 10px 16px; font-size: 12px; flex-wrap: wrap; gap: 6px; }
  .login { padding: 40px 24px; }
  .empty-state { padding-bottom: 0; }
}
@media (prefers-reduced-motion: no-preference) { button, a { transition: background-color 100ms ease, border-color 100ms ease; } }
.secure-unlock { padding: 16px 24px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.secure-unlock label { display: block; font-size: 13px; margin-bottom: 8px; }
.secure-unlock .token-field { margin: 8px 0; }
.secure-unlock .token-field input { min-width: 0; width: 100%; }
.secure-unlock .token-field button { min-height: 44px; padding: 8px 14px; }
.secure-unlock .archive-choice { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; line-height: 1.5; }
.archive-choice input { flex: 0 0 20px; width: 20px; height: 20px; }
.attached-images { display: flex; gap: 10px; overflow-x: auto; max-height: 150px; margin-bottom: 8px; }
.attachment { flex: 0 0 110px; display: grid; gap: 3px; font-size: 11px; }
.attachment img { max-width: 110px; height: 65px; object-fit: contain; }
.attachment button, #attach-image { min-height: 44px; padding: 6px 10px; }
.history-image { margin: 12px 0; }
.history-image button { min-height: 44px; padding: 8px 12px; }
.history-image img { display: block; max-width: 100%; max-height: 65vh; object-fit: contain; border-radius: 8px; }
body[data-archive="true"] .conversation-footer { flex-wrap: wrap; }
body[data-archive="true"] #history-note { display: inline; font-size: 10px; }
@media(max-width:760px) { .secure-unlock { padding: 12px 16px; } .composer-actions { flex-wrap: wrap; } .composer-actions small { flex-basis: 100%; } }
