Files
Cortex-Inara/cortex/static/style.css
Scott Idem 0ebfbc6590 Refactor UI into separate CSS/JS, add help modal and HELP.md
- static/index.html: reduced to 127-line HTML shell
- static/style.css: all styles extracted (~900 lines) + help modal styles
  + shared markdown rendering for file-preview and help-modal-body
  including tables (previously missing)
- static/app.js: all JS extracted (~900 lines) + help modal fetch/render
- index.html: adds ? help button + help modal HTML
- inara/HELP.md: comprehensive reference doc covering all features,
  keyboard shortcuts, API endpoints, memory system, planned items
- routers/files.py: HELP.md added to ALLOWED set
- context_loader.py: HELP.md loaded at tier 2+ (after PROTOCOLS.md)
  so Inara can reference it when helping Scott with the interface

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 21:52:54 -04:00

905 lines
30 KiB
CSS

* { box-sizing: border-box; margin: 0; padding: 0; }
/* ── Dark theme (default) ───────────────────────────────── */
:root {
--bg: #1a1228;
--surface: #221840;
--border: #3a2852;
--user-bg: #5c1528;
--user-border: #7a1f36;
--inara-bg: #261d42;
--inara-border: #3d2a55;
--accent: #c4935a;
--text: #e8e0f0;
--muted: #9080a8;
--error-bg: #3b0f0f;
--error-border: #7f1d1d;
--error-text: #fca5a5;
--shadow: rgba(0,0,0,0.55);
--modal-overlay: rgba(0,0,0,0.72);
--code-bg: rgba(0,0,0,0.30);
--pre-bg: rgba(0,0,0,0.35);
--success: #6abf6a;
--success-dim: #2a4a2a;
}
/* ── Light theme ─────────────────────────────────────────── */
@media (prefers-color-scheme: light) {
:root:not([data-theme="dark"]) {
--bg: #f2eef9;
--surface: #e8e1f4;
--border: #c0afd8;
--user-bg: #f5dae2;
--user-border: #d890aa;
--inara-bg: #ede5f8;
--inara-border: #b8a0d8;
--accent: #7a4818;
--text: #1c1030;
--muted: #60487a;
--error-bg: #fde8e8;
--error-border: #d88888;
--error-text: #8b0f0f;
--shadow: rgba(0,0,0,0.18);
--modal-overlay: rgba(0,0,0,0.45);
--code-bg: rgba(0,0,0,0.06);
--pre-bg: rgba(0,0,0,0.07);
--success: #1e6e1e;
--success-dim: #5aaa5a;
}
}
/* Manual overrides — take precedence over system preference */
[data-theme="dark"] {
--bg: #1a1228;
--surface: #221840;
--border: #3a2852;
--user-bg: #5c1528;
--user-border: #7a1f36;
--inara-bg: #261d42;
--inara-border: #3d2a55;
--accent: #c4935a;
--text: #e8e0f0;
--muted: #9080a8;
--error-bg: #3b0f0f;
--error-border: #7f1d1d;
--error-text: #fca5a5;
--shadow: rgba(0,0,0,0.55);
--modal-overlay: rgba(0,0,0,0.72);
--code-bg: rgba(0,0,0,0.30);
--pre-bg: rgba(0,0,0,0.35);
--success: #6abf6a;
--success-dim: #2a4a2a;
}
[data-theme="light"] {
--bg: #f2eef9;
--surface: #e8e1f4;
--border: #c0afd8;
--user-bg: #f5dae2;
--user-border: #d890aa;
--inara-bg: #ede5f8;
--inara-border: #b8a0d8;
--accent: #7a4818;
--text: #1c1030;
--muted: #60487a;
--error-bg: #fde8e8;
--error-border: #d88888;
--error-text: #8b0f0f;
--shadow: rgba(0,0,0,0.18);
--modal-overlay: rgba(0,0,0,0.45);
--code-bg: rgba(0,0,0,0.06);
--pre-bg: rgba(0,0,0,0.07);
--success: #1e6e1e;
--success-dim: #5aaa5a;
}
body {
font-family: system-ui, -apple-system, sans-serif;
background: var(--bg);
color: var(--text);
height: 100vh;
display: flex;
flex-direction: column;
}
header {
padding: 12px 20px;
background: var(--surface);
border-bottom: 1px solid var(--border);
display: flex;
align-items: center;
gap: 12px;
position: relative;
}
.header-emoji {
font-size: 1.6rem;
display: inline-block;
}
@keyframes shimmer {
0% { transform: scale(1) rotate(0deg); opacity: 1; }
25% { transform: scale(1.2) rotate(-12deg); opacity: 0.7; }
75% { transform: scale(1.2) rotate(12deg); opacity: 0.7; }
100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
.header-emoji.processing { animation: shimmer 0.75s ease-in-out infinite; }
header .name { font-size: 1.1rem; font-weight: 600; color: var(--accent); }
header .subtitle { font-size: 0.78rem; color: var(--muted); }
.hdr-btn {
background: var(--bg);
border: 1px solid var(--border);
border-radius: 6px;
color: var(--muted);
font-size: 0.75rem;
padding: 5px 10px;
cursor: pointer;
transition: border-color 0.15s, color 0.15s;
}
.hdr-btn:hover { border-color: var(--muted); color: var(--text); }
#backend-toggle.gemini { border-color: var(--success-dim); color: var(--success); }
#sessions-btn { margin-left: auto; }
/* Sessions panel */
#sessions-panel {
display: none;
position: absolute;
top: calc(100% + 4px);
right: 20px;
width: 300px;
max-height: 340px;
overflow-y: auto;
background: var(--surface);
border: 1px solid var(--border);
border-radius: 8px;
z-index: 100;
box-shadow: 0 8px 24px var(--shadow);
}
#sessions-panel.open { display: block; }
.session-item {
padding: 10px 14px;
cursor: pointer;
border-bottom: 1px solid var(--border);
display: flex;
justify-content: space-between;
align-items: center;
gap: 8px;
}
.session-item:last-child { border-bottom: none; }
.session-item:hover { background: var(--bg); }
.session-item.new { color: var(--accent); justify-content: center; }
.session-id {
font-family: monospace;
font-size: 0.85rem;
color: var(--text);
}
.session-meta {
font-size: 0.72rem;
color: var(--muted);
white-space: nowrap;
text-align: right;
flex-shrink: 0;
}
/* Messages */
#messages {
flex: 1;
overflow-y: auto;
padding: 20px;
display: flex;
flex-direction: column;
gap: 14px;
}
.message {
max-width: 75%;
padding: 10px 14px;
border-radius: 12px;
line-height: 1.55;
word-wrap: break-word;
font-size: 0.95rem;
}
.message.user { white-space: pre-wrap; }
.message.user {
align-self: flex-end;
background: var(--user-bg);
border: 1px solid var(--user-border);
border-bottom-right-radius: 3px;
}
.message.assistant {
align-self: flex-start;
background: var(--inara-bg);
border: 1px solid var(--inara-border);
border-bottom-left-radius: 3px;
}
/* Markdown rendering inside assistant messages */
.message.assistant p { margin: 0 0 0.6em; }
.message.assistant p:last-child { margin-bottom: 0; }
.message.assistant ul,
.message.assistant ol { margin: 0.4em 0 0.6em 1.4em; padding: 0; }
.message.assistant li { margin-bottom: 0.2em; }
.message.assistant h1,
.message.assistant h2,
.message.assistant h3 { margin: 0.8em 0 0.3em; font-weight: 600;
color: var(--accent); line-height: 1.3; }
.message.assistant h1 { font-size: 1.1em; }
.message.assistant h2 { font-size: 1.0em; }
.message.assistant h3 { font-size: 0.95em; }
.message.assistant strong { color: var(--text); font-weight: 600; }
.message.assistant em { color: var(--accent); font-style: italic; }
.message.assistant a { color: var(--accent); text-decoration: underline; }
.message.assistant hr { border: none; border-top: 1px solid var(--border);
margin: 0.8em 0; }
.message.assistant blockquote {
border-left: 3px solid var(--border);
margin: 0.5em 0;
padding: 0.2em 0.8em;
color: var(--muted);
}
.message.assistant code {
font-family: 'Courier New', monospace;
font-size: 0.88em;
background: var(--code-bg);
border: 1px solid var(--border);
border-radius: 4px;
padding: 0.1em 0.35em;
}
.message.assistant pre {
background: var(--pre-bg);
border: 1px solid var(--border);
border-radius: 6px;
padding: 10px 12px;
overflow-x: auto;
margin: 0.5em 0;
}
.message.assistant pre code {
background: none;
border: none;
padding: 0;
font-size: 0.85em;
}
.message.system {
align-self: center;
font-size: 0.72rem;
color: var(--muted);
background: none;
padding: 2px 0;
}
.message.error {
align-self: flex-start;
background: var(--error-bg);
border: 1px solid var(--error-border);
color: var(--error-text);
border-bottom-left-radius: 3px;
}
.message.thinking { color: var(--muted); font-style: italic; }
/* Copy button */
.message.assistant { position: relative; }
.copy-btn {
position: absolute;
top: 7px;
right: 8px;
background: var(--bg);
border: 1px solid var(--border);
border-radius: 4px;
color: var(--muted);
font-size: 0.7rem;
padding: 2px 7px;
cursor: pointer;
opacity: 0;
transition: opacity 0.15s, color 0.15s, border-color 0.15s;
}
.message.assistant:hover .copy-btn { opacity: 1; }
.copy-btn:hover { color: var(--text); border-color: var(--muted); }
.copy-btn.copied { color: var(--success); border-color: var(--success-dim); }
/* Note messages */
.message.note-private {
align-self: flex-end;
background: rgba(100, 70, 5, 0.15);
border: 1px dashed rgba(180, 130, 40, 0.45);
border-bottom-right-radius: 3px;
font-size: 0.9rem;
max-width: 70%;
}
.message.note-public {
align-self: flex-end;
background: rgba(5, 70, 70, 0.15);
border: 1px dashed rgba(40, 170, 150, 0.45);
border-bottom-right-radius: 3px;
font-size: 0.9rem;
max-width: 70%;
}
.note-label {
display: block;
font-size: 0.62rem;
font-weight: 600;
letter-spacing: 0.06em;
text-transform: uppercase;
margin-bottom: 5px;
opacity: 0.65;
}
.message.note-private .note-label { color: #c9a84c; }
.message.note-public .note-label { color: #4abfb0; }
.message.note-private .note-content { color: #c9a84c; white-space: pre-wrap; }
.message.note-public .note-content { color: #4abfb0; white-space: pre-wrap; }
/* ── Input area ────────────────────────────────────────────── */
#input-area {
padding: 14px 20px;
background: var(--surface);
border-top: 1px solid var(--border);
display: flex;
gap: 10px;
align-items: flex-end;
}
#input {
flex: 1;
background: var(--bg);
border: 1px solid var(--border);
border-radius: 8px;
color: var(--text);
padding: 10px 14px;
font-size: 0.95rem;
font-family: inherit;
resize: none;
line-height: 1.4;
overflow-y: auto;
transition: border-color 0.2s;
}
#input:focus { outline: none; border-color: var(--muted); }
#input.note-mode { border-color: rgba(180, 130, 40, 0.55); }
#input.note-mode:focus { border-color: rgba(180, 130, 40, 0.85); }
#input.note-mode.public { border-color: rgba(40, 170, 150, 0.55); }
#input.note-mode.public:focus { border-color: rgba(40, 170, 150, 0.85); }
/* Right column — all controls stacked, fixed width */
#right-col {
display: flex;
flex-direction: column;
align-items: stretch;
gap: 4px;
flex-shrink: 0;
width: 88px;
}
/* Semi-hidden controls: height selector row */
#height-row {
display: none; /* shown by JS when content > 3 lines */
align-items: center;
gap: 4px;
}
#height-row span {
font-size: 0.65rem;
color: var(--muted);
flex-shrink: 0;
}
#height-sel {
flex: 1;
background: var(--bg);
border: 1px solid var(--border);
border-radius: 5px;
color: var(--muted);
font-size: 0.65rem;
padding: 2px 4px;
cursor: pointer;
min-width: 0;
}
#height-sel:focus { outline: none; border-color: var(--muted); }
/* Semi-hidden: enter-mode toggle */
#enter-toggle {
display: none; /* shown by JS when content > 3 lines */
background: var(--bg);
border: 1px solid var(--border);
border-radius: 5px;
color: var(--muted);
font-size: 0.68rem;
padding: 3px 6px;
cursor: pointer;
text-align: center;
transition: border-color 0.15s, color 0.15s;
}
#enter-toggle:hover { border-color: var(--muted); color: var(--text); }
/* Note type toggle — only visible in note mode */
#note-type-btn {
display: none;
background: var(--bg);
border: 1px solid rgba(180, 130, 40, 0.4);
border-radius: 5px;
color: rgba(180, 130, 40, 0.85);
font-size: 0.68rem;
padding: 3px 6px;
cursor: pointer;
text-align: center;
transition: opacity 0.15s;
}
#note-type-btn.public {
border-color: rgba(40, 170, 150, 0.4);
color: rgba(40, 170, 150, 0.85);
}
#note-type-btn:hover { opacity: 0.75; }
/* Note button */
#note-btn {
background: var(--bg);
border: 1px solid var(--border);
color: var(--muted);
border-radius: 8px;
padding: 8px 0;
cursor: pointer;
font-size: 0.85rem;
text-align: center;
transition: border-color 0.15s, color 0.15s;
}
#note-btn:hover { border-color: var(--muted); color: var(--text); }
#note-btn.active { border-color: rgba(180, 130, 40, 0.6); color: #c9a84c; }
#note-btn.active.public { border-color: rgba(40, 170, 150, 0.6); color: #4abfb0; }
/* Send button */
#send {
background: var(--user-bg);
border: 1px solid var(--user-border);
color: var(--text);
border-radius: 8px;
padding: 10px 0;
cursor: pointer;
font-size: 0.9rem;
text-align: center;
transition: background 0.15s;
}
#send:hover { background: var(--user-border); }
#send:disabled { background: var(--surface); color: var(--muted);
border-color: var(--border); cursor: not-allowed; }
/* Stop button */
#stop {
display: none;
background: var(--error-bg);
border: 1px solid var(--error-border);
color: var(--error-text);
border-radius: 8px;
padding: 10px 0;
cursor: pointer;
font-size: 0.9rem;
text-align: center;
transition: background 0.15s;
}
#stop:hover { background: #5c1a1a; }
#session-id {
font-size: 0.7rem;
color: var(--border);
padding: 0 20px 6px;
background: var(--surface);
}
/* ── Message wrappers (edit/delete controls) ──────────────── */
.msg-wrapper {
display: flex;
flex-direction: column;
max-width: 75%;
}
.msg-wrapper.user { align-self: flex-end; }
.msg-wrapper.assistant { align-self: flex-start; }
/* Inner message fills wrapper width */
.msg-wrapper .message.user,
.msg-wrapper .message.assistant {
align-self: stretch;
max-width: none;
}
.msg-actions {
display: flex;
gap: 4px;
opacity: 0;
transition: opacity 0.15s;
padding: 2px 2px 0;
}
.msg-wrapper.user .msg-actions { justify-content: flex-end; }
.msg-wrapper.assistant .msg-actions { justify-content: flex-start; }
.msg-wrapper:hover .msg-actions { opacity: 1; }
.msg-act-btn {
background: none;
border: 1px solid var(--border);
border-radius: 4px;
color: var(--muted);
font-size: 0.65rem;
padding: 1px 6px;
cursor: pointer;
transition: color 0.15s, border-color 0.15s;
}
.msg-act-btn:hover { color: var(--text); border-color: var(--muted); }
.msg-act-btn.del:hover { color: var(--error-text); border-color: var(--error-border); }
/* Inline edit */
.edit-textarea {
width: 100%;
background: var(--bg);
border: 1px solid var(--muted);
border-radius: 6px;
color: var(--text);
padding: 6px 10px;
font-size: 0.9rem;
font-family: inherit;
resize: vertical;
line-height: 1.4;
}
.edit-textarea:focus { outline: none; border-color: var(--accent); }
.edit-btns {
display: flex;
gap: 6px;
margin-top: 6px;
justify-content: flex-end;
}
.edit-save-btn, .edit-cancel-btn {
background: none;
border: 1px solid var(--border);
border-radius: 4px;
color: var(--muted);
font-size: 0.75rem;
padding: 3px 10px;
cursor: pointer;
transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.edit-save-btn { border-color: var(--inara-border); color: var(--accent); }
.edit-save-btn:hover { background: var(--inara-bg); }
.edit-cancel-btn:hover { color: var(--text); border-color: var(--muted); }
/* ── File editor modal ───────────────────────────────────── */
#file-modal {
display: none;
position: fixed;
inset: 0;
background: var(--modal-overlay);
z-index: 200;
align-items: center;
justify-content: center;
}
#file-modal.open { display: flex; }
#file-modal-inner {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 10px;
width: min(860px, 96vw);
height: min(82vh, 800px);
display: flex;
flex-direction: column;
overflow: hidden;
}
#file-modal-header {
display: flex;
align-items: center;
gap: 8px;
padding: 10px 14px;
border-bottom: 1px solid var(--border);
background: var(--bg);
flex-shrink: 0;
}
#file-modal-header select {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 5px;
color: var(--text);
font-size: 0.85rem;
padding: 4px 8px;
cursor: pointer;
}
#file-modal-title {
font-size: 0.9rem;
font-weight: 600;
color: var(--accent);
flex: 1;
}
.fm-btn {
background: var(--bg);
border: 1px solid var(--border);
border-radius: 5px;
color: var(--muted);
font-size: 0.75rem;
padding: 4px 10px;
cursor: pointer;
transition: color 0.15s, border-color 0.15s;
}
.fm-btn:hover { color: var(--text); border-color: var(--muted); }
.fm-btn.active { color: var(--accent); border-color: var(--accent); }
.fm-btn.save { color: var(--accent); border-color: var(--inara-border); }
.fm-btn.save:hover { background: var(--inara-bg); }
#file-saved-msg {
font-size: 0.75rem;
color: #6abf6a;
opacity: 0;
transition: opacity 0.3s;
}
#file-saved-msg.show { opacity: 1; }
#file-modal-body {
flex: 1;
overflow: hidden;
display: flex;
flex-direction: column;
}
#file-editor {
flex: 1;
width: 100%;
background: var(--bg);
color: var(--text);
border: none;
outline: none;
padding: 16px;
font-family: 'Courier New', monospace;
font-size: 0.85rem;
line-height: 1.55;
resize: none;
display: block;
}
#file-preview {
flex: 1;
overflow-y: auto;
padding: 16px 20px;
display: none;
line-height: 1.6;
}
#file-preview.active { display: block; }
#file-editor.hidden { display: none; }
/* Talk activity badge on Sessions button */
#sessions-btn.talk-badge::after {
content: '●';
color: #7cb9e8;
margin-left: 5px;
font-size: 0.55rem;
vertical-align: middle;
}
/* ── Context panel ───────────────────────────────────────── */
#ctx-panel {
display: none;
position: absolute;
top: calc(100% + 4px);
right: 20px;
width: 280px;
background: var(--surface);
border: 1px solid var(--border);
border-radius: 8px;
z-index: 100;
box-shadow: 0 8px 24px var(--shadow);
overflow: hidden;
}
#ctx-panel.open { display: block; }
.ctx-section {
padding: 10px 14px;
border-bottom: 1px solid var(--border);
}
.ctx-section:last-child { border-bottom: none; }
.ctx-section-title {
font-size: 0.65rem;
font-weight: 600;
letter-spacing: 0.05em;
text-transform: uppercase;
color: var(--muted);
margin-bottom: 8px;
}
.ctx-row {
display: flex;
gap: 6px;
flex-wrap: wrap;
}
.ctx-btn {
background: var(--bg);
border: 1px solid var(--border);
border-radius: 4px;
color: var(--muted);
font-size: 0.73rem;
padding: 4px 10px;
cursor: pointer;
transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.ctx-btn:hover { color: var(--text); border-color: var(--muted); }
.ctx-btn.active { color: var(--accent); border-color: var(--accent); }
.ctx-btn.mem-on { color: var(--success); border-color: var(--success-dim); }
#ctx-distill-status {
margin-top: 6px;
font-size: 0.68rem;
color: var(--success);
min-height: 1em;
opacity: 0;
transition: opacity 0.3s;
}
#ctx-distill-status.show { opacity: 1; }
#ctx-distill-status.err { color: var(--error-text); }
/* Theme toggle + font size */
#theme-btn { font-size: 0.85rem; padding: 5px 8px; }
#font-size-btn { min-width: 32px; text-align: center; }
/* Ctx header button — shows current tier as a dim superscript */
#ctx-open-btn .tier-badge {
font-size: 0.6em;
opacity: 0.7;
margin-left: 2px;
vertical-align: super;
}
/* ── Help modal ──────────────────────────────────────────── */
#help-modal {
display: none;
position: fixed;
inset: 0;
background: var(--modal-overlay);
z-index: 200;
align-items: center;
justify-content: center;
}
#help-modal.open { display: flex; }
#help-modal-inner {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 10px;
width: min(780px, 96vw);
height: min(85vh, 860px);
display: flex;
flex-direction: column;
overflow: hidden;
}
#help-modal-header {
display: flex;
align-items: center;
gap: 10px;
padding: 10px 16px;
border-bottom: 1px solid var(--border);
background: var(--bg);
flex-shrink: 0;
}
#help-modal-header h2 {
font-size: 0.95rem;
font-weight: 600;
color: var(--accent);
flex: 1;
margin: 0;
}
#help-modal-body {
flex: 1;
overflow-y: auto;
padding: 20px 24px;
line-height: 1.65;
font-size: 0.92rem;
}
/* Markdown rendering shared by file-preview and help-modal-body */
#file-preview, #help-modal-body {
color: var(--text);
}
#file-preview p, #help-modal-body p { margin: 0 0 0.7em; }
#file-preview p:last-child,
#help-modal-body p:last-child { margin-bottom: 0; }
#file-preview ul, #file-preview ol,
#help-modal-body ul, #help-modal-body ol { margin: 0.4em 0 0.7em 1.5em; }
#file-preview li, #help-modal-body li { margin-bottom: 0.25em; }
#file-preview h1, #file-preview h2, #file-preview h3,
#help-modal-body h1, #help-modal-body h2,
#help-modal-body h3 {
margin: 1em 0 0.4em;
font-weight: 600;
color: var(--accent);
line-height: 1.3;
}
#file-preview h1, #help-modal-body h1 { font-size: 1.15em; }
#file-preview h2, #help-modal-body h2 { font-size: 1.05em; }
#file-preview h3, #help-modal-body h3 { font-size: 0.95em; }
#file-preview strong, #help-modal-body strong { color: var(--text); font-weight: 600; }
#file-preview em, #help-modal-body em { color: var(--accent); font-style: italic; }
#file-preview a, #help-modal-body a { color: var(--accent); text-decoration: underline; }
#file-preview hr, #help-modal-body hr {
border: none;
border-top: 1px solid var(--border);
margin: 0.9em 0;
}
#file-preview blockquote, #help-modal-body blockquote {
border-left: 3px solid var(--border);
margin: 0.5em 0;
padding: 0.2em 0.8em;
color: var(--muted);
}
#file-preview code, #help-modal-body code {
font-family: 'Courier New', monospace;
font-size: 0.88em;
background: var(--code-bg);
border: 1px solid var(--border);
border-radius: 4px;
padding: 0.1em 0.35em;
}
#file-preview pre, #help-modal-body pre {
background: var(--pre-bg);
border: 1px solid var(--border);
border-radius: 6px;
padding: 10px 12px;
overflow-x: auto;
margin: 0.5em 0;
}
#file-preview pre code, #help-modal-body pre code {
background: none;
border: none;
padding: 0;
font-size: 0.85em;
}
#file-preview table, #help-modal-body table {
border-collapse: collapse;
width: 100%;
margin: 0.6em 0;
font-size: 0.9em;
}
#file-preview th, #file-preview td,
#help-modal-body th, #help-modal-body td {
border: 1px solid var(--border);
padding: 5px 10px;
text-align: left;
}
#file-preview th, #help-modal-body th {
background: var(--bg);
color: var(--accent);
font-weight: 600;
}