* {
    box-sizing: border-box;
}

:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --border: #e5e9f2;
    --text: #172033;
    --muted: #6f788b;
    --primary: #315efb;
    --primary-dark: #244bd2;
    --sidebar: #111827;
}

body {
    margin: 0;
    font-family: Inter, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.app {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: 250px;
    min-height: 100vh;
    background: var(--sidebar);
    color: white;
    padding: 22px 14px;
    display: flex;
    flex-direction: column;
}

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

.brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--primary);
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 20px;
}

.brand strong,
.brand span {
    display: block;
}

.brand span {
    margin-top: 3px;
    color: #9ba4b5;
    font-size: 11px;
}

nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.nav-item {
    border: 0;
    background: transparent;
    color: #aeb6c5;
    text-align: left;
    padding: 12px 13px;
    border-radius: 8px;
    font-size: 14px;
}

.nav-item span {
    display: inline-block;
    width: 28px;
}

.nav-item:hover,
.nav-item.active {
    background: #202a3d;
    color: white;
}

.nav-item.active {
    box-shadow: inset 3px 0 0 var(--primary);
}

.nav-divider {
    height: 1px;
    background: #283244;
    margin: 14px 8px;
}

.sidebar-footer {
    margin-top: auto;
    padding: 14px 10px;
    border-top: 1px solid #283244;
    display: flex;
    gap: 10px;
    align-items: center;
}

.sidebar-footer strong,
.sidebar-footer span {
    display: block;
}

.sidebar-footer strong {
    font-size: 12px;
}

.sidebar-footer span {
    color: #9ba4b5;
    font-size: 10px;
    margin-top: 3px;
}

.status-dot {
    width: 9px;
    height: 9px;
    background: #31c48d;
    border-radius: 50%;
}

.main {
    flex: 1;
    min-width: 0;
}

.topbar {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 22px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topbar h1 {
    margin: 0;
    font-size: 23px;
}

.topbar p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.topbar-actions {
    display: flex;
    gap: 10px;
}

.primary-btn,
.outline-btn,
.text-btn {
    border-radius: 7px;
    padding: 10px 15px;
    font-weight: 600;
    font-size: 13px;
}

.primary-btn {
    border: 1px solid var(--primary);
    background: var(--primary);
    color: white;
}

.primary-btn:hover {
    background: var(--primary-dark);
}

.outline-btn {
    border: 1px solid var(--border);
    background: white;
    color: var(--text);
}

.outline-btn:hover {
    background: #f5f7fb;
}

.text-btn {
    border: 0;
    background: transparent;
    color: var(--primary);
}

#content {
    padding: 30px;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

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

.stat-card,
.panel,
.page-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 11px;
}

.stat-card {
    padding: 21px;
}

.stat-label {
    color: var(--muted);
    font-size: 13px;
}

.stat-value {
    font-size: 29px;
    font-weight: 750;
    margin-top: 10px;
}

.stat-note {
    margin-top: 7px;
    font-size: 11px;
    color: var(--muted);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 18px;
    margin-top: 18px;
}

.panel {
    padding: 22px;
}

.panel-header,
.page-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.panel-header h2,
.page-card-header h2 {
    margin: 0;
    font-size: 17px;
}

.panel-header p,
.page-card-header p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.empty-state,
.placeholder {
    padding: 45px 20px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

.system-status {
    margin-top: 18px;
}

.status-row {
    display: flex;
    justify-content: space-between;
    padding: 15px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.status-row strong {
    color: #31a878;
}

.page-card {
    padding: 24px;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

form {
    margin-top: 25px;
}

form label {
    display: block;
    margin: 15px 0 7px;
    font-size: 12px;
    font-weight: 600;
}

form input,
form select {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: white;
    outline: none;
}

form input:focus,
form select:focus {
    border-color: var(--primary);
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 22px;
}

.notice {
    margin-top: 22px;
    padding: 13px;
    border-radius: 7px;
    background: #f3f6ff;
    color: #59657b;
    font-size: 12px;
    line-height: 1.5;
}

.delivery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-top: 25px;
}

.delivery-card {
    border: 1px solid var(--border);
    padding: 18px;
    border-radius: 8px;
}

.delivery-card span,
.delivery-card strong {
    display: block;
}

.delivery-card span {
    color: var(--muted);
    font-size: 12px;
}

.delivery-card strong {
    margin-top: 8px;
    font-size: 24px;
}

.toast {
    position: fixed;
    right: 25px;
    bottom: 25px;
    padding: 13px 18px;
    background: #172033;
    color: white;
    border-radius: 8px;
    font-size: 13px;
    display: none;
    box-shadow: 0 8px 30px rgba(0,0,0,.18);
}

@media (max-width: 1000px) {
    .sidebar {
        width: 210px;
    }

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

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

@media (max-width: 700px) {
    .sidebar {
        display: none;
    }

    .topbar {
        padding: 18px;
    }

    #content {
        padding: 18px;
    }

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

    .topbar-actions {
        display: none;
    }
}

.setting-status {
    margin-top: 5px;
    margin-bottom: 12px;
    color: var(--muted);
    font-size: 11px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

.notice {
    margin-top: 18px;
    padding: 12px;
    border-radius: 7px;
    background: #f5f7fb;
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 11px;
}


/* ============================================================
   CAMPAIGN UI - PROFESSIONAL
   ============================================================ */

.campaign-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.campaign-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-width: 0;
    padding: 18px 20px;

    border: 1px solid #eaecf0;
    border-radius: 10px;
    background: #fff;

    box-shadow: 0 1px 2px rgba(16, 24, 40, .03);

    transition:
        border-color .15s ease,
        box-shadow .15s ease,
        transform .15s ease;
}

.campaign-card:hover {
    border-color: #d0d5dd;
    box-shadow: 0 4px 12px rgba(16, 24, 40, .06);
    transform: translateY(-1px);
}

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

.campaign-icon {
    flex: 0 0 42px;

    width: 42px;
    height: 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 1px solid #dbe7ff;
    border-radius: 10px;

    background: #f4f7ff;
    color: #316dff;

    font-size: 18px;
}

.campaign-info {
    min-width: 0;
}

.campaign-info h3 {
    margin: 0 0 5px;

    color: #101828;

    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.campaign-info p {
    margin: 0 0 9px;

    color: #667085;

    font-size: 12px;
    line-height: 1.45;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.campaign-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 14px;

    color: #667085;
    font-size: 11px;
}

.campaign-meta span {
    white-space: nowrap;
}

.campaign-side {
    display: flex;
    align-items: center;
    justify-content: flex-end;

    gap: 12px;
    flex: 0 0 auto;
}

.campaign-status,
.recipient-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 24px;
    padding: 3px 9px;

    border-radius: 999px;

    font-size: 11px;
    font-weight: 600;

    text-transform: capitalize;
    white-space: nowrap;
}

.status-draft {
    background: #f2f4f7;
    color: #475467;
}

.status-prepared {
    background: #fff4e5;
    color: #9a6700;
}

.status-sending {
    background: #eff8ff;
    color: #175cd3;
}

.status-completed,
.status-sent {
    background: #ecfdf3;
    color: #027a48;
}

.status-failed {
    background: #fef3f2;
    color: #b42318;
}

.status-pending {
    background: #f2f4f7;
    color: #475467;
}

.campaign-card .campaign-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
}

.campaign-card .campaign-actions .small-btn {
    min-height: 32px;
    padding: 6px 10px !important;

    border-radius: 7px;

    font-size: 11px !important;
    font-weight: 600;

    white-space: nowrap;
}

.campaign-card .campaign-actions .outline-btn:hover {
    border-color: #98a2b3;
    background: #f9fafb;
}

.campaign-card .campaign-actions .primary-btn:hover {
    filter: brightness(.97);
}

@media (max-width: 900px) {

    .campaign-card {
        align-items: flex-start;
    }

    .campaign-side {
        align-items: flex-end;
        flex-direction: column;
        gap: 8px;
    }

}

@media (max-width: 700px) {

    .campaign-card {
        align-items: stretch;
        flex-direction: column;
        gap: 16px;
        padding: 16px;
    }

    .campaign-main {
        align-items: flex-start;
    }

    .campaign-icon {
        flex-basis: 38px;
        width: 38px;
        height: 38px;
        border-radius: 9px;
    }

    .campaign-info h3,
    .campaign-info p {
        white-space: normal;
    }

    .campaign-meta {
        gap: 6px 10px;
    }

    .campaign-side {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
    }

    .campaign-status {
        align-self: flex-start;
    }

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

    .campaign-card .campaign-actions .small-btn {
        flex: 1;
        min-width: 0;
    }

}


/* Modal */


.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(16, 24, 40, 0.55);
}

.modal-overlay.active {
    display: flex;
}

.modal-card {
    width: min(760px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.campaign-detail-card {
    width: min(900px, 100%);
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 24px;
    border-bottom: 1px solid #eaecf0;
}

.modal-header h2 {
    margin: 0 0 5px;
}

.modal-header p {
    margin: 0;
    color: #667085;
}

.modal-close {
    border: 0;
    background: transparent;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #667085;
}

#campaign-form {
    padding: 24px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
}

.form-group input,
.form-group select {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 12px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    background: #fff;
    font-size: 14px;
}

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

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #eaecf0;
}

/* Campaign details */

#campaign-detail-content {
    padding: 24px;
}

.detail-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.detail-stats > div {
    padding: 15px;
    border: 1px solid #eaecf0;
    border-radius: 10px;
}

.detail-stats span,
.detail-stats strong {
    display: block;
}

.detail-stats span {
    font-size: 12px;
    color: #667085;
    margin-bottom: 5px;
}

.detail-stats strong {
    font-size: 22px;
}

.campaign-summary {
    display: grid;
    gap: 10px;
    padding: 16px;
    border-radius: 10px;
    background: #f9fafb;
}

.campaign-summary > div {
    display: flex;
    gap: 15px;
}

.campaign-summary strong {
    width: 80px;
}

.campaign-summary span {
    color: #475467;
}

.campaign-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0;
}

.recipient-heading {
    margin-top: 25px;
}

.recipient-table {
    border: 1px solid #eaecf0;
    border-radius: 10px;
    overflow: hidden;
}

.recipient-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 12px 15px;
    border-bottom: 1px solid #eaecf0;
}

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

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

.recipient-row > div span {
    margin-top: 3px;
    font-size: 12px;
    color: #667085;
}

.empty-state {
    text-align: center;
    padding: 45px 20px;
    color: #667085;
}

.empty-state h3 {
    margin-bottom: 6px;
    color: #344054;
}

@media (max-width: 700px) {

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

    .form-full {
        grid-column: auto;
    }

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

    .campaign-side {
        width: 100%;
        justify-content: space-between;
    }

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

    .campaign-summary > div {
        flex-direction: column;
        gap: 3px;
    }

    .recipient-row {
        align-items: flex-start;
        flex-direction: column;
    }
}


/* ============================================================
   SMART MAILER - PROFESSIONAL TEMPLATE EDITOR
   ============================================================ */

.template-modal-card {
    width: min(1050px, 94vw);
    max-width: 1050px;
    max-height: 94vh;
    overflow-y: auto;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 35, 80, 0.25);
}

/* Cobalt blue editor header */
.template-modal-card .modal-header {
    background: linear-gradient(135deg, #084c9e 0%, #1769c2 55%, #2581dc 100%);
    color: #fff;
    padding: 24px 28px;
    border-radius: 16px 16px 0 0;
}

.template-modal-card .modal-header h2 {
    color: #fff;
    margin: 0 0 5px;
    font-size: 22px;
}

.template-modal-card .modal-header p {
    color: rgba(255,255,255,.85);
    margin: 0;
}

.template-modal-card .modal-close {
    color: #fff;
    font-size: 30px;
    opacity: .9;
}

.template-modal-card .modal-close:hover {
    opacity: 1;
}

/* Editor body */
.template-modal-card form {
    padding: 28px;
    background: #fff;
}

.template-modal-card .form-group label {
    display: block;
    font-weight: 700;
    color: #17365d;
    margin-bottom: 8px;
}

/* Name + Subject */
.template-modal-card input,
.template-modal-card select {
    min-height: 46px;
    border: 1px solid #cbd8e8;
    border-radius: 8px;
    padding: 11px 13px;
    background: #fff;
    transition: .2s ease;
}

.template-modal-card input:focus,
.template-modal-card select:focus {
    outline: none;
    border-color: #1769c2;
    box-shadow: 0 0 0 3px rgba(23,105,194,.12);
}

/* Plain Text / HTML selector */
.template-type-buttons {
    display: inline-flex;
    gap: 4px;
    padding: 5px;
    background: #edf3fa;
    border: 1px solid #d7e2ee;
    border-radius: 10px;
}

.template-type-btn {
    border: 0;
    background: transparent;
    color: #46617c;
    padding: 10px 24px;
    border-radius: 7px;
    font-weight: 700;
    cursor: pointer;
    transition: .2s ease;
}

.template-type-btn:hover {
    color: #084c9e;
}

.template-type-btn.active {
    background: #1769c2;
    color: #fff;
    box-shadow: 0 3px 8px rgba(8,76,158,.25);
}

/* Personalization area */
.template-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 13px;
    background: #f5f9fd;
    border: 1px solid #d7e4f1;
    border-radius: 10px;
}

.template-tags::before {
    content: "Insert:";
    color: #526b85;
    font-size: 13px;
    font-weight: 700;
    margin-right: 4px;
}

.template-tags button {
    border: 1px solid #1769c2;
    background: #fff;
    color: #1769c2;
    border-radius: 7px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: .2s ease;
}

.template-tags button:hover {
    background: #1769c2;
    color: #fff;
}

/* BIG MESSAGE EDITOR */
.template-editor {
    display: block;
    width: 100%;
    min-height: 500px !important;
    height: 500px;
    box-sizing: border-box;
    resize: vertical;

    padding: 18px;
    border: 1px solid #c5d5e6;
    border-radius: 10px;

    background: #fbfdff;
    color: #172b4d;

    font-family: "Courier New", Consolas, monospace;
    font-size: 14px;
    line-height: 1.7;

    transition: .2s ease;
}

.template-editor:focus {
    outline: none;
    border-color: #1769c2;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(23,105,194,.12);
}

/* Help text */
.template-modal-card .form-help {
    display: block;
    margin-top: 8px;
    color: #71859b;
    font-size: 12px;
}

/* HTML preview */
.template-preview {
    min-height: 220px;
    padding: 22px;
    background: #fff;
    border: 1px solid #cbd8e8;
    border-radius: 10px;
    box-shadow: inset 0 1px 4px rgba(0,0,0,.04);
}

/* Buttons */
.template-modal-card .primary-btn {
    background: #1769c2;
    border-color: #1769c2;
}

.template-modal-card .primary-btn:hover {
    background: #084c9e;
    border-color: #084c9e;
}

/* Template list rows */
#template-list .campaign-row {
    border-left: 4px solid #1769c2;
    transition: .2s ease;
}

#template-list .campaign-row:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 16px rgba(8,76,158,.10);
}

/* Mobile */
@media (max-width: 700px) {

    .template-modal-card {
        width: 96vw;
        max-height: 95vh;
    }

    .template-modal-card form {
        padding: 18px;
    }

    .template-editor {
        min-height: 380px !important;
        height: 380px;
    }

    .template-type-buttons {
        width: 100%;
    }

    .template-type-btn {
        flex: 1;
    }
}


/* =========================================================
   SMART MAILER — PROFESSIONAL TEMPLATE EDITOR
   Colong Blue / Professional UI
   ========================================================= */

.template-modal-card {
    width: min(1100px, 94vw);
    max-height: 94vh;
    overflow-y: auto;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.25);
}

.template-modal-card .modal-header {
    padding: 24px 28px;
    border-bottom: 1px solid #e5eaf2;
    background: linear-gradient(135deg, #f8fbff 0%, #eef5ff 100%);
}

.template-modal-card .modal-header h2 {
    margin: 0 0 5px;
    font-size: 22px;
    font-weight: 700;
    color: #102a43;
}

.template-modal-card .modal-header p {
    margin: 0;
    color: #62748a;
    font-size: 13px;
}

.template-modal-card form {
    padding: 26px 28px 28px;
}

.template-modal-card .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
}

.template-modal-card .form-full {
    grid-column: 1 / -1;
}

.template-modal-card .form-group {
    margin: 0;
}

.template-modal-card .form-group label {
    display: block;
    margin-bottom: 8px;
    color: #243b53;
    font-size: 13px;
    font-weight: 700;
}

.template-modal-card input,
.template-modal-card textarea,
.template-modal-card select {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #ccd6e3;
    border-radius: 10px;
    background: #fff;
    color: #172b4d;
    font-size: 14px;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.template-modal-card input {
    min-height: 46px;
    padding: 0 14px;
}

.template-modal-card input:focus,
.template-modal-card textarea:focus {
    outline: none;
    border-color: #1769aa;
    box-shadow: 0 0 0 3px rgba(23, 105, 170, .12);
}

.template-type-buttons {
    display: inline-flex;
    padding: 4px;
    gap: 4px;
    border-radius: 10px;
    background: #edf3f9;
    border: 1px solid #d9e3ee;
}

.template-type-btn {
    border: 0;
    border-radius: 7px;
    padding: 9px 18px;
    background: transparent;
    color: #52667d;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all .18s ease;
}

.template-type-btn:hover {
    color: #145a8d;
}

.template-type-btn.active {
    background: #1769aa;
    color: #fff;
    box-shadow: 0 2px 6px rgba(23, 105, 170, .25);
}

.template-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px;
    border: 1px solid #dce5ef;
    border-radius: 12px;
    background: #f8fafc;
}

.template-tags::before {
    content: "Insert a field:";
    width: 100%;
    margin-bottom: 2px;
    color: #70839a;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.template-tags button {
    border: 1px solid #b9d1e6;
    border-radius: 20px;
    padding: 8px 13px;
    background: #fff;
    color: #145a8d;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all .18s ease;
}

.template-tags button:hover {
    border-color: #1769aa;
    background: #eaf4fc;
    transform: translateY(-1px);
}

.template-editor {
    display: block;
    min-height: 500px;
    resize: vertical;
    padding: 17px 18px !important;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    line-height: 1.65;
    font-size: 13px !important;
    background: #fbfdff !important;
}

#template-preview-section {
    margin-top: 2px;
}

.template-preview {
    min-height: 260px;
    padding: 24px;
    overflow: auto;
    border: 1px solid #d7e1eb;
    border-radius: 12px;
    background: #fff;
    box-shadow: inset 0 1px 3px rgba(15, 23, 42, .04);
}

.form-help {
    display: block;
    margin-top: 8px;
    color: #718399;
    font-size: 11px;
    line-height: 1.5;
}

.template-modal-card .modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 22px;
    margin-top: 24px;
    border-top: 1px solid #e5eaf2;
}

.template-modal-card .primary-btn {
    min-height: 42px;
    padding: 0 20px;
    border-radius: 9px;
}

.template-modal-card .secondary-btn {
    min-height: 42px;
    padding: 0 18px;
    border-radius: 9px;
}

/* Template list */

#template-list {
    display: grid;
    gap: 12px;
}

#template-list .campaign-row {
    padding: 17px 18px;
    border: 1px solid #e1e8f0;
    border-radius: 12px;
    background: #fff;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

#template-list .campaign-row:hover {
    border-color: #b8d2e8;
    box-shadow: 0 7px 22px rgba(20, 56, 89, .08);
    transform: translateY(-1px);
}

#template-list .campaign-info {
    min-width: 0;
}

#template-list .campaign-info strong {
    display: block;
    margin-bottom: 5px;
    color: #17324d;
    font-size: 14px;
}

#template-list .campaign-info span {
    display: block;
    overflow: hidden;
    color: #718399;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#template-list .campaign-actions {
    display: flex;
    gap: 7px;
}

#template-list .campaign-actions button {
    border-radius: 8px;
}

@media (max-width: 760px) {
    .template-modal-card {
        width: 96vw;
        max-height: 96vh;
    }

    .template-modal-card form {
        padding: 20px;
    }

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

    .template-modal-card .form-full {
        grid-column: auto;
    }

    .template-editor {
        min-height: 400px;
    }
}


/* =========================================================
   SMART MAILER - PROFESSIONAL TEMPLATE EDITOR
   Colonial Blue Design
   ========================================================= */

:root {
    --template-blue: #1f4e79;
    --template-blue-dark: #163a5c;
    --template-blue-light: #eaf2f8;
    --template-border: #d7e0e8;
    --template-text: #1f2937;
    --template-muted: #6b7280;
}

/* ---------- Template modal ---------- */

#template-modal {
    padding: 24px;
    backdrop-filter: blur(4px);
}

#template-modal .template-modal-card {
    width: min(1100px, 96vw);
    max-width: 1100px;
    max-height: 94vh;
    overflow-y: auto;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.25);
    border: 1px solid #dce4eb;
}

/* ---------- Header ---------- */

#template-modal .modal-header {
    padding: 24px 30px;
    background: linear-gradient(
        135deg,
        var(--template-blue-dark),
        var(--template-blue)
    );
    color: #ffffff;
    border-radius: 16px 16px 0 0;
    border-bottom: none;
}

#template-modal .modal-header h2 {
    margin: 0 0 6px;
    color: #ffffff;
    font-size: 25px;
    font-weight: 700;
}

#template-modal .modal-header p {
    margin: 0;
    color: rgba(255, 255, 255, 0.82);
    font-size: 14px;
}

#template-modal .modal-close {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 24px;
    transition: all 0.2s ease;
}

#template-modal .modal-close:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: rotate(90deg);
}

/* ---------- Form ---------- */

#template-modal #template-form {
    padding: 28px 30px 30px;
}

#template-modal .form-grid {
    gap: 22px;
}

#template-modal .form-group {
    margin-bottom: 2px;
}

#template-modal .form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--template-text);
    font-size: 13px;
    font-weight: 700;
}

#template-modal .form-group input,
#template-modal .form-group select {
    width: 100%;
    min-height: 46px;
    padding: 11px 14px;
    border: 1px solid var(--template-border);
    border-radius: 9px;
    background: #ffffff;
    color: var(--template-text);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease,
                box-shadow 0.2s ease;
    box-sizing: border-box;
}

#template-modal .form-group input:focus,
#template-modal .form-group select:focus {
    border-color: var(--template-blue);
    box-shadow: 0 0 0 3px rgba(31, 78, 121, 0.12);
}

/* ---------- Message type ---------- */

#template-modal .template-type-buttons {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    background: #edf2f6;
    border: 1px solid var(--template-border);
    border-radius: 10px;
}

#template-modal .template-type-btn {
    min-width: 120px;
    padding: 10px 18px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: #4b5563;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

#template-modal .template-type-btn:hover {
    color: var(--template-blue);
}

#template-modal .template-type-btn.active {
    background: var(--template-blue);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(31, 78, 121, 0.25);
}

/* ---------- Personalization ---------- */

#template-modal .template-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px;
    background: var(--template-blue-light);
    border: 1px solid #cbddea;
    border-radius: 10px;
}

#template-modal .template-tags::before {
    content: "Insert variable:";
    display: flex;
    align-items: center;
    margin-right: 4px;
    color: var(--template-blue-dark);
    font-size: 12px;
    font-weight: 700;
}

#template-modal .template-tags button {
    padding: 8px 13px;
    border: 1px solid #b8ccdc;
    border-radius: 7px;
    background: #ffffff;
    color: var(--template-blue-dark);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
}

#template-modal .template-tags button:hover {
    background: var(--template-blue);
    border-color: var(--template-blue);
    color: #ffffff;
    transform: translateY(-1px);
}

#template-modal .template-tags button:active {
    transform: translateY(0);
}

/* ---------- Message editor ---------- */

#template-modal #template-body {
    display: block;
    width: 100%;
    min-height: 430px;
    height: 430px;
    resize: vertical;
    box-sizing: border-box;
    padding: 18px 20px;
    border: 1px solid var(--template-border);
    border-radius: 10px;
    background: #fbfcfd;
    color: #1f2937;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 14px;
    line-height: 1.7;
    outline: none;
    transition: border-color 0.2s ease,
                box-shadow 0.2s ease,
                background 0.2s ease;
}

#template-modal #template-body:focus {
    background: #ffffff;
    border-color: var(--template-blue);
    box-shadow: 0 0 0 3px rgba(31, 78, 121, 0.12);
}

#template-modal .form-help {
    display: block;
    margin-top: 9px;
    color: var(--template-muted);
    font-size: 12px;
    line-height: 1.5;
}

/* ---------- Preview ---------- */

#template-modal #template-preview-section {
    margin-top: 4px;
    padding-top: 4px;
}

#template-modal .template-preview {
    min-height: 220px;
    padding: 22px;
    border: 1px solid var(--template-border);
    border-radius: 10px;
    background: #ffffff;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.04);
    overflow: auto;
}

/* ---------- Modal actions ---------- */

#template-modal .modal-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    margin-top: 26px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

#template-modal .modal-actions button {
    min-height: 44px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

#template-modal .modal-actions .outline-btn {
    border: 1px solid #cbd5df;
    background: #ffffff;
    color: #374151;
}

#template-modal .modal-actions .outline-btn:hover {
    border-color: var(--template-blue);
    color: var(--template-blue);
}

#template-modal .modal-actions .primary-btn {
    border: 1px solid var(--template-blue);
    background: var(--template-blue);
    color: #ffffff;
}

#template-modal .modal-actions .primary-btn:hover {
    background: var(--template-blue-dark);
    border-color: var(--template-blue-dark);
    transform: translateY(-1px);
}

/* ---------- Template list ---------- */

#templates-page .page-card-header {
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 20px;
    margin-bottom: 20px;
}

#templates-page .campaign-row {
    padding: 17px 18px;
    border: 1px solid #e3e8ed;
    border-radius: 10px;
    margin-bottom: 10px;
    background: #ffffff;
    transition: all 0.2s ease;
}

#templates-page .campaign-row:hover {
    border-color: #b9ccdc;
    box-shadow: 0 4px 15px rgba(31, 78, 121, 0.08);
    transform: translateY(-1px);
}

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

@media (max-width: 800px) {

    #template-modal {
        padding: 10px;
    }

    #template-modal .template-modal-card {
        width: 100%;
        max-height: 96vh;
        border-radius: 12px;
    }

    #template-modal .modal-header {
        padding: 20px;
        border-radius: 12px 12px 0 0;
    }

    #template-modal #template-form {
        padding: 20px;
    }

    #template-modal #template-body {
        min-height: 320px;
        height: 320px;
    }

    #template-modal .template-type-buttons {
        width: 100%;
    }

    #template-modal .template-type-btn {
        flex: 1;
    }

    #template-modal .modal-actions {
        flex-wrap: wrap;
    }

    #template-modal .modal-actions button {
        flex: 1;
    }
}


/* =========================================================
   SMART MAILER - COMPACT PROFESSIONAL TEMPLATE MODAL
   ========================================================= */

.template-modal-card {
    width: min(1100px, 94vw) !important;
    max-width: 1100px !important;
    max-height: 90vh !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Compact modal header */
.template-modal-card .modal-header {
    padding: 18px 24px !important;
    flex-shrink: 0 !important;
}

.template-modal-card .modal-header h2 {
    margin: 0 !important;
    font-size: 24px !important;
}

.template-modal-card .modal-header p {
    margin: 4px 0 0 !important;
    font-size: 13px !important;
}

/* Form fills the modal without creating a page scrollbar */
.template-modal-card #template-form {
    padding: 16px 24px !important;
    overflow: hidden !important;
}

/* Reduce vertical spacing between fields */
.template-modal-card .form-group {
    margin-bottom: 12px !important;
}

.template-modal-card label {
    margin-bottom: 5px !important;
}

/* Name + subject remain side by side */
.template-modal-card .form-row {
    gap: 18px !important;
}

/* Message type */
.template-modal-card .message-type,
.template-modal-card .type-toggle {
    margin-bottom: 10px !important;
}

/* Personalization area */
.template-modal-card .personalization-box {
    padding: 10px 14px !important;
    margin-bottom: 10px !important;
}

/* Personalization buttons */
.template-modal-card .personalization-box button {
    padding: 6px 11px !important;
    font-size: 12px !important;
}

/* Make the message editor shorter */
.template-modal-card textarea {
    min-height: 150px !important;
    height: 150px !important;
    max-height: 150px !important;
    resize: vertical !important;
}

/* Keep the bottom buttons visible */
.template-modal-card .modal-actions {
    padding: 12px 24px !important;
    margin-top: 0 !important;
    flex-shrink: 0 !important;
}

/* Slightly smaller buttons */
.template-modal-card .modal-actions button {
    padding: 9px 17px !important;
}

/* On smaller screens, allow the modal itself to scroll */
@media (max-height: 750px) {
    .template-modal-card {
        max-height: 94vh !important;
    }

    .template-modal-card #template-form {
        overflow-y: auto !important;
    }

    .template-modal-card textarea {
        height: 120px !important;
        min-height: 120px !important;
        max-height: 120px !important;
    }
}

@media (max-width: 700px) {
    .template-modal-card {
        width: 96vw !important;
        max-height: 94vh !important;
    }

    .template-modal-card #template-form {
        overflow-y: auto !important;
    }

    .template-modal-card .form-row {
        grid-template-columns: 1fr !important;
    }
}


/* =========================================================
   TEMPLATE MODAL - FINAL RESPONSIVE LAYOUT
   Keeps action buttons visible when HTML preview appears
   ========================================================= */

.template-modal-card {
    width: min(1100px, 94vw) !important;
    max-width: 1100px !important;
    height: min(88vh, 780px) !important;
    max-height: 88vh !important;
    overflow: hidden !important;

    display: flex !important;
    flex-direction: column !important;
}

/* Header stays fixed */
.template-modal-card .modal-header {
    flex: 0 0 auto !important;
    padding: 16px 24px !important;
}

/* The FORM itself becomes the flexible container */
.template-modal-card #template-form {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    padding: 14px 24px 0 !important;

    display: flex !important;
    flex-direction: column !important;

    overflow: hidden !important;
}

/* Only the form content scrolls */
.template-modal-card #template-form > .form-grid {
    flex: 1 1 auto !important;
    min-height: 0 !important;

    overflow-y: auto !important;
    overflow-x: hidden !important;

    padding-right: 8px !important;
    padding-bottom: 8px !important;
}

/* Keep fields compact */
.template-modal-card .form-group {
    margin-bottom: 10px !important;
}

.template-modal-card label {
    margin-bottom: 4px !important;
}

/* Editor */
.template-modal-card .template-editor {
    height: 145px !important;
    min-height: 145px !important;
    max-height: 180px !important;
}

/* HTML preview */
.template-modal-card .template-preview {
    min-height: 100px !important;
    max-height: 180px !important;
    overflow-y: auto !important;
    padding: 10px !important;
}

/* Keep action bar permanently visible */
.template-modal-card .modal-actions {
    flex: 0 0 auto !important;

    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 10px !important;

    padding: 12px 24px 16px !important;
    margin: 0 !important;

    border-top: 1px solid #e5e7eb !important;
    background: #fff !important;
}

/* Buttons */
.template-modal-card .modal-actions button {
    padding: 9px 16px !important;
    white-space: nowrap !important;
}

/* Personalization buttons */
.template-modal-card .template-tags {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
}

.template-modal-card .template-tags button {
    padding: 6px 10px !important;
    font-size: 12px !important;
}

/* Smaller screens */
@media (max-height: 750px) {

    .template-modal-card {
        height: 94vh !important;
        max-height: 94vh !important;
    }

    .template-modal-card .modal-header {
        padding: 12px 18px !important;
    }

    .template-modal-card #template-form {
        padding: 10px 18px 0 !important;
    }

    .template-modal-card .template-editor {
        height: 110px !important;
        min-height: 110px !important;
    }

    .template-modal-card .template-preview {
        max-height: 130px !important;
    }

    .template-modal-card .modal-actions {
        padding: 9px 18px 12px !important;
    }
}

/* Phones / narrow screens */
@media (max-width: 700px) {

    .template-modal-card {
        width: 96vw !important;
        height: 94vh !important;
        max-height: 94vh !important;
    }

    .template-modal-card .form-grid {
        grid-template-columns: 1fr !important;
    }

    .template-modal-card .modal-actions {
        flex-wrap: wrap !important;
    }
}


/* =========================================================
   CONTACT MANAGEMENT
   ========================================================= */

.contacts-header {
    align-items: center;
}

.contacts-header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.contacts-toolbar {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 170px 190px;
    gap: 10px;
    margin: 20px 0 14px;
}

.contact-search {
    position: relative;
}

.contact-search > span {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #667085;
    font-size: 18px;
}

.contact-search input {
    width: 100%;
    padding-left: 36px;
}

.contacts-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0;
    color: #667085;
    font-size: 13px;
}

.contacts-summary strong {
    color: #344054;
}

.contacts-table-wrap {
    border: 1px solid #eaecf0;
    border-radius: 10px;
    overflow-x: auto;
    background: #fff;
}

.contacts-table {
    width: 100%;
    min-width: 950px;
    border-collapse: collapse;
}

.contacts-table th {
    text-align: left;
    padding: 11px 12px;
    background: #f9fafb;
    color: #667085;
    font-size: 12px;
    font-weight: 600;
    border-bottom: 1px solid #eaecf0;
    white-space: nowrap;
}

.contacts-table td {
    padding: 12px;
    border-bottom: 1px solid #eaecf0;
    vertical-align: middle;
    font-size: 13px;
    color: #475467;
}

.contacts-table tbody tr:last-child td {
    border-bottom: 0;
}

.contact-check-col {
    width: 42px;
}

.contact-primary strong,
.contact-primary span {
    display: block;
}

.contact-primary strong {
    color: #344054;
    margin-bottom: 3px;
}

.contact-primary span {
    color: #667085;
    font-size: 12px;
}

.contact-status,
.contact-subscription {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}

.status-active,
.subscribed {
    background: #ecfdf3;
    color: #027a48;
}

.status-unsubscribed,
.not-subscribed {
    background: #fef3f2;
    color: #b42318;
}

.contact-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.small-btn {
    padding: 6px 10px !important;
    font-size: 12px !important;
}

.danger-btn {
    color: #b42318 !important;
}

.contacts-bulk-bar {
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    margin-bottom: 10px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    background: #f9fafb;
    color: #475467;
    font-size: 13px;
}

.contacts-bulk-actions {
    display: flex;
    gap: 8px;
}

.contacts-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    padding: 16px 0 4px;
    color: #667085;
    font-size: 13px;
}

.contacts-pagination button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.contact-modal-card,
.contact-import-modal-card {
    width: min(600px, 94vw);
    max-height: 90vh;
    overflow-y: auto;
}

.import-result {
    margin-top: 15px;
    padding: 12px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    background: #f9fafb;
    color: #475467;
    font-size: 13px;
}

.import-result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
}

@media (max-width: 800px) {

    .contacts-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 14px;
    }

    .contacts-toolbar {
        grid-template-columns: 1fr;
    }

}

@media (max-width: 500px) {

    .contacts-header-actions {
        width: 100%;
    }

    .contacts-header-actions button {
        flex: 1;
    }

    .contacts-bulk-bar {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

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

}


/* =========================================================
   CONTACTS PAGE - FINAL POLISHED DESIGN
   Matches the Templates page visual language
   ========================================================= */

.contacts-card {
    width: 100%;
    overflow: hidden;
}

/* ---------------------------------------------------------
   Header
   --------------------------------------------------------- */

.contacts-header {
    padding: 20px 24px !important;
    align-items: center !important;
}

.contacts-header h2 {
    margin: 0 0 5px !important;
    font-size: 22px;
    font-weight: 700;
    color: #101828;
}

.contacts-header p {
    margin: 0 !important;
    color: #667085;
    font-size: 13px;
}

.contacts-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ---------------------------------------------------------
   Search / Filters
   --------------------------------------------------------- */

.contacts-toolbar {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;

    padding: 14px 24px !important;

    background: #f9fafb;
    border-top: 1px solid #eaecf0;
    border-bottom: 1px solid #eaecf0;
}

.contact-search {
    position: relative;
    flex: 1 1 420px;
    min-width: 220px;
}

.contact-search span {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);

    color: #98a2b3;
    font-size: 18px;
    line-height: 1;

    pointer-events: none;
}

.contact-search input {
    width: 100%;
    height: 40px;

    padding: 0 14px 0 38px;

    border: 1px solid #d0d5dd;
    border-radius: 8px;

    background: #fff;
    color: #101828;

    font-size: 13px;

    outline: none;
    box-sizing: border-box;

    transition:
        border-color .15s ease,
        box-shadow .15s ease;
}

.contact-search input:focus {
    border-color: #84adff;
    box-shadow: 0 0 0 3px rgba(49, 109, 255, .10);
}

.contacts-toolbar select {
    height: 40px;
    min-width: 155px;

    padding: 0 34px 0 12px;

    border: 1px solid #d0d5dd;
    border-radius: 8px;

    background-color: #fff;
    color: #344054;

    font-size: 13px;

    outline: none;
    cursor: pointer;
}

.contacts-toolbar select:focus {
    border-color: #84adff;
    box-shadow: 0 0 0 3px rgba(49, 109, 255, .10);
}

/* ---------------------------------------------------------
   Bulk action bar
   --------------------------------------------------------- */

.contacts-bulk-bar {
    margin: 14px 24px 0;
    padding: 10px 14px;

    align-items: center;
    justify-content: space-between;

    border: 1px solid #d0d5dd;
    border-radius: 8px;

    background: #f8fafc;

    color: #475467;
    font-size: 13px;
}

.contacts-bulk-bar strong {
    color: #101828;
}

.contacts-bulk-actions {
    display: flex;
    gap: 8px;
}

/* ---------------------------------------------------------
   Summary
   --------------------------------------------------------- */

.contacts-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 16px 24px 10px;

    color: #667085;
    font-size: 12px;
}

.contacts-summary strong {
    color: #344054;
    font-size: 13px;
}

/* ---------------------------------------------------------
   Contacts table
   --------------------------------------------------------- */

.contacts-table-wrap {
    margin: 0 24px 20px;

    border: 1px solid #eaecf0;
    border-radius: 10px;

    overflow-x: auto;
    overflow-y: hidden;

    background: #fff;
}

.contacts-table {
    width: 100%;
    min-width: 900px;

    border-collapse: separate;
    border-spacing: 0;
}

.contacts-table thead th {
    height: 42px;

    padding: 0 14px;

    background: #f9fafb;

    border-bottom: 1px solid #eaecf0;

    color: #667085;

    font-size: 11px;
    font-weight: 600;

    text-align: left;
    white-space: nowrap;

    text-transform: uppercase;
    letter-spacing: .03em;
}

.contacts-table thead th:first-child {
    padding-left: 16px;
}

.contacts-table tbody td {
    padding: 13px 14px;

    border-bottom: 1px solid #f2f4f7;

    color: #475467;

    font-size: 13px;

    vertical-align: middle;
}

.contacts-table tbody tr:last-child td {
    border-bottom: 0;
}

.contacts-table tbody tr {
    transition: background .12s ease;
}

.contacts-table tbody tr:hover {
    background: #fafcff;
}

.contact-check-col {
    width: 42px;
}

.contacts-table input[type="checkbox"] {
    width: 15px;
    height: 15px;

    cursor: pointer;
}

/* ---------------------------------------------------------
   Contact identity
   --------------------------------------------------------- */

.contact-primary {
    display: flex;
    flex-direction: column;
    gap: 3px;

    min-width: 190px;
}

.contact-primary strong {
    color: #101828;
    font-size: 13px;
    font-weight: 600;
}

.contact-primary span {
    color: #667085;
    font-size: 12px;
}

/* ---------------------------------------------------------
   Status badges
   --------------------------------------------------------- */

.contact-status,
.contact-subscription {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    min-height: 24px;

    padding: 3px 9px;

    border-radius: 999px;

    font-size: 11px;
    font-weight: 600;

    white-space: nowrap;
}

.contact-status {
    background: #ecfdf3;
    color: #027a48;
}

.contact-status.status-unsubscribed {
    background: #fef3f2;
    color: #b42318;
}

.contact-subscription.subscribed {
    background: #eff8ff;
    color: #175cd3;
}

.contact-subscription.not-subscribed {
    background: #f2f4f7;
    color: #667085;
}

/* ---------------------------------------------------------
   Row actions
   --------------------------------------------------------- */

.contact-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;

    white-space: nowrap;
}

.contact-actions .small-btn {
    padding: 6px 9px !important;
    font-size: 11px !important;
}

.danger-btn {
    color: #b42318 !important;
    border-color: #fecdca !important;
    background: #fff !important;
}

.danger-btn:hover {
    background: #fef3f2 !important;
}

/* ---------------------------------------------------------
   Pagination
   --------------------------------------------------------- */

#contacts-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;

    padding: 0 24px 20px;

    color: #667085;
    font-size: 12px;
}

#contacts-pagination button:disabled {
    opacity: .45;
    cursor: not-allowed;
}

/* ---------------------------------------------------------
   Empty / loading states
   --------------------------------------------------------- */

.contacts-table .empty-state {
    padding: 55px 20px;
}

.contacts-table .empty-state h3 {
    margin: 0 0 6px;
    color: #344054;
    font-size: 15px;
}

.contacts-table .empty-state p {
    margin: 0;
    color: #667085;
    font-size: 12px;
}

/* =========================================================
   CONTACT MODALS
   Match Template Modal
   ========================================================= */

#contact-modal .modal-card,
#import-contacts-modal .modal-card {
    width: min(620px, 92vw) !important;
    max-width: 620px !important;

    max-height: 88vh !important;

    overflow: hidden !important;

    display: flex !important;
    flex-direction: column !important;
}

#contact-modal .modal-header,
#import-contacts-modal .modal-header {
    flex: 0 0 auto !important;

    padding: 18px 24px !important;

    border-bottom: 1px solid #eaecf0;
}

#contact-modal .modal-header h2,
#import-contacts-modal .modal-header h2 {
    margin: 0 0 5px;
    color: #101828;
    font-size: 19px;
}

#contact-modal .modal-header p,
#import-contacts-modal .modal-header p {
    margin: 0;
    color: #667085;
    font-size: 12px;
}

#contact-modal form,
#import-contacts-modal form {
    overflow-y: auto !important;
    min-height: 0 !important;

    padding: 20px 24px !important;
}

#contact-modal .form-group,
#import-contacts-modal .form-group {
    margin-bottom: 14px;
}

#contact-modal label,
#import-contacts-modal label {
    display: block;

    margin-bottom: 6px;

    color: #344054;

    font-size: 12px;
    font-weight: 600;
}

#contact-modal input,
#import-contacts-modal input,
#import-contacts-modal select {
    width: 100%;
    min-height: 40px;

    box-sizing: border-box;

    padding: 9px 11px;

    border: 1px solid #d0d5dd;
    border-radius: 7px;

    background: #fff;

    color: #101828;

    font-size: 13px;

    outline: none;

    transition:
        border-color .15s ease,
        box-shadow .15s ease;
}

#contact-modal input:focus,
#import-contacts-modal input:focus,
#import-contacts-modal select:focus {
    border-color: #84adff;
    box-shadow: 0 0 0 3px rgba(49, 109, 255, .10);
}

#contact-modal .modal-actions,
#import-contacts-modal .modal-actions {
    flex: 0 0 auto !important;

    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;

    gap: 10px;

    padding: 12px 24px 16px !important;
    margin: 0 !important;

    border-top: 1px solid #eaecf0;

    background: #fff;
}

/* Import helper text */

#import-contacts-modal small,
#import-contacts-modal .form-help {
    display: block;

    margin-top: 7px;

    color: #667085;

    font-size: 11px;
    line-height: 1.5;
}

/* Import result */

#import-contacts-modal #import-result {
    margin: 0 24px 18px;

    padding: 12px 14px;

    border: 1px solid #d0d5dd;
    border-radius: 8px;

    background: #f9fafb;

    font-size: 12px;
}

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

@media (max-width: 900px) {

    .contacts-toolbar {
        flex-wrap: wrap;
    }

    .contact-search {
        flex-basis: 100%;
    }

    .contacts-toolbar select {
        flex: 1;
    }

}

@media (max-width: 700px) {

    .contacts-header {
        align-items: flex-start !important;
        flex-direction: column !important;
        gap: 14px;
    }

    .contacts-header-actions {
        width: 100%;
    }

    .contacts-header-actions button {
        flex: 1;
    }

    .contacts-toolbar {
        padding: 12px 16px !important;
    }

    .contacts-toolbar select {
        min-width: 0;
        width: 100%;
        flex: 1 1 100%;
    }

    .contacts-summary {
        padding-left: 16px;
        padding-right: 16px;
    }

    .contacts-table-wrap {
        margin-left: 16px;
        margin-right: 16px;

        border-radius: 8px;
    }

    .contacts-bulk-bar {
        margin-left: 16px;
        margin-right: 16px;

        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .contacts-bulk-actions {
        width: 100%;
    }

    .contacts-bulk-actions button {
        flex: 1;
    }

    #contacts-pagination {
        padding-left: 16px;
        padding-right: 16px;
    }

    #contact-modal .modal-header,
    #import-contacts-modal .modal-header {
        padding-left: 18px !important;
        padding-right: 18px !important;
    }

    #contact-modal form,
    #import-contacts-modal form {
        padding-left: 18px !important;
        padding-right: 18px !important;
    }

    #contact-modal .modal-actions,
    #import-contacts-modal .modal-actions {
        padding-left: 18px !important;
        padding-right: 18px !important;
    }

}



/* =========================================================

/* =========================================================
   CONTACT LISTS — PROFESSIONAL UI
   ========================================================= */

.lists-card {
    min-height: 400px;
}

.lists-header {
    align-items: center;
}

/* List collection */

#lists-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Individual list */

.list-card {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 24px;

    padding: 18px 20px;

    margin: 0;

    border: 1px solid #eaecf0;
    border-radius: 10px;

    background: #fff;

    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);

    transition:
        border-color .15s ease,
        box-shadow .15s ease,
        transform .15s ease;
}

.list-card:hover {
    border-color: #d0d5dd;

    box-shadow: 0 4px 12px rgba(16, 24, 40, .07);

    transform: translateY(-1px);
}

/* Main content */

.list-card .campaign-main {
    display: flex;
    align-items: center;

    min-width: 0;

    gap: 14px;
}

/* List icon */

.list-card .campaign-main::before {
    content: "☷";

    flex: 0 0 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 42px;
    height: 42px;

    border-radius: 9px;

    background: #eff6ff;

    color: #2563eb;

    font-size: 22px;
    font-weight: 600;
}

/* List name */

.list-card .campaign-main h3 {
    margin: 0 0 5px;

    color: #101828;

    font-size: 14px;
    font-weight: 600;

    line-height: 1.4;
}

/* Description */

.list-card .campaign-main p {
    margin: 0;

    max-width: 600px;

    overflow: hidden;

    color: #667085;

    font-size: 12px;

    line-height: 1.5;

    text-overflow: ellipsis;

    white-space: nowrap;
}

/* Member count */

.list-card .campaign-side {
    flex: 0 0 auto;

    min-width: 92px;

    padding-left: 18px;

    text-align: right;

    border-left: 1px solid #eaecf0;
}

.list-card .campaign-side strong {
    display: block;

    margin-bottom: 2px;

    color: #101828;

    font-size: 18px;
    font-weight: 700;

    line-height: 1.3;
}

.list-card .campaign-side span {
    display: block;

    color: #667085;

    font-size: 11px;
    font-weight: 500;
}

/* Empty state */

#lists-container .empty-state {
    padding: 55px 20px;

    border: 1px dashed #d0d5dd;
    border-radius: 10px;

    background: #f9fafb;

    text-align: center;
}

#lists-container .empty-state h3 {
    margin: 0 0 6px;

    color: #344054;

    font-size: 15px;
}

#lists-container .empty-state p {
    margin: 0;

    color: #667085;

    font-size: 12px;
}

/* Mobile */

@media (max-width: 700px) {

    .lists-header {
        align-items: flex-start;

        flex-direction: column;

        gap: 12px;
    }

    .list-card {
        align-items: flex-start;

        flex-direction: column;

        gap: 16px;

        padding: 16px;
    }

    .list-card .campaign-main {
        width: 100%;
    }

    .list-card .campaign-main p {
        max-width: calc(100vw - 120px);
    }

    .list-card .campaign-side {
        width: 100%;

        min-width: 0;

        padding: 12px 0 0;

        text-align: left;

        border-left: 0;

        border-top: 1px solid #eaecf0;
    }

}


/* =========================================================
   NEW CONTACT LIST MODAL
   Match Contact / Template modal design
   ========================================================= */

#list-modal {
    align-items: center !important;
    justify-content: center !important;
}

#list-modal .modal-card {
    width: min(620px, 92vw) !important;
    max-width: 620px !important;

    max-height: 88vh !important;

    overflow: hidden !important;

    display: flex !important;
    flex-direction: column !important;

    padding: 0 !important;

    border: 1px solid #eaecf0 !important;
    border-radius: 12px !important;

    background: #fff !important;

    box-shadow:
        0 20px 40px rgba(16, 24, 40, .12),
        0 4px 12px rgba(16, 24, 40, .06) !important;
}

/* Header */

#list-modal .modal-header {
    flex: 0 0 auto !important;

    padding: 18px 24px !important;

    border-bottom: 1px solid #eaecf0 !important;

    background: #fff !important;
}

#list-modal .modal-header h2 {
    margin: 0 0 5px !important;

    color: #101828 !important;

    font-size: 19px !important;
    font-weight: 600 !important;

    line-height: 1.35 !important;
}

#list-modal .modal-header p {
    margin: 0 !important;

    color: #667085 !important;

    font-size: 12px !important;

    line-height: 1.5 !important;
}

/* Form */

#list-modal form {
    overflow-y: auto !important;

    min-height: 0 !important;

    padding: 20px 24px !important;

    background: #fff !important;
}

#list-modal .form-group {
    margin-bottom: 16px !important;
}

#list-modal .form-group:last-child {
    margin-bottom: 0 !important;
}

#list-modal label {
    display: block !important;

    margin-bottom: 6px !important;

    color: #344054 !important;

    font-size: 12px !important;
    font-weight: 600 !important;
}

#list-modal input,
#list-modal textarea {
    width: 100% !important;

    min-height: 40px !important;

    box-sizing: border-box !important;

    padding: 9px 11px !important;

    border: 1px solid #d0d5dd !important;

    border-radius: 7px !important;

    background: #fff !important;

    color: #101828 !important;

    font-family: inherit !important;

    font-size: 13px !important;

    outline: none !important;

    transition:
        border-color .15s ease,
        box-shadow .15s ease !important;
}

#list-modal textarea {
    min-height: 100px !important;

    resize: vertical !important;

    line-height: 1.5 !important;
}

#list-modal input::placeholder,
#list-modal textarea::placeholder {
    color: #98a2b3 !important;
}

#list-modal input:focus,
#list-modal textarea:focus {
    border-color: #84adff !important;

    box-shadow:
        0 0 0 3px rgba(49, 109, 255, .10) !important;
}

/* Footer buttons */

#list-modal .modal-actions {
    flex: 0 0 auto !important;

    display: flex !important;

    justify-content: flex-end !important;

    align-items: center !important;

    gap: 10px !important;

    padding: 12px 24px 16px !important;

    margin: 0 !important;

    border-top: 1px solid #eaecf0 !important;

    background: #fff !important;
}

/* Cancel button */

#list-modal .modal-actions .secondary-btn,
#list-modal .modal-actions .cancel-btn {
    min-height: 36px !important;

    padding: 8px 14px !important;

    border: 1px solid #d0d5dd !important;

    border-radius: 7px !important;

    background: #fff !important;

    color: #344054 !important;

    font-size: 12px !important;
}

/* Primary button */

#list-modal .modal-actions button[type="submit"] {
    min-height: 36px !important;

    padding: 8px 15px !important;

    border-radius: 7px !important;

    font-size: 12px !important;

    font-weight: 600 !important;
}

/* Mobile */

@media (max-width: 700px) {

    #list-modal .modal-card {
        width: calc(100vw - 32px) !important;

        max-width: none !important;

        max-height: 90vh !important;

        border-radius: 10px !important;
    }

    #list-modal .modal-header {
        padding-left: 18px !important;
        padding-right: 18px !important;
    }

    #list-modal form {
        padding-left: 18px !important;
        padding-right: 18px !important;
    }

    #list-modal .modal-actions {
        padding-left: 18px !important;
        padding-right: 18px !important;
    }

}


/* =========================================================
   CONTACT LIST PAGE — POLISHED CARDS
   ========================================================= */

#lists-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* List card */

#lists-container .list-card {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    padding: 18px 20px;

    margin: 0;

    border: 1px solid #eaecf0;
    border-radius: 10px;

    background: #fff;

    box-shadow:
        0 1px 2px rgba(16, 24, 40, .04);

    transition:
        border-color .15s ease,
        box-shadow .15s ease,
        transform .15s ease;
}

#lists-container .list-card:hover {
    border-color: #d0d5dd;

    box-shadow:
        0 5px 14px rgba(16, 24, 40, .07);

    transform: translateY(-1px);
}

/* Main area */

#lists-container .campaign-main {
    display: flex;
    align-items: center;

    min-width: 0;

    flex: 1;

    gap: 14px;
}

/* Icon */

#lists-container .list-icon {
    flex: 0 0 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 42px;
    height: 42px;

    border-radius: 9px;

    background: #eff6ff;

    color: #2563eb;
}

#lists-container .list-icon span {
    font-size: 22px;

    line-height: 1;
}

/* Information */

#lists-container .list-information {
    min-width: 0;
}

#lists-container .list-information h3 {
    margin: 0 0 5px;

    color: #101828;

    font-size: 14px;
    font-weight: 600;

    line-height: 1.4;
}

#lists-container .list-information p {
    margin: 0;

    max-width: 650px;

    overflow: hidden;

    color: #667085;

    font-size: 12px;

    line-height: 1.5;

    text-overflow: ellipsis;

    white-space: nowrap;
}

/* Statistics */

#lists-container .campaign-side {
    flex: 0 0 auto;

    min-width: 95px;

    padding-left: 20px;

    text-align: right;

    border-left: 1px solid #eaecf0;
}

#lists-container .campaign-side strong {
    display: block;

    margin: 0 0 2px;

    color: #101828;

    font-size: 19px;
    font-weight: 700;

    line-height: 1.3;
}

#lists-container .campaign-side span {
    display: block;

    color: #667085;

    font-size: 11px;
    font-weight: 500;
}

/* Empty state */

#lists-container .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;

    padding: 55px 20px;

    border: 1px dashed #d0d5dd;
    border-radius: 10px;

    background: #f9fafb;

    text-align: center;
}

#lists-container .empty-state-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 44px;
    height: 44px;

    margin-bottom: 14px;

    border-radius: 10px;

    background: #eff6ff;

    color: #2563eb;

    font-size: 22px;
    font-weight: 600;
}

#lists-container .empty-state h3 {
    margin: 0 0 6px;

    color: #344054;

    font-size: 15px;
}

#lists-container .empty-state p {
    max-width: 420px;

    margin: 0 0 18px;

    color: #667085;

    font-size: 12px;

    line-height: 1.5;
}

/* Mobile */

@media (max-width: 700px) {

    #lists-container .list-card {
        align-items: flex-start;

        flex-direction: column;

        gap: 16px;

        padding: 16px;
    }

    #lists-container .campaign-main {
        width: 100%;
    }

    #lists-container .list-information p {
        max-width: calc(100vw - 120px);
    }

    #lists-container .campaign-side {
        width: 100%;

        min-width: 0;

        padding: 12px 0 0;

        text-align: left;

        border-left: 0;

        border-top: 1px solid #eaecf0;
    }

}


/* =========================================================
   EMAIL TEMPLATES — PROFESSIONAL LIST
   ========================================================= */

#templates-page .campaign-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Template card */

#templates-page .template-card {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    padding: 18px 20px;

    border: 1px solid #eaecf0;
    border-radius: 10px;

    background: #fff;

    box-shadow:
        0 1px 2px rgba(16, 24, 40, .04);

    transition:
        border-color .15s ease,
        box-shadow .15s ease,
        transform .15s ease;
}

#templates-page .template-card:hover {
    border-color: #d0d5dd;

    box-shadow:
        0 5px 14px rgba(16, 24, 40, .07);

    transform: translateY(-1px);
}

/* Main */

#templates-page .template-card-main {
    display: flex;
    align-items: center;

    min-width: 0;

    flex: 1;

    gap: 14px;
}

/* Icon */

#templates-page .template-icon {
    flex: 0 0 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 42px;
    height: 42px;

    border-radius: 9px;

    background: #f2f4f7;

    color: #344054;
}

#templates-page .template-icon span {
    font-size: 19px;

    line-height: 1;
}

/* Information */

#templates-page .template-information {
    min-width: 0;
}

#templates-page .template-information h3 {
    margin: 0 0 4px;

    color: #101828;

    font-size: 14px;
    font-weight: 600;

    line-height: 1.4;
}

#templates-page .template-subject {
    max-width: 600px;

    margin: 0 0 7px;

    overflow: hidden;

    color: #667085;

    font-size: 12px;

    line-height: 1.5;

    text-overflow: ellipsis;

    white-space: nowrap;
}

/* Type badge */

#templates-page .template-type-badge {
    display: inline-flex;

    align-items: center;

    min-height: 22px;

    padding: 2px 8px;

    border-radius: 999px;

    font-size: 10px;
    font-weight: 600;
}

#templates-page .template-type-badge.text {
    background: #f2f4f7;

    color: #475467;
}

#templates-page .template-type-badge.html {
    background: #eff8ff;

    color: #175cd3;
}

/* Actions */

#templates-page .template-card-actions {
    display: flex;
    align-items: center;

    gap: 7px;

    flex: 0 0 auto;
}

#templates-page .template-card-actions button {
    min-height: 34px;

    padding: 7px 12px;

    font-size: 11px;
}

/* Empty state */

#templates-page .template-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;

    padding: 55px 20px;

    border: 1px dashed #d0d5dd;
    border-radius: 10px;

    background: #f9fafb;

    text-align: center;
}

#templates-page .template-empty-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 44px;
    height: 44px;

    margin-bottom: 14px;

    border-radius: 10px;

    background: #f2f4f7;

    color: #344054;

    font-size: 20px;
    font-weight: 600;
}

#templates-page .template-empty-icon.error {
    background: #fef3f2;

    color: #b42318;
}

#templates-page .template-empty-state h3 {
    margin: 0 0 6px;

    color: #344054;

    font-size: 15px;
}

#templates-page .template-empty-state p {
    max-width: 430px;

    margin: 0 0 18px;

    color: #667085;

    font-size: 12px;

    line-height: 1.5;
}

/* Mobile */

@media (max-width: 700px) {

    #templates-page .template-card {
        align-items: flex-start;

        flex-direction: column;

        gap: 15px;

        padding: 16px;
    }

    #templates-page .template-card-main {
        width: 100%;
    }

    #templates-page .template-subject {
        max-width: calc(100vw - 110px);
    }

    #templates-page .template-card-actions {
        width: 100%;

        padding-top: 12px;

        border-top: 1px solid #eaecf0;
    }

    #templates-page .template-card-actions button {
        flex: 1;
    }

}



/* ============================================================
   SMART MAILER - PROFESSIONAL CAMPAIGN MODAL
   ============================================================ */

#campaign-modal .modal-card {
    width: min(760px, 92vw) !important;
    max-width: 760px !important;
    max-height: 88vh !important;

    overflow: hidden !important;

    display: flex !important;
    flex-direction: column !important;

    padding: 0 !important;

    border: 1px solid #eaecf0 !important;
    border-radius: 12px !important;

    background: #fff !important;

    box-shadow:
        0 20px 40px rgba(16, 24, 40, .12),
        0 4px 12px rgba(16, 24, 40, .06) !important;
}


/* Header */

#campaign-modal .modal-header {
    flex: 0 0 auto !important;

    padding: 18px 24px !important;

    border-bottom: 1px solid #eaecf0 !important;

    background: #fff !important;
}

#campaign-modal .modal-header h2 {
    margin: 0 0 5px !important;

    color: #101828 !important;

    font-size: 19px !important;
    font-weight: 600 !important;

    line-height: 1.35 !important;
}

#campaign-modal .modal-header p {
    margin: 0 !important;

    color: #667085 !important;

    font-size: 12px !important;

    line-height: 1.5 !important;
}


/* Close button */

#campaign-modal .modal-close {
    width: 32px !important;
    height: 32px !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    margin-top: -4px !important;

    border-radius: 7px !important;
}

#campaign-modal .modal-close:hover {
    background: #f2f4f7 !important;
}


/* Form */

#campaign-modal #campaign-form {
    overflow-y: auto !important;

    min-height: 0 !important;

    padding: 20px 24px !important;

    background: #fff !important;
}

#campaign-modal .form-grid {
    display: grid !important;

    grid-template-columns: 1fr 1fr !important;

    gap: 16px 18px !important;
}

#campaign-modal .form-group {
    display: flex !important;

    flex-direction: column !important;

    gap: 6px !important;

    margin: 0 !important;
}

#campaign-modal .form-group label {
    display: block !important;

    margin: 0 !important;

    color: #344054 !important;

    font-size: 12px !important;

    font-weight: 600 !important;

    line-height: 1.4 !important;
}


/* Inputs and selects */

#campaign-modal .form-group input,
#campaign-modal .form-group select {
    width: 100% !important;

    min-height: 40px !important;

    box-sizing: border-box !important;

    padding: 9px 11px !important;

    border: 1px solid #d0d5dd !important;

    border-radius: 7px !important;

    background: #fff !important;

    color: #101828 !important;

    font-family: inherit !important;

    font-size: 13px !important;

    outline: none !important;

    transition:
        border-color .15s ease,
        box-shadow .15s ease !important;
}

#campaign-modal .form-group input::placeholder {
    color: #98a2b3 !important;
}

#campaign-modal .form-group input:focus,
#campaign-modal .form-group select:focus {
    border-color: #84adff !important;

    box-shadow:
        0 0 0 3px rgba(49, 109, 255, .10) !important;
}


/* Help text */

#campaign-modal .form-help {
    display: block !important;

    margin-top: 2px !important;

    color: #667085 !important;

    font-size: 11px !important;

    line-height: 1.5 !important;
}


/* Full-width fields */

#campaign-modal .form-full {
    grid-column: 1 / -1 !important;
}


/* Footer */

#campaign-modal .modal-actions {
    flex: 0 0 auto !important;

    display: flex !important;

    justify-content: flex-end !important;

    align-items: center !important;

    gap: 10px !important;

    padding: 12px 24px 16px !important;

    margin: 0 !important;

    border-top: 1px solid #eaecf0 !important;

    background: #fff !important;
}


/* Footer buttons */

#campaign-modal .modal-actions button {
    min-height: 36px !important;

    padding: 8px 14px !important;

    border-radius: 7px !important;

    font-size: 12px !important;
}

#campaign-modal .modal-actions .outline-btn {
    border: 1px solid #d0d5dd !important;

    background: #fff !important;

    color: #344054 !important;
}

#campaign-modal .modal-actions .outline-btn:hover {
    background: #f9fafb !important;
}


/* Mobile */

@media (max-width: 700px) {

    #campaign-modal .modal-card {
        width: calc(100vw - 32px) !important;

        max-width: none !important;

        max-height: 90vh !important;

        border-radius: 10px !important;
    }

    #campaign-modal .modal-header {
        padding-left: 18px !important;
        padding-right: 18px !important;
    }

    #campaign-modal #campaign-form {
        padding-left: 18px !important;
        padding-right: 18px !important;
    }

    #campaign-modal .form-grid {
        grid-template-columns: 1fr !important;

        gap: 14px !important;
    }

    #campaign-modal .form-full {
        grid-column: auto !important;
    }

    #campaign-modal .modal-actions {
        padding-left: 18px !important;
        padding-right: 18px !important;
    }

}


/* Campaign editor must always appear above campaign details */
#campaign-modal {
    z-index: 2000 !important;
}

#campaign-detail-modal {
    z-index: 1000 !important;
}


/* ============================================================
   CAMPAIGN REPORT
   ============================================================ */

.detail-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.detail-stats > div {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
}

.detail-stats span {
    display: block;
    margin-bottom: 5px;
    color: #667085;
    font-size: 11px;
}

.detail-stats strong {
    display: block;
    color: #101828;
    font-size: 20px;
}

.campaign-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.campaign-summary > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fafafa;
}

.campaign-summary strong {
    color: #475467;
    font-size: 11px;
}

.campaign-summary span {
    color: #101828;
    font-size: 13px;
    word-break: break-word;
}

.recipient-main {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1;
}

.recipient-main > strong {
    color: #101828;
    font-size: 13px;
}

.recipient-main > span {
    color: #667085;
    font-size: 12px;
    word-break: break-word;
}

.recipient-detail {
    color: #667085 !important;
    font-size: 11px !important;
}

.recipient-error {
    color: #b42318 !important;
    font-size: 11px !important;
}

.delete-campaign-btn {
    color: #b42318 !important;
}

.delete-campaign-btn:hover {
    border-color: #fda29b !important;
    background: #fef3f2 !important;
}

@media (max-width: 800px) {

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

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

}

@media (max-width: 500px) {

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

}
