/* Trading agents tab — section title + hero (aligned with Trade Picks / Alerts) */
.autotrade-section-modern {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.automation-subtabs {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
}

.automation-subtabs::-webkit-scrollbar {
    display: none;
}

.automation-subtab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 20px;
    flex-shrink: 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: var(--transition-fast);
}

.automation-subtab:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.automation-subtab.active {
    border-color: transparent;
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(96, 165, 250, 0.3);
}

.automation-subtab:focus-visible {
    outline: 2px solid var(--primary, #3b82f6);
    outline-offset: 2px;
}

.automation-subtab-panel[hidden] {
    display: none;
}

.automation-subtab[hidden],
.automation-workflow-rail .automation-subtab[hidden] {
    display: none;
}

.automation-inactive-agents {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 18px;
    border-radius: var(--radius-lg);
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
}

.automation-inactive-agents h4 {
    margin: 0;
    font-size: var(--type-lg, 1.1rem);
}

.automation-bench-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.automation-bench-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.automation-bench-row h5 {
    margin: 0;
    font-size: 15px;
}

.automation-bench-row .automation-fine {
    margin: 2px 0 0;
}

/* Three fixed agents: 3 columns desktop/tablet, 1 column mobile */
.automation-fixed-agents-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 12px;
    margin-bottom: 8px;
}

@media (max-width: 639px) {
    .automation-fixed-agents-grid {
        grid-template-columns: 1fr;
    }
}

.automation-ares-status-card-wide {
    margin-bottom: 4px;
}

.automation-agent-fixed-card.is-active-slot {
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.55);
    background: linear-gradient(
        180deg,
        rgba(16, 185, 129, 0.22),
        rgba(16, 185, 129, 0.09)
    );
    border-color: rgba(16, 185, 129, 0.52);
    align-items: flex-start;
    text-align: left;
    padding: 16px 18px;
    gap: 8px;
}

.automation-agent-fixed-card {
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 12px;
    cursor: pointer;
}

.automation-agent-fixed-card.automation-ares-card {
    border-radius: 6px;
}

.automation-agent-fixed-card.automation-ares-card h4 {
    font-size: calc(20px + 2pt);
}

.automation-agent-fixed-card.automation-ares-card .btn-modern {
    font-size: calc(13px + 2pt);
}

.automation-agent-fixed-card .sub {
    display: none !important;
}

.automation-agent-fixed-card:not(.is-active-slot) .automation-agent-label-wrap,
.automation-agent-fixed-card:not(.is-active-slot) .automation-budget-row,
.automation-agent-fixed-card:not(.is-active-slot) [data-agent-action="save"] {
    display: none !important;
}

.automation-agent-fixed-card.is-active-slot .automation-agent-label-wrap {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    text-align: left;
}

.automation-agent-fixed-card.is-active-slot .automation-budget-row {
    display: flex !important;
    flex-direction: column;
    width: 100%;
    align-items: stretch;
    text-align: left;
}

.automation-agent-fixed-card.is-active-slot [data-agent-action="save"] {
    display: inline-flex !important;
}

.automation-agent-active-summary {
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary);
    display: none;
    line-height: 1.45;
    letter-spacing: 0.01em;
}

.automation-agent-fixed-card.is-active-slot .automation-agent-active-summary {
    display: block;
    color: #083344;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(6, 95, 70, 0.16);
    border-radius: 6px;
    padding: 8px 10px;
    width: 100%;
    box-sizing: border-box;
    font-size: calc(14px + 2pt);
}

.automation-agent-fixed-card .automation-agent-card-actions {
    margin: 0;
    justify-content: center;
}

.automation-agent-fixed-card.is-active-slot .automation-agent-card-actions {
    width: 100%;
    justify-content: flex-start;
}

.automation-agent-fixed-card.is-active-slot [data-agent-action="activate"] {
    display: none;
}

.automation-agent-fixed-card.is-hash-focus {
    outline: 2px solid rgba(59, 130, 246, 0.7);
    outline-offset: 2px;
}

.automation-agent-fixed-card.is-inactive-slot {
    opacity: 0.76;
    filter: saturate(0.75);
    background: linear-gradient(
        180deg,
        rgba(148, 163, 184, 0.08),
        rgba(148, 163, 184, 0.03)
    );
    border-color: rgba(148, 163, 184, 0.35);
    min-height: 220px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 14px;
}

.automation-agent-fixed-card.is-inactive-slot h4 {
    margin: 0;
    font-size: calc(26px + 2pt);
    line-height: 1.2;
}

.automation-agent-fixed-card.is-inactive-slot .sub,
.automation-agent-fixed-card.is-inactive-slot [data-agent-action="save"] {
    display: none !important;
}

.automation-agent-fixed-card.is-inactive-slot .automation-agent-card-actions {
    margin: 0;
    justify-content: center;
}

.automation-agent-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(2, 6, 23, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.automation-agent-modal {
    width: min(680px, 96vw);
    max-height: min(92vh, 100dvh);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
}

.automation-agent-modal-header {
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 16px 10px;
    border-bottom: 1px solid var(--border-color);
}

.automation-agent-modal-header h4 {
    margin: 0;
    font-size: 22px;
}

.automation-agent-modal-sub {
    margin: 4px 0 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.automation-agent-modal-close {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 16px;
    padding: 6px;
    border-radius: 8px;
    cursor: pointer;
}

.automation-agent-modal-close:hover {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-primary);
}

.automation-agent-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.automation-agent-modal-status {
    margin: 2px 0 0;
    min-height: 1.2em;
}

.automation-agent-modal-footer {
    flex-shrink: 0;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 16px 16px;
    border-top: 1px solid var(--border-color);
}

@media (max-width: 1023px) {
    .automation-agent-fixed-card.is-active-slot {
        padding: 14px;
        gap: 8px;
    }

    .automation-agent-fixed-card.is-inactive-slot {
        min-height: 180px;
        padding: 18px 14px;
    }

    .automation-agent-fixed-card.is-inactive-slot h4 {
        font-size: calc(22px + 2pt);
    }

    .automation-agent-fixed-card h4 {
        font-size: calc(22px + 2pt);
    }

    .automation-agent-fixed-card.automation-ares-card h4 {
        font-size: calc(22px + 2pt);
    }

    .automation-agent-active-summary {
        font-size: calc(13px + 2pt);
    }
}

.automation-agent-label-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.automation-agent-label-wrap input {
    width: 100%;
    box-sizing: border-box;
}

.automation-agent-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.autotrade-position-header {
    margin-top: 0;
    border-bottom: none !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
    min-height: 68px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
}

.autotrade-position-header .hero-secondary-icon {
    order: -1;
}

.autotrade-header-leading {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.autotrade-header-leading .automation-agent-room-date-bar {
    margin-left: auto;
    flex: 0 0 auto;
}

.autotrade-header-leading .alerts-date-nav-scroll-wrap {
    margin-left: 0;
    margin-bottom: 0;
    flex: 0 0 auto;
}

.autotrade-header-leading .alerts-date-nav-scroll-wrap::after {
    display: none;
}

.autotrade-header-leading .alerts-date-nav-modern {
    overflow: visible;
    padding-bottom: 0;
}

.autotrade-position-header .section-title-modern {
    display: flex;
    align-items: center;
}

@media (max-width: 639px) {
    .autotrade-position-header .section-title-modern {
        display: none;
    }
}

.autotrade-hero-modern {
    padding: 32px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(59, 130, 246, 0.08));
}

#tab-trading-agents-modern .autotrade-hero-modern.hero-panel-dismissible {
    margin-top: 0;
}

.autotrade-hero-content {
    display: flex;
    align-items: center;
    gap: 24px;
}

.autotrade-icon-large {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, #10b981, #3b82f6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 36px;
    flex-shrink: 0;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.28);
}

.autotrade-hero-text {
    flex: 1;
}

.autotrade-hero-title {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 8px 0;
    letter-spacing: -0.5px;
}

.autotrade-hero-description {
    font-size: 18px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.6;
}

@media (max-width: 639px) {
    .autotrade-hero-content {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }

    .autotrade-icon-large {
        width: 64px;
        height: 64px;
        font-size: 28px;
    }

    .autotrade-hero-title {
        font-size: 22px;
    }
}

.automation-ares-tab {
    display: grid;
    gap: 14px;
}

.automation-ares-panel {
    border: 1px solid var(--border-color);
    border-radius: 14px;
    overflow: hidden;
    background: var(--bg-glass);
}

@media (min-width: 768px) {
    .automation-ares-panel {
        display: grid;
        grid-template-columns: 1fr 1fr;
        align-items: stretch;
    }

    .automation-ares-panel > .automation-command-strip,
    .automation-ares-panel > .automation-workspace,
    .automation-ares-panel > .automation-setup-lower {
        grid-column: 1 / -1;
    }

    .automation-command-strip {
        display: grid;
        grid-template-columns: 1fr 1fr;
        align-items: start;
        border-bottom: 1px solid var(--border-color);
    }

    .automation-command-strip .automation-ares-panel-hero {
        border-bottom: none;
    }

    .automation-command-strip > .automation-active-agent-slot {
        display: flex;
        flex-direction: column;
        min-width: 0;
        border-right: 1.5px solid rgba(185, 28, 28, 0.28);
    }

    .automation-command-strip:has(#automation-ares-toggle:checked) > .automation-active-agent-slot {
        border-right-color: rgba(16, 185, 129, 0.45);
    }

    .automation-command-strip .automation-ares-master-switch {
        border-bottom: 1.5px solid rgba(185, 28, 28, 0.28);
        border-right: none;
        flex-shrink: 0;
    }

    .automation-command-strip .automation-ares-master-switch:has(#automation-ares-toggle:checked) {
        border-bottom-color: rgba(16, 185, 129, 0.45);
        border-right: none;
    }
}

.automation-ares-panel-hero {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    border-radius: 0;
}

.automation-ares-panel-hero h3 {
    margin: 0;
    font-size: calc(22px + 2pt);
}

.automation-ares-panel-hero p {
    margin: 8px 0 0;
    color: var(--text-secondary);
    font-size: calc(17px + 2pt);
}

.automation-ares-kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.automation-ares-kpi {
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 10px 11px;
}

.automation-ares-kpi .k {
    display: block;
    font-size: calc(13px + 2pt);
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.automation-ares-kpi .v {
    font-size: calc(18px + 2pt);
    font-weight: 800;
}

.automation-ares-content {
    padding: 16px;
    display: grid;
    row-gap: 16px;
    column-gap: 12px;
}

.automation-ares-detached {
    padding: 0;
    display: grid;
    row-gap: 16px;
    column-gap: 12px;
}

.automation-ares-grid {
    display: grid;
    row-gap: 16px;
    column-gap: 12px;
}

.automation-ares-grid-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.automation-ares-grid-2 {
    grid-template-columns: 1fr 1fr;
}

.automation-ares-detached .automation-ares-grid-2 > .automation-ares-card {
    margin-top: 10px;
    margin-bottom: 10px;
}

.automation-ares-card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-secondary);
    padding: 14px;
}

.automation-ares-card h4 {
    margin: 0;
    font-size: 20px;
    letter-spacing: 0.15px;
}

.automation-ares-card .sub {
    margin: 5px 0 0;
    color: var(--text-secondary);
    font-size: 16px;
}

.automation-ares-switch-row {
    margin-top: 10px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-primary);
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.automation-ares-toggle {
    position: relative;
    width: 46px;
    height: 24px;
    flex-shrink: 0;
}

.automation-ares-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.automation-ares-toggle .slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #64748b;
    transition: 0.2s;
    cursor: pointer;
}

.automation-ares-toggle .slider::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    top: 3px;
    left: 3px;
    border-radius: 50%;
    background: #fff;
    transition: 0.2s;
}

.automation-ares-toggle input:checked + .slider {
    background: #10b981;
}

.automation-ares-toggle input:checked + .slider::before {
    transform: translateX(22px);
}

.automation-ares-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.automation-ares-line {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
}

.automation-budget-card .automation-budget-row {
    margin-top: 12px;
    padding: 10px 11px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-primary);
}

.automation-budget-row-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 8px;
}

.automation-budget-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.automation-budget-hint {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.automation-budget-segmented {
    display: flex;
    gap: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 4px;
}

.automation-budget-opt {
    flex: 1;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 10px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.automation-budget-opt:hover {
    color: var(--text-primary);
    background: rgba(59, 130, 246, 0.08);
}

.automation-budget-opt.active {
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.45);
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.automation-budget-segmented-many {
    flex-wrap: wrap;
    justify-content: center;
    border-radius: 12px;
}

.automation-budget-segmented-many .automation-budget-opt {
    flex: 0 1 auto;
    min-width: 2.35rem;
    padding: 7px 8px;
    font-size: 12px;
}

.automation-agent-modal-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
}

.automation-agent-modal-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.automation-agent-modal-section-title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.automation-agent-modal-section-title .fas {
    opacity: 0.75;
    font-size: 13px;
}

.automation-agent-modal-section-sub {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.45;
}

.automation-agent-toggle-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 14px;
}

@media (max-width: 560px) {
    .automation-agent-toggle-grid {
        grid-template-columns: 1fr;
    }
}

.automation-agent-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
    color: var(--text-primary);
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.automation-agent-toggle-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    accent-color: var(--primary, #3b82f6);
}

.automation-agent-toggle-row-single {
    max-width: 100%;
}

.automation-agent-policy-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

@media (min-width: 720px) {
    .automation-agent-policy-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.automation-agent-policy-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    min-width: 0;
}

.automation-agent-policy-row-single {
    max-width: 100%;
}

.automation-agent-policy-label {
    font-size: 12px;
    color: var(--text-primary);
    line-height: 1.35;
}

.automation-agent-policy-row .automation-budget-segmented,
.automation-agent-policy-row .automation-agent-policy-tri {
    width: 100%;
}

.automation-agent-policy-tri .automation-budget-opt {
    flex: 1 1 0;
    min-width: 0;
    padding-left: 6px;
    padding-right: 6px;
}

.automation-agent-range-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

.automation-agent-range-row > label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.automation-agent-range-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.automation-agent-range-wrap input[type="range"] {
    flex: 1;
    min-width: 0;
    accent-color: var(--primary, #3b82f6);
}

.automation-agent-range-readout {
    font-size: 13px;
    font-weight: 700;
    min-width: 3rem;
    text-align: right;
    color: var(--text-primary);
}

.automation-budget-usage {
    margin-top: 14px;
}

.automation-budget-cap-hint {
    margin: 6px 0 0;
}

.automation-budget-save-status {
    margin: 8px 0 0;
    min-height: 1.2em;
}

.automation-ares-chip-row {
    margin-top: 10px;
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
}

.automation-ares-chip {
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    padding: 4px 9px;
}

.automation-ares-chip.ok {
    border-color: rgba(16, 185, 129, 0.45);
    background: rgba(16, 185, 129, 0.12);
    color: #067161;
}

.automation-ares-chip.off {
    opacity: 0.55;
    filter: grayscale(20%);
}

.automation-days-card .automation-days-glance {
    margin-top: 12px;
}

.automation-days-chip-strip {
    margin-top: 0;
}

.automation-days-editor {
    margin-top: 12px;
}

.automation-days-editor .automation-days-actions {
    margin-top: 12px;
}

.automation-days-summary-line {
    margin: 10px 0 0;
    font-weight: 600;
    font-size: 15px;
    text-align: center;
}

.automation-days-save-status {
    margin: 6px 0 0;
    min-height: 1.2em;
}

.automation-day-grid-modern {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
    padding: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 999px;
}

.automation-day-pill {
    flex: 1;
    min-width: 52px;
    position: relative;
    margin: 0;
    cursor: pointer;
    text-align: center;
}

.automation-day-pill input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
}

.automation-day-pill span {
    display: block;
    border-radius: 999px;
    padding: 8px 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid transparent;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.automation-day-pill:hover span {
    color: var(--text-primary);
    background: rgba(59, 130, 246, 0.08);
}

.automation-day-pill input:checked + span {
    color: var(--text-primary);
    background: rgba(16, 185, 129, 0.18);
    border-color: rgba(16, 185, 129, 0.5);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.automation-day-pill input:focus-visible + span {
    outline: 2px solid rgba(59, 130, 246, 0.6);
    outline-offset: 2px;
}

.automation-fine {
    color: var(--text-secondary);
    font-size: 13px;
}

.automation-ares-queue {
    margin-top: 10px;
    display: grid;
    gap: 8px;
}

.automation-ares-queue .q-row {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-secondary);
    padding: 10px 11px;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
    margin-bottom: 10px;
}

.automation-ares-queue .q-row:last-child {
    margin-bottom: 0;
}

.automation-ares-queue .q-main {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.automation-ares-queue .sym {
    font-weight: 700;
}

.automation-ares-queue .q-mini-swap {
    display: flex;
    align-items: stretch;
    gap: 10px;
}

.automation-ares-queue .q-mini-swap.q-mini-swap--open-only {
    gap: 0;
}

.automation-ares-queue .q-mini-leg-link {
    display: block;
    flex: 1 1 0;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

.automation-ares-queue .q-mini-leg.q-mini-leg--clickable {
    cursor: pointer;
}

.automation-ares-queue .q-mini-leg.q-mini-leg--clickable:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: var(--primary);
}

.automation-ares-queue .q-mini-leg {
    flex: 1 1 0;
    min-width: 0;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    padding: 9px 10px;
    background: var(--bg-primary);
    transition: var(--transition);
}

.automation-ares-queue .q-mini-leg.q-mini-leg--bearish {
    border-left: 3px solid rgba(239, 68, 68, 0.85);
}

.automation-ares-queue .q-mini-leg.q-mini-leg--bullish {
    border-left: 3px solid rgba(16, 185, 129, 0.9);
}

.automation-ares-queue .q-mini-leg-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 5px;
}

.automation-ares-queue .q-mini-leg-title {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.automation-ares-queue .q-mini-pill {
    font-size: calc(14px + 2pt);
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-radius: 6px;
    padding: 4px 7px;
    line-height: 1;
}

.automation-ares-queue .q-mini-pill.q-mini-pill--bearish {
    background: rgba(239, 68, 68, 0.14);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.28);
}

.automation-ares-queue .q-mini-pill.q-mini-pill--bullish {
    background: rgba(16, 185, 129, 0.14);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.28);
}

.automation-ares-queue .q-mini-ticker {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--text-primary);
}

.automation-ares-queue .q-mini-price {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--text-primary);
    text-align: right;
    white-space: nowrap;
    margin-left: auto;
}

.automation-ares-queue .q-mini-quote {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    margin-left: auto;
    min-width: fit-content;
}

.automation-ares-queue .q-mini-quote-detail {
    margin-top: 2px;
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.1;
    white-space: nowrap;
}

.automation-ares-queue .q-mini-yf-company-name {
    margin: 8px 0 0;
    font-size: calc(15px + 2pt);
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-primary);
    width: 100%;
}

.automation-ares-queue .q-mini-leg-meta {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-wrap: wrap;
    gap: 5px 7px;
    align-items: center;
}

.automation-ares-queue .artemis-yf-meta-wrap--queue {
    margin-top: 8px;
    width: 100%;
    min-width: 0;
}

.automation-ares-queue .artemis-yf-meta-line--queue {
    display: none !important;
}

.automation-ares-queue .artemis-yf-description-text {
    font-size: 10px;
    line-height: 1.4;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
}

.automation-ares-queue
    .artemis-yf-meta-wrap--queue.artemis-yf-meta-wrap--desc-expanded
    .artemis-yf-description-text {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
}

.automation-ares-queue .artemis-yf-description-more {
    font-size: 10px;
}

.automation-ares-queue .q-mini-company {
    width: 100%;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
}

.automation-ares-queue .q-mini-submeta {
    font-size: calc(10px + 2pt);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: 6px;
    padding: 2px 6px;
    line-height: 1.25;
}

.automation-ares-queue .stage-badge-modern {
    border-radius: 6px;
    font-size: calc(12px + 2pt);
}

.automation-ares-queue .q-mini-submeta.q-mini-submeta--pl {
    font-weight: 600;
}

.automation-ares-queue .q-mini-realized-pl-wrap {
    margin-top: 6px;
}

.automation-ares-queue .q-mini-submeta.q-mini-submeta--pl {
    font-weight: 800;
}

.automation-ares-queue .q-mini-submeta.q-mini-submeta--pl.positive {
    color: var(--success, #16a34a);
    border-color: color-mix(in srgb, var(--success, #16a34a) 45%, var(--border-color));
    background: color-mix(in srgb, var(--success, #16a34a) 12%, var(--bg-secondary));
}

.automation-ares-queue .q-mini-submeta.q-mini-submeta--pl.negative {
    color: var(--danger, #dc2626);
    border-color: color-mix(in srgb, var(--danger, #dc2626) 45%, var(--border-color));
    background: color-mix(in srgb, var(--danger, #dc2626) 12%, var(--bg-secondary));
}

.automation-ares-queue .q-mini-bridge {
    width: 28px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.automation-ares-queue .q-mini-bridge-line {
    width: 2px;
    min-height: 12px;
    flex: 1;
    background: linear-gradient(
        180deg,
        transparent,
        var(--border-color) 20%,
        var(--border-color) 80%,
        transparent
    );
}

.automation-ares-queue .q-mini-bridge-icon {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    margin: 4px 0;
}

.automation-ares-queue .q-mini-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.automation-ares-queue .q-mini-chip {
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 3px 7px;
    line-height: 1;
}

.automation-ares-queue .q-mini-chip.q-mini-chip--swap {
    border-color: rgba(59, 130, 246, 0.42);
    color: #2563eb;
}

.automation-ares-queue .q-mini-chip.q-mini-chip--cash {
    border-color: rgba(16, 185, 129, 0.42);
    color: #059669;
}

.automation-queue-pager {
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.automation-queue-page-text {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
}

.automation-queue-pager .btn-modern {
    font-size: 14px;
}

.automation-ares-feed {
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 8px;
}

.automation-ares-feed li.automation-feed-item {
    border-left: 3px solid rgba(59, 130, 246, 0.55);
    border-radius: 8px;
    background: var(--bg-primary);
    padding: 10px 12px;
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr) minmax(76px, auto);
    gap: 10px 12px;
    align-items: start;
    font-size: calc(12px + 2pt);
}

.automation-ares-feed li.automation-feed-item--close {
    border-left-color: rgba(245, 158, 11, 0.65);
}

.automation-ares-feed li.automation-feed-item--cash {
    border-left-color: rgba(16, 185, 129, 0.6);
}

.automation-ares-feed li.automation-feed-item--empty {
    border-left-color: rgba(148, 163, 184, 0.5);
}

.automation-feed-time {
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
    line-height: 1.35;
    padding-top: 2px;
}

.automation-feed-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.automation-feed-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
}

.automation-feed-pill {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 999px;
    line-height: 1.2;
    background: rgba(59, 130, 246, 0.18);
    color: var(--text-primary);
    border: 1px solid rgba(59, 130, 246, 0.35);
}

.automation-feed-pill--swap {
    background: rgba(59, 130, 246, 0.18);
    border-color: rgba(59, 130, 246, 0.4);
}

.automation-feed-pill--close {
    background: rgba(245, 158, 11, 0.16);
    border-color: rgba(245, 158, 11, 0.4);
}

.automation-feed-pill--cash {
    background: rgba(16, 185, 129, 0.14);
    border-color: rgba(16, 185, 129, 0.38);
}

.automation-feed-pill--other {
    background: rgba(148, 163, 184, 0.15);
    border-color: rgba(148, 163, 184, 0.35);
}

.automation-feed-pill--idle {
    align-self: center;
    background: rgba(148, 163, 184, 0.12);
    border-color: rgba(148, 163, 184, 0.3);
}

.automation-feed-symbols {
    font-weight: 600;
    font-size: calc(12px + 1pt);
    line-height: 1.35;
    min-width: 0;
}

.automation-feed-sym {
    color: var(--accent-primary, #3b82f6);
    text-decoration: none;
}

.automation-feed-sym:hover {
    text-decoration: underline;
}

.automation-feed-arrow {
    opacity: 0.55;
    margin: 0 5px;
    font-weight: 500;
}

.automation-feed-verb {
    font-weight: 600;
    color: var(--text-secondary);
    margin-right: 4px;
}

.automation-feed-detail {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    word-break: break-word;
}

.automation-would-execute-heading {
    margin-top: 18px;
}

.automation-feed-rationale {
    margin-top: 8px;
}

.automation-feed-rationale summary {
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
}

.automation-rationale-narrative {
    margin: 8px 0 6px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-primary);
}

.automation-rationale-section {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

.automation-rationale-status {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.35);
}

.automation-rationale-status--bound {
    background: rgba(16, 185, 129, 0.14);
    border-color: rgba(16, 185, 129, 0.38);
    color: var(--text-primary);
}

.automation-rationale-status--observed_not_bound {
    background: rgba(245, 158, 11, 0.16);
    border-color: rgba(245, 158, 11, 0.4);
    color: var(--text-primary);
}

.automation-rationale-status--unavailable {
    background: rgba(148, 163, 184, 0.12);
    border-color: rgba(148, 163, 184, 0.3);
}

.automation-feed-agent-row {
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
}

.automation-feed-agent {
    font-weight: 600;
    color: var(--text-primary);
}

.automation-feed-agent-label {
    opacity: 0.85;
}

.automation-feed-source {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    opacity: 0.75;
}

.automation-feed-side {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 4px;
    text-align: right;
}

.automation-feed-metrics {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.automation-feed-metric {
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.automation-feed-metric--muted {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 11px;
}

.automation-feed-metric--pl-pos {
    color: #059669;
}

.automation-feed-metric--pl-neg {
    color: #dc2626;
}

.automation-feed-empty-title {
    color: var(--text-secondary);
    font-size: 13px;
    padding-top: 2px;
}

.automation-activity-hype-banner {
    margin: 0 0 14px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(96, 165, 250, 0.35);
    background: rgba(96, 165, 250, 0.1);
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.45;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.automation-activity-hype-banner i {
    color: #60a5fa;
    margin-top: 2px;
}

.automation-activity-hype-banner strong {
    color: var(--text-primary);
    font-weight: 650;
}

.automation-ares-feed li.automation-feed-item--hype {
    border-left-color: rgba(96, 165, 250, 0.45);
    background: rgba(148, 163, 184, 0.06);
    opacity: 0.96;
}

.automation-feed-hype-hint {
    grid-column: 1 / -1;
    border-left: none !important;
    background: transparent !important;
    padding: 4px 0 0 !important;
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.automation-feed-hype-hint i {
    color: #60a5fa;
}

.automation-activity-hype-row .sym {
    color: var(--text-primary);
}

.automation-activity-hype-row .automation-fine {
    display: block;
    margin-top: 4px;
}

.automation-range-btns {
    margin-top: 10px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.automation-range-btns .btn-modern.active {
    background: rgba(59, 130, 246, 0.18);
    border-color: rgba(59, 130, 246, 0.5);
    color: var(--text-primary);
}

.automation-order-history-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.automation-order-history-heading h4 {
    margin: 0;
}

.automation-order-history-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 12px 0 8px;
    flex-wrap: wrap;
}

#automation-order-history-cards {
    margin-top: 8px;
}

.automation-pl-pos {
    color: #059669;
    font-weight: 700;
}

.automation-pl-neg {
    color: #dc2626;
    font-weight: 700;
}

.automation-pl-flat {
    color: var(--text-primary);
    font-weight: 700;
}

.automation-agents-hint {
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--text-secondary);
    min-height: 1.2em;
}

.automation-agents-slots {
    margin-top: 12px;
    display: grid;
    gap: 8px;
}

.automation-agent-slot {
    border: 1px solid var(--border-color);
    border-radius: 9px;
    background: var(--bg-primary);
    padding: 10px;
    display: grid;
    gap: 8px;
    font-size: 12px;
}

.automation-agent-slot-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.automation-agent-slot-title {
    font-weight: 700;
    font-size: 13px;
}

.automation-agent-slot-meta {
    color: var(--text-secondary);
    font-size: 11px;
    line-height: 1.35;
}

.automation-agent-slot-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.automation-agent-slot .automation-agent-label-input {
    flex: 1;
    min-width: 120px;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-glass);
    color: inherit;
    font-size: 12px;
}

.automation-agent-slot.is-active-slot {
    border-color: rgba(16, 185, 129, 0.45);
    box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.12);
}

.automation-check-row {
    margin-top: 9px;
    display: grid;
    gap: 6px;
}

.automation-check-row label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
}

.automation-check-row input {
    width: 14px;
    height: 14px;
    accent-color: var(--primary);
}

.automation-flow-log {
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 7px;
    max-height: 220px;
    overflow: auto;
}

.automation-flow-log li {
    border-left: 3px solid rgba(59, 130, 246, 0.5);
    border-radius: 8px;
    background: var(--bg-primary);
    padding: 7px 9px;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.automation-flow-log .tag {
    color: var(--text-secondary);
    font-size: 11px;
    white-space: nowrap;
}

@media (max-width: 1023px) {
    .automation-ares-panel-hero {
        grid-template-columns: 1fr;
    }

    .automation-ares-grid-3 {
        grid-template-columns: 1fr 1fr;
    }

    .automation-ares-queue .q-meta {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 639px) {
    .automation-ares-line {
        flex-wrap: wrap;
    }

    .automation-agent-slot .automation-agent-label-input {
        min-width: 0;
        width: 100%;
    }

    .automation-ares-grid-3,
    .automation-ares-grid-2 {
        grid-template-columns: 1fr;
    }

    .automation-ares-feed li {
        grid-template-columns: 1fr;
    }

    .automation-ares-queue .q-mini-swap:not(.q-mini-swap--open-only) {
        flex-direction: column;
        gap: 8px;
    }

    .automation-ares-queue .q-mini-bridge {
        width: 100%;
        flex-direction: row;
    }

    .automation-ares-queue .q-mini-bridge-line {
        width: auto;
        height: 2px;
        min-height: 0;
        flex: 1;
        background: linear-gradient(
            90deg,
            transparent,
            var(--border-color) 20%,
            var(--border-color) 80%,
            transparent
        );
    }

    .automation-ares-queue .q-mini-bridge-icon {
        margin: 0 5px;
    }

    .automation-ares-queue .q-mini-bridge-icon .fa-arrow-right {
        transform: rotate(90deg);
    }

    .automation-queue-pager {
        justify-content: space-between;
    }

    .automation-day-grid-modern {
        flex-direction: column;
        border-radius: 12px;
    }

    .automation-day-pill {
        min-width: 100%;
    }

}

/* Trading agents visual refresh (design-aligned, behavior-preserving) */
#tab-trading-agents-modern .automation-ares-content {
    padding: 20px;
    row-gap: 18px;
}

#tab-trading-agents-modern .automation-ares-grid-2 {
    gap: 14px;
}

#tab-trading-agents-modern .automation-ares-status-card-wide {
    border-radius: 18px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    box-shadow: inset 0 1px 0 color-mix(in srgb, var(--text-primary) 5%, transparent);
    padding: 18px;
}

/* Active agent card; inactive agents in grid below */
#tab-trading-agents-modern .automation-ares-agent-ui-root {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
}

#tab-trading-agents-modern .automation-ares-agent-ui-root:not(.ares-automation-off) .automation-agent-switcher-kicker,
#tab-trading-agents-modern .automation-ares-agent-ui-root:not(.ares-automation-off) .automation-fixed-agents-grid {
    display: none;
}

#tab-trading-agents-modern .automation-ares-status-agent-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    align-items: start;
    width: 100%;
}

#tab-trading-agents-modern .automation-active-agent-slot {
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
}

/* Execution feed + ARES decision log: larger labels / cell text on this tab */
#tab-trading-agents-modern .automation-ares-feed li.automation-feed-item {
    font-size: calc(14px + 2pt);
    grid-template-columns: 100px minmax(0, 1fr) minmax(88px, auto);
    gap: 10px 14px;
    padding: 11px 14px;
}

#tab-trading-agents-modern .automation-feed-time {
    font-size: 14px;
}

#tab-trading-agents-modern .automation-feed-pill {
    font-size: 12px;
    padding: 4px 10px;
}

#tab-trading-agents-modern .automation-feed-symbols {
    font-size: calc(14px + 1pt);
}

#tab-trading-agents-modern .automation-feed-detail {
    font-size: 14px;
}

#tab-trading-agents-modern .automation-feed-agent-row {
    font-size: 13px;
}

#tab-trading-agents-modern .automation-feed-source {
    font-size: 12px;
}

#tab-trading-agents-modern .automation-feed-metric,
#tab-trading-agents-modern .automation-feed-metric--muted {
    font-size: 13px;
}

#tab-trading-agents-modern .automation-feed-empty-title {
    font-size: 15px;
}

#tab-trading-agents-modern .automation-fixed-agents-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 14px;
}

@media (min-width: 1024px) {
    #tab-trading-agents-modern .automation-fixed-agents-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

#tab-trading-agents-modern .automation-agent-fixed-card {
    position: relative;
    border-radius: 18px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    min-height: 248px;
    padding: 18px 16px;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    gap: 10px;
    box-shadow: inset 0 1px 0 color-mix(in srgb, var(--text-primary) 5%, transparent);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

#tab-trading-agents-modern .automation-agent-fixed-card .automation-agent-card-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    border: 1px solid var(--border-color);
    background: linear-gradient(180deg, var(--bg-primary), var(--bg-tertiary));
    display: grid;
    place-items: center;
    font-size: 28px;
    color: var(--text-secondary);
    margin-top: 2px;
}

#tab-trading-agents-modern .automation-agent-fixed-card h4 {
    margin: 4px 0 0;
    font-size: 38px;
    line-height: 1.05;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

#tab-trading-agents-modern .automation-agent-fixed-card .sub {
    display: block !important;
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
    color: var(--text-secondary);
    max-width: 240px;
}

#tab-trading-agents-modern .automation-agent-fixed-card .sub code {
    background: transparent;
    color: inherit;
    padding: 0;
}

/* Active slot: show only content through the slot blurb; hide label, save, buys/sells, weekdays */
#tab-trading-agents-modern #automation-fixed-agents-root .automation-agent-fixed-card.is-active-slot > p.sub ~ *,
#tab-trading-agents-modern #automation-active-agent-slot .automation-agent-fixed-card.is-active-slot > p.sub ~ * {
    display: none !important;
}

#tab-trading-agents-modern .automation-agent-fixed-card .automation-agent-card-actions {
    margin-top: 4px;
    width: 100%;
    justify-content: center;
}

#tab-trading-agents-modern .automation-agent-fixed-card [data-agent-action="activate"] {
    border-radius: 999px;
    min-width: 116px;
}

#tab-trading-agents-modern .automation-agent-fixed-card.is-active-slot {
    border-color: color-mix(in srgb, var(--primary, #60a5fa) 55%, var(--border-color));
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--primary, #60a5fa) 12%, var(--bg-primary)),
        color-mix(in srgb, var(--primary, #60a5fa) 6%, var(--bg-secondary))
    );
    box-shadow:
        0 0 0 3px color-mix(in srgb, var(--primary, #60a5fa) 28%, transparent),
        0 12px 24px color-mix(in srgb, var(--primary, #60a5fa) 20%, transparent);
    transform: translateY(-3px) scale(1.012);
}

#tab-trading-agents-modern .automation-agent-fixed-card.is-active-slot h4 {
    color: var(--text-primary);
}

#tab-trading-agents-modern .automation-agent-fixed-card.is-active-slot .automation-agent-card-icon {
    border-color: color-mix(in srgb, var(--primary, #60a5fa) 42%, var(--border-color));
    color: var(--primary, #3b82f6);
    background: linear-gradient(
        180deg,
        var(--bg-primary),
        color-mix(in srgb, var(--primary, #60a5fa) 14%, var(--bg-secondary))
    );
    box-shadow: 0 8px 18px color-mix(in srgb, var(--primary, #60a5fa) 18%, transparent);
}

#tab-trading-agents-modern .automation-agent-fixed-card.is-active-slot::before {
    content: "ACTIVE AGENT";
    position: absolute;
    top: -11px;
    left: 14px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--primary, #60a5fa) 70%, #475569);
    background: linear-gradient(
        90deg,
        var(--primary, #60a5fa),
        var(--primary-dark, #3b82f6)
    );
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.06em;
    line-height: 1;
    text-transform: uppercase;
    box-shadow: 0 6px 14px color-mix(in srgb, var(--primary, #60a5fa) 34%, transparent);
}

/* Command strip: compact live agent + KPIs, no poster-card chrome */
#tab-trading-agents-modern .automation-command-strip {
    align-items: start;
}

#tab-trading-agents-modern .automation-command-strip .automation-ares-master-switch {
    padding: 14px 16px;
}

#tab-trading-agents-modern .automation-command-strip .automation-ares-panel-hero {
    padding: 12px;
    display: flex;
    align-items: stretch;
}

#tab-trading-agents-modern .automation-command-strip .automation-ares-kpi-grid {
    width: 100%;
    gap: 8px;
    grid-template-rows: auto auto;
    align-content: start;
}

#tab-trading-agents-modern .automation-command-strip .automation-ares-kpi {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    min-height: 0;
    padding: 10px 12px;
    border-radius: 8px;
}

#tab-trading-agents-modern .automation-command-strip .automation-ares-kpi .k {
    margin-bottom: 0;
    font-size: 11px;
    letter-spacing: 0.06em;
}

#tab-trading-agents-modern .automation-command-strip .automation-ares-kpi .v {
    font-size: 16px;
    line-height: 1.2;
}

#tab-trading-agents-modern .automation-command-strip .automation-agent-fixed-card.is-active-slot {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    grid-template-areas:
        "icon title"
        "icon sub"
        "summary summary";
    align-items: center;
    justify-items: start;
    text-align: left;
    gap: 2px 12px;
    flex: 0 0 auto;
    margin: 0;
    padding: 12px 16px 14px;
    min-height: 0;
    border: none;
    border-radius: 0;
    outline: none;
    background: transparent;
    box-shadow: none;
    transform: none;
}

#tab-trading-agents-modern .automation-command-strip .automation-agent-fixed-card.is-active-slot::before {
    display: none;
}

#tab-trading-agents-modern .automation-command-strip .automation-agent-fixed-card.is-active-slot .automation-agent-card-icon {
    grid-area: icon;
    width: 40px;
    height: 40px;
    margin: 0;
    font-size: 18px;
    border-radius: 10px;
    box-shadow: none;
}

#tab-trading-agents-modern .automation-command-strip .automation-agent-fixed-card.is-active-slot h4 {
    grid-area: title;
    margin: 0;
    font-size: 18px;
    line-height: 1.2;
}

#tab-trading-agents-modern .automation-command-strip .automation-agent-fixed-card.is-active-slot .sub {
    grid-area: sub;
    max-width: none;
    margin: 0;
    font-size: 13px;
}

#tab-trading-agents-modern .automation-command-strip .automation-agent-fixed-card.is-active-slot .automation-agent-active-summary {
    grid-area: summary;
    margin-top: 6px;
    width: 100%;
}

#tab-trading-agents-modern .automation-agent-fixed-card.is-active-slot .automation-agent-active-summary {
    display: block;
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    padding: 8px 10px;
    font-weight: 600;
    font-size: 13px;
}

#tab-trading-agents-modern .automation-agent-fixed-card.is-active-slot [data-agent-action="activate"] {
    display: none;
}

#tab-trading-agents-modern .automation-agent-fixed-card:not(.is-active-slot) .automation-budget-row,
#tab-trading-agents-modern .automation-agent-fixed-card:not(.is-active-slot) .automation-agent-label-wrap,
#tab-trading-agents-modern .automation-agent-fixed-card:not(.is-active-slot) [data-agent-action="save"] {
    display: none !important;
}

#tab-trading-agents-modern .automation-agent-fixed-card.is-active-slot .automation-agent-label-wrap,
#tab-trading-agents-modern .automation-agent-fixed-card.is-active-slot .automation-budget-row {
    display: flex !important;
    flex-direction: column;
    width: 100%;
    align-items: stretch;
    text-align: left;
}

#tab-trading-agents-modern .automation-agent-fixed-card.is-active-slot [data-agent-action="save"] {
    display: inline-flex !important;
}

#tab-trading-agents-modern .automation-agent-fixed-card.is-inactive-slot {
    opacity: 0.78;
    filter: saturate(0.8);
    transform: none;
    box-shadow: inset 0 1px 0 color-mix(in srgb, var(--text-primary) 5%, transparent);
}

#tab-trading-agents-modern .automation-agent-fixed-card.is-inactive-slot .automation-agent-card-icon {
    opacity: 0.82;
}

#tab-trading-agents-modern .automation-agent-fixed-card.is-inactive-slot [data-agent-action="activate"] {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

#tab-trading-agents-modern .automation-agent-fixed-card.is-inactive-slot [data-agent-action="activate"]:hover {
    border-color: color-mix(in srgb, var(--text-secondary) 50%, var(--border-color));
    color: var(--text-primary);
}

@media (max-width: 1023px) {
    #tab-trading-agents-modern .automation-fixed-agents-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px;
    }

    #tab-trading-agents-modern .automation-agent-fixed-card {
        min-height: 198px;
        padding: 16px 14px;
    }

    #tab-trading-agents-modern .automation-agent-fixed-card h4 {
        font-size: 30px;
    }
}

/* Trading agents modal glow-up */
#tab-trading-agents-modern .automation-agent-modal-overlay {
    background: rgba(10, 14, 25, 0.62);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    padding: 18px;
}

#tab-trading-agents-modern .automation-agent-modal {
    width: min(820px, 96vw);
    max-height: min(90vh, 100dvh);
    display: flex;
    flex-direction: column;
    border-radius: 22px;
    border: 1px solid color-mix(in srgb, var(--primary, #60a5fa) 18%, var(--border-color));
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--primary, #60a5fa) 5%, var(--bg-primary)) 0%,
        var(--bg-primary) 16%,
        var(--bg-primary) 100%
    );
    box-shadow:
        0 24px 48px rgba(21, 28, 44, 0.24),
        inset 0 2px 0 color-mix(in srgb, var(--text-primary) 6%, transparent);
    overflow: hidden;
}

#tab-trading-agents-modern .automation-agent-modal-header {
    flex-shrink: 0;
    padding: 20px 20px 16px;
    border-bottom: 1px solid color-mix(in srgb, var(--primary, #60a5fa) 18%, var(--border-color));
    background: linear-gradient(
        90deg,
        color-mix(in srgb, var(--primary, #60a5fa) 12%, var(--bg-primary)),
        color-mix(in srgb, var(--primary-dark, #3b82f6) 8%, var(--bg-primary))
    );
    align-items: center;
}

#tab-trading-agents-modern .automation-agent-modal-header h4 {
    margin: 0;
    font-size: 28px;
    line-height: 1.1;
    letter-spacing: -0.015em;
    color: var(--text-primary);
}

#tab-trading-agents-modern .automation-agent-modal-sub {
    margin: 6px 0 0;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

#tab-trading-agents-modern .automation-agent-modal-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    display: grid;
    place-items: center;
    color: var(--text-secondary);
}

#tab-trading-agents-modern .automation-agent-modal-close:hover {
    background: color-mix(in srgb, var(--primary, #60a5fa) 10%, var(--bg-primary));
    border-color: color-mix(in srgb, var(--primary, #60a5fa) 42%, var(--border-color));
    color: var(--primary-dark, #2563eb);
}

#tab-trading-agents-modern .automation-agent-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 18px 20px;
    gap: 14px;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
}

#tab-trading-agents-modern .automation-agent-modal-section {
    border-bottom-color: var(--border-color);
    margin-bottom: 14px;
    padding-bottom: 12px;
}

#tab-trading-agents-modern .automation-agent-toggle-row {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

#tab-trading-agents-modern .automation-agent-modal .automation-agent-label-wrap {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

#tab-trading-agents-modern .automation-agent-modal .automation-agent-label-wrap input {
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    padding: 11px 12px;
    font-size: 14px;
    color: var(--text-primary);
}

#tab-trading-agents-modern .automation-agent-modal .automation-budget-row {
    margin-top: 0;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--bg-secondary);
    padding: 12px;
}

#tab-trading-agents-modern .automation-agent-modal .automation-budget-row-head {
    margin-bottom: 10px;
}

#tab-trading-agents-modern .automation-agent-modal .automation-budget-label {
    font-size: 13px;
    color: var(--text-primary);
    text-transform: none;
    letter-spacing: 0;
}

#tab-trading-agents-modern .automation-agent-modal .automation-budget-hint {
    font-size: 10px;
    color: var(--text-secondary);
}

#tab-trading-agents-modern .automation-agent-modal .automation-budget-segmented {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 5px;
}

#tab-trading-agents-modern .automation-agent-modal .automation-budget-opt {
    font-size: 13px;
    font-weight: 700;
}

#tab-trading-agents-modern .automation-agent-modal .automation-budget-opt.active {
    background: linear-gradient(
        90deg,
        var(--primary, #60a5fa),
        var(--primary-dark, #3b82f6)
    );
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--primary, #60a5fa) 30%, transparent);
}

#tab-trading-agents-modern .automation-agent-modal .automation-day-grid-modern {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

#tab-trading-agents-modern .automation-agent-modal .automation-day-pill input:checked + span {
    background: linear-gradient(
        90deg,
        color-mix(in srgb, var(--primary, #60a5fa) 22%, var(--bg-primary)),
        color-mix(in srgb, var(--primary-dark, #3b82f6) 18%, var(--bg-primary))
    );
    border-color: color-mix(in srgb, var(--primary, #60a5fa) 44%, var(--border-color));
    color: var(--text-primary);
}

#tab-trading-agents-modern .automation-agent-modal-status {
    margin-top: 2px;
    font-size: 12px;
    color: var(--text-secondary);
}

#tab-trading-agents-modern .automation-agent-modal-footer {
    flex-shrink: 0;
    padding: 14px 20px 18px;
    border-top: 1px solid color-mix(in srgb, var(--primary, #60a5fa) 18%, var(--border-color));
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--primary, #60a5fa) 4%, var(--bg-primary)),
        var(--bg-primary)
    );
    justify-content: space-between;
}

#tab-trading-agents-modern #automation-agent-modal-activate-btn,
#tab-trading-agents-modern #automation-agent-modal-save-btn {
    border-radius: 999px;
    min-height: 40px;
    padding-inline: 16px;
}

#tab-trading-agents-modern #automation-agent-modal-save-btn {
    background: linear-gradient(
        90deg,
        var(--primary, #60a5fa),
        var(--primary-dark, #3b82f6)
    );
    border-color: transparent;
    color: #ffffff;
    box-shadow: 0 8px 16px color-mix(in srgb, var(--primary, #60a5fa) 34%, transparent);
}

@media (max-width: 639px) {
    #tab-trading-agents-modern .automation-fixed-agents-grid {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    #tab-trading-agents-modern .automation-agent-modal {
        width: 100%;
        max-height: min(92vh, 100dvh);
        border-radius: 16px;
    }

    #tab-trading-agents-modern .automation-agent-modal-header {
        padding: 16px 16px 12px;
    }

    #tab-trading-agents-modern .automation-agent-modal-header h4 {
        font-size: 24px;
    }

    #tab-trading-agents-modern .automation-agent-modal-body {
        padding: 14px 16px;
        gap: 12px;
    }

    #tab-trading-agents-modern .automation-agent-modal-footer {
        padding: 12px 16px 14px;
        flex-direction: column;
        align-items: stretch;
    }
}

/* Master ARES on/off — primary control on the Agents tab */
.automation-ares-master-switch {
    box-sizing: border-box;
    width: 100%;
    margin: 0;
    cursor: pointer;
    gap: 16px;
    padding: 20px;
    border: none;
    border-bottom: 1.5px solid rgba(185, 28, 28, 0.28);
    border-radius: 0;
    background:
        linear-gradient(180deg, rgba(148, 163, 184, 0.16), rgba(148, 163, 184, 0.06));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.automation-ares-master-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
}

.automation-ares-master-kicker {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9f1239;
    background: rgba(244, 63, 94, 0.14);
    border: 1px solid rgba(190, 18, 60, 0.28);
    border-radius: 999px;
    padding: 3px 9px;
}

.automation-ares-master-title {
    font-size: calc(18px + 1pt);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1.2;
}

.automation-ares-master-hint {
    font-size: 14px;
    line-height: 1.4;
    color: var(--text-secondary);
}

.automation-ares-toggle-xl {
    width: 68px;
    height: 36px;
}

.automation-ares-toggle-xl .slider::before {
    width: 28px;
    height: 28px;
    top: 4px;
    left: 4px;
}

.automation-ares-toggle-xl input:checked + .slider::before {
    transform: translateX(32px);
}

.automation-ares-toggle-xl .slider {
    background: #be123c;
    box-shadow: inset 0 0 0 1px rgba(127, 29, 29, 0.25);
}

.automation-ares-master-switch:has(#automation-ares-toggle:checked) {
    background: linear-gradient(
        180deg,
        rgba(16, 185, 129, 0.24),
        rgba(16, 185, 129, 0.1)
    );
    border-bottom-color: rgba(16, 185, 129, 0.45);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.automation-ares-master-switch:has(#automation-ares-toggle:checked) .automation-ares-master-kicker {
    color: #065f46;
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(6, 95, 70, 0.28);
}

.automation-ares-master-switch:has(#automation-ares-toggle:checked) .automation-ares-toggle-xl .slider {
    background: #059669;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.18);
}

.automation-ares-master-switch:has(#automation-ares-toggle:focus-visible) .slider {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary, #2563eb) 55%, transparent);
}

.automation-ares-tab.portfolio-readonly-state .automation-ares-master-switch {
    display: none;
}

.automation-ares-preview-watermark {
    margin: 12px 0 0;
    padding: 12px 14px;
    border-radius: 10px;
    border: none;
    background: color-mix(in srgb, var(--primary, #2563eb) 8%, transparent);
}

.automation-ares-preview-watermark strong {
    display: block;
    font-size: 0.95rem;
}

.automation-ares-preview-watermark p {
    margin: 4px 0 0;
    color: var(--text-secondary, #64748b);
}

@media (max-width: 639px) {
    .automation-ares-master-switch {
        flex-wrap: wrap;
        padding: 16px;
        gap: 12px;
    }

    .automation-ares-master-copy {
        flex: 1 1 100%;
    }

    .automation-ares-toggle-xl {
        margin-left: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .automation-ares-toggle .slider,
    .automation-ares-toggle .slider::before {
        transition: none;
    }
}

/* Setup tab: recent intra-day ARES fills and the shared active-agent editor */
.automation-setup-lower {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 18px;
    margin-top: 18px;
}

.automation-yesterday-card {
    overflow: hidden;
    padding: 20px;
    border-radius: 18px;
    background:
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.14), transparent 38%),
        var(--bg-secondary);
}

.automation-yesterday-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border-color);
}

.automation-yesterday-kicker {
    display: block;
    margin-bottom: 6px;
    color: var(--primary, #3b82f6);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.automation-yesterday-card h4,
.automation-inline-settings-heading h4 {
    margin: 0;
    color: var(--text-primary);
    font-size: 24px;
    letter-spacing: -0.02em;
}

.automation-yesterday-card .sub {
    margin-top: 6px;
    font-size: 14px;
}

.automation-yesterday-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(92px, 1fr));
    gap: 8px;
}

.automation-yesterday-summary > div {
    min-width: 92px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: color-mix(in srgb, var(--bg-primary) 88%, transparent);
    text-align: right;
}

.automation-yesterday-summary strong,
.automation-yesterday-summary span {
    display: block;
}

.automation-yesterday-summary strong {
    color: var(--text-primary);
    font-size: 17px;
    line-height: 1.2;
}

.automation-yesterday-summary span {
    margin-top: 3px;
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.automation-yesterday-actions {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.automation-yesterday-action {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto 12px;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-left-width: 4px;
    border-radius: 14px;
    background: var(--bg-primary);
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.automation-yesterday-action:hover {
    border-color: color-mix(in srgb, var(--primary, #3b82f6) 45%, var(--border-color));
    box-shadow: var(--shadow-md, 0 6px 18px rgba(15, 23, 42, 0.1));
    transform: translateY(-1px);
}

.automation-yesterday-action:focus-visible {
    outline: 2px solid var(--primary, #3b82f6);
    outline-offset: 2px;
}

.automation-yesterday-action-chevron {
    color: var(--text-muted, var(--text-secondary));
    font-size: 12px;
}

.automation-yesterday-action--open {
    border-left-color: #10b981;
}

.automation-yesterday-action--swap {
    border-left-color: #3b82f6;
}

.automation-yesterday-action--close {
    border-left-color: #f59e0b;
}

.automation-yesterday-action--other {
    border-left-color: #94a3b8;
}

.automation-yesterday-action-agent {
    overflow: hidden;
    max-width: 140px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.automation-yesterday-hint {
    margin: 12px 0 0;
    color: var(--text-secondary);
    font-size: 12px;
    text-align: center;
}

.automation-yesterday-action-icon {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 12px;
    background: var(--bg-secondary);
    color: var(--primary, #3b82f6);
    font-size: 17px;
}

.automation-yesterday-action-copy {
    min-width: 0;
}

.automation-yesterday-action-topline {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 11px;
}

.automation-yesterday-action-type {
    padding: 3px 7px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--primary, #3b82f6) 13%, var(--bg-secondary));
    color: var(--text-primary);
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.automation-yesterday-action h5 {
    margin: 6px 0 3px;
    color: var(--text-primary);
    font-size: 17px;
    line-height: 1.3;
}

.automation-yesterday-action h5 a {
    color: var(--primary, #3b82f6);
    text-decoration: none;
}

.automation-yesterday-action h5 a:hover {
    text-decoration: underline;
}

.automation-yesterday-action p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 12px;
}

.automation-yesterday-action-result {
    text-align: right;
    font-size: 14px;
    font-weight: 800;
    white-space: nowrap;
}

.automation-yesterday-action-result small {
    display: block;
    margin-top: 2px;
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.automation-yesterday-action-result .positive,
.automation-yesterday-summary strong.positive {
    color: #059669;
}

.automation-yesterday-action-result .negative,
.automation-yesterday-summary strong.negative {
    color: #dc2626;
}

.automation-yesterday-empty {
    display: flex;
    min-height: 112px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 20px;
    border: 1px dashed var(--border-color);
    border-radius: 14px;
    color: var(--text-secondary);
    text-align: center;
}

.automation-yesterday-empty i {
    margin-bottom: 4px;
    color: var(--primary, #3b82f6);
    font-size: 22px;
}

.automation-yesterday-empty strong {
    color: var(--text-primary);
}

.automation-yesterday-empty span {
    font-size: 13px;
}

.automation-action-detail-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
}

.automation-action-detail-modal {
    display: flex;
    width: min(1040px, 100%);
    max-height: min(88vh, 880px);
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg, 16px);
    background: var(--bg-secondary);
    box-shadow: var(--shadow-lg);
}

/* Charts and alerts inside this modal open the shared indicator modal, which
   sits at a lower z-index than this overlay; lift it while this modal is open. */
body.automation-action-modal-open .indicator-info-modal-overlay {
    z-index: 12500;
}

.automation-action-detail-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px;
    border-bottom: 1px solid var(--border-color);
}

.automation-action-detail-kicker {
    display: block;
    margin-bottom: 6px;
    color: var(--primary, #3b82f6);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.automation-action-detail-modal-title {
    margin: 0;
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
}

.automation-action-detail-modal-sub {
    margin: 6px 0 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.automation-action-detail-modal-close {
    padding: 6px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}

.automation-action-detail-modal-close:hover {
    background: var(--surface-3, var(--bg-primary));
    color: var(--text-primary);
}

.automation-action-detail-modal-body {
    overflow-y: auto;
    padding: 18px;
}

.automation-action-section + .automation-action-section {
    margin-top: 22px;
}

.automation-action-section h4 {
    margin: 0 0 12px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.automation-action-flow {
    display: grid;
    margin: 0;
    padding: 0;
    gap: 8px;
    list-style: none;
}

.automation-action-flow-row {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-primary);
}

.automation-action-flow-icon {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border-radius: 9px;
    background: var(--bg-secondary);
    color: var(--primary, #3b82f6);
    font-size: 12px;
}

.automation-action-flow-copy strong {
    display: block;
    color: var(--text-primary);
    font-size: 14px;
}

.automation-action-flow-copy small {
    display: block;
    margin-top: 2px;
    color: var(--text-secondary);
    font-size: 12px;
}

.automation-action-flow-value {
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 800;
    text-align: right;
    white-space: nowrap;
}

.automation-action-flow-value small {
    display: block;
    margin-top: 2px;
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.automation-action-flow-value.positive {
    color: #059669;
}

.automation-action-flow-value.negative {
    color: #dc2626;
}

.automation-action-funding {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.automation-action-funding i {
    color: var(--primary, #3b82f6);
}

.automation-action-reasons {
    display: grid;
    margin: 0;
    padding: 0;
    gap: 10px;
    list-style: none;
}

.automation-action-reason {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-primary);
}

.automation-action-reason-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.automation-action-reason-time {
    color: var(--text-secondary);
    font-size: 11px;
}

.automation-action-reason p {
    margin: 0;
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.45;
}

.automation-action-empty {
    margin: 0;
    padding: 16px;
    border: 1px dashed var(--border-color);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
    text-align: center;
}

.automation-action-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.automation-action-symbol-link {
    padding: 8px 14px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    color: var(--primary, #3b82f6);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.automation-action-symbol-link:hover {
    border-color: var(--primary, #3b82f6);
    background: color-mix(in srgb, var(--primary, #3b82f6) 10%, transparent);
}

.automation-inline-settings-card {
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background: var(--bg-secondary);
}

.automation-inline-settings-heading {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background:
        linear-gradient(
            90deg,
            color-mix(in srgb, var(--primary, #60a5fa) 9%, var(--bg-primary)),
            var(--bg-primary)
        );
}

.automation-inline-settings-heading p {
    margin: 7px 0 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.automation-agent-settings-home {
    padding: 16px;
}

#tab-trading-agents-modern .automation-agent-modal.is-inline {
    width: 100%;
    max-height: none;
    border-radius: 14px;
    box-shadow: none;
}

#tab-trading-agents-modern .automation-agent-modal.is-inline .automation-agent-modal-body {
    overflow: visible;
}

#tab-trading-agents-modern .automation-agent-modal.is-inline .automation-agent-modal-footer {
    justify-content: flex-end;
}

@media (max-width: 767px) {
    .automation-setup-lower {
        grid-template-columns: 1fr;
    }

    .automation-yesterday-header {
        flex-direction: column;
    }

    .automation-yesterday-summary {
        width: 100%;
    }

    .automation-yesterday-summary > div {
        text-align: left;
    }

    .automation-yesterday-action {
        grid-template-columns: 40px minmax(0, 1fr);
        align-items: start;
    }

    .automation-yesterday-action-icon {
        width: 40px;
        height: 40px;
    }

    .automation-yesterday-action-result {
        grid-column: 2;
        text-align: left;
    }

    .automation-yesterday-action-chevron {
        display: none;
    }

    .automation-agent-settings-home {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .automation-yesterday-card {
        padding: 16px;
    }

    .automation-yesterday-summary {
        grid-template-columns: 1fr;
    }

    .automation-yesterday-summary > div {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 12px;
    }
}

.automation-workflow-shell {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    gap: 0;
    min-height: 0;
    overflow: visible;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.automation-workflow-shell:has(#automation-agent-room:not([hidden])) {
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
    align-items: start;
}

#tab-trading-agents-modern .autotrade-hero-modern {
    display: none;
}

.automation-workflow-rail {
    flex-direction: column;
    align-items: stretch;
    align-self: start;
    overflow: visible;
    position: sticky;
    top: 8rem;
    min-height: 0;
    max-height: none;
    height: auto;
    padding: 8px 8px 12px 0;
    background: transparent;
}

.automation-workflow-rail::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.automation-workflow-rail .automation-subtab {
    justify-content: flex-start;
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    box-shadow: none;
    font-size: 14px;
    font-weight: 600;
}

.automation-workflow-rail .automation-subtab:hover {
    background: color-mix(in srgb, var(--text-primary) 8%, transparent);
    color: var(--text-primary);
}

.automation-workflow-rail .automation-subtab.active {
    background: color-mix(in srgb, var(--primary, #6baaff) 18%, transparent);
    color: var(--text-primary);
    box-shadow: none;
}

.automation-workflow-rail .automation-subtab[data-automation-panel="settings"] {
    margin-top: 8px;
}

.automation-workflow-count {
    margin-left: auto;
    min-width: 1.5rem;
    padding: 1px 7px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--primary, #6baaff) 28%, transparent);
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.5;
    text-align: center;
}

.automation-workflow-stage {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 4px 0 8px 16px;
    background: var(--bg-primary);
}

.automation-workflow-inbox {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.automation-workflow-page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    padding: 0;
    background: transparent;
    box-shadow: none;
}

.automation-workflow-page-title {
    margin: 0;
    color: var(--text-primary);
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.automation-workflow-arm {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: auto;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    cursor: pointer;
}

.automation-workflow-arm .automation-ares-master-title {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.automation-workflow-arm .automation-ares-master-kicker {
    display: none;
}

.automation-workflow-split {
    display: grid;
    grid-template-columns: minmax(280px, 0.92fr) minmax(300px, 1.08fr);
    gap: 22px;
    align-items: start;
}

.automation-workflow-rail-scroll {
    min-width: 0;
    min-height: 0;
    max-height: min(72vh, 40rem);
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.automation-workflow-rail-scroll::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.automation-workflow-queue {
    min-width: 0;
    padding: 10px 8px;
    border: none;
    border-radius: 16px;
    background: var(--bg-secondary);
    box-shadow: none;
}

.automation-workflow-calendar {
    margin-top: 12px;
    padding: 14px 14px 16px;
    border: none;
    border-radius: 16px;
    background: var(--bg-secondary);
}

.automation-workflow-calendar-head h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 750;
    color: var(--text-primary);
}

.automation-workflow-calendar-head .automation-fine {
    margin: 4px 0 0;
}

.automation-workflow-calendar-days {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    margin: 14px 0 12px;
}

.automation-workflow-calendar-day {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.automation-workflow-calendar-day.is-on {
    background: color-mix(in srgb, var(--primary, #60a5fa) 18%, var(--bg-primary));
    color: var(--text-primary);
}

.automation-workflow-calendar-day.is-off {
    background: var(--bg-primary);
    color: var(--text-secondary);
    opacity: 0.55;
}

.automation-workflow-calendar-window {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 12px 13px;
    border-radius: 12px;
    background: var(--bg-primary);
}

.automation-workflow-calendar-kicker {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.automation-workflow-calendar-window time {
    font-size: 15px;
    font-weight: 750;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.automation-workflow-detail {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0;
    border: 0;
    background: transparent;
}

.automation-workflow-group {
    margin: 0;
}

.automation-workflow-group-head {
    display: grid;
    grid-template-columns: 16px 16px minmax(0, 1fr) auto 18px;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
}

.automation-workflow-group-head:hover {
    background: color-mix(in srgb, var(--text-primary) 6%, transparent);
}

.automation-workflow-group-head .fa-chevron-down,
.automation-workflow-group-head .fa-chevron-right {
    font-size: 11px;
    color: var(--text-secondary);
}

.automation-workflow-radio {
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-primary);
}

.automation-workflow-group.is-complete .automation-workflow-radio,
.automation-workflow-row.is-done .automation-workflow-radio {
    display: grid;
    place-items: center;
    border-color: var(--success, #47d18c);
    background: var(--success, #47d18c);
    color: #fff;
    font-size: 9px;
}

.automation-workflow-group.is-complete .automation-workflow-radio::before,
.automation-workflow-row.is-done .automation-workflow-radio::before {
    content: "✓";
    font-weight: 800;
    line-height: 1;
}

.automation-workflow-group-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.automation-workflow-progress {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
}

.automation-workflow-progress.is-complete {
    color: var(--success, #47d18c);
}

.automation-workflow-more {
    color: var(--text-light, var(--text-secondary));
    font-size: 16px;
    letter-spacing: 0.08em;
}

.automation-workflow-group .automation-ares-queue {
    display: none;
    margin: 0 8px 8px 42px;
    gap: 2px;
}

.automation-workflow-group.is-open .automation-ares-queue {
    display: grid;
}

.automation-workflow-group.is-open .fa-chevron-right {
    transform: rotate(90deg);
}

.automation-workflow-queue .q-row,
.automation-workflow-row {
    display: grid;
    grid-template-columns: 16px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 9px 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
}

.automation-workflow-queue .q-row .q-main {
    display: contents;
}

.automation-workflow-row.is-selected {
    background: color-mix(in srgb, var(--primary, #6baaff) 16%, transparent);
    box-shadow: none;
}

.automation-workflow-row-label {
    font-weight: 600;
    color: var(--text-primary);
}

.automation-workflow-summary,
.automation-workflow-status {
    padding: 16px 18px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--bg-secondary);
    cursor: pointer;
}

.automation-workflow-summary {
    border: none;
}

.automation-workflow-summary h3,
.automation-workflow-status h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 800;
}

.automation-workflow-summary h3,
.automation-workflow-summary .wf-em {
    color: var(--secondary, #9076ff);
}

.automation-workflow-summary p,
.automation-workflow-status p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

#automation-workflow-summary-text,
#automation-workflow-status-detail {
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.45;
}

#automation-workflow-summary-meta,
#automation-workflow-status-text {
    margin-top: 8px;
    font-size: 13px;
}

.automation-workflow-summary-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    cursor: default;
}

.automation-workflow-summary-actions[hidden] {
    display: none !important;
}

.automation-workflow-leading {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
}

.automation-workflow-leading .automation-workflow-msg {
    cursor: default;
}

.automation-workflow-status h3 {
    color: var(--success, #47d18c);
}

.automation-workflow-detail-tabs {
    display: flex;
    gap: 0;
    margin: 4px 0 0;
    padding: 0 8px;
    border-bottom: 1px solid var(--border-color);
}

.automation-workflow-detail-tabs[hidden],
.automation-workflow-detail-body[hidden],
.automation-workflow-summary[hidden],
.automation-workflow-status[hidden],
.automation-workflow-calendar[hidden],
.automation-workflow-group[hidden],
.automation-workflow-page-title[hidden],
.automation-workflow-page-head[hidden],
.automation-workflow-split[hidden],
.automation-agent-room[hidden] {
    display: none !important;
}

.automation-workflow-detail-tab {
    padding: 12px 16px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 650;
    cursor: pointer;
}

.automation-workflow-detail-tab.active {
    color: var(--primary, #6baaff);
    border-bottom-color: var(--primary, #6baaff);
}

.automation-workflow-detail-body {
    padding: 4px 0 8px;
}

.automation-workflow-thread {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.automation-workflow-msg {
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    cursor: pointer;
}

.automation-workflow-msg.is-selected {
    border-color: color-mix(in srgb, var(--primary, #60a5fa) 45%, var(--border-color));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary, #60a5fa) 18%, transparent);
}

.automation-workflow-msg.is-out {
    margin-left: 28px;
    background: var(--bg-tertiary, var(--bg-secondary));
}

.automation-workflow-msg-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 12px;
}

.automation-workflow-msg-from {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    font-weight: 700;
}

.automation-workflow-avatar {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 999px;
    background: var(--warning, #e8b339);
    color: #0b1222;
    font-size: 12px;
    font-weight: 800;
}

.wf-em {
    color: var(--secondary, #9076ff);
    font-weight: 700;
}

.automation-workflow-compose {
    margin-top: 4px;
    padding: 14px 16px 36px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-tertiary, var(--bg-secondary));
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.automation-workflow-compose-time {
    display: block;
    margin-top: 10px;
    color: var(--text-secondary);
    font-size: 12px;
    text-align: right;
}

#automation-panel-control .automation-yesterday-card,
#automation-panel-control #automation-ares-agent-ui-root,
#automation-panel-control .automation-agents-hint {
    display: none;
}

.automation-workflow-stage:has(#automation-agent-room:not([hidden])) {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.automation-workflow-stage:has(#automation-agent-room:not([hidden])) {
    min-height: 0;
    height: auto;
    overflow: visible;
}

.automation-workflow-stage:has(#automation-agent-room:not([hidden])) .automation-ares-tab,
.automation-workflow-stage:has(#automation-agent-room:not([hidden])) #automation-panel-control,
.automation-workflow-stage:has(#automation-agent-room:not([hidden])) .automation-workflow-inbox {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: visible;
    height: auto;
}

.automation-agent-room {
    display: flex;
    flex-direction: column;
    gap: 22px;
    align-items: stretch;
    min-width: 0;
    flex: 1;
    min-height: 0;
    height: auto;
    overflow: visible;
}

.automation-agent-room-date-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
}

.automation-agent-room-date-bar .alerts-date-nav-scroll-wrap {
    margin-left: auto;
}

.automation-agent-room-date-bar.is-loading .alerts-date-chip-modern {
    pointer-events: none;
    opacity: 0.55;
}

.automation-agent-room-top {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr);
    grid-template-rows: auto;
    gap: 22px;
    min-width: 0;
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    overflow: visible;
    align-items: start;
}

.automation-agent-room-left {
    display: flex;
    flex-direction: column;
    gap: 22px;
    min-width: 0;
    min-height: 0;
    height: auto;
    max-height: none;
    overflow: visible;
    position: sticky;
    top: 8rem;
    align-self: start;
}

.automation-agent-room-date-bar {
    flex-shrink: 0;
}

.automation-agent-room-logs {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
    min-width: 0;
    min-height: 0;
    height: auto;
    align-items: start;
    align-content: start;
    grid-template-rows: auto;
    overflow: visible;
}

.automation-agent-recent-fills {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 0;
    height: auto;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    overflow: visible;
    align-self: start;
}

.automation-agent-recent-fills .automation-agent-chat-head {
    flex-shrink: 0;
    padding: 0;
    border: none;
    margin: 0 0 10px;
    background: transparent;
    position: static;
}

.automation-agent-recent-fills .automation-ares-feed {
    flex: 0 0 auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    width: 100%;
    border: none;
    background: transparent;
    overflow: visible;
}

.automation-agent-recent-fills .automation-feed-date {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.automation-agent-recent-fills .automation-feed-clock {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.3;
}

.automation-agent-recent-fills .automation-feed-context {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    margin-top: 2px;
}

.automation-agent-recent-fills .automation-feed-context .stage-badge-modern {
    font-size: 10px;
    padding: 2px 7px;
}

.automation-agent-recent-fills .automation-feed-signal {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.03em;
    padding: 2px 7px;
    border-radius: 999px;
    line-height: 1.2;
}

.automation-agent-recent-fills .automation-feed-confidence,
.automation-agent-recent-fills .automation-feed-phase {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.automation-feed-reason {
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-secondary);
    margin-top: 2px;
    word-break: break-word;
}

.automation-agent-recent-fills .automation-feed-reason {
    font-size: 11px;
}

.automation-agent-recent-fills .automation-ares-feed li.automation-feed-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
}

.automation-agent-recent-fills .automation-ares-feed li.automation-feed-item[data-chat-block] {
    cursor: pointer;
    border-radius: 10px;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.automation-agent-recent-fills .automation-ares-feed li.automation-feed-item[data-chat-block]:hover,
.automation-agent-recent-fills .automation-ares-feed li.automation-feed-item[data-chat-block]:focus-visible {
    background: var(--bg-glass);
    box-shadow: inset 0 0 0 1px var(--border-color);
    outline: none;
}

.automation-agent-recent-fills .automation-ares-feed li.automation-feed-item[data-chat-block]:active {
    background: var(--bg-secondary);
}

.automation-agent-recent-fills .automation-feed-ticket-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.automation-agent-recent-fills .automation-feed-time {
    display: flex;
    flex-wrap: nowrap;
    align-items: baseline;
    gap: 6px;
    padding-top: 0;
    min-width: 0;
}

.automation-agent-recent-fills .automation-feed-date,
.automation-agent-recent-fills .automation-feed-clock {
    white-space: nowrap;
}

.automation-agent-recent-fills .automation-feed-side {
    flex-shrink: 0;
}

.automation-agent-recent-fills .automation-feed-metrics {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
}

.automation-agent-recent-fills .automation-feed-ticket-title {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

#tab-trading-agents-modern .automation-agent-recent-fills .automation-feed-symbols,
.automation-agent-recent-fills .automation-feed-symbols {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    font-size: 15px;
}

.automation-agent-recent-fills .automation-feed-sym,
.automation-agent-recent-fills .automation-feed-sym.symbol-name-modern {
    display: inline-block;
    max-width: 100%;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    overflow-wrap: normal;
    word-break: normal;
}

.automation-agent-recent-fills .automation-feed-verb,
.automation-agent-recent-fills .automation-feed-arrow {
    white-space: nowrap;
}

.automation-agent-recent-fills .automation-feed-pill {
    flex-shrink: 0;
}

.automation-agent-recent-fills .automation-feed-context .stage-badge-modern,
.automation-agent-recent-fills .automation-feed-signal {
    white-space: nowrap;
    flex-shrink: 0;
}

.automation-agent-recent-fills .automation-feed-title-line {
    display: flex;
    align-items: baseline;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
    color: var(--text-secondary);
}

.automation-agent-recent-fills .automation-feed-title-symbols {
    display: inline-flex;
    align-items: baseline;
    flex-shrink: 0;
    gap: 4px;
    min-width: 0;
}

.automation-agent-recent-fills .automation-feed-title-sep {
    flex-shrink: 0;
    color: var(--text-secondary);
}

.automation-agent-recent-fills .automation-feed-title-rest {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    word-break: normal;
    overflow-wrap: normal;
}

.automation-agent-recent-fills .automation-feed-title-line .automation-feed-sym.symbol-name-modern {
    font-size: 12px;
    font-weight: 800;
    color: var(--text-primary);
    max-width: none;
}

.automation-agent-recent-fills .automation-feed-reason {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: normal;
    overflow-wrap: break-word;
}

.automation-agent-log-toggle {
    display: none;
    grid-column: 1 / -1;
    gap: 0;
}

.automation-agent-room-logs .automation-agent-chat,
.automation-agent-room-logs .automation-ares-decision-log-card {
    min-width: 0;
    min-height: 0;
    max-height: none;
    display: flex;
    flex-direction: column;
}

.automation-agent-room-logs .automation-agent-chat {
    overflow: visible;
}

.automation-agent-room-logs .automation-ares-decision-log-card {
    overflow: visible;
}

.automation-agent-room-logs .automation-agent-chat {
    height: auto;
    align-self: start;
}

.automation-agent-room-logs .automation-ares-decision-log-card {
    height: auto;
    align-self: start;
}

.automation-agent-room-logs .automation-ares-decision-log-card > h4,
.automation-agent-room-logs .automation-ares-decision-log-card > .sub {
    flex-shrink: 0;
}

.automation-agent-room-logs .automation-agent-chat-log {
    flex: 0 0 auto;
    min-height: 0;
    height: auto;
    max-height: none;
    overflow: visible;
}

.automation-agent-room-logs .automation-agent-chat-log::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.automation-agent-room-logs .automation-ares-decision-log-card {
    --decision-log-visible-count: 9;
    --decision-log-row-height: 6rem;
    --decision-log-row-gap: 8px;
}

.automation-agent-room-logs #automation-ares-decision-feed {
    flex: 0 0 auto;
    min-height: 0;
    overflow: visible;
}

.automation-agent-room-logs .automation-agent-chat-log {
    padding: 0;
    border: none;
    background: transparent;
}

.automation-agent-room-logs .automation-agent-chat-log .automation-agent-chat-turn {
    width: 100%;
    box-sizing: border-box;
    scroll-margin-top: 5.5rem;
}

.automation-agent-room-logs #automation-ares-decision-feed {
    margin: 0;
    padding: 0 0 4px;
}

.automation-agent-room-logs .automation-ares-decision-log-card #automation-decision-log-pager {
    display: none;
}

.automation-agent-room-card {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    gap: 16px;
    min-width: 0;
    width: 100%;
    height: auto;
    box-sizing: border-box;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: none;
}

.automation-agent-room-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
    min-width: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

.automation-agent-room-card .hero-secondary-icon {
    order: 0;
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    min-width: 80px;
    min-height: 80px;
    font-size: 36px;
    background: transparent;
    border: none;
}

.automation-agent-room-copy {
    min-width: 0;
    width: 100%;
    margin-left: 0;
    text-align: center;
}

.automation-agent-room-card .automation-yesterday-kicker {
    margin: 0 0 4px;
    color: var(--text-secondary);
    font-size: var(--type-2xs);
    font-weight: var(--weight-bold);
}

.automation-agent-room-card.is-active .automation-yesterday-kicker {
    color: var(--primary);
}

.automation-agent-room-card h2 {
    margin: 0;
    font-family: var(--font-display);
    font-size: var(--type-2xl);
    font-weight: var(--display-copy-weight);
    letter-spacing: var(--display-copy-letter-spacing);
    line-height: var(--display-copy-line-height);
    color: var(--text-primary);
}

.automation-agent-room-caps {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.automation-agent-room-cap {
    color: var(--text-secondary);
    font-size: var(--type-2xs);
    font-weight: var(--weight-bold);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.automation-agent-recent-fills .automation-ares-loading,
.automation-agent-room-logs .automation-agent-chat-log .automation-ares-loading,
.automation-agent-room-logs #automation-ares-decision-feed .automation-ares-loading {
    min-height: min(240px, 40vh);
}

.automation-agent-room-card #automation-agent-room-edit {
    width: 100%;
    justify-content: center;
    margin-top: auto;
    border-radius: var(--radius-md);
    font-size: var(--type-sm);
    font-weight: var(--weight-semibold);
    color: var(--iris-primary-action-fg);
}

.automation-agent-chat {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 420px;
    padding: 16px 16px 20px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: var(--bg-secondary);
}

.automation-agent-room-logs .automation-agent-chat {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    gap: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    overflow: visible;
}

.automation-agent-room-logs .automation-ares-decision-log-card {
    padding: 16px 16px 12px;
    border-radius: var(--radius-lg);
    background: var(--bg-glass);
}

.automation-agent-chat-head h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 18px;
}

.automation-agent-chat-head .automation-fine {
    margin: 4px 0 0;
}

.automation-agent-chat-log {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: min(70vh, 720px);
    overflow: auto;
}

.automation-agent-chat-empty {
    margin: 0;
    padding: 16px 14px;
    border: 1px dashed var(--border-color);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: var(--type-sm);
    text-align: center;
}

.automation-agent-chat-reason {
    margin: 6px 0 0;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: var(--type-2xs);
}

.automation-agent-chat-block + .automation-agent-chat-block {
    margin-top: 22px;
}

.automation-agent-chat-turn.is-linked {
    box-shadow:
        0 0 0 1px var(--primary),
        0 8px 24px rgba(107, 170, 255, 0.12);
    background: color-mix(in srgb, var(--primary, #6baaff) 10%, var(--bg-primary));
}

.automation-agent-chat-turn.is-linked.is-linked-close {
    box-shadow:
        0 0 0 1px rgba(245, 158, 11, 0.65),
        0 8px 24px rgba(245, 158, 11, 0.12);
    background: color-mix(in srgb, #f59e0b 12%, var(--bg-primary));
}

.automation-agent-chat-turn.is-linked.is-linked-open {
    box-shadow:
        0 0 0 1px rgba(16, 185, 129, 0.55),
        0 8px 24px rgba(16, 185, 129, 0.1);
    background: color-mix(in srgb, #10b981 10%, var(--bg-primary));
}

.automation-agent-recent-fills .automation-ares-feed li.automation-feed-item.is-fill-linked {
    box-shadow: inset 0 0 0 1px var(--primary);
    background: color-mix(in srgb, var(--primary, #6baaff) 8%, var(--bg-primary));
}

.automation-agent-chat-stamp {
    display: block;
    margin: 0 0 10px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-align: center;
    text-transform: uppercase;
}

.automation-agent-chat-turn {
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-primary);
}

.automation-agent-chat-turn.is-think {
    border-left: 3px solid color-mix(in srgb, var(--primary, #6baaff) 70%, transparent);
}

.automation-agent-chat-turn.is-execute {
    border-left: 3px solid var(--success, #47d18c);
}

.automation-agent-chat-turn.is-execute.is-execute-close {
    border-left-color: rgba(245, 158, 11, 0.85);
}

.automation-agent-chat-turn.is-execute.is-execute-open {
    border-left-color: rgba(16, 185, 129, 0.9);
}

.automation-agent-chat-turn.is-pass,
.automation-agent-chat-turn.is-fail {
    border-left: 3px solid var(--text-secondary);
}

.automation-agent-chat-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.automation-agent-chat-role {
    color: var(--text-primary);
}

.automation-agent-chat-turn p {
    margin: 0;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.45;
}

@media (max-width: 900px) {
    .automation-agent-room-top,
    .automation-agent-room-logs {
        grid-template-columns: 1fr;
    }

    .automation-agent-room-top {
        grid-template-rows: auto;
        overflow: visible;
        height: auto;
    }

    .automation-agent-room-left {
        position: static;
        height: auto;
        max-height: none;
        min-height: 0;
        overflow: visible;
    }

    .automation-agent-recent-fills {
        flex: 0 0 auto;
        height: auto;
        max-height: none;
        min-height: 0;
        overflow: visible;
    }

    .automation-agent-room-logs,
    .automation-agent-room-logs .automation-agent-chat {
        height: auto;
        max-height: none;
        overflow: visible;
    }

    .automation-agent-log-toggle {
        display: flex;
    }

    #automation-agent-room[data-agent-log-view="think"] .automation-ares-decision-log-card,
    #automation-agent-room[data-agent-log-view="decisions"] .automation-agent-chat {
        display: none;
    }
}

@media (max-width: 900px) {
    .automation-workflow-shell,
    .automation-workflow-split {
        grid-template-columns: 1fr;
    }

    .automation-workflow-rail {
        position: static;
        flex-direction: row;
        flex-shrink: 0;
        min-height: 0;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
    }

    .automation-workflow-rail .automation-subtab {
        width: auto;
    }

    .automation-workflow-rail .automation-subtab[data-automation-panel="settings"] {
        margin-top: 0;
    }

    .automation-workflow-stage {
        padding: 8px 0;
    }
}

.automation-ares-tab,
.automation-subtab-panel,
#automation-panel-history,
#automation-panel-history .automation-ares-detached,
#automation-panel-history .automation-order-history-card,
#automation-order-history-cards {
    min-width: 0;
    max-width: 100%;
}

#automation-panel-history .automation-order-history-heading,
#automation-order-history-pagination-wrap {
    min-width: 0;
    max-width: 100%;
}

#automation-order-summary {
    overflow-wrap: anywhere;
}

.automation-workflow-inbox > .automation-ares-detached {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.automation-workflow-inbox > .automation-ares-detached .automation-ares-grid-2 {
    display: none;
}

.automation-ares-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 88px;
    padding: 16px 12px;
    color: var(--text-secondary);
}

.automation-ares-loading .loading-spinner-modern {
    font-size: 22px;
    margin-bottom: 0;
    color: var(--primary, #6baaff);
}

.automation-ares-feed .automation-ares-loading {
    min-height: 64px;
}
