/* =====================================================
   LIGHT THEME - Email Automation UI
   ===================================================== */
:root {
    --bg:            #f8f9fa;
    --surface:       #ffffff;
    --surface-2:     #f8f9fa;
    --border:        #d9e2ec;
    --border-focus:  #4f46e5;
    --primary:       #2c3e50;
    --primary-dark:  #1f2d3d;
    --primary-light: rgba(79, 70, 229, 0.08);
    --success:       #16a34a;
    --success-light: rgba(22, 163, 74, 0.10);
    --warning:       #d97706;
    --danger:        #dc2626;
    --danger-light:  rgba(220, 38, 38, 0.08);
    --text:          #1f2937;
    --text-2:        #334155;
    --text-muted:    #64748b;
    --text-ph:       #94a3b8;
    --radius:        16px;
    --radius-sm:     10px;
    --shadow-sm:     0 8px 24px rgba(15, 23, 42, 0.06);
    --shadow:        0 16px 40px rgba(15, 23, 42, 0.08);
    --shadow-lg:     0 24px 64px rgba(15, 23, 42, 0.12);
    --border-color:  var(--border);
    --bg-hover:      #eef2f7;
    --bg-main:       var(--surface);
    --bg-secondary:  var(--surface-2);
    --bg-code:       rgba(79, 70, 229, 0.08);
    --danger-color:  var(--danger);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Manrope', sans-serif;
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== LOGIN PAGE ===== */
#login-container {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    z-index: 100;
    padding: 1.5rem;
    overflow-y: auto;
}

.login-split {
    display: flex;
    flex-direction: row;
    width: 100%;
    max-width: 860px;
    min-height: 520px;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(15,23,42,0.18), 0 4px 20px rgba(15,23,42,0.08);
    animation: loginIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    /* true horizontal centering */
    margin-left: auto;
    margin-right: auto;
}

@keyframes loginIn {
    from { opacity: 0; transform: translateY(24px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

/* Left: Branding — fixed width so form panel is always centered on the right */
.login-brand {
    flex: 0 0 42%;
    background: linear-gradient(160deg, #2c3e50 0%, #34495e 60%, #4f46e5 100%);
    padding: 3rem 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: white;
    position: relative;
    overflow: hidden;
}
.login-brand::before {
    content: ''; position: absolute;
    width: 280px; height: 280px; border-radius: 50%;
    background: rgba(255,255,255,0.07);
    top: -80px; right: -80px;
}
.login-brand::after {
    content: ''; position: absolute;
    width: 180px; height: 180px; border-radius: 50%;
    background: rgba(255,255,255,0.05);
    bottom: -60px; left: -30px;
}

.login-brand-icon {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    position: relative; z-index: 1;
}

.login-brand-title {
    font-family: 'Manrope', sans-serif;
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 0.75rem;
    position: relative; z-index: 1;
}

.login-brand-sub {
    font-size: 0.93rem;
    opacity: 0.82;
    font-weight: 300;
    line-height: 1.65;
    position: relative; z-index: 1;
}

.login-brand-features {
    margin-top: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    position: relative; z-index: 1;
}

.login-feature-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.86rem;
    opacity: 0.9;
}

/* Right: Form — takes remaining space, contents are centered */
.login-form-panel {
    flex: 1;
    background: #ffffff;
    padding: 3rem 2.75rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
}

.login-form-title {
    font-family: 'Manrope', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    margin-bottom: 0.35rem;
}

.login-form-sub {
    font-size: 0.87rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.login-field {
    margin-bottom: 1.15rem;
}

.login-field label {
    display: block;
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 0.4rem;
}

.login-field input {
    width: 100%;
    background: #f8fafc;
    border: 1.5px solid var(--border);
    color: var(--text);
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.93rem;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    outline: none;
}

.login-field input::placeholder { color: var(--text-ph); }

.login-field input:focus {
    border-color: var(--border-focus);
    background: white;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.login-btn {
    width: 100%;
    padding: 0.9rem;
    font-size: 0.97rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 14px rgba(59,130,246,0.35);
    margin-top: 0.5rem;
    font-family: inherit;
    letter-spacing: 0.01em;
}

.login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59,130,246,0.4);
}
.login-btn:active { transform: translateY(1px); }

/* Google sign-in button */
.login-google-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    padding: 0.82rem 1rem;
    font-size: 0.93rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: var(--radius-sm);
    background: #ffffff;
    color: #1a1a1a;
    border: 1.5px solid #d1d5db;
    cursor: pointer;
    transition: all 0.18s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 0.25rem;
}
.login-google-btn:hover {
    background: #f8fafc;
    border-color: #a0aec0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Divider between Google and username form */
.login-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0 0.9rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}
.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Switch row — "Don't have an account? Sign Up" */
.login-switch-row {
    margin-top: 1.25rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.login-switch-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.15s;
}
.login-switch-btn:hover { color: var(--primary-dark); }

/* Sender account dropdown */
.sender-select {
    width: 100%;
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    color: var(--text);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    cursor: pointer;
    appearance: auto;
}
.sender-select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.10);
    background: var(--surface);
}

/* ── Signup request cards (admin panel) ── */
.signup-request-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
    margin-bottom: 0.6rem;
}
.signup-request-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.signup-request-username {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}
.signup-request-time {
    font-size: 0.78rem;
    color: var(--text-muted);
}
.signup-request-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}
.btn-approve {
    padding: 0.4rem 1rem;
    border-radius: 7px;
    border: none;
    background: #22c55e;
    color: #fff;
    font-weight: 600;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-approve:hover { background: #16a34a; }
.btn-reject {
    padding: 0.4rem 1rem;
    border-radius: 7px;
    border: none;
    background: #ef4444;
    color: #fff;
    font-weight: 600;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-reject:hover { background: #dc2626; }
.signup-requests-empty {
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 0.5rem 0;
}
.signup-request-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ef4444;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 999px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 6px;
    vertical-align: middle;
    line-height: 1;
}

.admin-users-list {
    display: grid;
    gap: 0.75rem;
}

.admin-user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.95rem 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-2);
}

.admin-user-item.is-blocked {
    border-color: rgba(239, 68, 68, 0.35);
    background: rgba(254, 242, 242, 0.85);
}

.admin-user-main {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
}

.admin-user-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.admin-user-name {
    font-size: 0.96rem;
    font-weight: 700;
    color: var(--text-primary);
}

.admin-user-meta {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.admin-user-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(148, 163, 184, 0.16);
    color: var(--text-secondary);
}

.admin-user-badge.role-admin {
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
}

.admin-user-badge.status-active {
    background: rgba(34, 197, 94, 0.12);
    color: #15803d;
}

.admin-user-badge.status-blocked {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}

.admin-user-badge.is-self {
    background: rgba(15, 23, 42, 0.08);
    color: var(--text-secondary);
}

.admin-user-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.admin-users-empty {
    color: var(--text-muted);
    font-size: 0.92rem;
    padding: 0.3rem 0;
}

/* ── Tablet: hide brand panel, center the form card ── */
@media (max-width: 768px) {
    #login-container { padding: 1rem; align-items: flex-start; padding-top: 2rem; }
    .login-split {
        flex-direction: column;
        max-width: 460px;
        min-height: auto;
        border-radius: 18px;
    }
    .login-brand {
        flex: 0 0 auto;
        padding: 2rem 2rem 1.75rem;
    }
    .login-brand-features { display: none; }
    .login-brand-sub { display: none; }
    .login-brand-icon { font-size: 2.5rem; margin-bottom: 0.6rem; }
    .login-brand-title { font-size: 1.4rem; margin-bottom: 0; }
    .login-form-panel { padding: 2rem; }
}

/* ── Mobile: single column, compact card ── */
@media (max-width: 480px) {
    #login-container { padding: 0.75rem; padding-top: 1.25rem; }
    .login-split {
        max-width: 100%;
        border-radius: 14px;
    }
    .login-brand { padding: 1.5rem 1.25rem 1.25rem; }
    .login-brand-title { font-size: 1.25rem; }
    .login-form-panel { padding: 1.5rem 1.25rem; }
    .login-form-title { font-size: 1.3rem; }
    .login-form-sub { margin-bottom: 1.5rem; }
}

/* ===== APP SHELL ===== */
#app-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 2rem;
    width: 100%;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1.1rem 1.25rem;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 2px);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(14px);
}

.header-left h1 {
    font-family: 'Manrope', sans-serif;
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.03em;
}
.header-left p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#welcome-msg {
    font-size: 0.94rem;
    color: var(--text-2);
    letter-spacing: -0.01em;
}

#welcome-msg strong {
    color: var(--primary);
    font-weight: 600;
}

/* ===== TABS ===== */
.tab-nav {
    display: flex;
    gap: 4px;
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px;
    box-shadow: var(--shadow-sm);
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.65rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: calc(var(--radius) - 4px);
    cursor: pointer;
    transition: all 0.2s;
}
.tab-btn:hover { color: var(--text); background: var(--bg); }
.tab-btn.active {
    background: linear-gradient(135deg, #2c3e50, #4f46e5);
    color: white;
    box-shadow: 0 10px 24px rgba(79, 70, 229, 0.24);
    font-weight: 600;
}

.tab-icon { font-size: 1rem; }

.tab-badge {
    background: var(--success);
    color: white;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 20px;
    min-width: 18px;
    text-align: center;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.65; }
}

.tab-content { display: none; }
.tab-content.active {
    display: block;
    animation: fadeUp 0.22s ease;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===== CARDS ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: opacity 0.3s;
    position: relative;
    overflow: hidden;
}
.card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 1px;
    background: linear-gradient(90deg, rgba(79, 70, 229, 0.18), rgba(44, 62, 80, 0.16), transparent);
}
.disabled-section { opacity: 0.4; pointer-events: none; }

h2 { font-size: 1.1rem; font-weight: 700; color: var(--text); margin-bottom: 0.35rem; }
h3 { font-size: 0.95rem; font-weight: 600; color: var(--text-2); margin-bottom: 0.6rem; }

.subtext {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 0.9rem;
    line-height: 1.5;
}

code {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-size: 0.8em;
    font-family: 'Courier New', monospace;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.3rem;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.18s;
    gap: 0.35rem;
    letter-spacing: 0.01em;
}
.btn:hover  { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.82rem; }

.btn-primary {
    background: linear-gradient(135deg, #2c3e50, #4f46e5);
    color: white;
    box-shadow: 0 10px 22px rgba(79, 70, 229, 0.18);
}
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 14px 26px rgba(79, 70, 229, 0.22); }

.btn-success {
    background: linear-gradient(135deg, #2c3e50, #4f46e5);
    color: white;
    width: 100%;
    font-size: 1rem;
    padding: 0.9rem;
    box-shadow: 0 10px 22px rgba(79, 70, 229, 0.18);
}
.btn-success:hover { background: #4338ca; }

.btn-danger {
    background: linear-gradient(135deg, #991b1b, #ef4444);
    color: white;
    box-shadow: 0 10px 22px rgba(239, 68, 68, 0.18);
}
.btn-danger:hover { background: #dc2626; box-shadow: 0 14px 26px rgba(239, 68, 68, 0.24); }

.btn-outline {
    background: transparent;
    color: var(--text-2);
    border: 1.5px solid var(--border);
}
.btn-outline:hover { background: var(--bg); border-color: #cbd5e1; }

#btn-logout {
    background: var(--danger-light);
    color: var(--danger);
    border: 1.5px solid rgba(239,68,68,0.18);
    font-size: 0.82rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.18s;
}
#btn-logout:hover { background: rgba(239,68,68,0.14); }

/* ===== FORMS / INPUTS ===== */
.input-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="password"],
textarea {
    width: 100%;
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    color: var(--text);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    resize: vertical;
}
input::placeholder, textarea::placeholder { color: var(--text-ph); }
input:focus, textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.10);
    background: var(--surface);
}
textarea { min-height: 120px; }

label {
    display: block;
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 0.35rem;
}

.template-editor label { margin-top: 1rem; }
.template-editor label:first-child { margin-top: 0; }

/* ===== TOPIC GENERATOR ===== */
.topic-generator {
    margin-bottom: 1.25rem;
    background: var(--primary-light);
    border: 1px solid rgba(59,130,246,0.14);
    border-radius: var(--radius-sm);
    padding: 1rem;
}
.topic-generator label { color: var(--primary-dark); font-weight: 600; margin-bottom: 0.5rem; }

/* ===== UPLOAD AREA ===== */
.upload-area {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--surface-2);
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-sm);
}
.file-name { font-size: 0.85rem; color: var(--text-muted); font-style: italic; }

/* ===== STATS ===== */
.dispatch-area { margin-bottom: 1.25rem; }
.stats { display: flex; justify-content: space-between; margin-bottom: 1rem; }
.stat-badge {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid rgba(59,130,246,0.12);
}

/* ===== LOGS ===== */
.log-container {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    max-height: 200px;
    overflow-y: auto;
}

/* ===== SEQUENCE STEP CARDS ===== */
.seq-step-card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.2rem;
    margin-bottom: 0.85rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.18s;
}
.seq-step-card:hover {
    box-shadow: 0 4px 16px rgba(59,130,246,0.08), 0 1px 4px rgba(0,0,0,0.05);
    border-color: #cbd5e1;
}

.seq-step-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.9rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--border);
}

.seq-step-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}

/* AI topic input row (below subject) */
.step-ai-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.step-ai-row input {
    flex: 1;
    font-size: 0.85rem;
    padding: 0.55rem 0.8rem;
    background: rgba(59,130,246,0.04);
    border-color: rgba(99,102,241,0.25);
}
.step-ai-row input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.10);
    background: white;
}
.step-ai-row .btn-ai-step {
    white-space: nowrap;
    color: #6366f1;
    border-color: rgba(99,102,241,0.35);
    font-size: 0.82rem;
    padding: 0.48rem 0.85rem;
}
.step-ai-row .btn-ai-step:hover {
    background: rgba(99,102,241,0.08);
    border-color: #6366f1;
}

/* Attachment section */
.step-att-section {
    background: var(--surface-2);
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.75rem;
}
.step-att-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}
.step-att-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    flex: 1;
}

/* Step footer (timing + save) */
.seq-step-footer {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    flex-wrap: wrap;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
    margin-top: 0.25rem;
}
.step-timing-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    padding-bottom: 0.4rem;
}
.step-timing-group {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

/* Attachment pills */
.attachment-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--primary-light);
    color: var(--primary-dark);
    border: 1px solid rgba(59,130,246,0.18);
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 0.2rem 0.6rem 0.2rem 0.75rem;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.attachment-pill .remove-btn {
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: color 0.15s;
}
.attachment-pill .remove-btn:hover { color: var(--danger); }

/* Launch / CSV section polish */
.seq-launch-row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.log-container h3 { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.4rem; }
#log-list {
    list-style: none;
    font-size: 0.82rem;
    color: var(--text-2);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.log-success { color: #059669; }
.log-error   { color: var(--danger); }

/* ===== UTILS ===== */
.hidden { display: none !important; }

/* ===== STATUS BOXES ===== */
.status-box {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.87rem;
    line-height: 1.5;
}
.status-box.success { background: var(--success-light); border: 1px solid rgba(16,185,129,0.22); color: #047857; }
.status-box.error   { background: var(--danger-light);  border: 1px solid rgba(239,68,68,0.22);  color: #b91c1c; }
.status-box.info    { background: rgba(59,130,246,0.08); border: 1px solid rgba(59,130,246,0.25); color: #1d4ed8; }

/* ── Connection Status Banners (shown in Settings after login) ── */
.connection-status-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.75rem 0 1.25rem;
    padding: 0.7rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    line-height: 1.5;
}
.connection-status-ok {
    background: rgba(16,185,129,0.09);
    border: 1px solid rgba(16,185,129,0.3);
    color: #065f46;
}
.connection-status-warn {
    background: rgba(245,158,11,0.09);
    border: 1px solid rgba(245,158,11,0.35);
    color: #92400e;
}
.connection-status-neutral {
    background: rgba(100,116,139,0.07);
    border: 1px solid rgba(100,116,139,0.2);
    color: #475569;
}

/* ── Alias list rows ── */
.alias-row { transition: background 0.15s; }
.alias-row:hover { background: var(--bg-2) !important; }
.btn-sm { padding: 0.28rem 0.65rem !important; font-size: 0.82rem !important; }

/* ── Connection status pill ── */
.conn-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
}
.conn-pill--ok {
    background: rgba(16,185,129,0.1);
    border: 1px solid rgba(16,185,129,0.3);
    color: #065f46;
}
.conn-pill--warn {
    background: rgba(245,158,11,0.1);
    border: 1px solid rgba(245,158,11,0.35);
    color: #92400e;
}
.conn-pill--neutral {
    background: rgba(100,116,139,0.08);
    border: 1px solid rgba(100,116,139,0.2);
    color: #475569;
}
.conn-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.conn-pill--ok   .conn-dot { background: #10b981; box-shadow: 0 0 0 2px rgba(16,185,129,0.25); }
.conn-pill--warn .conn-dot { background: #f59e0b; box-shadow: 0 0 0 2px rgba(245,158,11,0.25); }
.conn-pill--neutral .conn-dot { background: #94a3b8; }

/* ===== LOADING SPINNER ===== */
.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}
.loading::after {
    content: '';
    position: absolute;
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.35);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { 100% { transform: rotate(360deg); } }
.btn-outline.loading::after {
    border-color: rgba(0,0,0,0.12);
    border-top-color: var(--text-2);
}

/* ===== SENDER OPTIONS ===== */
.sender-options > div {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
}

/* ===== CAMPAIGNS DASHBOARD ===== */
.campaigns-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.campaigns-container { display: flex; flex-direction: column; gap: 0.65rem; }

/* Pagination */
.campaigns-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem 0 0.25rem;
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
}
.pagination-info {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-2);
    min-width: 120px;
    text-align: center;
}
.pagination-total {
    font-weight: 400;
    color: var(--text-muted);
}
.campaigns-pagination .btn[disabled] {
    opacity: 0.35;
    pointer-events: none;
    cursor: not-allowed;
    transform: none;
}
.campaigns-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.campaigns-empty .empty-icon { font-size: 2.8rem; margin-bottom: 0.75rem; opacity: 0.4; }

.campaign-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(248, 249, 250, 0.99));
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1.1rem 1.3rem;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
    animation: slideUp 0.3s ease forwards;
    opacity: 0;
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.campaign-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    border-radius: 3px 0 0 3px;
    background: linear-gradient(180deg, var(--primary), #6366f1);
    opacity: 0;
    transition: opacity 0.2s;
}
.campaign-card:hover {
    border-color: rgba(59,130,246,0.28);
    box-shadow: var(--shadow);
    transform: translateX(3px);
}
.campaign-card:hover::before { opacity: 1; }

.campaign-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.5rem;
}
.campaign-subject {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.campaign-date {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    margin-top: 2px;
}
.campaign-card-bottom { display: flex; gap: 0.6rem; align-items: center; }
.campaign-stat {
    font-size: 0.77rem;
    padding: 0.18rem 0.55rem;
    border-radius: 6px;
    font-weight: 600;
}
.campaign-stat.recipients  { background: var(--primary-light); color: var(--primary-dark); }
.campaign-stat.replies     { background: var(--success-light); color: #047857; }
.campaign-stat.no-replies  { background: #f1f5f9; color: #94a3b8; }

/* Delete button on campaign cards */
.btn-delete-campaign {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.82rem;
    padding: 2px 6px;
    border-radius: 5px;
    color: #cbd5e1;
    transition: background 0.15s, color 0.15s;
    line-height: 1;
    flex-shrink: 0;
}
.btn-delete-campaign:hover { background: #fee2e2; color: #b91c1c; }

/* ===== CAMPAIGN DETAIL OVERLAY ===== */
.campaign-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.40);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
    animation: fadeOverlay 0.2s ease;
}
@keyframes fadeOverlay { from { opacity: 0; } to { opacity: 1; } }

.campaign-detail-panel {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(248, 249, 250, 0.99));
    border: 1px solid var(--border);
    border-radius: 16px;
    max-width: 920px;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.96) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.campaign-detail-panel::-webkit-scrollbar { width: 5px; }
.campaign-detail-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.detail-header h2 { margin-bottom: 0.2rem; font-size: 1.2rem; color: var(--text); }
.detail-header .subtext { margin-bottom: 0; }
.detail-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }
.detail-body { display: flex; flex-direction: column; gap: 1.5rem; }

.detail-section h3 {
    font-size: 0.77rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.recipients-table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.recipients-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.recipients-table th {
    background: var(--surface-2);
    padding: 0.65rem 1rem;
    text-align: left;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}
.recipients-table td {
    padding: 0.6rem 1rem;
    border-top: 1px solid #f1f5f9;
    color: var(--text-2);
}
.recipients-table tbody tr:hover { background: var(--surface-2); }

/* Clickable email link in recipients table */
.recipient-email-link {
    background: none; border: none; padding: 0; margin: 0; cursor: pointer;
    color: var(--primary); font-size: inherit; font-weight: 600;
    text-decoration: underline; text-underline-offset: 2px;
    transition: color 0.15s;
}
.recipient-email-link:hover { color: var(--primary-dark); }

/* Highlighted reply thread when jumped to */
.reply-thread-group.highlighted {
    outline: 2.5px solid var(--primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(59,130,246,0.13);
    transition: outline 0.2s, box-shadow 0.2s;
}

.status-replied {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.18rem 0.55rem; border-radius: 6px;
    font-size: 0.75rem; font-weight: 700;
    background: var(--success-light); color: #047857;
}
.status-replied-multi {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.18rem 0.55rem; border-radius: 6px;
    font-size: 0.75rem; font-weight: 700;
    background: rgba(99,102,241,0.1); color: #4338ca;
}
.status-pending {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.18rem 0.55rem; border-radius: 6px;
    font-size: 0.75rem; font-weight: 500;
    background: #f1f5f9; color: #94a3b8;
}
.detail-replies-container {
    display: flex; flex-direction: column; gap: 0.65rem;
    padding-right: 0.2rem;
}
/* no max-height — the parent .campaign-detail-panel (max-height: 88vh, overflow-y: auto) handles scrolling */

/* ===== MULTI-REPLY THREAD ===== */
.reply-thread-group {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.reply-thread-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface-2);
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border);
}
.reply-thread-sender { font-weight: 700; font-size: 0.88rem; color: var(--text); }
.reply-count-badge {
    font-size: 0.72rem; font-weight: 700;
    padding: 0.18rem 0.55rem; border-radius: 20px;
    background: var(--success-light); color: #047857;
    white-space: nowrap;
}
.reply-thread-messages { display: flex; flex-direction: column; }
.reply-message-item {
    padding: 0.85rem 1rem;
    border-top: 1px solid #f1f5f9;
}
.reply-message-item:first-child { border-top: none; }
.reply-message-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.45rem;
    gap: 1rem;
}
.reply-message-num {
    font-size: 0.73rem; font-weight: 700;
    background: var(--primary-light); color: var(--primary-dark);
    padding: 0.1rem 0.5rem; border-radius: 5px;
}
.reply-message-date { font-size: 0.73rem; color: var(--text-muted); }
.reply-message-body {
    font-size: 0.83rem; color: var(--text-2);
    line-height: 1.55; white-space: pre-wrap; word-break: break-word;
    max-height: 120px; overflow-y: auto;
    background: var(--surface-2); padding: 0.6rem 0.85rem;
    border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.reply-message-body::-webkit-scrollbar { width: 4px; }
.reply-message-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.reply-detail-card {
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
}
.reply-detail-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem;
}
.reply-detail-from  { font-weight: 600; font-size: 0.88rem; color: var(--text); }
.reply-detail-date  { font-size: 0.74rem; color: var(--text-muted); }
.reply-detail-body {
    font-size: 0.83rem; color: var(--text-2); line-height: 1.55;
    white-space: pre-wrap; word-break: break-word;
    max-height: 130px; overflow-y: auto;
    background: var(--surface); padding: 0.65rem; border-radius: 6px;
    border: 1px solid var(--border); margin-top: 0.5rem;
}

/* ===== SETTINGS ===== */
.guide-details {
    background: var(--primary-light) !important;
    border: 1px solid rgba(59,130,246,0.18) !important;
    border-radius: var(--radius-sm);
}
.guide-details summary { color: var(--primary-dark) !important; }
.guide-details div  { color: var(--text-2) !important; }
.guide-details a    { color: var(--primary) !important; }

/* ===== MISC ===== */
.text-muted { color: var(--text-muted); }
.italic     { font-style: italic; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    #app-container { padding: 1.25rem 1rem; }
    .upload-area { flex-direction: column; align-items: stretch; }
    .stats { flex-direction: column; gap: 0.5rem; }
    .tab-btn { font-size: 0.8rem; padding: 0.55rem 0.65rem; }
    .campaign-detail-overlay { padding: 0.75rem; }
    .campaign-detail-panel { max-height: 92vh; padding: 1.25rem; }
    .detail-header { flex-direction: column; }
    .detail-actions { width: 100%; }
    .detail-actions .btn { flex: 1; }
    .recipients-table th,
    .recipients-table td { padding: 0.5rem 0.6rem; font-size: 0.78rem; }
    header { flex-wrap: wrap; gap: 0.75rem; }
    .header-left h1 { font-size: 1.35rem; }
    .campaigns-pagination { gap: 0.65rem; }
    .pagination-info { min-width: auto; font-size: 0.8rem; }
    .input-group { flex-direction: column; }
    .input-group .btn { width: 100%; }
}

/* ── Small mobile (≤480px) ── */
@media (max-width: 480px) {
    #app-container { padding: 1rem 0.75rem; }
    header { margin-bottom: 1rem; }
    .header-left h1 { font-size: 1.2rem; }
    .header-left p { font-size: 0.78rem; }
    #btn-logout { font-size: 0.78rem; padding: 0.4rem 0.75rem; }
    .tab-nav { gap: 2px; padding: 3px; border-radius: 10px; }
    .tab-btn { font-size: 0.75rem; padding: 0.5rem 0.4rem; gap: 0.25rem; }
    .tab-icon { font-size: 0.9rem; }
    .card { padding: 1.1rem; border-radius: 10px; margin-bottom: 1rem; }
    h2 { font-size: 1rem; }
    .btn { font-size: 0.85rem; padding: 0.6rem 1rem; }
    .btn-success { font-size: 0.92rem; padding: 0.8rem; }
    .campaign-card { padding: 0.9rem 1rem; }
    .campaign-subject { font-size: 0.88rem; }
    .campaign-detail-overlay { padding: 0.5rem; }
    .campaign-detail-panel { padding: 1rem; border-radius: 12px; }
    .detail-header h2 { font-size: 1rem; }
    .detail-section h3 { font-size: 0.72rem; }
    .recipients-table-wrapper { border-radius: 6px; }
    .recipients-table th,
    .recipients-table td { padding: 0.4rem 0.5rem; font-size: 0.74rem; }
    .reply-thread-header { padding: 0.5rem 0.75rem; }
    .reply-thread-sender { font-size: 0.8rem; }
    .reply-message-item { padding: 0.65rem 0.75rem; }
    .reply-message-body { font-size: 0.78rem; }
    .log-container { max-height: 150px; }
    .campaigns-pagination { flex-wrap: wrap; gap: 0.5rem; }
    .sender-options > div { padding: 0.75rem; }
    .stat-badge { font-size: 0.76rem; padding: 0.25rem 0.6rem; }
}

/* ── Extra small (≤360px) ── */
@media (max-width: 360px) {
    #app-container { padding: 0.75rem 0.5rem; }
    .tab-btn span:not(.tab-icon):not(.tab-badge) { display: none; }
    .tab-btn { padding: 0.55rem; justify-content: center; }
    .campaign-detail-panel { padding: 0.75rem; }
}

/* ===== SCHEDULING SECTION ===== */

.schedule-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}
.schedule-header h2 { margin-bottom: 0.15rem; }
.schedule-loading-text { color: var(--text-muted); font-style: italic; }

/* ── Step cards (S1 / S2 / S3) ── */
.sched-step-card {
    border-left: 3px solid var(--primary);
    position: relative;
    overflow: visible;
}
.sched-step-label {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.sched-step-label > div { flex: 1; }
.sched-step-label h2 { margin-bottom: 0.2rem; }
.sched-step-label .subtext { margin-bottom: 0; }
.sched-step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2.2rem;
    height: 2.2rem;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    box-shadow: 0 2px 8px rgba(59,130,246,0.3);
    margin-top: 2px;
}
.sched-step-body {
    padding-left: calc(2.2rem + 1rem);
}

/* Datetime + dispatch row */
.sched-datetime-row {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-top: 0.25rem;
}
.sched-datetime-group {
    flex: 1;
    min-width: 240px;
}
.sched-dispatch-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding-top: 1.6rem; /* align with input */
}
.sched-recipient-count {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--primary-light);
    color: var(--primary-dark);
    border: 1px solid rgba(59,130,246,0.2);
    border-radius: 20px;
    padding: 0.25rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 600;
}
.sched-dispatch-actions .btn-success {
    width: auto;
    padding: 0.85rem 2rem;
    font-size: 0.95rem;
}

/* Empty state */
.schedule-empty {
    text-align: center;
    padding: 1.75rem 1rem;
    color: var(--text-muted);
}
.schedule-empty .empty-icon { font-size: 2rem; opacity: 0.35; margin-bottom: 0.5rem; display: block; }
.schedule-empty p { font-size: 0.87rem; line-height: 1.55; }
.schedule-empty strong { color: var(--text-2); }

/* Queue table */
.sched-queue-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.sched-queue-table th {
    background: var(--surface-2);
    padding: 0.6rem 0.9rem;
    text-align: left;
    font-size: 0.73rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.sched-queue-table td {
    padding: 0.75rem 0.9rem;
    border-top: 1px solid #f1f5f9;
    color: var(--text-2);
    vertical-align: middle;
}
.sched-queue-table tbody tr:hover { background: var(--surface-2); }
.sched-label-cell { font-weight: 600; color: var(--text); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sched-date-cell { font-size: 0.82rem; white-space: nowrap; }
.sched-from-cell { font-size: 0.8rem; color: var(--text-muted); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Recipient pill in queue */
.sched-recipient-pill {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: 12px;
    padding: 0.15rem 0.6rem;
    font-size: 0.78rem;
    font-weight: 600;
}

/* Countdown label */
.sched-countdown {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-style: italic;
    margin-left: 0.25rem;
}
.sched-countdown--soon {
    color: #f59e0b;
    font-style: normal;
    font-weight: 600;
}

/* Status pills */
.sched-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.22rem 0.65rem;
    border-radius: 20px;
    font-size: 0.73rem;
    font-weight: 700;
    white-space: nowrap;
}
.sched-status-pending { background: rgba(59,130,246,0.1);  color: #1d4ed8; border: 1px solid rgba(59,130,246,0.2); }
.sched-status-sending { background: rgba(245,158,11,0.12); color: #92400e; border: 1px solid rgba(245,158,11,0.3); animation: pulse 1.5s infinite; }
.sched-status-failed  { background: var(--danger-light);   color: #b91c1c; border: 1px solid rgba(239,68,68,0.25); }

/* Error hint */
.sched-error-hint {
    font-size: 0.72rem;
    color: #b91c1c;
    margin-top: 0.3rem;
    cursor: help;
    word-break: break-word;
}

/* Cancel button */
.btn-cancel-sched {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: transparent;
    border: 1px solid rgba(239,68,68,0.25);
    cursor: pointer;
    font-size: 0.78rem;
    font-family: inherit;
    padding: 0.28rem 0.7rem;
    border-radius: 6px;
    color: #b91c1c;
    transition: all 0.15s;
    white-space: nowrap;
}
.btn-cancel-sched:hover { background: #fee2e2; border-color: #ef4444; }

/* Datetime input */
.sched-datetime-input {
    width: 100%;
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    color: var(--text);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    box-sizing: border-box;
}
.sched-datetime-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.10);
    background: var(--surface);
}
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(0.4);
    cursor: pointer;
}

/* ── Scheduled campaign highlight in Replies tab ── */
.campaign-card--scheduled {
    border-color: rgba(99,102,241,0.35) !important;
    background: linear-gradient(135deg, var(--surface) 0%, rgba(99,102,241,0.04) 100%) !important;
}
.campaign-card--scheduled::before {
    background: linear-gradient(180deg, #6366f1, #8b5cf6) !important;
    opacity: 1 !important;
}
.campaign-scheduled-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    background: rgba(99,102,241,0.12);
    color: #4338ca;
    border: 1px solid rgba(99,102,241,0.25);
    letter-spacing: 0.01em;
    white-space: nowrap;
}

/* ── Required / Optional badges ── */
.req-badge {
    display: inline-block;
    font-weight: 600;
    font-size: 0.67rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(239,68,68,0.1);
    color: #b91c1c;
    margin-left: 0.3rem;
    vertical-align: middle;
}
.opt-badge {
    display: inline-block;
    font-weight: 500;
    font-size: 0.67rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(100,116,139,0.1);
    color: #64748b;
    margin-left: 0.3rem;
    vertical-align: middle;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 1.2rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.45;
    max-width: 380px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.18);
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto;
}
.toast.toast-visible { opacity: 1; transform: translateX(0); }
.toast-success {
    background: var(--surface);
    border: 1px solid rgba(16,185,129,0.3);
    border-left: 4px solid #10b981;
}
.toast-error {
    background: var(--surface);
    border: 1px solid rgba(239,68,68,0.3);
    border-left: 4px solid #ef4444;
}
.toast-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 1px; }
.toast-msg { color: var(--text); }
.toast-msg strong { font-weight: 700; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .sched-step-body { padding-left: 0; }
    .sched-datetime-row { flex-direction: column; }
    .sched-dispatch-actions { padding-top: 0; width: 100%; }
    .sched-dispatch-actions .btn-success { width: 100%; }
}
@media (max-width: 480px) {
    .toast-container { bottom: 1rem; right: 0.75rem; left: 0.75rem; }
    .toast { max-width: unset; }
    .sched-queue-table { font-size: 0.78rem; }
    .sched-queue-table th, .sched-queue-table td { padding: 0.5rem 0.55rem; }
    .sched-step-label { flex-direction: row; }
}


/* Attachments */
.attachment-pill { display: inline-flex; align-items: center; gap: 0.5rem; background: var(--bg-hover); padding: 0.25rem 0.5rem; border-radius: 4px; font-size: 0.85rem; border: 1px solid var(--border-color); }
.attachment-pill .remove-btn { cursor: pointer; color: var(--danger-color); font-weight: bold; }
.attachment-pill .remove-btn:hover { opacity: 0.8; }

/* Upload progress bar */
.step-upload-progress {
    height: 4px;
    background: var(--border-color);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 0.4rem;
}
.step-upload-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    border-radius: 999px;
    transition: width 0.15s ease;
}

/* Attach size hint */
.step-att-limit {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-left: 0.25rem;
    white-space: nowrap;
}

/* CC / BCC row */
.step-cc-bcc-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
}
.step-cc-field label { font-size: 0.82rem; font-weight: 500; }

/* CSV launch card redesign */
.seq-launch-card {
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.04), rgba(44, 62, 80, 0.04));
}
.seq-launch-header { margin-bottom: 1rem; }
.seq-launch-title { margin: 0 0 0.3rem; font-size: 1rem; font-weight: 600; }
.seq-launch-subtitle { margin: 0; font-size: 0.85rem; color: var(--text-muted); }
.seq-launch-subtitle code { background: var(--bg-code, rgba(0,0,0,0.06)); padding: 0.1rem 0.3rem; border-radius: 4px; font-size: 0.82rem; }
.seq-launch-body {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.seq-csv-drop-zone {
    flex: 1;
    min-width: 200px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    background: var(--bg-main, #fff);
}
.seq-csv-drop-zone:hover { border-color: #6366f1; background: rgba(99,102,241,0.04); }
.seq-csv-drop-zone:hover { border-color: #4f46e5; background: rgba(79,70,229,0.04); }
.seq-csv-icon { font-size: 1.4rem; line-height: 1; flex-shrink: 0; }
.seq-csv-prompt { font-size: 0.85rem; font-weight: 500; }
.seq-csv-filename { font-size: 0.82rem; color: var(--text-muted); margin-left: auto; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seq-launch-btn { flex-shrink: 0; }
.seq-send-progress {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}
.seq-send-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
}
.seq-send-body {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}
.seq-send-copy {
    flex: 1;
    min-width: 0;
}
.seq-send-spinner {
    width: 1rem;
    height: 1rem;
    margin-top: 0.15rem;
    border-radius: 999px;
    border: 2px solid rgba(59,130,246,0.2);
    border-top-color: #2563eb;
    animation: seq-spin 0.8s linear infinite;
    flex-shrink: 0;
}
.seq-send-meter {
    height: 8px;
    margin-top: 0.55rem;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(148,163,184,0.2);
}
.seq-send-meter-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #2563eb, #14b8a6);
    transition: width 0.2s ease;
}
.seq-send-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.55rem;
}
.seq-send-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
}
@keyframes seq-spin {
    to { transform: rotate(360deg); }
}

.seq-flow-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.9rem;
    margin-bottom: 1.1rem;
}
.seq-flow-item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1rem 1.05rem;
    border: 1px solid rgba(231, 220, 199, 0.95);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(247, 240, 228, 0.85));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.65);
}
.seq-flow-kicker {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 0.18rem 0.5rem;
    border-radius: 999px;
    background: rgba(79, 70, 229, 0.10);
    color: #3730a3;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.seq-flow-item strong {
    color: var(--text);
    font-size: 0.95rem;
}
.seq-flow-item span:last-child {
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.5;
}
.seq-section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}
.detail-analysis-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-top: 0.8rem;
}
.analysis-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.96);
    color: var(--text-2);
    font-size: 0.78rem;
    font-weight: 700;
}
.analysis-pill strong {
    color: var(--text);
    font-size: 0.84rem;
}
.delivery-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.28rem 0.58rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}
.delivery-chip.replied,
.delivery-chip.delivered {
    background: rgba(22, 163, 74, 0.14);
    color: #166534;
}
.delivery-chip.bounced {
    background: rgba(194, 65, 12, 0.12);
    color: #9a3412;
}
.delivery-chip.spam {
    background: rgba(79, 70, 229, 0.14);
    color: #3730a3;
}
.seq-final-card {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
}
.seq-launch-checklist {
    display: grid;
    gap: 0.55rem;
    margin: 0.9rem 0 1rem;
}
.seq-check-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--surface-2);
    font-size: 0.84rem;
    color: var(--text-2);
}
.seq-check-item.ok {
    border-color: rgba(22, 163, 74, 0.22);
    background: rgba(22, 163, 74, 0.06);
}
.seq-check-item.waiting {
    border-color: rgba(79, 70, 229, 0.18);
    background: rgba(79, 70, 229, 0.04);
}
.recipient-stack {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.recipient-stack strong {
    font-size: 0.84rem;
    color: var(--text);
}
.recipient-stack span {
    font-size: 0.77rem;
    color: var(--text-muted);
}

@media (max-width: 900px) {
    .seq-flow-strip { grid-template-columns: 1fr; }
}
