:root {
    --green: #0b6257;
    --green-light: #128b7b;
    --green-soft: #e5f5f0;
    --ink: #182230;
    --muted: #74808d;
    --line: #e3e8ee;
    --page: #f1f5f9;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--page);
    color: var(--ink);
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 15px;
}

a {
    color: inherit;
    text-decoration: none;
}

button, input, select {
    font: inherit;
}

.topbar {
    min-height: 72px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 14px 4%;
    border-bottom: 1px solid var(--line);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 21px;
    font-weight: 800;
}

.brand-icon, .hero-mark {
    display: grid;
    place-items: center;
    width: 45px;
    height: 45px;
    border-radius: 13px;
    background: var(--green);
    color: white;
    font-weight: 800;
}

.topbar-subtitle {
    color: var(--muted);
    font-size: 13px;
}

.page-shell {
    max-width: 1480px;
    margin: auto;
    padding: 25px -8px 45px;
}

.hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    padding: 10px 20px;
    color: white;
    border-radius: 20px;
    background: linear-gradient(120deg, #0b6257, #128b7b);
    margin-bottom: 20px;
}

    .hero h1 {
        margin: 0 0 7px;
        font-size: clamp(25px, 3vw, 32px);
    }

    .hero p {
        margin: 0;
        color: #d7f1eb;
    }

.hero-mark {
    width: 55px;
    height: 55px;
    background: white;
    color: var(--green);
}

.eyebrow {
    font-size: 10px;
    letter-spacing: 1.5px;
    color: #89969d;
    margin-bottom: 6px;
    font-weight: 800;
}

.panel {
    background: white;
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 20px;
}

.panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
}

    .panel-heading h2 {
        margin: 0;
        font-size: 24px;
    }

.count-pill {
    background: var(--green-soft);
    color: var(--green);
    border-radius: 25px;
    padding: 9px 13px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.field {
    margin-bottom: 22px;
}

    .field > label {
        display: block;
        font-weight: 700;
        margin-bottom: 10px;
    }

.optional {
    color: var(--muted);
    font-weight: 400;
}

.form-control {
    width: 100%;
    min-width: 0;
    padding: 13px;
    border: 1px solid #dce3e9;
    border-radius: 12px;
    background: #f8fafc;
    color: var(--ink);
    outline: none;
}

    .form-control:focus {
        border-color: var(--green-light);
        box-shadow: 0 0 0 3px #128b7b20;
    }

.template-row, .file-row {
    display: flex;
    align-items: center;
    gap: 9px;
}

.dropdown-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
}

.template-search {
    padding-right: 42px;
}

.dropdown-chevron {
    position: absolute;
    right: 14px;
    top: 10px;
    color: var(--green);
    font-size: 22px;
    pointer-events: none;
}

.dropdown-options {
    display: none;
    position: absolute;
    z-index: 100;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    max-height: 250px;
    overflow-y: auto;
    padding: 6px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 12px 30px #15253b20;
}

    .dropdown-options.open {
        display: block;
    }

.template-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px;
    border: 0;
    border-radius: 9px;
    background: white;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
}

    .template-option:hover,
    .template-option:focus {
        background: var(--green-soft);
    }

    .template-option[hidden] {
        display: none;
    }

    .template-option small {
        color: var(--muted);
        white-space: nowrap;
    }

.icon-button {
    display: grid;
    place-items: center;
    width: 50px;
    height: 48px;
    flex-shrink: 0;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    font-size: 23px;
}

.refresh {
    background: var(--green-soft);
    color: var(--green);
}

.attach {
    background: #eaf2ff;
    color: #366dc0;
}

.image-button {
    background: #f1eaff;
    color: #7c49b2;
}

.clear {
    background: #fff0f0;
    color: #bf3434;
}

.search-button {
    background: #edf1f5;
    color: #33465a;
}

.file-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border: 1px solid var(--line);
    background: #f8fafc;
    border-radius: 12px;
    padding: 13px;
    font-size: 14px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.field-hint {
    color: var(--muted);
    font-size: 13px;
    margin-top: 9px;
}

.separator {
    height: 1px;
    background: var(--line);
    margin: 5px 0 23px;
}

.button-primary, .button-secondary {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 9px;
    border: 0;
    border-radius: 12px;
    padding: 13px 18px;
    font-weight: 800;
    cursor: pointer;
}

.button-primary {
    background: var(--green-light);
    color: white;
}

    .button-primary:hover {
        background: var(--green);
    }

.button-secondary {
    background: var(--green-soft);
    color: var(--green);
}

.send-button {
    width: 100%;
    min-height: 56px;
    font-size: 16px;
}

    .send-button:disabled {
        opacity: .65;
        cursor: wait;
    }

.form-validation {
    color: #b42318;
    font-size: 13px;
    margin-top: 10px;
}

.alert {
    padding: 13px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    overflow-wrap: anywhere;
}

.success {
    background: #e6f6ed;
    color: #17653d;
}

.danger {
    background: #fff0f0;
    color: #a12626;
}

.history-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    padding: 20px 22px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 17px;
}

    .history-link:hover {
        box-shadow: 0 8px 24px #15253b10;
    }

    .history-link h2 {
        margin: 0 0 5px;
        font-size: 20px;
    }

    .history-link p {
        margin: 0;
        color: var(--muted);
        font-size: 13px;
    }

.history-arrow {
    font-size: 26px;
    color: var(--green);
}

.filter-row {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) 150px 50px 50px;
    gap: 9px;
    margin-bottom: 18px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.message-table {
    border-collapse: collapse;
    width: 100%;
    min-width: 650px;
    text-align: left;
}

    .message-table thead {
        background: var(--green);
        color: white;
    }

    .message-table th {
        font-size: 13px;
        padding: 15px;
        white-space: nowrap;
    }

    .message-table td {
        padding: 15px;
        border-bottom: 1px solid #edf0f3;
        vertical-align: middle;
    }

    .message-table tbody tr:last-child td {
        border-bottom: 0;
    }

    .message-table tbody tr:hover {
        background: #f8fbfa;
    }

.id-cell {
    color: #4c5967;
    width: 65px;
}

.candidate-link {
    display: block;
    font-weight: 750;
    max-width: 310px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.phone-link {
    display: inline-block;
    color: var(--muted);
    font-size: 13px;
    margin-top: 5px;
}

    .candidate-link:hover,
    .phone-link:hover {
        color: var(--green);
        text-decoration: underline;
    }

.status-badge {
    display: inline-flex;
    justify-content: center;
    min-width: 82px;
    padding: 8px 11px;
    border-radius: 9px;
    background: #edf1f5;
    color: #465466;
    font-size: 12px;
    font-weight: 800;
    text-transform: lowercase;
}

    .status-badge.delivered,
    .status-badge.read {
        background: #e3f5ef;
        color: #0b6859;
    }

    .status-badge.sent {
        background: #e7f0ff;
        color: #315ca8;
    }

    .status-badge.failed {
        background: #ffeded;
        color: #b42318;
    }

    .status-badge.pending,
    .status-badge.queued {
        background: #fff5dd;
        color: #946200;
    }

.date-cell {
    color: #5e6a77;
    font-size: 13px;
    white-space: nowrap;
}

.empty-cell {
    text-align: center;
    color: var(--muted);
    padding: 30px !important;
}

.pagination-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.rows-form, .page-actions {
    display: flex;
    align-items: center;
    gap: 9px;
}

.rows-form {
    color: var(--muted);
}

.compact-select {
    width: 78px;
    padding: 9px;
}

.page-info, .page-number {
    font-size: 13px;
    color: var(--muted);
}

.page-button {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: var(--green-soft);
    color: var(--green);
    font-size: 24px;
}

    .page-button.disabled {
        opacity: .35;
        pointer-events: none;
    }

.footnote {
    color: var(--muted);
    font-size: 13px;
    margin-top: 17px;
}

@media (max-width: 700px) {
    .topbar {
        min-height: 64px;
        padding: 12px 14px;
    }

    .brand {
        font-size: 17px;
        gap: 8px;
    }

    .brand-icon {
        width: 37px;
        height: 37px;
    }

    .topbar-subtitle {
        display: none;
    }

    .page-shell {
        padding: 15px 12px 30px;
    }

    .hero {
        padding: 20px 16px;
    }

        .hero h1 {
            font-size: 24px;
        }

    .hero-mark {
        width: 44px;
        height: 44px;
    }

    .panel {
        padding: 16px 12px;
        border-radius: 17px;
    }

    .panel-heading h2 {
        font-size: 20px;
    }

    .count-pill {
        font-size: 10px;
        padding: 8px;
    }

    .icon-button {
        width: 42px;
        height: 44px;
    }

    .filter-row {
        grid-template-columns: minmax(0, 1fr) 83px 40px 40px;
        gap: 5px;
    }

        .filter-row .form-control {
            padding: 9px 7px;
            font-size: 12px;
        }

    .message-table th,
    .message-table td {
        padding: 12px 10px;
    }

    .page-info {
        width: 100%;
        order: 3;
    }

    .page-actions {
        margin-left: auto;
    }

    .history-actions {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 10px;
        flex-wrap: wrap;
    }

    @media (max-width: 700px) {
        .history-actions {
            gap: 7px;
        }

            .history-actions .button-secondary {
                padding: 10px;
                font-size: 12px;
            }

            .history-actions .count-pill {
                font-size: 10px;
                padding: 8px;
            }
    }
}

.bulk-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.panel-title {
    min-width: 0;
}

.heading-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.history-header-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 15px;
    border: 1px solid #d8eee6;
    border-radius: 12px;
    background: var(--green-soft);
    color: var(--green);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
    text-decoration: none;
    transition: background .18s ease, transform .18s ease;
}

    .history-header-button:hover {
        background: #d9f1e8;
        color: var(--green);
        transform: translateY(-1px);
    }

.history-link-content {
    min-width: 0;
}

.history-link .history-arrow {
    flex: 0 0 auto;
}

@media (max-width: 600px) {
    .bulk-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .heading-actions {
        width: 100%;
        justify-content: space-between;
    }

    .history-header-button {
        min-height: 38px;
        padding: 9px 11px;
        font-size: 11px;
    }

    .history-link {
        padding: 16px;
    }

        .history-link h2 {
            font-size: 17px;
        }

        .history-link p {
            font-size: 11px;
        }
}

.file-row {
    cursor: pointer;
}

    .file-row .file-name {
        cursor: pointer;
    }

    .file-row:focus-within {
        outline: 2px solid var(--green-light);
        outline-offset: 2px;
        border-radius: 12px;
    }

.template-name-cell {
    display: inline-block;
    max-width: 260px;
    color: #075e54;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.filter-row .form-control {
    min-width: 0;
}

.filter-row .search-button {
    cursor: pointer;
}

#templateDropdownWrap {
    position: relative;
    flex: 1;
    min-width: 0;
}

#templateSearch {
    width: 100%;
    cursor: text;
    padding-right: 42px;
}

#templateOptions {
    display: none;
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    max-height: 280px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 6px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 12px 30px #15253b20;
    z-index: 9999;
}

    #templateOptions.open {
        display: block;
    }

    #templateOptions .template-option {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
        width: 100%;
        padding: 12px;
        border: 0;
        border-radius: 9px;
        background: #ffffff;
        color: var(--ink);
        text-align: left;
        cursor: pointer;
    }

        #templateOptions .template-option:hover,
        #templateOptions .template-option:focus {
            background: var(--green-soft);
            outline: none;
        }

        #templateOptions .template-option[hidden],
        #templateOptions .template-empty-message[hidden] {
            display: none !important;
        }

        #templateOptions .template-option span {
            overflow-wrap: anywhere;
        }

        #templateOptions .template-option small {
            flex-shrink: 0;
            color: var(--muted);
            white-space: nowrap;
        }

    #templateOptions .template-empty-message {
        padding: 14px 12px;
        color: var(--muted);
        font-size: 13px;
    }

#templateHint {
    overflow-wrap: anywhere;
}

@media (max-width: 600px) {
    #templateOptions {
        max-height: 220px;
    }

        #templateOptions .template-option {
            padding: 10px;
            font-size: 13px;
        }
}

.file-picker-row {
    position: relative;
    cursor: pointer;
    min-height: 48px;
}

    .file-picker-row:hover {
        border-color: #25a56a;
    }

    .file-picker-row:focus-visible {
        outline: 2px solid #25a56a;
        outline-offset: 2px;
    }

    .file-picker-row .clear {
        flex-shrink: 0;
        position: relative;
        z-index: 2;
        cursor: pointer;
    }

    .file-picker-row .file-picker-input {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        opacity: 0;
        cursor: pointer;
        z-index: 1;
        margin: 0;
    }

    .file-picker-row .file-name,
    .file-picker-row .icon-button.attach,
    .file-picker-row .icon-button.image-button {
        pointer-events: none;
    }

    .file-picker-row:focus-within {
        outline: 2px solid #25a56a;
        outline-offset: 2px;
    }

.bulk-page,
.bulk-page * {
    box-sizing: border-box;
}

.bulk-page {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

    .bulk-page .hero,
    .bulk-page .panel {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .bulk-page .panel-heading,
    .bulk-page .bulk-heading,
    .bulk-page .heading-actions,
    .bulk-page .template-row,
    .bulk-page .dropdown-wrap,
    .bulk-page .file-row {
        min-width: 0;
        max-width: 100%;
    }

    .bulk-page .template-row {
        display: flex;
        align-items: stretch;
        gap: 8px;
        width: 100%;
    }

    .bulk-page .dropdown-wrap {
        position: relative;
        flex: 1 1 0;
        width: 100%;
        min-width: 0;
    }

    .bulk-page .template-search {
        display: block;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        padding-right: 38px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .bulk-page .dropdown-chevron {
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        pointer-events: none;
    }

    .bulk-page .dropdown-options {
        position: absolute;
        top: calc(100% + 4px);
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        max-height: 260px;
        overflow-y: auto;
        overflow-x: hidden;
        z-index: 1000;
    }

    .bulk-page .template-option {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        text-align: left;
        overflow: hidden;
    }

        .bulk-page .template-option span {
            flex: 1 1 auto;
            min-width: 0;
            overflow-wrap: anywhere;
            word-break: break-word;
        }

        .bulk-page .template-option small {
            flex: 0 0 auto;
            white-space: nowrap;
        }

    .bulk-page .file-row {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
        overflow: hidden;
    }

    .bulk-page .file-name {
        flex: 1 1 auto;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .bulk-page .file-row .icon-button {
        flex: 0 0 auto;
    }

    .bulk-page .send-button {
        width: 100%;
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .bulk-page .form-validation {
        max-width: 100%;
        overflow-wrap: anywhere;
    }

@media (max-width: 600px) {
    .bulk-page .panel-heading {
        flex-wrap: wrap;
        gap: 12px;
    }

    .bulk-page .heading-actions {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        width: 100%;
    }

    .bulk-page .history-header-button {
        max-width: 100%;
    }

    .bulk-page .template-row {
        gap: 6px;
    }

    .bulk-page .template-option {
        align-items: flex-start;
    }

        .bulk-page .template-option small {
            font-size: 11px;
        }
}

.whatsapp-chat-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 7px 12px;
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: #ffffff;
    text-decoration: none;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    border: none;
    transition: 0.2s ease;
}

    .whatsapp-chat-button:hover {
        background: #128C7E;
        color: #ffffff;
        transform: translateY(-1px);
    }

.whatsapp-icon {
    font-size: 17px;
    line-height: 1;
}

.whatsapp-chat-panel {
    overflow: hidden;
}

.whatsapp-chat-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border-bottom: 1px solid #e5e7eb;
    flex-wrap: wrap;
}

.whatsapp-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: white;
    font-weight: 700;
}

.whatsapp-contact-info {
    flex: 1;
    min-width: 150px;
}

    .whatsapp-contact-info h2 {
        font-size: 17px;
        margin: 0 0 5px;
    }

    .whatsapp-contact-info p {
        margin: 0;
        color: #64748b;
        font-size: 13px;
        overflow-wrap: anywhere;
    }

.whatsapp-chat-body {
    min-height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: #f0fdf4;
}

.chat-empty-state {
    text-align: center;
    max-width: 400px;
}

.chat-empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #dcfce7;
    color: #128C7E;
    font-size: 30px;
}

.chat-empty-state h3 {
    margin-bottom: 10px;
}

.chat-empty-state p {
    color: #64748b;
    font-size: 13px;
    overflow-wrap: anywhere;
}

.wa-page {
    max-width: 1100px;
    margin: 0 auto;
}

.wa-shell {
    overflow: hidden;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 15px;
    box-shadow: 0 5px 24px rgba(15,23,42,.07);
}

.wa-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #075e54;
    color: white;
}

.wa-avatar {
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    border-radius: 50%;
    background: #d9fdd3;
    color: #075e54;
    font-size: 20px;
    font-weight: 800;
}

.wa-contact {
    flex: 1;
    min-width: 0;
}

    .wa-contact h2 {
        margin: 0;
        color: white;
        font-size: 16px;
        overflow-wrap: anywhere;
    }

    .wa-contact p {
        margin: 4px 0 0;
        color: #d1fae5;
        font-size: 12px;
    }

.wa-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.wa-header-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 11px;
    color: #fff;
    border: 1px solid rgba(255,255,255,.4);
    border-radius: 7px;
    text-decoration: none;
    font-size: 12px;
    white-space: nowrap;
    background: transparent;
    cursor: pointer;
}

    .wa-header-button:hover {
        background: rgba(255,255,255,.12);
        color: #fff;
    }

.wa-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.wa-search {
    background: #fff;
    outline: none;
    font-size: 13px;
    flex: 1;
    min-width: 0;
    height: 38px;
    padding: 8px 12px;
    border: 1px solid #dbe3ea;
    border-radius: 8px;
}

    .wa-search:focus {
        border-color: #128c7e;
        box-shadow: 0 0 0 3px rgba(18,140,126,.1);
    }

.wa-refresh {
    height: 38px;
    padding: 0 13px;
    border: 0;
    border-radius: 8px;
    background: #128c7e;
    color: #fff;
    cursor: pointer;
}

.wa-chat-body {
    height: min(65vh, 650px);
    min-height: 350px;
    overflow-y: auto;
    padding: 20px clamp(12px, 4vw, 35px);
    background-color: #efeae2;
    background-image: radial-gradient( rgba(255,255,255,.32) 1px, transparent 1px );
    background-size: 18px 18px;
}

.wa-date-divider {
    display: flex;
    justify-content: center;
    margin: 16px 0;
}

    .wa-date-divider span {
        padding: 6px 12px;
        border-radius: 8px;
        color: #475569;
        background: #fff;
        box-shadow: 0 1px 2px rgba(0,0,0,.05);
        font-size: 11px;
    }

.wa-message-row {
    display: flex;
    width: 100%;
    margin: 9px 0;
}

    .wa-message-row.outgoing {
        justify-content: flex-end;
    }

    .wa-message-row.incoming {
        justify-content: flex-start;
    }

.wa-bubble {
    max-width: min(85%, 570px);
    min-width: 120px;
    padding: 11px 12px 8px;
    border-radius: 10px;
    overflow-wrap: anywhere;
    box-shadow: 0 1px 2px rgba(0,0,0,.06);
}

.outgoing .wa-bubble {
    background: #d9fdd3;
    border-top-right-radius: 3px;
}

.incoming .wa-bubble {
    background: #fff;
    border-top-left-radius: 3px;
}

.wa-message-label {
    margin-bottom: 5px;
    font-size: 10px;
    font-weight: 700;
    color: #128c7e;
}

.wa-message-text {
    color: #1f2937;
    font-size: 13px;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.wa-message-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 5px;
    margin-top: 5px;
    color: #64748b;
    font-size: 10px;
}

.wa-ticks {
    color: #64748b;
    font-size: 13px;
    font-weight: 800;
}

    .wa-ticks.read {
        color: #0ea5e9;
    }

.wa-reply-card {
    margin-top: 8px;
    padding: 9px;
    border-left: 3px solid #128c7e;
    border-radius: 4px;
    background: rgba(255,255,255,.72);
}

.wa-reply-heading {
    margin-bottom: 4px;
    color: #128c7e;
    font-size: 11px;
    font-weight: 700;
}

.wa-empty {
    max-width: 430px;
    margin: 60px auto;
    padding: 25px;
    border-radius: 12px;
    background: white;
    text-align: center;
}

.wa-empty-icon {
    font-size: 38px;
    margin-bottom: 10px;
}

.wa-empty h3 {
    font-size: 17px;
    margin-bottom: 8px;
}

.wa-empty p {
    color: #64748b;
    font-size: 12px;
    line-height: 1.6;
}

.wa-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 13px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

.wa-footer-note {
    flex: 1;
    color: #64748b;
    font-size: 12px;
    line-height: 1.5;
}

.wa-open-whatsapp {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 14px;
    border-radius: 8px;
    background: #25d366;
    color: #064e3b;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

    .wa-open-whatsapp:hover {
        background: #1ebe5d;
        color: #064e3b;
    }

.wa-error {
    font-size: 13px;
    margin: 12px;
    padding: 12px;
    border-radius: 8px;
    background: #fee2e2;
    color: #991b1b;
    overflow-wrap: anywhere;
}

@media (max-width: 600px) {
    .wa-header {
        padding: 12px;
        gap: 9px;
    }

    .wa-avatar {
        width: 39px;
        height: 39px;
        font-size: 16px;
    }

    .wa-contact h2 {
        font-size: 14px;
    }

    .wa-header-button {
        padding: 7px 8px;
        font-size: 11px;
    }

    .wa-chat-body {
        height: 60vh;
        min-height: 320px;
        padding: 12px 9px;
    }

    .wa-bubble {
        max-width: 88%;
    }

    .wa-footer {
        align-items: flex-start;
        flex-wrap: wrap;
        padding: 10px;
    }

    .wa-footer-note {
        flex-basis: 100%;
    }

    .wa-open-whatsapp {
        width: 100%;
    }
}

.wa-actions {
    display: flex;
    gap: 7px;
}

    .wa-actions a,
    .wa-actions button {
        padding: 8px 10px;
        border: 1px solid rgba(255,255,255,.4);
        border-radius: 7px;
        background: transparent;
        color: white;
        text-decoration: none;
        font-size: 12px;
        cursor: pointer;
    }

.wa-count {
    color: #64748b;
    font-size: 12px;
    white-space: nowrap;
}

.wa-body {
    height: min(68vh, 680px);
    min-height: 350px;
    padding: 18px clamp(10px, 4vw, 35px);
    overflow-y: auto;
    background-color: #efeae2;
    background-image: radial-gradient( rgba(255,255,255,.3) 1px, transparent 1px);
    background-size: 18px 18px;
}

.wa-date {
    display: flex;
    justify-content: center;
    margin: 15px 0;
}

    .wa-date span {
        padding: 6px 12px;
        border-radius: 8px;
        background: white;
        color: #64748b;
        font-size: 11px;
    }

.wa-row {
    display: flex;
    width: 100%;
    margin: 10px 0;
}

    .wa-row.sent {
        justify-content: flex-end;
    }

    .wa-row.received {
        justify-content: flex-start;
    }

    .wa-row.sent .wa-bubble {
        background: #d9fdd3;
        border-top-right-radius: 3px;
    }

    .wa-row.received .wa-bubble {
        background: white;
        border-top-left-radius: 3px;
    }

.wa-sender {
    margin-bottom: 7px;
    color: #128c7e;
    font-size: 11px;
    font-weight: 800;
}

.wa-template-title {
    margin-bottom: 9px;
    color: #075e54;
    font-size: 14px;
    font-weight: 800;
}

.wa-template-id {
    display: inline-block;
    margin-bottom: 8px;
    padding: 4px 7px;
    border-radius: 5px;
    background: rgba(18,140,126,.12);
    color: #075e54;
    font-size: 10px;
}

.wa-text {
    color: #1f2937;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.wa-template-section {
    margin-top: 10px;
    padding-top: 9px;
    border-top: 1px solid rgba(0,0,0,.1);
}

.wa-field-label {
    margin-bottom: 4px;
    color: #64748b;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.wa-template-image {
    display: block;
    max-width: 100%;
    max-height: 300px;
    margin: 8px 0;
    border-radius: 9px;
    object-fit: contain;
    background: #fff;
}

.wa-template-video,
.wa-reply-video {
    display: block;
    width: 100%;
    max-width: 420px;
    max-height: 320px;
    margin: 8px 0;
    border-radius: 9px;
    background: #111827;
}

.wa-reply-image {
    display: block;
    width: 100%;
    max-width: 420px;
    max-height: 360px;
    margin: 8px 0;
    border-radius: 9px;
    object-fit: contain;
    background: #f8fafc;
}

.wa-media-label {
    margin-top: 6px;
    color: #64748b;
    font-size: 11px;
}

.wa-image-link {
    display: inline-block;
    margin-top: 5px;
    color: #075e54;
    font-size: 11px;
    text-decoration: underline;
    overflow-wrap: anywhere;
}

.wa-meta {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    margin-top: 7px;
    color: #64748b;
    font-size: 10px;
}

.wa-status {
    margin-top: 7px;
    padding-top: 6px;
    border-top: 1px solid rgba(0,0,0,.07);
    color: #64748b;
    font-size: 10px;
    text-transform: capitalize;
}

.wa-footer p {
    flex: 1;
    min-width: 180px;
    margin: 0;
    color: #64748b;
    font-size: 12px;
    line-height: 1.5;
}

.wa-open {
    padding: 10px 14px;
    border-radius: 8px;
    background: #25d366;
    color: #064e3b;
    text-decoration: none;
    font-size: 12px;
    font-weight: 800;
}

.wa-row[hidden],
.wa-date[hidden],
#waNoResults[hidden] {
    display: none !important;
}

.wa-composer {
    display: flex;
    align-items: flex-end;
    gap: 9px;
    padding: 12px;
    background: #f0f2f5;
    border-top: 1px solid #e2e8f0;
}

.wa-composer-input {
    flex: 1;
    min-width: 0;
    min-height: 42px;
    max-height: 130px;
    resize: vertical;
    padding: 11px 14px;
    border: 1px solid #dbe3ea;
    border-radius: 22px;
    outline: none;
    background: #fff;
    color: #202c33;
    font: inherit;
    font-size: 14px;
}

    .wa-composer-input:focus {
        border-color: #128c7e;
        box-shadow: 0 0 0 3px rgba(18,140,126,.1);
    }

.wa-send-text {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border: 0;
    border-radius: 50%;
    background: #075e54;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
}

    .wa-send-text:disabled {
        opacity: .5;
        cursor: not-allowed;
    }

.wa-composer-note {
    padding: 0 12px 10px;
    background: #f0f2f5;
    color: #64748b;
    font-size: 11px;
}

@media (max-width: 600px) {
    .wa-header {
        padding: 11px;
        gap: 8px;
    }

    .wa-avatar {
        width: 37px;
        height: 37px;
        font-size: 16px;
    }

    .wa-contact h2 {
        font-size: 13px;
    }

    .wa-actions a,
    .wa-actions button {
        padding: 7px;
        font-size: 11px;
    }

    .wa-body {
        height: 60vh;
        min-height: 320px;
        padding: 12px 8px;
    }

    .wa-bubble {
        max-width: 92%;
    }

    .wa-toolbar {
        gap: 7px;
        padding: 9px;
    }

    .wa-count {
        font-size: 10px;
    }

    .wa-footer p {
        flex-basis: 100%;
    }

    .wa-open {
        width: 100%;
        text-align: center;
    }
}

/* Bulk Message dropdown and file picker fixes */

.bulk-page,
.bulk-page * {
    box-sizing: border-box;
}

    .bulk-page .template-row,
    .bulk-page .file-row {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
        min-width: 0;
    }

    .bulk-page #templateDropdownWrap {
        position: relative;
        flex: 1 1 0;
        min-width: 0;
    }

    .bulk-page #templateSearch {
        width: 100%;
        min-width: 0;
        padding-right: 40px;
        cursor: text;
    }

    .bulk-page .dropdown-chevron {
        position: absolute;
        top: 50%;
        right: 13px;
        transform: translateY(-50%);
        pointer-events: none;
    }

    .bulk-page #templateOptions {
        display: none;
        position: absolute;
        top: calc(100% + 5px);
        left: 0;
        right: 0;
        width: 100%;
        max-height: 260px;
        overflow-y: auto;
        overflow-x: hidden;
        overscroll-behavior: contain;
        padding: 6px;
        background: #fff;
        border: 1px solid var(--line);
        border-radius: 12px;
        box-shadow: 0 12px 30px #15253b20;
        z-index: 9999;
    }

        .bulk-page #templateOptions.open {
            display: block;
        }

        .bulk-page #templateOptions .template-option {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            width: 100%;
            padding: 12px;
            border: 0;
            border-radius: 8px;
            background: #fff;
            color: var(--ink);
            text-align: left;
            cursor: pointer;
        }

            .bulk-page #templateOptions .template-option:hover,
            .bulk-page #templateOptions .template-option:focus,
            .bulk-page #templateOptions .template-option.selected {
                background: var(--green-soft);
                outline: none;
            }

            .bulk-page #templateOptions .template-option[hidden],
            .bulk-page #templateOptions .template-empty-message[hidden] {
                display: none !important;
            }

            .bulk-page #templateOptions .template-option span {
                flex: 1 1 auto;
                min-width: 0;
                overflow-wrap: anywhere;
            }

            .bulk-page #templateOptions .template-option small {
                flex-shrink: 0;
                color: var(--muted);
                white-space: nowrap;
            }

        .bulk-page #templateOptions .template-empty-message {
            padding: 14px 12px;
            color: var(--muted);
            font-size: 13px;
        }

    .bulk-page .file-picker-row {
        position: relative;
        min-height: 48px;
        cursor: pointer;
    }

        .bulk-page .file-picker-row:hover .file-name {
            border-color: var(--green-light);
        }

        .bulk-page .file-picker-row:focus-visible {
            outline: 2px solid var(--green-light);
            outline-offset: 2px;
            border-radius: 12px;
        }

        .bulk-page .file-picker-row .file-name {
            flex: 1 1 auto;
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .bulk-page .file-picker-row .icon-button {
            flex: 0 0 48px;
            pointer-events: none;
        }

            .bulk-page .file-picker-row .icon-button img {
                display: block;
                width: 32px;
                height: 32px;
                object-fit: contain;
            }

        .bulk-page .file-picker-row .file-picker-input {
            position: absolute;
            width: 1px;
            height: 1px;
            opacity: 0;
            overflow: hidden;
            pointer-events: none;
        }

        .bulk-page .file-picker-row .clear {
            position: relative;
            z-index: 2;
            flex: 0 0 42px;
            pointer-events: auto;
            cursor: pointer;
        }

    .bulk-page .form-validation {
        overflow-wrap: anywhere;
    }

@media (max-width: 600px) {
    .bulk-page #templateOptions {
        max-height: 220px;
    }

        .bulk-page #templateOptions .template-option {
            padding: 10px;
            font-size: 13px;
        }

            .bulk-page #templateOptions .template-option small {
                font-size: 11px;
            }

    .bulk-page .file-row {
        gap: 6px;
    }

    .bulk-page .file-picker-row .icon-button {
        flex-basis: 40px;
    }

    .bulk-page .file-picker-row .clear {
        flex-basis: 38px;
    }
}

.wa-share-panel {
    position: relative;
    padding: 12px 14px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

    .wa-share-panel .wa-composer {
        display: flex;
        align-items: flex-end;
        gap: 10px;
        width: 100%;
        margin: 0;
    }

.wa-attachment-toggle {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: #e5f5f0;
    color: #075e54;
    font-size: 29px;
    line-height: 1;
    cursor: pointer;
}

    .wa-attachment-toggle:hover,
    .wa-attachment-toggle[aria-expanded="true"] {
        background: #ccece1;
    }

.wa-share-panel .wa-composer-input {
    flex: 1;
    min-width: 0;
    min-height: 42px;
    max-height: 130px;
    resize: none;
    padding: 11px 14px;
    border: 1px solid #dce5e9;
    border-radius: 22px;
    background: #fff;
    color: #182230;
    font: inherit;
    outline: none;
}

    .wa-share-panel .wa-composer-input:focus {
        border-color: #128b7b;
    }

.wa-share-panel .wa-send-text {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: #075e54;
    color: #fff;
    font-size: 19px;
    cursor: pointer;
}

    .wa-share-panel .wa-send-text:disabled {
        opacity: .5;
        cursor: not-allowed;
    }

.wa-attachment-menu {
    position: absolute;
    z-index: 2000;
    left: 14px;
    bottom: 72px;
    width: 220px;
    max-width: calc(100vw - 40px);
    padding: 8px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .18);
}

    .wa-attachment-menu[hidden],
    .wa-selected-file[hidden],
    .wa-number-panel[hidden] {
        display: none !important;
    }

    .wa-attachment-menu button {
        display: flex;
        align-items: center;
        gap: 12px;
        width: 100%;
        padding: 10px;
        border: 0;
        border-radius: 9px;
        background: #fff;
        color: #182230;
        text-align: left;
        font-size: 14px;
        cursor: pointer;
    }

        .wa-attachment-menu button:hover {
            background: #f1f5f9;
        }

.wa-menu-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 10px;
    font-size: 20px;
    font-weight: 700;
}

.image-icon {
    background: #e6f0ff;
    color: #2864bc;
}

.document-icon {
    background: #ffe9e6;
    color: #c74635;
}

.video-icon {
    background: #f0e8ff;
    color: #7846bd;
}

.audio-icon {
    background: #fff0d6;
    color: #a66b00;
}

.contact-icon {
    background: #dcfce7;
    color: #15803d;
}

.wa-selected-file {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 12px;
    margin-bottom: 10px;
    background: #e5f5f0;
    border-radius: 10px;
    font-size: 13px;
}

#waSelectedFileName {
    min-width: 0;
    overflow-wrap: anywhere;
}

#waRemoveFile {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 50%;
    background: #fee2e2;
    color: #991b1b;
    font-size: 20px;
    cursor: pointer;
}

.wa-number-panel {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

#waContactNumber {
    flex: 1;
    width: 100%;
    min-width: 0;
    padding: 10px;
    border: 1px solid #dce5e9;
    border-radius: 10px;
}

#waAddNumber {
    padding: 9px 14px;
    border: 0;
    border-radius: 10px;
    background: #075e54;
    color: white;
    cursor: pointer;
}

.wa-share-status {
    margin-top: 7px;
    font-size: 12px;
    color: #52616b;
    overflow-wrap: anywhere;
}

@media (max-width: 600px) {
    .wa-share-panel {
        padding: 9px;
    }

    .wa-attachment-menu {
        left: 8px;
        bottom: 65px;
    }
}



.wa-header .wa-contact {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    min-width: 0;
    gap: 4px;
}

    .wa-header .wa-contact h2 {
        margin: 0;
        color: #ffffff;
        font-size: 16px;
        font-weight: 700;
        overflow-wrap: anywhere;
    }

    .wa-header .wa-contact p {
        margin: 0;
        color: #d1f5ec;
        font-size: 13px;
        overflow-wrap: anywhere;
    }
