diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5540135 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,58 @@ +# ============================================ +# Chat Switchboard v0.5 - Unified Dockerfile +# ============================================ +# Stage 1: Build Go backend +# Stage 2: Download JS vendor libs (marked, DOMPurify) +# Stage 3: Production image (nginx + backend) +# +# Vendor libs are baked in during build so the +# app works in disconnected (SCIF) environments +# with no CDN access. +# ============================================ + +# ── Stage 1: Go backend build ──────────────── +FROM golang:1.22-bookworm AS backend + +WORKDIR /app +COPY server/go.mod server/go.sum* ./ +COPY server/ . +RUN go mod download && go mod tidy && go mod verify +RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o /bin/switchboard . + +# ── Stage 2: Vendor JS libs ───────────────── +FROM node:20-alpine AS vendor + +WORKDIR /vendor +RUN npm pack marked@16.3.0 && \ + tar xzf marked-16.3.0.tgz && \ + cp package/lib/marked.umd.js marked.min.js && \ + rm -rf package marked-16.3.0.tgz + +RUN npm pack dompurify@3.2.4 && \ + tar xzf dompurify-3.2.4.tgz && \ + cp package/dist/purify.min.js purify.min.js && \ + rm -rf package dompurify-3.2.4.tgz + +# ── Stage 3: Production ───────────────────── +FROM nginx:1-alpine + +RUN apk add --no-cache bash + +# Go backend binary +COPY --from=backend /bin/switchboard /usr/local/bin/switchboard + +# Frontend static files +COPY src/ /usr/share/nginx/html/ + +# Vendor libs (overwrite any existing copies in src/vendor/) +COPY --from=vendor /vendor/marked.min.js /usr/share/nginx/html/vendor/marked.min.js +COPY --from=vendor /vendor/purify.min.js /usr/share/nginx/html/vendor/purify.min.js + +# nginx config +COPY nginx.conf /etc/nginx/conf.d/default.conf + +# Entrypoint: start Go backend, then nginx +COPY docker-entrypoint.sh /docker-entrypoint.d/90-start-backend.sh +RUN chmod +x /docker-entrypoint.d/90-start-backend.sh + +EXPOSE 80 diff --git a/VERSION b/VERSION index 267577d..cb0c939 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.4.1 +0.5.2 diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100644 index 0000000..f905b01 --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# ============================================ +# Chat Switchboard - Backend Launcher +# ============================================ +# Runs as an nginx entrypoint.d hook. +# Starts the Go backend in the background +# before nginx begins accepting connections. +# ============================================ + +set -e + +echo "🔀 Starting Chat Switchboard backend..." + +# Launch Go backend in background +/usr/local/bin/switchboard & +BACKEND_PID=$! + +# Wait for backend to be ready (max 10s) +for i in $(seq 1 20); do + if wget -q --spider http://localhost:${PORT:-8080}/health 2>/dev/null; then + echo "✅ Backend ready (PID ${BACKEND_PID})" + exit 0 + fi + sleep 0.5 +done + +echo "❌ Backend failed to start within 10s" +exit 1 diff --git a/src/css/styles.css b/src/css/styles.css index a4cc24b..1afb765 100644 --- a/src/css/styles.css +++ b/src/css/styles.css @@ -1,1569 +1,529 @@ /* ========================================== - Chat Switchboard - Styles + Chat Switchboard v0.5.2 + Clean utility layout · Open WebUI inspired ========================================== */ -* { - margin: 0; - padding: 0; - box-sizing: border-box; -} - :root { - --bg-primary: #212121; - --bg-secondary: #171717; - --bg-tertiary: #2f2f2f; - --text-primary: #ececec; - --text-secondary: #b4b4b4; - --accent: #10a37f; - --accent-hover: #0d8a6a; - --border: #3a3a3a; - --code-bg: #1e1e1e; - --error: #ff6b6b; - --success: #10a37f; - --warning: #ffd93d; - --thinking-bg: #1a1a2e; - --thinking-border: #4a4a6a; - --thinking-text: #a0a0c0; + --bg: #0e0e10; + --bg-surface: #18181b; + --bg-raised: #222227; + --bg-hover: #2a2a30; + --border: #2e2e35; + --border-light: #3a3a42; + --text: #e8e8ed; + --text-2: #9898a8; + --text-3: #6b6b7b; + --accent: #6c9fff; + --accent-hover: #84b0ff; + --accent-dim: rgba(108,159,255,0.12); + --danger: #ef4444; + --success: #22c55e; + --warning: #eab308; + --radius: 8px; + --radius-lg: 12px; + --sidebar-w: 260px; + --sidebar-rail: 52px; + --font: 'Söhne', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; + --mono: 'Söhne Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace; + --transition: 180ms ease; } -body { - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif; - background: var(--bg-primary); - color: var(--text-primary); - min-height: 100vh; - display: flex; - flex-direction: column; -} +*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; } +html, body { height: 100%; } +body { font-family: var(--font); background: var(--bg); color: var(--text); overflow: hidden; font-size: 14px; } +a { color: var(--accent); text-decoration: none; } +a:hover { text-decoration: underline; } +::selection { background: var(--accent-dim); } -/* Header */ -.header { - background: var(--bg-secondary); - padding: 1rem 2rem; - border-bottom: 1px solid var(--border); - display: flex; - justify-content: space-between; - flex-shrink: 0; - align-items: center; - flex-wrap: wrap; - gap: 1rem; -} +/* ── App Shell ───────────────────────────── */ -.header h1 { - font-size: 1.5rem; - font-weight: 600; - color: var(--accent); -} +.app { display: flex; height: 100vh; } -.header-actions { - display: flex; - gap: 0.5rem; - flex-wrap: wrap; - align-items: center; -} +/* ── Sidebar ─────────────────────────────── */ -/* Buttons */ -.btn { - padding: 0.5rem 1rem; - border: none; - border-radius: 6px; - cursor: pointer; - font-size: 0.875rem; - font-weight: 500; - transition: all 0.2s ease; - display: flex; - align-items: center; - gap: 0.5rem; -} - -.btn-primary { background: var(--accent); color: white; } -.btn-primary:hover { background: var(--accent-hover); } -.btn-secondary { background: var(--bg-tertiary); color: var(--text-primary); border: 1px solid var(--border); } -.btn-secondary:hover { background: var(--border); } -.btn-danger { background: transparent; color: var(--error); border: 1px solid var(--error); } -.btn-danger:hover { background: var(--error); color: white; } -.btn-small { padding: 0.25rem 0.5rem; font-size: 0.75rem; } -.btn:disabled { opacity: 0.5; cursor: not-allowed; } - -/* Layout */ -.main-container { - display: flex; - flex: 1; - min-height: 0; - overflow: hidden; -} - -/* Sidebar */ .sidebar { - width: 260px; - background: var(--bg-secondary); + width: var(--sidebar-w); background: var(--bg-surface); border-right: 1px solid var(--border); - display: flex; - flex-direction: column; - transition: width 0.3s ease; + display: flex; flex-direction: column; + transition: width var(--transition); + overflow: hidden; flex-shrink: 0; } +.sidebar.collapsed { width: var(--sidebar-rail); } -.sidebar.collapsed { width: 0; overflow: hidden; } - -.sidebar-header { - padding: 1rem; +.sidebar-top { + display: flex; flex-direction: column; gap: 2px; + padding: 10px 10px 8px; border-bottom: 1px solid var(--border); } -.sidebar-title { - font-weight: 600; - font-size: 0.875rem; - color: var(--text-secondary); - text-transform: uppercase; - letter-spacing: 0.5px; +.sb-btn { + display: flex; align-items: center; gap: 10px; + padding: 8px 10px; border-radius: var(--radius); + background: none; border: none; color: var(--text-2); + cursor: pointer; font-size: 13px; white-space: nowrap; + transition: background var(--transition), color var(--transition); + width: 100%; } +.sb-btn:hover { background: var(--bg-hover); color: var(--text); } +.sb-btn svg { flex-shrink: 0; } +.sb-label { overflow: hidden; transition: opacity var(--transition); } +.sidebar.collapsed .sb-label { opacity: 0; width: 0; } -.new-chat-btn { margin: 1rem; width: calc(100% - 2rem); } - -.chat-history { flex: 1; overflow-y: auto; padding: 0.5rem; } - -.chat-history-item { - padding: 0.75rem 1rem; - border-radius: 6px; - cursor: pointer; - margin-bottom: 0.25rem; - transition: background 0.2s ease; - display: flex; - justify-content: space-between; - align-items: center; - gap: 0.5rem; +/* Chat list */ +.sidebar-chats { + flex: 1; overflow-y: auto; overflow-x: hidden; + padding: 8px 6px; } +.sidebar-chats::-webkit-scrollbar { width: 4px; } +.sidebar-chats::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; } -.chat-history-item:hover { background: var(--bg-tertiary); } -.chat-history-item.active { background: var(--bg-tertiary); border-left: 3px solid var(--accent); } +.chat-group-label { + font-size: 11px; font-weight: 600; color: var(--text-3); + padding: 12px 10px 4px; text-transform: uppercase; letter-spacing: 0.5px; + white-space: nowrap; overflow: hidden; +} +.sidebar.collapsed .chat-group-label { display: none; } -.chat-history-item .title { - flex: 1; +.chat-item { + display: flex; align-items: center; gap: 8px; + padding: 7px 10px; border-radius: var(--radius); + cursor: pointer; font-size: 13px; color: var(--text-2); + transition: background var(--transition); position: relative; + overflow: hidden; +} +.chat-item:hover { background: var(--bg-hover); color: var(--text); } +.chat-item.active { background: var(--bg-raised); color: var(--text); } +.chat-item-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } +.chat-item-time { + font-size: 10px; color: var(--text-3); flex-shrink: 0; white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - font-size: 0.875rem; +} +.chat-item-delete { + opacity: 0; position: absolute; right: 6px; background: var(--bg-raised); + border: none; color: var(--text-3); cursor: pointer; font-size: 11px; + padding: 2px 6px; border-radius: 4px; transition: opacity var(--transition); +} +.chat-item:hover .chat-item-delete { opacity: 1; } +.chat-item:hover .chat-item-time { display: none; } +.sidebar.collapsed .chat-item-title, +.sidebar.collapsed .chat-item-time, +.sidebar.collapsed .chat-item-delete { display: none; } + +.sidebar-empty { + color: var(--text-3); font-size: 12px; text-align: center; padding: 2rem 0.5rem; +} +.sidebar.collapsed .sidebar-empty { display: none; } + +/* User area */ +.sidebar-bottom { + border-top: 1px solid var(--border); + padding: 8px 10px; position: relative; } -.chat-history-item .item-actions { - display: flex; - gap: 0.25rem; - opacity: 0; - transition: opacity 0.2s; +.user-btn { + display: flex; align-items: center; gap: 10px; + padding: 6px 8px; border-radius: var(--radius); + background: none; border: none; color: var(--text); + cursor: pointer; width: 100%; + transition: background var(--transition); } +.user-btn:hover { background: var(--bg-hover); } -.chat-history-item:hover .item-actions { opacity: 1; } - -.chat-history-item .item-btn { - background: none; - border: none; - color: var(--text-secondary); - cursor: pointer; - padding: 0.25rem; - border-radius: 4px; - transition: all 0.2s; +.user-avatar { + width: 30px; height: 30px; border-radius: 50%; + background: var(--bg-raised); display: flex; align-items: center; + justify-content: center; font-size: 13px; font-weight: 600; + color: var(--accent); flex-shrink: 0; position: relative; } - -.chat-history-item .item-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.1); } -.chat-history-item .item-btn.delete:hover { color: var(--error); background: rgba(255, 107, 107, 0.1); } - -/* Chat Area */ -.chat-area { - flex: 1; - display: flex; - flex-direction: column; - overflow: hidden; - min-height: 0; +.avatar-dot { + position: absolute; bottom: -1px; right: -1px; + width: 9px; height: 9px; border-radius: 50%; + background: var(--success); border: 2px solid var(--bg-surface); } +.user-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } -.chat-messages { - flex: 1; - overflow-y: auto; - padding: 1rem 2rem; - min-height: 0; +/* Flyout */ +.user-flyout { + display: none; position: absolute; bottom: 100%; left: 8px; right: 8px; + background: var(--bg-raised); border: 1px solid var(--border-light); + border-radius: var(--radius-lg); padding: 4px; margin-bottom: 4px; + box-shadow: 0 -4px 24px rgba(0,0,0,0.5); z-index: 200; } +.user-flyout.open { display: block; } + +.flyout-item { + display: flex; align-items: center; gap: 10px; + padding: 8px 12px; border-radius: var(--radius); + background: none; border: none; color: var(--text-2); + cursor: pointer; font-size: 13px; width: 100%; + transition: background var(--transition), color var(--transition); +} +.flyout-item:hover { background: var(--bg-hover); color: var(--text); } +.flyout-item svg { flex-shrink: 0; } +.flyout-danger:hover { color: var(--danger); } +.flyout-divider { height: 1px; background: var(--border); margin: 4px 8px; } + +/* ── Chat Area ───────────────────────────── */ + +.chat-area { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg); } + +.model-bar { + display: flex; align-items: center; gap: 6px; + padding: 8px 16px; flex-shrink: 0; +} +.model-bar select { + background: transparent; border: 1px solid transparent; + color: var(--text); font-size: 14px; font-weight: 500; + padding: 4px 8px; border-radius: var(--radius); cursor: pointer; + font-family: var(--font); max-width: 300px; + transition: border-color var(--transition); +} +.model-bar select:hover { border-color: var(--border); } +.model-bar select:focus { outline: none; border-color: var(--accent); } +.model-bar select option { background: var(--bg-surface); color: var(--text); } + +.icon-btn { + background: none; border: none; color: var(--text-3); cursor: pointer; + padding: 4px; border-radius: 4px; + transition: color var(--transition); +} +.icon-btn:hover { color: var(--text); } /* Messages */ -.message { - max-width: 800px; - margin: 0 auto 1.5rem; - animation: fadeIn 0.3s ease; +.messages { flex: 1; overflow-y: auto; scroll-behavior: smooth; } +.messages::-webkit-scrollbar { width: 6px; } +.messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; } + +.message { padding: 1.25rem 0; } +.message:not(:last-child) { border-bottom: 1px solid rgba(255,255,255,0.03); } + +.msg-inner { max-width: 768px; margin: 0 auto; padding: 0 1.5rem; display: flex; gap: 1rem; } + +.msg-avatar { + width: 28px; height: 28px; border-radius: 50%; + display: flex; align-items: center; justify-content: center; + font-size: 14px; flex-shrink: 0; margin-top: 2px; } +.message.user .msg-avatar { background: var(--accent-dim); } +.message.assistant .msg-avatar { background: var(--bg-raised); } -@keyframes fadeIn { - from { opacity: 0; transform: translateY(10px); } - to { opacity: 1; transform: translateY(0); } +.msg-body { flex: 1; min-width: 0; } +.msg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; } +.msg-role { font-size: 13px; font-weight: 600; } +.msg-time { font-size: 11px; color: var(--text-3); } +.msg-actions { + margin-left: auto; display: flex; gap: 2px; opacity: 0; + transition: opacity var(--transition); } - -.message-content { - display: flex; - gap: 1rem; - align-items: flex-start; +.message:hover .msg-actions { opacity: 1; } +.msg-action-btn { + background: none; border: none; color: var(--text-3); cursor: pointer; + padding: 2px 6px; border-radius: 4px; font-size: 11px; + transition: background var(--transition), color var(--transition); } +.msg-action-btn:hover { background: var(--bg-hover); color: var(--text); } -.message-avatar { - width: 36px; - height: 36px; - border-radius: 6px; - display: flex; - align-items: center; - justify-content: center; - font-size: 1.25rem; - flex-shrink: 0; +.msg-text { font-size: 14px; line-height: 1.7; } + +/* ── Markdown Content ────────────────────── */ + +.msg-text p { margin: 0.4em 0; } +.msg-text p:first-child { margin-top: 0; } +.msg-text p:last-child { margin-bottom: 0; } + +.msg-text pre { + background: var(--bg-surface); border: 1px solid var(--border); + padding: 0.75rem 1rem; border-radius: var(--radius); + overflow-x: auto; margin: 0.75rem 0; position: relative; + font-size: 13px; } - -.message.user .message-avatar { background: var(--accent); } -.message.assistant .message-avatar { background: linear-gradient(135deg, #6366f1, #8b5cf6); } - -.message-body { flex: 1; min-width: 0; } - -.message-header { - display: flex; - justify-content: space-between; - align-items: center; - margin-bottom: 0.5rem; -} - -.message-role { - font-weight: 600; - font-size: 0.875rem; - color: var(--text-secondary); -} - -.message-time { - font-size: 0.7rem; - color: var(--text-secondary); -} - -.message-actions { - display: flex; - gap: 0.25rem; - opacity: 0; - transition: opacity 0.2s; -} - -.message:hover .message-actions { opacity: 1; } - -.message-action-btn { - background: none; - border: none; - color: var(--text-secondary); - cursor: pointer; - padding: 0.25rem 0.5rem; +.msg-text code { + font-family: var(--mono); font-size: 0.9em; + background: var(--bg-raised); padding: 0.15em 0.4em; border-radius: 4px; - font-size: 0.7rem; - transition: all 0.2s; } - -.message-action-btn:hover { color: var(--text-primary); background: var(--bg-tertiary); } - -.message-text { - line-height: 1.6; - word-wrap: break-word; -} - -.message-text p { margin-bottom: 0.75rem; } -.message-text p:last-child { margin-bottom: 0; } - -/* Code blocks */ -.message-text code { - background: var(--code-bg); - padding: 0.2rem 0.4rem; - border-radius: 4px; - font-family: 'Fira Code', 'Monaco', 'Consolas', monospace; - font-size: 0.875em; -} - -.message-text pre { - background: var(--code-bg); - padding: 1rem; - border-radius: 8px; - overflow-x: auto; - margin: 0.75rem 0; - position: relative; -} - -.message-text pre code { background: none; padding: 0; } - +.msg-text pre code { background: none; padding: 0; font-size: inherit; } .copy-code-btn { - position: absolute; - top: 0.5rem; - right: 0.5rem; - background: var(--bg-tertiary); - border: 1px solid var(--border); - color: var(--text-secondary); - padding: 0.25rem 0.5rem; - border-radius: 4px; - font-size: 0.7rem; - cursor: pointer; - opacity: 0; - transition: opacity 0.2s; + position: absolute; top: 6px; right: 6px; background: var(--bg-raised); + border: 1px solid var(--border); color: var(--text-3); border-radius: 4px; + padding: 2px 10px; font-size: 11px; cursor: pointer; + opacity: 0; transition: opacity var(--transition); +} +.msg-text pre:hover .copy-code-btn { opacity: 1; } +.copy-code-btn:hover { color: var(--text); border-color: var(--border-light); } + +.msg-text ul, .msg-text ol { margin: 0.4em 0; padding-left: 1.5em; } +.msg-text li { margin: 0.2em 0; } +.msg-text li > p { margin: 0.2em 0; } + +.msg-text blockquote { + border-left: 3px solid var(--accent); padding: 0.25em 0.75em; margin: 0.5em 0; + color: var(--text-2); background: var(--accent-dim); border-radius: 0 var(--radius) var(--radius) 0; } -.message-text pre:hover .copy-code-btn { opacity: 1; } -.copy-code-btn:hover { background: var(--border); color: var(--text-primary); } +.msg-text hr { border: none; border-top: 1px solid var(--border); margin: 0.75em 0; } -/* ========================================== - THINKING BLOCKS - Collapsible & Styled - ========================================== */ +.msg-text table { border-collapse: collapse; width: 100%; margin: 0.5em 0; font-size: 13px; } +.msg-text th, .msg-text td { border: 1px solid var(--border); padding: 0.4em 0.7em; text-align: left; } +.msg-text th { background: var(--bg-raised); font-weight: 600; } + +.msg-text h1, .msg-text h2, .msg-text h3, .msg-text h4 { margin: 0.75em 0 0.3em; font-weight: 600; } +.msg-text h1 { font-size: 1.4em; } +.msg-text h2 { font-size: 1.2em; } +.msg-text h3 { font-size: 1.05em; } + +.msg-text a { color: var(--accent); } +.msg-text img { max-width: 100%; border-radius: var(--radius); } + +/* Thinking blocks */ .thinking-block { - background: var(--thinking-bg); - border: 1px solid var(--thinking-border); - border-radius: 8px; - margin: 0.75rem 0; - overflow: hidden; + border: 1px solid rgba(108,159,255,0.12); border-radius: var(--radius); + margin: 0.5rem 0; background: rgba(108,159,255,0.03); } - -.thinking-header { - display: flex; - align-items: center; - gap: 0.5rem; - padding: 0.5rem 1rem; - background: rgba(74, 74, 106, 0.3); - cursor: pointer; - user-select: none; - transition: background 0.2s; +.thinking-block summary { + padding: 0.4rem 0.75rem; cursor: pointer; font-size: 12px; + color: var(--text-3); user-select: none; + transition: color var(--transition); } - -.thinking-header:hover { - background: rgba(74, 74, 106, 0.5); -} - -.thinking-toggle { - font-size: 0.75rem; - transition: transform 0.2s; - color: var(--thinking-text); -} - -.thinking-block.collapsed .thinking-toggle { - transform: rotate(-90deg); -} - -.thinking-label { - font-size: 0.75rem; - font-weight: 600; - color: var(--thinking-text); - text-transform: uppercase; - letter-spacing: 0.5px; -} - +.thinking-block summary:hover { color: var(--text-2); } +.thinking-block[open] summary { border-bottom: 1px solid rgba(108,159,255,0.08); } .thinking-content { - padding: 1rem; - color: var(--thinking-text); - font-size: 0.9rem; - line-height: 1.5; - max-height: 300px; - overflow-y: auto; - transition: max-height 0.3s ease, padding 0.3s ease; + padding: 0.5rem 0.75rem; font-size: 12px; color: var(--text-3); + max-height: 300px; overflow-y: auto; line-height: 1.6; } -.thinking-block.collapsed .thinking-content { - max-height: 0; - padding: 0 1rem; - overflow: hidden; +/* Empty state */ +.empty-state { + display: flex; flex-direction: column; align-items: center; + justify-content: center; height: 100%; color: var(--text-3); gap: 0.25rem; } +.empty-logo { font-size: 3rem; margin-bottom: 0.5rem; } +.empty-state h2 { font-size: 1.25rem; font-weight: 600; color: var(--text-2); } +.empty-state p { font-size: 0.85rem; } /* Typing indicator */ -.typing-indicator { - display: flex; - gap: 4px; - padding: 0.5rem 0; +.typing-dots { display: flex; gap: 4px; padding: 0.5rem 0; } +.typing-dots span { + width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); + animation: dot-pulse 1.2s infinite; } +.typing-dots span:nth-child(2) { animation-delay: 0.2s; } +.typing-dots span:nth-child(3) { animation-delay: 0.4s; } +@keyframes dot-pulse { 0%,60%,100% { opacity: 0.4; } 30% { opacity: 1; } } -.typing-indicator span { - width: 8px; - height: 8px; - background: var(--text-secondary); - border-radius: 50%; - animation: bounce 1.4s infinite ease-in-out; +/* ── Input Area ──────────────────────────── */ + +.input-area { padding: 0 1rem 1rem; flex-shrink: 0; } +.input-wrap { + max-width: 768px; margin: 0 auto; + background: var(--bg-surface); border: 1px solid var(--border); + border-radius: var(--radius-lg); padding: 0; + display: flex; align-items: flex-end; + transition: border-color var(--transition); } +.input-wrap:focus-within { border-color: var(--border-light); } -.typing-indicator span:nth-child(1) { animation-delay: -0.32s; } -.typing-indicator span:nth-child(2) { animation-delay: -0.16s; } - -@keyframes bounce { - 0%, 80%, 100% { transform: scale(0); } - 40% { transform: scale(1); } +.input-wrap textarea { + flex: 1; resize: none; background: none; border: none; + color: var(--text); padding: 12px 0 12px 16px; + font-family: var(--font); font-size: 14px; + max-height: 200px; line-height: 1.5; } +.input-wrap textarea:focus { outline: none; } +.input-wrap textarea::placeholder { color: var(--text-3); } -/* Input Area */ -.input-area { - background: var(--bg-secondary); - border-top: 1px solid var(--border); - padding: 1rem 2rem; - flex-shrink: 0; +.input-actions { display: flex; align-items: center; gap: 2px; padding: 6px 8px; } + +.action-btn { + background: none; border: none; color: var(--text-3); cursor: pointer; + padding: 6px; border-radius: var(--radius); + transition: background var(--transition), color var(--transition); + display: flex; align-items: center; justify-content: center; } +.action-btn:hover { background: var(--bg-hover); color: var(--text); } -.input-container { max-width: 800px; margin: 0 auto; } +.send-btn { color: var(--accent); } +.send-btn:hover { background: var(--accent-dim); color: var(--accent-hover); } +.send-btn:disabled { opacity: 0.3; cursor: not-allowed; } -.input-top-bar { - display: flex; - justify-content: space-between; - align-items: center; - margin-bottom: 0.75rem; - gap: 1rem; - flex-wrap: wrap; -} - -.model-selector { - display: flex; - align-items: center; - gap: 0.5rem; -} - -.model-selector label { - font-size: 0.75rem; - color: var(--text-secondary); -} - -.model-selector select { - background: var(--bg-tertiary); - border: 1px solid var(--border); - border-radius: 6px; - color: var(--text-primary); - padding: 0.35rem 0.75rem; - font-size: 0.8rem; - cursor: pointer; - max-width: 200px; -} - -.model-selector select:focus { outline: none; border-color: var(--accent); } - -.input-shortcuts { - font-size: 0.7rem; - color: var(--text-secondary); -} - -.input-shortcuts kbd { - background: var(--bg-tertiary); - border: 1px solid var(--border); - border-radius: 3px; - padding: 0.1rem 0.3rem; - font-family: inherit; -} - -.input-wrapper { - background: var(--bg-tertiary); - border: 1px solid var(--border); - border-radius: 12px; - padding: 1rem; - transition: border-color 0.2s ease; -} - -.input-wrapper:focus-within { border-color: var(--accent); } - -.input-wrapper textarea { - width: 100%; - background: none; - border: none; - color: var(--text-primary); - font-size: 1rem; - font-family: inherit; - resize: none; - outline: none; - line-height: 1.5; - max-height: 200px; - min-height: 60px; -} - -.input-wrapper textarea::placeholder { color: var(--text-secondary); } - -.input-actions { - display: flex; - justify-content: space-between; - align-items: center; - margin-top: 0.75rem; - padding-top: 0.75rem; - border-top: 1px solid var(--border); -} - -.input-left { display: flex; gap: 0.5rem; align-items: center; } - -.send-btn { - padding: 0.5rem 1rem; - background: var(--accent); - color: white; - border: none; - border-radius: 6px; - cursor: pointer; - font-weight: 500; - transition: all 0.2s ease; - display: flex; - align-items: center; - gap: 0.5rem; -} - -.send-btn:hover:not(:disabled) { background: var(--accent-hover); } -.send-btn:disabled { opacity: 0.5; cursor: not-allowed; } - -.stop-btn { - padding: 0.5rem 1rem; - background: var(--error); - color: white; - border: none; - border-radius: 6px; - cursor: pointer; - font-weight: 500; - display: none; - align-items: center; - gap: 0.5rem; -} - -.stop-btn:hover { background: #ff5252; } +.stop-btn { display: none; color: var(--warning); } .stop-btn.visible { display: flex; } -/* Modal */ -.modal-overlay { - position: fixed; - top: 0; left: 0; right: 0; bottom: 0; - background: rgba(0, 0, 0, 0.7); - display: none; - align-items: center; - justify-content: center; - z-index: 1000; -} +/* ── Buttons ─────────────────────────────── */ +button { font-family: var(--font); cursor: pointer; } +.btn-primary { + background: var(--accent); color: #fff; border: none; + padding: 8px 16px; border-radius: var(--radius); + font-weight: 500; font-size: 13px; + transition: background var(--transition); +} +.btn-primary:hover { background: var(--accent-hover); } +.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; } +.btn-full { width: 100%; } +.btn-small { + background: var(--bg-raised); border: 1px solid var(--border); + color: var(--text-2); padding: 6px 12px; border-radius: var(--radius); + font-size: 12px; transition: all var(--transition); +} +.btn-small:hover { background: var(--bg-hover); color: var(--text); } +.btn-small.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; } +.btn-danger { background: var(--danger); color: #fff; border: none; border-radius: var(--radius); } + +/* ── Auth Splash ─────────────────────────── */ + +.splash { + display: flex; align-items: center; justify-content: center; + height: 100vh; background: var(--bg); +} +.splash-card { + background: var(--bg-surface); border: 1px solid var(--border); + border-radius: var(--radius-lg); padding: 2rem; + width: 380px; max-width: 90vw; +} +.splash-brand { text-align: center; margin-bottom: 1.5rem; } +.splash-logo { font-size: 3rem; margin-bottom: 0.5rem; } +.splash-brand h1 { font-size: 1.2rem; font-weight: 600; } +.splash-brand p { color: var(--text-2); font-size: 0.85rem; } +.splash-error { color: var(--danger); font-size: 12px; text-align: center; margin-top: 0.5rem; } + +.auth-tabs { display: flex; margin-bottom: 1rem; border-bottom: 1px solid var(--border); } +.auth-tab { + flex: 1; background: none; border: none; color: var(--text-3); + padding: 8px; cursor: pointer; font-size: 13px; + border-bottom: 2px solid transparent; + transition: color var(--transition); +} +.auth-tab.active { color: var(--accent); border-bottom-color: var(--accent); } +.auth-error { color: var(--danger); font-size: 12px; min-height: 1.2em; margin: 0.5rem 0; } +.auth-actions { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 1rem; } + +/* ── Forms ────────────────────────────────── */ + +.form-group { margin-bottom: 0.75rem; } +.form-group label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 4px; font-weight: 500; } +.form-group input, .form-group select, .form-group textarea { + width: 100%; background: var(--bg-raised); border: 1px solid var(--border); + color: var(--text); padding: 8px 12px; border-radius: var(--radius); + font-family: var(--font); font-size: 13px; + transition: border-color var(--transition); +} +.form-group input:focus, .form-group select:focus, .form-group textarea:focus { + outline: none; border-color: var(--accent); +} +.form-row { display: flex; gap: 0.75rem; } +.form-row .form-group { flex: 1; } +.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; margin: 0.5rem 0; color: var(--text-2); } + +/* ── Modal ────────────────────────────────── */ + +.modal-overlay { + position: fixed; inset: 0; background: rgba(0,0,0,0.6); + display: none; align-items: center; justify-content: center; + z-index: 1000; backdrop-filter: blur(2px); +} .modal-overlay.active { display: flex; } .modal { - background: var(--bg-secondary); - border-radius: 12px; - width: 90%; - max-width: 600px; - max-height: 90vh; - overflow-y: auto; - animation: modalSlideIn 0.3s ease; -} - -@keyframes modalSlideIn { - from { opacity: 0; transform: scale(0.9); } - to { opacity: 1; transform: scale(1); } + background: var(--bg-surface); border: 1px solid var(--border); + border-radius: var(--radius-lg); width: 90%; max-width: 520px; + max-height: 85vh; display: flex; flex-direction: column; + animation: modal-in 0.15s ease; } +.modal-wide { max-width: 700px; } +@keyframes modal-in { from { opacity: 0; transform: translateY(-8px); } } .modal-header { - padding: 1.5rem; - border-bottom: 1px solid var(--border); - display: flex; - justify-content: space-between; - align-items: center; + display: flex; align-items: center; justify-content: space-between; + padding: 16px 20px; border-bottom: 1px solid var(--border); } - -.modal-header h2 { font-size: 1.25rem; font-weight: 600; } - +.modal-header h2 { font-size: 15px; font-weight: 600; } .modal-close { - background: none; - border: none; - color: var(--text-secondary); - cursor: pointer; - padding: 0.5rem; - border-radius: 6px; - transition: all 0.2s; - font-size: 1.5rem; - line-height: 1; + background: none; border: none; color: var(--text-3); font-size: 18px; + cursor: pointer; padding: 2px 6px; border-radius: 4px; + transition: color var(--transition); } - -.modal-close:hover { color: var(--text-primary); background: var(--bg-tertiary); } - -.modal-body { padding: 1.5rem; } - -.form-group { margin-bottom: 1.5rem; } - -.form-group label { - display: block; - margin-bottom: 0.5rem; - font-weight: 500; - color: var(--text-secondary); - font-size: 0.875rem; -} - -.form-group input, -.form-group select, -.form-group textarea { - width: 100%; - padding: 0.75rem 1rem; - background: var(--bg-tertiary); - border: 1px solid var(--border); - border-radius: 8px; - color: var(--text-primary); - font-size: 1rem; - font-family: inherit; - transition: border-color 0.2s ease; -} - -.form-group input:focus, -.form-group select:focus, -.form-group textarea:focus { - outline: none; - border-color: var(--accent); -} - -.form-group small { - display: block; - margin-top: 0.5rem; - color: var(--text-secondary); - font-size: 0.75rem; -} - -.form-row { - display: grid; - grid-template-columns: 1fr 1fr; - gap: 1rem; -} - -.toggle-group { - display: flex; - align-items: center; - justify-content: space-between; - padding: 1rem; - background: var(--bg-tertiary); - border-radius: 8px; - margin-bottom: 1rem; -} - -.toggle-label { font-weight: 500; } - -.toggle-switch { - position: relative; - width: 50px; - height: 26px; -} - -.toggle-switch input { opacity: 0; width: 0; height: 0; } - -.toggle-slider { - position: absolute; - cursor: pointer; - top: 0; left: 0; right: 0; bottom: 0; - background: var(--border); - border-radius: 26px; - transition: 0.3s; -} - -.toggle-slider:before { - position: absolute; - content: ""; - height: 20px; - width: 20px; - left: 3px; - bottom: 3px; - background: white; - border-radius: 50%; - transition: 0.3s; -} - -.toggle-switch input:checked + .toggle-slider { background: var(--accent); } -.toggle-switch input:checked + .toggle-slider:before { transform: translateX(24px); } - +.modal-close:hover { color: var(--text); } +.modal-body { flex: 1; overflow-y: auto; padding: 16px 20px; } .modal-footer { - padding: 1rem 1.5rem; - border-top: 1px solid var(--border); - display: flex; - justify-content: flex-end; - gap: 0.75rem; + padding: 12px 20px; border-top: 1px solid var(--border); + display: flex; justify-content: flex-end; gap: 0.5rem; } -/* Toast */ -.toast-container { - position: fixed; - bottom: 2rem; - right: 2rem; - z-index: 2000; - display: flex; - flex-direction: column; - gap: 0.5rem; -} - -.toast { - background: var(--bg-tertiary); - border: 1px solid var(--border); - border-radius: 8px; - padding: 1rem 1.5rem; - display: flex; - align-items: center; - gap: 0.75rem; - animation: slideIn 0.3s ease; - box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); -} - -@keyframes slideIn { - from { opacity: 0; transform: translateX(100%); } - to { opacity: 1; transform: translateX(0); } -} - -.toast.success { border-left: 3px solid var(--success); } -.toast.error { border-left: 3px solid var(--error); } -.toast.warning { border-left: 3px solid var(--warning); } - -.toast-close { - background: none; - border: none; - color: var(--text-secondary); - cursor: pointer; - margin-left: auto; -} - -/* Empty State */ -.empty-state { - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - height: 100%; - text-align: center; - padding: 2rem; -} - -.empty-state-icon { - width: 80px; - height: 80px; - background: var(--bg-tertiary); - border-radius: 50%; - display: flex; - align-items: center; - justify-content: center; - margin-bottom: 1.5rem; -} - -.empty-state-icon svg { width: 40px; height: 40px; stroke: var(--accent); } -.empty-state h2 { font-size: 1.5rem; margin-bottom: 0.5rem; } -.empty-state p { color: var(--text-secondary); max-width: 400px; } - -/* Dropdown */ -.dropdown { - position: relative; - display: inline-block; -} - -.dropdown-content { - display: none; - position: absolute; - right: 0; - top: 100%; - background: var(--bg-secondary); - border: 1px solid var(--border); - border-radius: 8px; - min-width: 160px; - box-shadow: 0 4px 12px rgba(0,0,0,0.3); - z-index: 100; -} - -.dropdown-content.show { display: block; } - -.dropdown-item { - display: block; - width: 100%; - padding: 0.75rem 1rem; - background: none; - border: none; - color: var(--text-primary); - text-align: left; - cursor: pointer; - font-size: 0.875rem; - transition: background 0.2s; -} - -.dropdown-item:hover { background: var(--bg-tertiary); } -.dropdown-item:first-child { border-radius: 8px 8px 0 0; } -.dropdown-item:last-child { border-radius: 0 0 8px 8px; } - -/* Responsive */ -@media (max-width: 768px) { - .sidebar { - position: fixed; - left: 0; top: 0; bottom: 0; - z-index: 100; - transform: translateX(-100%); - } - .sidebar.open { transform: translateX(0); } - .header { padding: 1rem; } - .chat-messages { padding: 1rem; } - .input-area { padding: 1rem; } - .form-row { grid-template-columns: 1fr; } - .input-top-bar { flex-direction: column; align-items: flex-start; } -} - -/* Scrollbar */ -::-webkit-scrollbar { width: 8px; height: 8px; } -::-webkit-scrollbar-track { background: var(--bg-secondary); } -::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; } -::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); } - -/* ── Connection Status ──────────────────── */ -.connection-status { - display: flex; - align-items: center; - gap: 0.4rem; - padding: 0.3rem 0.7rem; - border-radius: 1rem; - font-size: 0.75rem; - font-weight: 500; - cursor: pointer; - transition: opacity 0.2s; - user-select: none; -} -.connection-status:hover { opacity: 0.8; } - -.status-dot { - width: 8px; - height: 8px; - border-radius: 50%; - display: inline-block; -} - -.connection-status.managed .status-dot { background: #22c55e; } -.connection-status.managed { color: #22c55e; border: 1px solid rgba(34, 197, 94, 0.3); } - -.connection-status.available .status-dot { background: #f59e0b; } -.connection-status.available { color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3); } - -.connection-status.offline .status-dot { background: var(--text-secondary); } -.connection-status.offline { color: var(--text-secondary); border: 1px solid var(--border); } - -/* ── Auth Modal ─────────────────────────── */ -.auth-modal { - max-width: 400px; -} - -.auth-tabs { - display: flex; - gap: 0; - margin-bottom: 1.25rem; - border-bottom: 1px solid var(--border); -} - -.auth-tab { - flex: 1; - padding: 0.6rem; - background: none; - border: none; - border-bottom: 2px solid transparent; - color: var(--text-secondary); - cursor: pointer; - font-size: 0.9rem; - font-weight: 500; - transition: all 0.2s; -} - -.auth-tab:hover { color: var(--text-primary); } -.auth-tab.active { - color: var(--accent); - border-bottom-color: var(--accent); -} - -.auth-error { - color: #ef4444; - font-size: 0.85rem; - min-height: 1.2rem; - margin-top: 0.5rem; -} - -/* ── App Hidden (splash gate active) ─────── */ - -.app-hidden { - display: none !important; -} - -#appContainer { - display: flex; - flex-direction: column; - flex: 1; - min-height: 0; -} - -/* ── Splash Gate ─────────────────────────── */ - -.splash-gate { - display: none; - position: fixed; - inset: 0; - z-index: 9999; - background: var(--bg-primary); - align-items: center; - justify-content: center; -} - -.splash-gate.visible { - display: flex; -} - -.splash-card { - width: 100%; - max-width: 400px; - padding: 2rem; -} - -.splash-brand { - text-align: center; - margin-bottom: 2rem; -} - -.splash-logo { - font-size: 3rem; - margin-bottom: 0.5rem; -} - -.splash-brand h1 { - font-size: 1.5rem; - font-weight: 600; - color: var(--text-primary); - margin: 0; -} - -.splash-tagline { - color: var(--text-secondary); - font-size: 0.9rem; - margin-top: 0.25rem; -} - -.splash-form { - background: var(--bg-secondary); - border: 1px solid var(--border); - border-radius: 12px; - padding: 1.5rem; -} - -.splash-form .auth-tabs { - margin-bottom: 1rem; -} - -.splash-actions { - margin-top: 1rem; - display: flex; - flex-direction: column; - gap: 0.5rem; -} - -.btn-full { - width: 100%; - justify-content: center; -} - -.splash-divider { - display: flex; - align-items: center; - gap: 0.75rem; - margin: 0.25rem 0; - color: var(--text-secondary); - font-size: 0.8rem; -} - -.splash-divider::before, -.splash-divider::after { - content: ''; - flex: 1; - height: 1px; - background: var(--border); -} - - -/* ── Admin Panel ─────────────────────────── */ - -.admin-modal { - max-width: 700px; - width: 90vw; -} - -.admin-tabs { - display: flex; - gap: 0; - border-bottom: 1px solid var(--border); - margin-bottom: 1rem; -} - -.admin-tab { - padding: 0.5rem 1rem; - background: none; - border: none; - border-bottom: 2px solid transparent; - color: var(--text-secondary); - cursor: pointer; - font-size: 0.9rem; -} - -.admin-tab:hover { color: var(--text-primary); } -.admin-tab.active { - color: var(--accent); - border-bottom-color: var(--accent); -} - -.admin-user-row { - display: flex; - align-items: center; - gap: 0.75rem; - padding: 0.6rem 0; - border-bottom: 1px solid var(--border); -} - -.admin-user-row:last-child { border-bottom: none; } - -.admin-user-info { - flex: 1; - min-width: 0; -} - -.admin-user-name { - font-weight: 600; - display: block; -} - -.admin-user-email { - font-size: 0.8rem; - color: var(--text-secondary); -} - -.admin-user-meta { - display: flex; - gap: 0.4rem; -} - -.admin-badge { - padding: 0.15rem 0.5rem; - border-radius: 4px; - font-size: 0.75rem; - font-weight: 500; -} - -.admin-badge-admin { background: #7c3aed22; color: #a78bfa; } -.admin-badge-user { background: #3b82f622; color: #60a5fa; } -.admin-badge-moderator { background: #f59e0b22; color: #fbbf24; } -.admin-badge-active { background: #10b98122; color: #34d399; } -.admin-badge-inactive { background: #ef444422; color: #f87171; } - -.admin-user-actions { - display: flex; - gap: 0.4rem; - align-items: center; -} - -.admin-role-select { - padding: 0.2rem 0.4rem; - background: var(--bg-primary); - color: var(--text-primary); - border: 1px solid var(--border); - border-radius: 4px; - font-size: 0.8rem; -} - -.admin-you { - color: var(--text-secondary); - font-size: 0.8rem; - font-style: italic; -} - -.btn-warning { background: #f59e0b; color: #000; } -.btn-danger { background: #ef4444; color: #fff; } -.btn-success { background: #10b981; color: #fff; } -.btn-small { padding: 0.2rem 0.5rem; font-size: 0.75rem; } - -.admin-stats-grid { - display: grid; - grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); - gap: 0.75rem; -} - -.admin-stat-card { - background: var(--bg-primary); - border: 1px solid var(--border); - border-radius: 8px; - padding: 1rem; - text-align: center; -} - -.admin-stat-value { - font-size: 1.5rem; - font-weight: 700; - color: var(--accent); -} - -.admin-stat-label { - font-size: 0.8rem; - color: var(--text-secondary); - margin-top: 0.25rem; -} - -.admin-loading, .admin-empty, .admin-error { - padding: 1rem; - text-align: center; - color: var(--text-secondary); -} - -.admin-error { color: #ef4444; } - -.toggle-label { - display: flex; - align-items: center; - gap: 0.5rem; - cursor: pointer; -} - -/* ── Admin Add User / Reset Password ─────── */ - -.admin-add-user-toggle { - margin-bottom: 0.75rem; -} - -.admin-add-user-form { - background: var(--bg-primary); - border: 1px solid var(--border); - border-radius: 8px; - padding: 0.75rem; - margin-bottom: 0.75rem; -} - -.admin-form-row { - display: flex; - gap: 0.5rem; - margin-bottom: 0.5rem; -} - -.admin-form-row:last-child { - margin-bottom: 0; -} - -.admin-input { - flex: 1; - padding: 0.4rem 0.6rem; - background: var(--bg-secondary); - color: var(--text-primary); - border: 1px solid var(--border); - border-radius: 4px; - font-size: 0.85rem; -} - -.admin-input:focus { - outline: none; - border-color: var(--accent); -} - -.admin-reset-dialog { - position: absolute; - inset: 0; - background: rgba(0,0,0,0.5); - display: flex; - align-items: center; - justify-content: center; - z-index: 10; - border-radius: 8px; -} - -.admin-reset-card { - background: var(--bg-secondary); - border: 1px solid var(--border); - border-radius: 8px; - padding: 1.25rem; - min-width: 300px; -} - -.admin-reset-card h3 { - margin: 0 0 0.5rem 0; - font-size: 1rem; -} - -.admin-reset-card p { - color: var(--text-secondary); - font-size: 0.85rem; - margin: 0 0 0.75rem 0; -} - -.admin-reset-card .admin-input { - width: 100%; - margin-bottom: 0.75rem; - box-sizing: border-box; -} - -.admin-modal .modal-body { - position: relative; -} - -/* ── Profile Section in Settings ─────────── */ - -.settings-section-title { - font-size: 0.95rem; - font-weight: 600; - color: var(--accent); - margin: 0 0 0.75rem 0; -} - -.settings-divider { - border: none; - border-top: 1px solid var(--border); - margin: 1rem 0; -} - -.profile-password-row { - margin-top: 0.5rem; -} - -#profileChangePwForm { - margin-top: 0.75rem; - padding: 0.75rem; - background: var(--bg-primary); - border: 1px solid var(--border); - border-radius: 6px; -} - -#profileChangePwForm .form-group { - margin-bottom: 0.5rem; -} - -/* ── API Providers List ──────────────────── */ - -.provider-list { - margin-bottom: 0.5rem; -} +.settings-section { margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); } +.settings-section:last-child { border-bottom: none; margin-bottom: 0; } +.settings-section h3 { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.5px; } +/* Providers */ .provider-row { - display: flex; - align-items: center; - justify-content: space-between; - padding: 0.5rem 0.6rem; - border: 1px solid var(--border); - border-radius: 6px; - margin-bottom: 0.4rem; - background: var(--bg-primary); + display: flex; align-items: center; justify-content: space-between; + padding: 8px 0; border-bottom: 1px solid var(--border); } +.provider-name { font-weight: 500; font-size: 13px; } +.provider-meta { font-size: 11px; color: var(--text-3); margin-left: 8px; } +.provider-actions { display: flex; align-items: center; gap: 8px; } +.badge-global { font-size: 10px; color: var(--text-3); background: var(--bg-raised); padding: 2px 8px; border-radius: 4px; } -.provider-info { - flex: 1; - min-width: 0; +/* Admin tabs */ +.admin-tabs { display: flex; border-bottom: 1px solid var(--border); padding: 0 16px; background: var(--bg-raised); } +.admin-tab { + padding: 8px 12px; background: none; border: none; color: var(--text-3); + cursor: pointer; font-size: 12px; border-bottom: 2px solid transparent; } +.admin-tab.active { color: var(--accent); border-bottom-color: var(--accent); } -.provider-name { - font-weight: 600; - font-size: 0.9rem; - display: block; -} - -.provider-meta { - font-size: 0.75rem; - color: var(--text-secondary); -} - -.provider-actions { - display: flex; - align-items: center; - gap: 0.4rem; -} - -.provider-empty { - padding: 0.75rem; - text-align: center; - color: var(--text-secondary); - font-size: 0.85rem; - border: 1px dashed var(--border); - border-radius: 6px; - margin-bottom: 0.5rem; -} - -.provider-add-toggle { - margin-bottom: 0.5rem; -} - -.provider-add-form { - background: var(--bg-primary); - border: 1px solid var(--border); - border-radius: 8px; - padding: 0.75rem; - margin-bottom: 0.5rem; -} - -.provider-add-form .form-group { - margin-bottom: 0.5rem; -} - -.provider-add-form .form-group:last-of-type { - margin-bottom: 0.75rem; -} - -.admin-hint { - font-size: 0.8rem; - color: var(--text-secondary); - margin: 0 0 0.75rem 0; -} - -/* ── Admin Models Tab ────────────────────── */ - -.admin-models-header { - display: flex; - align-items: flex-start; - justify-content: space-between; - gap: 0.75rem; - margin-bottom: 0.75rem; -} - -.admin-models-header .admin-hint { - flex: 1; - margin: 0; -} - -.admin-model-group { - margin-bottom: 1rem; -} - -.admin-model-group-header { - font-size: 0.8rem; - font-weight: 600; - color: var(--accent); - text-transform: uppercase; - letter-spacing: 0.05em; - padding: 0.25rem 0; - border-bottom: 1px solid var(--border); - margin-bottom: 0.25rem; -} - -.admin-model-row { - display: flex; - align-items: center; - gap: 0.5rem; - padding: 0.4rem 0; - border-bottom: 1px solid var(--border); -} - -.admin-model-row:last-child { - border-bottom: none; -} - -.admin-model-toggle { - flex-shrink: 0; -} - -.toggle-label-compact input[type="checkbox"] { - width: 16px; - height: 16px; - accent-color: var(--accent); - cursor: pointer; -} - -.admin-model-info { - flex: 1; - min-width: 0; -} - -.admin-model-name { - font-weight: 500; - font-size: 0.85rem; - display: block; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.admin-model-id { - font-size: 0.7rem; - color: var(--text-secondary); - font-family: monospace; -} - -.admin-model-caps { - display: flex; - gap: 0.25rem; - flex-shrink: 0; -} - -.cap-badge { - font-size: 0.65rem; - padding: 0.1rem 0.35rem; - border-radius: 3px; - border: 1px solid var(--border); - cursor: pointer; - font-weight: 500; - text-transform: uppercase; - letter-spacing: 0.03em; - background: none; - transition: all 0.15s; -} - -.cap-active { - background: var(--accent); - color: #000; - border-color: var(--accent); -} - -.cap-inactive { - color: var(--text-secondary); - opacity: 0.5; -} - -.cap-badge:hover { - opacity: 1; -} - -.admin-model-actions { - flex-shrink: 0; -} - -/* ── Settings Mode Badge ─────────────────── */ - -.settings-mode-badge { - padding: 0.5rem 0.75rem; - border-radius: 6px; - font-size: 0.8rem; - margin-bottom: 1rem; - font-weight: 500; -} - -.mode-managed { - background: #10b98115; - border: 1px solid #10b98133; - color: #34d399; -} - -.mode-unmanaged { - background: #f59e0b15; - border: 1px solid #f59e0b33; - color: #fbbf24; +.admin-user-row { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; } +.admin-user-email { font-size: 11px; color: var(--text-3); } +.admin-model-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12px; } +.badge-admin { background: var(--accent); color: #fff; font-size: 10px; padding: 1px 8px; border-radius: 4px; } +.badge-user { background: var(--bg-raised); color: var(--text-3); font-size: 10px; padding: 1px 8px; border-radius: 4px; } +.badge-inactive { background: var(--danger); color: #fff; font-size: 10px; padding: 1px 8px; border-radius: 4px; } +.loading { color: var(--text-3); font-size: 12px; padding: 0.5rem; } +.error-hint { color: var(--danger); font-size: 12px; padding: 0.5rem; } +.empty-hint { color: var(--text-3); font-size: 12px; text-align: center; padding: 1rem; } + +/* ── Toast ────────────────────────────────── */ + +.toast-container { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); z-index: 10000; display: flex; flex-direction: column; gap: 0.5rem; } +.toast { + background: var(--bg-surface); border: 1px solid var(--border); + border-radius: var(--radius); padding: 8px 16px; font-size: 13px; + display: flex; align-items: center; gap: 8px; + animation: toast-in 0.25s ease; box-shadow: 0 4px 12px rgba(0,0,0,0.3); } +.toast.error { border-color: var(--danger); } +.toast.warning { border-color: var(--warning); } +.toast.success { border-color: var(--success); } +.toast button { background: none; border: none; color: var(--text-3); cursor: pointer; } +@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } } /* ── Debug Modal ─────────────────────────── */ -.debug-modal { - max-width: 900px; - height: 80vh; - display: flex; - flex-direction: column; - overflow: hidden; /* override base .modal overflow-y: auto */ -} +.debug-modal { max-width: 900px; height: 80vh; overflow: hidden; } +.debug-tabs { display: flex; border-bottom: 1px solid var(--border); padding: 0 16px; background: var(--bg-raised); } +.debug-tab { padding: 8px 12px; background: none; border: none; color: var(--text-3); cursor: pointer; font-size: 12px; border-bottom: 2px solid transparent; } +.debug-tab.active { color: var(--accent); border-bottom-color: var(--accent); } +.debug-modal-body { flex: 1; overflow: hidden; padding: 0 !important; } +.debug-tab-content { height: 100%; display: flex; flex-direction: column; } +.debug-toolbar { display: flex; gap: 1rem; padding: 6px 12px; border-bottom: 1px solid var(--border); font-size: 11px; } +.debug-check { display: flex; align-items: center; gap: 4px; color: var(--text-3); cursor: pointer; } +.debug-content { flex: 1; overflow-y: auto; padding: 6px; font-family: var(--mono); font-size: 11px; line-height: 1.5; } +.debug-entry { padding: 1px 6px; border-bottom: 1px solid rgba(128,128,128,0.06); white-space: pre-wrap; word-break: break-all; } +.debug-time { color: var(--text-3); opacity: 0.6; font-size: 10px; } +.debug-msg { color: var(--text); } +.debug-empty { color: var(--text-3); text-align: center; padding: 2rem; } +.debug-net-entry { border-bottom: 1px solid var(--border); } +.debug-net-entry summary { padding: 6px; cursor: pointer; font-size: 11px; } +.debug-net-method { font-weight: bold; color: var(--accent); } +.debug-net-url { color: var(--text); word-break: break-all; } +.debug-net-detail { padding: 6px 12px; font-size: 11px; } +.debug-pre { white-space: pre-wrap; word-break: break-all; max-height: 200px; overflow: auto; padding: 6px; background: rgba(0,0,0,0.2); border-radius: 4px; margin: 4px 0; } +.debug-footer { display: flex; align-items: center; } -.debug-tabs { - display: flex; - gap: 0; - border-bottom: 1px solid var(--border); - padding: 0 1rem; - background: var(--bg-secondary); -} +/* ── Responsive ──────────────────────────── */ -.debug-tab { - padding: 0.5rem 1rem; - background: none; - border: none; - color: var(--text-secondary); - cursor: pointer; - font-size: 0.8rem; - border-bottom: 2px solid transparent; - transition: color 0.2s, border-color 0.2s; -} - -.debug-tab:hover { color: var(--text-primary); } -.debug-tab.active { - color: var(--accent); - border-bottom-color: var(--accent); -} - -.debug-modal-body { - flex: 1; - overflow: hidden; - padding: 0 !important; -} - -.debug-tab-content { - height: 100%; - display: flex; - flex-direction: column; -} - -.debug-toolbar { - display: flex; - gap: 1rem; - padding: 0.4rem 1rem; - border-bottom: 1px solid var(--border); - font-size: 0.75rem; -} - -.debug-check { - display: flex; - align-items: center; - gap: 0.3rem; - color: var(--text-secondary); - cursor: pointer; -} - -.debug-content { - flex: 1; - overflow-y: auto; - padding: 0.5rem; - font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace; - font-size: 0.72rem; - line-height: 1.5; -} - -.debug-entry { - padding: 1px 0.5rem; - border-bottom: 1px solid rgba(128, 128, 128, 0.08); - white-space: pre-wrap; - word-break: break-all; -} - -.debug-entry:hover { - background: rgba(255, 255, 255, 0.02); -} - -.debug-time { - color: var(--text-secondary); - opacity: 0.6; - font-size: 0.68rem; -} - -.debug-msg { - color: var(--text-primary); -} - -.debug-empty { - color: var(--text-secondary); - text-align: center; - padding: 2rem; - font-family: inherit; -} - -.debug-net-entry { - border-bottom: 1px solid var(--border); -} - -.debug-net-entry summary { - padding: 0.4rem 0.5rem; - cursor: pointer; - font-size: 0.75rem; -} - -.debug-net-entry summary:hover { - background: rgba(255, 255, 255, 0.02); -} - -.debug-net-method { - font-weight: bold; - color: var(--accent); - min-width: 3em; - display: inline-block; -} - -.debug-net-url { - color: var(--text-primary); - word-break: break-all; -} - -.debug-net-detail { - padding: 0.5rem 1rem; - font-size: 0.72rem; -} - -.debug-pre { - white-space: pre-wrap; - word-break: break-all; - max-height: 200px; - overflow: auto; - padding: 0.5rem; - background: rgba(0, 0, 0, 0.2); - border-radius: 4px; - margin: 0.3rem 0; -} - -.debug-state-pre { - max-height: none; - font-size: 0.75rem; -} - -.debug-footer { - display: flex; - align-items: center; - gap: 0.5rem; - padding: 0.5rem 1rem; - border-top: 1px solid var(--border); +@media (max-width: 768px) { + .sidebar { position: fixed; z-index: 100; height: 100%; } + .sidebar.collapsed { width: 0; border: none; } + .msg-inner { padding: 0 1rem; } } diff --git a/src/index.html b/src/index.html index 15f1f2d..68cde0e 100644 --- a/src/index.html +++ b/src/index.html @@ -7,518 +7,229 @@ - +
-