:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-soft: #f7f9fc;
    --surface-strong: #eef3f9;
    --text: #122033;
    --text-soft: #334155;
    --muted: #718096;
    --border: #dde4ee;
    --border-strong: #ccd6e3;

    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: rgba(37, 99, 235, 0.10);

    --success: #16a34a;
    --success-soft: rgba(22, 163, 74, 0.11);
    --warning: #d97706;
    --warning-soft: rgba(217, 119, 6, 0.12);
    --danger: #dc2626;
    --danger-soft: rgba(220, 38, 38, 0.10);
    --info: #2563eb;
    --info-soft: rgba(37, 99, 235, 0.10);

    --sidebar: #0e1a2b;
    --sidebar-soft: #17263a;
    --sidebar-text: #dbe6f5;
    --sidebar-muted: #90a0b7;

    --shadow-sm: 0 8px 24px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 24px 80px rgba(15, 23, 42, 0.10);

    --radius-sm: 12px;
    --radius: 18px;
    --radius-lg: 24px;

    --sidebar-width: 264px;
    --topbar-height: 84px;
}

html[data-theme="dark"] {
    --bg: #0a101b;
    --surface: #101827;
    --surface-soft: #141f31;
    --surface-strong: #1a273a;
    --text: #f5f7fb;
    --text-soft: #d5deea;
    --muted: #91a0b6;
    --border: #253348;
    --border-strong: #34455d;

    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --primary-soft: rgba(59, 130, 246, 0.13);

    --success: #22c55e;
    --success-soft: rgba(34, 197, 94, 0.13);
    --warning: #f59e0b;
    --warning-soft: rgba(245, 158, 11, 0.13);
    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, 0.12);
    --info: #60a5fa;
    --info-soft: rgba(96, 165, 250, 0.12);

    --sidebar: #080e18;
    --sidebar-soft: #111b2b;
    --sidebar-text: #eef4ff;
    --sidebar-muted: #8596ad;

    --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.18);
    --shadow-lg: 0 24px 80px rgba(0, 0, 0, 0.34);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    transition: background-color .2s ease, color .2s ease;
}

button,
input,
textarea,
select {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- Common buttons ---------- */

.primary-button,
.secondary-button,
.text-button,
.icon-button,
.theme-toggle,
.logout-button,
.nav-item {
    border: 0;
}

.primary-button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 0 18px;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    font-weight: 750;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.18);
    transition: transform .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.primary-button:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.primary-button:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.primary-button.small {
    min-height: 39px;
    padding: 0 14px;
    font-size: 13px;
}

.secondary-button {
    min-height: 38px;
    padding: 0 13px;
    border-radius: 11px;
    background: var(--surface-soft);
    color: var(--text-soft);
    border: 1px solid var(--border);
    font-weight: 700;
}

.text-button {
    background: transparent;
    text-decoration: none;
    color: var(--primary);
    font-weight: 750;
    padding: 8px 0;
}

.icon-button {
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    border-radius: 12px;
    background: var(--surface-soft);
    color: var(--text);
    border: 1px solid var(--border);
}

/* ---------- Theme ---------- */

.theme-toggle {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border-radius: 12px;
    color: var(--text);
    background: var(--surface-soft);
    border: 1px solid var(--border);
    font-weight: 700;
    white-space: nowrap;
}

.theme-toggle b {
    width: 20px;
    text-align: center;
}

.theme-toggle.compact {
    min-height: 38px;
}

/* ---------- Auth ---------- */

.auth-body,
.setup-body {
    overflow-x: hidden;
}

.auth-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(420px, 1.05fr) minmax(480px, .95fr);
}

.auth-visual {
    position: relative;
    display: flex;
    min-height: 100vh;
    overflow: hidden;
    padding: 52px;
    color: #fff;
    background:
        radial-gradient(circle at 18% 18%, rgba(59, 130, 246, 0.42), transparent 25rem),
        radial-gradient(circle at 76% 78%, rgba(99, 102, 241, 0.32), transparent 28rem),
        linear-gradient(145deg, #0a1628 0%, #10284c 52%, #12243e 100%);
}

.auth-visual::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: .15;
    background-image:
        linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px);
    background-size: 36px 36px;
    mask-image: linear-gradient(to bottom, transparent, black 15%, black 85%, transparent);
}

.auth-visual-content {
    position: relative;
    z-index: 1;
    width: min(720px, 100%);
    margin: auto;
}

.auth-logo-large,
.auth-mobile-brand {
    display: flex;
    align-items: center;
    gap: 13px;
}

.auth-logo-large strong,
.auth-mobile-brand strong {
    display: block;
    font-size: 21px;
}

.auth-logo-large span,
.auth-mobile-brand span {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    opacity: .75;
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    color: #fff;
    font-size: 20px;
    box-shadow: 0 12px 28px rgba(37, 99, 235, .28);
    flex: 0 0 auto;
}

.brand-mark.xl {
    width: 48px;
    height: 48px;
    border-radius: 15px;
}

.auth-copy {
    max-width: 680px;
    margin-top: 108px;
}

.auth-kicker,
.page-eyebrow,
.panel-kicker,
.welcome-kicker {
    display: block;
    font-size: 11px;
    font-weight: 850;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.auth-kicker {
    color: #8fb7ff;
}

.auth-copy h1 {
    margin: 14px 0 18px;
    max-width: 620px;
    font-size: clamp(40px, 4.2vw, 68px);
    line-height: 1.02;
    letter-spacing: -.045em;
}

.auth-copy > p {
    max-width: 620px;
    margin: 0;
    color: rgba(255,255,255,.72);
    font-size: 17px;
    line-height: 1.7;
}

.auth-feature-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 58px;
}

.auth-feature {
    display: flex;
    gap: 12px;
    padding: 16px;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 16px;
    background: rgba(255,255,255,.06);
    backdrop-filter: blur(10px);
}

.auth-feature > span {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    color: #a7f3d0;
    background: rgba(34,197,94,.15);
    font-weight: 850;
    flex: 0 0 auto;
}

.auth-feature strong {
    display: block;
    font-size: 13px;
}

.auth-feature p {
    margin: 5px 0 0;
    color: rgba(255,255,255,.62);
    font-size: 12px;
    line-height: 1.45;
}

.auth-panel {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 40px;
    background:
        radial-gradient(circle at top right, var(--primary-soft), transparent 24rem),
        var(--bg);
}

.auth-panel-inner {
    width: min(480px, 100%);
}

.auth-panel-top {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 54px;
}

.auth-mobile-brand {
    display: none;
    color: var(--text);
}

.auth-mobile-brand.always-visible {
    display: flex;
}

.auth-heading {
    margin-bottom: 28px;
}

.auth-heading h2,
.setup-heading h1 {
    margin: 8px 0 8px;
    font-size: 34px;
    line-height: 1.1;
    letter-spacing: -.035em;
}

.auth-heading p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.page-eyebrow,
.panel-kicker,
.welcome-kicker {
    color: var(--primary);
}

.auth-form {
    display: grid;
    gap: 18px;
}

.field {
    display: grid;
    gap: 8px;
}

.field > span {
    font-size: 13px;
    font-weight: 750;
    color: var(--text-soft);
}

.input-shell {
    position: relative;
}

.input-shell input {
    width: 100%;
    height: 50px;
    padding: 0 15px;
    border: 1px solid var(--border);
    border-radius: 13px;
    outline: none;
    color: var(--text);
    background: var(--surface);
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.input-shell input::placeholder {
    color: var(--muted);
    opacity: .72;
}

.input-shell input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.password-shell input {
    padding-right: 50px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
}

.password-toggle:hover {
    background: var(--surface-soft);
    color: var(--text);
}

.auth-submit {
    width: 100%;
    min-height: 50px;
    margin-top: 2px;
}

.auth-footnote {
    margin-top: 24px;
    color: var(--muted);
    text-align: center;
    font-size: 12px;
    line-height: 1.5;
}

/* ---------- Alerts ---------- */

.inline-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 22px;
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-soft);
}

.inline-alert.info {
    border-color: rgba(37,99,235,.22);
    background: var(--info-soft);
}

.inline-alert.error {
    border-color: rgba(220,38,38,.22);
    background: var(--danger-soft);
}

.inline-alert-icon {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    font-weight: 900;
    flex: 0 0 auto;
}

.inline-alert.info .inline-alert-icon {
    color: var(--info);
    background: rgba(37,99,235,.12);
}

.inline-alert.error .inline-alert-icon {
    color: var(--danger);
    background: rgba(220,38,38,.12);
}

.inline-alert strong {
    display: block;
    margin-top: 1px;
    font-size: 13px;
}

.inline-alert p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.text-link {
    display: inline-block;
    margin-top: 7px;
    color: var(--primary);
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
}

.error-list {
    margin: 6px 0 0;
    padding-left: 18px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

/* ---------- Setup ---------- */

.setup-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
    background:
        radial-gradient(circle at 14% 14%, var(--primary-soft), transparent 24rem),
        var(--bg);
}

.setup-card {
    width: min(680px, 100%);
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}

.setup-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 20px 22px;
    border-bottom: 1px solid var(--border);
}

.setup-content {
    position: relative;
    padding: 32px;
}

.setup-step {
    position: absolute;
    top: 32px;
    right: 32px;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    color: var(--primary);
    background: var(--primary-soft);
    font-weight: 900;
}

/* ---------- App layout ---------- */

.app-layout {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    color: var(--sidebar-text);
    background:
        radial-gradient(circle at 0 0, rgba(37,99,235,.23), transparent 16rem),
        var(--sidebar);
    border-right: 1px solid rgba(255,255,255,.05);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 8px 24px;
}

.sidebar-brand strong {
    display: block;
    color: #fff;
    font-size: 18px;
}

.sidebar-brand span {
    display: block;
    margin-top: 2px;
    color: var(--sidebar-muted);
    font-size: 11px;
}

.sidebar-nav {
    display: grid;
    gap: 5px;
}

.nav-item {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 12px;
    border-radius: 12px;
    color: var(--sidebar-muted);
    background: transparent;
    text-decoration: none;
    text-align: left;
    font-size: 13px;
    font-weight: 700;
    transition: background-color .15s ease, color .15s ease;
}

.nav-item:hover {
    color: var(--sidebar-text);
    background: rgba(255,255,255,.06);
}

.nav-item.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(37,99,235,.95), rgba(59,130,246,.78));
    box-shadow: 0 10px 24px rgba(37,99,235,.18);
}

.nav-icon {
    width: 22px;
    display: inline-grid;
    place-items: center;
    font-size: 16px;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid rgba(255,255,255,.07);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px 13px;
}

.sidebar-user strong {
    display: block;
    color: #fff;
    font-size: 12px;
}

.sidebar-user span {
    display: block;
    max-width: 150px;
    margin-top: 2px;
    color: var(--sidebar-muted);
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-avatar {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #6366f1);
    font-size: 13px;
    font-weight: 900;
    flex: 0 0 auto;
}

.logout-button {
    width: 100%;
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    border-radius: 11px;
    color: var(--sidebar-muted);
    background: transparent;
    font-weight: 700;
}

.logout-button:hover {
    color: #fff;
    background: rgba(255,255,255,.06);
}

.app-main {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 16px 28px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(18px);
}

.topbar-left,
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.page-title {
    margin: 3px 0 0;
    font-size: 24px;
    letter-spacing: -.025em;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 9px 6px 6px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface);
}

.user-chip-text strong {
    display: block;
    font-size: 12px;
}

.user-chip-text span {
    display: block;
    margin-top: 1px;
    color: var(--muted);
    font-size: 10px;
    text-transform: capitalize;
}

.mobile-menu-button {
    display: none;
}

.sidebar-backdrop {
    display: none;
}

.content {
    width: min(1600px, 100%);
    margin: 0 auto;
    padding: 28px;
}

/* ---------- Dashboard ---------- */

.welcome-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 26px;
    padding: 26px;
    border: 1px solid rgba(37,99,235,.17);
    border-radius: 22px;
    background:
        linear-gradient(120deg, var(--surface) 0%, var(--surface) 52%, var(--primary-soft) 100%);
    box-shadow: var(--shadow-sm);
}

.welcome-card h2 {
    margin: 7px 0 8px;
    font-size: 26px;
    letter-spacing: -.03em;
}

.welcome-card p {
    max-width: 820px;
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.stat-card,
.panel {
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.stat-card {
    display: flex;
    gap: 14px;
    align-items: center;
    min-height: 128px;
    padding: 18px;
    border-radius: 18px;
}

.stat-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    font-weight: 900;
    flex: 0 0 auto;
}

.stat-icon.blue {
    color: var(--primary);
    background: var(--primary-soft);
}

.stat-icon.green {
    color: var(--success);
    background: var(--success-soft);
}

.stat-icon.amber {
    color: var(--warning);
    background: var(--warning-soft);
}

.stat-icon.red {
    color: var(--danger);
    background: var(--danger-soft);
}

.stat-meta {
    min-width: 0;
}

.stat-meta > span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.stat-meta strong {
    display: block;
    margin: 4px 0 3px;
    font-size: 25px;
    letter-spacing: -.025em;
}

.stat-meta small {
    display: block;
    color: var(--muted);
    font-size: 11px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(320px, .75fr);
    gap: 18px;
    margin-top: 18px;
}

.dashboard-grid.lower {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.panel {
    padding: 20px;
    border-radius: 18px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 17px;
    border-bottom: 1px solid var(--border);
}

.panel-header h3 {
    margin: 5px 0 0;
    font-size: 17px;
}

.empty-state {
    display: grid;
    place-items: center;
    min-height: 300px;
    padding: 36px;
    text-align: center;
}

.empty-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    margin-bottom: 14px;
    border-radius: 18px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 24px;
}

.empty-state h4 {
    margin: 0;
    font-size: 16px;
}

.empty-state p {
    max-width: 410px;
    margin: 8px auto 16px;
    color: var(--muted);
    line-height: 1.55;
    font-size: 13px;
}

.steps-list {
    display: grid;
    gap: 4px;
    padding-top: 10px;
}

.step-row {
    min-height: 64px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 9px 0;
}

.step-status {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 900;
}

.step-row.done .step-status {
    color: var(--success);
    background: var(--success-soft);
}

.step-row.pending .step-status {
    color: var(--muted);
    background: var(--surface-soft);
    border: 1px solid var(--border);
}

.step-row strong {
    display: block;
    font-size: 13px;
}

.step-row span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
}

.session-details {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding-top: 17px;
}

.session-details > div {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface-soft);
}

.session-details span {
    display: block;
    color: var(--muted);
    font-size: 11px;
}

.session-details strong {
    display: block;
    margin-top: 4px;
    font-size: 13px;
    word-break: break-word;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 27px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 850;
}

.status-pill.success {
    color: var(--success);
    background: var(--success-soft);
}

.accent-panel {
    display: flex;
    align-items: center;
    gap: 18px;
    background:
        linear-gradient(135deg, var(--surface) 0%, var(--surface) 60%, var(--primary-soft) 100%);
}

.accent-panel-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 24px;
    flex: 0 0 auto;
}

.accent-panel h3 {
    margin: 5px 0 6px;
    font-size: 17px;
}

.accent-panel p {
    margin: 0 0 13px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

/* ---------- Toasts ---------- */

.toast-container {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 9999;
    width: min(390px, calc(100vw - 36px));
    display: grid;
    gap: 10px;
    pointer-events: none;
}

.toast {
    position: relative;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 28px;
    gap: 11px;
    align-items: start;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    animation: toastIn .2s ease-out;
    pointer-events: auto;
}

.toast.closing {
    animation: toastOut .18s ease-in forwards;
}

.toast-icon {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    font-weight: 900;
}

.toast.success .toast-icon {
    color: var(--success);
    background: var(--success-soft);
}

.toast.error .toast-icon {
    color: var(--danger);
    background: var(--danger-soft);
}

.toast.warning .toast-icon {
    color: var(--warning);
    background: var(--warning-soft);
}

.toast.info .toast-icon {
    color: var(--info);
    background: var(--info-soft);
}

.toast-copy strong {
    display: block;
    margin-top: 1px;
    font-size: 13px;
}

.toast-copy p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.toast-close {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    color: var(--muted);
    background: transparent;
    font-size: 18px;
}

.toast-close:hover {
    color: var(--text);
    background: var(--surface-soft);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-8px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
    to { opacity: 0; transform: translateY(-8px) scale(.98); }
}

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-grid,
    .dashboard-grid.lower {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 980px) {
    .auth-page {
        grid-template-columns: 1fr;
    }

    .auth-visual {
        display: none;
    }

    .auth-panel {
        min-height: 100vh;
        padding: 24px;
    }

    .auth-mobile-brand {
        display: flex;
        margin-bottom: 30px;
    }

    .auth-panel-top {
        position: absolute;
        top: 22px;
        right: 22px;
        margin: 0;
    }

    .sidebar {
        transform: translateX(-102%);
        transition: transform .22s ease;
        box-shadow: 18px 0 50px rgba(0,0,0,.24);
    }

    .sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 45;
        display: block;
        background: rgba(3, 8, 18, .54);
        backdrop-filter: blur(2px);
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease;
    }

    .sidebar-open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .app-main {
        margin-left: 0;
    }

    .mobile-menu-button {
        display: inline-grid;
    }
}

@media (max-width: 720px) {
    .topbar {
        min-height: 72px;
        padding: 12px 14px;
    }

    .page-title {
        font-size: 20px;
    }

    .page-eyebrow {
        display: none;
    }

    .topbar-actions {
        gap: 8px;
    }

    .topbar-actions .theme-toggle span,
    .topbar-actions .user-chip-text {
        display: none;
    }

    .user-chip {
        padding: 4px;
        border: 0;
        background: transparent;
    }

    .content {
        padding: 16px 14px 28px;
    }

    .welcome-card {
        align-items: flex-start;
        flex-direction: column;
        padding: 20px;
    }

    .welcome-card .primary-button {
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin-top: 12px;
    }

    .stat-card {
        min-height: 112px;
        align-items: flex-start;
        flex-direction: column;
        gap: 9px;
        padding: 14px;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
        border-radius: 11px;
    }

    .stat-meta strong {
        font-size: 21px;
    }

    .dashboard-grid,
    .dashboard-grid.lower {
        gap: 12px;
        margin-top: 12px;
    }

    .panel {
        padding: 16px;
    }

    .panel-header {
        align-items: flex-start;
    }

    .empty-state {
        min-height: 240px;
        padding: 24px 12px;
    }

    .step-row {
        grid-template-columns: 34px minmax(0, 1fr);
    }

    .step-row .text-button {
        grid-column: 2;
        justify-self: start;
    }

    .session-details {
        grid-template-columns: 1fr;
    }

    .accent-panel {
        align-items: flex-start;
    }

    .setup-shell {
        padding: 14px;
    }

    .setup-content {
        padding: 22px 18px;
    }

    .setup-step {
        top: 22px;
        right: 18px;
    }

    .setup-topbar .theme-toggle span {
        display: none;
    }
}

@media (max-width: 480px) {
    .auth-panel {
        padding: 20px 16px;
        place-items: start center;
    }

    .auth-panel-inner {
        padding-top: 34px;
    }

    .auth-heading h2,
    .setup-heading h1 {
        font-size: 29px;
    }

    .auth-panel-top .theme-toggle span {
        display: none;
    }

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

    .stat-card {
        min-height: auto;
        flex-direction: row;
        align-items: center;
    }

    .accent-panel {
        flex-direction: column;
    }

    .toast-container {
        top: 12px;
        right: 12px;
        width: calc(100vw - 24px);
    }
}


/* ============================================================
   FASE 3 - CUENTAS SMTP
   ============================================================ */

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 18px;
}

.section-heading h2 {
    margin: 7px 0 7px;
    font-size: 28px;
    letter-spacing: -.035em;
}

.section-heading p {
    max-width: 850px;
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.compact-heading {
    align-items: flex-start;
    margin-bottom: 18px;
}

.back-link {
    display: inline-flex;
    margin-bottom: 24px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
    text-decoration: none;
}

.back-link:hover {
    color: var(--primary);
}

.smtp-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.mini-stat-card {
    min-height: 112px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.mini-stat-label,
.mini-stat-card small {
    display: block;
    color: var(--muted);
}

.mini-stat-label {
    font-size: 11px;
    font-weight: 750;
}

.mini-stat-card strong {
    display: block;
    margin: 7px 0 4px;
    font-size: 26px;
}

.mini-stat-card strong.mini-stat-text {
    font-size: 20px;
}

.mini-stat-card small {
    font-size: 11px;
}

.smtp-empty-panel {
    margin-top: 18px;
}

.smtp-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.smtp-card {
    position: relative;
    overflow: hidden;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 19px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: transform .16s ease, border-color .16s ease, opacity .16s ease;
}

.smtp-card:hover {
    transform: translateY(-1px);
    border-color: var(--border-strong);
}

.smtp-card.is-disabled {
    opacity: .72;
}

.smtp-card-head {
    display: flex;
    align-items: flex-start;
    gap: 13px;
}

.smtp-provider-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 18px;
    flex: 0 0 auto;
}

.smtp-card-title {
    min-width: 0;
    flex: 1;
}

.smtp-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.smtp-title-row h3 {
    min-width: 0;
    margin: 1px 0 0;
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.smtp-card-title > p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 12px;
    word-break: break-all;
}

.status-pill.neutral {
    color: var(--muted);
    background: var(--surface-strong);
}

.smtp-details {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-top: 18px;
}

.smtp-details > div {
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-soft);
}

.smtp-details span,
.smtp-meta-row > span {
    display: block;
    color: var(--muted);
    font-size: 10px;
}

.smtp-details strong {
    display: block;
    margin-top: 3px;
    font-size: 11px;
    word-break: break-word;
}

.smtp-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    margin-top: 13px;
    padding: 0 2px;
}

.smtp-meta-row strong {
    color: var(--text-soft);
    font-weight: 750;
}

.smtp-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.smtp-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.smtp-actions form {
    margin: 0;
}

.ghost-button,
.danger-ghost-button,
.danger-button {
    min-height: 38px;
    padding: 0 12px;
    border-radius: 11px;
    font-weight: 750;
}

.ghost-button {
    border: 0;
    color: var(--muted);
    background: transparent;
}

.ghost-button:hover {
    color: var(--text);
    background: var(--surface-soft);
}

.danger-ghost-button {
    border: 0;
    color: var(--danger);
    background: transparent;
}

.danger-ghost-button:hover {
    background: var(--danger-soft);
}

.danger-button {
    border: 0;
    color: #fff;
    background: var(--danger);
}

.smtp-history-note {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 11px;
    color: var(--muted);
    background: var(--surface-soft);
    font-size: 11px;
    line-height: 1.5;
}

.form-alert {
    margin-bottom: 18px;
}

.settings-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 18px;
    align-items: start;
}

.settings-main {
    padding: 0;
    overflow: hidden;
}

.settings-section {
    padding: 22px;
    border-bottom: 1px solid var(--border);
}

.settings-section:last-child {
    border-bottom: 0;
}

.settings-section-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.settings-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: var(--primary);
    background: var(--primary-soft);
    flex: 0 0 auto;
}

.settings-section-heading h3 {
    margin: 0;
    font-size: 15px;
}

.settings-section-heading p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 11px;
}

.form-grid {
    display: grid;
    gap: 15px;
}

.form-grid.two-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.three-columns {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-grid.smtp-server-grid {
    grid-template-columns: minmax(0, 1.8fr) minmax(120px, .55fr) minmax(150px, .75fr);
    margin-bottom: 15px;
}

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

.select-shell {
    position: relative;
}

.select-shell select {
    width: 100%;
    height: 50px;
    padding: 0 42px 0 15px;
    border: 1px solid var(--border);
    border-radius: 13px;
    outline: none;
    color: var(--text);
    background: var(--surface);
    appearance: none;
}

.select-shell::after {
    content: "⌄";
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}

.select-shell select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.field-help {
    display: block;
    margin-top: -2px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.45;
}

.suffix-shell input {
    padding-right: 66px;
}

.suffix-shell em {
    position: absolute;
    top: 50%;
    right: 13px;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 10px;
    font-style: normal;
}

.ionos-hint {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    padding: 13px;
    border: 1px solid rgba(37,99,235,.16);
    border-radius: 13px;
    background: var(--primary-soft);
}

.ionos-hint-icon {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    color: var(--primary);
    background: var(--surface);
    font-weight: 900;
    flex: 0 0 auto;
}

.ionos-hint strong {
    display: block;
    font-size: 12px;
}

.ionos-hint p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
}

.settings-sidebar {
    min-width: 0;
}

.sticky-panel {
    position: sticky;
    top: calc(var(--topbar-height) + 18px);
}

.settings-side-title {
    margin: 6px 0 17px;
    font-size: 17px;
}

.modern-switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface-soft);
}

.modern-switch-row strong {
    display: block;
    font-size: 12px;
}

.modern-switch-row > div > span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.35;
}

.modern-switch {
    position: relative;
    width: 46px;
    height: 26px;
    flex: 0 0 auto;
}

.modern-switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.modern-switch-slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: var(--border-strong);
    transition: background-color .18s ease;
}

.modern-switch-slider::after {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
    transition: transform .18s ease;
}

.modern-switch input:checked + .modern-switch-slider {
    background: var(--primary);
}

.modern-switch input:checked + .modern-switch-slider::after {
    transform: translateX(20px);
}

.security-note {
    display: flex;
    gap: 11px;
    margin-top: 14px;
    padding: 13px;
    border-radius: 13px;
    background: var(--success-soft);
}

.security-note-icon {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    color: var(--success);
    background: var(--surface);
    flex: 0 0 auto;
}

.security-note strong {
    display: block;
    font-size: 11px;
}

.security-note p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.45;
}

.settings-actions-stack {
    display: grid;
    gap: 9px;
    margin-top: 18px;
}

.link-button {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.modal-open {
    overflow: hidden;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(5, 10, 20, .58);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity .16s ease;
}

.modal-backdrop.visible {
    opacity: 1;
}

.app-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 100;
    width: min(520px, calc(100vw - 28px));
    max-height: calc(100vh - 32px);
    overflow: auto;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: 0 28px 90px rgba(0,0,0,.28);
    opacity: 0;
    transform: translate(-50%, -48%) scale(.98);
    transition: opacity .16s ease, transform .16s ease;
}

.app-modal.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.app-modal-small {
    width: min(440px, calc(100vw - 28px));
    text-align: center;
}

.app-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.app-modal-head h3,
.delete-modal-copy h3 {
    margin: 5px 0 0;
    font-size: 18px;
}

.modal-close {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 10px;
    color: var(--muted);
    background: var(--surface-soft);
    font-size: 20px;
}

.modal-form {
    padding-top: 17px;
}

.modal-copy {
    margin: 0 0 16px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
}

.modal-copy strong {
    color: var(--text);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    margin-top: 18px;
}

.modal-status {
    margin-top: 14px;
    padding: 12px;
    border-radius: 12px;
    font-size: 11px;
    line-height: 1.5;
}

.modal-status.info {
    color: var(--info);
    background: var(--info-soft);
}

.modal-status.success {
    color: var(--success);
    background: var(--success-soft);
}

.modal-status.error {
    color: var(--danger);
    background: var(--danger-soft);
}

.modal-warning-icon {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    margin: 4px auto 14px;
    border-radius: 17px;
    color: var(--danger);
    background: var(--danger-soft);
    font-size: 22px;
    font-weight: 900;
}

.delete-modal-copy p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

.danger-text {
    color: var(--danger);
}

.app-modal-small .modal-actions {
    justify-content: center;
}

.button-spinner {
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255,255,255,.45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 1180px) {
    .smtp-grid {
        grid-template-columns: 1fr;
    }

    .settings-layout {
        grid-template-columns: 1fr;
    }

    .sticky-panel {
        position: static;
    }
}

@media (max-width: 760px) {
    .section-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .section-heading > .primary-button {
        width: 100%;
    }

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

    .smtp-details {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .smtp-card-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .smtp-actions,
    .smtp-actions-secondary {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .smtp-actions > *,
    .smtp-actions form,
    .smtp-actions button,
    .smtp-actions a {
        width: 100%;
    }

    .smtp-actions form button {
        width: 100%;
    }

    .form-grid.two-columns,
    .form-grid.three-columns,
    .form-grid.smtp-server-grid {
        grid-template-columns: 1fr;
    }

    .settings-section {
        padding: 18px 16px;
    }

    .modal-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .smtp-details {
        grid-template-columns: 1fr;
    }

    .smtp-title-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 7px;
    }

    .smtp-actions,
    .smtp-actions-secondary {
        grid-template-columns: 1fr;
    }

    .modal-actions {
        grid-template-columns: 1fr;
    }

    .app-modal {
        padding: 16px;
    }
}


/* ============================================================
   FASE 4 - CAMPAÑAS
   ============================================================ */

.status-pill.neutral {
    color: var(--muted);
    background: var(--surface-strong);
}

.status-pill.info {
    color: var(--info);
    background: var(--info-soft);
}

.status-pill.warning {
    color: var(--warning);
    background: var(--warning-soft);
}

.status-pill.danger {
    color: var(--danger);
    background: var(--danger-soft);
}

.inline-alert.success {
    border-color: rgba(22,163,74,.22);
    background: var(--success-soft);
}

.inline-alert.success .inline-alert-icon {
    color: var(--success);
    background: rgba(22,163,74,.12);
}

.campaign-summary-grid,
.recipient-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin: 18px 0;
}

.recipient-stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.campaign-list {
    display: grid;
    gap: 12px;
}

.campaign-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 19px;
    border: 1px solid var(--border);
    border-radius: 17px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.campaign-card-main {
    min-width: 0;
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.campaign-card-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: var(--primary);
    background: var(--primary-soft);
    flex: 0 0 auto;
}

.campaign-card-copy {
    min-width: 0;
}

.campaign-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.campaign-title-row h3 {
    margin: 0;
    font-size: 16px;
}

.campaign-subject {
    margin: 5px 0 0;
    color: var(--text-soft);
    font-size: 13px;
}

.campaign-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 10px;
    color: var(--muted);
    font-size: 11px;
}

.campaign-card-actions {
    display: flex;
    gap: 8px;
    flex: 0 0 auto;
}

.campaign-empty-panel {
    margin-top: 18px;
}

.wizard-heading {
    margin-bottom: 18px;
}

.wizard-heading h2 {
    margin: 7px 0 7px;
    font-size: 27px;
    letter-spacing: -.035em;
}

.wizard-heading p {
    margin: 0;
    color: var(--muted);
}

.wizard-steps {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 18px;
}

.wizard-step {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface);
    color: var(--muted);
    text-decoration: none;
    font-size: 11px;
    font-weight: 800;
}

.wizard-step.active {
    color: var(--primary);
    border-color: rgba(37,99,235,.32);
    background: var(--primary-soft);
}

.wizard-step.done {
    color: var(--success);
}

.wizard-step.disabled {
    opacity: .52;
    pointer-events: none;
}

.wizard-step-number {
    width: 27px;
    height: 27px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    color: var(--muted);
    background: var(--surface-strong);
    flex: 0 0 auto;
}

.wizard-step.active .wizard-step-number {
    color: #fff;
    background: var(--primary);
}

.wizard-step.done .wizard-step-number {
    color: var(--success);
    background: var(--success-soft);
}

.wizard-layout,
.confirmation-layout {
    width: min(1050px, 100%);
    margin: 0 auto;
}

.wizard-panel {
    padding: 24px;
}

.wizard-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 24px;
}

.wizard-actions.outside {
    margin: 18px 0 0;
}

.wizard-actions-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.smtp-choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.smtp-choice {
    position: relative;
    min-height: 118px;
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: var(--surface-soft);
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease, transform .15s ease;
}

.smtp-choice:hover {
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

.smtp-choice.selected {
    border-color: rgba(37,99,235,.45);
    background: var(--primary-soft);
}

.smtp-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.smtp-choice-check {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    color: transparent;
    background: var(--surface);
    font-weight: 900;
}

.smtp-choice.selected .smtp-choice-check {
    color: #fff;
    border-color: var(--primary);
    background: var(--primary);
}

.smtp-choice strong,
.smtp-choice span,
.smtp-choice small {
    display: block;
}

.smtp-choice span {
    margin-top: 5px;
    color: var(--text-soft);
    font-size: 12px;
    line-height: 1.45;
}

.smtp-choice small {
    margin-top: 7px;
    color: var(--muted);
    font-size: 10px;
}

.recipient-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.textarea-shell textarea {
    width: 100%;
    resize: vertical;
    min-height: 190px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 13px;
    outline: none;
    color: var(--text);
    background: var(--surface);
    line-height: 1.55;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.textarea-shell textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.recipient-add-button {
    width: 100%;
    margin-top: 14px;
}

.file-dropzone {
    min-height: 190px;
    display: grid;
    place-items: center;
    align-content: center;
    padding: 20px;
    border: 1px dashed var(--border-strong);
    border-radius: 15px;
    background: var(--surface-soft);
    text-align: center;
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease;
}

.file-dropzone:hover,
.file-dropzone.has-file {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.file-dropzone input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.file-dropzone-icon {
    width: 45px;
    height: 45px;
    display: grid;
    place-items: center;
    margin-bottom: 10px;
    border-radius: 14px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 20px;
}

.file-dropzone strong {
    font-size: 14px;
}

.file-dropzone p {
    max-width: 100%;
    margin: 7px 0 3px;
    color: var(--muted);
    font-size: 12px;
    word-break: break-word;
}

.file-dropzone small {
    color: var(--muted);
    font-size: 10px;
}

.import-report {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    margin-bottom: 16px;
    padding: 15px;
    border: 1px solid rgba(22,163,74,.22);
    border-radius: 15px;
    background: var(--success-soft);
}

.import-report-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: var(--success);
    background: rgba(22,163,74,.12);
    font-weight: 900;
    flex: 0 0 auto;
}

.import-report strong {
    display: block;
    font-size: 13px;
}

.import-report p {
    margin: 4px 0;
    color: var(--text-soft);
    font-size: 12px;
}

.import-report small {
    display: block;
    color: var(--muted);
    line-height: 1.45;
}

.recipients-preview-panel {
    margin-top: 16px;
}

.recipient-preview-list {
    display: grid;
}

.recipient-preview-row {
    min-height: 58px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.recipient-preview-row:last-child {
    border-bottom: 0;
}

.recipient-avatar {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 11px;
    font-weight: 900;
}

.recipient-preview-row strong {
    display: block;
    font-size: 12px;
}

.recipient-preview-row span:not(.status-pill) {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    padding: 8px;
    border: 1px solid var(--border);
    border-bottom: 0;
    border-radius: 13px 13px 0 0;
    background: var(--surface-soft);
}

.editor-toolbar button {
    min-height: 34px;
    padding: 0 10px;
    border: 0;
    border-radius: 8px;
    color: var(--text-soft);
    background: transparent;
    font-size: 12px;
    font-weight: 750;
}

.editor-toolbar button:hover {
    color: var(--primary);
    background: var(--primary-soft);
}

.editor-toolbar > span {
    width: 1px;
    height: 22px;
    margin: 0 3px;
    background: var(--border);
}

.campaign-editor {
    min-height: 420px;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 0 0 13px 13px;
    outline: none;
    color: var(--text);
    background: var(--surface);
    font-size: 15px;
    line-height: 1.65;
}

.campaign-editor:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.campaign-editor:empty::before {
    content: attr(data-placeholder);
    color: var(--muted);
}

.editor-help {
    margin-top: 9px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
}

.preview-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 310px;
    gap: 16px;
}

.preview-panel,
.preview-sidebar {
    padding: 20px;
}

.email-preview-shell {
    overflow: hidden;
    margin-top: 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #f3f5f8;
}

.email-preview-frame {
    width: 100%;
    min-height: 620px;
    display: block;
    border: 0;
    background: #fff;
}

.preview-sidebar > h3 {
    margin: 6px 0 8px;
}

.preview-sidebar > p {
    margin: 0 0 16px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

.full-width {
    width: 100%;
}

.preview-smtp-box {
    margin-top: 12px;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-soft);
}

.preview-smtp-box span,
.preview-smtp-box strong,
.preview-smtp-box small {
    display: block;
}

.preview-smtp-box span {
    color: var(--muted);
    font-size: 10px;
}

.preview-smtp-box strong {
    margin-top: 4px;
    font-size: 12px;
}

.preview-smtp-box small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
}

.confirmation-panel {
    padding: 24px;
}

.confirmation-list {
    display: grid;
    margin-top: 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}

.confirmation-list > div {
    display: grid;
    gap: 4px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-soft);
}

.confirmation-list > div:last-child {
    border-bottom: 0;
}

.confirmation-list span {
    color: var(--muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 800;
}

.confirmation-list strong {
    font-size: 13px;
}

.confirmation-list small {
    color: var(--muted);
    font-size: 11px;
}

.confirmation-alert {
    margin-top: 16px;
    margin-bottom: 0;
}

.campaign-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
    gap: 16px;
}

.detail-confirmation-list {
    margin-top: 16px;
}

.detail-recipient-list {
    padding-top: 8px;
}

.campaign-content-preview {
    margin-top: 16px;
}

.detail-preview .email-preview-frame {
    min-height: 560px;
}

.compact-empty {
    min-height: 150px;
}

@media (max-width: 1180px) {
    .wizard-steps {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .recipient-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .preview-layout,
    .campaign-detail-grid {
        grid-template-columns: 1fr;
    }

    .preview-sidebar {
        order: -1;
    }
}

@media (max-width: 760px) {
    .campaign-summary-grid,
    .recipient-stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .campaign-card {
        align-items: stretch;
        flex-direction: column;
    }

    .campaign-card-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .campaign-card-actions > * {
        width: 100%;
    }

    .wizard-steps {
        grid-template-columns: 1fr 1fr;
    }

    .recipient-layout,
    .smtp-choice-grid {
        grid-template-columns: 1fr;
    }

    .wizard-panel,
    .confirmation-panel {
        padding: 18px 16px;
    }

    .wizard-actions.outside,
    .wizard-actions-right {
        align-items: stretch;
        flex-direction: column;
    }

    .wizard-actions.outside > *,
    .wizard-actions-right,
    .wizard-actions-right > *,
    .wizard-actions-right form,
    .wizard-actions-right button {
        width: 100%;
    }

    .wizard-actions-right form button {
        width: 100%;
    }

    .email-preview-frame {
        min-height: 520px;
    }
}

@media (max-width: 480px) {
    .campaign-summary-grid,
    .recipient-stats-grid {
        grid-template-columns: 1fr;
    }

    .wizard-steps {
        display: flex;
        overflow-x: auto;
        padding-bottom: 5px;
        scrollbar-width: thin;
    }

    .wizard-step {
        min-width: 145px;
    }

    .campaign-card-actions {
        grid-template-columns: 1fr;
    }

    .campaign-meta {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
    }

    .wizard-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .wizard-actions > * {
        width: 100%;
    }

    .wizard-actions .primary-button,
    .wizard-actions .secondary-button {
        width: 100%;
    }

    .recipient-preview-row {
        grid-template-columns: 32px minmax(0, 1fr);
    }

    .recipient-preview-row .status-pill {
        grid-column: 2;
        justify-self: start;
    }

    .editor-toolbar {
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .editor-toolbar button {
        white-space: nowrap;
    }

    .campaign-editor {
        min-height: 340px;
    }
}


.dashboard-campaign-list {
    display: grid;
    padding-top: 8px;
}

.dashboard-campaign-row {
    min-height: 66px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 11px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
    color: inherit;
    text-decoration: none;
}

.dashboard-campaign-row:last-child {
    border-bottom: 0;
}

.dashboard-campaign-row:hover strong {
    color: var(--primary);
}

.dashboard-campaign-row strong,
.dashboard-campaign-row span:not(.status-pill),
.dashboard-campaign-row small {
    display: block;
}

.dashboard-campaign-row strong {
    font-size: 12px;
}

.dashboard-campaign-row span:not(.status-pill) {
    max-width: 650px;
    margin-top: 3px;
    overflow: hidden;
    color: var(--muted);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-campaign-status {
    display: grid;
    justify-items: end;
    gap: 5px;
}

.dashboard-campaign-status small {
    color: var(--muted);
    font-size: 9px;
}

@media (max-width: 560px) {
    .dashboard-campaign-row {
        grid-template-columns: 34px minmax(0, 1fr);
    }

    .dashboard-campaign-status {
        grid-column: 2;
        justify-items: start;
    }
}


/* ============================================================
   FASE 4 - GESTIÓN DE CAMPAÑAS Y DESTINATARIOS
   ============================================================ */

.section-heading-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
    flex-wrap: wrap;
}

.danger-ghost-button.small {
    min-height: 39px;
    padding: 0 13px;
    font-size: 12px;
}

.recipient-edit-layout {
    margin-top: 16px;
}

.compact-dropzone {
    min-height: 160px;
}

.recipient-manager-panel {
    margin-top: 16px;
    padding: 20px;
}

.recipient-manager-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.recipient-manager-header h3 {
    margin: 5px 0 0;
    font-size: 17px;
}

.recipient-manager-actions,
.recipient-search-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.recipient-search-form .input-shell {
    width: min(300px, 38vw);
}

.recipient-search-form input {
    height: 40px;
}

.recipient-management-list {
    display: grid;
}

.recipient-management-row {
    min-height: 62px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto 38px;
    align-items: center;
    gap: 11px;
    border-bottom: 1px solid var(--border);
}

.recipient-management-row:last-child {
    border-bottom: 0;
}

.recipient-management-copy {
    min-width: 0;
}

.recipient-management-copy strong {
    display: block;
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recipient-management-copy span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
}

.recipient-delete-button {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--muted);
    background: transparent;
    font-size: 20px;
    line-height: 1;
}

.recipient-delete-button:hover {
    color: var(--danger);
    border-color: rgba(220, 38, 38, .18);
    background: var(--danger-soft);
}

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 11px;
}

.pagination-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-current {
    padding: 0 8px;
    white-space: nowrap;
}

.recipient-manage-shortcut {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 16px;
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-soft);
}

.recipient-manage-shortcut strong,
.recipient-manage-shortcut span {
    display: block;
}

.recipient-manage-shortcut strong {
    font-size: 12px;
}

.recipient-manage-shortcut span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
}

#delete-campaign-modal small {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    line-height: 1.5;
}

@media (max-width: 900px) {
    .recipient-manager-header {
        align-items: stretch;
        flex-direction: column;
    }

    .recipient-manager-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .recipient-search-form {
        width: 100%;
    }

    .recipient-search-form .input-shell {
        width: 100%;
        flex: 1 1 auto;
    }

    .recipient-manager-actions .danger-ghost-button {
        width: 100%;
    }

    .section-heading-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 620px) {
    .recipient-search-form {
        display: grid;
        grid-template-columns: 1fr auto;
    }

    .recipient-search-form .text-button {
        grid-column: 1 / -1;
        justify-self: start;
    }

    .recipient-management-row {
        grid-template-columns: 32px minmax(0, 1fr) 34px;
        padding: 8px 0;
    }

    .recipient-management-row .status-pill {
        grid-column: 2;
        justify-self: start;
    }

    .recipient-delete-button {
        grid-column: 3;
        grid-row: 1 / span 2;
    }

    .pagination-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .pagination-actions {
        justify-content: space-between;
    }

    .recipient-manage-shortcut {
        align-items: stretch;
        flex-direction: column;
    }

    .recipient-manage-shortcut .secondary-button {
        width: 100%;
    }

    .section-heading-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .section-heading-actions > * {
        width: 100%;
    }
}


/* ============================================================
   IDENTIDAD CORPORATIVA ASOCIACIÓN
   Verde institucional + dorado
   ============================================================ */

:root {
    --bg: #f5f3ed;
    --surface: #ffffff;
    --surface-soft: #f8f6f0;
    --surface-strong: #eeece4;
    --text: #10261b;
    --text-soft: #334b40;
    --muted: #718077;
    --border: #dfe4dc;
    --border-strong: #cbd4cc;

    --primary: #17643f;
    --primary-hover: #0f5031;
    --primary-soft: rgba(23, 100, 63, 0.10);

    --success: #1d7a4d;
    --success-soft: rgba(29, 122, 77, 0.11);
    --warning: #c99a1d;
    --warning-soft: rgba(201, 154, 29, 0.14);
    --danger: #c84b3c;
    --danger-soft: rgba(200, 75, 60, 0.10);
    --info: #17643f;
    --info-soft: rgba(23, 100, 63, 0.10);

    --accent: #d4a72c;
    --accent-hover: #b88e1d;
    --accent-soft: rgba(212, 167, 44, 0.14);

    --sidebar: #0a3323;
    --sidebar-soft: #12452f;
    --sidebar-text: #edf5ef;
    --sidebar-muted: #a7bbb0;

    --shadow-sm: 0 8px 24px rgba(10, 51, 35, 0.07);
    --shadow-lg: 0 24px 80px rgba(10, 51, 35, 0.13);
}

html[data-theme="dark"] {
    --bg: #07140f;
    --surface: #0d2017;
    --surface-soft: #12291e;
    --surface-strong: #183426;
    --text: #f4f6f1;
    --text-soft: #d4ded7;
    --muted: #93a99c;
    --border: #264537;
    --border-strong: #345b49;

    --primary: #2f8a5d;
    --primary-hover: #3da16f;
    --primary-soft: rgba(47, 138, 93, 0.15);

    --success: #36a56d;
    --success-soft: rgba(54, 165, 109, 0.14);
    --warning: #e0b43c;
    --warning-soft: rgba(224, 180, 60, 0.16);
    --danger: #ef7d6e;
    --danger-soft: rgba(239, 125, 110, 0.13);
    --info: #58a87b;
    --info-soft: rgba(88, 168, 123, 0.14);

    --accent: #e0b43c;
    --accent-hover: #f0c851;
    --accent-soft: rgba(224, 180, 60, 0.16);

    --sidebar: #04100b;
    --sidebar-soft: #0b2a1d;
    --sidebar-text: #f1f6f2;
    --sidebar-muted: #8fa99b;

    --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.22);
    --shadow-lg: 0 24px 80px rgba(0, 0, 0, 0.38);
}

/* Fondo general */
body {
    background:
        radial-gradient(circle at 14% 0%, rgba(212, 167, 44, .05), transparent 28rem),
        var(--bg);
}

/* Marca */
.brand-mark {
    background: linear-gradient(145deg, #17643f 0%, #0f5031 72%);
    color: #f7d45b;
    box-shadow: 0 12px 28px rgba(10, 51, 35, .22);
    border: 1px solid rgba(212, 167, 44, .28);
}

.brand-mark.xl {
    box-shadow: 0 18px 38px rgba(10, 51, 35, .28);
}

/* Login */
.auth-visual {
    background:
        radial-gradient(circle at 18% 18%, rgba(212, 167, 44, 0.16), transparent 24rem),
        radial-gradient(circle at 78% 78%, rgba(23, 100, 63, 0.34), transparent 30rem),
        linear-gradient(145deg, #071f15 0%, #0c3a28 54%, #0a3323 100%);
}

.auth-visual::after {
    opacity: .13;
    background-image:
        linear-gradient(rgba(212,167,44,.10) 1px, transparent 1px),
        linear-gradient(90deg, rgba(212,167,44,.10) 1px, transparent 1px);
}

.auth-kicker {
    color: #e0b43c;
}

.auth-feature {
    border-color: rgba(212, 167, 44, .12);
    background: rgba(255,255,255,.055);
}

.auth-feature > span {
    color: #f1cc59;
    background: rgba(212, 167, 44, .12);
}

.auth-panel {
    background:
        radial-gradient(circle at top right, rgba(212,167,44,.08), transparent 25rem),
        radial-gradient(circle at bottom left, var(--primary-soft), transparent 28rem),
        var(--bg);
}

/* Sidebar */
.sidebar {
    background:
        radial-gradient(circle at 0 0, rgba(212, 167, 44, .10), transparent 17rem),
        linear-gradient(180deg, #0a3323 0%, #08291d 72%, #061e15 100%);
    border-right: 1px solid rgba(212, 167, 44, .08);
}

html[data-theme="dark"] .sidebar {
    background:
        radial-gradient(circle at 0 0, rgba(212, 167, 44, .09), transparent 17rem),
        linear-gradient(180deg, #061d14 0%, #04150f 72%, #03100b 100%);
}

.nav-item.active {
    color: #ffffff;
    background: linear-gradient(135deg, #17643f 0%, #1f754b 100%);
    box-shadow: 0 10px 24px rgba(9, 64, 39, .26);
}

.nav-item.active .nav-icon {
    color: #f4c843;
}

.sidebar-footer {
    border-top-color: rgba(212, 167, 44, .11);
}

/* Cabecera y tarjetas */
.topbar {
    background: color-mix(in srgb, var(--bg) 90%, transparent);
}

.welcome-card {
    border-color: rgba(23, 100, 63, .15);
    background:
        linear-gradient(120deg, var(--surface) 0%, var(--surface) 55%, rgba(212, 167, 44, .07) 100%);
}

.panel,
.stat-card,
.mini-stat-card,
.campaign-card,
.setup-card {
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}

/* Botones */
.primary-button {
    background: #17643f;
    box-shadow: 0 10px 24px rgba(23, 100, 63, .20);
}

.primary-button:hover {
    background: #0f5031;
}

html[data-theme="dark"] .primary-button {
    background: #24754d;
}

html[data-theme="dark"] .primary-button:hover {
    background: #2f8a5d;
}

.secondary-button:hover {
    border-color: rgba(23, 100, 63, .25);
    color: var(--primary);
}

.text-button,
.text-link {
    color: var(--primary);
}

/* Focus corporativo */
.input-shell input:focus,
.textarea-shell textarea:focus,
.campaign-editor:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

/* Iconografía */
.stat-icon.blue,
.settings-icon,
.empty-icon,
.recipient-avatar,
.file-dropzone-icon,
.accent-panel-icon {
    color: var(--primary);
    background: var(--primary-soft);
}

.stat-card:nth-child(4) .stat-icon,
.mini-stat-card:nth-child(4) .settings-icon {
    color: var(--accent);
    background: var(--accent-soft);
}

/* Acentos dorados */
.panel-kicker,
.welcome-kicker,
.page-eyebrow {
    color: var(--primary);
}

.sidebar-brand .brand-mark,
.auth-logo-large .brand-mark {
    color: #f3c94a;
}

.wizard-step.active {
    color: var(--primary);
    border-color: rgba(23, 100, 63, .34);
    background: var(--primary-soft);
}

.wizard-step.active .wizard-step-number {
    background: var(--primary);
}

.wizard-step.done {
    color: var(--success);
}

.smtp-choice.selected {
    border-color: rgba(23, 100, 63, .40);
    background: var(--primary-soft);
}

.smtp-choice.selected .smtp-choice-check {
    border-color: var(--primary);
    background: var(--primary);
}

.file-dropzone:hover,
.file-dropzone.has-file {
    border-color: var(--primary);
    background: var(--primary-soft);
}

/* Tablas/listados */
.campaign-card:hover,
.smtp-card:hover,
.recipient-management-row:hover,
.dashboard-campaign-row:hover {
    background: color-mix(in srgb, var(--surface) 94%, var(--primary-soft));
}

/* Estados */
.status-pill.success {
    color: var(--success);
    background: var(--success-soft);
}

.status-pill.warning {
    color: #9b7516;
    background: var(--warning-soft);
}

html[data-theme="dark"] .status-pill.warning {
    color: #f0c851;
}

.status-pill.info {
    color: var(--primary);
    background: var(--primary-soft);
}

/* Modales */
.app-modal {
    border-color: var(--border);
    box-shadow: var(--shadow-lg);
}

.modal-warning-icon {
    color: var(--accent);
    background: var(--accent-soft);
}

/* Editor */
.editor-toolbar button:hover {
    color: var(--primary);
    background: var(--primary-soft);
}

/* Vista previa */
.email-preview-shell {
    border-color: #d9ded8;
    background: #f3f1ea;
}

/* Toast */
.toast.success .toast-icon {
    color: var(--success);
    background: var(--success-soft);
}

.toast.info .toast-icon {
    color: var(--primary);
    background: var(--primary-soft);
}

.toast.warning .toast-icon {
    color: var(--accent);
    background: var(--accent-soft);
}

/* Badges y botones secundarios de acento */
.accent-panel {
    background:
        linear-gradient(135deg, var(--surface) 0%, var(--surface) 62%, rgba(212,167,44,.07) 100%);
}

.accent-panel-icon {
    border: 1px solid rgba(212, 167, 44, .16);
}

/* Usuario */
.user-avatar {
    background: linear-gradient(145deg, #17643f, #0f5031);
    color: #f7d45b;
}

/* Paginación */
.pagination-current {
    color: var(--text-soft);
}

/* Dashboard */
.stats-grid .stat-card:nth-child(1) .stat-icon {
    color: var(--primary);
    background: var(--primary-soft);
}

.stats-grid .stat-card:nth-child(2) .stat-icon {
    color: var(--success);
    background: var(--success-soft);
}

.stats-grid .stat-card:nth-child(3) .stat-icon {
    color: #8c6a14;
    background: var(--accent-soft);
}

html[data-theme="dark"] .stats-grid .stat-card:nth-child(3) .stat-icon {
    color: #f1cc59;
}

.stats-grid .stat-card:nth-child(4) .stat-icon {
    color: var(--danger);
    background: var(--danger-soft);
}

/* Línea fina dorada decorativa en cabeceras */
.section-heading h2::after,
.wizard-heading h2::after,
.auth-heading h2::after,
.setup-heading h1::after {
    content: "";
    display: block;
    width: 48px;
    height: 2px;
    margin-top: 10px;
    border-radius: 999px;
    background: var(--accent);
}

/* Ajustes móviles */
@media (max-width: 720px) {
    .topbar {
        background: color-mix(in srgb, var(--bg) 94%, transparent);
    }
}


/* ============================================================
   FASE 4.5 - EDITOR PROFESIONAL DE EMAIL
   ============================================================ */
.editor-workspace{display:grid;grid-template-columns:minmax(0,1.6fr) minmax(340px,.75fr);gap:18px;align-items:start}.editor-main-panel{min-width:0}.editor-section-heading{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center}.editor-mode-actions{display:flex;gap:6px}.editor-mode-actions .active,.preview-device-switch .active{color:#fff!important;border-color:var(--primary)!important;background:var(--primary)!important}.rich-editor-shell{margin-top:18px;border:1px solid var(--border);border-radius:16px;overflow:hidden;background:var(--surface)}.advanced-toolbar{display:flex;flex-wrap:wrap;gap:7px;padding:10px;border-bottom:1px solid var(--border);background:var(--surface-soft);position:sticky;top:0;z-index:5}.editor-tool-group{display:flex;align-items:center;gap:4px;padding-right:7px;border-right:1px solid var(--border)}.editor-tool-group:last-child{border-right:0}.advanced-toolbar button,.editor-color-tool{min-height:34px;display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;border-radius:8px;padding:0 9px;color:var(--text-soft);background:transparent;font-size:11px;font-weight:800;cursor:pointer}.advanced-toolbar button:hover,.editor-color-tool:hover{color:var(--primary);border-color:var(--border);background:var(--surface)}.editor-select{height:34px;border:1px solid var(--border);border-radius:8px;padding:0 28px 0 9px;color:var(--text);background:var(--surface);font-size:11px;font-weight:700}.editor-select.compact{width:66px;padding-right:20px}.editor-color-tool{position:relative;width:36px;padding:0}.editor-color-tool input{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer}.editor-canvas-wrap{position:relative;overflow:auto;background:#eef0eb;padding:22px}.advanced-campaign-editor{min-height:430px;max-width:700px;margin:0 auto;padding:34px 32px;border:0;border-radius:4px;background:#fff;color:#26352d;box-shadow:0 10px 32px rgba(10,51,35,.08);font-family:Arial,Helvetica,sans-serif;font-size:16px;line-height:1.65;outline:0}.advanced-campaign-editor img{cursor:pointer}.advanced-campaign-editor .editor-image-selected{outline:2px solid var(--primary);outline-offset:3px}.editor-source{width:100%;min-height:520px;padding:18px;border:0;resize:vertical;background:#0c1812;color:#e8f1eb;font:13px/1.6 ui-monospace,SFMono-Regular,Consolas,monospace;outline:0}.image-resize-box{position:absolute;z-index:8;border:1px dashed var(--primary);pointer-events:none}.resize-handle{position:absolute;width:12px;height:12px;border:2px solid #fff;border-radius:3px;background:var(--primary);box-shadow:0 2px 7px rgba(0,0,0,.2);pointer-events:auto}.resize-handle.nw{left:-7px;top:-7px;cursor:nwse-resize}.resize-handle.ne{right:-7px;top:-7px;cursor:nesw-resize}.resize-handle.sw{left:-7px;bottom:-7px;cursor:nesw-resize}.resize-handle.se{right:-7px;bottom:-7px;cursor:nwse-resize}.image-inspector{padding:14px;border-top:1px solid var(--border);background:var(--surface-soft)}.image-inspector-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.image-inspector-heading strong,.image-inspector-heading span{display:block}.image-inspector-heading strong{font-size:12px}.image-inspector-heading span{margin-top:3px;color:var(--muted);font-size:10px}.image-inspector-grid{display:grid;grid-template-columns:120px 1fr 1fr;gap:10px;margin-top:12px}.mini-field span{display:block;margin-bottom:5px;color:var(--muted);font-size:9px;font-weight:800;text-transform:uppercase;letter-spacing:.04em}.mini-field input{width:100%;height:36px;border:1px solid var(--border);border-radius:8px;padding:0 9px;color:var(--text);background:var(--surface);font-size:11px}.image-inspector-actions{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;margin-top:11px}.quick-size-group{display:flex;gap:5px}.quick-size-group button{min-height:31px;padding:0 8px;border:1px solid var(--border);border-radius:7px;color:var(--text-soft);background:var(--surface);font-size:10px;font-weight:800}.quick-size-group button:hover{color:var(--primary);border-color:var(--primary)}.editor-help-modern{display:flex;gap:9px;align-items:flex-start;margin-top:13px;padding:11px 13px;border:1px solid rgba(23,100,63,.13);border-radius:11px;color:var(--muted);background:var(--primary-soft)}.editor-help-modern>span{color:var(--success);font-weight:900}.editor-help-modern p{margin:0;font-size:10px;line-height:1.5}.editor-save-actions{margin-top:15px}.editor-side-column{display:grid;gap:18px;position:sticky;top:92px}.compact-panel-header{padding-bottom:12px}.compact-panel-header h3{font-size:14px}.preview-device-switch{display:flex;gap:4px;padding:3px;border:1px solid var(--border);border-radius:9px;background:var(--surface-soft)}.preview-device-switch button{min-height:29px;padding:0 8px;border-radius:6px;color:var(--muted);background:transparent;font-size:9px;font-weight:800}.editor-live-preview{display:flex;justify-content:center;margin-top:14px;overflow:auto;padding:12px;border-radius:12px;background:#e9ebe6;transition:.2s}.editor-live-preview iframe{width:100%;height:480px;border:0;background:#fff;transition:width .2s}.editor-live-preview.mobile iframe{width:375px;max-width:100%}.attachments-panel{padding-bottom:14px}.attachment-total{color:var(--muted);font-size:9px;font-weight:800}.attachment-dropzone{min-height:105px;display:grid;place-items:center;align-content:center;gap:3px;margin-top:13px;border:1.5px dashed var(--border-strong);border-radius:12px;background:var(--surface-soft);text-align:center;cursor:pointer}.attachment-dropzone:hover{border-color:var(--primary);background:var(--primary-soft)}.attachment-dropzone input{display:none}.attachment-upload-icon{font-size:21px;color:var(--primary)}.attachment-dropzone strong{font-size:11px}.attachment-dropzone small{color:var(--muted);font-size:9px}.attachment-list{display:grid;margin-top:10px}.attachment-row{display:grid;grid-template-columns:30px minmax(0,1fr) 30px;align-items:center;gap:9px;min-height:52px;border-bottom:1px solid var(--border)}.attachment-file-icon{width:28px;height:28px;display:grid;place-items:center;border-radius:8px;color:var(--primary);background:var(--primary-soft);font-size:12px}.attachment-copy{min-width:0}.attachment-copy strong{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:10px}.attachment-copy span{display:block;margin-top:2px;color:var(--muted);font-size:9px}.attachment-delete{width:28px;height:28px;border-radius:8px;color:var(--muted);background:transparent;font-size:18px}.attachment-delete:hover{color:var(--danger);background:var(--danger-soft)}.attachment-empty{padding:15px 0;color:var(--muted);font-size:10px;text-align:center}.attachment-note{margin:10px 0 0;color:var(--muted);font-size:9px;line-height:1.5}.image-upload-picker{display:grid;grid-template-columns:92px 1fr;align-items:center;gap:14px;min-height:105px;padding:12px;border:1.5px dashed var(--border-strong);border-radius:13px;background:var(--surface-soft);cursor:pointer}.image-upload-picker input{display:none}.image-upload-preview{width:80px;height:80px;display:grid;place-items:center;border-radius:10px;background-size:cover;background-position:center;background-color:var(--primary-soft);color:var(--primary);font-size:24px}.image-upload-picker strong,.image-upload-picker small{display:block}.image-upload-picker strong{font-size:12px}.image-upload-picker small{margin-top:4px;color:var(--muted);font-size:10px}.email-preview-shell.mobile{max-width:405px;margin-left:auto;margin-right:auto}.email-preview-shell.mobile .email-preview-frame{height:680px}.preview-attachment-list{display:grid;gap:5px;margin-top:10px}.preview-attachment-list span{display:block;overflow:hidden;padding:7px 9px;border:1px solid var(--border);border-radius:8px;color:var(--muted);font-size:9px;text-overflow:ellipsis;white-space:nowrap}
@media(max-width:1180px){.editor-workspace{grid-template-columns:1fr}.editor-side-column{position:static;grid-template-columns:1fr 1fr}.live-preview-panel,.attachments-panel{min-width:0}}
@media(max-width:760px){.editor-section-heading{grid-template-columns:auto 1fr}.editor-mode-actions{grid-column:1/-1;margin-top:10px}.editor-side-column{grid-template-columns:1fr}.advanced-toolbar{position:static}.editor-tool-group{border-right:0;padding-right:0}.editor-canvas-wrap{padding:10px}.advanced-campaign-editor{min-height:380px;padding:24px 18px}.image-inspector-grid{grid-template-columns:1fr}.image-inspector-actions{align-items:stretch;flex-direction:column}.quick-size-group{width:100%;display:grid;grid-template-columns:repeat(4,1fr)}.quick-size-group:nth-child(2){grid-template-columns:repeat(3,1fr)}.editor-live-preview iframe{height:430px}.image-upload-picker{grid-template-columns:72px 1fr}.image-upload-preview{width:62px;height:62px}}


/* ============================================================
   FASE 4.5 - CORRECCIÓN EDITOR / DRAG DE IMÁGENES
   ============================================================ */

.advanced-campaign-editor img[data-campaign-image] {
    cursor: grab;
}

.advanced-campaign-editor img[data-campaign-image]:active,
.advanced-campaign-editor img.editor-image-dragging {
    cursor: grabbing;
}

.advanced-campaign-editor.editor-image-drag-mode {
    outline: 2px dashed var(--primary);
    outline-offset: -6px;
    background:
        linear-gradient(var(--primary-soft), var(--primary-soft)),
        var(--surface);
}

.advanced-campaign-editor img.editor-image-dragging {
    opacity: .55;
}

[data-editor-attachment] {
    white-space: nowrap;
}

.attachments-panel .attachment-dropzone {
    cursor: pointer;
}


/* ============================================================
   LOGO JUCIL - LOGIN Y PORTAL
   ============================================================ */

.app-brand-logo {
    display: block;
    object-fit: contain;
    flex: 0 0 auto;
    filter: drop-shadow(0 8px 18px rgba(0, 0, 0, .18));
}

.app-brand-logo-login {
    width: 82px;
    height: 82px;
}

.app-brand-logo-mobile {
    width: 50px;
    height: 50px;
}

.app-brand-logo-sidebar {
    width: 54px;
    height: 54px;
}

.sidebar-brand {
    min-height: 78px;
}

.auth-logo-large {
    align-items: center;
}

.auth-logo-large strong {
    font-size: 24px;
}

.auth-logo-large span {
    font-size: 12px;
}

html[data-theme="dark"] .app-brand-logo {
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, .35));
}

@media (max-width: 900px) {
    .app-brand-logo-login {
        width: 68px;
        height: 68px;
    }
}

@media (max-width: 620px) {
    .app-brand-logo-mobile {
        width: 46px;
        height: 46px;
    }

    .app-brand-logo-sidebar {
        width: 48px;
        height: 48px;
    }
}


/* ============================================================
   PREVISUALIZACIÓN DE IMPORTACIÓN DE DESTINATARIOS
   ============================================================ */

.import-preview-backdrop {
    z-index: 1090;
}

.import-preview-modal {
    width: min(760px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    z-index: 1100;
}

.import-preview-heading {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.import-preview-heading h3 {
    margin: 4px 0 2px;
    font-size: 20px;
}

.import-preview-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    word-break: break-all;
}

.import-preview-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 14px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 22px;
    font-weight: 800;
}

.import-preview-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 9px;
}

.import-preview-stats article {
    min-width: 0;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface-soft);
}

.import-preview-stats article.has-warning {
    border-color: rgba(212, 167, 44, .38);
    background: var(--warning-soft);
}

.import-preview-stats span,
.import-preview-result span {
    display: block;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.35;
}

.import-preview-stats strong {
    display: block;
    margin-top: 5px;
    font-size: 20px;
}

.import-preview-result {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    margin-top: 12px;
    overflow: hidden;
    border: 1px solid rgba(23, 100, 63, .22);
    border-radius: 14px;
    background: var(--border);
}

.import-preview-result > div {
    padding: 14px;
    background: color-mix(in srgb, var(--surface) 88%, var(--primary-soft));
}

.import-preview-result strong {
    display: block;
    margin-top: 5px;
    color: var(--primary);
    font-size: 22px;
}

.import-preview-sample {
    margin-top: 16px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

.import-preview-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 7px;
}

.import-preview-section-title strong {
    font-size: 12px;
}

.import-preview-section-title span {
    color: var(--muted);
    font-size: 10px;
}

.import-preview-list {
    display: grid;
}

.import-preview-row {
    min-height: 46px;
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    border-bottom: 1px solid var(--border);
}

.import-preview-row:last-child {
    border-bottom: 0;
}

.import-preview-row strong {
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.import-preview-row .recipient-avatar {
    width: 28px;
    height: 28px;
    font-size: 11px;
}

.import-preview-warning {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
    margin-top: 13px;
    padding: 11px 13px;
    border-left: 3px solid var(--accent);
    border-radius: 0 10px 10px 0;
    background: var(--warning-soft);
}

.import-preview-warning strong {
    font-size: 11px;
}

.import-preview-warning span {
    color: var(--text-soft);
    font-size: 10px;
    line-height: 1.45;
}

.import-preview-actions {
    justify-content: flex-end;
    margin-top: 18px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

.import-preview-actions form {
    margin: 0;
}

.import-preview-actions .primary-button:disabled {
    cursor: not-allowed;
    opacity: .45;
    box-shadow: none;
}

@media (max-width: 680px) {
    .import-preview-modal {
        width: calc(100vw - 20px);
        max-height: calc(100vh - 20px);
    }

    .import-preview-stats,
    .import-preview-result {
        grid-template-columns: repeat(2, 1fr);
    }

    .import-preview-result > div:last-child {
        grid-column: 1 / -1;
    }

    .import-preview-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .import-preview-actions form,
    .import-preview-actions button {
        width: 100%;
    }
}

@media (max-width: 440px) {
    .import-preview-stats {
        grid-template-columns: 1fr 1fr;
    }

    .import-preview-row {
        grid-template-columns: 28px minmax(0, 1fr);
        padding: 7px 0;
    }

    .import-preview-row .status-pill {
        grid-column: 2;
        justify-self: start;
    }
}


/* ============================================================
   FASE 4.7 - BAJAS Y LISTA GLOBAL DE EXCLUSIÓN
   ============================================================ */

.unsubscribe-public-page {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 15% 0%, rgba(212, 167, 44, .10), transparent 25rem),
        radial-gradient(circle at 90% 100%, rgba(23, 100, 63, .12), transparent 32rem),
        #f5f3ed;
    color: #10261b;
    font-family: Inter, Arial, Helvetica, sans-serif;
}

.unsubscribe-public-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.unsubscribe-public-card {
    width: min(560px, 100%);
    padding: 34px;
    border: 1px solid #dfe4dc;
    border-radius: 22px;
    background: #ffffff;
    box-shadow: 0 24px 80px rgba(10, 51, 35, .13);
    text-align: center;
}

.unsubscribe-logo-wrap {
    width: 92px;
    height: 92px;
    display: grid;
    place-items: center;
    margin: 0 auto 22px;
    border-radius: 24px;
    background: #0a3323;
    box-shadow: 0 14px 32px rgba(10, 51, 35, .22);
}

.unsubscribe-logo {
    width: 78px;
    height: 78px;
    object-fit: contain;
}

.unsubscribe-kicker {
    display: block;
    color: #17643f;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.4px;
    text-transform: uppercase;
}

.unsubscribe-public-card h1 {
    margin: 9px auto 12px;
    max-width: 440px;
    color: #10261b;
    font-size: clamp(24px, 5vw, 34px);
    line-height: 1.08;
}

.unsubscribe-public-card > p {
    max-width: 450px;
    margin: 0 auto;
    color: #65756c;
    font-size: 14px;
    line-height: 1.65;
}

.unsubscribe-email {
    margin: 22px 0 18px;
    padding: 14px;
    border: 1px solid #dfe4dc;
    border-radius: 14px;
    background: #f8f6f0;
}

.unsubscribe-email span,
.unsubscribe-email strong {
    display: block;
}

.unsubscribe-email span {
    color: #718077;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .8px;
}

.unsubscribe-email strong {
    margin-top: 5px;
    font-size: 14px;
}

.unsubscribe-form {
    margin: 0;
}

.unsubscribe-danger-button {
    width: 100%;
    min-height: 48px;
    justify-content: center;
}

.unsubscribe-help {
    margin-top: 15px !important;
    font-size: 11px !important;
}

.unsubscribe-result-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    margin: 0 auto 18px;
    border-radius: 50%;
    font-size: 25px;
    font-weight: 800;
}

.unsubscribe-result-icon.success {
    color: #17643f;
    background: rgba(23, 100, 63, .11);
}

.unsubscribe-result-icon.neutral {
    color: #8a6a17;
    background: rgba(212, 167, 44, .15);
}

.unsubscribe-result-icon.error {
    color: #c84b3c;
    background: rgba(200, 75, 60, .11);
}

.unsubscribe-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 3px;
    margin-top: 26px;
    padding-top: 18px;
    border-top: 1px solid #e6e8e3;
}

.unsubscribe-footer span {
    color: #0a3323;
    font-size: 12px;
    font-weight: 800;
}

.unsubscribe-footer small {
    color: #849088;
    font-size: 10px;
}

.suppression-stats-grid {
    margin-top: 16px;
}

.suppression-manager-panel {
    margin-top: 16px;
}

.suppression-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.suppression-table {
    width: 100%;
    min-width: 820px;
    border-collapse: collapse;
}

.suppression-table th {
    padding: 13px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: .55px;
}

.suppression-table td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-soft);
    font-size: 11px;
    vertical-align: middle;
}

.suppression-table tbody tr:hover {
    background: color-mix(in srgb, var(--surface) 94%, var(--primary-soft));
}

.suppression-table .align-right {
    text-align: right;
}

.suppression-email-cell {
    display: flex;
    align-items: center;
    gap: 9px;
}

.suppression-email-cell strong {
    color: var(--text);
    font-size: 11px;
    white-space: nowrap;
}

#reactivate-modal small {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    line-height: 1.5;
}

@media (max-width: 620px) {
    .unsubscribe-public-shell {
        padding: 12px;
    }

    .unsubscribe-public-card {
        padding: 26px 18px;
        border-radius: 18px;
    }

    .unsubscribe-logo-wrap {
        width: 78px;
        height: 78px;
    }

    .unsubscribe-logo {
        width: 66px;
        height: 66px;
    }
}


/* ============================================================
   FASE 4.8 - RESUMEN DE IMPORTACIÓN MÁS EXPLÍCITO
   ============================================================ */

.import-preview-info {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    margin-top: 14px;
    padding: 12px 14px;
    border: 1px solid rgba(212, 167, 44, .34);
    border-radius: 12px;
    background: rgba(212, 167, 44, .08);
}

.import-preview-info-icon {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid rgba(212, 167, 44, .45);
    border-radius: 50%;
    color: #9b7516;
    font-size: 12px;
    font-weight: 800;
}

html[data-theme="dark"] .import-preview-info-icon {
    color: #f0c851;
}

.import-preview-info strong,
.import-preview-info span {
    display: block;
}

.import-preview-info strong {
    color: var(--text);
    font-size: 11px;
    line-height: 1.45;
}

.import-preview-info span {
    margin-top: 2px;
    color: var(--text-soft);
    font-size: 10px;
    line-height: 1.45;
}

.import-preview-row {
    grid-template-columns: 22px 30px minmax(0, 1fr) auto;
}

.import-preview-number {
    color: var(--muted);
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

@media (max-width: 440px) {
    .import-preview-row {
        grid-template-columns: 20px 28px minmax(0, 1fr);
    }

    .import-preview-row .status-pill {
        grid-column: 3;
        justify-self: start;
    }
}


/* ============================================================
   FASE 4.9 - VISTA PREVIA EN MODAL SECUNDARIO
   ============================================================ */

.import-preview-launch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 14px;
    padding: 12px 14px;
    border: 1px solid rgba(212, 167, 44, .34);
    border-radius: 12px;
    background: rgba(212, 167, 44, .08);
}

.import-preview-launch-copy {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    min-width: 0;
}

.import-preview-launch-copy strong,
.import-preview-launch-copy span {
    display: block;
}

.import-preview-launch-copy strong {
    color: var(--text);
    font-size: 11px;
    line-height: 1.45;
}

.import-preview-launch-copy span {
    margin-top: 2px;
    color: var(--text-soft);
    font-size: 10px;
    line-height: 1.45;
}

.import-list-preview-backdrop {
    z-index: 1140;
}

.import-list-preview-modal {
    width: min(620px, calc(100vw - 32px));
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    z-index: 1150;
}

.import-list-preview-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 14px;
}

.import-list-preview-heading h3 {
    margin: 5px 0 4px;
    font-size: 19px;
}

.import-list-preview-heading p {
    margin: 0;
    max-width: 500px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.5;
}

.modal-icon-close {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--muted);
    background: var(--surface);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.modal-icon-close:hover {
    color: var(--text);
    border-color: var(--border-strong);
    background: var(--surface-soft);
}

.import-list-preview-list {
    max-height: 430px;
    overflow-y: auto;
    padding-right: 2px;
}

.import-list-preview-actions {
    justify-content: flex-end;
    margin-top: 15px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

@media (max-width: 620px) {
    .import-preview-launch {
        align-items: stretch;
        flex-direction: column;
    }

    .import-preview-launch .secondary-button {
        width: 100%;
    }

    .import-list-preview-modal {
        width: calc(100vw - 20px);
        max-height: calc(100vh - 20px);
    }
}


/* ============================================================
   FASE 4.10 - BUSCADOR Y PAGINACIÓN EN VISTA PREVIA
   ============================================================ */

.import-list-preview-modal {
    width: min(720px, calc(100vw - 32px));
}

.import-list-search-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.import-list-search-shell {
    position: relative;
    flex: 1 1 auto;
}

.import-list-search-shell input {
    width: 100%;
    height: 42px;
    padding-left: 38px;
}

.import-list-search-icon {
    position: absolute;
    top: 50%;
    left: 13px;
    z-index: 2;
    color: var(--muted);
    font-size: 17px;
    transform: translateY(-50%);
    pointer-events: none;
}

.import-list-clear-search {
    flex: 0 0 auto;
}

.import-list-summary-bar {
    display: flex;
    align-items: center;
    min-height: 30px;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 10px;
}

.import-list-preview-content {
    min-height: 220px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.import-list-loading {
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    color: var(--muted);
    font-size: 11px;
}

.import-list-spinner {
    width: 26px;
    height: 26px;
    display: block;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: import-list-spin .75s linear infinite;
}

@keyframes import-list-spin {
    to {
        transform: rotate(360deg);
    }
}

.import-list-preview-list {
    max-height: 430px;
    overflow-y: auto;
    padding-right: 2px;
}

.import-list-empty {
    min-height: 220px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 5px;
    text-align: center;
}

.import-list-empty .empty-icon {
    margin-bottom: 5px;
}

.import-list-empty strong {
    font-size: 12px;
}

.import-list-empty span {
    color: var(--muted);
    font-size: 10px;
}

.import-list-pagination {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 13px 0 0;
}

.import-list-pagination > span {
    color: var(--muted);
    font-size: 10px;
    text-align: center;
}

.import-list-pagination button:disabled {
    cursor: not-allowed;
    opacity: .42;
}

.import-list-preview-list .import-preview-row strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 620px) {
    .import-list-preview-modal {
        width: calc(100vw - 20px);
    }

    .import-list-search-row {
        align-items: stretch;
        flex-direction: column;
    }

    .import-list-clear-search {
        align-self: flex-start;
    }

    .import-list-pagination {
        grid-template-columns: 1fr 1fr;
    }

    .import-list-pagination > span {
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .import-list-pagination [data-import-list-prev] {
        grid-column: 1;
        grid-row: 2;
    }

    .import-list-pagination [data-import-list-next] {
        grid-column: 2;
        grid-row: 2;
    }
}


/* ============================================================
   CORRECCIÓN FASE 4.10 - RESPETAR ELEMENTOS [hidden]
   ============================================================ */

/*
 * Algunos componentes de la vista previa definen display:flex/grid.
 * Eso puede hacer que el atributo HTML "hidden" no los oculte
 * visualmente en determinados navegadores.
 */
.import-list-loading[hidden],
.import-list-preview-list[hidden],
.import-list-empty[hidden],
.import-list-pagination[hidden],
.import-list-clear-search[hidden],
.import-list-preview-backdrop[hidden],
.import-list-preview-modal[hidden] {
    display: none !important;
}


/* ============================================================
   FASE 4.11 - BOTONES DE GESTIÓN DE CAMPAÑAS ALINEADOS
   ============================================================ */

.campaign-card-actions {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(94px, 1fr);
    align-items: stretch;
    gap: 10px;
    flex: 0 0 auto;
}

.campaign-card-actions > .primary-button,
.campaign-card-actions > .secondary-button,
.campaign-card-actions > .danger-ghost-button {
    min-width: 94px;
    width: 100%;
    min-height: 40px;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
    padding: 0 14px;
}

.campaign-card-actions > .primary-button.small,
.campaign-card-actions > .secondary-button.small,
.campaign-card-actions > .danger-ghost-button.small {
    min-height: 40px;
    font-size: 13px;
}

.campaign-card-actions > .danger-ghost-button {
    border: 1px solid color-mix(in srgb, var(--danger) 22%, transparent);
    border-radius: 11px;
    background: transparent;
}

.campaign-card-actions > .danger-ghost-button:hover {
    border-color: color-mix(in srgb, var(--danger) 34%, transparent);
}

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

    .campaign-card-actions {
        width: 100%;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        grid-auto-flow: row;
        grid-auto-columns: unset;
    }
}

@media (max-width: 520px) {
    .campaign-card-actions {
        grid-template-columns: 1fr;
    }
}


/* ============================================================
   CORRECCIÓN FASE 4.11 - CENTRADO VERTICAL BOTONES CAMPAÑAS
   ============================================================ */

.campaign-card-actions > .primary-button,
.campaign-card-actions > .secondary-button,
.campaign-card-actions > .danger-ghost-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    vertical-align: middle;
}

.campaign-card-actions > a,
.campaign-card-actions > button {
    box-sizing: border-box;
}


/* ============================================================
   FASE 4.12 - DESTINATARIOS COMPACTO + DRAG & DROP
   ============================================================ */

.recipient-entry-grid {
    align-items: stretch;
    gap: 14px;
}

.recipient-entry-grid > .wizard-panel {
    display: flex;
    flex-direction: column;
    padding: 16px;
}

.recipient-entry-grid > .wizard-panel .settings-section-heading {
    min-height: 52px;
    margin-bottom: 10px;
}

.recipient-entry-grid > .wizard-panel .settings-section-heading h3 {
    margin-bottom: 2px;
}

.recipient-entry-grid > .wizard-panel .settings-section-heading p {
    margin-top: 0;
    line-height: 1.35;
}

.recipient-entry-grid > .wizard-panel > form {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
}

.recipient-entry-grid .field {
    margin: 0;
}

.recipient-entry-grid .textarea-shell textarea {
    min-height: 116px;
    height: 116px;
    resize: vertical;
    padding: 11px 12px;
}

.recipient-entry-grid .file-dropzone,
.recipient-entry-grid .compact-dropzone {
    min-height: 116px;
    height: 116px;
    padding: 12px 14px;
    gap: 0;
}

.recipient-entry-grid .file-dropzone-icon {
    width: 34px;
    height: 34px;
    margin-bottom: 5px;
    border-radius: 10px;
    font-size: 16px;
}

.recipient-entry-grid .file-dropzone strong {
    max-width: 360px;
    font-size: 11px;
    line-height: 1.35;
}

.recipient-entry-grid .file-dropzone p {
    margin: 4px 0 1px;
    font-size: 10px;
}

.recipient-entry-grid .file-dropzone small {
    font-size: 9px;
}

.recipient-entry-grid .recipient-add-button {
    width: 100%;
    min-height: 40px;
    margin-top: auto;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    text-align: center;
}

.recipient-entry-grid .textarea-shell + * {
    margin-top: 0;
}

.recipient-entry-grid form > .recipient-add-button {
    margin-top: 12px;
}

/* Arrastrar archivo */
.file-dropzone.is-dragging {
    border-color: var(--primary);
    border-style: solid;
    background: var(--primary-soft);
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--primary) 18%, transparent);
    transform: translateY(-1px);
}

.file-dropzone.is-dragging .file-dropzone-icon {
    transform: translateY(-2px);
}

.file-dropzone.has-error {
    border-color: var(--danger);
    background: var(--danger-soft);
}

.file-dropzone.has-error [data-file-name] {
    color: var(--danger);
}

.file-dropzone,
.file-dropzone-icon {
    transition:
        border-color .15s ease,
        background-color .15s ease,
        box-shadow .15s ease,
        transform .15s ease;
}

@media (max-width: 720px) {
    .recipient-entry-grid > .wizard-panel {
        padding: 14px;
    }

    .recipient-entry-grid > .wizard-panel .settings-section-heading {
        min-height: 0;
    }

    .recipient-entry-grid .textarea-shell textarea,
    .recipient-entry-grid .file-dropzone,
    .recipient-entry-grid .compact-dropzone {
        min-height: 108px;
        height: 108px;
    }
}


/* ============================================================
   ALINEACIÓN ESTRICTA DE DESTINATARIOS
   ============================================================ */

.recipient-entry-grid {
    align-items: stretch;
}

.recipient-entry-grid > .wizard-panel {
    display: grid;
    grid-template-rows: 54px 1fr;
    gap: 10px;
}

.recipient-entry-grid > .wizard-panel .settings-section-heading {
    min-height: 54px;
    height: 54px;
    margin: 0;
    align-items: flex-start;
}

.recipient-entry-grid .recipient-entry-form {
    display: grid;
    grid-template-rows: 141px 40px;
    gap: 12px;
    min-height: 193px;
    height: 193px;
    flex: none;
}

.recipient-entry-grid .recipient-entry-field,
.recipient-entry-grid .recipient-entry-file-field {
    display: grid;
    grid-template-rows: 18px 116px;
    gap: 7px;
    min-height: 141px;
    height: 141px;
    margin: 0;
}

.recipient-entry-grid .recipient-entry-label {
    display: block;
    height: 18px;
    margin: 0;
    color: var(--text);
    font-size: 11px;
    font-weight: 750;
    line-height: 18px;
}

.recipient-entry-grid .recipient-entry-label-placeholder {
    visibility: hidden;
    user-select: none;
}

.recipient-entry-grid .textarea-shell,
.recipient-entry-grid .file-dropzone,
.recipient-entry-grid .compact-dropzone {
    width: 100%;
    min-height: 116px;
    height: 116px;
    box-sizing: border-box;
}

.recipient-entry-grid .textarea-shell textarea {
    width: 100%;
    min-height: 116px;
    height: 116px;
    box-sizing: border-box;
}

.recipient-entry-grid .recipient-add-button,
.recipient-entry-grid form > .recipient-add-button {
    width: 100%;
    min-height: 40px;
    height: 40px;
    margin: 0;
    align-self: end;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

@media (max-width: 720px) {
    .recipient-entry-grid > .wizard-panel {
        grid-template-rows: auto 1fr;
    }

    .recipient-entry-grid > .wizard-panel .settings-section-heading {
        min-height: 0;
        height: auto;
    }

    .recipient-entry-grid .recipient-entry-form {
        grid-template-rows: 133px 40px;
        min-height: 185px;
        height: 185px;
    }

    .recipient-entry-grid .recipient-entry-field,
    .recipient-entry-grid .recipient-entry-file-field {
        grid-template-rows: 18px 108px;
        min-height: 133px;
        height: 133px;
    }

    .recipient-entry-grid .textarea-shell,
    .recipient-entry-grid .textarea-shell textarea,
    .recipient-entry-grid .file-dropzone,
    .recipient-entry-grid .compact-dropzone {
        min-height: 108px;
        height: 108px;
    }
}


/* ============================================================
   PASOS DE CAMPAÑA NAVEGABLES
   ============================================================ */

.wizard-step:not(.disabled) {
    cursor: pointer;
    transition:
        border-color .15s ease,
        background-color .15s ease,
        color .15s ease,
        transform .15s ease,
        box-shadow .15s ease;
}

.wizard-step:not(.disabled):not(.active):hover {
    color: var(--primary);
    border-color: color-mix(in srgb, var(--primary) 28%, var(--border));
    background: color-mix(in srgb, var(--surface) 90%, var(--primary-soft));
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.wizard-step:not(.disabled):not(.active):hover .wizard-step-number {
    color: var(--primary);
    background: var(--primary-soft);
}

.wizard-step.done:hover .wizard-step-number {
    color: var(--success);
    background: var(--success-soft);
}

.wizard-step.active {
    cursor: default;
}

/* ============================================================
   FASE 5 · MOTOR DE ENVÍO MASIVO
   ============================================================ */

.delivery-confirmation-panel {
    overflow: visible;
}

.delivery-launch-form {
    margin-top: 22px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
}

.delivery-choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.delivery-choice {
    position: relative;
    min-height: 112px;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface-soft);
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease, transform .15s ease, box-shadow .15s ease;
}

.delivery-choice:hover {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
    box-shadow: var(--shadow-sm);
}

.delivery-choice.selected {
    border-color: var(--primary);
    background: var(--primary-soft);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 25%, transparent);
}

.delivery-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.delivery-choice-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--primary);
    font-weight: 900;
    font-size: 18px;
}

.delivery-choice.selected .delivery-choice-icon {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.delivery-choice-copy {
    display: grid;
    gap: 5px;
}

.delivery-choice-copy strong {
    font-size: 15px;
    color: var(--text);
}

.delivery-choice-copy small,
.delivery-schedule-fields .field > small {
    color: var(--muted);
    line-height: 1.45;
}

.delivery-schedule-fields {
    margin-top: 14px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-soft);
}

.delivery-schedule-fields[hidden] {
    display: none !important;
}

.delivery-schedule-fields .field {
    max-width: 440px;
    margin: 0;
}

.delivery-wizard-actions {
    margin-top: 20px;
}

.delivery-final-summary {
    display: grid;
    gap: 9px;
    margin: 16px 0;
}

.delivery-final-summary > div {
    display: grid;
    gap: 3px;
    padding: 11px 13px;
    border-radius: 11px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
}

.delivery-final-summary span {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 800;
}

.delivery-final-summary strong {
    color: var(--text);
    font-size: 14px;
}

.delivery-final-summary small {
    color: var(--muted);
}

.delivery-lock-warning {
    margin-top: 14px;
}

.delivery-heading-actions {
    flex-wrap: wrap;
}

.delivery-heading-actions form {
    margin: 0;
}

.delivery-progress-panel {
    margin-bottom: 18px;
}

.delivery-progress-head {
    margin-bottom: 16px;
}

.delivery-scheduled-banner {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-bottom: 17px;
    padding: 13px 15px;
    border: 1px solid color-mix(in srgb, var(--warning) 28%, var(--border));
    border-radius: 13px;
    background: var(--warning-soft);
}

.delivery-scheduled-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    flex: 0 0 38px;
    border-radius: 11px;
    background: var(--surface);
    color: var(--warning);
    font-size: 19px;
    font-weight: 900;
}

.delivery-scheduled-banner div {
    display: grid;
    gap: 3px;
}

.delivery-scheduled-banner strong {
    color: var(--text);
}

.delivery-scheduled-banner small {
    color: var(--muted);
}

.delivery-progress-track {
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface-strong);
    border: 1px solid var(--border);
}

.delivery-progress-track > span {
    display: block;
    height: 100%;
    min-width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 70%, var(--success)));
    transition: width .35s ease;
}

.delivery-progress-caption {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 9px 1px 18px;
    color: var(--muted);
    font-size: 13px;
}

.delivery-progress-caption > strong {
    color: var(--primary);
    font-size: 15px;
}

.delivery-stat-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
}

.delivery-progress-panel .delivery-stat-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.delivery-time-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.delivery-time-grid > div {
    display: grid;
    gap: 4px;
    padding: 11px 12px;
    border-radius: 11px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
}

.delivery-time-grid span {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: .04em;
}

.delivery-time-grid strong {
    color: var(--text);
    font-size: 13px;
}

.delivery-log-panel {
    margin-top: 18px;
}

.delivery-log-list {
    display: grid;
}

.delivery-log-row {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr) auto;
    align-items: start;
    gap: 12px;
    padding: 12px 2px;
    border-top: 1px solid var(--border);
}

.delivery-log-row:first-child {
    border-top: 0;
}

.delivery-log-dot {
    width: 8px;
    height: 8px;
    margin-top: 5px;
    border-radius: 999px;
    background: var(--info);
}

.delivery-log-dot.warning { background: var(--warning); }
.delivery-log-dot.error { background: var(--danger); }
.delivery-log-dot.info { background: var(--success); }

.delivery-log-row > div {
    display: grid;
    gap: 3px;
}

.delivery-log-row strong {
    font-size: 13px;
    color: var(--text);
    text-transform: capitalize;
}

.delivery-log-row small,
.delivery-log-row time {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.delivery-log-row time {
    white-space: nowrap;
}

.delivery-history-panel {
    margin-top: 16px;
}

.delivery-history-filters {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(180px, 260px) auto;
    align-items: end;
    gap: 12px;
    margin-bottom: 18px;
}

.delivery-filter-actions {
    display: flex;
    gap: 8px;
}

.delivery-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 14px;
}

.delivery-table {
    width: 100%;
    min-width: 920px;
    border-collapse: collapse;
}

.delivery-table th,
.delivery-table td {
    padding: 12px 13px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
    font-size: 13px;
}

.delivery-table th {
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.delivery-table tbody tr:last-child td {
    border-bottom: 0;
}

.delivery-error-cell {
    max-width: 360px;
    color: var(--muted);
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.pagination-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
}

.pagination-row > span {
    color: var(--muted);
    font-size: 13px;
}

.secondary-button.disabled {
    pointer-events: none;
    opacity: .45;
}

.campaign-mini-progress {
    display: grid;
    grid-template-columns: minmax(120px, 210px) auto;
    align-items: center;
    gap: 9px;
    margin-top: 10px;
}

.campaign-mini-progress > span {
    height: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface-strong);
}

.campaign-mini-progress i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
}

.campaign-mini-progress small {
    color: var(--muted);
    white-space: nowrap;
}

.campaign-scheduled-meta {
    color: var(--warning) !important;
    font-weight: 750;
}

@media (max-width: 1180px) {
    .delivery-stat-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .delivery-time-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .delivery-choice-grid,
    .delivery-progress-panel .delivery-stat-grid,
    .delivery-stat-grid,
    .delivery-time-grid {
        grid-template-columns: 1fr 1fr;
    }

    .delivery-history-filters {
        grid-template-columns: 1fr 1fr;
    }

    .delivery-filter-actions {
        grid-column: 1 / -1;
    }

    .delivery-log-row {
        grid-template-columns: 10px 1fr;
    }

    .delivery-log-row time {
        grid-column: 2;
    }
}

@media (max-width: 560px) {
    .delivery-choice-grid,
    .delivery-progress-panel .delivery-stat-grid,
    .delivery-stat-grid,
    .delivery-time-grid,
    .delivery-history-filters {
        grid-template-columns: 1fr;
    }

    .delivery-choice {
        min-height: 98px;
    }

    .delivery-progress-caption {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .delivery-filter-actions {
        grid-column: auto;
    }

    .delivery-filter-actions > * {
        flex: 1;
    }

    .campaign-mini-progress {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .campaign-mini-progress small {
        white-space: normal;
    }
}

.campaign-summary-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.log-history-filters {
    grid-template-columns: minmax(260px, 1fr) minmax(150px, 210px) minmax(130px, 170px) auto;
}

.global-log-list {
    border-top: 1px solid var(--border);
}

.global-log-row {
    padding: 14px 2px;
}

.global-log-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: 4px;
    font-size: 12px;
}

.global-log-meta a {
    color: var(--primary);
    font-weight: 750;
    text-decoration: none;
}

.global-log-meta span {
    color: var(--muted);
}

@media (max-width: 1180px) {
    .campaign-summary-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .log-history-filters {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 760px) {
    .campaign-summary-grid,
    .log-history-filters {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .campaign-summary-grid,
    .log-history-filters {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   DETALLE RÁPIDO DE DESTINATARIOS DESDE LAS TARJETAS DE ENVÍO
   ============================================================ */

.delivery-stat-action {
    width: 100%;
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    appearance: none;
    transition: border-color .16s ease, background-color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.delivery-stat-action .delivery-stat-open {
    display: block;
    margin-top: 8px;
    color: var(--primary);
    font-size: 11px;
    font-weight: 800;
    opacity: .82;
}

.delivery-stat-action:not(:disabled):hover,
.delivery-stat-action:not(:disabled):focus-visible {
    border-color: color-mix(in srgb, var(--primary) 42%, var(--border));
    background: color-mix(in srgb, var(--surface) 94%, var(--primary-soft));
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.delivery-stat-action:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--primary) 24%, transparent);
    outline-offset: 2px;
}

.delivery-stat-action:disabled {
    cursor: default;
    opacity: 1;
}

.delivery-stat-action:disabled .delivery-stat-open {
    visibility: hidden;
}

.delivery-recipients-modal {
    width: min(1080px, calc(100vw - 34px));
    padding: 0;
    overflow: hidden;
}

.delivery-recipients-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 22px 24px 18px;
    border-bottom: 1px solid var(--border);
}

.delivery-recipients-title-group {
    display: flex;
    align-items: flex-start;
    min-width: 0;
    gap: 14px;
}

.delivery-recipients-icon {
    display: grid;
    place-items: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 19px;
}

.delivery-recipients-title-group > div {
    min-width: 0;
}

.delivery-recipients-title-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.delivery-recipients-title-line h3 {
    margin: 1px 0 0;
    color: var(--text);
    font-size: 22px;
}

.delivery-recipients-title-group p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.delivery-recipients-close {
    flex: 0 0 36px;
}

.delivery-recipients-search {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto auto;
    align-items: end;
    gap: 10px;
    padding: 18px 24px 12px;
}

.delivery-recipients-search .field {
    margin: 0;
}

.delivery-recipients-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 24px 12px;
    color: var(--muted);
    font-size: 11px;
}

.delivery-recipients-loading,
.delivery-recipients-error {
    margin: 4px 24px 16px;
    padding: 13px 14px;
    border-radius: 12px;
    font-size: 12px;
}

.delivery-recipients-loading {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    background: var(--surface-soft);
    border: 1px solid var(--border);
}

.delivery-recipients-error {
    color: var(--danger);
    background: var(--danger-soft);
    border: 1px solid color-mix(in srgb, var(--danger) 22%, var(--border));
}

.delivery-recipients-loading[hidden],
.delivery-recipients-error[hidden],
.delivery-recipients-empty[hidden],
.delivery-recipients-table-wrap[hidden] {
    display: none !important;
}

.delivery-recipients-table-wrap {
    max-height: min(460px, calc(100vh - 330px));
    margin: 0 24px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 14px;
}

.delivery-recipients-table {
    width: 100%;
    min-width: 860px;
    border-collapse: collapse;
}

.delivery-recipients-table th,
.delivery-recipients-table td {
    padding: 12px 13px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
    font-size: 12px;
}

.delivery-recipients-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: var(--muted);
    background: var(--surface-soft);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .045em;
}

.delivery-recipients-table tbody tr:last-child td {
    border-bottom: 0;
}

.delivery-recipients-email-cell strong {
    color: var(--text);
    overflow-wrap: anywhere;
}

.delivery-recipients-detail-cell {
    max-width: 350px;
    color: var(--muted);
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.delivery-recipients-detail-cell span,
.delivery-recipients-detail-cell small {
    display: block;
}

.delivery-recipients-detail-cell small {
    margin-top: 3px;
    color: var(--muted);
    opacity: .8;
}

.delivery-recipients-empty {
    margin: 0 24px;
}

.delivery-recipients-pagination {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 16px 24px 22px;
}

.delivery-recipients-pagination > span {
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.delivery-recipients-pagination button:disabled {
    opacity: .42;
    cursor: default;
    pointer-events: none;
}

@media (max-width: 720px) {
    .delivery-recipients-modal {
        width: calc(100vw - 18px);
        max-height: calc(100vh - 18px);
        border-radius: 16px;
    }

    .delivery-recipients-modal-head {
        padding: 17px 16px 14px;
    }

    .delivery-recipients-icon {
        flex-basis: 40px;
        width: 40px;
        height: 40px;
    }

    .delivery-recipients-title-line h3 {
        font-size: 19px;
    }

    .delivery-recipients-search {
        grid-template-columns: 1fr 1fr;
        padding: 14px 16px 10px;
    }

    .delivery-recipients-search .field {
        grid-column: 1 / -1;
    }

    .delivery-recipients-search .primary-button,
    .delivery-recipients-search .secondary-button {
        width: 100%;
    }

    .delivery-recipients-summary {
        padding: 0 16px 10px;
    }

    .delivery-recipients-loading,
    .delivery-recipients-error,
    .delivery-recipients-empty {
        margin-left: 16px;
        margin-right: 16px;
    }

    .delivery-recipients-table-wrap {
        max-height: calc(100vh - 345px);
        margin: 0 16px;
    }

    .delivery-recipients-pagination {
        grid-template-columns: 1fr 1fr;
        padding: 14px 16px 17px;
    }

    .delivery-recipients-pagination > span {
        grid-column: 1 / -1;
        grid-row: 1;
    }
}

/* ============================================================
   FASE 6.1 - GESTIÓN DE PLANTILLAS
   ============================================================ */

.paired-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 10px;
}

.paired-actions > a,
.paired-actions > button,
.paired-actions > form,
.paired-actions > form > button {
    box-sizing: border-box;
    min-width: 0;
    width: 100%;
}

.paired-actions > a,
.paired-actions > button,
.paired-actions > form > button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-top: 0;
    padding-bottom: 0;
    line-height: 1.1;
    text-align: center;
}

.compact-paired-actions > a,
.compact-paired-actions > button,
.compact-paired-actions > form > button {
    min-height: 40px;
}

.modal-paired-actions {
    width: min(100%, 420px);
    margin-left: auto;
    margin-right: auto;
}

.template-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.template-filter-panel {
    margin-bottom: 16px;
}

.template-filter-form {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(170px, 220px) minmax(220px, 260px);
    align-items: end;
    gap: 12px;
}

.template-filter-actions {
    align-self: end;
}

.template-list {
    display: grid;
    gap: 12px;
}

.template-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    padding: 18px;
}

.template-card.is-disabled {
    opacity: .78;
}

.template-card-main {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    align-items: center;
    gap: 13px;
    min-width: 0;
}

.template-card-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 20px;
    font-weight: 800;
}

.template-card-copy {
    min-width: 0;
}

.template-card-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.template-card-title-row h3 {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 16px;
}

.template-subject {
    margin: 5px 0 0;
    overflow: hidden;
    color: var(--text-soft);
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
}

.template-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-top: 8px;
    color: var(--muted);
    font-size: 10px;
}

.template-meta strong {
    color: var(--text-soft);
}

.template-card-actions {
    display: grid;
    grid-template-columns: repeat(5, minmax(92px, 1fr));
    align-items: stretch;
    gap: 8px;
}

.template-card-actions > a,
.template-card-actions > button,
.template-card-actions > form,
.template-card-actions > form > button {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
}

.template-card-actions > a,
.template-card-actions > button,
.template-card-actions > form > button {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 11px;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
}

.template-card-actions > .danger-ghost-button {
    border: 1px solid color-mix(in srgb, var(--danger) 22%, transparent);
    border-radius: 11px;
}

.template-pagination {
    display: grid;
    grid-template-columns: 120px minmax(160px, auto) 120px;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 18px;
}

.template-pagination > span {
    color: var(--muted);
    font-size: 11px;
    text-align: center;
}

.template-pagination .disabled {
    opacity: .45;
    pointer-events: none;
}

.template-empty-panel {
    min-height: 280px;
    display: grid;
    place-items: center;
}

.compact-section-heading {
    align-items: center;
}

.template-create-panel {
    max-width: 880px;
}

.template-create-form {
    display: grid;
    gap: 18px;
}

.template-create-fields,
.template-details-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.template-form-actions {
    width: min(100%, 420px);
    margin-left: auto;
}

.template-form-status {
    margin: 0 0 16px;
}

.template-details-panel {
    margin-bottom: 18px;
}

.template-details-grid {
    align-items: end;
    margin-top: 16px;
}

.template-active-control {
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface-soft);
    cursor: pointer;
}

.template-active-control input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.template-active-switch {
    width: 40px;
    height: 22px;
    flex: 0 0 auto;
    position: relative;
    border-radius: 999px;
    background: var(--border-strong);
    transition: background .15s ease;
}

.template-active-switch::after {
    content: '';
    width: 16px;
    height: 16px;
    position: absolute;
    left: 3px;
    top: 3px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
    transition: transform .15s ease;
}

.template-active-control input:checked + .template-active-switch {
    background: var(--primary);
}

.template-active-control input:checked + .template-active-switch::after {
    transform: translateX(18px);
}

.template-active-control > span:last-child {
    min-width: 0;
}

.template-active-control strong,
.template-active-control small {
    display: block;
}

.template-active-control strong {
    font-size: 11px;
}

.template-active-control small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 9px;
    line-height: 1.35;
}

.template-editor-workspace {
    margin-bottom: 18px;
}

.template-image-summary strong {
    display: block;
    margin-top: 12px;
    color: var(--primary);
    font-size: 32px;
}

.template-image-summary p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.5;
}

.template-editor-savebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
}

.template-editor-savebar > div:first-child strong,
.template-editor-savebar > div:first-child span {
    display: block;
}

.template-editor-savebar > div:first-child strong {
    font-size: 11px;
}

.template-editor-savebar > div:first-child span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 9px;
}

.template-save-actions {
    width: min(100%, 380px);
    flex: 0 0 380px;
}

.template-heading-actions {
    width: min(100%, 300px);
}

.template-preview-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(290px, .55fr);
    gap: 18px;
    align-items: start;
}

.template-preview-sidebar {
    position: sticky;
    top: 92px;
}

.template-preview-duplicate {
    margin-top: 14px;
}

.template-preview-layout .preview-device-switch button.active {
    color: #fff;
    border-color: var(--primary);
    background: var(--primary);
}

[data-template-modal-backdrop][hidden],
[data-template-editor-backdrop][hidden],
#template-delete-modal[hidden],
#template-unsaved-preview-modal[hidden],
#template-link-modal[hidden],
#template-image-modal[hidden],
#template-cta-modal[hidden] {
    display: none !important;
}

@media (max-width: 1180px) {
    .template-card {
        grid-template-columns: 1fr;
    }

    .template-card-actions {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .template-filter-form {
        grid-template-columns: 1fr 200px;
    }

    .template-filter-actions {
        grid-column: 1 / -1;
        width: min(100%, 360px);
        justify-self: end;
    }

    .template-preview-layout {
        grid-template-columns: 1fr;
    }

    .template-preview-sidebar {
        position: static;
    }
}

@media (max-width: 760px) {
    .template-summary-grid,
    .template-create-fields,
    .template-details-grid {
        grid-template-columns: 1fr;
    }

    .template-card-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .template-card-actions > :last-child {
        grid-column: 1 / -1;
    }

    .template-editor-savebar {
        align-items: stretch;
        flex-direction: column;
    }

    .template-save-actions,
    .template-heading-actions,
    .template-form-actions {
        width: 100%;
        flex-basis: auto;
    }
}

@media (max-width: 560px) {
    .template-filter-form {
        grid-template-columns: 1fr;
    }

    .template-filter-actions {
        grid-column: auto;
        width: 100%;
    }

    .template-card-main {
        grid-template-columns: 38px minmax(0, 1fr);
        align-items: start;
    }

    .template-card-icon {
        width: 38px;
        height: 38px;
        border-radius: 11px;
        font-size: 17px;
    }

    .template-card-title-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .template-card-title-row h3,
    .template-subject {
        white-space: normal;
    }

    .template-card-actions,
    .paired-actions {
        grid-template-columns: 1fr;
    }

    .template-card-actions > :last-child {
        grid-column: auto;
    }

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

    .template-pagination > span {
        grid-column: 1 / -1;
        grid-row: 1;
    }
}

/* ============================================================
   FASE 6.1.1 · Vista previa de plantilla sin guardar
   ============================================================ */

.template-preview-modal {
    width: min(980px, calc(100vw - 32px));
    padding: 18px;
}

.template-preview-current-subject {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.4;
}

.template-preview-modal-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
}

.template-preview-modal-toolbar p {
    margin: 0;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.5;
}

.template-unsaved-preview-shell {
    display: flex;
    justify-content: center;
    overflow: auto;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #e9ebe6;
}

.template-unsaved-preview-shell iframe {
    width: 100%;
    height: 610px;
    border: 0;
    border-radius: 8px;
    background: #fff;
    transition: width .2s ease;
}

.template-unsaved-preview-shell.mobile iframe {
    width: 375px;
    max-width: 100%;
}

.template-preview-modal-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 14px;
}

.template-preview-modal-actions .primary-button {
    min-width: 180px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

#template-unsaved-preview-modal[hidden] {
    display: none !important;
}

@media (max-width: 760px) {
    .template-preview-modal-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .template-preview-modal-toolbar .preview-device-switch {
        align-self: flex-start;
    }

    .template-unsaved-preview-shell {
        padding: 8px;
    }

    .template-unsaved-preview-shell iframe {
        height: 520px;
    }

    .template-preview-modal-actions .primary-button {
        width: 100%;
    }
}

/* ============================================================
   FASE 6.1.2 · Envío de prueba desde plantillas
   ============================================================ */

.template-heading-actions {
    width: min(100%, 500px);
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.template-heading-actions > a,
.template-heading-actions > button {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-top: 0;
    padding-bottom: 0;
    line-height: 1.1;
    text-align: center;
}

.template-heading-actions > button:disabled {
    cursor: not-allowed;
    opacity: .55;
}

.template-test-modal {
    width: min(620px, calc(100vw - 32px));
}

#template-test-modal[hidden] {
    display: none !important;
}

#template-test-modal .modal-actions > button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-top: 0;
    padding-bottom: 0;
    line-height: 1.1;
    text-align: center;
}

@media (max-width: 760px) {
    .template-heading-actions {
        width: 100%;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .template-heading-actions {
        grid-template-columns: 1fr;
    }

    #template-test-modal .modal-paired-actions {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   FASE 6.2 · Plantillas dentro del asistente de campañas
   ============================================================ */

.campaign-template-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-top: 16px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-soft);
}

.campaign-template-bar-copy {
    min-width: 0;
}

.campaign-template-bar-copy > strong,
.campaign-template-bar-copy > small {
    display: block;
}

.campaign-template-bar-copy > strong {
    margin-top: 3px;
    font-size: 12px;
    color: var(--text);
}

.campaign-template-bar-copy > small {
    margin-top: 4px;
    max-width: 720px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.5;
}

.campaign-template-bar-actions {
    width: min(100%, 360px);
    flex: 0 0 360px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.campaign-template-bar-actions > button {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-top: 0;
    padding-bottom: 0;
    line-height: 1.1;
    text-align: center;
}

.campaign-template-picker-modal,
.campaign-template-preview-modal {
    width: min(920px, calc(100vw - 32px));
}

.campaign-template-search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}

.campaign-template-search-shell {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: center;
}

.campaign-template-search-shell > span {
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 17px;
}

.campaign-template-list-summary {
    margin-top: 10px;
    color: var(--muted);
    font-size: 10px;
}

.campaign-template-list-area {
    min-height: 300px;
    margin-top: 12px;
}

.campaign-template-loading {
    min-height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--muted);
    font-size: 11px;
}

.campaign-template-list {
    display: grid;
    gap: 9px;
}

.campaign-template-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 250px;
    align-items: center;
    gap: 14px;
    min-height: 84px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.campaign-template-item-copy {
    min-width: 0;
}

.campaign-template-item-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.campaign-template-item-heading strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
}

.campaign-template-item-subject,
.campaign-template-item-copy small {
    display: block;
}

.campaign-template-item-subject {
    margin-top: 5px;
    overflow: hidden;
    color: var(--text-soft);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.campaign-template-item-copy small {
    margin-top: 5px;
    color: var(--muted);
    font-size: 9px;
}

.campaign-template-item-actions {
    width: 250px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.campaign-template-item-actions > button {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-top: 0;
    padding-bottom: 0;
    line-height: 1.1;
    text-align: center;
}

.campaign-template-empty {
    min-height: 260px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 5px;
    color: var(--muted);
    text-align: center;
}

.campaign-template-empty .empty-icon {
    margin-bottom: 4px;
}

.campaign-template-empty strong {
    color: var(--text);
    font-size: 12px;
}

.campaign-template-empty span {
    font-size: 10px;
}

.campaign-template-pagination {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr) 130px;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}

.campaign-template-pagination > span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    text-align: center;
}

.campaign-template-modal-actions {
    justify-content: flex-end;
}

.campaign-template-modal-actions > button {
    min-width: 150px;
}

.campaign-template-preview-subject {
    display: grid;
    gap: 3px;
    margin: 4px 0 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-soft);
}

.campaign-template-preview-subject span {
    color: var(--muted);
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.campaign-template-preview-subject strong {
    font-size: 11px;
}

.campaign-template-preview-shell {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: #e9ebe6;
}

.campaign-template-preview-shell iframe {
    width: 100%;
    height: 560px;
    border: 0;
    border-radius: 8px;
    background: #fff;
}

.campaign-template-preview-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.campaign-template-preview-actions > button,
.paired-modal-actions > button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-top: 0;
    padding-bottom: 0;
    line-height: 1.1;
    text-align: center;
}

.paired-modal-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.campaign-template-picker-modal[hidden],
.campaign-template-preview-modal[hidden],
#campaign-template-confirm-modal[hidden],
#campaign-save-template-modal[hidden],
.campaign-template-loading[hidden],
.campaign-template-list[hidden],
.campaign-template-empty[hidden],
.campaign-template-pagination[hidden],
[data-campaign-template-clear][hidden] {
    display: none !important;
}

@media (max-width: 900px) {
    .campaign-template-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .campaign-template-bar-actions {
        width: 100%;
        flex-basis: auto;
    }

    .campaign-template-item {
        grid-template-columns: 1fr;
    }

    .campaign-template-item-actions {
        width: 100%;
    }
}

@media (max-width: 560px) {
    .campaign-template-bar-actions,
    .campaign-template-item-actions,
    .campaign-template-preview-actions,
    .paired-modal-actions {
        grid-template-columns: 1fr;
    }

    .campaign-template-search-row {
        grid-template-columns: 1fr;
    }

    .campaign-template-search-row .text-button {
        justify-self: start;
    }

    .campaign-template-pagination {
        grid-template-columns: 1fr 1fr;
    }

    .campaign-template-pagination > span {
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .campaign-template-preview-shell {
        padding: 7px;
    }

    .campaign-template-preview-shell iframe {
        height: 500px;
    }
}

/* ============================================================
   CONSISTENCIA GLOBAL DE BOTONES Y ACCIONES
   - Los enlaces que visualmente son botones no se subrayan.
   - Botones y enlaces-botón comparten alineación y métricas.
   - Los enlaces de texto normales mantienen sus estilos propios.
   ============================================================ */

.primary-button,
.secondary-button,
.ghost-button,
.danger-ghost-button,
.danger-button,
.link-button {
    box-sizing: border-box;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    margin-bottom: 0;
    font-family: inherit;
    line-height: 1;
    text-align: center;
    vertical-align: middle;
    text-decoration: none;
}

.text-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    font-family: inherit;
    line-height: 1.15;
    text-align: center;
    vertical-align: middle;
    text-decoration: none;
}

a.primary-button,
a.secondary-button,
a.ghost-button,
a.danger-ghost-button,
a.danger-button,
a.link-button,
a.text-button,
a.primary-button:hover,
a.secondary-button:hover,
a.ghost-button:hover,
a.danger-ghost-button:hover,
a.danger-button:hover,
a.link-button:hover,
a.text-button:hover,
a.primary-button:focus,
a.secondary-button:focus,
a.ghost-button:focus,
a.danger-ghost-button:focus,
a.danger-button:focus,
a.link-button:focus,
a.text-button:focus,
a.primary-button:active,
a.secondary-button:active,
a.ghost-button:active,
a.danger-ghost-button:active,
a.danger-button:active,
a.link-button:active,
a.text-button:active,
a.primary-button:visited,
a.secondary-button:visited,
a.ghost-button:visited,
a.danger-ghost-button:visited,
a.danger-button:visited,
a.link-button:visited,
a.text-button:visited {
    text-decoration: none !important;
}

.primary-button.small,
.secondary-button.small,
.ghost-button.small,
.danger-ghost-button.small,
.danger-button.small {
    min-height: 38px;
    padding-top: 0;
    padding-bottom: 0;
    line-height: 1;
}

.modal-actions > form,
.wizard-actions > form,
.wizard-actions-right > form,
.smtp-actions > form,
.campaign-card-actions > form,
.template-card-actions > form,
.recipient-manager-actions > form,
.delivery-heading-actions > form {
    margin: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
}

.modal-actions > .primary-button,
.modal-actions > .secondary-button,
.modal-actions > .danger-button,
.modal-actions > .danger-ghost-button,
.modal-actions > form > .primary-button,
.modal-actions > form > .secondary-button,
.modal-actions > form > .danger-button,
.modal-actions > form > .danger-ghost-button {
    min-width: 112px;
}

.delivery-heading-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.delivery-heading-actions > .primary-button,
.delivery-heading-actions > .secondary-button,
.delivery-heading-actions > .danger-ghost-button,
.delivery-heading-actions > form > .primary-button,
.delivery-heading-actions > form > .secondary-button,
.delivery-heading-actions > form > .danger-ghost-button {
    height: 42px;
    min-height: 42px;
    padding: 0 16px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

@media (max-width: 620px) {
    .delivery-heading-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .delivery-heading-actions > *,
    .delivery-heading-actions > form,
    .delivery-heading-actions > form > button,
    .delivery-heading-actions > form > a {
        width: 100%;
    }
}

/* ============================================================
   VISIBILIDAD DEL ICONO NATIVO DE FECHA/HORA
   Chrome/Chromium puede heredar el tema oscuro del navegador
   aunque la aplicación esté en modo claro.
   ============================================================ */

input[type="date"],
input[type="time"],
input[type="datetime-local"] {
    color-scheme: light;
}

html[data-theme="dark"] input[type="date"],
html[data-theme="dark"] input[type="time"],
html[data-theme="dark"] input[type="datetime-local"] {
    color-scheme: dark;
}

/* ============================================================
   DASHBOARD LIMPIO
   Se elimina contenido heredado de primeras fases y se deja
   la actividad reciente como panel principal a ancho completo.
   ============================================================ */

.dashboard-grid.dashboard-grid-single {
    grid-template-columns: minmax(0, 1fr);
}


/* =========================================================
   FASE 6.3.1 · MULTICUENTA · GESTIÓN DE GRUPOS SMTP
   ========================================================= */
.section-heading-actions {
    display:flex;
    align-items:center;
    justify-content:flex-end;
    gap:10px;
    flex-wrap:wrap;
}

.smtp-group-badge {
    display:inline-flex;
    align-items:center;
    gap:5px;
    width:max-content;
    max-width:100%;
    margin-top:7px;
    padding:5px 9px;
    border:1px solid rgba(23,100,63,.18);
    border-radius:999px;
    color:var(--primary);
    background:var(--primary-soft);
    font-size:10px;
    font-weight:800;
}

.multicuenta-summary-grid {
    margin-bottom:18px;
}

.phase-note {
    display:flex;
    align-items:flex-start;
    gap:12px;
    margin:0 0 20px;
    padding:14px 16px;
    border:1px solid rgba(212,167,44,.28);
    border-radius:14px;
    background:rgba(212,167,44,.08);
}

.phase-note-icon {
    flex:0 0 30px;
    width:30px;
    height:30px;
    display:grid;
    place-items:center;
    border-radius:50%;
    color:#fff;
    background:#D4A72C;
    font-size:12px;
    font-weight:900;
}

.phase-note strong,
.phase-note p {
    display:block;
}

.phase-note strong {
    color:var(--text);
    font-size:12px;
}

.phase-note p {
    margin:3px 0 0;
    color:var(--muted);
    font-size:10px;
    line-height:1.5;
}

.multicuenta-card .smtp-card-footer {
    justify-content:flex-start;
}

.multicuenta-common-panel,
.multicuenta-members-panel,
.multicuenta-link-panel {
    margin-top:18px;
}

.multicuenta-common-grid,
.inherited-settings-grid {
    display:grid;
    grid-template-columns:repeat(3, minmax(0,1fr));
    gap:12px;
    margin-top:15px;
}

.multicuenta-common-grid > div,
.inherited-settings-grid > div {
    min-width:0;
    padding:12px 13px;
    border:1px solid var(--border);
    border-radius:12px;
    background:var(--surface-soft);
}

.multicuenta-common-grid span,
.inherited-settings-grid span {
    display:block;
    margin-bottom:4px;
    color:var(--muted);
    font-size:9px;
    font-weight:800;
    text-transform:uppercase;
    letter-spacing:.04em;
}

.multicuenta-common-grid strong,
.inherited-settings-grid strong {
    display:block;
    overflow:hidden;
    color:var(--text);
    font-size:11px;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.panel-copy,
.muted-copy {
    margin:5px 0 0;
    color:var(--muted);
    font-size:10px;
    line-height:1.5;
}

.compact-empty-state {
    padding:24px 10px;
}

.multicuenta-account-list {
    display:grid;
    margin-top:12px;
    border-top:1px solid var(--border);
}

.multicuenta-account-row {
    display:grid;
    grid-template-columns:minmax(270px,1.25fr) minmax(250px,.8fr) auto;
    align-items:center;
    gap:18px;
    padding:15px 0;
    border-bottom:1px solid var(--border);
}

.multicuenta-account-row.is-disabled {
    opacity:.65;
}

.multicuenta-account-main {
    min-width:0;
    display:flex;
    align-items:center;
    gap:11px;
}

.smtp-provider-icon.small-icon {
    flex:0 0 36px;
    width:36px;
    height:36px;
    font-size:14px;
}

.multicuenta-account-main > div:last-child {
    min-width:0;
}

.multicuenta-account-title {
    display:flex;
    align-items:center;
    gap:8px;
    flex-wrap:wrap;
}

.multicuenta-account-title > strong {
    color:var(--text);
    font-size:12px;
}

.multicuenta-account-main span:not(.status-pill),
.multicuenta-account-main small {
    display:block;
    overflow:hidden;
    margin-top:3px;
    color:var(--muted);
    font-size:10px;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.multicuenta-account-metrics {
    display:grid;
    grid-template-columns:repeat(3,minmax(70px,1fr));
    gap:8px;
}

.multicuenta-account-metrics > div {
    padding:9px 10px;
    border-radius:10px;
    background:var(--surface-soft);
}

.multicuenta-account-metrics span,
.multicuenta-account-metrics strong {
    display:block;
}

.multicuenta-account-metrics span {
    color:var(--muted);
    font-size:8px;
    font-weight:800;
    text-transform:uppercase;
}

.multicuenta-account-metrics strong {
    margin-top:3px;
    color:var(--text);
    font-size:10px;
}

.multicuenta-account-actions {
    display:flex;
    align-items:center;
    justify-content:flex-end;
    gap:7px;
    flex-wrap:wrap;
}

.multicuenta-account-actions form {
    margin:0;
}

.multicuenta-account-actions .secondary-button,
.multicuenta-account-actions .ghost-button,
.multicuenta-account-actions .danger-ghost-button {
    min-height:36px;
    padding:0 11px;
    font-size:10px;
}

.multicuenta-link-form {
    display:grid;
    grid-template-columns:minmax(280px,1fr) auto;
    align-items:end;
    gap:12px;
    margin-top:14px;
}

.multicuenta-link-form .field {
    margin:0;
}

.multicuenta-link-help {
    display:block;
    margin-top:9px;
}

@media (max-width:1100px) {
    .multicuenta-account-row {
        grid-template-columns:1fr;
        gap:12px;
    }

    .multicuenta-account-actions {
        justify-content:flex-start;
    }
}

@media (max-width:760px) {
    .section-heading-actions {
        width:100%;
        justify-content:stretch;
    }

    .section-heading-actions > * {
        flex:1 1 180px;
        justify-content:center;
    }

    .multicuenta-common-grid,
    .inherited-settings-grid {
        grid-template-columns:1fr;
    }

    .multicuenta-account-metrics {
        grid-template-columns:repeat(3,minmax(0,1fr));
    }

    .multicuenta-link-form {
        grid-template-columns:1fr;
    }

    .multicuenta-link-form .secondary-button {
        width:100%;
    }
}

/* =========================================================
   FASE 6.3.2 · CAMPAÑAS MULTICUENTA
   ========================================================= */
.campaign-smtp-method-heading {
    margin:18px 0 10px;
}

.campaign-smtp-method-heading:first-of-type {
    margin-top:4px;
}

.campaign-smtp-method-heading.with-separator {
    margin-top:24px;
    padding-top:20px;
    border-top:1px solid var(--border);
}

.campaign-smtp-method-heading h4 {
    margin:3px 0 0;
    color:var(--text);
    font-size:13px;
}

.smtp-choice-multicuenta {
    border-color:rgba(23,100,63,.26);
    background:linear-gradient(180deg, rgba(23,100,63,.055), rgba(23,100,63,.018));
}

.smtp-choice-multicuenta.selected {
    border-color:var(--success);
    box-shadow:0 0 0 2px rgba(23,100,63,.08);
}

.campaign-multicuenta-status {
    margin-top:14px;
}

@media (max-width:760px) {
    .campaign-smtp-method-heading.with-separator {
        margin-top:18px;
        padding-top:16px;
    }
}

/* ================================================================
   Fase 6.3.4 · Revisión y reenvío de errores postcampaña
   ================================================================ */
.error-review-modal {
    width: min(1180px, calc(100vw - 36px));
    max-height: min(88vh, 900px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.error-review-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 24px 18px;
    border-bottom: 1px solid var(--border-color, #dfe7e2);
}

.error-review-title-group {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    min-width: 0;
}

.error-review-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(194, 48, 48, .12);
    color: #b42318;
    font-weight: 800;
    font-size: 20px;
    flex: 0 0 auto;
}

.error-review-head h3 {
    margin: 0;
    font-size: 1.28rem;
}

.error-review-head p {
    margin: 5px 0 0;
    color: var(--muted-text, #63736a);
    font-size: .91rem;
}

.error-review-feedback {
    margin: 14px 24px 0;
    padding: 11px 13px;
    border-radius: 10px;
    font-size: .9rem;
    line-height: 1.35;
}

.error-review-feedback.info {
    background: rgba(28, 101, 163, .08);
    border: 1px solid rgba(28, 101, 163, .2);
    color: #185d98;
}

.error-review-feedback.success {
    background: rgba(23, 100, 63, .08);
    border: 1px solid rgba(23, 100, 63, .22);
    color: #17643f;
}

.error-review-feedback.error {
    background: rgba(180, 35, 24, .08);
    border: 1px solid rgba(180, 35, 24, .2);
    color: #b42318;
}

.error-review-modal .delivery-recipients-loading {
    margin: 16px 24px;
}

.error-review-table-wrap {
    margin: 14px 24px 0;
    overflow: auto;
    border: 1px solid var(--border-color, #dfe7e2);
    border-radius: 12px;
    flex: 1 1 auto;
    min-height: 0;
}

.error-review-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    background: var(--panel-bg, #fff);
}

.error-review-table th,
.error-review-table td {
    padding: 12px 11px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--border-color, #e4ebe7);
}

.error-review-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--soft-bg, #f6f8f7);
    color: var(--muted-text, #58675f);
    font-size: .78rem;
    font-weight: 700;
}

.error-review-table tr:last-child td {
    border-bottom: 0;
}

.error-review-table th:nth-child(1),
.error-review-table td:nth-child(1) {
    width: 44px;
}

.error-review-table th:nth-child(2),
.error-review-table td:nth-child(2) {
    width: 20%;
}

.error-review-table th:nth-child(3),
.error-review-table td:nth-child(3) {
    width: 23%;
}

.error-review-table th:nth-child(4),
.error-review-table td:nth-child(4) {
    width: 28%;
}

.error-review-table th:nth-child(5),
.error-review-table td:nth-child(5) {
    width: 225px;
}

.error-review-check-col {
    text-align: center !important;
}

.error-review-check-col input,
.error-review-select-all-label input {
    width: 17px;
    height: 17px;
    accent-color: #17643f;
    cursor: pointer;
}

.error-review-email-cell,
.error-review-reason-cell,
.error-review-correction-cell {
    overflow-wrap: anywhere;
}

.error-review-email-cell strong,
.error-review-reason-cell strong,
.error-review-correction-cell > strong {
    display: block;
    margin-bottom: 6px;
}

.error-review-email-cell .status-pill {
    margin-bottom: 5px;
}

.error-review-email-cell small,
.error-review-reason-cell small,
.error-review-correction-cell small {
    display: block;
    color: var(--muted-text, #64736b);
    font-size: .78rem;
    line-height: 1.35;
}

.error-review-correction-cell input[type="email"] {
    width: 100%;
    min-height: 38px;
    border: 1px solid var(--border-color, #ccd8d1);
    border-radius: 8px;
    padding: 8px 10px;
    background: var(--input-bg, #fff);
    color: var(--text-color, #1b2b23);
    outline: none;
}

.error-review-correction-cell input[type="email"]:focus {
    border-color: #17643f;
    box-shadow: 0 0 0 3px rgba(23, 100, 63, .10);
}

.error-review-suggestion {
    margin-top: 5px;
    color: #17643f !important;
    font-weight: 600;
}

.error-review-row-actions {
    display: flex;
    gap: 7px;
    align-items: center;
    flex-wrap: wrap;
}

.error-review-row-actions .primary-button,
.error-review-row-actions .secondary-button {
    min-height: 36px;
    white-space: nowrap;
    flex: 1 1 auto;
}

.error-review-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 14px 24px 0;
}

.error-review-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 24px 12px;
}

.error-review-select-all-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
}

.error-review-bulk-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.error-review-bulk-actions > button {
    min-width: 190px;
}

.error-review-info {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 24px 22px;
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(28, 101, 163, .07);
    border: 1px solid rgba(28, 101, 163, .18);
    color: var(--text-color, #26372e);
}

.error-review-info > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #1c65a3;
    color: #fff;
    font-size: .75rem;
    font-weight: 800;
    flex: 0 0 auto;
}

.error-review-info p {
    margin: 0;
    font-size: .84rem;
    line-height: 1.45;
}

.error-review-modal .empty-state {
    margin: 18px 24px 0;
}

@media (max-width: 980px) {
    .error-review-modal {
        width: min(96vw, 760px);
        max-height: 92vh;
    }

    .error-review-table {
        min-width: 930px;
    }

    .error-review-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .error-review-bulk-actions {
        width: 100%;
    }

    .error-review-bulk-actions > button {
        flex: 1 1 0;
        min-width: 0;
    }
}

@media (max-width: 620px) {
    .error-review-modal {
        width: calc(100vw - 18px);
        max-height: 94vh;
    }

    .error-review-head {
        padding: 16px 16px 14px;
    }

    .error-review-feedback,
    .error-review-table-wrap,
    .error-review-modal .delivery-recipients-loading,
    .error-review-modal .empty-state {
        margin-left: 16px;
        margin-right: 16px;
    }

    .error-review-actions {
        padding: 16px 16px 10px;
    }

    .error-review-info {
        margin: 0 16px 16px;
    }

    .error-review-bulk-actions {
        flex-direction: column;
    }

    .error-review-bulk-actions > button {
        width: 100%;
    }
}

/* ================================================================
   Fase 6.3.4.1 · Corrección visibilidad modal revisión de errores
   Los elementos con hidden no deben interceptar clics ni mostrarse.
   ================================================================ */
[data-error-review-backdrop][hidden],
[data-error-review-modal][hidden],
[data-error-review-feedback][hidden],
[data-error-review-loading][hidden],
[data-error-review-empty][hidden],
[data-error-review-pagination][hidden] {
    display: none !important;
}


/* Integración progresiva del nuevo compositor en Campañas */
.campaign-composer-primary{
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    align-items:center;
    gap:28px;
    margin-bottom:16px;
    padding:24px 26px;
    border:1px solid rgba(23,100,63,.22);
    background:linear-gradient(135deg,var(--surface) 0%,var(--primary-soft) 100%);
}
.campaign-composer-primary-copy{min-width:0}.campaign-composer-primary-copy h3{margin:4px 0 7px;font-size:20px}.campaign-composer-primary-copy p{max-width:760px;margin:0;color:var(--muted);font-size:11px;line-height:1.6}.campaign-composer-status{display:flex;align-items:center;gap:7px;margin-top:14px;color:var(--text-soft);font-size:10px}.campaign-composer-status-dot{width:9px;height:9px;flex:0 0 auto;border-radius:50%;background:var(--border-strong);box-shadow:0 0 0 4px rgba(120,130,124,.08)}.campaign-composer-status-dot.is-ready{background:var(--success);box-shadow:0 0 0 4px rgba(23,100,63,.1)}.campaign-composer-primary-actions{display:grid;justify-items:stretch;justify-self:end;gap:10px;width:250px;max-width:100%}.campaign-composer-primary-actions .primary-button,.campaign-composer-primary-actions .secondary-button{width:100%;min-width:0;justify-content:center}.campaign-composer-primary-actions small{color:var(--muted);font-size:9px;line-height:1.45;text-align:center}.campaign-composer-open{min-width:0;justify-content:center}.campaign-legacy-backup{margin-top:14px;border:1px solid var(--border);border-radius:14px;background:var(--surface);overflow:hidden}.campaign-legacy-backup>summary{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:14px 17px;color:var(--text-soft);background:var(--surface-soft);cursor:pointer;list-style:none}.campaign-legacy-backup>summary::-webkit-details-marker{display:none}.campaign-legacy-backup>summary:after{content:'+';width:26px;height:26px;display:grid;place-items:center;flex:0 0 auto;border:1px solid var(--border);border-radius:8px;background:var(--surface);font-size:16px;font-weight:800}.campaign-legacy-backup[open]>summary:after{content:'−'}.campaign-legacy-backup>summary span{font-size:11px;font-weight:900}.campaign-legacy-backup>summary small{margin-left:auto;color:var(--muted);font-size:9px;font-weight:600}.campaign-legacy-backup-body{padding:16px}.campaign-legacy-backup .editor-workspace{margin:0}.campaign-legacy-backup .editor-section-heading h3:after{content:' · clásico';color:var(--muted);font-weight:700}
@media(max-width:900px){.campaign-composer-primary{grid-template-columns:1fr;gap:16px}.campaign-composer-primary-actions{justify-items:stretch;justify-self:end;width:250px;max-width:100%}.campaign-composer-primary-actions small{text-align:center}.campaign-composer-open{width:100%}.campaign-legacy-backup>summary{align-items:flex-start;flex-wrap:wrap}.campaign-legacy-backup>summary small{width:100%;margin-left:0;order:3}}

/* Integración compositor · adjuntos visibles junto al nuevo editor */
.campaign-composer-attachments{margin-top:14px;padding:18px}.campaign-composer-attachments .compact-panel-header{align-items:flex-start}.campaign-composer-attachments .compact-panel-header p{max-width:760px;margin:5px 0 0;color:var(--muted);font-size:10px;line-height:1.5}.campaign-composer-attachments-grid{display:grid;grid-template-columns:minmax(260px,.7fr) minmax(0,1.3fr);gap:20px;align-items:start}.campaign-composer-attachments .attachment-dropzone{margin-top:0}.campaign-composer-attachments .attachment-list{margin-top:0}
@media(max-width:900px){.campaign-composer-attachments-grid{grid-template-columns:1fr}.campaign-composer-attachments .attachment-total{margin-left:auto}}


/* Integración compositor · adjuntos compactos, vista previa y navegación */
.campaign-composer-attachments{margin-top:12px;padding:14px 16px}
.campaign-attachments-toolbar{display:flex;align-items:center;justify-content:space-between;gap:18px}.campaign-attachments-toolbar .campaign-attachment-add,.campaign-composer-next-actions>.primary-button{width:250px;min-width:250px;min-height:42px;justify-content:center}.campaign-attachment-add.secondary-button.small{min-height:42px}.campaign-composer-next-actions{align-items:center}
.campaign-attachments-heading{min-width:0}
.campaign-attachments-title-line{display:flex;align-items:baseline;gap:10px;margin-top:2px}
.campaign-attachments-title-line h3{margin:0;font-size:13px}
.campaign-attachments-heading p{margin:3px 0 0;color:var(--muted);font-size:9px}
.campaign-attachment-add{flex:0 0 auto;cursor:pointer}
.campaign-attachment-add input{display:none}
.campaign-composer-attachment-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px 12px;margin-top:10px}
.campaign-composer-attachment-list .attachment-row{grid-template-columns:26px minmax(0,1fr) 28px 28px;gap:7px;min-height:42px;padding:2px 0;border-bottom:1px solid var(--border)}
.campaign-composer-attachment-list .attachment-row:not(:has(.attachment-preview-button)){grid-template-columns:26px minmax(0,1fr) 28px}
.campaign-composer-attachment-list .attachment-file-icon{width:24px;height:24px;border-radius:7px;font-size:10px}
.campaign-composer-attachment-list .attachment-copy strong,.attachment-preview-link{font-size:10px}
.attachment-preview-link{display:block;width:100%;padding:0;border:0;color:var(--text);background:transparent;font-weight:800;text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:pointer}
.attachment-preview-link:hover{color:var(--primary);text-decoration:underline}
.attachment-preview-button{width:26px;height:26px;border:1px solid var(--border);border-radius:7px;color:var(--primary);background:var(--surface);font-size:13px;cursor:pointer}
.attachment-preview-button:hover{border-color:var(--primary);background:var(--primary-soft)}
.campaign-composer-attachment-list .attachment-delete{width:26px;height:26px;font-size:16px}
.campaign-composer-attachments .attachment-note{margin:8px 0 0}
.campaign-composer-next-actions{margin-top:12px}
.campaign-attachment-preview-modal{width:min(1000px,calc(100vw - 34px));max-width:1000px}
.campaign-attachment-preview-body{height:min(72vh,760px);margin:0 18px 4px;border:1px solid var(--border);border-radius:12px;overflow:hidden;background:#f2f3f0}
.campaign-attachment-preview-body iframe{width:100%;height:100%;border:0;background:#fff}
.campaign-attachment-preview-body img{display:block;width:100%;height:100%;max-width:100%;max-height:100%;object-fit:contain;object-position:center;background:#f2f3f0}
.campaign-attachment-preview-body img[hidden],.campaign-attachment-preview-body iframe[hidden]{display:none!important}
@media(max-width:900px){.campaign-attachments-toolbar{align-items:flex-start}.campaign-composer-attachment-list{grid-template-columns:1fr}.campaign-attachment-preview-body{height:68vh}}
@media(max-width:620px){.campaign-composer-primary-actions{justify-self:stretch;width:100%}.campaign-attachments-toolbar{display:grid;grid-template-columns:1fr}.campaign-attachment-add{justify-self:stretch}.campaign-attachments-toolbar .campaign-attachment-add,.campaign-composer-next-actions>.primary-button,.campaign-composer-next-actions>.secondary-button{min-width:0;width:100%}.campaign-composer-next-actions{gap:8px}.campaign-composer-next-actions .primary-button,.campaign-composer-next-actions .secondary-button{flex:1 1 auto;text-align:center;justify-content:center}}


/* Gestión de destinatarios dentro del asistente */
/*
 * Respeta siempre el atributo hidden. Algunas piezas del modal usan flex/grid
 * y, sin esta regla, su display de autor puede imponerse al display:none del
 * atributo HTML, dejando visibles a la vez carga, vacío o confirmación.
 */
.recipient-list-loading[hidden],
[data-recipient-list][hidden],
[data-recipient-list-empty][hidden],
[data-recipient-delete-confirm][hidden],
[data-recipient-pagination][hidden],
[data-recipient-list-clear][hidden] {
    display: none !important;
}
.app-modal-wide.recipient-list-modal {
    width: min(980px, calc(100vw - 32px));
    padding: 0;
    overflow: hidden;
}
.recipient-list-modal .recipient-list-modal-head {
    padding: 20px 22px 16px;
}
.recipient-list-modal-head p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 12px;
}
.recipient-list-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 22px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-soft);
}
.recipient-modal-search {
    flex: 1;
    min-width: 0;
}
.recipient-modal-search .input-shell {
    width: min(430px, 52vw);
}
.recipient-list-modal-body {
    min-height: 88px;
    max-height: min(55vh, 520px);
    overflow: auto;
    padding: 0 22px;
}
.recipient-list-loading {
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--muted);
    font-size: 12px;
}
.recipient-list-modal .recipient-management-row {
    min-height: 58px;
}
.recipient-list-modal .recipient-management-copy strong {
    font-size: 13px;
}
.recipient-delete-confirm-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 22px;
    border-top: 1px solid rgba(220, 38, 38, .16);
    background: var(--danger-soft);
}
.recipient-delete-confirm-bar > div:first-child {
    min-width: 0;
}
.recipient-delete-confirm-bar span,
.recipient-delete-confirm-bar strong {
    display: block;
}
.recipient-delete-confirm-bar span {
    color: var(--muted);
    font-size: 10px;
}
.recipient-delete-confirm-bar strong {
    margin-top: 2px;
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.recipient-delete-confirm-actions {
    display: flex;
    gap: 8px;
    flex: 0 0 auto;
}
.recipient-modal-pagination {
    margin: 0;
    padding: 14px 22px 18px;
}

@media (max-width: 700px) {
    .app-modal-wide.recipient-list-modal {
        width: calc(100vw - 18px);
        max-height: calc(100vh - 18px);
    }
    .recipient-list-toolbar {
        align-items: stretch;
        flex-direction: column;
    }
    .recipient-modal-search {
        width: 100%;
        flex-wrap: wrap;
    }
    .recipient-modal-search .input-shell {
        width: 100%;
        flex: 1 1 100%;
    }
    .recipient-list-modal-body {
        max-height: 52vh;
        padding: 0 14px;
    }
    .recipient-list-modal .recipient-management-row {
        grid-template-columns: 30px minmax(0, 1fr) 34px;
        gap: 8px;
    }
    .recipient-list-modal .recipient-management-row .status-pill {
        grid-column: 2 / 3;
        justify-self: start;
        margin-top: -7px;
        margin-bottom: 7px;
    }
    .recipient-list-modal .recipient-delete-button {
        grid-column: 3;
        grid-row: 1 / 3;
    }
    .recipient-delete-confirm-bar,
    .recipient-modal-pagination {
        align-items: stretch;
        flex-direction: column;
    }
    .recipient-delete-confirm-actions,
    .recipient-modal-pagination .pagination-actions {
        justify-content: space-between;
    }
}


/* Detalle de campaña · consulta y descarga de adjuntos */
.detail-attachment-row{grid-template-columns:30px minmax(0,1fr) 34px}
.detail-attachment-name{display:block;max-width:100%;padding:0;border:0;color:var(--text);background:transparent;font:inherit;font-size:10px;font-weight:800;text-align:left;text-decoration:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:pointer}
button.detail-attachment-name:hover,a.detail-attachment-name:hover{color:var(--primary);text-decoration:underline}
.detail-attachment-action{width:30px;height:30px;display:grid;place-items:center;border:1px solid var(--border);border-radius:8px;color:var(--primary);background:var(--surface);font-size:13px;font-weight:900;text-decoration:none;cursor:pointer}
.detail-attachment-action:hover{border-color:var(--primary);background:var(--primary-soft)}
.detail-attachment-modal-actions{justify-content:flex-end}
#detail-attachment-preview-modal[hidden], [data-detail-attachment-backdrop][hidden]{display:none!important}
#detail-attachment-preview-modal .campaign-attachment-preview-body img{display:block;width:100%;height:100%;max-width:100%;max-height:100%;object-fit:contain;object-position:center}
#detail-attachment-preview-modal .campaign-attachment-preview-body img[hidden],#detail-attachment-preview-modal .campaign-attachment-preview-body iframe[hidden]{display:none!important}
