:root {
    --bg: #eef2f7;
    --panel: #ffffff;
    --panel-2: #f4f7fb;
    --text: #20314d;
    --muted: #687890;
    --line: #d8e2ec;
    --brand: #173a67;
    --brand-dark: #102947;
    --brand-soft: #e9f0f7;
    --accent: #cb2026;
    --accent-dark: #a8191e;
    --success: #1f8f5f;
    --warning: #d97706;
    --danger: #c0392b;
    --danger-dark: #7f1d1d;
    --purple: #6d28d9;
    --shadow: 0 18px 40px rgba(23, 58, 103, 0.08);
    --shadow-strong: 0 24px 60px rgba(23, 58, 103, 0.12);
    --radius-lg: 24px;
    --radius-md: 18px;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    color: var(--text);
    overflow-x: hidden;
    background-color: #f3f7fc;
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.9), transparent 24%),
        radial-gradient(circle at left top, rgba(214, 226, 240, 0.4), transparent 30%),
        linear-gradient(180deg, #f9fbfe 0%, #edf3f9 100%);
    background-attachment: fixed;
    background-repeat: no-repeat;
}
body.has-system-confirm-open {
    overflow: hidden;
}
a { color: var(--brand); text-decoration: none; }
img { max-width: 100%; }
.layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: 100vh; min-width: 0; }
.sidebar {
    position: relative;
    background:
        linear-gradient(180deg, rgba(12, 32, 55, 0.92) 0%, rgba(23, 58, 103, 0.94) 100%),
        url("../../background.jpg") center center / cover no-repeat;
    color: #fff;
    padding: 28px 24px;
    box-shadow: inset -1px 0 0 rgba(255,255,255,.08);
}
.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 30px;
    padding: 16px 14px 18px;
    border-bottom: 1px solid rgba(255,255,255,.12);
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(255,255,255,.08) 0%, rgba(255,255,255,.03) 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.brand-mark {
    flex: 0 0 94px;
    width: 94px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 10px;
    border-radius: 16px;
    background:
        radial-gradient(circle at top left, rgba(255,255,255,1) 0%, rgba(255,255,255,.98) 34%, rgba(241,245,250,.95) 100%);
    border: 1px solid rgba(255,255,255,.35);
    box-shadow: 0 10px 20px rgba(5, 16, 32, .18);
}
.brand img {
    width: 100%;
    max-width: 72px;
    height: auto;
    display: block;
    filter: saturate(1.05) contrast(1.02);
}
.brand-copy {
    min-width: 0;
}
.brand strong {
    display: block;
    font-size: 19px;
    line-height: 1.04;
    letter-spacing: -0.03em;
    color: #fff;
}
.menu a {
    display: block;
    color: rgba(255,255,255,.92);
    padding: 13px 16px;
    border-radius: 14px;
    margin-bottom: 8px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.04);
    transition: background .2s ease, transform .2s ease, border-color .2s ease;
}
.menu a:hover { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.08); transform: translateX(2px); }
.menu a.active {
    background: linear-gradient(135deg, rgba(255,255,255,.18) 0%, rgba(255,255,255,.08) 100%);
    border-color: rgba(255,255,255,.16);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.menu a[href="logout.asp"] {
    margin-top: 18px;
    color: #fff;
    background: linear-gradient(135deg, rgba(203, 32, 38, 0.28) 0%, rgba(166, 24, 30, 0.22) 100%);
    border-color: rgba(203, 32, 38, 0.36);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 10px 20px rgba(8, 18, 34, .18);
}
.menu a[href="logout.asp"]:hover {
    background: linear-gradient(135deg, rgba(203, 32, 38, 0.42) 0%, rgba(166, 24, 30, 0.34) 100%);
    border-color: rgba(255, 129, 129, 0.34);
    transform: translateX(2px) translateY(-1px);
}
.menu a[href="logout.asp"]::before {
    content: "\2190";
    display: inline-block;
    margin-right: 10px;
    font-weight: 700;
    opacity: .9;
}
.content { min-width: 0; padding: 28px; }
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding: 22px 26px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(216,225,235,.9);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}
.topbar-main {
    min-width: 0;
}
.topbar h1 { margin: 0 0 8px; font-size: 34px; line-height: 1; letter-spacing: -0.03em; }
.topbar p { margin: 0; color: var(--muted); }
.topbar-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}
.topbar-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 999px;
    background: linear-gradient(180deg, #ffffff 0%, #f3f7fb 100%);
    border: 1px solid rgba(216,225,235,.95);
    color: var(--muted);
    font-size: 13px;
}
.topbar-chip strong {
    color: var(--brand-dark);
}
.alert, .box, .login-card, .card, .table-wrap, .hero {
    background: var(--panel);
    border: 1px solid rgba(216,225,235,.9);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
}
.alert {
    position: relative;
    padding: 16px 20px 16px 56px;
    margin-bottom: 18px;
    border-left: 4px solid var(--accent);
    color: var(--brand-dark);
    font-weight: 600;
}
.alert::before {
    content: "i";
    position: absolute;
    top: 50%;
    left: 18px;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    transform: translateY(-50%);
    font-size: 14px;
    font-weight: 800;
    line-height: 1;
    color: #fff;
    background: var(--accent);
    box-shadow: 0 8px 16px rgba(203, 32, 38, 0.22);
}
.alert-success {
    border-color: rgba(31, 143, 95, 0.28);
    background:
        linear-gradient(135deg, rgba(31, 143, 95, 0.14) 0%, rgba(255, 255, 255, 0.98) 58%),
        var(--panel);
    box-shadow: 0 18px 36px rgba(31, 143, 95, 0.12);
}
.alert-success::before {
    content: "\2713";
    background: linear-gradient(180deg, #28b36f 0%, #1f8f5f 100%);
    box-shadow: 0 10px 20px rgba(31, 143, 95, 0.24);
}
.alert-warning {
    border-color: rgba(217, 119, 6, 0.3);
    background:
        linear-gradient(135deg, rgba(217, 119, 6, 0.14) 0%, rgba(255, 255, 255, 0.98) 58%),
        var(--panel);
    box-shadow: 0 18px 36px rgba(217, 119, 6, 0.12);
}
.alert-warning::before {
    content: "!";
    background: linear-gradient(180deg, #e5941c 0%, #d97706 100%);
    box-shadow: 0 10px 20px rgba(217, 119, 6, 0.24);
}
.alert-danger {
    border-color: rgba(192, 57, 43, 0.3);
    background:
        linear-gradient(135deg, rgba(192, 57, 43, 0.12) 0%, rgba(255, 255, 255, 0.98) 58%),
        var(--panel);
    box-shadow: 0 18px 36px rgba(192, 57, 43, 0.12);
}
.alert-danger::before {
    content: "!";
    background: linear-gradient(180deg, #d55142 0%, #c0392b 100%);
    box-shadow: 0 10px 20px rgba(192, 57, 43, 0.24);
}
.system-confirm-overlay[hidden] {
    display: none;
}
.system-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    padding: 24px;
}
.system-confirm-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(3px);
}
.system-confirm-dialog {
    position: relative;
    width: min(100%, 520px);
    padding: 24px;
    border: 1px solid rgba(216,225,235,.95);
    border-radius: 24px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbfe 100%);
    box-shadow: 0 30px 70px rgba(15, 23, 42, 0.26);
}
.system-confirm-head strong {
    display: block;
    font-size: 24px;
    line-height: 1.05;
    letter-spacing: -0.03em;
    color: var(--brand-dark);
}
.system-confirm-body {
    margin-top: 14px;
}
.system-confirm-body p {
    margin: 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.6;
}
.system-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 22px;
}
.system-confirm-actions .btn {
    min-width: 120px;
    min-height: 46px;
}
.system-busy-overlay[hidden] {
    display: none;
}
.system-busy-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    display: grid;
    place-items: center;
    padding: 24px;
}
.system-busy-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.52);
    backdrop-filter: blur(4px);
}
.system-busy-dialog {
    position: relative;
    width: min(100%, 520px);
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 28px;
    border: 1px solid rgba(216,225,235,.95);
    border-radius: 24px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbfe 100%);
    box-shadow: 0 30px 70px rgba(15, 23, 42, 0.28);
    text-align: center;
}
.system-busy-dialog strong {
    font-size: 24px;
    line-height: 1.05;
    letter-spacing: -0.03em;
    color: var(--brand-dark);
}
.system-busy-dialog p,
.system-busy-dialog span {
    margin: 0;
    color: var(--muted);
}
.system-busy-spinner {
    width: 54px;
    height: 54px;
    border-radius: 999px;
    border: 4px solid rgba(31, 54, 95, 0.12);
    border-top-color: var(--brand);
    animation: systemBusySpin .85s linear infinite;
}
body.has-system-busy-open {
    overflow: hidden;
}
.is-submitting {
    pointer-events: none;
}
@keyframes systemBusySpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.grid { display: grid; gap: 18px; }
.grid.kpi { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 24px; }
.card { padding: 22px; }
.card h3, .card h4 { margin: 0 0 10px; }
.metric { font-size: 34px; font-weight: 700; line-height: 1; letter-spacing: -0.04em; color: var(--brand-dark); }
.metric-sub { color: var(--muted); font-size: 13px; }
.hero {
    padding: 24px 26px;
    margin-bottom: 24px;
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(320px, 380px);
    align-items: center;
    gap: 24px;
    background:
        linear-gradient(135deg, rgba(23, 58, 103, 0.98) 0%, rgba(19, 45, 84, 0.94) 58%, rgba(203, 32, 38, 0.9) 100%),
        url("../../background.jpg") center center / cover no-repeat;
    color: #fff;
    border: 0;
    box-shadow: var(--shadow-strong);
}
.hero > * {
    min-width: 0;
}
.hero-copy {
    max-width: 700px;
}
.hero h2 { margin: 0 0 8px; font-size: 30px; line-height: 1.02; letter-spacing: -0.04em; }
.hero .muted { color: rgba(255,255,255,.82); max-width: 58ch; font-size: 15px; line-height: 1.5; }
.btn, button, input[type=submit] {
    display: inline-block;
    border: 0;
    border-radius: 14px;
    padding: 12px 18px;
    background: var(--brand);
    color: #fff;
    cursor: pointer;
    font-weight: 700;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.btn:hover, button:hover, input[type=submit]:hover { transform: translateY(-1px); box-shadow: 0 10px 20px rgba(23, 58, 103, 0.14); }
.btn.secondary { background: var(--brand-soft); color: var(--brand-dark); }
.btn.warning { background: var(--warning); }
.btn.danger { background: var(--danger); }
.btn.purple { background: var(--purple); }
.btn.disabled,
button[disabled],
input[type=submit][disabled] {
    background: linear-gradient(180deg, #eef3f8 0%, #e2eaf3 100%);
    color: #8a9ab0;
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none;
    transform: none;
}
.btn.disabled:hover,
button[disabled]:hover,
input[type=submit][disabled]:hover {
    box-shadow: none;
    transform: none;
}
.actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
    max-width: 380px;
    justify-self: end;
    align-content: center;
    padding: 14px;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(255,255,255,.10) 0%, rgba(255,255,255,.05) 100%);
    border: 1px solid rgba(255,255,255,.12);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
    backdrop-filter: blur(8px);
}
.actions .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 50px;
    padding: 12px 18px;
    text-align: center;
    border-radius: 16px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1.2;
    text-shadow: none;
}
.actions .btn-wide { grid-column: auto; }
.hero .btn {
    background: linear-gradient(180deg, #ffffff 0%, #eef3f8 100%);
    color: var(--brand-dark);
    box-shadow: 0 12px 24px rgba(6, 18, 36, .16);
}
.hero .btn.secondary {
    background: linear-gradient(180deg, rgba(255,255,255,.18) 0%, rgba(255,255,255,.12) 100%);
    color: #fff;
    border: 1px solid rgba(255,255,255,.20);
    box-shadow: none;
}
.hero .btn.danger {
    background: linear-gradient(180deg, #d55142 0%, #c0392b 100%);
    color: #fff;
    box-shadow: 0 12px 24px rgba(192, 57, 43, .24);
}
.hero .btn.danger:hover {
    box-shadow: 0 14px 28px rgba(192, 57, 43, .28);
}
.hero .btn.warning {
    background: linear-gradient(180deg, #ea9a2a 0%, #d97706 100%);
    color: #fff;
    box-shadow: 0 12px 24px rgba(217, 119, 6, .22);
}
.hero .btn.warning:hover {
    box-shadow: 0 14px 28px rgba(217, 119, 6, .26);
}
.hero .btn.purple {
    background: linear-gradient(180deg, #7c3aed 0%, #6d28d9 100%);
    color: #fff;
    box-shadow: 0 12px 24px rgba(109, 40, 217, .22);
}
.hero .btn.purple:hover {
    box-shadow: 0 14px 28px rgba(109, 40, 217, .26);
}
.hero .btn.disabled {
    background: linear-gradient(180deg, rgba(255,255,255,.18) 0%, rgba(255,255,255,.12) 100%);
    color: rgba(255,255,255,.68);
    border: 1px solid rgba(255,255,255,.14);
}
.action-lock-note {
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255,255,255,.08);
    color: rgba(255,255,255,.84);
    font-size: 13px;
    line-height: 1.45;
    border: 1px solid rgba(255,255,255,.10);
}
.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}
.form-actions .btn,
.form-actions button,
.form-actions input[type=submit] {
    min-height: 44px;
}
.selection-action-card {
    margin-bottom: 24px;
    grid-column: 1 / -1;
}
.selection-action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}
.selection-action-grid form {
    display: grid;
    gap: 12px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: linear-gradient(180deg, #fbfdff 0%, #f3f7fb 100%);
}
.selection-action-grid form h4 {
    margin: 0;
    font-size: 18px;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--brand-dark);
}
.selection-bulk-undo {
    margin-bottom: 18px;
}
.selection-bulk-undo form {
    margin-top: 12px;
}
.selection-bulk-undo-summary {
    margin-top: 18px;
    margin-bottom: 0;
}
.summary-base-actions {
    margin-top: 18px;
}
.summary-base-actions form {
    display: flex;
    justify-content: flex-start;
}
.upload-limit-alert {
    margin-top: 14px;
    margin-bottom: 0;
}
.selection-random-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: end;
}
.selection-random-submit {
    display: flex;
    align-items: end;
}
.selection-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 18px 22px 0;
}
.selection-toolbar-main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
}
.selection-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--brand-dark);
    font-weight: 600;
}
.selection-counter {
    color: var(--muted);
    font-size: 14px;
}
.selection-counter strong {
    color: var(--brand-dark);
}
.selection-inline-options {
    margin-top: 12px;
}
.campaign-contacts-filter {
    margin: 0 22px 18px;
}
.operation-state-card {
    background: linear-gradient(180deg, #fbfdff 0%, #f4f8fc 100%);
}
.selection-cell {
    width: 56px;
    text-align: center;
}
form .form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], select, textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--text);
}
input[type=file] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--text);
}
textarea { min-height: 150px; resize: vertical; }
.full { grid-column: 1 / -1; }
.table-wrap { overflow: auto; padding: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th {
    padding: 14px 18px;
    background: linear-gradient(180deg, #f7f9fc 0%, #eef3f8 100%);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: #5d7190;
}
.table-wrap table tr:last-child td { border-bottom: 0; }
.badge {
    display: inline-flex;
    padding: 7px 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}
.status-rascunho { background: #e5e7eb; color: #374151; }
.status-agendada { background: #dbeafe; color: #1d4ed8; }
.status-em_envio { background: #ffedd5; color: #c2410c; }
.status-pausada { background: #ede9fe; color: #6d28d9; }
.status-concluida { background: #dcfce7; color: #166534; }
.status-cancelada { background: #fee2e2; color: #b91c1c; }
.status-erro { background: #fecaca; color: var(--danger-dark); }
.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 40px;
}
.login-card { width: 100%; max-width: 460px; padding: 30px; }
.progress {
    width: 100%;
    height: 14px;
    background: #e5eef6;
    border-radius: 999px;
    overflow: hidden;
}
.progress span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--brand) 0%, #4d8dc3 100%);
}
.muted { color: var(--muted); }
.split { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.html-preview { padding: 20px; background: #fff; border: 1px dashed var(--line); border-radius: 16px; }
.stack { display: grid; gap: 24px; }
.section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 14px;
}
.section-head h3 {
    margin: 0 0 4px;
    font-size: 24px;
    line-height: 1;
    letter-spacing: -0.03em;
}
.section-head p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}
.dashboard-overview {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(280px, .9fr);
    gap: 20px;
    margin-bottom: 24px;
}
.dashboard-summary {
    padding: 26px 28px;
    background: linear-gradient(135deg, #ffffff 0%, #f7f9fc 100%);
}
.dashboard-summary h3 {
    margin: 0 0 8px;
    font-size: 26px;
    line-height: 1;
    letter-spacing: -0.03em;
}
.dashboard-summary .summary-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 22px;
}
.dashboard-summary .summary-metrics strong,
.dashboard-insight strong {
    display: block;
    font-size: 28px;
    line-height: 1;
    color: var(--brand-dark);
}
.dashboard-summary .summary-metrics span,
.dashboard-insight span {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
}
.dashboard-summary .summary-metrics > div {
    min-height: 104px;
    padding: 16px 16px 14px;
    border-radius: 18px;
    border: 1px solid rgba(216,225,235,.9);
    background: linear-gradient(180deg, #ffffff 0%, #f6f9fc 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.75);
}
.dashboard-summary .summary-metrics > div strong {
    margin-bottom: 8px;
    font-size: 26px;
    letter-spacing: -0.05em;
}
.dashboard-summary .summary-metrics > div span {
    margin-top: 0;
    font-size: 12px;
    line-height: 1.45;
}
.dashboard-insight {
    padding: 26px 24px;
    background: linear-gradient(180deg, rgba(23, 58, 103, 0.98) 0%, rgba(16, 41, 71, 0.98) 100%);
    color: #fff;
    border: 0;
    box-shadow: var(--shadow-strong);
}
.dashboard-insight h3 {
    margin: 0 0 10px;
    font-size: 22px;
    line-height: 1.05;
}
.dashboard-insight p,
.dashboard-insight span {
    color: rgba(255,255,255,.78);
}
.dashboard-insight .summary-metrics {
    display: grid;
    gap: 12px;
    margin-top: 20px;
}
.dashboard-insight .summary-metrics > div {
    padding: 14px 14px 12px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255,255,255,.10) 0%, rgba(255,255,255,.05) 100%);
    border: 1px solid rgba(255,255,255,.08);
}
.dashboard-insight .summary-metrics > div strong {
    margin-bottom: 6px;
    font-size: 24px;
    color: #fff;
}
.dashboard-insight .summary-metrics > div span {
    margin-top: 0;
    font-size: 12px;
    line-height: 1.4;
}
.dashboard-kpi-grid {
    margin-bottom: 24px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
}
.dashboard-kpi-grid .kpi-card {
    padding: 18px 20px;
    border-color: rgba(216,225,235,.9);
    background: linear-gradient(180deg, #ffffff 0%, #f8fbfe 100%);
}
.dashboard-kpi-grid .kpi-card-primary,
.dashboard-kpi-grid > .kpi-card:nth-child(10),
.dashboard-kpi-grid > .kpi-card:nth-child(11) {
    background: linear-gradient(135deg, #ffffff 0%, #f3f8fd 100%);
    border-color: rgba(194, 210, 229, .95);
    box-shadow: 0 18px 36px rgba(23, 58, 103, 0.10);
}
.dashboard-kpi-grid .kpi-card-primary .metric,
.dashboard-kpi-grid > .kpi-card:nth-child(10) .metric,
.dashboard-kpi-grid > .kpi-card:nth-child(11) .metric {
    font-size: 28px;
}
.dashboard-kpi-grid .kpi-card-alert,
.dashboard-kpi-grid > .kpi-card:nth-child(9) {
    background: linear-gradient(135deg, #fff7f7 0%, #fff0f0 100%);
    border-color: rgba(239, 190, 190, .95);
}
.dashboard-kpi-grid > .kpi-card:nth-child(1) { order: 1; }
.dashboard-kpi-grid > .kpi-card:nth-child(8) { order: 2; }
.dashboard-kpi-grid > .kpi-card:nth-child(10) { order: 3; }
.dashboard-kpi-grid > .kpi-card:nth-child(11) { order: 4; }
.dashboard-kpi-grid > .kpi-card:nth-child(2) { order: 5; }
.dashboard-kpi-grid > .kpi-card:nth-child(3) { order: 6; }
.dashboard-kpi-grid > .kpi-card:nth-child(4) { order: 7; }
.dashboard-kpi-grid > .kpi-card:nth-child(5) { order: 8; }
.dashboard-kpi-grid > .kpi-card:nth-child(6) { order: 9; }
.dashboard-kpi-grid > .kpi-card:nth-child(7) { order: 10; }
.dashboard-kpi-grid > .kpi-card:nth-child(9) {
    order: 11;
    grid-column: auto;
}
.kpi-card h3 {
    font-size: 14px;
    color: var(--muted);
}
.dashboard-kpi-grid > .kpi-card:not(.kpi-card-primary):not(:nth-child(10)):not(:nth-child(11)) .metric {
    font-size: 26px;
    color: #27486f;
}
.kpi-card .metric-sub {
    font-size: 12px;
    line-height: 1.45;
}
.table-section-card {
    padding: 22px 22px 0;
    border: 1px solid rgba(216,225,235,.9);
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, rgba(255,255,255,.96) 0%, #ffffff 100%);
    box-shadow: var(--shadow);
}
.table-section-card .section-head {
    margin-bottom: 18px;
}
.table-section-card .table-wrap {
    margin: 0 -22px;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    box-shadow: none;
}
tbody tr {
    transition: background .18s ease;
}
tbody tr:hover {
    background: #f8fbfe;
}
td strong {
    color: var(--brand-dark);
}
.table-section-card .btn.secondary,
.table-section-card .btn {
    min-height: 42px;
    padding: 10px 18px;
    border-radius: 14px;
    background: linear-gradient(180deg, #eef4fb 0%, #e3edf8 100%);
    color: var(--brand-dark);
    border: 1px solid rgba(216,225,235,.95);
    box-shadow: none;
}
.table-section-card .btn.secondary:hover,
.table-section-card .btn:hover {
    background: linear-gradient(180deg, #e9f1fb 0%, #dce8f6 100%);
}
.table-section-card tbody td:first-child strong,
.table-section-card tbody td:nth-child(2) strong {
    font-size: 16px;
    letter-spacing: -0.02em;
}
.table-section-card tbody td:first-child,
.table-section-card tbody td:nth-child(2) {
    color: var(--brand-dark);
}
.table-section-card .muted {
    display: inline-block;
    margin-top: 4px;
    font-size: 13px;
    line-height: 1.45;
}
.table-section-card tbody td:first-child {
    color: #5f7390;
    font-size: 13px;
}
.table-section-card .badge {
    padding: 6px 10px;
    font-size: 11px;
    letter-spacing: .04em;
}
.toolbar-card {
    padding: 22px 24px;
    margin-bottom: 22px;
    background:
        radial-gradient(circle at top right, rgba(23, 58, 103, 0.06) 0%, rgba(23, 58, 103, 0) 28%),
        linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
}
.campaigns-toolbar {
    border-radius: 24px;
    box-shadow: 0 18px 42px rgba(23, 58, 103, 0.08);
}
.campaigns-toolbar-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
}
.campaigns-toolbar-copy {
    min-width: 0;
}
.campaigns-primary-action {
    min-width: 180px;
    min-height: 48px;
    padding: 12px 20px;
    border-radius: 16px;
    background: linear-gradient(135deg, #173a67 0%, #244f86 100%);
    box-shadow: 0 14px 28px rgba(23, 58, 103, 0.18);
}
.campaigns-filter-row {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(216,225,235,.9);
}
.campaigns-filter-label {
    flex: 0 0 auto;
    color: #647892;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.campaigns-filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.toolbar-card h3 {
    margin: 0 0 6px;
    font-size: 25px;
    line-height: 1;
    letter-spacing: -0.03em;
}
.toolbar-card p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    max-width: 72ch;
}
.toolbar-card .btn {
    min-height: 44px;
    padding: 10px 18px;
    border-radius: 14px;
}
.filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}
.filter-row .btn {
    flex: 0 0 auto;
    box-shadow: 0 10px 20px rgba(23, 58, 103, 0.12);
}
.filter-chip {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 7px 13px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, #ffffff 0%, #f7f9fc 100%);
    color: var(--brand-dark);
    font-size: 13px;
    font-weight: 700;
    transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.filter-chip:hover {
    transform: translateY(-1px);
    border-color: rgba(23, 58, 103, 0.18);
    background: #f9fbfe;
}
.filter-chip.active {
    background: linear-gradient(180deg, #eaf1f9 0%, #dfe9f5 100%);
    border-color: rgba(23, 58, 103, 0.16);
    color: var(--brand-dark);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.75);
}
.campaigns-table-card {
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 18px 42px rgba(23, 58, 103, 0.08);
    background: linear-gradient(180deg, #ffffff 0%, #fcfdff 100%);
}
.table-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 22px 24px 10px;
}
.table-card-header h3 {
    margin: 0 0 4px;
    font-size: 26px;
    line-height: 1;
    letter-spacing: -0.03em;
}
.table-card-header p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}
.table-card-header + .table-wrap {
    margin-top: 6px;
}
.table-card-header .inline-note {
    padding: 8px 14px;
    border-radius: 999px;
    background: linear-gradient(180deg, #ffffff 0%, #f5f8fc 100%);
    border: 1px solid rgba(216,225,235,.95);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.75);
}
.campaign-code {
    color: #637794;
    font-size: 13px;
    white-space: nowrap;
}
.campaign-name {
    min-width: 220px;
}
.campaign-name strong {
    display: inline-block;
    margin-bottom: 4px;
    font-size: 16px;
    letter-spacing: -0.02em;
}
.campaign-name .muted {
    font-size: 13px;
}
.campaign-batch {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 84px;
    line-height: 1.3;
}
.campaign-batch strong,
.campaign-stats strong {
    color: var(--brand-dark);
}
.campaign-batch strong {
    display: block;
    margin: 0;
    font-size: 18px;
    line-height: 1;
}
.campaign-batch .batch-label {
    display: block;
    margin: -2px 0 0;
    color: var(--brand-dark);
    font-size: 12px;
    font-weight: 700;
}
.campaign-batch .muted {
    display: block;
    margin-top: 2px;
    font-size: 12px;
}
.campaign-stats {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 190px;
    max-width: 240px;
    line-height: 1.2;
    font-size: 12px;
}
.campaign-stats .stat-inline {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 24px;
    padding: 0;
    border-radius: 999px;
    background: transparent;
    border: 0;
    color: #607491;
}
.campaign-stats .stat-inline::after {
    content: "";
    width: 4px;
    height: 4px;
    margin-left: 4px;
    border-radius: 50%;
    background: rgba(99,119,148,.35);
}
.campaign-stats .stat-inline:last-child::after {
    display: none;
}
.campaign-stats .stat-inline strong {
    display: inline-block;
    margin: 0;
    font-size: 14px;
    line-height: 1;
    color: var(--brand-dark);
}
.campaign-stats .stat-inline em {
    font-style: normal;
    font-size: 11px;
    font-weight: 700;
    color: #607491;
    letter-spacing: 0;
}
.campaign-date {
    white-space: nowrap;
    color: var(--brand-dark);
    min-width: 84px;
}
.campaign-date strong {
    display: block;
    margin-bottom: 3px;
    font-size: 14px;
}
.campaign-date .muted {
    font-size: 11px;
}
.campaign-actions-cell {
    width: 1%;
    text-align: right;
    white-space: nowrap;
}
.campaign-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}
.campaign-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 108px;
    min-height: 40px;
    padding: 9px 16px;
    border-radius: 14px;
    text-align: center;
    line-height: 1.2;
}
.campaigns-table-card tbody tr:hover {
    background: linear-gradient(90deg, rgba(248,251,254,.88) 0%, rgba(244,248,252,.96) 100%);
}
.inline-note {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    color: var(--muted);
    font-size: 13px;
}
.detail-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}
.detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(320px, .95fr);
    gap: 18px;
    margin-bottom: 18px;
}
.detail-grid > * {
    min-width: 0;
}
.detail-list {
    display: grid;
    gap: 12px;
}
.detail-item {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}
.detail-item:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}
.detail-item span {
    color: var(--muted);
    flex: 0 0 42%;
    max-width: 42%;
}
.detail-item strong {
    color: var(--brand-dark);
    flex: 1 1 0;
    text-align: right;
    overflow-wrap: break-word;
}
.email-summary-card .detail-item {
    flex-direction: column;
    gap: 6px;
}
.email-summary-card .detail-item span,
.email-summary-card .detail-item strong {
    flex: 1 1 auto;
    max-width: 100%;
    text-align: left;
}
.email-summary-card .detail-item strong {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.password-inline-field {
    display: flex;
    align-items: center;
    gap: 10px;
}
.password-inline-field input {
    flex: 1 1 auto;
}
.password-inline-toggle {
    flex: 0 0 auto;
    min-width: 108px;
    padding: 10px 14px;
}
.metric-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.metric-panel {
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f7f9fc 100%);
}
.metric-panel-linked {
    background: linear-gradient(180deg, #eef9f2 0%, #e6f5ec 100%);
    border-color: rgba(31, 143, 95, 0.22);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}
.metric-panel strong {
    display: block;
    margin-bottom: 6px;
    font-size: 28px;
    line-height: 1;
    color: var(--brand-dark);
}
.metric-panel-linked strong {
    color: #166534;
}
.metric-panel span {
    color: var(--muted);
    font-size: 13px;
}
.metric-panel-linked span {
    color: #2d6a4f;
    font-weight: 700;
}
.metric-panel-warning {
    background: linear-gradient(180deg, #fff8ed 0%, #fff2df 100%);
    border-color: rgba(217, 119, 6, 0.24);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.72);
}
.metric-panel-warning strong {
    color: #b45309;
}
.metric-panel-warning span {
    color: #9a5b10;
    font-weight: 700;
}
.card-title {
    margin: 0 0 18px;
    font-size: 24px;
    line-height: 1;
    letter-spacing: -0.03em;
}
.schedule-overview-card {
    display: grid;
    gap: 18px;
}
.schedule-overview-head .card-title {
    margin-bottom: 10px;
}
.schedule-overview-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}
.schedule-overview-section {
    padding-top: 4px;
    border-top: 1px solid var(--line);
}
.schedule-overview-section h4 {
    margin: 0 0 14px;
    font-size: 16px;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--brand-dark);
}
.schedule-prep-note {
    padding: 18px 20px;
    border: 1px solid rgba(31, 54, 95, 0.10);
    border-radius: 18px;
    background: linear-gradient(180deg, #f7fbff 0%, #eff5fc 100%);
}
.schedule-prep-note strong {
    display: block;
    margin-bottom: 8px;
    color: var(--brand-dark);
    font-size: 16px;
    letter-spacing: -0.02em;
}
.schedule-prep-note p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}
.schedule-confirm-card {
    display: grid;
    gap: 24px;
}
.schedule-field-grid {
    display: grid;
    gap: 14px;
    margin-bottom: 18px;
}
.schedule-confirm-compact {
    padding: 16px 18px;
    border: 1px solid rgba(216,225,235,.95);
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f7f9fc 100%);
    margin-bottom: 14px;
}
.schedule-confirm-compact strong {
    display: block;
    margin-bottom: 6px;
    color: var(--brand-dark);
    font-size: 16px;
    letter-spacing: -0.02em;
}
.schedule-confirm-compact p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}
.schedule-confirm-card .form-note {
    margin-top: 0;
}
.schedule-confirm-card form .actions {
    margin-top: 24px !important;
}
.table-section {
    margin-top: 18px;
}
.table-section .table-wrap {
    margin-top: 0;
}
.table-section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 12px;
    padding: 22px 22px 0;
}
.table-section-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}
.file-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}
.file-thumb {
    width: 58px;
    height: 58px;
    flex: 0 0 58px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(216,225,235,.9);
    background: linear-gradient(180deg, #ffffff 0%, #eef4fb 100%);
}
.file-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.file-thumb-generic {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-dark);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .06em;
}
.file-row-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}
.file-row-actions .btn {
    min-width: 96px;
    min-height: 38px;
    padding: 8px 12px;
}
.table-section-header h3 {
    margin: 0 0 4px;
    font-size: 22px;
    line-height: 1;
    letter-spacing: -0.03em;
}
.table-section-header p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}
.pill-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}
.pill-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 9px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--brand-dark);
    font-weight: 700;
}
.pill-nav a.active {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
    color: #fff;
}
.text-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--panel-2);
    color: var(--brand-dark);
    font-size: 12px;
    font-weight: 700;
}
.form-shell {
    display: grid;
    gap: 22px;
}
.form-panel {
    padding: 0;
    overflow: hidden;
}
.form-panel-head {
    padding: 22px 24px 0;
}
.form-panel-head h3 {
    margin: 0 0 4px;
    font-size: 24px;
    line-height: 1;
    letter-spacing: -0.03em;
}
.form-panel-head p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}
.form-panel-body {
    padding: 20px 24px 24px;
}
.form-grid.tight {
    gap: 18px;
}
.form-note {
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
}
.field-span-2 {
    grid-column: span 2;
}
.editor-input textarea {
    min-height: 220px;
    font-family: Consolas, "Courier New", monospace;
    line-height: 1.5;
}
.editor-input.compact textarea {
    min-height: 140px;
}
.campaign-editor-intro {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 20px;
    padding: 18px 20px;
    border: 1px solid rgba(216,225,235,.9);
    border-radius: 20px;
    background:
        linear-gradient(135deg, rgba(23, 58, 103, 0.06) 0%, rgba(255,255,255,.96) 45%, rgba(203, 32, 38, 0.05) 100%);
}
.campaign-editor-copy {
    min-width: 0;
}
.campaign-editor-copy strong {
    display: block;
    margin-bottom: 6px;
    font-size: 17px;
    color: var(--brand-dark);
}
.campaign-editor-copy p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.55;
}
.campaign-editor-tips {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}
.campaign-editor-grid {
    gap: 22px;
}
.campaign-attachments-intro {
    margin-bottom: 18px;
    padding: 18px 20px;
    border: 1px solid rgba(216,225,235,.9);
    border-radius: 20px;
    background: linear-gradient(180deg, #fbfdff 0%, #f5f9fd 100%);
}
.attachment-field input[type=file] {
    padding: 14px;
    border: 1px dashed rgba(23, 58, 103, 0.24);
    border-radius: 16px;
    background: #fff;
}
.attachment-preview {
    margin-top: 12px;
}
.attachment-preview-actions {
    margin-top: 10px;
}
.attachment-preview-actions .btn {
    min-height: 40px;
}
.attachment-preview-empty {
    padding: 12px 14px;
    border: 1px dashed rgba(23, 58, 103, 0.2);
    border-radius: 14px;
    background: #fff;
    color: var(--muted);
    font-size: 13px;
}
.attachment-preview-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    border: 1px solid rgba(216,225,235,.9);
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbfe 100%);
}
.attachment-preview-card img {
    width: 84px;
    height: 84px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid rgba(216,225,235,.9);
    background: #fff;
}
.attachment-preview-card-file {
    justify-content: flex-start;
}
.attachment-preview-meta {
    min-width: 0;
}
.attachment-preview-meta strong {
    display: block;
    margin-bottom: 4px;
    color: var(--brand-dark);
    word-break: break-word;
}
.attachment-preview-meta span {
    color: var(--muted);
    font-size: 12px;
}
.attachment-file-badge {
    width: 84px;
    height: 84px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: linear-gradient(135deg, #173a67 0%, #315b8f 100%);
    color: #fff;
    font-weight: 800;
    font-size: 15px;
    letter-spacing: .05em;
}
.schedule-picker {
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid rgba(216,225,235,.9);
    border-radius: 18px;
    background: linear-gradient(180deg, #fbfdff 0%, #f4f8fc 100%);
}
.schedule-picker-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) 110px 110px;
    gap: 12px;
    align-items: end;
}
.sub-label {
    display: block;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #607491;
}
.schedule-picker-summary {
    min-height: 46px;
    padding: 12px 14px;
    border-radius: 14px;
    background: #fff;
    border: 1px dashed rgba(23, 58, 103, 0.2);
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}
.schedule-picker-summary strong {
    color: var(--brand-dark);
}
.visual-editor-block label {
    margin-bottom: 10px;
}
.visual-editor-shell {
    border: 1px solid rgba(208, 219, 232, 0.95);
    border-radius: 22px;
    overflow: hidden;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.85), 0 14px 34px rgba(23, 58, 103, 0.08);
}
.visual-editor-shell.compact {
    border-radius: 20px;
}
.visual-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(216,225,235,.85);
    background: linear-gradient(180deg, #f9fbfe 0%, #f1f6fb 100%);
}
.editor-tool {
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 12px;
    background: #fff;
    color: var(--brand-dark);
    border: 1px solid rgba(205, 216, 230, 0.95);
    box-shadow: none;
    font-size: 13px;
    font-weight: 700;
}
.editor-tool:hover {
    background: linear-gradient(180deg, #ffffff 0%, #eef4fb 100%);
    box-shadow: 0 10px 18px rgba(23, 58, 103, 0.08);
}
.visual-editor {
    min-height: 280px;
    padding: 22px 24px;
    outline: none;
    color: var(--text);
    font-size: 15px;
    line-height: 1.65;
    background:
        linear-gradient(180deg, rgba(255,255,255,.96) 0%, rgba(251,253,255,.98) 100%);
}
.visual-editor.compact {
    min-height: 170px;
}
.visual-editor:empty::before {
    content: attr(data-placeholder);
    color: #91a0b7;
}
.visual-editor p {
    margin: 0 0 14px;
}
.visual-editor p:last-child {
    margin-bottom: 0;
}
.visual-editor ul,
.visual-editor ol {
    margin: 0 0 14px 22px;
    padding: 0;
}
.visual-editor a {
    color: var(--brand);
    text-decoration: underline;
}
.editor-link-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
}
.editor-link-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(18, 33, 58, 0.46);
    backdrop-filter: blur(4px);
}
.editor-link-dialog {
    position: relative;
    z-index: 1;
    width: min(520px, calc(100% - 32px));
    margin: 8vh auto 0;
    padding: 24px;
    border-radius: 24px;
    border: 1px solid rgba(210, 220, 233, 0.95);
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: 0 24px 60px rgba(11, 30, 56, 0.22);
}
.editor-link-head strong {
    display: block;
    margin-bottom: 6px;
    font-size: 24px;
    line-height: 1.1;
    color: var(--brand-dark);
}
.editor-link-head p {
    margin: 0;
    color: var(--muted);
}
.editor-link-body {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}
.editor-link-body label {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--brand-dark);
}
.editor-link-body input {
    width: 100%;
}
.editor-link-note {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}
.editor-link-error {
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(207, 71, 55, 0.1);
    color: #b13224;
    font-size: 13px;
    font-weight: 700;
}
.editor-link-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
}
body.has-editor-link-open {
    overflow: hidden;
}
.upload-dropzone {
    padding: 28px 24px;
    border: 2px dashed rgba(23, 58, 103, 0.2);
    border-radius: 18px;
    background: #fff;
}
.upload-dropzone input[type=file] {
    padding: 12px;
    background: #fff;
}
.upload-dropzone strong {
    display: block;
    margin-bottom: 8px;
    font-size: 20px;
    line-height: 1;
    color: var(--brand-dark);
}
.upload-dropzone p {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 14px;
}
.upload-file-grid {
    margin-top: 4px;
}
.upload-file-preview {
    margin-top: 12px;
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: linear-gradient(180deg, #fbfdff 0%, #f5f8fc 100%);
}
.upload-file-preview-thumb {
    width: 72px;
    height: 72px;
    border-radius: 14px;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: #eaf0f7;
    border: 1px solid rgba(216,225,235,.9);
}
.upload-file-preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.upload-file-preview-thumb span {
    font-size: 13px;
    font-weight: 800;
    color: var(--brand-dark);
    letter-spacing: .08em;
}
.upload-file-preview-copy {
    min-width: 0;
    display: grid;
    gap: 4px;
}
.upload-file-preview-copy strong,
.upload-file-preview-copy span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.upload-file-preview-copy span {
    color: var(--muted);
    font-size: 13px;
}
.upload-file-preview-remove {
    min-height: 42px;
}
.info-list {
    display: grid;
    gap: 12px;
}
.info-list .detail-item {
    padding-bottom: 10px;
}
.info-list .detail-item span,
.info-list .detail-item strong {
    min-width: 0;
}
.info-list .detail-item span {
    padding-right: 8px;
}
.contacts-page {
    display: grid;
    gap: 22px;
    padding: 0;
}
#contactsTableAnchor {
    scroll-margin-top: 18px;
}
.contacts-import-card,
.contacts-filter-card {
    border-radius: 24px;
    box-shadow: 0 18px 42px rgba(23, 58, 103, 0.08);
    background: linear-gradient(180deg, #ffffff 0%, #fcfdff 100%);
    margin-bottom: 18px;
}
.contacts-import-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(280px, .9fr);
    gap: 18px;
}
.contacts-panel {
    padding: 22px;
    border: 1px solid rgba(216,225,235,.9);
    border-radius: 20px;
    background: #fff;
}
.contacts-panel h4 {
    margin: 0 0 8px;
    font-size: 18px;
    line-height: 1.1;
    letter-spacing: -0.02em;
}
.contacts-panel p {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 14px;
}
.contacts-upload-dropzone {
    padding: 20px 18px;
}
.contacts-upload-dropzone label {
    margin-bottom: 10px;
}
.contacts-server-block {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid rgba(216,225,235,.9);
}
.contacts-filter-card {
    padding: 22px 24px;
}
.contacts-import-card .form-panel-head {
    padding: 22px 24px 10px;
}
.contacts-import-card .form-panel-body {
    padding: 20px 24px 24px;
}
.contacts-import-card .form-panel-head h3,
.contacts-filter-card h3 {
    font-size: 26px;
    line-height: 1;
    letter-spacing: -0.03em;
}
.contacts-filter-card form {
    display: grid;
    gap: 16px;
}
.contacts-filter-card .form-actions {
    margin-top: 0 !important;
}
.contacts-filter-card .form-grid {
    align-items: end;
}
.contacts-table-card .table-wrap {
    margin-top: 6px;
}
.contacts-table-card table {
    table-layout: fixed;
    min-width: 0;
}
.contacts-table-card .selection-cell {
    width: 56px;
    min-width: 56px;
}
.contacts-table-card th,
.contacts-table-card td {
    padding: 12px 12px;
    vertical-align: top;
}
.contacts-table-card thead th {
    font-size: 11px;
    letter-spacing: .12em;
}
.contacts-table-card tbody tr:hover {
    background: linear-gradient(90deg, rgba(248,251,254,.88) 0%, rgba(244,248,252,.96) 100%);
}
.contacts-name-cell {
    width: 20%;
}
.contacts-name-cell strong {
    display: block;
    font-size: 13px;
    line-height: 1.35;
    letter-spacing: -0.02em;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.contacts-email-cell {
    width: 24%;
    color: var(--brand-dark);
    font-size: 12px;
    line-height: 1.35;
}
.contacts-email-cell,
.contacts-company-cell {
    min-width: 0;
}
.contacts-email-cell span,
.contacts-company-cell span {
    display: block;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.contacts-company-cell {
    width: 20%;
    font-size: 12px;
    line-height: 1.35;
}
.contacts-company-cell,
.contacts-name-cell,
.contacts-email-cell {
    overflow-wrap: anywhere;
    word-break: break-word;
}
.contacts-status-cell,
.contacts-updated-cell {
    white-space: nowrap;
}
.contacts-status-cell { width: 10%; }
.contacts-updated-cell {
    width: 12%;
    font-size: 12px;
    color: var(--muted);
    min-width: 0;
}
.contacts-actions-cell {
    width: 14%;
    text-align: right;
}
.contacts-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 6px;
    min-width: 0;
}
.contacts-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    width: 100px;
    padding: 6px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    white-space: normal;
    text-align: center;
    box-shadow: none;
}
.contacts-actions .btn:hover {
    box-shadow: 0 8px 16px rgba(23, 58, 103, 0.10);
}
.contacts-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px 24px 20px;
    border-top: 1px solid var(--line);
    background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
}
.contacts-pagination-summary {
    color: var(--muted);
    font-size: 13px;
}
.contacts-pagination-summary strong,
.contacts-pagination-page strong {
    color: var(--brand-dark);
}
.contacts-pagination-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.contacts-pagination-actions .btn,
.contacts-pagination-actions .disabled {
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 12px;
}
.contacts-pagination-actions .disabled {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: #94a3b8;
    cursor: default;
}
.contacts-pagination-numbers {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.page-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(216,225,235,.95);
    background: linear-gradient(180deg, #ffffff 0%, #f5f8fc 100%);
    color: var(--brand-dark);
    font-size: 13px;
    font-weight: 700;
}
.page-chip.active {
    background: linear-gradient(180deg, #eaf1f9 0%, #dfe9f5 100%);
    border-color: rgba(23, 58, 103, 0.16);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.75);
}
.page-ellipsis {
    color: #94a3b8;
    font-size: 13px;
    font-weight: 700;
    padding: 0 2px;
}
.contacts-pagination-page {
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}
.contacts-table-card.is-loading {
    opacity: .68;
    transition: opacity .18s ease;
    pointer-events: none;
}
.kpi-card {
    position: relative;
    overflow: hidden;
}
.kpi-card::after {
    content: "";
    position: absolute;
    inset: auto -24px -24px auto;
    width: 86px;
    height: 86px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(23, 58, 103, 0.12) 0%, rgba(23, 58, 103, 0) 70%);
}
.kpi-card .metric-sub strong {
    color: var(--brand-dark);
}
@media (max-width: 1080px) {
    .layout, .split, form .form-grid, .dashboard-overview, .detail-grid { grid-template-columns: 1fr; }
    .sidebar { padding-bottom: 10px; }
    .hero { grid-template-columns: 1fr; align-items: flex-start; }
    .actions { justify-self: stretch; max-width: 100%; }
    .topbar { flex-direction: column; align-items: flex-start; }
    .topbar-meta { justify-content: flex-start; }
    .campaigns-toolbar-head { flex-direction: column; align-items: flex-start; }
    .campaigns-primary-action { min-width: 0; }
    .campaigns-filter-row { align-items: flex-start; }
    .dashboard-summary .summary-metrics { grid-template-columns: 1fr; }
    .dashboard-summary .summary-metrics > div { min-height: 0; }
    .dashboard-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-kpi-grid > .kpi-card:nth-child(9) { grid-column: auto; }
    .table-card-header { flex-direction: column; align-items: flex-start; }
    .table-section-header { flex-direction: column; align-items: flex-start; }
    .field-span-2 { grid-column: auto; }
    .contacts-import-grid { grid-template-columns: 1fr; }
    .contacts-table-card table { table-layout: auto; min-width: 1120px; }
    .contacts-actions { min-width: 0; }
}
@media (max-width: 860px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar { padding: 20px 18px; }
    .content { padding: 18px; }
    .topbar { padding: 18px 20px; }
    .topbar h1 { font-size: 28px; }
    .hero { padding: 22px 20px; }
    .hero h2 { font-size: 28px; }
    .campaigns-filter-row { flex-direction: column; }
    .campaigns-table-card .table-card-header { padding: 20px 18px 8px; }
    .campaign-actions {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }
    .campaign-actions .btn {
        width: 100%;
        min-width: 0;
    }
    .dashboard-kpi-grid { grid-template-columns: 1fr; }
    .table-section-card { padding: 20px 18px 0; }
    .table-section-card .table-wrap { margin: 0 -18px; }
    .actions { grid-template-columns: 1fr; }
    .actions .btn-wide { grid-column: auto; }
    .metric-grid { grid-template-columns: 1fr; }
    .campaign-editor-intro { flex-direction: column; }
    .campaign-editor-tips { justify-content: flex-start; }
    .visual-editor-toolbar { gap: 8px; }
    .editor-tool { flex: 0 0 auto; }
    .schedule-picker-grid { grid-template-columns: 1fr; }
    .detail-item { flex-direction: column; gap: 4px; }
    .detail-item strong { text-align: left; }
    .contacts-filter-card,
    .contacts-import-card .form-panel-head,
    .contacts-import-card .form-panel-body,
    .campaigns-table-card .table-card-header {
        padding-left: 18px;
        padding-right: 18px;
    }
    .contacts-table-card th,
    .contacts-table-card td {
        padding: 12px 10px;
    }
    .contacts-name-cell,
    .contacts-email-cell,
    .contacts-company-cell,
    .contacts-status-cell,
    .contacts-updated-cell,
    .contacts-actions-cell {
        width: auto;
        min-width: 120px;
        white-space: normal;
    }
    .contacts-updated-cell {
        min-width: 110px;
    }
    .contacts-actions {
        min-width: 0;
    }
    .contacts-pagination {
        flex-direction: column;
        align-items: flex-start;
    }
    .contacts-actions .btn {
        min-height: 34px;
        width: 100px;
        padding: 7px 10px;
    }
}
