/* ═══════════════════════════════════════════════
   CRM Gestão — Design System
   Based on css.html specification
   ═══════════════════════════════════════════════ */

:root {
    --crm-bg: #15191e;
    --crm-card: #1c232b;
    --crm-card-border: #2a3b47;
    --crm-cyan: #00ffff;
    --crm-yellow: #ffd700;
    --crm-red: #ff4d4d;
    --crm-green: #00e676;
    --crm-teal: #193237;
    --crm-text: #ffffff;
    --crm-text-secondary: #b0b0b0;
    --crm-text-muted: #6b7280;
    --crm-font: 'Jura', sans-serif;
    --crm-radius: 4px;
    --crm-radius-lg: 4px;
    --crm-glow-cyan: 0 0 10px #00ffff, 0 0 20px rgba(0, 255, 255, 0.4);
    --crm-glow-yellow: 0 0 10px #ffd700, 0 0 20px rgba(255, 215, 0, 0.4);
    --crm-glow-red: 0 0 10px #ff4d4d, 0 0 20px rgba(255, 77, 77, 0.4);
    --crm-transition: all 0.3s ease;
}

[class*="crm-gestao-"] {
    border-radius: var(--crm-radius);
    overflow: hidden;
}

/* ── Global Font Override ── */
[class*="crm-gestao-"]:not(.mce-container),
[class*="crm-gestao-"] *:not(.mce-ico):not(.fa-solid):not(.fa-regular):not(.fa-brands):not(.fas):not(.far),
.crm-modal,
.crm-modal *:not(.mce-ico):not(.fa-solid):not(.fa-regular):not(.fa-brands):not(.fas):not(.far),
.crm-toast {
    font-family: 'Jura', sans-serif !important;
}

/* ── Section Title ── */
.crm-section-title {
    font-family: var(--crm-font);
    color: var(--crm-cyan);
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0;
    letter-spacing: -0.02em;
}

/* ═══════════════════════════════════════════════
   KPI Dashboard Cards
   ═══════════════════════════════════════════════ */
.crm-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.crm-kpi-card {
    background: var(--crm-card);
    border: 1px solid var(--crm-card-border);
    border-radius: var(--crm-radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
    transition: var(--crm-transition);
}

.crm-kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--crm-cyan), transparent);
    opacity: 0.7;
}

.crm-kpi-card[data-color="yellow"]::before {
    background: linear-gradient(90deg, transparent, var(--crm-yellow), transparent);
}

.crm-kpi-card[data-color="red"]::before {
    background: linear-gradient(90deg, transparent, var(--crm-red), transparent);
}

.crm-kpi-card:hover {
    border-color: rgba(0, 255, 255, 0.3);
    transform: translateY(-2px);
}

.crm-kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    background: rgba(0, 255, 255, 0.08);
    color: var(--crm-cyan);
    border: 1px solid rgba(0, 255, 255, 0.2);
}

.crm-kpi-card[data-color="yellow"] .crm-kpi-icon {
    background: rgba(255, 215, 0, 0.08);
    color: var(--crm-yellow);
    border-color: rgba(255, 215, 0, 0.2);
}

.crm-kpi-card[data-color="red"] .crm-kpi-icon {
    background: rgba(255, 77, 77, 0.08);
    color: var(--crm-red);
    border-color: rgba(255, 77, 77, 0.2);
}

.crm-kpi-info {
    display: flex;
    flex-direction: column;
}

.crm-kpi-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--crm-text);
    line-height: 1.1;
}

.crm-kpi-label {
    font-size: 0.8rem;
    color: var(--crm-text-secondary);
    margin-top: 2px;
}

.crm-kpi-sub {
    font-size: 0.75rem;
    color: var(--crm-cyan);
    margin-top: 2px;
}

/* ═══════════════════════════════════════════════
   Toolbar
   ═══════════════════════════════════════════════ */
.crm-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.crm-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.crm-search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.crm-search-box i {
    position: absolute;
    left: 12px;
    color: var(--crm-text-muted);
    font-size: 0.85rem;
    pointer-events: none;
}

.crm-search-input {
    background: var(--crm-card);
    border: 1px solid var(--crm-card-border);
    border-radius: var(--crm-radius);
    color: var(--crm-text);
    padding: 8px 14px 8px 34px;
    font-size: 0.85rem;
    font-family: var(--crm-font);
    outline: none;
    transition: var(--crm-transition);
    width: 200px;
}

.crm-search-input:focus {
    border-color: var(--crm-cyan);
    box-shadow: 0 0 0 1px rgba(0, 255, 255, 0.2);
}

.crm-filter-select {
    background: var(--crm-card);
    border: 1px solid var(--crm-card-border);
    border-radius: var(--crm-radius);
    color: var(--crm-text);
    padding: 8px 12px;
    font-size: 0.85rem;
    font-family: var(--crm-font);
    outline: none;
    cursor: pointer;
    transition: var(--crm-transition);
}

.crm-filter-select:focus {
    border-color: var(--crm-cyan);
}

/* ═══════════════════════════════════════════════
   Buttons
   ═══════════════════════════════════════════════ */
.crm-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 2px solid;
    border-radius: var(--crm-radius);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--crm-font);
    cursor: pointer;
    transition: var(--crm-transition);
    text-decoration: none;
    white-space: nowrap;
}

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

.crm-btn-primary:hover {
    background: rgba(0, 255, 255, 0.1);
    box-shadow: var(--crm-glow-cyan);
}

.crm-btn-secondary {
    background: transparent;
    border-color: var(--crm-card-border);
    color: var(--crm-text-secondary);
}

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

.crm-btn-success {
    background: transparent;
    border-color: var(--crm-green);
    color: var(--crm-green);
}

.crm-btn-success:hover {
    background: rgba(0, 230, 118, 0.1);
    box-shadow: 0 0 10px rgba(0, 230, 118, 0.4);
}

.crm-btn-danger {
    background: transparent;
    border-color: var(--crm-red);
    color: var(--crm-red);
}

.crm-btn-danger:hover {
    background: rgba(255, 77, 77, 0.1);
    box-shadow: var(--crm-glow-red);
}

.crm-btn-warning {
    background: transparent;
    border-color: var(--crm-yellow);
    color: var(--crm-yellow);
}

.crm-btn-warning:hover {
    background: rgba(255, 215, 0, 0.1);
    box-shadow: var(--crm-glow-yellow);
}

.crm-btn-sm {
    padding: 5px 10px;
    font-size: 0.78rem;
}

.crm-btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

/* GLASS Design/* Botões GLASS */
.crm-btn-glass-yellow {
    background: rgba(255, 235, 59, 0.15) !important;
    color: #ffeb3b !important;
    border: 1px solid #ffeb3b !important;
    height: 32px !important;
    line-height: 30px !important;
    font-size: 10px !important;
    padding: 0 15px !important;
    box-shadow: none !important;
    transition: all 0.3s ease !important;
    text-transform: uppercase !important;
    font-weight: 600 !important;
}
.crm-btn-glass-yellow:hover {
    box-shadow: 0 0 15px #ffeb3b !important;
}
.crm-btn-glass-cyan {
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid var(--crm-cyan);
    color: var(--crm-cyan);
    height: 32px;
    width: 32px;
    font-size: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--crm-transition);
    box-shadow: none;
}

.crm-btn-glass-cyan:hover {
    box-shadow: var(--crm-glow-cyan);
    background: rgba(0, 255, 255, 0.2);
}

/* ═══════════════════════════════════════════════
   Tables
   ═══════════════════════════════════════════════ */
.crm-table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--crm-card-border);
    border-radius: var(--crm-radius-lg);
    background: var(--crm-card);
}

.crm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    font-family: var(--crm-font);
}

.crm-table thead th {
    background: rgba(0, 255, 255, 0.05);
    color: var(--crm-cyan);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--crm-card-border);
    white-space: nowrap;
}

.crm-table tbody td {
    padding: 12px 16px;
    color: var(--crm-text);
    border-bottom: 1px solid rgba(42, 59, 71, 0.5);
    vertical-align: middle;
}

.crm-table tbody tr {
    transition: background-color 0.2s;
}

.crm-table tbody tr:hover {
    background: rgba(0, 255, 255, 0.03);
}

.crm-table tbody tr:last-child td {
    border-bottom: none;
}

.crm-table .crm-loading {
    text-align: center;
    padding: 40px;
    color: var(--crm-text-muted);
}

.crm-table .crm-empty {
    text-align: center;
    padding: 40px;
    color: var(--crm-text-muted);
}

.crm-td-actions {
    display: flex;
    gap: 6px;
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════
   Status Badges
   ═══════════════════════════════════════════════ */
.crm-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.crm-badge-cyan {
    background: rgba(0, 255, 255, 0.1);
    color: var(--crm-cyan);
    border: 1px solid rgba(0, 255, 255, 0.3);
}

.crm-badge-yellow {
    background: rgba(255, 215, 0, 0.1);
    color: var(--crm-yellow);
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.crm-badge-glass-cyan { background: rgba(0, 255, 255, 0.1); color: var(--crm-cyan); border: 1px solid var(--crm-cyan); }
.crm-badge-glass-yellow { background: rgba(255, 193, 7, 0.1); color: #ffc107; border: 1px solid #ffc107; }

.crm-badge-red {
    background: rgba(255, 77, 77, 0.1);
    color: var(--crm-red);
    border: 1px solid rgba(255, 77, 77, 0.3);
}

.crm-badge-green {
    background: rgba(0, 230, 118, 0.1);
    color: var(--crm-green);
    border: 1px solid rgba(0, 230, 118, 0.3);
}

.crm-badge-gray {
    background: rgba(107, 114, 128, 0.15);
    color: var(--crm-text-muted);
    border: 1px solid rgba(107, 114, 128, 0.3);
}

/* Priority badges */
.crm-badge-alta {
    background: rgba(255, 77, 77, 0.1);
    color: var(--crm-red);
    border: 1px solid rgba(255, 77, 77, 0.3);
}

.crm-badge-media {
    background: rgba(255, 215, 0, 0.1);
    color: var(--crm-yellow);
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.crm-badge-baixa {
    background: rgba(0, 230, 118, 0.1);
    color: var(--crm-green);
    border: 1px solid rgba(0, 230, 118, 0.3);
}

/* ═══════════════════════════════════════════════
   Card Grid (Projetos)
   ═══════════════════════════════════════════════ */
.crm-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.crm-project-card {
    background: var(--crm-card);
    border: 1px solid var(--crm-card-border);
    border-radius: var(--crm-radius-lg);
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: var(--crm-transition);
    cursor: pointer;
}

.crm-project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--crm-cyan), transparent);
    opacity: 0.5;
}

.crm-project-card:hover {
    border-color: rgba(0, 255, 255, 0.3);
    transform: translateY(-2px);
}

.crm-project-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.crm-project-card-title {
    color: var(--crm-text);
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.crm-project-card-client {
    color: var(--crm-text-secondary);
    font-size: 0.8rem;
    margin-top: 4px;
}

.crm-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(42, 59, 71, 0.5);
    border-radius: 4px;
    margin: 12px 0 8px;
    overflow: hidden;
}

.crm-progress-fill {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--crm-cyan), #00cccc);
    transition: width 0.5s ease;
}

.crm-progress-text {
    font-size: 0.75rem;
    color: var(--crm-text-secondary);
}

.crm-project-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(42, 59, 71, 0.4);
}

/* ═══════════════════════════════════════════════
   Modals
   ═══════════════════════════════════════════════ */
.crm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--crm-font);
}

.crm-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.crm-modal-content {
    position: relative;
    background: var(--crm-card);
    border: 1px solid var(--crm-card-border);
    border-radius: var(--crm-radius-lg);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: crmModalIn 0.25s ease;
}

.crm-modal-large {
    max-width: 800px;
}

@keyframes crmModalIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.crm-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--crm-card-border);
}

.crm-modal-title {
    color: var(--crm-cyan);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.crm-modal-close {
    background: transparent;
    border: 1px solid var(--crm-yellow);
    color: var(--crm-yellow);
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--crm-transition);
    font-size: 0.9rem;
}

.crm-modal-close:hover {
    box-shadow: var(--crm-glow-yellow);
}

.crm-modal-body {
    padding: 24px;
}

/* ═══════════════════════════════════════════════
   Forms
   ═══════════════════════════════════════════════ */
.crm-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.crm-form-group {
    display: flex;
    flex-direction: column;
}

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

.crm-form-group label {
    color: var(--crm-text-secondary);
    font-size: 0.8rem;
    margin-bottom: 6px;
    font-weight: 500;
}

.crm-input {
    background: var(--crm-bg);
    border: 1px solid var(--crm-card-border);
    border-radius: var(--crm-radius);
    color: var(--crm-text);
    padding: 10px 14px;
    font-size: 0.9rem;
    font-family: var(--crm-font);
    outline: none;
    transition: var(--crm-transition);
    width: 100%;
}

.crm-input:focus {
    border-color: var(--crm-cyan);
    box-shadow: 0 0 0 1px rgba(0, 255, 255, 0.2);
}

.crm-textarea {
    resize: vertical;
    min-height: 400px;
}

select.crm-input {
    cursor: pointer;
    appearance: auto;
}

.crm-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--crm-card-border);
}

/* ═══════════════════════════════════════════════
   Calc Preview (Orçamentos)
   ═══════════════════════════════════════════════ */
.crm-calc-preview {
    background: rgba(0, 255, 255, 0.03);
    border: 1px solid rgba(0, 255, 255, 0.15);
    border-radius: var(--crm-radius);
    padding: 16px 20px;
    margin-top: 16px;
}

.crm-calc-preview h4 {
    color: var(--crm-cyan);
    font-size: 0.85rem;
    margin: 0 0 12px;
}

.crm-calc-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 0.85rem;
}

.crm-calc-row span {
    color: var(--crm-text-secondary);
}

.crm-calc-row strong {
    color: var(--crm-cyan);
}

/* ═══════════════════════════════════════════════
   Pagination
   ═══════════════════════════════════════════════ */
.crm-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.crm-pagination button {
    background: var(--crm-card);
    border: 1px solid var(--crm-card-border);
    color: var(--crm-text-secondary);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-family: var(--crm-font);
    transition: var(--crm-transition);
}

.crm-pagination button:hover {
    border-color: var(--crm-cyan);
    color: var(--crm-cyan);
}

.crm-pagination button.active {
    background: rgba(0, 255, 255, 0.1);
    border-color: var(--crm-cyan);
    color: var(--crm-cyan);
}

.crm-pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.crm-pagination-info {
    color: var(--crm-text-muted);
    font-size: 0.78rem;
    margin: 0 8px;
}

/* ═══════════════════════════════════════════════
   Toast Notification
   ═══════════════════════════════════════════════ */
.crm-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px 20px;
    border-radius: var(--crm-radius);
    color: #fff;
    font-family: var(--crm-font);
    font-size: 0.9rem;
    z-index: 9999999;
    animation: crmToastIn 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    gap: 10px;
}

.crm-toast-success {
    background: #1c3a2a;
    border: 1px solid var(--crm-green);
}

.crm-toast-error {
    background: #3a1c1c;
    border: 1px solid var(--crm-red);
}

.crm-toast-info {
    background: #1c2a3a;
    border: 1px solid var(--crm-cyan);
}

@keyframes crmToastIn {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ═══════════════════════════════════════════════
   View Detail Blocks
   ═══════════════════════════════════════════════ */
.crm-view-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.crm-view-item label {
    display: block;
    color: var(--crm-cyan);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.crm-view-item span,
.crm-view-item div {
    color: var(--crm-text);
    font-size: 0.9rem;
}

.crm-view-section {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--crm-card-border);
}

.crm-view-section h4 {
    color: var(--crm-cyan);
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.crm-link-copy {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--crm-bg);
    padding: 8px 12px;
    border-radius: var(--crm-radius);
    border: 1px solid var(--crm-card-border);
    margin-top: 8px;
}

.crm-link-copy input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--crm-text);
    font-size: 0.8rem;
    font-family: var(--crm-font);
    outline: none;
}

.crm-link-copy button {
    background: transparent;
    border: 1px solid var(--crm-cyan);
    color: var(--crm-cyan);
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: var(--crm-transition);
}

.crm-link-copy button:hover {
    box-shadow: var(--crm-glow-cyan);
}

/* ═══════════════════════════════════════════════
   Configurações / Logo
   ═══════════════════════════════════════════════ */
.crm-config-card {
    background: var(--crm-card);
    border: 1px solid var(--crm-card-border);
    border-radius: var(--crm-radius-lg);
    padding: 32px;
}

.crm-logo-section {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 24px;
}

.crm-logo-preview {
    width: 160px;
    height: 160px;
    border: 2px dashed var(--crm-card-border);
    border-radius: var(--crm-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    transition: var(--crm-transition);
}

.crm-logo-preview:hover {
    border-color: var(--crm-cyan);
}

.crm-logo-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.crm-logo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--crm-text-muted);
}

.crm-logo-placeholder i {
    font-size: 2.5rem;
    color: var(--crm-card-border);
}

.crm-logo-placeholder span {
    font-size: 0.78rem;
}

.crm-logo-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.crm-config-divider {
    height: 1px;
    background: var(--crm-card-border);
    margin: 24px 0;
}

/* Quill Contrato Editor */
#quill-contrato {
    background: var(--crm-bg);
    border: 1px solid var(--crm-card-border);
    border-top: none;
    border-radius: 0 0 var(--crm-radius) var(--crm-radius);
}

#quill-contrato .ql-editor {
    color: #ffffff;
    font-family: Verdana, Geneva, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    min-height: 250px;
}

#quill-contrato .ql-editor.ql-blank::before {
    color: var(--crm-text-muted);
    font-family: Verdana, Geneva, sans-serif;
    font-size: 16px;
    font-style: italic;
}

/* ENTER (novo paragrafo p) x SHIFT+ENTER (quebra de linha br)
   Reset forcado para neutralizar estilos do tema WordPress,
   depois adiciona margem controlada para diferenciar os dois comportamentos */
#quill-contrato .ql-editor p,
#quill-descritivo .ql-editor p,
#quill-observacoes .ql-editor p,
#quill-padroes-inclusos .ql-editor p {
    margin-top: 0 !important;
    margin-bottom: 1em !important;
    padding: 0 !important;
}

#quill-contrato .ql-editor p:last-child,
#quill-descritivo .ql-editor p:last-child,
#quill-observacoes .ql-editor p:last-child,
#quill-padroes-inclusos .ql-editor p:last-child {
    margin-bottom: 0 !important;
}

#quill-contrato .ql-indent-1 { padding-left: 3em; }
#quill-contrato .ql-indent-2 { padding-left: 6em; }
#quill-contrato .ql-indent-3 { padding-left: 9em; }
#quill-contrato .ql-indent-4 { padding-left: 12em; }
#quill-contrato .ql-indent-5 { padding-left: 15em; }

#quill-contrato + .ql-toolbar,
#quill-contrato ~ .ql-toolbar,
#quill-contrato.ql-container + .ql-toolbar {
    background: var(--crm-card);
    border-color: var(--crm-card-border);
}

/* Quill toolbar dark theme - scoped to contrato parent */
.crm-gestao-configuracoes .ql-toolbar.ql-snow {
    background: var(--crm-card);
    border: 1px solid var(--crm-card-border);
    border-radius: var(--crm-radius) var(--crm-radius) 0 0;
}

.crm-gestao-configuracoes .ql-toolbar .ql-stroke {
    stroke: var(--crm-text-secondary);
}

.crm-gestao-configuracoes .ql-toolbar .ql-fill {
    fill: var(--crm-text-secondary);
}

.crm-gestao-configuracoes .ql-toolbar .ql-picker-label {
    color: var(--crm-text-secondary);
}

.crm-gestao-configuracoes .ql-toolbar button:hover .ql-stroke,
.crm-gestao-configuracoes .ql-toolbar .ql-picker-label:hover .ql-stroke {
    stroke: var(--crm-cyan);
}

.crm-gestao-configuracoes .ql-toolbar button:hover .ql-fill,
.crm-gestao-configuracoes .ql-toolbar .ql-picker-label:hover .ql-fill {
    fill: var(--crm-cyan);
}

.crm-gestao-configuracoes .ql-toolbar button:hover,
.crm-gestao-configuracoes .ql-toolbar .ql-picker-label:hover {
    color: var(--crm-cyan);
}

/* Save Progress Bar */
.crm-save-progress-container {
    background: var(--crm-bg) !important;
    border: 1px solid var(--crm-card-border) !important;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
}

.crm-save-progress-bar {
    background: var(--crm-cyan) !important;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.4), 0 0 20px rgba(0, 255, 255, 0.2);
    height: 100%;
    transition: width 0.1s linear;
}

/* ═══════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════ */
@media (max-width: 768px) {
    .crm-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .crm-toolbar-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .crm-search-input {
        width: 100%;
    }

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

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

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

    .crm-modal-content {
        width: 95%;
        max-height: 95vh;
    }

}

/* Animations for drag & drop */
@keyframes crmKanbanDrop {
    0% {
        transform: scale(1.05);
        box-shadow: 0 0 20px rgba(0, 255, 255, 0.4);
    }

    100% {
        transform: scale(1);
        box-shadow: none;
    }
}

.crm-kanban-column.dropped {
    animation: crmKanbanDrop 0.3s ease;
}

/* Loading state for kanban */
.crm-kanban-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    color: var(--crm-text-muted);
    font-size: 0.9rem;
}

.crm-kanban-loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--crm-card-border);
    border-top-color: var(--crm-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

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

/* ═══════════════════════════════════════════════
   Kanban Board for Projects
   ═══════════════════════════════════════════════ */
.crm-kanban-container {
    background: var(--crm-bg);
    border-radius: var(--crm-radius-lg);
    padding: 20px;
    overflow-x: auto;
}

.crm-kanban-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.crm-kanban-filters {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.crm-kanban-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    min-height: 500px;
    margin-bottom: 20px;
}

.crm-kanban-column {
    background: var(--crm-card);
    border: 1px solid var(--crm-card-border);
    border-radius: var(--crm-radius-lg);
    display: flex;
    flex-direction: column;
    min-height: 400px;
    transition: var(--crm-transition);
}

.crm-kanban-column.drag-over {
    border-color: var(--crm-cyan);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.2);
}

.crm-kanban-column-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--crm-card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.crm-kanban-column-title {
    color: var(--crm-cyan);
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.crm-kanban-column-count {
    background: rgba(0, 255, 255, 0.1);
    color: var(--crm-cyan);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 24px;
    text-align: center;
}

.crm-kanban-column[data-status="Planejamento"] .crm-kanban-column-title {
    color: var(--crm-yellow);
}

.crm-kanban-column[data-status="Planejamento"] .crm-kanban-column-count {
    background: rgba(255, 215, 0, 0.1);
    color: var(--crm-yellow);
    border-color: rgba(255, 215, 0, 0.3);
}

.crm-kanban-column[data-status="Desenvolvimento"] .crm-kanban-column-title {
    color: var(--crm-cyan);
}

.crm-kanban-column[data-status="Ajustes"] .crm-kanban-column-title {
    color: var(--crm-yellow);
}

.crm-kanban-column[data-status="Publicado"] .crm-kanban-column-title {
    color: var(--crm-green);
}

.crm-kanban-column[data-status="Publicado"] .crm-kanban-column-count {
    background: rgba(0, 230, 118, 0.1);
    color: var(--crm-green);
    border-color: rgba(0, 230, 118, 0.3);
}

.crm-kanban-column[data-status="Finalizado"] .crm-kanban-column-title {
    color: var(--crm-text-muted);
}

.crm-kanban-column[data-status="Finalizado"] .crm-kanban-column-count {
    background: rgba(107, 114, 128, 0.15);
    color: var(--crm-text-muted);
    border-color: rgba(107, 114, 128, 0.3);
}

.crm-kanban-cards {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 300px;
}

.crm-kanban-card {
    background: var(--crm-bg);
    border: 1px solid var(--crm-card-border);
    border-radius: var(--crm-radius);
    padding: 12px;
    cursor: grab;
    transition: var(--crm-transition);
    position: relative;
    overflow: hidden;
}

.crm-kanban-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--crm-cyan);
    opacity: 0.7;
}

.crm-kanban-card[data-priority="alta"]::before {
    background: var(--crm-red);
}

.crm-kanban-card[data-priority="media"]::before {
    background: var(--crm-yellow);
}

.crm-kanban-card[data-priority="baixa"]::before {
    background: var(--crm-green);
}

.crm-kanban-card:hover {
    border-color: rgba(0, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.crm-kanban-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
    transform: rotate(2deg);
}

.crm-kanban-card-title {
    color: var(--crm-text);
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0 0 8px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.crm-kanban-card-client {
    color: var(--crm-text-secondary);
    font-size: 0.75rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.crm-kanban-card-client i {
    color: var(--crm-cyan);
    font-size: 0.7rem;
}

.crm-kanban-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(42, 59, 71, 0.3);
}

.crm-kanban-card-date {
    color: var(--crm-text-muted);
    font-size: 0.7rem;
}

.crm-kanban-card-actions {
    display: flex;
    gap: 4px;
}

.crm-kanban-card-actions button {
    background: transparent;
    border: none;
    color: var(--crm-text-muted);
    cursor: pointer;
    padding: 2px;
    border-radius: 3px;
    transition: var(--crm-transition);
    font-size: 0.75rem;
}

.crm-kanban-card-actions button:hover {
    color: var(--crm-cyan);
    background: rgba(0, 255, 255, 0.1);
}

.crm-kanban-priority {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--crm-green);
}

.crm-kanban-priority.alta {
    background: var(--crm-red);
    box-shadow: 0 0 6px rgba(255, 77, 77, 0.4);
}

.crm-kanban-priority.media {
    background: var(--crm-yellow);
    box-shadow: 0 0 6px rgba(255, 215, 0, 0.4);
}

.crm-kanban-priority.baixa {
    background: var(--crm-green);
    box-shadow: 0 0 6px rgba(0, 230, 118, 0.4);
}

.crm-kanban-empty {
    text-align: center;
    color: var(--crm-text-muted);
    font-size: 0.8rem;
    padding: 20px;
    font-style: italic;
}

/* Responsive Kanban */
@media (max-width: 1200px) {
    .crm-kanban-board {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .crm-kanban-board {
        grid-template-columns: repeat(2, 1fr);
    }

    .crm-kanban-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

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

    .crm-kanban-column {
        min-height: 300px;
    }

    .crm-kanban-cards {
        min-height: 200px;
    }

    .crm-kanban-filters {
        width: 100%;
        justify-content: space-between;
    }

    .crm-search-input {
        flex: 1;
        min-width: 150px;
    }
}

/* Animations for drag & drop */
@keyframes crmKanbanDrop {
    0% {
        transform: scale(1.05);
        box-shadow: 0 0 20px rgba(0, 255, 255, 0.4);
    }

    100% {
        transform: scale(1);
        box-shadow: none;
    }
}

.crm-kanban-column.dropped {
    animation: crmKanbanDrop 0.3s ease;
}

/* Loading state for kanban */
.crm-kanban-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    color: var(--crm-text-muted);
    font-size: 0.9rem;
}

.crm-kanban-loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--crm-card-border);
    border-top-color: var(--crm-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

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