/* **** EP :: AI4COMM style **** */

:root {
    --ep-blue-dark: #082B7A;
    --ep-blue: #004EA2;
    --ep-blue-light: #1e6cff;
    --ep-blue-lighter: #f2f8ff;
    --ep-blue-bg: #EDF1FA;
    --ep-blue-bg-light: #F3F6FC;
    --ep-gold: #FFCC00;
    --ep-dark: #262B38;
    --ep-dark-80: #515560;
    --ep-dark-60: #6e6e6e;
    --ep-text: #1E1E1F;
    --ep-border: #D4D5D7;
    --ep-border-light: #E9EAEB;
    --ep-bg: #F5F5F5;
    --ep-white: #FFFFFF;
    --ep-error: #D7003D;
    --ep-success: #00A174;
    --sb-bg: #F5F5F5;
    --sb-hover: rgba(0, 0, 0, .05);
    --sb-active: rgba(14, 71, 203, .08);
    --sb-border: #E0E0E0;
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 11px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-xxl: 30px;
    --text-wght-rl: 350;
    --text-wght-r: 400;
    --text-wght-m: 500;
    --text-wght-sb: 625;
    --text-wght-b: 700;
    --text-wdth: 85;
    --text-opsz: 80;
    --text-GRAD: 88;
    --text-axis: 1;
    --font-size-text: clamp(1.125rem, 1.287vw + 0.739rem, 1.563rem);
    --line-height-text: clamp(1.688rem, 1.011vw + 1.884rem, 2.631rem);
}

/* Fonts */
@font-face {
    font-family: 'europeavar';
    src: url("../fonts/EuropeaVar.woff2") format('woff2'),
         url("../fonts/EuropeaVar.woff") format('woff'),
         url("../fonts/EuropeaVar.ttf") format('truetype');
    font-weight: 200 900;
    font-style: normal;
    font-display: swap;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
html,
body {
    height: 100%;
    overflow: hidden;
    font-family: europeavar, sans-serif;
    font-variation-settings:
            "wght" var(--text-wght-r),
            "wdth" var(--text-wdth),
            "opsz" var(--text-opsz),
            "GRAD" var(--text-GRAD),
            "ital" var(--text-axis);
    color: var(--ep-text);
    background: var(--ep-bg);
}
body {
    font-size: 1rem;
}

/* Focus */
*:focus {
    outline: 2px solid var(--ep-blue-light);
    outline-offset: 2px;
}
*:focus, a:hover {
    text-decoration-thickness: 2px;
}
a, a:focus, a:hover {
    text-underline-offset: 4px;
}

/* Utilities */
.ep-hidden {
    display: none !important;
}

/* SR Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ─── Scrollbar ─── */

::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, .1);
    border-radius: 10px;
}

/* ─── global ─── */
.wrapper {
    display: flex;
}

/* ─── Sidebar ─── */
.sidebar {
    width: 300px;
    min-width: 300px;
    background: var(--sb-bg);
    display: flex;
    flex-direction: column;
    height: 100vh;
    border-right: 1px solid var(--sb-border);
    z-index: 10;
}
.sb-head {
    padding: 30px 20px;
}
.sb-logo {
    display: flex;
    align-items: center;
    margin-bottom: 30px;
}
.sb-logo img {
    height: 36px;
    width: auto;
}
.sb-new-btn {
    width: 100%;
    background: var(--ep-white);
    border: 1px solid var(--ep-dark-60);
    color: var(--ep-dark-80);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background .15s;
    font-family: inherit;
    text-align: left;
}
.sb-new-btn:hover, .sb-new-btn:focus {
    background: var(--ep-bg);
    border-color: var(--ep-dark);
    color: var(--ep-text);
}
.sb-new-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}
.sb-label {
    font-size: 1rem;
    font-variation-settings: "wght" var(--text-wght-m);
    color: var(--ep-text);
    padding: 14px 12px 6px;
}
.sb-body {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--ep-border) transparent;
}
.h-item {
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background .12s;
    margin-bottom: 10px;
}
.h-item:hover, .h-item:focus {
    background: var(--sb-hover);
}
.h-item.active {
    background: var(--ep-white);
}
.h-title {
    font-size: 0.85rem;
    color: var(--ep-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.h-item.active .h-title {
    color: var(--ep-text);
    font-family: europeavar, sans-serif;
    font-variation-settings: "wght" var(--text-wght-r);
}
.h-meta {
    font-size: 12px;
    color: var(--ep-dark-60);
    margin-top: 2px;
}
.sb-empty {
    padding: 6px 12px;
    color: var(--ep-dark-60);
    font-size: 0.85rem;
    /*background-color: var(--ep-white);*/
    border-radius: var(--radius-sm);
}
.footer-sepa {
    display: block;
    margin: 0 0 5px 0;
    background-color: var(--ep-dark-60);
    width: 100%;
    height: 1px;
    border: 0;
}
.sb-footer {
    padding: 12px 20px;
    display: flex;
    gap: 15px;
    flex-direction: column;
    align-items: flex-start;
}
.sb-footer-badge {
    color: var(--ep-text);
    font-size: 0.8rem;
    padding: 2px 8px;
    background-color: var(--ep-white);
    border-radius: var(--radius-xs);
    border: solid 1px var(--ep-dark-60);
}
.sb-footer-text {
    font-size: 0.85rem;
    color: var(--ep-text);
}
.sb-footer-text a {
    color: var(--ep-text);
    font-variation-settings: "wght" var(--text-wght-m);
    text-decoration: none;
}
.sb-footer-text a:hover, .sb-footer-text a:focus {
    text-decoration: underline;
}

/* ─── Main ─── */

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-width: 0;
    background: var(--ep-white);
}
.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--ep-border) transparent;
}
.chat-inner {
    max-width: 780px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ─── Welcome ─── */

.welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 200px);
    text-align: center;
    padding: 40px 20px;
}
.wl-logo {
    margin-bottom: 24px;
}
.wl-logo img {
    height: 72px;
    width: auto;
}
.welcome h1 {
    font-size: 1.8rem;
    font-family: europeavar, sans-serif;
    font-variation-settings: "wght" 600,"opsz" 80;
    color: var(--ep-dark);
    margin-bottom: 8px;
}
.welcome p {
    font-size: 1.1rem;
    color: var(--ep-text);
    max-width: 780px;
    line-height: 1.6;
    margin-bottom: 60px;
}
.wl-input-wrap {
    width: 100%;
    max-width: 780px;
    background: var(--ep-white);
    border: 1.5px solid var(--ep-border);
    border-radius: var(--radius-md);
    box-shadow: none;
    transition: border-color .15s, box-shadow .15s;
    overflow: hidden;
    margin-bottom: 32px;
}
.wl-input-wrap:focus-within {
    outline: solid 2px var(--ep-blue-light);
    outline-offset: 2px;
    box-shadow: 0 2px 12px rgba(14, 71, 203, .08);
}
.wl-input-row {
    display: flex;
    align-items: flex-end;
    padding: 6px 6px 6px 12px;
}
.wl-input-row textarea {
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--ep-dark);
    resize: none;
    max-height: 160px;
    min-height: 28px;
    margin-right: 16px;
}
#welcomeInput::placeholder {
    color: var(--ep-dark-60);
}
.wl-input-footer {
    padding: 0 14px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.wl-input-hint {
    font-size: 11.5px;
    color: var(--ep-dark-60);
}

/* Welcome cards — lien avec flèche (style XD) */

.wl-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
    max-width: 780px;
}
.wl-card {
    display: flex;
    flex-direction: column;
    background: var(--ep-white);
    border: 1px solid var(--ep-border-light);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    font-family: europeavar, sans-serif;
    font-variation-settings: "wght" 600,"opsz" 80;
    text-align: left;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}
.wl-card:hover, .wl-card:focus {
    border-color: var(--ep-dark);
    box-shadow: 0 2px 8px rgba(14, 71, 203, .07);
}
.wl-card .wl-card-title {
    font-size: 1.1rem;
    color: var(--ep-blue);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.wl-card:hover .wl-card-title span, .wl-card:focus .wl-card-title span {
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-thickness: 2px;
}
.wl-card-title::after {
    content: "→";
    font-size: 1.5rem;
    font-weight: 400;
}
.wl-card-desc {
    font-family: europeavar, sans-serif;
    font-variation-settings: "wght" var(--text-wght-r);
    color: var(--ep-text);
    font-size: 0.9rem;
    line-height: 1.45;
}
/* ─── Messages ─── */

.msg-group {
    margin-bottom: 20px;
    animation: fadeUp .25s ease both;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.msg-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 4px;
}
.msg-row.user {
    flex-direction: row-reverse;
}
.msg-av {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .3px;
    margin-top: 2px;
}
.msg-av.ai {
    background: var(--ep-blue);
    color: var(--ep-white);
}
.msg-av.user {
    background: var(--ep-dark);
    color: var(--ep-white);
}
.bubble {
    max-width: 80%;
    padding: 12px;
    border-radius: var(--radius-lg);
    line-height: 1.65;
    font-size: 15px;
}
.bubble.ai {
    background: var(--ep-white);
    color: var(--ep-dark);
    border: 1px solid var(--ep-border-light);
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .04), 0 4px 12px rgba(0, 0, 0, .03);
}

.bubble.user {
    /*background: var(--ep-blue);
    color: var(--ep-white);
    border-bottom-right-radius: 4px;*/
    color: var(--ep-text);
    border-bottom-right-radius: 4px;
    padding: 12px 0;
}
.msg-acts {
    display: flex;
    gap: 4px;
    margin-top: 4px;
    padding: 0 42px;
    opacity: 0;
    transition: opacity .15s;
}
.msg-group:hover .msg-acts {
    opacity: 1;
}
.msg-acts.user {
    justify-content: flex-end;
}
.act-btn {
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--ep-border-light);
    background: var(--ep-white);
    color: var(--ep-dark-60);
    font-size: 12px;
    cursor: pointer;
    transition: all .12s;
}
.act-btn:hover {
    border-color: var(--ep-border);
    color: var(--ep-dark);
}

/* ─── Typing indicator ─── */

.typing-ind {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
}
.typing-bub {
    background: var(--ep-white);
    border: 1px solid var(--ep-border-light);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    padding: 14px 18px;
    display: flex;
    gap: 5px;
    align-items: center;
}
.typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ep-dark-60);
    animation: tpulse 1.4s ease infinite;
}
.typing-dot:nth-child(2) {
    animation-delay: .2s;
}
.typing-dot:nth-child(3) {
    animation-delay: .4s;
}
@keyframes tpulse {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: .4;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

/* ─── Briefing ─── */

.briefing-shell {
    background: var(--ep-white);
    border: 1.5px solid var(--ep-border-light);
    border-radius: var(--radius-lg);
    padding: 24px 24px 18px;
    margin: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .04), 0 4px 12px rgba(0, 0, 0, .03);
}
.briefing-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--ep-border-light);
}
.briefing-title {
    font-size: 1.2rem;
    font-variation-settings: "wght" 600,"opsz" 80;
    color: var(--ep-blue-dark);
    letter-spacing: -.2px;
}
.briefing-count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #edf7f0;
    color: var(--ep-text);
    border: 1px solid #cce8d5;
    font-size: 0.8rem;
    font-variation-settings: "wght" 600,"opsz" 80;
    white-space: nowrap;
}
.briefing-section {
    padding: 14px 0 6px;
}
.briefing-section + .briefing-section {
    border-top: 1px solid var(--ep-border-light);
}
.briefing-intro {
    font-size: 15px;
    color: var(--ep-dark);
    line-height: 1.75;
    margin: 0 0 16px;
    padding: 0 0 14px;
    border-bottom: 1px solid var(--ep-border-light);
}
.briefing-section-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.briefing-section-num {
    min-width: 26px;
    height: 26px;
    border-radius: 999px;
    background: var(--ep-blue-bg);
    color: var(--ep-blue);
    border: solid 1px var(--ep-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
}
.briefing-section-title {
    font-size: 1rem;
    font-variation-settings: "wght" 600,"opsz" 80;
    color: var(--ep-blue-dark);
    line-height: 1.35;
}
.briefing-paragraph {
    font-size: 15px;
    color: var(--ep-dark-80);
    line-height: 1.75;
    margin: 0 0 10px;
}
.briefing-source {
    margin: 10px 0 18px;
    font-size: 0.85rem;
    color: var(--ep-dark-80);
    line-height: 1.55;
}
.briefing-source a {
    color: var(--ep-blue);
    text-decoration: underline;
}
.briefing-source a:hover, .briefing-source a:focus {
    text-decoration-thickness: 2px;
}
.briefing-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 8px;
}

/* ─── Chat sources ─── */

.chat-answer-heading {
    font-size: 1rem;
    font-variation-settings: "wght" 600,"opsz" 80;
    color: var(--ep-blue-dark);
    margin: 14px 0 6px;
    padding-bottom: 4px;
    border-bottom: 1.5px solid var(--ep-blue-bg);
}
.chat-answer-heading:first-child {
    margin-top: 0;
}
.chat-answer-para {
    margin: 0 0 8px;
    line-height: 1.7;
}
.chat-answer-list {
    margin: 4px 0 10px 6px;
    padding-left: 16px;
    line-height: 1.7;
}
.chat-answer-list li {
    margin-bottom: 4px;
}
.chat-answer-list-num {
    list-style: decimal;
}
.chat-sources {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--ep-border-light);
}
.chat-sources-label {
    font-size: 0.85rem;
    font-variation-settings: "wght" 600,"opsz" 80;
    color: var(--ep-dark-80);
    margin-bottom: 6px;
}
.chat-source-item {
    font-size: 0.85rem;
    color: var(--ep-dark-60);
    line-height: 1.5;
    margin-bottom: 3px;
}
.chat-source-item a {
    color: var(--ep-blue);
    text-decoration: none;
}
.chat-source-item a:hover {
    text-decoration: underline;
}
.evidence-badge {
    display: inline;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--ep-blue);
    background: var(--ep-blue-bg);
    padding: 1px 5px;
    border-radius: 4px;
    text-decoration: none;
    transition: background .12s, color .12s;
}
a.evidence-badge:hover {
    background: var(--ep-blue);
    color: var(--ep-white);
    cursor: pointer;
}

/* ─── Quote toggle ─── */

.quote-toggle {
    margin: 8px 0 18px;
    border: 1px solid var(--ep-border);
    border-radius: var(--radius-md);
    background: var(--ep-white);
}
.quote-toggle summary {
    position: relative;
    cursor: pointer;
    list-style: none;
    padding: 10px 14px;
    font-size: 0.9rem;
    font-variation-settings: "wght" 600,"opsz" 80;
    color: var(--ep-text);
    border-bottom: solid 1px transparent;
    display: flex;
    align-items: center;
    gap: 6px;
}
.quote-toggle[open] summary {
    border-bottom: solid 1px var(--ep-border);
    background-color: var(--ep-blue-lighter);
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-md);
}
.quote-toggle summary:focus {
    outline-offset: 0 !important;
}
.quote-toggle summary::-webkit-details-marker {
    display: none;
}
.quote-toggle summary::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    position: absolute;
    right: 10px;
    transition: transform .15s;
    /* SVG encoded injected here as bg */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpolygon points='12 17.6 4.22 9.82 5.64 8.4 12 14.77 18.36 8.41 19.78 9.82 12 17.6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
}
.quote-toggle[open] summary::before {
    transform: rotate(180deg);
}
.quote-content {
    padding: 0 14px 14px;
}
.quote-text {
    font-size: 15px;
    color: var(--ep-dark);
    line-height: 1.7;
    border-left: 3px solid var(--ep-blue);
    padding-left: 12px;
    margin-top: 12px;
}

/* ─── Topics summary ─── */

.topics-summary-card {
    border: 1px solid var(--ep-border-light);
    background: var(--ep-white);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .04), 0 4px 12px rgba(0, 0, 0, .03);
}
.topics-summary-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.topics-summary-title {
    font-size: 1.2rem;
    font-variation-settings: "wght" 600,"opsz" 80;
    color: var(--ep-text);
}
.topics-summary-intro {
    color: var(--ep-dark);
    font-size: 14px;
    line-height: 1.55;
    margin: 0 0 12px;
}
.topics-clean-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}
.topic-clean-item {
    border: 1px solid var(--ep-border-light);
    border-radius: var(--radius-lg);
    background: var(--ep-bg);
    padding: 12px 14px;
}
.topic-clean-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.topic-clean-num {
    min-width: 24px;
    height: 24px;
    border-radius: 999px;
    background: var(--ep-blue-bg);
    color: var(--ep-blue);
    border: solid 1px var(--ep-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    margin-top: 1px;
}
.topic-clean-main {
    flex: 1;
    min-width: 0;
}
.topic-clean-title {
    font-size: 0.95rem;
    font-variation-settings: "wght" 600,"opsz" 80;
    color: var(--ep-dark);
    line-height: 1.35;
}
.topic-clean-rationale {
    margin-top: 4px;
    font-size: 0.9rem;
    color: var(--ep-dark-80);
    line-height: 1.45;
}
.topic-clean-meta {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--ep-dark-60);
}

/* ─── Input area ─── */

.input-area {
    padding: 30px 16px 28px;
    background: var(--ep-white);
    flex-shrink: 0;
    display: none;
}
.input-area.visible {
    display: block;
}
.input-wrap {
    max-width: 780px;
    margin: 0 auto;
    background: var(--ep-white);
    border: 1.5px solid var(--ep-border);
    border-radius: var(--radius-md);
    box-shadow: none;
    transition: border-color .15s, box-shadow .15s;
    overflow: hidden;
}
.input-wrap:focus-within {
    border-color: var(--ep-blue-light);
    box-shadow: 0 2px 12px rgba(14, 71, 203, .08);
}
.input-row {
    display: flex;
    align-items: flex-end;
    padding: 6px 6px 6px 12px;
}
.input-row textarea {
    font-family: europeavar, sans-serif;
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 0.9rem;
    color: var(--ep-dark);
    resize: none;
    max-height: 160px;
    min-height: 28px;
    margin-right: 16px;
}
.input-row textarea::placeholder {
    color: #ADADAD;
}
.send-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: none;
    background: var(--ep-blue);
    color: var(--ep-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .12s, transform .1s;
}
.send-btn:hover:not(:disabled) {
    background: var(--ep-blue-dark);
    transform: scale(1.05);
}
.send-btn:disabled {
    background: var(--ep-border);
    color: var(--ep-dark-60);
    cursor: not-allowed;
}
.send-btn svg {
    width: 16px;
    height: 16px;
}
.input-footer {
    padding: 0 14px 10px;
    display: flex;
    align-items: center;
}
.input-hint {
    flex: 1;
    text-align: right;
    font-size: 11.5px;
    color: var(--ep-dark-60);
}

/* Media Queries */
