.stanloop-ai-assistant {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 24px;
    margin: 0 0 24px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.stanloop-ai-assistant__hero {
    margin-bottom: 22px;
}

.stanloop-ai-assistant__eyebrow,
.stanloop-ai-modal__eyebrow {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6366f1;
}

.stanloop-ai-assistant h2 {
    margin: 0 0 10px;
    font-size: 28px;
    line-height: 1.2;
}

.stanloop-ai-assistant__hero p:last-child {
    margin-bottom: 0;
    color: #4b5563;
}

.stanloop-ai-assistant__notice {
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 18px;
    font-size: 14px;
}

.stanloop-ai-assistant__notice--warning {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #9a3412;
}

.stanloop-ai-assistant__topics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}

.stanloop-ai-assistant__topic {
    text-align: left;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 14px;
    cursor: pointer;
    color: #111827;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.stanloop-ai-assistant__topic:hover,
.stanloop-ai-assistant__topic:focus {
    background: #eef2ff;
    border-color: #6366f1;
    transform: translateY(-1px);
}

.stanloop-ai-assistant__topic strong,
.stanloop-ai-assistant__topic span {
    display: block;
}

.stanloop-ai-assistant__topic strong {
    font-size: 15px;
    margin-bottom: 5px;
}

.stanloop-ai-assistant__topic span {
    font-size: 13px;
    color: #4b5563;
    line-height: 1.4;
}

.stanloop-ai-assistant__footer-note {
    margin-top: 16px;
    font-size: 13px;
    color: #6b7280;
}

.stanloop-ai-modal-open {
    overflow: hidden;
}

.stanloop-ai-modal[hidden] {
    display: none !important;
}

.stanloop-ai-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
}

.stanloop-ai-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.56);
}

.stanloop-ai-modal__dialog {
    position: relative;
    width: min(760px, calc(100vw - 28px));
    max-height: calc(100vh - 36px);
    margin: 18px auto;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.stanloop-ai-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.stanloop-ai-modal__header h3 {
    margin: 0;
    font-size: 22px;
    line-height: 1.25;
}

.stanloop-ai-modal__close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 999px;
    background: #f3f4f6;
    color: #111827;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.stanloop-ai-modal__close:hover,
.stanloop-ai-modal__close:focus {
    background: #e5e7eb;
}

.stanloop-ai-modal__messages {
    flex: 1 1 auto;
    min-height: 260px;
    max-height: 52vh;
    overflow-y: auto;
    padding: 18px 20px;
    background: #f9fafb;
}

.stanloop-ai-message {
    margin-bottom: 14px;
}

.stanloop-ai-message__label {
    margin: 0 0 5px;
    font-size: 12px;
    font-weight: 700;
    color: #6b7280;
}

.stanloop-ai-message__bubble {
    display: inline-block;
    max-width: min(620px, 100%);
    padding: 12px 14px;
    border-radius: 15px;
    white-space: pre-wrap;
    line-height: 1.55;
    font-size: 14px;
}

.stanloop-ai-message--assistant .stanloop-ai-message__bubble {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    color: #111827;
}

.stanloop-ai-message--creator {
    text-align: right;
}

.stanloop-ai-message--creator .stanloop-ai-message__bubble {
    text-align: left;
    background: #111827;
    border: 1px solid #111827;
    color: #ffffff;
}

.stanloop-ai-modal__chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 20px 0;
    border-top: 1px solid #e5e7eb;
    background: #ffffff;
}

.stanloop-ai-chip {
    border: 1px solid #c7d2fe;
    background: #eef2ff;
    color: #3730a3;
    border-radius: 999px;
    padding: 8px 11px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.stanloop-ai-chip:hover,
.stanloop-ai-chip:focus {
    background: #e0e7ff;
}

.stanloop-ai-modal__composer {
    padding: 14px 20px 18px;
    background: #ffffff;
}

.stanloop-ai-modal__composer textarea {
    width: 100%;
    min-height: 78px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 11px 12px;
    resize: vertical;
    font-size: 15px;
    line-height: 1.45;
    background: #ffffff;
}

.stanloop-ai-modal__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.stanloop-ai-modal__send {
    border: 0;
    border-radius: 999px;
    padding: 10px 18px;
    background: #111827;
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
}

.stanloop-ai-modal__send:disabled,
.stanloop-ai-modal__composer textarea:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.stanloop-ai-modal__status {
    font-size: 14px;
    color: #4b5563;
}

.stanloop-ai-modal__status.is-error {
    color: #b91c1c;
    font-weight: 700;
}

.stanloop-ai-modal__setup-warning {
    padding: 12px 20px;
    background: #fff7ed;
    color: #9a3412;
    border-top: 1px solid #fed7aa;
    font-size: 14px;
}

@media (max-width: 720px) {
    .stanloop-ai-assistant {
        padding: 18px;
        border-radius: 14px;
    }

    .stanloop-ai-assistant h2 {
        font-size: 23px;
    }

    .stanloop-ai-assistant__topics {
        grid-template-columns: 1fr;
    }

    .stanloop-ai-modal__dialog {
        width: calc(100vw - 16px);
        max-height: calc(100vh - 16px);
        margin: 8px auto;
        border-radius: 14px;
    }

    .stanloop-ai-modal__messages {
        max-height: 50vh;
        padding: 14px;
    }

    .stanloop-ai-modal__header,
    .stanloop-ai-modal__composer,
    .stanloop-ai-modal__chips {
        padding-left: 14px;
        padding-right: 14px;
    }
}

.stanloop-ai-message__bubble--draft {
    display: block;
    width: min(620px, 100%);
}

.stanloop-ai-draft-card h4 {
    margin: 0 0 6px;
    font-size: 17px;
    line-height: 1.3;
}

.stanloop-ai-draft-card__helper {
    margin: 0 0 14px;
    color: #4b5563;
    font-size: 13px;
}

.stanloop-ai-draft-field {
    display: block;
    margin: 0 0 12px;
}

.stanloop-ai-draft-field span {
    display: block;
    margin: 0 0 5px;
    font-weight: 700;
    font-size: 13px;
    color: #374151;
}

.stanloop-ai-draft-field input,
.stanloop-ai-draft-field textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 9px 10px;
    font-size: 14px;
    line-height: 1.4;
    background: #ffffff;
}

.stanloop-ai-draft-field textarea {
    resize: vertical;
}

.stanloop-ai-draft-card__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.stanloop-ai-draft-card__save,
.stanloop-ai-draft-card__cancel {
    border: 0;
    border-radius: 999px;
    padding: 9px 14px;
    font-weight: 700;
    cursor: pointer;
}

.stanloop-ai-draft-card__save {
    background: #111827;
    color: #ffffff;
}

.stanloop-ai-draft-card__cancel {
    background: #f3f4f6;
    color: #111827;
}

.stanloop-ai-draft-card__save:disabled,
.stanloop-ai-draft-card__cancel:disabled,
.stanloop-ai-draft-field input:disabled,
.stanloop-ai-draft-field textarea:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.stanloop-ai-draft-card__status {
    font-size: 13px;
    color: #047857;
    font-weight: 700;
}

.stanloop-ai-draft-card__status.is-error {
    color: #b91c1c;
}

/* v0.1.43 Structured Discussed Link UX */
.stanloop-ai-modal__composer[hidden] {
    display: none !important;
}

.stanloop-ai-structured-card h4 {
    margin: 0 0 6px;
    font-size: 17px;
    line-height: 1.3;
}

.stanloop-ai-structured-card__helper {
    margin: 0 0 14px;
    color: #4b5563;
    font-size: 13px;
}

.stanloop-ai-structured-card__inline-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: -2px 0 14px;
}

.stanloop-ai-structured-card__secondary {
    border: 1px solid #c7d2fe;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    padding: 8px 12px;
    font-weight: 700;
    cursor: pointer;
}

.stanloop-ai-structured-card__secondary:hover,
.stanloop-ai-structured-card__secondary:focus {
    background: #e0e7ff;
}

.stanloop-ai-structured-card__status {
    font-size: 13px;
    color: #047857;
    font-weight: 700;
}

.stanloop-ai-structured-card__status.is-error {
    color: #b91c1c;
}

/* v0.1.44 Discussed Link UX Polish */
.stanloop-ai-draft-card__preview {
    display: grid;
    gap: 8px;
    margin: 12px 0 14px;
}

.stanloop-ai-draft-card__preview-row {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #f9fafb;
    padding: 9px 10px;
}

.stanloop-ai-draft-card__preview-row strong,
.stanloop-ai-draft-card__preview-row span,
.stanloop-ai-draft-card__preview-row a {
    display: block;
}

.stanloop-ai-draft-card__preview-row strong {
    margin-bottom: 3px;
    color: #374151;
    font-size: 12px;
}

.stanloop-ai-draft-card__preview-row span,
.stanloop-ai-draft-card__preview-row a {
    color: #111827;
    font-size: 13px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.stanloop-ai-draft-card__preview-row span {
    white-space: pre-line;
}

.stanloop-ai-draft-card__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    padding: 9px 14px;
    font-weight: 700;
    text-decoration: none;
    background: #111827;
    color: #ffffff;
    cursor: pointer;
}

.stanloop-ai-draft-card__link:hover,
.stanloop-ai-draft-card__link:focus {
    color: #ffffff;
    text-decoration: none;
}


/* v0.1.52 Fan FAQ formatted draft preview */
.stanloop-ai-draft-card__preview-row span {
    white-space: pre-line;
}

/* v0.1.58 Broadcast AI setup */
.stanloop-ai-broadcast-card .stanloop-ai-draft-field textarea {
    min-height: 220px;
}

.stanloop-ai-broadcast-tools {
    display: grid;
    gap: 9px;
    margin: 0 0 12px;
}

.stanloop-ai-broadcast-tools__file,
.stanloop-ai-broadcast-tools__input {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 9px 10px;
    background: #ffffff;
    font-size: 14px;
}

@media (min-width: 700px) {
    .stanloop-ai-broadcast-tools {
        grid-template-columns: 1fr auto;
        align-items: center;
    }

    .stanloop-ai-broadcast-tools__input {
        grid-column: span 1;
    }
}

/* v0.1.59 Broadcast cursor-safe insertion tools */
.stanloop-ai-broadcast-tools .stanloop-ai-structured-card__secondary {
    min-height: 40px;
}

/* v0.1.65 Discussed Link Instagram/Reel intake upgrades */
.stanloop-ai-draft-field select {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 9px 10px;
    font-size: 14px;
    line-height: 1.4;
    background: #ffffff;
}

.stanloop-ai-draft-field input[type="file"] {
    padding: 8px;
    background: #f9fafb;
}

.stanloop-ai-draft-card__preview-row span {
    white-space: pre-wrap;
}
