:root {
    --navy: #071f3c;
    --navy-soft: #0c2c52;
    --blue: #176b9b;
    --blue-bright: #1677ff;
    --blue-light: #eaf3ff;
    --background: #eef2f7;
    --surface: #ffffff;
    --text: #10233f;
    --muted: #6e7d93;
    --border: #dce4ef;
    --success: #087a4c;
    --success-soft: #e8f7f0;
    --danger: #b42318;
    --shadow: 0 18px 45px rgba(16, 35, 63, 0.08);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--background);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background: var(--background);
    font-family:
        Inter,
        ui-sans-serif,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

button,
input,
select {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button:not(:disabled),
a {
    cursor: pointer;
}

.hidden {
    display: none !important;
}

.loading-screen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: var(--navy);
    color: white;
}

.loading-logo,
.brand-symbol {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    color: var(--navy);
    background: #ffc536;
    font-size: 22px;
    font-weight: 900;
}

.spinner,
.mini-spinner {
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.24);
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

.spinner {
    width: 28px;
    height: 28px;
}

.mini-spinner {
    width: 18px;
    height: 18px;
    border-color: rgba(23, 107, 155, 0.2);
    border-top-color: var(--blue);
}

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

.login-view {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(420px, 600px) 1fr;
    background: var(--surface);
}

.login-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(42px, 7vw, 96px);
}

.login-brand,
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 13px;
}

.login-brand {
    margin-bottom: 70px;
}

.login-brand strong,
.sidebar-brand strong {
    display: block;
    font-size: 16px;
}

.login-brand span,
.sidebar-brand span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.eyebrow,
.visual-label {
    color: var(--blue-bright);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.13em;
}

.login-copy h1 {
    max-width: 560px;
    margin: 15px 0;
    font-size: clamp(32px, 4vw, 51px);
    line-height: 1.04;
    letter-spacing: -0.045em;
}

.login-copy p {
    max-width: 510px;
    margin: 0 0 38px;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.65;
}

#login-form {
    display: grid;
    gap: 19px;
    max-width: 460px;
}

label,
.field {
    display: grid;
    gap: 8px;
    color: #3b4c63;
    font-size: 13px;
    font-weight: 700;
}

input,
select {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--border);
    border-radius: 11px;
    outline: none;
    background: white;
    color: var(--text);
    padding: 0 14px;
    transition:
        border-color 0.2s,
        box-shadow 0.2s;
}

input:focus,
select:focus {
    border-color: var(--blue-bright);
    box-shadow: 0 0 0 4px rgba(22, 119, 255, 0.1);
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 82px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 12px;
    border: 0;
    background: none;
    color: var(--blue);
    transform: translateY(-50%);
    font-size: 12px;
    font-weight: 800;
}

.button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 11px;
    padding: 0 18px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 800;
    transition:
        transform 0.15s,
        opacity 0.15s,
        background 0.15s;
}

.button:not(:disabled):hover {
    transform: translateY(-1px);
}

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

.button-primary {
    color: white;
    background: var(--blue-bright);
}

.button-secondary {
    border-color: var(--border);
    color: var(--text);
    background: white;
}

.button-whatsapp {
    color: white;
    background: #128c59;
}

.button-full {
    width: 100%;
    min-height: 49px;
}

.form-error {
    margin: 0;
    color: var(--danger);
    font-size: 13px;
}

.login-security {
    margin-top: 26px;
    color: var(--muted);
}

.login-visual {
    position: relative;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
    padding: 70px;
    color: white;
    background:
        radial-gradient(
            circle at 70% 20%,
            rgba(23, 107, 155, 0.72),
            transparent 42%
        ),
        linear-gradient(145deg, #071f3c, #0b3764);
}

.login-visual::before,
.login-visual::after {
    content: "";
    position: absolute;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 50%;
}

.login-visual::before {
    top: -180px;
    right: -140px;
    width: 570px;
    height: 570px;
}

.login-visual::after {
    top: -60px;
    right: -20px;
    width: 300px;
    height: 300px;
}

.visual-content {
    position: relative;
    z-index: 1;
    max-width: 660px;
}

.visual-label {
    color: #ffc536;
}

.visual-content h2 {
    max-width: 620px;
    margin: 16px 0;
    font-size: clamp(38px, 5vw, 65px);
    line-height: 1.02;
    letter-spacing: -0.05em;
}

.visual-content > p {
    max-width: 500px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 17px;
    line-height: 1.65;
}

.visual-metrics {
    display: flex;
    gap: 45px;
    margin-top: 48px;
}

.visual-metrics strong,
.visual-metrics span {
    display: block;
}

.visual-metrics strong {
    font-size: 25px;
}

.visual-metrics span {
    margin-top: 4px;
    color: rgba(255, 255, 255, 0.62);
    font-size: 12px;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    display: flex;
    width: 230px;
    flex-direction: column;
    padding: 25px 18px;
    color: white;
    background: linear-gradient(180deg, #071f3c, #092a4e);
}

.sidebar-brand {
    padding: 0 8px;
}

.sidebar-brand span {
    color: rgba(255, 255, 255, 0.56);
}

.sidebar-nav {
    display: grid;
    gap: 7px;
    margin-top: 45px;
}

.nav-item {
    display: flex;
    min-height: 45px;
    align-items: center;
    gap: 11px;
    border: 0;
    border-radius: 11px;
    padding: 0 14px;
    color: rgba(255, 255, 255, 0.7);
    background: transparent;
    text-align: left;
    font-size: 13px;
    font-weight: 700;
}

.nav-item.active {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-footer {
    display: grid;
    gap: 18px;
    margin-top: auto;
    padding: 18px 8px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.server-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.66);
    font-size: 11px;
}

.server-indicator i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #42d392;
    box-shadow: 0 0 0 4px rgba(66, 211, 146, 0.12);
}

.logout-button {
    justify-self: start;
    border: 0;
    padding: 0;
    color: #ff8b92;
    background: none;
    font-size: 12px;
    font-weight: 800;
}

.main-area {
    grid-column: 2;
    min-width: 0;
    padding: 28px;
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 25px;
}

.topbar h1 {
    margin: 6px 0 3px;
    font-size: 28px;
    letter-spacing: -0.035em;
}

.topbar p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-pill {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 10px 15px;
    color: var(--muted);
    background: white;
    font-size: 12px;
    font-weight: 800;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat-card,
.panel {
    border: 1px solid rgba(220, 228, 239, 0.9);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.stat-card {
    min-height: 132px;
    border-radius: 16px;
    padding: 21px;
}

.stat-card span,
.stat-card small {
    display: block;
    color: var(--muted);
}

.stat-card span {
    font-size: 12px;
    font-weight: 800;
}

.stat-card strong {
    display: block;
    margin: 11px 0 5px;
    font-size: 27px;
    letter-spacing: -0.04em;
}

.stat-card small {
    font-size: 11px;
}

.panel {
    border-radius: var(--radius);
    padding: 22px;
}

.filters-panel {
    margin-bottom: 18px;
}

.panel-header,
.results-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.panel-header {
    margin-bottom: 22px;
}

.panel-header h2,
.results-header h2 {
    margin: 0 0 4px;
    font-size: 18px;
}

.panel-header p,
.results-header p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.text-button {
    border: 0;
    color: var(--blue);
    background: none;
    font-size: 12px;
    font-weight: 800;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 15px;
}

.field-wide {
    grid-column: span 2;
}

.filter-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 20px;
}

.filter-tip {
    color: var(--muted);
    font-size: 12px;
}

.inline-code {
    border: 0;
    border-radius: 6px;
    padding: 3px 7px;
    color: #7e5700;
    background: #fff2c9;
    font-family: monospace;
    font-weight: 800;
}

.results-panel {
    min-height: 360px;
}

.results-header {
    align-items: center;
    margin-bottom: 18px;
}

.results-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--blue);
    font-size: 12px;
    font-weight: 800;
}

.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 13px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1050px;
}

th {
    padding: 12px 14px;
    color: var(--muted);
    background: #f7f9fc;
    text-align: left;
    font-size: 10px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

td {
    border-top: 1px solid var(--border);
    padding: 15px 14px;
    vertical-align: top;
    font-size: 12px;
}

.company-cell strong,
.company-cell span,
.contact-cell span {
    display: block;
}

.company-cell strong {
    max-width: 300px;
    font-size: 13px;
    line-height: 1.4;
}

.company-cell span,
.secondary-text,
.contact-cell span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
}

.activity-cell {
    max-width: 270px;
    line-height: 1.5;
}

.contact-cell a {
    display: block;
    margin-bottom: 5px;
    color: var(--blue);
    text-decoration: none;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 5px 8px;
    color: var(--success);
    background: var(--success-soft);
    font-size: 10px;
    font-weight: 800;
}

.table-action {
    min-height: 34px;
    white-space: nowrap;
    padding: 0 12px;
}

.empty-state {
    height: 210px;
    color: var(--muted);
    text-align: center;
}

.empty-state strong,
.empty-state span {
    display: block;
}

.empty-state strong {
    margin-bottom: 8px;
    color: var(--text);
    font-size: 14px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin-top: 18px;
}

.pagination span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.detail-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    justify-content: flex-end;
    background: rgba(6, 21, 40, 0.52);
    backdrop-filter: blur(3px);
}

.detail-drawer {
    display: flex;
    width: min(650px, 100%);
    height: 100%;
    flex-direction: column;
    background: white;
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.16);
}

.detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid var(--border);
    padding: 25px;
}

.detail-header h2 {
    margin: 8px 0 5px;
    font-size: 23px;
    line-height: 1.25;
}

.detail-header p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.close-button {
    display: grid;
    min-width: 38px;
    height: 38px;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--muted);
    background: white;
    font-size: 25px;
}

.detail-content {
    overflow-y: auto;
    flex: 1;
    padding: 24px;
}

.detail-section {
    margin-bottom: 26px;
}

.detail-section h3 {
    margin: 0 0 12px;
    font-size: 13px;
}

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

.detail-field {
    min-height: 74px;
    border: 1px solid var(--border);
    border-radius: 11px;
    padding: 12px;
    background: #fbfcfe;
}

.detail-field span,
.detail-field strong {
    display: block;
}

.detail-field span {
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.detail-field strong {
    overflow-wrap: anywhere;
    font-size: 12px;
    line-height: 1.5;
}

.detail-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    border-top: 1px solid var(--border);
    padding: 18px 24px;
}

.toast {
    position: fixed;
    right: 25px;
    bottom: 25px;
    z-index: 200;
    max-width: 390px;
    border-radius: 12px;
    padding: 14px 18px;
    color: white;
    background: var(--navy);
    box-shadow: var(--shadow);
    font-size: 12px;
    font-weight: 700;
}

@media (max-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filters-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 850px) {
    .login-view {
        display: block;
    }

    .login-card {
        min-height: 100vh;
    }

    .login-visual {
        display: none;
    }

    .app-shell {
        display: block;
    }

    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        padding: 14px 18px;
    }

    .sidebar-brand {
        display: none;
    }

    .sidebar-nav {
        margin: 0;
    }

    .sidebar-footer {
        display: none;
    }

    .main-area {
        padding: 18px;
    }

    .topbar,
    .filter-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar-actions {
        justify-content: space-between;
    }
}

@media (max-width: 580px) {
    .login-card {
        padding: 35px 22px;
    }

    .login-brand {
        margin-bottom: 45px;
    }

    .stats-grid,
    .filters-grid,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .field-wide {
        grid-column: auto;
    }

    .panel,
    .stat-card {
        border-radius: 14px;
    }

    .detail-footer .button {
        width: 100%;
    }
}

/* ===== CRM VISUAL 1.0 ===== */

.crm-layout {
    display: grid;
    grid-template-columns:
        minmax(0, 1fr)
        minmax(280px, 340px);
    gap: 18px;
}

.crm-leads-panel {
    min-width: 0;
}

.crm-plan-panel {
    align-self: start;
}

.crm-filter-form {
    display: grid;
    grid-template-columns:
        minmax(220px, 1fr)
        minmax(145px, 180px)
        minmax(170px, 210px)
        auto;
    align-items: end;
    gap: 12px;
    margin-bottom: 20px;
}

.crm-filter-button {
    min-height: 46px;
}

.crm-plan-item {
    padding: 15px 0;
    border-bottom: 1px solid var(--border);
}

.crm-plan-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 9px;
}

.crm-plan-header strong {
    font-size: 12px;
}

.crm-plan-header span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.crm-progress {
    overflow: hidden;
    height: 7px;
    border-radius: 999px;
    background: #e9eef5;
}

.crm-progress i {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--blue-bright);
    transition: width 0.3s ease;
}

.crm-plan-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 20px;
    border-radius: 12px;
    padding: 15px;
    background: var(--blue-light);
}

.crm-plan-total span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.crm-plan-total strong {
    color: var(--blue);
    font-size: 15px;
}

.crm-offer-badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 6px 9px;
    color: #7c5100;
    background: #fff2c9;
    font-size: 10px;
    font-weight: 800;
}

.crm-status-select {
    min-width: 125px;
    min-height: 36px;
    padding: 0 8px;
    font-size: 11px;
}

.crm-overdue {
    display: inline-flex;
    margin-top: 7px;
    border-radius: 999px;
    padding: 4px 7px;
    color: var(--danger);
    background: #fff0ef;
    font-size: 9px;
    font-weight: 900;
    text-transform: uppercase;
}

.crm-modal {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(6, 21, 40, 0.58);
    backdrop-filter: blur(4px);
}

.crm-modal-card {
    width: min(520px, 100%);
    max-height: calc(100vh - 44px);
    overflow-y: auto;
    border-radius: 18px;
    padding: 24px;
    background: white;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.23);
}

.crm-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.crm-modal-header h2 {
    margin: 7px 0 5px;
    font-size: 21px;
}

.crm-modal-header p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.crm-modal form {
    display: grid;
    gap: 16px;
}

.crm-modal textarea {
    width: 100%;
    resize: vertical;
    border: 1px solid var(--border);
    border-radius: 11px;
    outline: none;
    padding: 12px 14px;
    color: var(--text);
    background: white;
    font: inherit;
    line-height: 1.5;
}

.crm-modal textarea:focus {
    border-color: var(--blue-bright);
    box-shadow:
        0 0 0 4px rgba(22, 119, 255, 0.1);
}

.crm-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    margin-top: 5px;
}

@media (max-width: 1180px) {
    .crm-layout {
        grid-template-columns: 1fr;
    }

    .crm-filter-form {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }
}

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

    .crm-modal-actions {
        flex-direction: column-reverse;
    }

    .crm-modal-actions .button {
        width: 100%;
    }
}

/* ===== DECISORES VISUAL 1.0 ===== */

.crm-row-actions {
    display: grid;
    gap: 7px;
    min-width: 112px;
}

.crm-row-actions .button {
    width: 100%;
    white-space: nowrap;
}

.crm-lead-modal-card {
    width: min(1180px, 100%);
}

.crm-manage-summary {
    display: grid;
    grid-template-columns:
        repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 15px;
}

.crm-manage-summary article {
    display: grid;
    gap: 6px;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 13px;
    padding: 14px;
    background: #f8fafc;
}

.crm-manage-summary span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.crm-manage-summary strong {
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-research-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-bottom: 20px;
}

.crm-decisor-layout {
    display: grid;
    grid-template-columns:
        minmax(0, 0.95fr)
        minmax(380px, 1.05fr);
    gap: 18px;
}

.crm-decisor-list-section,
.crm-decisor-form-section {
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px;
}

.crm-section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 17px;
}

.crm-section-heading h3 {
    margin: 0 0 5px;
    font-size: 16px;
}

.crm-section-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
}

.crm-section-heading > span {
    flex: 0 0 auto;
    border-radius: 999px;
    padding: 6px 9px;
    color: var(--blue);
    background: var(--blue-light);
    font-size: 10px;
    font-weight: 800;
}

.crm-decisor-list {
    display: grid;
    gap: 12px;
    max-height: 615px;
    overflow-y: auto;
    padding-right: 3px;
}

.crm-decisor-empty {
    display: grid;
    gap: 6px;
    place-items: center;
    min-height: 160px;
    border: 1px dashed var(--border);
    border-radius: 13px;
    padding: 20px;
    color: var(--muted);
    text-align: center;
    font-size: 12px;
}

.crm-decisor-card {
    border: 1px solid var(--border);
    border-radius: 13px;
    padding: 15px;
    background: #fff;
}

.crm-decisor-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.crm-decisor-card-header > div {
    display: grid;
    gap: 4px;
}

.crm-decisor-card-header strong {
    font-size: 13px;
}

.crm-decisor-card-header span {
    color: var(--muted);
    font-size: 10px;
}

.crm-confidence-badge {
    flex: 0 0 auto;
    border-radius: 999px;
    padding: 5px 8px;
    font-size: 9px;
    font-weight: 900;
}

.crm-confidence-nao_confirmado,
.crm-confidence-baixa {
    color: #7c4b00;
    background: #fff2c9;
}

.crm-confidence-media {
    color: #075985;
    background: #e0f2fe;
}

.crm-confidence-alta,
.crm-confidence-confirmado {
    color: #087443;
    background: #dcfce7;
}

.crm-decisor-contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 12px;
}

.crm-decisor-contact-links a {
    border-radius: 8px;
    padding: 6px 8px;
    color: var(--blue);
    background: var(--blue-light);
    font-size: 9px;
    font-weight: 800;
    text-decoration: none;
}

.crm-decisor-contact-links a:hover {
    text-decoration: underline;
}

.crm-decisor-metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 15px;
    margin-top: 12px;
    color: var(--muted);
    font-size: 9px;
}

.crm-decisor-metadata strong {
    color: var(--text);
}

.crm-decisor-data {
    display: grid;
    gap: 4px;
    margin-top: 11px;
    color: var(--text);
    font-size: 10px;
}

.crm-decisor-notes {
    margin: 11px 0 0;
    border-left: 3px solid var(--blue-bright);
    padding-left: 9px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.crm-decisor-card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 7px;
    margin-top: 13px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.crm-decisor-card-actions .button {
    min-height: 33px;
    padding: 0 11px;
    font-size: 9px;
}

.crm-form-grid {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
    gap: 13px;
}

.crm-field-full {
    grid-column: 1 / -1;
}

.crm-decisor-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    margin-top: 16px;
}

.crm-danger-zone {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 19px;
    border: 1px solid #fecaca;
    border-radius: 14px;
    padding: 15px;
    background: #fff7f7;
}

.crm-danger-zone > div {
    display: grid;
    gap: 4px;
}

.crm-danger-zone strong {
    color: #991b1b;
    font-size: 12px;
}

.crm-danger-zone span {
    color: #b45353;
    font-size: 10px;
}

.crm-danger-button {
    color: white;
    background: #b42318;
}

.crm-danger-button:hover {
    background: #8f1b13;
}

.crm-text-danger {
    color: #b42318;
    background: #fff0ef;
}

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

    .crm-decisor-layout {
        grid-template-columns: 1fr;
    }

    .crm-decisor-list {
        max-height: none;
    }
}

@media (max-width: 650px) {
    .crm-manage-summary {
        grid-template-columns: 1fr;
    }

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

    .crm-field-full {
        grid-column: auto;
    }

    .crm-danger-zone {
        align-items: stretch;
        flex-direction: column;
    }

    .crm-decisor-form-actions {
        flex-direction: column-reverse;
    }

    .crm-decisor-form-actions .button,
    .crm-danger-zone .button {
        width: 100%;
    }
}

/* ===== MODAL FINAL 4.0 ===== */

body.crm-modal-open {
    overflow: hidden !important;
}

#crm-lead-modal {
    align-items: center !important;
    overflow: hidden !important;
    padding: 18px !important;
}

#crm-lead-modal .crm-lead-modal-card {
    display: grid !important;

    grid-template-rows:
        auto
        auto
        auto
        minmax(0, 1fr)
        auto;

    width: min(
        1240px,
        calc(100vw - 36px)
    ) !important;

    height: min(
        850px,
        calc(100dvh - 36px)
    ) !important;

    max-height: calc(100dvh - 36px) !important;

    overflow: hidden !important;
    padding: 0 !important;
}

#crm-lead-modal .crm-modal-header {
    margin: 0 !important;
    border-bottom: 1px solid var(--border);
    padding: 20px 24px 16px !important;
}

#crm-lead-modal .crm-manage-summary {
    margin: 16px 24px 12px !important;
}

#crm-lead-modal .crm-research-toolbar {
    margin: 0 24px 14px !important;
}

#crm-lead-modal .crm-decisor-layout {
    min-height: 0 !important;
    overflow: hidden !important;

    grid-template-columns:
        minmax(320px, 0.85fr)
        minmax(460px, 1.15fr) !important;

    margin: 0 24px !important;
}

#crm-lead-modal .crm-decisor-list-section,
#crm-lead-modal .crm-decisor-form-section {
    min-height: 0 !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
}

#crm-lead-modal .crm-decisor-list {
    max-height: none !important;
    overflow: visible !important;
}

#crm-lead-modal .crm-danger-zone {
    margin: 14px 24px 20px !important;
}

.crm-removal-zone {
    border-color: var(--border) !important;
    background: #f8fafc !important;
}

.crm-removal-copy {
    display: grid;
    gap: 4px;
}

.crm-removal-copy strong {
    color: var(--text) !important;
}

.crm-removal-copy span {
    color: var(--muted) !important;
}

.crm-removal-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 13px;
}

.crm-delete-details {
    position: relative;
}

.crm-delete-details summary {
    cursor: pointer;
    color: #a33a32;
    font-size: 10px;
    font-weight: 800;
    list-style: none;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.crm-delete-details summary::-webkit-details-marker {
    display: none;
}

.crm-delete-details-content {
    position: absolute;
    right: 0;
    bottom: calc(100% + 10px);
    z-index: 50;

    width: 285px;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 13px;
    background: white;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.18);
}

.crm-delete-details-content p {
    margin: 0 0 11px;
    color: #9f3e38;
    font-size: 10px;
    line-height: 1.5;
}

.crm-delete-details-content .button {
    width: 100%;
}

@media (max-width: 950px) {
    #crm-lead-modal {
        padding: 8px !important;
    }

    #crm-lead-modal .crm-lead-modal-card {
        width: 100% !important;
        height: calc(100dvh - 16px) !important;
        max-height: calc(100dvh - 16px) !important;
    }

    #crm-lead-modal .crm-decisor-layout {
        display: block !important;
        overflow-y: auto !important;
    }

    #crm-lead-modal .crm-decisor-list-section,
    #crm-lead-modal .crm-decisor-form-section {
        overflow: visible !important;
        margin-bottom: 14px;
    }
}

@media (max-width: 650px) {
    .crm-removal-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .crm-delete-details-content {
        position: static;
        width: 100%;
        margin-top: 10px;
    }
}

/* ===== QSA VISUAL 1.0 ===== */

.detail-enrichment {
    display: grid;
    gap: 18px;
    border-top: 1px solid var(--border);
    padding: 22px 24px;
}

.enrichment-heading,
.enrichment-partners-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.enrichment-heading h3,
.enrichment-partners-heading h4 {
    margin: 5px 0 0;
}

.enrichment-heading h3 {
    font-size: 18px;
}

.enrichment-partners-heading h4 {
    font-size: 14px;
}

.enrichment-competence,
.enrichment-partners-heading > span {
    flex: 0 0 auto;
    border-radius: 999px;
    padding: 6px 9px;
    color: var(--blue);
    background: var(--blue-light);
    font-size: 9px;
    font-weight: 800;
}

.enrichment-tax-grid {
    display: grid;
    grid-template-columns:
        repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.enrichment-tax-grid article {
    display: grid;
    gap: 5px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 13px;
    background: #f8fafc;
}

.enrichment-tax-grid span {
    color: var(--muted);
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
}

.enrichment-tax-grid strong {
    font-size: 14px;
}

.enrichment-tax-grid small {
    color: var(--muted);
    font-size: 9px;
}

.enrichment-partners-list {
    display: grid;
    gap: 10px;
}

.enrichment-partner-card {
    display: grid;
    gap: 11px;
    border: 1px solid var(--border);
    border-radius: 13px;
    padding: 14px;
    background: white;
}

.enrichment-partner-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.enrichment-partner-main > div {
    display: grid;
    gap: 4px;
}

.enrichment-partner-main strong {
    font-size: 12px;
}

.enrichment-partner-main span {
    color: var(--muted);
    font-size: 10px;
}

.enrichment-person-type {
    flex: 0 0 auto;
    border-radius: 999px;
    padding: 5px 8px;
    color: #075985 !important;
    background: #e0f2fe;
    font-size: 8px !important;
    font-weight: 800;
}

.enrichment-partner-data {
    display: flex;
    flex-wrap: wrap;
    gap: 7px 16px;
    color: var(--muted);
    font-size: 9px;
}

.enrichment-partner-data strong {
    color: var(--text);
}

.enrichment-partner-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.enrichment-small-button {
    min-height: 33px;
    padding: 0 11px;
    font-size: 9px;
}

.enrichment-empty,
.enrichment-loading {
    display: grid;
    gap: 5px;
    place-items: center;
    min-height: 90px;
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 17px;
    color: var(--muted);
    text-align: center;
    font-size: 10px;
}

.enrichment-crm-hint {
    margin: 0;
    border-radius: 10px;
    padding: 10px 12px;
    color: #785400;
    background: #fff6d8;
    font-size: 9px;
    line-height: 1.5;
}

@media (max-width: 650px) {
    .detail-enrichment {
        padding: 18px;
    }

    .enrichment-tax-grid {
        grid-template-columns: 1fr;
    }

    .enrichment-heading,
    .enrichment-partners-heading,
    .enrichment-partner-main {
        align-items: stretch;
        flex-direction: column;
    }

    .enrichment-person-type {
        align-self: flex-start;
    }

    .enrichment-partner-actions {
        display: grid;
    }

    .enrichment-partner-actions .button {
        width: 100%;
    }
}

/* ===== EMAIL ASSISTANT 1.0 ===== */

.crm-create-email-button {
    order: -10;
}

.crm-email-modal-card {
    width: min(
        1050px,
        calc(100vw - 40px)
    );

    max-height: calc(100dvh - 40px);
    overflow: hidden;
    padding: 0;
}

.crm-email-modal-card .crm-modal-header {
    margin: 0;
    border-bottom: 1px solid var(--border);
    padding: 22px 24px 17px;
}

.crm-email-content {
    display: grid;
    grid-template-columns:
        minmax(0, 1fr)
        minmax(260px, 310px);

    min-height: 0;
    max-height: calc(100dvh - 170px);
}

.crm-email-editor {
    min-width: 0;
    overflow-y: auto;
    padding: 21px 24px 25px;
}

.crm-email-grid {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.crm-email-field-full {
    grid-column: 1 / -1;
}

.crm-email-editor textarea {
    width: 100%;
    min-height: 330px;
    resize: vertical;

    border: 1px solid var(--border);
    border-radius: 11px;
    outline: none;
    padding: 14px;

    color: var(--text);
    background: white;

    font: inherit;
    font-size: 12px;
    line-height: 1.6;
}

.crm-email-editor textarea:focus {
    border-color: var(--blue-bright);

    box-shadow:
        0 0 0 4px
        rgba(22, 119, 255, 0.1);
}

.crm-email-sidebar {
    display: flex;
    flex-direction: column;
    gap: 15px;

    overflow-y: auto;
    border-left: 1px solid var(--border);
    padding: 21px;

    background: #f8fafc;
}

.crm-email-help,
.crm-email-webmail-settings {
    display: grid;
    gap: 9px;

    border: 1px solid var(--border);
    border-radius: 13px;
    padding: 14px;

    background: white;
}

.crm-email-help strong,
.crm-email-webmail-settings strong {
    font-size: 12px;
}

.crm-email-help span {
    color: var(--muted);
    font-size: 10px;
    line-height: 1.55;
}

.crm-email-webmail-settings input {
    width: 100%;
    min-height: 41px;

    border: 1px solid var(--border);
    border-radius: 9px;
    outline: none;
    padding: 0 11px;

    color: var(--text);
    background: white;
    font: inherit;
    font-size: 10px;
}

.crm-email-actions {
    display: grid;
    gap: 9px;
}

.crm-email-actions .button {
    width: 100%;
}

.crm-email-sent-button {
    color: #087443;
    background: #dcfce7;
}

.crm-email-sent-button:hover {
    background: #c7f7d8;
}

.crm-email-warning {
    color: var(--muted);
    font-size: 9px;
    line-height: 1.5;
    text-align: center;
}

@media (max-width: 850px) {
    .crm-email-modal-card {
        width: calc(100vw - 20px);
        max-height: calc(100dvh - 20px);
    }

    .crm-email-content {
        display: block;
        overflow-y: auto;
        max-height: calc(100dvh - 110px);
    }

    .crm-email-editor {
        overflow: visible;
    }

    .crm-email-sidebar {
        overflow: visible;
        border-top: 1px solid var(--border);
        border-left: 0;
    }
}

@media (max-width: 600px) {
    .crm-email-grid {
        grid-template-columns: 1fr;
    }

    .crm-email-field-full {
        grid-column: auto;
    }

    .crm-email-editor {
        padding: 17px;
    }

    .crm-email-sidebar {
        padding: 17px;
    }
}

/* ===== CRM QSA VISUAL 1.0 ===== */

.crm-qsa-panel {
    margin-bottom: 17px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 17px;
}

.crm-qsa-details {
    border: 1px solid var(--border);
    border-radius: 13px;
    background: #f8fafc;
}

.crm-qsa-details > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;

    cursor: pointer;
    padding: 13px;

    list-style: none;
}

.crm-qsa-details > summary::-webkit-details-marker {
    display: none;
}

.crm-qsa-details > summary > div {
    display: grid;
    gap: 4px;
}

.crm-qsa-details > summary strong {
    font-size: 13px;
}

.crm-qsa-count {
    flex: 0 0 auto;
    border-radius: 999px;
    padding: 5px 8px;

    color: var(--blue);
    background: var(--blue-light);

    font-size: 9px;
    font-weight: 800;
}

.crm-qsa-content {
    display: grid;
    gap: 12px;

    border-top: 1px solid var(--border);
    padding: 12px;
}

.crm-qsa-tax-grid {
    display: grid;
    grid-template-columns:
        repeat(3, minmax(0, 1fr));
    gap: 7px;
}

.crm-qsa-tax-grid article {
    display: grid;
    gap: 4px;

    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 9px;

    background: white;
}

.crm-qsa-tax-grid span {
    color: var(--muted);
    font-size: 8px;
    font-weight: 800;
    text-transform: uppercase;
}

.crm-qsa-tax-grid strong {
    font-size: 11px;
}

.crm-qsa-list {
    display: grid;
    gap: 9px;

    max-height: 280px;
    overflow-y: auto;
    padding-right: 2px;
}

.crm-qsa-card {
    display: grid;
    gap: 9px;

    border: 1px solid var(--border);
    border-radius: 11px;
    padding: 11px;

    background: white;
}

.crm-qsa-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.crm-qsa-card-header > div {
    display: grid;
    gap: 3px;
}

.crm-qsa-card-header strong {
    font-size: 11px;
}

.crm-qsa-card-header span {
    color: var(--muted);
    font-size: 9px;
}

.crm-qsa-type {
    flex: 0 0 auto;
    border-radius: 999px;
    padding: 4px 7px;

    color: #075985 !important;
    background: #e0f2fe;

    font-size: 7px !important;
    font-weight: 900;
}

.crm-qsa-data {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 12px;

    color: var(--muted);
    font-size: 8px;
}

.crm-qsa-data strong {
    color: var(--text);
}

.crm-qsa-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.crm-qsa-actions .button {
    min-height: 30px;
    padding: 0 8px;
    font-size: 8px;
}

.crm-qsa-loading,
.crm-qsa-empty {
    display: grid;
    gap: 5px;
    place-items: center;

    min-height: 90px;
    border: 1px dashed var(--border);
    border-radius: 11px;
    padding: 13px;

    color: var(--muted);
    text-align: center;
    font-size: 9px;
}

.crm-qsa-empty strong {
    color: var(--text);
    font-size: 10px;
}

@media (max-width: 650px) {
    .crm-qsa-tax-grid {
        grid-template-columns: 1fr;
    }

    .crm-qsa-card-header {
        align-items: stretch;
        flex-direction: column;
    }

    .crm-qsa-type {
        align-self: flex-start;
    }

    .crm-qsa-actions {
        display: grid;
    }

    .crm-qsa-actions .button {
        width: 100%;
    }
}
