:root {
    /* -- Colors -- */
    --fos-primary: #6C47FF;
    --fos-primary-dark: #5535E0;
    --fos-primary-light: #EAE6FF;
    --fos-primary-faint: rgba(108, 71, 255, 0.06);
    --fos-primary-border: rgba(108, 71, 255, 0.20);

    --fos-success: #059669;
    --fos-success-light: #D1FAE5;
    --fos-success-dark: #047857;
    --fos-success-border: rgba(5, 150, 105, 0.2);

    --fos-danger: #EF4444;
    --fos-danger-light: #FEF2F2;
    --fos-danger-border: rgba(239, 68, 68, 0.25);
    --fos-danger-text: #991B1B;

    --fos-warning: #B07C12;
    --fos-warning-light: #FEF3C7;
    --fos-warning-dark: #B45309;

    --fos-text: #1D2327;
    --fos-text-sub: #50575E;
    --fos-text-dim: #6B7280;
    --fos-border: #E5E7EB;
    --fos-bg-soft: #F9FAFB;
}

/* ── 1. Animations ────────────────────────────────────────────────────────── */
@keyframes fos-hero-shimmer {
    0% {
        background-position: -100% 0
    }

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

@keyframes fos-hero-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.5),
            inset 0 0 0 1px rgba(255, 255, 255, 0.25);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(255, 255, 255, 0),
            inset 0 0 0 1px rgba(255, 255, 255, 0.4);
    }
}

@keyframes fos-pulse {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: 0.3
    }
}

/* ── 2. Hero Foundation ───────────────────────────────────────────────────── */
.fos-hero {
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    color: #fff;
    transition: all 0.3s ease;
}

/* State Modifiers */
.fos-hero--completed {
    background: linear-gradient(135deg, #6C47FF 0%, #5535E0 100%);
    box-shadow: 0 12px 32px -10px rgba(85, 53, 224, 0.55);
}

.fos-hero--running {
    background: linear-gradient(135deg, #8B5CFF 0%, #6C47FF 45%, #4F2BC9 100%);
    box-shadow: 0 12px 32px -10px rgba(108, 71, 255, 0.55);
}

.fos-hero--paused {
    background: linear-gradient(135deg, #FBBF24 0%, #F59E0B 50%, #B45309 100%);
    box-shadow: 0 12px 32px -10px rgba(180, 83, 9, 0.45);
}

.fos-hero--cancelled {
    background: linear-gradient(135deg, #94A3B8 0%, #64748B 100%);
    box-shadow: 0 12px 32px -10px rgba(100, 116, 139, 0.45);
}

.fos-hero--error {
    background: linear-gradient(135deg, #F87171 0%, #DC2626 55%, #991B1B 100%);
    box-shadow: 0 12px 32px -10px rgba(220, 38, 38, 0.55);
}

.fos-hero--warning {
    background: linear-gradient(135deg, #FBBF24 0%, #F59E0B 50%, #B45309 100%);
    box-shadow: 0 12px 32px -10px rgba(180, 83, 9, 0.45);
}

.fos-hero--awaiting {
    background: linear-gradient(135deg, #60A5FA 0%, #3B82F6 50%, #1D4ED8 100%);
    box-shadow: 0 12px 32px -10px rgba(29, 78, 216, 0.5);
}

.fos-hero--queued {
    background: linear-gradient(135deg, #4F46E5 0%, #2563EB 58%, #0F766E 100%);
    box-shadow: 0 12px 32px -10px rgba(37, 99, 235, 0.48);
}

.fos-hero--neutral {
    background: #fff;
    border: 1px solid var(--fos-border);
    color: var(--fos-text);
}

/* Shimmer Overlay (Running Only) */
.fos-hero--running::after,
.fos-hero--warning::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.07) 50%, transparent 70%);
    background-size: 250% 100%;
    animation: fos-hero-shimmer 5s linear infinite;
    z-index: 1;
}

/* ── 3. Top Bar ───────────────────────────────────────────────────────────── */
.fos-hero__top {
    padding: 18px 22px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    position: relative;
    z-index: 2;
}

.fos-hero--neutral .fos-hero__top {
    background: linear-gradient(135deg, rgba(148, 163, 184, 0.08) 0%, rgba(148, 163, 184, 0.02) 100%);
    border-bottom: 1px solid var(--fos-border);
}

.fos-hero__back {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.28);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    text-decoration: none;
    font-size: 16px;
    transition: var(--fos-transition);
}

.fos-hero__back:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
}

.fos-hero--neutral .fos-hero__back {
    background: #fff;
    border: 1px solid var(--fos-border);
    color: var(--fos-text-sub);
}

.fos-hero__icon {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: grid;
    place-items: center;
    font-size: 22px;
    flex-shrink: 0;
}

.fos-hero--running .fos-hero__icon {
    animation: fos-hero-pulse 2.2s ease-in-out infinite;
}

.fos-hero--queued .fos-hero__icon {
    background: rgba(255, 255, 255, 0.20);
    border-color: rgba(255, 255, 255, 0.34);
}

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

.fos-hero__title {
    font-size: 19px !important;
    font-weight: 700 !important;
    letter-spacing: -0.4px !important;
    color: #fff !important;
    margin: 0 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fos-hero--neutral .fos-hero__title {
    color: var(--fos-text) !important;
}

.fos-hero__meta {
    font-size: 12px;
    margin-top: 4px;
    color: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    gap: 6px;
}

.fos-hero--neutral .fos-hero__meta {
    color: var(--fos-text-sub);
}

.fos-hero__meta code {
    font-size: 10.5px;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 1px 6px;
    border-radius: 3px;
    font-family: var(--fos-font-mono);
}

.fos-hero--neutral .fos-hero__meta code {
    background: var(--fos-primary-faint);
    color: var(--fos-primary);
}

.fos-sep {
    opacity: 0.5;
    margin: 0 4px;
}

/* ── Article Type Badge (inside hero meta bar) ────────────────────────────── */
.fos-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.28);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    vertical-align: middle;
    white-space: nowrap;
}

.fos-hero__chip {
    padding: 5px 11px;
    border-radius: 14px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.fos-hero__chip-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    animation: fos-pulse 1.2s infinite;
}

.fos-hero--queued .fos-hero__chip-dot {
    background: #A7F3D0;
}

/* ── 4. KPI Grid ─────────────────────────────────────────────────────────── */
.fos-hero__kpis {
    display: grid;
    grid-template-columns: 1.3fr 1fr 1fr 1fr auto;
    gap: 0;
    align-items: stretch;
    position: relative;
    z-index: 2;
}

.fos-hero__stat {
    padding: 0px 26px;
    border-right: 1px solid rgba(255, 255, 255, 0.14);
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100px;
    position: relative;
    min-width: 0;
}

.fos-hero--neutral .fos-hero__stat {
    border-right: 1px solid var(--fos-border);
    background: #FAFBFC;
}

.fos-hero__stat-label {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.75);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 8px;
    line-height: 1;
}

.fos-hero--neutral .fos-hero__stat-label {
    color: var(--fos-text-dim);
}

.fos-hero__stat-value {
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.fos-hero--neutral .fos-hero__stat-value {
    color: var(--fos-text);
}

.fos-hero__stat-sub {
    margin-top: 6px;
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.72);
    line-height: 1.2;
}

.fos-hero--neutral .fos-hero__stat-sub {
    color: var(--fos-text-sub);
}

/* Progress Bar inside Stat */
.fos-hero__progress-track {
    margin-top: 6px;
    height: 5px;
    background: rgba(255, 255, 255, 0.22);
    border-radius: 3px;
    overflow: hidden;
}

.fos-hero__progress-fill {
    height: 100%;
    background: #fff;
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.fos-hero--running .fos-hero__progress-fill {
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}

.fos-hero--queued .fos-hero__progress-track {
    background: rgba(255, 255, 255, 0.18);
}

.fos-hero--queued .fos-hero__progress-fill {
    background: #A7F3D0;
    box-shadow: 0 0 10px rgba(167, 243, 208, 0.45);
}

/* ── 5. Actions ───────────────────────────────────────────────────────────── */
.fos-hero__actions {
    padding: 14px 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

.fos-hero__btn {
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 9px;
    cursor: pointer;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    font-family: inherit;
    transition: var(--fos-transition);
    text-decoration: none !important;
    min-width: 175px;
    box-sizing: border-box;
}

.fos-hero__btn--light {
    background: #fff;
    color: var(--fos-text);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.fos-hero__btn--outline {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.42);
}

.fos-hero__btn:hover {
    transform: translateY(-1px);
}

/* ── 6. Callouts (Error/Approval) ────────────────────────────────────────── */
.fos-hero__callout {
    padding: 12px 22px;
    background: rgba(0, 0, 0, 0.18);
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    display: flex;
    gap: 12px;
    align-items: center;
    position: relative;
    z-index: 2;
    color: #fff;
    font-size: 12px;
}

.fos-hero__callout--error {
    background: rgba(0, 0, 0, 0.2);
}

.fos-hero__callout--publishing {
    background: rgba(17, 24, 39, 0.22);
}

.fos-hero__callout--warning {
    background: rgba(176, 124, 18, 0.28);
}

/* ── 7. Runtime Strip ─────────────────────────────────────────────────────── */
.fos-hero__runtime {
    padding: 9px 22px;
    background: rgba(0, 0, 0, 0.24);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 11.5px;
    position: relative;
    z-index: 2;
    color: rgba(255, 255, 255, 0.88);
}

.fos-hero__technical-toggle {
    background: transparent;
    border: none;
    padding: 0;
    color: #fff;
    font-weight: 600;
    font-family: inherit;
    text-decoration: underline;
    text-decoration-color: rgba(255, 255, 255, 0.45);
    text-underline-offset: 3px;
    cursor: pointer;
}

/* ── 8. Shared Components ────────────────────────────────────────────────── */
.fos-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    font-family: inherit;
    line-height: 1.2;
    text-decoration: none;
}

.fos-btn--sm {
    padding: 5px 12px;
    font-size: 11.5px;
}

.fos-btn--ghost-white {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.32);
    color: #fff;
}

.fos-btn--ghost-white:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.55);
}

/* Fix for neutral hero (white background) */
.fos-hero--neutral .fos-btn--ghost-white {
    background: var(--fos-bg-soft);
    border: 1px solid var(--fos-border);
    color: var(--fos-text-sub);
}

.fos-hero--neutral .fos-btn--ghost-white:hover {
    background: #fff;
    border-color: var(--fos-primary-border);
    color: var(--fos-primary);
}

.fos-finalizing-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 0;
    padding: 14px 22px;
    border-top: 1px solid var(--fos-border);
    border-bottom: 1px solid var(--fos-border);
    background: #F8FAFC;
    color: var(--fos-text);
}

.fos-finalizing-notice__icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #EEF2FF;
    flex: 0 0 auto;
}

.fos-finalizing-notice__title {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 3px;
}

.fos-finalizing-notice__text {
    color: var(--fos-text-sub);
    font-size: 12px;
    line-height: 1.45;
}

/* ── Pending Queue State ─────────────────────────────────────────────────── */
.fos-pending-body {
    border-color: rgba(37, 99, 235, 0.16);
}

.fos-pending-body__header {
    justify-content: space-between;
    background: linear-gradient(180deg, #fff 0%, #F8FAFC 100%);
}

.fos-pending-body__eyebrow {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--fos-primary);
}

.fos-pending-body__title {
    margin-top: 2px;
    font-size: 14px;
    font-weight: 800;
    color: var(--fos-text);
}

.fos-pending-body__content {
    padding: 18px 22px 22px;
    background: #F8FAFC;
}

.fos-pending-body .fos-detalhe-progress {
    padding: 18px 20px;
    border: 1px solid rgba(37, 99, 235, 0.16);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 10px 24px -18px rgba(15, 23, 42, 0.35);
}

.fos-detalhe-progress__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.fos-detalhe-progress__status {
    font-size: 18px;
    font-weight: 800;
    color: var(--fos-text);
    letter-spacing: -0.2px;
}

.fos-detalhe-progress__agent {
    margin-top: 4px;
    color: var(--fos-text-sub);
    font-size: 13px;
    line-height: 1.45;
}

.fos-detalhe-progress__right {
    min-width: 96px;
    text-align: right;
}

.fos-detalhe-progress__pct {
    font-size: 26px;
    line-height: 1;
    font-family: var(--fos-font-mono);
    font-weight: 800;
    color: var(--fos-primary);
}

.fos-detalhe-progress__pct-label {
    margin-top: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--fos-text-dim);
}

.fos-detalhe-bar-wrap {
    height: 8px;
    margin-top: 18px;
    border-radius: 999px;
    overflow: hidden;
    background: #E5E7EB;
}

.fos-detalhe-bar-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #4F46E5, #0F766E);
}

.fos-detalhe-dots {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(18px, 1fr));
    gap: 8px;
    margin-top: 14px;
}

.fos-detalhe-dot {
    height: 6px;
    border-radius: 999px;
    background: #D1D5DB;
}

.fos-detalhe-dot--pending {
    background: linear-gradient(90deg, rgba(79, 70, 229, 0.22), rgba(15, 118, 110, 0.22));
}

.fos-pending-queue-note {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 14px 0 0;
    padding: 14px 16px;
    border: 1px solid rgba(37, 99, 235, 0.14);
    border-left: 3px solid #2563EB;
    border-radius: 8px;
    background: #EFF6FF;
}

.fos-pending-queue-note__icon {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 8px;
    background: #fff;
    border: 1px solid rgba(37, 99, 235, 0.16);
    font-size: 14px;
}

.fos-pending-queue-note__title {
    font-size: 13px;
    font-weight: 800;
    color: var(--fos-text);
}

.fos-pending-queue-note__text {
    margin-top: 2px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--fos-text-sub);
}

.fos-pending-queue-grid {
    margin-top: 14px;
}

.fos-pipeline-row__caret {
    transition: transform 0.2s ease;
    display: inline-flex;
    align-items: center;
    color: var(--fos-text-dim);
}

.fos-btn--ghost-primary {
    background: var(--fos-primary-faint);
    color: var(--fos-primary);
    border: 1px solid var(--fos-primary-border);
}

.fos-btn--ghost-primary:hover {
    background: var(--fos-primary-light);
}

.fos-btn--ghost {
    background: transparent;
    color: var(--fos-text-sub);
    border: 1px solid var(--fos-border);
}

.fos-btn--ghost:hover {
    background: var(--fos-bg-soft);
}

.fos-pipeline-row__caret {
    transition: transform 0.2s ease;
    display: inline-flex;
    align-items: center;
    color: var(--fos-text-dim);
}

.fos-pipeline-row__caret.is-open {
    transform: rotate(180deg);
}

/* ──────────────────────────────────────────────────────────────────────────
   ORIGINAL STYLES (Preserved or migrated)
   ========================================================================== */

/* ── Event Log (Structured v3.0) ─────────────────────────────────────────── */
.fos-log-content {
    padding: 16px 20px !important;
    background: #0F1420 !important;
    font-family: var(--fos-font-mono) !important;
    font-size: 11px !important;
    line-height: 1.8 !important;
    max-height: 280px !important;
    overflow: auto !important;
}

.fos-log-line {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 4px;
    color: #E5E7EB;
}

.fos-log-time {
    color: #4B5563;
    min-width: 54px;
    flex-shrink: 0;
}

.fos-log-level {
    font-weight: 800;
    text-transform: uppercase;
    min-width: 32px;
    flex-shrink: 0;
    letter-spacing: 0.4px;
}

.fos-log-level--info {
    color: #60A5FA;
}

.fos-log-level--ok {
    color: #34D399;
}

.fos-log-level--warn {
    color: #FBBF24;
}

.fos-log-level--err {
    color: #F87171;
}

.fos-log-agent {
    color: #818CF8;
    font-weight: 600;
    min-width: 28px;
    flex-shrink: 0;
}

.fos-log-msg {
    color: #F3F4F6;
    word-break: break-word;
}

/* ── AGENT TIMELINE (Unchanged structure, refined spacing) ────────────────── */
.agent-row {
    border-bottom: 1px solid var(--fos-border);
    transition: background 0.2s;
}

.agent-row:hover {
    background: #fafbfc;
}

/* ── RESPONSIVE ──────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
    .fos-hero__kpis {
        grid-template-columns: 1fr 1fr;
    }

    .fos-hero__stat {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .fos-hero__actions {
        grid-column: span 2;
        align-items: center;
        flex-direction: row;
    }

    .fos-hero__btn {
        flex: 1;
        justify-content: center;
    }
}

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

    .fos-hero__stat {
        border-right: none;
    }

    .fos-hero__actions {
        grid-column: span 1;
        flex-direction: column;
    }
}

/* ── 9. Modals ───────────────────────────────────────────────────────────── */
.fos-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.fos-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 20, 32, 0.65);
    backdrop-filter: blur(4px);
    cursor: pointer;
}

.fos-modal__content {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.3);
    width: 100%;
    position: relative;
    z-index: 2;
    overflow: hidden;
    animation: fos-modal-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fos-modal-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

.fos-modal__header h2 {
    margin: 0 !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    color: var(--fos-text) !important;
}

.fos-modal__close {
    background: transparent;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: var(--fos-text-dim);
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}

.fos-modal__close:hover {
    color: var(--fos-danger);
}

body.fos-modal-open {
    overflow: hidden !important;
}