* { box-sizing: border-box; }
html, body {
    font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background: #f5f6f8;
    color: #1f2430;
}
body {
    display: flex;
    min-height: 100vh;
    align-items: stretch;
}

.sidenav {
    width: 230px;
    flex: 0 0 230px;
    background: #1f2937;
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    overflow-y: auto;
}
.sidenav-brand { color: #fff; font-weight: 700; font-size: 19px; padding: 0 8px 16px; letter-spacing: 0.2px; }
.sidenav a {
    color: #cbd5e1; text-decoration: none; font-size: 14.5px; font-weight: 500;
    padding: 11px 16px; border-radius: 10px; background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.sidenav a:hover { background: #2563eb; border-color: #2563eb; color: #fff; }
.logout-form { margin-top: auto; padding-top: 14px; }
.logout-form .link-button {
    width: 100%; text-align: left; padding: 11px 16px; border-radius: 10px;
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.05);
}
.link-button {
    color: #cbd5e1; cursor: pointer; font-size: 14.5px; font-weight: 500;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.link-button:hover { background: #dc2626; border-color: #dc2626; color: #fff; }

.page { flex: 1; min-width: 0; margin: 0; padding: 28px 36px; }
h1 { font-size: 23px; margin-bottom: 18px; }
h2 { font-size: 17px; margin: 22px 0 10px; }

.card { background: #fff; border-radius: 12px; padding: 22px; box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04); margin-bottom: 18px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #e5e7eb; }
th { color: #6b7280; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }
th a { color: inherit; text-decoration: none; }
th a:hover { color: #1f2430; text-decoration: underline; }
tr:hover td { background: #fafafa; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 11px 20px; border-radius: 10px; border: 1px solid #d1d5db;
    background: #fff; color: #1f2430; cursor: pointer; font-size: 15px; font-weight: 500;
    text-decoration: none; line-height: 1.2; transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease, transform 0.06s ease;
}
.btn:hover { background: #f3f4f6; border-color: #9ca3af; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: #2563eb; border-color: #2563eb; color: #fff; box-shadow: 0 2px 6px rgba(37,99,235,0.28); }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; box-shadow: 0 3px 10px rgba(37,99,235,0.35); }
.btn-danger { background: #dc2626; border-color: #dc2626; color: #fff; box-shadow: 0 2px 6px rgba(220,38,38,0.28); }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; box-shadow: 0 3px 10px rgba(220,38,38,0.35); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }

label { display: block; font-size: 13px; color: #374151; margin: 12px 0 4px; font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=time], select, textarea {
    width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.checkbox-row { display: flex; align-items: center; gap: 6px; margin: 6px 0; }
.checkbox-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.checkbox-grid label { display: flex; align-items: center; gap: 4px; margin: 0; font-weight: normal; }

/* Filter bars: side by side by default, wrapping to stacked rows only when
   the viewport is too narrow to fit them - see contacts/list.html. */
.filter-bar { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.filter-field { flex: 1 1 160px; min-width: 140px; }
.filter-field label { margin-top: 0; }
.filter-field-grow { flex: 2 1 220px; }
.filter-field-btn { flex: 0 0 auto; }

.bulk-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding-top: 16px; margin-top: 16px; border-top: 1px solid #e5e7eb; }
.bulk-toolbar-sep { width: 1px; align-self: stretch; background: #e5e7eb; }
.bulk-toolbar input[type=text], .bulk-toolbar select { width: auto; }

.status-badge {
    display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600;
    background: #e5e7eb; color: #374151;
}
.status-RUNNING { background: #dcfce7; color: #166534; }
.status-PAUSED { background: #fef9c3; color: #854d0e; }
.status-DRAFT { background: #e5e7eb; color: #374151; }
.status-COMPLETED { background: #dbeafe; color: #1e40af; }
.status-CANCELLED, .status-FAILED { background: #fee2e2; color: #991b1b; }

.error-banner { background: #fee2e2; color: #991b1b; padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; }
.success-banner { background: #dcfce7; color: #166534; padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; }

.tabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid #e5e7eb; }
.tabs a { padding: 8px 14px; text-decoration: none; color: #6b7280; font-size: 14px; border-bottom: 2px solid transparent; }
.tabs a.active { color: #2563eb; border-bottom-color: #2563eb; }

.pager { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 13px; color: #6b7280; }

.login-body { display: block; }
.login-page {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at 15% 15%, rgba(37,99,235,0.35), transparent 45%),
        radial-gradient(circle at 85% 85%, rgba(37,99,235,0.25), transparent 45%),
        linear-gradient(160deg, #0f172a, #1f2937 60%, #111827);
}
.login-card {
    width: 100%;
    max-width: 380px;
    background: #fff;
    border-radius: 16px;
    padding: 36px 32px 32px;
    box-shadow: 0 20px 45px rgba(0,0,0,0.35), 0 2px 6px rgba(0,0,0,0.08);
}
.login-brand { display: flex; align-items: center; gap: 10px; justify-content: center; }
.login-brand-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 10px; color: #fff;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 4px 10px rgba(37,99,235,0.35);
}
.login-brand-name { font-size: 19px; font-weight: 700; color: #1f2430; letter-spacing: 0.2px; }
.login-subtitle { text-align: center; color: #6b7280; font-size: 13.5px; margin: 8px 0 0; }
.login-card .error-banner { margin-top: 18px; margin-bottom: 0; }
.login-card form { margin-top: 6px; }
.login-submit { width: 100%; padding: 12px 20px; font-size: 15px; }

.ql-editor { min-height: 220px; background: #fff; }

.recipient-count {
    position: sticky; top: 8px; z-index: 5; margin: 16px 0 4px; padding: 10px 14px;
    background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; color: #1e3a8a; font-size: 14px;
}
.recipient-count strong { font-size: 18px; }
.recipient-count span { color: #64748b; font-size: 13px; }

.ce-html { display: flex; gap: 12px; flex-wrap: wrap; }
.ce-col { flex: 1 1 360px; min-width: 0; }
.ce-source {
    width: 100%; height: 440px; box-sizing: border-box;
    font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.45;
}
.ce-preview { width: 100%; height: 440px; border: 1px solid #d1d5db; border-radius: 6px; background: #fff; }
