* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f9fafb;
    height: 100vh;
    overflow: hidden;
}

/* --- Login --- */

.login-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #14443d 0%, #0a8a60 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-card {
    background: white;
    border-radius: 1rem;
    padding: 2.5rem;
    width: 100%;
    max-width: 24rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-icon {
    width: 4rem;
    height: 4rem;
    background: #d8f3e8;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.login-header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.25rem;
}

.login-header p {
    font-size: 0.875rem;
    color: #6b7280;
}

.login-error {
    color: #dc2626;
    font-size: 0.813rem;
    min-height: 1.25rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

.login-btn {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.938rem;
}

/* --- App layout --- */

.app-container {
    display: flex;
    height: 100vh;
}

.chat-panel {
    width: 40%;
    display: flex;
    flex-direction: column;
    background: white;
}

.resize-handle {
    width: 6px;
    cursor: col-resize;
    background: #e5e7eb;
    transition: background 0.15s;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.resize-handle:hover,
.resize-handle.active {
    background: #0a8a60;
}

.resize-handle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 1px;
    width: 4px;
    height: 32px;
    transform: translateY(-50%);
    border-left: 1px solid #9ca3af;
    border-right: 1px solid #9ca3af;
}

.resize-handle:hover::after,
.resize-handle.active::after {
    border-color: white;
}

.map-panel {
    width: 60%;
    position: relative;
}

/* --- Header --- */

.header {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-info h1 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
}

.header-info p {
    font-size: 0.75rem;
    color: #6b7280;
}

.header-actions {
    display: flex;
    gap: 0.25rem;
}

.header-btn {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 0.5rem;
    transition: background 0.2s;
    color: #374151;
}

.header-btn:hover {
    background: #f3f4f6;
}

.header-btn-danger:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* --- Messages --- */

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.messages-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 1rem;
}

.empty-state-icon {
    width: 3rem;
    height: 3rem;
    background: #d8f3e8;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem;
}

.empty-state h2 {
    font-size: 1rem;
    font-weight: 500;
    color: #111827;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: #6b7280;
    font-size: 0.875rem;
}

.message {
    display: flex;
}

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

.message-bubble {
    max-width: 95%;
    padding: 0.625rem 0.875rem;
    border-radius: 1rem;
    font-size: 0.813rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.message.user .message-bubble {
    background: #0a8a60;
    color: white;
}

.message.assistant .message-bubble {
    background: #f3f4f6;
    color: #111827;
}

.message.assistant .message-bubble h1,
.message.assistant .message-bubble h2,
.message.assistant .message-bubble h3 {
    margin: 0.5rem 0 0.25rem;
    font-size: 0.938rem;
}

.message.assistant .message-bubble ul,
.message.assistant .message-bubble ol {
    padding-left: 1.25rem;
    margin: 0.25rem 0;
}

.message.assistant .message-bubble table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.5rem 0;
    font-size: 0.75rem;
}

.message.assistant .message-bubble table th,
.message.assistant .message-bubble table td {
    border: 1px solid #d1d5db;
    padding: 0.25rem 0.5rem;
    text-align: left;
}

.message.assistant .message-bubble table th {
    background: #e5e7eb;
    font-weight: 600;
}

.message.assistant .message-bubble strong,
.message.assistant .message-bubble b {
    font-weight: 600;
    color: #1f2937;
}

.message.assistant .message-bubble em,
.message.assistant .message-bubble i {
    font-style: italic;
}

.message.assistant .message-bubble a {
    color: #0a8a60;
    text-decoration: underline;
    cursor: pointer;
}

.message.assistant .message-bubble a:hover {
    color: #086b4b;
}

.message.assistant .message-bubble .parcelle-link {
    color: #0a8a60;
    text-decoration: underline;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.message.assistant .message-bubble .parcelle-link:hover {
    color: #086b4b;
    border-bottom-color: #f59e0b;
    background-color: rgba(245, 158, 11, 0.1);
    padding: 0 2px;
}

.message.assistant .message-bubble li {
    margin: 0.25rem 0;
}

.message.assistant .message-bubble blockquote {
    border-left: 3px solid #d1d5db;
    padding-left: 0.75rem;
    margin: 0.5rem 0;
    color: #6b7280;
}

.message.assistant .message-bubble code {
    background: #f3f4f6;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.message.assistant .message-bubble pre {
    background: #1f2937;
    color: #f3f4f6;
    padding: 0.75rem;
    border-radius: 0.375rem;
    overflow-x: auto;
    margin: 0.5rem 0;
}

.message.assistant .message-bubble pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.message.assistant .message-bubble p {
    margin: 0.5rem 0;
    line-height: 1.6;
}

/* --- Loading dots --- */

.loading-dots {
    display: flex;
    gap: 0.5rem;
    padding: 0.625rem 0.875rem;
}

.loading-dot {
    width: 0.5rem;
    height: 0.5rem;
    background: #9ca3af;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

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

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* --- Input --- */

.input-container {
    background: white;
    border-top: 1px solid #e5e7eb;
    padding: 0.875rem;
}

.input-wrapper {
    display: flex;
    gap: 0.5rem;
}

#messageInput {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    padding: 0.625rem 0.875rem;
    font-size: 0.813rem;
    resize: none;
    font-family: inherit;
}

#messageInput:focus {
    outline: none;
    border-color: #0a8a60;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.send-btn {
    background: #0a8a60;
    color: white;
    border: none;
    padding: 0.625rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    transition: background 0.2s;
    font-size: 0.813rem;
}

.send-btn:hover:not(:disabled) {
    background: #086b4b;
}

.send-btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
}

/* --- Map --- */

#map {
    width: 100%;
    height: 100%;
}

/* --- Recherche adresse BAN --- */

.map-search {
    position: absolute;
    top: 10px;
    left: 50px;
    z-index: 1000;
    width: 280px;
}

#searchAddress {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.813rem;
    background: white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

#searchAddress:focus {
    outline: none;
    border-color: #0a8a60;
    box-shadow: 0 2px 6px rgba(16,185,129,0.2);
}

.search-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-height: 240px;
    overflow-y: auto;
}

.search-results.visible {
    display: block;
}

.search-item {
    padding: 8px 12px;
    font-size: 0.813rem;
    color: #374151;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
}

.search-item:hover {
    background: #eefaf4;
    color: #0a6e4e;
}

.search-item:last-child {
    border-bottom: none;
    border-radius: 0 0 8px 8px;
}

.coords-display {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 0.75rem 1.25rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    font-size: 0.875rem;
    font-family: monospace;
    z-index: 1000;
    display: none;
}

.coords-display.active {
    display: block;
}

/* --- Modal --- */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 2000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 1rem;
    max-width: 28rem;
    width: 100%;
    padding: 1.5rem;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
}

.close-btn {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    border-radius: 0.5rem;
    transition: background 0.2s;
}

.close-btn:hover {
    background: #f3f4f6;
}

/* --- Forms --- */

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.form-group input {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.form-group input:focus {
    outline: none;
    border-color: #0a8a60;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-group input:disabled {
    background: #f3f4f6;
    color: #6b7280;
}

.form-help {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.btn {
    flex: 1;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-secondary {
    background: white;
    border: 1px solid #d1d5db;
    color: #374151;
}

.btn-secondary:hover {
    background: #f9fafb;
}

.btn-primary {
    background: #0a8a60;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #086b4b;
}

.btn-primary:disabled {
    background: #d1d5db;
    cursor: not-allowed;
}

.icon {
    width: 1.125rem;
    height: 1.125rem;
}

/* --- Responsive --- */

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    .chat-panel {
        width: 100% !important;
        height: 50vh;
        border-right: none;
        border-bottom: 2px solid #e5e7eb;
    }
    .resize-handle {
        display: none;
    }
    .map-panel {
        width: 100% !important;
        height: 50vh;
    }
    .header-info h1 {
        font-size: 0.938rem;
    }
    .message-bubble {
        max-width: 100%;
        font-size: 0.75rem;
    }
    #messageInput {
        font-size: 0.75rem;
    }
    .map-search {
        left: 10px;
        width: 200px;
    }
}

/* --- Source links in chat --- */

/* --- Feedback buttons --- */

.feedback-btns {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

.fb-btn {
    background: none;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    padding: 0.125rem 0.375rem;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.15s;
    opacity: 0.5;
}

.fb-btn:hover {
    opacity: 1;
    background: #f3f4f6;
}

.fb-up:hover {
    border-color: #16a34a;
}

.fb-down:hover {
    border-color: #dc2626;
}

/* --- Side panel (history / favorites) --- */

.side-panel {
    position: fixed;
    top: 0;
    left: -320px;
    width: 320px;
    height: 100vh;
    background: white;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
    z-index: 2500;
    display: flex;
    flex-direction: column;
    transition: left 0.25s ease;
}

.side-panel.open {
    left: 0;
}

.side-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.side-panel-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
}

.side-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.history-item, .favorite-item {
    padding: 0.625rem 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    border: 1px solid transparent;
    margin-bottom: 0.25rem;
    transition: all 0.15s;
}

.history-item:hover, .favorite-item:hover {
    background: #eefaf4;
    border-color: #9adfc3;
}

.history-item-title, .favorite-item-title {
    font-size: 0.813rem;
    color: #111827;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-meta, .favorite-item-meta {
    font-size: 0.688rem;
    color: #9ca3af;
    margin-top: 0.125rem;
}

.favorite-item-actions {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

.fav-delete {
    font-size: 0.625rem;
    color: #dc2626;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

.fav-delete:hover {
    text-decoration: underline;
}

/* --- Termes cliquables dans les popups --- */

.terme-cliquable {
    color: #0a8a60;
    cursor: pointer;
    border-bottom: 1px dashed #9adfc3;
    font-weight: 600;
    transition: all 0.15s;
}

.terme-cliquable:hover {
    background: #d8f3e8;
    border-bottom-color: #0a8a60;
}

/* --- Source links in chat --- */

/* --- RAG images --- */

.rag-image {
    margin: 8px 0;
    text-align: center;
}

.rag-image img {
    max-width: 100%;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: transform 0.2s;
}

.rag-image img:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.img-caption {
    font-size: 0.7rem;
    color: #6b7280;
    font-style: italic;
    margin-top: 4px;
}

/* --- Source links in chat --- */

.source-link {
    color: #0a8a60;
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.75rem;
}

.source-link:hover {
    color: #086b4b;
}

/* --- Source viewer modal --- */

.source-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 3000;
}

.source-modal.active {
    display: flex;
}

.source-modal-content {
    background: white;
    border-radius: 0.75rem;
    max-width: 44rem;
    width: 95%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.source-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
}

.source-modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
}

.source-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.source-modal-close:hover {
    color: #111827;
}

.source-modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

.source-chunk {
    padding: 0.75rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.813rem;
    line-height: 1.5;
    color: #374151;
    white-space: pre-wrap;
    word-break: break-word;
    margin-bottom: 0.625rem;
}

.source-chunk-label {
    font-size: 0.688rem;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 0.375rem;
    text-transform: uppercase;
}


/* ====== LLM Mode Modal ====== */

#llmModeModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#llmModeModal .modal-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

#llmModeModal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

#llmModeModal .modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: #111827;
}

.mode-card {
    transition: all 0.2s ease;
}

.mode-card:hover {
    border-color: #0a8a60;
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.1);
}

.mode-card h3 {
    font-size: 1rem;
    margin: 0 0 0.5rem 0;
    color: #111827;
}

.mode-card p {
    font-size: 0.85em;
    color: #666;
    margin: 0;
    line-height: 1.4;
}

#llmModeText {
    font-size: 0.8em;
    color: #666;
    cursor: pointer;
    transition: color 0.2s;
}

#llmModeText:hover {
    color: #0a8a60;
    text-decoration: underline;
}

/* =====================
   MATCHING — Parcelle Results
   ===================== */

.matching-result {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-left: 4px solid #22c55e;
    padding: 1.5rem;
    margin: 1rem 0;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    line-height: 1.6;
}

.matching-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
    padding: 1rem;
    background: white;
    border-radius: 0.5rem;
}

.stat-card {
    text-align: center;
    padding: 1rem;
    border-radius: 0.4rem;
    border: 1px solid #e5e7eb;
}

.stat-compat {
    background: #ecfdf5;
    border-color: #a7f3d0;
}

.stat-compat-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: #059669;
}

.stat-partiel {
    background: #fffbeb;
    border-color: #fcd34d;
}

.stat-partiel-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: #d97706;
}

.stat-incompat {
    background: #fef2f2;
    border-color: #fecaca;
}

.stat-incompat-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: #dc2626;
}

.stat-label {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.5rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.matching-parcelles {
    margin-top: 1.5rem;
}

.matching-parcelles h3 {
    font-size: 1rem;
    color: #374151;
    margin: 1rem 0 0.75rem 0;
}

.parcelle-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.4rem;
    padding: 1rem;
    margin: 0.75rem 0;
    transition: all 0.2s ease;
}

.parcelle-item:hover {
    border-color: #0a8a60;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.1);
}

.parcelle-matching-link {
    color: #0a8a60;
    cursor: pointer;
    text-decoration: underline;
    font-weight: 500;
    transition: color 0.2s;
}

.parcelle-matching-link:hover {
    color: #086b4b;
    text-decoration: none;
}

.parcelle-score {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.score-compatible {
    background: #ecfdf5;
    color: #059669;
}

.score-partiel {
    background: #fffbeb;
    color: #d97706;
}

.score-incompatible {
    background: #fef2f2;
    color: #dc2626;
}

.parcelle-details {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 0.5rem;
    line-height: 1.5;
}

.matching-blocages {
    background: #fff5f5;
    border-left: 3px solid #dc2626;
    padding: 0.75rem;
    margin-top: 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.85rem;
}

.matching-blocages strong {
    color: #dc2626;
}

.matching-avertissements {
    background: #fffbeb;
    border-left: 3px solid #d97706;
    padding: 0.75rem;
    margin-top: 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.85rem;
}

.matching-avertissements strong {
    color: #d97706;
}


/* ============================================================
   IDENTITÉ PRODUIT — PLUi Intelligence
   Couche de marque alignée sur le pack design (flyer / docs) :
   palette vert profond + émeraude + doré, typo Fraunces/Inter.
   ============================================================ */

/* Tokens définis dans brand.css (chargé avant cette feuille). */

body {
    font-family: var(--brand-font-body);
    background: var(--brand-paper);
}

.login-header h1,
.empty-state h2,
.modal-header h2,
.side-panel-header h3,
.source-modal-header h3 {
    font-family: var(--brand-font-display);
    letter-spacing: -0.01em;
}

/* --- Header du chat : bandeau vert profond --- */

.header {
    background: var(--brand-grad-deep);
    border-bottom: none;
}

.header-info h1 {
    font-family: var(--brand-font-display);
    color: #ffffff;
    font-weight: 700;
}

.header-info p {
    color: #9fc4b5;
}

#llmModeText {
    color: #9fc4b5 !important;
}

#llmModeText:hover {
    color: #7ef0c5 !important;
}

.header-btn {
    color: #cfe8dd;
}

.header-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.header-btn-danger:hover {
    background: rgba(220, 38, 38, 0.25);
    color: #fca5a5;
}

/* --- Boutons & bulles : dégradé émeraude --- */

.btn-primary,
.send-btn {
    background: var(--brand-grad-cta);
}

.btn-primary:hover:not(:disabled),
.send-btn:hover:not(:disabled) {
    background: var(--brand-grad-cta-hover);
}

.message.user .message-bubble {
    background: var(--brand-grad-cta);
}

/* --- Login : fond de marque --- */

.login-overlay {
    background: var(--brand-grad-hero);
}

.login-icon {
    background: var(--brand-mint);
}

/* --- Accents secondaires --- */

.resize-handle:hover,
.resize-handle.active {
    background: var(--brand-emerald);
}

.parcelle-link:hover {
    border-bottom-color: var(--brand-gold) !important;
    background-color: rgba(245, 184, 65, 0.15) !important;
}

/* --- Vue aérienne IGN dans les résultats de matching --- */

.message.assistant .message-bubble img.ortho-img {
    width: 100%;
    max-width: 440px;
    border-radius: 10px;
    border: 1px solid var(--brand-line);
    box-shadow: 0 4px 14px rgba(15, 46, 42, 0.14);
    display: block;
    margin: 0.25rem 0 0.5rem;
}

/* --- Légende des parcelles candidates (matching) --- */

.matching-legend {
    background: #fff;
    border: 1px solid var(--brand-line);
    border-radius: 10px;
    padding: 0.55rem 0.8rem;
    font-size: 0.72rem;
    color: var(--brand-ink);
    box-shadow: 0 4px 14px rgba(15, 46, 42, 0.15);
    line-height: 1.7;
}

.matching-legend b {
    display: block;
    font-size: 0.75rem;
    margin-bottom: 0.15rem;
}

.matching-legend span { display: block; }

.matching-legend i {
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 3px;
    margin-right: 0.45rem;
    vertical-align: -1px;
}

/* --- Bouton export PDF de fiche --- */

.message.assistant .message-bubble .fiche-export {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--brand-emerald-dark);
    background: var(--brand-mint);
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    text-decoration: none;
    white-space: nowrap;
}

.message.assistant .message-bubble .fiche-export:hover {
    background: var(--brand-mint-border);
    color: var(--brand-deep);
}

/* Etiquette de hauteur sur le plan des hauteurs (couche carto) */
.height-label {
    background: transparent;
    border: none;
    box-shadow: none;
    color: #0f2e2a;
    font-weight: 700;
    font-size: 0.72rem;
    text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff;
}
.height-label::before { display: none; }
.data-layer-hint {
    background: rgba(15,46,42,0.88);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.78rem;
    padding: 5px 9px;
}
.data-layer-hint::before { display: none; }

/* ===== Panneau de couches custom (remplace L.control.layers) ===== */
.layers-panel-wrap { position: relative; }
.layers-panel-btn {
    display: flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; background: #fff; border-radius: 8px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.25); font-size: 1.1rem; text-decoration: none;
    cursor: pointer;
}
.layers-panel-btn:hover { background: #f0fdf4; }
.layers-panel {
    position: absolute; top: 0; right: 44px; width: 248px; max-height: 78vh;
    overflow-y: auto; background: #fff; border-radius: 10px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.22); padding: 0; font-size: 0.8rem;
}
.layers-panel-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 12px; border-bottom: 1px solid #eef2ef; font-weight: 700;
    font-family: 'Fraunces', serif; color: #0f2e2a; position: sticky; top: 0; background: #fff;
}
.layers-panel-close { color: #94a3b8; text-decoration: none; font-size: 0.9rem; }
.layers-panel-close:hover { color: #dc2626; }
.layers-section { padding: 8px 12px; border-bottom: 1px solid #f4f7f5; }
.layers-section:last-child { border-bottom: none; }
.layers-section-t {
    font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em;
    color: #0a8a60; font-weight: 700; margin-bottom: 6px;
}
.layers-item {
    display: flex; align-items: center; gap: 7px; padding: 3px 0;
    cursor: pointer; color: #334155;
}
.layers-item:hover { color: #0f2e2a; }
.layers-item input { cursor: pointer; margin: 0; }
.layers-swatch {
    width: 13px; height: 13px; border-radius: 3px; display: inline-block;
    flex-shrink: 0; border: 1px solid rgba(0,0,0,0.12);
}
.layers-subgroup { margin: 2px 0 4px 18px; padding-left: 8px; border-left: 2px solid #eef2ef; }
.layers-subitem { font-size: 0.74rem; color: #64748b; }
.layers-subitem .layers-swatch { width: 11px; height: 11px; border-radius: 50%; }

/* Légendes empilées des couches data */
.data-layer-legend {
    background: #fff; padding: 8px 11px; border-radius: 9px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.2); max-width: 220px;
}
.legend-block + .legend-block, .legend-sep { margin-top: 6px; }
.legend-sep { border-top: 1px solid #eef2ef; padding-top: 6px; }
.legend-title { font-weight: 600; margin-bottom: 3px; font-size: 0.76rem; }
.legend-row { display: flex; align-items: center; gap: 5px; font-size: 0.71rem; color: #475569; }
.legend-swatch { width: 11px; height: 11px; display: inline-block; flex-shrink: 0; }
