body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #f0f4f4;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background: #0D1B2A;
    color: white;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 3px solid #0D9488;
    flex-shrink: 0;
}

header .icon {
    font-size: 24px;
}

header .titles h1 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: white;
}

header .titles p {
    font-size: 12px;
    color: #14B8A6;
    margin-top: 2px;
}

header .badge {
    margin-left: auto;
    background: #0F2433;
    border: 1px solid #0D9488;
    color: #14B8A6;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 20px;
}

.chat-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    box-sizing: border-box;
    background: #ffffff;
}

.welcome {
    background: transparent;
    padding: 4px 0;
    max-width: 680px;
}

.welcome h2 {
    font-size: 13px;
    color: #9CA3AF;
    margin-bottom: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.welcome p {
    font-size: 13px;
    color: #6B7280;
    line-height: 1.65;
    margin-bottom: 10px;
}

.welcome .chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.chip {
    background: #E0F2F1;
    color: #0D6E66;
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    border: none;
    transition: background 0.15s;
    font-family: inherit;
}

.chip:hover {
    background: #B2DFDB;
}

.message {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.message.user {
    flex-direction: row-reverse;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 2px;
}

.avatar.bot {
    background: #0D9488;
    color: white;
}

.avatar.user {
    background: #0D1B2A;
    color: white;
}

.bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.45;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.message.bot .bubble {
    background: white;
    color: #1E293B;
    border-radius: 4px 12px 12px 12px;
}

.message.user .bubble {
    background: #0D1B2A;
    color: white;
    border-radius: 12px 4px 12px 12px;
}

.bubble p {
    margin-bottom: 8px;
    margin-top: 0;
}

.bubble p:last-child {
    margin-bottom: 0;
}

.bubble strong {
    color: #0D6E66;
}

.message.user .bubble strong {
    color: #14B8A6;
}

.bubble ul {
    margin: 4px 0 4px 18px;
}

.bubble li {
    margin-bottom: 2px;
}

.bubble h4.bubble-h {
    color: #0D6E66;
    font-size: 14px;
    font-weight: 700;
    margin: 10px 0 2px;
}

.bubble h4.bubble-h:first-child {
    margin-top: 0;
}

.typing {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 14px 16px;
}

.typing span {
    width: 7px;
    height: 7px;
    background: #0D9488;
    border-radius: 50%;
    animation: bounce 1.2s infinite;
}

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

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

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-6px);
    }
}

.input-area {
    background: white;
    border-top: 1px solid #E5E7EB;
    padding: 16px 24px;
    flex-shrink: 0;
}

.input-row {
    max-width: 820px;
    margin: 0 auto;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

textarea {
    flex: 1;
    border: 1.5px solid #D1D5DB;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    line-height: 1.5;
    max-height: 120px;
    min-height: 44px;
    transition: border-color 0.15s;
}

textarea:focus {
    border-color: #0D9488;
}

textarea::placeholder {
    color: #9CA3AF;
}

button.send {
    background: #0D9488;
    color: white;
    border: none;
    border-radius: 10px;
    width: 44px;
    height: 44px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    flex-shrink: 0;
}

button.send:hover {
    background: #0F766E;
}

button.send:disabled {
    background: #9CA3AF;
    cursor: not-allowed;
}

.footer-note {
    text-align: center;
    font-size: 11px;
    color: #9CA3AF;
    margin-top: 8px;
}

.footer-note a {
    color: #0D9488;
    text-decoration: none;
}

.api-key-bar {
    background: #FFF8E7;
    border-bottom: 1px solid #F59E0B33;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.api-key-bar label {
    font-size: 12px;
    color: #92400E;
    white-space: nowrap;
    font-weight: 600;
}

.api-key-bar input {
    flex: 1;
    border: 1px solid #F59E0B;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12px;
    font-family: monospace;
    outline: none;
    background: white;
    max-width: 380px;
}

.api-key-bar input:focus {
    border-color: #D97706;
}

.api-key-bar .save-btn {
    background: #F59E0B;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
}

.api-key-bar .save-btn:hover {
    background: #D97706;
}

.api-key-bar .dismiss {
    background: none;
    border: none;
    color: #92400E;
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
    margin-left: auto;
}

/* ── LACUNE SIGNALERING ──────────────────────────────────────────────────── */
#lacune-panel {
    display: flex;
    flex-direction: column;
    padding: 16px 20px 12px;
}

.lacune-header {
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(20, 50, 80, 0.5);
    margin-bottom: 10px;
}

.lacune-city-label {
    display: inline-block;
    background: rgba(200, 64, 26, 0.1);
    color: #C8401A;
    font-size: 11px;
    font-weight: 700;
    font-family: var(--mono);
    padding: 2px 8px;
    border-radius: 3px;
    margin-left: 8px;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.lacune-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lacune-card {
    background: #fff;
    border: 1px solid rgba(74, 120, 160, 0.18);
    border-left: 3px solid #C8401A;
    border-radius: 5px;
    padding: 10px 14px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.lacune-card:hover {
    border-color: rgba(200, 64, 26, 0.5);
    box-shadow: 0 2px 8px rgba(200, 64, 26, 0.08);
}

.lacune-card-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.lacune-domain {
    font-size: 12px;
    font-weight: 700;
    color: #1F4E79;
    font-family: var(--mono);
}

.lacune-type {
    font-size: 10px;
    font-family: var(--mono);
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 1px 6px;
    border-radius: 3px;
    background: rgba(74, 120, 160, 0.1);
    color: rgba(20, 50, 80, 0.6);
}

.lacune-type.absoluut {
    background: rgba(200, 64, 26, 0.1);
    color: #C8401A;
}

.lacune-type.cross-domein {
    background: rgba(31, 78, 121, 0.1);
    color: #1F4E79;
}

.lacune-type.bewijs {
    background: rgba(217, 119, 6, 0.1);
    color: #92400E;
}

.lacune-type.relatief {
    background: rgba(6, 95, 70, 0.1);
    color: #065F46;
}

.lacune-diagnose {
    font-size: 12.5px;
    line-height: 1.5;
    color: #1a2a3a;
}

.lacune-implicatie {
    font-size: 11px;
    color: rgba(20, 50, 80, 0.55);
    margin-top: 3px;
    font-style: italic;
}

.lacune-loading {
    font-size: 12px;
    color: rgba(20, 50, 80, 0.5);
    font-family: var(--mono);
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lacune-loading-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #C8401A;
    animation: lacunePulse 1.2s ease-in-out infinite;
}

.lacune-loading-dot:nth-child(2) {
    animation-delay: .2s;
}

.lacune-loading-dot:nth-child(3) {
    animation-delay: .4s;
}

@keyframes lacunePulse {

    0%,
    80%,
    100% {
        opacity: .2;
        transform: scale(.8);
    }

    40% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ── CITY SELECTOR ─────────────────────────────────────────────────────── */
#city-selector-bar {
    background: #fff;
    border-bottom: 1px solid rgba(74, 120, 160, 0.15);
    padding: 12px 16px 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

#city-selector-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

#city-selector-bar label {
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(20, 50, 80, 0.5);
    white-space: nowrap;
}

#city-text-input {
    flex: 1;
    min-width: 100px;
    max-width: 180px;
    border: 1px solid rgba(74, 120, 160, 0.3);
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 12px;
    font-family: var(--mono);
    color: #1a2a3a;
    background: rgba(255, 255, 255, 0.9);
    outline: none;
}

#city-text-input:focus {
    border-color: #C8401A;
}

#city-dropdown {
    flex: 1;
    min-width: 120px;
    max-width: 200px;
    border: 1px solid rgba(74, 120, 160, 0.3);
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 12px;
    font-family: var(--mono);
    color: #1a2a3a;
    background: rgba(255, 255, 255, 0.9);
    outline: none;
    cursor: pointer;
}

#city-dropdown:focus {
    border-color: #C8401A;
}

#city-go-btn {
    background: #C8401A;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 6px 16px;
    font-size: 11px;
    font-family: var(--mono);
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    cursor: pointer;
    white-space: nowrap;
}

#city-go-btn:hover {
    background: #a83315;
}

#city-active-label {
    font-size: 11px;
    font-family: var(--mono);
    color: rgba(20, 50, 80, 0.4);
    display: none;
}

#city-active-label.visible {
    display: inline;
}


/* ── LANG SELECTOR ──────────────────────────────────────────────────────── */
.lang-btn {
    background: none;
    border: 1px solid rgba(74, 120, 160, 0.25);
    border-radius: 3px;
    padding: 3px 7px;
    font-size: 10px;
    font-family: var(--mono);
    font-weight: 700;
    letter-spacing: .05em;
    color: rgba(20, 50, 80, 0.5);
    cursor: pointer;
    transition: all 0.15s;
    text-transform: uppercase;
}

.lang-btn:hover {
    border-color: #C8401A;
    color: #C8401A;
}

.lang-btn.active {
    background: #C8401A;
    border-color: #C8401A;
    color: #fff;
}

.lang-group {
    display: flex;
    gap: 4px;
    align-items: center;
    margin-left: auto;
}


/* ── TWO-COLUMN LAYOUT ──────────────────────────────────────────────────── */
#main-cols {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

#col-left {
    width: 42%;
    min-width: 320px;
    max-width: 560px;
    display: flex;
    flex-direction: column;
    border-right: 2px solid rgba(74, 120, 160, 0.12);
    overflow: hidden;
    background: #F7F9FC;
}

#col-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #ffffff;
    min-width: 0;
    min-height: 0;
}

/* lacune panel fills left column */
#lacune-panel {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}


/* ── DOMAIN FILTER ──────────────────────────────────────────────────────── */
#domain-filter {
    padding: 10px 20px 8px;
    border-bottom: 1px solid rgba(74, 120, 160, 0.12);
    background: #F7F9FC;
    flex-shrink: 0;
}

#domain-filter-label {
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(20, 50, 80, 0.45);
    margin-bottom: 6px;
}

.domain-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.domain-chip {
    background: rgba(74, 120, 160, 0.08);
    border: 1px solid rgba(74, 120, 160, 0.2);
    border-radius: 3px;
    padding: 2px 7px;
    font-size: 10px;
    font-family: var(--mono);
    color: rgba(20, 50, 80, 0.55);
    cursor: pointer;
    transition: all 0.12s;
    white-space: nowrap;
    user-select: none;
}

.domain-chip:hover {
    border-color: #C8401A;
    color: #C8401A;
}

.domain-chip.selected {
    background: #C8401A;
    border-color: #C8401A;
    color: #fff;
}

.domain-chip.all-chip {
    background: rgba(31, 78, 121, 0.08);
    border-color: rgba(31, 78, 121, 0.25);
    color: #1F4E79;
    font-weight: 700;
}

.domain-chip.all-chip.selected {
    background: #1F4E79;
    border-color: #1F4E79;
    color: #fff;
}


#lacune-stop-btn {
    display: none;
    margin: 8px 20px 4px;
    background: none;
    border: 1px solid rgba(200, 64, 26, 0.4);
    border-radius: 4px;
    padding: 4px 14px;
    font-size: 10px;
    font-family: var(--mono);
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #C8401A;
    cursor: pointer;
    flex-shrink: 0;
}

#lacune-stop-btn:hover {
    background: rgba(200, 64, 26, 0.08);
}

#lacune-stop-btn.visible {
    display: block;
}