/* PLGames AI — Visual identity: «Paper & Ember» (Phase 7, 2026-05-05)
 * Принципы: контент имеет цвет, UI — нет. Один тёплый акцент (terracotta/ember),
 * плоские поверхности, hairline borders, минимум motion. Без glassmorphism,
 * без glow-shadows, без многоцветных gradient-mesh бекграундов. */

:root {
    /* Background — warm near-black with subtle surface hierarchy */
    --bg: #0F0F10;
    --bg-nav: #141416;
    --bg-card: #17171A;
    --bg-surface: var(--bg-card);
    --bg-hover: rgba(255, 255, 255, 0.04);
    --bg-active: rgba(255, 255, 255, 0.07);
    --bg-input: #141416;
    --bg-tooltip: #1F1F22;

    /* Text — neutral, no purple tint */
    --text: #ECECEE;
    --text-secondary: #A8A8AC;
    --text-muted: #74747A;
    --text-dim: #4D4D52;

    /* Accent — terracotta / ember. Used sparingly: CTA, focus, active state. */
    --accent: #C97F4E;
    --accent-hover: #B36F40;
    --accent-bright: #E0A580;
    --accent-soft: rgba(201, 127, 78, 0.10);
    --accent-glow: transparent;
    --accent-text: #E0A580;

    /* Semantic — muted system colors */
    --green: #5BA47A;
    --green-soft: rgba(91, 164, 122, 0.10);
    --red: #D96A6A;
    --red-soft: rgba(217, 106, 106, 0.10);
    --yellow: #D9A35E;
    --yellow-soft: rgba(217, 163, 94, 0.10);
    --blue: #6B95C9;
    --blue-soft: rgba(107, 149, 201, 0.10);

    /* Borders — hairline @ low opacity (the only "decor") */
    --border: rgba(255, 255, 255, 0.07);
    --border-light: rgba(255, 255, 255, 0.12);
    --border-glow: rgba(255, 255, 255, 0.12);

    /* Glass tokens kept for legacy refs — flattened to opaque card surface */
    --glass-bg: var(--bg-card);
    --glass-border: var(--border);

    /* Layout */
    --nav-width: 230px;
    --nav-width-collapsed: 56px;
    --topbar-height: 52px;

    /* Radius — 5 levels + pill */
    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 16px;
    --radius-pill: 9999px;
    --radius-full: var(--radius-pill); /* legacy alias */

    /* Spacing scale — 4-base */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-8: 48px;

    /* Typography */
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace;

    /* Code block bg */
    --bg-code: #0B0B0D;

    /* Inset highlight removed — no embossed look */
    --highlight-inset: none;

    /* Shadows — soft elevation only, no glow */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.45);
    --shadow-glow: none;

    /* Motion — crisp, spring-only on context-changes */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-fast: 120ms;
    --duration-normal: 200ms;
}

/* Light theme — warm paper */
[data-theme="light"] {
    --bg: #FAFAF8;
    --bg-nav: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-surface: var(--bg-card);
    --bg-hover: rgba(0, 0, 0, 0.04);
    --bg-active: rgba(0, 0, 0, 0.07);
    --bg-input: #FFFFFF;
    --bg-tooltip: #1F1F22;

    --text: #1A1A1B;
    --text-secondary: #4A4A4D;
    --text-muted: #76767A;
    --text-dim: #A8A8AC;

    --accent: #B86A38;
    --accent-hover: #9C5A2E;
    --accent-bright: #D08456;
    --accent-soft: rgba(184, 106, 56, 0.08);
    --accent-glow: transparent;
    --accent-text: #9C5A2E;

    --green: #2F7A4F;
    --green-soft: rgba(47, 122, 79, 0.08);
    --red: #B83838;
    --red-soft: rgba(184, 56, 56, 0.06);
    --yellow: #B07020;
    --yellow-soft: rgba(176, 112, 32, 0.06);
    --blue: #2B5C9C;
    --blue-soft: rgba(43, 92, 156, 0.06);

    --border: rgba(0, 0, 0, 0.07);
    --border-light: rgba(0, 0, 0, 0.11);
    --border-glow: rgba(0, 0, 0, 0.11);

    --glass-bg: var(--bg-card);
    --glass-border: var(--border);

    --bg-code: #F5F4F1;
    --highlight-inset: none;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 14px;
    line-height: 1.55;
    letter-spacing: -0.005em;
    /* Inter optical features: tabular numerals + contextual alts for cleaner numbers/operators. */
    font-feature-settings: "cv11", "ss01", "ss03", "calt", "tnum";
    text-rendering: optimizeLegibility;
}

/* Phase 7 («Paper & Ember»): gradient mesh removed — flat surface, content has color, UI does not. */

/* ===== Landing Page ===== */

#landing {
    height: 100vh;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    position: relative;
    z-index: 1;
}

.landing-container {
    max-width: 480px;
    width: 100%;
    padding: 48px 24px;
    text-align: center;
}

.landing-logo {
    width: 64px;
    height: 64px;
    background: var(--accent);
    color: #fff;
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 24px;
    position: relative;
}

#landing h1 {
    font-size: 32px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.022em;
    margin-bottom: 8px;
}

.landing-subtitle {
    font-size: 15px;
    color: var(--accent-text);
    font-weight: 500;
    margin-bottom: 8px;
}

.landing-desc {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
    max-width: 380px;
    margin: 0 auto 28px;
}

.landing-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 28px;
}

.landing-feature {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 14px 12px;
    text-align: left;
    transition: all var(--duration-normal) ease-out;
}

.landing-feature:hover {
    border-color: var(--border-light);
    background: var(--bg-hover);
}

.lf-icon { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent); margin-bottom: 8px; }
.lf-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.lf-desc { font-size: 11px; color: var(--text-muted); line-height: 1.4; }

.landing-auth {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
}

.landing-auth h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 14px;
}

.auth-field { margin-bottom: 10px; }

.auth-field input, .auth-field textarea {
    width: 100%;
    background: var(--bg-input);
    backdrop-filter: blur(8px);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 14px;
    font-family: var(--font);
    outline: none;
    transition: all var(--duration-normal) ease-out;
}

.auth-field input:focus, .auth-field textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.auth-btn {
    width: 100%;
    padding: 10px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
    margin-bottom: 8px;
    transition: background var(--duration-normal) var(--ease-out);
    background: var(--accent);
    color: #fff;
}

.auth-btn:hover {
    background: var(--accent-hover);
}

.auth-social {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 12px 0 6px;
}

.auth-social-btn {
    width: 48px;
    height: 40px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration-normal) ease-out;
    backdrop-filter: blur(8px);
}

.auth-social-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.auth-social-btn.btn-github { background: rgba(33, 38, 45, 0.6); color: #e6edf3; border-color: rgba(48, 54, 61, 0.5); }
.auth-social-btn.btn-github:hover:not(:disabled) { background: rgba(48, 54, 61, 0.8); }
.auth-social-btn.btn-yandex { background: rgba(252, 63, 29, 0.8); color: white; border-color: rgba(224, 55, 26, 0.5); }

.auth-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 12px;
    font-size: 13px;
}

.auth-links a { color: var(--accent-text); text-decoration: none; transition: color var(--duration-normal) ease-out; }
.auth-links a:hover { color: var(--accent-bright); }

.auth-error {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: var(--radius);
    background: var(--red-soft);
    color: var(--red);
    font-size: 13px;
    text-align: center;
    backdrop-filter: blur(8px);
}

.landing-footer { margin-top: 28px; text-align: center; }
.landing-footer-link {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--text-dim); text-decoration: none; font-size: 12px;
    transition: color var(--duration-normal) ease-out;
}
.landing-footer-link:hover { color: var(--text-muted); }
.landing-footer-link svg { opacity: 0.6; }

/* ===== App Shell ===== */

#app { display: flex; height: 100vh; position: relative; z-index: 1; }

/* ===== Topbar ===== */

#topbar {
    height: var(--topbar-height);
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    background: var(--bg-nav);
    z-index: 10;
}

#topbar-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
#tab-title { font-size: 14px; font-weight: 600; color: var(--text); }
#session-name { font-size: 13px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#topbar-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

#topbar-right select {
    background: var(--glass-bg);
    backdrop-filter: blur(12px) saturate(1.6);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 5px 12px;
    font-size: 12px;
    font-family: var(--font);
    cursor: pointer;
    outline: none;
    transition: all var(--duration-normal) ease-out;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b6680'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 22px;
}
#topbar-right select { box-shadow: var(--highlight-inset); }
#topbar-right select:hover { border-color: var(--border-light); color: var(--text); }
#topbar-right select:focus { border-color: var(--accent); box-shadow: var(--highlight-inset), 0 0 0 3px var(--accent-soft); }

/* ===== Sidebar / Nav ===== */

#sidebar {
    width: var(--nav-width);
    background: var(--bg-nav);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width var(--duration-normal) ease-out;
}

.sidebar-header {
    padding: 14px 16px; display: flex; flex-direction: column; gap: 8px;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand { display: flex; align-items: center; gap: 10px; }

.brand-logo {
    width: 30px; height: 30px;
    background: var(--accent);
    color: white;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 600;
    box-shadow: 0 0 16px var(--accent-glow);
}

.brand-name { font-size: 14px; font-weight: 600; color: var(--text); letter-spacing: -0.011em; }

.status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--text-dim); margin-left: auto; flex-shrink: 0;
    transition: all var(--duration-normal) ease-out;
}
.status-dot.ok { background: var(--green); box-shadow: 0 0 8px rgba(52, 211, 153, 0.5); }
.status-dot.degraded { background: var(--yellow); box-shadow: 0 0 8px rgba(251, 191, 36, 0.4); }
.status-dot.error { background: var(--red); box-shadow: 0 0 8px rgba(248, 113, 113, 0.4); }

.sidebar-nav { padding: 10px 8px 6px; display: flex; flex-direction: column; gap: 2px; }

.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px; border: none; background: transparent;
    color: var(--text-muted); border-radius: var(--radius);
    cursor: pointer; font-size: 13px; font-family: var(--font);
    text-align: left; transition: all var(--duration-normal) ease-out;
    position: relative;
}
.nav-item:hover { background: color-mix(in srgb, var(--bg-hover) 84%, transparent); color: var(--text-secondary); border-color: color-mix(in srgb, var(--border) 72%, transparent); }
.nav-item.active {
    background: var(--accent-soft);
    color: var(--accent-text);
    border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}
.nav-icon { width: 18px; height: 16px; text-align: center; flex-shrink: 0; opacity: 0.5; transition: opacity var(--duration-normal) ease-out; display: flex; align-items: center; justify-content: center; }
.nav-icon svg { width: 16px; height: 16px; }
.nav-item:hover .nav-icon { opacity: 0.8; }
.nav-item.active .nav-icon { opacity: 1; }

.sidebar-divider { height: 1px; background: var(--border); margin: 4px 16px; }

/* Collections */
#collections-list { padding: 2px 8px; }
#collections-list:empty { display: none; }

.coll-item {
    display: flex; align-items: center; gap: 6px;
    padding: 5px 10px; border-radius: var(--radius); cursor: pointer;
    font-size: 12px; color: var(--text-dim); margin-bottom: 1px;
    transition: all var(--duration-normal) ease-out;
}
.coll-item:hover { background: var(--bg-hover); color: var(--text-secondary); }
.coll-item.active { background: var(--accent-soft); color: var(--accent-text); }
.coll-icon { font-size: 13px; flex-shrink: 0; }
.coll-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coll-delete {
    display: none; background: none; border: none; color: var(--text-dim);
    cursor: pointer; font-size: 12px; padding: 0 2px;
}
.coll-item:hover .coll-delete { display: block; }
.coll-delete:hover { color: var(--red); }

/* Conversation actions & move menu */
.conv-actions { display: flex; gap: 2px; flex-shrink: 0; }
.conv-move {
    display: none; background: none; border: none; color: var(--text-dim);
    cursor: pointer; font-size: 11px; padding: 1px 3px; border-radius: var(--radius-xs);
}
.conv-item:hover .conv-move { display: block; }
.conv-move:hover { color: var(--accent); }

.move-menu {
    position: absolute; right: 0; top: 100%; z-index: 50;
    background: var(--glass-bg); backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius); padding: 4px; min-width: 140px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4); animation: fadeIn var(--duration-fast) ease-out;
}
.move-menu-item {
    padding: 6px 10px; border-radius: var(--radius-sm);
    font-size: 12px; color: var(--text-secondary); cursor: pointer;
    white-space: nowrap; transition: all var(--duration-normal) ease-out;
}
.move-menu-item:hover { background: var(--bg-hover); color: var(--text); }

#sessions-section { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.sessions-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px 4px; }
.sessions-header-actions { display: flex; gap: 4px; }
.sessions-title { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dim); font-weight: 600; }

#new-collection-btn {
    width: 24px; height: 24px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: transparent;
    color: var(--text-muted); font-size: 13px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background var(--duration-fast) ease-out, color var(--duration-fast) ease-out;
}
#new-collection-btn:hover { background: var(--bg-hover); color: var(--text); }

#new-chat-btn {
    width: 24px; height: 24px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: transparent;
    color: var(--text-muted); font-size: 16px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--duration-normal) ease-out;
}
#new-chat-btn:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--border-glow); }

#conversations-list { flex: 1; overflow-y: auto; padding: 4px 8px; }

.conv-item {
    padding: 8px 10px; border-radius: var(--radius); cursor: pointer;
    margin-bottom: 2px; font-size: 13px; white-space: nowrap;
    overflow: visible; text-overflow: ellipsis;
    display: flex; align-items: center; justify-content: space-between; gap: 4px;
    transition: background var(--duration-fast) ease-out, color var(--duration-fast) ease-out, border-color var(--duration-fast) ease-out;
    color: var(--text-muted);
    position: relative;
    border: 1px solid transparent;
}
.conv-item:hover {
    background: color-mix(in srgb, var(--bg-hover) 84%, transparent);
    color: var(--text-secondary);
    border-color: color-mix(in srgb, var(--border) 50%, transparent);
}
.conv-item.active {
    background: color-mix(in srgb, var(--accent-soft) 88%, var(--bg-card));
    color: var(--accent-text);
    border-color: color-mix(in srgb, var(--accent) 18%, transparent);
    box-shadow: var(--highlight-inset);
}
.conv-item .conv-title { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.conv-item .conv-delete {
    display: none; background: none; border: none;
    color: var(--text-dim); cursor: pointer; font-size: 12px; padding: 1px 4px; border-radius: var(--radius-xs);
}
.conv-item:hover .conv-delete { display: block; }
.conv-item .conv-delete:hover { color: var(--red); }

.sidebar-footer { padding: 10px 12px; border-top: 1px solid var(--border); }
.sidebar-footer button {
    width: 100%; padding: 7px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: transparent;
    color: var(--text-dim); cursor: pointer; font-size: 12px; font-family: var(--font);
    transition: all var(--duration-normal) ease-out;
}
.sidebar-footer button:hover { background: var(--bg-hover); color: var(--text-muted); }

/* ===== Main Content ===== */

#main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.tab-content { display: none; flex: 1; flex-direction: column; overflow: hidden; }
.tab-content.active { display: flex; }

/* ===== Chat ===== */

#messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }

#welcome {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 12px; padding: 40px 20px; text-align: center;
}

.welcome-icon {
    width: 64px; height: 64px;
    background: var(--accent-soft);
    color: var(--accent); border-radius: var(--radius-lg);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 600; margin-bottom: 8px;
    border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}

#welcome h2 {
    font-size: 26px; font-weight: 600; color: var(--text);
    letter-spacing: -0.022em;
}
#welcome p { font-size: 14px; color: var(--text-muted); max-width: 400px; line-height: 1.6; }

.welcome-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 8px; max-width: 500px; }

.welcome-chip {
    padding: 10px 18px; border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary); font-size: 13px; cursor: pointer; font-family: var(--font);
    transition: all var(--duration-normal) var(--ease-out);
    box-shadow: var(--highlight-inset);
}
.welcome-chip:hover {
    background: color-mix(in srgb, var(--accent) 12%, var(--bg-card));
    color: var(--accent-text);
    border-color: color-mix(in srgb, var(--accent) 25%, transparent);
}

#message-list {
    max-width: 720px; width: 100%; margin: 0 auto;
    padding: 20px 24px 8px; display: flex; flex-direction: column;
}

/* Message rows */
.msg-row {
    padding: 14px 0; animation: msg-fade-in 200ms ease-out;
    display: flex; gap: 12px; position: relative;
}
.msg-row + .msg-row { margin-top: 2px; }

/* Message grouping — hide avatar & meta for consecutive same-role messages */
.msg-row.grouped { padding-top: 2px; }
.msg-row.grouped .msg-avatar { visibility: hidden; height: 0; margin: 0; }
.msg-row.grouped .msg-meta { display: none; }
@keyframes msg-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.msg-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }

.msg-avatar {
    width: 36px; height: 36px; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600; flex-shrink: 0;
    align-self: flex-end; margin-bottom: 4px;
    border: 1px solid var(--border);
}
.msg-row.user .msg-avatar { background: var(--bg-card); color: var(--blue); }
.msg-row.assistant .msg-avatar {
    background: var(--bg-card);
    color: var(--accent);
}

.msg-body { flex: 1; min-width: 0; }

.msg-role { font-size: 12px; font-weight: 600; color: var(--text-secondary); letter-spacing: 0.01em; }

.msg-provider-tag {
    font-size: 10px; padding: 2px 8px; border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--bg-card) 90%, var(--accent));
    color: var(--text-dim);
    letter-spacing: 0.03em; font-weight: 500;
    border: 1px solid var(--border);
}

.msg-content {
    font-size: 14px; line-height: 1.7; color: var(--text); word-wrap: break-word;
}

/* Assistant bubble — OpenClaw flat card */
.msg-row.assistant:not(.streaming) .msg-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 10px 14px;
    box-shadow: none;
    transition: background var(--duration-fast) ease-out, border-color var(--duration-fast) ease-out;
}
.msg-row.assistant:not(.streaming) .msg-content:hover {
    background: var(--bg-hover);
}

/* Hover actions — OpenClaw 3-stage reveal (0 → 0.6 → 1.0) */
.msg-actions {
    position: absolute; top: 10px; right: 0;
    display: flex; gap: 2px; opacity: 0;
    pointer-events: none;
    transition: opacity var(--duration-fast) ease-out;
}
.msg-row:hover .msg-actions { opacity: 0.6; pointer-events: auto; }
.msg-action-btn {
    width: 28px; height: 28px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: var(--glass-bg);
    backdrop-filter: blur(12px) saturate(1.6);
    color: var(--text-dim); cursor: pointer; font-size: 13px;
    display: flex; align-items: center; justify-content: center;
    transition: opacity var(--duration-fast) ease-out, background var(--duration-fast) ease-out, color var(--duration-fast) ease-out, border-color var(--duration-fast) ease-out;
}
.msg-action-btn:hover { opacity: 1; background: var(--bg-hover); color: var(--text); border-color: var(--border-light); }
.msg-action-btn.copied { color: var(--green); }
.msg-edit-btn { font-size: 14px; }
.msg-regen-btn { font-size: 16px; }
@media (hover: none) { .msg-actions { opacity: 1; pointer-events: auto; } }

/* Streaming message — OpenClaw pulsing border */
.msg-row.assistant.streaming .msg-content {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 10px 14px;
    background: var(--bg-card);
    animation: pulsing-border 1.5s ease-out infinite;
}
@keyframes pulsing-border {
    0%, 100% { border-color: var(--border); }
    50% { border-color: var(--accent); }
}

/* Markdown */
.msg-content h1, .msg-content h2, .msg-content h3 { margin: 14px 0 6px; }
.msg-content h1 { font-size: 18px; } .msg-content h2 { font-size: 16px; } .msg-content h3 { font-size: 15px; }
.msg-content p { margin: 6px 0; }
.msg-content ul, .msg-content ol { margin: 6px 0; padding-left: 22px; }
.msg-content li { margin: 2px 0; }
.msg-content code {
    background: var(--bg-code);
    padding: 2px 6px; border-radius: var(--radius-xs); font-size: 13px;
    font-family: var(--font-mono);
    border: 1px solid var(--border);
    color: var(--accent-text);
}
.msg-content pre {
    background: var(--bg-code); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 14px; overflow-x: auto; margin: 10px 0;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}
.msg-content pre code { background: none; padding: 0; font-size: 13px; line-height: 1.5; border: none; }
.msg-content a { color: var(--accent-text); text-decoration: none; transition: color var(--duration-normal) ease-out; }
.msg-content a:hover { color: var(--accent-bright); text-decoration: underline; }
.msg-content blockquote { border-left: 3px solid var(--accent); padding-left: 14px; color: var(--text-secondary); margin: 10px 0; }
.msg-content table { border-collapse: collapse; margin: 10px 0; font-size: 13px; }
.msg-content th, .msg-content td { border: 1px solid var(--border); padding: 6px 10px; }
.msg-content th { background: var(--bg-surface); font-weight: 600; }

/* Agent steps */
.agent-steps { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.agent-steps:empty { display: none; }
.agent-steps.collapsed { display: none; }

.agent-step {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 8px 12px; border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border);
    font-size: 12px; animation: stepSlideIn var(--duration-normal) ease-out;
    transition: border-color var(--duration-fast) ease-out, background var(--duration-fast) ease-out;
    max-height: 120px; overflow: hidden;
}
.agent-step:hover { border-color: var(--border-light); background: var(--bg-hover); }
@keyframes stepSlideIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

.step-icon {
    width: 22px; height: 22px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; flex-shrink: 0;
}
.step-icon-thinking { background: var(--yellow-soft); color: var(--yellow); }
.step-icon-tool { background: var(--blue-soft); color: var(--blue); }

.step-spinner { width: 12px; height: 12px; border: 2px solid var(--accent); border-top-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.step-body { flex: 1; min-width: 0; }
.step-label { font-weight: 600; color: var(--text-secondary); }
.step-args { display: block; color: var(--text-dim); font-family: var(--font-mono); font-size: 11px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-result-area { margin-top: 4px; }
.step-result { font-size: 11px; border-radius: var(--radius-xs); }
.step-result summary { cursor: pointer; padding: 2px 0; color: var(--text-muted); }
.step-result-ok summary { color: var(--green); }
.step-result-error summary { color: var(--red); }
.step-result-content { padding: 4px 0; color: var(--text-dim); white-space: pre-wrap; word-break: break-word; max-height: 120px; overflow-y: auto; font-family: var(--font-mono); font-size: 11px; }

/* Council cards */
.council-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px; margin-bottom: 12px;
}
.council-card {
    padding: 10px 14px; border-radius: var(--radius);
    background: var(--glass-bg); backdrop-filter: blur(12px) saturate(1.6);
    border: 1px solid var(--border);
    font-size: 12px; animation: stepSlideIn var(--duration-normal) ease-out;
    transition: all var(--duration-fast) ease-out;
    overflow: hidden;
}
.council-card.loading {
    min-height: 60px;
}
.council-card.success { border-color: var(--green); }
.council-card.error { border-color: var(--red); opacity: 0.6; }
.council-card:hover { border-color: var(--accent); }

.council-card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 6px;
}
.council-model-name {
    font-weight: 600; color: var(--text-secondary); font-size: 11px;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.council-model-status {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--text-muted);
}
.council-model-status.loading { background: var(--yellow); animation: pulse 1.5s infinite; }
.council-model-status.success { background: var(--green); }
.council-model-status.error { background: var(--red); }
@keyframes pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

.council-card-body {
    font-size: 12px; color: var(--text-dim);
    max-height: 100px; overflow: hidden;
    line-height: 1.4;
}
.council-card-body.expanded { max-height: none; }

.council-toggle-btn {
    display: block; margin: 6px auto 0; padding: 3px 12px;
    font-size: 11px; color: var(--accent); background: none;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    cursor: pointer; transition: all var(--duration-fast);
}
.council-toggle-btn:hover { border-color: var(--accent); background: var(--accent-soft); }

/* Council synthesis indicator */
.council-synth-bar {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; margin-bottom: 8px;
    border-radius: var(--radius);
    background: var(--bg-card); border: 1px solid var(--border);
    font-size: 12px; color: var(--text-secondary);
    animation: stepSlideIn var(--duration-normal) ease-out;
}
.council-synth-bar .step-spinner { margin-right: 4px; }

/* Consensus map */
.consensus-block {
    padding: 10px 14px; margin-top: 12px; border-radius: var(--radius);
    background: var(--glass-bg); backdrop-filter: blur(12px);
    border: 1px solid var(--border); font-size: 12px;
}
.consensus-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 8px;
}
.consensus-title { font-weight: 600; color: var(--text-secondary); }
.consensus-confidence {
    padding: 2px 8px; border-radius: var(--radius-sm);
    font-weight: 600; font-size: 11px;
}
.confidence-high { background: var(--green-soft, rgba(52,211,153,0.15)); color: var(--green); }
.confidence-medium { background: var(--yellow-soft); color: var(--yellow); }
.confidence-low { background: var(--red-soft); color: var(--red); }

.consensus-section { margin-bottom: 6px; }
.consensus-section-title { font-weight: 600; color: var(--text-muted); margin-bottom: 3px; }
.consensus-item {
    padding: 3px 0; color: var(--text-dim);
    display: flex; align-items: flex-start; gap: 6px;
}
.consensus-icon-agree { color: var(--green); }
.consensus-icon-disagree { color: var(--yellow); }

/* Orchestrator plan */
.orchestrator-plan {
    display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px;
}
.orch-task {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px; border-radius: var(--radius);
    background: var(--bg-card); border: 1px solid var(--border);
    font-size: 12px; transition: all var(--duration-fast) ease-out;
    animation: stepSlideIn var(--duration-normal) ease-out;
}
.orch-task.running { border-color: var(--accent); background: var(--accent-soft, rgba(99,102,241,0.08)); }
.orch-task.done { border-color: var(--green); }
.orch-task.error { border-color: var(--red); }

.orch-task-num {
    width: 22px; height: 22px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 600; flex-shrink: 0;
    background: var(--accent-soft); color: var(--accent);
}
.orch-task.done .orch-task-num { background: var(--green-soft, rgba(52,211,153,0.15)); color: var(--green); }
.orch-task.error .orch-task-num { background: var(--red-soft); color: var(--red); }

.orch-task-body { flex: 1; min-width: 0; }
.orch-task-query { font-weight: 500; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.orch-task-meta { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.orch-task-status { flex-shrink: 0; }

.msg-fallback { font-size: 11px; color: var(--yellow); margin-bottom: 6px; }

.typing-indicator { display: inline-flex; gap: 6px; padding: 4px 0; align-items: center; }
.typing-indicator span {
    width: 6px; height: 6px; background: var(--text-muted); border-radius: 50%;
    animation: reading-pulse 1.4s ease-in-out infinite;
}
.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes reading-pulse {
    0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
    30% { opacity: 1; transform: scale(1); }
}
@keyframes bounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }

.msg-error { max-width: 720px; width: 100%; margin: 0 auto; padding: 8px 24px; }
.msg-error-inner { padding: 10px 14px; border-radius: var(--radius); background: var(--red-soft); color: var(--red); font-size: 13px; backdrop-filter: blur(8px); }

/* Source cards */
.source-cards {
    display: flex; gap: 8px; overflow-x: auto; padding: 8px 0 12px;
    scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.source-cards::-webkit-scrollbar { height: 4px; }
.source-cards::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-xs); }

.source-card {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; border-radius: var(--radius);
    background: var(--glass-bg); backdrop-filter: blur(12px) saturate(1.6);
    border: 1px solid var(--border);
    text-decoration: none; color: var(--text); flex-shrink: 0;
    min-width: 180px; max-width: 260px;
    transition: all var(--duration-fast) ease-out;
}
.source-card:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.source-card.highlight { border-color: var(--accent); box-shadow: 0 0 16px var(--accent-glow); animation: sourceFlash 1.5s ease; }
@keyframes sourceFlash { 0%, 100% { box-shadow: 0 0 0 1px var(--accent); } 50% { box-shadow: 0 0 20px var(--accent-glow); } }

.source-idx {
    display: flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--accent-soft); color: var(--accent);
    font-size: 10px; font-weight: 600; flex-shrink: 0;
}
.source-favicon { width: 16px; height: 16px; flex-shrink: 0; border-radius: var(--radius-xs); }
.source-info { display: flex; flex-direction: column; min-width: 0; }
.source-title { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source-domain { font-size: 10px; color: var(--text-muted); }

/* Inline citations */
.citation-ref {
    color: var(--accent); font-size: 0.8em; font-weight: 600;
    text-decoration: none; cursor: pointer; vertical-align: super;
}
.citation-ref:hover { text-decoration: underline; }

/* Research progress bar */
.research-bar {
    width: 100%; height: 4px; background: var(--bg-hover);
    border-radius: var(--radius-xs); margin-top: 4px; overflow: hidden;
}
.research-bar-fill {
    height: 100%; background: var(--accent);
    border-radius: var(--radius-xs); transition: width var(--duration-normal) ease-out;
    box-shadow: 0 0 8px var(--accent-glow);
}

/* Follow-up questions */
.follow-ups {
    display: flex; flex-wrap: wrap; gap: 8px;
    padding: 12px 0 4px; margin-top: 8px;
    border-top: 1px solid var(--border);
}
.follow-up-btn {
    padding: 6px 14px; border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary); font-size: 12px;
    font-family: var(--font); cursor: pointer;
    transition: all var(--duration-fast) ease-out;
    box-shadow: var(--highlight-inset);
}
.follow-up-btn:hover {
    border-color: color-mix(in srgb, var(--accent) 30%, transparent);
    color: var(--accent-text);
    background: color-mix(in srgb, var(--accent) 10%, var(--bg-card));
    box-shadow: var(--highlight-inset), 0 2px 12px var(--accent-glow);
}

/* Input area */
#input-area {
    padding: 0 24px 16px; flex-shrink: 0;
    max-width: 768px; width: 100%; margin: 0 auto;
    position: relative;
}
#input-area::before {
    content: ''; position: absolute; top: -60px; left: 0; right: 0; height: 60px;
    background: linear-gradient(to bottom, transparent 20%, var(--bg));
    pointer-events: none;
}

#input-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg); padding: 4px;
    display: flex; align-items: flex-end;
    transition: border-color var(--duration-fast) ease-out, box-shadow var(--duration-fast) ease-out;
    box-shadow: var(--highlight-inset), 0 4px 20px rgba(0, 0, 0, 0.2);
}
#input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

#message-input {
    flex: 1; background: transparent; color: var(--text);
    border: none; padding: 10px 14px; font-size: 14px;
    font-family: var(--font); resize: none; max-height: 140px;
    line-height: 1.5; outline: none;
}
#message-input::placeholder { color: var(--text-muted); }

#send-btn {
    width: 36px; height: 36px; border-radius: var(--radius);
    border: none;
    background: var(--accent);
    color: white;
    font-size: 16px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; margin: 2px;
    transition: transform var(--duration-fast) var(--ease-spring), box-shadow var(--duration-normal) ease-out;
    box-shadow: 0 2px 8px var(--accent-glow);
}
#send-btn:hover { background: var(--accent-hover); }
#send-btn:active { background: var(--accent-hover); transform: scale(0.97); }
#send-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ===== Panel pages (all non-chat tabs) ===== */

.panel-page { padding: 24px; overflow-y: auto; flex: 1; }

.panel-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px; max-width: 960px;
}

.panel-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg); overflow: hidden;
    transition: all var(--duration-normal) ease-out;
    box-shadow: var(--highlight-inset), 0 2px 8px rgba(0, 0, 0, 0.1);
}
.panel-card:hover { border-color: var(--border-light); box-shadow: var(--highlight-inset), 0 8px 24px rgba(0, 0, 0, 0.2); }
.panel-card.wide { grid-column: 1 / -1; }

.card-header {
    padding: 12px 16px; font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--text-dim); border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg-card) 50%, transparent);
}

.card-body { padding: 14px 16px; }

.status-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; }
.status-row + .status-row { border-top: 1px solid var(--border); }
.status-name { font-size: 13px; color: var(--text-secondary); }

.status-value { font-size: 11px; padding: 2px 8px; border-radius: var(--radius-sm); font-weight: 500; }
.status-value.ok { background: var(--green-soft); color: var(--green); }
.status-value.error { background: var(--red-soft); color: var(--red); }
.status-value.unknown { background: var(--bg-hover); color: var(--text-dim); }
.status-loading { color: var(--text-dim); font-size: 13px; padding: 8px 0; }

.info-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.info-table td { padding: 6px 0; color: var(--text-secondary); border: none; }
.info-table .label { color: var(--text-dim); width: 100px; font-weight: 500; }
.info-table tr + tr td { border-top: 1px solid var(--border); }

/* Provider icon in rows */
.provider-row { gap: 10px; }
.provider-icon-sm { width: 22px; height: 22px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.provider-icon-sm svg { width: 20px; height: 20px; }
.provider-key-badge {
    font-size: 9px; padding: 1px 6px; border-radius: var(--radius-xs);
    background: var(--accent-soft); color: var(--accent); font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.05em;
}

.stat-number { font-size: 28px; font-weight: 600; color: var(--text); letter-spacing: -0.022em; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

/* ===== Agents ===== */

.agents-header { margin-bottom: 20px; }
.agents-header h2 { font-size: 20px; font-weight: 600; color: var(--text); margin-bottom: 4px; letter-spacing: -0.022em; }
.agents-header p { font-size: 13px; color: var(--text-muted); }

.agents-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px; max-width: 960px; margin-bottom: 24px;
}

.agent-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 18px;
    transition: all var(--duration-normal) ease-out;
}
.agent-card:hover {
    border-color: var(--border-light);
    background: var(--bg-hover);
}
.agent-card.agent-default { border-color: color-mix(in srgb, var(--accent) 30%, transparent); }

.agent-card-top { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }

.agent-avatar {
    width: 40px; height: 40px; border-radius: var(--radius);
    background: var(--accent-soft);
    color: var(--accent); display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 600; flex-shrink: 0;
    border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}

.agent-info { flex: 1; min-width: 0; }
.agent-name { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.agent-desc { font-size: 12px; color: var(--text-muted); line-height: 1.4; }

.agent-delete { background: none; border: none; color: var(--text-dim); font-size: 18px; cursor: pointer; padding: 0 4px; transition: color var(--duration-normal) ease-out; }
.agent-delete:hover { color: var(--red); }

.agent-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.agent-meta-item { font-size: 11px; color: var(--text-dim); background: var(--bg-hover); padding: 3px 8px; border-radius: var(--radius-sm); }

.agent-use-btn {
    width: 100%; padding: 8px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: transparent;
    color: var(--text-secondary); font-size: 12px; font-family: var(--font);
    cursor: pointer; transition: all var(--duration-normal) ease-out;
}
.agent-use-btn:hover {
    background: var(--accent-soft); color: var(--accent);
    border-color: var(--border-glow);
    box-shadow: 0 2px 12px var(--accent-glow);
}

.create-agent-panel { max-width: 520px; }
.create-agent-panel summary { font-size: 13px; font-weight: 500; color: var(--accent-text); cursor: pointer; padding: 8px 0; }
.create-agent-form { padding: 12px 0; }
.create-agent-form textarea { width: 100%; background: var(--bg-input); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; font-family: var(--font); resize: vertical; outline: none; }

/* ===== Skills ===== */

.skills-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; max-width: 960px; }

.skill-card {
    background: var(--glass-bg); backdrop-filter: blur(16px);
    border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px;
    transition: all var(--duration-normal) ease-out;
}
.skill-card:hover { border-color: var(--border-light); background: var(--bg-hover); }
.skill-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.skill-icon { width: 28px; height: 28px; background: var(--blue-soft); color: var(--blue); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.skill-name { font-size: 14px; font-weight: 600; color: var(--text); flex: 1; }
.skill-status { font-size: 10px; padding: 2px 8px; border-radius: var(--radius-sm); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }
.skill-status.ok { background: var(--green-soft); color: var(--green); }
.skill-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* ===== Channels ===== */

.channels-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; max-width: 960px; }
.channel-card {
    background: var(--glass-bg); backdrop-filter: blur(16px);
    border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px;
    transition: all var(--duration-normal) ease-out;
}
.channel-card:hover { border-color: var(--border-light); background: var(--bg-hover); }
.channel-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.channel-icon { width: 28px; height: 28px; background: var(--bg-hover); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 14px; color: var(--text-secondary); flex-shrink: 0; }
.channel-name { font-size: 14px; font-weight: 600; color: var(--text); flex: 1; }
.channel-status { font-size: 10px; padding: 2px 8px; border-radius: var(--radius-sm); font-weight: 500; text-transform: uppercase; }
.channel-status.ok { background: var(--green-soft); color: var(--green); }
.channel-status.not-configured { background: var(--bg-hover); color: var(--text-dim); }
.channel-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* ===== Settings ===== */

.settings-grid { max-width: 640px; }
.settings-section { margin-bottom: 28px; }
.settings-section-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.settings-section-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 14px; }

.setting-card {
    background: var(--glass-bg); backdrop-filter: blur(16px);
    border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; margin-bottom: 10px;
    transition: all var(--duration-normal) ease-out;
}
.setting-card:hover { border-color: var(--border-light); }
.sc-label { font-size: 11px; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.05em; }
.sc-row { display: flex; gap: 8px; align-items: center; }
.sc-input {
    flex: 1; background: var(--bg-input); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 8px 12px; font-size: 13px; font-family: var(--font); outline: none;
    transition: all var(--duration-normal) ease-out;
}
.sc-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sc-btn {
    background: var(--accent); color: white;
    border: none; border-radius: var(--radius-sm); padding: 8px 16px;
    font-size: 12px; font-weight: 600; cursor: pointer; font-family: var(--font);
    white-space: nowrap; transition: all var(--duration-normal) ease-out;
    box-shadow: 0 2px 8px var(--accent-glow);
}
.sc-btn:hover { background: var(--accent-hover); }
.sc-btn-sm { padding: 6px 10px; font-size: 11px; }
.sc-btn-danger { background: var(--red-soft); color: var(--red); box-shadow: none; }
.sc-btn-danger:hover { background: var(--red); color: white; box-shadow: 0 2px 8px rgba(248, 113, 113, 0.3); }
.sc-btn-oauth { display: inline-flex; align-items: center; gap: 6px; background: var(--bg-hover); color: var(--text); border: 1px solid var(--border); box-shadow: none; }
.sc-btn-oauth:hover { background: var(--bg-active); }
.sc-btn-oauth svg { flex-shrink: 0; }
.provider-status { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 6px; vertical-align: middle; }
.provider-status.connected { background: var(--green); box-shadow: 0 0 6px rgba(52, 211, 153, 0.5); }
.provider-status.disconnected { background: var(--text-muted); }
.sc-hint { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.sc-code { font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); line-height: 1.6; }
.sc-pre {
    background: var(--bg-code); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 12px 14px; font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary);
    line-height: 1.5; overflow-x: auto; white-space: pre;
}

/* ===== Pricing ===== */

.pricing-header { margin-bottom: 24px; }
.pricing-header h2 { font-size: 20px; font-weight: 600; color: var(--text); margin-bottom: 4px; letter-spacing: -0.022em; }
.pricing-header p { font-size: 13px; color: var(--text-muted); }

.pricing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; max-width: 960px; }

.pricing-card {
    background: var(--glass-bg); backdrop-filter: blur(16px);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 24px 20px; position: relative;
    transition: all var(--duration-normal) ease-out;
}
.pricing-card:hover { border-color: var(--border-light); background: var(--bg-hover); }
.pricing-card.pricing-popular {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}
.pricing-badge {
    position: absolute; top: -9px; right: 14px;
    background: var(--accent);
    color: white; font-size: 10px; font-weight: 600; padding: 2px 10px;
    border-radius: var(--radius-sm); text-transform: uppercase;
    box-shadow: 0 2px 8px var(--accent-glow);
}
.pricing-name { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.pricing-price { font-size: 24px; font-weight: 600; color: var(--accent); margin-bottom: 8px; letter-spacing: -0.022em; font-variant-numeric: tabular-nums; }
.pricing-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 14px; line-height: 1.4; }
.pricing-features { list-style: none; padding: 0; font-size: 12px; color: var(--text-secondary); line-height: 2; }
.pricing-features li::before { content: "~ "; color: var(--green); }

.pricing-usp { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 8px; max-width: 960px; }
.usp-item {
    padding: 8px 16px; border-radius: var(--radius-xl);
    background: var(--accent-soft);
    color: var(--accent-text); font-size: 13px; font-weight: 500;
    border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
}

/* ===== Dialog ===== */

dialog {
    background: var(--glass-bg); backdrop-filter: blur(16px);
    color: var(--text); border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg); padding: 24px; max-width: 400px; width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(8px); }
dialog h2 { margin-bottom: 16px; font-size: 16px; font-weight: 600; }

/* ===== Mobile ===== */

.mobile-only { display: none; }
#sidebar-overlay.hidden { display: none; }

@media (max-width: 768px) {
    .mobile-only { display: flex; }
    #sidebar { position: fixed; left: -100%; top: 0; bottom: 0; z-index: 100; transition: left var(--duration-normal) ease-out; width: 260px; }
    #sidebar.open { left: 0; }
    #sidebar-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 99; backdrop-filter: blur(8px); }
    #message-list { padding: 16px 14px 8px; }
    #input-area { padding: 0 12px 12px; }
    .panel-page { padding: 16px; }
    .panel-grid, .agents-grid, .skills-grid, .channels-grid, .pricing-grid { grid-template-columns: 1fr; }
    #menu-btn { background: none; border: none; color: var(--text); font-size: 18px; cursor: pointer; padding: 4px; }
}

/* ===== Scrollbar — OpenClaw minimal ===== */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.14); }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ===== Animations ===== */

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Sidebar Collapse ===== */

.sidebar-collapse-btn {
    width: 24px; height: 24px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: transparent;
    color: var(--text-dim); font-size: 14px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--duration-normal) ease-out; margin-left: auto; flex-shrink: 0;
}
.sidebar-collapse-btn:hover { background: var(--bg-hover); color: var(--text); }

/* --- Sidebar Controls Row --- */
.sidebar-controls {
    display: flex; gap: 6px; align-items: center;
}

/* --- Collapsed Sidebar --- */
#sidebar.collapsed { width: var(--nav-width-collapsed); }

/* Hide text elements */
#sidebar.collapsed .brand-name,
#sidebar.collapsed .sessions-title,
#sidebar.collapsed .conv-title,
#sidebar.collapsed .conv-delete,
#sidebar.collapsed .conv-move,
#sidebar.collapsed .sidebar-collapse-btn span:first-child,
#sidebar.collapsed .nav-item [data-i18n] { display: none; }

/* Brand */
#sidebar.collapsed .sidebar-brand { justify-content: center; }
#sidebar.collapsed .status-dot { margin-left: 0; }

/* Header */
#sidebar.collapsed .sidebar-header { padding: 12px 6px; align-items: center; }
#sidebar.collapsed .sidebar-controls { justify-content: center; }
#sidebar.collapsed .theme-switcher { display: none; }
#sidebar.collapsed .lang-switcher { display: none; }

/* Nav items — center icon only */
#sidebar.collapsed .sidebar-nav { padding: 8px 4px 6px; }
#sidebar.collapsed .nav-item {
    justify-content: center; padding: 10px 0;
    gap: 0; min-height: 38px;
    position: relative;
}
/* Tooltip on hover for collapsed nav */
#sidebar.collapsed .nav-item::after {
    content: attr(data-tooltip);
    position: absolute; left: calc(100% + 8px); top: 50%;
    transform: translateY(-50%);
    background: var(--bg-tooltip); color: var(--text);
    padding: 4px 10px; border-radius: var(--radius-sm);
    font-size: 12px; white-space: nowrap; pointer-events: none;
    opacity: 0; transition: opacity var(--duration-fast) ease-out;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 200;
}
#sidebar.collapsed .nav-item:hover::after { opacity: 1; }
#sidebar.collapsed .nav-icon {
    margin: 0; width: 24px; height: 24px;
    opacity: 0.7;
}
#sidebar.collapsed .nav-icon svg { width: 18px; height: 18px; }
#sidebar.collapsed .nav-item.active .nav-icon { opacity: 1; }

/* Sessions */
#sidebar.collapsed .sessions-header { justify-content: center; padding: 10px 4px 4px; }
#sidebar.collapsed #new-chat-btn { margin: 0; }
#sidebar.collapsed #new-collection-btn { display: none; }
#sidebar.collapsed #conversations-list { padding: 4px 4px; }

/* Conversation items — show initials */
#sidebar.collapsed .conv-item {
    justify-content: center; padding: 8px 4px;
    font-size: 0; white-space: nowrap; overflow: hidden;
}
#sidebar.collapsed .conv-item::before {
    content: attr(data-initial);
    font-size: 11px; color: var(--text-muted); font-weight: 600;
}
#sidebar.collapsed .conv-item.active::before { color: var(--accent); }
#sidebar.collapsed .conv-actions { display: none; }

/* Collections */
#sidebar.collapsed #collections-list { display: none; }

/* Footer */
#sidebar.collapsed .sidebar-footer button { font-size: 0; padding: 8px; }
#sidebar.collapsed .sidebar-footer button::before { content: "\23FB"; font-size: 14px; }

/* Collapse button */
#sidebar.collapsed .sidebar-collapse-btn { transform: rotate(180deg); }

/* Usage bar */
#sidebar.collapsed .usage-bar { padding: 6px 4px; }
#sidebar.collapsed #usage-text { display: none; }

/* ===== Theme Switcher ===== */

.theme-switcher {
    display: flex; align-items: center; gap: 2px;
    background: var(--bg-hover); border-radius: var(--radius-sm);
    padding: 2px; border: 1px solid var(--border);
}

.theme-btn {
    width: 26px; height: 24px; border: none; background: transparent;
    border-radius: var(--radius-sm); cursor: pointer; font-size: 13px;
    color: var(--text-dim); display: flex; align-items: center; justify-content: center;
    transition: all var(--duration-normal) ease-out;
}
.theme-btn:hover { color: var(--text-secondary); }
.theme-btn.active { background: var(--accent-soft); color: var(--accent); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15); }

/* (collapsed theme/lang handled above in Collapsed Sidebar section) */

/* ===== Language Switcher ===== */

.lang-switcher {
    display: flex; align-items: center; gap: 2px;
    background: var(--bg-hover); border-radius: var(--radius-sm);
    padding: 2px; border: 1px solid var(--border);
}

.lang-btn {
    padding: 2px 8px; border: none; background: transparent;
    border-radius: var(--radius-sm); cursor: pointer; font-size: 11px; font-weight: 600;
    color: var(--text-dim); font-family: var(--font);
    transition: all var(--duration-normal) ease-out; letter-spacing: 0.03em;
}
.lang-btn:hover { color: var(--text-secondary); }
.lang-btn.active { background: var(--accent-soft); color: var(--accent); }

/* ===== Focus Mode ===== */

body.focus-mode #sidebar,
body.focus-mode #sidebar-overlay,
body.focus-mode #topbar { display: none !important; }
body.focus-mode #main { width: 100%; }
body.focus-mode #messages { padding-top: 16px; }

/* Expand button on tool results */
.step-expand-btn {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 2px 8px; margin-left: 6px;
    border-radius: var(--radius); border: 1px solid var(--border);
    background: transparent; color: var(--text-muted);
    font-size: 11px; cursor: pointer;
    transition: background var(--duration-fast) ease-out, color var(--duration-fast) ease-out;
}
.step-expand-btn:hover { background: var(--bg-hover); color: var(--text); }

.focus-btn {
    width: 32px; height: 32px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: transparent;
    color: var(--text-dim); cursor: pointer; font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--duration-normal) ease-out;
}
.focus-btn:hover { background: var(--bg-hover); color: var(--text); }

.focus-exit-btn {
    position: fixed; top: 12px; right: 12px; z-index: 200;
    width: 36px; height: 36px; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--glass-bg);
    backdrop-filter: blur(16px);
    color: var(--text-muted); cursor: pointer; font-size: 16px;
    display: none; align-items: center; justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    transition: all var(--duration-normal) ease-out;
}
.focus-exit-btn:hover { background: var(--bg-hover); color: var(--text); }
body.focus-mode .focus-exit-btn { display: flex; }

/* ===== Toast Notifications ===== */

#toast-container {
    position: fixed; bottom: 20px; right: 20px; z-index: 10000;
    display: flex; flex-direction: column-reverse; gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 10px 16px; border-radius: var(--radius);
    font-size: 13px; font-family: var(--font);
    display: flex; align-items: center; gap: 8px;
    pointer-events: auto; min-width: 200px; max-width: 380px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    animation: toastIn var(--duration-normal) ease-out;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
}
.toast.toast-out { animation: toastOut 0.2s ease forwards; }

.toast-success { border-color: var(--green); }
.toast-error { border-color: var(--red); }
.toast-info { border-color: var(--blue); }
.toast-warning { border-color: var(--yellow); }

.toast-icon { font-size: 15px; flex-shrink: 0; }
.toast-success .toast-icon { color: var(--green); }
.toast-error .toast-icon { color: var(--red); }
.toast-info .toast-icon { color: var(--blue); }
.toast-warning .toast-icon { color: var(--yellow); }
.toast-msg { flex: 1; color: var(--text); }
.toast-close {
    background: none; border: none; color: var(--text-dim);
    cursor: pointer; font-size: 14px; padding: 0 2px; flex-shrink: 0;
}
.toast-close:hover { color: var(--text); }

@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastOut { from { opacity: 1; transform: translateY(0) scale(1); } to { opacity: 0; transform: translateY(12px) scale(0.96); } }

/* ===== Agent Steps ===== */

.agent-steps-wrapper { margin-bottom: 8px; }

.agent-steps-summary {
    display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
    padding: 6px 0; font-size: 12px;
}
.summary-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: var(--radius-full);
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text-secondary); font-size: 11px;
    transition: background var(--duration-fast) ease-out;
}
.summary-chip:hover { background: var(--bg-hover); }

.agent-steps-toggle {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 8px; cursor: pointer; font-size: 11px;
    color: var(--text-muted); background: none; border: none;
    font-family: var(--font); transition: color var(--duration-normal) ease-out;
}
.agent-steps-toggle:hover { color: var(--text-secondary); }
.agent-steps-toggle .toggle-arrow { transition: transform var(--duration-fast) ease-out; font-size: 9px; }
.agent-steps-toggle .toggle-arrow.open { transform: rotate(90deg); }

.agent-steps.collapsed { display: none; }

/* ===== Keyboard Shortcuts Hint ===== */

.kbd {
    display: inline-block; padding: 1px 5px; border-radius: var(--radius-xs);
    background: var(--bg-hover); border: 1px solid var(--border);
    font-size: 10px; font-family: var(--font-mono); color: var(--text-dim);
    line-height: 1.5;
}

/* ===== File Upload ===== */

.attach-btn {
    width: 36px; height: 36px; border: none; background: transparent;
    color: var(--text-muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; margin: 2px; border-radius: var(--radius-sm);
    transition: color var(--duration-fast) ease-out, background var(--duration-fast) ease-out;
}
.attach-btn:hover { background: var(--bg-hover); color: var(--text); }

#file-previews {
    display: flex; flex-wrap: wrap; gap: 8px;
    padding: 0; margin-bottom: 0;
}
#file-previews:empty { display: none; }

.file-preview {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px; border-radius: var(--radius-sm);
    background: var(--glass-bg); backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    font-size: 12px; color: var(--text-secondary);
    animation: fadeIn 0.2s ease;
}
.file-preview-icon { font-size: 16px; flex-shrink: 0; }
.file-preview-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-preview-size { color: var(--text-dim); font-size: 11px; }
.file-preview-remove {
    background: none; border: none; color: var(--text-dim);
    cursor: pointer; font-size: 14px; padding: 0 2px;
}
.file-preview-remove:hover { color: var(--red); }

.file-preview-thumb {
    width: 32px; height: 32px; border-radius: var(--radius-xs);
    object-fit: cover; flex-shrink: 0;
}

.drop-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
}
.drop-overlay.hidden { display: none; }
.drop-overlay-content {
    padding: 40px 60px; border-radius: var(--radius-lg);
    border: 3px dashed var(--accent);
    background: var(--glass-bg); backdrop-filter: blur(16px);
    color: var(--accent); font-size: 20px; font-weight: 600;
    box-shadow: 0 0 40px var(--accent-glow);
}

/* File cards in messages */
.msg-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; margin-bottom: 4px; }
.msg-file-card {
    display: flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: var(--radius-sm);
    background: var(--glass-bg); border: 1px solid var(--border);
    font-size: 12px; color: var(--text-secondary);
}
.msg-file-card .file-icon { font-size: 14px; }
.msg-file-thumb { width: 48px; height: 48px; border-radius: var(--radius-xs); object-fit: cover; cursor: pointer; }

/* ===== Tier Gating ===== */

.pro-badge {
    display: inline-block; padding: 1px 6px; border-radius: var(--radius-xs);
    background: var(--accent);
    color: white; font-size: 9px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em;
    vertical-align: middle; margin-left: 6px;
    box-shadow: 0 2px 6px var(--accent-glow);
}

.agent-card.locked {
    opacity: 0.6; position: relative;
}
.agent-card.locked .agent-use-btn {
    background: var(--bg-hover); color: var(--text-dim);
    border-color: var(--border); cursor: default;
}
.agent-card.locked .agent-use-btn:hover {
    background: var(--bg-hover); color: var(--text-dim); border-color: var(--border);
    box-shadow: none;
}
.agent-lock-overlay {
    position: absolute; inset: 0; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    background: rgba(10, 10, 15, 0.5); cursor: pointer;
    backdrop-filter: blur(8px);
}
.agent-lock-text {
    padding: 6px 14px; border-radius: var(--radius-sm);
    background: var(--glass-bg); backdrop-filter: blur(12px) saturate(1.6);
    border: 1px solid var(--accent);
    color: var(--accent); font-size: 12px; font-weight: 600;
}

.usage-bar {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 16px; font-size: 11px; color: var(--text-dim);
}
.usage-bar-fill {
    flex: 1; height: 4px; background: var(--bg-hover);
    border-radius: var(--radius-xs); overflow: hidden;
}
.usage-bar-fill-inner {
    height: 100%; border-radius: var(--radius-xs);
    background: var(--accent);
    transition: width var(--duration-normal) ease-out;
}
.usage-bar-fill-inner.warning { background: linear-gradient(90deg, var(--yellow), #d97706); }
.usage-bar-fill-inner.critical { background: linear-gradient(90deg, var(--red), #dc2626); }

/* Paywall modal */
#paywall-modal {
    position: fixed; inset: 0; z-index: 10001;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: none; align-items: center; justify-content: center;
}
#paywall-modal.open { display: flex; }
.paywall-content {
    background: var(--glass-bg); backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg); padding: 32px;
    max-width: 400px; width: 90%; text-align: center;
    animation: fadeIn var(--duration-normal) ease-out;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
.paywall-icon { font-size: 40px; margin-bottom: 12px; }
.paywall-title { font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.paywall-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; line-height: 1.5; }
.paywall-btn {
    width: 100%; padding: 10px; border-radius: var(--radius);
    border: none; background: var(--accent);
    color: white; font-size: 14px; font-weight: 600; cursor: pointer;
    font-family: var(--font); margin-bottom: 8px;
    transition: all var(--duration-normal) ease-out;
    box-shadow: 0 4px 16px var(--accent-glow);
}
.paywall-btn:hover { background: var(--accent-hover); }
.paywall-close {
    background: transparent; border: 1px solid var(--border);
    color: var(--text-muted); width: 100%; padding: 8px;
    border-radius: var(--radius); cursor: pointer; font-size: 13px;
    font-family: var(--font); transition: all var(--duration-normal) ease-out;
}
.paywall-close:hover { background: var(--bg-hover); }

/* ===== Light theme overrides ===== */

[data-theme="light"] #landing { background: var(--bg); }
[data-theme="light"] #landing h1 { color: var(--text); }
[data-theme="light"] .msg-content pre { background: var(--bg-code); border-color: var(--border); }
[data-theme="light"] .sc-pre { background: var(--bg-code); }
[data-theme="light"] .msg-content code { background: var(--bg-code); border-color: var(--border); color: var(--accent-text); }
[data-theme="light"] .toast { box-shadow: var(--shadow-md); }
[data-theme="light"] .focus-exit-btn { box-shadow: var(--shadow-sm); }

/* ===== Code Block Wrapper ===== */

.code-block-wrapper { position: relative; margin: 8px 0; border-radius: var(--radius); overflow: hidden; background: var(--bg-code, rgba(0,0,0,0.3)); }
.code-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 4px 12px; font-size: 12px; color: var(--text-muted);
    background: rgba(255,255,255,0.04); border-bottom: 1px solid var(--border);
}
.code-lang { text-transform: uppercase; font-weight: 600; letter-spacing: 0.5px; }
.code-copy-btn {
    background: transparent; border: 1px solid var(--border); color: var(--text-muted);
    padding: 2px 10px; border-radius: var(--radius-xs); cursor: pointer; font-size: 11px;
    transition: all var(--duration-fast) ease-out;
}
.code-copy-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.code-copy-btn.copied { background: var(--green); color: #fff; border-color: var(--green); }
.code-block-wrapper pre { margin: 0; border: none; border-radius: 0; }

/* Collapsible JSON */
.json-collapse { margin: 8px 0; border-radius: var(--radius); }
.json-collapse summary {
    cursor: pointer; padding: 6px 12px; font-size: 12px; color: var(--text-muted);
    background: rgba(255,255,255,0.04); border-radius: var(--radius); border: 1px solid var(--border);
    transition: all var(--duration-fast) ease-out;
}
.json-collapse summary:hover { background: rgba(255,255,255,0.08); }
.json-collapse[open] summary { border-radius: var(--radius) var(--radius) 0 0; }

/* ===== Message Search Bar ===== */

#message-search-bar {
    display: flex; align-items: center; gap: 8px; padding: 8px 12px;
    background: var(--glass-bg); backdrop-filter: blur(12px) saturate(1.6);
    border-bottom: 1px solid var(--border);
    animation: slideDown 0.2s ease;
}
#message-search-bar.hidden { display: none; }
#message-search-bar input {
    flex: 1; background: rgba(255,255,255,0.06); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 6px 10px; color: var(--text); font-size: 13px;
    font-family: var(--font); outline: none;
}
#message-search-bar input:focus { border-color: var(--accent); }
#message-search-bar button {
    background: transparent; border: none; color: var(--text-muted);
    cursor: pointer; font-size: 18px; padding: 2px 6px;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Pinned Messages ===== */

#pinned-messages { padding: 0 8px 8px; }
.pinned-details summary {
    cursor: pointer; font-size: 13px; color: var(--text-muted); padding: 6px 8px;
    border-radius: var(--radius-sm); background: rgba(255,255,255,0.03);
}
.pinned-details summary:hover { background: rgba(255,255,255,0.06); }
.pinned-list { display: flex; flex-direction: column; gap: 4px; padding-top: 6px; }
.pinned-item {
    display: flex; align-items: center; gap: 8px; padding: 4px 8px;
    font-size: 12px; color: var(--text-muted); border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.02); border: 1px solid var(--border);
}
.pinned-role { font-weight: 600; color: var(--accent); min-width: 24px; }
.pinned-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pinned-remove {
    background: transparent; border: none; color: var(--text-muted);
    cursor: pointer; font-size: 14px; padding: 0 4px;
}
.pinned-remove:hover { color: var(--red); }
.msg-row.pinned { border-left: 2px solid var(--accent); }

/* ===== Mic Button (STT) ===== */

.mic-btn {
    width: 36px; height: 36px; border: none; background: transparent;
    color: var(--text-muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; margin: 2px; border-radius: var(--radius-sm);
    transition: color var(--duration-fast) ease-out, background var(--duration-fast) ease-out;
}
.mic-btn:hover { color: var(--text); background: var(--bg-hover); }
.mic-btn.recording { color: var(--red); animation: micPulse 1s ease-in-out infinite; }
@keyframes micPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ===== Context Indicator ===== */

#input-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 2px 12px 0; min-height: 18px;
}
#input-token-count { font-size: 11px; color: var(--text-muted); }
#context-indicator { display: flex; align-items: center; gap: 6px; }
.context-bar {
    width: 80px; height: 4px; border-radius: var(--radius-xs);
    background: rgba(255,255,255,0.08); overflow: hidden;
}
.context-bar-fill { height: 100%; border-radius: var(--radius-xs); transition: width var(--duration-normal) ease-out, background var(--duration-normal) ease-out; }
.context-pct { font-size: 11px; color: var(--text-muted); }

/* ===== Slash Commands Menu ===== */

.slash-menu {
    position: absolute; bottom: 100%; left: 0; right: 0;
    max-height: 320px; overflow-y: auto;
    background: var(--glass-bg); backdrop-filter: blur(16px);
    border: 1px solid var(--border); border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    box-shadow: 0 -8px 32px rgba(0,0,0,0.3);
    z-index: 100; animation: slideUp var(--duration-fast) ease-out;
}
.slash-menu.hidden { display: none; }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.slash-list { padding: 6px 0; }
.slash-group-label {
    padding: 8px 14px 4px; font-size: 11px; font-weight: 600;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;
}
.slash-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 14px; cursor: pointer; transition: background var(--duration-fast) ease-out;
}
.slash-item:hover, .slash-item.active { background: rgba(255,255,255,0.06); }
.slash-item.active { border-left: 2px solid var(--accent); }
.slash-icon { font-size: 16px; width: 22px; text-align: center; flex-shrink: 0; }
.slash-name { font-size: 13px; color: var(--text); font-weight: 500; white-space: nowrap; }
.slash-desc { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slash-empty { padding: 16px; text-align: center; font-size: 13px; color: var(--text-muted); }
.slash-disabled { opacity: 0.5; cursor: default; }

/* ===== Command Palette ===== */

.command-palette {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(8px);
    display: flex; align-items: flex-start; justify-content: center;
    padding-top: 15vh; animation: fadeIn var(--duration-fast) ease-out;
}
.command-palette.hidden { display: none; }
.cmd-palette-dialog {
    width: 520px; max-width: 90vw; max-height: 60vh;
    background: var(--glass-bg); backdrop-filter: blur(16px);
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 16px 64px rgba(0,0,0,0.4);
    overflow: hidden; display: flex; flex-direction: column;
}
.cmd-palette-dialog input {
    width: 100%; padding: 14px 18px; font-size: 15px;
    background: transparent; border: none; border-bottom: 1px solid var(--border);
    color: var(--text); font-family: var(--font); outline: none;
}
.cmd-palette-dialog .slash-list { max-height: 50vh; overflow-y: auto; }

/* Share Modal */
.share-modal-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
}
.share-modal {
    background: var(--bg-surface); border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg); width: 420px; max-width: 90vw;
    box-shadow: 0 16px 64px rgba(0,0,0,0.5);
    backdrop-filter: blur(16px);
}
.share-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.share-modal-header h3 { margin: 0; font-size: 1rem; color: var(--text); }
.share-modal-close {
    background: none; border: none; color: var(--text-muted);
    font-size: 1.3rem; cursor: pointer; padding: 0; line-height: 1;
}
.share-modal-close:hover { color: var(--text); }
.share-modal-body { padding: 20px; }
.share-url-box {
    display: flex; gap: 8px; margin-bottom: 12px;
}
.share-url-input {
    flex: 1; padding: 8px 12px; border-radius: var(--radius-sm);
    background: var(--bg-input); border: 1px solid var(--border);
    color: var(--text); font-size: 0.85rem; outline: none;
}
.share-copy-btn {
    padding: 8px 16px; border-radius: var(--radius-sm); border: none;
    background: var(--accent); color: white; cursor: pointer;
    font-size: 0.85rem; font-weight: 500; white-space: nowrap;
}
.share-copy-btn:hover { background: var(--accent-hover); }
.share-revoke-btn {
    padding: 8px 16px; border-radius: var(--radius-sm); border: 1px solid var(--red-soft);
    background: var(--red-soft); color: var(--red); cursor: pointer;
    font-size: 0.85rem; width: 100%;
}
.share-revoke-btn:hover { background: rgba(248,113,113,0.2); }
.conv-share {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; font-size: 12px; padding: 2px;
}
.conv-share:hover { color: var(--accent); }

/* Prompt Library */
#prompt-library { margin-top: 32px; width: 100%; max-width: 700px; }
.prompt-lib-title {
    font-size: 1rem; font-weight: 600; color: var(--text-secondary);
    margin-bottom: 16px; text-align: left;
}
.prompt-lib-categories { display: flex; flex-direction: column; gap: 16px; }
.prompt-lib-cat { }
.prompt-lib-cat-header {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.85rem; font-weight: 600; color: var(--text-secondary);
    margin-bottom: 8px;
}
.prompt-lib-cat-icon { font-size: 1rem; }
.prompt-lib-cards {
    display: flex; flex-wrap: wrap; gap: 8px;
}
.prompt-card {
    padding: 8px 14px; border-radius: var(--radius);
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text); font-size: 0.82rem; cursor: pointer;
    transition: all var(--duration-fast) ease-out; backdrop-filter: blur(8px);
}
.prompt-card:hover {
    background: var(--bg-hover); border-color: var(--accent-soft);
    color: var(--accent-bright); box-shadow: 0 0 12px var(--accent-glow);
}

/* Keyboard Shortcuts Panel */
.shortcuts-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
}
.shortcuts-panel {
    background: var(--bg-surface); border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg); width: 440px; max-width: 90vw;
    box-shadow: 0 16px 64px rgba(0,0,0,0.5);
    backdrop-filter: blur(16px);
}
.shortcuts-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.shortcuts-header h3 { margin: 0; font-size: 1rem; color: var(--text); }
.shortcuts-close {
    background: none; border: none; color: var(--text-muted);
    font-size: 1.3rem; cursor: pointer; padding: 0; line-height: 1;
}
.shortcuts-close:hover { color: var(--text); }
.shortcuts-list { padding: 12px 20px; }
.shortcut-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 0; border-bottom: 1px solid var(--border);
}
.shortcut-row:last-child { border-bottom: none; }
.shortcut-row kbd {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 3px 8px; font-size: 0.78rem;
    color: var(--accent-bright); font-family: inherit; min-width: 80px;
    text-align: center;
}
.shortcut-row span { color: var(--text-secondary); font-size: 0.85rem; }

/* ===== OpenClaw-inspired: Skeleton Loader ===== */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius);
}
.skeleton-line { height: 14px; border-radius: var(--radius-sm); margin-bottom: 8px; }
.skeleton-line--short { width: 40%; }
.skeleton-line--medium { width: 65%; }
.skeleton-line--long { width: 85%; }

/* ===== OpenClaw-inspired: Code Block Chrome ===== */
.code-block-wrapper {
    position: relative; border-radius: var(--radius); overflow: hidden;
    margin: 10px 0; border: 1px solid var(--border);
}
.code-block-wrapper pre {
    margin: 0; border: none; border-radius: 0;
    box-shadow: none;
}
.code-block-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; padding: 4px 8px 4px 12px;
    background: rgba(0, 0, 0, 0.25); font-size: 12px; line-height: 1;
}
.code-block-lang {
    color: var(--text-muted); font-family: var(--font-mono);
    font-size: 11px; text-transform: lowercase; user-select: none;
}
.code-block-copy {
    appearance: none; border: none; background: transparent;
    color: var(--text-muted); font-size: 11px; font-family: var(--font);
    cursor: pointer; padding: 2px 6px; border-radius: var(--radius-sm);
    transition: color var(--duration-fast) ease-out, background var(--duration-fast) ease-out;
}
.code-block-copy:hover { color: var(--text); background: rgba(255, 255, 255, 0.1); }
.code-block-copy.copied { color: var(--green); }

/* ===== OpenClaw-inspired: Nav Active Glow Bar ===== */
.sidebar-collapsed .nav-item.active::before {
    content: ""; position: absolute; left: 6px; top: 10px; bottom: 10px;
    width: 3px; border-radius: var(--radius-full);
    background: var(--accent);
    box-shadow: 0 0 14px var(--accent-glow);
}
.sidebar-collapsed .nav-item.active {
    background: var(--accent-soft);
}

/* ===== OpenClaw-inspired: Focus Ring ===== */
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ===== OpenClaw-inspired: Rise Animation ===== */
@keyframes rise {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes scale-in {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
.panel-page { animation: rise var(--duration-normal) var(--ease-out); }
.glass-card { animation: scale-in 200ms var(--ease-out); }

/* ===== User Message Bubble — OpenClaw accent tint ===== */
.msg-row.user .msg-content {
    background: var(--accent-soft);
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    padding: 10px 14px;
    transition: background var(--duration-fast) ease-out;
}
.msg-row.user .msg-content:hover {
    background: color-mix(in srgb, var(--accent) 15%, transparent);
}

/* ===== OpenClaw-inspired: Glow Pulse ===== */
@keyframes glow-pulse {
    0%, 100% { box-shadow: 0 0 0 transparent; }
    50% { box-shadow: 0 0 20px var(--accent-glow); }
}

/* Compose input: focus state */
#input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ===== OpenClaw-inspired: Link Preview Cards ===== */
.link-preview {
    display: flex; gap: 12px; padding: 10px 12px;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--bg-card); margin: 8px 0;
    transition: background var(--duration-fast) ease-out;
}
.link-preview:hover { background: var(--bg-hover); }
.link-preview-text { flex: 1; min-width: 0; }
.link-preview-title {
    font-size: 13px; font-weight: 600; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.link-preview-desc {
    font-size: 12px; color: var(--text-muted); margin-top: 2px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.link-preview-domain {
    font-size: 11px; color: var(--text-dim); margin-top: 4px;
}
.link-preview-img {
    width: 60px; height: 60px; border-radius: var(--radius-sm); object-fit: cover; flex-shrink: 0;
}

/* ===== OpenClaw-inspired: Interactive Buttons in Messages ===== */
.msg-interactive {
    display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px;
}
.msg-interactive-btn {
    padding: 6px 14px; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--bg-card);
    color: var(--text); font-size: 13px; cursor: pointer;
    transition: all var(--duration-fast) ease-out;
}
.msg-interactive-btn:hover {
    background: var(--bg-hover); border-color: var(--accent-soft);
    color: var(--accent-bright);
}
.msg-interactive-btn--primary {
    background: var(--accent); color: white; border-color: transparent;
}
.msg-interactive-btn--primary:hover {
    background: var(--accent-hover);
}

/* ===== OpenClaw-inspired: Markdown Sidebar (right panel) ===== */
.md-sidebar {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: clamp(320px, 40vw, 560px);
    background: var(--bg-nav);
    border-left: 1px solid var(--border);
    backdrop-filter: blur(12px) saturate(1.6);
    -webkit-backdrop-filter: blur(12px) saturate(1.6);
    z-index: 60;
    display: flex; flex-direction: column;
    transform: translateX(100%);
    transition: transform var(--duration-normal) var(--ease-out);
}
.md-sidebar.open { transform: translateX(0); }

.md-sidebar-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.md-sidebar-title {
    font-size: 13px; font-weight: 600; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.md-sidebar-close {
    width: 28px; height: 28px; border-radius: var(--radius);
    border: 1px solid var(--border); background: transparent;
    color: var(--text-muted); font-size: 16px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background var(--duration-fast) ease-out, color var(--duration-fast) ease-out;
}
.md-sidebar-close:hover { background: var(--bg-hover); color: var(--text); }

.md-sidebar-body {
    flex: 1; overflow-y: auto; padding: 16px;
    font-size: 14px; line-height: 1.6; color: var(--text);
}
.md-sidebar-body pre { max-height: 400px; overflow: auto; }
.md-sidebar-body .code-block-wrapper { margin: 10px 0; }

.md-sidebar-backdrop {
    position: fixed; inset: 0; z-index: 59;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0; pointer-events: none;
    transition: opacity var(--duration-normal) ease-out;
}
.md-sidebar-backdrop.open { opacity: 1; pointer-events: auto; }

@media (max-width: 768px) {
    .md-sidebar { width: 100vw; }
}

/* ===== OpenClaw-inspired: View Transitions (theme switch) ===== */
@keyframes theme-circle-reveal {
    0% { clip-path: circle(0% at var(--theme-switch-x, 50%) var(--theme-switch-y, 50%)); }
    100% { clip-path: circle(150% at var(--theme-switch-x, 50%) var(--theme-switch-y, 50%)); }
}
html.theme-transition { view-transition-name: theme; }
html.theme-transition::view-transition-old(theme) { mix-blend-mode: normal; animation: none; z-index: 1; }
html.theme-transition::view-transition-new(theme) { mix-blend-mode: normal; z-index: 2; animation: theme-circle-reveal 0.4s var(--ease-out) forwards; }

/* ===== OpenClaw-inspired: Callout/Alert Components ===== */
.callout {
    padding: 14px 16px; border-radius: var(--radius);
    border: 1px solid var(--border); font-size: 13px; line-height: 1.5;
    margin: 10px 0; box-shadow: var(--highlight-inset);
}
.callout-title { font-weight: 600; margin-bottom: 4px; }
.callout.callout-danger {
    border-color: color-mix(in srgb, var(--red) 25%, transparent);
    background: linear-gradient(135deg, color-mix(in srgb, var(--red) 8%, transparent), color-mix(in srgb, var(--red) 4%, transparent));
    color: var(--red);
}
.callout.callout-info {
    border-color: color-mix(in srgb, var(--blue) 25%, transparent);
    background: linear-gradient(135deg, color-mix(in srgb, var(--blue) 8%, transparent), color-mix(in srgb, var(--blue) 4%, transparent));
    color: var(--blue);
}
.callout.callout-success {
    border-color: color-mix(in srgb, var(--green) 25%, transparent);
    background: linear-gradient(135deg, color-mix(in srgb, var(--green) 8%, transparent), color-mix(in srgb, var(--green) 4%, transparent));
    color: var(--green);
}
.callout.callout-warning {
    border-color: color-mix(in srgb, var(--yellow) 25%, transparent);
    background: linear-gradient(135deg, color-mix(in srgb, var(--yellow) 8%, transparent), color-mix(in srgb, var(--yellow) 4%, transparent));
    color: var(--yellow);
}

/* ===== Token/Cost metadata on messages ===== */
.msg-token-meta {
    display: flex; align-items: center; gap: 8px;
    margin-top: 6px; font-size: 11px; color: var(--text-dim);
}
.msg-token-meta span { display: inline-flex; align-items: center; gap: 3px; }

/* ===== Session search input ===== */
.sessions-search {
    padding: 4px 12px 8px;
}
.sessions-search input {
    width: 100%; padding: 6px 10px;
    border-radius: var(--radius); border: 1px solid var(--border);
    background: var(--bg-input); color: var(--text);
    font-size: 12px; outline: none;
    transition: border-color var(--duration-fast) ease-out;
}
.sessions-search input:focus { border-color: var(--accent-soft); }
.sessions-search input::placeholder { color: var(--text-dim); }

/* Session time label */
.conv-time {
    font-size: 10px; color: var(--text-dim); flex-shrink: 0;
    margin-left: auto; white-space: nowrap;
}

/* ===== Usage Chart (CSS bars) ===== */
#usage-chart { min-height: 120px; }
.usage-chart-bars {
    display: flex; align-items: flex-end; gap: 4px; height: 100px; padding: 4px 0;
}
.usage-bar-col {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    min-width: 0;
}
.usage-bar-val { font-size: 10px; color: var(--text-dim); }
.usage-bar-fill-v {
    width: 100%; max-width: 32px; min-height: 2px;
    background: linear-gradient(180deg, var(--accent), var(--accent-hover));
    border-radius: var(--radius-xs) 3px 0 0;
    transition: height var(--duration-normal) var(--ease-out);
}
.usage-bar-label { font-size: 9px; color: var(--text-dim); white-space: nowrap; }

/* ===== Bulk Delete ===== */
.bulk-bar {
    display: flex; align-items: center; padding: 4px 12px; gap: 6px;
}
.bulk-delete-btn {
    display: flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: var(--radius);
    border: 1px solid color-mix(in srgb, var(--red) 30%, transparent);
    background: color-mix(in srgb, var(--red) 8%, transparent);
    color: var(--red); font-size: 11px; cursor: pointer;
    transition: background var(--duration-fast) ease-out;
}
.bulk-delete-btn:hover { background: color-mix(in srgb, var(--red) 16%, transparent); }
.conv-check {
    width: 14px; height: 14px; flex-shrink: 0; accent-color: var(--accent);
    cursor: pointer; opacity: 0; transition: opacity var(--duration-fast) ease-out;
}
.conv-item:hover .conv-check, .conv-check:checked { opacity: 1; }

/* ===== Config Mode Toggle ===== */
.config-mode-toggle {
    display: flex; gap: 0; margin-bottom: 14px;
    border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
    width: fit-content;
}
.config-mode-btn {
    padding: 6px 16px; border: none; background: transparent;
    color: var(--text-muted); font-size: 12px; cursor: pointer;
    transition: all var(--duration-fast) ease-out;
}
.config-mode-btn.active {
    background: var(--accent-soft); color: var(--accent-text);
}
.config-mode-btn:hover:not(.active) { background: var(--bg-hover); }
.config-raw-textarea {
    width: 100%; padding: 12px; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--bg-input);
    color: var(--text); font-family: var(--font-mono); font-size: 12px;
    line-height: 1.5; resize: vertical; outline: none;
}
.config-raw-textarea:focus { border-color: var(--accent-soft); }

/* ===== Message Timestamps ===== */
.msg-time { font-size: 10px; color: var(--text-dim); margin-left: auto; }

/* ===== Thinking Block (OpenClaw-style dashed border) ===== */
.thinking-block {
    border: 1px dashed color-mix(in srgb, var(--accent) 30%, var(--border)) !important;
    background: color-mix(in srgb, var(--accent) 4%, transparent) !important;
}
.thinking-text {
    font-size: 12px; color: var(--text-dim); margin-top: 4px;
    font-style: italic; line-height: 1.5;
}

/* ===== Animated Gradient Border on Compose ===== */
@keyframes gradient-rotate {
    0% { --gradient-angle: 0deg; }
    100% { --gradient-angle: 360deg; }
}
@property --gradient-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}
/* Phase 7: animated conic-gradient on focus removed — focus state uses solid accent border + ring (see #input-wrapper:focus-within). */
#input-wrapper { position: relative; z-index: 0; }

/* ===== Session Day Group Headers ===== */
.conv-day-header {
    padding: 6px 12px 4px; font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--text-dim);
}

/* ===== Accessibility: prefers-reduced-motion ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   Model Picker (Stage 1) — unified searchable selector
   ============================================================ */

.model-picker { position: relative; display: inline-block; }

.model-picker-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px) saturate(1.6);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 5px 10px 5px 8px;
    font-size: 12px;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--duration-normal) ease-out;
    box-shadow: var(--highlight-inset);
    max-width: 280px;
}
.model-picker-trigger:hover { border-color: var(--border-light); }
.model-picker-trigger:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--highlight-inset), 0 0 0 3px var(--accent-soft);
}
.mp-icon { font-size: 13px; line-height: 1; flex-shrink: 0; }
.mp-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
    color: var(--text);
}
.mp-chevron { color: var(--text-muted); flex-shrink: 0; }

.model-picker-popover {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 360px;
    max-width: 420px;
    max-height: 480px;
    background: var(--bg-card, #181822);
    border: 1px solid var(--border-light, rgba(255,255,255,0.12));
    border-radius: var(--radius-lg, 10px);
    box-shadow: 0 16px 48px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04);
    backdrop-filter: blur(16px) saturate(1.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
    animation: mp-pop 120ms ease-out;
}
.model-picker-popover.hidden { display: none; }

@keyframes mp-pop {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.mp-search-wrap {
    position: relative;
    padding: 10px 10px 8px;
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
    flex-shrink: 0;
}
.mp-search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}
#model-picker-search {
    width: 100%;
    background: var(--bg, #0c0c14);
    border: 1px solid var(--border, rgba(255,255,255,0.08));
    border-radius: 8px;
    color: var(--text);
    font-size: 13px;
    padding: 7px 10px 7px 30px;
    outline: none;
    transition: border-color var(--duration-fast) ease-out;
}
#model-picker-search:focus { border-color: var(--accent, #7c5cff); }

.mp-list {
    overflow-y: auto;
    padding: 4px 0 8px;
    flex: 1;
}
.mp-list::-webkit-scrollbar { width: 8px; }
.mp-list::-webkit-scrollbar-thumb { background: var(--border-light, rgba(255,255,255,0.08)); border-radius: 4px; }

.mp-group { padding: 4px 0; }
.mp-group-header {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 8px 14px 4px;
}

.mp-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    background: transparent;
    border: none;
    text-align: left;
    padding: 7px 14px;
    cursor: pointer;
    color: var(--text);
    font: inherit;
    transition: background var(--duration-fast) ease-out;
}
.mp-item:hover { background: var(--bg-hover, rgba(255,255,255,0.04)); }
.mp-item.selected {
    background: color-mix(in srgb, var(--accent, #7c5cff) 12%, transparent);
    box-shadow: inset 2px 0 0 var(--accent, #7c5cff);
}
.mp-item.selected .mp-item-label { color: var(--accent, #7c5cff); }

.mp-item-label {
    font-size: 13px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mp-item-desc {
    font-size: 11px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mp-badge {
    display: inline-block;
    font-size: 10px;
    background: var(--accent-soft, rgba(124, 92, 255, 0.18));
    color: var(--accent, #7c5cff);
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 4px;
    vertical-align: 1px;
}

.mp-empty {
    padding: 24px 14px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* ============================================================
   Compose Mode Toggle (Stage 2) — pills above the input
   ============================================================ */

.compose-mode-toggle {
    display: flex;
    gap: 4px;
    padding: 4px 8px 0;
    align-items: center;
}

.compose-mode-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid var(--border, rgba(255,255,255,0.08));
    border-radius: var(--radius-xl, 999px);
    color: var(--text-muted);
    font: inherit;
    font-size: 12px;
    padding: 4px 12px 4px 10px;
    cursor: pointer;
    transition: all var(--duration-fast, 120ms) ease-out;
    line-height: 1.4;
}
.compose-mode-pill:hover {
    border-color: var(--border-light);
    color: var(--text);
    background: var(--bg-hover, rgba(255,255,255,0.04));
}
.compose-mode-pill.active {
    background: color-mix(in srgb, var(--accent, #7c5cff) 14%, transparent);
    border-color: color-mix(in srgb, var(--accent, #7c5cff) 50%, transparent);
    color: var(--accent, #7c5cff);
    font-weight: 500;
}
.compose-mode-pill.active .cmp-hint { color: color-mix(in srgb, var(--accent, #7c5cff) 70%, transparent); }

.cmp-icon { font-size: 13px; line-height: 1; }
.cmp-label { font-weight: 500; }
.cmp-hint {
    font-size: 10.5px;
    opacity: 0.85;
    color: var(--text-muted);
    border-left: 1px solid currentColor;
    padding-left: 6px;
    margin-left: 2px;
    line-height: 1;
    border-color: color-mix(in srgb, currentColor 25%, transparent);
}

/* Когда council или orchestrator активны — focus-mode select прячется (focus_mode forced). */
body.compose-mode-council #focus-mode-select,
body.compose-mode-orchestrator #focus-mode-select { display: none; }

/* Подсветка input bar в специальных режимах */
body.compose-mode-council #input-wrapper,
body.compose-mode-orchestrator #input-wrapper {
    border-color: color-mix(in srgb, var(--accent, #7c5cff) 35%, var(--border));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent, #7c5cff) 15%, transparent);
}

/* ============================================================
   Integrations tab (Stage 3) — CLI / MCP / API discovery
   ============================================================ */

.int-hero {
    margin-bottom: 24px;
    padding: 20px 24px;
    background: var(--accent-soft);
    border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
    border-radius: var(--radius-lg);
}
.int-hero h2 {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.022em;
}
.int-hero p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.int-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.int-card {
    background: var(--bg-card, #181822);
    border: 1px solid var(--border, rgba(255,255,255,0.08));
    border-radius: var(--radius-lg, 10px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.int-card-wide { grid-column: 1 / -1; }

.int-card-header {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 16px 18px 12px;
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.06));
}
.int-card-icon {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 2px;
}
.int-card-header h3 {
    margin: 0 0 2px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}
.int-card-header p {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
}

.int-card-body {
    padding: 14px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.int-field { display: flex; flex-direction: column; gap: 4px; }
.int-field label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 600;
}

.int-code-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg, #0c0c14);
    border: 1px solid var(--border, rgba(255,255,255,0.06));
    border-radius: 6px;
    padding: 6px 8px 6px 10px;
}
.int-code-row code {
    flex: 1;
    background: transparent;
    color: var(--text);
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 12px;
    overflow-x: auto;
    white-space: nowrap;
}

.int-code-block {
    position: relative;
    background: var(--bg, #0c0c14);
    border: 1px solid var(--border, rgba(255,255,255,0.06));
    border-radius: 6px;
    overflow: hidden;
}
.int-code-block pre {
    margin: 0;
    padding: 12px 14px;
    overflow-x: auto;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text);
    white-space: pre;
}
.int-code-block .int-copy-btn { position: absolute; top: 6px; right: 6px; }

.int-copy-btn {
    background: var(--bg-hover, rgba(255,255,255,0.06));
    border: 1px solid var(--border, rgba(255,255,255,0.06));
    border-radius: 5px;
    color: var(--text-muted);
    padding: 4px 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all var(--duration-fast, 120ms) ease-out;
    line-height: 1;
}
.int-copy-btn:hover {
    color: var(--accent, #7c5cff);
    border-color: color-mix(in srgb, var(--accent, #7c5cff) 40%, transparent);
}
.int-copy-btn.copied {
    color: #4ade80;
    border-color: rgba(74, 222, 128, 0.4);
}

.int-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: color-mix(in srgb, var(--accent, #7c5cff) 18%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent, #7c5cff) 50%, transparent);
    color: var(--accent, #7c5cff);
    border-radius: var(--radius-xl, 999px);
    padding: 7px 14px 7px 12px;
    font: inherit;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration-fast, 120ms) ease-out;
    align-self: flex-start;
}
.int-action-btn:hover {
    background: color-mix(in srgb, var(--accent, #7c5cff) 28%, transparent);
}

.int-key-zone {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}
.int-key-result {
    background: var(--bg, #0c0c14);
    border: 1px solid color-mix(in srgb, #4ade80 35%, var(--border));
    border-radius: 6px;
    padding: 10px 12px;
}
.int-key-result .int-code-row { background: transparent; border: none; padding: 0; }
.int-key-warning {
    font-size: 11px;
    color: #fbbf24;
    margin-top: 6px;
    line-height: 1.4;
}

.int-help { margin: 0; color: var(--text-secondary); font-size: 12.5px; line-height: 1.5; }
.int-help code { background: var(--bg-hover, rgba(255,255,255,0.06)); padding: 1px 5px; border-radius: 3px; font-size: 11.5px; }
.int-help-small { margin: 0; color: var(--text-muted); font-size: 11.5px; line-height: 1.5; }
.int-help-small a { color: var(--accent, #7c5cff); text-decoration: none; }
.int-help-small a:hover { text-decoration: underline; }

.int-details {
    border-top: 1px solid var(--border, rgba(255,255,255,0.06));
    padding-top: 10px;
}
.int-details summary {
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
    list-style: none;
    user-select: none;
}
.int-details summary::-webkit-details-marker { display: none; }
.int-details summary::before { content: '▸ '; transition: transform var(--duration-fast) ease-out; display: inline-block; }
.int-details[open] summary::before { content: '▾ '; }
.int-feature-list {
    margin: 8px 0 0;
    padding-left: 20px;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.7;
}
.int-feature-list code { font-size: 11.5px; }

.int-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.06));
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.int-tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 12.5px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all var(--duration-fast, 120ms) ease-out;
    margin-bottom: -1px;
}
.int-tab:hover { color: var(--text); }
.int-tab.active {
    color: var(--accent, #7c5cff);
    border-bottom-color: var(--accent, #7c5cff);
}
.int-tab-panel { display: flex; flex-direction: column; gap: 10px; }

@media (max-width: 880px) {
    .int-grid { grid-template-columns: 1fr; }
    .int-card-wide { grid-column: 1; }
}

/* PLGames CLI featured card */
.int-cli-installs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 12px;
}
.int-install-block {
    background: var(--bg, #0c0c14);
    border: 1px solid var(--border, rgba(255,255,255,.08));
    border-radius: 8px;
    padding: 12px 14px;
}
.int-install-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.int-install-label svg { color: var(--accent, #7c5cff); }
.int-install-block .int-code-row {
    background: transparent;
    border: 1px solid var(--border, rgba(255,255,255,.08));
    padding: 8px 10px;
}
.int-install-block .int-code-row code {
    font-size: 12px;
    color: var(--text);
}
.int-steps-inline {
    margin: 6px 0 8px 20px;
    padding: 0;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.7;
}
.int-steps-inline li { margin-bottom: 2px; }
.int-steps-inline code {
    background: var(--bg, #0c0c14);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 12px;
    border: 1px solid var(--border, rgba(255,255,255,.08));
}

/* Stage 3 v2 — пошаговые рецепты для CLI */

.int-cli-about {
    margin: 0 0 14px;
    padding: 10px 14px;
    background: var(--bg, #0c0c14);
    border-left: 3px solid var(--accent, #7c5cff);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 12.5px;
    line-height: 1.5;
}

.int-steps {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.int-step {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 10px;
    align-items: start;
}

.int-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--accent, #7c5cff) 18%, transparent);
    color: var(--accent, #7c5cff);
    font-size: 12px;
    font-weight: 600;
    margin-top: 2px;
    flex-shrink: 0;
}

.int-step-body { min-width: 0; }
.int-step-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 4px;
}
.int-step-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0 0 8px;
    line-height: 1.5;
}
.int-step-desc a {
    color: var(--accent, #7c5cff);
    text-decoration: none;
}
.int-step-desc a:hover { text-decoration: underline; }
.int-step-desc code {
    background: var(--bg-hover, rgba(255,255,255,0.06));
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 11.5px;
}

.int-step .int-code-block { margin-top: 4px; }

/* ============================================================
 * Stage 6 — Failover chain badge
 * Surfaces FailoverProvider.fallback_chain below an assistant
 * message when the request was rebalanced across providers.
 * ============================================================ */
.msg-failover-chain {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0 6px;
    padding: 4px 10px;
    background: color-mix(in srgb, var(--accent-soft) 80%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
    border-radius: var(--radius-full);
    font-size: 11.5px;
    color: var(--text-secondary);
    line-height: 1.4;
    backdrop-filter: blur(8px);
    cursor: help;
    transition: background var(--duration-fast) ease-out, border-color var(--duration-fast) ease-out;
    max-width: 100%;
    width: fit-content;
}
.msg-failover-chain:hover {
    background: color-mix(in srgb, var(--accent-soft) 100%, transparent);
    border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}
.msg-failover-chain .fc-icon {
    color: var(--accent-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.msg-failover-chain .fc-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-failover-chain strong { color: var(--accent-text); font-weight: 600; }
.msg-failover-chain .fc-class {
    color: var(--text-muted);
    font-size: 11px;
    margin-left: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ============================================================
 * Stage 4 — Orchestrator tree-view
 * Renders the live DAG of plan steps inside the assistant bubble.
 * ============================================================ */
.orch-tree {
    margin: 4px 0 8px;
    background: color-mix(in srgb, var(--bg-card) 80%, transparent);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    backdrop-filter: blur(12px);
}
.orch-tree-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: color-mix(in srgb, var(--accent-soft) 35%, transparent);
    border-bottom: 1px solid var(--border);
}
.orch-tree-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--accent) 18%, transparent);
    color: var(--accent-text);
    font-size: 18px;
    flex-shrink: 0;
}
.orch-tree-title-wrap { flex: 1; min-width: 0; }
.orch-tree-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.35;
}
.orch-tree-sub {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 2px;
}
.orch-tree-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
    transition: all var(--duration-normal) ease-out;
}
.orch-tree-status.running {
    background: color-mix(in srgb, var(--accent) 18%, transparent);
    color: var(--accent-text);
}
.orch-tree-status.done {
    background: color-mix(in srgb, #10b981 22%, transparent);
    color: #34d399;
}
.orch-tree-status.error {
    background: color-mix(in srgb, #ef4444 22%, transparent);
    color: #f87171;
}
.orch-tree-status .step-spinner {
    width: 14px;
    height: 14px;
    border-width: 2px;
}

.orch-tree-body {
    padding: 6px 0 4px;
    display: flex;
    flex-direction: column;
}

.orch-step {
    display: grid;
    grid-template-columns: 36px 1fr;
    gap: 10px;
    padding: 6px 14px;
    transition: background var(--duration-fast) ease-out;
}
.orch-step:hover { background: color-mix(in srgb, var(--accent-soft) 30%, transparent); }
.orch-step:last-child .orch-step-line { display: none; }

.orch-step-rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 4px;
}
.orch-step-num {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11.5px;
    font-weight: 600;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    color: var(--text-muted);
    flex-shrink: 0;
    transition: all var(--duration-normal) ease-out;
    z-index: 1;
}
.orch-step-line {
    width: 1.5px;
    flex: 1;
    background: var(--border);
    margin-top: 2px;
    min-height: 14px;
}

.orch-step-card {
    min-width: 0;
    padding: 6px 0;
}
.orch-step-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 11.5px;
}
.orch-step-kind {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    background: color-mix(in srgb, var(--bg-hover) 70%, transparent);
    border: 1px solid var(--border);
}
.orch-step-kind-icon { font-size: 12px; }

.orch-step.kind-chat .orch-step-kind { color: var(--accent-bright); border-color: color-mix(in srgb, var(--accent) 30%, transparent); background: var(--accent-soft); }
.orch-step.kind-council .orch-step-kind { color: #fb923c; border-color: rgba(251, 146, 60, 0.3); background: rgba(251, 146, 60, 0.1); }
.orch-step.kind-tool .orch-step-kind { color: #34d399; border-color: rgba(52, 211, 153, 0.3); background: rgba(52, 211, 153, 0.1); }
.orch-step.kind-synth .orch-step-kind { color: #60a5fa; border-color: rgba(96, 165, 250, 0.3); background: rgba(96, 165, 250, 0.1); }

.orch-step-id {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 10.5px;
    color: var(--text-muted);
    background: color-mix(in srgb, var(--bg-hover) 60%, transparent);
    padding: 1px 6px;
    border-radius: var(--radius-xs);
}
.orch-step-deps {
    font-size: 10.5px;
    color: var(--text-muted);
    cursor: help;
}
.orch-step-status {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.orch-step-status .step-spinner {
    width: 12px;
    height: 12px;
    border-width: 2px;
}
.orch-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: var(--radius-full);
    background: color-mix(in srgb, #10b981 22%, transparent);
    color: #34d399;
}
.orch-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: var(--radius-full);
    background: color-mix(in srgb, #ef4444 22%, transparent);
    color: #f87171;
    font-weight: 600;
    font-size: 12px;
}
.orch-dur {
    font-size: 10.5px;
    color: var(--text-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.orch-step-desc {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.4;
    margin-top: 4px;
}
.orch-step-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 3px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.orch-step.running .orch-step-num {
    background: color-mix(in srgb, var(--accent) 22%, transparent);
    border-color: var(--accent);
    color: var(--accent-text);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent);
}
.orch-step.done .orch-step-num {
    background: color-mix(in srgb, #10b981 22%, transparent);
    border-color: #10b981;
    color: #34d399;
}
.orch-step.error .orch-step-num {
    background: color-mix(in srgb, #ef4444 22%, transparent);
    border-color: #ef4444;
    color: #f87171;
}
.orch-step.pending .orch-step-card { opacity: 0.65; }
.orch-step.running .orch-step-card { opacity: 1; }

.orch-step-output {
    margin-top: 8px;
}
.orch-output-details {
    background: color-mix(in srgb, var(--bg-hover) 50%, transparent);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.orch-output-details summary {
    padding: 6px 10px;
    font-size: 11.5px;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    transition: color var(--duration-fast) ease-out;
}
.orch-output-details summary:hover { color: var(--text-secondary); }
.orch-output-details[open] summary {
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}
.orch-output-body {
    margin: 0;
    padding: 10px 12px;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--bg-card);
    max-height: 240px;
    overflow-y: auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    line-height: 1.5;
}
.orch-error-msg {
    padding: 8px 10px;
    background: color-mix(in srgb, #ef4444 12%, transparent);
    border: 1px solid color-mix(in srgb, #ef4444 30%, transparent);
    border-radius: var(--radius-sm);
    color: #fca5a5;
    font-size: 12px;
    line-height: 1.4;
}

.orch-final {
    margin: 12px 14px 14px;
    padding: 12px 14px;
    background: color-mix(in srgb, #10b981 8%, var(--bg-card));
    border: 1px solid color-mix(in srgb, #10b981 28%, transparent);
    border-radius: var(--radius);
}
.orch-final-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #34d399;
    font-size: 12.5px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.orch-final-icon {
    width: 22px;
    height: 22px;
    border-radius: var(--radius-full);
    background: color-mix(in srgb, #10b981 22%, transparent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.orch-final-body {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.55;
}
.orch-final-body p:first-child { margin-top: 0; }
.orch-final-body p:last-child { margin-bottom: 0; }

/* ============================================================
 * Stage 5 — Council findings panel
 * Renders /api/v1/council/review structured result.
 * ============================================================ */
.council-progress {
    margin: 4px 0 8px;
    padding: 14px 16px;
    background: color-mix(in srgb, var(--bg-card) 80%, transparent);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(12px);
}
.council-progress-head {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 13px;
}
.council-progress-roles {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0 6px;
}
.cp-role {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    background: color-mix(in srgb, var(--bg-hover) 70%, transparent);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 11px;
    color: var(--text-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.cp-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    animation: cp-pulse 1.4s ease-in-out infinite;
}
.cp-role:nth-child(2) .cp-dot { animation-delay: 0.2s; }
.cp-role:nth-child(3) .cp-dot { animation-delay: 0.4s; }
.cp-role:nth-child(4) .cp-dot { animation-delay: 0.6s; }
.cp-role:nth-child(5) .cp-dot { animation-delay: 0.8s; }
@keyframes cp-pulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.3); }
}
.council-progress-hint {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 6px;
}

.council-panel {
    margin: 4px 0 8px;
    background: color-mix(in srgb, var(--bg-card) 85%, transparent);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    backdrop-filter: blur(12px);
}
.council-panel-header {
    padding: 12px 14px;
    background: color-mix(in srgb, var(--accent-soft) 35%, transparent);
    border-bottom: 1px solid var(--border);
}
.cp-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.cp-title-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, #fb923c 18%, transparent);
    color: #fb923c;
    font-size: 18px;
    flex-shrink: 0;
}
.cp-title-main { flex: 1; min-width: 0; }
.cp-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.35;
}
.cp-sub {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 2px;
}
.cp-totals {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}
.cp-stat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    border: 1px solid transparent;
}
.cp-stat-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.cp-roles-row {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: var(--bg-card);
}
.cp-role-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: color-mix(in srgb, var(--bg-hover) 70%, transparent);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 11px;
    color: var(--text-muted);
    cursor: help;
    transition: all var(--duration-fast) ease-out;
}
.cp-role-chip:hover { border-color: var(--border-light); color: var(--text-secondary); }
.cp-role-chip .cp-role-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #34d399;
}
.cp-role-chip.err .cp-role-dot { background: #f87171; }
.cp-role-chip.err { opacity: 0.7; }
.cp-role-name { font-weight: 600; color: var(--text-secondary); }
.cp-role-model { color: var(--text-muted); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.cp-role-count {
    background: color-mix(in srgb, var(--accent) 18%, transparent);
    color: var(--accent-text);
    padding: 0 6px;
    border-radius: var(--radius-full);
    font-weight: 600;
    min-width: 18px;
    text-align: center;
}

.cp-filter-row {
    padding: 10px 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg-card) 70%, transparent);
}
.cp-filter {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 4px 12px;
    font-size: 11.5px;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-family: inherit;
    transition: all var(--duration-fast) ease-out;
}
.cp-filter:hover {
    border-color: var(--border-light);
    color: var(--text-secondary);
    background: var(--bg-hover);
}
.cp-filter.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    font-weight: 600;
}

.cp-findings {
    padding: 8px 0;
    max-height: 600px;
    overflow-y: auto;
}
.cp-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12.5px;
}

.cp-file-group { padding: 0 14px 8px; }
.cp-file-group + .cp-file-group { border-top: 1px solid var(--border); padding-top: 10px; }
.cp-file-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0 6px;
    font-size: 12px;
    color: var(--text-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    position: sticky;
    top: 0;
    background: color-mix(in srgb, var(--bg-card) 92%, transparent);
    backdrop-filter: blur(8px);
    z-index: 1;
}
.cp-file-name { color: var(--text-secondary); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-file-count {
    background: var(--bg-hover);
    padding: 1px 7px;
    border-radius: var(--radius-full);
    font-size: 10.5px;
    color: var(--text-muted);
}

.cp-finding {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-bottom: 8px;
    background: var(--bg-card);
    border-left-width: 3px;
    transition: border-color var(--duration-fast) ease-out, background var(--duration-fast) ease-out;
}
.cp-finding:hover { background: color-mix(in srgb, var(--bg-hover) 50%, var(--bg-card)); }
.cp-finding.sev-critical { border-left-color: #dc2626; }
.cp-finding.sev-high     { border-left-color: #ea580c; }
.cp-finding.sev-medium   { border-left-color: #ca8a04; }
.cp-finding.sev-low      { border-left-color: #2563eb; }
.cp-finding.sev-info     { border-left-color: #6b7280; }

.cp-finding-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.cp-sev-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-xs);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}
.cp-sev-pill.sev-critical { background: rgba(220, 38, 38, 0.18); color: #fca5a5; }
.cp-sev-pill.sev-high     { background: rgba(234, 88, 12, 0.18); color: #fdba74; }
.cp-sev-pill.sev-medium   { background: rgba(202, 138, 4, 0.22); color: #fde047; }
.cp-sev-pill.sev-low      { background: rgba(37, 99, 235, 0.18); color: #93c5fd; }
.cp-sev-pill.sev-info     { background: rgba(107, 114, 128, 0.18); color: #d1d5db; }

.cp-stat.sev-critical { background: rgba(220, 38, 38, 0.14); color: #fca5a5; border-color: rgba(220, 38, 38, 0.3); }
.cp-stat.sev-high     { background: rgba(234, 88, 12, 0.14); color: #fdba74; border-color: rgba(234, 88, 12, 0.3); }
.cp-stat.sev-medium   { background: rgba(202, 138, 4, 0.16); color: #fde047; border-color: rgba(202, 138, 4, 0.3); }
.cp-stat.sev-low      { background: rgba(37, 99, 235, 0.14); color: #93c5fd; border-color: rgba(37, 99, 235, 0.3); }
.cp-stat.sev-info     { background: rgba(107, 114, 128, 0.14); color: #d1d5db; border-color: rgba(107, 114, 128, 0.3); }

.cp-finding-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    flex: 1;
    min-width: 0;
    line-height: 1.3;
}
.cp-finding-loc {
    font-size: 10.5px;
    color: var(--text-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.cp-finding-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}
.cp-finding-cat,
.cp-finding-role,
.cp-finding-model {
    font-size: 10.5px;
    padding: 1px 7px;
    border-radius: var(--radius-xs);
    background: color-mix(in srgb, var(--bg-hover) 70%, transparent);
    color: var(--text-muted);
}
.cp-finding-cat { color: var(--accent-text); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.cp-finding-model { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.cp-finding-rationale,
.cp-finding-fix {
    margin-top: 6px;
}
.cp-finding-rationale summary,
.cp-finding-fix summary {
    cursor: pointer;
    font-size: 11.5px;
    color: var(--text-muted);
    user-select: none;
    padding: 2px 0;
    transition: color var(--duration-fast) ease-out;
}
.cp-finding-rationale summary:hover,
.cp-finding-fix summary:hover { color: var(--text-secondary); }
.cp-finding-rat-body,
.cp-finding-fix-body {
    margin-top: 4px;
    padding: 8px 10px;
    background: color-mix(in srgb, var(--bg-hover) 50%, transparent);
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.cp-finding-rat-body p,
.cp-finding-fix-body p { margin: 0 0 6px; }
.cp-finding-rat-body p:last-child,
.cp-finding-fix-body p:last-child { margin-bottom: 0; }

.cp-synthesis {
    border-top: 1px solid var(--border);
    background: color-mix(in srgb, var(--accent-soft) 25%, transparent);
}
.cp-synthesis-details summary {
    padding: 12px 14px;
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
}
.cp-synthesis-details summary::-webkit-details-marker { display: none; }
.cp-synthesis-details[open] summary { border-bottom: 1px solid var(--border); }
.cp-synth-icon { font-size: 16px; }
.cp-synthesis-body {
    padding: 12px 14px 14px;
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.6;
}
.cp-synthesis-body p:first-child { margin-top: 0; }
.cp-synthesis-body p:last-child { margin-bottom: 0; }
.cp-synthesis-body code {
    background: var(--bg-hover);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 12px;
}

@media (max-width: 640px) {
    .orch-step { grid-template-columns: 30px 1fr; padding: 6px 10px; }
    .orch-step-num { width: 22px; height: 22px; }
    .cp-roles-row { padding: 8px 10px; }
    .cp-filter-row { padding: 8px 10px; }
    .cp-file-group { padding: 0 10px 8px; }
}

/* Light-theme overrides for severity pills — the dark-theme fg colors are
 * too pale on a white background. */
[data-theme="light"] .cp-sev-pill.sev-critical { background: rgba(220, 38, 38, 0.14); color: #b91c1c; }
[data-theme="light"] .cp-sev-pill.sev-high     { background: rgba(234, 88, 12, 0.14); color: #c2410c; }
[data-theme="light"] .cp-sev-pill.sev-medium   { background: rgba(202, 138, 4, 0.18); color: #a16207; }
[data-theme="light"] .cp-sev-pill.sev-low      { background: rgba(37, 99, 235, 0.14); color: #1d4ed8; }
[data-theme="light"] .cp-sev-pill.sev-info     { background: rgba(107, 114, 128, 0.14); color: #4b5563; }
[data-theme="light"] .cp-stat.sev-critical { color: #b91c1c; }
[data-theme="light"] .cp-stat.sev-high     { color: #c2410c; }
[data-theme="light"] .cp-stat.sev-medium   { color: #a16207; }
[data-theme="light"] .cp-stat.sev-low      { color: #1d4ed8; }
[data-theme="light"] .cp-stat.sev-info     { color: #4b5563; }
[data-theme="light"] .orch-step.kind-chat .orch-step-kind { color: var(--accent-text); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 22%, transparent); }
[data-theme="light"] .orch-step.kind-council .orch-step-kind { color: #c2410c; background: rgba(234, 88, 12, 0.08); border-color: rgba(234, 88, 12, 0.2); }
[data-theme="light"] .orch-step.kind-tool .orch-step-kind { color: #047857; background: rgba(16, 185, 129, 0.08); border-color: rgba(16, 185, 129, 0.2); }
[data-theme="light"] .orch-step.kind-synth .orch-step-kind { color: #1d4ed8; background: rgba(37, 99, 235, 0.08); border-color: rgba(37, 99, 235, 0.2); }
[data-theme="light"] .orch-tree-status.done { color: #047857; }
[data-theme="light"] .orch-tree-status.error { color: #b91c1c; }
[data-theme="light"] .orch-check { color: #047857; }
[data-theme="light"] .orch-x { color: #b91c1c; }
[data-theme="light"] .orch-step.done .orch-step-num { color: #047857; }
[data-theme="light"] .orch-step.error .orch-step-num { color: #b91c1c; }
[data-theme="light"] .orch-final-header { color: #047857; }
[data-theme="light"] .orch-final { background: color-mix(in srgb, #10b981 6%, var(--bg-card)); }
[data-theme="light"] .orch-error-msg { color: #b91c1c; background: rgba(239, 68, 68, 0.06); border-color: rgba(239, 68, 68, 0.25); }
[data-theme="light"] .cp-role-chip .cp-role-dot { background: #047857; }
[data-theme="light"] .cp-role-chip.err .cp-role-dot { background: #b91c1c; }
[data-theme="light"] .msg-failover-chain { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 28%, transparent); }
