.brand-link { text-align: center; }
.login-page { background: #f4f6f9; }

.content-wrapper {
    background: linear-gradient(180deg, #f4f6f9 0%, #eef2f7 100%);
}

.card {
    border-radius: 12px;
    overflow: hidden;
}

.small-box {
    border-radius: 14px;
}

.btn {
    border-radius: 8px;
}

.table thead th {
    background: #f8fafc;
    border-bottom: 1px solid #dee2e6;
}

.dark-mode .content-wrapper {
    background: #1f2933;
}

.dark-mode .card {
    background: #2f3a45;
}

.uaicrm-sidebar-blue {
    background: linear-gradient(180deg, #0d6efd 0%, #084298 100%) !important;
}

.uaicrm-sidebar-red {
    background: linear-gradient(180deg, #dc3545 0%, #842029 100%) !important;
}

.uaicrm-sidebar-green {
    background: linear-gradient(180deg, #198754 0%, #0f5132 100%) !important;
}

.uaicrm-sidebar-yellow {
    background: linear-gradient(180deg, #ffc107 0%, #997404 100%) !important;
}

.uaicrm-sidebar-yellow .nav-link,
.uaicrm-sidebar-yellow .brand-link {
    color: #1f1f1f !important;
}

.uaicrm-sidebar-blue .nav-link,
.uaicrm-sidebar-red .nav-link,
.uaicrm-sidebar-green .nav-link,
.uaicrm-sidebar-blue .brand-link,
.uaicrm-sidebar-red .brand-link,
.uaicrm-sidebar-green .brand-link {
    color: #ffffff !important;
}

.uaicrm-brand-logo {
    max-height: 32px;
    object-fit: contain;
    opacity: 1;
}

.brand-link .brand-text {
    white-space: nowrap;
}

.uaicrm-sidebar-cyan {
    background: linear-gradient(180deg, #0891b2 0%, #155e75 100%) !important;
}

.uaicrm-sidebar-indigo {
    background: linear-gradient(180deg, #4f46e5 0%, #312e81 100%) !important;
}

.uaicrm-sidebar-cyan .nav-link,
.uaicrm-sidebar-indigo .nav-link,
.uaicrm-sidebar-cyan .brand-link,
.uaicrm-sidebar-indigo .brand-link {
    color: #ffffff !important;
}

html,
body {
    min-height: 100%;
}

body.uaicrm-panel-bg-enabled,
body.uaicrm-panel-bg-enabled.theme-uai_modern {
    background-image:
        linear-gradient(180deg, rgba(248, 250, 252, 0.64) 0%, rgba(239, 246, 255, 0.72) 100%),
        var(--uai-panel-bg-image);
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

body.uaicrm-panel-bg-enabled.dark-mode,
body.uaicrm-panel-bg-enabled.theme-uai_modern.dark-mode {
    background-image:
        linear-gradient(180deg, rgba(15, 23, 42, 0.66) 0%, rgba(2, 6, 23, 0.82) 100%),
        var(--uai-panel-bg-image);
}

.uaicrm-panel-bg-enabled .wrapper,
.uaicrm-panel-bg-enabled.theme-uai_modern .wrapper {
    min-height: 100vh;
    min-height: 100dvh;
    background: transparent !important;
}

.uaicrm-panel-bg-enabled .content-wrapper,
.uaicrm-panel-bg-enabled.theme-uai_modern .content-wrapper {
    position: relative;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.74) 0%, rgba(239, 246, 255, 0.82) 100%) !important;
}

.uaicrm-panel-bg-enabled .main-header.navbar,
.uaicrm-panel-bg-enabled.theme-uai_modern .main-header {
    background: rgba(37, 99, 235, 0.78) !important;
    background: color-mix(in srgb, var(--uai-navbar-bg, #2563eb) 78%, transparent) !important;
    border-bottom: 1px solid color-mix(in srgb, var(--uai-navbar-contrast, #ffffff) 18%, transparent);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}

.uaicrm-panel-bg-enabled .main-sidebar,
.uaicrm-panel-bg-enabled.theme-uai_modern .main-sidebar {
    background: rgba(37, 99, 235, 0.78) !important;
    background: linear-gradient(180deg, color-mix(in srgb, var(--uai-sidebar-bg, #2563eb) 80%, transparent) 0%, color-mix(in srgb, var(--uai-sidebar-bg, #2563eb) 58%, rgba(15, 23, 42, 0.48)) 100%) !important;
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
}

.uaicrm-panel-bg-enabled .main-sidebar .brand-link,
.uaicrm-panel-bg-enabled.theme-uai_modern .main-sidebar .brand-link {
    background: rgba(15, 23, 42, 0.18) !important;
    background: color-mix(in srgb, #000000 20%, transparent) !important;
}

.uaicrm-panel-bg-enabled .main-footer,
.uaicrm-panel-bg-enabled.theme-uai_modern .main-footer {
    background: rgba(255, 255, 255, 0.76) !important;
    border-top: 1px solid rgba(148, 163, 184, 0.34);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

.uaicrm-panel-bg-enabled .content-wrapper::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 18% 16%, rgba(14, 165, 233, 0.16), transparent 32%);
    pointer-events: none;
}

.uaicrm-panel-bg-enabled .content-header,
.uaicrm-panel-bg-enabled .content {
    position: relative;
    z-index: 1;
}

.uaicrm-panel-bg-enabled .card,
.uaicrm-panel-bg-enabled .small-box {
    background: rgba(255, 255, 255, 0.92);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}

.uaicrm-panel-bg-enabled.dark-mode .content-wrapper,
.uaicrm-panel-bg-enabled.theme-uai_modern.dark-mode .content-wrapper {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.78) 0%, rgba(2, 6, 23, 0.9) 100%) !important;
}

.uaicrm-panel-bg-enabled.dark-mode .card,
.uaicrm-panel-bg-enabled.dark-mode .small-box {
    background: rgba(29, 41, 57, 0.9);
}

.uaicrm-panel-bg-enabled.dark-mode .main-footer,
.uaicrm-panel-bg-enabled.theme-uai_modern.dark-mode .main-footer {
    background: rgba(29, 41, 57, 0.78) !important;
    border-top-color: rgba(148, 163, 184, 0.22);
    color: #e5e7eb;
}

@media (max-width: 767.98px) {
    body.uaicrm-panel-bg-enabled,
    body.uaicrm-panel-bg-enabled.theme-uai_modern {
        background-attachment: scroll;
        background-position: center top;
    }

    .uaicrm-panel-bg-enabled .content-wrapper,
    .uaicrm-panel-bg-enabled.theme-uai_modern .content-wrapper {
        background: linear-gradient(180deg, rgba(248, 250, 252, 0.82) 0%, rgba(239, 246, 255, 0.9) 100%) !important;
    }

    .uaicrm-panel-bg-enabled.dark-mode .content-wrapper,
    .uaicrm-panel-bg-enabled.theme-uai_modern.dark-mode .content-wrapper {
        background: linear-gradient(180deg, rgba(15, 23, 42, 0.84) 0%, rgba(2, 6, 23, 0.94) 100%) !important;
    }

    .uaicrm-panel-bg-enabled .main-header.navbar,
    .uaicrm-panel-bg-enabled.theme-uai_modern .main-header,
    .uaicrm-panel-bg-enabled .main-sidebar,
    .uaicrm-panel-bg-enabled.theme-uai_modern .main-sidebar,
    .uaicrm-panel-bg-enabled .main-footer,
    .uaicrm-panel-bg-enabled.theme-uai_modern .main-footer {
        -webkit-backdrop-filter: blur(12px);
        backdrop-filter: blur(12px);
    }

    .uaicrm-panel-bg-enabled .main-sidebar,
    .uaicrm-panel-bg-enabled.theme-uai_modern .main-sidebar {
        background: rgba(37, 99, 235, 0.86) !important;
        background: linear-gradient(180deg, color-mix(in srgb, var(--uai-sidebar-bg, #2563eb) 86%, transparent) 0%, color-mix(in srgb, var(--uai-sidebar-bg, #2563eb) 68%, rgba(15, 23, 42, 0.52)) 100%) !important;
    }
}

.uaicrm-support-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    background: #111827;
    color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.uaicrm-support-banner__body {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
}

.uaicrm-support-banner__body strong {
    font-weight: 700;
}

.uaicrm-support-banner__meta {
    color: #cbd5e1;
    font-size: 0.875rem;
}

.uaicrm-support-banner__form {
    margin: 0;
    flex: 0 0 auto;
}

@media (max-width: 767.98px) {
    .uaicrm-support-banner {
        align-items: stretch;
        flex-direction: column;
    }

    .uaicrm-support-banner__form .btn {
        width: 100%;
    }
}

.crm-tag-badge {
    display: inline-flex;
    align-items: center;
    max-width: 160px;
    margin: 0 4px 4px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    white-space: nowrap;
}

.crm-tag-selector .custom-control-label {
    min-height: 24px;
}


/* Responsive operational layout */
.content-wrapper {
    overflow-x: hidden;
}

.content-header h1 {
    overflow-wrap: anywhere;
}

.content-header .btn,
.card-header .btn,
.table .btn {
    white-space: nowrap;
}

.table-responsive {
    -webkit-overflow-scrolling: touch;
}

.uaicrm-admin-tenant-table th,
.uaicrm-admin-tenant-table td {
    vertical-align: middle;
}

.uaicrm-admin-tenant-table td {
    min-width: 0;
    overflow-wrap: anywhere;
}

.uaicrm-cell-id {
    width: 64px;
    color: #64748b;
    font-weight: 700;
}

.uaicrm-cell-primary strong,
.uaicrm-muted-line,
.uaicrm-rule-list,
.uaicrm-hierarchy-path {
    display: block;
    min-width: 0;
}

.uaicrm-cell-primary strong {
    color: #111827;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.uaicrm-muted-line {
    margin-top: 2px;
    color: #64748b;
    font-size: 0.86rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.uaicrm-hierarchy-path {
    max-width: 420px;
    color: #475569;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.uaicrm-cell-plan {
    max-width: 190px;
    line-height: 1.3;
}

.uaicrm-rule-list {
    color: #475569;
    font-size: 0.86rem;
    line-height: 1.35;
    white-space: nowrap;
}

.uaicrm-table-actions {
    min-width: 0;
}

.uaicrm-table-action-list {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}

.uaicrm-table-action-list form {
    display: inline-flex;
    margin: 0;
}

.uaicrm-table-action-list .btn,
.uaicrm-table-action-list button {
    margin: 0 !important;
    white-space: nowrap;
}

.uaicrm-card-footer-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.uaicrm-card-footer-actions .btn {
    margin: 0 !important;
}

.dark-mode .uaicrm-cell-primary strong {
    color: #f9fafb;
}

.dark-mode .uaicrm-muted-line,
.dark-mode .uaicrm-rule-list,
.dark-mode .uaicrm-hierarchy-path {
    color: #cbd5e1;
}

.small-box .inner {
    min-height: 104px;
}

.small-box .inner p {
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.card-header .form-inline {
    gap: 8px;
}

.card-header .form-inline .form-control,
.card-header .form-inline .btn {
    margin-right: 0 !important;
}

@media (max-width: 767.98px) {
    .content-header {
        padding: 12px 0.5rem 6px;
    }

    .content {
        padding: 0 0.5rem;
    }

    .content-header .container-fluid > .d-flex.justify-content-between.align-items-center,
    .card-header.d-flex.justify-content-between.align-items-center {
        align-items: stretch !important;
        flex-direction: column;
        gap: 12px;
    }

    .content-header .container-fluid > .d-flex.justify-content-between.align-items-center > div:last-child,
    .content-header .container-fluid > .d-flex.justify-content-between.align-items-center > form,
    .card-header.d-flex.justify-content-between.align-items-center > form,
    .card-header.d-flex.justify-content-between.align-items-center > div:last-child {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }

    .content-header .container-fluid > .d-flex.justify-content-between.align-items-center .btn,
    .card-header.d-flex.justify-content-between.align-items-center .btn {
        flex: 1 1 150px;
        margin: 0 !important;
    }

    .card-header .form-inline {
        align-items: stretch;
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    .card-header .form-inline .form-control,
    .card-header .form-inline .btn,
    .card-header > .btn {
        width: 100%;
    }

    .card-body.table-responsive > .table {
        min-width: 720px;
    }

    .small-box {
        min-height: 126px;
    }

    .small-box .inner {
        min-height: 102px;
        padding-right: 62px;
    }

    .small-box h3 {
        font-size: 1.6rem;
        line-height: 1.1;
    }

    .small-box .icon {
        font-size: 64px;
        right: 10px;
        top: 12px;
    }

    .main-footer {
        font-size: 0.86rem;
        padding: 10px 12px;
    }
}

@media (max-width: 420px) {
    .content-header .container-fluid > .d-flex.justify-content-between.align-items-center .btn,
    .card-header.d-flex.justify-content-between.align-items-center .btn {
        flex-basis: 100%;
    }

    .card-body.table-responsive > .table {
        min-width: 680px;
    }

    .small-box .inner {
        padding: 12px 56px 12px 12px;
    }

    .small-box h3 {
        font-size: 1.42rem;
    }

    .small-box p {
        font-size: 0.88rem;
    }
}


/* CRM pipeline board */
.crm-pipeline-metrics {
    margin-bottom: 12px;
}

.crm-pipeline-metric {
    min-height: 82px;
    padding: 14px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
}

.crm-pipeline-metric span {
    display: block;
    color: #6b7280;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
}

.crm-pipeline-metric strong {
    display: block;
    margin-top: 6px;
    color: #111827;
    font-size: 1.45rem;
    line-height: 1.1;
}

.crm-pipeline-toolbar .form-inline {
    align-items: stretch;
    display: flex;
    flex-wrap: wrap;
}

.crm-pipeline-toolbar .form-control {
    min-width: 180px;
}

.crm-pipeline-board {
    display: flex;
    align-items: stretch;
    gap: 14px;
    min-height: 420px;
    padding-bottom: 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.crm-pipeline-column {
    display: flex;
    flex: 0 0 310px;
    max-width: 310px;
    flex-direction: column;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f8fafc;
}

.crm-pipeline-column__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 78px;
    padding: 12px 14px;
    border-top: 4px solid #6c757d;
    border-bottom: 1px solid #e5e7eb;
    border-radius: 8px 8px 0 0;
    background: #ffffff;
}

.crm-pipeline-column__header--muted {
    border-top-color: #9ca3af;
}

.crm-pipeline-column__header h2 {
    margin: 0;
    color: #111827;
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.2;
}

.crm-pipeline-column__header span {
    display: block;
    margin-top: 4px;
    color: #6b7280;
    font-size: 0.82rem;
}

.crm-pipeline-column__header strong {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #eef2ff;
    color: #1f2937;
}

.crm-pipeline-column__body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
}

.crm-pipeline-empty {
    padding: 12px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    color: #6b7280;
    font-size: 0.88rem;
    text-align: center;
}

.crm-lead-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

.crm-lead-card__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.crm-lead-card__top a {
    color: #111827;
    font-weight: 800;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.crm-lead-card__meta {
    display: grid;
    gap: 5px;
    color: #64748b;
    font-size: 0.82rem;
}

.crm-lead-card__meta span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-lead-card__facts {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: #64748b;
    font-size: 0.86rem;
}

.crm-lead-card__facts strong {
    color: #111827;
    font-size: 1rem;
}

.crm-lead-card__tags {
    min-height: 20px;
}

.crm-lead-card__actions,
.crm-lead-card__actions form,
.crm-lead-card__move {
    display: flex;
    align-items: stretch;
    gap: 6px;
    margin: 0;
}

.crm-lead-card__actions {
    flex-wrap: wrap;
}

.crm-lead-card__actions .btn {
    min-width: 34px;
}

.crm-lead-card__move .form-control {
    min-width: 0;
}

.crm-lead-card__move .btn {
    flex: 0 0 auto;
}

.dark-mode .crm-pipeline-metric,
.dark-mode .crm-pipeline-column__header,
.dark-mode .crm-lead-card {
    border-color: #4b5563;
    background: #1f2937;
}

.dark-mode .crm-pipeline-column {
    border-color: #4b5563;
    background: #111827;
}

.dark-mode .crm-pipeline-metric strong,
.dark-mode .crm-pipeline-column__header h2,
.dark-mode .crm-lead-card__top a,
.dark-mode .crm-lead-card__facts strong {
    color: #f9fafb;
}

.dark-mode .crm-pipeline-metric span,
.dark-mode .crm-pipeline-column__header span,
.dark-mode .crm-lead-card__meta,
.dark-mode .crm-lead-card__facts,
.dark-mode .crm-pipeline-empty {
    color: #cbd5e1;
}

.dark-mode .crm-pipeline-empty {
    border-color: #4b5563;
}

@media (max-width: 767.98px) {
    .crm-pipeline-metric {
        min-height: 74px;
        margin-bottom: 8px;
        padding: 12px;
    }

    .crm-pipeline-metric strong {
        font-size: 1.22rem;
    }

    .crm-pipeline-toolbar .form-control,
    .crm-pipeline-toolbar .btn {
        width: 100%;
    }

    .crm-pipeline-board {
        gap: 10px;
        margin-right: -0.5rem;
        padding-right: 0.5rem;
    }

    .crm-pipeline-column {
        flex-basis: min(86vw, 320px);
        max-width: min(86vw, 320px);
    }

    .crm-lead-card__top,
    .crm-lead-card__facts {
        align-items: flex-start;
        flex-direction: column;
    }

    .crm-lead-card__actions .btn {
        min-width: 38px;
    }
}


.crm-lead-card__products {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    color: #64748b;
    font-size: 0.82rem;
}

.crm-lead-card__products strong {
    margin-left: auto;
    color: #111827;
}

.crm-lead-product-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 72px 100px 42px;
    gap: 8px;
}

.dark-mode .crm-lead-card__products,
.dark-mode .crm-lead-card__products strong {
    color: #cbd5e1;
}

@media (max-width: 767.98px) {
    .crm-lead-product-form {
        grid-template-columns: 1fr;
    }
}


/* CRM CSV import preview */
.crm-import-summary {
    display: grid;
    grid-template-columns: repeat(5, minmax(110px, 1fr));
    gap: 10px;
}

.crm-import-summary > div {
    min-height: 66px;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f8fafc;
}

.crm-import-summary strong {
    display: block;
    color: #111827;
    font-size: 1.35rem;
    line-height: 1.1;
}

.crm-import-summary span {
    display: block;
    margin-top: 4px;
    color: #64748b;
    font-size: 0.86rem;
}

.crm-import-table th,
.crm-import-table td {
    vertical-align: middle;
    white-space: nowrap;
}

.crm-import-table td:nth-child(3),
.crm-import-table td:last-child {
    white-space: normal;
    min-width: 180px;
}

.dark-mode .crm-import-summary > div {
    border-color: #4b5563;
    background: #1f2937;
}

.dark-mode .crm-import-summary strong {
    color: #f9fafb;
}

.dark-mode .crm-import-summary span {
    color: #cbd5e1;
}

@media (max-width: 767.98px) {
    .crm-import-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .crm-import-preview .card-header,
    .crm-import-preview .card-footer {
        align-items: stretch !important;
        flex-direction: column;
        gap: 8px;
    }

    .crm-import-preview .card-footer .btn {
        width: 100%;
    }
}

/* Responsive tables become labeled records on small screens. */
@media (max-width: 767.98px) {
    .small-box h3 {
        font-size: 1.34rem;
        line-height: 1.12;
        max-width: 100%;
        overflow-wrap: anywhere;
    }

    .uaicrm-mobile-cards.table-responsive {
        overflow-x: visible;
    }

    .uaicrm-mobile-cards > .uaicrm-responsive-table {
        min-width: 0 !important;
    }

    .uaicrm-responsive-table thead {
        display: none;
    }

    .uaicrm-responsive-table,
    .uaicrm-responsive-table tbody,
    .uaicrm-responsive-table tr,
    .uaicrm-responsive-table td {
        display: block;
        width: 100%;
    }

    .uaicrm-responsive-table tr {
        padding: 12px 14px;
        border-bottom: 1px solid #dee2e6;
        background: #ffffff;
    }

    .uaicrm-responsive-table.table-striped tbody tr:nth-of-type(odd),
    .uaicrm-responsive-table.table-hover tbody tr:hover {
        background: #ffffff;
    }

    .uaicrm-responsive-table td {
        position: relative;
        display: block;
        min-width: 0;
        min-height: 31px;
        padding: 6px 0 6px 118px !important;
        border-top: 0 !important;
        overflow-wrap: anywhere;
        white-space: normal;
    }

    .uaicrm-responsive-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        top: 7px;
        width: 104px;
        color: #64748b;
        font-size: 0.72rem;
        font-weight: 800;
        letter-spacing: 0;
        line-height: 1.2;
        text-transform: uppercase;
    }

    .uaicrm-responsive-table td.uaicrm-table-actions {
        display: block;
        min-height: 0;
        padding: 10px 0 0 !important;
    }

    .uaicrm-responsive-table td.uaicrm-table-actions .uaicrm-table-action-list {
        justify-content: flex-start;
        width: 100%;
    }

    .uaicrm-responsive-table td.uaicrm-table-actions::before,
    .uaicrm-responsive-table td.uaicrm-table-empty::before {
        display: none;
    }

    .uaicrm-responsive-table td.uaicrm-table-empty {
        display: block;
        padding: 14px !important;
        text-align: center;
    }

    .uaicrm-responsive-table td.uaicrm-table-actions .btn,
    .uaicrm-responsive-table td.uaicrm-table-actions form {
        margin: 0 !important;
    }

    .uaicrm-responsive-table td.uaicrm-table-actions form {
        display: inline-flex !important;
    }

    .uaicrm-responsive-table td.uaicrm-table-actions .btn,
    .uaicrm-responsive-table td.uaicrm-table-actions form {
        flex: 1 1 112px;
    }

    .uaicrm-responsive-table td.uaicrm-table-actions form .btn,
    .uaicrm-responsive-table td.uaicrm-table-actions form button {
        width: 100%;
    }

    .uaicrm-responsive-table .uaicrm-hierarchy-path {
        max-width: none;
    }

    .uaicrm-responsive-table .uaicrm-rule-list {
        white-space: normal;
    }

    .uaicrm-responsive-table .crm-tag-badge {
        max-width: 100%;
    }

    .dark-mode .uaicrm-responsive-table tr {
        border-bottom-color: #4b5563;
        background: #1f2937;
    }

    .dark-mode .uaicrm-responsive-table.table-striped tbody tr:nth-of-type(odd),
    .dark-mode .uaicrm-responsive-table.table-hover tbody tr:hover {
        background: #1f2937;
    }

    .dark-mode .uaicrm-responsive-table td::before {
        color: #cbd5e1;
    }
}

@media (max-width: 420px) {
    .small-box h3 {
        font-size: 1.22rem;
    }
}

@media (max-width: 575.98px) {
    .uaicrm-card-footer-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .uaicrm-card-footer-actions .btn {
        width: 100%;
    }
}

/* Second-pass mobile QA fixes. */
@media (max-width: 767.98px) {
    .small-box .inner {
        padding-right: 42px;
    }

    .small-box .icon {
        font-size: 52px;
        right: 8px;
        top: 16px;
    }

    .uaicrm-mobile-cards > .uaicrm-mobile-fit-table {
        min-width: 0 !important;
        width: 100%;
    }

    .uaicrm-mobile-fit-table th,
    .uaicrm-mobile-fit-table td {
        overflow-wrap: anywhere;
        white-space: normal;
    }

    .uaicrm-responsive-table .crm-tag-badge {
        height: auto;
        overflow: visible;
        text-overflow: clip;
        white-space: normal;
    }
}

/* Headerless action/checklist tables need fixed utility columns on mobile. */
@media (max-width: 767.98px) {
    .uaicrm-mobile-cards > .uaicrm-mobile-row-table {
        min-width: 0 !important;
        width: 100%;
    }

    .uaicrm-mobile-row-table,
    .uaicrm-mobile-row-table tbody,
    .uaicrm-mobile-row-table tr {
        display: block;
        width: 100%;
    }

    .uaicrm-mobile-row-table tr {
        display: grid;
        grid-template-columns: 64px minmax(0, 1fr);
        align-items: center;
        gap: 10px;
        padding: 10px 14px;
        border-top: 1px solid #dee2e6;
    }

    .uaicrm-mobile-row-table tr:first-child {
        border-top: 0;
    }

    .uaicrm-mobile-row-table td {
        display: block;
        min-width: 0;
        padding: 0 !important;
        border-top: 0 !important;
        overflow-wrap: normal;
        word-break: normal;
        white-space: normal;
    }

    .uaicrm-mobile-row-table td:first-child {
        width: 64px;
        max-width: 64px;
    }

    .uaicrm-mobile-row-table td:nth-child(n+3) {
        grid-column: 2;
        display: flex;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 6px;
    }

    .uaicrm-mobile-row-table td:nth-child(n+3):empty {
        display: none;
    }

    .uaicrm-mobile-row-table td:last-child {
        text-align: right;
    }
}

/* Desktop drag-and-drop for the CRM pipeline. */
.crm-pipeline-board--drag-enabled .crm-lead-card--can-drag {
    cursor: grab;
}

.crm-pipeline-board--drag-enabled .crm-lead-card--can-drag:active {
    cursor: grabbing;
}

.crm-lead-card--dragging {
    opacity: 0.52;
}

.crm-lead-card--moving {
    opacity: 0.65;
    pointer-events: none;
}

.crm-pipeline-column--drop-target {
    border-color: var(--uai-accent-color, #0d6efd);
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.18);
}

.crm-pipeline-column--drop-target .crm-pipeline-column__body {
    background: rgba(13, 110, 253, 0.05);
}

.dark-mode .crm-pipeline-column--drop-target {
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.24);
}

.dark-mode .crm-pipeline-column--drop-target .crm-pipeline-column__body {
    background: rgba(96, 165, 250, 0.08);
}

.uaicrm-whatsapp-qr {
    max-width: 320px;
    width: 100%;
}

.uaicrm-whatsapp-header {
    row-gap: 10px;
}

.uaicrm-whatsapp-actions {
    gap: 8px;
}

.uaicrm-whatsapp-actions .btn {
    white-space: nowrap;
}

@media (max-width: 575.98px) {
    .uaicrm-whatsapp-actions,
    .uaicrm-whatsapp-actions .btn,
    .uaicrm-whatsapp-actions form {
        width: 100%;
    }
}


/* Conversations workspace. */
.uaicrm-conversations-page-header,
.uaicrm-marketplace-header {
    row-gap: 10px;
}

.crm-conversations-workspace {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    min-height: calc(100vh - 190px);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
}

.crm-conversations-sidebar {
    min-width: 0;
    border-right: 1px solid #dee2e6;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
}

.crm-conversation-filters {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(120px, 150px) minmax(120px, 150px) 42px;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid #dee2e6;
    background: #ffffff;
}

.crm-conversation-filters .btn {
    width: 42px;
    min-width: 42px;
    padding-left: 0;
    padding-right: 0;
}

.crm-conversation-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.crm-conversation-list-item {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
    border-bottom: 1px solid #e9ecef;
    color: #212529;
    text-decoration: none;
}

.crm-conversation-list-item:hover,
.crm-conversation-list-item.active {
    color: #111827;
    text-decoration: none;
    background: #e8f2ff;
}

.crm-conversation-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
    background: #0f766e;
    color: #ffffff;
    font-weight: 700;
}

.crm-conversation-avatar-lg {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
}

.crm-conversation-list-body,
.crm-conversation-list-top,
.crm-conversation-list-subject,
.crm-conversation-list-meta,
.crm-conversation-list-badges {
    min-width: 0;
}

.crm-conversation-list-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.crm-conversation-list-top strong,
.crm-conversation-list-subject {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-conversation-list-top strong {
    display: block;
    font-size: .94rem;
}

.crm-conversation-list-top small {
    flex: 0 0 auto;
    max-width: 112px;
    color: #6c757d;
    font-size: .72rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-conversation-list-subject,
.crm-conversation-list-meta,
.crm-conversation-list-badges,
.uaicrm-muted-line {
    display: block;
}

.crm-conversation-list-subject {
    color: #495057;
    font-size: .84rem;
}

.crm-conversation-list-meta {
    color: #6c757d;
    font-size: .78rem;
}

.crm-conversation-list-meta span + span::before {
    content: "•";
    margin: 0 5px;
}

.crm-conversation-list-badges {
    margin-top: 4px;
}

.crm-conversation-empty-list,
.crm-conversation-empty-thread,
.crm-conversation-no-selection {
    padding: 18px;
    color: #6c757d;
    text-align: center;
}

.crm-conversation-thread {
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #eef1f4;
}

.crm-conversation-thread-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #dee2e6;
    background: #ffffff;
}

.crm-conversation-thread-title {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.crm-conversation-thread-title h2 {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.crm-conversation-thread-title p {
    margin: 2px 0 0;
    color: #6c757d;
    font-size: .86rem;
    overflow-wrap: anywhere;
}

.crm-conversation-thread-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
}

.crm-conversation-thread-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    padding: 8px 16px;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
    color: #495057;
    font-size: .86rem;
}

.crm-conversation-thread-meta span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.crm-conversation-message-list {
    flex: 1 1 auto;
    min-height: 360px;
    overflow-y: auto;
    padding: 18px;
}

.crm-conversation-message-row {
    display: flex;
    margin-bottom: 10px;
}

.crm-conversation-message-row-out {
    justify-content: flex-end;
}

.crm-conversation-message-row-in {
    justify-content: flex-start;
}

.crm-conversation-message-row-internal {
    justify-content: center;
}

.crm-conversation-message-bubble {
    max-width: min(72%, 720px);
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    background: #ffffff;
    box-shadow: 0 1px 1px rgba(15, 23, 42, .06);
}

.crm-conversation-message-row-out .crm-conversation-message-bubble {
    background: #d9f7df;
    border-color: #bfeac8;
}

.crm-conversation-message-row-internal .crm-conversation-message-bubble {
    background: #fff7da;
    border-color: #f2df9b;
}

.crm-conversation-message-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 5px;
    color: #495057;
    font-size: .76rem;
}

.crm-conversation-message-head span {
    color: #6c757d;
    white-space: nowrap;
}

.crm-conversation-message-bubble p {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.crm-conversation-compose {
    display: grid;
    grid-template-columns: 46px minmax(180px, 260px) minmax(240px, 1fr) 46px;
    gap: 8px;
    align-items: end;
    padding: 12px;
    border-top: 1px solid #dee2e6;
    background: #ffffff;
}

.crm-conversation-compose textarea {
    resize: vertical;
    min-height: 68px;
    max-height: 180px;
}

.crm-conversation-number-select {
    min-height: 46px;
}

.crm-conversation-compose .btn {
    width: 46px;
    min-width: 46px;
    padding-left: 0;
    padding-right: 0;
}

.crm-conversation-attach {
    width: 46px;
    min-width: 46px;
}

.crm-conversation-attach .dropdown-toggle::after {
    display: none;
}

.crm-conversation-attach-menu {
    width: min(420px, calc(100vw - 48px));
    max-height: 420px;
    overflow-y: auto;
    padding: 8px 0;
}

.crm-conversation-attach-menu .dropdown-item {
    white-space: normal;
    line-height: 1.25;
}

.crm-conversation-attach-menu .dropdown-item strong,
.crm-conversation-attach-menu .dropdown-item small {
    display: block;
    min-width: 0;
    overflow-wrap: anywhere;
}

.crm-conversation-attach-menu .dropdown-item small {
    color: #6c757d;
    font-size: .76rem;
    margin-top: 2px;
}

.crm-conversation-file-name {
    grid-column: 1 / -1;
    min-height: 0;
    color: #6c757d;
    font-size: .82rem;
    overflow-wrap: anywhere;
}

.crm-conversation-message-attachment {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: .84rem;
}

.uaicrm-marketplace-table td {
    vertical-align: middle;
}

.uaicrm-marketplace-table .uaicrm-muted-line {
    color: #6c757d;
    font-size: .78rem;
    overflow-wrap: anywhere;
}

.dark-mode .crm-conversations-workspace,
.dark-mode .crm-conversation-filters,
.dark-mode .crm-conversation-thread-header,
.dark-mode .crm-conversation-compose {
    background: #1f2937;
    border-color: #4b5563;
}

.dark-mode .crm-conversations-sidebar,
.dark-mode .crm-conversation-thread,
.dark-mode .crm-conversation-thread-meta {
    background: #111827;
    border-color: #4b5563;
}

.dark-mode .crm-conversation-list-item {
    color: #e5e7eb;
    border-color: #374151;
}

.dark-mode .crm-conversation-list-item:hover,
.dark-mode .crm-conversation-list-item.active {
    color: #ffffff;
    background: #1e3a5f;
}

.dark-mode .crm-conversation-list-subject,
.dark-mode .crm-conversation-thread-title p,
.dark-mode .crm-conversation-thread-meta,
.dark-mode .crm-conversation-message-head,
.dark-mode .uaicrm-marketplace-table .uaicrm-muted-line {
    color: #cbd5e1;
}

.dark-mode .crm-conversation-message-bubble {
    background: #1f2937;
    border-color: #4b5563;
    color: #e5e7eb;
}

.dark-mode .crm-conversation-message-row-out .crm-conversation-message-bubble {
    background: #164e3b;
    border-color: #166534;
}

.dark-mode .crm-conversation-message-row-internal .crm-conversation-message-bubble {
    background: #4a3d16;
    border-color: #7c6a20;
}

@media (max-width: 1199.98px) {
    .crm-conversation-filters {
        grid-template-columns: minmax(0, 1fr) 42px;
    }

    .crm-conversation-filters select {
        grid-column: span 2;
    }
}

@media (max-width: 991.98px) {
    .crm-conversations-workspace {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .crm-conversations-sidebar {
        border-right: 0;
        border-bottom: 1px solid #dee2e6;
        max-height: 430px;
    }

    .crm-conversation-message-list {
        min-height: 430px;
    }
}

@media (max-width: 575.98px) {
    .crm-conversation-thread-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .crm-conversation-thread-actions {
        justify-content: flex-start;
    }

    .crm-conversation-message-list {
        min-height: 360px;
        padding: 12px;
    }

    .crm-conversation-message-bubble {
        max-width: 92%;
    }

    .crm-conversation-message-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 2px;
    }

    .crm-conversation-compose {
        grid-template-columns: 46px minmax(0, 1fr) 46px;
    }

    .crm-conversation-compose textarea {
        grid-column: 1 / -1;
    }

    .crm-conversation-attach-menu {
        width: calc(100vw - 32px);
    }
}

.crm-product-thumb {
    width: 54px;
    height: 54px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    background: #f8f9fa;
}

.crm-product-thumb-empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
}

.crm-product-image-current {
    display: flex;
    align-items: center;
    gap: 12px;
}

.crm-product-image-current img {
    width: 88px;
    height: 88px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.crm-conversation-thread-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid #dee2e6;
    background: #ffffff;
}

.crm-conversation-tags-panel summary {
    cursor: pointer;
    list-style: none;
    font-weight: 600;
}

.crm-conversation-tags-panel summary::-webkit-details-marker {
    display: none;
}

.crm-conversation-transfer-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(190px, 260px) auto;
    gap: 8px;
    align-content: start;
}

.crm-conversation-list-tags {
    display: block;
    margin-top: 4px;
}

.crm-conversation-message-image {
    display: block;
    max-width: 260px;
    max-height: 260px;
    margin-top: 8px;
    border-radius: 8px;
    object-fit: contain;
    border: 1px solid rgba(0, 0, 0, .08);
}

.crm-conversation-selection {
    grid-column: 3 / 4;
    color: #495057;
    font-size: .82rem;
    overflow-wrap: anywhere;
}

.crm-conversation-clear-selection {
    grid-column: 4 / 5;
    justify-self: end;
    width: auto !important;
    min-width: 0 !important;
    padding: 0 !important;
}

.crm-quick-item-form .form-text {
    min-height: 18px;
}

.dark-mode .crm-conversation-thread-tools {
    background: #1f2937;
    border-color: #4b5563;
}

.dark-mode .crm-conversation-selection {
    color: #cbd5e1;
}

@media (max-width: 767.98px) {
    .crm-product-image-current {
        align-items: flex-start;
        flex-direction: column;
    }

    .crm-conversation-thread-tools {
        grid-template-columns: 1fr;
    }

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

    .crm-conversation-selection,
    .crm-conversation-clear-selection,
    .crm-conversation-number-select {
        grid-column: 1 / -1;
        justify-self: start;
    }
}

.uaicrm-plan-price {
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1.15;
    margin-bottom: 10px;
}

.uaicrm-plan-benefits li {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin-bottom: 8px;
    overflow-wrap: anywhere;
}

.uaicrm-plan-benefits i {
    margin-top: 3px;
}

.uaicrm-plan-composition-summary {
    border-top: 1px solid #e5e7eb;
    color: #4b5563;
    font-size: .9rem;
    margin-top: 12px;
    padding-top: 10px;
}

.uaicrm-plan-actions {
    gap: 8px;
}

.dark-mode .uaicrm-plan-composition-summary {
    border-color: #4b5563;
    color: #cbd5e1;
}
