/* ==========================================================
   ADTHRIVE MEDIA — MY AUTOMATIONS
   Complete CSS | Desktop | Tablet | Mobile
   ========================================================== */

/* 1. DESIGN SYSTEM */
:root {
    --auto-primary: #7CB947;
    --auto-primary-dark: #639936;
    --auto-primary-light: #F0F7E9;
    --auto-text: #202B24;
    --auto-muted: #6B776E;
    --auto-border: #E1E8E0;
    --auto-bg: #F7F9F6;
    --auto-white: #FFFFFF;
    --auto-success: #168653;
    --auto-danger: #D93645;
    --auto-warning: #B7791F;
    --auto-radius: 14px;
    --auto-radius-sm: 9px;
    --auto-shadow: 0 5px 22px rgba(25, 45, 25, 0.055);
    --auto-transition: 0.2s ease;
}

/* 2. BASE */
.automations-page,
.automations-page * {
    box-sizing: border-box;
}

.automations-page {
    width: 100%;
    max-width: 1440px;
    min-width: 0;
    margin: 0 auto;
    padding: 28px;
    color: var(--auto-text);
    font-family: inherit;
    font-size: 16px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.automations-page button,
.automations-page input,
.automations-page select,
.automations-page textarea {
    font: inherit;
}

.automations-page button {
    cursor: pointer;
    transition: background var(--auto-transition),
        border-color var(--auto-transition),
        color var(--auto-transition),
        box-shadow var(--auto-transition),
        transform var(--auto-transition);
}

.automations-page button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    box-shadow: none;
    transform: none;
}

.automations-page [hidden] {
    display: none !important;
}

.automations-page button:focus-visible,
.automations-page input:focus-visible,
.automations-page select:focus-visible,
.automations-page textarea:focus-visible,
.automations-page summary:focus-visible {
    outline: 3px solid rgba(124, 185, 71, 0.3);
    outline-offset: 3px;
}

/* 3. PAGE HEADING */
.automations-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.automations-heading>div {
    min-width: 0;
}

.automations-heading h1 {
    margin: 0 0 7px;
    color: var(--auto-text);
    font-size: clamp(27px, 3vw, 34px);
    font-weight: 750;
    line-height: 1.25;
    letter-spacing: -0.8px;
}

.automations-heading p {
    margin: 0;
    color: var(--auto-muted);
    font-size: 15px;
}

#createAutomationBtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-height: 46px;
    padding: 11px 19px;
    border: 1px solid var(--auto-primary);
    border-radius: 10px;
    background: var(--auto-primary);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 4px 10px rgba(124, 185, 71, 0.16);
}

#createAutomationBtn:hover {
    background: var(--auto-primary-dark);
    border-color: var(--auto-primary-dark);
    box-shadow: 0 6px 15px rgba(100, 155, 53, 0.2);
    transform: translateY(-1px);
}



/* 4. SUMMARY CARDS */
.automation-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 26px;
}

.automation-summary-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    min-width: 0;
    min-height: 125px;
    padding: 22px;
    border: 1px solid var(--auto-border);
    border-radius: var(--auto-radius);
    background: var(--auto-white);
    box-shadow: var(--auto-shadow);
}

.automation-summary-card span {
    color: var(--auto-muted);
    font-size: 14px;
    font-weight: 550;
}

.automation-summary-card strong {
    color: var(--auto-text);
    font-size: 31px;
    font-weight: 750;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

/* 5. FILTERS */
.automation-filters {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
    padding: 18px;
    border: 1px solid var(--auto-border);
    border-radius: var(--auto-radius);
    background: var(--auto-white);
}

.automation-filters>div {
    display: flex;
    flex-direction: column;
    gap: 7px;
    width: min(100%, 320px);
    min-width: 0;
}

.automations-page label {
    display: block;
    margin-bottom: 7px;
    color: #344238;
    font-size: 14px;
    font-weight: 650;
}

.automation-filters label {
    margin-bottom: 0;
}

/* 6. INPUTS, SELECTS AND TEXTAREAS */
.automations-page input:not([type="hidden"]),
.automations-page select,
.automations-page textarea {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: 11px 13px;
    border: 1px solid #DCE4DC;
    border-radius: var(--auto-radius-sm);
    background: #fff;
    color: var(--auto-text);
    font-size: 14px;
    line-height: 1.5;
    transition: border-color var(--auto-transition),
        box-shadow var(--auto-transition);
}

.automations-page input:not([type="hidden"]),
.automations-page select {
    min-height: 45px;
}

.automations-page textarea {
    min-height: 100px;
    resize: vertical;
}

.automations-page input::placeholder,
.automations-page textarea::placeholder {
    color: #9AA49B;
    opacity: 1;
}

.automations-page input:focus,
.automations-page select:focus,
.automations-page textarea:focus {
    border-color: var(--auto-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(124, 185, 71, 0.12);
}

.automations-page input[readonly] {
    background: #F3F6F2;
    color: var(--auto-muted);
}

.automations-page select:disabled {
    cursor: not-allowed;
    background: #F1F3F1;
    color: #929B93;
}

/* 7. SECONDARY BUTTONS */
#refreshAutomationsBtn,
#cancelAutomationBtn,
#closeAutomationDetailsBtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 18px;
    border: 1px solid var(--auto-border);
    border-radius: 9px;
    background: #fff;
    color: #344238;
    font-size: 14px;
    font-weight: 650;
}

#refreshAutomationsBtn:hover,
#cancelAutomationBtn:hover,
#closeAutomationDetailsBtn:hover {
    border-color: #C7D2C7;
    background: #F5F8F4;
}

#refreshAutomationsBtn {
    flex-shrink: 0;
}

/* 8. STATUS MESSAGES */
#automationMessage,
#automationFormMessage {
    margin: 0 0 18px;
    color: var(--auto-muted);
    font-size: 14px;
    overflow-wrap: anywhere;
}

#automationMessage:empty,
#automationFormMessage:empty {
    display: none;
}

#automationMessage:not(:empty),
#automationFormMessage:not(:empty) {
    padding: 12px 15px;
    border: 1px solid var(--auto-border);
    border-radius: 9px;
    background: #fff;
}

/* 9. AUTOMATION LIST PANEL */
.automation-list-section {
    min-width: 0;
    margin-bottom: 28px;
    padding: 24px;
    border: 1px solid var(--auto-border);
    border-radius: var(--auto-radius);
    background: var(--auto-white);
    box-shadow: var(--auto-shadow);
}

.automation-list-section h2,
#automationFormSection>h2,
#automationDetailsSection>h2 {
    margin: 0 0 20px;
    color: var(--auto-text);
    font-size: 21px;
    font-weight: 750;
    line-height: 1.4;
}

/* Automation cards created by JavaScript */
#automationList {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    min-width: 0;
}

#automationList>p {
    grid-column: 1 / -1;
    margin: 0;
    padding: 30px 15px;
    color: var(--auto-muted);
    text-align: center;
}

#automationList>article,
#automationList>.automation-card,
#automationList>.automation-item,
#automationList>.automation-list-card {
    min-width: 0;
    padding: 20px;
    border: 1px solid var(--auto-border);
    border-radius: 12px;
    background: #fff;
    overflow-wrap: anywhere;
    transition: border-color var(--auto-transition),
        box-shadow var(--auto-transition);
}

#automationList>article:hover,
#automationList>.automation-card:hover,
#automationList>.automation-item:hover,
#automationList>.automation-list-card:hover {
    border-color: #C9DCB9;
    box-shadow: 0 5px 16px rgba(25, 45, 25, 0.06);
}

#automationList h3,
#automationList h4 {
    margin: 0 0 8px;
    color: var(--auto-text);
    font-size: 17px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

#automationList p {
    color: var(--auto-muted);
    overflow-wrap: anywhere;
}

#automationList button {
    max-width: 100%;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid var(--auto-border);
    border-radius: 8px;
    background: #fff;
    color: #344238;
    font-size: 13px;
    font-weight: 650;
    white-space: normal;
    overflow-wrap: anywhere;
}

#automationList button:hover:not(:disabled) {
    border-color: var(--auto-primary);
    color: var(--auto-primary-dark);
}

/* 10. PAGINATION */
.automation-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #EDF0ED;
}

.automation-pagination span {
    color: var(--auto-muted);
    font-size: 14px;
    text-align: center;
}

.automation-pagination button {
    min-height: 40px;
    padding: 9px 15px;
    border: 1px solid var(--auto-border);
    border-radius: 9px;
    background: #fff;
    color: var(--auto-text);
    font-size: 13px;
    font-weight: 650;
}

.automation-pagination button:hover:not(:disabled) {
    border-color: var(--auto-primary);
    background: var(--auto-primary-light);
}

/* 11. CREATE / EDIT FORM */
#automationFormSection,
#automationDetailsSection {
    min-width: 0;
    margin: 0 0 28px;
    padding: 26px;
    border: 1px solid var(--auto-border);
    border-radius: var(--auto-radius);
    background: var(--auto-white);
    box-shadow: var(--auto-shadow);
    scroll-margin-top: 24px;
}

#automationForm {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

.automation-field {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
}

.automation-field label {
    margin-bottom: 8px;
}

.automation-field small {
    display: block;
    margin-top: 7px;
    color: var(--auto-muted);
    font-size: 12px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

/* 12. CONFIGURATION PANELS */
.automation-config-panel {
    min-width: 0;
    padding: 23px;
    border: 1px solid var(--auto-border);
    border-radius: 12px;
    background: #FBFCFA;
}

.automation-config-panel h3 {
    margin: 0 0 7px;
    color: var(--auto-text);
    font-size: 18px;
    font-weight: 750;
    line-height: 1.4;
}

.automation-config-panel>p {
    margin: 0 0 20px;
    color: var(--auto-muted);
    font-size: 14px;
}

.automation-config-panel .automation-field+.automation-field {
    margin-top: 19px;
}

/* 13. ADVANCED JSON CONFIGURATION */
.automation-advanced-config {
    min-width: 0;
    border: 1px solid var(--auto-border);
    border-radius: 11px;
    background: #fff;
    overflow: hidden;
}

.automation-advanced-config summary {
    padding: 16px 18px;
    background: #F7F9F6;
    color: var(--auto-text);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    overflow-wrap: anywhere;
}

.automation-advanced-config summary:hover {
    background: var(--auto-primary-light);
}

.automation-advanced-config[open] summary {
    border-bottom: 1px solid var(--auto-border);
}

.automation-advanced-config .automation-field {
    padding: 18px;
}

.automation-advanced-config .automation-field+.automation-field {
    padding-top: 0;
}

#automationTemplateComponents,
#triggerConfig,
#actionConfig {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.6;
    tab-size: 2;
}

/* 14. FORM ACTIONS */
#saveAutomationBtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    min-height: 46px;
    padding: 11px 22px;
    border: 1px solid var(--auto-primary);
    border-radius: 9px;
    background: var(--auto-primary);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}

#saveAutomationBtn:hover:not(:disabled) {
    border-color: var(--auto-primary-dark);
    background: var(--auto-primary-dark);
    box-shadow: 0 4px 12px rgba(100, 155, 53, 0.17);
}

#cancelAutomationBtn {
    align-self: flex-start;
}

/* 15. AUTOMATION DETAILS */
#automationDetails {
    min-width: 0;
    margin-bottom: 20px;
    overflow-wrap: anywhere;
}

#automationDetails>*,
#automationDetails article,
#automationDetails .automation-detail-card {
    max-width: 100%;
    min-width: 0;
}

#automationDetails pre {
    max-width: 100%;
    padding: 15px;
    border: 1px solid var(--auto-border);
    border-radius: 9px;
    background: #F7F9F6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    overflow-x: auto;
}

#closeAutomationDetailsBtn {
    margin-top: 5px;
}



/* Compact monthly message usage box */
.cb-message-usage {
    display: flex;
    flex-direction: column;
    gap: 7px;
    width: 190px;
    min-width: 190px;
    padding: 10px 13px;
    background: #f5f7ff;
    border: 1px solid #dce3ff;
    border-radius: 12px;
    color: #192235;
    box-sizing: border-box;
}

.cb-message-usage-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: #68758d;
    font-size: 11px;
}

.cb-message-usage-count {
    font-size: 21px;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
}

.cb-message-usage-count span {
    color: #78849a;
    font-size: 13px;
    font-weight: 600;
}

.cb-message-usage-bar {
    width: 100%;
    height: 5px;
    overflow: hidden;
    background: #e1e6f5;
    border-radius: 20px;
}

.cb-message-usage-progress {
    width: 0%;
    height: 100%;
    background: #4355df;
    border-radius: inherit;
    transition: width 0.25s ease;
}

.cb-message-usage-note {
    color: #68758d;
    font-size: 10px;
    line-height: 1.4;
}

@media (max-width: 700px) {
    .cb-message-usage {
        width: 100%;
        min-width: 0;
    }
}


/* Additive chatbot form styling; existing approved stylesheets remain untouched. */
.cb-form-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin: 0 0 16px;
    font-weight: 600;
}

.cb-form-field input,
.cb-form-field select,
.cb-form-field textarea,
.cb-repeater-row input,
#cbWhatsAppAccount {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    border: 1px solid #d7deea;
    border-radius: 9px;
    padding: 10px 12px;
    background: #fff;
    color: #172033;
    font: inherit;
}

.cb-form-field textarea {
    resize: vertical;
}

.cb-repeater {
    margin: 16px 0;
    padding: 14px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
}

.cb-repeater>b,
.cb-repeater-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.cb-repeater-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 10px;
    align-items: end;
    margin: 10px 0;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
    background: #fff;
}

.cb-repeater-row label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
}

.cb-repeater-row button,
#cbAddButton,
#cbAddListRow,
#cbAddTemplateVariable {
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid #d7deea;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font: inherit;
}

.cb-repeater-row button:hover,
#cbAddButton:hover,
#cbAddListRow:hover,
#cbAddTemplateVariable:hover {
    background: #eef4ff;
}

.cb-repeater button:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.cb-template-preview,
.cb-policy-note {
    margin: 12px 0;
    padding: 12px;
    border-radius: 9px;
    background: #f1f5f9;
    color: #334155;
}

.cb-policy-note {
    border-left: 3px solid #64748b;
    font-size: 13px;
    line-height: 1.5;
}

.cb-template-preview p {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-weight: 400;
}

.cb-friendly-parameters {
    margin-top: 12px;
}

.chat-bot_header{
    gap:2px;
    box-sizing: 10px;
    
}


/* Mobile CSS: Keep Header Actions in One Line */
@media (max-width: 768px) {
    .cb-head-actions.cb-compact-actions {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        padding:20px;
        justify-content: flex-start;
        gap: 10px;
        width: 100%;
        min-width: 0;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .cb-head-actions.cb-compact-actions::-webkit-scrollbar {
        display: none;
    }

    .cb-compact-actions .cb-wallet {
        flex: 0 0 auto;
        font-size: 10px;
        white-space: nowrap;
    }

    .cb-compact-actions .cb-usage {
        flex: 0 0 48px;
        width: 48px;
        min-width: 48px;
    }

    .cb-compact-actions .cb-usage-top {
        font-size: 10px;
        white-space: nowrap;
    }

    .cb-compact-actions .cb-usage-track {
        height: 3px;
    }

    .cb-compact-actions .cb-btn {
        flex: 0 0 auto;
        padding: 10px 8px;
        font-size: 10px;
        line-height: 1.2;
        white-space: nowrap;
    }
}

@media (max-width:640px) {
    .cb-repeater-row {
        grid-template-columns: 1fr;
    }
}


/* ==========================================================
   TABLET — 768px AND BELOW
   ========================================================== */
@media (max-width: 768px) {
    .automations-page {
        padding: 22px;
    }

    .automations-heading {
        gap: 16px;
        margin-bottom: 23px;
    }

    .automations-heading h1 {
        font-size: 29px;
    }

    .automations-heading p {
        font-size: 14px;
    }

    #createAutomationBtn {
        min-height: 43px;
        padding: 10px 14px;
        font-size: 13px;
    }

    .automation-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
        margin-bottom: 22px;
    }

    .automation-summary-card {
        min-height: 105px;
        padding: 18px;
    }

    .automation-summary-card strong {
        font-size: 28px;
    }

    .automation-filters {
        padding: 15px;
    }

    .automation-list-section {
        padding: 20px;
    }

    #automationList {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }

    #automationFormSection,
    #automationDetailsSection {
        padding: 22px;
    }

    .automation-config-panel {
        padding: 19px;
    }

    .automation-pagination {
        gap: 10px;
    }

    .automation-pagination button {
        padding: 9px 12px;
    }
}

/* ==========================================================
   MOBILE — 480px AND BELOW
   ========================================================== */
@media (max-width: 480px) {
    .automations-page {
        width: 100%;
        padding: 16px;
        font-size: 15px;
    }

    .automations-heading {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        margin-bottom: 22px;
    }

    .automations-heading h1 {
        font-size: 26px;
        letter-spacing: -0.5px;
    }

    .automations-heading p {
        font-size: 14px;
        line-height: 1.6;
    }

    #createAutomationBtn {
        width: 100%;
        min-height: 46px;
        padding: 12px 15px;
        font-size: 14px;
    }

    .automation-summary {
        gap: 11px;
        margin-bottom: 19px;
    }

    .automation-summary-card {
        min-height: 95px;
        gap: 6px;
        padding: 15px;
        border-radius: 11px;
    }

    .automation-summary-card span {
        font-size: 12px;
    }

    .automation-summary-card strong {
        font-size: 26px;
    }

    .automation-filters {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        margin-bottom: 18px;
        padding: 15px;
        border-radius: 11px;
    }

    .automation-filters>div {
        width: 100%;
    }

    #refreshAutomationsBtn {
        width: 100%;
        min-height: 44px;
    }

    .automation-list-section {
        margin-bottom: 20px;
        padding: 17px;
        border-radius: 12px;
    }

    .automation-list-section h2,
    #automationFormSection>h2,
    #automationDetailsSection>h2 {
        margin-bottom: 17px;
        font-size: 19px;
    }

    #automationList {
        gap: 12px;
    }

    #automationList>article,
    #automationList>.automation-card,
    #automationList>.automation-item,
    #automationList>.automation-list-card {
        padding: 15px;
    }

    #automationList h3,
    #automationList h4 {
        font-size: 16px;
    }

    #automationList button {
        min-height: 40px;
    }

    .automation-pagination {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 12px;
        margin-top: 19px;
        padding-top: 17px;
    }

    .automation-pagination span {
        grid-column: 1 / -1;
        grid-row: 1;
        font-size: 13px;
    }

    .automation-pagination button {
        width: 100%;
        min-height: 42px;
        padding: 9px 8px;
        font-size: 13px;
    }

    #automationFormSection,
    #automationDetailsSection {
        margin-bottom: 20px;
        padding: 17px;
        border-radius: 12px;
    }

    #automationForm {
        gap: 18px;
    }

    .automations-page label {
        font-size: 13px;
    }

    .automations-page input:not([type="hidden"]),
    .automations-page select {
        min-height: 46px;
        padding: 11px 12px;
        font-size: 14px;
    }

    .automations-page textarea {
        min-height: 100px;
        padding: 11px 12px;
        font-size: 14px;
    }

    .automation-field small {
        font-size: 12px;
    }

    .automation-config-panel {
        padding: 15px;
        border-radius: 10px;
    }

    .automation-config-panel h3 {
        font-size: 16px;
    }

    .automation-config-panel>p {
        margin-bottom: 17px;
        font-size: 13px;
    }

    .automation-config-panel .automation-field+.automation-field {
        margin-top: 17px;
    }

    .automation-advanced-config summary {
        padding: 14px;
        font-size: 13px;
    }

    .automation-advanced-config .automation-field {
        padding: 15px;
    }

    .automation-advanced-config .automation-field+.automation-field {
        padding-top: 0;
    }

    #automationTemplateComponents,
    #triggerConfig,
    #actionConfig {
        font-size: 12px;
    }

    #saveAutomationBtn,
    #cancelAutomationBtn,
    #closeAutomationDetailsBtn {
        width: 100%;
        min-height: 46px;
        align-self: stretch;
    }

    #automationFormMessage,
    #automationMessage {
        font-size: 13px;
    }

    #automationMessage:not(:empty),
    #automationFormMessage:not(:empty) {
        padding: 11px 12px;
    }

    #automationDetails pre {
        padding: 12px;
        font-size: 12px;
    }
}

/* ==========================================================
   SMALL MOBILE — 360px AND BELOW
   ========================================================== */
@media (max-width: 360px) {
    .automations-page {
        padding: 12px;
    }

    .automations-heading h1 {
        font-size: 24px;
    }

    .automation-summary {
        gap: 9px;
    }

    .automation-summary-card {
        min-height: 88px;
        padding: 12px;
    }

    .automation-summary-card span {
        font-size: 11px;
    }

    .automation-summary-card strong {
        font-size: 23px;
    }

    .automation-filters,
    .automation-list-section,
    #automationFormSection,
    #automationDetailsSection {
        padding: 13px;
    }

    .automation-config-panel {
        padding: 12px;
    }

    .automation-pagination {
        gap: 8px;
    }

    .automation-pagination button {
        padding: 8px 5px;
        font-size: 12px;
    }
}

/* ACCESSIBILITY */
@media (prefers-reduced-motion: reduce) {

    .automations-page *,
    .automations-page *::before,
    .automations-page *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}










/* =========================================================
   WHATSAPP ACCOUNT MANAGEMENT — ADTHRIVE MEDIA
   ========================================================= */

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

:root {
    --whatsapp-primary: #7CB947;
    --whatsapp-primary-hover: #659e38;
    --whatsapp-text: #111827;
    --whatsapp-muted: #6b7280;
    --whatsapp-border: #e5e7eb;
    --whatsapp-background: #f7f8fa;
    --whatsapp-white: #ffffff;
    --whatsapp-success: #16854f;
    --whatsapp-danger: #b42318;
}

body {
    min-height: 100vh;
    background: var(--whatsapp-background);
    color: var(--whatsapp-text);
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

/* Main Page */

.whatsapp-page {
    width: 100%;
    max-width: 1300px;
    margin: 0 auto;
    padding: 35px;
}

/* Page Heading */

.whatsapp-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
}

.whatsapp-heading h1 {
    margin-bottom: 6px;
    color: var(--whatsapp-text);
    font-size: 30px;
    font-weight: 750;
    line-height: 1.3;
    letter-spacing: -0.5px;
}

.whatsapp-heading p {
    color: var(--whatsapp-muted);
    font-size: 14px;
}

/* Buttons */

.whatsapp-page button {
    min-height: 43px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 18px;
    border: 1px solid var(--whatsapp-border);
    border-radius: 8px;
    background: var(--whatsapp-white);
    color: #374151;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}

.whatsapp-page button:hover:not(:disabled) {
    background: #f8faf7;
    border-color: #c8d9b8;
    color: var(--whatsapp-primary-hover);
}

.whatsapp-page button:active:not(:disabled) {
    transform: scale(0.98);
}

.whatsapp-page button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

#showConnectFormBtn,
#connectAccountBtn,
#updateTokenBtn {
    background: var(--whatsapp-primary);
    border-color: var(--whatsapp-primary);
    color: #ffffff;
}

#showConnectFormBtn:hover:not(:disabled),
#connectAccountBtn:hover:not(:disabled),
#updateTokenBtn:hover:not(:disabled) {
    background: var(--whatsapp-primary-hover);
    border-color: var(--whatsapp-primary-hover);
    color: #ffffff;
}

/* Account Summary */

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

.whatsapp-summary-card {
    display: flex;
    flex-direction: column;
    gap: 11px;
    min-width: 0;
    padding: 23px;
    background: var(--whatsapp-white);
    border: 1px solid var(--whatsapp-border);
    border-radius: 12px;
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.025);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.whatsapp-summary-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}

.whatsapp-summary-card span {
    color: var(--whatsapp-muted);
    font-size: 13px;
    font-weight: 600;
}

.whatsapp-summary-card strong {
    color: var(--whatsapp-text);
    font-size: 30px;
    font-weight: 750;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.whatsapp-summary-card:nth-child(2) strong {
    color: var(--whatsapp-success);
}

.whatsapp-summary-card:nth-child(3) strong {
    color: #b7791f;
}

.whatsapp-summary-card:nth-child(4) strong {
    color: #64748b;
}

/* General Messages */

#whatsappMessage,
#connectFormMessage,
#updateTokenMessage {
    display: none;
    margin-bottom: 20px;
    padding: 12px 15px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

#whatsappMessage:not(:empty),
#connectFormMessage:not(:empty),
#updateTokenMessage:not(:empty) {
    display: block;
}

#whatsappMessage.success,
#connectFormMessage.success,
#updateTokenMessage.success {
    background: #eaf7ee;
    border-color: #ccebd8;
    color: var(--whatsapp-success);
}

#whatsappMessage.error,
#connectFormMessage.error,
#updateTokenMessage.error {
    background: #fff1f2;
    border-color: #fecaca;
    color: var(--whatsapp-danger);
}

/* Connect Account & Update Token Panels */

#connectAccountSection,
#updateTokenSection,
#whatsappDetailsSection {
    min-width: 0;
    margin-bottom: 25px;
    padding: 27px;
    background: var(--whatsapp-white);
    border: 1px solid var(--whatsapp-border);
    border-radius: 12px;
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.025);
}

#connectAccountSection[hidden],
#updateTokenSection[hidden],
#whatsappDetailsSection[hidden] {
    display: none;
}

#connectAccountSection h2,
#updateTokenSection h2,
#whatsappDetailsSection h2 {
    margin-bottom: 10px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eef0f2;
    color: var(--whatsapp-text);
    font-size: 17px;
    font-weight: 750;
}

#connectAccountSection>p,
#updateTokenSection>p {
    margin-bottom: 23px;
    color: var(--whatsapp-muted);
    font-size: 13px;
    line-height: 1.7;
}

/* Forms */

#connectAccountForm,
#updateTokenForm {
    width: 100%;
    max-width: 850px;
}

.whatsapp-field {
    width: 100%;
    margin-bottom: 20px;
}

.whatsapp-field label {
    display: block;
    margin-bottom: 7px;
    color: #374151;
    font-size: 13px;
    font-weight: 650;
}

.whatsapp-field input {
    display: block;
    width: 100%;
    height: 46px;
    padding: 0 13px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    outline: none;
    background: #ffffff;
    color: var(--whatsapp-text);
    font-family: inherit;
    font-size: 13px;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.whatsapp-field input:hover {
    border-color: #aeb5bf;
}

.whatsapp-field input:focus {
    border-color: var(--whatsapp-primary);
    box-shadow: 0 0 0 3px rgba(124, 185, 71, 0.13);
}

.whatsapp-field input::placeholder {
    color: #9ca3af;
    font-size: 12px;
}

/* Access Token Checkbox */

.whatsapp-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 20px;
    color: #4b5563;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}

.whatsapp-checkbox input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--whatsapp-primary);
    cursor: pointer;
}

/* Form Action Buttons */

#connectAccountForm button,
#updateTokenForm button {
    margin: 5px 8px 0 0;
}

#cancelConnectBtn,
#cancelUpdateTokenBtn {
    background: #ffffff;
    border-color: #d1d5db;
    color: #4b5563;
}

#cancelConnectBtn:hover:not(:disabled),
#cancelUpdateTokenBtn:hover:not(:disabled) {
    background: #f9fafb;
    border-color: #9ca3af;
    color: var(--whatsapp-text);
}

/* Account List Section */

.whatsapp-account-list-section {
    min-width: 0;
    margin-bottom: 25px;
    padding: 26px;
    background: var(--whatsapp-white);
    border: 1px solid var(--whatsapp-border);
    border-radius: 12px;
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.025);
}

.whatsapp-list-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 17px;
    border-bottom: 1px solid #eef0f2;
}

.whatsapp-list-heading h2 {
    color: var(--whatsapp-text);
    font-size: 17px;
    font-weight: 750;
}

#whatsappAccountList {
    min-width: 0;
}

#whatsappAccountList>p {
    padding: 32px 15px;
    color: var(--whatsapp-muted);
    font-size: 13px;
    text-align: center;
}

/* Account List Items */

#whatsappAccountList>div,
#whatsappAccountList>article,
#whatsappAccountList>li {
    min-width: 0;
    margin-bottom: 12px;
    padding: 20px;
    border: 1px solid #eef0f2;
    border-radius: 9px;
    background: #ffffff;
    transition:
        border-color 0.2s ease,
        background 0.2s ease,
        box-shadow 0.2s ease;
}

#whatsappAccountList>div:hover,
#whatsappAccountList>article:hover,
#whatsappAccountList>li:hover {
    border-color: #dce8d2;
    background: #fcfdfb;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.035);
}

#whatsappAccountList>div:last-child,
#whatsappAccountList>article:last-child,
#whatsappAccountList>li:last-child {
    margin-bottom: 0;
}

#whatsappAccountList strong {
    color: var(--whatsapp-text);
    font-size: 14px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

#whatsappAccountList p {
    color: #4b5563;
    font-size: 13px;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

#whatsappAccountList small {
    display: block;
    margin-top: 6px;
    color: var(--whatsapp-muted);
    font-size: 11px;
    overflow-wrap: anywhere;
}

/* Status Badges */

.whatsapp-status,
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    padding: 4px 10px;
    border-radius: 20px;
    background: #f3f4f6;
    color: #4b5563;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.status-connected,
.status-badge.connected,
.status-active,
.status-badge.active {
    background: #eaf7ee;
    color: #16854f;
}

.status-pending,
.status-badge.pending {
    background: #fff7e6;
    color: #9a6700;
}

.status-disconnected,
.status-badge.disconnected,
.status-error,
.status-badge.error {
    background: #fff1f2;
    color: #b42318;
}

/* Account Details */

#whatsappAccountDetails {
    min-width: 0;
    margin-bottom: 20px;
}

#whatsappAccountDetails>p {
    margin-bottom: 13px;
    color: #4b5563;
    font-size: 13px;
    line-height: 1.7;
    overflow-wrap: anywhere;
    word-break: break-word;
}

#whatsappAccountDetails>div,
#whatsappAccountDetails>article {
    min-width: 0;
    padding: 13px 0;
    border-bottom: 1px solid #eef0f2;
}

#whatsappAccountDetails strong {
    color: var(--whatsapp-text);
    font-weight: 700;
}

#whatsappAccountDetails pre,
#whatsappAccountDetails code {
    max-width: 100%;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    word-break: break-word;
}

#closeDetailsBtn {
    margin-top: 5px;
}

/* Accessibility */

.whatsapp-page button:focus-visible,
.whatsapp-page input:focus-visible {
    outline: 3px solid rgba(124, 185, 71, 0.3);
    outline-offset: 3px;
}

/* Tablet */

@media (max-width: 1000px) {
    .whatsapp-page {
        padding: 28px 22px;
    }

    .whatsapp-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 15px;
    }

    .whatsapp-summary-card {
        padding: 20px;
    }
}

/* Mobile */

@media (max-width: 600px) {
    .whatsapp-page {
        padding: 22px 14px;
    }

    .whatsapp-heading {
        align-items: stretch;
        flex-direction: column;
        gap: 16px;
        margin-bottom: 22px;
    }

    .whatsapp-heading h1 {
        font-size: 25px;
    }

    .whatsapp-heading p {
        font-size: 13px;
    }

    #showConnectFormBtn {
        width: 100%;
    }

    .whatsapp-summary {
        gap: 11px;
        margin-bottom: 20px;
    }

    .whatsapp-summary-card {
        gap: 9px;
        padding: 16px 14px;
        border-radius: 10px;
    }

    .whatsapp-summary-card span {
        font-size: 12px;
    }

    .whatsapp-summary-card strong {
        font-size: 26px;
    }

    #connectAccountSection,
    #updateTokenSection,
    #whatsappDetailsSection {
        padding: 20px 15px;
        border-radius: 10px;
    }

    #connectAccountSection h2,
    #updateTokenSection h2,
    #whatsappDetailsSection h2 {
        font-size: 15px;
    }

    #connectAccountSection>p,
    #updateTokenSection>p {
        font-size: 12px;
    }

    .whatsapp-field {
        margin-bottom: 17px;
    }

    .whatsapp-field label {
        font-size: 12px;
    }

    .whatsapp-field input {
        height: 44px;
        font-size: 12px;
    }

    .whatsapp-checkbox {
        margin-bottom: 18px;
        font-size: 12px;
    }

    #connectAccountForm button,
    #updateTokenForm button {
        width: 100%;
        margin: 5px 0 8px;
    }

    .whatsapp-account-list-section {
        padding: 19px 14px;
        border-radius: 10px;
    }

    .whatsapp-list-heading {
        align-items: center;
        gap: 10px;
    }

    .whatsapp-list-heading h2 {
        font-size: 15px;
    }

    #whatsappAccountList>div,
    #whatsappAccountList>article,
    #whatsappAccountList>li {
        padding: 15px 12px;
    }

    #whatsappAccountList strong {
        font-size: 13px;
    }

    #whatsappAccountList p {
        font-size: 12px;
    }

    #closeDetailsBtn {
        width: 100%;
    }

    #whatsappMessage,
    #connectFormMessage,
    #updateTokenMessage {
        font-size: 12px;
    }
}

/* Extra Small Phones */

@media (max-width: 360px) {
    .whatsapp-page {
        padding: 17px 10px;
    }

    .whatsapp-heading h1 {
        font-size: 23px;
    }

    .whatsapp-summary {
        grid-template-columns: 1fr 1fr;
        gap: 9px;
    }

    .whatsapp-summary-card {
        padding: 14px 11px;
    }

    .whatsapp-summary-card span {
        font-size: 11px;
    }

    .whatsapp-summary-card strong {
        font-size: 23px;
    }

    .whatsapp-account-list-section {
        padding: 16px 11px;
    }

    #connectAccountSection,
    #updateTokenSection,
    #whatsappDetailsSection {
        padding: 17px 12px;
    }

    .whatsapp-list-heading h2 {
        font-size: 14px;
    }

    .whatsapp-list-heading button {
        padding: 0 11px;
    }
}






/* =========================================================
   MESSAGES PAGE — ADTHRIVE MEDIA
   ========================================================= */

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

:root {
    --messages-primary: #7CB947;
    --messages-primary-hover: #659e38;
    --messages-text: #111827;
    --messages-muted: #6b7280;
    --messages-border: #e5e7eb;
    --messages-background: #f7f8fa;
    --messages-white: #ffffff;
    --messages-success: #16854f;
    --messages-danger: #b42318;
}

body {
    min-height: 100vh;
    background: var(--messages-background);
    color: var(--messages-text);
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

/* Main Page */

.messages-page {
    width: 100%;
    max-width: 1350px;
    margin: 0 auto;
    padding: 35px;
}

/* Page Heading */

.messages-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
}

.messages-heading h1 {
    margin-bottom: 6px;
    font-size: 30px;
    font-weight: 750;
    line-height: 1.3;
    letter-spacing: -0.5px;
}

.messages-heading p {
    color: var(--messages-muted);
    font-size: 14px;
}

/* Buttons */

.messages-page button {
    min-height: 43px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 18px;
    border: 1px solid var(--messages-border);
    border-radius: 8px;
    background: var(--messages-white);
    color: #374151;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}

.messages-page button:hover:not(:disabled) {
    background: #f8faf7;
    border-color: #c8d9b8;
    color: var(--messages-primary-hover);
}

.messages-page button:active:not(:disabled) {
    transform: scale(0.98);
}

.messages-page button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#refreshMessagesBtn,
#applyMessageFiltersBtn,
#createTextMessageBtn,
#createTemplateMessageBtn,
#sendPendingMessageBtn {
    background: var(--messages-primary);
    border-color: var(--messages-primary);
    color: #ffffff;
}

#refreshMessagesBtn:hover:not(:disabled),
#applyMessageFiltersBtn:hover:not(:disabled),
#createTextMessageBtn:hover:not(:disabled),
#createTemplateMessageBtn:hover:not(:disabled),
#sendPendingMessageBtn:hover:not(:disabled) {
    background: var(--messages-primary-hover);
    border-color: var(--messages-primary-hover);
    color: #ffffff;
}

/* Summary Cards */

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

.messages-summary-card {
    display: flex;
    flex-direction: column;
    gap: 11px;
    min-width: 0;
    padding: 23px;
    background: var(--messages-white);
    border: 1px solid var(--messages-border);
    border-radius: 12px;
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.025);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.messages-summary-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}

.messages-summary-card span {
    color: var(--messages-muted);
    font-size: 13px;
    font-weight: 600;
}

.messages-summary-card strong {
    color: var(--messages-text);
    font-size: 30px;
    font-weight: 750;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.messages-summary-card:nth-child(2) strong {
    color: var(--messages-success);
}

.messages-summary-card:nth-child(3) strong {
    color: #b7791f;
}

.messages-summary-card:nth-child(4) strong {
    color: var(--messages-danger);
}

/* Compose Message Card */

.messages-compose,
.messages-history {
    min-width: 0;
    margin-bottom: 25px;
    padding: 27px;
    background: var(--messages-white);
    border: 1px solid var(--messages-border);
    border-radius: 12px;
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.025);
}

.messages-compose>h2,
.messages-history-heading h2 {
    color: var(--messages-text);
    font-size: 17px;
    font-weight: 750;
}

.messages-compose>h2 {
    margin-bottom: 23px;
    padding-bottom: 17px;
    border-bottom: 1px solid #eef0f2;
}

/* Form Fields */

.messages-field {
    width: 100%;
    min-width: 0;
    margin-bottom: 20px;
}

.messages-field label {
    display: block;
    margin-bottom: 7px;
    color: #374151;
    font-size: 13px;
    font-weight: 650;
}

.messages-field input,
.messages-field select,
.messages-field textarea {
    display: block;
    width: 100%;
    min-height: 45px;
    padding: 11px 13px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    outline: none;
    background: #ffffff;
    color: var(--messages-text);
    font-family: inherit;
    font-size: 13px;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.messages-field input,
.messages-field select {
    height: 45px;
    padding-top: 0;
    padding-bottom: 0;
}

.messages-field textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.7;
}

.messages-field textarea[spellcheck="false"] {
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
}

.messages-field input::placeholder,
.messages-field textarea::placeholder {
    color: #9ca3af;
    font-size: 12px;
}

.messages-field input:hover,
.messages-field select:hover,
.messages-field textarea:hover {
    border-color: #aeb5bf;
}

.messages-field input:focus,
.messages-field select:focus,
.messages-field textarea:focus {
    border-color: var(--messages-primary);
    box-shadow: 0 0 0 3px rgba(124, 185, 71, 0.13);
}

.messages-field small {
    display: block;
    margin-top: 7px;
    color: var(--messages-muted);
    font-size: 11px;
    line-height: 1.7;
}

/* Message Type Selector */

.messages-compose>.messages-field {
    max-width: 420px;
}

/* Forms */

#textMessageForm,
#templateMessageForm {
    width: 100%;
    max-width: 800px;
}

#templateMessageForm[hidden],
#textMessageForm[hidden] {
    display: none;
}

#textMessageForm button,
#templateMessageForm button {
    margin-top: 3px;
}

/* Compose Status */

#composeMessageStatus,
#messageHistoryStatus {
    display: none;
    margin-top: 18px;
    padding: 12px 15px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

#composeMessageStatus:not(:empty),
#messageHistoryStatus:not(:empty) {
    display: block;
}

#composeMessageStatus.success,
#messageHistoryStatus.success {
    background: #eaf7ee;
    border-color: #ccebd8;
    color: var(--messages-success);
}

#composeMessageStatus.error,
#messageHistoryStatus.error {
    background: #fff1f2;
    border-color: #fecaca;
    color: var(--messages-danger);
}

/* Pending Send Panel */

#pendingSendPanel {
    margin-top: 22px;
    padding: 20px;
    background: #f8fbf5;
    border: 1px solid #dce8d2;
    border-radius: 10px;
}

#pendingSendPanel[hidden] {
    display: none;
}

#pendingSendDescription {
    margin-bottom: 15px;
    color: #4b5563;
    font-size: 13px;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

#sendPendingMessageBtn {
    min-width: 190px;
}

/* Message History Heading */

.messages-history-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 22px;
    padding-bottom: 17px;
    border-bottom: 1px solid #eef0f2;
}

/* Filters */

.messages-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: end;
    margin-bottom: 22px;
    padding: 21px;
    background: #fafbf9;
    border: 1px solid #eef0f2;
    border-radius: 10px;
}

.messages-filters .messages-field {
    margin-bottom: 0;
}

#applyMessageFiltersBtn {
    grid-column: 1 / -1;
    width: 100%;
}

/* Message History List */

#messageHistoryList {
    min-width: 0;
}

#messageHistoryList>p {
    padding: 32px 15px;
    color: var(--messages-muted);
    font-size: 13px;
    text-align: center;
}

/* Supports common JS-rendered message item structures */

#messageHistoryList>div,
#messageHistoryList>article,
#messageHistoryList>li {
    min-width: 0;
    margin-bottom: 12px;
    padding: 19px;
    border: 1px solid #eef0f2;
    border-radius: 9px;
    background: #ffffff;
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

#messageHistoryList>div:hover,
#messageHistoryList>article:hover,
#messageHistoryList>li:hover {
    background: #fcfdfb;
    border-color: #dce8d2;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.035);
}

#messageHistoryList>div:last-child,
#messageHistoryList>article:last-child,
#messageHistoryList>li:last-child {
    margin-bottom: 0;
}

#messageHistoryList strong {
    color: var(--messages-text);
    font-size: 14px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

#messageHistoryList p {
    color: #4b5563;
    font-size: 13px;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

#messageHistoryList small {
    display: block;
    margin-top: 6px;
    color: var(--messages-muted);
    font-size: 11px;
    overflow-wrap: anywhere;
}

/* Message Status Badges */

.message-status,
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    padding: 4px 10px;
    border-radius: 20px;
    background: #f3f4f6;
    color: #4b5563;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.status-pending,
.status-badge.pending {
    background: #fff7e6;
    color: #9a6700;
}

.status-sent,
.status-badge.sent,
.status-delivered,
.status-badge.delivered,
.status-read,
.status-badge.read {
    background: #eaf7ee;
    color: #16854f;
}

.status-failed,
.status-badge.failed {
    background: #fff1f2;
    color: #b42318;
}

/* Pagination */

.messages-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #eef0f2;
}

#messagesPageInfo {
    color: var(--messages-muted);
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

/* Accessibility */

.messages-page button:focus-visible,
.messages-page input:focus-visible,
.messages-page select:focus-visible,
.messages-page textarea:focus-visible {
    outline: 3px solid rgba(124, 185, 71, 0.3);
    outline-offset: 3px;
}

/* Tablet */

@media (max-width: 1000px) {
    .messages-page {
        padding: 28px 22px;
    }

    .messages-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 15px;
    }

    .messages-summary-card {
        padding: 20px;
    }
}

/* Mobile */

@media (max-width: 600px) {
    .messages-page {
        padding: 22px 14px;
    }

    .messages-heading {
        align-items: stretch;
        flex-direction: column;
        gap: 16px;
        margin-bottom: 22px;
    }

    .messages-heading h1 {
        font-size: 25px;
    }

    .messages-heading p {
        font-size: 13px;
    }

    #refreshMessagesBtn {
        width: 100%;
    }

    .messages-summary {
        gap: 11px;
        margin-bottom: 20px;
    }

    .messages-summary-card {
        gap: 9px;
        padding: 16px 14px;
        border-radius: 10px;
    }

    .messages-summary-card span {
        font-size: 12px;
    }

    .messages-summary-card strong {
        font-size: 26px;
    }

    .messages-compose,
    .messages-history {
        padding: 20px 15px;
        border-radius: 10px;
    }

    .messages-compose>h2,
    .messages-history-heading h2 {
        font-size: 15px;
    }

    .messages-field {
        margin-bottom: 17px;
    }

    .messages-field label {
        font-size: 12px;
    }

    .messages-field input,
    .messages-field select {
        height: 44px;
        font-size: 12px;
    }

    .messages-field textarea {
        min-height: 105px;
        font-size: 12px;
    }

    .messages-compose>.messages-field {
        max-width: none;
    }

    #textMessageForm button,
    #templateMessageForm button {
        width: 100%;
    }

    #pendingSendPanel {
        padding: 16px 13px;
    }

    #sendPendingMessageBtn {
        width: 100%;
        min-width: 0;
    }

    .messages-filters {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 16px;
    }

    #applyMessageFiltersBtn {
        grid-column: auto;
        width: 100%;
    }

    #messageHistoryList>div,
    #messageHistoryList>article,
    #messageHistoryList>li {
        padding: 15px 12px;
    }

    #messageHistoryList strong {
        font-size: 13px;
    }

    #messageHistoryList p {
        font-size: 12px;
    }

    .messages-pagination {
        justify-content: space-between;
        gap: 8px;
    }

    .messages-pagination button {
        min-height: 39px;
        padding: 0 11px;
        font-size: 11px;
    }

    #messagesPageInfo {
        font-size: 11px;
    }

    #composeMessageStatus,
    #messageHistoryStatus {
        font-size: 12px;
    }
}

/* Extra Small Phones */

@media (max-width: 360px) {
    .messages-page {
        padding: 17px 10px;
    }

    .messages-heading h1 {
        font-size: 23px;
    }

    .messages-summary {
        grid-template-columns: 1fr 1fr;
        gap: 9px;
    }

    .messages-summary-card {
        padding: 14px 11px;
    }

    .messages-summary-card span {
        font-size: 11px;
    }

    .messages-summary-card strong {
        font-size: 23px;
    }

    .messages-compose,
    .messages-history {
        padding: 17px 12px;
    }

    .messages-pagination {
        gap: 5px;
    }

    .messages-pagination button {
        padding: 0 8px;
    }
}








/* ================================
   Contact Management Module
   AdThrive Media - Responsive CSS
================================ */

:root {
    --contact-primary: #7CB947;
    --contact-primary-hover: #659e38;
    --contact-text: #111827;
    --contact-muted: #6b7280;
    --contact-border: #e5e7eb;
    --contact-bg: #f7f8fa;
    --contact-white: #ffffff;
    --contact-danger: #dc2626;
    --contact-radius: 10px;
    --contact-shadow: 0 4px 14px rgba(17, 24, 39, 0.05);
}

.contacts-page,
.contacts-page * {
    box-sizing: border-box;
}

.contacts-page {
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
    padding: 28px;
    color: var(--contact-text);
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 16px;
}

/* Page heading */

.contacts-page .page-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 26px;
}

.contacts-page .page-heading>div {
    flex: 1;
    min-width: 0;
}

.contacts-page .page-heading h1 {
    margin: 0 0 8px;
    color: var(--contact-text);
    font-size: 30px;
    font-weight: 700;
    line-height: 1.3;
}

.contacts-page .page-heading p {
    margin: 0;
    color: var(--contact-muted);
    font-size: 15px;
    line-height: 1.6;
}

/* Buttons */

.contacts-page button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 17px;
    border: 1px solid var(--contact-border);
    border-radius: 7px;
    background: var(--contact-white);
    color: var(--contact-text);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}

.contacts-page button:hover {
    border-color: var(--contact-primary);
    color: var(--contact-primary-hover);
}

.contacts-page button:active {
    transform: translateY(1px);
}

.contacts-page button:focus-visible {
    outline: 3px solid rgba(124, 185, 71, 0.3);
    outline-offset: 2px;
}

.contacts-page button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

#addContactBtn,
#saveContactBtn {
    border-color: var(--contact-primary);
    background: var(--contact-primary);
    color: var(--contact-white);
}

#addContactBtn:hover,
#saveContactBtn:hover {
    border-color: var(--contact-primary-hover);
    background: var(--contact-primary-hover);
    color: var(--contact-white);
}

#refreshContactsBtn {
    background: var(--contact-white);
}

/* Main sections */

.contacts-page .billing-section {
    min-width: 0;
    margin-bottom: 25px;
    padding: 24px;
    border: 1px solid var(--contact-border);
    border-radius: var(--contact-radius);
    background: var(--contact-white);
    box-shadow: var(--contact-shadow);
}

.contacts-page .billing-section>h2 {
    margin: 0 0 20px;
    color: var(--contact-text);
    font-size: 21px;
    font-weight: 700;
    line-height: 1.4;
}

/* Section heading */

.contacts-page .section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.contacts-page .section-heading h2 {
    margin: 0;
    color: var(--contact-text);
    font-size: 21px;
    font-weight: 700;
    line-height: 1.4;
}

.contacts-page .section-heading p {
    margin: 0;
    color: var(--contact-muted);
    font-size: 14px;
    line-height: 1.6;
}

/* Labels */

.contacts-page label {
    display: block;
    margin: 0 0 7px;
    color: #374151;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
}

/* Inputs, selects and textareas */

.contacts-page input,
.contacts-page select,
.contacts-page textarea {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 11px 13px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    outline: none;
    background: var(--contact-white);
    color: var(--contact-text);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.contacts-page input::placeholder,
.contacts-page textarea::placeholder {
    color: #9ca3af;
}

.contacts-page input:focus,
.contacts-page select:focus,
.contacts-page textarea:focus {
    border-color: var(--contact-primary);
    box-shadow: 0 0 0 3px rgba(124, 185, 71, 0.15);
}

.contacts-page input:disabled,
.contacts-page select:disabled,
.contacts-page textarea:disabled {
    background: #f3f4f6;
    color: var(--contact-muted);
    cursor: not-allowed;
}

.contacts-page textarea {
    min-height: 110px;
    resize: vertical;
}

/* Search form */

#contactSearchForm {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.7fr);
    gap: 10px 16px;
    align-items: end;
}

#contactSearchForm label {
    margin: 0 0 -3px;
}

#contactSearchForm input,
#contactSearchForm select {
    min-width: 0;
}

#contactSearchForm button {
    justify-self: start;
    min-width: 110px;
}

#contactSearchForm button[type="submit"] {
    border-color: var(--contact-primary);
    background: var(--contact-primary);
    color: var(--contact-white);
}

#contactSearchForm button[type="submit"]:hover {
    border-color: var(--contact-primary-hover);
    background: var(--contact-primary-hover);
    color: var(--contact-white);
}

#resetContactSearchBtn {
    justify-self: start;
}

/* Contact form */

#contactForm {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 16px;
    align-items: end;
}

#contactForm>label {
    align-self: end;
    margin: 0 0 -3px;
}

#contactForm>input,
#contactForm>select,
#contactForm>textarea {
    min-width: 0;
}

#contactForm>textarea,
#contactForm>button {
    grid-column: 1 / -1;
}

#contactForm>button {
    justify-self: start;
    min-width: 145px;
    margin-top: 7px;
}

#contactForm>button[type="submit"] {
    border-color: var(--contact-primary);
    background: var(--contact-primary);
    color: var(--contact-white);
}

#contactForm>button[type="submit"]:hover {
    border-color: var(--contact-primary-hover);
    background: var(--contact-primary-hover);
    color: var(--contact-white);
}

#cancelContactEditBtn {
    margin-top: 0;
}

/* Contact messages */

#contactsMessage {
    display: none;
    margin: 18px 0 0;
    padding: 12px 15px;
    border: 1px solid var(--contact-border);
    border-radius: 7px;
    background: #f9fafb;
    color: var(--contact-text);
    font-size: 14px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

#contactsMessage:not(:empty) {
    display: block;
}

#contactsMessage.success,
#contactsMessage[data-type="success"] {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

#contactsMessage.error,
#contactsMessage[data-type="error"] {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

#contactsMessage.warning,
#contactsMessage[data-type="warning"] {
    border-color: #fde68a;
    background: #fffbeb;
    color: #92400e;
}

/* Contacts table */

.contacts-page .billing-table-wrapper {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--contact-border);
    border-radius: 8px;
    -webkit-overflow-scrolling: touch;
}

.contacts-page .billing-table {
    width: 100%;
    min-width: 900px;
    border-collapse: collapse;
    border-spacing: 0;
    text-align: left;
}

.contacts-page .billing-table thead {
    background: #f9fafb;
}

.contacts-page .billing-table th {
    padding: 15px 16px;
    border-bottom: 1px solid var(--contact-border);
    color: #4b5563;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.035em;
    text-transform: uppercase;
    white-space: nowrap;
}

.contacts-page .billing-table td {
    padding: 15px 16px;
    border-bottom: 1px solid #f0f1f3;
    color: #374151;
    font-size: 14px;
    line-height: 1.6;
    vertical-align: middle;
    overflow-wrap: anywhere;
}

.contacts-page .billing-table tbody tr:last-child td {
    border-bottom: none;
}

.contacts-page .billing-table tbody tr:hover {
    background: #fafcf8;
}

.contacts-page .billing-table td[colspan] {
    padding: 28px 16px;
    color: var(--contact-muted);
    text-align: center;
}

.contacts-page .billing-table td button {
    min-height: 34px;
    margin: 2px 4px 2px 0;
    padding: 7px 11px;
    font-size: 12px;
    white-space: nowrap;
}

/* Optional contact status badges */

.contact-status,
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 25px;
    padding: 4px 9px;
    border: 1px solid transparent;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    white-space: nowrap;
}

.contact-status.active,
.status-badge.active {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.contact-status.inactive,
.status-badge.inactive {
    border-color: #e5e7eb;
    background: #f3f4f6;
    color: #4b5563;
}

/* Pagination */

.contacts-page .billing-pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 20px;
}

.contacts-page .billing-pagination span,
#contactsPaginationInfo {
    color: #4b5563;
    font-size: 14px;
    font-weight: 600;
}

.contacts-page .billing-pagination button {
    min-width: 95px;
}

/* Tablet */

@media (max-width: 1050px) {
    .contacts-page {
        padding: 22px;
    }

    .contacts-page .page-heading h1 {
        font-size: 27px;
    }

    .contacts-page .billing-section {
        padding: 21px;
    }

    .contacts-page .billing-table {
        min-width: 850px;
    }
}

/* Mobile */

@media (max-width: 600px) {
    .contacts-page {
        padding: 16px;
        font-size: 15px;
    }

    .contacts-page .page-heading {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
        margin-bottom: 20px;
    }

    .contacts-page .page-heading h1 {
        font-size: 24px;
    }

    .contacts-page .page-heading p {
        font-size: 14px;
    }

    .contacts-page .page-heading button {
        width: 100%;
    }

    .contacts-page .billing-section {
        margin-bottom: 18px;
        padding: 16px;
    }

    .contacts-page .billing-section>h2,
    .contacts-page .section-heading h2 {
        font-size: 19px;
    }

    #contactSearchForm,
    #contactForm {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }

    #contactSearchForm label,
    #contactForm>label {
        margin: 7px 0 -4px;
    }

    #contactSearchForm button,
    #contactForm>button {
        width: 100%;
        grid-column: 1;
        justify-self: stretch;
        margin-top: 7px;
    }

    #contactSearchForm button+button {
        margin-top: 0;
    }

    .contacts-page .section-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .contacts-page .billing-table {
        min-width: 820px;
    }

    .contacts-page .billing-table th,
    .contacts-page .billing-table td {
        padding: 12px;
    }

    .contacts-page .billing-pagination {
        justify-content: space-between;
        gap: 8px;
    }

    .contacts-page .billing-pagination button {
        flex: 1;
        min-width: 0;
        padding: 9px 10px;
    }

    .contacts-page .billing-pagination span {
        text-align: center;
    }
}

/* Small phones */

@media (max-width: 360px) {
    .contacts-page {
        padding: 12px;
    }

    .contacts-page .page-heading h1 {
        font-size: 22px;
    }

    .contacts-page .billing-section {
        padding: 13px;
    }

    .contacts-page input,
    .contacts-page select,
    .contacts-page textarea {
        font-size: 13px;
    }

    .contacts-page button {
        padding: 9px 12px;
        font-size: 13px;
    }

    .contacts-page .billing-pagination {
        justify-content: center;
    }

    .contacts-page .billing-pagination span {
        width: 100%;
        order: -1;
    }
}

/* Reduced motion */

@media (prefers-reduced-motion: reduce) {

    .contacts-page *,
    .contacts-page *::before,
    .contacts-page *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}










/* =====================================================
   ADTHRIVE MEDIA — WHATSAPP TEMPLATES
   File: CSS/templates.css
   Complete Responsive CSS
   Header & Sidebar Excluded
===================================================== */

/* ================= GLOBAL ================= */

.templates-page,
.templates-page *,
.wa-builder-overlay,
.wa-builder-overlay *,
#templateDetailsModal,
#templateDetailsModal * {
    box-sizing: border-box;
}



.templates-page {
    --template-green: #7CB947;
    --template-green-dark: #659e38;
    --template-text: #18231c;
    --template-muted: #738075;
    --template-border: #e7ece7;
    --template-surface: #ffffff;
    --template-background: #f7f9f7;

    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 28px;
    color: var(--template-text);
}

.templates-page button,
.templates-page input,
.templates-page select,
.wa-builder-overlay button,
.wa-builder-overlay input,
.wa-builder-overlay select,
.wa-builder-overlay textarea {
    font: inherit;
}

.templates-page button,
.wa-builder-overlay button,
#templateDetailsModal button {
    cursor: pointer;
}

.templates-page button:focus-visible,
.templates-page input:focus-visible,
.templates-page select:focus-visible,
.wa-builder-overlay button:focus-visible,
.wa-builder-overlay input:focus-visible,
.wa-builder-overlay select:focus-visible,
.wa-builder-overlay textarea:focus-visible {
    outline: 3px solid rgba(124, 185, 71, 0.28);
    outline-offset: 2px;
}

.templates-page .hidden,
.wa-builder-overlay.hidden,
#templateDetailsModal.hidden,
.templates-page [hidden] {
    display: none !important;
}

.templates-page img,
.wa-builder-overlay img {
    max-width: 100%;
    height: auto;
}

.templates-page p,
.templates-page h1,
.templates-page h2,
.templates-page h3,
.wa-builder-overlay p,
.wa-builder-overlay h2,
.wa-builder-overlay h3 {
    overflow-wrap: anywhere;
}

/* ================= PAGE HEADER ================= */

.templates-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.templates-page-header>div {
    min-width: 0;
}

.templates-eyebrow {
    display: inline-block;
    margin-bottom: 9px;
    color: var(--template-green-dark);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.5px;
}

.templates-page-header h1 {
    margin: 0;
    color: #172119;
    font-size: 32px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.7px;
}

.templates-page-header p {
    margin: 10px 0 0;
    color: var(--template-muted);
    font-size: 14px;
    line-height: 1.7;
}

.templates-page .primary-button,
.templates-page .secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 17px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.templates-page .primary-button {
    background: var(--template-green);
    color: #ffffff;
}

.templates-page .primary-button:hover {
    background: var(--template-green-dark);
}

.templates-page .secondary-button {
    background: #ffffff;
    color: #334137;
    border-color: #dfe6df;
}

.templates-page .secondary-button:hover {
    background: #f4f7f3;
    border-color: #cbd7c8;
}

.templates-page-header>.primary-button {
    flex: 0 0 auto;
    white-space: nowrap;
}

.templates-page-header>.primary-button span {
    font-size: 19px;
    line-height: 1;
}

/* ================= PAGE MESSAGE ================= */

.templates-page-message {
    width: 100%;
    margin-bottom: 20px;
    padding: 13px 15px;
    border: 1px solid #dce8d5;
    border-radius: 10px;
    background: #f2f8ee;
    color: #345b28;
    font-size: 13px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.templates-page-message.error {
    color: #a32929;
    border-color: #f0d1d1;
    background: #fff4f4;
}

/* ================= SUMMARY CARDS ================= */

.templates-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    width: 100%;
    margin-bottom: 26px;
}

.templates-summary-card {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    padding: 20px;
    border: 1px solid var(--template-border);
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 3px 12px rgba(20, 40, 20, 0.025);
}

.templates-summary-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 43px;
    width: 43px;
    height: 43px;
    border-radius: 12px;
    background: #eff6e9;
    color: #558e31;
    font-size: 18px;
    font-weight: 800;
}

.templates-summary-card>div:last-child {
    min-width: 0;
}

.templates-summary-card span {
    display: block;
    color: var(--template-muted);
    font-size: 12px;
    line-height: 1.5;
}

.templates-summary-card strong {
    display: block;
    margin-top: 5px;
    color: #1b281d;
    font-size: 27px;
    font-weight: 800;
    line-height: 1.2;
}

.templates-summary-card.success .templates-summary-icon {
    color: #16804a;
    background: #e6f7ed;
}

.templates-summary-card.warning .templates-summary-icon {
    color: #a56c12;
    background: #fff4dc;
}

.templates-summary-card.danger .templates-summary-icon {
    color: #c33b3b;
    background: #ffeded;
}

/* ================= MAIN PANEL ================= */

.templates-main-panel {
    width: 100%;
    min-width: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--template-border);
    border-radius: 15px;
    background: #ffffff;
    box-shadow: 0 4px 18px rgba(20, 40, 20, 0.035);
}

.templates-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 23px 24px 18px;
}

.templates-panel-header>div {
    min-width: 0;
}

.templates-panel-header h3 {
    margin: 0;
    color: #1a261c;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.4;
}

.templates-panel-header p {
    margin: 6px 0 0;
    color: var(--template-muted);
    font-size: 12px;
    line-height: 1.6;
}

/* ================= TOOLBAR ================= */

.templates-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
    padding: 0 24px 20px;
}

.templates-search {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1 1 240px;
    min-width: 0;
}

.templates-search-icon {
    position: absolute;
    left: 13px;
    z-index: 1;
    color: #8a978c;
    font-size: 19px;
    pointer-events: none;
}

.templates-search input,
.templates-filter select {
    width: 100%;
    min-width: 0;
    height: 43px;
    padding: 0 13px;
    border: 1px solid #e0e7e0;
    border-radius: 9px;
    background: #ffffff;
    color: #28352b;
    font-size: 13px;
}

.templates-search input {
    padding-left: 39px;
}

.templates-search input::placeholder {
    color: #9aa49b;
}

.templates-search input:focus,
.templates-filter select:focus {
    border-color: var(--template-green);
    outline: none;
    box-shadow: 0 0 0 3px rgba(124, 185, 71, 0.12);
}

.templates-filter {
    flex: 0 1 180px;
    min-width: 0;
}

.templates-filter select {
    cursor: pointer;
}

.templates-toolbar>.secondary-button {
    flex: 0 0 auto;
}

/* ================= LOADING ================= */

.templates-loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    min-height: 200px;
    padding: 30px 20px;
    color: var(--template-muted);
    text-align: center;
}

.templates-loader {
    width: 35px;
    height: 35px;
    border: 3px solid #e7efdf;
    border-top-color: var(--template-green);
    border-radius: 50%;
    animation: templates-spin 0.8s linear infinite;
}

.templates-loading-state p {
    margin: 0;
    font-size: 13px;
}

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

/* ================= EMPTY STATE ================= */

.templates-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 240px;
    padding: 35px 22px;
    text-align: center;
}

.templates-empty-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    margin-bottom: 16px;
    border-radius: 15px;
    background: #eff6e9;
    color: #558e31;
    font-size: 24px;
    font-weight: 800;
}

.templates-empty-state h3 {
    margin: 0;
    color: #202c22;
    font-size: 18px;
    line-height: 1.4;
}

.templates-empty-state p {
    max-width: 390px;
    margin: 9px 0 18px;
    color: var(--template-muted);
    font-size: 13px;
    line-height: 1.7;
}

/* ================= DESKTOP TABLE ================= */

.templates-table-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.templates-table {
    width: 100%;
    min-width: 740px;
    border-collapse: collapse;
    text-align: left;
}

.templates-table thead {
    background: #f7f9f6;
}

.templates-table th {
    padding: 14px 17px;
    border-top: 1px solid #edf0ec;
    border-bottom: 1px solid #e8ede7;
    color: #748075;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    white-space: nowrap;
}

.templates-table td {
    padding: 15px 17px;
    border-bottom: 1px solid #eef1ed;
    color: #344037;
    font-size: 13px;
    vertical-align: middle;
}

.templates-table tbody tr:last-child td {
    border-bottom: none;
}

.templates-table tbody tr:hover {
    background: #fbfcfa;
}

.templates-table button {
    max-width: 100%;
}

/* ================= MOBILE TEMPLATE CARDS ================= */

.mobile-templates-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    min-width: 0;
    padding: 0 20px 18px;
}

.mobile-templates-container>* {
    max-width: 100%;
    min-width: 0;
}

/* ================= PAGINATION ================= */

.templates-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    padding: 18px 22px;
    border-top: 1px solid #edf0ec;
}

.templates-pagination>div:first-child {
    min-width: 0;
    color: var(--template-muted);
    font-size: 12px;
    line-height: 1.6;
}

.pagination-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    flex-wrap: wrap;
}

.pagination-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 9px 13px;
    border: 1px solid #e1e8df;
    border-radius: 8px;
    background: #ffffff;
    color: #344137;
    font-size: 12px;
    font-weight: 700;
}

.pagination-button:hover:not(:disabled) {
    border-color: var(--template-green);
    background: #f5faef;
}

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

.pagination-current {
    min-width: 28px;
    color: #273429;
    font-size: 13px;
    font-weight: 800;
    text-align: center;
}



/* =====================================================
   TEMPLATE TABLE, MOBILE CARDS & PAGINATION
===================================================== */

/*TEMPLATE MEDIA SECTION
=========================*/
/* =========================================================
   WHATSAPP TEMPLATE BUILDER — HEADER & BODY CONTENT
   Scoped to the existing template builder
   ========================================================= */

/* 1. Content section layout */
.wa-builder-section {
    min-width: 0;
}

.wa-builder-section .form-field {
    min-width: 0;
    margin-bottom: 22px;
}

.wa-builder-section .form-field label {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 9px;
    color: var(--text-primary, #172033);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
}

.wa-builder-section .form-field label > span:not(.wa-optional) {
    color: #e5484d;
}

.wa-optional {
    color: var(--text-secondary, #778195);
    font-size: 12px;
    font-weight: 400;
}

/* 2. Header mode selector */
.wa-header-mode-field {
    padding: 18px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 12px;
    background: var(--surface-secondary, #f8fafc);
}

.wa-header-mode-field select {
    width: 100%;
    min-height: 46px;
}

.wa-header-mode-field > small {
    display: block;
    margin-top: 9px;
    color: var(--text-secondary, #778195);
    font-size: 12px;
    line-height: 1.65;
}

/* 3. Text header field */
#templateHeaderTextGroup {
    padding: 18px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 12px;
    background: var(--surface-primary, #ffffff);
}

#templateHeaderTextGroup input[type="text"] {
    width: 100%;
    min-height: 46px;
    padding: 11px 13px;
    border: 1px solid var(--input-border, #d7deea);
    border-radius: 9px;
    outline: none;
    background: var(--input-background, #ffffff);
    color: var(--text-primary, #172033);
    font: inherit;
    font-size: 14px;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#templateHeaderTextGroup input[type="text"]:focus {
    border-color: var(--primary-color, #2563eb);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 10%);
}

#templateHeaderTextGroup input::placeholder {
    color: #9aa4b5;
}

.wa-field-meta {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: 9px;
}

.wa-field-meta small {
    flex: 1 1 220px;
    min-width: 0;
    color: var(--text-secondary, #778195);
    font-size: 12px;
    line-height: 1.65;
}

#templateHeaderCounter,
#templateBodyCounter,
#templateFooterCounter,
#templateVariableCount {
    flex-shrink: 0;
    color: var(--text-secondary, #778195);
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* 4. Media header field */
#templateMediaHeaderGroup {
    padding: 18px;
    border: 1px solid #c9d9ff;
    border-radius: 12px;
    background: #f8faff;
}

/* Preserve the existing JS-controlled hidden state */
#templateMediaHeaderGroup.hidden,
#templateHeaderTextGroup.hidden,
#templateHeaderModeSummary.hidden {
    display: none !important;
}

#templateMediaHeaderType {
    width: 100%;
    min-height: 46px;
}

#templateMediaHeaderGroup label[for="templateHeaderMediaFile"] {
    margin-top: 16px !important;
}

/* Media file input */
#templateHeaderMediaFile {
    display: block;
    width: 100%;
    min-height: 48px;
    padding: 8px;
    border: 1px dashed #aab8ce;
    border-radius: 10px;
    background: #ffffff;
    color: var(--text-primary, #172033);
    font: inherit;
    font-size: 13px;
    box-sizing: border-box;
}

#templateHeaderMediaFile::file-selector-button {
    margin-right: 10px;
    padding: 9px 12px;
    border: 0;
    border-radius: 7px;
    background: #e8efff;
    color: #244db8;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

#templateHeaderMediaFile::file-selector-button:hover {
    background: #dce7ff;
}

/* 5. Media requirements panel */
.wa-media-details {
    margin-top: 14px;
    padding: 14px;
    border: 1px solid #dbe5f3;
    border-radius: 10px;
    background: #ffffff;
}

.wa-media-details > strong {
    display: block;
    margin-bottom: 9px;
    color: var(--text-primary, #172033);
    font-size: 13px;
    font-weight: 700;
}

#templateHeaderMediaRules {
    margin: 0;
    padding-left: 20px;
    color: var(--text-secondary, #5f6b7e);
    font-size: 12px;
    line-height: 1.8;
}

#templateHeaderMediaRules li {
    padding-left: 3px;
}

.wa-media-details > p {
    margin: 12px 0 0;
    padding-top: 11px;
    border-top: 1px solid #edf0f5;
    color: var(--text-secondary, #778195);
    font-size: 12px;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

/* 6. Header mode summary */
#templateHeaderModeSummary {
    margin: 0 0 22px;
    padding: 15px 17px;
    border: 1px solid #bce8d0;
    border-radius: 11px;
    background: #f1fbf5;
}

#templateHeaderModeSummary > strong {
    display: block;
    margin-bottom: 5px;
    color: #176b42;
    font-size: 13px;
    font-weight: 700;
}

#templateHeaderModeSummary > p {
    margin: 0;
    color: #47735c;
    font-size: 12px;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

/* 7. Body text field */
.wa-body-field {
    padding: 18px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 12px;
    background: var(--surface-primary, #ffffff);
}

.wa-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.wa-label-row label {
    margin-bottom: 0 !important;
}

.wa-format-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 10px;
    padding: 8px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    background: var(--surface-secondary, #f8fafc);
}

.wa-format-toolbar button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
    padding: 7px 10px;
    border: 1px solid #dce3ed;
    border-radius: 7px;
    background: #ffffff;
    color: #344054;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.wa-format-toolbar button:hover {
    border-color: var(--primary-color, #2563eb);
    background: #eff5ff;
}

.wa-format-toolbar .wa-insert-variable {
    gap: 5px;
    padding-inline: 12px;
    color: var(--primary-color, #2563eb);
    font-size: 12px;
}

#templateBody {
    display: block;
    width: 100%;
    min-height: 170px;
    padding: 13px;
    border: 1px solid var(--input-border, #d7deea);
    border-radius: 9px;
    outline: none;
    background: var(--input-background, #ffffff);
    color: var(--text-primary, #172033);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.75;
    resize: vertical;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#templateBody:focus {
    border-color: var(--primary-color, #2563eb);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 10%);
}

#templateBody::placeholder {
    color: #9aa4b5;
}

/* 8. Dynamic variable examples generated by templates.js */
.wa-variable-examples {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    margin-top: 14px;
}

.wa-variable-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
    padding: 13px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    background: var(--surface-secondary, #f8fafc);
}

.wa-variable-token {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-width: 48px;
    min-height: 34px;
    padding: 5px 8px;
    border: 1px solid #cbd9ff;
    border-radius: 7px;
    background: #edf3ff;
    color: #244db8;
    font-size: 12px;
    font-weight: 700;
}

.wa-variable-input-wrap {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

.wa-variable-input-wrap > span {
    color: var(--text-secondary, #778195);
    font-size: 12px;
    font-weight: 600;
}

.wa-variable-input-wrap input {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--input-border, #d7deea);
    border-radius: 8px;
    outline: none;
    background: #ffffff;
    color: var(--text-primary, #172033);
    font: inherit;
    font-size: 13px;
    box-sizing: border-box;
}

.wa-variable-input-wrap input:focus {
    border-color: var(--primary-color, #2563eb);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 10%);
}

.wa-empty-hint {
    margin: 0;
    padding: 12px;
    border: 1px dashed var(--border-color, #d7deea);
    border-radius: 9px;
    color: var(--text-secondary, #778195);
    font-size: 12px;
    line-height: 1.7;
}

/* 9. Shared select and input styling */
.wa-builder-section .form-field input:not([type="file"]),
.wa-builder-section .form-field select {
    max-width: 100%;
    box-sizing: border-box;
}

.wa-builder-section .form-field select {
    padding: 11px 12px;
    border: 1px solid var(--input-border, #d7deea);
    border-radius: 9px;
    outline: none;
    background-color: #ffffff;
    color: var(--text-primary, #172033);
    font-family: inherit;
    font-size: 14px;
}

.wa-builder-section .form-field select:focus {
    border-color: var(--primary-color, #2563eb);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 10%);
}

/* 10. Tablet and mobile */
@media (max-width: 768px) {
    .wa-builder-section .form-field {
        margin-bottom: 16px;
    }

    .wa-header-mode-field,
    #templateHeaderTextGroup,
    #templateMediaHeaderGroup,
    .wa-body-field {
        padding: 14px;
        border-radius: 10px;
    }

    .wa-header-mode-field > small,
    .wa-field-meta small,
    .wa-media-details > p {
        font-size: 12px;
    }

    .wa-field-meta {
        gap: 7px;
    }

    .wa-field-meta small {
        flex-basis: 100%;
    }

    #templateHeaderCounter,
    #templateBodyCounter,
    #templateFooterCounter,
    #templateVariableCount {
        margin-left: auto;
    }

    #templateHeaderMediaFile {
        font-size: 12px;
    }

    #templateBody {
        min-height: 155px;
        font-size: 14px;
    }

    .wa-format-toolbar {
        gap: 6px;
        padding: 7px;
    }

    .wa-format-toolbar button {
        min-height: 36px;
    }

    #templateHeaderModeSummary {
        margin-bottom: 16px;
        padding: 13px;
    }
}

/* 11. Small mobile screens */
@media (max-width: 480px) {
    .wa-builder-section .form-field label {
        font-size: 13px;
    }

    .wa-optional {
        font-size: 11px;
    }

    .wa-header-mode-field,
    #templateHeaderTextGroup,
    #templateMediaHeaderGroup,
    .wa-body-field {
        padding: 12px;
    }

    #templateHeaderTextGroup input[type="text"],
    #templateMediaHeaderType,
    .wa-header-mode-field select {
        min-height: 44px;
        font-size: 13px;
    }

    #templateHeaderMediaFile {
        padding: 7px;
    }

    #templateHeaderMediaFile::file-selector-button {
        margin-bottom: 5px;
        padding: 8px;
        font-size: 11px;
    }

    .wa-media-details {
        padding: 11px;
    }

    .wa-label-row {
        align-items: flex-start;
    }

    .wa-format-toolbar {
        gap: 5px;
    }

    .wa-format-toolbar button {
        min-width: 34px;
        min-height: 34px;
        padding: 6px 9px;
    }

    .wa-format-toolbar .wa-insert-variable {
        flex: 1 1 auto;
    }

    #templateBody {
        min-height: 145px;
        padding: 11px;
        font-size: 13px;
    }

    .wa-variable-row {
        gap: 9px;
        padding: 10px;
    }

    .wa-variable-token {
        min-width: 42px;
        font-size: 11px;
    }
}

/* 12. Extra-small phones */
@media (max-width: 360px) {
    .wa-optional {
        width: 100%;
    }

    .wa-format-toolbar button {
        min-width: 32px;
        padding: 6px 8px;
    }

    .wa-format-toolbar .wa-insert-variable {
        flex-basis: 100%;
    }

    .wa-variable-row {
        flex-direction: column;
    }

    .wa-variable-token {
        align-self: flex-start;
    }
}


.templates-main-panel {
    min-width: 0;
}


/* Desktop table wrapper */
.templates-table-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #ffffff;
}

.templates-table-wrapper.hidden,
.mobile-templates-container.hidden,
.templates-pagination.hidden {
    display: none !important;
}

.templates-table {
    width: 100%;
    min-width: 760px;
    border-collapse: separate;
    border-spacing: 0;
    text-align: left;
}

.templates-table thead {
    background: #f8fafc;
}

.templates-table th {
    padding: 15px 16px;
    border-bottom: 1px solid #e5e7eb;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.045em;
    text-transform: uppercase;
    white-space: nowrap;
}

.templates-table td {
    padding: 16px;
    border-bottom: 1px solid #eef2f7;
    color: #334155;
    font-size: 14px;
    vertical-align: middle;
}

.templates-table tbody tr:last-child td {
    border-bottom: none;
}

.templates-table tbody tr {
    transition: background-color 0.18s ease;
}

.templates-table tbody tr:hover {
    background: #f8fafc;
}

.templates-table td:first-child {
    color: #111827;
    font-weight: 600;
}

.templates-table td:last-child {
    white-space: nowrap;
}

/* Action buttons generated by templates.js */
.templates-table td button,
.mobile-template-card button {
    min-height: 34px;
    margin: 2px 4px 2px 0;
    padding: 7px 11px;
    border: 1px solid #dbe2ea;
    border-radius: 8px;
    background: #ffffff;
    color: #334155;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition:
        background-color 0.18s ease,
        border-color 0.18s ease,
        color 0.18s ease;
}

.templates-table td button:hover,
.mobile-template-card button:hover {
    border-color: #a5b4fc;
    background: #eef2ff;
    color: #3730a3;
}

.templates-table button:focus-visible,
.mobile-template-card button:focus-visible,
.pagination-button:focus-visible {
    outline: 3px solid rgba(79, 70, 229, 0.25);
    outline-offset: 2px;
}

/* Status badge compatibility */
.templates-table .template-status,
.mobile-template-card .template-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    padding: 5px 9px;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #f8fafc;
    color: #475569;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

/* Mobile card container */
.mobile-templates-container {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    width: 100%;
    min-width: 0;
}

/* Compatible with common card class names */
.mobile-template-card,
.mobile-templates-container .template-card {
    min-width: 0;
    padding: 18px;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.035);
    overflow-wrap: anywhere;
}

.mobile-template-card h3,
.mobile-templates-container .template-card h3 {
    margin: 0 0 8px;
    color: #111827;
    font-size: 15px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.mobile-template-card p,
.mobile-templates-container .template-card p {
    margin: 6px 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.6;
}

.mobile-template-card .template-card-actions,
.mobile-templates-container .template-card .template-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 14px;
}

/* Pagination */
.templates-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    width: 100%;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid #e5e7eb;
}

#templatesPaginationInfo {
    color: #64748b;
    font-size: 13px;
    line-height: 1.6;
}

.pagination-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.pagination-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 13px;
    border: 1px solid #dbe2ea;
    border-radius: 9px;
    background: #ffffff;
    color: #334155;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
}

.pagination-button:hover:not(:disabled) {
    border-color: #a5b4fc;
    background: #eef2ff;
    color: #3730a3;
}

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

.pagination-current {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #c7d2fe;
    border-radius: 9px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 13px;
    font-weight: 700;
}

/* Tablet */
@media (max-width: 900px) {
    .mobile-templates-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .templates-pagination {
        align-items: flex-start;
    }
}

/* Mobile */
@media (max-width: 600px) {
    .templates-table-wrapper {
        border: 0;
        border-radius: 0;
        background: transparent;
    }

    .templates-table {
        min-width: 720px;
    }

    .mobile-templates-container {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }

    .mobile-template-card,
    .mobile-templates-container .template-card {
        padding: 15px;
        border-radius: 12px;
    }

    .templates-pagination {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-top: 16px;
        padding-top: 15px;
    }

    .pagination-buttons {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 36px minmax(0, 1fr);
        gap: 8px;
        width: 100%;
    }

    .pagination-button {
        width: 100%;
        min-width: 0;
        padding: 8px 6px;
        font-size: 12px;
    }

    .pagination-current {
        width: 36px;
        min-width: 36px;
        box-sizing: border-box;
    }
}

/* =====================================================
   CREATE / EDIT TEMPLATE BUILDER MODAL
===================================================== */

.wa-builder-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
    overflow-x: hidden;
    overflow-y: auto;
    background: rgba(13, 25, 16, 0.58);
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.wa-builder-modal {
    position: relative;
    width: 100%;
    max-width: 1200px;
    min-width: 0;
    max-height: calc(100vh - 44px);
    max-height: calc(100dvh - 44px);
    margin: auto;
    overflow-x: hidden;
    overflow-y: auto;
    border: 1px solid #e5ebe3;
    border-radius: 18px;
    background: #f7f9f6;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.2);
    overscroll-behavior: contain;
}

.wa-builder-topbar {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 25px 28px;
    border-bottom: 1px solid #e7ece5;
    background: #ffffff;
}

.wa-builder-topbar>div {
    flex: 1 1 auto;
    min-width: 0;
}

.wa-builder-eyebrow {
    display: inline-block;
    color: #679d3d;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.2px;
    line-height: 1.5;
}

.wa-builder-topbar h2 {
    margin: 9px 0 0;
    color: #17221a;
    font-size: 25px;
    font-weight: 800;
    line-height: 1.3;
}

.wa-builder-topbar p {
    margin: 8px 0 0;
    color: #768076;
    font-size: 13px;
    line-height: 1.7;
}

.wa-builder-topbar .user-modal-close {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    border: 1px solid #e2e8e0;
    border-radius: 10px;
    background: #ffffff;
    color: #384438;
    font-size: 24px;
}

.wa-builder-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
    align-items: start;
    gap: 22px;
    width: 100%;
    min-width: 0;
    padding: 24px;
    margin: 0;
}

.wa-builder-editor,
.wa-builder-preview-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
    width: 100%;
}

.wa-builder-section {
    width: 100%;
    min-width: 0;
    padding: 22px;
    border: 1px solid #e5ebe2;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 3px 10px rgba(20, 40, 20, 0.025);
}

.wa-section-title {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
    margin-bottom: 21px;
}

.wa-section-title>div {
    flex: 1 1 auto;
    min-width: 0;
}

.wa-step {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: #edf6e7;
    color: #5b9634;
    font-size: 13px;
    font-weight: 800;
}

.wa-section-title h3 {
    margin: 0;
    color: #243026;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.45;
}

.wa-section-title p {
    margin: 5px 0 0;
    color: #7a857a;
    font-size: 11px;
    line-height: 1.6;
}

.wa-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 17px;
    width: 100%;
    min-width: 0;
}

.form-field {
    width: 100%;
    min-width: 0;
    margin: 0 0 18px;
}

.wa-form-grid .form-field {
    margin-bottom: 0;
}

.form-field label {
    display: block;
    margin-bottom: 8px;
    color: #344136;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.form-field label>span:not(.wa-optional) {
    color: #d64a4a;
}

.wa-optional {
    color: #8a948a;
    font-size: 10px;
    font-weight: 500;
}

.form-field input,
.form-field select,
.form-field textarea {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 11px 12px;
    border: 1px solid #dfe7dd;
    border-radius: 9px;
    background: #ffffff;
    color: #29352b;
    font-size: 13px;
    line-height: 1.5;
}

.form-field input::placeholder,
.form-field textarea::placeholder {
    color: #a2aba1;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    border-color: #7cb947;
    outline: none;
    box-shadow: 0 0 0 3px rgba(124, 185, 71, 0.12);
}

.form-field textarea {
    min-height: 160px;
    resize: vertical;
    line-height: 1.7;
}

.form-field small {
    display: block;
    margin-top: 7px;
    color: #849084;
    font-size: 10px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.wa-field-meta,
.wa-label-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    color: #839083;
    font-size: 10px;
    line-height: 1.6;
}

.wa-field-meta small {
    flex: 1 1 150px;
    min-width: 0;
    margin: 0;
}

.wa-label-row {
    margin-top: 0;
    margin-bottom: 8px;
}

.wa-label-row label {
    margin: 0;
}

.wa-body-field {
    margin-top: 19px;
}

/* Formatting toolbar */

.wa-format-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    width: 100%;
    min-width: 0;
    padding: 9px;
    border: 1px solid #e5ebe3;
    border-bottom: none;
    border-radius: 9px 9px 0 0;
    background: #f8faf7;
}

.wa-format-toolbar button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 35px;
    min-height: 34px;
    padding: 7px 10px;
    border: 1px solid #e0e7dd;
    border-radius: 7px;
    background: #ffffff;
    color: #344236;
    font-size: 12px;
    font-weight: 700;
}

.wa-format-toolbar button:hover {
    background: #eff6e9;
}

.wa-format-toolbar .wa-insert-variable {
    flex: 0 1 auto;
    min-width: 0;
    margin-left: auto;
    color: #578c34;
}

.wa-body-field textarea {
    border-radius: 0 0 9px 9px;
}

.wa-variable-examples {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    min-width: 0;
    margin-top: 13px;
}

.wa-variable-examples:empty {
    display: none;
}

.wa-variable-examples>* {
    max-width: 100%;
    min-width: 0;
}

/* Buttons builder */

.wa-section-title>.wa-small-button {
    flex: 0 0 auto;
}

.wa-small-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 8px 12px;
    border: 1px solid #dce9d5;
    border-radius: 8px;
    background: #f1f8ec;
    color: #578c34;
    font-size: 11px;
    font-weight: 800;
}

.wa-small-button:hover {
    background: #e6f3dd;
}

.wa-buttons-builder {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    min-width: 0;
}

.wa-buttons-builder>* {
    max-width: 100%;
    min-width: 0;
}

.wa-buttons-builder input,
.wa-buttons-builder select,
.wa-buttons-builder textarea {
    max-width: 100%;
    min-width: 0;
}

.wa-help-note {
    margin: 14px 0 0;
    color: #879187;
    font-size: 11px;
    line-height: 1.7;
}

.form-message {
    width: 100%;
    min-width: 0;
    padding: 12px 14px;
    border-radius: 9px;
    font-size: 12px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

/* Builder footer */

.wa-builder-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 11px;
    flex-wrap: wrap;
    width: 100%;
    min-width: 0;
}

.wa-builder-footer button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 43px;
    max-width: 100%;
    padding: 11px 18px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.4;
}

.wa-builder-footer .secondary-button {
    border-color: #dfe7dd;
    background: #ffffff;
    color: #384638;
}

.wa-builder-footer .primary-button {
    background: #7cb947;
    color: #ffffff;
}

.wa-builder-footer .primary-button:hover {
    background: #659e38;
}

/* ================= LIVE PREVIEW ================= */

.wa-preview-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-width: 0;
}

.wa-preview-heading>div {
    min-width: 0;
}

.wa-preview-heading h3 {
    margin: 0;
    color: #233027;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.4;
}

.wa-preview-heading p {
    margin: 6px 0 0;
    color: #7c877c;
    font-size: 11px;
    line-height: 1.7;
}

.wa-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    padding: 6px 9px;
    border: 1px solid #d9edce;
    border-radius: 20px;
    background: #eff8e9;
    color: #568b34;
    font-size: 10px;
    font-weight: 800;
}

.wa-live-badge i {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #7cb947;
}

.wa-phone-frame {
    width: 100%;
    max-width: 330px;
    min-width: 0;
    margin: 0 auto;
    padding: 8px;
    border: 2px solid #dce2dc;
    border-radius: 27px;
    background: #ffffff;
    box-shadow: 0 10px 30px rgba(20, 40, 20, 0.08);
}

.wa-phone-top {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 13px 10px;
    border-radius: 18px 18px 0 0;
    background: #f7faf5;
    color: #314033;
    font-size: 12px;
    font-weight: 800;
}

.wa-phone-camera {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #c5cec3;
}

.wa-phone-dots {
    margin-left: auto;
    font-size: 17px;
}

.wa-chat-wallpaper {
    width: 100%;
    min-width: 0;
    min-height: 250px;
    padding: 15px 10px;
    border-top: 1px solid #e9eee6;
    background-color: #edf2e9;
    background-image: radial-gradient(#dbe5d5 0.6px, transparent 0.6px);
    background-size: 12px 12px;
}

.wa-chat-day {
    width: fit-content;
    margin: 0 auto 15px;
    padding: 5px 10px;
    border-radius: 8px;
    background: #ffffff;
    color: #7b8679;
    font-size: 9px;
    font-weight: 800;
}

.wa-message-bubble {
    width: fit-content;
    max-width: 94%;
    min-width: 0;
    margin-right: auto;
    padding: 12px;
    border: 1px solid #e0e8dc;
    border-radius: 3px 12px 12px 12px;
    background: #ffffff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.035);
    overflow-wrap: anywhere;
    word-break: break-word;
}

.wa-preview-header {
    margin-bottom: 7px;
    color: #243427;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.wa-preview-body {
    color: #364237;
    font-size: 12px;
    line-height: 1.7;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.wa-preview-footer {
    margin-top: 9px;
    color: #869085;
    font-size: 10px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.wa-preview-time {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    margin-top: 8px;
    color: #8b9589;
    font-size: 9px;
}

.wa-preview-time span {
    color: #39a4cf;
    font-weight: 800;
}

.wa-preview-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    min-width: 0;
    margin-top: 8px;
}

.wa-preview-buttons>* {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 34px;
    padding: 8px;
    border: 1px solid #dce7d8;
    border-radius: 9px;
    background: #ffffff;
    color: #3787a6;
    font-size: 11px;
    text-align: center;
    overflow-wrap: anywhere;
}

.wa-phone-composer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-width: 0;
    padding: 11px 8px;
    border-radius: 0 0 18px 18px;
    background: #f7faf5;
    color: #8b9689;
    font-size: 11px;
}

.wa-preview-note,
.wa-validation-card {
    width: 100%;
    min-width: 0;
    padding: 16px;
    border: 1px solid #e4ebe1;
    border-radius: 12px;
    background: #ffffff;
    overflow-wrap: anywhere;
}

.wa-preview-note strong,
.wa-validation-card h4 {
    display: block;
    margin: 0;
    color: #344136;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.5;
}

.wa-preview-note p {
    margin: 8px 0 0;
    color: #7c877c;
    font-size: 11px;
    line-height: 1.7;
}

.wa-validation-card ul {
    display: flex;
    flex-direction: column;
    gap: 11px;
    margin: 13px 0 0;
    padding-left: 18px;
}

.wa-validation-card li {
    color: #7c877c;
    font-size: 11px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.wa-validation-card li.is-pending {
    color: #9a7a38;
}

.wa-validation-card li.is-complete {
    color: #3f8a4f;
}

/* =====================================================
   TEMPLATE DETAILS MODAL
===================================================== */

#templateDetailsModal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
    overflow-x: hidden;
    overflow-y: auto;
    background: rgba(13, 25, 16, 0.58);
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.template-details-modal {
    width: 100%;
    max-width: 720px;
    min-width: 0;
    max-height: calc(100vh - 44px);
    max-height: calc(100dvh - 44px);
    margin: auto;
    overflow-x: hidden;
    overflow-y: auto;
    border: 1px solid #e4eae2;
    border-radius: 16px;
    background: #ffffff;
}

.template-details-modal .user-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
    padding: 23px 24px;
    border-bottom: 1px solid #e9eee7;
}

.template-details-modal .user-modal-header>div {
    min-width: 0;
}

.modal-eyebrow {
    display: inline-block;
    color: #6b9d43;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
}

.template-details-modal .user-modal-header h2 {
    margin: 8px 0 0;
    color: #263329;
    font-size: 23px;
    line-height: 1.35;
}

.template-details-modal .user-modal-header p {
    margin: 7px 0 0;
    color: #7a857a;
    font-size: 12px;
    line-height: 1.6;
}

.template-details-modal .user-modal-close {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border: 1px solid #e0e7dd;
    border-radius: 9px;
    background: #ffffff;
    color: #465146;
    font-size: 23px;
}

.template-details-loading,
.template-details-content {
    width: 100%;
    min-width: 0;
    padding: 24px;
    color: #526052;
    font-size: 13px;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.template-details-content>* {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.template-details-content table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
}

.template-details-content pre {
    max-width: 100%;
    overflow-x: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.template-details-modal .user-modal-footer,
#templateDetailsActions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
    padding: 17px 24px;
    border-top: 1px solid #e9eee7;
}

#templateDetailsActions button {
    min-height: 40px;
    padding: 10px 14px;
    border: 1px solid #dfe7dc;
    border-radius: 9px;
    background: #ffffff;
    color: #384638;
    font-size: 12px;
    font-weight: 700;
}

#templateDetailsActions #closeTemplateDetailsFooter {
    border-color: #7cb947;
    background: #7cb947;
    color: #ffffff;
}


/* Template builder: Buttons & Actions */
.wa-buttons-section {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.wa-buttons-section .wa-section-title {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.wa-buttons-section .wa-section-heading {
    flex: 1;
    min-width: 180px;
}

.wa-buttons-section .wa-section-heading h3 {
    margin: 0 0 5px;
}

.wa-buttons-section .wa-section-heading p {
    margin: 0;
    line-height: 1.5;
}

.wa-button-type-guide {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.wa-button-guide-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    padding: 14px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #f9fafb;
}

.wa-button-guide-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: #e8efff;
    color: #3157b7;
    font-size: 18px;
}

.wa-button-guide-item strong,
.wa-button-guide-item small {
    display: block;
}

.wa-button-guide-item strong {
    margin: 2px 0 5px;
    color: #111827;
    font-size: 13px;
}

.wa-button-guide-item small {
    color: #6b7280;
    font-size: 12px;
    line-height: 1.45;
}

.wa-button-builder-footer {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding-top: 14px;
    border-top: 1px solid #e5e7eb;
}

.wa-button-limit-counter {
    margin: 0;
    color: #374151;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.6;
}

.wa-button-builder-footer .wa-help-note {
    margin: 0;
    color: #6b7280;
    font-size: 12px;
    line-height: 1.6;
}

.wa-buttons-builder {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.wa-buttons-builder .wa-button-row {
    min-width: 0;
    padding: 18px;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.035);
}

.wa-buttons-builder .wa-button-row-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.wa-buttons-builder .wa-button-row-head strong {
    color: #111827;
    font-size: 14px;
}

.wa-buttons-builder .wa-button-row-head .wa-remove-button {
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 7px 11px;
    background: #fff;
    color: #b91c1c;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.wa-buttons-builder .wa-button-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.wa-buttons-builder .wa-button-extra {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.wa-buttons-builder .wa-button-extra label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
    color: #374151;
    font-size: 13px;
    font-weight: 600;
}

.wa-buttons-builder .wa-button-extra input,
.wa-buttons-builder .wa-button-grid input,
.wa-buttons-builder .wa-button-grid select {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 9px;
    background: #fff;
    color: #111827;
    font: inherit;
    font-size: 14px;
}

.wa-buttons-builder .wa-button-extra small {
    grid-column: 1 / -1;
    color: #6b7280;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.6;
}

.wa-buttons-builder input:focus,
.wa-buttons-builder select:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}


@media (max-width: 640px) {
    #templatesTableWrapper{display:none;}
    .wa-buttons-section .wa-section-title {
        align-items: flex-start;
    }

    .wa-buttons-section #addTemplateButton {
        width: 100%;
        justify-content: center;
    }

    .wa-button-type-guide {
        grid-template-columns: 1fr;
    }

    .wa-buttons-builder .wa-button-grid,
    .wa-buttons-builder .wa-button-extra {
        grid-template-columns: 1fr;
    }

    .wa-buttons-builder .wa-button-row {
        padding: 14px;
    }
}


/* =====================================================
   TABLET — 768px
===================================================== */

@media screen and (max-width: 768px) {
    #templatesTableWrapper{display:none;}

    .templates-page {
        padding: 22px 18px;
    }

    .templates-page-header {
        align-items: flex-start;
        gap: 16px;
    }

    .templates-page-header h1 {
        font-size: 29px;
    }

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

    .templates-summary-card {
        padding: 17px;
    }

    .templates-toolbar {
        gap: 10px;
        padding-right: 18px;
        padding-left: 18px;
    }

    .templates-panel-header {
        padding-right: 18px;
        padding-left: 18px;
    }

    .wa-builder-overlay {
        align-items: flex-start;
        padding: 14px;
    }

    .wa-builder-modal {
        max-width: 650px;
        max-height: none;
        margin: 0 auto;
    }

    .wa-builder-layout {
        display: flex;
        flex-direction: column;
        gap: 20px;
        padding: 18px;
    }

    .wa-builder-editor,
    .wa-builder-preview-column {
        width: 100%;
    }

    .wa-phone-frame {
        max-width: 330px;
    }

    #templateDetailsModal {
        align-items: flex-start;
        padding: 14px;
    }

    .template-details-modal {
        max-height: none;
        margin: 0 auto;
    }
}

/* =====================================================
   MOBILE — 480px
===================================================== */

@media screen and (max-width: 480px) {
    #templatesTableWrapper{display:none;}

    .templates-page {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        padding: 18px 14px 26px;
    }

    /* Page title and create button */

    .templates-page-header {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        margin-bottom: 21px;
    }

    .templates-page-header>div {
        width: 100%;
        min-width: 0;
    }

    .templates-eyebrow {
        margin-bottom: 7px;
        font-size: 10px;
    }

    .templates-page-header h1 {
        font-size: 27px;
        letter-spacing: -0.5px;
    }

    .templates-page-header p {
        margin-top: 8px;
        font-size: 13px;
        line-height: 1.65;
    }

    .templates-page-header>.primary-button {
        align-self: flex-start;
        width: auto;
        max-width: 100%;
        min-height: 42px;
        padding: 10px 15px;
        white-space: normal;
    }

    /* Summary cards */

    .templates-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
        margin-bottom: 19px;
    }

    .templates-summary-card {
        gap: 9px;
        min-height: 88px;
        padding: 12px 10px;
        border-radius: 11px;
    }

    .templates-summary-icon {
        flex-basis: 32px;
        width: 32px;
        height: 32px;
        border-radius: 9px;
        font-size: 14px;
    }

    .templates-summary-card span {
        font-size: 10px;
        line-height: 1.5;
    }

    .templates-summary-card strong {
        margin-top: 4px;
        font-size: 22px;
    }

    /* Main panel */

    .templates-main-panel {
        margin-top: 0;
        border-radius: 12px;
    }

    .templates-panel-header {
        padding: 17px 13px 14px;
    }

    .templates-panel-header h3 {
        font-size: 16px;
    }

    .templates-panel-header p {
        font-size: 11px;
    }

    /* Search and filter */

    .templates-toolbar {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 0 13px 15px;
    }

    .templates-search,
    .templates-filter {
        flex: none;
        width: 100%;
        min-width: 0;
    }

    .templates-search input,
    .templates-filter select {
        width: 100%;
        min-width: 0;
        height: 43px;
        font-size: 12px;
    }

    .templates-toolbar>.secondary-button {
        align-self: flex-start;
        width: auto;
        min-width: 80px;
        min-height: 38px;
        padding: 9px 14px;
    }

    /* Loading and empty states */

    .templates-loading-state {
        min-height: 160px;
        padding: 24px 12px;
    }

    .templates-empty-state {
        min-height: 190px;
        padding: 25px 14px;
    }

    .templates-empty-state h3 {
        font-size: 16px;
    }

    .templates-empty-state p {
        font-size: 12px;
    }

    /* Table stays horizontally scrollable */

    .templates-table-wrapper {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
    }

    .templates-table {
        width: 740px;
        min-width: 740px;
    }

    .templates-table th,
    .templates-table td {
        padding: 12px;
        font-size: 12px;
    }

    /* Mobile cards */

    .mobile-templates-container {
        gap: 10px;
        padding: 0 11px 14px;
    }

    .mobile-templates-container>* {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    /* Pagination */

    .templates-pagination {
        flex-direction: column;
        align-items: stretch;
        gap: 11px;
        padding: 14px 11px;
    }

    .templates-pagination>div:first-child {
        text-align: center;
        font-size: 11px;
    }

    .pagination-buttons {
        justify-content: center;
        gap: 7px;
    }

    .pagination-button {
        min-height: 36px;
        padding: 8px 10px;
        font-size: 11px;
    }

    /* Builder modal */

    .wa-builder-overlay {
        align-items: flex-start;
        padding: 8px;
    }

    .wa-builder-modal {
        width: 100%;
        max-width: 100%;
        max-height: none;
        margin: 0 auto;
        border-radius: 13px;
    }

    .wa-builder-topbar {
        gap: 9px;
        padding: 16px 13px;
    }

    .wa-builder-eyebrow {
        font-size: 9px;
        letter-spacing: 0.5px;
    }

    .wa-builder-topbar h2 {
        font-size: 20px;
    }

    .wa-builder-topbar p {
        font-size: 12px;
    }

    .wa-builder-topbar .user-modal-close {
        flex-basis: 33px;
        width: 33px;
        height: 33px;
        min-width: 33px;
    }

    .wa-builder-layout {
        gap: 14px;
        padding: 12px;
    }

    .wa-builder-editor,
    .wa-builder-preview-column {
        gap: 13px;
    }

    .wa-builder-section {
        padding: 14px 12px;
        border-radius: 11px;
    }

    .wa-section-title {
        gap: 9px;
        margin-bottom: 16px;
    }

    .wa-step {
        flex-basis: 28px;
        width: 28px;
        height: 28px;
        border-radius: 8px;
        font-size: 12px;
    }

    .wa-section-title h3 {
        font-size: 14px;
    }

    .wa-section-title p {
        font-size: 10px;
    }

    .wa-form-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }

    .form-field {
        margin-bottom: 14px;
    }

    .wa-form-grid .form-field {
        margin-bottom: 0;
    }

    .form-field label {
        font-size: 11px;
    }

    .form-field input,
    .form-field select,
    .form-field textarea {
        min-height: 43px;
        padding: 10px;
        font-size: 13px;
    }

    .form-field textarea {
        min-height: 145px;
    }

    .form-field small {
        font-size: 10px;
    }

    .wa-field-meta,
    .wa-label-row {
        gap: 6px;
        font-size: 10px;
    }

    .wa-format-toolbar {
        gap: 6px;
        padding: 7px;
    }

    .wa-format-toolbar button {
        min-width: 32px;
        min-height: 32px;
        padding: 6px 9px;
        font-size: 11px;
    }

    .wa-format-toolbar .wa-insert-variable {
        flex: 1 1 115px;
        margin-left: 0;
    }

    .wa-section-title>.wa-small-button {
        min-height: 34px;
        padding: 7px 9px;
        font-size: 10px;
    }

    .wa-help-note {
        font-size: 10px;
    }

    .wa-builder-footer {
        flex-direction: column-reverse;
        align-items: stretch;
        gap: 8px;
    }

    .wa-builder-footer button {
        width: 100%;
        min-height: 43px;
        padding: 10px 13px;
    }

    /* Preview */

    .wa-preview-heading h3 {
        font-size: 15px;
    }

    .wa-preview-heading p {
        font-size: 10px;
    }

    .wa-phone-frame {
        width: 100%;
        max-width: 300px;
        padding: 6px;
        border-radius: 23px;
    }

    .wa-phone-top {
        padding: 11px 9px;
    }

    .wa-chat-wallpaper {
        min-height: 220px;
        padding: 12px 8px;
    }

    .wa-message-bubble {
        max-width: 96%;
        padding: 10px;
    }

    .wa-preview-header {
        font-size: 12px;
    }

    .wa-preview-body {
        font-size: 11px;
        line-height: 1.65;
    }

    .wa-preview-footer {
        font-size: 10px;
    }

    .wa-phone-composer {
        gap: 5px;
        padding: 10px 7px;
        font-size: 10px;
    }

    .wa-preview-note,
    .wa-validation-card {
        padding: 12px;
    }

    .wa-preview-note strong,
    .wa-validation-card h4 {
        font-size: 11px;
    }

    .wa-preview-note p,
    .wa-validation-card li {
        font-size: 10px;
    }

    /* Details modal */

    #templateDetailsModal {
        align-items: flex-start;
        padding: 8px;
    }

    .template-details-modal {
        width: 100%;
        max-width: 100%;
        max-height: none;
        margin: 0 auto;
        border-radius: 12px;
    }

    .template-details-modal .user-modal-header {
        gap: 9px;
        padding: 16px 13px;
    }

    .template-details-modal .user-modal-header h2 {
        font-size: 19px;
    }

    .template-details-modal .user-modal-header p {
        font-size: 11px;
    }

    .template-details-modal .user-modal-close {
        flex-basis: 33px;
        width: 33px;
        height: 33px;
        min-width: 33px;
    }

    .template-details-loading,
    .template-details-content {
        padding: 15px 13px;
        font-size: 12px;
    }

    .template-details-modal .user-modal-footer,
    #templateDetailsActions {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 13px;
    }

    #templateDetailsActions button {
        width: 100%;
        min-height: 41px;
        padding: 10px;
        font-size: 11px;
    }
}

/* =====================================================
   EXTRA SMALL MOBILE — 360px
===================================================== */

@media screen and (max-width: 360px) {
    #templatesTableWrapper{display:none;}

    .templates-page {
        padding: 15px 10px 22px;
    }

    .templates-page-header h1 {
        font-size: 24px;
    }

    .templates-page-header p {
        font-size: 12px;
    }

    .templates-summary-grid {
        gap: 7px;
    }

    .templates-summary-card {
        gap: 7px;
        min-height: 81px;
        padding: 9px 7px;
    }

    .templates-summary-icon {
        flex-basis: 28px;
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .templates-summary-card span {
        font-size: 9px;
    }

    .templates-summary-card strong {
        font-size: 19px;
    }

    .templates-panel-header {
        padding-right: 11px;
        padding-left: 11px;
    }

    .templates-toolbar {
        padding-right: 11px;
        padding-left: 11px;
    }

    .wa-builder-overlay,
    #templateDetailsModal {
        padding: 5px;
    }

    .wa-builder-topbar {
        padding: 13px 10px;
    }

    .wa-builder-topbar h2 {
        font-size: 18px;
    }

    .wa-builder-layout {
        padding: 9px;
    }

    .wa-builder-section {
        padding: 11px 9px;
    }

    .wa-section-title {
        flex-wrap: wrap;
    }

    .wa-section-title>.wa-small-button {
        margin-left: 37px;
    }

    .wa-phone-frame {
        max-width: 100%;
    }

    .template-details-modal .user-modal-header h2 {
        font-size: 17px;
    }
}

/* ================= ACCESSIBILITY ================= */

@media (prefers-reduced-motion: reduce) {

    .templates-page *,
    .wa-builder-overlay *,
    #templateDetailsModal * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}




/* =====================================================
   ADTHRIVE MEDIA — TEMPLATES
   COMPLETE MOBILE RESPONSIVE CSS
   Desktop CSS remains unchanged
   Append at the END of existing CSS
===================================================== */

/* ================= MOBILE SAFETY ================= */

@media screen and (max-width: 768px) {

    .templates-page,
    .templates-page *,
    .wa-builder-overlay,
    .wa-builder-overlay *,
    #templateDetailsModal,
    #templateDetailsModal * {
        box-sizing: border-box;
    }

    .templates-page {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        padding: 22px 18px 30px;
        overflow-wrap: anywhere;
    }

    .templates-page img {
        max-width: 100%;
        height: auto;
    }

    .templates-page button,
    .templates-page input,
    .templates-page select,
    .wa-builder-overlay button,
    .wa-builder-overlay input,
    .wa-builder-overlay select,
    .wa-builder-overlay textarea {
        max-width: 100%;
        min-width: 0;
        font: inherit;
    }

    .templates-page .hidden,
    .wa-builder-overlay.hidden,
    #templateDetailsModal.hidden {
        display: none !important;
    }

    /* ================= PAGE HEADER ================= */

    .templates-page-header {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 16px;
        width: 100%;
        min-width: 0;
        margin-bottom: 22px;
    }

    .templates-page-header>div {
        flex: 1 1 240px;
        min-width: 0;
    }

    .templates-page-header h1 {
        font-size: clamp(25px, 4.5vw, 30px);
        line-height: 1.25;
        overflow-wrap: anywhere;
    }

    .templates-page-header p {
        font-size: 13px;
        line-height: 1.65;
    }

    .templates-page-header>.primary-button {
        flex: 0 1 auto;
        width: auto;
        max-width: 100%;
        min-height: 42px;
        padding: 10px 15px;
        white-space: normal;
    }

    /* ================= SUMMARY CARDS ================= */

    .templates-summary-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        width: 100%;
        min-width: 0;
        margin-bottom: 22px;
    }

    .templates-summary-card {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        min-width: 0;
        padding: 15px 12px;
        border-radius: 12px;
    }

    .templates-summary-icon {
        flex: 0 0 36px;
        width: 36px;
        height: 36px;
        font-size: 15px;
    }

    .templates-summary-card>div:last-child {
        flex: 1 1 auto;
        min-width: 0;
    }

    .templates-summary-card span {
        font-size: 11px;
        line-height: 1.45;
        overflow-wrap: anywhere;
    }

    .templates-summary-card strong {
        font-size: 23px;
        line-height: 1.25;
    }

    /* ================= MAIN PANEL ================= */

    .templates-main-panel {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        margin-top: 0;
        overflow: hidden;
        border-radius: 12px;
    }

    .templates-panel-header {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 12px;
        padding: 18px 16px 15px;
    }

    .templates-panel-header>div {
        min-width: 0;
    }

    .templates-panel-header h3 {
        font-size: 17px;
        line-height: 1.4;
    }

    .templates-panel-header p {
        font-size: 12px;
        line-height: 1.6;
        overflow-wrap: anywhere;
    }

    /* ================= TOOLBAR ================= */

    .templates-toolbar {
        display: flex;
        align-items: stretch;
        flex-wrap: wrap;
        gap: 10px;
        width: 100%;
        min-width: 0;
        padding: 0 16px 17px;
    }

    .templates-search {
        position: relative;
        flex: 1 1 100%;
        width: 100%;
        min-width: 0;
    }

    .templates-search-icon {
        position: absolute;
        left: 12px;
        top: 50%;
        transform: translateY(-50%);
        pointer-events: none;
    }

    .templates-search input {
        display: block;
        width: 100%;
        height: 44px;
        padding: 0 12px 0 37px;
        border-radius: 9px;
        font-size: 13px;
    }

    .templates-filter {
        flex: 1 1 150px;
        width: auto;
        min-width: 0;
    }

    .templates-filter select {
        width: 100%;
        height: 44px;
        padding: 0 10px;
        border-radius: 9px;
        font-size: 12px;
    }

    .templates-toolbar>.secondary-button {
        flex: 0 0 auto;
        align-self: stretch;
        min-height: 42px;
        padding: 9px 15px;
        border-radius: 9px;
        font-size: 12px;
    }

    /* ================= TABLE ================= */

    .templates-table-wrapper {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .templates-table {
        width: 740px;
        min-width: 740px;
        border-collapse: collapse;
    }

    .templates-table th,
    .templates-table td {
        padding: 12px;
        font-size: 12px;
        white-space: nowrap;
    }

    /* ================= MOBILE TEMPLATE CARDS ================= */

    .mobile-templates-container {
        display: flex;
        flex-direction: column;
        gap: 12px;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        padding: 0 12px 16px;
    }

    .mobile-templates-container>* {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .mobile-templates-container button {
        max-width: 100%;
        min-height: 36px;
        padding: 8px 11px;
        font-size: 12px;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    /* ================= PAGINATION ================= */

    .templates-pagination {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        width: 100%;
        min-width: 0;
        padding: 15px 12px;
    }

    .templates-pagination>div:first-child {
        text-align: center;
        font-size: 12px;
        line-height: 1.5;
        overflow-wrap: anywhere;
    }

    .pagination-buttons {
        display: flex;
        align-items: center;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }

    .pagination-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 0;
        min-height: 38px;
        padding: 8px 11px;
        border-radius: 8px;
        font-size: 12px;
        white-space: normal;
    }

    .pagination-current {
        min-width: 25px;
        text-align: center;
        font-size: 13px;
    }

    /* ================= BUILDER MODAL ================= */

    .wa-builder-overlay {
        position: fixed;
        inset: 0;
        z-index: 9999;
        display: flex;
        align-items: flex-start;
        justify-content: center;
        width: 100%;
        height: 100%;
        height: 100dvh;
        min-height: 0;
        padding: 12px;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .wa-builder-modal {
        width: 100%;
        max-width: 700px;
        min-width: 0;
        max-height: none;
        height: auto;
        margin: 0 auto;
        overflow: visible;
        border-radius: 14px;
    }

    .wa-builder-topbar {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 12px;
        width: 100%;
        min-width: 0;
        padding: 18px 16px;
    }

    .wa-builder-topbar>div {
        flex: 1 1 auto;
        min-width: 0;
    }

    .wa-builder-topbar h2 {
        font-size: 22px;
        line-height: 1.3;
        overflow-wrap: anywhere;
    }

    .wa-builder-topbar p {
        font-size: 12px;
        line-height: 1.6;
    }

    .wa-builder-topbar .user-modal-close {
        flex: 0 0 34px;
        width: 34px;
        height: 34px;
        min-width: 34px;
        padding: 0;
    }

    .wa-builder-layout {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        width: 100%;
        min-width: 0;
        padding: 14px;
        margin: 0;
    }

    .wa-builder-editor,
    .wa-builder-preview-column {
        display: flex;
        flex-direction: column;
        gap: 14px;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .wa-builder-section {
        width: 100%;
        min-width: 0;
        padding: 16px 13px;
        border-radius: 11px;
    }

    .wa-section-title {
        display: flex;
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 9px;
        width: 100%;
        min-width: 0;
        margin-bottom: 16px;
    }

    .wa-section-title>div {
        flex: 1 1 150px;
        min-width: 0;
    }

    .wa-step {
        flex: 0 0 28px;
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .wa-section-title h3 {
        font-size: 15px;
        line-height: 1.4;
    }

    .wa-section-title p {
        font-size: 11px;
        line-height: 1.5;
    }

    .wa-form-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 13px;
        width: 100%;
        min-width: 0;
    }

    .form-field {
        width: 100%;
        min-width: 0;
        margin-bottom: 15px;
    }

    .wa-form-grid .form-field {
        margin-bottom: 0;
    }

    .form-field label {
        display: block;
        margin-bottom: 7px;
        font-size: 12px;
        line-height: 1.5;
        overflow-wrap: anywhere;
    }

    .form-field input,
    .form-field select,
    .form-field textarea {
        display: block;
        width: 100%;
        min-width: 0;
        min-height: 43px;
        padding: 10px 11px;
        border-radius: 8px;
        font-size: 13px;
    }

    .form-field textarea {
        min-height: 145px;
        line-height: 1.6;
        resize: vertical;
    }

    .form-field small {
        font-size: 10px;
        line-height: 1.5;
        overflow-wrap: anywhere;
    }

    .wa-field-meta,
    .wa-label-row {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 6px;
        width: 100%;
        min-width: 0;
        font-size: 10px;
        line-height: 1.5;
    }

    .wa-format-toolbar {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 6px;
        width: 100%;
        min-width: 0;
        padding: 8px;
    }

    .wa-format-toolbar button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 33px;
        min-height: 33px;
        padding: 7px 9px;
        border-radius: 7px;
        font-size: 12px;
    }

    .wa-format-toolbar .wa-insert-variable {
        flex: 1 1 115px;
        min-width: 0;
        margin-left: 0;
        white-space: normal;
    }

    .wa-variable-examples,
    .wa-buttons-builder {
        width: 100%;
        min-width: 0;
    }

    .wa-buttons-builder {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .wa-buttons-builder>* {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .wa-section-title>.wa-small-button {
        min-height: 35px;
        padding: 8px 10px;
        font-size: 11px;
    }

    .wa-help-note {
        font-size: 11px;
        line-height: 1.6;
        overflow-wrap: anywhere;
    }

    .form-message {
        width: 100%;
        min-width: 0;
        padding: 11px;
        font-size: 12px;
        line-height: 1.5;
        overflow-wrap: anywhere;
    }

    .wa-builder-footer {
        display: flex;
        flex-direction: column-reverse;
        align-items: stretch;
        gap: 9px;
        width: 100%;
        min-width: 0;
    }

    .wa-builder-footer button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        min-width: 0;
        min-height: 43px;
        margin: 0;
        padding: 10px 14px;
        border-radius: 9px;
        font-size: 13px;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    /* ================= WHATSAPP PREVIEW ================= */

    .wa-preview-heading {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 10px;
        width: 100%;
        min-width: 0;
    }

    .wa-preview-heading>div {
        flex: 1 1 150px;
        min-width: 0;
    }

    .wa-preview-heading h3 {
        font-size: 16px;
    }

    .wa-preview-heading p {
        font-size: 11px;
        line-height: 1.5;
    }

    .wa-live-badge {
        flex: 0 0 auto;
        font-size: 10px;
    }

    .wa-phone-frame {
        width: 100%;
        max-width: 300px;
        min-width: 0;
        margin: 0 auto;
    }

    .wa-phone-top,
    .wa-phone-composer {
        display: flex;
        align-items: center;
        gap: 7px;
        min-width: 0;
        padding: 10px 8px;
        font-size: 11px;
    }

    .wa-chat-wallpaper {
        width: 100%;
        min-width: 0;
        min-height: 220px;
        padding: 12px 8px;
    }

    .wa-message-bubble {
        width: fit-content;
        max-width: 96%;
        min-width: 0;
        padding: 10px;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .wa-preview-header,
    .wa-preview-body,
    .wa-preview-footer {
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .wa-preview-body {
        font-size: 11px;
        line-height: 1.65;
    }

    .wa-preview-buttons {
        display: flex;
        flex-direction: column;
        gap: 6px;
        width: 100%;
        min-width: 0;
    }

    .wa-preview-buttons>* {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow-wrap: anywhere;
        font-size: 11px;
    }

    .wa-preview-note,
    .wa-validation-card {
        width: 100%;
        min-width: 0;
        padding: 13px;
        border-radius: 10px;
        overflow-wrap: anywhere;
    }

    .wa-preview-note p,
    .wa-validation-card li {
        font-size: 11px;
        line-height: 1.6;
        overflow-wrap: anywhere;
    }

    /* ================= DETAILS MODAL ================= */

    #templateDetailsModal {
        position: fixed;
        inset: 0;
        z-index: 10000;
        display: flex;
        align-items: flex-start;
        justify-content: center;
        width: 100%;
        height: 100%;
        height: 100dvh;
        min-height: 0;
        padding: 12px;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .template-details-modal {
        width: 100%;
        max-width: 650px;
        min-width: 0;
        max-height: none;
        margin: 0 auto;
        border-radius: 13px;
    }

    .template-details-modal .user-modal-header {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 10px;
        padding: 17px 14px;
    }

    .template-details-modal .user-modal-header>div {
        flex: 1 1 auto;
        min-width: 0;
    }

    .template-details-modal .user-modal-header h2 {
        font-size: 20px;
        line-height: 1.35;
    }

    .template-details-modal .user-modal-header p {
        font-size: 12px;
        line-height: 1.5;
    }

    .template-details-modal .user-modal-close {
        flex: 0 0 34px;
        width: 34px;
        height: 34px;
        min-width: 34px;
    }

    .template-details-loading,
    .template-details-content {
        width: 100%;
        min-width: 0;
        padding: 15px;
        font-size: 12px;
        line-height: 1.6;
        overflow-wrap: anywhere;
    }

    .template-details-content table {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
    }

    .template-details-content pre {
        max-width: 100%;
        overflow-x: auto;
        white-space: pre-wrap;
        overflow-wrap: anywhere;
    }

    .template-details-modal .user-modal-footer,
    #templateDetailsActions {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 9px;
        width: 100%;
        min-width: 0;
        padding: 13px;
    }

    #templateDetailsActions button {
        width: 100%;
        min-width: 0;
        min-height: 42px;
        margin: 0;
        padding: 10px;
        font-size: 12px;
        white-space: normal;
        overflow-wrap: anywhere;
    }
}

/* =====================================================
   SMALL MOBILE — 360px AND BELOW
===================================================== */

@media screen and (max-width: 360px) {

    .templates-page {
        padding: 16px 10px 22px;
    }

    .templates-page-header h1 {
        font-size: 24px;
    }

    .templates-page-header p {
        font-size: 12px;
    }

    .templates-summary-grid {
        gap: 7px;
    }

    .templates-summary-card {
        gap: 7px;
        min-height: 80px;
        padding: 9px 7px;
    }

    .templates-summary-icon {
        flex-basis: 28px;
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .templates-summary-card span {
        font-size: 9px;
    }

    .templates-summary-card strong {
        font-size: 19px;
    }

    .templates-panel-header {
        padding-right: 11px;
        padding-left: 11px;
    }

    .templates-toolbar {
        padding-right: 11px;
        padding-left: 11px;
    }

    .wa-builder-overlay,
    #templateDetailsModal {
        padding: 6px;
    }

    .wa-builder-topbar {
        padding: 14px 11px;
    }

    .wa-builder-topbar h2 {
        font-size: 18px;
    }

    .wa-builder-layout {
        padding: 9px;
    }

    .wa-builder-section {
        padding: 12px 9px;
    }

    .wa-section-title {
        gap: 7px;
    }

    .wa-section-title>.wa-small-button {
        margin-left: 35px;
    }

    .wa-phone-frame {
        max-width: 100%;
    }

    .template-details-modal .user-modal-header h2 {
        font-size: 18px;
    }
}

/* ================= ACCESSIBILITY ================= */

@media (prefers-reduced-motion: reduce) {

    .templates-page *,
    .wa-builder-overlay *,
    #templateDetailsModal * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}











/* =========================================================
   ADTHRIVE MEDIA — WHATSAPP ACCOUNTS MODULE
   File: CSS/my-automation.css
   Scope: WhatsApp Accounts module only
   Shared Header & Sidebar CSS remains unchanged
========================================================= */

/* ===================== VARIABLES & RESET ===================== */

.wa-accounts-main {
    --wa-green: #7CB947;
    --wa-green-hover: #659e38;
    --wa-green-light: #edf7e7;
    --wa-border: #e5e7eb;
    --wa-text: #111827;
    --wa-muted: #6b7280;
    --wa-danger: #b42318;
    --wa-radius: 12px;

    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
    padding: 28px;
    color: var(--wa-text);
    box-sizing: border-box;
    font-family: "Segoe UI", Arial, sans-serif;
}

.wa-accounts-main *,
.wa-dialog,
.wa-dialog * {
    box-sizing: border-box;
}

.wa-accounts-main button,
.wa-dialog button,
.wa-dialog input,
.wa-dialog textarea {
    font-family: inherit;
}

.wa-accounts-main button:disabled,
.wa-dialog button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===================== PAGE HEADING ===================== */

.wa-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.wa-heading h1 {
    margin: 0;
    color: var(--wa-text);
    font-size: 28px;
    font-weight: 750;
    line-height: 1.3;
}

.wa-heading p {
    margin: 7px 0 0;
    color: var(--dashboard-muted, var(--wa-muted));
    font-size: 14px;
    line-height: 1.65;
}

.wa-heading-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

/* ===================== BUTTONS ===================== */

.wa-accounts-main .btn-secondary {
    background: #fff;
    border: 1px solid #d1d5db;
    color: #374151;
}

.wa-accounts-main .btn-secondary:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.wa-accounts-main .btn-primary {
    background: var(--wa-green);
    border-color: var(--wa-green);
    color: #fff;
}

.wa-accounts-main .btn-primary:hover {
    background: var(--wa-green-hover);
    border-color: var(--wa-green-hover);
}

.wa-accounts-main .btn:focus-visible,
.wa-action-button:focus-visible,
.wa-icon-button:focus-visible,
.wa-menu-logout:focus-visible {
    outline: 3px solid rgba(124, 185, 71, 0.35);
    outline-offset: 2px;
}

/* ===================== PAGE MESSAGE ===================== */

.wa-accounts-main #pageMessage {
    margin: 0 0 22px;
    padding: 13px 16px;
    border: 1px solid #dbeafe;
    border-radius: 9px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 13px;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.wa-accounts-main #pageMessage[hidden] {
    display: none !important;
}

.wa-accounts-main #pageMessage.success {
    background: #eaf7ee;
    border-color: #bbebca;
    color: #16854f;
}

.wa-accounts-main #pageMessage.error {
    background: #fff1f2;
    border-color: #fecdd3;
    color: #b42318;
}

.wa-accounts-main #pageMessage.warning {
    background: #fff7e6;
    border-color: #f5d78e;
    color: #9a6700;
}

/* ===================== STATISTICS CARDS ===================== */

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

.wa-stats .dashboard-stat-card {
    min-width: 0;
    padding: 21px;
    background: #fff;
    border: 1px solid var(--wa-border);
    border-radius: var(--wa-radius);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.035);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.wa-stats .dashboard-stat-card:hover {
    border-color: #cfe3c2;
    box-shadow: 0 5px 16px rgba(15, 23, 42, 0.055);
}

.wa-stats .dashboard-stat-card h2 {
    margin: 0 0 12px;
    color: var(--wa-muted);
    font-size: 13px;
    font-weight: 650;
    line-height: 1.5;
}

.wa-stats .dashboard-stat-card p {
    margin: 0;
    color: var(--wa-text);
    font-size: 29px;
    font-weight: 800;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.wa-stats .dashboard-stat-card span {
    display: block;
    margin-top: 9px;
    color: #6b7280;
    font-size: 11px;
    line-height: 1.6;
}

/* ===================== ACCOUNT PANEL ===================== */

.wa-account-panel {
    min-width: 0;
    margin-bottom: 24px;
    overflow: hidden;
}

.wa-list-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 20px;
    border-bottom: 1px solid #eef0f2;
}

.wa-list-heading h2 {
    margin: 0;
    color: var(--wa-text);
    font-size: 18px;
    font-weight: 750;
    line-height: 1.45;
}

.wa-list-heading p {
    margin: 5px 0 0;
    color: var(--dashboard-muted, var(--wa-muted));
    font-size: 13px;
    line-height: 1.6;
}

/* ===================== SEARCH ===================== */

.wa-search-label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 260px;
    color: var(--wa-muted);
    font-size: 12px;
    font-weight: 650;
}

.wa-search-label input {
    width: 100%;
    min-height: 42px;
    padding: 10px 13px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: var(--wa-text);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.wa-search-label input::placeholder {
    color: #9ca3af;
}

.wa-search-label input:focus {
    border-color: var(--wa-green);
    box-shadow: 0 0 0 3px rgba(124, 185, 71, 0.16);
}

/* ===================== TABLE ===================== */

.wa-table-wrap {
    width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
}

.wa-table {
    width: 100%;
    min-width: 1050px;
    border-collapse: collapse;
    border-spacing: 0;
    text-align: left;
}

.wa-table thead {
    background: #f9fafb;
}

.wa-table th {
    padding: 14px 16px;
    border-bottom: 1px solid var(--wa-border);
    color: #6b7280;
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.035em;
    text-transform: uppercase;
    white-space: nowrap;
}

.wa-table td {
    padding: 15px 16px;
    border-bottom: 1px solid #f0f1f3;
    color: #374151;
    font-size: 12px;
    line-height: 1.6;
    vertical-align: middle;
}

.wa-table tbody tr {
    transition: background-color 0.15s ease;
}

.wa-table tbody tr:hover {
    background: #fafcf8;
}

.wa-table tbody tr:last-child td {
    border-bottom: none;
}

/* Loading and no-result rows */

.wa-table td[colspan] {
    padding: 30px 18px;
    color: #6b7280;
    text-align: center;
    font-size: 13px;
}

/* ===================== ACCOUNT NAME CELL ===================== */

.wa-table td.wa-account-name {
    min-width: 160px;
}

.wa-account-name strong {
    display: block;
    color: #111827;
    font-size: 13px;
    font-weight: 750;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.wa-account-name small {
    display: block;
    margin-top: 3px;
    color: #6b7280;
    font-size: 11px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

/* ===================== STATUS BADGES ===================== */

.wa-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    border-radius: 999px;
    background: #f3f4f6;
    color: #4b5563;
    font-size: 10px;
    font-weight: 750;
    line-height: 1.4;
    white-space: nowrap;
}

.wa-status.connected,
.wa-status.active,
.wa-status.ready {
    background: #eaf7ee;
    color: #16854f;
}

.wa-status.disconnected,
.wa-status.failed,
.wa-status.error {
    background: #fff1f2;
    color: #b42318;
}

.wa-status.pending,
.wa-status.unknown {
    background: #fff7e6;
    color: #9a6700;
}

/* ===================== ROW ACTION BUTTONS ===================== */

.wa-table td.wa-row-actions {
    min-width: 220px;
}

.wa-row-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.wa-action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 6px 9px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #374151;
    font-family: inherit;
    font-size: 11px;
    font-weight: 650;
    line-height: 1.3;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.wa-action-button:hover {
    background: #f3f7ef;
    border-color: var(--wa-green);
}

.wa-action-button.danger {
    border-color: #fecaca;
    color: var(--wa-danger);
}

.wa-action-button.danger:hover {
    background: #fff1f2;
    border-color: #f87171;
}

/* ===================== EMPTY STATE ===================== */

.wa-empty {
    padding: 42px 20px;
    text-align: center;
}

.wa-empty[hidden] {
    display: none !important;
}

.wa-empty-icon {
    color: var(--wa-green);
    font-size: 36px;
    line-height: 1.4;
}

.wa-empty h3 {
    margin: 12px 0 7px;
    color: #111827;
    font-size: 18px;
    font-weight: 750;
}

.wa-empty p {
    max-width: 430px;
    margin: 0 auto 18px;
    color: #6b7280;
    font-size: 13px;
    line-height: 1.7;
}

/* ===================== CREDENTIAL SAFETY NOTE ===================== */

.wa-security-note {
    padding: 20px;
    margin-bottom: 24px;
    border: 1px solid #dcebd4;
    border-radius: 10px;
    background: #f8fcf5;
}

.wa-security-note h2 {
    margin: 0 0 8px;
    color: #24421c;
    font-size: 16px;
    font-weight: 750;
    line-height: 1.5;
}

.wa-security-note p {
    margin: 0;
    color: #6b7280;
    font-size: 13px;
    line-height: 1.8;
}

/* =========================================================
   DIALOGS — ADD ACCOUNT, DETAILS AND UPDATE TOKEN
========================================================= */

.wa-dialog {
    width: min(680px, calc(100% - 28px));
    max-width: 680px;
    max-height: 90vh;
    margin: auto;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    border: none;
    border-radius: 14px;
    background: #fff;
    color: #111827;
    box-shadow: 0 22px 70px rgba(15, 23, 42, 0.25);
}

.wa-dialog[open] {
    animation: wa-dialog-enter 0.18s ease-out;
}

.wa-dialog::backdrop {
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(2px);
}

@keyframes wa-dialog-enter {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wa-dialog-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 25px;
}

/* Dialog Header */

.wa-dialog-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eef0f2;
}

.wa-dialog-heading h2 {
    margin: 0 0 6px;
    color: #111827;
    font-size: 20px;
    font-weight: 750;
    line-height: 1.4;
}

.wa-dialog-heading p {
    margin: 0;
    color: #6b7280;
    font-size: 12px;
    line-height: 1.7;
}

.wa-dialog small {
    display: block;
    color: #6b7280;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.65;
}

/* Dialog Close Button */

.wa-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    padding: 0;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: #6b7280;
    font-size: 27px;
    line-height: 1;
    cursor: pointer;
}

.wa-icon-button:hover {
    background: #f3f4f6;
    color: #111827;
}

/* Dialog Labels */

.wa-dialog label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    color: #374151;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.5;
}

.wa-dialog label span {
    display: inline;
    color: #b42318;
}

.wa-dialog input,
.wa-dialog textarea {
    display: block;
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #111827;
    font-family: inherit;
    font-size: 13px;
    font-weight: 400;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.wa-dialog input::placeholder,
.wa-dialog textarea::placeholder {
    color: #9ca3af;
    opacity: 1;
}

.wa-dialog input:focus,
.wa-dialog textarea:focus {
    border-color: var(--wa-green);
    box-shadow: 0 0 0 3px rgba(124, 185, 71, 0.16);
}

.wa-dialog textarea {
    min-height: 90px;
    resize: vertical;
    line-height: 1.6;
}

.wa-dialog input:required:invalid,
.wa-dialog textarea:required:invalid {
    box-shadow: none;
}

/* Two-column form fields */

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

/* Dialog Footer */

.wa-dialog-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 8px;
}

.wa-dialog-actions .btn {
    min-height: 40px;
}

/* ===================== ACCOUNT DETAILS ===================== */

.wa-details-dialog {
    width: min(620px, calc(100% - 28px));
}

.wa-details-list {
    display: grid;
    grid-template-columns: minmax(130px, 0.75fr) minmax(0, 1.25fr);
    gap: 0;
    margin: 0;
}

.wa-details-list dt,
.wa-details-list dd {
    min-width: 0;
    padding: 11px 0;
    border-bottom: 1px solid #f0f1f3;
    font-size: 13px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.wa-details-list dt {
    padding-right: 15px;
    color: #6b7280;
    font-weight: 500;
}

.wa-details-list dd {
    margin: 0;
    color: #111827;
    font-weight: 650;
}

.wa-details-list dt:last-of-type,
.wa-details-list dd:last-of-type {
    border-bottom: none;
}

/* ===================== LOGOUT BUTTON ===================== */

.wa-menu-logout {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 40px;
    margin-top: 5px;
    padding: 0 12px;
    border: none;
    border-radius: 7px;
    background: #fff1f2;
    color: #b42318;
    font-family: inherit;
    font-size: 13px;
    font-weight: 650;
    text-align: left;
    cursor: pointer;
}

.wa-menu-logout:hover {
    background: #ffe4e6;
}

/* =========================================================
   RESPONSIVE — TABLET
========================================================= */

@media (max-width: 1100px) {
    .wa-accounts-main {
        padding: 24px 20px;
    }

    .wa-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 15px;
    }

    .wa-list-heading {
        flex-direction: column;
        gap: 16px;
    }

    .wa-search-label {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 768px) {
    .wa-heading {
        flex-direction: column;
        gap: 14px;
    }

    .wa-heading h1 {
        font-size: 24px;
    }

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

    .wa-list-heading {
        padding: 17px;
    }

    .wa-table th,
    .wa-table td {
        padding: 12px;
    }

    .wa-dialog {
        width: calc(100% - 24px);
        max-height: 92vh;
    }
}

/* =========================================================
   RESPONSIVE — MOBILE
========================================================= */

@media (max-width: 600px) {
    .wa-accounts-main {
        padding: 20px 14px;
    }

    .wa-heading h1 {
        font-size: 22px;
    }

    .wa-heading p {
        font-size: 13px;
    }

    .wa-heading-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .wa-heading-actions .btn {
        width: 100%;
        min-width: 0;
        padding: 10px;
        font-size: 12px;
    }

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

    .wa-stats .dashboard-stat-card {
        padding: 15px;
    }

    .wa-stats .dashboard-stat-card h2 {
        font-size: 12px;
    }

    .wa-stats .dashboard-stat-card p {
        font-size: 23px;
    }

    .wa-stats .dashboard-stat-card span {
        font-size: 10px;
    }

    .wa-account-panel {
        margin-bottom: 18px;
    }

    .wa-list-heading {
        padding: 15px;
    }

    .wa-list-heading h2 {
        font-size: 16px;
    }

    .wa-table {
        min-width: 950px;
    }

    .wa-empty {
        padding: 32px 14px;
    }

    .wa-security-note {
        padding: 15px;
    }

    .wa-security-note h2 {
        font-size: 15px;
    }

    .wa-security-note p {
        font-size: 12px;
    }

    .wa-form-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }

    .wa-dialog {
        width: calc(100% - 20px);
        max-height: 92vh;
        border-radius: 12px;
    }

    .wa-dialog-form {
        gap: 14px;
        padding: 18px;
    }

    .wa-dialog-heading h2 {
        font-size: 18px;
    }

    .wa-dialog-actions {
        display: flex;
        flex-direction: column-reverse;
        align-items: stretch;
        gap: 8px;
    }

    .wa-dialog-actions .btn {
        width: 100%;
    }

    .wa-details-list {
        grid-template-columns: minmax(95px, 0.75fr) minmax(0, 1.25fr);
    }

    .wa-details-list dt,
    .wa-details-list dd {
        padding: 9px 0;
        font-size: 12px;
    }
}

/* =========================================================
   RESPONSIVE — VERY SMALL MOBILE
========================================================= */

@media (max-width: 360px) {
    .wa-accounts-main {
        padding: 16px 10px;
    }

    .wa-stats {
        gap: 8px;
    }

    .wa-stats .dashboard-stat-card {
        padding: 12px;
    }

    .wa-stats .dashboard-stat-card p {
        font-size: 20px;
    }

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

    .wa-dialog-form {
        padding: 15px;
    }

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

    .wa-details-list dt {
        padding-bottom: 2px;
        border-bottom: none;
    }

    .wa-details-list dd {
        padding-top: 2px;
    }
}

/* =========================================================
   ACCESSIBILITY — REDUCED MOTION
========================================================= */

@media (prefers-reduced-motion: reduce) {

    .wa-accounts-main *,
    .wa-dialog * {
        scroll-behavior: auto !important;
        animation: none !important;
        transition: none !important;
    }
}











/* ==========================================================
   ADTHRIVE MEDIA — BULK WHATSAPP CAMPAIGN
   Complete Responsive CSS
   Desktop | Tablet | Mobile
   Brand: #7CB947
   ========================================================== */

/* 1. DESIGN TOKENS */
:root {
    --bw-primary: #7CB947;
    --bw-primary-dark: #639936;
    --bw-primary-light: #F0F7E9;
    --bw-text: #202B24;
    --bw-muted: #6B776E;
    --bw-border: #E1E8E0;
    --bw-bg: #F7F9F6;
    --bw-white: #FFFFFF;
    --bw-success: #168653;
    --bw-danger: #D93645;
    --bw-warning: #B7791F;
    --bw-info: #2563EB;
    --bw-radius: 14px;
    --bw-radius-sm: 9px;
    --bw-shadow: 0 5px 22px rgba(25, 45, 25, 0.055);
    --bw-transition: 0.2s ease;
}

/* 2. BASE LAYOUT */
.bw-page,
.bw-page * {
    box-sizing: border-box;
}

.bw-page {
    width: 100%;
    max-width: 1440px;
    min-width: 0;
    margin: 0 auto;
    padding: 28px;
    color: var(--bw-text);
    font-family: inherit;
    font-size: 15px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.bw-page button,
.bw-page input,
.bw-page select,
.bw-page textarea {
    font: inherit;
}

.bw-page button {
    cursor: pointer;
    transition:
        background var(--bw-transition),
        border-color var(--bw-transition),
        color var(--bw-transition),
        box-shadow var(--bw-transition),
        transform var(--bw-transition);
}

.bw-page button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    box-shadow: none;
    transform: none;
}

.bw-page [hidden] {
    display: none !important;
}

.bw-page button:focus-visible,
.bw-page input:focus-visible,
.bw-page select:focus-visible,
.bw-page textarea:focus-visible,
.bw-page summary:focus-visible {
    outline: 3px solid rgba(124, 185, 71, 0.3);
    outline-offset: 3px;
}

/* 3. PAGE HEADER */
.bw-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.bw-page-header>div {
    min-width: 0;
}

.bw-eyebrow {
    margin: 0 0 9px;
    color: var(--bw-primary-dark);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.5px;
    line-height: 1.5;
}

.bw-page-header h1 {
    margin: 0 0 10px;
    color: var(--bw-text);
    font-size: clamp(28px, 3vw, 36px);
    font-weight: 800;
    letter-spacing: -0.9px;
    line-height: 1.2;
}

.bw-subtitle {
    max-width: 720px;
    margin: 0;
    color: var(--bw-muted);
    font-size: 15px;
    line-height: 1.7;
}


.chat-management {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 22px;
    border: 1px solid #16856b;
    border-radius: 10px;
    background: #16856b;
    box-shadow: 0 4px 12px rgba(22, 133, 107, 0.15);
    cursor: pointer;
    transition: all 0.25s ease;
    margin: -100px 87% 10px;
    margin-bottom: 40px;
    justify-content: flex-end;
    display: flex;

}

.chat-management a {
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.chat-management:hover {
    background: #106b56;
    border-color: #106b56;
    box-shadow: 0 7px 18px rgba(22, 133, 107, 0.25);
    transform: translateY(-2px);
}

.chat-management:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(22, 133, 107, 0.15);
}

.chat-management:focus-within {
    outline: 3px solid rgba(22, 133, 107, 0.2);
    outline-offset: 3px;
}



/* 4. BUTTONS */
.bw-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    max-width: 100%;
    padding: 10px 17px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    overflow-wrap: anywhere;
}

.bw-button-primary {
    border-color: var(--bw-primary);
    background: var(--bw-primary);
    color: #FFFFFF;
    box-shadow: 0 3px 9px rgba(124, 185, 71, 0.13);
}

.bw-button-primary:hover:not(:disabled) {
    border-color: var(--bw-primary-dark);
    background: var(--bw-primary-dark);
    box-shadow: 0 5px 13px rgba(100, 155, 53, 0.2);
    transform: translateY(-1px);
}

.bw-button-secondary {
    border-color: var(--bw-border);
    background: #FFFFFF;
    color: #344238;
}

.bw-button-secondary:hover:not(:disabled) {
    border-color: #C4D7B8;
    background: var(--bw-primary-light);
    color: var(--bw-primary-dark);
}

.bw-page-header>.bw-button {
    flex-shrink: 0;
    margin-top: 4px;
}

/* 5. PAGE ALERT */
.bw-alert {
    margin-bottom: 22px;
    padding: 14px 17px;
    border: 1px solid var(--bw-border);
    border-radius: 10px;
    background: #FFFFFF;
    color: var(--bw-text);
    font-size: 14px;
    overflow-wrap: anywhere;
}

.bw-alert:empty {
    display: none;
}

/* Optional state classes for alerts */
.bw-alert.is-success {
    border-color: #B9E2CA;
    background: #F0FBF4;
    color: #176B40;
}

.bw-alert.is-error {
    border-color: #F2C3C7;
    background: #FFF4F4;
    color: #A52632;
}

.bw-alert.is-warning {
    border-color: #F0D8A8;
    background: #FFFAED;
    color: #855B13;
}

/* 6. WALLET AND CAMPAIGN STATISTICS */
.bw-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 17px;
    margin-bottom: 26px;
}

.bw-stat-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 7px;
    min-width: 0;
    min-height: 130px;
    padding: 21px;
    border: 1px solid var(--bw-border);
    border-radius: var(--bw-radius);
    background: var(--bw-white);
    box-shadow: var(--bw-shadow);
}

.bw-stat-card>span {
    color: var(--bw-muted);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.5;
}

.bw-stat-card>strong {
    max-width: 100%;
    color: var(--bw-text);
    font-size: clamp(22px, 2.2vw, 30px);
    font-weight: 800;
    letter-spacing: -0.6px;
    line-height: 1.3;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.bw-stat-card>small {
    color: var(--bw-muted);
    font-size: 12px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

/* 7. FOUR-STEP NAVIGATION */
.bw-step-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 24px;
    padding: 7px;
    border: 1px solid var(--bw-border);
    border-radius: 12px;
    background: #FFFFFF;
}

.bw-step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--bw-muted);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.45;
    text-align: center;
    overflow-wrap: anywhere;
}

.bw-step-indicator.is-active {
    border-color: #D5E7C7;
    background: var(--bw-primary-light);
    color: var(--bw-primary-dark);
}

.bw-step-indicator.is-complete {
    color: var(--bw-success);
}

/* 8. CAMPAIGN PANELS */
#bulkCampaignForm {
    display: flex;
    flex-direction: column;
    gap: 23px;
    min-width: 0;
}

.bw-panel {
    min-width: 0;
    padding: 26px;
    border: 1px solid var(--bw-border);
    border-radius: var(--bw-radius);
    background: var(--bw-white);
    box-shadow: var(--bw-shadow);
    scroll-margin-top: 24px;
}

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

.bw-panel-heading>div {
    min-width: 0;
}

.bw-step-label {
    display: inline-block;
    margin-bottom: 7px;
    color: var(--bw-primary-dark);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.3px;
}

.bw-panel-heading h2 {
    margin: 0 0 7px;
    color: var(--bw-text);
    font-size: 22px;
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: -0.35px;
}

.bw-panel-heading p {
    max-width: 760px;
    margin: 0;
    color: var(--bw-muted);
    font-size: 13px;
    line-height: 1.7;
}

.bw-panel-heading>.bw-button {
    flex-shrink: 0;
}

/* 9. FORM FIELDS */
.bw-field-label {
    display: block;
    margin: 19px 0 8px;
    color: #344238;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.5;
}

.bw-panel-heading+.bw-field-label {
    margin-top: 0;
}

.bw-page input:not([type="checkbox"]):not([type="file"]),
.bw-page select,
.bw-page textarea {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: 11px 13px;
    border: 1px solid #DCE4DC;
    border-radius: var(--bw-radius-sm);
    background: #FFFFFF;
    color: var(--bw-text);
    font-size: 14px;
    line-height: 1.5;
    transition: border-color var(--bw-transition),
        box-shadow var(--bw-transition);
}

.bw-page input:not([type="checkbox"]):not([type="file"]),
.bw-page select {
    min-height: 46px;
}

.bw-page textarea {
    min-height: 105px;
    resize: vertical;
}

.bw-page input::placeholder,
.bw-page textarea::placeholder {
    color: #9AA49B;
    opacity: 1;
}

.bw-page input:focus,
.bw-page select:focus,
.bw-page textarea:focus {
    border-color: var(--bw-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(124, 185, 71, 0.12);
}

.bw-page select:disabled,
.bw-page input:disabled,
.bw-page textarea:disabled {
    cursor: not-allowed;
    background: #F1F3F1;
    color: #89938A;
}

.bw-page select option {
    color: var(--bw-text);
}

/* 10. FILE UPLOAD */
.bw-page input[type="file"] {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 12px;
    border: 1px dashed #B9CBB0;
    border-radius: 10px;
    background: #FAFCF8;
    color: var(--bw-muted);
    font-size: 13px;
    line-height: 1.5;
}

.bw-page input[type="file"]::file-selector-button {
    margin: 0 12px 0 0;
    padding: 8px 12px;
    border: 1px solid #D3E3C7;
    border-radius: 7px;
    background: var(--bw-primary-light);
    color: var(--bw-primary-dark);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.bw-page input[type="file"]::file-selector-button:hover {
    background: #E5F1DA;
}

/* 11. HELP TEXT */
.bw-help {
    margin: 8px 0 0;
    color: var(--bw-muted);
    font-size: 12px;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

/* 12. ACTION GROUPS */
.bw-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 11px;
    min-width: 0;
    margin-top: 19px;
}

.bw-actions .bw-button {
    flex-shrink: 0;
}

/* 13. IMPORT SUMMARY */
.bw-import-summary {
    margin-top: 21px;
    padding: 17px;
    border: 1px solid var(--bw-border);
    border-radius: 10px;
    background: #FAFCF8;
    overflow-wrap: anywhere;
}

.bw-import-summary>*:first-child {
    margin-top: 0;
}

.bw-import-summary>*:last-child {
    margin-bottom: 0;
}

.bw-import-summary strong {
    color: var(--bw-text);
}

.bw-import-summary p {
    margin: 7px 0;
    color: var(--bw-muted);
    font-size: 13px;
}

/* 14. TABLES */
.bw-table-wrap {
    width: 100%;
    min-width: 0;
    margin-top: 21px;
    border: 1px solid var(--bw-border);
    border-radius: 11px;
    background: #FFFFFF;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
}

.bw-table-wrap h3 {
    margin: 0;
    padding: 18px 18px 12px;
    color: var(--bw-text);
    font-size: 17px;
    font-weight: 750;
}

.bw-table {
    width: 100%;
    min-width: 600px;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    text-align: left;
}

.bw-table th,
.bw-table td {
    padding: 13px 15px;
    border-bottom: 1px solid #EDF0ED;
    vertical-align: middle;
    overflow-wrap: anywhere;
}

.bw-table th {
    background: #F7F9F6;
    color: #526054;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.45px;
    white-space: nowrap;
}

.bw-table td {
    color: #344238;
}

.bw-table tbody tr:last-child td {
    border-bottom: none;
}

.bw-table tbody tr:hover {
    background: #FBFCFA;
}

.bw-table button {
    max-width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--bw-border);
    border-radius: 7px;
    background: #FFFFFF;
    color: var(--bw-text);
    font-size: 12px;
    font-weight: 650;
    overflow-wrap: anywhere;
}

.bw-table button:hover:not(:disabled) {
    border-color: var(--bw-primary);
    color: var(--bw-primary-dark);
}

/* 15. TEMPLATE PREVIEW */
.bw-template-preview {
    min-width: 0;
    margin-top: 15px;
    padding: 18px;
    border: 1px solid var(--bw-border);
    border-radius: 11px;
    background: #FAFCF8;
    overflow-wrap: anywhere;
}

.bw-template-preview>*:first-child {
    margin-top: 0;
}

.bw-template-preview>*:last-child {
    margin-bottom: 0;
}

.bw-template-preview p {
    color: var(--bw-muted);
    font-size: 13px;
    line-height: 1.7;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.bw-template-preview h3,
.bw-template-preview h4 {
    margin: 0 0 8px;
    color: var(--bw-text);
    font-size: 15px;
    font-weight: 750;
}

.bw-template-preview button {
    max-width: 100%;
    margin: 6px 5px 0 0;
    padding: 7px 10px;
    border: 1px solid var(--bw-border);
    border-radius: 7px;
    background: #FFFFFF;
    color: var(--bw-text);
    font-size: 12px;
    overflow-wrap: anywhere;
}

/* 16. ADVANCED COMPONENTS */
.bw-advanced {
    margin-top: 22px;
    border: 1px solid var(--bw-border);
    border-radius: 11px;
    background: #FFFFFF;
    overflow: hidden;
}

.bw-advanced summary {
    padding: 15px 17px;
    background: #F7F9F6;
    color: var(--bw-text);
    font-size: 13px;
    font-weight: 750;
    cursor: pointer;
    overflow-wrap: anywhere;
}

.bw-advanced summary:hover {
    background: var(--bw-primary-light);
}

.bw-advanced[open] summary {
    border-bottom: 1px solid var(--bw-border);
}

.bw-advanced>.bw-field-label,
.bw-advanced>textarea,
.bw-advanced>.bw-help {
    margin-right: 17px;
    margin-left: 17px;
    width: calc(100% - 34px);
}

.bw-advanced>.bw-field-label {
    margin-top: 17px;
}

.bw-advanced>textarea {
    margin-top: 0;
}

.bw-advanced>.bw-help {
    margin-top: 8px;
    margin-bottom: 18px;
}

#templateVariables,
#templateComponents {
    font-size: 13px;
}

#templateComponents {
    font-family: Consolas, "Courier New", monospace;
    line-height: 1.6;
    tab-size: 2;
}

/* 17. REVIEW GRID */
.bw-review-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.bw-review-grid>div {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    min-width: 0;
    min-height: 105px;
    padding: 17px;
    border: 1px solid var(--bw-border);
    border-radius: 10px;
    background: #FAFCF8;
}

.bw-review-grid>div>span {
    color: var(--bw-muted);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
}

.bw-review-grid>div>strong {
    color: var(--bw-text);
    font-size: 19px;
    font-weight: 800;
    line-height: 1.4;
    overflow-wrap: anywhere;
    font-variant-numeric: tabular-nums;
}

#reviewStatus {
    color: var(--bw-primary-dark);
}

/* 18. CONSENT */
.bw-consent {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 22px;
    padding: 17px;
    border: 1px solid var(--bw-border);
    border-radius: 10px;
    background: #FAFCF8;
    color: #455247;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.7;
    cursor: pointer;
}

.bw-consent input[type="checkbox"] {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    margin: 3px 0 0;
    accent-color: var(--bw-primary-dark);
    cursor: pointer;
}

.bw-consent span {
    min-width: 0;
}

/* 19. ESTIMATE WARNING */
.bw-warning {
    margin-top: 18px;
    padding: 14px 16px;
    border: 1px solid #F0D8A8;
    border-radius: 9px;
    background: #FFFAED;
    color: #855B13;
    font-size: 13px;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

/* 20. CAMPAIGN STATUS */
.bw-campaign-status {
    min-width: 0;
    margin-top: 22px;
    padding: 18px;
    border: 1px solid var(--bw-border);
    border-radius: 11px;
    background: #FAFCF8;
    overflow-wrap: anywhere;
}

.bw-campaign-status>*:first-child {
    margin-top: 0;
}

.bw-campaign-status>*:last-child {
    margin-bottom: 0;
}

.bw-campaign-status p {
    margin: 7px 0;
    color: var(--bw-muted);
    font-size: 13px;
    line-height: 1.7;
}

.bw-campaign-status strong {
    color: var(--bw-text);
}

.bw-campaign-status h3,
.bw-campaign-status h4 {
    margin: 0 0 9px;
    color: var(--bw-text);
    font-size: 16px;
    font-weight: 750;
}

/* 21. PROGRESS BAR */
.bw-progress-track {
    width: 100%;
    height: 11px;
    margin-top: 20px;
    border-radius: 999px;
    background: #E9EEE6;
    overflow: hidden;
}

.bw-progress-bar {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--bw-primary);
    transition: width 0.35s ease;
}

/* 22. FOOTER */
.bw-footer {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px 25px;
    margin-top: 27px;
    padding: 20px 2px 0;
    border-top: 1px solid var(--bw-border);
}

.bw-footer p {
    margin: 0;
    color: var(--bw-muted);
    font-size: 12px;
    line-height: 1.7;
}

.bw-footer p:first-child {
    color: #465447;
    font-weight: 700;
}

/*===================================
    CHAT-MANAGEMENT MOBILE RESPONSIVE
    ===================================*/
    

/* ========================================
   TABLET RESPONSIVE
======================================== */

@media (max-width: 1024px) {
    .chat-management {
        padding: 11px 18px;
        margin-bottom: 30px;
        border-radius: 9px;
    }

    .chat-management a {
        font-size: 14px;
    }
}

/* ========================================
   MOBILE RESPONSIVE
======================================== */

@media (max-width: 768px) {
    .chat-management {
        display: inline-flex;
        align-items: center;
        justify-content: center;

        max-width: 100%;
        padding: 10px 15px;
        margin: 0 0 24px auto;

        border-radius: 8px;
        box-sizing: border-box;
    }

    .chat-management a {
        font-size: 13px;
        line-height: 1.4;
    }

    .chat-management:hover {
        transform: none;
    }
}

/* ========================================
   SMALL MOBILE
======================================== */

@media (max-width: 480px) {
    .chat-management {
        padding: 9px 12px;
        margin-bottom: 20px;
        border-radius: 8px;
    }

    .chat-management a {
        font-size: 12px;
    }
}

/* ========================================
   EXTRA SMALL MOBILE
======================================== */

@media (max-width: 360px) {
    .chat-management {
        padding: 8px 10px;
        margin-bottom: 16px;
    }

    .chat-management a {
        font-size: 11px;
    }
}


/* ==========================================================
   TABLET — 768px AND BELOW
   ========================================================== */
@media (max-width: 768px) {
    .bw-page {
        padding: 22px;
    }

    .bw-page-header {
        gap: 16px;
        margin-bottom: 23px;
    }

    .bw-page-header h1 {
        font-size: 30px;
    }

    .bw-subtitle {
        font-size: 14px;
    }

    .bw-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 13px;
        margin-bottom: 22px;
    }

    .bw-stat-card {
        min-height: 112px;
        padding: 18px;
    }

    .bw-stat-card>strong {
        font-size: 27px;
    }

    .bw-step-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
    }

    .bw-step-indicator {
        min-height: 43px;
        padding: 9px;
        font-size: 12px;
    }

    #bulkCampaignForm {
        gap: 19px;
    }

    .bw-panel {
        padding: 21px;
    }

    .bw-panel-heading h2 {
        font-size: 20px;
    }

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

    .bw-review-grid>div {
        min-height: 95px;
        padding: 15px;
    }

    .bw-footer {
        flex-direction: column;
        gap: 8px;
    }
}

/* ==========================================================
   MOBILE — 480px AND BELOW
   ========================================================== */
@media (max-width: 480px) {
    .bw-page {
        width: 100%;
        padding: 15px;
        font-size: 14px;
    }

    .bw-page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        margin-bottom: 20px;
    }

    .bw-eyebrow {
        font-size: 10px;
        letter-spacing: 1.2px;
    }

    .bw-page-header h1 {
        margin-bottom: 9px;
        font-size: 27px;
        letter-spacing: -0.6px;
    }

    .bw-subtitle {
        font-size: 13px;
        line-height: 1.7;
    }

    .bw-page-header>.bw-button {
        width: 100%;
        margin-top: 0;
    }

    .bw-button {
        min-height: 44px;
        padding: 10px 12px;
        font-size: 13px;
    }

    .bw-alert {
        margin-bottom: 17px;
        padding: 12px;
        font-size: 13px;
    }

    .bw-stats-grid {
        gap: 10px;
        margin-bottom: 18px;
    }

    .bw-stat-card {
        min-height: 104px;
        gap: 6px;
        padding: 13px;
        border-radius: 11px;
    }

    .bw-stat-card>span {
        font-size: 11px;
        line-height: 1.5;
    }

    .bw-stat-card>strong {
        font-size: clamp(19px, 6vw, 25px);
        letter-spacing: -0.4px;
    }

    .bw-stat-card>small {
        font-size: 10px;
        line-height: 1.5;
    }

    .bw-step-nav {
        gap: 5px;
        margin-bottom: 18px;
        padding: 5px;
        border-radius: 10px;
    }

    .bw-step-indicator {
        min-height: 43px;
        padding: 8px 5px;
        font-size: 11px;
        line-height: 1.4;
    }

    #bulkCampaignForm {
        gap: 16px;
    }

    .bw-panel {
        padding: 16px;
        border-radius: 12px;
    }

    .bw-panel-heading {
        flex-direction: column;
        align-items: stretch;
        gap: 13px;
        margin-bottom: 20px;
    }

    .bw-step-label {
        margin-bottom: 6px;
        font-size: 10px;
    }

    .bw-panel-heading h2 {
        margin-bottom: 7px;
        font-size: 19px;
        letter-spacing: -0.2px;
    }

    .bw-panel-heading p {
        font-size: 12px;
    }

    .bw-panel-heading>.bw-button {
        width: 100%;
    }

    .bw-field-label {
        margin-top: 17px;
        margin-bottom: 7px;
        font-size: 12px;
    }

    .bw-page input:not([type="checkbox"]):not([type="file"]),
    .bw-page select,
    .bw-page textarea {
        padding: 11px;
        border-radius: 8px;
        font-size: 13px;
    }

    .bw-page input:not([type="checkbox"]):not([type="file"]),
    .bw-page select {
        min-height: 44px;
    }

    .bw-page textarea {
        min-height: 100px;
    }

    .bw-page input[type="file"] {
        padding: 10px;
        font-size: 12px;
    }

    .bw-page input[type="file"]::file-selector-button {
        margin-bottom: 5px;
        padding: 7px 9px;
        font-size: 12px;
    }

    .bw-help {
        font-size: 11px;
        line-height: 1.7;
    }

    .bw-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 9px;
        margin-top: 16px;
    }

    .bw-actions .bw-button {
        width: 100%;
        min-height: 44px;
        flex-shrink: 1;
    }

    .bw-import-summary {
        margin-top: 16px;
        padding: 13px;
    }

    .bw-table-wrap {
        margin-top: 16px;
        border-radius: 9px;
    }

    .bw-table-wrap h3 {
        padding: 14px 12px 10px;
        font-size: 15px;
    }

    .bw-table {
        min-width: 540px;
        font-size: 12px;
    }

    .bw-table th,
    .bw-table td {
        padding: 11px 12px;
    }

    .bw-table th {
        font-size: 10px;
    }

    .bw-template-preview {
        margin-top: 12px;
        padding: 13px;
    }

    .bw-template-preview p {
        font-size: 12px;
    }

    .bw-advanced {
        margin-top: 17px;
    }

    .bw-advanced summary {
        padding: 13px;
        font-size: 12px;
        line-height: 1.6;
    }

    .bw-advanced>.bw-field-label,
    .bw-advanced>textarea,
    .bw-advanced>.bw-help {
        margin-right: 12px;
        margin-left: 12px;
        width: calc(100% - 24px);
    }

    .bw-advanced>.bw-field-label {
        margin-top: 14px;
    }

    .bw-advanced>.bw-help {
        margin-bottom: 14px;
    }

    #templateVariables,
    #templateComponents {
        font-size: 12px;
    }

    .bw-review-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
        margin-bottom: 17px;
    }

    .bw-review-grid>div {
        min-height: 94px;
        gap: 7px;
        padding: 12px;
        border-radius: 9px;
    }

    .bw-review-grid>div>span {
        font-size: 11px;
    }

    .bw-review-grid>div>strong {
        font-size: 17px;
    }

    #recalculateBtn {
        width: 100%;
    }

    .bw-consent {
        gap: 10px;
        margin-top: 17px;
        padding: 13px;
        font-size: 12px;
        line-height: 1.7;
    }

    .bw-consent input[type="checkbox"] {
        flex-basis: 17px;
        width: 17px;
        height: 17px;
    }

    .bw-warning {
        margin-top: 14px;
        padding: 12px;
        font-size: 12px;
    }

    .bw-campaign-status {
        margin-top: 17px;
        padding: 14px;
    }

    .bw-campaign-status p {
        font-size: 12px;
    }

    .bw-progress-track {
        height: 9px;
        margin-top: 17px;
    }

    #campaignProgressText {
        font-size: 11px;
    }

    .bw-footer {
        gap: 7px;
        margin-top: 22px;
        padding-top: 16px;
    }

    .bw-footer p {
        font-size: 11px;
    }
}

/* ==========================================================
   EXTRA SMALL MOBILE — 360px AND BELOW
   ========================================================== */
@media (max-width: 360px) {
    .bw-page {
        padding: 11px;
    }

    .bw-page-header h1 {
        font-size: 25px;
    }

    .bw-stats-grid {
        gap: 8px;
    }

    .bw-stat-card {
        min-height: 99px;
        padding: 10px;
    }

    .bw-stat-card>span {
        font-size: 10px;
    }

    .bw-stat-card>strong {
        font-size: 20px;
    }

    .bw-stat-card>small {
        font-size: 9px;
    }

    .bw-step-indicator {
        padding: 7px 3px;
        font-size: 10px;
    }

    .bw-panel {
        padding: 13px;
    }

    .bw-panel-heading h2 {
        font-size: 18px;
    }

    .bw-review-grid {
        gap: 7px;
    }

    .bw-review-grid>div {
        min-height: 90px;
        padding: 9px;
    }

    .bw-review-grid>div>span {
        font-size: 10px;
    }

    .bw-review-grid>div>strong {
        font-size: 15px;
    }

    .bw-consent {
        padding: 11px;
    }
}

/* ACCESSIBILITY */
@media (prefers-reduced-motion: reduce) {

    .bw-page *,
    .bw-page *::before,
    .bw-page *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}










/* =========================================================
   ADTHRIVE MEDIA — BULK WHATSAPP CAMPAIGN
   Complete CSS | Responsive | Exact HTML Selectors
   Brand Color: #7CB947
   ========================================================= */

:root {
    --bw-primary: #7CB947;
    --bw-primary-dark: #639936;
    --bw-primary-light: #F0F7E9;
    --bw-text: #202B24;
    --bw-muted: #6B776E;
    --bw-border: #E1E8E0;
    --bw-bg: #F7F9F6;
    --bw-white: #FFFFFF;
    --bw-success: #168653;
    --bw-danger: #D93645;
    --bw-warning: #B7791F;
    --bw-info: #2563EB;
    --bw-radius: 14px;
    --bw-radius-sm: 9px;
    --bw-shadow: 0 5px 22px rgba(25, 45, 25, 0.055);
    --bw-transition: 0.2s ease;
}

/* ===================== BASE ===================== */

.bw-page,
.bw-page * {
    box-sizing: border-box;
}

.bw-page {
    width: 100%;
    max-width: 1440px;
    min-width: 0;
    margin: 0 auto;
    padding: 28px;
    color: var(--bw-text);
    font-family: inherit;
    font-size: 15px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.bw-page button,
.bw-page input,
.bw-page select,
.bw-page textarea {
    font: inherit;
}

.bw-page button {
    cursor: pointer;
    transition:
        background var(--bw-transition),
        border-color var(--bw-transition),
        color var(--bw-transition),
        box-shadow var(--bw-transition),
        transform var(--bw-transition);
}

.bw-page button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    transform: none;
    box-shadow: none;
}

.bw-page [hidden] {
    display: none !important;
}

.bw-page button:focus-visible,
.bw-page input:focus-visible,
.bw-page select:focus-visible,
.bw-page textarea:focus-visible,
.bw-page summary:focus-visible {
    outline: 3px solid rgba(124, 185, 71, 0.3);
    outline-offset: 3px;
}

/* ===================== PAGE HEADER ===================== */

.bw-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 26px;
}

.bw-page-header>div {
    min-width: 0;
}

.bw-eyebrow {
    margin: 0 0 9px;
    color: var(--bw-primary-dark);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.5px;
    line-height: 1.5;
}

.bw-page-header h1 {
    margin: 0 0 10px;
    color: var(--bw-text);
    font-size: clamp(28px, 3vw, 36px);
    font-weight: 800;
    letter-spacing: -0.8px;
    line-height: 1.2;
}

.bw-page-header p:not(.bw-eyebrow) {
    max-width: 750px;
    margin: 0;
    color: var(--bw-muted);
    font-size: 14px;
    line-height: 1.8;
}

/* ===================== ALERT ===================== */

.bw-alert {
    margin: 0 0 22px;
    padding: 14px 17px;
    border: 1px solid #C9D8EC;
    border-radius: 10px;
    background: #F3F7FD;
    color: #244B83;
    font-size: 13px;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.bw-alert:empty {
    display: none;
}

.bw-alert.success {
    border-color: #B9E2CA;
    background: #F0FBF4;
    color: #176B40;
}

.bw-alert.error {
    border-color: #F2C3C7;
    background: #FFF4F4;
    color: #A52632;
}

.bw-alert.warning {
    border-color: #F0D8A8;
    background: #FFFAED;
    color: #855B13;
}

.bw-alert.info {
    border-color: #C9D8EC;
    background: #F3F7FD;
    color: #244B83;
}

/* ===================== SUMMARY CARDS ===================== */

.bw-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 17px;
    margin-bottom: 25px;
}

.bw-stat-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 7px;
    min-width: 0;
    min-height: 130px;
    padding: 21px;
    border: 1px solid var(--bw-border);
    border-radius: var(--bw-radius);
    background: var(--bw-white);
    box-shadow: var(--bw-shadow);
    transition:
        border-color var(--bw-transition),
        box-shadow var(--bw-transition),
        transform var(--bw-transition);
}

.bw-stat-card:hover {
    border-color: #D0E2C4;
    box-shadow: 0 8px 25px rgba(25, 45, 25, 0.075);
    transform: translateY(-2px);
}

.bw-stat-card>span {
    color: var(--bw-muted);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.6;
}

.bw-stat-card>strong {
    max-width: 100%;
    color: var(--bw-text);
    font-size: clamp(22px, 2.2vw, 29px);
    font-weight: 800;
    letter-spacing: -0.6px;
    line-height: 1.35;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.bw-stat-card>small {
    color: var(--bw-muted);
    font-size: 11px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

/* ===================== STEP NAVIGATION ===================== */

.bw-step-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 9px;
    margin-bottom: 24px;
    padding: 7px;
    border: 1px solid var(--bw-border);
    border-radius: 12px;
    background: var(--bw-white);
}

.bw-step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--bw-muted);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.5;
    text-align: center;
    overflow-wrap: anywhere;
}

.bw-step-indicator.is-active {
    border-color: #D5E7C7;
    background: var(--bw-primary-light);
    color: var(--bw-primary-dark);
}

.bw-step-indicator.is-complete {
    color: var(--bw-success);
}

/* ===================== CAMPAIGN FORM ===================== */

#bulkCampaignForm {
    display: flex;
    flex-direction: column;
    gap: 23px;
    min-width: 0;
    margin: 0;
}

/* ===================== PANELS ===================== */

.bw-panel {
    min-width: 0;
    padding: 26px;
    border: 1px solid var(--bw-border);
    border-radius: var(--bw-radius);
    background: var(--bw-white);
    box-shadow: var(--bw-shadow);
    scroll-margin-top: 24px;
}

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

.bw-panel-heading>div {
    min-width: 0;
}

.bw-step-label {
    display: inline-block;
    margin-bottom: 7px;
    color: var(--bw-primary-dark);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.4px;
}

.bw-panel-heading h2 {
    margin: 0 0 7px;
    color: var(--bw-text);
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -0.35px;
    line-height: 1.4;
}

.bw-panel-heading p {
    max-width: 760px;
    margin: 0;
    color: var(--bw-muted);
    font-size: 13px;
    line-height: 1.8;
}

.bw-panel-heading>.bw-button {
    flex-shrink: 0;
}

/* ===================== BUTTONS ===================== */

.bw-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    max-width: 100%;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 750;
    line-height: 1.5;
    text-align: center;
    overflow-wrap: anywhere;
}

.bw-button-primary {
    border-color: var(--bw-primary);
    background: var(--bw-primary);
    color: #FFFFFF;
    box-shadow: 0 3px 9px rgba(124, 185, 71, 0.15);
}

.bw-button-primary:hover:not(:disabled) {
    border-color: var(--bw-primary-dark);
    background: var(--bw-primary-dark);
    box-shadow: 0 5px 13px rgba(100, 155, 53, 0.2);
    transform: translateY(-1px);
}

.bw-button-secondary {
    border-color: var(--bw-border);
    background: #FFFFFF;
    color: #344238;
}

.bw-button-secondary:hover:not(:disabled) {
    border-color: #C4D7B8;
    background: var(--bw-primary-light);
    color: var(--bw-primary-dark);
}

.bw-button:active:not(:disabled) {
    transform: translateY(0);
}

/* ===================== FORM LABELS ===================== */

.bw-field-label {
    display: block;
    margin: 19px 0 8px;
    color: #344238;
    font-size: 12px;
    font-weight: 750;
    line-height: 1.6;
}

.bw-panel-heading+.bw-field-label {
    margin-top: 0;
}

/* ===================== INPUTS ===================== */

.bw-page input:not([type="checkbox"]):not([type="file"]),
.bw-page select,
.bw-page textarea {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: 11px 13px;
    border: 1px solid #DCE4DC;
    border-radius: var(--bw-radius-sm);
    background: #FFFFFF;
    color: var(--bw-text);
    font-size: 13px;
    line-height: 1.6;
    transition:
        border-color var(--bw-transition),
        box-shadow var(--bw-transition);
}

.bw-page input:not([type="checkbox"]):not([type="file"]),
.bw-page select {
    min-height: 45px;
}

.bw-page textarea {
    min-height: 105px;
    resize: vertical;
}

.bw-page input::placeholder,
.bw-page textarea::placeholder {
    color: #9AA49B;
    opacity: 1;
}

.bw-page input:focus,
.bw-page select:focus,
.bw-page textarea:focus {
    border-color: var(--bw-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(124, 185, 71, 0.12);
}

.bw-page input:disabled,
.bw-page select:disabled,
.bw-page textarea:disabled {
    cursor: not-allowed;
    background: #F1F3F1;
    color: #89938A;
}

.bw-page select option {
    color: var(--bw-text);
}

/* ===================== CSV FILE INPUT ===================== */

.bw-page input[type="file"] {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 12px;
    border: 1px dashed #B9CBB0;
    border-radius: 10px;
    background: #FAFCF8;
    color: var(--bw-muted);
    font-size: 12px;
    line-height: 1.7;
}

.bw-page input[type="file"]::file-selector-button {
    margin: 0 12px 0 0;
    padding: 8px 12px;
    border: 1px solid #D3E3C7;
    border-radius: 7px;
    background: var(--bw-primary-light);
    color: var(--bw-primary-dark);
    font: inherit;
    font-weight: 750;
    cursor: pointer;
}

.bw-page input[type="file"]::file-selector-button:hover {
    background: #E5F1DA;
}

/* ===================== HELP TEXT ===================== */

.bw-help {
    margin: 8px 0 0;
    color: var(--bw-muted);
    font-size: 11px;
    line-height: 1.8;
    overflow-wrap: anywhere;
}

/* ===================== ACTION BUTTON GROUPS ===================== */

.bw-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    min-width: 0;
    margin-top: 19px;
}

.bw-actions .bw-button {
    flex-shrink: 0;
}

/* ===================== IMPORT SUMMARY ===================== */

.bw-import-summary {
    min-width: 0;
    margin-top: 21px;
    padding: 17px;
    border: 1px solid var(--bw-border);
    border-radius: 10px;
    background: #FAFCF8;
    overflow-wrap: anywhere;
}

.bw-import-summary>*:first-child {
    margin-top: 0;
}

.bw-import-summary>*:last-child {
    margin-bottom: 0;
}

.bw-import-summary strong {
    color: var(--bw-text);
}

.bw-import-summary p {
    margin: 7px 0;
    color: var(--bw-muted);
    font-size: 12px;
    line-height: 1.7;
}

/* ===================== TABLES ===================== */

.bw-table-wrap {
    width: 100%;
    min-width: 0;
    margin-top: 21px;
    border: 1px solid var(--bw-border);
    border-radius: 11px;
    background: #FFFFFF;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
}

.bw-table-wrap h3 {
    margin: 0;
    padding: 17px 18px 12px;
    color: var(--bw-text);
    font-size: 16px;
    font-weight: 800;
}

.bw-table {
    width: 100%;
    min-width: 590px;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
    text-align: left;
}

.bw-table th,
.bw-table td {
    padding: 13px 15px;
    border-bottom: 1px solid #EDF0ED;
    vertical-align: middle;
    overflow-wrap: anywhere;
}

.bw-table th {
    background: #F7F9F6;
    color: #526054;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.45px;
    white-space: nowrap;
}

.bw-table td {
    color: #344238;
}

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

.bw-table tbody tr:hover {
    background: #FAFCF8;
}

/* ===================== TEMPLATE PREVIEW ===================== */

.bw-template-preview {
    min-width: 0;
    margin-top: 17px;
    padding: 18px;
    border: 1px solid var(--bw-border);
    border-radius: 11px;
    background: #F7F9F6;
    overflow-wrap: anywhere;
}

.bw-template-preview>*:first-child {
    margin-top: 0;
}

.bw-template-preview>*:last-child {
    margin-bottom: 0;
}

.bw-template-preview p {
    margin: 7px 0;
    color: #465447;
    font-size: 12px;
    line-height: 1.8;
    overflow-wrap: anywhere;
}

.bw-template-preview h3,
.bw-template-preview h4 {
    margin: 0 0 8px;
    color: var(--bw-text);
    font-size: 15px;
    font-weight: 800;
}

.bw-template-preview button {
    max-width: 100%;
    margin: 6px 5px 0 0;
    padding: 7px 10px;
    border: 1px solid var(--bw-border);
    border-radius: 7px;
    background: #FFFFFF;
    color: var(--bw-text);
    font-size: 11px;
    overflow-wrap: anywhere;
}

/* ===================== ADVANCED COMPONENTS ===================== */

.bw-advanced {
    min-width: 0;
    margin-top: 22px;
    border: 1px solid var(--bw-border);
    border-radius: 11px;
    background: #FFFFFF;
    overflow: hidden;
}

.bw-advanced summary {
    padding: 15px 17px;
    background: #F7F9F6;
    color: var(--bw-text);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.6;
    cursor: pointer;
}

.bw-advanced summary:hover {
    background: var(--bw-primary-light);
}

.bw-advanced[open] summary {
    border-bottom: 1px solid var(--bw-border);
}

.bw-advanced>.bw-field-label,
.bw-advanced>textarea,
.bw-advanced>.bw-help {
    width: calc(100% - 34px);
    margin-right: 17px;
    margin-left: 17px;
}

.bw-advanced>.bw-field-label {
    margin-top: 17px;
}

.bw-advanced>textarea {
    margin-top: 0;
}

.bw-advanced>.bw-help {
    margin-top: 8px;
    margin-bottom: 18px;
}

#templateVariables,
#templateComponents {
    font-size: 12px;
}

#templateComponents {
    font-family: Consolas, "Courier New", monospace;
    line-height: 1.7;
    tab-size: 2;
}

/* ===================== REVIEW AND COST GRID ===================== */

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

.bw-review-grid>div {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    min-width: 0;
    min-height: 105px;
    padding: 17px;
    border: 1px solid var(--bw-border);
    border-radius: 10px;
    background: #FAFCF8;
}

.bw-review-grid>div>span {
    color: var(--bw-muted);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.7;
}

.bw-review-grid>div>strong {
    color: var(--bw-text);
    font-size: 19px;
    font-weight: 800;
    line-height: 1.5;
    overflow-wrap: anywhere;
    font-variant-numeric: tabular-nums;
}

#reviewStatus {
    color: var(--bw-primary-dark);
}

#recalculateBtn {
    max-width: 100%;
}

/* ===================== CONSENT ===================== */

.bw-consent {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 22px;
    padding: 17px;
    border: 1px solid var(--bw-border);
    border-radius: 10px;
    background: #FAFCF8;
    color: #455247;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.8;
    cursor: pointer;
}

.bw-consent input[type="checkbox"] {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    margin: 3px 0 0;
    accent-color: var(--bw-primary-dark);
    cursor: pointer;
}

.bw-consent span {
    min-width: 0;
}

/* ===================== ESTIMATE WARNING ===================== */

.bw-warning {
    margin-top: 18px;
    padding: 14px 16px;
    border: 1px solid #F0D8A8;
    border-radius: 9px;
    background: #FFFAED;
    color: #855B13;
    font-size: 12px;
    line-height: 1.8;
    overflow-wrap: anywhere;
}

/* ===================== CAMPAIGN STATUS ===================== */

.bw-campaign-status {
    min-width: 0;
    margin-top: 22px;
    padding: 18px;
    border: 1px solid var(--bw-border);
    border-radius: 11px;
    background: #FAFCF8;
    overflow-wrap: anywhere;
}

.bw-campaign-status>*:first-child {
    margin-top: 0;
}

.bw-campaign-status>*:last-child {
    margin-bottom: 0;
}

.bw-campaign-status p {
    margin: 7px 0;
    color: var(--bw-muted);
    font-size: 12px;
    line-height: 1.8;
}

.bw-campaign-status strong {
    color: var(--bw-text);
}

.bw-campaign-status h3,
.bw-campaign-status h4 {
    margin: 0 0 9px;
    color: var(--bw-text);
    font-size: 15px;
    font-weight: 800;
}

/* ===================== PROGRESS BAR ===================== */

.bw-progress-track {
    width: 100%;
    height: 11px;
    margin-top: 20px;
    border-radius: 999px;
    background: #E9EEE6;
    overflow: hidden;
}

.bw-progress-bar {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--bw-primary);
    transition: width 0.35s ease;
}

#campaignProgressText {
    margin-top: 8px;
}

/* ===================== FOOTER ===================== */

.bw-footer {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px 25px;
    margin-top: 27px;
    padding: 20px 2px 0;
    border-top: 1px solid var(--bw-border);
}

.bw-footer p {
    margin: 0;
    color: var(--bw-muted);
    font-size: 11px;
    line-height: 1.8;
}

.bw-footer p:first-child {
    color: #465447;
    font-weight: 750;
}




.bw-detail-summary {
    margin-top: 16px;
}

.bw-detail-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.bw-detail-stats>div {
    padding: 14px;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 10px;
    overflow-wrap: anywhere;
}

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

.bw-detail-table {
    width: 100%;
    border-collapse: collapse;
}

.bw-detail-table th,
.bw-detail-table td {
    padding: 10px;
    border-bottom: 1px solid var(--border-color, #ddd);
    text-align: left;
    overflow-wrap: anywhere;
}

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

/* ===================== TABLET ===================== */

@media (max-width: 900px) {
    .bw-page {
        padding: 22px;
    }

    .bw-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 13px;
    }

    .bw-stat-card {
        min-height: 115px;
        padding: 18px;
    }

    .bw-stat-card>strong {
        font-size: 26px;
    }

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

    .bw-panel {
        padding: 22px;
    }
}

/* ===================== SMALL TABLETS ===================== */

@media (max-width: 650px) {
    .bw-page {
        padding: 18px;
    }

    .bw-page-header h1 {
        font-size: 29px;
    }

    .bw-step-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
    }

    .bw-step-indicator {
        min-height: 44px;
        padding: 9px 7px;
        font-size: 11px;
    }

    .bw-panel {
        padding: 18px;
    }

    .bw-panel-heading {
        gap: 12px;
    }

    .bw-panel-heading h2 {
        font-size: 19px;
    }

    .bw-actions {
        gap: 9px;
    }

    .bw-actions .bw-button {
        flex-shrink: 1;
    }

    .bw-footer {
        flex-direction: column;
        gap: 8px;
    }
}

/* ===================== MOBILE ===================== */

@media (max-width: 480px) {
    .bw-page {
        padding: 14px;
        font-size: 14px;
    }

    .bw-page-header {
        margin-bottom: 20px;
    }

    .bw-eyebrow {
        font-size: 10px;
        letter-spacing: 1.2px;
    }

    .bw-page-header h1 {
        margin-bottom: 8px;
        font-size: 27px;
        letter-spacing: -0.5px;
    }

    .bw-page-header p:not(.bw-eyebrow) {
        font-size: 12px;
        line-height: 1.8;
    }

    .bw-alert {
        margin-bottom: 17px;
        padding: 12px;
        font-size: 12px;
    }

    .bw-stats {
        gap: 9px;
        margin-bottom: 19px;
    }

    .bw-stat-card {
        min-height: 101px;
        gap: 6px;
        padding: 12px;
        border-radius: 10px;
    }

    .bw-stat-card:hover {
        transform: none;
    }

    .bw-stat-card>span {
        font-size: 10px;
        line-height: 1.6;
    }

    .bw-stat-card>strong {
        font-size: clamp(18px, 5.5vw, 24px);
        letter-spacing: -0.4px;
    }

    .bw-stat-card>small {
        font-size: 10px;
        line-height: 1.5;
    }

    .bw-step-nav {
        gap: 5px;
        margin-bottom: 17px;
        padding: 5px;
        border-radius: 10px;
    }

    .bw-step-indicator {
        min-height: 43px;
        padding: 7px 4px;
        font-size: 10px;
        line-height: 1.5;
    }

    #bulkCampaignForm {
        gap: 16px;
    }

    .bw-panel {
        padding: 15px;
        border-radius: 11px;
    }

    .bw-panel-heading {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 19px;
    }

    .bw-step-label {
        margin-bottom: 5px;
        font-size: 10px;
    }

    .bw-panel-heading h2 {
        margin-bottom: 7px;
        font-size: 19px;
    }

    .bw-panel-heading p {
        font-size: 12px;
        line-height: 1.8;
    }

    .bw-panel-heading>.bw-button {
        width: 100%;
    }

    .bw-button {
        min-height: 44px;
        padding: 10px 12px;
        font-size: 12px;
    }

    .bw-field-label {
        margin-top: 16px;
        margin-bottom: 7px;
        font-size: 12px;
    }

    .bw-page input:not([type="checkbox"]):not([type="file"]),
    .bw-page select,
    .bw-page textarea {
        padding: 10px 11px;
        border-radius: 8px;
        font-size: 12px;
    }

    .bw-page input:not([type="checkbox"]):not([type="file"]),
    .bw-page select {
        min-height: 44px;
    }

    .bw-page textarea {
        min-height: 95px;
    }

    .bw-page input[type="file"] {
        padding: 9px;
        font-size: 11px;
    }

    .bw-page input[type="file"]::file-selector-button {
        margin: 0 8px 5px 0;
        padding: 7px 9px;
        font-size: 11px;
    }

    .bw-help {
        font-size: 10px;
        line-height: 1.8;
    }

    .bw-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        margin-top: 16px;
    }

    .bw-actions .bw-button {
        width: 100%;
        flex-shrink: 1;
    }

    .bw-import-summary {
        margin-top: 15px;
        padding: 13px;
    }

    .bw-table-wrap {
        margin-top: 15px;
        border-radius: 9px;
    }

    .bw-table-wrap h3 {
        padding: 13px 12px 10px;
        font-size: 14px;
    }

    .bw-table {
        min-width: 520px;
        font-size: 11px;
    }

    .bw-table th,
    .bw-table td {
        padding: 10px 11px;
    }

    .bw-template-preview {
        margin-top: 13px;
        padding: 13px;
    }

    .bw-template-preview p {
        font-size: 11px;
    }

    .bw-template-preview h3,
    .bw-template-preview h4 {
        font-size: 14px;
    }

    .bw-advanced {
        margin-top: 17px;
    }

    .bw-advanced summary {
        padding: 13px;
        font-size: 11px;
    }

    .bw-advanced>.bw-field-label,
    .bw-advanced>textarea,
    .bw-advanced>.bw-help {
        width: calc(100% - 24px);
        margin-right: 12px;
        margin-left: 12px;
    }

    .bw-advanced>.bw-field-label {
        margin-top: 14px;
    }

    .bw-advanced>.bw-help {
        margin-bottom: 14px;
    }

    #templateVariables,
    #templateComponents {
        font-size: 11px;
    }

    .bw-review-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin-bottom: 17px;
    }

    .bw-review-grid>div {
        min-height: 90px;
        gap: 6px;
        padding: 11px;
        border-radius: 9px;
    }

    .bw-review-grid>div>span {
        font-size: 10px;
        line-height: 1.6;
    }

    .bw-review-grid>div>strong {
        font-size: 16px;
        line-height: 1.5;
    }

    #recalculateBtn {
        width: 100%;
    }

    .bw-consent {
        gap: 10px;
        margin-top: 17px;
        padding: 12px;
        font-size: 11px;
        line-height: 1.8;
    }

    .bw-consent input[type="checkbox"] {
        flex-basis: 17px;
        width: 17px;
        height: 17px;
    }

    .bw-warning {
        margin-top: 14px;
        padding: 12px;
        font-size: 11px;
    }

    .bw-campaign-status {
        margin-top: 17px;
        padding: 13px;
        font-size: 12px;
    }

    .bw-campaign-status p {
        font-size: 11px;
    }

    .bw-progress-track {
        height: 9px;
        margin-top: 17px;
    }

    #campaignProgressText {
        font-size: 10px;
    }

    .bw-footer {
        gap: 7px;
        margin-top: 21px;
        padding-top: 15px;
    }

    .bw-footer p {
        font-size: 10px;
    }
}

/* ===================== EXTRA SMALL PHONES ===================== */

@media (max-width: 360px) {
    .bw-page {
        padding: 10px;
    }

    .bw-page-header h1 {
        font-size: 25px;
    }

    .bw-stats {
        gap: 7px;
    }

    .bw-stat-card {
        min-height: 95px;
        padding: 9px;
    }

    .bw-stat-card>span {
        font-size: 9px;
    }

    .bw-stat-card>strong {
        font-size: 19px;
    }

    .bw-stat-card>small {
        font-size: 9px;
    }

    .bw-step-indicator {
        padding: 7px 3px;
        font-size: 9px;
    }

    .bw-panel {
        padding: 12px;
    }

    .bw-panel-heading h2 {
        font-size: 18px;
    }

    .bw-review-grid {
        gap: 7px;
    }

    .bw-review-grid>div {
        min-height: 85px;
        padding: 9px;
    }

    .bw-review-grid>div>span {
        font-size: 9px;
    }

    .bw-review-grid>div>strong {
        font-size: 14px;
    }

    .bw-consent {
        padding: 10px;
    }
}

/* ===================== REDUCED MOTION ===================== */

@media (prefers-reduced-motion: reduce) {

    .bw-page *,
    .bw-page *::before,
    .bw-page *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}










/* =========================================================
   ADTHRIVE MEDIA — TRACK CAMPAIGN MESSAGES
   Complete Responsive CSS
   Desktop • Tablet • Mobile
   Brand Color: #7CB947
   ========================================================= */

:root {
    --primary: #7CB947;
    --primary-dark: #639936;
    --primary-light: #F0F7E9;
    --text: #202B24;
    --muted: #6B776E;
    --border: #E1E8E0;
    --background: #F7F9F6;
    --white: #FFFFFF;
    --success: #168653;
    --success-bg: #F0FBF4;
    --danger: #D93645;
    --danger-bg: #FFF4F4;
    --warning: #B7791F;
    --warning-bg: #FFFAED;
    --info: #2563EB;
    --info-bg: #F3F7FD;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 5px 22px rgba(25, 45, 25, 0.055);
    --transition: 0.2s ease;
}

/* ==================== RESET & BASE ==================== */

.page,
.page * {
    box-sizing: border-box;
}

.page {
    width: 100%;
    max-width: 1440px;
    min-width: 0;
    margin: 0 auto;
    padding: 28px;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.page button,
.page input,
.page select {
    font: inherit;
}

.page button {
    cursor: pointer;
    transition:
        background var(--transition),
        border-color var(--transition),
        color var(--transition),
        box-shadow var(--transition),
        transform var(--transition);
}

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

.page [hidden] {
    display: none !important;
}

.page button:focus-visible,
.page input:focus-visible,
.page select:focus-visible {
    outline: 3px solid rgba(124, 185, 71, 0.3);
    outline-offset: 3px;
}

/* ==================== ALERT ==================== */

.alert {
    margin: 0 0 22px;
    padding: 14px 17px;
    border: 1px solid #C9D8EC;
    border-radius: 10px;
    background: var(--info-bg);
    color: #244B83;
    font-size: 13px;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.alert:empty {
    display: none;
}

.alert.success {
    border-color: #B9E2CA;
    background: var(--success-bg);
    color: #176B40;
}

.alert.error {
    border-color: #F2C3C7;
    background: var(--danger-bg);
    color: #A52632;
}

.alert.warning {
    border-color: #F0D8A8;
    background: var(--warning-bg);
    color: #855B13;
}

.alert.info {
    border-color: #C9D8EC;
    background: var(--info-bg);
    color: #244B83;
}

/* ==================== SUMMARY STATS ==================== */

.stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 17px;
    margin-bottom: 26px;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 8px;
    min-width: 0;
    min-height: 125px;
    padding: 21px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--white);
    box-shadow: var(--shadow);
    transition:
        border-color var(--transition),
        box-shadow var(--transition),
        transform var(--transition);
}

.stat:hover {
    border-color: #D0E2C4;
    box-shadow: 0 8px 25px rgba(25, 45, 25, 0.075);
    transform: translateY(-2px);
}

.stat>span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.6;
}

.stat>strong {
    max-width: 100%;
    color: var(--text);
    font-size: clamp(25px, 2.5vw, 32px);
    font-weight: 800;
    letter-spacing: -0.7px;
    line-height: 1.35;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

/* ==================== PANELS ==================== */

.panel {
    min-width: 0;
    margin-bottom: 24px;
    padding: 25px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--white);
    box-shadow: var(--shadow);
    scroll-margin-top: 24px;
}

.panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 22px;
    margin-bottom: 23px;
}

.panel-heading>div {
    min-width: 0;
}

.panel-heading h2 {
    margin: 0 0 8px;
    color: var(--text);
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -0.35px;
    line-height: 1.4;
}

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

/* ==================== SEARCH LABELS ==================== */

.search-label,
.filters label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    color: #344238;
    font-size: 12px;
    font-weight: 750;
    line-height: 1.6;
}

.search-label {
    flex: 0 1 300px;
    width: 100%;
    max-width: 300px;
}

.page input[type="search"],
.page input[type="text"],
.page select {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 44px;
    padding: 10px 13px;
    border: 1px solid #DCE4DC;
    border-radius: var(--radius-sm);
    background: #FFFFFF;
    color: var(--text);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.5;
    transition:
        border-color var(--transition),
        box-shadow var(--transition);
}

.page input::placeholder {
    color: #9AA49B;
    opacity: 1;
}

.page input[type="search"]:focus,
.page input[type="text"]:focus,
.page select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(124, 185, 71, 0.12);
}

.page select:disabled,
.page input:disabled {
    cursor: not-allowed;
    background: #F1F3F1;
    color: #89938A;
}

/* ==================== TABLE WRAPPER ==================== */

.table-wrap {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #FFFFFF;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
}

.table-wrap table {
    width: 100%;
    min-width: 820px;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
    text-align: left;
}

/* ==================== TABLE HEADERS ==================== */

.table-wrap thead th {
    padding: 14px 15px;
    border-bottom: 1px solid var(--border);
    background: #F7F9F6;
    color: #526054;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.45px;
    line-height: 1.6;
    white-space: nowrap;
}

/* ==================== TABLE CELLS ==================== */

.table-wrap tbody td {
    padding: 14px 15px;
    border-bottom: 1px solid #EDF0ED;
    color: #344238;
    font-size: 12px;
    line-height: 1.7;
    vertical-align: middle;
    overflow-wrap: anywhere;
}

.table-wrap tbody tr:last-child td {
    border-bottom: none;
}

.table-wrap tbody tr:hover {
    background: #FAFCF8;
}

/* ==================== EMPTY TABLE STATE ==================== */

.table-wrap td.empty {
    padding: 35px 18px;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
    line-height: 1.8;
}

/* ==================== TABLE BUTTONS ==================== */

.page .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 36px;
    max-width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--primary);
    border-radius: 8px;
    background: var(--primary);
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 750;
    line-height: 1.5;
    text-align: center;
    overflow-wrap: anywhere;
}

.page .button:hover:not(:disabled) {
    border-color: var(--primary-dark);
    background: var(--primary-dark);
    box-shadow: 0 3px 9px rgba(99, 153, 54, 0.16);
}

.page .button.secondary {
    border-color: var(--border);
    background: #FFFFFF;
    color: #344238;
}

.page .button.secondary:hover:not(:disabled) {
    border-color: #C4D7B8;
    background: var(--primary-light);
    color: var(--primary-dark);
}

/* ==================== STATUS BADGES ==================== */

.status-badge,
.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    padding: 5px 9px;
    border: 1px solid #DCE4DC;
    border-radius: 999px;
    background: #F5F7F4;
    color: #526054;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.4;
    text-align: center;
    overflow-wrap: anywhere;
}

/* Optional status classes for badges generated by JavaScript */

.status-badge.success,
.status-pill.success,
.status-badge.delivered,
.status-pill.delivered,
.status-badge.read,
.status-pill.read {
    border-color: #B9E2CA;
    background: var(--success-bg);
    color: #176B40;
}

.status-badge.failed,
.status-pill.failed,
.status-badge.error,
.status-pill.error {
    border-color: #F2C3C7;
    background: var(--danger-bg);
    color: #A52632;
}

.status-badge.pending,
.status-pill.pending,
.status-badge.queued,
.status-pill.queued {
    border-color: #F0D8A8;
    background: var(--warning-bg);
    color: #855B13;
}

.status-badge.sent,
.status-pill.sent {
    border-color: #C9D8EC;
    background: var(--info-bg);
    color: #244B83;
}

.status-badge.skipped,
.status-pill.skipped {
    border-color: #E1E5E0;
    background: #F3F4F3;
    color: #687168;
}

/* ==================== DETAILS PANEL ==================== */

#detailsPanel {
    scroll-margin-top: 20px;
}

#detailsPanel .panel-heading {
    align-items: center;
}

#detailsTitle {
    overflow-wrap: anywhere;
}

#detailsMeta {
    margin-top: 5px;
    overflow-wrap: anywhere;
}

/* ==================== DETAIL STATS ==================== */

.detail-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 13px;
    margin-bottom: 24px;
}

.detail-stats .stat {
    min-height: 95px;
    padding: 16px;
    border-radius: 11px;
    box-shadow: none;
}

.detail-stats .stat:hover {
    box-shadow: none;
    transform: none;
}

.detail-stats .stat>span {
    font-size: 11px;
}

.detail-stats .stat>strong {
    font-size: 24px;
}

/* ==================== RECIPIENT FILTERS ==================== */

.filters {
    display: grid;
    grid-template-columns: minmax(180px, 0.8fr) minmax(220px, 1.2fr) auto;
    align-items: end;
    gap: 16px;
    margin: 0 0 20px;
    padding: 17px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #FAFCF8;
}

.filters label {
    width: 100%;
}

.filters .muted {
    align-self: center;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

/* ==================== NOTE ==================== */

.note {
    margin: 17px 0 0;
    padding: 13px 15px;
    border: 1px solid #DCE7D4;
    border-radius: 9px;
    background: #F7FAF3;
    color: #596957;
    font-size: 11px;
    line-height: 1.8;
    overflow-wrap: anywhere;
}

/* ==================== FOOTER ==================== */

.page>footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 26px;
    padding: 20px 2px 0;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 11px;
    line-height: 1.8;
}

.page>footer::first-line {
    font-weight: 600;
}

/* ==================== TABLET ==================== */

@media (max-width: 900px) {
    .page {
        padding: 22px;
    }

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

    .stat {
        min-height: 110px;
        padding: 18px;
    }

    .stat>strong {
        font-size: 28px;
    }

    .panel {
        padding: 21px;
    }

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

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

    .filters .muted {
        grid-column: 1 / -1;
    }

    .panel-heading {
        gap: 16px;
    }
}

/* ==================== SMALL TABLETS ==================== */

@media (max-width: 650px) {
    .page {
        padding: 17px;
    }

    .panel {
        padding: 17px;
    }

    .panel-heading {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        margin-bottom: 19px;
    }

    .panel-heading h2 {
        font-size: 19px;
    }

    .search-label {
        flex: 1 1 auto;
        width: 100%;
        max-width: none;
    }

    #detailsPanel .panel-heading {
        align-items: stretch;
    }

    #closeDetailsBtn {
        width: 100%;
    }

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

    .filters {
        gap: 12px;
        padding: 14px;
    }

    .page>footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }
}

/* ==================== MOBILE ==================== */

@media (max-width: 480px) {
    .page {
        padding: 13px;
        font-size: 13px;
    }

    .alert {
        margin-bottom: 17px;
        padding: 12px;
        font-size: 12px;
    }

    .stats {
        gap: 9px;
        margin-bottom: 19px;
    }

    .stat {
        min-height: 96px;
        gap: 6px;
        padding: 12px;
        border-radius: 10px;
    }

    .stat:hover {
        transform: none;
    }

    .stat>span {
        font-size: 10px;
    }

    .stat>strong {
        font-size: clamp(22px, 6vw, 27px);
        letter-spacing: -0.5px;
    }

    .panel {
        margin-bottom: 17px;
        padding: 14px;
        border-radius: 11px;
    }

    .panel-heading {
        gap: 13px;
        margin-bottom: 17px;
    }

    .panel-heading h2 {
        margin-bottom: 6px;
        font-size: 18px;
    }

    .panel-heading p {
        font-size: 12px;
        line-height: 1.8;
    }

    .search-label,
    .filters label {
        gap: 6px;
        font-size: 11px;
    }

    .page input[type="search"],
    .page input[type="text"],
    .page select {
        min-height: 43px;
        padding: 10px;
        font-size: 12px;
    }

    .table-wrap {
        border-radius: 9px;
    }

    .table-wrap table {
        min-width: 760px;
        font-size: 11px;
    }

    .table-wrap thead th {
        padding: 12px 11px;
        font-size: 10px;
    }

    .table-wrap tbody td {
        padding: 12px 11px;
        font-size: 11px;
    }

    .table-wrap td.empty {
        padding: 27px 13px;
        font-size: 12px;
    }

    .page .button {
        min-height: 35px;
        padding: 7px 10px;
        font-size: 10px;
    }

    .detail-stats {
        gap: 8px;
        margin-bottom: 18px;
    }

    .detail-stats .stat {
        min-height: 83px;
        gap: 5px;
        padding: 11px;
    }

    .detail-stats .stat>span {
        font-size: 10px;
    }

    .detail-stats .stat>strong {
        font-size: 21px;
    }

    .filters {
        grid-template-columns: minmax(0, 1fr);
        gap: 13px;
        margin-bottom: 16px;
        padding: 12px;
    }

    .filters .muted {
        grid-column: auto;
        align-self: start;
    }

    .note {
        margin-top: 13px;
        padding: 11px;
        font-size: 10px;
    }

    .page>footer {
        gap: 5px;
        margin-top: 20px;
        padding-top: 15px;
        font-size: 10px;
    }
}

/* ==================== EXTRA SMALL PHONES ==================== */

@media (max-width: 360px) {
    .page {
        padding: 10px;
    }

    .stats {
        gap: 7px;
    }

    .stat {
        min-height: 88px;
        padding: 9px;
    }

    .stat>span {
        font-size: 9px;
    }

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

    .panel {
        padding: 11px;
    }

    .panel-heading h2 {
        font-size: 17px;
    }

    .detail-stats {
        gap: 7px;
    }

    .detail-stats .stat {
        padding: 9px;
    }

    .detail-stats .stat>strong {
        font-size: 19px;
    }

    .filters {
        padding: 10px;
    }
}

/* ==================== REDUCED MOTION ==================== */

@media (prefers-reduced-motion: reduce) {

    .page *,
    .page *::before,
    .page *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}









/* =====================================================
   ADTHRIVE MEDIA
   CREATE WHATSAPP AUTOMATION - MAIN CONTENT CSS
   ===================================================== */

/* ---------- 1. CSS VARIABLES ---------- */

:root {
    --ca-primary: #7CB947;
    --ca-primary-hover: #659B35;
    --ca-primary-light: #F2F8EB;

    --ca-text: #182230;
    --ca-heading: #111827;
    --ca-muted: #64748B;

    --ca-border: #E2E8F0;
    --ca-border-hover: #CBD5E1;

    --ca-white: #FFFFFF;
    --ca-surface: #F8FAFC;
    --ca-disabled: #F1F5F9;

    --ca-success: #15803D;
    --ca-success-bg: #F0FDF4;
    --ca-danger: #DC2626;
    --ca-danger-bg: #FEF2F2;
    --ca-warning: #B45309;
    --ca-warning-bg: #FFFBEB;

    --ca-radius: 12px;
    --ca-shadow: 0 4px 20px rgba(15, 23, 42, 0.05);
    --ca-focus: 0 0 0 3px rgba(124, 185, 71, 0.18);
}

/* ---------- 2. MAIN CONTENT CONTAINER ---------- */

.container {
    display: block;
    width: 100%;
    max-width: 900px;
    min-width: 0;
    margin: 0 auto;
    padding: 32px 24px 48px;

    color: var(--ca-text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

/* Prevent overflow inside the main content */

.container *,
.container *::before,
.container *::after {
    box-sizing: border-box;
}

.container [hidden] {
    display: none !important;
}

/* ---------- 3. PAGE HEADER ---------- */

.page-header {
    display: block;
    width: 100%;
    margin: 0 0 28px;
}

.page-header h1 {
    margin: 0 0 10px;
    color: var(--ca-heading);

    font-size: 30px;
    font-weight: 750;
    line-height: 1.3;
    letter-spacing: -0.6px;

    overflow-wrap: anywhere;
}

.page-header p {
    max-width: 700px;
    margin: 0;

    color: var(--ca-muted);
    font-size: 15px;
    font-weight: 400;
    line-height: 1.8;
}

/* ---------- 4. MAIN FORM CARD ---------- */

.form-card {
    display: block;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 30px;

    background: var(--ca-white);
    border: 1px solid var(--ca-border);
    border-radius: 16px;

    box-shadow: var(--ca-shadow);
}

/* ---------- 5. FORM GROUPS ---------- */

.form-group {
    display: block;
    width: 100%;
    min-width: 0;
    margin: 0 0 24px;
}

.form-group label {
    display: block;
    margin: 0 0 9px;

    color: #334155;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.5;
}

/* ---------- 6. INPUTS, SELECTS AND TEXTAREAS ---------- */

.form-group input,
.form-group select,
.form-group textarea {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 46px;
    margin: 0;
    padding: 12px 14px;

    border: 1px solid var(--ca-border-hover);
    border-radius: 9px;

    outline: none;
    background: var(--ca-white);
    color: var(--ca-text);

    font-family: inherit;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background-color 0.2s ease;
}

/* Placeholder */

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #94A3B8;
    opacity: 1;
}

/* Hover */

.form-group input:hover:not(:disabled),
.form-group select:hover:not(:disabled),
.form-group textarea:hover:not(:disabled) {
    border-color: #A8B6C8;
}

/* Focus */

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--ca-primary);
    box-shadow: var(--ca-focus);
}

/* Disabled fields */

.form-group input:disabled,
.form-group select:disabled,
.form-group textarea:disabled {
    background: var(--ca-disabled);
    color: #94A3B8;
    border-color: var(--ca-border);
    cursor: not-allowed;
    opacity: 1;
}

/* Select dropdown */

.form-group select {
    cursor: pointer;
    padding-right: 35px;
}

.form-group select:disabled {
    cursor: not-allowed;
}

/* ---------- 7. TEXTAREA STYLING ---------- */

.form-group textarea {
    min-height: 110px;
    resize: vertical;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

#automationDescription {
    min-height: 105px;
}

#templateComponents {
    min-height: 145px;

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

    tab-size: 2;
}

/* ---------- 8. HELPER TEXT ---------- */

.form-group small {
    display: block;
    margin: 8px 0 0;

    color: var(--ca-muted);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.8;
}

/* ---------- 9. INBOUND / OUTBOUND FIELDS ---------- */

#inboundFields,
#outboundFields {
    display: block;
    width: 100%;
    min-width: 0;
}

#inboundFields .form-group,
#outboundFields .form-group {
    margin-bottom: 24px;
}

/* Respect HTML hidden attribute */

#outboundFields[hidden],
#inboundFields[hidden] {
    display: none !important;
}

/* ---------- 10. SECTION DIVIDER ---------- */

.form-card hr {
    display: block;
    width: 100%;
    height: 1px;
    margin: 28px 0;
    padding: 0;

    border: 0;
    background: var(--ca-border);
}

/* ---------- 11. WHATSAPP MESSAGE HEADING ---------- */

.form-card h2 {
    margin: 0 0 24px;

    color: var(--ca-heading);
    font-size: 20px;
    font-weight: 750;
    line-height: 1.4;
    letter-spacing: -0.2px;
}

/* ---------- 12. TEMPLATE PREVIEW ---------- */

#templatePreview {
    width: 100%;
    min-width: 0;
    padding: 16px;
    margin-bottom: 24px;

    border: 1px solid #D8E8C8;
    border-radius: 11px;

    background: #F7FBF2;
}

#templatePreview[hidden] {
    display: none !important;
}

#templatePreview label {
    margin: 0 0 10px;
    color: #416C25;
}

#templatePreviewText {
    display: block;
    width: 100%;
    min-height: 60px;
    margin: 0;
    padding: 15px;

    overflow-x: auto;
    overflow-y: auto;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    word-break: break-word;

    border: 1px solid var(--ca-border);
    border-radius: 8px;

    background: var(--ca-white);
    color: #334155;

    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.8;
}

/* ---------- 13. FORM STATUS MESSAGE ---------- */

#formMessage {
    display: block;
    width: 100%;
    min-width: 0;
    margin: 0;

    color: #334155;
    font-size: 13px;
    line-height: 1.7;

    overflow-wrap: anywhere;
    word-break: break-word;
}

#formMessage:empty {
    display: none;
}

#formMessage:not(:empty) {
    margin-bottom: 24px;
    padding: 13px 15px;

    border: 1px solid var(--ca-border);
    border-radius: 9px;

    background: var(--ca-surface);
}

/* Optional classes for JavaScript status messages */

#formMessage.success {
    border-color: #BBF7D0;
    background: var(--ca-success-bg);
    color: var(--ca-success);
}

#formMessage.error {
    border-color: #FECACA;
    background: var(--ca-danger-bg);
    color: var(--ca-danger);
}

#formMessage.warning {
    border-color: #FDE68A;
    background: var(--ca-warning-bg);
    color: var(--ca-warning);
}

/* ---------- 14. FORM ACTIONS CONTAINER ---------- */

.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 12px;

    width: 100%;
    margin: 30px 0 0;
    padding: 23px 0 0;

    border-top: 1px solid var(--ca-border);
}

/* ---------- 15. CREATE AUTOMATION BUTTON ---------- */

.form-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 180px;
    min-height: 46px;
    margin: 0;
    padding: 12px 22px;

    border: 1px solid var(--ca-primary);
    border-radius: 9px;

    background: var(--ca-primary);
    color: var(--ca-white);

    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.5;
    text-align: center;

    cursor: pointer;

    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.form-actions button:hover:not(:disabled) {
    border-color: var(--ca-primary-hover);
    background: var(--ca-primary-hover);

    box-shadow: 0 4px 12px rgba(101, 155, 53, 0.2);
    transform: translateY(-1px);
}

.form-actions button:active:not(:disabled) {
    transform: translateY(0);
}

.form-actions button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* ---------- 16. CANCEL LINK ---------- */

.form-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 90px;
    min-height: 46px;
    margin: 0;
    padding: 11px 20px;

    border: 1px solid var(--ca-border-hover);
    border-radius: 9px;

    background: var(--ca-white);
    color: #475569;

    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;

    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease;
}

.form-actions a:hover {
    border-color: #94A3B8;
    background: var(--ca-surface);
    color: var(--ca-heading);
}

/* ---------- 17. KEYBOARD ACCESSIBILITY ---------- */

.form-actions button:focus-visible,
.form-actions a:focus-visible {
    outline: 3px solid rgba(124, 185, 71, 0.35);
    outline-offset: 3px;
}

/* ---------- 18. TABLET RESPONSIVE ---------- */

@media (max-width: 768px) {
    .container {
        padding: 26px 18px 38px;
    }

    .page-header {
        margin-bottom: 24px;
    }

    .page-header h1 {
        font-size: 27px;
    }

    .page-header p {
        font-size: 14px;
    }

    .form-card {
        padding: 25px;
    }

    .form-card h2 {
        font-size: 19px;
    }
}

/* ---------- 19. MOBILE RESPONSIVE ---------- */

@media (max-width: 480px) {
    .container {
        padding: 20px 12px 30px;
    }

    .page-header {
        margin-bottom: 20px;
    }

    .page-header h1 {
        margin-bottom: 8px;
        font-size: 23px;
        letter-spacing: -0.3px;
    }

    .page-header p {
        font-size: 13px;
        line-height: 1.75;
    }

    .form-card {
        padding: 19px 15px;
        border-radius: 12px;
    }

    .form-group {
        margin-bottom: 20px;
    }

    .form-group label {
        margin-bottom: 8px;
        font-size: 13px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        min-height: 44px;
        padding: 11px 12px;
        font-size: 14px;
    }

    .form-group textarea {
        min-height: 100px;
    }

    .form-group small {
        font-size: 12px;
        line-height: 1.7;
    }

    #templateComponents {
        min-height: 120px;
        font-size: 12px;
    }

    .form-card hr {
        margin: 22px 0;
    }

    .form-card h2 {
        margin-bottom: 20px;
        font-size: 18px;
    }

    #templatePreview {
        padding: 12px;
    }

    #templatePreviewText {
        padding: 12px;
        font-size: 12px;
    }

    #formMessage:not(:empty) {
        margin-bottom: 20px;
        padding: 11px 12px;
        font-size: 12px;
    }

    .form-actions {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;

        margin-top: 23px;
        padding-top: 18px;
    }

    .form-actions button,
    .form-actions a {
        width: 100%;
        min-width: 0;
        min-height: 46px;
        margin: 0;
        padding: 12px 14px;
        font-size: 14px;
    }
}

/* ---------- 20. EXTRA SMALL MOBILE ---------- */

@media (max-width: 360px) {
    .container {
        padding-right: 8px;
        padding-left: 8px;
    }

    .page-header h1 {
        font-size: 21px;
    }

    .page-header p {
        font-size: 12px;
    }

    .form-card {
        padding: 16px 12px;
    }

    .form-card h2 {
        font-size: 17px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 10px;
        font-size: 13px;
    }

    .form-actions button,
    .form-actions a {
        padding: 11px 12px;
        font-size: 13px;
    }
}

/* ---------- 21. REDUCED MOTION ---------- */

@media (prefers-reduced-motion: reduce) {

    .container *,
    .container *::before,
    .container *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}




/* =========================================================
   ADTHRIVE MEDIA — MY AUTOMATIONS
   Complete responsive page stylesheet
   Brand: #7CB947
   Scope: .ma-page only
   ========================================================= */

.ma-page {
    --ma-green: #7CB947;
    --ma-green-dark: #639A35;
    --ma-green-light: #F0F7E9;
    --ma-text: #202B3C;
    --ma-muted: #718096;
    --ma-border: #E5EAF0;
    --ma-surface: #FFFFFF;
    --ma-background: #F7F9FC;
    --ma-danger: #DC3545;
    --ma-warning: #C88716;
    --ma-success: #25834F;

    width: 100%;
    min-width: 0;
    padding: 28px;
    color: var(--ma-text);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    box-sizing: border-box;
}

.ma-page *,
.ma-page *::before,
.ma-page *::after {
    box-sizing: border-box;
}

.ma-page [hidden] {
    display: none !important;
}

.ma-page h1,
.ma-page h2,
.ma-page h3,
.ma-page p {
    overflow-wrap: anywhere;
}

.ma-page button,
.ma-page input,
.ma-page select,
.ma-page textarea {
    font: inherit;
}

.ma-page button {
    cursor: pointer;
}

.ma-page button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.ma-page input,
.ma-page select,
.ma-page textarea {
    width: 100%;
    min-width: 0;
    color: var(--ma-text);
    background: #FFFFFF;
    border: 1px solid #DCE3EB;
    border-radius: 9px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ma-page input,
.ma-page select {
    min-height: 44px;
    padding: 10px 12px;
}

.ma-page textarea {
    min-height: 90px;
    padding: 11px 12px;
    resize: vertical;
}

.ma-page input::placeholder,
.ma-page textarea::placeholder {
    color: #9AA5B4;
}

.ma-page input:focus,
.ma-page select:focus,
.ma-page textarea:focus {
    border-color: var(--ma-green);
    box-shadow: 0 0 0 3px rgb(124 185 71 / 15%);
}

.ma-page input[readonly] {
    background: #F4F6F9;
    color: #657184;
}

.ma-page button:focus-visible {
    outline: 3px solid rgb(124 185 71 / 35%);
    outline-offset: 3px;
}

/* =========================================================
   1. PAGE HEADER
   The supplied HTML has no .ma-header wrapper.
   ========================================================= */

.ma-page>div:first-child {
    margin-bottom: 26px;
}

.ma-page>div:first-child .ma-eyebrow {
    margin: 0 0 5px;
    color: var(--ma-green-dark);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.7px;
}

.ma-page>div:first-child h1 {
    margin: 0;
    color: var(--ma-text);
    font-size: clamp(27px, 3vw, 34px);
    font-weight: 750;
    line-height: 1.3;
    letter-spacing: -0.7px;
}

.ma-page>div:first-child .ma-subtitle {
    margin: 8px 0 0;
    color: var(--ma-muted);
    font-size: 14px;
    line-height: 1.7;
}

/* Create button directly after the introductory div */

.ma-page>#maCreate {
    margin: 0 0 25px;
}

/* =========================================================
   2. BUTTONS
   ========================================================= */

.ma-page .ma-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 41px;
    padding: 9px 15px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    white-space: nowrap;
    text-decoration: none;
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.ma-page .ma-btn:not(:disabled):active {
    transform: translateY(1px);
}

.ma-page .ma-primary {
    color: #FFFFFF;
    background: var(--ma-green);
    border-color: var(--ma-green);
    box-shadow: 0 3px 8px rgb(124 185 71 / 15%);
}

.ma-page .ma-primary:hover:not(:disabled) {
    color: #FFFFFF;
    background: var(--ma-green-dark);
    border-color: var(--ma-green-dark);
    box-shadow: 0 5px 13px rgb(124 185 71 / 22%);
}

.ma-page .ma-secondary {
    color: #455267;
    background: #FFFFFF;
    border-color: #DCE3EB;
}

.ma-page .ma-secondary:hover:not(:disabled) {
    color: var(--ma-green-dark);
    background: var(--ma-green-light);
    border-color: #C4DDB0;
}

/* =========================================================
   3. NOTIFICATION
   ========================================================= */

.ma-page .ma-notice {
    margin: 0 0 20px;
    padding: 12px 15px;
    color: #426C25;
    background: #F0F8E9;
    border: 1px solid #D1E6BE;
    border-radius: 10px;
    font-size: 13px;
    overflow-wrap: anywhere;
}

.ma-page .ma-notice.error,
.ma-page .ma-notice.is-error {
    color: #A52D3B;
    background: #FFF0F1;
    border-color: #F1C5CB;
}

.ma-page .ma-notice.success,
.ma-page .ma-notice.is-success {
    color: #237344;
    background: #EDFAF2;
    border-color: #BCE5CA;
}

.ma-page .ma-notice.warning,
.ma-page .ma-notice.is-warning {
    color: #8C5B08;
    background: #FFF8E8;
    border-color: #F1DFAA;
}

/* =========================================================
   4. STATISTICS CARDS
   ========================================================= */

.ma-page .ma-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 17px;
    margin: 0 0 25px;
}

.ma-page .ma-stats article {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 137px;
    padding: 21px;
    overflow: hidden;
    background: var(--ma-surface);
    border: 1px solid var(--ma-border);
    border-radius: 14px;
    box-shadow: 0 3px 12px rgb(27 39 56 / 3%);
    transition: border-color 0.2s ease, box-shadow 0.2s ease,
        transform 0.2s ease;
}

.ma-page .ma-stats article::before {
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--ma-green);
    content: "";
}

.ma-page .ma-stats article:hover {
    transform: translateY(-2px);
    border-color: #CFE3BD;
    box-shadow: 0 8px 22px rgb(27 39 56 / 6%);
}

.ma-page .ma-stats article span {
    color: var(--ma-muted);
    font-size: 13px;
    font-weight: 600;
}

.ma-page .ma-stats article strong {
    margin: 9px 0 3px;
    color: var(--ma-text);
    font-size: 31px;
    font-weight: 800;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.ma-page .ma-stats article small {
    color: #929CAB;
    font-size: 11px;
}

/* =========================================================
   5. PANELS
   ========================================================= */

.ma-page .ma-panel {
    min-width: 0;
    margin: 0 0 24px;
    padding: 24px;
    background: var(--ma-surface);
    border: 1px solid var(--ma-border);
    border-radius: 14px;
    box-shadow: 0 3px 14px rgb(27 39 56 / 3%);
    scroll-margin-top: 24px;
}

.ma-page .ma-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.ma-page .ma-toolbar h2 {
    margin: 0;
    color: var(--ma-text);
    font-size: 19px;
    font-weight: 750;
    line-height: 1.4;
}

.ma-page .ma-toolbar p {
    margin: 5px 0 0;
    color: var(--ma-muted);
    font-size: 13px;
    line-height: 1.6;
}

/* =========================================================
   6. SEARCH AND FILTERS
   ========================================================= */

.ma-page .ma-filters {
    display: grid;
    grid-template-columns: minmax(220px, 1.6fr) repeat(2, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 22px;
    padding: 17px;
    background: #F8FAFC;
    border: 1px solid #EDF0F4;
    border-radius: 11px;
}

.ma-page .ma-filters label,
.ma-page .ma-form-grid>label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
    color: #455166;
    font-size: 12px;
    font-weight: 700;
}

.ma-page .ma-filters input,
.ma-page .ma-filters select {
    background-color: #FFFFFF;
}

/* =========================================================
   7. LOADING AND EMPTY STATES
   ========================================================= */

.ma-page .ma-state {
    padding: 35px 20px;
    color: var(--ma-muted);
    font-size: 13px;
    text-align: center;
}

.ma-page #maLoading {
    padding-top: 28px;
    padding-bottom: 28px;
}

.ma-page .ma-state h3 {
    margin: 0 0 8px;
    color: var(--ma-text);
    font-size: 17px;
}

.ma-page .ma-state p {
    margin: 0 0 18px;
}

.ma-page #maEmpty {
    padding: 45px 20px;
    background: #FBFCFE;
    border: 1px dashed #DCE3EB;
    border-radius: 12px;
}

/* =========================================================
   8. AUTOMATION LIST
   ========================================================= */

.ma-page .ma-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    min-width: 0;
}

.ma-page .ma-list:empty {
    display: none;
}

/* Common card classes for automation elements rendered by JS */

.ma-page .ma-card,
.ma-page .ma-automation-card,
.ma-page .automation-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 19px;
    background: #FFFFFF;
    border: 1px solid var(--ma-border);
    border-radius: 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease,
        transform 0.2s ease;
}

.ma-page .ma-card:hover,
.ma-page .ma-automation-card:hover,
.ma-page .automation-card:hover {
    transform: translateY(-2px);
    border-color: #C5DDAF;
    box-shadow: 0 7px 20px rgb(27 39 56 / 5%);
}

.ma-page .ma-card-header,
.ma-page .ma-card-top,
.ma-page .ma-automation-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.ma-page .ma-card h3,
.ma-page .ma-automation-card h3,
.ma-page .automation-card h3 {
    margin: 0;
    color: var(--ma-text);
    font-size: 15px;
    font-weight: 750;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.ma-page .ma-card p,
.ma-page .ma-automation-card p,
.ma-page .automation-card p {
    color: var(--ma-muted);
    font-size: 12px;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.ma-page .ma-card-description {
    margin: 8px 0 13px;
}

.ma-page .ma-card-meta,
.ma-page .ma-card-details,
.ma-page .ma-automation-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #EDF0F4;
}

.ma-page .ma-card-meta span,
.ma-page .ma-card-details span,
.ma-page .ma-automation-meta span {
    display: block;
    color: var(--ma-muted);
    font-size: 11px;
}

.ma-page .ma-card-meta strong,
.ma-page .ma-card-details strong,
.ma-page .ma-automation-meta strong {
    display: block;
    margin-top: 3px;
    color: var(--ma-text);
    font-size: 12px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.ma-page .ma-card-actions,
.ma-page .ma-automation-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
    padding-top: 17px;
}

.ma-page .ma-card-actions .ma-btn,
.ma-page .ma-automation-actions .ma-btn {
    min-height: 35px;
    padding: 7px 11px;
    font-size: 11px;
}

/* =========================================================
   9. STATUS BADGES
   ========================================================= */

.ma-page .ma-status,
.ma-page .ma-badge,
.ma-page .ma-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    max-width: 100%;
    padding: 5px 9px;
    color: #5B6677;
    background: #F0F2F5;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: 0.25px;
    overflow-wrap: anywhere;
}

.ma-page .ma-status-active,
.ma-page .status-active,
.ma-page .ma-status.is-active {
    color: #267346;
    background: #E9F8EF;
    border-color: #C8EAD4;
}

.ma-page .ma-status-paused,
.ma-page .status-paused,
.ma-page .ma-status.is-paused {
    color: #98620A;
    background: #FFF5DF;
    border-color: #F2DFB0;
}

.ma-page .ma-status-draft,
.ma-page .status-draft,
.ma-page .ma-status.is-draft {
    color: #53657C;
    background: #EEF2F7;
    border-color: #DCE3EB;
}

.ma-page .ma-status-failed,
.ma-page .status-failed,
.ma-page .ma-status.is-failed {
    color: #B02B3A;
    background: #FFF0F1;
    border-color: #F2C6CB;
}

/* =========================================================
   10. PAGINATION
   ========================================================= */

.ma-page .ma-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-top: 23px;
    padding-top: 18px;
    border-top: 1px solid #EDF0F4;
}

.ma-page #maPageInfo {
    color: var(--ma-muted);
    font-size: 12px;
    font-weight: 600;
}

.ma-page .ma-pagination>div {
    display: flex;
    gap: 8px;
}

/* =========================================================
   11. CREATE AND EDIT FORM
   ========================================================= */

.ma-page #maFormPanel {
    scroll-margin-top: 24px;
}

.ma-page #maForm {
    width: 100%;
    min-width: 0;
}

.ma-page .ma-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 19px;
}

.ma-page .ma-form-grid>label.wide {
    grid-column: 1 / -1;
}

.ma-page .ma-form-grid label small {
    color: #8792A2;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.6;
}

.ma-page .ma-form-grid textarea#maComponents {
    min-height: 130px;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 12px;
    line-height: 1.7;
}

.ma-page .ma-form-grid select:disabled {
    color: #8993A2;
    background: #F3F5F8;
    cursor: not-allowed;
}

.ma-page .ma-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #EDF0F4;
}

.ma-page #maSave {
    min-width: 145px;
}

.ma-page #maSave:disabled {
    cursor: wait;
}

/* =========================================================
   12. DETAILS PANEL
   ========================================================= */

.ma-page .ma-details {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    min-width: 0;
}

.ma-page .ma-detail-card,
.ma-page .ma-detail-section,
.ma-page .ma-history-section {
    min-width: 0;
    padding: 18px;
    background: #FBFCFE;
    border: 1px solid var(--ma-border);
    border-radius: 11px;
}

.ma-page .ma-details h3,
.ma-page .ma-detail-card h3,
.ma-page .ma-detail-section h3,
.ma-page .ma-history-section h3 {
    margin: 0 0 13px;
    color: var(--ma-text);
    font-size: 15px;
    font-weight: 750;
}

.ma-page .ma-details p {
    color: #586579;
    font-size: 13px;
    overflow-wrap: anywhere;
}

.ma-page .ma-details dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
    margin: 0;
}

.ma-page .ma-details dl>div {
    min-width: 0;
    padding: 12px;
    background: #FFFFFF;
    border: 1px solid #EDF0F4;
    border-radius: 8px;
}

.ma-page .ma-details dt {
    margin-bottom: 5px;
    color: var(--ma-muted);
    font-size: 11px;
    font-weight: 600;
}

.ma-page .ma-details dd {
    margin: 0;
    color: var(--ma-text);
    font-size: 13px;
    font-weight: 650;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.ma-page .ma-details pre {
    max-width: 100%;
    padding: 14px;
    overflow: auto;
    color: #DCE8F5;
    background: #202B3C;
    border-radius: 9px;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 12px;
    line-height: 1.7;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* =========================================================
   13. OPTIONAL HISTORY TABLE
   ========================================================= */

.ma-page .ma-history-wrap,
.ma-page .ma-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--ma-border);
    border-radius: 10px;
}

.ma-page .ma-history-table,
.ma-page .ma-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 12px;
}

.ma-page .ma-history-table th,
.ma-page .ma-table th {
    padding: 12px 14px;
    color: #536176;
    background: #F5F7FA;
    font-size: 11px;
    font-weight: 750;
    white-space: nowrap;
}

.ma-page .ma-history-table td,
.ma-page .ma-table td {
    padding: 12px 14px;
    color: #4B586B;
    border-top: 1px solid #EDF0F4;
    vertical-align: top;
    overflow-wrap: anywhere;
}

.ma-page .ma-history-table tbody tr:hover,
.ma-page .ma-table tbody tr:hover {
    background: #F8FBF5;
}

/* =========================================================
   14. VALIDATION
   ========================================================= */

.ma-page .is-invalid,
.ma-page input[aria-invalid="true"],
.ma-page select[aria-invalid="true"],
.ma-page textarea[aria-invalid="true"] {
    border-color: var(--ma-danger) !important;
}

.ma-page .ma-error-text {
    margin-top: 5px;
    color: var(--ma-danger);
    font-size: 11px;
}

.ma-page .ma-muted {
    color: var(--ma-muted);
}

/* =========================================================
   15. TABLET RESPONSIVENESS
   ========================================================= */

@media (max-width: 1100px) {
    .ma-page {
        padding: 23px;
    }

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

    .ma-page .ma-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ma-page .ma-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ma-page .ma-filters label:first-child {
        grid-column: 1 / -1;
    }
}

/* =========================================================
   16. MOBILE RESPONSIVENESS
   ========================================================= */

@media (max-width: 680px) {
    .ma-page {
        padding: 16px 12px;
        font-size: 14px;
    }

    .ma-page>div:first-child {
        margin-bottom: 16px;
    }

    .ma-page>div:first-child h1 {
        font-size: 27px;
    }

    .ma-page>div:first-child .ma-subtitle {
        font-size: 13px;
    }

    .ma-page>#maCreate {
        width: 100%;
        margin-bottom: 20px;
    }

    .ma-page .ma-stats {
        gap: 10px;
        margin-bottom: 17px;
    }

    .ma-page .ma-stats article {
        min-height: 112px;
        padding: 15px;
    }

    .ma-page .ma-stats article strong {
        font-size: 26px;
    }

    .ma-page .ma-stats article span {
        font-size: 12px;
    }

    .ma-page .ma-stats article small {
        font-size: 10px;
    }

    .ma-page .ma-panel {
        margin-bottom: 17px;
        padding: 16px 13px;
        border-radius: 12px;
    }

    .ma-page .ma-toolbar {
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 17px;
    }

    .ma-page .ma-toolbar h2 {
        font-size: 17px;
    }

    .ma-page .ma-toolbar p {
        font-size: 12px;
    }

    .ma-page .ma-toolbar>.ma-btn {
        flex-shrink: 0;
        min-height: 37px;
        padding: 8px 10px;
        font-size: 11px;
    }

    .ma-page .ma-filters {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
        padding: 12px;
        margin-bottom: 16px;
    }

    .ma-page .ma-filters label:first-child {
        grid-column: auto;
    }

    .ma-page .ma-list {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }

    .ma-page .ma-card,
    .ma-page .ma-automation-card,
    .ma-page .automation-card {
        padding: 15px;
    }

    .ma-page .ma-card-actions,
    .ma-page .ma-automation-actions {
        gap: 7px;
    }

    .ma-page .ma-card-actions .ma-btn,
    .ma-page .ma-automation-actions .ma-btn {
        flex: 1 1 auto;
    }

    .ma-page .ma-form-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 15px;
    }

    .ma-page .ma-form-grid>label.wide {
        grid-column: auto;
    }

    .ma-page .ma-form-grid textarea#maComponents {
        min-height: 110px;
    }

    .ma-page .ma-actions {
        flex-direction: column;
    }

    .ma-page .ma-actions .ma-btn {
        width: 100%;
    }

    .ma-page .ma-pagination {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .ma-page .ma-pagination>div {
        width: 100%;
    }

    .ma-page .ma-pagination>div .ma-btn {
        flex: 1;
    }

    .ma-page .ma-details dl {
        grid-template-columns: minmax(0, 1fr);
    }

    .ma-page .ma-detail-card,
    .ma-page .ma-detail-section,
    .ma-page .ma-history-section {
        padding: 13px;
    }
}

/* =========================================================
   17. VERY SMALL PHONES
   ========================================================= */

@media (max-width: 380px) {
    .ma-page {
        padding: 12px 9px;
    }

    .ma-page .ma-stats article {
        padding: 12px 10px;
    }

    .ma-page .ma-stats article strong {
        font-size: 23px;
    }

    .ma-page .ma-panel {
        padding: 13px 10px;
    }

    .ma-page .ma-toolbar {
        flex-wrap: wrap;
    }

    .ma-page .ma-toolbar>.ma-btn {
        width: 100%;
    }

    .ma-page .ma-card-meta,
    .ma-page .ma-card-details,
    .ma-page .ma-automation-meta {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* =========================================================
   18. REDUCED MOTION ACCESSIBILITY
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    .ma-page *,
    .ma-page *::before,
    .ma-page *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}











/*==========================================
    AdThrive Media Chatbot Start From Here
        CHAT-BOT CSS
======================================*/
/* Chatbot Builder styles are isolated; existing approved stylesheets remain unchanged. */

/* =========================================================
   ADTHRIVE MEDIA — CHATBOT BUILDER
   Works with the existing chatbot-builder.js selectors
   ========================================================= */

.cb-page,
.cb-page * {
    box-sizing: border-box;
}

.cb-page {
    --cb-primary: #2563eb;
    --cb-primary-hover: #1d4ed8;
    --cb-dark: #172033;
    --cb-text: #263247;
    --cb-muted: #718096;
    --cb-border: #e2e8f0;
    --cb-surface: #ffffff;
    --cb-soft: #f7f9fc;
    --cb-green: #16a34a;
    --cb-danger: #dc2626;

    width: 100%;
    min-width: 0;
    color: var(--cb-text);
    font-size: 14px;
    line-height: 1.5;
}

.cb-page [hidden] {
    display: none !important;
}

.cb-page button,
.cb-page input,
.cb-page select,
.cb-page textarea {
    font: inherit;
}

.cb-page button {
    cursor: pointer;
}

.cb-page button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.cb-page input,
.cb-page select,
.cb-page textarea {
    max-width: 100%;
}



/* Chatbot Builder: Fix screen-edge alignment */
.cb-page {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0 auto;
    padding: 28px;
    box-sizing: border-box;
}

/* Heading and header actions */
.cb-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    width: 100%;
    margin: 0 0 24px;
}

.cb-heading > div:first-child {
    flex: 1 1 auto;
    min-width: 0;
}

.chat-bot_header {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
}

.cb-head-actions.cb-compact-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 8px;
    min-width: 0;
}

/* Keep wallet and usage together */
.cb-wallet-usage-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 7px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
    background: #fff;
    white-space: nowrap;
}

/* Main sections */
.cb-toolbar-panel {
    margin-bottom: 18px;
}

.cb-workspace {
    width: 100%;
    min-width: 0;
}

/* Tablet */
@media (max-width: 1100px) {
    .cb-page {
        padding: 18px;
    }

    .cb-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 16px;
    }

    .chat-bot_header {
        width: 100%;
    }

    .cb-head-actions.cb-compact-actions {
        justify-content: flex-start;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 5px;
        scrollbar-width: none;
    }

    .cb-head-actions.cb-compact-actions::-webkit-scrollbar {
        display: none;
    }
}

/* Mobile */
@media (max-width: 600px) {
    .cb-page {
        padding: 12px;
    }

    .cb-heading {
        gap: 12px;
        margin-bottom: 18px;
    }

    .cb-heading h1 {
        font-size: 23px;
    }

    .cb-subtitle {
        font-size: 12px;
    }

    .cb-head-actions.cb-compact-actions {
        gap: 6px;
    }

    .cb-head-actions .cb-btn {
        flex: 0 0 auto;
        padding: 7px 9px;
        font-size: 11px;
        white-space: nowrap;
    }

    .cb-toolbar-panel {
        padding: 12px;
    }

    .cb-workspace {
        grid-template-columns: minmax(0, 1fr);
    }
}
/* =========================================================
   PAGE HEADING
   ========================================================= */

.cb-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
    min-width: 0;
}

.cb-heading > div:first-child {
    flex: 1 1 auto;
    min-width: 0;
}

.cb-eyebrow {
    
    margin: 0 0 6px;
    color: var(--cb-primary);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.2px;
    text-transform: uppercase;
}

.cb-heading h1 {
    margin: 0;
    color: var(--cb-dark);
    font-size: 28px;
    font-weight: 750;
    line-height: 1.25;
}

.cb-subtitle {
    margin: 8px 0 0;
    color: var(--cb-muted);
    font-size: 13px;
    line-height: 1.6;
}

/* =========================================================
   HEADER ACTIONS
   Wallet + usage + action buttons
   ========================================================= */

.chat-bot_header {
    display: flex;
    flex: 0 1 auto;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
    max-width: 100%;
}

.cb-head-actions.cb-compact-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    width: 100%;
    min-width: 0;
}

/* Wallet and usage share one box */

.cb-wallet-usage-box {
    display: flex;
    flex: 0 1 auto;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-width: 0;
    padding: 6px 10px;
    border: 1px solid var(--cb-border);
    border-radius: 9px;
    background: #fff;
    white-space: nowrap;
}

.cb-wallet {
    flex: 0 0 auto;
    min-width: 0;
    color: var(--cb-dark);
    font-size: 12px;
    white-space: nowrap;
}

.cb-wallet strong {
    font-weight: 700;
}

.cb-usage {
    display: flex;
    flex: 0 0 76px;
    flex-direction: column;
    gap: 4px;
    width: 76px;
    min-width: 0;
}

.cb-usage-top {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cb-dark);
    font-size: 11px;
    line-height: 1.2;
    white-space: nowrap;
}

.cb-usage-top strong {
    font-weight: 750;
}

.cb-usage-limit {
    color: var(--cb-muted);
    font-weight: 500;
}

.cb-usage-track {
    width: 100%;
    height: 4px;
    overflow: hidden;
    border-radius: 10px;
    background: #e8edf5;
}

#cbMessageProgressBar {
    display: block;
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: var(--cb-green);
    transition: width 0.25s ease;
}

.cb-head-actions .cb-btn {
    flex: 0 0 auto;
    min-height: 32px;
    padding: 6px 10px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.2;
    white-space: nowrap;
}

/* =========================================================
   BUTTONS
   ========================================================= */

.cb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 15px !important;
    min-height: 36px;
    padding:14px 13px !important;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 650;
    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        color 0.18s ease,
        transform 0.18s ease;
}

.cb-btn:active:not(:disabled) {
    transform: translateY(1px);
}

.cb-btn:focus-visible,
.cb-icon-btn:focus-visible,
.cb-block-pick:focus-visible {
    outline: 2px solid var(--cb-primary);
    outline-offset: 2px;
}

.cb-light {
    border-color: var(--cb-border);
    background: #fff;
    color: var(--cb-text);
}

.cb-light:hover:not(:disabled) {
    border-color: #c5d0e0;
    background: #f5f7fb;
}

.cb-dark {
    border-color: var(--cb-dark);
    background: var(--cb-dark);
    color: #fff;
}

.cb-dark:hover:not(:disabled) {
    background: #27344d;
}

.cb-primary {
    border-color: var(--cb-primary);
    background: var(--cb-primary);
    color: #fff;
}

.cb-primary:hover:not(:disabled) {
    border-color: var(--cb-primary-hover);
    background: var(--cb-primary-hover);
}

/* =========================================================
   NOTIFICATION
   ========================================================= */

.cb-notice {
    margin: 0 0 16px;
    padding: 11px 14px;
    border: 1px solid #bbf7d0;
    border-radius: 9px;
    background: #f0fdf4;
    color: #166534;
    font-size: 13px;
    overflow-wrap: anywhere;
}

.cb-notice[data-state="error"] {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

/* =========================================================
   FLOW TOOLBAR
   ========================================================= */

.cb-toolbar-panel {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 18px;
    padding: 16px;
    border: 1px solid var(--cb-border);
    border-radius: 12px;
    background: var(--cb-surface);
    box-shadow: 0 2px 8px rgb(20 35 60 / 3%);
}

.cb-flow-name,
.cb-flow-status {
    display: flex;
    flex: 1 1 170px;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    color: #526078;
    font-size: 12px;
    font-weight: 700;
}

.cb-flow-name {
    flex-basis: 230px;
}

.cb-flow-name input,
.cb-flow-status select,
.cb-page input:not([type="checkbox"]):not([type="radio"]),
.cb-page select,
.cb-page textarea {
    width: 100%;
    min-width: 0;
    padding: 9px 11px;
    border: 1px solid #d9e1ed;
    border-radius: 8px;
    outline: none;
    background: #fff;
    color: var(--cb-text);
    font-size: 13px;
    font-weight: 400;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.cb-page input:focus,
.cb-page select:focus,
.cb-page textarea:focus {
    border-color: var(--cb-primary);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 10%);
}

.cb-page select:disabled {
    background: #f1f4f8;
    color: #748096;
}

.cb-local-note {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    align-self: center;
    color: var(--cb-muted);
    font-size: 11px;
    font-weight: 500;
}

.cb-dot {
    flex: 0 0 7px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
}

/* =========================================================
   MAIN WORKSPACE
   ========================================================= */

.cb-workspace {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr) 285px;
    align-items: stretch;
    gap: 14px;
    min-width: 0;
}

.cb-blocks,
.cb-canvas-wrap,
.cb-settings {
    min-width: 0;
    border: 1px solid var(--cb-border);
    border-radius: 12px;
    background: var(--cb-surface);
    box-shadow: 0 2px 8px rgb(20 35 60 / 3%);
}

/* =========================================================
   BLOCK SIDEBAR
   ========================================================= */

.cb-blocks {
    max-height: 850px;
    overflow-y: auto;
    padding: 15px;
}

.cb-blocks h2,
.cb-settings h2,
.cb-test-panel h2 {
    margin: 0;
    color: var(--cb-dark);
    font-size: 15px;
    font-weight: 750;
}

.cb-blocks > p {
    margin: 6px 0 14px;
    color: var(--cb-muted);
    font-size: 11px;
    line-height: 1.5;
}

.cb-block-pick {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-width: 0;
    margin-bottom: 8px;
    padding: 10px 8px;
    border: 1px solid #e8edf4;
    border-radius: 9px;
    background: #fff;
    color: var(--cb-text);
    text-align: left;
    transition: border-color 0.18s ease, background 0.18s ease;
}

.cb-block-pick:hover {
    border-color: #b9cdfc;
    background: #f7faff;
}

.cb-block-pick > span:nth-child(2) {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
}

.cb-block-pick b {
    font-size: 12px;
    font-weight: 700;
}

.cb-block-pick small {
    margin-top: 2px;
    color: var(--cb-muted);
    font-size: 10px;
    line-height: 1.4;
}

.cb-block-icon {
    display: inline-flex;
    flex: 0 0 30px;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
}

.cb-block-icon.blue {
    background: #e8f1ff;
    color: #2563eb;
}

.cb-block-icon.green {
    background: #e8f9ef;
    color: #15803d;
}

.cb-block-icon.purple {
    background: #f3eaff;
    color: #7c3aed;
}

.cb-block-icon.slate {
    background: #edf1f7;
    color: #475569;
}

.cb-block-icon.amber {
    background: #fff5dc;
    color: #b7791f;
}

.cb-block-icon.red {
    background: #feecec;
    color: #dc2626;
}

.cb-tip {
    margin-top: 16px;
    padding: 11px;
    border: 1px solid #dbeafe;
    border-radius: 9px;
    background: #f5f9ff;
}

.cb-tip b {
    color: #1d4ed8;
    font-size: 11px;
}

.cb-tip p {
    margin: 5px 0 0;
    color: #526078;
    font-size: 11px;
    line-height: 1.6;
}

/* =========================================================
   CANVAS CONTAINER
   ========================================================= */

.cb-canvas-wrap {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cb-canvas-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 54px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--cb-border);
}

.cb-canvas-top > div {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.cb-canvas-top b {
    color: var(--cb-dark);
    font-size: 13px;
    font-weight: 750;
}

#cbNodeCount {
    color: var(--cb-muted);
    font-size: 11px;
    white-space: nowrap;
}

.cb-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 4px 8px;
    border: 1px solid var(--cb-border);
    border-radius: 7px;
    background: #fff;
    color: var(--cb-text);
    font-size: 13px;
    font-weight: 700;
}

.cb-icon-btn:hover {
    background: #f3f6fb;
}

/* Canvas must remain larger than the visible viewport.
   The viewport provides scrolling on smaller screens. */

.cb-canvas-viewport {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 520px;
    max-height: 750px;
    overflow: auto;
    overscroll-behavior: contain;
    background-color: #f8fafd;
    background-image: radial-gradient(#cbd5e1 0.8px, transparent 0.8px);
    background-size: 20px 20px;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.cb-canvas {
    position: relative;
    width: 1300px;
    min-width: 1300px;
    height: 900px;
    transform-origin: top left;
}

.cb-edges,
.cb-nodes {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.cb-edges {
    z-index: 1;
    overflow: visible;
    pointer-events: none;
}

.cb-nodes {
    z-index: 2;
    pointer-events: none;
}

/* SVG connections */

.cb-edge-path {
    fill: none;
    stroke: #8796b0;
    stroke-width: 2;
    pointer-events: stroke;
    cursor: pointer;
}

.cb-edge-path:hover {
    stroke: var(--cb-primary);
    stroke-width: 3;
}

.cb-edge-preview {
    stroke: var(--cb-primary);
    stroke-dasharray: 6 5;
    pointer-events: none;
}

.cb-edge-label {
    fill: #526078;
    stroke: #fff;
    stroke-width: 4px;
    paint-order: stroke;
    font-size: 10px;
    font-weight: 800;
    pointer-events: none;
}

.cb-edge-endpoint {
    fill: #fff;
    stroke: var(--cb-primary);
    stroke-width: 2;
    pointer-events: all;
    cursor: grab;
}

.cb-edge-endpoint:hover,
.cb-edge-endpoint.dragging {
    fill: #dbeafe;
    stroke-width: 3;
}

/* =========================================================
   CANVAS NODES
   JavaScript positions nodes with left/top in pixels.
   Normal node width = 212px; condition output uses 260px.
   ========================================================= */

.cb-node {
    position: absolute;
    width: 212px;
    min-height: 112px;
    overflow: visible;
    border: 1px solid #dce4ef;
    border-radius: 11px;
    background: #fff;
    box-shadow: 0 5px 16px rgb(27 43 70 / 9%);
    pointer-events: auto;
    cursor: grab;
    user-select: none;
    touch-action: none;
}

.cb-node[data-kind="condition"] {
    width: 260px;
}

.cb-node:active {
    cursor: grabbing;
}

.cb-node.selected {
    border-color: var(--cb-primary);
    box-shadow:
        0 0 0 3px rgb(37 99 235 / 12%),
        0 8px 20px rgb(27 43 70 / 10%);
}

.cb-node-head {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    padding: 10px;
    border-bottom: 1px solid #edf1f7;
    border-radius: 10px 10px 0 0;
    background: #fbfcff;
}

.cb-node-symbol {
    display: inline-flex;
    flex: 0 0 25px;
    align-items: center;
    justify-content: center;
    width: 25px;
    height: 25px;
    border-radius: 7px;
    background: #e8f1ff;
    color: #2563eb;
    font-size: 13px;
}

.cb-node-title {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    color: var(--cb-dark);
    font-size: 12px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cb-node-kind {
    flex: 0 0 auto;
    max-width: 58px;
    overflow: hidden;
    padding: 2px 5px;
    border-radius: 5px;
    background: #edf2f8;
    color: #64748b;
    font-size: 9px;
    text-overflow: ellipsis;
    text-transform: uppercase;
}

.cb-node-body {
    min-height: 38px;
    padding: 10px;
    overflow-wrap: anywhere;
    color: #526078;
    font-size: 11px;
    line-height: 1.5;
}

.cb-node-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 10px;
    border-top: 1px solid #edf1f7;
    color: #8995a8;
    font-size: 9px;
}

.cb-node-foot span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Node connection ports */

.cb-port {
    position: absolute;
    z-index: 4;
    display: block;
    width: 13px;
    height: 13px;
    padding: 0;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--cb-primary);
    box-shadow: 0 0 0 1px #93b4fa;
    cursor: crosshair;
    touch-action: none;
}

.cb-port:hover {
    background: #1d4ed8;
    box-shadow: 0 0 0 4px rgb(37 99 235 / 15%);
}

.cb-port-in {
    top: 34px;
    left: -7px;
}

.cb-port-out {
    top: 52px;
    right: -7px;
}

.cb-port-row {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-height: 28px;
    padding: 3px 10px;
    border-top: 1px solid #edf1f7;
    color: #64748b;
    font-size: 9px;
    font-weight: 800;
}

.cb-port-row .cb-port {
    position: static;
    flex: 0 0 13px;
}

.cb-port-true {
    background: #16a34a;
    box-shadow: 0 0 0 1px #86efac;
}

.cb-port-false {
    background: #dc2626;
    box-shadow: 0 0 0 1px #fca5a5;
}

/* =========================================================
   CANVAS FOOTER
   ========================================================= */

.cb-canvas-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 14px;
    padding: 10px 14px;
    border-top: 1px solid var(--cb-border);
    color: var(--cb-muted);
    font-size: 10px;
}

.cb-canvas-foot > span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.cb-line-sample {
    display: inline-block;
    width: 23px;
    border-top: 2px solid #8796b0;
}

/* =========================================================
   SETTINGS SIDEBAR
   ========================================================= */

.cb-settings {
    display: flex;
    flex-direction: column;
    max-height: 850px;
    overflow: hidden;
}

.cb-settings-heading {
    padding: 16px;
    border-bottom: 1px solid var(--cb-border);
}

.cb-settings-heading p {
    margin: 5px 0 0;
    color: var(--cb-muted);
    font-size: 11px;
    overflow-wrap: anywhere;
}

.cb-settings-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 15px;
    scrollbar-width: thin;
}

.cb-empty-settings {
    padding: 22px 12px;
    border: 1px dashed #cbd5e1;
    border-radius: 9px;
    color: var(--cb-muted);
    font-size: 12px;
    line-height: 1.7;
    text-align: center;
}

/* JavaScript-generated setting fields */

.cb-settings-body > label,
.cb-settings-body label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    margin-bottom: 14px;
    color: #526078;
    font-size: 11px;
    font-weight: 700;
}

.cb-settings-body input,
.cb-settings-body select,
.cb-settings-body textarea {
    display: block;
    width: 100%;
    min-width: 0;
}

.cb-settings-body textarea {
    min-height: 78px;
    resize: vertical;
    line-height: 1.5;
}

.cb-field-help {
    display: block;
    margin-top: 2px;
    color: #8490a3;
    font-size: 10px;
    font-weight: 400;
    line-height: 1.6;
}

/* Repeated buttons and list rows */

.cb-repeater {
    margin: 12px 0 16px;
    padding: 11px;
    border: 1px solid #e4eaf3;
    border-radius: 9px;
    background: #fbfcfe;
}

.cb-repeater > b {
    display: block;
    margin-bottom: 10px;
    color: var(--cb-dark);
    font-size: 12px;
}

.cb-repeater-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid #e4eaf3;
    border-radius: 8px;
    background: #fff;
}

.cb-repeater-row label {
    margin-bottom: 0;
}

.cb-repeater button,
.cb-delete-node,
.cb-existing-connections button {
    min-height: 31px;
    padding: 6px 9px;
    border: 1px solid var(--cb-border);
    border-radius: 7px;
    background: #fff;
    color: var(--cb-text);
    font-size: 11px;
    font-weight: 650;
}

.cb-repeater button:hover,
.cb-existing-connections button:hover {
    background: #f1f5f9;
}

.cb-repeater button:disabled {
    opacity: 0.45;
}

.cb-template-preview {
    margin: 0 0 15px;
    padding: 12px;
    border: 1px solid #dbeafe;
    border-radius: 9px;
    background: #f5f9ff;
}

.cb-template-preview b {
    color: #1d4ed8;
    font-size: 12px;
}

.cb-template-preview p {
    margin: 8px 0;
    color: #334155;
    font-size: 12px;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.cb-template-preview small {
    color: var(--cb-muted);
    font-size: 10px;
}

.cb-friendly-parameters {
    margin: 10px 0;
    padding: 10px;
    border-radius: 8px;
    background: #f7f9fc;
}

.cb-policy-note {
    margin: 10px 0;
    padding: 10px;
    border: 1px solid #fde68a;
    border-radius: 8px;
    background: #fffbeb;
    color: #92400e;
    font-size: 11px;
    line-height: 1.6;
}

.cb-existing-connections {
    margin: 14px 0;
    padding: 11px;
    border: 1px solid #e4eaf3;
    border-radius: 9px;
    background: #fbfcfe;
}

.cb-existing-connections > b {
    display: block;
    margin-bottom: 9px;
    font-size: 12px;
}

.cb-connection-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 0;
    border-top: 1px solid #e9eef5;
    font-size: 11px;
}

.cb-connection-row > span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.cb-delete-node {
    width: 100%;
    margin-top: 12px;
    border-color: #fecaca;
    background: #fff7f7;
    color: #b91c1c;
}

.cb-delete-node:hover {
    background: #fee2e2;
}

/* =========================================================
   TEST PANEL
   ========================================================= */

.cb-test-panel {
    margin-top: 18px;
    padding: 18px;
    border: 1px solid var(--cb-border);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 8px rgb(20 35 60 / 3%);
}

.cb-test-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.cb-test-head p {
    margin: 5px 0 0;
    color: var(--cb-muted);
    font-size: 12px;
    line-height: 1.6;
}

.cb-test-form {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.cb-test-form label {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    color: #526078;
    font-size: 12px;
    font-weight: 700;
}

.cb-test-form input {
    width: 100%;
}

.cb-test-result {
    max-height: 320px;
    margin: 14px 0 0;
    padding: 14px;
    overflow: auto;
    border: 1px solid #e4eaf3;
    border-radius: 9px;
    background: #f7f9fc;
    color: #334155;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 11px;
    line-height: 1.7;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* =========================================================
   SCROLLBARS
   ========================================================= */

.cb-blocks,
.cb-settings-body,
.cb-canvas-viewport {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.cb-blocks::-webkit-scrollbar,
.cb-settings-body::-webkit-scrollbar,
.cb-canvas-viewport::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.cb-blocks::-webkit-scrollbar-thumb,
.cb-settings-body::-webkit-scrollbar-thumb,
.cb-canvas-viewport::-webkit-scrollbar-thumb {
    border-radius: 10px;
    background: #cbd5e1;
}

/* =========================================
   DESKTOP CHATBOT FLOATING GALLERY
   ========================================= */

@media (min-width: 769px) {
    #cbFlowGallery:not([hidden]) {
        position: fixed;
        inset: 50% auto auto 50%;
        transform: translate(-50%, -50%);
        z-index: 10000;

        display: flex;
        flex-direction: column;
        gap: 18px;

        width: min(1100px, calc(100vw - 80px));
        max-height: min(780px, calc(100vh - 70px));
        padding: 24px;

        overflow-y: auto;
        overscroll-behavior: contain;

        background: #ffffff;
        border: 1px solid #e2e8f0;
        border-radius: 20px;
        box-shadow: 0 25px 90px rgb(15 23 42 / 25%);
        box-sizing: border-box;
    }

    #cbFlowGallery[hidden] {
        display: none !important;
    }

    /* Background overlay */
    body.cb-gallery-open::before {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 9999;
        background: rgb(15 23 42 / 55%);
        backdrop-filter: blur(3px);
    }

    /* Heading card */
    #cbFlowGallery .cb-gallery-heading {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 20px;
        padding: 20px;
        background: #f8faff;
        border: 1px solid #e5eaf5;
        border-radius: 14px;
    }

    #cbFlowGallery .cb-gallery-heading h2 {
        margin: 0;
        color: #172033;
        font-size: 23px;
        font-weight: 750;
    }

    #cbFlowGallery .cb-gallery-heading p {
        margin: 7px 0 0;
        color: #64748b;
        font-size: 13px;
    }

    /* Back button */
    #cbFlowGallery #cbCloseGallery {
        flex-shrink: 0;
        padding: 11px 16px;
        border: 1px solid #d8e0ec;
        border-radius: 9px;
        background: #ffffff;
        color: #334155;
        font-size: 13px;
        font-weight: 650;
        cursor: pointer;
    }

    #cbFlowGallery #cbCloseGallery:hover {
        background: #eef4ff;
        border-color: #b9cdf4;
    }

    /* Message / loading card */
    #cbFlowGallery #cbGalleryMessage:not(:empty) {
        padding: 13px 16px;
        margin: 0;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        background: #f8fafc;
        color: #64748b;
        font-size: 13px;
    }

    /* Individual bot cards grid */
    #cbFlowGallery #cbFlowCards {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        align-items: stretch;
        gap: 18px;
        min-width: 0;
    }

    #cbFlowGallery #cbFlowCards > * {
        min-width: 0;
        box-sizing: border-box;
        border: 1px solid #e2e8f0;
        border-radius: 14px;
        background: #ffffff;
        box-shadow: 0 3px 12px rgb(15 23 42 / 4%);
        transition: border-color 0.2s, box-shadow 0.2s,
                    transform 0.2s;
    }

    #cbFlowGallery #cbFlowCards > *:hover {
        border-color: #b9cdf4;
        box-shadow: 0 10px 25px rgb(15 23 42 / 9%);
        transform: translateY(-3px);
    }

    #cbFlowGallery #cbFlowCards h3,
    #cbFlowGallery #cbFlowCards h4,
    #cbFlowGallery #cbFlowCards p {
        overflow-wrap: anywhere;
    }
}

/* =========================================================
   ADTHRIVE — CHATBOT FLOW GALLERY
   Desktop-only | Structured floating modal
   ========================================================= */

/* Prevent background scrolling when gallery is open */
body.cb-gallery-open {
    overflow: hidden;
}

/* ---------- 1. Modal backdrop ---------- */

body.cb-gallery-open::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* ---------- 2. Main floating window ---------- */

@media (min-width: 769px) {
    #cbFlowGallery:not([hidden]) {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        z-index: 9999;

        display: flex;
        flex-direction: column;
        gap: 0;

        width: min(1120px, calc(100vw - 64px));
        height: min(760px, calc(100vh - 64px));
        max-width: 1120px;
        max-height: calc(100vh - 64px);
        min-width: 0;
        min-height: 0;

        padding: 0;
        margin: 0;

        overflow: hidden;
        box-sizing: border-box;

        background: #f7f9fc;
        color: #172033;
        border: 1px solid #e1e7f0;
        border-radius: 18px;

        box-shadow:
            0 24px 80px rgba(15, 23, 42, 0.24),
            0 4px 16px rgba(15, 23, 42, 0.08);
    }

    #cbFlowGallery[hidden] {
        display: none !important;
    }

    /* ---------- 3. Fixed header area ---------- */

    #cbFlowGallery .cb-gallery-heading {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex: 0 0 auto;
        gap: 24px;

        min-height: 96px;
        padding: 22px 26px;

        background: #ffffff;
        border-bottom: 1px solid #e8edf4;
        box-sizing: border-box;
    }

    #cbFlowGallery .cb-gallery-heading > div {
        min-width: 0;
        flex: 1;
    }

    #cbFlowGallery .cb-gallery-heading h2 {
        margin: 0;
        color: #172033;
        font-size: 23px;
        font-weight: 750;
        line-height: 1.35;
        letter-spacing: -0.45px;
    }

    #cbFlowGallery .cb-gallery-heading p {
        margin: 6px 0 0;
        color: #718096;
        font-size: 13px;
        line-height: 1.6;
    }

    /* ---------- 4. Back to editor button ---------- */

    #cbFlowGallery #cbCloseGallery {
        display: inline-flex;
        flex: 0 0 auto;
        align-items: center;
        justify-content: center;

        min-height: 40px;
        padding: 10px 16px;

        border: 1px solid #dce3ed;
        border-radius: 9px;
        background: #ffffff;
        color: #344054;

        font-family: inherit;
        font-size: 13px;
        font-weight: 650;
        white-space: nowrap;
        cursor: pointer;

        transition:
            background 0.2s ease,
            border-color 0.2s ease,
            box-shadow 0.2s ease;
    }

    #cbFlowGallery #cbCloseGallery:hover {
        background: #f1f5ff;
        border-color: #c5d4f2;
        box-shadow: 0 2px 7px rgba(15, 23, 42, 0.05);
    }

    #cbFlowGallery #cbCloseGallery:focus-visible {
        outline: 3px solid rgba(59, 130, 246, 0.25);
        outline-offset: 2px;
    }

    /* ---------- 5. Gallery body / scroll area ---------- */

    #cbFlowGallery #cbGalleryMessage {
        flex: 0 0 auto;
        margin: 20px 24px 0;
        padding: 12px 15px;

        border: 1px solid #e2e8f0;
        border-radius: 9px;
        background: #ffffff;
        color: #64748b;

        font-size: 13px;
        line-height: 1.6;
        overflow-wrap: anywhere;
        box-sizing: border-box;
    }

    #cbFlowGallery #cbGalleryMessage:empty {
        display: none;
    }

    /* ---------- 6. Scrollable bot cards area ---------- */

    #cbFlowGallery #cbFlowCards {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        align-content: start;
        align-items: stretch;
        gap: 18px;

        flex: 1 1 auto;
        min-width: 0;
        min-height: 0;

        margin: 20px 24px 24px;
        padding: 2px 3px 8px;

        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;

        scrollbar-width: thin;
        scrollbar-color: #cbd5e1 transparent;
        box-sizing: border-box;
    }

    #cbFlowGallery #cbFlowCards::-webkit-scrollbar {
        width: 7px;
    }

    #cbFlowGallery #cbFlowCards::-webkit-scrollbar-track {
        background: transparent;
    }

    #cbFlowGallery #cbFlowCards::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 20px;
    }

    /* ---------- 7. Individual bot card base ---------- */

    #cbFlowGallery #cbFlowCards > * {
        display: flex;
        flex-direction: column;
        align-self: stretch;

        min-width: 0;
        min-height: 180px;
        max-width: 100%;
        padding: 18px;

        border: 1px solid #e2e8f0;
        border-radius: 13px;
        background: #ffffff;

        box-shadow: 0 2px 8px rgba(15, 23, 42, 0.035);
        box-sizing: border-box;

        overflow-wrap: anywhere;

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

    #cbFlowGallery #cbFlowCards > *:hover {
        border-color: #b9cdf4;
        box-shadow: 0 8px 22px rgba(15, 23, 42, 0.07);
        transform: translateY(-2px);
    }

    #cbFlowGallery #cbFlowCards h3,
    #cbFlowGallery #cbFlowCards h4 {
        margin-top: 0;
        color: #1e293b;
        font-size: 15px;
        font-weight: 700;
        line-height: 1.5;
        overflow-wrap: anywhere;
    }

    #cbFlowGallery #cbFlowCards p {
        color: #64748b;
        font-size: 13px;
        line-height: 1.65;
        overflow-wrap: anywhere;
    }

    #cbFlowGallery #cbFlowCards button {
        max-width: 100%;
        box-sizing: border-box;
        cursor: pointer;
    }

    #cbFlowGallery #cbFlowCards img {
        display: block;
        max-width: 100%;
        height: auto;
        object-fit: cover;
        border-radius: 8px;
    }

    /* ---------- 8. Empty gallery ---------- */

    #cbFlowGallery #cbFlowCards:empty {
        display: block;
    }

    #cbFlowGallery #cbFlowCards:empty::after {
        content: "Your saved chatbots will appear here.";
        display: flex;
        align-items: center;
        justify-content: center;

        min-height: 150px;
        padding: 24px;

        border: 1px dashed #cbd5e1;
        border-radius: 12px;
        background: #ffffff;
        color: #64748b;
        font-size: 13px;
        text-align: center;
        box-sizing: border-box;
    }
}

/* ---------- 9. Smaller desktop / tablet ---------- */

@media (min-width: 769px) and (max-width: 1050px) {
    #cbFlowGallery:not([hidden]) {
        width: calc(100vw - 40px);
        height: calc(100vh - 40px);
        max-height: calc(100vh - 40px);
        border-radius: 14px;
    }

    #cbFlowGallery .cb-gallery-heading {
        min-height: 84px;
        padding: 18px 20px;
    }

    #cbFlowGallery .cb-gallery-heading h2 {
        font-size: 20px;
    }

    #cbFlowGallery #cbGalleryMessage {
        margin: 16px 18px 0;
    }

    #cbFlowGallery #cbFlowCards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
        margin: 16px 18px 18px;
    }

    #cbFlowGallery #cbFlowCards > * {
        padding: 15px;
    }
}

/* ---------- 10. Mobile: disabled ---------- */

@media (max-width: 768px) {
    #cbFlowGallery,
    body.cb-gallery-open::before {
        display: none !important;
    }

    body.cb-gallery-open {
        overflow: auto;
    }
}

/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 1200px) {
    .cb-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .chat-bot_header {
        width: 100%;
        justify-content: flex-start;
    }

    .cb-head-actions.cb-compact-actions {
        justify-content: flex-start;
    }

    .cb-workspace {
        grid-template-columns: 190px minmax(0, 1fr);
    }

    .cb-settings {
        grid-column: 1 / -1;
        max-height: none;
    }

    .cb-settings-body {
        max-height: 500px;
    }

    .cb-blocks {
        max-height: 750px;
    }
}

/* =========================================================
   MOBILE — KEEP HEADER ACTIONS ON ONE LINE
   Horizontal scrolling is allowed; no button wrapping.
   ========================================================= */

@media (max-width: 768px) {
    .cb-page {
        font-size: 13px;
    }

    .cb-heading {
        gap: 14px;
        margin-bottom: 16px;
    }

    .cb-heading h1 {
        font-size: 23px;
    }

    .cb-eyebrow {
        font-size: 10px;
        letter-spacing: 0.8px;
    }

    .cb-subtitle {
        font-size: 12px;
    }

    .chat-bot_header {
        display: block;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow: hidden;
    }

    .cb-head-actions.cb-compact-actions {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: flex-start;
        gap: 5px;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        padding: 2px 1px 7px;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .cb-head-actions.cb-compact-actions::-webkit-scrollbar {
        display: none;
    }

    .cb-wallet-usage-box {
        display: flex;
        flex: 0 0 auto;
        flex-direction: row;
        align-items: center;
        gap: 7px;
        padding: 5px 7px;
        border-radius: 7px;
    }

    .cb-compact-actions .cb-wallet {
        flex: 0 0 auto;
        font-size: 10px;
    }

    .cb-compact-actions .cb-usage {
        flex: 0 0 48px;
        width: 48px;
        min-width: 48px;
        gap: 3px;
    }

    .cb-compact-actions .cb-usage-top {
        font-size: 10px;
    }

    .cb-compact-actions .cb-usage-track {
        height: 3px;
    }

    .cb-head-actions .cb-btn {
        flex: 0 0 auto;
        min-height: 30px;
        padding: 6px 8px;
        border-radius: 6px;
        font-size: 10px;
        line-height: 1.2;
        white-space: nowrap;
    }

    .cb-toolbar-panel {
        align-items: stretch;
        gap: 11px;
        padding: 12px;
    }

    .cb-flow-name,
    .cb-flow-status {
        flex: 1 1 100%;
    }

    .cb-local-note {
        align-self: flex-start;
        font-size: 10px;
    }

    .cb-workspace {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }

    .cb-blocks {
        max-height: 350px;
        padding: 12px;
    }

    .cb-canvas-wrap {
        grid-column: 1;
        min-width: 0;
    }

    .cb-canvas-top {
        min-height: 48px;
        padding: 8px 10px;
    }

    .cb-canvas-top > div {
        gap: 6px;
    }

    .cb-canvas-top b {
        font-size: 12px;
    }

    .cb-icon-btn {
        min-width: 28px;
        height: 28px;
        padding: 4px 6px;
    }

    .cb-canvas-viewport {
        min-height: 430px;
        max-height: 65vh;
        overflow: auto;
        touch-action: pan-x pan-y;
    }

    /* Keep the canvas large so nodes can be moved without
       forcing the whole page to become wider. */

    .cb-canvas {
        width: 1300px;
        min-width: 1300px;
        height: 900px;
    }

    .cb-settings {
        grid-column: 1;
        max-height: none;
    }

    .cb-settings-heading {
        padding: 13px;
    }

    .cb-settings-body {
        max-height: 65vh;
        padding: 12px;
    }

    .cb-test-panel {
        padding: 13px;
    }

    .cb-test-form {
        align-items: stretch;
        flex-direction: column;
    }

    .cb-test-form > button {
        align-self: flex-start;
    }

    .cb-canvas-foot {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
        padding: 10px;
    }
}

/* =========================================================
   SMALL MOBILE
   ========================================================= */

@media (max-width: 380px) {
    .cb-heading h1 {
        font-size: 21px;
    }

    .cb-wallet-usage-box {
        gap: 5px;
        padding: 4px 6px;
    }

    .cb-compact-actions .cb-wallet {
        font-size: 9px;
    }

    .cb-compact-actions .cb-usage {
        flex-basis: 43px;
        width: 43px;
        min-width: 43px;
    }

    .cb-head-actions .cb-btn {
        padding: 6px 7px;
        font-size: 9px;
    }

    .cb-canvas-viewport {
        min-height: 380px;
    }
}

/* Reduced motion accessibility */

@media (prefers-reduced-motion: reduce) {
    .cb-page *,
    .cb-page *::before,
    .cb-page *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}










/* =========================================================
   ADTHRIVE MEDIA — WHATSAPP CHATS MANAGEMENT
   Scoped to .cm-page; safe to add to existing style.css
   ========================================================= */

.cm-page {
    --cm-primary: #16856b;
    --cm-primary-dark: #106b56;
    --cm-primary-soft: #e9f7f1;
    --cm-text: #172b27;
    --cm-muted: #71817d;
    --cm-border: #e2eae6;
    --cm-surface: #ffffff;
    --cm-background: #f5f8f6;
    --cm-danger: #c53d3d;

    width: 100%;
    min-width: 0;
    padding: 26px;
    color: var(--cm-text);
    font-family: inherit;
    box-sizing: border-box;
}

.cm-page *,
.cm-page *::before,
.cm-page *::after {
    box-sizing: border-box;
}

.cm-page button,
.cm-page input,
.cm-page textarea,
.cm-page select {
    font: inherit;
}

.cm-page button {
    -webkit-tap-highlight-color: transparent;
}

.cm-page button:focus-visible,
.cm-page input:focus-visible,
.cm-page textarea:focus-visible,
.cm-page select:focus-visible {
    outline: 3px solid rgba(22, 133, 107, 0.22);
    outline-offset: 2px;
}

/* -------------------------
   TOP HEADER
   ------------------------- */

.cm-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
}

.cm-eyebrow {
    margin: 0 0 7px;
    color: var(--cm-primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1.1px;
    text-transform: uppercase;
}

.cm-topbar h1 {
    margin: 0;
    color: var(--cm-text);
    font-size: clamp(25px, 3vw, 34px);
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: -0.8px;
}

.cm-subtitle {
    max-width: 680px;
    margin: 9px 0 0;
    color: var(--cm-muted);
    font-size: 14px;
    line-height: 1.7;
}

.cm-top-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
}

.cm-live {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 13px;
    border: 1px solid #d6eee4;
    border-radius: 30px;
    background: #f0faf5;
    color: #167554;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.cm-live i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #20a66b;
    box-shadow: 0 0 0 4px rgba(32, 166, 107, 0.12);
}

/* -------------------------
   BUTTONS
   ------------------------- */

.cm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 750;
    line-height: 1.2;
    white-space: nowrap;
    transition:
        background 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.cm-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.cm-btn:disabled {
    opacity: 0.48;
    cursor: not-allowed;
}

.cm-btn-secondary {
    border-color: var(--cm-border);
    background: #fff;
    color: var(--cm-text);
}

.cm-btn-secondary:hover:not(:disabled) {
    border-color: #b8d9cd;
    background: #f5fbf8;
}

.cm-btn-primary {
    background: var(--cm-primary);
    color: #fff;
    box-shadow: 0 4px 10px rgba(22, 133, 107, 0.12);
}

.cm-btn-primary:hover:not(:disabled) {
    background: var(--cm-primary-dark);
    box-shadow: 0 6px 16px rgba(22, 133, 107, 0.2);
}

/* -------------------------
   NOTICE / STATUS
   ------------------------- */

.cm-notice {
    margin-bottom: 18px;
    padding: 12px 15px;
    border: 1px solid #d8e9e2;
    border-radius: 10px;
    background: #f0f8f4;
    color: #28644f;
    font-size: 13px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.cm-notice:empty,
.cm-notice[hidden] {
    display: none;
}

/* -------------------------
   MAIN WORKSPACE
   ------------------------- */

.cm-workspace {
    display: grid;
    grid-template-columns: minmax(280px, 350px) minmax(0, 1fr);
    gap: 0;
    min-width: 0;
    height: min(720px, calc(100vh - 240px));
    min-height: 470px;
    overflow: hidden;
    border: 1px solid var(--cm-border);
    border-radius: 17px;
    background: var(--cm-surface);
    box-shadow: 0 8px 30px rgba(27, 55, 44, 0.045);
}

/* -------------------------
   LEFT SIDEBAR
   ------------------------- */

.cm-sidebar {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border-right: 1px solid var(--cm-border);
    background: #fff;
}

.cm-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 19px;
    border-bottom: 1px solid var(--cm-border);
}

.cm-controls label {
    margin-top: 4px;
    color: #41544d;
    font-size: 12px;
    font-weight: 750;
}

.cm-controls select,
.cm-controls input {
    display: block;
    width: 100%;
    min-width: 0;
    height: 43px;
    padding: 0 12px;
    border: 1px solid #dce6e1;
    border-radius: 9px;
    background-color: #fff;
    color: var(--cm-text);
    font-size: 13px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cm-controls select:focus,
.cm-controls input:focus {
    border-color: var(--cm-primary);
    box-shadow: 0 0 0 3px rgba(22, 133, 107, 0.08);
    outline: none;
}

.cm-controls input::placeholder {
    color: #a1ada8;
}

.cm-filter-row {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 7px;
}

.cm-filter {
    flex: 1;
    min-width: 0;
    min-height: 35px;
    padding: 7px 8px;
    border: 1px solid #e2eae6;
    border-radius: 8px;
    background: #fff;
    color: #65756f;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    transition: all 0.2s ease;
}

.cm-filter:hover {
    border-color: #b8d9cd;
    color: var(--cm-primary);
}

.cm-filter.is-active {
    border-color: var(--cm-primary);
    background: var(--cm-primary-soft);
    color: var(--cm-primary-dark);
}

/* -------------------------
   CHAT LIST
   ------------------------- */

.cm-chat-list {
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #cbd8d1 transparent;
}

.cm-chat-list::-webkit-scrollbar,
.cm-messages::-webkit-scrollbar {
    width: 5px;
}

.cm-chat-list::-webkit-scrollbar-thumb,
.cm-messages::-webkit-scrollbar-thumb {
    border-radius: 10px;
    background: #cbd8d1;
}

.cm-chat-list > * {
    min-width: 0;
}

.cm-chat-list > button,
.cm-chat-list > a,
.cm-chat-list .cm-chat-item,
.cm-chat-list .cm-chat {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-width: 0;
    padding: 14px 16px;
    border: 0;
    border-bottom: 1px solid #edf1ee;
    background: #fff;
    color: var(--cm-text);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.18s ease;
}

.cm-chat-list > button:hover,
.cm-chat-list > a:hover,
.cm-chat-list .cm-chat-item:hover,
.cm-chat-list .cm-chat:hover {
    background: #f6faf8;
}

.cm-chat-list > button.is-active,
.cm-chat-list > a.is-active,
.cm-chat-list .cm-chat-item.is-active,
.cm-chat-list .cm-chat.is-active,
.cm-chat-list > .is-active {
    background: #eaf7f1;
    box-shadow: inset 3px 0 0 var(--cm-primary);
}

.cm-chat-list img {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
}

.cm-chat-list .cm-avatar,
.cm-chat-list .cm-list-avatar {
    display: flex;
    flex: 0 0 42px;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #e4f3eb;
    color: #197657;
    font-size: 15px;
    font-weight: 800;
}

.cm-chat-list .cm-chat-info,
.cm-chat-list .cm-chat-details,
.cm-chat-list .cm-list-content {
    flex: 1;
    min-width: 0;
}

.cm-chat-list .cm-chat-name,
.cm-chat-list .cm-list-name,
.cm-chat-list strong {
    display: block;
    overflow: hidden;
    color: #20352d;
    font-size: 13px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cm-chat-list .cm-chat-preview,
.cm-chat-list .cm-list-preview,
.cm-chat-list .cm-last-message {
    display: block;
    margin-top: 5px;
    overflow: hidden;
    color: #7d8b85;
    font-size: 12px;
    line-height: 1.5;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cm-chat-list .cm-chat-time,
.cm-chat-list .cm-time {
    align-self: flex-start;
    flex-shrink: 0;
    color: #8a9992;
    font-size: 10px;
}

.cm-chat-list .cm-unread,
.cm-chat-list .cm-unread-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 19px;
    height: 19px;
    margin-top: 6px;
    padding: 0 5px;
    border-radius: 20px;
    background: var(--cm-primary);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
}

.cm-empty {
    padding: 25px 16px;
    color: #87948e;
    font-size: 13px;
    line-height: 1.7;
    text-align: center;
}

.cm-sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 15px;
    border-top: 1px solid var(--cm-border);
    background: #fbfdfc;
    color: #829089;
    font-size: 10px;
}

/* -------------------------
   RIGHT CONVERSATION
   ------------------------- */

.cm-conversation {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: #f8faf8;
}

.cm-chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 77px;
    
    padding: 14px 20px;
    border-bottom: 1px solid var(--cm-border);
    background: #fff;
}

.cm-avatar {
    display: flex;
    flex: 0 0 43px;
    align-items: center;
    justify-content: center;
    width: 43px;
    height: 43px;
    overflow: hidden;
    border-radius: 50%;
    background: #e3f3eb;
    color: #177657;
    font-size: 16px;
    font-weight: 800;
    background: transparent !important;
}


.cm-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    
}

.cm-chat-title {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
    background: transparent !important;
}

.cm-chat-title strong {
    overflow: hidden;
    color: #20352d;
    font-size: 14px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cm-chat-title span {
    overflow: hidden;
    color: #829089;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cm-manual-tag {
    flex-shrink: 0;
    padding: 7px 10px;
    border: 1px solid #dbece4;
    border-radius: 20px;
    background: #f1faf5;
    color: #247454;
    font-size: 11px;
    font-weight: 750;
}

/* -------------------------
   MESSAGE AREA
   ------------------------- */

.cm-messages {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    padding: 22px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    background-color: #f5f8f5;
    background-image: radial-gradient(#dfe8e2 0.7px, transparent 0.7px);
    background-size: 19px 19px;
    scrollbar-width: thin;
    scrollbar-color: #cbd8d1 transparent;
}

/* Common message bubble class names */
.cm-messages .cm-message,
.cm-messages .cm-msg,
.cm-messages .cm-bubble {
    position: relative;
    width: fit-content;
    max-width: min(76%, 540px);
    padding: 11px 13px;
    border: 1px solid #e4ebe6;
    border-radius: 12px 12px 12px 4px;
    background: #fff;
    color: #263b32;
    box-shadow: 0 2px 5px rgba(24, 55, 40, 0.035);
    font-size: 13px;
    line-height: 1.65;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.cm-messages .cm-message.outbound,
.cm-messages .cm-message.sent,
.cm-messages .cm-msg.outbound,
.cm-messages .cm-msg.sent,
.cm-messages .cm-bubble.outbound,
.cm-messages .cm-bubble.sent,
.cm-messages .cm-outbound,
.cm-messages .is-outbound {
    align-self: flex-end;
    border-color: #cce9d9;
    border-radius: 12px 12px 4px 12px;
    background: #dcf6e7;
}

.cm-messages .cm-message.inbound,
.cm-messages .cm-msg.inbound,
.cm-messages .cm-bubble.inbound,
.cm-messages .cm-inbound,
.cm-messages .is-inbound {
    align-self: flex-start;
}

.cm-messages .cm-message p,
.cm-messages .cm-msg p,
.cm-messages .cm-bubble p {
    margin: 0;
}

.cm-messages .cm-message-time,
.cm-messages .cm-msg-time,
.cm-messages .cm-time {
    display: block;
    margin-top: 5px;
    color: #82958a;
    font-size: 10px;
    line-height: 1.3;
    text-align: right;
}

.cm-messages img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.cm-messages a {
    color: #167c61;
    overflow-wrap: anywhere;
}

.cm-messages .cm-message-status,
.cm-messages .cm-status {
    margin-left: 5px;
    color: #708d80;
    font-size: 10px;
}

/* -------------------------
   REPLY COMPOSER
   ------------------------- */

.cm-reply-form {
    display: flex;
    align-items: flex-end;
    gap: 11px;
    padding: 15px 18px;
    border-top: 1px solid var(--cm-border);
    background: #fff;
}

.cm-reply-form textarea {
    display: block;
    flex: 1;
    width: 100%;
    min-width: 0;
    min-height: 46px;
    max-height: 140px;
    padding: 12px 14px;
    resize: vertical;
    border: 1px solid #dce6e1;
    border-radius: 11px;
    background: #fbfdfc;
    color: var(--cm-text);
    font-size: 13px;
    line-height: 1.55;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cm-reply-form textarea::placeholder {
    color: #9aa8a1;
}

.cm-reply-form textarea:focus {
    border-color: var(--cm-primary);
    box-shadow: 0 0 0 3px rgba(22, 133, 107, 0.08);
    outline: none;
}

.cm-reply-form textarea:disabled {
    background: #f1f4f2;
    cursor: not-allowed;
}

.cm-reply-form .cm-btn {
    min-height: 46px;
    flex-shrink: 0;
}

.cm-policy {
    margin: 0;
    padding: 0 18px 14px;
    background: #fff;
    color: #87948e;
    font-size: 10px;
    line-height: 1.6;
}

.cm-footnote {
    margin: 13px 0 0;
    color: #84928b;
    font-size: 11px;
    line-height: 1.6;
}

/* -------------------------
   TABLET
   ------------------------- */

@media (max-width: 1050px) {
    .cm-page {
        padding: 20px;
    }

    .cm-workspace {
        grid-template-columns: minmax(245px, 300px) minmax(0, 1fr);
        height: min(700px, calc(100vh - 220px));
    }

    .cm-controls {
        padding: 15px;
    }

    .cm-chat-header {
        padding: 13px 15px;
    }

    .cm-messages {
        padding: 16px;
    }

    .cm-reply-form {
        padding: 12px;
    }

    .cm-policy {
        padding: 0 12px 12px;
    }
}

/* -------------------------
   MOBILE
   ------------------------- */

@media (max-width: 700px) {
    .cm-page {
        padding: 12px;
    }

    .cm-topbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 14px;
        margin-bottom: 15px;
    }

    .cm-topbar h1 {
        font-size: 26px;
        letter-spacing: -0.5px;
    }

    .cm-subtitle {
        margin-top: 6px;
        font-size: 12px;
        line-height: 1.6;
    }

    .cm-top-actions {
        display: flex;
        justify-content: space-between;
        width: 100%;
        gap: 8px;
    }

    .cm-live {
        padding: 8px 11px;
        font-size: 11px;
    }

    .cm-btn {
        min-height: 39px;
        padding: 9px 12px;
        border-radius: 9px;
        font-size: 12px;
    }

    .cm-notice {
        margin-bottom: 12px;
        padding: 10px 12px;
        font-size: 12px;
    }

    .cm-workspace {
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: 0;
        overflow: hidden;
        border-radius: 13px;
    }

    .cm-sidebar {
        flex: 0 0 auto;
        width: 100%;
        max-height: 44vh;
        min-height: 245px;
        border-right: 0;
        border-bottom: 1px solid var(--cm-border);
    }

    .cm-controls {
        gap: 7px;
        padding: 12px;
    }

    .cm-controls label {
        font-size: 11px;
    }

    .cm-controls select,
    .cm-controls input {
        height: 40px;
        padding: 0 10px;
        font-size: 12px;
    }

    .cm-filter-row {
        gap: 6px;
        margin-top: 5px;
    }

    .cm-filter {
        min-height: 34px;
        padding: 7px 5px;
        font-size: 11px;
    }

    .cm-chat-list {
        flex: 1;
        min-height: 80px;
    }

    .cm-chat-list > button,
    .cm-chat-list > a,
    .cm-chat-list .cm-chat-item,
    .cm-chat-list .cm-chat {
        gap: 10px;
        padding: 10px 12px;
    }

    .cm-chat-list img,
    .cm-chat-list .cm-avatar,
    .cm-chat-list .cm-list-avatar {
        flex-basis: 36px;
        width: 36px;
        height: 36px;
        font-size: 13px;
    }

    .cm-chat-list .cm-chat-name,
    .cm-chat-list .cm-list-name,
    .cm-chat-list strong {
        font-size: 12px;
    }

    .cm-chat-list .cm-chat-preview,
    .cm-chat-list .cm-list-preview,
    .cm-chat-list .cm-last-message {
        font-size: 11px;
    }

    .cm-sidebar-footer {
        padding: 9px 12px;
        font-size: 9px;
    }

    .cm-conversation {
        flex: 0 0 auto;
        width: 100%;
        height: 520px;
        min-height: 400px;
    }

    .cm-chat-header {
        min-height: 65px;
        gap: 9px;
        padding: 10px 12px;
    }

    .cm-avatar {
        flex-basis: 36px;
        width: 36px;
        height: 36px;
        font-size: 13px;
    }

    .cm-chat-title strong {
        font-size: 12px;
    }

    .cm-chat-title span {
        font-size: 10px;
    }

    .cm-manual-tag {
        padding: 6px 8px;
        font-size: 9px;
    }

    .cm-messages {
        gap: 10px;
        padding: 13px 10px;
        background-size: 17px 17px;
    }

    .cm-messages .cm-message,
    .cm-messages .cm-msg,
    .cm-messages .cm-bubble {
        max-width: 88%;
        padding: 9px 11px;
        font-size: 12px;
        line-height: 1.6;
    }

    .cm-messages .cm-message-time,
    .cm-messages .cm-msg-time,
    .cm-messages .cm-time {
        font-size: 9px;
    }

    .cm-reply-form {
        align-items: stretch;
        gap: 8px;
        padding: 10px;
    }

    .cm-reply-form textarea {
        min-height: 42px;
        max-height: 100px;
        padding: 10px;
        border-radius: 9px;
        font-size: 12px;
    }

    .cm-reply-form .cm-btn {
        min-height: 42px;
        padding: 8px 10px;
        font-size: 11px;
    }

    .cm-policy {
        padding: 0 10px 10px;
        font-size: 9px;
        line-height: 1.5;
    }

    .cm-footnote {
        margin-top: 10px;
        font-size: 10px;
    }
}

/* -------------------------
   SMALL MOBILE
   ------------------------- */

@media (max-width: 380px) {
    .cm-page {
        padding: 8px;
    }

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

    .cm-top-actions {
        gap: 6px;
    }

    .cm-btn {
        padding: 8px 9px;
        font-size: 11px;
    }

    .cm-sidebar {
        max-height: 46vh;
    }

    .cm-controls {
        padding: 10px;
    }

    .cm-conversation {
        height: 480px;
        min-height: 370px;
    }

    .cm-manual-tag {
        padding: 5px 6px;
        font-size: 8px;
    }

    .cm-reply-form {
        gap: 6px;
        padding: 8px;
    }

    .cm-reply-form .cm-btn {
        padding: 7px 8px;
        font-size: 10px;
    }
}

/* -------------------------
   REDUCED MOTION
   ------------------------- */

@media (prefers-reduced-motion: reduce) {
    .cm-page *,
    .cm-page *::before,
    .cm-page *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}