/* ─── Brand tokens ─────────────────────────────────────────────────────────── */
:root {
    --deep:           #080f1e;
    --surface:        #0c1528;
    --card:           #101c30;
    --card-raised:    #162038;
    --bubble-ai:      #121e32;
    --border:         rgba(255, 255, 255, 0.07);
    --border-mid:     rgba(255, 255, 255, 0.11);
    --text:           #d8e8f8;
    --text-muted:     #5a7a9a;
    --text-dim:       #2e4a66;

    /* KI blues */
    --blue:           #1e6fc4;
    --blue-light:     #3a90e0;
    --blue-glow:      rgba(30, 111, 196, 0.22);
    --teal:           #0e8a8a;
    --teal-light:     #18b0b0;

    /* Signature gradient — deep navy → rich blue → teal */
    --brand-gradient: linear-gradient(135deg, #050c1a 0%, #0d2040 22%, #0e4a8a 52%, #0b7a8a 78%, #0aacac 100%);

    --radius-lg:      18px;
    --radius-md:      12px;
    --radius-sm:      8px;
    --shadow-deep:    0 32px 80px rgba(0, 0, 0, 0.65);
    --shadow-card:    0 4px 20px rgba(0, 0, 0, 0.4);
    --transition:     0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* ─── Body ─────────────────────────────────────────────────────────────────── */
body {
    font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
    background: var(--deep);
    background-image:
        radial-gradient(ellipse 70% 55% at 15% 85%, rgba(10, 172, 172, 0.06) 0%, transparent 55%),
        radial-gradient(ellipse 55% 70% at 85% 15%, rgba(30, 111, 196, 0.09) 0%, transparent 55%);
    min-height: 100vh;
    min-height: calc(var(--vh, 1vh) * 100);
    height: 100vh;
    height: calc(var(--vh, 1vh) * 100);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    overflow: hidden;
    color: var(--text);
}

/* ─── Container (base.html wrapper) ───────────────────────────────────────── */
/* Full width/height, no max-width so workspace can handle sizing */
.container {
    width: 100%;
    max-width: 100%;
    height: 100%;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* ─── Workspace — two-panel layout ────────────────────────────────────────── */
.workspace {
    display: flex;
    height: 100%;
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
    padding: 20px;
    gap: 16px;
    box-sizing: border-box;
}

/* ─── Chat panel (left, 58%) ───────────────────────────────────────────────── */
.chat-panel {
    flex: 0 0 58%;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* ─── Chat container ───────────────────────────────────────────────────────── */
.chat-container {
    background: var(--surface);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-deep);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    flex: 1;
}

/* ─── Header ───────────────────────────────────────────────────────────────── */
.chat-header {
    background: var(--brand-gradient);
    padding: 20px 28px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.chat-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
    background-size: 200px 200px;
    pointer-events: none;
    opacity: 0.5;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    z-index: 1;
}

.header-logo-wrap {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 0;
    flex-shrink: 0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.header-logo-placeholder {
    width: 54px;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
    font-size: 26px;
    font-weight: 700;
    color: #ffffff;
    border-radius: 12px;
    letter-spacing: -1px;
}

.header-text h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: #ffffff;
    line-height: 1.2;
}

.subtitle {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
    margin-top: 3px;
}

.meet-team-btn {
    margin-left: auto;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}
.meet-team-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

.start-over-btn {
    margin-left: 8px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

.start-over-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* ─── Messages area ────────────────────────────────────────────────────────── */
.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 28px 24px;
    background: var(--card);
    background-image: radial-gradient(circle, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 28px 28px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
.chat-messages::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.18); }

/* ─── Welcome message ──────────────────────────────────────────────────────── */
.welcome-message {
    text-align: center;
    padding: 52px 24px;
    animation: fadeUp 0.6s ease both;
}

.welcome-subtitle {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 14px;
}

.welcome-hint {
    font-size: 14px;
    color: var(--text-muted);
    max-width: 460px;
    margin: 0 auto;
    line-height: 1.7;
}

.welcome-message::after {
    content: '';
    display: block;
    width: 48px;
    height: 2px;
    background: var(--brand-gradient);
    border-radius: 2px;
    margin: 20px auto 0;
}

/* ─── Message bubbles ──────────────────────────────────────────────────────── */
.message {
    display: flex;
    animation: fadeUp 0.3s ease both;
}

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

.message.user      { justify-content: flex-end; }
.message.assistant { justify-content: flex-start; }

.message-bubble {
    max-width: 72%;
    padding: 13px 18px;
    border-radius: var(--radius-lg);
    word-wrap: break-word;
    line-height: 1.6;
    font-size: 14.5px;
}

.message.user .message-bubble {
    background: var(--brand-gradient);
    color: #fff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255,255,255,0.06);
}

.message.assistant .message-bubble {
    max-width: 90%;
    background: var(--bubble-ai);
    color: var(--text);
    border: 1px solid var(--border-mid);
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-card);
}

/* ─── Expert bubble header ─────────────────────────────────────────────────── */
.expert-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.expert-avatar {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--expert-color, var(--blue));
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    opacity: 0.92;
}

.expert-name-wrap {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.expert-name {
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.2;
}

.expert-role {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.03em;
    line-height: 1.2;
}

/* ─── Markdown inside assistant bubbles ────────────────────────────────────── */
.message-content p { margin: 0 0 11px 0; }
.message-content p:last-child { margin-bottom: 0; }

.message.user .message-content { white-space: pre-wrap; }

.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    line-height: 1.3;
    margin: 16px 0 8px;
    color: #eaf2fa;
}
.message-content h1:first-child,
.message-content h2:first-child,
.message-content h3:first-child { margin-top: 0; }

.message-content h1 { font-size: 1.25em; }
.message-content h2 { font-size: 1.1em; }
.message-content h3 { font-size: 1em; color: var(--teal-light); }
.message-content h4 { font-size: 0.95em; }

.message-content ul,
.message-content ol {
    margin: 8px 0 12px 0;
    padding-left: 22px;
}
.message-content li { margin: 5px 0; }

.message-content strong { font-weight: 600; color: #eaf2fa; }
.message-content em { font-style: italic; opacity: 0.85; }

.message-content code {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 2px 7px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.88em;
    color: var(--blue-light);
}

.message-content pre {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    overflow-x: auto;
    margin: 12px 0;
}
.message-content pre code {
    background: none;
    border: none;
    padding: 0;
    color: #c8daea;
}

.message-content blockquote {
    border-left: 3px solid var(--blue);
    margin: 12px 0;
    padding: 8px 14px;
    background: rgba(30, 111, 196, 0.07);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-style: italic;
    color: var(--text-muted);
}

.message-content a {
    color: var(--blue-light);
    text-decoration: none;
    border-bottom: 1px solid rgba(30, 111, 196, 0.3);
    transition: border-color var(--transition);
}
.message-content a:hover { border-color: var(--blue-light); }

.message-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 14px 0;
    font-size: 13px;
}
.message-content th,
.message-content td {
    border: 1px solid var(--border-mid);
    padding: 8px 12px;
    text-align: left;
}
.message-content th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
    color: #eaf2fa;
}
.message-content tr:nth-child(even) td { background: rgba(255, 255, 255, 0.02); }

.message-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 16px 0;
}

/* ─── Collapsible sections ─────────────────────────────────────────────────── */
.message-content details {
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-md);
    margin: 8px 0;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.15);
}
.message-content details + details { margin-top: 6px; }

.message-content summary {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.95em;
    padding: 11px 14px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.04);
    list-style: none;
    display: flex;
    align-items: center;
    gap: 9px;
    color: #d0e4f0;
    user-select: none;
    transition: background var(--transition);
}
.message-content summary::-webkit-details-marker { display: none; }
.message-content summary::before {
    content: '\25B6';
    font-size: 9px;
    color: var(--teal-light);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}
.message-content details[open] > summary {
    background: rgba(14, 138, 138, 0.1);
    border-bottom: 1px solid var(--border);
    color: #eaf2fa;
}
.message-content details[open] > summary::before { transform: rotate(90deg); }
.message-content details > *:not(summary) { padding: 10px 14px 4px; }

/* ─── Show-more clamp ──────────────────────────────────────────────────────── */
.message-clamp {
    position: relative;
    max-height: 400px;
    overflow: hidden;
}
.message-clamp::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 90px;
    background: linear-gradient(to bottom, transparent, var(--bubble-ai));
    pointer-events: none;
}
.message.assistant .message-bubble.expanded .message-clamp { max-height: none; }
.message.assistant .message-bubble.expanded .message-clamp::after { display: none; }

.show-more-btn {
    display: block;
    margin: 10px auto 2px;
    background: transparent;
    border: 1px solid rgba(30, 111, 196, 0.4);
    color: var(--blue-light);
    border-radius: 20px;
    padding: 5px 20px;
    font-size: 12.5px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
    letter-spacing: 0.03em;
}
.show-more-btn:hover {
    background: rgba(30, 111, 196, 0.12);
    border-color: var(--blue);
    color: var(--blue);
}

/* ─── Streaming text & cursor ──────────────────────────────────────────────── */
.streaming-text {
    font-size: 14.5px;
    color: var(--text);
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    min-height: 1.2em;
}

.specialist-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.5rem 0 0.25rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.5;
}
.specialist-divider::before,
.specialist-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.stream-cursor {
    display: inline-block;
    width: 2px;
    height: 1.1em;
    background: var(--text-muted);
    margin-left: 1px;
    vertical-align: text-bottom;
    border-radius: 1px;
    animation: blink-cursor 0.9s step-end infinite;
}

@keyframes blink-cursor {
    50% { opacity: 0; }
}

/* ─── Typing indicator ─────────────────────────────────────────────────────── */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 14px 18px;
    background: var(--bubble-ai);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-lg);
    border-bottom-left-radius: 4px;
    width: fit-content;
    box-shadow: var(--shadow-card);
}
.typing-indicator span {
    height: 7px;
    width: 7px;
    background: var(--text-muted);
    border-radius: 50%;
    display: inline-block;
    animation: typing 1.4s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0);    opacity: 0.5; }
    30%            { transform: translateY(-7px); opacity: 1; }
}

/* ─── Input area ───────────────────────────────────────────────────────────── */
.chat-input-container {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 18px 24px 12px;
    flex-shrink: 0;
}

.data-notice {
    margin-top: 8px;
    text-align: center;
    font-size: 11px;
    color: var(--text-dim);
    letter-spacing: 0.02em;
}

.chat-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    background: var(--card-raised);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-lg);
    padding: 10px 10px 10px 18px;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.chat-form:focus-within {
    border-color: rgba(30, 111, 196, 0.4);
    box-shadow: 0 0 0 3px var(--blue-glow);
}

.message-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 14.5px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    resize: none;
    max-height: 120px;
    overflow-y: auto;
    line-height: 1.55;
    padding: 4px 0;
}
.message-input::placeholder { color: var(--text-dim); }

.message-input::-webkit-scrollbar { width: 4px; }
.message-input::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.send-button {
    background: #ffffff;
    color: #000000;
    border: none;
    border-radius: 12px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
    flex-shrink: 0;
}
.send-button:hover:not(:disabled) {
    background: #e8e8e8;
    transform: scale(1.05);
}
.send-button:disabled { opacity: 0.3; cursor: not-allowed; }

.send-icon { font-size: 18px; line-height: 1; }

/* ─── Error message ────────────────────────────────────────────────────────── */
.error-message {
    background: rgba(196, 72, 48, 0.12);
    color: #f08070;
    padding: 11px 16px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(196, 72, 48, 0.25);
    text-align: center;
    font-size: 13.5px;
}

/* ─── Innovation Document panel (right, 42%) ───────────────────────────────── */
.doc-panel {
    flex: 0 0 42%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-deep);
}

.doc-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    background: var(--card);
}

.doc-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.doc-icon { font-size: 16px; }

.doc-title {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.01em;
}

.doc-updating {
    font-size: 11px;
    color: var(--teal-light);
    letter-spacing: 0.04em;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.doc-actions { display: flex; gap: 6px; }

.doc-export-btn {
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 600;
    font-family: 'Plus Jakarta Sans', sans-serif;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-mid);
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition);
}
.doc-export-btn:hover {
    color: var(--text);
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
}

.doc-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.doc-content::-webkit-scrollbar { width: 4px; }
.doc-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.doc-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 32px;
}
.doc-empty p {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.7;
}

/* ─── Document sections ────────────────────────────────────────────────────── */
.doc-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    animation: fadeUp 0.4s ease both;
}

.doc-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    user-select: none;
}
.doc-section-header:hover { background: rgba(255,255,255,0.06); }

.doc-section-chevron {
    margin-left: auto;
    font-size: 11px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}
.doc-section.collapsed .doc-section-chevron { transform: rotate(-90deg); }
.doc-section.collapsed .doc-section-body { display: none; }
.doc-section.collapsed { border-bottom: none; }

.doc-section-icon { font-size: 13px; }

.doc-section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.doc-section-body {
    padding: 12px 14px;
}

.doc-section-body p,
.doc-section-body .doc-text {
    font-size: 13px;
    color: var(--text);
    line-height: 1.65;
    margin: 0;
}

.doc-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.doc-list li {
    font-size: 13px;
    color: var(--text);
    line-height: 1.55;
    padding-left: 0;
    position: relative;
    list-style: none;
}

/* Draggable doc items */
.doc-draggable {
    cursor: grab;
    border-radius: 5px;
    transition: background 0.15s;
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 3px 4px 3px 2px;
}
.doc-draggable:hover { background: rgba(255,255,255,0.05); }
.doc-draggable:active { cursor: grabbing; }

.drag-handle {
    font-size: 11px;
    color: var(--text-dim);
    opacity: 0;
    flex-shrink: 0;
    margin-top: 2px;
    transition: opacity 0.15s;
}
.doc-draggable:hover .drag-handle { opacity: 1; }

/* Drop zone highlight on chat form */
.chat-form.drag-over {
    border-color: rgba(30, 111, 196, 0.6) !important;
    box-shadow: 0 0 0 3px rgba(30, 111, 196, 0.15) !important;
}

.doc-need-item {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 6px;
    padding: 8px 10px;
    background: rgba(255,255,255,0.02);
    border-radius: 6px;
    border: 1px solid var(--border);
    margin-bottom: 6px;
}
.doc-need-item > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}
.doc-need-item:last-child { margin-bottom: 0; }
.doc-need-text { font-size: 13px; color: var(--text); line-height: 1.5; }
.doc-need-stakeholder {
    font-size: 11px;
    color: var(--teal-light);
    font-weight: 600;
    letter-spacing: 0.03em;
}

/* ─── Section accent colors ────────────────────────────────────────────────── */
.doc-section[data-section="regulatory"] .doc-section-header { border-left: 3px solid #0e8a8a; }
.doc-section[data-section="technical"] .doc-section-header   { border-left: 3px solid #2e7d32; }
.doc-section[data-section="clinical"] .doc-section-header    { border-left: 3px solid #7b3fa0; }
.doc-section[data-section="ai_digital"] .doc-section-header  { border-left: 3px solid #c47a1e; }
.doc-section[data-section="next_steps"] .doc-section-header  { border-left: 3px solid #1e6fc4; }

/* ─── Login page ───────────────────────────────────────────────────────────── */
.login-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-deep);
    width: 100%;
    max-width: 380px;
    overflow: hidden;
}

.login-header {
    background: var(--brand-gradient);
    color: white;
    padding: 32px 24px 28px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.login-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
    background-size: 200px 200px;
    pointer-events: none;
}

.login-logo {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin: 0 auto 14px;
    position: relative;
    z-index: 1;
}

.login-header h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.3px;
    position: relative;
    z-index: 1;
}
.login-header .subtitle {
    position: relative;
    z-index: 1;
    margin-top: 4px;
}

.login-form {
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--surface);
}

.login-field { display: flex; flex-direction: column; }

.login-input {
    background: var(--card-raised);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: 14.5px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--text);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.login-input::placeholder { color: var(--text-dim); }
.login-input:focus {
    border-color: rgba(30, 111, 196, 0.5);
    box-shadow: 0 0 0 3px var(--blue-glow);
}
.login-input--error { border-color: rgba(196, 72, 48, 0.5); }

.login-error {
    color: #f08070;
    font-size: 13px;
    text-align: center;
    margin-top: -8px;
}

.login-button {
    background: var(--brand-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 13px;
    font-size: 14.5px;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: opacity var(--transition), transform var(--transition), box-shadow var(--transition);
    box-shadow: 0 2px 16px rgba(30, 111, 196, 0.25);
}
.login-button:hover {
    opacity: 0.92;
    transform: translateY(-1px);
    box-shadow: 0 6px 22px rgba(30, 111, 196, 0.35);
}
.login-button:active { transform: translateY(0); }

/* ─── Compatibility warning ────────────────────────────────────────────────── */
.compat-warning {
    background: var(--surface);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-deep);
    width: 100%;
    max-width: 380px;
    overflow: hidden;
}

.compat-warning__header {
    background: var(--brand-gradient);
    color: white;
    padding: 32px 24px 28px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.compat-warning__header::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
    background-size: 200px 200px;
    pointer-events: none;
}
.compat-warning__header h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.3px;
    position: relative;
    z-index: 1;
}
.compat-warning__header .subtitle {
    position: relative;
    z-index: 1;
    margin-top: 4px;
    font-size: 14px;
    opacity: 0.85;
}

.compat-warning__body {
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.compat-warning__icon { font-size: 36px; text-align: center; line-height: 1; }

.compat-warning__title {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    text-align: center;
}

.compat-warning__msg {
    font-size: 13.5px;
    color: var(--text-muted);
    line-height: 1.6;
    text-align: center;
}

.compat-warning__items {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.compat-warning__items li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13.5px;
    color: var(--text-muted);
    line-height: 1.5;
}
.compat-warning__items li span:first-child { font-size: 15px; flex-shrink: 0; margin-top: 1px; }
.compat-warning__items li.compat-fail { color: #f08070; }
.compat-warning__items li.compat-ok  { color: var(--teal-light); }

/* ─── Print styles (for PDF export) ───────────────────────────────────────── */
@media print {
    body { background: white; padding: 0; overflow: auto; }
    .chat-panel { display: none !important; }
    .workspace { padding: 0; display: block; height: auto; }
    .doc-panel {
        width: 100%;
        border: none;
        box-shadow: none;
        background: white;
        color: black;
        border-radius: 0;
        height: auto;
        overflow: visible;
    }
    .doc-header { background: white; border-bottom: 2px solid #ccc; }
    .doc-title { color: black; font-size: 18px; }
    .doc-icon { display: none; }
    .doc-actions { display: none; }
    .doc-updating { display: none !important; }
    .doc-content { overflow: visible; height: auto; }
    .doc-section { border: 1px solid #ddd; break-inside: avoid; background: white; }
    .doc-section-header { background: #f5f5f5; }
    .doc-section-title { color: #333; }
    .doc-section-body p, .doc-list li, .doc-need-text { color: #222; }
    .doc-need-stakeholder { color: #0e8a8a; }
    .doc-need-item { border-color: #ddd; background: #fafafa; }
    .doc-empty { display: none; }
}

/* ─── Responsive — wide ────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
    .workspace { padding: 14px; gap: 12px; }
    .chat-panel { flex: 0 0 54%; }
    .doc-panel  { flex: 0 0 46%; }
}

/* ─── Responsive — tablet / mobile ────────────────────────────────────────── */
@media (max-width: 900px) {
    body {
        padding: 0;
        overflow-y: auto;
        overflow-x: hidden;
        height: auto;
        min-height: 100vh;
        min-height: calc(var(--vh, 1vh) * 100);
        align-items: flex-start;
    }

    .container {
        min-height: 100vh;
        min-height: calc(var(--vh, 1vh) * 100);
        max-width: 100%;
        height: auto;
    }

    .workspace {
        flex-direction: column;
        padding: 0;
        gap: 0;
        height: auto;
        max-width: 100%;
    }

    .chat-panel {
        flex: none;
        height: calc(var(--vh, 1vh) * 100);
        min-height: 0;
    }

    .chat-container {
        border-radius: 0;
        border-left: none;
        border-right: none;
        height: 100%;
    }

    .doc-panel {
        flex: none;
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-top: 1px solid var(--border-mid);
        min-height: 400px;
    }

    .chat-header { border-radius: 0; padding: 14px 18px; flex-shrink: 0; }
    .header-logo-placeholder { width: 44px; height: 44px; font-size: 22px; }
    .header-text h1 { font-size: 18px; }

    .chat-messages {
        padding: 14px;
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    body.keyboard-open .chat-messages { flex: 1; overflow-y: auto; }

    .message-bubble { max-width: 88%; padding: 10px 14px; font-size: 14px; }
    .message.assistant .message-bubble { max-width: 95%; }

    .chat-input-container {
        padding: 12px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        flex-shrink: 0;
        position: relative;
        z-index: 100;
    }

    body.keyboard-open .chat-input-container { position: relative; }

    .message-input {
        font-size: 16px;
        touch-action: manipulation;
    }

    .send-button { width: 40px; height: 40px; }
}

@media (max-width: 768px) {
    body.keyboard-open {
        height: 100vh;
        height: calc(var(--vh, 1vh) * 100);
    }
}

@media (max-width: 480px) {
    .chat-header { padding: 12px 14px; }
    .header-logo-placeholder { width: 38px; height: 38px; font-size: 18px; border-radius: 9px; }
    .header-text h1 { font-size: 16px; }
    .subtitle { font-size: 10px; }

    .chat-messages { padding: 10px; }

    .message-bubble { max-width: 92%; font-size: 13.5px; padding: 9px 12px; }

    .welcome-message { padding: 36px 14px; }
    .welcome-subtitle { font-size: 18px; }
    .welcome-hint { font-size: 13px; }

    .chat-input-container {
        padding: 10px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    }

    .chat-form { gap: 8px; padding: 8px 8px 8px 14px; }
    .send-button { width: 38px; height: 38px; border-radius: 10px; }
    .send-icon { font-size: 16px; }

    .doc-header { padding: 12px 14px; }
    .doc-content { padding: 14px; gap: 10px; }
}

/* ─── Meet the Team modal ──────────────────────────────────────────────────── */

.team-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(4, 9, 22, 0.82);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: backdropIn 0.2s ease;
}
.team-modal-backdrop[hidden] { display: none; }

@keyframes backdropIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.team-modal {
    background: #0d1b35;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px 28px;
    box-shadow: 0 32px 80px rgba(0,0,0,0.6);
    animation: modalIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.team-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.team-modal-title {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

.team-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.07);
    color: rgba(255,255,255,0.6);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.team-modal-close:hover { background: rgba(255,255,255,0.15); color: #fff; }

.team-modal-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

/* Expert card */
.expert-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 18px 16px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    transition: border-color 0.2s, background 0.2s, transform 0.2s;
    cursor: default;
}
.expert-card:hover {
    background: rgba(255,255,255,0.07);
    border-color: rgba(255,255,255,0.16);
    transform: translateY(-2px);
}

.expert-card-portrait {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid;
    display: block;
}

.expert-card-avatar-fallback {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 2px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.expert-card-name {
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

.expert-card-role {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    opacity: 0.55;
    color: #fff;
    margin: -2px 0 0;
}

.expert-card-bio {
    font-size: 12px;
    line-height: 1.55;
    color: rgba(255,255,255,0.5);
    margin: 0;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.expert-card-chat-btn {
    margin-top: 2px;
    padding: 5px 14px;
    border-radius: 20px;
    border: 1px solid;
    background: transparent;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    color: #fff;
    opacity: 0.75;
}
.expert-card-chat-btn:hover { opacity: 1; }

@media (max-width: 600px) {
    .team-modal { padding: 16px; }
    .team-modal-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .expert-card { padding: 14px 10px; }
    .expert-card-portrait,
    .expert-card-avatar-fallback { width: 60px; height: 60px; font-size: 22px; }
}
