
.utilities-module {
    display: grid;
    gap: 20px;
}

.utilities-header {
    background: linear-gradient(135deg, #0f172a, #334155);
    color: #f8fafc;
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.25);
}

.utilities-header h2 {
    margin: 0;
    font-size: 28px;
}

.utilities-header p {
    margin: 10px 0 0;
    color: #cbd5e1;
}

.utilities-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.utilities-category {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.utilities-category h3 {
    align-items: center;
    display: flex;
    gap: 8px;
    margin: 0 0 6px;
    font-size: 18px;
}

.utilities-category-label {
    margin: 0;
    color: #64748b;
    font-size: 13px;
}

.utilities-list {
    list-style: none;
    margin: 14px 0 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.utilities-item {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px;
    display: grid;
    gap: 6px;
    background: #f8fafc;
}

.utilities-item-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.utilities-item-title {
    font-weight: 600;
    color: #0f172a;
}

.utilities-pill {
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.utilities-pill-soon {
    background: #e2e8f0;
    color: #334155;
}

.utilities-item p {
    margin: 0;
    color: #475569;
    font-size: 13px;
}

.utilities-item button {
    width: fit-content;
    border: none;
    border-radius: 8px;
    background: #94a3b8;
    color: #fff;
    font-weight: 600;
    padding: 7px 11px;
    cursor: not-allowed;
}

.utilities-pill-live {
    background: #dcfce7;
    color: #166534;
}

.utilities-workspace {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.crm-dedupe-head {
    align-items: flex-start;
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.crm-dedupe-head h3,
.utilities-workspace h3 {
    margin-top: 0;
}

.crm-dedupe-head button,
#crm-dedupe-merge-next,
#crm-dedupe-execute,
.utilities-item button:not(:disabled) {
    border: none;
    border-radius: 8px;
    background: #2563eb;
    color: #fff;
    cursor: pointer;
    font-weight: 700;
    padding: 8px 12px;
}

.crm-dedupe-status {
    background: #0f172a;
    border-radius: 10px;
    color: #e2e8f0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    line-height: 1.45;
    margin-top: 16px;
    max-height: 150px;
    overflow: auto;
    padding: 10px 12px;
    white-space: pre-wrap;
}

.crm-dedupe-status .muted {
    color: #94a3b8;
}

.crm-dedupe-results {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.crm-dedupe-summary {
    color: #334155;
    font-weight: 700;
}

.crm-dedupe-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.crm-dedupe-table th,
.crm-dedupe-table td {
    border-bottom: 1px solid #cbd5e1;
    padding: 12px;
    text-align: left;
    vertical-align: top;
}

.crm-dedupe-table th {
    background: #e2e8f0;
    color: #334155;
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.crm-dedupe-table small {
    color: #64748b;
    display: block;
    margin-top: 2px;
}

.crm-dedupe-group {
    background: #f8fafc;
    color: #0f172a;
    cursor: pointer;
}

.crm-dedupe-group:hover,
.crm-dedupe-group:focus {
    background: #eff6ff;
    outline: 2px solid #93c5fd;
    outline-offset: -2px;
}

.crm-dedupe-comparisons {
    border-top: 1px solid #e2e8f0;
    color: #475569;
    display: grid;
    font-size: 12px;
    gap: 3px;
    margin-top: 4px;
    padding-top: 6px;
}

.crm-dedupe-group span,
.crm-dedupe-group small,
.muted {
    color: #64748b;
}

.error {
    color: #b91c1c;
}

.crm-dedupe-modal {
    align-items: center;
    background: rgba(15, 23, 42, 0.58);
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 24px;
    position: fixed;
    z-index: 1000;
}

.crm-dedupe-modal-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 25px 70px rgba(15, 23, 42, 0.38);
    box-sizing: border-box;
    height: 80vh;
    max-width: 920px;
    overflow-y: auto;
    padding: 20px;
    position: relative;
    width: min(920px, 96vw);
}

.crm-dedupe-modal-close {
    background: #e2e8f0;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-size: 22px;
    height: 34px;
    position: absolute;
    right: 16px;
    top: 16px;
    width: 34px;
}

.crm-dedupe-account-list,
.crm-dedupe-contact-grid {
    display: grid;
    gap: 10px;
}

.crm-dedupe-account-choice {
    align-items: flex-start;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    display: flex;
    gap: 10px;
    padding: 10px;
}

.crm-dedupe-contact-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-bottom: 14px;
}

.crm-dedupe-contact-grid label {
    color: #334155;
    display: grid;
    font-size: 12px;
    font-weight: 700;
    gap: 4px;
}

.crm-dedupe-contact-grid input {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 8px;
}

.crm-dedupe-counts {
    columns: 2;
    color: #475569;
    font-size: 13px;
}

.crm-dedupe-print-area {
    display: none;
}

@media print {
    body.crm-dedupe-report-printing * {
        visibility: hidden !important;
    }

    body.crm-dedupe-report-printing #crm-dedupe-print-area,
    body.crm-dedupe-report-printing #crm-dedupe-print-area * {
        display: block;
        visibility: visible !important;
    }

    body.crm-dedupe-report-printing #crm-dedupe-print-area {
        color: #000;
        left: 0;
        padding: 24px;
        position: absolute;
        top: 0;
        width: 100%;
    }

    body.crm-dedupe-report-printing #crm-dedupe-print-area table {
        border-collapse: collapse;
        width: 100%;
    }

    body.crm-dedupe-report-printing #crm-dedupe-print-area th,
    body.crm-dedupe-report-printing #crm-dedupe-print-area td {
        border: 1px solid #333;
        padding: 6px;
        text-align: left;
    }
}

.utilities-grid-focused {
    grid-template-columns: 1fr;
}

.utilities-back-link {
    display: inline-flex;
    align-items: center;
    margin-bottom: 14px;
    color: #2563eb;
    font-weight: 700;
    text-decoration: none;
}

.utilities-back-link:hover { text-decoration: underline; }

.crm-dedupe-modal-card {
    display: flex;
    flex-direction: column;
}

.crm-dedupe-modal-body {
    align-items: flex-start;
    display: grid;
    flex: 1 1 auto;
    gap: 16px;
    grid-template-columns: minmax(0, 1fr) 0;
    min-height: 0;
    overflow: hidden;
}

.crm-dedupe-modal-main {
    display: grid;
    gap: 14px;
    max-height: 100%;
    overflow-y: auto;
    padding-right: 4px;
}

.crm-dedupe-actions {
    background: #fff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex: 0 0 auto;
    justify-content: flex-end;
    margin: 16px -20px -20px;
    padding: 14px 20px;
    position: sticky;
    bottom: 0;
    z-index: 2;
}

.crm-dedupe-actions button:disabled,
#crm-dedupe-execute:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

.crm-dedupe-account-choice {
    cursor: pointer;
    flex-wrap: wrap;
}

.crm-dedupe-account-choice.is-selected {
    background: #eff6ff;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.14);
}

.crm-dedupe-account-summary {
    flex: 1 1 220px;
}

.crm-dedupe-account-details {
    background: #fff;
    border-radius: 8px;
    display: none;
    flex: 1 0 100%;
    gap: 8px 14px;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    margin: 4px 0 0 28px;
    padding: 10px;
}

.crm-dedupe-account-choice.is-selected .crm-dedupe-account-details {
    display: grid;
}

.crm-dedupe-account-details div {
    display: grid;
    gap: 2px;
}

.crm-dedupe-account-details dt {
    color: #475569;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.crm-dedupe-account-details dd {
    color: #0f172a;
    margin: 0;
}

.crm-dedupe-log-pane {
    align-self: stretch;
    background: #0f172a;
    border-radius: 12px;
    box-shadow: -14px 0 30px rgba(15, 23, 42, 0.16);
    color: #e2e8f0;
    max-height: 100%;
    opacity: 0;
    overflow-y: auto;
    padding: 0;
    transform: translateX(24px);
    transition: opacity 180ms ease, padding 180ms ease, transform 180ms ease;
    width: 0;
}

.crm-dedupe-log-pane.is-expanded {
    opacity: 1;
    padding: 14px;
    transform: translateX(0);
    width: auto;
}

.crm-dedupe-modal-body.has-log-pane {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 34%);
}

.crm-dedupe-log-pane h4,
.crm-dedupe-log-pane h5 {
    color: #fff;
    margin: 0 0 10px;
}

.crm-dedupe-log-pane ol,
.crm-dedupe-log-pane ul {
    margin: 0 0 12px 18px;
    padding: 0;
}

.crm-dedupe-log-pane li {
    margin-bottom: 8px;
}
