.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

:root {
    --paper: #f3f0e8;
    --paper-raised: #faf8f3;
    --ink: #243038;
    --ink-muted: #5c6a70;
    --teal: #1a6b63;
    --teal-deep: #0f3f3b;
    --mist: #d7e2de;
    --denied: #7a2e2e;
    --rule: rgba(36, 48, 56, 0.12);
    --shadow: 0 18px 40px rgba(15, 63, 59, 0.08);
}

html,
body {
    height: 100%;
    margin: 0;
    /*    background: var(--paper);*/
    color: var(--ink);
    font-family: "nunito", Calibri, sans-serif
}

.chat-frame {
    min-height: 100vh;
    height: 100vh;
    display: flex;
    flex-direction: column;
/*    background:
        radial-gradient(1200px 280px at 10% -10%, rgba(26, 107, 99, 0.08), transparent 55%),
        var(--paper);*/
}

.dossier {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-width: 42rem;
    width: 100%;
    margin: 0 auto;
}

.dossier-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.15rem 1.25rem 0.9rem;
    border-bottom: 1px solid var(--rule);
    flex: 0 0 auto;
}

.stimulus {
    flex: 0 0 auto;
    margin: 0.75rem 1.25rem 0;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--rule);
    border-radius: 10px;
    background: var(--paper-raised);
    max-height: 5.5rem;
    overflow: auto;
}

.stimulus-in-thread {
    align-self: stretch;
    max-width: 100%;
    margin: 0;
    max-height: none;
}

.stimulus-text,
.stimulus-ref {
    margin: 0;
    font-family: "nunito", Calibri, sans-serif;
    font-size: 0.92rem;
    line-height: 1.45;
    color: var(--ink);
    white-space: pre-line;
}

.stimulus-text p,
.stimulus-text ul,
.stimulus-text ol {
    margin: 0 0 0.55rem;
}

.stimulus-text p:last-child,
.stimulus-text ul:last-child,
.stimulus-text ol:last-child {
    margin-bottom: 0;
}

.stimulus-html {
    white-space: normal;
}

.stimulus-ref {
    margin-top: 0.55rem;
    color: var(--ink-muted);
}

.stimulus-image {
    display: block;
    max-width: 100%;
    max-height: 8rem;
    width: auto;
    height: auto;
    object-fit: contain;
    margin-top: 0.65rem;
    border-radius: 8px;
}

.eyebrow {
    margin: 0 0 0.2rem;
    font-family: "nunito", Calibri, sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--teal);
}

.dossier-header h1 {
    margin: 0;
    font-family: "nunito", Calibri, sans-serif;
    font-size: 1.85rem;
    font-weight: 650;
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: var(--teal-deep);
}

.ticks {
    display: flex;
    gap: 0.4rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ticks li {
    width: 0.42rem;
    height: 1.55rem;
    border-radius: 1px;
    background: var(--mist);
    transform: skewX(-12deg);
}

.ticks li.is-done {
    background: var(--teal);
}

.ticks li.is-current {
    background: var(--teal);
    box-shadow: 0 0 0 3px rgba(26, 107, 99, 0.18);
}

.thread {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 1.15rem 1.25rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.bubble {
    max-width: min(86%, 34rem);
    padding: 0.5rem 0.5rem;
    font-family: "nunito", Calibri, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
/*    white-space: pre-wrap;*/
    word-wrap: break-word;

}

.bubble-assistant {
    align-self: flex-start;
    background: #fff; /*var(--paper-raised);*/
    border: 1px solid var(--rule);
    border-radius: 2px 14px 14px 14px;
    box-shadow: var(--shadow);
    box-shadow: -11px 11px 4px rgba(15, 63, 59, 0.08)
}

.bubble-user {
    align-self: flex-end;
    background: #ffffff; /* var(--teal-deep);*/
    /*    color: #f4f7f6;*/
    border-radius: 14px 2px 14px 14px;
    border: 2px solid var(--rule);
    box-shadow: var(--shadow);
    box-shadow: 9px 8px 4px 0px rgba(15, 63, 59, 0.08)
}

.bubble-meta-assistant {
    display: block;
    margin-bottom: 0.28rem;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    /* opacity: 0.72;*/
    color: #ce102c
}

.bubble-meta-user {
    display: block;
    margin-bottom: 0.28rem;
    font-size: 0.68rem;
    font-weight: bold;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    /* opacity: 0.72;*/
    color: #6d6d6d
}

.bubble-theme {
    display: block;
    margin: -0.1rem 0 0.45rem;
    font-family: Figtree, "Segoe UI", sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--teal-deep);
}

.bubble-user .bubble-theme {
    color: #d7ebe6;
}

.typing {
    align-self: flex-start;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--ink-muted);
    font-family: Figtree, "Segoe UI", sans-serif;
    font-size: 0.88rem;
}

.typing-dots {
    display: inline-flex;
    gap: 0.22rem;
}

.typing-dots span {
    width: 0.38rem;
    height: 0.38rem;
    border-radius: 50%;
    background: var(--teal);
    animation: pulse 1.1s ease-in-out infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes pulse {
    0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-2px); }
}

.composer {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.65rem;
    padding: 0.85rem 1.25rem 1.1rem;
    border-top: 1px solid var(--rule);
/*    background: rgba(250, 248, 243, 0.9);*/
}

.composer-actions {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    align-self: end;
}

.composer-actions .composer-end {
    min-height: 2.35rem;
    background: transparent;
    color: black; /*var(--teal-deep)*/
    ;
    border: 1px solid black; /*var(--teal);*/
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
}

.composer textarea {
    resize: none;
    min-height: 3.1rem;
    max-height: 8rem;
    padding: 0.7rem 0.85rem;
    border: 1px solid black /*var(--rule)*/;
    border-radius: 2px;
    background: #fff;
    color: var(--ink);
    font-family: Figtree, "Segoe UI", sans-serif;
    font-size: 1rem;
    line-height: 1.4;
}

.composer textarea:focus {
    /*outline: 2px solid rgba(26, 107, 99, 0.35);*/
    outline-offset: 1px;
    border-color: red /*var(--teal);*/
}

.composer textarea:disabled {
    background: #eceae3;
    color: var(--ink-muted);
}

.composer button {
    align-self: end;
    min-height: 3.1rem;
    padding: 0 1.15rem;
    border: 0;
    border-radius: 2px;
    background: #292727; /*/var(--teal);*/
    color: #f7fbfa;
    font-family: Figtree, "Segoe UI", sans-serif;
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    width: 100%;
    transition: 0.5s all;
}

.composer button:hover:not(:disabled) {
    background:grey; /*var(--teal-deep);*/
    color : #ffffff;
    border-color: #ffffff;
}

.composer button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.closed-banner {
    flex: 0 0 auto;
    margin: 0 1.25rem 1.15rem;
    padding: 0.9rem 1rem;
    border-left: 3px solid #ce102c; /*var(--teal);*/
    /*    background: rgba(26, 107, 99, 0.08);*/
    font-family: Figtree, "Segoe UI", sans-serif;
    font-size: 0.98rem;
}

.closed-banner strong {
    font-family: Literata, Georgia, serif;
    font-weight: 650;
    display: block;
    margin-bottom: 0.15rem;
}

.error-inline {
    flex: 0 0 auto;
    margin: 0 1.25rem 0.85rem;
    padding: 0.75rem 0.9rem;
    border-left: 3px solid var(--denied);
    background: rgba(122, 46, 46, 0.08);
    color: var(--denied);
    font-family: Figtree, "Segoe UI", sans-serif;
    font-size: 0.92rem;
}

.error-inline .retry {
    display: inline-block;
    margin-left: 0.65rem;
    padding: 0.2rem 0.65rem;
    border: 1px solid var(--denied);
    border-radius: 2px;
    background: transparent;
    color: var(--denied);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.error-inline .retry:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.denied {
    margin: auto;
    max-width: 26rem;
    padding: 2rem 1.4rem;
    text-align: left;
}

.denied-stamp {
    display: inline-block;
    margin-bottom: 0.85rem;
    padding: 0.2rem 0.55rem;
    border: 2px solid var(--denied);
    color: var(--denied);
    font-family: Figtree, "Segoe UI", sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.denied h1 {
    margin: 0 0 0.55rem;
    font-family: Literata, Georgia, serif;
    font-size: 2rem;
    color: var(--teal-deep);
}

.denied p {
    margin: 0;
    font-family: Figtree, "Segoe UI", sans-serif;
    color: var(--ink-muted);
    line-height: 1.5;
}

#blazor-error-ui {
    background: #f7e27a;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    font-family: Figtree, "Segoe UI", sans-serif;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

@media (max-width: 640px) {
    .dossier-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .composer {
        grid-template-columns: 1fr;
    }

    .composer button {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .typing-dots span {
        animation: none;
    }
}
