/* Horizon WebTrader's isolated, native conversation layer. */
.hc-dialog,
.hc-dialog * {
    box-sizing: border-box;
}

.hc-dialog {
    --hc-surface: #151d25;
    --hc-surface-raised: #1c2731;
    --hc-text: #edf3f4;
    --hc-muted: #a2b1b8;
    --hc-line: rgba(174, 198, 204, .16);
    --hc-accent: #77d6c0;
    --hc-accent-ink: #10221f;
    --hc-danger: #ff8179;
    --hc-shadow: 0 28px 90px rgba(0, 0, 0, .46);
    position: fixed;
    inset: 0;
    margin: auto;
    width: min(500px, calc(100vw - 32px));
    max-width: none;
    max-height: min( min(720px, calc(100dvh - 32px)), 100%);
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--hc-line);
    border-radius: 18px;
    background: var(--hc-surface);
    color: var(--hc-text);
    box-shadow: var(--hc-shadow);
    font-family: 'DM Sans', 'Segoe UI', sans-serif;
    text-align: start;
    direction: inherit;
}

.hc-dialog[open] {
    display: flex;
    flex-direction: column;
    animation: hc-dialog-in 180ms cubic-bezier(.2, .75, .25, 1) both;
}

.hc-dialog--fallback[open] {
    position: fixed;
    z-index: 2147483001;
    inset: auto;
    top: 50%;
    left: 50%;
    margin: 0;
    animation: hc-fallback-in 180ms cubic-bezier(.2, .75, .25, 1) both;
}

body.hc-dialog-fallback::before {
    position: fixed;
    z-index: 2147483000;
    inset: 0;
    background: rgba(5, 11, 16, .72);
    backdrop-filter: blur(5px);
    content: "";
}

.hc-dialog::backdrop {
    background: rgba(5, 11, 16, .66);
    backdrop-filter: blur(5px);
    animation: hc-backdrop-in 160ms ease-out both;
}

.hc-dialog.hc-light {
    --hc-surface: #f8faf9;
    --hc-surface-raised: #edf3f1;
    --hc-text: #17262a;
    --hc-muted: #5b6c70;
    --hc-line: rgba(35, 68, 69, .16);
    --hc-accent: #087d69;
    --hc-accent-ink: #ffffff;
    --hc-danger: #b33e3e;
    --hc-shadow: 0 24px 80px rgba(18, 40, 42, .24);
}

.hc-dialog__topline {
    height: 3px;
    flex: 0 0 3px;
    background: linear-gradient(90deg, var(--hc-accent), rgba(119, 214, 192, .16));
}

.hc-dialog[data-type="error"] .hc-dialog__topline,
.hc-dialog[data-type="danger"] .hc-dialog__topline {
    background: linear-gradient(90deg, var(--hc-danger), rgba(255, 129, 121, .16));
}

.hc-dialog__body {
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 18px 30px 24px;
}

.hc-dialog__header {
    flex: 0 0 auto;
    padding: 27px 30px 0;
}

.hc-dialog__eyebrow {
    margin: 0 0 10px;
    color: var(--hc-accent);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .16em;
    line-height: 1.4;
    text-transform: uppercase;
}

.hc-dialog[data-type="error"] .hc-dialog__eyebrow,
.hc-dialog[data-type="danger"] .hc-dialog__eyebrow {
    color: var(--hc-danger);
}

.hc-dialog__title {
    margin: 0;
    color: var(--hc-text);
    font-family: 'Manrope', 'Segoe UI', sans-serif;
    font-size: clamp(21px, 5vw, 26px);
    font-weight: 750;
    letter-spacing: -.035em;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.hc-dialog__message {
    margin: 13px 0 0;
    color: var(--hc-muted);
    font-size: 14px;
    line-height: 1.65;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.hc-dialog__form {
    margin-top: 22px;
}

.hc-dialog__label {
    display: block;
    margin: 0 0 8px;
    color: var(--hc-text);
    font-size: 12px;
    font-weight: 700;
}

.hc-dialog__input {
    display: block;
    width: 100%;
    min-height: 48px;
    padding: 11px 13px;
    border: 1px solid var(--hc-line);
    border-radius: 9px;
    outline: none;
    background: var(--hc-surface-raised);
    color: var(--hc-text);
    font: 600 15px 'DM Sans', 'Segoe UI', sans-serif;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

.hc-dialog__input:focus {
    border-color: var(--hc-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--hc-accent) 19%, transparent);
}

.hc-dialog__input[aria-invalid="true"] {
    border-color: var(--hc-danger);
}

.hc-dialog__error {
    min-height: 20px;
    margin: 7px 0 0;
    color: var(--hc-danger);
    font-size: 12px;
    line-height: 1.5;
}

.hc-dialog__actions {
    display: flex;
    flex: 0 0 auto;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 22px;
    border-top: 1px solid var(--hc-line);
    background: var(--hc-surface);
}

.hc-dialog__button {
    min-width: 102px;
    min-height: 43px;
    padding: 10px 17px;
    border: 1px solid transparent;
    border-radius: 9px;
    cursor: pointer;
    font: 700 13px 'DM Sans', 'Segoe UI', sans-serif;
    transition: transform 130ms ease, background-color 130ms ease, border-color 130ms ease;
}

.hc-dialog__button:hover {
    transform: translateY(-1px);
}

.hc-dialog__button:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--hc-accent) 50%, transparent);
    outline-offset: 2px;
}

.hc-dialog__button--secondary {
    border-color: var(--hc-line);
    background: var(--hc-surface-raised);
    color: var(--hc-text);
}

.hc-dialog__button--secondary:hover {
    border-color: color-mix(in srgb, var(--hc-accent) 55%, var(--hc-line));
}

.hc-dialog__button--primary {
    background: var(--hc-accent);
    color: var(--hc-accent-ink);
    box-shadow: 0 4px 14px color-mix(in srgb, var(--hc-accent) 20%, transparent);
}

.hc-dialog[data-type="error"] .hc-dialog__button--primary,
.hc-dialog[data-type="danger"] .hc-dialog__button--primary {
    background: var(--hc-danger);
    color: #fff;
}

.hc-dialog__button--primary:hover {
    filter: brightness(1.07);
}

.hc-dialog :focus-visible {
    outline-color: var(--hc-accent);
}

@keyframes hc-dialog-in {
    from { opacity: 0; transform: translateY(9px) scale(.99); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes hc-backdrop-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes hc-fallback-in {
    from { opacity: 0; transform: translate(-50%, -48%) scale(.99); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@media (max-width: 540px) {
    .hc-dialog {
        width: calc(100vw - 24px);
        max-height: calc(100dvh - 24px);
        border-radius: 15px;
    }
    .hc-dialog__body {
        padding: 23px 21px 19px;
    }
    .hc-dialog__actions {
        padding: 12px 15px max(12px, env(safe-area-inset-bottom));
    }
    .hc-dialog__button {
        flex: 1;
        min-width: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hc-dialog[open],
    .hc-dialog::backdrop {
        animation: none;
    }
    .hc-dialog__button,
    .hc-dialog__input {
        transition: none;
    }
    .hc-dialog--fallback[open] {
        animation: none;
    }
}
