#automation-pro-portal {
    position: static;
    z-index: auto;
    width: 100%;
    max-height: none;
    padding: 0.35rem 0.75rem;
    pointer-events: auto;
    background: linear-gradient(180deg, #f8fbff 0%, #f1f5fb 100%);
    border-bottom: 1px solid #dbe5f2;
}
#automation-pro-portal:empty { display: none; }

.automation-pro-panel,
.automation-pro-comment-editor {
    box-sizing: border-box;
    width: calc(100% - 2rem);
    margin: 0.65rem 1rem;
    border: 1px solid #cddbeb;
    border-radius: 0.85rem;
    background: #fff;
    color: #172033;
    box-shadow: 0 8px 24px rgba(30, 64, 175, 0.08);
    font-family: inherit;
}

.automation-pro-panel {
    grid-column: 1 / -1;
    width: min(1180px, calc(100% - 2rem));
    max-height: none;
    margin: 0 auto;
    padding: 0.8rem 0.9rem;
    overflow: visible;
    pointer-events: auto;
    border-top: 0;
}

/* The closed state is a compact launcher, not an 880px status bar covering
   campaign content. Detailed controls are available only after "Abrir". */
.automation-pro-panel.is-collapsed {
    width: min(1180px, calc(100% - 2rem));
    max-width: none;
    margin: 0 auto;
    overflow: hidden;
}
.automation-pro-panel.is-collapsed #automation-pro-scan,
.automation-pro-panel.is-collapsed #automation-pro-turbo,
.automation-pro-panel.is-collapsed .automation-pro-message {
    display: none;
}

.automation-pro-bar,
.automation-pro-title,
.automation-pro-summary,
.automation-pro-bar-actions,
.automation-pro-actions,
.automation-pro-inline {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.automation-pro-bar { justify-content: space-between; gap: 0.55rem; }
.automation-pro-title { gap: 0.55rem; min-width: 0; }
.automation-pro-title > strong { font-size: 0.98rem; white-space: nowrap; color: #102a56; }
.automation-pro-summary,
.automation-pro-bar-actions,
.automation-pro-actions,
.automation-pro-inline { gap: 0.38rem; }

.automation-pro-chip,
.automation-pro-badge,
.automation-pro-delivery {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    font-weight: 700;
    line-height: 1.25;
}

.automation-pro-chip {
    padding: 0.18rem 0.42rem;
    font-size: 0.68rem;
    background: #eef2f7;
    color: #475569;
}
.automation-pro-chip.ok { background: #dcfce7; color: #047857; }
.automation-pro-chip.off { background: #f1f5f9; color: #64748b; }
.automation-pro-chip.info { background: #dbeafe; color: #1d4ed8; }
.automation-pro-chip.error { background: #fee2e2; color: #b91c1c; }

.automation-pro-button {
    border: 1px solid transparent;
    border-radius: 0.42rem;
    padding: 0.42rem 0.62rem;
    font-weight: 800;
    font-size: 0.72rem;
    line-height: 1.2;
    cursor: pointer;
}
.automation-pro-button:disabled { opacity: 0.55; cursor: wait; }
.automation-pro-button.primary { color: #fff; background: #2563eb; }
.automation-pro-button.success { color: #fff; background: #059669; }
.automation-pro-button.danger { color: #fff; background: #dc2626; }
.automation-pro-button.secondary { color: #1e3a5f; border-color: #bfdbfe; background: #eff6ff; }
.automation-pro-close {
    width: 1.8rem;
    height: 1.8rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #64748b;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
}
.automation-pro-close:hover { color: #b91c1c; background: #fee2e2; }

.automation-pro-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
    margin-top: 0.55rem;
}
.automation-pro-stats-card { grid-column: 1 / -1; }
.automation-pro-panel.is-collapsed .automation-pro-body { display: none; }
.automation-pro-panel.is-collapsed .automation-pro-comment-editor { display: none; }
.automation-pro-panel.is-collapsed.has-comment-editor .automation-pro-comment-editor {
    display: grid;
}
.automation-pro-panel.has-comment-editor .automation-pro-close { display: none; }

.automation-pro-card {
    min-width: 0;
    padding: 0.58rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.55rem;
    background: linear-gradient(180deg, #fbfdff 0%, #f8fafc 100%);
}
.automation-pro-card h3,
.automation-pro-comment-editor h3 {
    margin: 0 0 0.35rem;
    font-size: 0.8rem;
    font-weight: 800;
}

.automation-pro-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin: 0 0.7rem 0.45rem 0;
    font-size: 0.74rem;
    font-weight: 700;
}
.automation-pro-switch input,
.automation-pro-comment-editor input[type="checkbox"] {
    width: 0.92rem;
    height: 0.92rem;
    margin: 0;
}

.automation-pro-inline { margin-top: 0.35rem; }
.automation-pro-inline input,
.automation-pro-inline select,
.automation-pro-public-fields textarea {
    box-sizing: border-box;
    border: 1px solid #94a3b8;
    border-radius: 0.42rem;
    background: #fff;
    padding: 0.42rem 0.55rem;
    font: inherit;
    font-size: 0.75rem;
}
.automation-pro-inline input { flex: 1 1 130px; min-width: 105px; }
.automation-pro-inline select {
    flex: 1 1 190px;
    min-width: 150px;
    max-width: 100%;
}
.automation-pro-inline select.is-hidden { display: none; }

.automation-pro-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.25rem 0.6rem;
    font-size: 0.7rem;
}
.automation-pro-stats > div { display: flex; justify-content: space-between; gap: 0.5rem; }
.automation-pro-stats span { color: #64748b; }
.automation-pro-stats strong { color: #0f172a; }

.automation-pro-turbo-list,
.automation-pro-recent {
    display: flex;
    flex-wrap: wrap;
    gap: 0.28rem;
    margin-top: 0.4rem;
    font-size: 0.68rem;
    color: #64748b;
}
.automation-pro-badge,
.automation-pro-delivery { padding: 0.18rem 0.38rem; }
.automation-pro-delivery { gap: 0.35rem; }
.automation-pro-mini-button {
    border: 0;
    border-radius: 999px;
    padding: 0.12rem 0.35rem;
    background: #fff;
    color: inherit;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}
.automation-pro-badge { background: #dbeafe; color: #1d4ed8; }
.automation-pro-badge.has-error,
.automation-pro-delivery.failed { background: #fee2e2; color: #b91c1c; }
.automation-pro-delivery.sent { background: #dcfce7; color: #047857; }
.automation-pro-delivery.queued,
.automation-pro-delivery.sending { background: #fef3c7; color: #92400e; }

.automation-pro-message {
    min-height: 0;
    margin: 0.35rem 0 0;
    font-size: 0.7rem;
    font-weight: 700;
}
.automation-pro-message:empty { display: none; }
.automation-pro-message.info { color: #475569; }
.automation-pro-message.success { color: #047857; }
.automation-pro-message.error { color: #b91c1c; }

.automation-pro-comment-editor {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(190px, 1fr) auto auto;
    align-items: center;
    gap: 0.45rem 0.8rem;
    width: 100%;
    margin: 0 0 0.45rem;
    padding: 0.55rem 0.7rem;
    background: #f8fafc;
    box-shadow: none;
}
.automation-pro-panel > .automation-pro-comment-editor {
    width: 100%;
    margin: 0.55rem 0 0;
}
.automation-pro-comment-editor h3 { margin-bottom: 0.12rem; }
.automation-pro-comment-editor p,
.automation-pro-help {
    margin: 0;
    color: #64748b;
    font-size: 0.7rem;
}
.automation-pro-comment-editor > label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.73rem;
    font-weight: 800;
    white-space: nowrap;
}
.automation-pro-public-fields {
    grid-column: 1 / -1;
    display: grid;
    gap: 0.25rem;
}
.automation-pro-public-fields label { font-size: 0.72rem; font-weight: 800; }
.automation-pro-public-fields textarea { width: 100%; min-height: 3.2rem; resize: vertical; }
.automation-pro-public-fields.is-hidden { display: none; }
.automation-pro-comment-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
}
.automation-pro-comment-editor .automation-pro-message { grid-column: 1 / -1; }
.automation-pro-native-save { display: none !important; }

@media (max-width: 1050px) {
    .automation-pro-body { grid-template-columns: 1fr 1fr; }
    .automation-pro-stats-card { grid-column: 1 / -1; }
}

@media (max-width: 700px) {
    #automation-pro-portal {
        width: 100%;
        max-height: none;
        padding: 0 0.45rem 0.45rem;
    }
    .automation-pro-panel,
    .automation-pro-comment-editor { width: 100%; margin: 0; }
    .automation-pro-panel.is-collapsed { width: 100%; margin: 0; }
    .automation-pro-bar { align-items: flex-start; }
    .automation-pro-body { grid-template-columns: 1fr; }
    .automation-pro-stats-card { grid-column: auto; }
    .automation-pro-comment-editor { grid-template-columns: 1fr; align-items: start; }
    .automation-pro-public-fields,
    .automation-pro-comment-actions,
    .automation-pro-comment-editor .automation-pro-message { grid-column: 1; }
}
