/*
 * Contentosapp Studio Admin — Settings tab styles.
 * Extracted from costudio-admin.css for tab-specific loading.
 */

/* Settings save bar — card footer matching ContentOS page-footer pattern */
.fos-settings-save-bar {
    background: var(--fos-surface);
    border: 1px solid var(--fos-border);
    border-radius: 10px;
    padding: 14px 20px;
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: var(--fos-shadow);
}

.fos-settings-save-bar__hint {
    font-size: 12px;
    color: var(--fos-text-dim);
}

.fos-settings-save-bar__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.fos-settings-save-bar__msg {
    font-size: 12px;
    color: var(--fos-text-sub);
}

.fos-settings-save-bar__msg.is-success {
    color: var(--fos-success);
    font-weight: 600;
}

.fos-settings-save-bar__msg.is-error {
    color: var(--fos-danger);
    font-weight: 600;
}

/* ── Contentosapp Studio-specific components below ───────────────────────────────────── */
/*
 * NOTE: .fos-tab-btn / .fos-tab-panel are used instead of .cts-tab-btn /
 * .cts-tab-panel to avoid conflicts with the Core admin.js tab system when
 * both plugins are active simultaneously.
 *
 * @package Contentosapp_Studio
 * @since   1.0.0
 */

/* ── Contentosapp Studio Settings Tabs (.fos-tab-btn / .fos-tab-panel) ────────────────── */
/* Isolated from Core's .cts-tab-btn / .cts-tab-panel to prevent JS interference */

.fos-tab-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    background: #fff;
    border: 1px solid var(--fos-border);
    border-radius: 10px;
    margin-top: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.fos-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--fos-text-sub);
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.fos-tab-btn:hover {
    color: var(--fos-primary);
    background: var(--fos-primary-faint);
}

/* M12: Tab active com focus ring unificado */
.fos-tab-btn.is-active {
    color: var(--fos-primary);
    background: var(--fos-primary-light);
    border-color: rgba(108, 71, 255, 0.2);
    box-shadow: 0 1px 3px rgba(108, 71, 255, 0.1);
}

/* M8: Tab fade transition aplicado nas abas de settings */
.fos-tab-panel {
    display: none;
}

.fos-tab-panel.is-active {
    display: block;
    animation: fos-tab-fade-in 0.18s ease forwards;
}


/* ── Settings: pipeline overview + agent cards ─────────────────────────────── */

.fos-pipeline-overview {
    background: var(--fos-bg-soft, #fafaf9);
    border: 1px solid var(--fos-border);
    border-radius: var(--fos-radius);
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: var(--fos-shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.06));
}

.fos-pipeline-overview__title {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--fos-text-dim);
    margin: 0 0 12px;
}

.fos-pipeline-overview__steps {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0;
    padding-bottom: 4px;
}

.fos-pipeline-step {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.fos-pipeline-connector {
    width: 28px;
    height: 1px;
    background: var(--fos-border);
    flex-shrink: 0;
}

.fos-pipeline-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 0 4px;
    margin: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    font: inherit;
    color: inherit;
}

/* A3: Corrigido — remove outline apenas para mouse (via :focus-visible),
   mantendo foco visível para usuários de teclado em todos os browsers */
.fos-pipeline-node:focus {
    outline: 2px solid var(--fos-primary);
    outline-offset: 2px;
}

/* Override: esconde anel de foco quando navegado com mouse (browsers modernos) */
.fos-pipeline-node:focus:not(:focus-visible) {
    outline: none;
}

.fos-pipeline-node:focus-visible {
    outline: 2px solid var(--fos-primary);
    outline-offset: 2px;
}

.fos-pipeline-node__circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--fos-border);
    background: var(--fos-bg-soft, #f8f8f9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: border-color 0.15s, background 0.15s;
    position: relative;
}

.fos-pipeline-node:hover .fos-pipeline-node__circle {
    border-color: rgba(108, 71, 255, 0.35);
    background: rgba(108, 71, 255, 0.06);
}

.fos-pipeline-node--custom .fos-pipeline-node__circle {
    border-color: var(--fos-primary);
    background: rgba(108, 71, 255, 0.08);
}

.fos-pipeline-node__dot {
    display: none;
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--fos-primary);
    border: 2px solid var(--fos-bg-soft, #fafaf9);
}

.fos-pipeline-node--custom .fos-pipeline-node__dot {
    display: block;
}

.fos-pipeline-node__label {
    font-size: 10px;
    color: var(--fos-text-dim);
    text-align: center;
    white-space: nowrap;
    max-width: 88px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fos-pipeline-node--custom .fos-pipeline-node__label {
    color: var(--fos-primary);
    font-weight: 600;
}

/* Rótulo “Instruções dos agentes”: usa .cts-mod-zone-label (admin.css) */

.fos-settings-disclaimer {
    margin-bottom: 16px;
}

.fos-settings-disclaimer a {
    color: var(--fos-primary);
    text-decoration: none;
    font-weight: 500;
}

.fos-settings-disclaimer a:hover {
    color: var(--fos-primary-dark);
    text-decoration: underline;
}


.fos-settings-prompts-form {
    margin: 0;
}

.fos-settings-agents-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.fos-agent-card {
    background: var(--fos-bg-soft, #fafaf9);
    border: 1px solid var(--fos-border);
    border-left: 3px solid var(--fos-border);
    border-radius: var(--fos-radius);
    overflow: hidden;
    box-shadow: var(--fos-shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.06));
    transition: border-left-color 0.15s, box-shadow 0.15s;
}

.fos-agent-card--open,
.fos-agent-card--custom {
    border-left-color: var(--fos-primary);
}

.fos-agent-card--open {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.fos-agent-card__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    cursor: pointer;
    user-select: none;
    transition: background 0.12s;
}

.fos-agent-card__header:hover {
    background: rgba(0, 0, 0, 0.02);
}

.fos-agent-card--open .fos-agent-card__header {
    background: rgba(0, 0, 0, 0.02);
    border-bottom: 1px solid var(--fos-border);
}

.fos-agent-card__num {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: var(--fos-bg-soft, #f8f8f9);
    border: 1px solid var(--fos-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: var(--fos-text-dim);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    flex-shrink: 0;
    transition: all 0.15s;
}

.fos-agent-card--open .fos-agent-card__num,
.fos-agent-card--custom .fos-agent-card__num {
    background: rgba(108, 71, 255, 0.1);
    border-color: rgba(108, 71, 255, 0.35);
    color: var(--fos-primary);
}

.fos-agent-card__emoji {
    font-size: 16px;
    flex-shrink: 0;
}

.fos-agent-card__info {
    flex: 1;
    min-width: 0;
}

.fos-agent-card__name {
    font-size: 13px;
    font-weight: 600;
    color: var(--fos-text);
    margin-bottom: 2px;
}

.fos-agent-card__role {
    font-size: 11px;
    color: var(--fos-text-dim);
    line-height: 1.35;
}

.fos-agent-card__badges {
    flex-shrink: 0;
}

.fos-agent-card__badge {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 4px;
}

.fos-agent-card__badge--default {
    background: var(--fos-bg-soft, #f8f8f9);
    color: var(--fos-text-dim);
    border: 1px solid var(--fos-border);
}

.fos-agent-card__badge--custom {
    background: rgba(108, 71, 255, 0.1);
    color: var(--fos-primary);
    border: 1px solid rgba(108, 71, 255, 0.35);
}

.fos-agent-card__chevron {
    color: var(--fos-text-dim);
    font-size: 10px;
    flex-shrink: 0;
    transition: transform 0.2s, color 0.2s;
}

.fos-agent-card--open .fos-agent-card__chevron {
    transform: rotate(180deg);
    color: var(--fos-primary);
}

.fos-agent-card__body {
    display: none;
    padding: 16px 18px;
}

.fos-agent-card--open .fos-agent-card__body {
    display: block;
}

.fos-agent-card__hint {
    font-size: 11px;
    color: var(--fos-text-dim);
    margin: 0 0 10px;
    line-height: 1.5;
}

.fos-agent-card__vars {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 12px;
}

.fos-agent-var {
    font-size: 10px;
    font-weight: 600;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    padding: 2px 8px;
    border-radius: 4px;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.fos-agent-card__textarea-wrap {
    margin: 0;
}

.fos-agent-card__textarea {
    width: 100%;
    min-height: 200px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    line-height: 1.6;
    border: 1px solid var(--fos-border);
    border-radius: var(--fos-radius-sm);
    padding: 12px 14px;
    resize: vertical;
    color: var(--fos-text);
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}

.fos-agent-card__textarea:focus {
    outline: none;
    border-color: var(--fos-primary);
    box-shadow: 0 0 0 3px rgba(108, 71, 255, 0.12);
}

.fos-agent-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.fos-agent-card__footer-hint {
    font-size: 11px;
    color: var(--fos-text-dim);
    margin: 0;
    flex: 1;
    min-width: 160px;
}

.fos-agent-card__actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* Agents inside flush card body */
.fos-int-card__body--flush .fos-agent-card {
    border: none;
    border-bottom: 1px solid var(--fos-border);
    border-left: 3px solid transparent;
    border-radius: 8px;
    box-shadow: none;
}

.fos-int-card__body--flush .fos-agent-card:last-child {
    border-bottom: none;
}

.fos-int-card__body--flush .fos-agent-card--open,
.fos-int-card__body--flush .fos-agent-card--custom {
    border-left-color: var(--fos-primary);
}

.fos-int-card__body--flush .fos-agent-card--open {
    box-shadow: none;
}

.fos-int-card__body--flush .fos-settings-agents-list {
    gap: 0;
    margin-bottom: 0;
}

.fos-settings-save-all {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding-top: 16px;
    margin-top: 8px;
    border-top: 1px solid var(--fos-border);
}

.fos-settings-save-all__hint {
    font-size: 12px;
    color: var(--fos-text-dim);
    margin: 0;
    flex: 1;
    min-width: 200px;
}

.fos-settings-save-all__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

/* ── Settings: site cards (Sites tab) ─────────────────────────────────────── */

.fos-sites-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.fos-site-card {
    background: #fff;
    border: 1px solid var(--fos-border);
    border-left: 4px solid var(--fos-site-accent, var(--fos-primary));
    border-radius: var(--fos-radius);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: background 0.12s;
}

.fos-site-card:hover {
    background: var(--fos-surface-2, #f9fafb);
}

.fos-site-card__avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--fos-site-soft, var(--fos-primary-faint, #EAE6FF));
    border: 1px solid var(--fos-site-border, rgba(108, 71, 255, 0.2));
    color: var(--fos-site-accent, var(--fos-primary, #6C47FF));
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
    font-family: inherit;
}

.fos-site-card__body,
.fos-site-card__info {
    flex: 1;
    min-width: 0;
}

.fos-site-card__info strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--fos-text);
    margin: 0 0 2px;
}

.fos-site-card__meta {
    margin-top: 4px;
}

.fos-site-card__name {
    font-size: 14px;
    font-weight: 600;
    color: var(--fos-text);
    margin: 0 0 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fos-site-card__url {
    font-size: 12px;
    color: var(--fos-text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fos-site-card__status {
    font-size: 11px;
    font-weight: 600;
    margin-top: 4px;
    min-height: 14px;
}

.fos-site-card__status.is-ok {
    color: var(--fos-success);
}

.fos-site-card__status.is-error {
    color: var(--fos-danger);
}

.fos-site-card__cats {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

/* ── Contextual Provider Tip ────────────────────────────────────────────── */

/* Fix: hardcoded color substituído por token + M19: PRO tip card */
.fos-provider-tip-card {
    background: var(--fos-bg-soft);
    border: 0.5px solid var(--fos-border);
    border-radius: 8px;
    padding: 12px 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    box-sizing: border-box;
    position: relative;
}

.fos-provider-tip-icon {
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Fix: Substituindo hardcoded color por token CSS */
.fos-provider-tip-content {
    font-size: 11px;
    color: var(--fos-text-dim);
    line-height: 1.5;
    margin: 0;
}

.fos-site-card__cat-tag {
    font-size: 10px;
    font-weight: 500;
    color: var(--fos-text-sub);
    background: var(--fos-surface-2, #f3f4f6);
    border: 1px solid var(--fos-border);
    border-radius: 4px;
    padding: 1px 6px;
    white-space: nowrap;
}

.fos-site-card__cat-more {
    font-size: 10px;
    font-weight: 600;
    color: var(--fos-primary);
    padding: 1px 4px;
}

.fos-site-card__actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.fos-site-card__actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid var(--fos-border);
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    transition: all 0.12s;
}

.fos-edit-site-btn:hover {
    background: var(--fos-primary-light);
    border-color: rgba(108, 71, 255, 0.3);
}

.fos-open-voice-btn:hover,
.fos-upsell-voice-btn:hover {
    background: var(--fos-primary-light);
    border-color: rgba(108, 71, 255, 0.3);
}

.fos-delete-site-btn:hover {
    background: #fef2f2;
    border-color: rgba(220, 38, 38, 0.3);
}

/* M9: Empty state de sites — melhorado com ícone e botão contextual */
.fos-sites-empty {
    text-align: center;
    padding: 48px 24px;
    border: 2px dashed var(--fos-border);
    border-radius: var(--fos-radius);
    color: var(--fos-text-dim);
    font-size: 14px;
}

.fos-sites-empty__icon {
    font-size: 32px;
    display: block;
    margin-bottom: 12px;
    opacity: 0.7;
}

.fos-sites-empty__title {
    font-size: 15px;
    font-weight: 600;
    color: var(--fos-text-sub);
    margin: 0 0 6px;
}

.fos-sites-empty__desc {
    font-size: 12px;
    color: var(--fos-text-dim);
    margin: 0 0 18px;
    line-height: 1.5;
}

@media (max-width: 782px) {
    .fos-site-card {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 600px) {
    .fos-settings-save-all__actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .fos-settings-save-all__actions .cts-btn {
        width: 100%;
    }
}

/* ==========================================================================
   Extracted From costudio-admin.css (Settings integrations + sites support)
   ========================================================================== */

/* ── AI Provider — Integration Cards ──────────────────────────────────────── */

/* Zone label — matches fos-lic-zone-label / cts-int-zone-label pattern */
.fos-int-zone-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--fos-text-dim);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
}

.fos-int-zone-label:not(:first-child) {
    margin-top: 20px;
}

.fos-int-zone-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--fos-border);
}

/* Integration card */
.fos-int-card {
    background: #fff;
    border: 1px solid var(--fos-border);
    border-radius: var(--fos-radius-sm);
    box-shadow: var(--fos-shadow);
    overflow: hidden;
}

.fos-int-card+.fos-int-zone-label {
    margin-top: 20px;
}

.fos-int-card__header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--fos-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.fos-int-card__left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

/* Icon box — 36px rounded box with primary faint background */
.fos-int-card__icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    font-size: 17px;
    flex-shrink: 0;
    background: var(--fos-primary-faint);
    border: 1px solid var(--fos-primary-border);
}

.fos-int-card__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--fos-text);
    margin: 0 0 2px;
    line-height: 1.3;
}

.fos-int-card__subtitle {
    font-size: 11px;
    color: var(--fos-text-dim);
    margin: 0;
    line-height: 1.4;
}

/* Status indicator */
.fos-int-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.fos-int-status__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--fos-text-dim);
    flex-shrink: 0;
}

.fos-int-status__text {
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    color: var(--fos-text-dim);
}

.fos-int-status--ok .fos-int-status__dot {
    background: var(--fos-success);
    box-shadow: 0 0 4px rgba(5, 150, 105, .45);
}

.fos-int-status--ok .fos-int-status__text {
    color: var(--fos-success);
}

.fos-int-status--warn .fos-int-status__dot {
    background: var(--fos-warning);
}

.fos-int-status--warn .fos-int-status__text {
    color: var(--fos-warning);
}

.fos-int-status--error .fos-int-status__dot {
    background: var(--fos-danger);
}

.fos-int-status--error .fos-int-status__text {
    color: var(--fos-danger);
}

/* Card body */
.fos-int-card__body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Fieldsets wrap Image / Web Search rows: without flex+gap, inner grid + full-width fields stack flush */
.fos-int-card__body>fieldset {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    border: 0;
    padding: 0;
    margin: 0;
}

.fos-int-card__body--flush {
    padding: 10px;
}

.fos-int-card__body--flush .fos-sites-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.fos-int-card__body--flush .fos-site-card {
    border: none;
    border-bottom: 1px solid var(--fos-border);
    border-radius: 0;
}

.fos-int-card__body--flush .fos-site-card:last-of-type {
    border-bottom: none;
}

.fos-int-card__body--flush .fos-sites-empty {
    padding: 32px 20px;
    text-align: center;
}

/* Grid */
.fos-int-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

@media (max-width: 900px) {
    .fos-int-grid {
        grid-template-columns: 1fr;
    }
}

/* Fields */
.fos-int-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.fos-int-field--full {
    grid-column: 1 / -1;
}

.fos-int-field>label {
    font-size: 12px;
    font-weight: 600;
    color: var(--fos-text, #111827);
    margin: 0;
}

input.fos-int-input {
    width: 100%;
    padding: 8px 12px;
    margin: 0;
    font-size: 12px;
    color: var(--fos-text, #111827);
    background: #fff;
    border: 1px solid var(--fos-border, #e5e7eb);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
    transition: border-color .15s, box-shadow .15s;
    outline: none;
    box-sizing: border-box;
}

input.fos-int-input:focus {
    border-color: var(--fos-primary, #6c47ff);
    box-shadow: 0 0 0 3px rgba(108, 71, 255, 0.12);
}

.fos-int-hint {
    font-size: 11px;
    color: var(--fos-text-dim);
    margin: 4px 0 0;
    line-height: 1.4;
}

.fos-int-hint a {
    color: var(--fos-primary);
    text-decoration: none;
}

.fos-int-hint a:hover {
    text-decoration: underline;
}

/* PRO notice card used in Image / Web Search sections */
.fos-int-pro-notice {
    margin: 0 0 10px;
    padding: 10px 12px;
    border: 1px solid rgba(245, 158, 11, 0.35);
    background: #fffbeb;
    border-radius: 8px;
    font-size: 12px;
    color: #92400e;
    line-height: 1.45;
}

/* ContentOS Auto: notice + diagnose button on one row (notice grows, button fixed) */
.fos-contentos-auto-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    margin: 0;
}

.fos-contentos-auto-banner .fos-contentos-auto-banner__notice {
    flex: 1 1 320px;
    min-width: min(100%, 200px);
    margin-bottom: 0;
    background: var(--fos-accent-light);
    border-color: var(--fos-accent-light);
    color: var(--fos-success);
}

#fos-img-contentos-info .fos-int-pro-notice {
    background: var(--fos-accent-light);
    border-color: var(--fos-accent-light);
    color: var(--fos-success);
    margin-bottom: 0;
}

.fos-contentos-auto-banner__diagnose {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.fos-diagnose-api-btn {
    font-size: 12px !important;
    white-space: nowrap;
}

/* API connectivity diagnose — panel aligned with Contentosapp Studio cards (no heavy green slab) */
.fos-diagnose-api-result {
    margin: 0 0 12px;
}

.fos-diagnose-api-result--panel {
    border: 1px solid var(--fos-border);
    border-radius: 10px;
    background: var(--fos-surface);
    box-shadow: var(--fos-shadow);
    overflow: hidden;
}

.fos-diagnose-api-result--state-loading .fos-diagnose-api-result__scroll {
    padding: 16px 18px;
}

.fos-diagnose-api-result__lead {
    margin: 0 0 12px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--fos-text-sub);
}

.fos-diagnose-api-result__progress {
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg,
            var(--fos-border) 20%,
            rgba(99, 102, 241, 0.55) 50%,
            var(--fos-border) 80%);
    background-size: 200% 100%;
    animation: fos-diagnose-shimmer 1.15s ease-in-out infinite;
}

@keyframes fos-diagnose-shimmer {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: -100% 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .fos-diagnose-api-result__progress {
        animation: none;
        background: var(--fos-border);
    }
}

.fos-diagnose-api-result__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 10px 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--fos-border);
    background: var(--fos-bg-soft);
}

.fos-diagnose-api-result__head-main {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 10px;
    min-width: 0;
    flex: 1;
}

.fos-diagnose-api-result__toggle.button-link {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    padding: 4px 0;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--fos-primary);
    box-shadow: none;
}

.fos-diagnose-api-result__toggle.button-link:hover {
    color: var(--fos-text);
    text-decoration: underline;
}

.fos-diagnose-api-result__toggle.button-link:focus {
    outline: 1px solid var(--fos-primary);
    outline-offset: 2px;
}

.fos-diagnose-api-result--collapsed .fos-diagnose-api-result__scroll {
    display: none;
}

.fos-diagnose-api-result--collapsed .fos-diagnose-api-result__head {
    border-bottom: none;
}

.fos-diagnose-api-result__scroll {
    padding: 0;
}

.fos-diagnose-api-result--state-success .fos-diagnose-api-result__head {
    background: rgba(34, 197, 94, 0.06);
}

.fos-diagnose-api-result--state-warning .fos-diagnose-api-result__head {
    background: rgba(245, 158, 11, 0.07);
}

.fos-diagnose-api-result--state-error.fos-diagnose-api-result--panel {
    border-color: rgba(239, 68, 68, 0.35);
}

.fos-diagnose-api-result__title {
    font-size: 12px;
    font-weight: 600;
    color: var(--fos-text);
    letter-spacing: 0.01em;
}

.fos-diagnose-api-result__badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    line-height: 1.2;
}

.fos-diagnose-api-result__badge--ok {
    color: #15803d;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.fos-diagnose-api-result__badge--warn {
    color: #b45309;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.28);
}

.fos-diagnose-api-result__list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    list-style: none;
    margin: 0;
    padding: 12px;
}

.fos-diagnose-api-result__row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 10px 10px 8px;
    border: 1px solid var(--fos-border);
    border-radius: 8px;
    background: var(--fos-bg-soft);
    font-size: 12px;
    line-height: 1.45;
    min-height: 100%;
    box-sizing: border-box;
}

@media (max-width: 960px) {
    .fos-diagnose-api-result__list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .fos-diagnose-api-result__list {
        grid-template-columns: 1fr;
    }
}

.fos-diagnose-api-result__mark {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    margin-top: 5px;
    border-radius: 50%;
}

.fos-diagnose-api-result__row--ok .fos-diagnose-api-result__mark {
    background: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

.fos-diagnose-api-result__row--fail .fos-diagnose-api-result__mark {
    background: #f97316;
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.22);
}

.fos-diagnose-api-result__body {
    flex: 1;
    min-width: 0;
}

.fos-diagnose-api-result__label {
    font-weight: 600;
    color: var(--fos-text);
}

.fos-diagnose-api-result__detail {
    margin-top: 3px;
    font-size: 11px;
    color: var(--fos-text-dim);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    word-break: break-word;
}

.fos-diagnose-api-result__scroll .fos-diagnose-api-result__error {
    margin: 0;
    padding: 14px 16px;
    font-size: 12px;
    line-height: 1.55;
    color: var(--fos-danger);
    background: rgba(239, 68, 68, 0.06);
    border-radius: 0 0 8px 8px;
}

.fos-diagnose-api-result--state-error .fos-diagnose-api-result__scroll {
    padding: 0;
}

@media (max-width: 600px) {
    .fos-contentos-auto-banner {
        align-items: flex-start;
    }

    .fos-contentos-auto-banner .fos-contentos-auto-banner__notice {
        flex: 1 1 100%;
    }

    .fos-contentos-auto-banner__diagnose {
        width: 100%;
        justify-content: stretch;
    }

    .fos-diagnose-api-btn {
        width: 100%;
        white-space: normal;
        text-align: center;
    }
}

.fos-int-pro-notice a {
    color: var(--fos-primary);
    text-decoration: none;
    font-weight: 600;
}

.fos-int-pro-notice a:hover {
    text-decoration: underline;
}

/* Scoped overrides for selects inside AI tab */
#fos-tab-ai select.fos-int-select {
    width: 100%;
    max-width: none !important;
    padding: 9px 28px 9px 12px;
    border: 1px solid var(--fos-border-input);
    border-radius: 7px;
    background-color: var(--fos-bg-soft);
    font-size: 12px;
    line-height: normal;
    -webkit-appearance: none !important;
    appearance: none !important;
    background-repeat: no-repeat !important;
    background-position: right 10px center !important;
    box-shadow: none;
    cursor: pointer;
    outline: none;
    transition: all .12s;
    color: var(--fos-text);
}

#fos-tab-ai select.fos-int-select:focus,
#fos-tab-ai select.fos-int-select:active {
    border-color: var(--fos-primary);
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23a0a0b0' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 10px center !important;
    box-shadow: 0 0 0 3px rgba(108, 71, 255, .12);
}

#fos-tab-ai select.fos-int-select option:disabled {
    color: var(--fos-text-dim);
}

/* Scoped override for API key input */
#fos-tab-ai .fos-int-apikey-wrap .cts-input {
    width: 100%;
    padding: 9px 40px 9px 12px;
    border: 1px solid var(--fos-border-input);
    border-radius: 7px;
    background: var(--fos-bg-soft);
    font-size: 12px;
    color: var(--fos-text);
    box-shadow: none;
    box-sizing: border-box;
    transition: all .12s;
    outline: none;
    line-height: normal;
}

#fos-tab-ai .fos-int-apikey-wrap .cts-input:focus {
    border-color: var(--fos-primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(108, 71, 255, .12);
}

#fos-tab-ai .fos-search-results-input {
    width: 100%;
    height: 40px;
    padding: 9px 12px;
    border: 1px solid var(--fos-border-input);
    border-radius: 7px;
    background: var(--fos-bg-soft);
    font-size: 12px;
    color: var(--fos-text);
    box-shadow: none;
    box-sizing: border-box;
    transition: all .12s;
    outline: none;
    line-height: normal;
}

#fos-tab-ai .fos-search-results-input:focus {
    border-color: var(--fos-primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(108, 71, 255, .12);
}

/* Model row */
.fos-int-model-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.fos-int-model-row .fos-int-select {
    flex: 1;
    min-width: 0;
}

/* Fetch button */
.fos-int-fetch-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 7px;
    background: var(--fos-primary-faint);
    border: 1px solid var(--fos-primary-border);
    color: var(--fos-text-sub);
    font-size: 13px;
    line-height: normal;
    cursor: pointer;
    transition: all .12s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.fos-int-fetch-btn:hover {
    border: 1px solid rgba(108, 71, 255, 0.35);
    color: var(--fos-primary-dark);
    background: var(--fos-primary-light);
}

.fos-int-fetch-btn.is-loading {
    opacity: .6;
    pointer-events: none;
}

/* API key row */
.fos-int-key-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fos-int-apikey-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
}

.fos-int-toggle-vis {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--fos-text-sub);
    display: flex;
    align-items: center;
    line-height: 1;
}

.fos-int-toggle-vis:hover {
    color: var(--fos-text);
}

/* Test connection button */
.fos-int-test-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 14px;
    border-radius: 7px;
    background: var(--fos-primary-faint);
    border: 1px solid var(--fos-primary-border);
    color: var(--fos-primary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    transition: all .12s;
}

.fos-int-test-btn:hover {
    border: 1px solid rgba(108, 71, 255, 0.35);
    color: var(--fos-primary-dark);
    background: var(--fos-primary-light);
}

.fos-int-test-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

/* Test result — hidden by default, shows as pill banner */
.fos-int-result {
    display: none;
    margin-top: 6px;
    font-size: 11px;
    font-weight: 500;
    padding: 1px 12px;
    border-radius: 6px;
    align-items: center;
    gap: 6px;
}

.fos-int-result.is-success {
    display: flex;
    background: #e6faf4;
    color: #065f46;
    border: 1px solid rgba(0, 196, 140, .25);
}

.fos-int-result.is-error {
    display: flex;
    background: var(--fos-danger-light);
    color: #991b1b;
    border: 1px solid rgba(239, 68, 68, .2);
}

/* ── AI Provider: Search toggle + external provider grid ─────────────────── */
/* Mirrors contentos-core .cts-int-toggle-row + .cts-switch (admin-integrations.css + admin-forms.css) */
.fos-int-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid var(--fos-border);
    border-radius: 8px;
    background: var(--fos-bg-soft);
}

.fos-int-toggle-row__info {
    flex: 1;
    min-width: 0;
}

.fos-int-toggle-row__title {
    font-size: 12px;
    font-weight: 600;
    color: var(--fos-text);
    margin: 0 0 3px;
    line-height: 1.35;
}

.fos-int-toggle-row__desc {
    margin: 0;
    font-size: 11px;
    color: var(--fos-text-dim);
    line-height: 1.4;
}

.fos-int-toggle-row__control {
    flex-shrink: 0;
    padding-top: 2px;
}

.fos-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    flex-shrink: 0;
}

.fos-switch input {
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
}

.fos-switch__slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #d1d5db;
    border-radius: 26px;
    transition: background 0.2s;
}

.fos-switch__slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}

.fos-switch input:checked+.fos-switch__slider {
    background: var(--fos-primary);
}

.fos-switch input:checked+.fos-switch__slider::before {
    transform: translateX(20px);
}

/* Same as contentos-core .cts-switch--compact (Web Search grounding) */
.fos-switch.fos-switch--compact {
    width: 36px;
    height: 20px;
}

.fos-switch.fos-switch--compact .fos-switch__slider {
    border-radius: 20px;
}

.fos-switch.fos-switch--compact .fos-switch__slider::before {
    width: 14px;
    height: 14px;
    left: 3px;
    top: 3px;
}

.fos-switch.fos-switch--compact input:checked+.fos-switch__slider::before {
    transform: translateX(16px);
}

.fos-switch input:focus-visible+.fos-switch__slider {
    box-shadow: 0 0 0 3px rgba(108, 71, 255, .15);
}

.fos-switch input:disabled+.fos-switch__slider {
    opacity: .55;
    cursor: not-allowed;
}

.fos-int-search-external-grid {
    /* vertical spacing from toggle row: parent fieldset uses gap: 14px */
    margin-top: 0;
}

#fos-search-external-fields.is-disabled {
    opacity: .62;
}

@media (max-width: 900px) {
    .fos-int-toggle-row {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ── Settings Section (replaces cts-api-card — fos-prefix, no colored border) ─ */
.fos-settings-section {
    background: #fff;
    border: 1px solid var(--fos-border);
    border-radius: var(--fos-radius-sm);
    box-shadow: var(--fos-shadow);
    overflow: hidden;
    margin-bottom: 16px;
}

.fos-settings-section__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--fos-border);
    background: var(--fos-bg-soft);
}

.fos-settings-section__icon {
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
}

.fos-settings-section__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--fos-text);
    margin: 0;
    line-height: 1.3;
}

.fos-settings-section__sub {
    font-size: 12px;
    color: var(--fos-text-sub);
    margin: 2px 0 0;
}

.fos-settings-section__body {
    padding: 20px;
}

/* ── Settings inline notice (agents PRO gate) ──────────────────────────────── */
.fos-settings-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--fos-border);
    border-radius: var(--fos-radius-sm);
    background: #fff;
    margin-bottom: 20px;
}

.fos-settings-notice--warn {
    border-color: rgba(245, 158, 11, 0.35);
    background: #fffbeb;
}

.fos-settings-notice__body {
    flex: 1;
    font-size: 13px;
    color: var(--fos-text-sub);
    line-height: 1.5;
}

.fos-settings-notice__body p {
    margin: 0 0 10px;
}

/* Truncated prompt mask for FREE users */
.fos-agent-card__textarea-wrap--masked {
    position: relative;
    max-height: 160px;
    overflow: hidden;
    border-radius: var(--fos-radius-sm);
    border: 1px solid var(--fos-border);
}

.fos-agent-card__textarea-wrap--masked .fos-agent-card__textarea {
    border: none !important;
    box-shadow: none !important;
    padding-bottom: 60px !important;
    pointer-events: none !important;
    user-select: none !important;
    filter: blur(0.5px);
}

.fos-agent-card__textarea-wrap--masked::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(to bottom, transparent, #fff 90%);
    pointer-events: none;
    z-index: 1;
}

.fos-agent-card__textarea-wrap--masked::before {
    content: '🔒 STUDIO';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    background: var(--fos-primary);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(108, 71, 255, 0.3);
    pointer-events: none;
    opacity: 0.9;
}

/* ── Seletor de modo ────────────────────────────────────────────────────────── */

.fos-img-mode-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.fos-img-mode-card {
    position: relative;
    border: 1px solid rgba(108, 71, 255, 0.15);
    border-radius: 10px;
    padding: 14px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    background: #ffffff;
}

.fos-img-mode-card:hover {
    border-color: #AFA9EC;
    background: #FAFAFE;
}

/* Inside a disabled fieldset: no hover, no pointer, locked cards dimmed */
fieldset[disabled] .fos-img-mode-card {
    pointer-events: none;
    cursor: default;
}

fieldset[disabled] .fos-img-mode-card:not(.fos-img-mode-card--active):hover {
    border-color: #e5e7eb;
}

fieldset[disabled] .fos-img-mode-card:not(.fos-img-mode-card--active) {
    opacity: 0.45;
}

.fos-img-mode-card--active {
    background: linear-gradient(135deg, rgba(108, 71, 255, 0.04) 0%, rgba(108, 71, 255, 0.02) 100%);
}

/* Radio visual */
.fos-img-mode-radio {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 1.5px solid #d1d5db;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
    flex-shrink: 0;
}

.fos-img-mode-radio::after {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ffffff;
    opacity: 0;
    transition: opacity 0.15s;
}

.fos-img-mode-card--active .fos-img-mode-radio {
    background: #534AB7;
    border-color: #534AB7;
}

.fos-img-mode-card--active .fos-img-mode-radio::after {
    opacity: 1;
}

/* ── Service-gated image mode card (Starter Auto plan) ──────────────────── */
.fos-img-mode-card--service-gated {
    pointer-events: none;
    opacity: 0.55;
}

.fos-img-mode-card--service-gated:hover {
    border-color: rgba(108, 71, 255, 0.15);
    background: #ffffff;
}

.fos-img-mode-icon-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fos-img-mode-plan-badge {
    background: #6C47FF;
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 5px;
    letter-spacing: 0;
    line-height: 1.4;
    pointer-events: none;
    white-space: nowrap;
    margin-bottom: 8px;
}

.fos-img-service-note {
    margin: 0;
    padding: 10px 12px;
    border: 1px solid rgba(108, 71, 255, 0.15);
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(108, 71, 255, 0.04) 0%, rgba(108, 71, 255, 0.02) 100%);
    color: #6b7280;
    font-size: 11px;
    line-height: 1.5;
}

/* Ícone do modo */
.fos-img-mode-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.fos-img-mode-icon--gray {
    background: #f3f4f6;
}

.fos-img-mode-icon--teal {
    background: #E1F5EE;
}

.fos-img-mode-icon--purple {
    background: #EEEDFE;
}

.fos-img-mode-title {
    font-size: 13px;
    font-weight: 500;
    color: #111827;
    line-height: 1.3;
}

.fos-img-mode-desc {
    font-size: 11px;
    color: #6b7280;
    line-height: 1.5;
    margin: 0;
}

.fos-img-mode-hint {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.07);
    font-size: 10px;
    color: var(--fos-text-dim);
    line-height: 1.5;
}

.fos-img-mode-hint code {
    background: rgba(0, 0, 0, 0.05);
    padding: 1px 3px;
    border-radius: 3px;
    font-size: 10px;
    font-family: monospace;
}


/* ── AI mode selector (ContentOS vs BYOK) — 2-col horizontal cards ─────────── */
.fos-aimode-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 6px;
}

.fos-aimode-card--row {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 10px;
    padding: 6px;
    border-radius: 7px;
}

.fos-aimode-card--row .fos-img-mode-radio {
    position: static;
    margin: 3px 0 0;
    flex-shrink: 0;
}

.fos-aimode-card--row .fos-img-mode-icon {
    margin-bottom: 0;
    flex-shrink: 0;
}

/* ── Execution model selector ─────────────────────────────────────────────── */
.fos-execution-model-card .fos-int-card__header {
    padding: 18px 20px;
}

.fos-execution-model-card .fos-int-card__body {
    padding: 20px;
}

.fos-execution-model-card .fos-production-mode-grid {
    gap: 16px;
    margin-bottom: 0;
}

.fos-execution-model-card__icon {
    color: #7c5cff;
    font-size: 15px;
}

.fos-execution-option {
    position: relative;
    min-height: 96px;
    padding: 20px 58px 18px 20px;
    border: 1px solid rgba(108, 71, 255, 0.15);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s, background .15s, box-shadow .15s;
}

.fos-execution-option:hover {
    border-color: #afa9ec;
    background: #fbfbff;
}

.fos-execution-option.fos-img-mode-card--active {
    background: linear-gradient(135deg, rgba(108, 71, 255, 0.04) 0%, rgba(108, 71, 255, 0.02) 100%);
    box-shadow: none;
}

.fos-execution-option>.fos-img-mode-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    font-size: 18px;
}

.fos-execution-option>.fos-img-mode-radio {
    position: absolute;
    top: 20px;
    right: 18px;
    width: 15px;
    height: 15px;
    margin: 0;
    border-width: 1.5px;
}

.fos-execution-option>.fos-img-mode-radio::after {
    width: 7px;
    height: 7px;
}

.fos-execution-option .fos-img-mode-title {
    font-size: 14px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 8px;
}

.fos-execution-option .fos-img-mode-desc {
    font-size: 12px;
    line-height: 1.5;
    color: #6b7280;
}

.fos-execution-option__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.fos-execution-option__tags span {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 2px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    background: #f9fafb;
    color: #6b7280;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

@media (max-width: 860px) {
    .fos-execution-model-card .fos-production-mode-grid {
        grid-template-columns: 1fr;
    }

    .fos-execution-option {
        min-height: 0;
    }
}

/* ── Seções condicionais ────────────────────────────────────────────────────── */

.fos-img-section {
    display: none;
}

.fos-img-section--active {
    display: block;
}


/* ── Labels e tooltip ───────────────────────────────────────────────────────── */

.fos-img-field-label {
    font-size: 12px;
    font-weight: 500;
    color: #4b5563;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 6px;
}

.fos-tooltip-icon {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    border: 1px solid var(--fos-border-input);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-style: normal;
    color: var(--fos-text-dim);
    cursor: default;
    flex-shrink: 0;
    line-height: 1;
}


/* ── Stepper de quantidade ──────────────────────────────────────────────────── */

.fos-img-quantity-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 18px;
    margin-bottom: 22px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--fos-border);
}

.fos-img-quantity-row__label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex: 0 0 auto;
}

.fos-img-quantity-row__label .fos-img-field-label {
    margin-bottom: 0;
}

.fos-img-quantity-row__control {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    margin-right: 16px;
}

.fos-img-quantity-row__notice {
    flex: 1 1 auto;
    min-width: 260px;
}

.fos-img-quantity-row__notice>div {
    width: 100%;
}

.fos-img-quantity-row__notice .fos-int-pro-notice,
.fos-img-quantity-row__notice .fos-provider-tip-card {
    margin: 0;
}

.fos-img-quantity-row__notice .fos-provider-tip-card {
    align-items: center;
    padding: 10px 14px;
}

.fos-img-quantity-row__notice .fos-provider-tip-content {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
}

.fos-img-quantity-row__notice .fos-provider-tip-icon {
    margin-top: 0;
}

.fos-img-qty-stepper {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
    border: 1px solid var(--fos-border);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .03);
}

.fos-img-qty-btn {
    width: 18px;
    height: 18px;
    border-radius: 6px;
    border: 1px solid var(--fos-primary-border);
    background: var(--fos-primary-faint);
    font-size: 15px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    color: var(--fos-primary);
    flex-shrink: 0;
    padding: 0;
    transition: background 0.1s, border-color 0.1s, color 0.1s;
}

.fos-img-qty-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #374151;
}

.fos-img-qty-val {
    width: 32px;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--fos-primary);
    flex-shrink: 0;
}

.fos-img-byok-provider-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    margin-bottom: 12px;
}

.fos-img-byok-model-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    margin-top: 6px;
}

.fos-img-byok-model-grid .fos-provider-tip-card {
    min-height: 62px;
}


.fos-img-byok-key-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}

.fos-img-byok-key-row__control {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.fos-img-byok-key-row__control .fos-int-apikey-wrap {
    max-width: none;
}

.fos-img-byok-key-row__hint {
    min-height: 22px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.fos-img-byok-key-row__hint .fos-int-result {
    flex: 0 1 auto;
    margin: 0;
}

.fos-img-byok-key-row__hint .fos-int-result-hint {
    flex: 1 1 auto;
    margin: 0;
    font-size: 11px;
    color: var(--fos-text-dim);
}

@media (max-width: 860px) {
    .fos-img-quantity-row {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .fos-img-quantity-row__control,
    .fos-img-quantity-row__notice {
        flex: 1 1 100%;
    }

    .fos-img-byok-provider-grid,
    .fos-img-byok-model-grid,
    .fos-img-byok-key-row__control {
        grid-template-columns: 1fr;
    }
}


/* ── Mode status strip (compact single-line, placeholder / none modes) ─────── */

.fos-img-mode-strip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 13px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.5;
}

.fos-img-mode-strip--teal {
    background: var(--fos-accent-light);
    color: var(--fos-success);
    border: 1px solid var(--fos-accent-light);
}

.fos-img-mode-strip--gray {
    background: var(--fos-accent-light);
    color: var(--fos-success);
    border: 1px solid var(--fos-accent-light);
}

.fos-img-mode-strip__icon {
    flex-shrink: 0;
    font-size: 13px;
    line-height: 1;
}

.fos-img-mode-strip__text {
    flex: 1;
}

.fos-img-mode-strip code {
    background: rgba(0, 0, 0, 0.06);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 11px;
    font-family: monospace;
}

/* ── Info boxes (modos sem API) ─────────────────────────────────────────────── */

.fos-img-info-box {
    background: #f9fafb;
    border-radius: 8px;
    padding: 14px 16px;
    border: 0.5px solid #e5e7eb;
}

.fos-img-info-box-title {
    font-size: 13px;
    font-weight: 500;
    color: #111827;
    margin: 0 0 4px 0;
}

.fos-img-info-box-desc {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.6;
    margin: 0;
}

.fos-img-info-box-desc code {
    background: #f3f4f6;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 11px;
    font-family: monospace;
    color: #374151;
}

/* ── Studio: Advanced Customization per agent ───────────────────────────────── */

.fos-agent-card__advanced {
    margin-top: 16px;
    padding: 16px;
    background: #f9f7ff;
    border: 1px solid #e0d9ff;
    border-radius: 8px;
}

.fos-agent-card__advanced-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--fos-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0 0 14px;
}

.fos-agent-card__advanced-field {
    margin-bottom: 14px;
}

.fos-agent-card__advanced-field:last-child {
    margin-bottom: 0;
}

.fos-agent-card__advanced-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--fos-text);
    margin-bottom: 5px;
}

.fos-agent-card__advanced-field .description {
    margin: 4px 0 0;
    font-size: 11px;
    color: var(--fos-text-dim);
}

.fos-agent-card__textarea--sm {
    min-height: 80px !important;
}

/* Locked state (PRO sees teaser, Studio sees fields) */
.fos-agent-card__advanced--locked {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fafafa;
    border-color: #e5e7eb;
}

.fos-agent-card__advanced-lock {
    font-size: 16px;
    flex-shrink: 0;
}

.fos-agent-card__advanced-msg {
    font-size: 12px;
    color: var(--fos-text-dim);
}

.fos-agent-card__advanced-msg a {
    color: var(--fos-primary);
    font-weight: 600;
    text-decoration: none;
}

/* Plan badge (Studio label) */
.fos-plan-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.fos-plan-badge--studio {
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    color: #fff;
}

/* ── M19: Tooltip para features bloqueadas/PRO ─────────────────────────────
   Uso: <span class="fos-pro-tooltip-wrap">
            <span class="fos-pro-tooltip-icon" tabindex="0">?</span>
            <span class="fos-pro-tooltip-text">Disponível no plano PRO</span>
        </span>
   ─────────────────────────────────────────────────────────────────────────── */
.fos-pro-tooltip-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.fos-pro-tooltip-icon {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--fos-primary-faint);
    border: 1px solid var(--fos-primary-border);
    color: var(--fos-primary);
    font-size: 9px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    flex-shrink: 0;
    font-style: normal;
}

.fos-pro-tooltip-icon:focus {
    outline: var(--fos-focus-ring);
}

.fos-pro-tooltip-text {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1d2327;
    color: #fff;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.45;
    padding: 7px 11px;
    border-radius: 6px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 200;
    width: 200px;
    text-align: center;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.fos-pro-tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1d2327;
}

.fos-pro-tooltip-wrap:hover .fos-pro-tooltip-text,
.fos-pro-tooltip-icon:focus+.fos-pro-tooltip-text,
.fos-pro-tooltip-icon:focus-visible+.fos-pro-tooltip-text {
    opacity: 1;
}

/* ── Disabled Fieldsets (PRO Features Locked) ── */
fieldset[disabled] {
    pointer-events: none;
    user-select: none;
}

/* Aplica opacidade apenas nos itens inutilizados, preservando os ativos de leitura (ex: "Sem Imagens") */
fieldset[disabled] .fos-int-toggle-row,
fieldset[disabled] .fos-int-search-external-grid,
fieldset[disabled] .fos-img-mode-card:not(.fos-img-mode-card--active),
fieldset[disabled] #fos-img-section-generate,
fieldset[disabled] #fos-img-section-placeholder {
    opacity: 0.55;
}

/* ── Advanced Tab — danger variants on existing primitives ───────────── */
.fos-int-card.fos-int-card--danger {
    border-color: #fca5a5;
    background: #fef2f2;
}

.fos-int-card.fos-int-card--danger .fos-int-card__title {
    color: #991b1b;
}

.fos-int-card.fos-int-card--danger .fos-int-card__subtitle {
    color: #7f1d1d;
}

.fos-int-toggle-row.fos-int-toggle-row--danger {
    background: #fff;
    border-color: #fecaca;
}

.fos-int-toggle-row.fos-int-toggle-row--danger .fos-int-toggle-row__title {
    color: #991b1b;
}

.fos-int-toggle-row.fos-int-toggle-row--danger .fos-int-toggle-row__desc {
    color: #7f1d1d;
}

.fos-switch.fos-switch--danger input:checked+.fos-switch__slider {
    background: #dc2626;
}

.fos-switch.fos-switch--danger input:focus-visible+.fos-switch__slider {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, .2);
}

/* ══════════════════════════════════════════════════════════════════════════
   Agent Editor — two-panel layout (Phase 2)
   ══════════════════════════════════════════════════════════════════════════ */

.fos-agents-locked-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    font-size: 13px;
    color: #92400e;
    margin-bottom: 16px;
}

.fos-agents-locked-banner a {
    color: #92400e;
    font-weight: 600;
}

/* ── Editor shell ─────────────────────────────────────────────────────── */
.fos-agents-editor {
    display: flex;
    border: 1px solid var(--fos-border, #e5e7eb);
    border-radius: 10px;
    min-height: 620px;
    background: #fff;
    overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────────────────── */
.fos-agents-sidebar {
    width: 210px;
    flex-shrink: 0;
    border-right: 1px solid var(--fos-border, #e5e7eb);
    overflow-y: auto;
    background: var(--fos-surface, #f9fafb);
    display: flex;
    flex-direction: column;
}

.fos-agents-sidebar__item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14.5px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--fos-border, #e5e7eb);
    transition: background 0.12s;
    position: relative;
    outline: none;
}

.fos-agents-sidebar__item:hover {
    background: #f1f5f9;
}

.fos-agents-sidebar__item.is-active {
    background: #fff;
    border-right: 2px solid var(--fos-primary, #6366f1);
}

.fos-agents-sidebar__item:focus-visible {
    box-shadow: inset 0 0 0 2px var(--fos-primary, #6366f1);
}

.fos-agents-sidebar__num {
    font-size: 10px;
    font-weight: 700;
    color: var(--fos-text-dim, #9ca3af);
    min-width: 18px;
}

.fos-agents-sidebar__icon {
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
}

.fos-agents-sidebar__meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.fos-agents-sidebar__name {
    font-size: 12px;
    font-weight: 600;
    color: var(--fos-text, #111827);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fos-agents-sidebar__badge {
    font-size: 10px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 4px;
    width: fit-content;
}

.fos-agents-sidebar__badge--custom {
    background: #ede9fe;
    color: #6d28d9;
}

.fos-agents-sidebar__badge--default {
    background: #f1f5f9;
    color: #64748b;
}

.fos-agents-sidebar__dirty {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #f59e0b;
    flex-shrink: 0;
}

/* ── Sidebar footer (restore-all) ────────────────────────────────────── */
.fos-agents-sidebar__footer {
    padding: 19px 12px;
    border-top: 1px solid var(--fos-border, #e5e7eb);
    margin-top: auto;
}

.fos-agents-sidebar__restore-all {
    display: block;
    width: 100%;
    padding: 7px 10px;
    font-size: 11px;
    font-weight: 500;
    color: var(--fos-text-dim, #6b7280);
    background: none;
    border: 1px dashed var(--fos-border, #d1d5db);
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    transition: color 0.12s, border-color 0.12s, background 0.12s;
}

.fos-agents-sidebar__restore-all:hover {
    color: #b45309;
    border-color: #fcd34d;
    background: #fffbeb;
}

.fos-agents-sidebar__restore-all:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Detail Panel ─────────────────────────────────────────────────────── */
.fos-agents-detail {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.fos-agents-detail__agent {
    display: none;
    flex-direction: column;
    flex: 1;
}

.fos-agents-detail__agent.is-active {
    display: flex;
}

.fos-agents-detail__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px 14px;
    border-bottom: 1px solid var(--fos-border, #e5e7eb);
}

.fos-agents-detail__header-left {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.fos-agents-detail__icon {
    font-size: 24px;
    line-height: 1;
    margin-top: 2px;
}

.fos-agents-detail__num {
    font-size: 11px;
    font-weight: 700;
    color: var(--fos-text-dim, #9ca3af);
    margin-right: 5px;
}

.fos-agents-detail__name {
    font-size: 15px;
    font-weight: 700;
    color: var(--fos-text, #111827);
    line-height: 1.3;
}

.fos-agents-detail__role {
    font-size: 12px;
    color: var(--fos-text-dim, #6b7280);
    margin-top: 3px;
}

.fos-agents-detail__status {
    font-size: 12px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.fos-agents-detail__status--ok {
    background: #dcfce7;
    color: #15803d;
}

.fos-agents-detail__status--error {
    background: #fee2e2;
    color: #b91c1c;
}

.fos-agents-detail__status--info {
    background: #eff6ff;
    color: #1d4ed8;
}

/* ── Agent tab nav ────────────────────────────────────────────────────── */
.fos-agents-tabs {
    display: flex;
    border-bottom: 1px solid var(--fos-border, #e5e7eb);
    padding: 0 20px;
    gap: 2px;
    background: var(--fos-surface, #f9fafb);
}

.fos-agents-tab-btn {
    padding: 9px 14px;
    font-size: 12px;
    font-weight: 500;
    color: var(--fos-text-dim, #6b7280);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.12s, border-color 0.12s;
}

.fos-agents-tab-btn:hover {
    color: var(--fos-text, #111827);
}

.fos-agents-tab-btn.is-active {
    color: var(--fos-primary, #6366f1);
    border-bottom-color: var(--fos-primary, #6366f1);
    background: #fff;
}

.fos-agents-tab-btn.is-locked {
    opacity: 0.65;
}

.fos-badge-plan {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 4px;
    background: #fef3c7;
    color: #92400e;
    border-radius: 3px;
    letter-spacing: 0.03em;
}

/* ── Tab panels ───────────────────────────────────────────────────────── */
.fos-agents-tab-panel {
    display: none;
    flex: 1;
    flex-direction: column;
    padding: 16px 20px;
    overflow-y: auto;
}

.fos-agents-tab-panel.is-active {
    display: flex;
}

/* ── Variables row ────────────────────────────────────────────────────── */
.fos-agent-vars {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    margin-bottom: 10px;
}

.fos-agent-vars__label {
    font-size: 11px;
    font-weight: 600;
    color: var(--fos-text-dim, #9ca3af);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.fos-agent-var {
    font-size: 11px;
    font-family: monospace;
    padding: 2px 7px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    color: #4f46e5;
    cursor: pointer;
    transition: background 0.1s;
    white-space: nowrap;
}

.fos-agent-var:hover {
    background: #e0e7ff;
    border-color: #a5b4fc;
}

/* ── Prompt textarea ──────────────────────────────────────────────────── */
.fos-agent-textarea-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
}

.fos-agent-textarea-wrap.is-masked {
    position: relative;
}

.fos-agent-textarea-wrap.is-masked::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.9));
    pointer-events: none;
}

.fos-agent-prompt-textarea {
    width: 100%;
    flex: 1;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 12px;
    line-height: 1.6;
    padding: 12px 14px;
    border: 1px solid var(--fos-border, #e5e7eb);
    border-radius: 6px;
    resize: vertical;
    color: var(--fos-text, #1f2937);
    background: #fafafa;
    transition: border-color 0.12s, box-shadow 0.12s;
    box-sizing: border-box;
}

.fos-agent-prompt-textarea:focus {
    outline: none;
    border-color: var(--fos-primary, #6366f1);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    background: #fff;
}

.fos-agent-prompt-textarea[readonly] {
    background: #f8fafc;
    color: #64748b;
}

/* ── Prompt actions row ───────────────────────────────────────────────── */
.fos-agent-prompt-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 8px;
    flex-shrink: 0;
    gap: 16px;
}

.fos-agent-prompt-actions__note {
    flex: 1 1 auto;
    margin: 0;
    font-size: 11px;
    color: var(--fos-text-dim);
    line-height: 1.5;
}

.fos-agent-prompt-actions__btns {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* ── Studio tab ───────────────────────────────────────────────────────── */
.fos-agent-studio {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.fos-agent-temp-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
}

.fos-agent-temp-slider {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    max-width: 260px;
    height: 7px;
    border-radius: 999px;
    outline: none;
    cursor: pointer;
    /* initial gradient at 35% = 0.7/2.0 — JS updates on input */
    background: linear-gradient(90deg, #d8ccff 0%, var(--fos-primary, #6C47FF) 35%, #e5e7eb 35%, #e5e7eb 100%);
}

.fos-agent-temp-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--fos-primary, #6C47FF);
    box-shadow: 0 1px 4px rgba(108, 71, 255, .3);
    cursor: pointer;
}

.fos-agent-temp-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--fos-primary, #6C47FF);
    box-shadow: 0 1px 4px rgba(108, 71, 255, .3);
    cursor: pointer;
}

.fos-agent-temp-value {
    font-size: 13px;
    font-weight: 700;
    color: var(--fos-primary, #6366f1);
    min-width: 28px;
    text-align: center;
}

.fos-agent-studio-actions {
    padding-top: 4px;
    display: flex;
    justify-content: flex-end;
}

.fos-agent-studio p.description {
    font-size: 12px;
    color: var(--fos-text-dim, #6b7280);
    margin: 4px 0 0;
    line-height: 1.4;
}

/* ── Locked panel ─────────────────────────────────────────────────────── */
.fos-agents-locked-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 20px;
    text-align: center;
    flex: 1;
}

.fos-agents-locked-panel__icon {
    font-size: 32px;
}

.fos-agents-locked-panel__title {
    font-size: 15px;
    font-weight: 700;
    color: var(--fos-text, #111827);
    margin: 0;
}

.fos-agents-locked-panel__desc {
    font-size: 13px;
    color: var(--fos-text-dim, #6b7280);
    margin: 0;
    max-width: 320px;
}

/* ── History tab ──────────────────────────────────────────────────────── */
.fos-agent-history__loading,
.fos-agent-history__empty {
    font-size: 13px;
    color: var(--fos-text-dim, #9ca3af);
    padding: 20px 0;
}

.fos-agent-history__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fos-agent-history__item {
    padding: 12px 14px;
    border: 1px solid var(--fos-border, #e5e7eb);
    border-radius: 7px;
    background: var(--fos-surface, #f9fafb);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.fos-agent-history__item-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.fos-agent-history__item-date {
    font-size: 12px;
    font-weight: 600;
    color: var(--fos-text, #374151);
}

.fos-agent-history__item-chars {
    font-size: 11px;
    color: var(--fos-text-dim, #9ca3af);
}

.fos-agent-history__item-excerpt {
    font-size: 12px;
    font-family: monospace;
    color: var(--fos-text-dim, #6b7280);
    white-space: pre-wrap;
    word-break: break-all;
}

.fos-agent-history__item .fos-agent-restore-btn {
    align-self: flex-start;
}

/* ── Preview tab ──────────────────────────────────────────────────────── */
.fos-agent-preview {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.fos-agent-preview__actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.fos-agent-preview__hint {
    font-size: 12px;
    color: var(--fos-text-dim, #9ca3af);
    margin: 0;
    flex: 1;
}

.fos-agent-preview__loading,
.fos-agent-preview__error {
    font-size: 13px;
    color: var(--fos-text-dim, #9ca3af);
    padding: 10px 0;
    margin: 0;
}

.fos-agent-preview__error {
    color: #b91c1c;
}

.fos-agent-preview__pre {
    font-size: 12px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    background: #f8fafc;
    border: 1px solid var(--fos-border, #e5e7eb);
    border-radius: 7px;
    padding: 14px 16px;
    margin: 0;
    max-height: 480px;
    overflow-y: auto;
    color: var(--fos-text, #1f2937);
}

/* ── Responsive: collapse to single panel below 860px ────────────────── */
@media (max-width: 860px) {
    .fos-agents-editor {
        flex-direction: column;
    }

    .fos-agents-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--fos-border, #e5e7eb);
        display: flex;
        flex-wrap: wrap;
        overflow-y: visible;
    }

    .fos-agents-sidebar__item {
        flex: 1;
        min-width: 100px;
        border-bottom: none;
        border-right: 1px solid var(--fos-border, #e5e7eb);
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 8px 10px;
        gap: 4px;
    }

    .fos-agents-sidebar__meta {
        align-items: center;
    }

    .fos-agents-sidebar__item.is-active {
        border-right-color: var(--fos-border, #e5e7eb);
        border-bottom: 2px solid var(--fos-primary, #6366f1);
    }
}
