/* A quiet canvas, friendly helpers, and one clear action at a time. */
:root {
  color-scheme: light;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  font-size: 14px;
  --bg: #f5f4fb;
  --panel: #ffffff;
  --field: #ffffff;
  --text: #201d32;
  --muted: #655f80;
  --line: #e2dff3;
  --hover: #efedf9;
  --green: #4b43d5;
  --accent: #4b43d5;
  --accent-hover: #3d35bf;
  --accent-soft: #eeedff;
  --on-accent: #ffffff;
  --nav-active: #221e32;
  --nav-text: #ffffff;
  --success: #258265;
  --warning: #987326;
  --danger: #b84853;
  --danger-soft: #fff0f1;
  --shadow: 0 14px 40px #39305d0c;
  --shadow-pop: 0 20px 64px #231d4330;
  --header-h: 86px;
  color: var(--text);
  background: var(--bg);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #191722;
  --panel: #24212f;
  --field: #201d2a;
  --text: #f0edf9;
  --muted: #b5afcb;
  --line: #40394f;
  --hover: #302b3e;
  --green: #b3a9ff;
  --accent: #b3a9ff;
  --accent-hover: #c7bfff;
  --accent-soft: #35304e;
  --on-accent: #211b3b;
  --nav-active: #e7e1f8;
  --nav-text: #211d30;
  --success: #8fd4b6;
  --warning: #e7c682;
  --danger: #f1a4af;
  --danger-soft: #422a36;
  --shadow: 0 14px 40px #08051020;
  --shadow-pop: 0 20px 64px #08051080;
}
[hidden] { display: none !important; }
* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button, a, summary { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button, a, summary, input, textarea, select { outline-offset: 4px; }
:focus-visible { outline: 2px solid var(--green); }
button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 9px 16px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); color: var(--text); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: background .15s, border-color .15s, box-shadow .15s;
}
button:hover:not(:disabled) { background: var(--hover); border-color: color-mix(in srgb, var(--green) 35%, var(--line)); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--green); border-color: var(--green); color: var(--on-accent); font-weight: 600; }
button.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
button.ghost { background: transparent; border-color: transparent; }
button.danger { color: var(--danger); background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 20%, var(--line)); }
button.small { min-height: 34px; font-size: 12px; padding: 7px 12px; }
button svg { width: 16px; height: 16px; flex-shrink: 0; }
button.text-button { min-height: 32px; padding: 5px 0 5px 12px; border: 0; background: transparent; color: var(--green); font-size: 12px; }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { color: var(--text); font-weight: 650; }
h1 { font-size: 32px; line-height: 1.2; letter-spacing: -1px; }
h2 { font-size: 19px; letter-spacing: -.4px; }
h3 { font-size: 16px; }
p { color: var(--muted); line-height: 1.65; }
small, .muted { color: var(--muted); }
small { font-size: 12px; line-height: 1.6; }
code { font-size: .9em; overflow-wrap: anywhere; }
.sr-only { 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: 9px; flex-shrink: 0; color: var(--text); font-size: 25px; font-weight: 700; letter-spacing: -.8px; line-height: 1; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 26px; height: 29px; }
.brand img { width: 28px; height: 28px; }
.theme-toggle { width: 36px; height: 36px; padding: 8px; color: var(--muted); }
.theme-toggle span { display: flex; }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-sun, [data-theme="dark"] .theme-moon { display: none !important; }
[data-theme="dark"] .theme-sun { display: flex !important; }
.home-page { width: 100%; max-width: 720px; margin: 0 auto; }
.home-intro { padding: 30px 0 26px; text-align: center; }
.home-intro h1 { margin: 0 0 8px; font-size: 44px; font-weight: 700; letter-spacing: -1.8px; }
.home-intro p { margin: 0; font-size: 17px; letter-spacing: .05px; }
.home-ask { border: 1px solid var(--line); border-radius: 23px; background: var(--panel); box-shadow: var(--shadow); }
.composer { min-width: 0; padding: 17px 19px; background: var(--panel); }
.home-composer { border-radius: inherit; padding: 16px; }
.helper-picker { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; max-height: 120px; overflow-y: auto; margin-bottom: 12px; }
.helper-picker > span { padding-right: 1px; font-size: 11px; color: var(--muted); }
.helper-chip { min-height: 35px; padding: 4px 12px 4px 6px; gap: 6px; font-size: 12px; font-weight: 600; }
.helper-chip > span { min-width: 0; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.helper-chip .creature { width: 25px; height: 26px; flex-shrink: 0; }
.helper-chip.selected, .helper-chip.selected:hover:not(:disabled) { border-color: var(--green); background: var(--accent-soft); box-shadow: inset 0 0 0 .5px var(--green); }
.composer textarea { display: block; width: 100%; height: 72px; min-height: 56px; max-height: 200px; padding: 8px 4px; resize: vertical; border: 0; border-radius: 8px; background: transparent; color: var(--text); font-size: 15px; line-height: 1.7; }
.home-composer textarea { height: 80px; min-height: 80px; margin-bottom: 16px; }
.composer textarea:focus-visible { outline-offset: 0; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .85; }
.composer-bottom, .composer-tools, .composer-send { display: flex; align-items: center; gap: 8px; }
.composer-bottom { justify-content: space-between; gap: 12px; }
.composer-tools { flex-wrap: wrap; min-width: 0; }
.composer-send { align-self: flex-end; flex-shrink: 0; }
.composer-send > .primary { min-height: 40px; padding: 9px 17px; max-width: 240px; }
.composer-send > .primary span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-button { min-height: 36px; padding: 8px 13px; font-size: 12px; }
.attach-button svg { width: 14px; height: 14px; }
.home-suggestions { padding-top: 23px; text-align: center; }
.home-suggestions > p { margin-bottom: 9px; font-size: 11px; }
.suggestions { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.suggestions button { min-height: 35px; padding: 8px 15px; font-size: 12px; }
.home-suggestions .suggestions { max-width: 570px; margin: 0 auto; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.section-heading h2 { margin: 0; font-size: 19px; }
.helper-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.bot-card { display: flex; flex-direction: column; min-width: 0; padding: 17px 16px 15px; border: 1px solid var(--line); border-radius: 19px; background: var(--panel); }
.helper-heading { display: flex; align-items: center; gap: 10px; min-width: 0; margin-bottom: 9px; }
.helper-heading .creature { width: 50px; height: 52px; margin-left: -3px; flex-shrink: 0; }
.helper-heading > div { min-width: 0; }
.helper-heading h3 { margin: 0 0 4px; font-size: 16px; overflow-wrap: anywhere; }
.bot-card > p { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 0 0 13px; font-size: 12px; line-height: 1.6; flex: 1; }
.helper-chat { width: 100%; min-height: 35px; padding: 8px 10px; background: color-mix(in srgb, var(--helper-color) 22%, var(--panel)); border: 0; color: var(--text); font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
.helper-chat:hover:not(:disabled) { background: color-mix(in srgb, var(--helper-color) 34%, var(--panel)); }
.add-helper-card { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 10px; min-width: 0; min-height: 184px; padding: 17px 16px; border: 1px dashed color-mix(in srgb, var(--green) 30%, var(--line)); border-radius: 19px; background: transparent; text-align: left; }
.add-helper-card > strong { font-size: 16px; font-weight: 650; }
.add-helper-card > span:last-child { color: var(--muted); font-size: 12px; line-height: 1.6; }
.add-helper-icon { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; background: var(--panel); color: var(--green); }
.add-helper-icon svg { width: 18px; height: 18px; }
.fleet-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 20px; }
.fleet-grid .bot-card { padding: 22px; min-height: 224px; }
.fleet-grid .helper-heading .creature { width: 64px; height: 69px; }
.fleet-grid .helper-heading h3 { font-size: 18px; }
.fleet-grid .bot-card > p { font-size: 13px; }
.fleet-grid .add-helper-card { padding: 22px; }
.creature { display: block; width: 120px; height: 130px; overflow: visible; }
.creature .body { transform-origin: center; animation: float 5s ease-in-out infinite; }
.creature .eyes { animation: blink 6s infinite; transform-origin: 50% 44%; }
.creature.busy .body { animation-duration: 1.4s; }
.creature.paused .body { animation-duration: 9s; }
.creature.paused .eyes { transform: scaleY(.35); animation: none; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-5px) rotate(2deg); } }
@keyframes blink { 0%, 43%, 47%, 100% { transform: scaleY(1); } 45% { transform: scaleY(.08); } }
.badge { display: inline-flex; align-items: center; gap: 0; color: var(--muted); font-size: 11px; line-height: 1.4; white-space: nowrap; }
.badge.idle, .badge.completed { color: var(--success); }
.badge.running, .badge.queued { color: var(--green); }
.badge.paused { color: var(--warning); }
.badge.error, .badge.interrupted, .badge.cancelled { color: var(--danger); }
.dot { display: inline-block; flex-shrink: 0; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: var(--success); vertical-align: middle; }
.dot.off { background: currentColor; }
.home-onboarding { padding: 24px; border: 1px solid var(--line); border-radius: 23px; background: var(--panel); text-align: center; }
.home-onboarding h2 { margin-bottom: 8px; font-size: 23px; }
.home-onboarding p { margin-bottom: 22px; font-size: 13px; }
.empty-faces { display: flex; align-items: flex-end; justify-content: center; gap: 8px; margin-bottom: 18px; }
.empty-faces .creature { width: 75px; height: 90px; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 36px 0 28px; }
.page-header h1 { display: flex; align-items: center; gap: 12px; margin: 0; }
.count { display: inline-flex; align-items: center; justify-content: center; min-width: 27px; height: 27px; padding: 0 7px; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: 0; }
.panel { min-width: 0; margin-bottom: 20px; padding: 26px; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); }
.panel h2, .panel h3 { font-size: 17px; margin-bottom: 16px; }
.panel p { font-size: 13px; }
.panel > p:last-child { margin-bottom: 0; }
.flex, .spread { display: flex; align-items: center; gap: 12px; min-width: 0; }
.spread { justify-content: space-between; gap: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }
.form-field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; min-width: 0; }
.form-field label { color: var(--text); font-size: 12px; font-weight: 550; }
.form-field input, .form-field select, .form-field textarea, .settings-row select { width: 100%; min-width: 0; min-height: 42px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); color: var(--text); font-size: 13px; }
.form-field textarea { min-height: 105px; line-height: 1.7; resize: vertical; }
.form-field input[type="color"] { padding: 5px; height: 42px; }
.form-field input[type="checkbox"] { width: auto; min-height: 0; }
.form-field small { font-size: 11px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.inline-check { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 20px; color: var(--text); font-size: 12px; line-height: 1.6; }
input[type="checkbox"] { accent-color: var(--green); flex-shrink: 0; }
.form-actions { margin-top: 22px; }
.error-text { color: var(--danger); font-size: 12px; line-height: 1.6; }
.notice { margin: 16px 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--accent-soft); color: var(--text); font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.notice a { text-decoration: underline; }
.notice button { margin-left: 8px; }
.code { padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--text); font: 12px/1.7 ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; white-space: pre-wrap; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.list-row > div { min-width: 0; overflow-wrap: anywhere; }
.list-row:last-child { border-bottom: 0; }
.list-row strong { font-size: 13px; font-weight: 550; }
.list-row p { margin: 5px 0 0; font-size: 12px; }
.list-row button, .list-row > a { flex-shrink: 0; }
.list-row > .flex { flex-wrap: wrap; justify-content: flex-end; }
.status-ok { color: var(--success); }
.status-warn { color: var(--warning); }
.apps-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.app-card { margin: 0; }
.app-heading { display: flex; align-items: center; gap: 13px; margin-bottom: 15px; }
.app-heading h2 { margin: 0 0 5px; font-size: 17px; }
.app-icon { display: grid; place-items: center; flex-shrink: 0; width: 46px; height: 46px; border: 1px solid var(--line); border-radius: 14px; background: var(--accent-soft); color: var(--green); }
.app-icon svg { width: 23px; height: 23px; }
.app-icon.calendar { background: #fff4d6; color: #9b7421; }
.app-icon.browser { background: #e9f3ed; color: #3e8262; }
.app-icon.bell { background: #fcecf0; color: #b9617f; }
[data-theme="dark"] .app-icon.calendar { background: #433927; color: #e7c880; }
[data-theme="dark"] .app-icon.browser { background: #283d35; color: #8fceb1; }
[data-theme="dark"] .app-icon.bell { background: #452d3c; color: #e2a7bf; }
.connection-state { color: var(--muted); font-size: 11px; }
.app-card > p { margin-bottom: 19px; }
.connection-config > summary { display: inline-flex; align-items: center; min-height: 35px; padding: 7px 16px; border: 1px solid var(--line); border-radius: 999px; color: var(--green); font-size: 12px; font-weight: 600; cursor: pointer; list-style: none; }
.connection-config > summary::-webkit-details-marker { display: none; }
.connection-config > summary:hover { background: var(--accent-soft); }
.connection-body { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--line); }
.connection-help { margin: 18px 0 0; font-size: 12px; }
.test-notification { margin-top: 22px; }
.advanced-settings > summary { cursor: pointer; color: var(--muted); font-size: 13px; line-height: 1.6; padding-block: 8px; }
.advanced-settings[open] > summary { color: var(--text); }
.advanced-body { padding-top: 22px; }
.model-connections { margin-top: 24px; }
.model-connections > summary { color: var(--text); font-weight: 600; }
.settings-layout { max-width: 880px; margin: 0 auto; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 16px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.settings-row:last-child { border-bottom: 0; padding-bottom: 0; }
.settings-row strong { font-size: 13px; font-weight: 550; }
.settings-row p { margin: 5px 0 0; font-size: 12px; }
.settings-row select { width: 180px; flex-shrink: 0; }
.settings-row button { flex-shrink: 0; }
.settings-layout dl dt { color: var(--muted); font-size: 12px; }
.settings-layout dl dd { margin: 10px 0 20px; }
.history-filters { display: flex; gap: 12px; margin-bottom: 18px; }
.history-filters .form-field { min-width: 160px; margin: 0; }
.history-filters select { border-radius: 999px; font-size: 12px; }
.activity-row { display: flex; align-items: center; gap: 20px; padding: 22px 24px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); cursor: pointer; }
.activity-row:hover { border-color: color-mix(in srgb, var(--green) 35%, var(--line)); }
.history-avatar .creature { width: 45px; height: 50px; }
.history-copy { flex: 1; min-width: 0; }
.history-copy .spread { font-size: 13px; }
.history-source { margin-left: 12px; color: var(--muted); font-size: 11px; }
.history-copy p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 8px 0; font-size: 13px; }
.history-copy time { color: var(--muted); font-size: 11px; }
.history-arrow { color: var(--muted); }
.history-arrow svg { width: 17px; height: 17px; }
.activity-empty { display: grid; place-items: center; min-height: 180px; padding: 30px; color: var(--muted); text-align: center; font-size: 13px; }
.activity-list > .activity-empty { min-height: 40vh; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); }
.task-line { display: flex; align-items: center; gap: 10px; min-width: 0; margin-top: 8px; font-size: 12px; }
.task-line > strong { min-width: 0; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.task-line button { min-height: 26px; padding: 3px 9px; font-size: 12px; }
.day-divider { display: flex; justify-content: center; margin: 4px 0 24px; }
.day-divider span { padding: 4px 12px; border-radius: 999px; background: var(--hover); color: var(--muted); font-size: 11px; }
.reply-quote { display: grid; gap: 2px; margin: 0 0 8px; padding: 2px 0 2px 10px; border-left: 2px solid var(--accent); color: var(--muted); font-size: 12px; }
.reply-quote strong { color: var(--text); font-weight: 600; }
.reply-quote span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: pre-wrap; overflow-wrap: anywhere; }
.reply-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; padding: 8px 12px; border-left: 2px solid var(--accent); border-radius: 10px; background: var(--hover); font-size: 12px; }
.reply-bar > div { min-width: 0; display: grid; gap: 2px; }
.reply-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.chat-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100%; padding: 30px 0; text-align: center; }
.chat-empty h3 { font-size: 21px; margin-bottom: 10px; }
.chat-empty p { max-width: 340px; margin-bottom: 22px; font-size: 13px; }
.drafts { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0 12px; }
.drafts:empty { display: none; }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.attachment img { display: block; max-width: min(100%, 240px); max-height: 180px; border: 1px solid var(--line); border-radius: 10px; }
.file-tile { position: relative; display: flex; align-items: center; gap: 10px; width: 200px; max-width: 100%; height: 64px; padding: 0 30px 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); overflow: hidden; }
.file-tile.uploading { opacity: .6; }
.file-kind { display: grid; place-items: center; flex-shrink: 0; width: 38px; height: 44px; border-radius: 7px; background: var(--accent-soft); color: var(--green); font-size: 10px; font-weight: 600; }
.file-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.file-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 500; }
.file-info small { font-size: 10px; }
.draft-image { position: relative; width: 64px; height: 64px; margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); }
.draft-image img { width: 100%; height: 100%; display: block; object-fit: cover; }
.draft-image.uploading img { opacity: .4; }
.draft-status { position: absolute; inset: 0; display: grid; place-items: center; font-size: 10px; }
.draft-remove { position: absolute; top: 3px; right: 3px; min-height: 20px; width: 20px; height: 20px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--panel); font-size: 13px; }
.message-content.md { white-space: normal; }
.md p { margin: 0 0 .8em; color: inherit; }
.md p:last-child, .md ul:last-child, .md ol:last-child { margin-bottom: 0; }
.md h4 { margin: 1.2em 0 .4em; font-size: 14px; }
.md h4:first-child { margin-top: 0; }
.md ul, .md ol { padding-left: 1.5em; margin: 0 0 .8em; }
.md li { margin: .25em 0; }
.md strong { font-weight: 600; }
.md code { padding: 2px 5px; border: 1px solid var(--line); border-radius: 5px; background: var(--bg); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.md .table-wrap { overflow-x: auto; margin: .6em 0 1em; border: 1px solid var(--line); border-radius: 10px; }
.md table { border-collapse: collapse; width: 100%; font-size: .95em; line-height: 1.5; }
.md th, .md td { padding: 9px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.md th { background: var(--bg); font-weight: 600; white-space: nowrap; }
.md tr:last-child td { border-bottom: 0; }
.md tbody tr:nth-child(even) td { background: var(--bg); }
.memory-editor { width: 100%; min-height: max(360px, 45vh); padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--field); color: var(--text); resize: vertical; font: 13px/1.8 ui-monospace, SFMono-Regular, Consolas, monospace; }
.helper-profile { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 36px; }
.preview { position: sticky; top: 24px; align-self: start; padding: 24px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--bg); text-align: center; }
.preview .creature { width: 120px; height: 135px; margin: 8px auto 24px; }
.preview-name { display: block; margin: 0; font-size: 18px; font-weight: 600; overflow-wrap: anywhere; }
.routine-prompt { max-height: 100px; overflow: auto; white-space: pre-wrap; }
.run-steps:empty { display: none; }
.run-steps { display: grid; gap: 3px; margin-top: 10px; }
.step { display: flex; align-items: center; gap: 9px; min-width: 0; color: var(--muted); font: 12px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; }
.step-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-mark { flex-shrink: 0; width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.step.live { color: var(--text); }
.step.live .step-mark { background: var(--green); animation: step-pulse 1.2s ease-in-out infinite; }
.step.error { color: var(--danger); }
.step.error .step-mark { background: var(--danger); }
@keyframes step-pulse { 50% { opacity: .3; } }
.viewer-panel .doing { color: var(--green); margin-bottom: 8px; }
.viewer-panel .doing:empty { display: none; }
.viewport-frame { width: 100%; height: min(65vh, 760px); margin-top: 16px; border-radius: 12px; overflow: hidden; background: #15121e; }
.notice.signin { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 0 0 16px; }
.notice.signin p { margin: 5px 0 0; font-size: 12px; }
.approval-detail { white-space: pre-wrap; margin: 10px 0 0; max-height: 240px; overflow: auto; font: inherit; font-size: 12px; }
.login { min-height: 100dvh; display: grid; place-items: center; padding: 32px 24px; }
.login-theme { position: absolute; top: 20px; right: 24px; }
.login-box { width: 100%; max-width: 390px; }
.login-box .brand { display: flex; justify-content: center; margin-bottom: 24px; }
.login-box > .creature { width: 105px; height: 115px; margin: 0 auto 24px; }
.login-box h1 { font-size: 25px; text-align: center; margin-bottom: 28px; }
.login-box form { padding: 28px; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); box-shadow: var(--shadow); }
.login-box button[type="submit"] { width: 100%; }
dialog { width: min(780px, calc(100% - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 1px solid var(--line); border-radius: 24px; color: var(--text); background: var(--panel); box-shadow: var(--shadow-pop); }
dialog::backdrop { background: #21193270; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 23px 28px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0; font-size: 22px; }
.modal-content { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 28px; padding: 28px; }
.modal-footer { position: sticky; bottom: 0; z-index: 1; display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 18px 28px; border-top: 1px solid var(--line); background: var(--panel); }
.modal-footer .error-text { margin-right: auto; }
.close { width: 34px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 24px; font-weight: 400; }
.details-events { padding: 24px 28px; }
.run-result { font-size: 13px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.event { padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.event strong { display: block; margin-bottom: 5px; font-weight: 500; }
.event pre { max-height: 250px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); font-size: 11px; }
.loading { padding: 80px 24px; color: var(--muted); text-align: center; }
#toast { position: fixed; right: 24px; bottom: 24px; z-index: 100; max-width: min(420px, calc(100% - 32px)); padding: 14px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); box-shadow: var(--shadow-pop); font-size: 13px; line-height: 1.6; opacity: 0; pointer-events: none; transition: opacity .2s; }
#toast.show { opacity: 1; }
#toast.error { color: var(--danger); border-color: var(--danger); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* Accounts: sign-in, reset, and admin account views. */
.auth-links { margin-top: 14px; text-align: center; }
.auth-note { font-size: 13px; color: var(--muted); margin: 0 0 14px; }
.create-user { margin-top: 18px; }
.create-user h3 { margin: 0 0 12px; }
.owner-form { margin-bottom: 16px; }
/* App frame: the rail (main navigation), an optional sidebar, the page, and an optional profile panel.
   Wide screens show them side by side. Phones turn the rail into a bottom bar and the panel into a sheet. */
:root { --rail-w: 84px; --sidebar-w: 280px; --panel-w: 380px; }
body { overflow: hidden; }
.shell { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); height: 100dvh; }
.shell.with-sidebar { grid-template-columns: var(--rail-w) var(--sidebar-w) minmax(0, 1fr); }
.main { min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.main-inner { width: 100%; max-width: 1184px; min-width: 0; margin: 0 auto; padding: 0 40px 56px; }
.main-inner:has(.settings-layout) { max-width: 944px; }
.rail { position: relative; z-index: 30; display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 0; padding: 14px 8px 12px; border-right: 1px solid var(--line); background: var(--bg); }
.rail-brand { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 10px; border-radius: 14px; }
.rail-brand:hover { background: var(--hover); }
.rail-items { display: flex; flex-direction: column; gap: 4px; width: 100%; }
.rail-bottom { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; margin-top: auto; }
.rail-item { position: relative; flex-direction: column; gap: 4px; width: 100%; min-height: 58px; padding: 8px 2px 7px; border: 0; border-radius: 16px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 500; line-height: 1.2; }
.rail-item svg { width: 22px; height: 22px; }
.rail-item:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.rail-item.active, .rail-item.active:hover:not(:disabled) { background: var(--accent-soft); color: var(--green); font-weight: 650; }
.rail-dot { position: absolute; top: 9px; right: calc(50% - 16px); width: 9px; height: 9px; border: 2px solid var(--bg); border-radius: 50%; background: var(--green); }
.more-menu { position: absolute; left: calc(100% + 8px); bottom: 12px; z-index: 50; display: flex; flex-direction: column; gap: 2px; width: 230px; padding: 8px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: var(--shadow-pop); }
.more-menu > button { justify-content: flex-start; gap: 12px; min-height: 42px; padding: 9px 12px; border: 0; border-radius: 12px; background: transparent; font-size: 13px; }
.more-menu > button svg { width: 18px; height: 18px; color: var(--muted); }
.more-menu > button.active { background: var(--accent-soft); color: var(--green); }
.more-menu hr { width: 100%; margin: 6px 0; border: 0; border-top: 1px solid var(--line); }
.menu-theme { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 2px 12px; font-size: 13px; }
.menu-mobile { display: none !important; }

/* Sidebar: chat list or library sections. */
.sidebar { display: flex; flex-direction: column; gap: 14px; min-height: 0; padding: 16px 12px 24px; overflow-y: auto; border-right: 1px solid var(--line); background: var(--panel); }
.sidebar-search, .library-search { position: relative; display: flex; align-items: center; }
.sidebar-search svg, .library-search svg { position: absolute; left: 13px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.sidebar-search input, .library-search input { width: 100%; min-height: 40px; padding: 9px 12px 9px 38px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--text); font-size: 13px; }
.chat-list { display: flex; flex-direction: column; gap: 18px; }
.chat-group { display: flex; flex-direction: column; gap: 2px; }
.chat-group-head { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 0 2px 4px 4px; }
.chat-group-head .creature { width: 24px; height: 26px; flex-shrink: 0; }
.chat-group-head strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.icon-button { width: 36px; min-width: 36px; height: 36px; min-height: 36px; padding: 0; }
.icon-button svg { width: 18px; height: 18px; }
.chat-group-head .icon-button { width: 30px; min-width: 30px; height: 30px; min-height: 30px; color: var(--muted); }
.chat-link-row { position: relative; display: flex; align-items: center; border-radius: 12px; }
.chat-link-row:hover { background: var(--hover); }
.chat-link-row.active { background: color-mix(in srgb, var(--helper-color) 20%, var(--panel)); }
.chat-link { flex: 1; justify-content: flex-start; gap: 8px; min-width: 0; min-height: 38px; padding: 8px 10px 8px 12px; border: 0; border-radius: 12px; background: transparent; font-size: 13px; font-weight: 450; text-align: left; }
.chat-link:hover:not(:disabled) { background: transparent; }
.chat-link-row.active .chat-link { font-weight: 650; }
.chat-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-goal { display: flex; color: var(--muted); }
.chat-goal svg { width: 15px; height: 15px; }
.chat-unread, .chat-working { flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.chat-working { animation: step-pulse 1.2s ease-in-out infinite; }
.chat-options { width: 30px; min-width: 30px; height: 30px; min-height: 30px; margin-right: 4px; padding: 0; color: var(--muted); opacity: 0; }
.chat-link-row:hover .chat-options, .chat-link-row.active .chat-options, .chat-options:focus-visible { opacity: 1; }
.chat-options svg { width: 16px; height: 16px; }
.text-button.small, .chat-group > .text-button { align-self: flex-start; padding-left: 12px; }
.sidebar-add { justify-content: flex-start; gap: 10px; min-height: 40px; border-style: dashed; color: var(--green); }
.sidebar-empty { padding: 8px 4px; font-size: 13px; }
.search-hits { display: flex; flex-direction: column; gap: 4px; padding-top: 4px; border-top: 1px solid var(--line); }
.search-hits h3 { margin: 10px 4px 4px; color: var(--muted); font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .5px; }
.search-hit { flex-direction: column; align-items: flex-start; gap: 3px; padding: 9px 12px; border: 0; border-radius: 12px; background: transparent; text-align: left; font-weight: 400; }
.search-hit strong { font-size: 12px; font-weight: 600; }
.search-hit span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.5; }
.search-hit time { color: var(--muted); font-size: 10px; }
mark { padding: 0 1px; border-radius: 3px; background: color-mix(in srgb, var(--green) 25%, transparent); color: var(--text); }
.chats-page { display: flex; flex-direction: column; gap: 16px; max-width: 640px; }
.chats-page .chat-link { min-height: 46px; font-size: 15px; }
.chats-page .chat-options { opacity: 1; }

/* Conversation */
.main.chat-main { display: flex; flex-direction: column; overflow: hidden; background: var(--panel); }
.conversation { position: relative; display: flex; flex-direction: column; flex: 1; min-height: 0; }
.chat-header { display: flex; align-items: center; gap: 12px; flex-shrink: 0; min-height: 68px; padding: 10px 16px 10px 20px; border-bottom: 1px solid var(--line); }
.chat-back { display: none; }
.chat-avatar { flex-shrink: 0; width: 46px; height: 46px; min-height: 46px; padding: 0; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--accent) 18%, var(--panel)); }
.chat-avatar .creature { width: 34px; height: 37px; }
.chat-title { flex: 1; min-width: 0; }
.chat-title h1 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; letter-spacing: -.3px; }
.chat-title p { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; margin: 2px 0 0; font-size: 12px; line-height: 1.4; }
.chat-title p > span:first-child { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-title .text-button { min-height: 0; padding: 0; }
.chat-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.chat-actions > button { position: relative; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.profile-toggle[aria-pressed="true"] { background: var(--accent-soft); color: var(--green); }
#signin-slot:not(:empty) { padding: 12px 20px 0; }
#signin-slot .notice.signin { margin: 0; }
.messages-wrap { position: relative; display: flex; flex-direction: column; flex: 1; min-height: 0; }
.messages { flex: 1; min-height: 0; padding: 28px max(24px, calc(50% - 390px)) 16px; overflow-y: auto; overscroll-behavior: contain; }
.message { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; margin-top: 18px; }
.message.continued { margin-top: 4px; }
.message.continued .message-label { display: none; }
.message.user { align-items: flex-end; }
.message-label { display: flex; align-items: baseline; gap: 8px; margin: 0 6px 5px; color: var(--muted); font-size: 11px; }
.message-label strong { color: var(--text); font-weight: 600; }
.message-label time { font-size: 10px; }
.message-row { display: flex; align-items: center; gap: 4px; max-width: min(88%, 680px); min-width: 0; }
.message.user .message-row { flex-direction: row-reverse; }
.bubble { min-width: 0; padding: 11px 16px; border-radius: 20px; background: var(--hover); overflow-wrap: anywhere; }
.message.assistant .bubble { border-top-left-radius: 8px; }
.message.assistant.continued .bubble { border-top-left-radius: 20px; }
.message.user .bubble { border-top-right-radius: 8px; background: var(--green); color: var(--on-accent); }
.message.user.continued .bubble { border-top-right-radius: 20px; }
.message-content { color: inherit; font-size: 14.5px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.user .reply-quote { border-left-color: currentColor; color: inherit; opacity: .85; }
.message.user .reply-quote strong { color: inherit; }
.message.user .md a, .message.user a { color: inherit; text-decoration: underline; }
.message.user .file-tile { background: var(--panel); }
.reply-button { flex-shrink: 0; width: 32px; min-width: 32px; height: 32px; min-height: 32px; padding: 0; border: 0; background: transparent; color: var(--muted); opacity: 0; }
.reply-button svg { width: 16px; height: 16px; }
.message:hover .reply-button, .reply-button:focus-visible { opacity: 1; }
@media (hover: none) { .reply-button { opacity: .7; } }
.message.system { align-items: center; margin: 18px 0 6px; gap: 4px; }
.message.system .bubble { max-width: min(92%, 620px); padding: 10px 14px; border: 1px dashed var(--line); background: transparent; }
.message.system .message-content { color: var(--muted); font-size: 12px; line-height: 1.6; }
.message.system time { color: var(--muted); font-size: 10px; }
.message.pending .bubble { min-width: min(320px, 100%); max-width: min(88%, 680px); }
.message.pending .message-content { color: var(--green); }
.day-divider { margin: 20px 0 4px; }
.chat-empty .creature { width: 84px; height: 92px; margin-bottom: 14px; }
.composer-dock { flex-shrink: 0; padding: 8px max(16px, calc(50% - 398px)) max(16px, env(safe-area-inset-bottom)); }
.composer-dock .composer { padding: 10px 12px 10px 16px; border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow); }
.composer-dock .composer textarea { height: 52px; min-height: 44px; padding: 6px 2px; resize: none; }
.composer-dock .attach-button { width: 38px; padding: 8px; }
.composer-dock .attach-button span { display: none; }
.composer-dock .composer-send > .primary { min-width: 42px; width: 42px; padding: 10px; }
.composer-dock .composer-send > .primary span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.jump-latest { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 1; box-shadow: var(--shadow-pop); }
.browser-main { flex: 1; min-height: 0; padding: 20px; overflow-y: auto; background: var(--bg); }
.browser-main .viewer-panel { max-width: 1280px; margin: 0 auto; }

/* Profile panel: who the helper is, what they've done, and their settings. */
.profile-panel { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; border-left: 1px solid var(--line); background: var(--panel); }
.panel-backdrop { display: none; }
.profile-top { display: flex; justify-content: flex-end; padding: 12px 12px 0; }
.profile-hero { display: flex; flex-direction: column; align-items: center; padding: 0 24px 18px; text-align: center; }
.profile-avatar { position: relative; display: grid; place-items: center; width: 116px; height: 116px; margin-bottom: 12px; border-radius: 50%; background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--helper-color) 34%, var(--panel)), color-mix(in srgb, var(--helper-color) 12%, var(--panel))); }
.profile-avatar .creature { width: 86px; height: 94px; }
.avatar-edit { position: absolute; right: 2px; bottom: 4px; width: 34px; min-width: 34px; height: 34px; min-height: 34px; padding: 0; box-shadow: var(--shadow); }
.avatar-edit svg { width: 15px; height: 15px; }
.profile-hero h2 { margin: 0 0 4px; font-size: 23px; overflow-wrap: anywhere; }
.profile-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 16px; }
.profile-facts { display: flex; justify-content: center; gap: 24px; margin: 14px 0 0; font-size: 12px; }
.profile-facts dt { color: var(--muted); font-size: 11px; }
.profile-facts dd { margin: 2px 0 0; }
.tabs { display: flex; gap: 2px; }
.profile-tabs { margin: 0 16px; padding: 4px; border-radius: 16px; background: var(--bg); }
.profile-tabs button { flex: 1; flex-direction: column; gap: 3px; min-width: 0; min-height: 52px; padding: 6px 2px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); font-size: 10.5px; }
.profile-tabs button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-tabs button svg { width: 19px; height: 19px; }
.profile-tabs button.active, .profile-tabs button.active:hover:not(:disabled) { background: var(--panel); color: var(--green); box-shadow: 0 1px 4px #231d4314; font-weight: 650; }
.profile-body { padding: 20px 20px 32px; }
.profile-body .panel { padding: 18px; border-radius: 16px; margin-bottom: 14px; }
.profile-body .grid2, .profile-body .form-row, .profile-body .helper-profile { grid-template-columns: minmax(0, 1fr); gap: 0; }
.profile-body .preview { display: none; }
.profile-body > .text-button, .files-tab > button { margin-top: 12px; }
.activity-day { margin: 18px 0 6px; font-size: 14px; }
.activity-day:first-child { margin-top: 0; }
.activity-feed { display: flex; flex-direction: column; gap: 2px; }
.activity-item { align-items: flex-start; justify-content: flex-start; gap: 12px; width: 100%; padding: 10px 8px; border: 0; border-radius: 14px; background: transparent; text-align: left; font-weight: 400; }
.activity-mark { display: grid; place-items: center; flex-shrink: 0; width: 34px; height: 34px; border-radius: 10px; background: var(--bg); color: var(--success); }
.activity-mark svg { width: 17px; height: 17px; }
.activity-mark.running, .activity-mark.queued { color: var(--green); }
.activity-mark.error, .activity-mark.interrupted, .activity-mark.cancelled { color: var(--danger); }
.activity-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.activity-copy strong { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.activity-copy span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.5; }
.activity-copy time { color: var(--muted); font-size: 11px; }
.identity-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.identity-card { flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 2px; min-height: 120px; padding: 14px; border: 2px solid transparent; border-radius: 18px; color: #fff; text-align: left; box-shadow: var(--shadow); }
.identity-card.personality { background: linear-gradient(150deg, color-mix(in srgb, var(--card) 70%, #fff), color-mix(in srgb, var(--card) 80%, #1b1530)); color: #1b1530; }
.identity-card.memory { background: linear-gradient(150deg, #7b74f0, #3d35bf); }
.identity-card strong { font-size: 15px; font-weight: 750; letter-spacing: .3px; text-transform: uppercase; }
.identity-card small { color: inherit; font-size: 11px; opacity: .85; }
.identity-card span { margin-top: auto; font: 12px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; opacity: .9; }
.identity-card:hover:not(:disabled) { border-color: transparent; filter: brightness(1.05); }
.identity-card.active { border-color: var(--text); }
.identity-editor label { display: block; margin-bottom: 4px; font-size: 13px; font-weight: 600; }
.identity-editor p { margin-bottom: 10px; font-size: 12px; }
.identity-editor textarea { width: 100%; min-height: 300px; margin-bottom: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--field); color: var(--text); font: 13px/1.7 ui-monospace, SFMono-Regular, Consolas, monospace; resize: vertical; }
.owner-form { margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.owner-form h3 { margin-bottom: 6px; }
.owner-form p { font-size: 12px; }
.owner-form select { flex: 1; min-height: 38px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); color: var(--text); }

/* Feed */
.feed-page, .goals-page { max-width: 760px; margin: 0 auto; }
.page-intro { margin: -14px 0 30px; font-size: 15px; }
.feed-prompt { margin-bottom: 26px; padding: 20px 22px; border-radius: 24px; background: var(--hover); }
.feed-prompt-label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: .7px; text-transform: uppercase; }
.feed-prompt > p { margin: 0 0 14px; color: var(--text); font-size: 15px; line-height: 1.6; white-space: pre-wrap; }
.feed-prompt textarea { width: 100%; min-height: 110px; margin-bottom: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--field); color: var(--text); font-size: 15px; line-height: 1.6; resize: vertical; }
.feed-options { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 8px 20px; }
.feed-options .form-field { min-width: 200px; margin-bottom: 12px; }
.feed-options .inline-check { margin-bottom: 22px; }
.feed-prompt-foot { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px 16px; }
.feed-meta { display: flex; align-items: center; gap: 6px; margin-right: auto; color: var(--muted); font-size: 12px; }
.feed-meta .creature { width: 22px; height: 24px; }
.feed-working { display: flex; align-items: center; gap: 12px; margin: 0 0 22px; }
.feed-error { margin: 0 0 22px; border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); background: var(--danger-soft); }
.spinner { flex-shrink: 0; width: 16px; height: 16px; border: 2px solid color-mix(in srgb, var(--green) 25%, transparent); border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.feed-list { display: flex; flex-direction: column; }
.feed-post { display: flex; gap: 14px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.feed-post:last-child { border-bottom: 0; }
.feed-avatar { flex-shrink: 0; width: 40px; }
.feed-avatar .creature { width: 38px; height: 41px; }
.feed-icon { display: grid; place-items: center; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--green); }
.feed-icon svg { width: 20px; height: 20px; }
.feed-body { flex: 1; min-width: 0; }
.feed-body header { display: flex; align-items: flex-start; gap: 10px; }
.feed-body h2 { flex: 1; margin: 0 0 6px; font-size: 17px; line-height: 1.4; letter-spacing: -.2px; overflow-wrap: anywhere; }
.feed-body header time { flex-shrink: 0; padding-top: 3px; color: var(--muted); font-size: 12px; }
.feed-body .md, .feed-body > p { color: var(--text); font-size: 14.5px; line-height: 1.65; overflow-wrap: anywhere; }
.feed-post.intro .feed-body > p { color: var(--muted); margin: 0; }
.feed-source { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 12px; }
.feed-source svg { width: 14px; height: 14px; }
.feed-actions { display: flex; align-items: center; gap: 4px; margin: 10px 0 0 -10px; }
.feed-actions button { min-height: 36px; color: var(--muted); }
.feed-actions .like.on { color: var(--danger); }
.feed-actions .like.on svg { fill: currentColor; }
.feed-by { margin-left: auto; color: var(--muted); font-size: 11px; }
.popover-menu { position: relative; flex-shrink: 0; }
.popover-menu > summary { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: var(--muted); cursor: pointer; list-style: none; }
.popover-menu > summary::-webkit-details-marker { display: none; }
.popover-menu > summary:hover, .popover-menu[open] > summary { background: var(--hover); }
.popover-menu > summary svg { width: 18px; height: 18px; }
.popover { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; display: flex; flex-direction: column; min-width: 200px; padding: 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: var(--shadow-pop); }
.popover button { justify-content: flex-start; border: 0; border-radius: 10px; background: transparent; font-weight: 450; }

/* Goals */
.goal-section { margin-bottom: 34px; }
.goal-section h2 { margin-bottom: 10px; font-size: 17px; }
.goal-list { display: flex; flex-direction: column; gap: 10px; }
.goal-card { justify-content: flex-start; gap: 14px; width: 100%; padding: 16px 18px; border-radius: 20px; text-align: left; font-weight: 400; }
.goal-card.done { opacity: .75; }
.goal-icon { display: grid; place-items: center; flex-shrink: 0; width: 42px; height: 42px; border-radius: 14px; background: var(--accent-soft); color: var(--green); }
.goal-icon svg { width: 21px; height: 21px; }
.goal-icon.large { width: 56px; height: 56px; border-radius: 18px; }
.goal-icon.large svg { width: 28px; height: 28px; }
.goal-copy { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.goal-cat { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin: 0; color: var(--muted); font-size: 11px; }
.goal-copy strong { font-size: 15px; font-weight: 650; overflow-wrap: anywhere; }
.goal-next { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.goal-meter { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; width: 84px; }
.goal-meter small { font-size: 11px; font-weight: 600; }
.progress { display: block; width: 100%; height: 6px; overflow: hidden; border-radius: 999px; background: var(--line); }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--green); transition: width .3s; }
.category-list { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.category-row { justify-content: flex-start; gap: 14px; width: 100%; min-height: 54px; padding: 12px 8px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; font-size: 14px; font-weight: 500; }
.category-row:hover:not(:disabled) { background: var(--hover); }
.category-row svg { width: 20px; height: 20px; color: var(--muted); }
.category-row > span { flex: 1; text-align: left; }
.category-row svg:last-child { width: 16px; height: 16px; }
.goal-page .back { margin: 24px 0 8px -10px; }
.goal-header { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 22px; }
.goal-header h1 { margin: 4px 0 6px; font-size: 28px; overflow-wrap: anywhere; }
.goal-details { margin: 0; font-size: 14px; white-space: pre-wrap; }
.goal-summary { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px 28px; }
.goal-progress-big span { color: var(--muted); font-size: 12px; }
.goal-progress-big strong { font-size: 26px; letter-spacing: -.5px; }
.goal-progress-big .progress { height: 10px; margin-top: 8px; }
.goal-next-step span { color: var(--muted); font-size: 12px; }
.goal-next-step p { margin: 4px 0 0; color: var(--text); font-size: 14px; }
.goal-who { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.goal-who .creature { width: 28px; height: 30px; }
.goal-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.goal-columns > .panel { margin-bottom: 0; }
.goal-plan { font-size: 14px; line-height: 1.7; }
#goal-note-form textarea { min-height: 80px; }
#goal-note-form input[type="range"] { min-height: 0; padding: 0; accent-color: var(--green); }
.goal-updates { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.goal-update { padding-left: 14px; border-left: 2px solid var(--line); }
.goal-update time { color: var(--muted); font-size: 11px; }
.goal-update p { margin: 2px 0 0; color: var(--text); font-size: 13px; white-space: pre-wrap; }
.goal-danger { margin: 28px 0; }
.modal-title { display: flex; align-items: center; gap: 10px; }
.modal-title svg { width: 24px; height: 24px; color: var(--green); }
.modal-sub { margin: 4px 0 0; font-size: 12px; }
.helper-radios { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; border: 0; }
.helper-radios legend { margin-bottom: 8px; padding: 0; font-size: 12px; font-weight: 550; }
.helper-radios .helper-chip { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.helper-radios .helper-chip:has(input:checked) { border-color: var(--green); background: var(--accent-soft); box-shadow: inset 0 0 0 .5px var(--green); }
.helper-radios .helper-chip:has(input:focus-visible) { outline: 2px solid var(--green); outline-offset: 2px; }
.helper-radios input { position: absolute; opacity: 0; pointer-events: none; }

/* Library */
.library-actions { display: flex; align-items: center; gap: 8px; }
.library-chips { display: none; gap: 6px; margin: -10px 0 14px; overflow-x: auto; scrollbar-width: none; }
.library-chip { flex-shrink: 0; gap: 6px; min-height: 36px; padding: 6px 12px; font-size: 12px; }
.library-chip svg { width: 15px; height: 15px; }
.library-chip small, .library-nav small { color: var(--muted); font-size: 11px; }
.library-chip.active { border-color: var(--green); background: var(--accent-soft); color: var(--green); }
.library-nav-group h2 { margin: 6px 10px 6px; color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: .5px; text-transform: uppercase; }
.library-nav { justify-content: flex-start; gap: 10px; width: 100%; min-height: 38px; padding: 8px 12px; border: 0; border-radius: 12px; background: transparent; font-weight: 450; }
.library-nav > span { flex: 1; text-align: left; }
.library-nav svg { width: 17px; height: 17px; color: var(--muted); }
.library-nav.active { background: var(--accent-soft); color: var(--green); font-weight: 650; }
.library-nav.active svg { color: currentColor; }
.library-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.library-search { flex: 1 1 220px; }
.library-filters select { min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--field); color: var(--text); font-size: 12px; }
.select-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; padding: 10px 12px 10px 16px; border-radius: 14px; background: var(--accent-soft); font-size: 13px; }
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); gap: 14px; }
.file-card { position: relative; min-width: 0; }
.file-open { flex-direction: column; align-items: stretch; gap: 4px; width: 100%; padding: 8px 8px 12px; border-radius: 18px; text-align: left; font-weight: 400; }
.file-card.picked .file-open { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); background: var(--accent-soft); }
.file-thumb { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; margin-bottom: 6px; overflow: hidden; border-radius: 12px; background: var(--bg); color: var(--green); }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-thumb svg { width: 30px; height: 30px; }
.file-ext { position: absolute; bottom: 8px; right: 8px; padding: 1px 6px; border-radius: 6px; background: var(--panel); color: var(--muted); font-size: 10px; font-weight: 650; }
.file-name { overflow: hidden; padding: 0 4px; font-size: 13px; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { overflow: hidden; padding: 0 4px; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.file-check { position: absolute; top: 14px; left: 14px; display: grid; place-items: center; width: 24px; height: 24px; border: 2px solid var(--panel); border-radius: 50%; background: color-mix(in srgb, var(--panel) 70%, transparent); color: var(--on-accent); pointer-events: none; box-shadow: 0 0 0 1px var(--line); }
.file-card.picked .file-check { background: var(--green); }
.file-check svg { width: 14px; height: 14px; }
.library-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 45vh; padding: 30px; text-align: center; }
.library-empty svg { width: 34px; height: 34px; color: var(--muted); }
.library-empty strong { font-size: 15px; }
.library-empty p { max-width: 380px; margin: 0; font-size: 13px; }
.file-preview { display: flex; justify-content: center; }
.preview-image { max-width: 100%; max-height: 65vh; border-radius: 12px; }
.preview-media { width: 100%; max-height: 65vh; }
.preview-text { width: 100%; max-height: 60vh; margin: 0; padding: 16px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); font-size: 13px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
pre.preview-text { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.file-title { overflow-wrap: anywhere; }
.button-link { display: inline-flex; align-items: center; justify-content: center; min-height: 34px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; font-size: 12px; font-weight: 600; }
.button-link.primary { background: var(--green); border-color: var(--green); color: var(--on-accent); }
.button-link:hover { text-decoration: none; filter: brightness(1.08); }

/* Profile panel as an overlay below the widest layout. */
@media (min-width: 1200px) {
  .shell.with-panel { grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--panel-w); }
  .shell.with-sidebar.with-panel { grid-template-columns: var(--rail-w) var(--sidebar-w) minmax(0, 1fr) var(--panel-w); }
}
@media (max-width: 1199px) {
  .profile-panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 60; width: min(var(--panel-w), 100%); box-shadow: var(--shadow-pop); }
  .panel-backdrop { position: fixed; inset: 0; z-index: 59; display: block; background: #21193255; }
}
@media (max-width: 1000px) {
  :root { --sidebar-w: 240px; }
  .main-inner { padding-inline: 28px; }
  .helper-profile { grid-template-columns: minmax(0, 1fr) 200px; gap: 24px; }
  .chat-actions [data-action=show-browser] span:not(.live-dot), .chat-actions [data-action=show-chat] span, .chat-actions [data-action=stop] span { display: none; }
  .goal-summary { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
  .shell, .shell.with-sidebar { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .sidebar { display: none; }
  .main { grid-row: 1; grid-column: 1; }
  .rail { grid-row: 2; grid-column: 1; flex-direction: row; gap: 0; padding: 4px 4px max(4px, env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); background: var(--panel); }
  .rail-brand, .rail-extra, .rail-bottom > .theme-toggle { display: none; }
  .rail-items { flex-direction: row; flex: 5; gap: 0; }
  .rail-bottom { flex: 1; margin: 0; }
  .rail-item { min-height: 54px; padding: 7px 0 5px; border-radius: 14px; font-size: 10.5px; }
  .rail-item svg { width: 22px; height: 22px; }
  .rail-dot { border-color: var(--panel); }
  .more-menu { position: fixed; left: auto; right: 8px; bottom: calc(66px + env(safe-area-inset-bottom)); width: min(260px, calc(100vw - 16px)); max-height: calc(100dvh - 90px); overflow-y: auto; }
  .menu-mobile { display: flex !important; }
  .page-bot .rail { display: none; }
  .main-inner { padding: 0 18px 28px; }
  .chat-back { display: inline-flex; margin-left: -8px; }
  .chat-header { gap: 8px; min-height: 60px; padding: 8px 10px; }
  .chat-avatar { width: 40px; height: 40px; min-height: 40px; }
  .chat-avatar .creature { width: 30px; height: 33px; }
  .chat-title h1 { font-size: 16px; }
  .chat-title p { gap: 2px 8px; font-size: 11px; }
  .chat-title .badge { display: none; }
  .chat-actions { gap: 2px; }
  .chat-actions > button { width: 38px; min-width: 38px; padding: 0; border-color: transparent; background: transparent; }
  .chat-actions > button.icon-button { width: 38px; }
  .messages { padding: 12px 12px 10px; }
  .message-row { max-width: 92%; }
  .bubble { padding: 10px 14px; }
  .message-content { font-size: 15px; }
  .composer-dock { padding: 6px 8px max(8px, env(safe-area-inset-bottom)); }
  .composer-dock .composer { padding: 8px 8px 8px 12px; border-radius: 22px; }
  .composer-dock .composer textarea { height: 44px; font-size: 16px; }
  .composer-dock .composer-tools { flex-wrap: nowrap; }
  .browser-main { padding: 10px; }
  .profile-panel { width: 100%; border-left: 0; padding-bottom: env(safe-area-inset-bottom); }
  .profile-body { padding: 16px 16px 28px; }
  .chats-page { max-width: none; }
  .page-intro { margin: -10px 0 22px; font-size: 14px; }
  .feed-prompt { padding: 16px 16px; border-radius: 20px; }
  .feed-prompt > p { font-size: 14px; }
  .feed-meta { width: 100%; }
  .feed-post { gap: 10px; }
  .feed-avatar { width: 32px; }
  .feed-avatar .creature { width: 30px; height: 33px; }
  .feed-icon { height: 32px; border-radius: 10px; }
  .feed-body h2 { font-size: 16px; }
  .goal-card { flex-wrap: wrap; padding: 14px; }
  .goal-meter { flex-direction: row; align-items: center; width: 100%; padding-left: 56px; }
  .goal-header h1 { font-size: 23px; }
  .goal-header .goal-icon.large { width: 46px; height: 46px; }
  .library-chips { display: flex; }
  .library-actions .primary span { display: none; }
  .library-actions .primary { width: 38px; padding: 0; }
  .library-filters select { flex: 1; }
  .library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .file-open { padding: 6px 6px 10px; border-radius: 16px; }
  .home-intro { padding: 27px 0 24px; }
  .home-intro h1 { font-size: 35px; letter-spacing: -1.4px; }
  .home-intro p { font-size: 14px; }
  .home-composer { padding: 14px; }
  .home-ask { border-radius: 21px; }
  .helper-picker { gap: 6px; }
  .helper-picker > span { font-size: 10px; }
  .helper-chip { min-height: 35px; padding-right: 10px; gap: 4px; }
  .helper-chip .creature { width: 23px; height: 25px; }
  .composer textarea { font-size: 16px; }
  .home-composer textarea { height: 98px; margin-bottom: 14px; }
  .composer-bottom { flex-wrap: wrap; gap: 8px; }
  .composer-send { margin-left: auto; gap: 6px; }
  .composer-tools { gap: 6px; }
  .composer-send > .primary { padding-inline: 13px; max-width: 150px; font-size: 12px; }
  .attach-button { min-height: 38px; padding: 8px 10px; font-size: 11px; gap: 5px; }
  .home-suggestions { padding-top: 20px; }
  .suggestions { gap: 7px; }
  .suggestions button { min-height: 36px; padding: 8px 12px; font-size: 11px; }
  .helper-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .bot-card { padding: 14px 13px; border-radius: 17px; }
  .helper-heading { gap: 6px; }
  .helper-heading .creature { width: 38px; height: 42px; }
  .helper-heading h3 { font-size: 14px; }
  .helper-heading .badge { font-size: 9px; }
  .bot-card > p { font-size: 11px; }
  .helper-chat { font-size: 11px; min-height: 36px; padding: 8px; }
  .page-header { padding: 24px 0 20px; gap: 12px; }
  .page-header h1 { font-size: 27px; gap: 9px; }
  .page-header > button { min-height: 38px; padding: 8px 12px; font-size: 11px; gap: 5px; }
  .count { min-width: 24px; height: 24px; font-size: 11px; }
  .fleet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fleet-grid .bot-card { padding: 16px 13px; min-height: 220px; }
  .fleet-grid .helper-heading { flex-direction: column; align-items: flex-start; gap: 5px; }
  .fleet-grid .helper-heading .creature { width: 53px; height: 58px; }
  .fleet-grid .helper-heading h3 { font-size: 16px; }
  .fleet-grid .bot-card > p { font-size: 12px; }
  .fleet-grid .add-helper-card { padding: 16px; }
  .panel { padding: 21px; border-radius: 18px; margin-bottom: 16px; }
  .grid2, .apps-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .grid2 > div .panel:last-child { margin-bottom: 0; }
  .app-heading h2 { font-size: 16px; }
  .app-card > p { font-size: 12px; }
  .form-field input, .form-field select, .form-field textarea, .settings-row select, .identity-editor textarea, .feed-prompt textarea, .sidebar-search input, .library-search input, .owner-form select { font-size: 16px; }
  .form-row { gap: 12px; }
  .settings-row { gap: 16px; }
  .settings-row select { width: 150px; }
  .settings-row p { font-size: 11px; }
  .settings-row strong, .settings-row > label { font-size: 12px; }
  .history-filters { gap: 9px; }
  .history-filters .form-field { min-width: 0; flex: 1; }
  .activity-row { padding: 17px; gap: 12px; }
  .history-avatar { align-self: flex-start; }
  .history-avatar .creature { width: 33px; height: 37px; }
  .history-copy .spread { gap: 8px; flex-wrap: wrap; }
  .history-source { display: block; margin: 4px 0 0; }
  .history-copy p { font-size: 12px; }
  .history-copy time { font-size: 10px; }
  .history-arrow { display: none; }
  .chat-empty h3 { font-size: 19px; }
  .chat-empty p { font-size: 12px; }
  .helper-profile, .modal-content { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .preview { grid-row: 1; position: static; display: flex; align-items: center; gap: 16px; padding: 12px 16px; text-align: left; }
  .preview .creature { width: 65px; height: 70px; margin: 0; flex-shrink: 0; }
  .preview-name { margin: 0; font-size: 16px; }
  .modal-content { padding: 20px; }
  .modal-header { padding: 18px 20px; }
  .modal-header h2 { font-size: 20px; }
  .details-events { padding: 20px; }
  .modal-footer { padding: 15px 20px; flex-wrap: wrap; }
  .modal-footer .error-text:not(:empty) { width: 100%; }
  dialog { width: calc(100% - 24px); max-height: calc(100dvh - 24px); border-radius: 21px; }
  .notice.signin { flex-wrap: wrap; }
  #toast { left: 16px; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); max-width: none; }
}
@media (max-width: 370px) {
  .main-inner { padding-inline: 14px; }
  .home-intro h1 { font-size: 31px; }
  .home-composer { padding: 12px; }
  .home-composer .attach-button { width: 36px; padding: 8px; }
  .home-composer .attach-button span { display: none; }
  .page-header h1 { font-size: 24px; }
  .page-header > button { padding-inline: 10px; font-size: 10px; }
  .helper-grid { grid-template-columns: minmax(0, 1fr); }
  .helper-heading, .fleet-grid .helper-heading { flex-direction: row; align-items: center; gap: 10px; }
  .helper-heading .creature { width: 50px; height: 55px; }
  .bot-card > p { font-size: 12px; }
  .helper-chat { font-size: 12px; }
  .fleet-grid .bot-card { min-height: 190px; }
  .rail-item { font-size: 9.5px; }
  .chat-title p > span:first-child { max-width: 120px; }
  .composer-dock .talk__button { padding-inline: 9px; font-size: 11px; }
  .identity-cards { gap: 8px; }
  .identity-card { min-height: 104px; padding: 12px; }
  .library-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (pointer: coarse) { button.small { min-height: 40px; } .profile-tabs button { min-height: 52px; } .list-row a { padding-block: 10px; } .chat-options { opacity: 1; } .chat-link { min-height: 44px; } }
