body.ac_page {
    --ac_bg_0: #eff4f8;
    --ac_bg_1: #ffffff;
    --ac_bg_2: #f4f8fc;
    --ac_text_main: #14324c;
    --ac_text_soft: #5b7386;
    --ac_primary: #1c638f;
    --ac_primary_dark: #124b72;
    --ac_ok: #146a51;
    --ac_note: #8a6116;
    --ac_err: #a63b3b;
    --ac_idle: #9db0bf;
    --ac_border: rgba(20, 50, 76, 0.12);
    --ac_shadow: 0 22px 52px rgba(21, 52, 82, 0.14);
    min-height: 100vh;
    margin: 0;
    color: var(--ac_text_main);
    background:
        radial-gradient(circle at 0 0, rgba(30, 96, 142, 0.22), transparent 38%),
        radial-gradient(circle at 100% 40%, rgba(32, 89, 136, 0.12), transparent 24%),
        linear-gradient(140deg, var(--ac_bg_0), #f8fbfe 58%, #e5eef7);
    font-family: "Segoe UI", "Trebuchet MS", Arial, sans-serif;
}

.ac_page * {
    box-sizing: border-box;
}

.ac_shell {
    width: min(100%, 860px);
    margin: 0 auto;
    padding: 52px 20px 40px;
}

.ac_panel {
    border: 1px solid var(--ac_border);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--ac_shadow);
    backdrop-filter: blur(10px);
    padding: 40px 36px;
}

/* ── Header ── */

.ac_header {
    margin-bottom: 30px;
}

.ac_header_inline {
    display: flex;
    align-items: baseline;
    gap: 14px;
    flex-wrap: wrap;
}

.ac_header_inline .ac_kicker {
    margin: 0;
    white-space: nowrap;
}

.ac_header_inline .ac_title {
    margin: 0;
}

.ac_kicker,
.ac_status_kicker {
    margin: 0 0 9px;
    color: var(--ac_primary);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.ac_title {
    margin: 0;
    font-size: clamp(2rem, 2.8vw, 2.6rem);
    line-height: 1.04;
    letter-spacing: -0.02em;
}

.ac_lead {
    margin: 14px 0 0;
    max-width: 680px;
    color: var(--ac_text_soft);
    line-height: 1.68;
    font-size: 1rem;
}

/* ── Test mode banner ── */

.ac_test_banner {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 18px;
    padding: 10px 16px;
    border: 1px solid rgba(138, 97, 22, 0.30);
    border-radius: 10px;
    background: #fff8e8;
    color: var(--ac_note);
    font-size: 0.88rem;
}

/* ── Main button ── */

.ac_actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    gap: 14px;
    margin: 4px 0 0;
}

.ac_btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-width: 0;
    min-height: 56px;
    padding: 0 18px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--ac_primary), var(--ac_primary_dark));
    color: #ffffff;
    font-size: 0.98rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0;
    text-align: center;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 14px 28px rgba(28, 99, 143, 0.28);
    transition: transform 0.14s ease, box-shadow 0.14s ease, opacity 0.14s ease;
}

.ac_btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 30px rgba(28, 99, 143, 0.32);
}

.ac_btn:disabled {
    opacity: 0.70;
    cursor: wait;
    transform: none;
}

.ac_btn_cancel {
    background: linear-gradient(135deg, #b94c45, #8f2f2f);
    box-shadow: 0 14px 28px rgba(166, 59, 59, 0.24);
}

.ac_btn_cancel:hover {
    box-shadow: 0 18px 30px rgba(166, 59, 59, 0.30);
}

.ac_btn_resolved {
    background: linear-gradient(135deg, #18806f, #125f53);
    box-shadow: 0 14px 28px rgba(24, 128, 111, 0.26);
}

.ac_btn_resolved:hover {
    box-shadow: 0 18px 30px rgba(24, 128, 111, 0.32);
}

/* ── Split button (Resueltas 24h) ── */

.ac_btn_split_wrap {
    position: relative;
}

.ac_split_menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 50;
    border: 1px solid var(--ac_border);
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 12px 32px rgba(20, 50, 76, 0.18);
    overflow: hidden;
}

.ac_split_option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 13px 18px;
    border: 0;
    background: transparent;
    color: var(--ac_text_main);
    font-size: 0.93rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s ease;
}

.ac_split_option:hover {
    background: #f0f7fc;
}

.ac_split_option + .ac_split_option {
    border-top: 1px solid var(--ac_border);
}

.ac_action_feedback {
    margin: 14px 2px 0;
    color: var(--ac_text_soft);
    font-size: 0.94rem;
    line-height: 1.6;
}

.ac_action_feedback[data_tone="note"] {
    color: var(--ac_text_soft);
}

.ac_action_feedback[data_tone="success"] {
    color: var(--ac_ok);
    font-weight: 600;
}

.ac_action_feedback[data_tone="error"] {
    color: var(--ac_err);
    font-weight: 600;
}

.ac_action_feedback a {
    color: inherit;
    font-weight: 700;
}

/* ── Progress section ── */

.ac_status {
    margin-top: 28px;
    border: 1px solid rgba(20, 50, 76, 0.08);
    border-radius: 18px;
    background: linear-gradient(180deg, var(--ac_bg_1), var(--ac_bg_2));
    padding: 24px;
}

.ac_status_head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.ac_status_title {
    margin: 0;
    font-size: 1.1rem;
}

.ac_status_badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 95px;
    min-height: 34px;
    border-radius: 999px;
    background: #eaf1f7;
    color: var(--ac_text_soft);
    font-size: 0.83rem;
    font-weight: 700;
    white-space: nowrap;
}

.ac_status_badge[data_tone="running"] { background: #e5f1fb; color: var(--ac_primary_dark); }
.ac_status_badge[data_tone="success"] { background: #eaf7f1; color: var(--ac_ok); }
.ac_status_badge[data_tone="generated"] { background: #e7f4ef; color: #166a51; }
.ac_status_badge[data_tone="mailing"] { background: #eaf2fb; color: #1b5f88; }
.ac_status_badge[data_tone="nodata"]  { background: #fff4df; color: var(--ac_note); }
.ac_status_badge[data_tone="cancelled"] { background: #f4edf9; color: #6f4b8f; }
.ac_status_badge[data_tone="error"]   { background: #fceeee; color: var(--ac_err); }
.ac_status_badge[data_tone="idle"]    { background: #eaf1f7; color: var(--ac_text_soft); }

.ac_status_message {
    margin: 18px 0 0;
    font-size: 1rem;
    font-weight: 700;
}

/* ── Download timer ── */

.ac_timer {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
    margin: 14px 0 0;
    padding: 10px 16px;
    border: 1px solid rgba(28, 99, 143, 0.18);
    border-radius: 12px;
    background: #f0f7fc;
}

.ac_timer_item {
    display: flex;
    align-items: center;
    gap: 7px;
}

.ac_timer_label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--ac_text_soft);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.ac_timer_value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--ac_primary_dark);
}

.ac_timer_countdown {
    font-variant-numeric: tabular-nums;
    font-family: "Consolas", "Menlo", "Courier New", monospace;
    font-size: 1rem;
    min-width: 3.4em;
    text-align: center;
}

.ac_timer_sep {
    width: 1px;
    height: 22px;
    margin: 0 16px;
    background: rgba(28, 99, 143, 0.20);
}

.ac_steps {
    list-style: none;
    margin: 16px 0 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.ac_step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border: 1px solid rgba(20, 50, 76, 0.09);
    border-radius: 12px;
    background: #ffffff;
    padding: 11px 14px;
    color: var(--ac_text_soft);
}

.ac_step_dot {
    width: 11px;
    height: 11px;
    border-radius: 999px;
    flex: 0 0 11px;
    background: var(--ac_idle);
    margin-top: 4px;
}

.ac_step_body {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    flex-direction: column;
    gap: 10px;
}

.ac_step_label {
    font-size: 0.93rem;
    font-weight: 600;
}

.ac_step .ac_timer {
    width: 100%;
    margin: 0;
}

.ac_timer_notice {
    flex: 1 0 100%;
    margin: 10px 0 0;
    color: var(--ac_err);
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.4;
    animation: ac_automation_blink 1.1s ease-in-out infinite;
}

.ac_step[data_state="active"] {
    border-color: rgba(28, 99, 143, 0.22);
    color: var(--ac_text_main);
    background: #f7fbff;
}

.ac_step[data_state="active"] .ac_step_dot {
    background: var(--ac_primary);
    box-shadow: 0 0 0 6px rgba(28, 99, 143, 0.14);
}

.ac_step[data_state="done"] {
    border-color: rgba(20, 106, 81, 0.22);
    color: var(--ac_text_main);
}

.ac_step[data_state="done"] .ac_step_dot {
    background: var(--ac_ok);
}

.ac_step[data_state="nodata"] {
    border-color: rgba(138, 97, 22, 0.28);
    color: var(--ac_note);
    background: #fffaf1;
}

.ac_step[data_state="nodata"] .ac_step_dot {
    background: var(--ac_note);
}

.ac_step[data_state="cancelled"] {
    border-color: rgba(111, 75, 143, 0.24);
    color: #6f4b8f;
    background: #faf7fe;
}

.ac_step[data_state="cancelled"] .ac_step_dot {
    background: #7a58a2;
}

.ac_step[data_state="error"] {
    border-color: rgba(166, 59, 59, 0.28);
    color: var(--ac_err);
    background: #fff8f8;
}

.ac_step[data_state="error"] .ac_step_dot {
    background: var(--ac_err);
}

/* ── Summary / result section ── */

.ac_summary {
    margin-top: 20px;
    border: 1px solid rgba(20, 50, 76, 0.08);
    border-radius: 18px;
    background: linear-gradient(180deg, var(--ac_bg_1), var(--ac_bg_2));
    padding: 24px;
}

.ac_summary_head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.ac_empty_state {
    margin: 20px 0 4px;
    color: var(--ac_text_soft);
    font-size: 0.95rem;
    line-height: 1.6;
}

.ac_empty_state_error {
    color: var(--ac_err);
    font-weight: 600;
}

.ac_empty_state_note {
    color: var(--ac_note);
    font-weight: 600;
}

.ac_grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 18px;
}

.ac_item {
    border: 1px solid rgba(20, 50, 76, 0.09);
    border-radius: 12px;
    background: #ffffff;
    padding: 11px 14px;
}

.ac_item_full {
    grid-column: 1 / -1;
}

.ac_label {
    display: block;
    font-size: 0.77rem;
    color: #5d7a90;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 5px;
}

.ac_item strong {
    font-size: 0.93rem;
    word-break: break-word;
    line-height: 1.5;
}

.ac_item_meta {
    display: block;
    color: var(--ac_text_soft);
    font-size: 0.92rem;
    line-height: 1.6;
}

/* ── Download area ── */

.ac_download_wrap {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
}

.ac_download_btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 50px;
    padding: 0 28px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, #1a7f55 0%, #146a44 100%);
    color: #ffffff;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 10px 22px rgba(20, 106, 68, 0.28);
    transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.ac_download_btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 26px rgba(20, 106, 68, 0.34);
}

.ac_link_secondary {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid var(--ac_border);
    border-radius: 999px;
    color: var(--ac_text_soft);
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.14s ease, color 0.14s ease;
}

.ac_link_secondary:hover {
    background: rgba(20, 50, 76, 0.05);
    color: var(--ac_text_main);
}

/* ── Responsive ── */

.ac_automation {
    margin-top: 24px;
    border: 1px solid rgba(20, 50, 76, 0.08);
    border-radius: 18px;
    background: linear-gradient(180deg, var(--ac_bg_1), var(--ac_bg_2));
    padding: 24px;
}

.ac_automation_head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.ac_automation_title {
    margin: 0;
    font-size: 1.1rem;
}

.ac_automation_message {
    margin: 18px 0 0;
    color: var(--ac_text_soft);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.7;
}

.ac_automation_message.is-error {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--ac_err);
    animation: ac_automation_blink 1.7s ease-in-out infinite;
}

.ac_automation_alert {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    flex: 0 0 28px;
    background: linear-gradient(135deg, #c86a55, #af3b36);
    color: #ffffff;
    font-size: 1rem;
    font-weight: 700;
    box-shadow: 0 10px 22px rgba(166, 59, 59, 0.22);
}

.ac_automation_grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 18px;
}

.ac_automation_progress {
    margin-top: 18px;
}

.ac_automation_progress_track {
    position: relative;
    overflow: hidden;
    min-height: 48px;
    border-radius: 14px;
    border: 1px solid rgba(20, 50, 76, 0.1);
    background: #edf2f6;
}

.ac_automation_progress_fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0;
    border-radius: inherit;
    transition: width 0.35s ease;
}

.ac_automation_progress_label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 18px;
    text-align: center;
    color: #ffffff;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.4;
    z-index: 1;
}

.ac_automation_progress_track.is-pending {
    background: #edf2f6;
}

.ac_automation_progress_track.is-pending .ac_automation_progress_fill {
    background: linear-gradient(90deg, rgba(111, 136, 156, 0.14), rgba(132, 154, 171, 0.18));
}

.ac_automation_progress_track.is-pending .ac_automation_progress_label {
    color: #6e8295;
}

.ac_automation_progress_track.is-running {
    background: #ebf4fb;
}

.ac_automation_progress_track.is-running .ac_automation_progress_fill {
    background: linear-gradient(90deg, #2d79a7 0%, #6ea4c7 100%);
}

.ac_automation_progress_track.is-generated {
    background: #eaf7f1;
}

.ac_automation_progress_track.is-generated .ac_automation_progress_fill {
    background: linear-gradient(90deg, #1c7c60 0%, #39a17f 100%);
}

.ac_automation_progress_track.is-mailing {
    background: #e8f1fb;
}

.ac_automation_progress_track.is-mailing .ac_automation_progress_fill {
    background: linear-gradient(90deg, #1b628d 0%, #3f88b6 100%);
}

.ac_automation_progress_track.is-success {
    background: #e9f7f0;
}

.ac_automation_progress_track.is-success .ac_automation_progress_fill {
    background: linear-gradient(90deg, #167356 0%, #1f8d67 100%);
}

.ac_automation_progress_track.is-error {
    background: #fff3f3;
}

.ac_automation_progress_track.is-error .ac_automation_progress_fill {
    background: linear-gradient(90deg, #b7403a 0%, #d45a3e 100%);
}

.ac_automation_progress_track.is-indeterminate .ac_automation_progress_fill {
    width: 45% !important;
    animation: ac_automation_slide 1.5s ease-in-out infinite;
}

.ac_automation_meta {
    margin: 16px 0 0;
    color: var(--ac_text_soft);
    font-size: 0.92rem;
}

.ac_automation_error {
    margin: 10px 0 0;
    color: var(--ac_err);
    font-size: 0.92rem;
    line-height: 1.6;
    animation: ac_automation_blink 1.7s ease-in-out infinite;
}

@keyframes ac_automation_slide {
    0% { transform: translateX(-110%); }
    50% { transform: translateX(90%); }
    100% { transform: translateX(220%); }
}

@keyframes ac_automation_blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.58; }
}

@media (max-width: 640px) {
    .ac_shell {
        padding: 24px 12px 28px;
    }

    .ac_panel {
        padding: 24px 18px;
    }

    .ac_actions {
        grid-template-columns: 1fr;
    }

    .ac_status,
    .ac_summary,
    .ac_automation {
        padding: 18px;
    }

    .ac_status_head,
    .ac_summary_head,
    .ac_automation_head {
        flex-direction: column;
    }

    .ac_grid,
    .ac_automation_grid {
        grid-template-columns: 1fr;
    }

    .ac_download_btn {
        width: 100%;
    }
}
