*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: #032e12;
    background: linear-gradient(to bottom, #033914, #09e180);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
}

.chat-container {
    width: 470px;
    max-width: 100%;
    height: min(780px, 100dvh);
    max-height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1),
        0 4px 8px rgba(0, 0, 0, 0.3),
        0 10px 20px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.chat-header {
    background-color: #4fd1c5;
    color: white;
    padding: 15px 20px;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.chat-header h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 500;
}

.header-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 17px;
    background-color: rgba(255, 255, 255, 0.16);
    color: white;
    cursor: pointer;
    flex-shrink: 0;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 10px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.header-info-btn:hover,
.header-info-btn.active {
    background-color: rgba(255, 255, 255, 0.26);
    border-color: rgba(255, 255, 255, 0.9);
}

.credibility-modal {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background-color: rgba(3, 46, 18, 0.42);
}

.credibility-modal[hidden] {
    display: none;
}

.credibility-panel {
    width: min(390px, 100%);
    max-height: min(560px, calc(100% - 24px));
    overflow-y: auto;
    border: 1px solid rgba(4, 55, 14, 0.14);
    border-radius: 14px;
    background-color: #fbfffd;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
}

.credibility-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #d9eee9;
}

.credibility-head h2 {
    margin: 0;
    color: #04370e;
    font-size: 18px;
    font-weight: 700;
}

#credibilityClose {
    width: 34px;
    height: 34px;
    border: 1px solid #bfe3dd;
    border-radius: 50%;
    background-color: #f4fbfa;
    color: #04370e;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#credibilityClose:hover {
    background-color: #e6f6f4;
}

.credibility-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 16px 16px;
}

.credibility-body section {
    border-left: 4px solid #4fd1c5;
    padding-left: 10px;
}

.credibility-body h3 {
    margin: 0 0 4px;
    color: #04370e;
    font-size: 13px;
    font-weight: 700;
}

.credibility-body p {
    margin: 0;
    color: #3b4b3b;
    font-size: 13px;
    line-height: 1.42;
}

.credibility-note {
    border-radius: 8px;
    background-color: #fff6d8;
    color: #5a4a00;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
    padding: 9px 10px;
}

.landing-strip {
    flex-shrink: 0;
    margin: 0;
    padding: 6px 14px 5px;
    border-bottom: 1px solid rgba(4, 55, 14, 0.08);
    background: linear-gradient(180deg, #f3fbf8 0%, rgba(255, 255, 255, 0.92) 100%);
}

.landing-strip p {
    margin: 0 0 2px;
    color: #1f3d2b;
    font-size: 11px;
    line-height: 1.3;
}

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

.landing-lead {
    color: #04370e !important;
    font-weight: 600;
    font-size: 12px !important;
}

.landing-crops,
.landing-meta {
    color: #275c55 !important;
    font-size: 10px !important;
}

.landing-safety {
    color: #5a4a00 !important;
}

.landing-cta {
    color: #0f5c4c !important;
    font-weight: 600;
}

.chat-messages {
    flex: 1 1 auto;
    min-height: 180px;
    overflow-y: auto;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
}

.message {
    max-width: calc(100% - 50px);
    margin-bottom: 15px;
    padding: 10px 15px;
    border-radius: 20px;
    line-height: 1.4;
    font-size: 14px;
}

.bot-message {
    background-color: #e6f6f4;
    align-self: flex-start;
    color: #333;
    margin-right: auto;
}

.user-message {
    background-color: #04370e;
    color: white;
    align-self: flex-end;
    margin-left: 10px;
}

.chat-input {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px 12px;
    background-color: #f9f9f9;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}

#chatbot-form-btn,
#chatbot-form-btn-voice,
#chatbot-form-btn-image,
#toolsToggle {
    background-color: #4fd1c5;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    margin-left: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background-color 0.3s ease;
}

#chatbot-form-btn:hover,
#chatbot-form-btn-voice:hover,
#chatbot-form-btn-image:hover,
#toolsToggle:hover,
#toolsToggle.active {
    background-color: #3cb3a7;
}

#chatbot-form-btn:disabled,
#chatbot-form-btn-voice:disabled,
#chatbot-form-btn-image:disabled,
#toolsToggle:disabled {
    cursor: default;
    opacity: 0.58;
}

#toolsToggle {
    width: auto;
    min-width: 40px;
    padding: 0 10px;
    gap: 6px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

.media-privacy-note {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin: 0;
    color: #4b604d;
    font-size: 11px;
    line-height: 1.3;
}

.media-privacy-note i {
    color: #3cb3a7;
    flex-shrink: 0;
    margin-top: 1px;
}

/* Uploaded leaf photo shown in the chat */
.msg-image {
    display: block;
    max-width: 180px;
    max-height: 180px;
    width: auto;
    height: auto;
    border-radius: 12px;
}

.typing-indicator {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    background-color: #4fd1c5;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
    animation: typing 1s infinite ease-in-out;
}

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

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

@keyframes typing {
    0% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }

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

.chat-footer {
    padding: 10px 20px;
    background-color: #f9f9f9;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#chatbot-form-btn-clear {
    background-color: #f44336;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#chatbot-form-btn-clear:hover {
    background-color: #d32f2f;
}

.voice-reading {
    display: flex;
    align-items: center;
}

.voice-reading input[type="checkbox"] {
    margin-right: 5px;
}

#chatbot-form {
    display: flex;
    width: 100%;
}

#messageText {
    flex-grow: 1;
    padding: 10px 15px;
    border: 1.6px solid #ccc;
    border-radius: 20px;
    background-color: white;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

#messageText:focus {
    outline: none;
    border-color: #4fd1c5;
    box-shadow: 0 0 0 3px rgba(79, 209, 197, 0.3);
}

.logo-title {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.logo-circle {
    width: 43px;
    height: 43px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 10px;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.logo-image {
    width: 90%;
    height: 90%;
    object-fit: contain;
}

.chat-container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.5);
    z-index: -1;
}

.message-container {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
    max-width: 80%;
}

.bot-container {
    align-self: flex-start;
}

.user-container {
    align-self: flex-end;
    justify-content: flex-end;
    margin-left: auto;
    flex-direction: row-reverse;
}

.bot-logo,
.user-image {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.bot-logo {
    margin-right: 10px;
}

.user-image {
    margin-left: 10px;
}

.bot-logo img,
.user-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Confidence label shown under grounded bot answers */
.confidence-line {
    display: flex;
    margin-top: 8px;
}

.confidence-pill {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    padding: 3px 8px;
}

.confidence-pill.confidence-fort,
.case-badge.confidence.confidence-fort {
    background-color: #dff3d8;
    color: #214a22;
}

.confidence-pill.confidence-moyen,
.case-badge.confidence.confidence-moyen {
    background-color: #fff1c7;
    color: #704900;
}

.confidence-pill.confidence-faible,
.case-badge.confidence.confidence-faible {
    background-color: #fde2dc;
    color: #7b2d20;
}

/* Source citation chips under bot answers */
.sources {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.sources-label {
    font-size: 11px;
    font-weight: 500;
    color: #5a6b5a;
}

.source-chip {
    align-self: flex-start;
    font-size: 11px;
    line-height: 1.3;
    background-color: #d8e8d0;
    color: #2f4f2f;
    padding: 2px 8px;
    border-radius: 10px;
    word-break: break-word;
}

.source-card {
    background-color: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(4, 55, 14, 0.12);
    border-radius: 8px;
    padding: 7px 8px;
}

.source-card-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.source-type {
    background-color: #d8e8d0;
    border-radius: 10px;
    color: #2f4f2f;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
    padding: 2px 7px;
    text-transform: uppercase;
}

.source-title {
    color: #243b2a;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.25;
}

.source-title-link {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.source-title-link:hover {
    color: #0b5f4d;
}

.source-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    margin-top: 5px;
}

.source-meta-item {
    color: #425542;
    font-size: 10px;
    line-height: 1.25;
}

.source-meta-item strong {
    color: #2f4f2f;
    font-weight: 700;
}

.source-snippet {
    color: #5a6b5a;
    font-size: 11px;
    line-height: 1.35;
    margin: 5px 0 0;
}

/* Per-answer audio replay */
.audio-actions {
    display: flex;
    margin-top: 8px;
}

.audio-replay {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    border: 1px solid #bfe3dd;
    border-radius: 14px;
    background-color: #f4fbfa;
    color: #04370e;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    padding: 5px 10px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.audio-replay:hover {
    background-color: #e6f6f4;
    border-color: #4fd1c5;
}

.audio-replay:active {
    background-color: #cfeee9;
}

/* Structured field-case response — keep scannable, not crowded */
.case-message {
    width: min(420px, calc(100vw - 80px));
    max-width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
}

.diagnostic-case {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.case-head {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.case-head-inline {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 10px;
}

.case-title {
    color: #04370e;
    font-size: 13px;
    font-weight: 700;
}

.case-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.case-badge {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 10px;
    line-height: 1.2;
    font-weight: 600;
}

.case-badge.confidence {
    background-color: #fff1c7;
    color: #704900;
}

.case-badge.risk {
    background-color: #fff1c7;
    color: #704900;
}

.case-badge.uncertain {
    background-color: #fde8e8;
    color: #7a1f1f;
}

.case-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.case-meta span {
    background-color: #f4fbfa;
    border: 1px solid #c9e9e5;
    border-radius: 10px;
    color: #275c55;
    font-size: 10px;
    line-height: 1.2;
    padding: 2px 7px;
}

.case-meta-line {
    margin: 0;
    color: #5a6b5a;
    font-size: 11px;
    line-height: 1.3;
}

.diagnostic-case-compact {
    gap: 7px;
}

.case-lead {
    margin: 0;
    color: #1a2e22;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;
}

.case-section {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.case-section-title {
    color: #6a7a6a;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
}

.case-section ul {
    margin: 0;
    padding-left: 16px;
}

.case-section li {
    margin-bottom: 2px;
    color: #243b2a;
    font-size: 13px;
    line-height: 1.4;
}

.case-weather-line {
    margin: 0;
    color: #3d5a52;
    font-size: 12px;
    line-height: 1.35;
}

.case-confirm {
    margin: 0;
    color: #5a6b5a;
    font-size: 11px;
    line-height: 1.35;
    font-style: italic;
}

.case-disclaimer {
    margin: 0;
    padding-top: 4px;
    color: #5a4a00;
    font-size: 11px;
    font-style: italic;
    line-height: 1.3;
}

.sources-details {
    margin-top: 6px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    padding-top: 4px;
}

.sources-summary {
    cursor: pointer;
    color: #5a6b5a;
    font-size: 11px;
    font-weight: 600;
    list-style: none;
    user-select: none;
}

.sources-summary::-webkit-details-marker {
    display: none;
}

.sources-summary::before {
    content: "▸ ";
    color: #8a9a8a;
}

details.sources-details[open] > .sources-summary::before {
    content: "▾ ";
}

.sources-compact {
    margin-top: 4px;
    gap: 4px;
}

.source-line {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
    color: #243b2a;
    font-size: 11px;
    line-height: 1.3;
}

.source-type-quiet {
    color: #6a7a6a;
    font-size: 10px;
    font-weight: 600;
}

.source-title-quiet {
    color: #243b2a;
    font-size: 11px;
    font-weight: 500;
}

.source-snippet {
    margin: 4px 0 0;
    color: #4a5c50;
    font-size: 11px;
    line-height: 1.3;
}

/* Context controls shown after a leaf photo is selected */
.context-message {
    width: min(360px, calc(100vw - 90px));
    max-width: 100%;
    padding: 12px;
    border-radius: 14px;
}

.image-context-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.context-title {
    color: #04370e;
    font-size: 13px;
    font-weight: 700;
}

.context-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.context-grid select,
.context-grid input {
    width: 100%;
    min-height: 36px;
    border: 1px solid #bfe3dd;
    border-radius: 8px;
    background-color: white;
    color: #243b2a;
    font-family: inherit;
    font-size: 13px;
    padding: 7px 9px;
}

.context-grid select:focus,
.context-grid input:focus {
    outline: none;
    border-color: #4fd1c5;
    box-shadow: 0 0 0 3px rgba(79, 209, 197, 0.25);
}

.context-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.context-submit,
.context-skip {
    min-height: 34px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    padding: 7px 12px;
}

.context-submit {
    background-color: #04370e;
    color: white;
}

.context-skip {
    background-color: #e6f6f4;
    color: #04370e;
    border: 1px solid #bfe3dd;
}

.image-context-form.submitted {
    opacity: 0.68;
}

/* Feedback (thumbs up/down) under bot answers */
.feedback {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
}

.fb-btn {
    background: none;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 14px;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.fb-btn:hover:not(:disabled) {
    background-color: rgba(0, 0, 0, 0.05);
}

.fb-btn:active:not(:disabled) {
    transform: scale(1.15);
}


.fb-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.fb-thanks {
    font-size: 11px;
    color: #5a6b5a;
}

/* Follow-up outcome prompt (after initial thumbs feedback) */
.followup-prompt {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.followup-label {
    color: #243b2a;
    font-size: 11px;
    font-weight: 700;
}

.followup-options {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.followup-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 26px;
    border: 1px solid #bfe3dd;
    border-radius: 13px;
    background-color: #f4fbfa;
    color: #04370e;
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    padding: 4px 9px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.followup-btn:hover:not(:disabled) {
    background-color: #e6f6f4;
    border-color: #4fd1c5;
}

.followup-btn:active:not(:disabled) {
    background-color: #cfeee9;
}

.followup-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.followup-thanks {
    font-size: 11px;
    color: #46a65c;
    font-weight: 600;
}

/* Public demo examples */
/* Optional field context for text questions */
.field-context-panel {
    flex-shrink: 0;
    margin: 0;
    padding: 4px 12px 2px;
    border-bottom: 1px solid #e8f3f0;
    background: rgba(255, 255, 255, 0.96);
    order: 0;
}

.field-context-toggle[aria-expanded="true"] {
    border-color: #4fd1c5;
    background: #e8faf6;
}

.workflow-step-hint {
    color: #5a6b5a;
    font-size: 11px;
}

.field-context-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 32px;
    border: 1px solid #c9e9e5;
    border-radius: 8px;
    background: #f4fbfa;
    color: #0f5c4c;
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    padding: 5px 8px;
    text-align: left;
}

.field-context-toggle .field-context-chevron {
    margin-left: auto;
    transition: transform 0.15s ease;
}

.field-context-toggle[aria-expanded="true"] .field-context-chevron {
    transform: rotate(180deg);
}

.field-context-fields {
    margin-top: 8px;
    padding: 10px;
    border: 1px solid #c9e9e5;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.92);
}

.field-context-hint {
    margin: 0 0 8px;
    color: #5a6b5a;
    font-size: 11px;
    line-height: 1.35;
}

.field-context-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}

.field-context-label {
    color: #5a6b5a;
    font-size: 11px;
    font-weight: 700;
}

.field-context-grid select,
.field-context-grid input {
    width: 100%;
    min-height: 34px;
    border: 1px solid #bfe3dd;
    border-radius: 8px;
    background: white;
    color: #243b2a;
    font-family: inherit;
    font-size: 13px;
    padding: 4px 8px;
}

.field-simple-french {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed #c9e9e5;
    color: #243b2a;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

.field-simple-french input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: #2f6f5e;
    cursor: pointer;
}

.field-simple-french-hint {
    color: #5a6b5a;
    font-size: 11px;
    font-weight: 400;
}

.examples-panel {
    flex-shrink: 0;
    background-color: #f9f9f9;
    border-top: 1px solid #eef3f1;
    padding: 4px 12px 0;
}

.examples-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 34px;
    margin: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #243b2a;
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 6px;
    text-align: left;
}

.examples-toggle:hover {
    background: rgba(79, 209, 197, 0.12);
}

.examples-toggle-hint {
    color: #5a6b5a;
    font-size: 10px;
    font-weight: 500;
    text-transform: none;
}

.examples-chevron {
    margin-left: auto;
    font-size: 11px;
    transition: transform 0.15s ease;
}

.examples-toggle[aria-expanded="true"] .examples-chevron {
    transform: rotate(180deg);
}

.examples-list-wrap {
    padding-bottom: 6px;
}

.examples-list-wrap[hidden] {
    display: none !important;
}

.examples-heading {
    color: #243b2a;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.examples-list {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.example-card {
    flex: 0 0 132px;
    min-height: 52px;
    min-width: 132px;
    max-width: 150px;
    background-color: #ffffff;
    border: 1px solid #bfe3dd;
    border-radius: 8px;
    color: #04370e;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-family: inherit;
    padding: 8px;
    text-align: left;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.example-card:hover:not(:disabled) {
    background-color: #e6f6f4;
    border-color: #4fd1c5;
}

.example-card:active:not(:disabled) {
    background-color: #cfeee9;
}

.example-card:disabled {
    cursor: default;
    opacity: 0.58;
}

.example-type {
    color: #2f7b70;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
}

.example-title {
    color: #04370e;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
}

.example-text {
    color: #5a6b5a;
    font-size: 11px;
    line-height: 1.25;
    display: none;
}

/* Optional tool drawer: keeps the first screen focused on the conversation. */
.tools-drawer {
    background-color: #f9f9f9;
    border-top: 1px solid #eef3f1;
    display: grid;
    gap: 10px;
    padding: 10px 20px 0;
}

.tools-drawer[hidden] {
    display: none;
}

/* Weather context controls */
.weather-panel {
    background-color: transparent;
    border-top: 0;
    display: grid;
    gap: 6px;
    padding: 0;
}

.weather-label {
    color: #243b2a;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.weather-controls {
    display: flex;
    gap: 8px;
}

#weatherLocation {
    flex: 1;
    min-width: 0;
    border: 1px solid #bfe3dd;
    border-radius: 8px;
    background-color: white;
    color: #04370e;
    font-family: inherit;
    font-size: 13px;
    min-height: 34px;
    padding: 6px 8px;
}

#weatherBtn {
    min-width: 62px;
    border: none;
    border-radius: 8px;
    background-color: #04370e;
    color: white;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    padding: 6px 10px;
}

#weatherLocation:disabled,
#weatherBtn:disabled {
    cursor: default;
    opacity: 0.58;
}

/* Weather context card */
.weather-message {
    width: min(380px, calc(100vw - 90px));
    max-width: 100%;
    padding: 12px;
    border-radius: 14px;
}

.weather-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.weather-head {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.weather-title {
    color: #04370e;
    font-size: 14px;
    font-weight: 700;
}

.weather-updated {
    color: #5a6b5a;
    font-size: 11px;
}

.weather-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

.weather-metric {
    background-color: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(4, 55, 14, 0.1);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 48px;
    padding: 7px;
}

.weather-metric span {
    color: #5a6b5a;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.weather-metric strong {
    color: #04370e;
    font-size: 15px;
}

.weather-insights {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.weather-insight {
    border-left: 4px solid #bfe3dd;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.66);
    padding: 7px 8px;
}

.weather-insight.weather-good {
    border-left-color: #46a65c;
}

.weather-insight.weather-watch {
    border-left-color: #e1a600;
}

.weather-insight.weather-risk {
    border-left-color: #d9534f;
}

.weather-insight-label {
    color: #04370e;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 2px;
}

.weather-insight p {
    color: #3b4b3b;
    font-size: 12px;
    line-height: 1.35;
    margin: 0;
}

.weather-disclaimer {
    margin: 0;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    color: #5a4a00;
    font-size: 12px;
    font-style: italic;
}

/* Soil context controls */
.soil-panel {
    background-color: transparent;
    border-top: 0;
    display: grid;
    gap: 6px;
    padding: 0;
}

.soil-label {
    color: #243b2a;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.soil-controls {
    display: grid;
    grid-template-columns: 0.85fr 1fr auto;
    gap: 8px;
}

#soilCrop,
#soilLocation {
    min-width: 0;
    border: 1px solid #bfe3dd;
    border-radius: 8px;
    background-color: white;
    color: #04370e;
    font-family: inherit;
    font-size: 13px;
    min-height: 34px;
    padding: 6px 8px;
}

#soilBtn {
    min-width: 62px;
    border: none;
    border-radius: 8px;
    background-color: #04370e;
    color: white;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    padding: 6px 10px;
}

#soilCrop:disabled,
#soilLocation:disabled,
#soilBtn:disabled {
    cursor: default;
    opacity: 0.58;
}

/* Soil context card */
.soil-message {
    width: min(390px, calc(100vw - 90px));
    max-width: 100%;
    padding: 12px;
    border-radius: 14px;
}

.soil-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.soil-head {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.soil-title {
    color: #04370e;
    font-size: 14px;
    font-weight: 700;
}

.soil-subtitle {
    color: #5a6b5a;
    font-size: 11px;
}

.soil-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

.soil-metric {
    background-color: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(4, 55, 14, 0.1);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 48px;
    padding: 7px;
}

.soil-metric span {
    color: #5a6b5a;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.soil-metric strong {
    color: #04370e;
    font-size: 15px;
}

.soil-indicators {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.soil-indicator {
    border-left: 4px solid #bfe3dd;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.66);
    padding: 7px 8px;
}

.soil-indicator.weather-good {
    border-left-color: #46a65c;
}

.soil-indicator.weather-watch {
    border-left-color: #e1a600;
}

.soil-indicator.weather-risk {
    border-left-color: #d9534f;
}

.soil-indicator-label,
.soil-section-title {
    color: #04370e;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 2px;
}

.soil-indicator strong {
    color: #243b2a;
    display: block;
    font-size: 12px;
    margin-bottom: 2px;
}

.soil-indicator p,
.soil-fertilizer p {
    color: #3b4b3b;
    font-size: 12px;
    line-height: 1.35;
    margin: 0;
}

.soil-fertilizer {
    background-color: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(4, 55, 14, 0.12);
    border-radius: 8px;
    padding: 8px;
    white-space: pre-line;
}

.soil-disclaimer {
    margin: 0;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    color: #5a4a00;
    font-size: 12px;
    font-style: italic;
}

/* Active microphone (listening) state */
#chatbot-form-btn-voice.listening {
    background-color: #f44336;
    animation: mic-pulse 1.2s infinite;
}

@keyframes mic-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.6);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(244, 67, 54, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0);
    }
}

/* --- Mobile-first: fill the screen on phones --- */
@media (max-width: 480px) {
    body {
        align-items: stretch;
        justify-content: stretch;
    }

    .chat-container {
        width: 100%;
        height: 100vh;
        height: 100dvh;
        max-height: none;
        border-radius: 0;
    }

    .chat-header {
        padding: 12px 15px;
    }

    .chat-header h1 {
        font-size: 20px;
    }

    .header-info-btn span {
        display: none;
    }

    .header-info-btn {
        width: 34px;
        padding: 0;
    }

    .credibility-modal {
        padding: 12px;
    }

    .landing-strip {
        padding: 8px 12px 6px;
    }

    .landing-strip p {
        font-size: 11px;
    }

    .landing-lead {
        font-size: 12px !important;
    }

    .chat-messages {
        padding: 15px;
    }

    .message-container {
        max-width: 90%;
    }

    .field-context-panel {
        padding: 6px 15px 0;
    }

    .examples-panel {
        padding: 10px 15px 0;
    }

    .example-card {
        flex-basis: 136px;
    }

    .tools-drawer {
        padding: 10px 15px 0;
    }

    .soil-controls {
        grid-template-columns: 1fr;
    }

    #toolsToggle span {
        display: none;
    }

    #toolsToggle {
        width: 40px;
        padding: 0;
    }

    .chat-input {
        padding: 12px 15px;
    }

    .chat-footer {
        padding: 10px 15px;
        flex-wrap: wrap;
        gap: 8px;
    }
}


.followup-after-photo {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.followup-after-label {
    font-size: 11px;
    color: #5a6b5a;
    font-weight: 600;
}

.followup-after-input {
    font-size: 12px;
    max-width: 100%;
}
