/* ────────────────────────────────────────────────────────────────────────────
   Orbis — CSS Design System with Light/Dark Theme Support
   ──────────────────────────────────────────────────────────────────────────── */

/* ── CSS Custom Properties (Dark Theme — default) ───────────────────────── */

:root,
[data-theme="dark"] {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #242424;
    --bg-hover: #2a2a2a;
    --bg-active: #333333;
    --bg-input: #1e1e1e;
    --bg-modal: #1a1a1a;
    --bg-card: #1e1e1e;
    --bg-code: #161616;
    --bg-msg-user: #2563eb;
    --bg-msg-assistant: #242424;
    --bg-welcome-card: #1e1e1e;

    --text-primary: #f0f0f0;
    --text-secondary: #a0a0a0;
    --text-tertiary: #707070;
    --text-inverse: #ffffff;
    --text-link: #60a5fa;
    --text-code: #e2e8f0;

    --border-primary: #2a2a2a;
    --border-secondary: #333333;
    --border-input: #3a3a3a;
    --border-focus: #2563eb;

    --accent: #2563eb;
    --accent-hover: #3b82f6;
    --accent-soft: rgba(37, 99, 235, 0.15);

    --status-green: #22c55e;
    --status-yellow: #eab308;
    --status-red: #ef4444;
    --status-blue: #3b82f6;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --sidebar-width: 280px;
    --header-height: 52px;

    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    --font-mono: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', Consolas, monospace;

    --transition: 0.2s ease;
}

/* ── Light Theme ────────────────────────────────────────────────────────── */

[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f0f1f3;
    --bg-hover: #e8eaed;
    --bg-active: #dcdfe3;
    --bg-input: #ffffff;
    --bg-modal: #ffffff;
    --bg-card: #ffffff;
    --bg-code: #f5f5f5;
    --bg-msg-user: #2563eb;
    --bg-msg-assistant: #f0f1f3;
    --bg-welcome-card: #f8f9fa;

    --text-primary: #1a1a1a;
    --text-secondary: #5f6368;
    --text-tertiary: #9aa0a6;
    --text-inverse: #ffffff;
    --text-link: #1a73e8;
    --text-code: #1f2937;

    --border-primary: #e0e0e0;
    --border-secondary: #d0d0d0;
    --border-input: #dadce0;
    --border-focus: #1a73e8;

    --accent: #1a73e8;
    --accent-hover: #1967d2;
    --accent-soft: rgba(26, 115, 232, 0.1);

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

/* ── Reset & Base ───────────────────────────────────────────────────────── */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-primary);
    transition: background var(--transition), color var(--transition);
    overflow: hidden;
}

body {
    display: flex;
}

a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--bg-code);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    color: var(--text-code);
}

pre {
    background: var(--bg-code);
    border-radius: var(--radius-md);
    padding: 16px;
    overflow-x: auto;
    margin: 8px 0;
    border: 1px solid var(--border-primary);
}

pre code {
    background: transparent;
    padding: 0;
    font-size: 13px;
    line-height: 1.5;
}

kbd {
    display: inline-block;
    padding: 2px 6px;
    font-family: var(--font-mono);
    font-size: 11px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-secondary);
    border-radius: 4px;
    box-shadow: 0 1px 0 var(--border-secondary);
}

/* ── Sidebar ────────────────────────────────────────────────────────────── */

.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-primary);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: background var(--transition), border-color var(--transition);
    z-index: 100;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border-primary);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon { font-size: 24px; }
.logo-text { font-size: 18px; font-weight: 700; letter-spacing: -0.5px; }

.sidebar-section {
    padding: 12px;
}

.sidebar-section-grow {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
    margin-bottom: 8px;
    padding: 0 4px;
}

.quick-action {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    text-align: left;
    transition: all var(--transition);
}

.quick-action:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.qa-icon { font-size: 16px; width: 22px; text-align: center; }

.history-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.history-item.active {
    background: var(--bg-active);
    color: var(--text-primary);
}

.sidebar-footer {
    padding: 8px 12px;
    border-top: 1px solid var(--border-primary);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-footer-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition);
}

.sidebar-footer-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 200;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    padding: 8px;
    color: var(--text-primary);
    cursor: pointer;
}

/* ── Main Content ───────────────────────────────────────────────────────── */

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-width: 0;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
    height: var(--header-height);
    border-bottom: 1px solid var(--border-primary);
    background: var(--bg-primary);
    transition: background var(--transition), border-color var(--transition);
    flex-shrink: 0;
}

.active-agents {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.agents-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.agent-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    background: var(--bg-hover);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    border: 1px solid var(--border-primary);
}

.agent-badge.small {
    padding: 1px 6px;
    font-size: 11px;
}

.message-agents {
    display: inline-flex;
    gap: 4px;
    flex-wrap: wrap;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-tertiary);
}

/* ── User Profile ───────────────────────────────────────────────────────── */

.user-profile-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.user-profile-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1px solid var(--border-primary);
    border-radius: 20px;
    padding: 3px 10px 3px 3px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.8rem;
    transition: all 0.2s;
}

.user-profile-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
}

.user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
}

.user-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-badge {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 8px;
    background: var(--accent-primary);
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 240px;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 200;
    overflow: hidden;
}

.user-dropdown-info {
    padding: 14px 16px;
}

.user-dropdown-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.user-dropdown-email {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.user-dropdown-role {
    font-size: 0.7rem;
    color: var(--accent-primary);
    margin-top: 4px;
    font-weight: 600;
}

.user-dropdown-divider {
    height: 1px;
    background: var(--border-primary);
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.15s;
}

.user-dropdown-item:hover {
    background: var(--bg-secondary);
    color: var(--status-red);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--status-yellow);
    transition: background var(--transition);
}

.status-dot.connected { background: var(--status-green); }
.status-dot.disconnected { background: var(--status-red); }
.status-dot.connecting { background: var(--status-yellow); animation: pulse 1.5s infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ── Chat Messages ──────────────────────────────────────────────────────── */

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
    scroll-behavior: smooth;
}

.welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 20px;
    gap: 12px;
}

.welcome-icon { font-size: 64px; margin-bottom: 8px; }
.welcome h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; }
.welcome p { color: var(--text-secondary); font-size: 16px; max-width: 400px; }

.welcome-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 24px;
    max-width: 560px;
    width: 100%;
}

.welcome-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: var(--bg-welcome-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    transition: all var(--transition);
    text-align: left;
}

.welcome-card:hover {
    background: var(--bg-hover);
    border-color: var(--border-secondary);
    color: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.wc-icon { font-size: 20px; flex-shrink: 0; }

/* Message bubbles */

.message {
    display: flex;
    gap: 12px;
    padding: 12px 20px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 2px;
}

.message.user .message-avatar {
    background: var(--accent);
    color: white;
}

.message.assistant .message-avatar {
    background: var(--bg-tertiary);
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.message-name {
    font-weight: 600;
    font-size: 13px;
}

.message-time {
    font-size: 11px;
    color: var(--text-tertiary);
}

.message-body {
    font-size: 14px;
    line-height: 1.65;
    color: var(--text-primary);
}

.message-body p { margin: 6px 0; }
.message-body ul, .message-body ol { margin: 6px 0; padding-left: 24px; }
.message-body li { margin: 3px 0; }
.message-body h1, .message-body h2, .message-body h3 { margin: 12px 0 6px; }
.message-body h1 { font-size: 18px; }
.message-body h2 { font-size: 16px; }
.message-body h3 { font-size: 14px; }
.message-body table { border-collapse: collapse; margin: 8px 0; width: 100%; }
.message-body th, .message-body td {
    border: 1px solid var(--border-primary);
    padding: 6px 10px;
    text-align: left;
    font-size: 13px;
}
.message-body th { background: var(--bg-tertiary); font-weight: 600; }
.message-body blockquote {
    border-left: 3px solid var(--accent);
    padding: 4px 12px;
    margin: 8px 0;
    color: var(--text-secondary);
    background: var(--accent-soft);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Thinking indicator */

.thinking {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.thinking-dots {
    display: flex;
    gap: 4px;
}

.thinking-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-tertiary);
    animation: thinking 1.4s infinite;
}

.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes thinking {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ── Streaming Cursor ───────────────────────────────────────────────────── */

.streaming-cursor {
    display: inline;
    color: var(--accent);
    animation: blink-cursor 0.8s step-end infinite;
    font-weight: 300;
}

@keyframes blink-cursor {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ── Write Approval Dialog ──────────────────────────────────────────────── */

.approval-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.approval-dialog {
    background: var(--bg-modal);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    max-width: 520px;
    width: 90%;
    padding: 24px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.approval-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.approval-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--text-primary);
}

.approval-icon {
    font-size: 24px;
}

.approval-body {
    margin-bottom: 20px;
}

.approval-agent {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.approval-operation {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.approval-body p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 8px 0;
    line-height: 1.5;
}

.approval-details {
    background: var(--bg-code);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 12px;
    font-size: 12px;
    overflow-x: auto;
    max-height: 200px;
    color: var(--text-secondary);
}

.approval-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.approval-btn {
    padding: 8px 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.approval-btn.approve {
    background: #16a34a;
    color: white;
    border-color: #16a34a;
}

.approval-btn.approve:hover {
    background: #15803d;
}

.approval-btn.reject {
    background: transparent;
    color: var(--text-secondary);
}

.approval-btn.reject:hover {
    background: var(--bg-hover);
    color: #ef4444;
    border-color: #ef4444;
}

/* ── Chat Input ─────────────────────────────────────────────────────────── */

.chat-input-area {
    padding: 12px 20px 16px;
    background: var(--bg-primary);
    transition: background var(--transition);
    flex-shrink: 0;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 900px;
    margin: 0 auto;
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: var(--radius-lg);
    padding: 8px 12px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.input-wrapper:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

#chat-input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    outline: none;
    max-height: 150px;
    padding: 4px 0;
}

#chat-input::placeholder {
    color: var(--text-tertiary);
}

.btn-send {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    border: none;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all var(--transition);
}

.btn-send:hover { background: var(--accent-hover); transform: scale(1.05); }
.btn-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.input-hint {
    text-align: center;
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 6px;
}

/* ── Prompt Intelligence ─────────────────────────────────────────────── */

.chat-input-area {
    position: relative;
}

.btn-catalog {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
}

.btn-catalog:hover {
    background: var(--bg-secondary);
    color: var(--accent-primary);
}

/* Dropdown */
.prompt-dropdown {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 900px;
    max-height: 380px;
    overflow-y: auto;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.15);
    z-index: 100;
    margin-bottom: 6px;
    padding: 6px;
}

.pi-group-header {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 8px 12px 4px;
    margin-top: 4px;
}

.pi-group-header:first-child {
    margin-top: 0;
}

.pi-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.pi-item:hover,
.pi-item.pi-selected {
    background: var(--bg-secondary);
}

.pi-item-icon {
    font-size: 1rem;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.pi-item-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.pi-item-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pi-item-template {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pi-item-badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    text-transform: capitalize;
    flex-shrink: 0;
}

/* Enhancement Bar */
.prompt-enhance-bar {
    max-width: 900px;
    margin: 0 auto 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
    font-size: 0.82rem;
    color: var(--text-secondary);
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.enhance-tip {
    flex: 1;
}

.enhance-apply-btn {
    padding: 3px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid var(--accent-primary);
    border-radius: 6px;
    background: var(--accent-primary);
    color: white;
    cursor: pointer;
    transition: opacity 0.2s;
}

.enhance-apply-btn:hover {
    opacity: 0.85;
}

.enhance-dismiss-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0 2px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.enhance-dismiss-btn:hover {
    opacity: 1;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn {
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
}

.btn-secondary:hover { background: var(--bg-hover); }

/* ── Modal ──────────────────────────────────────────────────────────────── */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-modal);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 640px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-primary);
    animation: modalIn 0.25s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-primary);
}

.modal-header h2 { font-size: 16px; font-weight: 600; }

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border-primary);
}

.settings-section {
    margin-bottom: 24px;
}

.settings-section h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.settings-hint {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 12px;
}

/* Health grid */

.health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
}

.health-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.health-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.health-dot.ok { background: var(--status-green); }
.health-dot.missing { background: var(--status-red); }

/* Config form */

.config-form {
    display: grid;
    gap: 10px;
}

.config-field {
    display: grid;
    grid-template-columns: 180px 1fr;
    align-items: center;
    gap: 8px;
}

.config-field label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.config-field input {
    padding: 6px 10px;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font-mono);
    outline: none;
    transition: border-color var(--transition);
}

.config-field input:focus {
    border-color: var(--border-focus);
}

.config-field input.masked {
    color: var(--text-tertiary);
    font-style: italic;
}

/* Theme options */

.theme-options {
    display: flex;
    gap: 16px;
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-secondary);
}

.theme-option input { cursor: pointer; }

/* Guardrail grid */

.guardrail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
}

.guardrail-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    font-size: 12px;
}

.guardrail-item b { color: var(--text-primary); }
.guardrail-item span { color: var(--text-tertiary); }

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%;
        transition: left 0.3s ease;
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar-toggle {
        display: flex;
    }

    .welcome-grid {
        grid-template-columns: 1fr;
    }

    .config-field {
        grid-template-columns: 1fr;
    }

    .chat-header {
        padding-left: 52px;
    }
}

@media (max-width: 480px) {
    .message {
        padding: 10px 14px;
    }
}

/* ── Scrollbar ──────────────────────────────────────────────────────────── */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-secondary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* ── Copy button for code blocks ────────────────────────────────────────── */

.code-block-wrapper {
    position: relative;
}

.code-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 10px;
    font-size: 11px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--transition);
}

.code-block-wrapper:hover .code-copy-btn {
    opacity: 1;
}

.code-copy-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ── Header Actions & Notifications ─────────────────────────────────── */

.header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-btn {
    background: none;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px 10px;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all var(--transition);
}

.header-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

.header-btn .btn-label {
    font-size: 12px;
    font-weight: 500;
}

.notification-wrapper {
    position: relative;
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--status-red);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
    pointer-events: none;
}

.notification-panel {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    width: 360px;
    max-height: 480px;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    overflow: hidden;
    flex-direction: column;
}

.notification-panel[style*="display: block"] {
    display: flex !important;
}

.notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-primary);
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
}

.notif-header button {
    background: none;
    border: none;
    color: var(--accent-primary);
    cursor: pointer;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}

.notif-header button:hover {
    background: var(--bg-hover);
}

.notif-list {
    overflow-y: auto;
    flex: 1;
    max-height: 420px;
}

.notif-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 32px 16px;
    font-size: 13px;
}

.notif-item {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-primary);
    cursor: pointer;
    transition: background var(--transition);
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item:hover {
    background: var(--bg-hover);
}

.notif-item.read {
    opacity: 0.6;
}

.notif-icon {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 2px;
}

.notif-body {
    flex: 1;
    min-width: 0;
}

.notif-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.notif-preview {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.notif-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── Message Feedback (Thumbs Up/Down) ──────────────────────────────── */

.message-feedback {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    opacity: 0;
    transition: opacity 0.2s;
}

.message:hover .message-feedback,
.message-feedback:focus-within {
    opacity: 1;
}

.feedback-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 2px 8px;
    color: var(--text-muted);
    transition: all 0.2s;
}

.feedback-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--border-primary);
}

.feedback-btn.active {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.feedback-confirm {
    font-size: 0.72rem;
    color: var(--text-muted);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(-4px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ── Analytics Modal ───────────────────────────────────────────────── */

.analytics-modal-content {
    max-width: 820px;
    width: 94vw;
    max-height: 88vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.analytics-modal-content .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ana-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ana-period-select {
    padding: 4px 8px;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.8rem;
}

.analytics-body {
    overflow-y: auto;
    padding-bottom: 16px;
}

.ana-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}

.ana-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 12px 10px;
    text-align: center;
}

.ana-card-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.ana-card-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.ana-section {
    margin-bottom: 16px;
}

.ana-section h3 {
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.ana-empty {
    font-size: 0.82rem;
    color: var(--text-muted);
    padding: 10px;
}

/* Agent bars */
.ana-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.ana-bar-label {
    font-size: 0.8rem;
    font-weight: 600;
    min-width: 80px;
    color: var(--text-secondary);
    text-transform: capitalize;
}

.ana-bar-track {
    flex: 1;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.ana-bar-fill {
    height: 100%;
    border-radius: 4px;
    background: var(--accent-primary);
    transition: width 0.5s ease;
}

.ana-bar-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    min-width: 70px;
    text-align: right;
}

/* Feature usage */
.ana-feature-item {
    font-size: 0.82rem;
    padding: 4px 0;
    color: var(--text-secondary);
}

/* Top prompts */
.ana-prompt-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-primary);
}

.ana-prompt-rank {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent-primary);
    min-width: 24px;
}

.ana-prompt-text {
    flex: 1;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.ana-prompt-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* Poor interactions */
.ana-poor-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    margin-bottom: 6px;
}

.ana-poor-q {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.ana-poor-reasons {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.ana-tag {
    font-size: 0.68rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(231, 76, 60, 0.12);
    color: #e74c3c;
    font-weight: 600;
}

/* Admin feedback queue */
.ana-fb-item {
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    margin-bottom: 6px;
}

.ana-fb-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    margin-bottom: 4px;
}

.ana-fb-time {
    margin-left: auto;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.ana-fb-message {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.btn-xs {
    padding: 2px 8px;
    font-size: 0.7rem;
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
}

.btn-xs:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.btn-secondary {
    padding: 6px 12px;
    font-size: 0.8rem;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

/* ── Feedback Modal ────────────────────────────────────────────────── */

.feedback-modal-content {
    max-width: 500px;
    width: 88vw;
    max-height: 70vh;
}

.feedback-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.fb-field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.fb-field select,
.fb-field textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    box-sizing: border-box;
}

.fb-field textarea {
    resize: vertical;
}

.fb-field select:focus,
.fb-field textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.fb-actions {
    display: flex;
    justify-content: flex-end;
}

.fb-status {
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 0.82rem;
}

.fb-status-success {
    background: rgba(39, 174, 96, 0.1);
    border: 1px solid rgba(39, 174, 96, 0.3);
    color: #27ae60;
}

.fb-status-error {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.3);
    color: #e74c3c;
}

/* ── Meeting Scheduler Modal ────────────────────────────────────────── */

.meeting-scheduler-modal-content {
    max-width: 650px;
    width: 90vw;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.meeting-scheduler-body {
    overflow-y: auto;
    padding-bottom: 16px;
}

.ms-input-section {
    margin-bottom: 18px;
}

.ms-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.ms-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 10px;
    box-sizing: border-box;
}

.ms-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.ms-suggestions h3 {
    font-size: 0.9rem;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.ms-parsed-info {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.ms-suggestion-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    margin-bottom: 8px;
    transition: border-color 0.2s;
}

.ms-suggestion-card:hover {
    border-color: var(--accent-primary);
}

.ms-suggestion-time {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ms-date {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
}

.ms-time {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.ms-confidence {
    font-size: 0.72rem;
    color: var(--accent-primary);
}

.ms-no-results {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 14px;
    text-align: center;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.ms-manual-section {
    margin-top: 14px;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    overflow: hidden;
}

.ms-manual-section summary {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    user-select: none;
}

.ms-manual-form {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ms-field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.ms-field input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.85rem;
    box-sizing: border-box;
}

.ms-field input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.ms-field-row {
    display: flex;
    gap: 12px;
}

.ms-field-row .ms-field {
    flex: 1;
}

.ms-status {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.5;
}

.ms-status-success {
    background: rgba(39, 174, 96, 0.1);
    border: 1px solid rgba(39, 174, 96, 0.3);
    color: #27ae60;
}

.ms-status-error {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.3);
    color: #e74c3c;
}

.ms-status a {
    color: var(--accent-primary);
    text-decoration: underline;
}

.mem-del-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0 4px;
    margin-left: 6px;
    opacity: 0.6;
    transition: opacity 0.2s, color 0.2s;
}

.mem-del-btn:hover {
    opacity: 1;
    color: #e74c3c;
}

/* ── Memory Modal ──────────────────────────────────────────────────────── */

.memory-modal-content {
    max-width: 620px;
    width: 90vw;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.memory-body {
    overflow-y: auto;
    padding-bottom: 16px;
}

.memory-stats {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.memory-add-form {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.memory-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-primary);
    margin-bottom: 12px;
}

.memory-tab {
    padding: 8px 14px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.memory-tab:hover { color: var(--text-primary); }
.memory-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.memory-list {
    max-height: 350px;
    overflow-y: auto;
}

.memory-item {
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    margin-bottom: 6px;
}

.memory-item-text {
    font-size: 0.85rem;
    color: var(--text-primary);
}

.memory-item-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.memory-bottom-actions {
    margin-top: 12px;
    display: flex;
    gap: 10px;
}

/* ── Memory Modal ──────────────────────────────────────────────────── */

.memory-modal-content {
    max-width: 620px;
    width: 90vw;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.memory-body {
    overflow-y: auto;
    padding-bottom: 16px;
}

.memory-stats {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.memory-add-form {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.memory-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-primary);
    margin-bottom: 12px;
}

.memory-tab {
    padding: 8px 14px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.memory-tab:hover { color: var(--text-primary); }
.memory-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.memory-list {
    max-height: 350px;
    overflow-y: auto;
}

.memory-item {
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    margin-bottom: 6px;
}

.memory-item-text {
    font-size: 0.85rem;
    color: var(--text-primary);
}

.memory-item-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.memory-bottom-actions {
    margin-top: 12px;
    display: flex;
    gap: 10px;
}

/* ── Sprint Intelligence Modal ──────────────────────────────────────── */

.sprint-intel-modal-content {
    max-width: 760px;
    width: 92vw;
    max-height: 88vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.sprint-intel-body {
    overflow-y: auto;
    padding-bottom: 16px;
}

/* Health banner */
.si-health-banner {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 16px 20px;
    border-radius: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    margin-bottom: 16px;
}

.si-health-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
}

.si-score-number {
    font-size: 2.4rem;
    font-weight: 800;
    line-height: 1;
}

.si-score-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.si-health-banner[data-health="Healthy"] .si-score-number { color: #27ae60; }
.si-health-banner[data-health="Healthy"] .si-score-label { color: #27ae60; }
.si-health-banner[data-health="At Risk"] .si-score-number { color: #f39c12; }
.si-health-banner[data-health="At Risk"] .si-score-label { color: #f39c12; }
.si-health-banner[data-health="Concerning"] .si-score-number { color: #e67e22; }
.si-health-banner[data-health="Concerning"] .si-score-label { color: #e67e22; }
.si-health-banner[data-health="Critical"] .si-score-number { color: #e74c3c; }
.si-health-banner[data-health="Critical"] .si-score-label { color: #e74c3c; }

.si-sprint-info {
    flex: 1;
}

.si-sprint-name {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

.si-sprint-dates {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Metrics grid */
.si-metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.si-metric-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 10px 8px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.si-metric-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.si-metric-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Progress bars */
.si-progress-section {
    margin-bottom: 14px;
}

.si-progress-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.si-progress-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    min-width: 90px;
}

.si-progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.si-progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.si-time-bar { background: var(--accent-primary); }
.si-work-bar { background: #27ae60; }

.si-progress-pct {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 40px;
    text-align: right;
}

/* Burndown */
.si-burndown {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--bg-secondary);
    margin-bottom: 14px;
    font-size: 0.85rem;
}

.si-burndown-icon { font-size: 1.2rem; }

/* Risks */
.si-risks h3 {
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.si-risk-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    background: var(--bg-secondary);
    border-left: 3px solid var(--text-muted);
    margin-bottom: 6px;
    font-size: 0.82rem;
}

.si-risk-item[data-severity="critical"] { border-left-color: #e74c3c; }
.si-risk-item[data-severity="high"] { border-left-color: #e67e22; }
.si-risk-item[data-severity="medium"] { border-left-color: #f39c12; }

.si-risk-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

.si-risk-item[data-severity="critical"] .si-risk-badge { background: rgba(231,76,60,0.15); color: #e74c3c; }
.si-risk-item[data-severity="high"] .si-risk-badge { background: rgba(230,126,34,0.15); color: #e67e22; }
.si-risk-item[data-severity="medium"] .si-risk-badge { background: rgba(243,156,18,0.15); color: #f39c12; }

.si-risk-detail {
    flex: 1;
    color: var(--text-secondary);
}

/* Prediction */
.si-prediction {
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--bg-secondary);
    margin-bottom: 14px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Actions */
.si-actions {
    margin-bottom: 14px;
}

/* AI Report */
.si-ai-report {
    margin-top: 10px;
}

.si-ai-report h3 {
    font-size: 0.9rem;
    margin-bottom: 8px;
}

#si-ai-report-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 14px 16px;
    font-size: 0.85rem;
    line-height: 1.55;
    max-height: 400px;
    overflow-y: auto;
}

/* ── Knowledge Trail Modal ──────────────────────────────────────────── */

.knowledge-modal-content {
    max-width: 720px;
    width: 90vw;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.knowledge-body {
    overflow-y: auto;
    padding-bottom: 16px;
}

.knowledge-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.knowledge-stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 12px 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.knowledge-search-area {
    margin-bottom: 16px;
}

.knowledge-search-row {
    display: flex;
    gap: 8px;
}

.knowledge-search-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.knowledge-search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.knowledge-results {
    margin-top: 14px;
    max-height: 300px;
    overflow-y: auto;
}

.knowledge-results h3 {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.knowledge-result-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 8px;
}

.kr-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.kr-source {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--accent-primary);
    letter-spacing: 0.5px;
}

.kr-score {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.kr-title {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.kr-snippet {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.knowledge-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.btn-danger-small {
    padding: 8px 16px;
    border: 1px solid #e74c3c;
    border-radius: 8px;
    background: transparent;
    color: #e74c3c;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.btn-danger-small:hover {
    background: rgba(231, 76, 60, 0.1);
}

.knowledge-status {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--bg-secondary);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ── Standup & Reports Modal ────────────────────────────────────────── */

.standup-modal-content {
    max-width: 680px;
    width: 90vw;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.standup-body {
    overflow-y: auto;
    padding-bottom: 16px;
}

.standup-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-primary);
    margin-bottom: 20px;
}

.standup-tab {
    flex: 1;
    padding: 10px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.standup-tab:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.standup-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.standup-tab-content {
    display: none;
}

.standup-tab-content.active {
    display: block;
}

.standup-form-group {
    margin-bottom: 16px;
}

.standup-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.standup-form-group .optional {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 12px;
}

.standup-input,
.standup-select {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    transition: border-color var(--transition);
}

.standup-input:focus,
.standup-select:focus,
.standup-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.standup-textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: "JetBrains Mono", "Fira Code", monospace;
    line-height: 1.5;
    resize: vertical;
    min-height: 180px;
}

.standup-textarea::placeholder {
    color: var(--text-muted);
    font-family: inherit;
}

.standup-file-input {
    font-size: 13px;
    color: var(--text-secondary);
}

.standup-file-input::file-selector-button {
    padding: 6px 12px;
    background: var(--bg-hover);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 12px;
    margin-right: 8px;
}

.standup-file-input::file-selector-button:hover {
    background: var(--accent-primary);
    color: #fff;
}

.standup-generate {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.standup-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
}

.standup-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 12px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--status-yellow, #f59e0b);
}

/* Meetings list */
.meetings-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 320px;
    overflow-y: auto;
}

.meeting-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.meeting-card.has-transcript {
    cursor: pointer;
}

.meeting-card.has-transcript:hover {
    border-color: var(--accent-primary);
    background: var(--bg-hover);
}

.meeting-card.no-transcript-card {
    opacity: 0.5;
}

.meeting-info {
    flex: 1;
    min-width: 0;
}

.meeting-subject {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.meeting-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.meeting-badge {
    flex-shrink: 0;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 500;
    margin-left: 10px;
}

.meeting-badge.transcript {
    background: rgba(16, 185, 129, 0.15);
    color: var(--status-green);
}

.meeting-badge.no-transcript {
    background: rgba(107, 114, 128, 0.15);
    color: var(--text-muted);
}
