/**
 * HairColorGPT Unified UI Components
 * Component layer for shared UI patterns.
 */

.hcgpt-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--hcgpt-space-2);
    padding: var(--hcgpt-space-2) var(--hcgpt-space-4);
    border: 1px solid var(--hcgpt-color-border);
    border-radius: var(--hcgpt-radius-md);
    background: var(--hcgpt-color-surface);
    color: var(--hcgpt-color-text);
    font-size: var(--hcgpt-text-sm);
    font-weight: var(--hcgpt-font-weight-regular);
    line-height: var(--hcgpt-line-height-120);
    text-decoration: none;
    cursor: pointer;
    transition: background var(--hcgpt-transition-fast), border-color var(--hcgpt-transition-fast), color var(--hcgpt-transition-fast), box-shadow var(--hcgpt-transition-fast), transform var(--hcgpt-transition-fast);
    font-family: var(--hcgpt-font-sans);
    font-style: normal;
}

.hcgpt-btn--primary {
    background: var(--hcgpt-primary);
    border-color: var(--hcgpt-primary);
    color: var(--hcgpt-color-on-primary);
    box-shadow: var(--hcgpt-shadow-sm);
}

.hcgpt-btn--primary:hover {
    background: var(--hcgpt-primary-hover);
    border-color: var(--hcgpt-primary-hover);
    box-shadow: var(--hcgpt-shadow-base);
}

.hcgpt-btn--secondary {
    background: var(--hcgpt-color-surface);
    border-color: var(--hcgpt-color-border);
    color: var(--hcgpt-color-text);
}

.hcgpt-btn--secondary:hover {
    background: var(--hcgpt-color-surface-2);
    border-color: var(--hcgpt-color-border);
}

.hcgpt-btn--ghost {
    background: transparent;
    border-color: transparent;
    color: var(--hcgpt-color-text-muted);
}

.hcgpt-btn--ghost:hover {
    background: var(--hcgpt-color-surface-2);
    border-color: var(--hcgpt-color-border);
    color: var(--hcgpt-color-text);
}

.hcgpt-btn--danger {
    background: var(--hcgpt-danger);
    border-color: var(--hcgpt-danger);
    color: var(--hcgpt-color-on-danger);
    box-shadow: var(--hcgpt-shadow-sm);
}

.hcgpt-btn--danger:hover {
    background: var(--hcgpt-danger-hover);
    border-color: var(--hcgpt-danger-hover);
    box-shadow: var(--hcgpt-shadow-base);
}

.hcgpt-btn--sm {
    padding: var(--hcgpt-space-1) var(--hcgpt-space-3);
    font-size: var(--hcgpt-text-xs);
}

.hcgpt-btn--md {
    padding: var(--hcgpt-space-2) var(--hcgpt-space-4);
    font-size: var(--hcgpt-text-sm);
}

.hcgpt-btn--lg {
    padding: var(--hcgpt-space-3) var(--hcgpt-space-5);
    font-size: var(--hcgpt-text-base);
}

.hcgpt-btn--icon {
    width: calc(var(--hcgpt-space-6) + var(--hcgpt-space-3));
    height: calc(var(--hcgpt-space-6) + var(--hcgpt-space-3));
    padding: 0;
    border-radius: var(--hcgpt-radius-full);
}

.hcgpt-btn:disabled,
.hcgpt-btn.is-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.hcgpt-btn.is-loading {
    position: relative;
    opacity: 0.7;
    pointer-events: none;
}

.hcgpt-btn.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: hcgpt-btn-spin 700ms linear infinite;
}

@keyframes hcgpt-btn-spin {
    to {
        transform: rotate(360deg);
    }
}

.hcgpt-field {
    display: flex;
    flex-direction: column;
    gap: var(--hcgpt-space-2);
    margin-bottom: var(--hcgpt-space-4);
}

.hcgpt-label {
    font-size: var(--hcgpt-text-sm);
    font-weight: var(--hcgpt-font-weight-semibold);
    color: var(--hcgpt-color-text);
}

.hcgpt-help {
    font-size: var(--hcgpt-text-xs);
    color: var(--hcgpt-color-text-muted);
    font-family: var(--hcgpt-font-sans);
}

.hcgpt-error-text {
    font-size: var(--hcgpt-text-xs);
    color: var(--hcgpt-danger);
}

.hcgpt-input,
.hcgpt-textarea,
.hcgpt-select {
    width: 100%;
    padding: var(--hcgpt-space-2) var(--hcgpt-space-3);
    border: 1px solid var(--hcgpt-color-border);
    border-radius: var(--hcgpt-radius-md);
    background: var(--hcgpt-color-surface);
    color: var(--hcgpt-color-text);
    font-size: var(--hcgpt-text-sm);
    transition: border-color var(--hcgpt-transition-fast), box-shadow var(--hcgpt-transition-fast);
}
.hcgpt-input {
    font-family: var(--hcgpt-font-sans);
}


.hcgpt-textarea {
    min-height: 120px;
    resize: vertical;
}

.hcgpt-field.is-invalid .hcgpt-input,
.hcgpt-field.is-invalid .hcgpt-textarea,
.hcgpt-field.is-invalid .hcgpt-select {
    border-color: var(--hcgpt-danger);
}

.hcgpt-card {
    background: var(--hcgpt-color-surface);
    border: 1px solid var(--hcgpt-color-border);
    border-radius: var(--hcgpt-radius-lg);
    box-shadow: var(--hcgpt-shadow-sm);
    overflow: hidden;
}

.hcgpt-card--flat {
    box-shadow: none;
}

.hcgpt-card__header,
.hcgpt-card__body,
.hcgpt-card__footer {
    padding: var(--hcgpt-space-4);
}

.hcgpt-card__header {
    background: var(--hcgpt-color-surface-2);
    border-bottom: 1px solid var(--hcgpt-color-border);
}

.hcgpt-card__footer {
    background: var(--hcgpt-color-surface-2);
    border-top: 1px solid var(--hcgpt-color-border);
}

.hcgpt-card__title {
    margin: 0;
    font-size: var(--hcgpt-text-md);
    color: var(--hcgpt-color-text);
    font-family: var(--hcgpt-font-heading);
    font-weight: var(--hcgpt-font-weight-medium);
    font-style: normal;
    text-transform: capitalize;
}

.hcgpt-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--hcgpt-space-1);
    padding: 2px var(--hcgpt-space-2);
    border-radius: var(--hcgpt-radius-full);
    font-size: var(--hcgpt-text-xs);
    font-weight: var(--hcgpt-font-weight-bold);
    border: 1px solid transparent;
    font-family: var(--hcgpt-font-sans);
    font-style: normal;
}

.hcgpt-badge--success {
    background: var(--hcgpt-success);
    color: var(--hcgpt-color-on-success);
}

.hcgpt-badge--warning {
    background: var(--hcgpt-warning);
    color: var(--hcgpt-color-on-warning);
}

.hcgpt-badge--danger {
    background: var(--hcgpt-danger);
    color: var(--hcgpt-color-on-danger);
}

.hcgpt-badge--info {
    background: var(--hcgpt-info);
    color: var(--hcgpt-color-on-info);
}

.hcgpt-badge--neutral {
    background: var(--hcgpt-color-surface-2);
    border-color: var(--hcgpt-color-border);
    color: var(--hcgpt-color-text-muted);
}

.hcgpt-alert {
    padding: var(--hcgpt-space-3) var(--hcgpt-space-4);
    border: 1px solid var(--hcgpt-color-border);
    border-left-width: 4px;
    border-radius: var(--hcgpt-radius-md);
    background: var(--hcgpt-color-surface-2);
    color: var(--hcgpt-color-text);
}

.hcgpt-alert--success {
    border-left-color: var(--hcgpt-success);
}

.hcgpt-alert--warning {
    border-left-color: var(--hcgpt-warning);
}

.hcgpt-alert--danger {
    border-left-color: var(--hcgpt-danger);
}

.hcgpt-alert--info {
    border-left-color: var(--hcgpt-info);
}

.hcgpt-alert--neutral {
    border-left-color: var(--hcgpt-color-border-strong);
}

.hcgpt-tabs {
    border: 1px solid var(--hcgpt-color-border);
    border-radius: var(--hcgpt-radius-md);
    background: var(--hcgpt-color-surface);
    overflow: hidden;
}

.hcgpt-tablist {
    display: flex;
    gap: var(--hcgpt-space-2);
    padding: var(--hcgpt-space-2);
    border-bottom: 1px solid var(--hcgpt-color-border);
    background: var(--hcgpt-color-surface-2);
}

.hcgpt-tab {
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--hcgpt-radius-md);
    padding: var(--hcgpt-space-2) var(--hcgpt-space-3);
    font-size: var(--hcgpt-text-sm);
    color: var(--hcgpt-color-text-muted);
    cursor: pointer;
    transition: background var(--hcgpt-transition-fast), border-color var(--hcgpt-transition-fast), color var(--hcgpt-transition-fast);
}

.hcgpt-tab:hover {
    background: var(--hcgpt-color-surface);
    border-color: var(--hcgpt-color-border);
    color: var(--hcgpt-color-text);
}

.hcgpt-tabpanel {
    padding: var(--hcgpt-space-4);
    color: var(--hcgpt-color-text);
}

.hcgpt-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--hcgpt-color-border);
    border-radius: var(--hcgpt-radius-md);
    overflow: hidden;
    background: var(--hcgpt-color-surface);
    font-size: var(--hcgpt-text-sm);
}

.hcgpt-table th,
.hcgpt-table td {
    padding: var(--hcgpt-space-2) var(--hcgpt-space-3);
    text-align: left;
    border-bottom: 1px solid var(--hcgpt-color-border);
}

.hcgpt-table thead th {
    background: var(--hcgpt-color-surface-2);
    color: var(--hcgpt-color-text);
    font-weight: var(--hcgpt-font-weight-semibold);
}

.hcgpt-table tbody tr:nth-child(even) {
    background: var(--hcgpt-color-surface-2);
}

.hcgpt-table tbody tr:last-child td {
    border-bottom: none;
}

.hcgpt-modal-demo {
    position: relative;
    min-height: 240px;
    border: 1px dashed var(--hcgpt-color-border);
    border-radius: var(--hcgpt-radius-md);
    background: var(--hcgpt-color-surface-2);
    overflow: hidden;
}

.hcgpt-modal-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--hcgpt-space-4);
    background: var(--hcgpt-color-overlay);
    z-index: var(--hcgpt-z-modal);
}

.hcgpt-modal-overlay--demo {
    position: absolute;
    inset: 0;
    background: var(--hcgpt-color-overlay-soft);
    z-index: 1;
}

.hcgpt-modal {
    width: 100%;
    max-width: 520px;
    background: var(--hcgpt-color-surface);
    border-radius: var(--hcgpt-radius-lg);
    box-shadow: var(--hcgpt-shadow-lg);
    overflow: hidden;
}

.hcgpt-modal__header,
.hcgpt-modal__body,
.hcgpt-modal__footer {
    padding: var(--hcgpt-space-4);
}

.hcgpt-modal__header {
    border-bottom: 1px solid var(--hcgpt-color-border);
}

.hcgpt-modal__title {
    margin: 0;
    font-size: var(--hcgpt-text-md);
    color: var(--hcgpt-type-structural-strong);
    font-family: var(--hcgpt-font-sans);
    font-weight: var(--hcgpt-font-weight-semibold);
    text-transform: var(--hcgpt-text-transform-uppercase);
    letter-spacing: var(--hcgpt-letter-spacing-003em);
}

.hcgpt-modal__body {
    color: var(--hcgpt-color-text-muted);
}

.hcgpt-modal__footer {
    border-top: 1px solid var(--hcgpt-color-border);
    display: flex;
    justify-content: flex-end;
    gap: var(--hcgpt-space-2);
}

.hcgpt-stack {
    display: flex;
    flex-direction: column;
    gap: var(--hcgpt-space-4);
}

.hcgpt-inline {
    display: flex;
    flex-wrap: wrap;
    gap: var(--hcgpt-space-3);
    align-items: center;
}

.hcgpt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--hcgpt-space-4);
}

.hcgpt-divider {
    height: 1px;
    background: var(--hcgpt-color-border);
    border: 0;
    margin: var(--hcgpt-space-4) 0;
}

/* Prose / Markdown typography (chat messages) */
:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-prose {
    color: var(--hcgpt-color-text);
    font-size: 15px;
    font-weight: var(--hcgpt-font-weight-regular);
    line-height: 1.7;
    word-wrap: break-word;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-prose> :where(p,
    ul,
    ol,
    pre,
    blockquote,
    table,
    h1,
    h2,
    h3,
    h4,
    h5,
    h6,
    hr) {
    margin: 0 0 var(--hcgpt-space-3);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-prose> :last-child {
    margin-bottom: 0;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-prose :is(h1, h2, h3, h4, h5, h6) {
    margin-top: var(--hcgpt-space-4);
    margin-bottom: var(--hcgpt-space-2);
    font-family: var(--hcgpt-font-heading);
    font-style: normal;
    text-transform: var(--hcgpt-text-transform-none);
    letter-spacing: var(--hcgpt-letter-spacing-0);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-prose :is(h1, h2, h3, h4, h5, h6):first-child {
    margin-top: 0;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-prose h1 {
    font-size: 28px;
    font-weight: var(--hcgpt-font-weight-bold);
    line-height: 1.25;
    color: var(--hcgpt-type-editorial-strong);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-prose h2 {
    font-size: 22px;
    font-weight: var(--hcgpt-font-weight-bold);
    line-height: 1.3;
    color: var(--hcgpt-type-structural-soft);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-prose h3 {
    font-size: 18px;
    font-weight: var(--hcgpt-font-weight-semibold);
    line-height: 1.35;
    color: var(--hcgpt-type-editorial-mid);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-prose h4 {
    font-size: 16px;
    font-weight: var(--hcgpt-font-weight-semibold);
    line-height: 1.4;
    color: var(--hcgpt-type-structural-strong);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-prose h5 {
    font-size: 14px;
    font-weight: var(--hcgpt-font-weight-semibold);
    line-height: 1.4;
    color: var(--hcgpt-type-editorial-mid);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-prose h6 {
    font-size: 13px;
    font-weight: var(--hcgpt-font-weight-semibold);
    line-height: 1.4;
    color: var(--hcgpt-type-structural-soft);
}

/* Assistant/Bot prose typography refresh (light-only). */
:where(#hcgpt-unified-chat-wrapper[data-hcgpt-theme="light"], .hcgpt-scope[data-hcgpt-theme="light"])
:is(.hcgpt-message.assistant, .hcgpt-message.bot, .hcgpt-message-assistant, .hcgpt-message-bot)
.hcgpt-message-content.hcgpt-prose {
    --hcgpt-bot-prose-color: #414141;
    --hcgpt-bot-h1-color: #616161;
    --hcgpt-bot-h2-color: #414141;
    --hcgpt-bot-h3-color: #313131;
    --hcgpt-bot-h4-color: #212121;
    --hcgpt-bot-h5-color: #111111;
    --hcgpt-bot-h6-color: #111111;
    --hcgpt-bot-h1-size: 26px;
    --hcgpt-bot-h2-size: 20px;
    --hcgpt-bot-h3-size: 16px;
    --hcgpt-bot-h4-size: 14px;
    --hcgpt-bot-h5-size: 12px;
    --hcgpt-bot-h6-size: 11px;
}

@media (prefers-color-scheme: light) {
    :where(#hcgpt-unified-chat-wrapper[data-hcgpt-theme="system"], .hcgpt-scope[data-hcgpt-theme="system"])
    :is(.hcgpt-message.assistant, .hcgpt-message.bot, .hcgpt-message-assistant, .hcgpt-message-bot)
    .hcgpt-message-content.hcgpt-prose {
        --hcgpt-bot-prose-color: #414141;
        --hcgpt-bot-h1-color: #616161;
        --hcgpt-bot-h2-color: #414141;
        --hcgpt-bot-h3-color: #313131;
        --hcgpt-bot-h4-color: #212121;
        --hcgpt-bot-h5-color: #111111;
        --hcgpt-bot-h6-color: #111111;
        --hcgpt-bot-h1-size: 26px;
        --hcgpt-bot-h2-size: 20px;
        --hcgpt-bot-h3-size: 16px;
        --hcgpt-bot-h4-size: 14px;
        --hcgpt-bot-h5-size: 12px;
        --hcgpt-bot-h6-size: 11px;
    }
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope)
:is(.hcgpt-message.assistant, .hcgpt-message.bot, .hcgpt-message-assistant, .hcgpt-message-bot)
.hcgpt-message-content.hcgpt-prose {
    color: var(--hcgpt-bot-prose-color, var(--hcgpt-color-text));
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope)
:is(.hcgpt-message.assistant, .hcgpt-message.bot, .hcgpt-message-assistant, .hcgpt-message-bot)
.hcgpt-message-content.hcgpt-prose h1 {
    font-size: var(--hcgpt-bot-h1-size, 28px);
    color: var(--hcgpt-bot-h1-color, var(--hcgpt-type-editorial-strong));
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope)
:is(.hcgpt-message.assistant, .hcgpt-message.bot, .hcgpt-message-assistant, .hcgpt-message-bot)
.hcgpt-message-content.hcgpt-prose h2 {
    font-size: var(--hcgpt-bot-h2-size, 22px);
    color: var(--hcgpt-bot-h2-color, var(--hcgpt-type-structural-soft));
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope)
:is(.hcgpt-message.assistant, .hcgpt-message.bot, .hcgpt-message-assistant, .hcgpt-message-bot)
.hcgpt-message-content.hcgpt-prose h3 {
    font-size: var(--hcgpt-bot-h3-size, 18px);
    color: var(--hcgpt-bot-h3-color, var(--hcgpt-type-editorial-mid));
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope)
:is(.hcgpt-message.assistant, .hcgpt-message.bot, .hcgpt-message-assistant, .hcgpt-message-bot)
.hcgpt-message-content.hcgpt-prose h4 {
    font-size: var(--hcgpt-bot-h4-size, 16px);
    color: var(--hcgpt-bot-h4-color, var(--hcgpt-type-structural-strong));
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope)
:is(.hcgpt-message.assistant, .hcgpt-message.bot, .hcgpt-message-assistant, .hcgpt-message-bot)
.hcgpt-message-content.hcgpt-prose h5 {
    font-size: var(--hcgpt-bot-h5-size, 14px);
    color: var(--hcgpt-bot-h5-color, var(--hcgpt-type-editorial-mid));
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope)
:is(.hcgpt-message.assistant, .hcgpt-message.bot, .hcgpt-message-assistant, .hcgpt-message-bot)
.hcgpt-message-content.hcgpt-prose h6 {
    font-size: var(--hcgpt-bot-h6-size, 13px);
    color: var(--hcgpt-bot-h6-color, var(--hcgpt-type-structural-soft));
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-prose p {
    font-size: 15px;
    font-weight: var(--hcgpt-font-weight-regular);
    line-height: 1.7;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-prose :is(strong, b) {
    font-size: inherit;
    font-weight: var(--hcgpt-font-weight-bold);
    line-height: inherit;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-prose :is(em, i) {
    font-size: inherit;
    font-style: italic;
    font-weight: var(--hcgpt-font-weight-regular);
    line-height: inherit;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-prose :is(figcaption, caption, label, .hcgpt-caption, .hcgpt-label) {
    font-size: 12px;
    font-weight: var(--hcgpt-font-weight-semibold);
    line-height: 1.4;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-prose :is(ul, ol) {
    padding-left: 1.25rem;
    margin-bottom: var(--hcgpt-space-3);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-prose li {
    font-size: 15px;
    font-weight: var(--hcgpt-font-weight-regular);
    line-height: 1.65;
    margin: 0 0 5px;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-prose li:last-child {
    margin-bottom: 0;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-prose :is(ul, ol) :is(ul, ol) > li {
    font-size: 14px;
    font-weight: var(--hcgpt-font-weight-regular);
    line-height: 1.6;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-prose li>p {
    margin: 0;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-prose a {
    color: var(--hcgpt-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-prose a:hover {
    color: var(--hcgpt-primary-hover);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-prose code {
    font-family: var(--hcgpt-font-mono);
    font-size: 13px;
    font-weight: var(--hcgpt-font-weight-regular);
    line-height: 1.5;
    font-style: normal;
    background: var(--hcgpt-color-surface-2);
    border: 1px solid var(--hcgpt-color-border);
    border-radius: var(--hcgpt-radius-sm);
    padding: 0.1em 0.35em;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-message-content.hcgpt-prose code {
    font-size: 13px;
    font-weight: var(--hcgpt-font-weight-regular);
    line-height: 1.5;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-prose pre {
    background: var(--hcgpt-color-surface-2);
    border: 1px solid var(--hcgpt-color-border);
    border-radius: var(--hcgpt-radius-md);
    padding: var(--hcgpt-space-3);
    overflow-x: auto;
    max-width: 100%;
    font-family: var(--hcgpt-font-mono);
    font-size: 13px;
    font-weight: var(--hcgpt-font-weight-regular);
    line-height: 1.6;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-prose pre code {
    background: none;
    border: 0;
    padding: 0;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-prose blockquote {
    margin: 0 0 var(--hcgpt-space-3);
    padding-left: var(--hcgpt-space-3);
    border-left: 3px solid var(--hcgpt-color-border-strong);
    color: var(--hcgpt-color-text-muted);
    font-size: 15px;
    font-weight: var(--hcgpt-font-weight-regular);
    line-height: 1.7;
    font-style: normal;
    opacity: 0.6;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-prose hr {
    border: 0;
    border-top: 1px solid var(--hcgpt-color-border);
    margin: var(--hcgpt-space-4) 0;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-prose table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--hcgpt-text-sm);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-prose th,
:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-prose td {
    border: 1px solid var(--hcgpt-color-border);
    padding: var(--hcgpt-space-2) var(--hcgpt-space-3);
    text-align: left;
    vertical-align: top;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-prose thead th {
    background: var(--hcgpt-color-surface-2);
    color: var(--hcgpt-color-text);
    font-weight: var(--hcgpt-font-weight-semibold);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-prose img {
    max-width: 100%;
    height: auto;
}

/* Chat frame alignment (messages + input share the same column) */
:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-chat-container {
    padding-left: calc(var(--hcgpt-chat-frame-pad) + env(safe-area-inset-left, 0px));
    padding-right: calc(var(--hcgpt-chat-frame-pad) + env(safe-area-inset-right, 0px));
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-messages {
    width: 100%;
    max-width: var(--hcgpt-messages-max-width, var(--hcgpt-chat-frame-max));
    margin-inline: var(--hcgpt-messages-margin-inline, auto);
    position: relative;
    z-index: var(--hcgpt-messages-z-index, 0);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-input-box {
    width: 100%;
    max-width: var(--hcgpt-input-box-max-width, calc(var(--hcgpt-chat-frame-max) - 40px));
    margin-inline: var(--hcgpt-input-box-margin-inline, auto);
    position: relative;
    z-index: var(--hcgpt-input-box-z-index, 1000);
}

/* Message turns (user/assistant) */
:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-turn {
    padding: var(--hcgpt-space-3) var(--hcgpt-space-4);
    border-radius: var(--hcgpt-bubble-radius);
    line-height: var(--hcgpt-line-height-150);
    word-wrap: break-word;
    position: relative;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-turn--assistant {
    background: var(--hcgpt-bubble-assistant-bg);
    color: var(--hcgpt-color-text);
    align-self: flex-start;
    margin-right: auto;
    margin-left: 0;
    padding-left: 0;
    border: 1px solid transparent;
    max-width: var(--hcgpt-bubble-assistant-max);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-turn--user {
    background: var(--hcgpt-bubble-user-bg);
    color: var(--hcgpt-color-text);
    align-self: flex-end;
    margin-left: auto;
    margin-right: 0;
    border: 1px solid var(--hcgpt-bubble-border);
    max-width: var(--hcgpt-bubble-user-max);
}

/* Menu shells */
:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) :is(.hcgpt-dropdown, .hcgpt-action-menu, .hcgpt-portal-menu, .hcgpt-positive-feedback-dropdown-content, .hcgpt-tools-menu, .hcgpt-chat-style-menu) {
    background-color: var(--hcgpt-overlay-bg);
    border: 1px solid var(--hcgpt-overlay-border);
    border-radius: var(--hcgpt-menu-shell-radius, var(--hcgpt-overlay-radius));
    box-shadow: var(--hcgpt-overlay-shadow);
}

/* Overlays / modals */
:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) :is(.hcgpt-share-modal, .hcgpt-feedback-modal, .hcgpt-modal-dialog) {
    background-color: var(--hcgpt-overlay-bg);
    border: 1px solid var(--hcgpt-overlay-border);
    border-radius: var(--hcgpt-overlay-radius);
    box-shadow: var(--hcgpt-overlay-shadow);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) :is(.hcgpt-share-overlay, .hcgpt-feedback-overlay, .hcgpt-modal-overlay) {
    background: var(--hcgpt-overlay-backdrop-bg);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-modal-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .4);
    z-index: 9999;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-modal-overlay[aria-hidden="false"],
:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-modal-overlay.is-visible {
    display: flex;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-modal-dialog {
    max-width: 760px;
    width: 92%;
    padding: 20px 22px;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-modal-dialog h3 {
    margin: 0 0 8px 0;
    font-family: var(--hcgpt-font-heading);
    font-weight: var(--hcgpt-font-weight-semibold);
    text-transform: var(--hcgpt-text-transform-uppercase);
    letter-spacing: var(--hcgpt-letter-spacing-003em);
    color: var(--hcgpt-type-structural-strong);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-modal-dialog p {
    margin: 0 0 14px 0;
    font-size: var(--hcgpt-font-size-14);
    line-height: var(--hcgpt-line-height-150);
    font-family: var(--hcgpt-font-sans);
    font-weight: var(--hcgpt-font-weight-thin);
    font-style: normal;
    text-transform: var(--hcgpt-text-transform-none);
}

/* Composer (chat input + controls) */
:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-chatbox-input-container {
    background: transparent;
    color: var(--hcgpt-color-text);
    border-color: var(--hcgpt-color-border);
    padding-left: var(--hcgpt-chatbox-input-pad-left, calc(var(--hcgpt-chat-frame-pad) + var(--hcgpt-chat-shell-pad, 0px) + env(safe-area-inset-left, 0px)));
    padding-right: var(--hcgpt-chatbox-input-pad-right, calc(var(--hcgpt-chat-frame-pad) + var(--hcgpt-chat-shell-pad, 0px) + env(safe-area-inset-right, 0px)));
}

#hcgpt-input-box {
    bottom: 0px;
    width: 100%;
    border-radius: 20px 20px 0 0;
    border: none;
    padding-block: 8px 16px;
    padding-inline: 0;
    box-sizing: border-box;
    --hcgpt-send-size: 36px;
    --hcgpt-send-inset-x: 4px;
    --hcgpt-send-inset-y: 4px;
    --hcgpt-send-gap: 6px;
    --hcgpt-send-icon-size: 18px;
    --hcgpt-send-stop-icon-size: 20px;
    --hcgpt-send-stop-square-size: 12px;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-user-input {
    background: var(--hcgpt-input-bg);
    border: 1px solid var(--hcgpt-input-border);
    border-radius: var(--hcgpt-input-radius);
    color: var(--hcgpt-color-text);
    box-shadow: none;
    transition: border-color var(--hcgpt-transition-fast), box-shadow var(--hcgpt-transition-fast), background var(--hcgpt-transition-fast), color var(--hcgpt-transition-fast);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-user-input::placeholder {
    color: var(--hcgpt-placeholder-color);
    font-size: 15px;
    font-weight: var(--hcgpt-font-weight-regular);
    line-height: 1.7;
    opacity: 0.4;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-user-input::selection {
    background: color-mix(in srgb, var(--hcgpt-color-focus-ring) 25%, transparent);
    color: var(--hcgpt-color-text);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-user-input:disabled {
    opacity: var(--hcgpt-control-disabled-opacity);
    cursor: not-allowed;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-input-box .hcgpt-btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    height: 36px;
    border: 0;
    background: transparent;
    color: var(--hcgpt-color-text-muted);
    border-radius: 12px;
    padding: 0 .75rem;
    cursor: pointer;
    transition: background var(--hcgpt-transition-fast), color var(--hcgpt-transition-fast), box-shadow var(--hcgpt-transition-fast), transform var(--hcgpt-transition-fast);
    font-weight: var(--hcgpt-font-weight-regular);
    font-family: var(--hcgpt-font-sans);
    font-style: normal;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-input-box .hcgpt-btn--icon {
    width: 36px;
    justify-content: center;
    padding: 0;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-input-box .hcgpt-btn--pill {
    padding: 0 .9rem;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-input-box .hcgpt-btn:hover {
    background: var(--hcgpt-control-hover-bg);
    color: var(--hcgpt-color-text);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-input-box .hcgpt-btn:disabled,
:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-input-box .hcgpt-btn.is-disabled {
    opacity: var(--hcgpt-control-disabled-opacity);
    cursor: not-allowed;
    pointer-events: none;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-input-box .hcgpt-btn-stt,
:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-input-box .hcgpt-btn-rec,
:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-stt-btn,
:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-rec-btn {
    background: transparent;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    color: var(--hcgpt-color-text-muted);
    transition: background var(--hcgpt-transition-fast), color var(--hcgpt-transition-fast), opacity var(--hcgpt-transition-fast);
    flex-shrink: 0;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-input-box .hcgpt-btn-stt:hover,
:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-input-box .hcgpt-btn-rec:hover,
:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-stt-btn:hover,
:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-rec-btn:hover {
    background: var(--hcgpt-control-hover-bg);
    color: var(--hcgpt-color-text);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-input-box .hcgpt-btn-stt:disabled,
:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-input-box .hcgpt-btn-rec:disabled,
:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-stt-btn:disabled,
:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-rec-btn:disabled {
    opacity: var(--hcgpt-control-disabled-opacity);
    cursor: not-allowed;
    pointer-events: none;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-input-box .hcgpt-btn-stt.recording svg {
    stroke: var(--hcgpt-danger);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-send-btn {
    position: absolute;
    right: var(--hcgpt-send-inset-x);
    bottom: var(--hcgpt-send-inset-y);
    z-index: 101;
    width: var(--hcgpt-send-size);
    height: var(--hcgpt-send-size);
    min-width: var(--hcgpt-send-size);
    min-height: var(--hcgpt-send-size);
    border-radius: 50%;
    display: grid;
    place-items: center;
    padding: 0;
    box-sizing: border-box;
    cursor: pointer;
    background: var(--hcgpt-input-bg);
    border: 1px solid var(--hcgpt-input-border);
    color: var(--hcgpt-color-text);
    box-shadow: none;
    transition: background var(--hcgpt-transition-fast), border-color var(--hcgpt-transition-fast), color var(--hcgpt-transition-fast), box-shadow var(--hcgpt-transition-fast), transform var(--hcgpt-transition-fast);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) :is(#hcgpt-right-controls, .hcgpt-right-controls) {
    position: absolute;
    right: calc(var(--hcgpt-send-inset-x) + var(--hcgpt-send-size) + var(--hcgpt-send-gap));
    bottom: var(--hcgpt-send-inset-y);
    z-index: 101;
    display: flex;
    align-items: center;
    gap: var(--hcgpt-send-gap);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-send-btn:hover {
    background: var(--hcgpt-control-hover-bg);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-send-btn:disabled,
:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-send-btn.is-loading,
:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-send-btn[aria-disabled="true"] {
    opacity: var(--hcgpt-control-disabled-opacity);
    cursor: not-allowed;
    pointer-events: none;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-send-btn.hcgpt-stop-mode {
    background: var(--hcgpt-control-active-bg);
}

/* Dark mode: remove chat input borders (composer field + send button) */
:where(.hcgpt-scope[data-hcgpt-theme="dark"]) :is(#hcgpt-user-input, #hcgpt-send-btn),
:where(body.hcgpt-chat-page.hcgpt-theme-dark) :is(#hcgpt-user-input, #hcgpt-send-btn),
:where(body.hcgpt-chat-page[data-hcgpt-theme="dark"]) :is(#hcgpt-user-input, #hcgpt-send-btn),
:where([data-hcgpt-theme="dark"]) #hcgpt-unified-chat-wrapper :is(#hcgpt-user-input, #hcgpt-send-btn) {
    border-color: transparent;
}

@media (prefers-color-scheme: dark) {
    :where(.hcgpt-scope:not([data-hcgpt-theme])) :is(#hcgpt-user-input, #hcgpt-send-btn),
    :where(.hcgpt-scope[data-hcgpt-theme="system"]) :is(#hcgpt-user-input, #hcgpt-send-btn),
    :where(body.hcgpt-chat-page.hcgpt-theme-system) :is(#hcgpt-user-input, #hcgpt-send-btn) {
        border-color: transparent;
    }
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-send-btn.hcgpt-stop-mode:hover {
    background: var(--hcgpt-control-hover-bg);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-send-btn svg {
    width: var(--hcgpt-send-icon-size);
    height: var(--hcgpt-send-icon-size);
    display: block;
    color: currentColor;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-send-btn.hcgpt-stop-mode svg {
    width: var(--hcgpt-send-stop-icon-size);
    height: var(--hcgpt-send-stop-icon-size);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-upload-btn,
:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-grey-buttons-container>label,
:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-grey-buttons-container .hcgpt-grey-btn,
:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-refresh-suggestions,
:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-websearch-btn,
:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-tools-main-btn {
    color: var(--hcgpt-color-text-muted);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-upload-btn:hover,
:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-grey-buttons-container>label:hover,
:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-grey-buttons-container .hcgpt-grey-btn:hover,
:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-refresh-suggestions:hover,
:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-websearch-btn:hover,
:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-tools-main-btn:hover {
    background: var(--hcgpt-control-hover-bg);
    color: var(--hcgpt-color-text);
}

/* Tool dropdown menu items */
:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-tools-menu {
    color: var(--hcgpt-color-text);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-tool-item {
    color: var(--hcgpt-color-text);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-tool-item:hover {
    background: var(--hcgpt-menu-item-hover-bg, var(--hcgpt-overlay-item-hover-bg));
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-tools-divider {
    background: var(--hcgpt-color-border);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-tool-item.hcgpt-tool-reset,
:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-tool-reset {
    color: var(--hcgpt-color-text-muted);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-tool-item.hcgpt-tool-reset:hover,
:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-tool-reset:hover {
    color: var(--hcgpt-danger);
    background: color-mix(in srgb, var(--hcgpt-danger) 12%, transparent);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-tool-indicator {
    background: color-mix(in srgb, var(--hcgpt-accent) 12%, var(--hcgpt-surface));
    border: 1px solid color-mix(in srgb, var(--hcgpt-accent) 35%, var(--hcgpt-color-border));
    color: var(--hcgpt-accent);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-indicator-close {
    color: var(--hcgpt-accent);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-indicator-close:hover {
    background: color-mix(in srgb, var(--hcgpt-accent) 18%, transparent);
    color: var(--hcgpt-accent);
}

/* Welcome block */
:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-chat-welcome-screen {
    width: 100%;
    max-width: min(820px, 100%);
    margin: 0 auto;
    padding: var(--hcgpt-space-2) var(--hcgpt-space-4);
    text-align: center;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-chat-welcome-title {
    margin: 0;
    color: var(--hcgpt-color-text);
    font-family: var(--hcgpt-font-sans);
    font-size: clamp(var(--hcgpt-font-size-28), 3vw, var(--hcgpt-font-size-35));
    font-weight: var(--hcgpt-font-weight-regular);
    line-height: var(--hcgpt-line-height-120);
    letter-spacing: var(--hcgpt-letter-spacing-0);
    text-transform: var(--hcgpt-text-transform-none);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-chat-welcome-subtitle {
    margin: var(--hcgpt-space-2) auto 0;
    max-width: 42ch;
    color: var(--hcgpt-color-text-muted);
    font-family: var(--hcgpt-font-sans);
    font-size: var(--hcgpt-font-size-18);
    font-weight: var(--hcgpt-font-weight-light);
    line-height: var(--hcgpt-line-height-140);
    letter-spacing: var(--hcgpt-letter-spacing-0);
}

@media (max-width: 767.98px) {
    :where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-chat-welcome-screen {
        padding-inline: var(--hcgpt-space-3);
    }

    :where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-chat-welcome-subtitle {
        font-size: var(--hcgpt-font-size-16);
        max-width: 28ch;
    }
}

@media (prefers-reduced-motion: reduce) {

    .hcgpt-btn,
    .hcgpt-input,
    .hcgpt-textarea,
    .hcgpt-select,
    .hcgpt-tab {
        transition: none;
    }
.hcgpt-input {
    font-family: var(--hcgpt-font-sans);
}

.hcgpt-btn {
    font-family: var(--hcgpt-font-sans);
    font-weight: var(--hcgpt-font-weight-regular);
    font-style: normal;
}


    .hcgpt-btn.is-loading::after {
        animation: none;
    }
}
