/* CAXOPIA's current showcase palette, scoped to the shared chat panel. */
.caxhc-root {
    --caxhc-primary: #102b22;
    --caxhc-secondary: #102b22;
    --caxhc-accent: #a6ed55;
    --caxhc-trust: #a6ed55;
    --caxhc-paper: #f5f3eb;
    --caxhc-muted: #56635b;
    --caxhc-line: #d8dcd0;
    color: var(--caxhc-secondary);
    font: 15px/1.45 Archivo, Arial, sans-serif;
    color-scheme: light;
}

.caxhc-root, .caxhc-root * { box-sizing: border-box; }
.caxhc-root [hidden] { display: none !important; }
.caxhc-root :is(button, input, textarea) { font: inherit; }
.caxhc-root :is(button, a, input, textarea, [tabindex]):focus-visible { outline: 3px solid var(--caxhc-primary); outline-offset: 2px; }
.caxhc-root :is(button, a) { -webkit-tap-highlight-color: transparent; }
.caxhc-root button { cursor: pointer; }
.caxhc-root button:disabled { cursor: default; opacity: .6; }

.caxhc-panel {
    position: fixed;
    right: max(204px, calc(env(safe-area-inset-right) + 186px));
    bottom: max(18px, env(safe-area-inset-bottom));
    z-index: 1201;
    display: flex;
    flex-direction: column;
    width: min(382px, calc(100vw - 24px));
    height: min(610px, calc(100vh - 36px));
    height: min(610px, calc(100dvh - 36px));
    overflow: hidden;
    border: 1px solid var(--caxhc-line);
    border-radius: 12px;
    background: var(--caxhc-paper);
    box-shadow: 0 16px 48px #102b2233;
}

.caxhc-panel > *, .caxhc-root form, .caxhc-root label { min-width: 0; max-width: 100%; }
.caxhc-header { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; color: var(--caxhc-paper); background: var(--caxhc-primary); }
.caxhc-heading { min-width: 0; }
.caxhc-heading strong { display: block; font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
.caxhc-status { display: block; margin-top: 4px; color: #d9e3d6; font-size: 12px; }
.caxhc-close { display: grid; flex: 0 0 auto; place-items: center; width: 44px; height: 44px; margin: 0; padding: 0; border: 1px solid #6a8074; border-radius: 6px; color: var(--caxhc-paper); background: transparent; font-size: 26px !important; line-height: 1; }
.caxhc-root .caxhc-close:focus-visible { outline-color: var(--caxhc-accent); }

/* Start the history from a bounded basis so a long transcript cannot squeeze the forms. */
.caxhc-messages { flex: 1 0 140px; min-height: 140px; overflow-y: auto; padding: 14px; background: var(--caxhc-paper); overscroll-behavior: contain; scrollbar-width: thin; }
.caxhc-message { display: flex; margin-bottom: 12px; }
.caxhc-message__bubble { max-width: 90%; padding: 10px 12px; border: 1px solid var(--caxhc-line); border-radius: 8px 8px 8px 2px; background: #fff; white-space: pre-wrap; overflow-wrap: anywhere; }
.caxhc-message__sender { display: block; margin-bottom: 4px; font-size: 11px; font-weight: 700; }
.caxhc-message--visitor { justify-content: flex-end; }
.caxhc-message--visitor .caxhc-message__bubble { border-color: var(--caxhc-accent); border-radius: 8px 8px 2px 8px; color: var(--caxhc-secondary); background: var(--caxhc-accent); }
.caxhc-message--operator .caxhc-message__bubble { border-color: #a9bba4; background: #eaf2e3; }
.caxhc-message--system .caxhc-message__bubble { max-width: 100%; color: var(--caxhc-muted); background: #e9ede4; font-size: 13px; }
.caxhc-message a { color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }

.caxhc-tools { display: flex; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; gap: 0 8px; padding: 0 10px; border-top: 1px solid var(--caxhc-line); background: var(--caxhc-paper); }
.caxhc-tools a, .caxhc-tools button { display: inline-flex; align-items: center; min-height: 44px; margin: 0; padding: 4px; border: 0; border-radius: 3px; color: var(--caxhc-secondary); background: none; font: 600 12px/1.3 Archivo, Arial, sans-serif; text-decoration: underline; text-underline-offset: 3px; }
.caxhc-tools button { color: #9a322b; }
.caxhc-actions { flex: 0 1 auto; min-height: 0; max-height: 65%; overflow-y: auto; overscroll-behavior: contain; }
.caxhc-typing { margin: 8px 14px; color: var(--caxhc-muted); font-size: 12px; }
.caxhc-contact { display: grid; gap: 8px; margin: 8px 12px; padding: 10px; border: 1px solid var(--caxhc-line); border-radius: 6px; background: #e9ede4; }
.caxhc-contact strong { font-size: 13px; }
.caxhc-contact__row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 8px; align-items: end; }
.caxhc-contact label { display: grid; gap: 4px; color: var(--caxhc-secondary); font-size: 12px; font-weight: 600; }
.caxhc-contact input, .caxhc-compose textarea { width: 100%; min-width: 0; min-height: 44px; margin: 0; padding: 10px; border: 1px solid #87958b; border-radius: 3px; color: var(--caxhc-secondary); background: #fff; font-size: 16px; font-weight: 400; line-height: 1.4; }
.caxhc-root input::placeholder, .caxhc-root textarea::placeholder { color: var(--caxhc-muted); opacity: 1; }
.caxhc-contact button, .caxhc-send, .caxhc-human { min-height: 44px; margin: 0; padding: 10px 12px; border: 1px solid transparent; border-radius: 3px; color: var(--caxhc-secondary); background: var(--caxhc-accent); font-weight: 700 !important; line-height: 1.3; }
.caxhc-contact button { grid-column: 1 / -1; }
.caxhc-compose { margin: 0; padding: 12px; border-top: 1px solid var(--caxhc-line); background: var(--caxhc-paper); }
.caxhc-compose__row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.caxhc-compose textarea { max-height: 120px; resize: none; }
.caxhc-send { min-width: 64px; }
.caxhc-compose__foot { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; margin-top: 8px; }
.caxhc-human { background: #e3e9dc; border-color: #b5c0af; font-size: 12px !important; }
.caxhc-privacy { color: var(--caxhc-muted); font-size: 11px; overflow-wrap: anywhere; }
.caxhc-credit { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px 6px; margin-top: 10px; color: var(--caxhc-muted); font-size: 10px; text-align: center; }
.caxhc-credit a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.caxhc-error { margin: 8px 0 0; padding-left: 8px; border-left: 3px solid #9a322b; color: #9a322b; font-size: 12px; font-weight: 600; }

@media (min-width: 681px) {
    .caxhc-contact__row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) auto; }
    .caxhc-contact button { grid-column: auto; }
}

@media (max-width: 680px) {
    .caxhc-panel {
        inset: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
        width: auto;
        height: auto;
        max-height: calc(100dvh - max(8px, env(safe-area-inset-top)) - max(8px, env(safe-area-inset-bottom)));
    }
}

@media (max-height: 420px) {
    .caxhc-panel { top: max(8px, env(safe-area-inset-top)); bottom: max(8px, env(safe-area-inset-bottom)); height: auto; }
    .caxhc-header { padding-top: 6px; padding-bottom: 6px; }
    .caxhc-messages { flex-basis: 64px; min-height: 64px; }
    .caxhc-actions { max-height: 58%; }
}
