/* Central theme extracted from crm/crm_leads.php for dokwm1 (non-/app pages). */

/* Inspired by css/modernize.css (normalize) + refreshed CRM shell tokens */
*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --crm-font: "Source Sans 3", "Segoe UI", system-ui, -apple-system, sans-serif;
    --crm-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    /* Outbase-like shell */
    --crm-bg: #eef1f6;
    --crm-surface: #ffffff;
    --crm-surface-2: #f7f8fb;
    --crm-border: #e4e7ef;
    --crm-border-strong: #d0d5e2;
    --crm-text: #1e2433;
    --crm-text-muted: #7a8499;
    --crm-primary: #4f6ef7;
    --crm-primary-hover: #3d5ae0;
    --crm-primary-soft: #eef2ff;
    --crm-accent: #8b7cf6;
    --crm-accent-hover: #7565e8;
    --crm-accent-soft: #f1eeff;
    --crm-danger: #ef6b6b;
    --crm-danger-hover: #e05555;
    --crm-secondary: #6b7489;
    --crm-secondary-hover: #555e72;
    --crm-success: #35c27a;
    --crm-success-hover: #28ad6a;
    --crm-warn: #f0a04b;
    --crm-radius: 12px;
    --crm-radius-sm: 8px;
    --crm-shadow: 0 1px 2px rgba(30, 36, 51, 0.04), 0 4px 14px rgba(30, 36, 51, 0.05);
    --crm-shadow-lg: 0 10px 36px rgba(30, 36, 51, 0.14);
    --crm-focus: 0 0 0 3px rgba(79, 110, 247, 0.22);
    --crm-fs: 15px;
    --crm-fs-sm: 14px;
    --crm-fs-xs: 13px;
    --crm-fs-table: 14px;
    --crm-fs-label: 12px;
    --crm-lh: 1.55;
    --crm-lh-tight: 1.35;
    --crm-tracking: 0.01em;
    --crm-tracking-wide: 0.05em;
}

html {
    line-height: var(--crm-lh);
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--crm-font);
    font-size: var(--crm-fs);
    font-weight: 400;
    line-height: var(--crm-lh);
    letter-spacing: var(--crm-tracking);
    color: var(--crm-text);
    background: var(--crm-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

button,
input,
optgroup,
select,
textarea {
    font-family: inherit;
    font-size: 100%;
    line-height: var(--crm-lh);
    margin: 0;
}

button,
select {
    text-transform: none;
}

button,
[type="button"],
[type="reset"],
[type="submit"] {
    -webkit-appearance: button;
}

::-webkit-input-placeholder {
    color: inherit;
    opacity: 0.54;
}

.crm-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    gap: 12px;
    padding: 12px 14px;
}

.crm-dashboard {
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    min-height: 52px;
    flex-wrap: wrap;
    box-shadow: var(--crm-shadow);
}

.agent-stats-simple {
    flex: 0 1 auto;
    font-size: var(--crm-fs-sm);
    font-weight: 600;
    line-height: var(--crm-lh-tight);
    letter-spacing: 0.02em;
    color: var(--crm-text);
    padding: 8px 14px;
    background: var(--crm-surface-2);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-sm);
    white-space: nowrap;
}

.agent-stats-simple .agent-stats-sep {
    margin: 0 6px;
    color: #94a3b8;
    font-weight: 400;
}

.crm-dashboard-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.crm-dashboard-agent {
    font-weight: 600;
    font-size: var(--crm-fs);
    letter-spacing: 0.01em;
    color: var(--crm-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.crm-voip-select,
.crm-leads-menu {
    padding: 7px 11px;
    font-size: var(--crm-fs-sm);
    font-family: inherit;
    line-height: var(--crm-lh-tight);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-sm);
    background: var(--crm-surface);
    color: var(--crm-text);
    cursor: pointer;
    min-width: 120px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.crm-prefix-input {
    padding: 7px 11px;
    font-size: var(--crm-fs-sm);
    font-family: inherit;
    line-height: var(--crm-lh-tight);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-sm);
    background: var(--crm-surface);
    color: var(--crm-text);
    width: 90px;
    margin-left: 6px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.crm-voip-select:focus,
.crm-leads-menu:focus,
.crm-prefix-input:focus {
    outline: none;
    border-color: var(--crm-primary);
    box-shadow: var(--crm-focus);
}

.crm-dashboard-btn {
    padding: 7px 14px;
    font-size: var(--crm-fs-sm);
    font-family: inherit;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: var(--crm-lh-tight);
    background: var(--crm-primary);
    color: #fff;
    border: 1px solid var(--crm-primary);
    border-radius: var(--crm-radius-sm);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    margin-left: 8px;
}

.crm-dashboard-btn:hover {
    background: var(--crm-primary-hover);
    border-color: var(--crm-primary-hover);
}

.crm-logout-btn {
    padding: 7px 14px;
    font-size: var(--crm-fs-sm);
    font-family: inherit;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: var(--crm-lh-tight);
    background: var(--crm-danger);
    color: #fff;
    border: 1px solid var(--crm-danger);
    border-radius: var(--crm-radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}

.crm-logout-btn:hover {
    background: var(--crm-danger-hover);
    border-color: var(--crm-danger-hover);
    color: #fff;
}

.crm-unread-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 8px;
    font-size: var(--crm-fs-sm);
    color: var(--crm-text);
    font-weight: 600;
    letter-spacing: 0.01em;
    text-decoration: none;
}
.crm-unread-wrap:hover { color: var(--crm-primary); }

.msg-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--crm-secondary);
    color: #fff;
    font-size: var(--crm-fs-xs);
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--crm-secondary-hover);
    user-select: none;
    transition: background 0.15s, transform 0.1s;
}
.msg-badge.has-unread { background: var(--crm-danger); border-color: var(--crm-danger-hover); }
.msg-badge:hover { transform: scale(1.05); }


.crm-main-section {
    display: flex;
    gap: 14px;
    flex: 1;
    min-height: 0;
    align-items: stretch;
}

.crm-column {
    min-width: 200px;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--crm-shadow);
}

.crm-column.list-col {
    flex: 1 1 100%;
}

.crm-column.detail-col {
    flex: 1 1 50%;
}

.crm-column-header {
    padding: 12px 16px;
    font-weight: 600;
    font-size: var(--crm-fs);
    letter-spacing: 0.02em;
    line-height: var(--crm-lh-tight);
    color: var(--crm-text);
    background: var(--crm-surface-2);
    border-bottom: 1px solid var(--crm-border);
    flex-shrink: 0;
}

.crm-column-content {
    flex: 1;
    overflow: hidden;
    padding: 10px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--crm-surface-2);
}

.crm-filter-row {
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-sm);
    padding: 10px;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.crm-filter-form-inline {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.crm-filter-input,
.crm-filter-select {
    flex: 1;
    min-width: 120px;
    padding: 8px 12px;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-sm);
    font-size: var(--crm-fs-sm);
    line-height: var(--crm-lh-tight);
    box-sizing: border-box;
    font-family: inherit;
    background: var(--crm-surface);
    color: var(--crm-text);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.crm-filter-input:focus,
.crm-filter-select:focus {
    outline: none;
    border-color: var(--crm-primary);
    box-shadow: var(--crm-focus);
}

/* Multi-select dropdown (lead modal + modal call form) */
#editLeadModal .crm-multiselect-wrapper,
#editModalCallFormArea .crm-multiselect-wrapper {
    position: relative;
    width: 100%;
    min-width: 0;
}

.crm-multiselect-button {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-sm);
    background: var(--crm-surface);
    font-size: var(--crm-fs-sm);
    line-height: var(--crm-lh-tight);
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 38px;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.crm-multiselect-button:hover { border-color: var(--crm-primary); }
.crm-multiselect-button:focus {
    outline: none;
    border-color: var(--crm-primary);
    box-shadow: var(--crm-focus);
}

.crm-multiselect-text {
    flex: 1;
    color: var(--crm-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.crm-multiselect-text.has-selection {
    font-weight: 600;
    color: var(--crm-primary);
}

.crm-multiselect-arrow {
    margin-left: 8px;
    color: #666;
    font-size: 10px;
    transition: transform 0.2s;
}

.crm-multiselect-wrapper.open .crm-multiselect-arrow {
    transform: rotate(180deg);
}

#editLeadModal .crm-multiselect-dropdown,
#editModalCallFormArea .crm-multiselect-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-sm);
    box-shadow: var(--crm-shadow-lg);
    z-index: 10002;
    max-height: 300px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.crm-multiselect-search {
    padding: 8px;
    border-bottom: 1px solid var(--crm-border);
    flex-shrink: 0;
}

.crm-multiselect-search-input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-sm);
    font-size: 12px;
    font-family: inherit;
    box-sizing: border-box;
}

.crm-multiselect-search-input:focus {
    outline: none;
    border-color: var(--crm-primary);
    box-shadow: var(--crm-focus);
}

#editLeadModal .crm-multiselect-options,
#editModalCallFormArea .crm-multiselect-options {
    flex: 1;
    overflow-y: auto;
    max-height: 200px;
    padding: 4px 0;
    box-sizing: border-box;
}

/* Modal call — tags lista siempre abierta para captura rápida */
#editModalCallFormArea .crm-modal-call-tags-expanded .crm-multiselect-dropdown {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    margin-top: 0;
    z-index: 2;
    max-height: none;
    overflow: visible;
    box-shadow: inset 0 0 0 1px #ddd;
}
#editModalCallFormArea .crm-modal-call-tags-expanded .crm-multiselect-options {
    max-height: min(70vh, 520px);
    overflow-y: auto;
}

#editModalCallFormArea #modal_call_tags_options {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 8px;
    padding: 10px;
}

#editModalCallFormArea .crm-modal-call-tag-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-height: 36px;
    padding: 8px 14px;
    border: 1px solid var(--crm-border-strong);
    border-radius: var(--crm-radius-sm);
    background: var(--crm-surface);
    color: var(--crm-text);
    font-size: var(--crm-fs-xs);
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: var(--crm-lh-tight);
    cursor: pointer;
    box-shadow: none;
    transition: background .12s ease, border-color .12s ease;
}

#editModalCallFormArea .crm-modal-call-tag-button:hover {
    border-color: var(--crm-primary);
    background: var(--crm-primary-soft);
    box-shadow: none;
}

#editModalCallFormArea .crm-modal-call-tag-button.is-selected {
    border-color: var(--crm-primary);
    background: var(--crm-primary);
    color: #fff;
    box-shadow: none;
    transform: none;
}

#editModalCallFormArea .crm-modal-call-tag-button.hidden {
    display: none;
}

.crm-multiselect-option {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    font-size: var(--crm-fs-xs);
    line-height: var(--crm-lh);
    user-select: none;
}

.crm-multiselect-option:hover { background: var(--crm-primary-soft); }
.crm-multiselect-option.hidden { display: none; }

.crm-multiselect-option input[type="checkbox"] {
    margin-right: 8px;
    margin-top: 0;
    margin-bottom: 0;
    cursor: pointer;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    padding: 0;
    border: none;
}

.crm-multiselect-option span {
    flex: 1;
    color: var(--crm-text);
    min-width: 0;
}

.crm-multiselect-group-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--crm-text-muted);
    padding: 6px 8px 4px;
    background: var(--crm-surface-2);
    border-bottom: 1px solid var(--crm-border);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.crm-multiselect-group.hidden {
    display: none;
}

#editModalAddCommentPanel .crm-multiselect-dropdown {
    max-height: 220px;
}

.lead-comment-preset-modal {
    position: fixed;
    display: none;
    width: min(920px, 64vw);
    max-height: 72vh;
    background: #fff;
    border: 1px solid #9aa8b8;
    border-radius: 8px;
    box-shadow: 0 12px 36px rgba(15, 23, 42, 0.35);
    z-index: 10004;
    overflow: hidden;
}

.lead-comment-preset-modal.is-open {
    display: flex;
    flex-direction: column;
}

.lead-comment-preset-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: #f1f5f9;
    border-bottom: 1px solid #cbd5e1;
}

.lead-comment-preset-modal-title {
    font-size: 14px;
    font-weight: 800;
    color: #1e293b;
}

.lead-comment-preset-modal-close {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid #94a3b8;
    border-radius: 50%;
    background: #fff;
    color: #334155;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
}

.lead-comment-preset-modal-close:hover {
    background: #fee2e2;
    border-color: #ef4444;
    color: #b91c1c;
}

.lead-comment-preset-modal-body {
    overflow-y: auto;
    padding: 14px;
}

.lead-comment-preset-category {
    margin-bottom: 16px;
}

.lead-comment-preset-category:last-child {
    margin-bottom: 0;
}

.lead-comment-preset-category-title {
    margin-bottom: 7px;
    padding-bottom: 4px;
    border-bottom: 2px solid var(--preset-color);
    color: var(--preset-color);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.lead-comment-preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.lead-comment-preset-choice {
    padding: 8px 13px;
    border: 1px solid var(--preset-color);
    border-radius: 6px;
    background: var(--preset-soft);
    color: var(--preset-color);
    font-size: 12px;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(15, 23, 42, .12);
    transition: transform .1s ease, box-shadow .1s ease, filter .1s ease;
}

.lead-comment-preset-choice:hover {
    filter: brightness(.96);
    box-shadow: 0 0 11px color-mix(in srgb, var(--preset-color) 48%, transparent);
}

.lead-comment-preset-choice:active,
.lead-comment-preset-choice.was-added {
    transform: translateY(2px);
    background: var(--preset-color);
    color: #fff;
    box-shadow: inset 0 3px 6px rgba(0, 0, 0, .28);
}

.crm-multiselect-actions {
    padding: 8px;
    border-top: 1px solid var(--crm-border);
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.crm-multiselect-select-all,
.crm-multiselect-clear-all {
    flex: 1;
    padding: 6px 12px;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-sm);
    background: var(--crm-surface-2);
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
}

.crm-multiselect-select-all:hover { background: var(--crm-primary-soft); }
.crm-multiselect-clear-all:hover { background: #fee2e2; }

.btn-filter,
.btn-clear {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: var(--crm-fs-xs);
    font-weight: 600;
    letter-spacing: 0.02em;
    min-width: 64px;
    font-family: inherit;
    line-height: var(--crm-lh-tight);
}

.btn {
    padding: 9px 16px;
    border: 1px solid var(--crm-border-strong);
    background: var(--crm-surface);
    border-radius: var(--crm-radius-sm);
    cursor: pointer;
    font-size: var(--crm-fs-sm);
    font-family: inherit;
    font-weight: 500;
    letter-spacing: 0.01em;
    line-height: var(--crm-lh-tight);
    color: var(--crm-text);
    flex: 1;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.btn:hover {
    background: var(--crm-surface-2);
}

.btn-primary {
    background: var(--crm-primary);
    color: #fff;
    border-color: var(--crm-primary);
}

.btn-primary:hover {
    background: var(--crm-primary-hover);
    border-color: var(--crm-primary-hover);
}

.btn-secondary {
    background: var(--crm-secondary);
    color: #fff;
    border-color: var(--crm-secondary);
}

.btn-secondary:hover {
    background: var(--crm-secondary-hover);
    border-color: var(--crm-secondary-hover);
}

.preset-comments-float {
    flex-shrink: 0;
    max-height: 120px;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--crm-surface-2);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-sm);
    padding: 8px;
    display: none;
}

.preset-comments-float.is-visible {
    display: block;
}

.preset-comments-float-title {
    font-size: 10px;
    color: #666;
    font-weight: 600;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.preset-comments-float-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.preset-comment-chip {
    display: block;
    width: 100%;
    text-align: left;
    font-size: 11px;
    line-height: 1.35;
    padding: 5px 8px;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-sm);
    background: var(--crm-surface);
    color: var(--crm-text);
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s;
}

.preset-comment-chip:hover {
    background: var(--crm-primary-soft);
    border-color: var(--crm-primary);
    color: var(--crm-primary-hover);
}

.crm-call-log-section {
    flex-shrink: 0;
    height: 130px;
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--crm-border);
    background: var(--crm-surface-2);
    overflow: hidden;
}

.crm-leads-table-wrap {
    width: 100%;
    flex: 1;
    overflow: auto;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-sm);
    min-height: 0;
}

.crm-leads-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--crm-fs-table);
    line-height: var(--crm-lh);
    table-layout: auto;
}

.crm-leads-table thead {
    background: var(--crm-surface-2);
    position: sticky;
    top: 0;
    z-index: 5;
}

.crm-leads-table th {
    padding: 12px 10px;
    text-align: left;
    font-weight: 600;
    font-size: var(--crm-fs-label);
    line-height: var(--crm-lh-tight);
    color: var(--crm-text-muted);
    border-bottom: 1px solid var(--crm-border);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: var(--crm-tracking-wide);
    background: var(--crm-surface-2);
}

.crm-leads-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #eef0f5;
    color: var(--crm-text);
    vertical-align: middle;
    white-space: nowrap;
    line-height: var(--crm-lh);
}

.crm-leads-table td.col-comment {
    white-space: normal;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crm-leads-table tbody tr.crm-list-item {
    cursor: pointer;
    transition: background 0.12s;
}

.crm-leads-table tbody tr.crm-list-item:nth-child(even) {
    background: #fafbfe;
}

.crm-leads-table tbody tr.crm-list-item:hover {
    background: var(--crm-primary-soft);
}

.crm-leads-table tbody tr.crm-list-item.selected {
    background: var(--crm-primary-soft);
    outline: 1px solid rgba(79, 110, 247, 0.35);
    outline-offset: -1px;
}

.crm-leads-table tbody tr.crm-list-item.my-lead-row {
    background: var(--crm-accent-soft);
}

.crm-leads-table tbody tr.crm-list-item.my-lead-row:hover {
    background: #e8e2ff;
}

.crm-leads-table .col-status {
    font-weight: 600;
    font-size: var(--crm-fs-label);
    text-align: center;
    min-width: 72px;
    max-width: 110px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.crm-leads-table .col-id {
    font-weight: 600;
    color: #222;
}

.crm-leads-table .col-name {
    font-weight: 600;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crm-leads-table .col-actions {
    white-space: nowrap;
    width: 56px;
}

.crm-leads-table .col-actions .item-actions {
    display: flex;
    gap: 3px;
    justify-content: center;
}

.crm-list-item .item-name {
    font-weight: 600;
    font-size: var(--crm-fs-sm);
    line-height: var(--crm-lh);
    letter-spacing: 0.01em;
    color: var(--crm-text);
    display: flex;
    align-items: center;
    gap: 4px;
}

.crm-check-icon {
    display: inline-block;
    font-size: 16px;
    line-height: 1;
    min-width: 18px;
}

.crm-check-icon.checked {
    color: #28a745;
    cursor: default;
}

.crm-check-icon.checked.clickable {
    cursor: pointer;
    transition: opacity 0.2s;
}

.crm-check-icon.checked.clickable:hover {
    opacity: 0.7;
}

.crm-check-icon.unchecked {
    color: #999;
    cursor: pointer;
    transition: color 0.2s;
}

.crm-check-icon.unchecked:hover {
    color: #28a745;
}

.crm-list-item .item-actions {
    display: flex;
    align-items: center;
    gap: 3px;
}

.btn-phone-tiny {
    padding: 2px 6px;
    border: 1px solid var(--crm-primary);
    background: var(--crm-primary);
    color: #fff;
    border-radius: var(--crm-radius-sm);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    min-width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-phone-tiny:hover {
    background: var(--crm-primary-hover);
    border-color: var(--crm-primary-hover);
}

.btn-open-tiny {
    padding: 2px 6px;
    border: 1px solid var(--crm-secondary);
    background: var(--crm-secondary);
    color: #fff;
    border-radius: var(--crm-radius-sm);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    min-width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-open-tiny:hover {
    background: var(--crm-secondary-hover);
    border-color: var(--crm-secondary-hover);
}

.crm-detail-panel {
    padding: 16px;
}

.crm-detail-section {
    margin-bottom: 20px;
}

.crm-detail-section h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: #333;
    border-bottom: 1px solid #ddd;
    padding-bottom: 6px;
}

.crm-detail-field {
    margin-bottom: 12px;
}

.crm-detail-field label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.crm-detail-field input,
.crm-detail-field textarea,
.crm-detail-field select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.crm-detail-field textarea {
    min-height: 80px;
    resize: vertical;
}

.crm-detail-field input[readonly] {
    background: #f5f5f5;
    color: #666;
}

.crm-auxiliar-section {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    height: 30px;
    flex-shrink: 0;
}

.crm-auxiliar-content {
    display: flex;
    gap: 8px;
    flex: 1;
    overflow: hidden;
}

.crm-auxiliar-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.crm-auxiliar-column-header {
    padding: 4px 8px;
    font-weight: bold;
    font-size: 11px;
    background: #e8e8e8;
    border-bottom: 1px solid #ddd;
    flex-shrink: 0;
}

.crm-auxiliar-column-content {
    flex: 1;
    overflow-y: auto;
    padding: 4px 6px;
}

/* Calendar Widget Styles */
.crm-calendar {
    width: 100%;
    font-size: 10px;
}

.crm-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    padding: 2px 4px;
}

.crm-calendar-nav {
    background: var(--crm-primary);
    color: #fff;
    border: none;
    border-radius: var(--crm-radius-sm);
    padding: 2px 6px;
    cursor: pointer;
    font-size: 10px;
    line-height: 1.2;
}

.crm-calendar-nav:hover {
    background: var(--crm-primary-hover);
}

.crm-calendar-month-year {
    font-weight: bold;
    font-size: 11px;
    color: #333;
}

.crm-calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 4px;
}

.crm-calendar-weekday {
    text-align: center;
    font-weight: bold;
    font-size: 9px;
    color: #666;
    padding: 2px 0;
}

.crm-calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.crm-calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 2px;
    background: #fff;
    cursor: pointer;
    position: relative;
}

.crm-calendar-day:hover {
    background: var(--crm-primary-soft);
    border-color: var(--crm-primary);
}

.crm-calendar-day.other-month {
    color: #cbd5e1;
    background: var(--crm-surface-2);
}

.crm-calendar-day.today {
    background: var(--crm-primary-soft);
    border-color: var(--crm-primary);
    font-weight: bold;
}

.crm-calendar-day.has-meeting {
    background: #fff3cd;
    border-color: #ffc107;
    font-weight: bold;
}

.crm-calendar-day.has-meeting::after {
    content: '';
    position: absolute;
    bottom: 1px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: #ff9800;
    border-radius: 50%;
}

.crm-calendar-day.today.has-meeting {
    background: #ffe082;
    border-color: #ff9800;
}

.crm-calendar-day-number {
    position: absolute;
    top: 2px;
    left: 2px;
    font-size: 11px;
    font-weight: bold;
    z-index: 1;
}

.crm-calendar-day-meetings {
    position: absolute;
    top: 16px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    font-size: 8px;
    line-height: 1.2;
    color: #333;
    overflow-y: auto;
    overflow-x: hidden;
}

.crm-calendar-day-meeting-item {
    margin-bottom: 2px;
    padding: 1px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 2px;
}

.crm-calendar-day-meeting-item.past-meeting {
    color: #dc3545;
}

.crm-meeting-done-btn {
    font-size: 10px;
    cursor: pointer;
    color: #28a745;
    background: transparent;
    border: none;
    padding: 0 2px;
    line-height: 1;
    flex-shrink: 0;
}

.crm-meeting-done-btn:hover {
    color: #218838;
    transform: scale(1.1);
}

.crm-calendar-meeting-name {
    cursor: pointer;
    color: #4a90e2;
    text-decoration: underline;
    font-size: 12px;
    font-weight: normal;
}

.crm-calendar-meeting-name:hover {
    color: #357abd;
}

.crm-calendar-phone-icon {
    font-size: 8px;
    cursor: pointer;
    color: #4a90e2;
    flex-shrink: 0;
    padding: 0 1px;
    line-height: 1;
}

.crm-calendar-phone-icon:hover {
    color: #357abd;
    transform: scale(1.1);
}

.crm-auxiliar-header {
    padding: 6px 10px;
    font-weight: bold;
    background: #efefef;
    border-bottom: 1px solid #ddd;
}


.crm-call-log {
    list-style: none;
    margin: 0;
    padding: 0;
}

.crm-call-log-item {
    padding: 2px 6px;
    margin-bottom: 4px;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-sm);
    border-left: 3px solid var(--crm-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.1;
}

.crm-call-log-item .log-line {
    font-size: 11px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crm-call-form {
    background: #fff;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 12px;
}

.crm-call-form h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
}

.crm-call-form .form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.crm-call-form .form-row label {
    flex: 1;
    display: flex;
    flex-direction: column;
    font-size: 12px;
}

.crm-call-form .form-row input,
.crm-call-form .form-row textarea,
.crm-call-form .form-row select {
    margin-top: 4px;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

.crm-call-form .form-row textarea {
    min-height: 60px;
}

.btn {
    padding: 6px 12px;
    border: 1px solid var(--crm-border-strong);
    background: var(--crm-surface);
    border-radius: var(--crm-radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    color: var(--crm-text);
}

.btn:hover {
    background: var(--crm-surface-2);
}

.btn-secondary {
    background: var(--crm-secondary);
    color: #fff;
    border-color: var(--crm-secondary);
}

.btn-secondary:hover {
    background: var(--crm-secondary-hover);
    border-color: var(--crm-secondary-hover);
}

.btn-primary {
    background: var(--crm-primary);
    color: #fff;
    border-color: var(--crm-primary);
}

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

.btn-call-start {
    background: var(--crm-primary);
    color: #fff;
    border-color: var(--crm-primary);
    font-size: 14px;
    padding: 8px 16px;
}

.btn-call-start:hover {
    background: var(--crm-primary-hover);
}

.btn-call-end {
    background: var(--crm-danger);
    color: #fff;
    border-color: var(--crm-danger);
    font-size: 14px;
    padding: 8px 16px;
}

.btn-call-end:hover {
    background: var(--crm-danger-hover);
}

.btn-call-quick {
    background: var(--crm-surface);
    color: var(--crm-text);
    border-color: var(--crm-border);
    font-size: var(--crm-fs-sm);
    padding: 12px 14px;
    border-radius: var(--crm-radius-sm);
    box-shadow: var(--crm-shadow);
}

.btn-call-quick:hover {
    background: var(--crm-primary-soft);
    border-color: var(--crm-primary);
}

/* ── CRM Modals ─────────────────────────────────────────────── */
.crm-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px);
}

.crm-modal {
    background: var(--crm-bg);
    border-radius: 14px;
    box-shadow: var(--crm-shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--crm-border);
}

.crm-modal-xl {
    width: 98vw;
    max-width: 98vw;
    height: 96vh;
    max-height: 96vh;
}

.crm-modal-md {
    width: 560px;
    max-width: 96vw;
    max-height: 92vh;
}

.crm-modal-lg {
    width: 1100px;
    max-width: 97vw;
    height: 90vh;
}

.crm-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    background: var(--crm-surface);
    border-bottom: 1px solid var(--crm-border);
    flex-shrink: 0;
    box-shadow: 0 1px 0 rgba(30, 36, 51, 0.03);
}

.crm-modal-header-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.crm-modal-header-label {
    font-size: var(--crm-fs-label);
    font-weight: 600;
    color: var(--crm-text-muted);
    text-transform: uppercase;
    letter-spacing: var(--crm-tracking-wide);
    line-height: var(--crm-lh-tight);
}

.crm-modal-header-id {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--crm-text);
}

.crm-modal-status-badge {
    display: inline-block;
    padding: 4px 12px;
    font-size: var(--crm-fs-label);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-radius: 999px;
    line-height: 1.4;
}

.crm-modal-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.crm-modal-voip-controls {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 4px;
}

#editLeadModal .crm-modal-voip-controls .crm-voip-select {
    min-width: 100px;
    max-width: 140px;
    padding: 5px 8px;
    font-size: var(--crm-fs-xs);
}

#editLeadModal .crm-modal-voip-controls .crm-prefix-input {
    width: 72px;
    margin-left: 0;
    padding: 5px 8px;
    font-size: var(--crm-fs-xs);
}

.crm-modal-nav-btn {
    padding: 7px 13px;
    font-size: var(--crm-fs-xs);
    font-weight: 600;
    letter-spacing: 0.02em;
    border: 1px solid var(--crm-border-strong);
    border-radius: var(--crm-radius-sm);
    background: var(--crm-surface);
    color: var(--crm-text);
    cursor: pointer;
    font-family: inherit;
    line-height: var(--crm-lh-tight);
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.crm-modal-nav-btn:hover {
    background: var(--crm-primary);
    border-color: var(--crm-primary);
    color: #fff;
}

.crm-modal-nav-btn-call {
    background: var(--crm-accent);
    border-color: var(--crm-accent);
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 4px 12px rgba(139, 124, 246, 0.28);
}

.crm-modal-nav-btn-call:hover {
    background: var(--crm-accent-hover);
    border-color: var(--crm-accent-hover);
    color: #fff;
}

.crm-modal-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.crm-modal-btn-close {
    padding: 7px 14px;
    font-size: var(--crm-fs-sm);
    font-weight: 600;
    letter-spacing: 0.02em;
    border: 1px solid var(--crm-danger);
    border-radius: var(--crm-radius-sm);
    background: var(--crm-danger);
    color: #fff;
    cursor: pointer;
    font-family: inherit;
    line-height: var(--crm-lh-tight);
}

.crm-modal-btn-close:hover {
    background: var(--crm-danger-hover);
    border-color: var(--crm-danger-hover);
}

.crm-modal-body {
    display: flex;
    flex: 1;
    min-height: 0;
    background: var(--crm-bg);
    gap: 10px;
    padding: 10px;
}

.crm-modal-col {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: transparent;
    border-right: none;
    gap: 10px;
}

.crm-modal-col:last-child {
    border-right: none;
}

.crm-modal-col-info,
.crm-modal-col-comments,
.crm-modal-col-schedule,
.crm-modal-col-call {
    flex: 1;
    min-width: 0;
}

.crm-modal-col-inner {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0;
}

#editLeadModal .crm-modal-col-info .crm-modal-col-inner {
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#editLeadModal .crm-modal-col-info .crm-modal-info-table {
    width: 100%;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    box-shadow: var(--crm-shadow);
    overflow: hidden;
}

#editLeadModal .crm-modal-col-info .crm-modal-info-table th {
    width: 42%;
    padding: 10px 12px;
    font-size: var(--crm-fs-label);
}

#editLeadModal .crm-modal-col-info .crm-modal-info-table td {
    padding: 10px 12px;
    font-size: var(--crm-fs-sm);
    word-break: break-word;
}

#editLeadModal .crm-modal-col-info .crm-modal-field-block {
    margin-top: 8px;
}

#editLeadModal .crm-modal-col-info .crm-modal-colleagues-list {
    max-height: 80px;
    font-size: 11px;
}

#editLeadModal .crm-modal-col-comments .crm-modal-section,
#editLeadModal .crm-modal-col-comments .crm-modal-section-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#editLeadModal #editModalLeadComments {
    flex: 1;
    min-height: 0;
}

.crm-modal-section {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    box-shadow: var(--crm-shadow);
    overflow: hidden;
}

.crm-modal-section + .crm-modal-section {
    border-top: 1px solid var(--crm-border);
    margin-top: 0;
}

.crm-modal-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 14px;
    background: var(--crm-surface);
    border-bottom: 1px solid var(--crm-border);
    flex-shrink: 0;
}

.crm-modal-section-title {
    font-size: var(--crm-fs-label);
    font-weight: 700;
    color: var(--crm-text-muted);
    text-transform: uppercase;
    letter-spacing: var(--crm-tracking-wide);
}

.crm-modal-section-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 14px;
    background: var(--crm-surface);
}

.crm-modal-info-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--crm-fs-xs);
    background: var(--crm-surface);
    border-radius: var(--crm-radius-sm);
    overflow: hidden;
}

.crm-modal-info-table th {
    width: 38%;
    padding: 10px 12px;
    text-align: left;
    font-size: var(--crm-fs-label);
    font-weight: 600;
    color: var(--crm-text-muted);
    text-transform: none;
    letter-spacing: 0.01em;
    background: transparent;
    border: none;
    border-bottom: 1px solid #eef0f5;
    white-space: nowrap;
}

.crm-modal-info-table td {
    padding: 10px 12px;
    font-size: var(--crm-fs-sm);
    font-weight: 500;
    color: var(--crm-text);
    border: none;
    border-bottom: 1px solid #eef0f5;
    vertical-align: middle;
}

.crm-modal-info-table tr:nth-child(even) td:not(.crm-modal-status-cell) {
    background: transparent;
}

.crm-modal-info-table tr:nth-child(even) th {
    background: transparent;
}

.crm-modal-info-table td.crm-modal-field-input {
    padding: 0;
}

.crm-modal-inline-input {
    width: 100%;
    box-sizing: border-box;
    border: none;
    background: transparent;
    padding: 5px 8px;
    font-size: 12px;
    font-weight: 500;
    color: #222;
    font-family: inherit;
}

.crm-modal-inline-input:focus {
    outline: 2px solid var(--crm-primary);
    outline-offset: -2px;
    background: #fff;
}

.crm-modal-name-feedback {
    display: block;
    font-size: 10px;
    color: var(--crm-success);
    padding: 0 8px 4px;
    min-height: 12px;
}

.crm-modal-status-cell {
    padding: 0 !important;
}

.crm-modal-status-cell select {
    width: 100%;
    height: 100%;
    min-height: 30px;
    border: none;
    padding: 5px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    cursor: pointer;
    box-sizing: border-box;
    font-family: inherit;
}

.crm-modal-status-cell select:focus {
    outline: 2px solid var(--crm-primary);
    outline-offset: -2px;
}

.crm-modal-status-feedback {
    display: block;
    font-size: 10px;
    color: var(--crm-success);
    padding: 2px 8px 4px;
    min-height: 12px;
}

.crm-modal-field-block {
    margin-top: 10px;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    padding: 12px 14px;
    box-shadow: var(--crm-shadow);
}

.crm-modal-field-label {
    display: block;
    font-size: var(--crm-fs-label);
    font-weight: 700;
    color: var(--crm-text-muted);
    text-transform: uppercase;
    letter-spacing: var(--crm-tracking-wide);
    margin-bottom: 8px;
}

.crm-modal-colleagues-list {
    margin: 0;
    padding: 8px 10px;
    list-style: none;
    font-size: var(--crm-fs-xs);
    color: var(--crm-text);
    background: var(--crm-surface-2);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-sm);
    max-height: 120px;
    overflow-y: auto;
}

.crm-modal-colleagues-list li {
    padding: 4px 0;
    border-bottom: 1px solid #eef0f5;
}

.crm-modal-colleagues-list li:last-child {
    border-bottom: none;
}

.crm-modal-colleagues-list .crm-modal-colleagues-empty {
    color: var(--crm-text-muted);
    font-style: italic;
}

.crm-modal-transfer-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
}

.crm-modal-transfer-form select {
    flex: 1;
    min-width: 0;
    width: 100%;
    font-size: var(--crm-fs-sm);
    padding: 9px 12px;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-sm);
    background: var(--crm-surface);
    font-family: inherit;
}

.crm-modal-transfer-form .btn {
    flex-shrink: 0;
    width: 100%;
    padding: 10px 14px;
    font-size: var(--crm-fs-sm);
    font-weight: 600;
    background: var(--crm-primary);
    border-color: var(--crm-primary);
    color: #fff;
    border-radius: var(--crm-radius-sm);
}

.crm-modal-transfer-form .btn:hover {
    background: var(--crm-primary-hover);
    border-color: var(--crm-primary-hover);
}

.crm-modal-panel {
    flex: 1;
    min-height: 72px;
    font-size: 11px;
    color: #444;
    white-space: pre-wrap;
    overflow-y: auto;
    padding: 8px 10px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 2px;
}

.crm-modal-panel-empty {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 16px;
}

.crm-modal-table-wrap {
    overflow: auto;
    max-height: 100%;
}

.crm-modal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--crm-fs-xs);
    line-height: var(--crm-lh);
}

.crm-modal-table thead {
    background: #f1f5f9;
    position: sticky;
    top: 0;
    z-index: 2;
}

.crm-modal-table th {
    padding: 9px 8px;
    text-align: left;
    font-size: var(--crm-fs-label);
    font-weight: 600;
    color: var(--crm-text-muted);
    text-transform: uppercase;
    letter-spacing: var(--crm-tracking-wide);
    border-bottom: 1px solid var(--crm-border);
    white-space: nowrap;
}

.crm-modal-table td {
    padding: 8px;
    border-bottom: 1px solid #eef2f7;
    color: var(--crm-text);
    vertical-align: top;
    line-height: var(--crm-lh);
}

.crm-modal-table tbody tr:nth-child(even) {
    background: #f8fafc;
}

.crm-modal-table .col-status-colored {
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    font-size: 10px;
}

.crm-modal-table .row-notes td {
    padding: 2px 6px 6px;
    color: #555;
    font-style: italic;
    border-bottom: 1px solid #e9ecef;
}

.crm-modal .btn-primary,
.crm-modal .btn-call-start {
    background: var(--crm-primary);
    border-color: var(--crm-primary);
    color: #fff;
}

.crm-modal .btn-primary:hover,
.crm-modal .btn-call-start:hover {
    background: var(--crm-primary-hover);
    border-color: var(--crm-primary-hover);
}

.crm-modal .btn-secondary {
    background: var(--crm-secondary);
    border-color: var(--crm-secondary);
    color: #fff;
}

.crm-modal .btn-secondary:hover {
    background: var(--crm-secondary-hover);
}

.crm-modal .btn-save,
.crm-modal #btnSubmitAddLead {
    background: var(--crm-accent);
    border-color: var(--crm-accent);
    color: #fff;
    box-shadow: 0 4px 12px rgba(139, 124, 246, 0.28);
}

.crm-modal .btn-save:hover,
.crm-modal #btnSubmitAddLead:hover {
    background: var(--crm-accent-hover);
    border-color: var(--crm-accent-hover);
}

.crm-modal .btn-call-end {
    background: var(--crm-danger);
    border-color: var(--crm-danger);
}

.crm-modal .btn-call-end:hover {
    background: var(--crm-danger-hover);
}

.crm-modal .btn-call-quick {
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    color: var(--crm-text);
    border-radius: var(--crm-radius-sm);
    box-shadow: var(--crm-shadow);
    min-height: 52px;
    font-weight: 600;
}

.crm-modal .btn-call-quick:hover {
    background: var(--crm-primary-soft);
    border-color: var(--crm-primary);
    color: var(--crm-primary-hover);
}

.crm-modal .btn-sm {
    padding: 6px 12px;
    font-size: var(--crm-fs-label);
    font-weight: 600;
    border-radius: var(--crm-radius-sm);
}

.crm-modal-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.crm-modal-form label {
    font-size: var(--crm-fs-label);
    font-weight: 600;
    color: var(--crm-text-muted);
    text-transform: uppercase;
    letter-spacing: var(--crm-tracking-wide);
    display: block;
    margin-bottom: 4px;
    line-height: var(--crm-lh-tight);
}

.crm-modal-form input[type="text"],
.crm-modal-form input[type="email"],
.crm-modal-form input[type="datetime-local"],
.crm-modal-form select,
.crm-modal-form textarea {
    width: 100%;
    padding: 8px 12px;
    font-size: var(--crm-fs-sm);
    line-height: var(--crm-lh);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-sm);
    background: var(--crm-surface);
    box-sizing: border-box;
    font-family: inherit;
    color: var(--crm-text);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.crm-modal-form input:focus,
.crm-modal-form select:focus,
.crm-modal-form textarea:focus {
    outline: none;
    border-color: var(--crm-primary);
    box-shadow: var(--crm-focus);
}

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

.crm-modal-form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding: 12px 16px;
    background: var(--crm-surface);
    border-top: 1px solid var(--crm-border);
    flex-shrink: 0;
}

.crm-modal-add-panel {
    margin-bottom: 8px;
    flex-shrink: 0;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    padding: 12px;
    box-shadow: var(--crm-shadow);
}

.crm-modal-color-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

#editLeadModal .crm-multiselect-button,
#editModalCallFormArea .crm-multiselect-button {
    border-color: var(--crm-border);
    border-radius: var(--crm-radius-sm);
    font-size: 12px;
}

#editLeadModal .crm-multiselect-button:hover,
#editModalCallFormArea .crm-multiselect-button:hover {
    border-color: var(--crm-primary);
}

#editModalCallFormArea {
    flex: 1;
    min-height: 0;
    width: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-sizing: border-box;
    padding: 4px;
    background: transparent;
}

#editModalCallFormArea .crm-modal-call-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

#editModalCallFormArea .crm-modal-call-actions .btn-call-end,
#editModalCallFormArea .crm-modal-call-actions .btn-call-start {
    grid-column: 1 / -1;
}

#editModalCallFormArea .btn-call-quick {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 2px;
    min-height: 64px;
    padding: 12px 14px;
    text-align: left;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    color: var(--crm-text);
    border-radius: var(--crm-radius-sm);
    box-shadow: var(--crm-shadow);
}

#editModalCallFormArea .btn-call-quick[data-quick-status*="NO_ANSWER"],
#editModalCallFormArea .btn-call-quick[data-quick-status*="NO ANSWER"] {
    background: #fff1f1;
    border-color: #f5c2c2;
    color: #c44747;
}

#editModalCallFormArea .btn-call-quick[data-quick-status*="BUSY"] {
    background: #fff6eb;
    border-color: #f5d3a8;
    color: #c47a2a;
}

#editModalCallFormArea .btn-call-quick[data-quick-status*="VOICEMAIL"] {
    background: #f3efff;
    border-color: #d4c8f5;
    color: #6b57c4;
}

#editModalCallFormArea .btn-call-quick[data-quick-status*="NOT_IN_SERVICE"],
#editModalCallFormArea .btn-call-quick[data-quick-status*="NOT IN SERVICE"] {
    background: #f1f2f5;
    border-color: #d5d8e0;
    color: #4a5160;
}

#editModalCallFormArea .btn-call-quick[data-quick-status*="CONNECTED"],
#editModalCallFormArea .btn-call-quick[data-quick-status*="MEETING"],
#editModalCallFormArea .btn-call-quick[data-quick-status*="ANSWERED"] {
    background: #e9faf1;
    border-color: #b6e8cb;
    color: #1f9a58;
    grid-column: 1 / -1;
}

#editModalCallFormArea .btn-call-quick:hover {
    filter: brightness(0.98);
    box-shadow: 0 2px 8px rgba(30, 36, 51, 0.08);
}

#legacyQuickCallButtons,
#modalQuickCallButtons {
    display: contents;
}

.empty-state {
    padding: 40px;
    text-align: center;
    color: #999;
}

.empty-state p {
    margin: 0;
}

/* Compact key-value grid for read-only details */
.kv-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 12px;
    align-items: baseline;
    font-size: 12px;
}
.kv-item {
    display: flex;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kv-item .label {
    color: #888;
    min-width: 74px;
}
.kv-item .value {
    color: #333;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kv-span2 { grid-column: 1 / -1; }
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---- dokwm1 bridge (frames + Bootstrap coexist) ---- */
.btn {
    flex: initial;
}

body {
    font-family: var(--crm-font);
    background: var(--crm-bg);
    color: var(--crm-text);
}

.wi-frame-chrome {
    background: var(--crm-primary) !important;
    border-radius: var(--crm-radius-sm);
    box-shadow: var(--crm-shadow);
}

.wi-header h1,
.wi-home,
.wi-home:visited,
.wi-home:active {
    color: var(--crm-primary) !important;
}

/* Casita sobre fondos primary (barra / thead): blanca, no primary-sobre-primary */
.wi-frame-chrome .wi-home,
.wi-frame-chrome .wi-home:visited,
.wi-frame-chrome .wi-home:active,
.wi-table thead .wi-home,
.wi-table thead .wi-home:visited,
.wi-table thead .wi-home:active,
.wi-table thead .wi-home-thead,
.wi-table thead .wi-home-thead:visited,
.wi-table thead .wi-home-thead:active {
    color: #fff !important;
}

.wi-btn {
    border-radius: var(--crm-radius-sm) !important;
    font-family: inherit;
    border-color: var(--crm-border-strong) !important;
    background: var(--crm-surface) !important;
    color: var(--crm-text) !important;
}

.wi-btn:hover {
    background: var(--crm-surface-2) !important;
}

.wi-btn-primary,
a.wi-btn-primary,
a.wi-btn-primary:visited,
a.wi-btn-primary:hover,
a.wi-btn-primary:active {
    background: var(--crm-primary) !important;
    border-color: var(--crm-primary) !important;
    color: #fff !important;
}

.wi-btn-primary:hover {
    background: var(--crm-primary-hover) !important;
    border-color: var(--crm-primary-hover) !important;
}

.wi-btn-del,
a.wi-btn-del,
a.wi-btn-del:visited,
a.wi-btn-del:hover,
a.wi-btn-del:active {
    border-color: #fecaca !important;
    color: var(--crm-danger) !important;
    background: var(--crm-surface) !important;
}

.wi-btn-edit,
a.wi-btn-edit,
a.wi-btn-edit:visited,
a.wi-btn-edit:hover,
a.wi-btn-edit:active {
    border-color: #c7d2fe !important;
    color: var(--crm-primary) !important;
    background: var(--crm-surface) !important;
}

.wi-table-wrap {
    background: var(--crm-surface) !important;
    border-color: var(--crm-border) !important;
    border-radius: var(--crm-radius) !important;
    box-shadow: var(--crm-shadow) !important;
}

.wi-table {
    font-size: var(--crm-fs-table) !important;
}

.wi-table th {
    background: var(--crm-primary) !important;
    color: #fff !important;
}

.wi-table thead tr.wi-filters-row th,
.wi-table thead tr.wi-filters-row .wi-col-check,
.wi-table thead tr.wi-filters-row .wi-col-actions {
    background: var(--crm-surface-2) !important;
    color: var(--crm-text) !important;
}

.wi-table thead .wi-col-check,
.wi-table thead .wi-col-actions,
.wi-table thead .wi-col-pin-data {
    background: var(--crm-primary) !important;
}

.wi-table th,
.wi-table td {
    border-bottom-color: var(--crm-border) !important;
}

.wi-loading {
    color: var(--crm-text-muted) !important;
}

.wi-toast-info {
    background: var(--crm-primary) !important;
}
