/* ===== Design Tokens ===== */
:root {
    /* Primary palette */
    --color-primary: #2a5298;
    --color-primary-dark: #1e3a5f;
    --color-primary-light: #3b82f6;

    /* Backgrounds */
    --color-bg: #f5f7fa;
    --color-bg-white: #ffffff;
    --color-bg-user-bubble: #2a5298;
    --color-bg-assistant-bubble: #ffffff;
    --color-bg-error: #fef2f2;
    --color-bg-service-card: #f0f7ff;
    --color-bg-service-card-hover: #dbeafe;

    /* Text */
    --color-text-primary: #1a1a2e;
    --color-text-secondary: #4b5563;
    --color-text-inverse: #ffffff;
    --color-text-error: #b91c1c;
    --color-text-link: #2563eb;

    /* Borders */
    --color-border: #dde1e6;
    --color-border-light: #e5e7eb;
    --color-border-error: #fca5a5;
    --color-border-focus: #3b82f6;

    /* Provider badges */
    --color-badge-borger-bg: #e0f2fe;
    --color-badge-borger-text: #0369a1;
    --color-badge-sundhed-bg: #dcfce7;
    --color-badge-sundhed-text: #15803d;
    --color-badge-default-bg: #f3f4f6;
    --color-badge-default-text: #4b5563;

    /* Typography */
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-size-base: 16px;
    --line-height-base: 1.5;

    /* Spacing & sizing */
    --max-width-conversation: 800px;
    --border-radius: 0.75rem;
    --transition-speed: 150ms;
    --animation-speed: 250ms;
}

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

html, body {
    height: 100%;
    font-family: var(--font-stack);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    color: var(--color-text-primary);
    background: var(--color-bg);
}

body {
    display: flex;
    flex-direction: column;
}

/* ===== Header ===== */
.header {
    background: linear-gradient(135deg, var(--color-primary-dark), var(--color-primary));
    color: var(--color-text-inverse);
    padding: 0.75rem 1rem;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: var(--max-width-conversation);
    margin: 0 auto;
}

.header-nav {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

.nav-link {
    color: var(--color-text-inverse);
    text-decoration: none;
    font-size: 0.8rem;
    padding: 0.35rem 0.65rem;
    border-radius: 0.4rem;
    opacity: 0.85;
    transition: opacity var(--transition-speed), background var(--transition-speed);
}

.nav-link:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.15);
}

.header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
}

.header-text {
    display: flex;
    flex-direction: column;
}

.header-title {
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.3;
}

.header-subtitle {
    font-size: 0.8rem;
    opacity: 0.85;
    line-height: 1.3;
}

/* ===== Main / Conversation ===== */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

#conversation {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* ===== Messages ===== */
.message {
    display: flex;
    max-width: 80%;
}

.message-user {
    align-self: flex-end;
}

.message-assistant {
    align-self: flex-start;
}

.message-error {
    align-self: center;
    max-width: 90%;
}

.bubble {
    padding: 0.6rem 0.9rem;
    border-radius: 0.75rem;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.message-user .bubble {
    background: var(--color-bg-user-bubble);
    color: var(--color-text-inverse);
    border-bottom-right-radius: 0.2rem;
}

.message-assistant .bubble {
    background: var(--color-bg-assistant-bubble);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    border-bottom-left-radius: 0.2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.message-error .bubble {
    background: var(--color-bg-error);
    color: var(--color-text-error);
    border: 1px solid var(--color-border-error);
    font-size: 0.9rem;
}

/* ===== Assistant Label ===== */
.assistant-label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 0.3rem;
}

.assistant-icon {
    display: inline-flex;
    align-items: center;
}

.bubble-content {
    white-space: pre-wrap;
}

/* ===== Error Icon ===== */
.error-icon {
    margin-right: 0.3rem;
}

/* ===== Message Entrance Animation ===== */
@keyframes bubble-enter {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bubble-enter {
    animation: bubble-enter var(--animation-speed) ease-out;
}

/* ===== Citations ===== */
.citations {
    margin-top: 0.5rem;
    padding-top: 0.4rem;
    border-top: 1px solid #e5e7eb;
    font-size: 0.85rem;
}

.section-heading {
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 0.25rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.citations ul {
    list-style: none;
    padding: 0;
}

.citations li {
    margin-bottom: 0.2rem;
}

.citations a {
    color: #2563eb;
    text-decoration: none;
}

.citations a:hover {
    text-decoration: underline;
}

.citation-title {
    margin-right: 0.4rem;
}

.provider-badge {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.72rem;
    font-weight: 600;
    vertical-align: middle;
}

.provider-borger {
    background: var(--color-badge-borger-bg);
    color: var(--color-badge-borger-text);
}

.provider-sundhed {
    background: var(--color-badge-sundhed-bg);
    color: var(--color-badge-sundhed-text);
}

.provider-default {
    background: var(--color-badge-default-bg);
    color: var(--color-badge-default-text);
}

/* ===== Self-Service Links ===== */
.self-service-links {
    margin-top: 0.5rem;
    padding-top: 0.4rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.service-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.7rem;
    background: var(--color-bg-service-card);
    border: 1px solid #bfdbfe;
    border-radius: 0.5rem;
    text-decoration: none;
    color: inherit;
    transition: background var(--transition-speed), transform var(--transition-speed), box-shadow var(--transition-speed);
}

.service-card:hover {
    background: var(--color-bg-service-card-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.service-card:focus {
    outline: 2px solid var(--color-border-focus);
    outline-offset: 2px;
}

.service-card-content {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.service-card-title {
    color: #1d4ed8;
    font-size: 0.88rem;
}

.service-desc {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    margin-top: 0.1rem;
}

.service-card-arrow {
    font-size: 1.1rem;
    color: var(--color-text-secondary);
    margin-left: 0.5rem;
    flex-shrink: 0;
}

/* ===== Typing Indicator ===== */
.typing-dots {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0;
}

.typing-dots span {
    display: block;
    width: 8px;
    height: 8px;
    background: var(--color-text-secondary);
    border-radius: 50%;
    animation: dot-pulse 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dot-pulse {
    0%, 80%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    40% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ===== Footer / Input Bar ===== */
.input-bar {
    flex-shrink: 0;
    background: var(--color-bg-white);
    border-top: 1px solid var(--color-border);
    padding: 0.6rem 1rem;
    position: sticky;
    bottom: 0;
}

#chat-form {
    display: flex;
    gap: 0.5rem;
    max-width: var(--max-width-conversation);
    margin: 0 auto;
}

#message-input {
    flex: 1;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--color-border-light);
    border-radius: 1.5rem;
    font-size: 0.95rem;
    outline: none;
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

#message-input:focus {
    border-color: var(--color-border-focus);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

#message-input:disabled {
    background: #f1f5f9;
}

#send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    background: var(--color-primary-light);
    color: var(--color-text-inverse);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background var(--transition-speed), opacity var(--transition-speed);
}

#send-btn:hover {
    background: var(--color-primary);
}

#send-btn:focus {
    outline: 2px solid var(--color-border-focus);
    outline-offset: 2px;
}

#send-btn:disabled {
    background: #93c5fd;
    cursor: not-allowed;
}

/* ===== Welcome State ===== */
.welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 1rem;
    gap: 1rem;
}

.welcome-icon {
    color: var(--color-primary);
    opacity: 0.8;
}

.welcome-heading {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.welcome-description {
    font-size: 0.95rem;
    color: var(--color-text-secondary);
    max-width: 400px;
}

.suggested-prompts {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.prompt-chip {
    padding: 0.5rem 1rem;
    background: var(--color-bg-white);
    border: 1px solid var(--color-border);
    border-radius: 2rem;
    font-size: 0.88rem;
    color: var(--color-text-primary);
    cursor: pointer;
    transition: background var(--transition-speed), border-color var(--transition-speed);
}

.prompt-chip:hover {
    background: var(--color-bg-service-card);
    border-color: var(--color-primary-light);
}

.prompt-chip:focus {
    outline: 2px solid var(--color-border-focus);
    outline-offset: 2px;
}

/* ===== Utility ===== */
.hidden {
    display: none;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .message {
        max-width: 95%;
    }

    .service-card {
        width: 100%;
    }

    .header-title {
        font-size: 1rem;
    }

    #message-input {
        font-size: 0.9rem;
    }
}

@media (min-width: 769px) {
    #conversation {
        max-width: var(--max-width-conversation);
        margin: 0 auto;
        width: 100%;
    }
}

/* ===== Stage Indicator (SSE streaming) ===== */
.stage-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0;
}

.stage-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--color-border-light);
    border-top-color: var(--color-primary-light);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.stage-label {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    transition: opacity var(--animation-speed) ease-in-out;
}

.stage-label.fade-out {
    opacity: 0;
}

.stage-label.fade-in {
    opacity: 1;
}

/* Duration shown next to trace link */
.trace-duration {
    font-size: 0.65rem;
    color: #999;
    font-family: monospace;
}

/* ===== Progress Checklist (SSE streaming) ===== */

/* Container */
.progress-checklist {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
}

/* Stage list wrapper — collapse/expand via max-height */
.progress-stages {
    overflow: hidden;
    max-height: 600px;
    transition: max-height 400ms ease, opacity 250ms ease;
    opacity: 1;
}

.progress-stages.collapsed {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
}

/* Individual stage row */
.progress-stage {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    animation: stage-enter var(--animation-speed) ease-out both;
}

/* Stage entrance animation — slide down + fade in */
@keyframes stage-enter {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stage icon — spinner or checkmark */
.progress-stage-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    transition: transform var(--animation-speed) ease, opacity var(--animation-speed) ease;
}

/* Spinner reuses existing @keyframes spin */
.progress-stage-icon .stage-spinner {
    width: 14px;
    height: 14px;
    border-width: 2px;
}

/* Checkmark icon */
.progress-stage-icon .checkmark {
    color: #16a34a;
    font-size: 0.9rem;
    line-height: 1;
}

/* Stage label */
.progress-stage-label {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Active stage pulse — subtle opacity flicker on the pending step */
@keyframes stage-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.progress-stage--active .progress-stage-label {
    animation: stage-pulse 2s ease-in-out infinite;
}

.progress-stage--active .progress-stage-timer {
    animation: stage-pulse 2s ease-in-out infinite;
}

/* Provider-colored progress stages */
.progress-stage--borger .progress-stage-label {
    color: var(--color-badge-borger-text);
}
.progress-stage--borger .progress-stage-icon {
    color: var(--color-badge-borger-text);
}
.progress-stage--sundhed .progress-stage-label {
    color: var(--color-badge-sundhed-text);
}
.progress-stage--sundhed .progress-stage-icon {
    color: var(--color-badge-sundhed-text);
}

/* Live timer — tabular nums prevent layout shifts (Req 5.4) */
.progress-stage-timer {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    opacity: 0.7;
    font-variant-numeric: tabular-nums;
    font-family: var(--font-stack);
    min-width: 3.2em;
    text-align: right;
    flex-shrink: 0;
}

/* ===== Collapsed Summary ===== */
.progress-summary {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.1rem;
    font-size: 0.82rem;
    color: var(--color-text-secondary);
    cursor: pointer;
    border: none;
    background: none;
    border-radius: 0.4rem;
    transition: background var(--transition-speed);
    user-select: none;
}

.progress-summary:hover {
    background: rgba(0, 0, 0, 0.03);
}

.progress-summary:focus-visible {
    outline: 2px solid var(--color-border-focus);
    outline-offset: 2px;
}

.progress-summary-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #16a34a;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.progress-summary-text {
    flex: 1;
}

.progress-summary-chevron {
    display: inline-flex;
    align-items: center;
    font-size: 0.9rem;
    transition: transform 300ms ease;
    flex-shrink: 0;
}

.progress-summary--expanded .progress-summary-chevron {
    transform: rotate(90deg);
}

/* ===== Streaming Text Shimmer ===== */
@keyframes text-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.bubble-content.streaming-in {
    background: linear-gradient(
        90deg,
        var(--color-text-primary) 40%,
        var(--color-text-secondary) 50%,
        var(--color-text-primary) 60%
    );
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: text-shimmer 1.5s ease-in-out;
}

/* ===== Validation Site v2 — Modern Redesign ===== */

/* --- Page shell --- */
body.validation-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background: #f0f2f5;
    font-family: var(--font-stack);
    color: var(--color-text-primary);
}

/* --- Top bar --- */
.v-topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.25rem;
    height: 52px;
    background: var(--color-bg-white);
    border-bottom: 1px solid var(--color-border-light);
    flex-shrink: 0;
    z-index: 10;
}

.v-topbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--color-primary);
    text-decoration: none;
    letter-spacing: -0.01em;
}
.v-topbar-brand:hover { opacity: 0.8; }
.v-topbar-brand svg { opacity: 0.7; }

.v-topbar-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

.v-trace-badge {
    font-size: 0.72rem;
    font-family: "SF Mono", "Fira Code", monospace;
    background: var(--color-bg);
    color: var(--color-text-secondary);
    padding: 0.2rem 0.55rem;
    border-radius: 100px;
    letter-spacing: 0.02em;
}
.v-trace-badge:empty { display: none; }

.v-nav-counter {
    font-size: 0.78rem;
    color: var(--color-text-secondary);
    font-variant-numeric: tabular-nums;
    min-width: 3rem;
    text-align: center;
}

.v-topbar-nav {
    display: flex;
    gap: 0.35rem;
}

.v-nav-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--color-border-light);
    border-radius: 100px;
    background: var(--color-bg-white);
    color: var(--color-text-secondary);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 150ms ease;
}
.v-nav-pill:hover:not(:disabled) {
    background: var(--color-bg);
    border-color: var(--color-primary-light);
    color: var(--color-primary);
}
.v-nav-pill:disabled { opacity: 0.3; cursor: not-allowed; }
.v-nav-pill:focus-visible { outline: 2px solid var(--color-border-focus); outline-offset: 1px; }
.v-nav-pill svg { flex-shrink: 0; }

/* --- Two-panel layout --- */
.v-layout {
    flex: 1;
    display: flex;
    overflow: hidden;
    gap: 0;
}

/* --- Sidebar: conversation browser --- */

.v-sidebar {
    flex: 0 0 280px;
    display: flex;
    flex-direction: column;
    background: var(--color-bg-white);
    border-right: 1px solid var(--color-border-light);
    overflow: hidden;
    min-height: 0;
    min-width: 180px;
    max-width: 450px;
    resize: horizontal;
}

.v-sidebar-header {
    padding: 0.65rem;
    border-bottom: 1px solid var(--color-border-light);
    flex-shrink: 0;
}

.v-search-box {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--color-bg);
    border: 1.5px solid var(--color-border-light);
    border-radius: 0.5rem;
    padding: 0.4rem 0.6rem;
    transition: border-color 150ms, box-shadow 150ms;
}
.v-search-box:focus-within {
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.v-search-icon { color: var(--color-text-secondary); opacity: 0.5; flex-shrink: 0; }

.v-search-input {
    border: none;
    background: transparent;
    font-family: var(--font-stack);
    font-size: 0.8rem;
    color: var(--color-text-primary);
    outline: none;
    width: 100%;
}
.v-search-input::placeholder { color: var(--color-text-secondary); opacity: 0.6; }

.v-sidebar-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.35rem;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.v-sidebar-footer {
    padding: 0.4rem 0.65rem;
    border-top: 1px solid var(--color-border-light);
    flex-shrink: 0;
}

.v-list-count {
    font-size: 0.7rem;
    color: var(--color-text-secondary);
}

/* Sidebar items */
.v-sidebar-item {
    position: relative;
    padding: 0.55rem 0.65rem;
    border-radius: 0.45rem;
    cursor: pointer;
    transition: background 100ms ease;
    margin-bottom: 2px;
}
.v-sidebar-item:hover { background: var(--color-bg); }
.v-sidebar-item.active {
    background: rgba(59, 130, 246, 0.08);
    box-shadow: inset 3px 0 0 var(--color-primary-light);
}

.v-sidebar-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.15rem;
}

.v-sidebar-item-id {
    font-size: 0.68rem;
    font-family: "SF Mono", "Fira Code", monospace;
    color: var(--color-primary);
    font-weight: 600;
}

.v-sidebar-item-ts {
    font-size: 0.65rem;
    color: var(--color-text-secondary);
}

.v-sidebar-item-query {
    font-size: 0.78rem;
    color: var(--color-text-primary);
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.v-sidebar-item-badge {
    position: absolute;
    top: 0.45rem;
    right: 0.45rem;
    font-size: 0.6rem;
    color: #16a34a;
    font-weight: 700;
}

/* Per-message evaluated indicator in sidebar */
.v-sidebar-item.evaluated .v-sidebar-item-id::after {
    content: " ✓";
    color: #16a34a;
    font-weight: 700;
}

.v-empty-state--small {
    padding: 1.5rem 0.5rem;
    font-size: 0.82rem;
}

/* --- Conversation panel --- */
.v-conversation {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    background: var(--color-bg-white);
    overflow: hidden;
    min-width: 250px;
    min-height: 0;
}

.v-conversation-inner {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.v-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
}

.v-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    height: 100%;
    color: var(--color-text-secondary);
    font-size: 0.88rem;
}

/* --- Chat messages --- */
.v-msg {
    display: flex;
    gap: 0.65rem;
    max-width: 92%;
    animation: v-fade-in 200ms ease;
}
.v-msg--user { align-self: flex-end; flex-direction: row-reverse; }
.v-msg--bot  { align-self: flex-start; }

@keyframes v-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.v-msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
    margin-top: 0.15rem;
}

.v-msg-bubble {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.v-msg-role {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-secondary);
    padding: 0 0.15rem;
}
.v-msg--user .v-msg-role { text-align: right; }

.v-msg-text {
    padding: 0.65rem 0.9rem;
    border-radius: 1rem;
    line-height: 1.55;
    font-size: 0.88rem;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Selected/highlighted message pair */
.v-msg.v-msg--highlighted .v-msg-text {
    outline: 2px solid var(--color-primary-light);
    outline-offset: 2px;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.15);
}

.v-msg--user .v-msg-text {
    background: var(--color-primary);
    color: var(--color-text-inverse);
    border-bottom-right-radius: 0.25rem;
}

.v-msg--bot .v-msg-text {
    background: var(--color-bg);
    color: var(--color-text-primary);
    border-bottom-left-radius: 0.25rem;
}

/* --- Evaluation panel --- */
.v-eval {
    flex: 0 0 380px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #f8f9fb;
    min-width: 280px;
    max-width: 550px;
    min-height: 0;
    resize: horizontal;
    direction: rtl; /* resize handle on left side */
}
.v-eval > * { direction: ltr; } /* reset text direction for children */

.v-eval-inner {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 1.5rem 2rem;
}

.v-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* --- Category cards --- */
.v-category {
    background: var(--color-bg-white);
    border: 1px solid var(--color-border-light);
    border-radius: 0.65rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.v-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.85rem;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border-light);
}

.v-category-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--color-text-primary);
    letter-spacing: -0.01em;
}

.v-category-badge {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--color-primary);
    background: rgba(59, 130, 246, 0.08);
    padding: 0.15rem 0.5rem;
    border-radius: 100px;
}

/* --- Parameter rows --- */
.v-param {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.85rem;
    gap: 0.75rem;
    transition: background 100ms ease;
}
.v-param:hover { background: rgba(0,0,0,0.015); }
.v-param + .v-param { border-top: 1px solid #f0f1f3; }

.v-param-info {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1;
    min-width: 0;
}

.v-param-code {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--color-primary);
    background: rgba(59, 130, 246, 0.06);
    padding: 0.1rem 0.35rem;
    border-radius: 0.25rem;
    flex-shrink: 0;
    font-family: "SF Mono", "Fira Code", monospace;
}

.v-param-name {
    font-size: 0.82rem;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Rating chips --- */
.v-rating-group {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.v-chip {
    min-width: 2rem;
    height: 1.85rem;
    padding: 0 0.55rem;
    border: 1.5px solid var(--color-border);
    border-radius: 100px;
    background: var(--color-bg-white);
    color: var(--color-text-secondary);
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 150ms ease;
    user-select: none;
}
.v-chip:hover {
    border-color: var(--color-primary-light);
    color: var(--color-primary);
    background: rgba(59, 130, 246, 0.04);
}
.v-chip:focus-visible { outline: 2px solid var(--color-border-focus); outline-offset: 1px; }

/* Active states */
.v-chip--num.active {
    background: var(--color-primary-light);
    border-color: var(--color-primary-light);
    color: #fff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}
.v-chip--yes.active {
    background: #16a34a;
    border-color: #16a34a;
    color: #fff;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.25);
}
.v-chip--no.active {
    background: #ef4444;
    border-color: #ef4444;
    color: #fff;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

/* --- Feedback --- */
.v-feedback {
    margin-top: 0.25rem;
}

.v-feedback-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.v-textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1.5px solid var(--color-border-light);
    border-radius: 0.5rem;
    font-family: var(--font-stack);
    font-size: 0.85rem;
    line-height: 1.5;
    resize: vertical;
    background: var(--color-bg-white);
    transition: border-color 150ms, box-shadow 150ms;
    box-sizing: border-box;
}
.v-textarea:focus {
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
    outline: none;
}

/* --- Submit row --- */
.v-submit-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.25rem;
}

.v-submit-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.25rem;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 150ms ease;
    box-shadow: 0 2px 8px rgba(42, 82, 152, 0.2);
}
.v-submit-btn:hover { background: var(--color-primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(42, 82, 152, 0.3); }
.v-submit-btn:active { transform: translateY(0); }
.v-submit-btn:disabled { opacity: 0.6; cursor: wait; transform: none; }
.v-submit-btn:focus-visible { outline: 2px solid var(--color-border-focus); outline-offset: 2px; }
.v-submit-btn svg { flex-shrink: 0; }

.v-score-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-primary);
    background: rgba(59, 130, 246, 0.08);
    padding: 0.35rem 0.75rem;
    border-radius: 100px;
    font-variant-numeric: tabular-nums;
}

/* --- Reference section --- */
.v-reference {
    margin-top: 1rem;
    border: 1px solid var(--color-border-light);
    border-radius: 0.65rem;
    background: var(--color-bg-white);
    overflow: hidden;
}

.v-reference-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 0.85rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    cursor: pointer;
    user-select: none;
    transition: color 150ms;
}
.v-reference-toggle:hover { color: var(--color-text-primary); }
.v-reference-toggle svg { opacity: 0.5; }

.v-reference-body { padding: 0 0.85rem 0.75rem; }

.v-ref-group { margin-bottom: 0.5rem; }
.v-ref-group-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-primary);
    margin-bottom: 0.25rem;
    padding-top: 0.35rem;
    border-top: 1px solid var(--color-border-light);
}
.v-ref-group:first-child .v-ref-group-title { border-top: none; padding-top: 0; }

.v-ref-item {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    padding: 0.15rem 0;
    flex-wrap: wrap;
}

.v-ref-code {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--color-primary);
    font-family: "SF Mono", "Fira Code", monospace;
    flex-shrink: 0;
}

.v-ref-name {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.v-ref-desc {
    font-size: 0.72rem;
    color: var(--color-text-secondary);
    line-height: 1.4;
    flex-basis: 100%;
    padding-left: 0;
}

/* --- Responsive --- */
@media (max-width: 1100px) {
    .v-eval { flex: 0 0 360px; }
}
@media (max-width: 900px) {
    .v-layout { flex-direction: column; overflow-y: auto; }
    .v-sidebar { flex: none; max-height: 200px; border-right: none; border-bottom: 1px solid var(--color-border-light); }
    .v-conversation { flex: none; max-height: 35vh; border-right: none; border-bottom: 1px solid var(--color-border-light); }
    .v-eval { flex: none; }
    .v-nav-pill-text { display: none; }
    .v-param { flex-wrap: wrap; }
    .v-param-info { flex-basis: 100%; }
}
