/* =========================================================================
   EcoPlus CRM — Design System
   ========================================================================= */

/* ── Reset / Scope ────────────────────────────────────────────────────────── */
.ep-crm *,
.ep-crm *::before,
.ep-crm *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Login Gate ─────────────────────────────────────────────────────────── */
.ep-crm-login-gate {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
    font-family: 'Plus Jakarta Sans', sans-serif;
}
.ep-crm-login-box {
    background: #1E293B;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 20px;
    padding: 48px 40px;
    width: 100%; max-width: 380px;
    text-align: center;
    box-shadow: 0 24px 80px rgba(0,0,0,.5);
}
.ep-crm-login-logo { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 24px; font-size: 24px; font-weight: 800; }
.ep-crm-login-badge { background: #2EAF7D; color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; letter-spacing: .5px; }
.ep-crm-login-box h2 { color: #F1F5F9; font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.ep-crm-login-box p  { color: #94A3B8; font-size: 14px; margin-bottom: 28px; }

/* ── Root Layout ──────────────────────────────────────────────────────────── */
.ep-crm {
    display: flex;
    min-height: 100vh;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    color: #1E293B;
    background: #F1F5F9;
    position: relative;
    overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.ep-crm-sidebar {
    width: 240px;
    min-width: 240px;
    background: #0F172A;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    z-index: 100;
    scrollbar-width: none;
}
.ep-crm-sidebar::-webkit-scrollbar { display: none; }

.ep-crm-sidebar__logo {
    display: flex; align-items: center; gap: 8px;
    padding: 28px 20px 20px;
    font-size: 18px; font-weight: 800;
    border-bottom: 1px solid rgba(255,255,255,.06);
    margin-bottom: 8px;
}
.ep-logo__eco  { color: #F1F5F9; }
.ep-logo__plus { color: #2EAF7D; }
.ep-crm-badge  { background: #2EAF7D; color: #fff; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 20px; letter-spacing: .5px; margin-left: 2px; }

/* Nav */
.ep-crm-nav { flex: 1; padding: 8px 12px; }
.ep-crm-nav__group { margin-bottom: 24px; }
.ep-crm-nav__label {
    display: block;
    font-size: 10px; font-weight: 700; letter-spacing: 1.2px;
    color: #475569; text-transform: uppercase;
    padding: 0 8px 8px;
}
.ep-crm-nav__item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 10px;
    color: #94A3B8; text-decoration: none;
    font-size: 13.5px; font-weight: 500;
    transition: all .2s; margin-bottom: 2px;
    cursor: pointer;
}
.ep-crm-nav__item:hover { color: #F1F5F9; background: rgba(255,255,255,.05); }
.ep-crm-nav__item.active { color: #2EAF7D; background: rgba(46,175,125,.12); }
.ep-crm-nav__item.active svg { color: #2EAF7D; }
.ep-crm-nav__item--soon { opacity: .5; cursor: default; pointer-events: none; }
.ep-crm-nav__count {
    margin-left: auto;
    background: #2EAF7D; color: #fff;
    font-size: 11px; font-weight: 700;
    padding: 1px 7px; border-radius: 20px; min-width: 22px; text-align: center;
}
.ep-crm-nav__count--alert { background: #EF4444; }
.ep-crm-badge-soon { margin-left: auto; font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 20px; background: rgba(255,255,255,.07); color: #64748B; letter-spacing: .4px; text-transform: uppercase; }

/* Sidebar Footer */
.ep-crm-sidebar__footer { padding: 16px 12px; border-top: 1px solid rgba(255,255,255,.06); }
.ep-crm-user { display: flex; align-items: center; gap: 10px; }
.ep-crm-user__avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, #2EAF7D, #1a8a60);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.ep-crm-user__info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ep-crm-user__name { font-size: 13px; font-weight: 600; color: #E2E8F0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ep-crm-user__role { font-size: 11px; color: #64748B; }

/* ── Main Area ───────────────────────────────────────────────────────────── */
.ep-crm-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-y: auto;
    height: 100vh;
}

/* ── Top Bar ─────────────────────────────────────────────────────────────── */
.ep-crm-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 28px;
    height: 64px;
    background: #fff;
    border-bottom: 1px solid #E2E8F0;
    position: sticky; top: 0; z-index: 50;
    gap: 16px;
    flex-shrink: 0;
}
.ep-crm-topbar__left { display: flex; align-items: center; gap: 14px; }
.ep-crm-topbar__title { font-size: 17px; font-weight: 700; color: #0F172A; }
.ep-crm-topbar__right { display: flex; align-items: center; gap: 12px; }
.ep-crm-date { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: #64748B; white-space: nowrap; }
.ep-crm-sidebar-toggle {
    display: none; flex-direction: column; gap: 5px;
    background: none; border: none; cursor: pointer; padding: 4px;
}
.ep-crm-sidebar-toggle span { display: block; width: 20px; height: 2px; background: #475569; border-radius: 2px; }

/* ── Content ─────────────────────────────────────────────────────────────── */
.ep-crm-content { padding: 28px; max-width: 1400px; width: 100%; }

/* ── Views ───────────────────────────────────────────────────────────────── */
.ep-crm-view { display: none; }
.ep-crm-view--active { display: block; }

/* ── KPI Cards ────────────────────────────────────────────────────────────── */
.ep-crm-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}
.ep-crm-kpi {
    background: #fff;
    border-radius: 16px;
    padding: 22px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
    border: 1px solid #F1F5F9;
    transition: transform .2s, box-shadow .2s;
}
.ep-crm-kpi:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(0,0,0,.1); }
.ep-crm-kpi__icon {
    width: 44px; height: 44px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
}
.ep-crm-kpi__icon--green  { background: rgba(46,175,125,.12); color: #2EAF7D; }
.ep-crm-kpi__icon--blue   { background: rgba(59,130,246,.12); color: #3B82F6; }
.ep-crm-kpi__icon--orange { background: rgba(249,115,22,.12);  color: #F97316; }
.ep-crm-kpi__icon--purple { background: rgba(139,92,246,.12); color: #8B5CF6; }
.ep-crm-kpi__body { flex: 1; }
.ep-crm-kpi__value {
    font-size: 32px; font-weight: 800; color: #0F172A; line-height: 1;
    letter-spacing: -.5px; margin-bottom: 4px;
}
.ep-crm-kpi__value--currency { font-size: 22px; letter-spacing: -.3px; }
.ep-crm-kpi__label { font-size: 13px; color: #64748B; font-weight: 500; }
.ep-crm-kpi__trend { font-size: 12px; font-weight: 600; padding: 4px 0; }
.ep-crm-kpi__trend--up     { color: #2EAF7D; }
.ep-crm-kpi__trend--down   { color: #EF4444; }
.ep-crm-kpi__trend--neutral{ color: #94A3B8; }
.ep-crm-kpi__trend--alert  { color: #F97316; }

/* ── Rows ─────────────────────────────────────────────────────────────────── */
.ep-crm-row {
    display: grid;
    gap: 20px;
    margin-bottom: 24px;
}
.ep-crm-row:has(.ep-crm-card--chart) { grid-template-columns: 1.4fr 1fr; }
.ep-crm-row:has(.ep-crm-card--table) { grid-template-columns: 1.6fr 1fr; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.ep-crm-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #F1F5F9;
    box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
    overflow: hidden;
}
.ep-crm-card__header {
    display: flex; align-items: flex-start; justify-content: space-between;
    padding: 20px 24px 16px;
    gap: 12px;
}
.ep-crm-card__header--sub { padding: 20px 24px 12px; border-top: 1px solid #F1F5F9; }
.ep-crm-card__title { font-size: 15px; font-weight: 700; color: #0F172A; }
.ep-crm-card__sub   { font-size: 12px; color: #94A3B8; margin-top: 2px; }
.ep-crm-card__link  { font-size: 12.5px; color: #2EAF7D; text-decoration: none; font-weight: 600; white-space: nowrap; }
.ep-crm-card__link:hover { color: #1a8a60; }

/* Chart */
.ep-crm-card--chart .ep-crm-chart { padding: 4px 24px 24px; }
.ep-crm-chart svg { width: 100%; height: 180px; }

/* Chart Bar SVG styles */
.ep-chart-bar { fill: #2EAF7D; rx: 4; transition: opacity .2s; }
.ep-chart-bar:hover { opacity: .75; }
.ep-chart-label { font-size: 11px; fill: #94A3B8; font-family: 'Plus Jakarta Sans', sans-serif; }
.ep-chart-value { font-size: 11px; fill: #475569; font-weight: 600; font-family: 'Plus Jakarta Sans', sans-serif; }
.ep-chart-grid  { stroke: #F1F5F9; stroke-width: 1; }

/* Pipeline */
.ep-crm-pipeline-list { padding: 0 24px 20px; display: flex; flex-direction: column; gap: 12px; }
.ep-crm-pipeline-item { display: flex; flex-direction: column; gap: 6px; }
.ep-crm-pipeline-item__head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.ep-crm-pipeline-item__dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.ep-crm-pipeline-item__name { flex: 1; color: #334155; font-weight: 500; }
.ep-crm-pipeline-item__count { color: #64748B; font-size: 12px; }
.ep-crm-pipeline-item__val { color: #0F172A; font-weight: 700; font-size: 12px; margin-left: auto; }
.ep-crm-pipeline-item__bar { height: 6px; background: #F1F5F9; border-radius: 20px; overflow: hidden; }
.ep-crm-pipeline-item__fill { height: 100%; border-radius: 20px; transition: width .6s cubic-bezier(.4,0,.2,1); }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.ep-crm-table { width: 100%; border-collapse: collapse; }
.ep-crm-table th {
    padding: 10px 16px; text-align: left;
    font-size: 11.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
    color: #94A3B8; background: #F8FAFC;
    border-bottom: 1px solid #E2E8F0;
}
.ep-crm-table td { padding: 12px 16px; border-bottom: 1px solid #F1F5F9; font-size: 13.5px; color: #334155; vertical-align: middle; }
.ep-crm-table tbody tr:last-child td { border-bottom: none; }
.ep-crm-table tbody tr:hover td { background: #FAFAFA; }
.ep-crm-table--full .ep-crm-card { border-radius: 0; border: none; box-shadow: none; }

.ep-crm-table__company { display: flex; align-items: center; gap: 10px; }
.ep-crm-table__name    { font-size: 13.5px; font-weight: 600; color: #0F172A; }
.ep-crm-table__sub     { font-size: 11.5px; color: #94A3B8; margin-top: 1px; }
.ep-crm-table__seg     { font-size: 12px; color: #64748B; }
.ep-crm-table__resp    { font-size: 13px; color: #475569; }
.ep-crm-table__mono    { font-family: 'JetBrains Mono', 'Courier New', monospace; font-size: 12.5px; color: #64748B; }
.ep-crm-table__date    { font-size: 12px; color: #94A3B8; white-space: nowrap; }
.ep-crm-table__date--late { color: #EF4444; font-weight: 600; }
.ep-crm-table__actions { display: flex; gap: 4px; justify-content: flex-end; }
.ep-crm-table__action {
    width: 30px; height: 30px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    background: none; border: 1px solid #E2E8F0; color: #64748B;
    cursor: pointer; transition: all .2s;
}
.ep-crm-table__action:hover { background: #F1F5F9; color: #2EAF7D; border-color: #2EAF7D; }
.ep-crm-table__action--danger:hover { background: #FEF2F2; color: #EF4444; border-color: #EF4444; }

.ep-crm-row--done td { opacity: .55; }

/* ── Avatar ──────────────────────────────────────────────────────────────── */
.ep-crm-avatar {
    border-radius: 50%; background: linear-gradient(135deg, #6366F1, #8B5CF6);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; color: #fff; flex-shrink: 0;
}
.ep-crm-avatar--sm { width: 32px; height: 32px; font-size: 11px; }

/* ── Status Badge ─────────────────────────────────────────────────────────── */
.ep-crm-status {
    display: inline-flex; align-items: center;
    padding: 3px 10px; border-radius: 20px;
    font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.ep-crm-status--green  { background: rgba(46,175,125,.1);  color: #2EAF7D; }
.ep-crm-status--blue   { background: rgba(59,130,246,.1);  color: #3B82F6; }
.ep-crm-status--orange { background: rgba(249,115,22,.1);  color: #F97316; }
.ep-crm-status--gray   { background: rgba(100,116,139,.1); color: #64748B; }
.ep-crm-status--red    { background: rgba(239,68,68,.1);   color: #EF4444; }

/* ── Priority dot ────────────────────────────────────────────────────────── */
.ep-crm-priority { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.ep-crm-priority--red    { background: #EF4444; }
.ep-crm-priority--orange { background: #F97316; }
.ep-crm-priority--gray   { background: #CBD5E1; }

/* ── Task List ───────────────────────────────────────────────────────────── */
.ep-crm-task-list { padding: 0 20px 8px; display: flex; flex-direction: column; gap: 4px; }
.ep-crm-task {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 4px; border-radius: 10px;
    transition: background .15s;
}
.ep-crm-task:hover { background: #F8FAFC; }
.ep-crm-task__check {
    width: 22px; height: 22px; border-radius: 50%;
    border: 2px solid #CBD5E1; background: none;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    color: transparent; transition: all .2s; flex-shrink: 0;
}
.ep-crm-task__check:hover { border-color: #2EAF7D; color: #2EAF7D; background: rgba(46,175,125,.08); }
.ep-crm-task__body { flex: 1; min-width: 0; }
.ep-crm-task__title { font-size: 13.5px; font-weight: 500; color: #0F172A; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ep-crm-task__client { font-size: 11.5px; color: #94A3B8; }
.ep-crm-task__meta { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.ep-crm-task__prazo { font-size: 11px; color: #94A3B8; white-space: nowrap; }
.ep-crm-task__prazo--late { color: #EF4444; font-weight: 600; }

/* ── Activity Feed ───────────────────────────────────────────────────────── */
.ep-crm-feed { padding: 0 20px 20px; display: flex; flex-direction: column; gap: 2px; }
.ep-crm-feed-item { display: flex; align-items: flex-start; gap: 10px; padding: 8px 4px; }
.ep-crm-feed-item__icon {
    width: 24px; height: 24px; border-radius: 8px;
    background: #F1F5F9; color: #64748B;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; margin-top: 1px;
}
.ep-crm-feed-item__body { flex: 1; min-width: 0; }
.ep-crm-feed-item__text { font-size: 13px; color: #334155; display: block; line-height: 1.4; }
.ep-crm-feed-item__time { font-size: 11px; color: #94A3B8; margin-top: 2px; display: block; }

/* ── Toolbar ─────────────────────────────────────────────────────────────── */
.ep-crm-toolbar {
    display: flex; gap: 12px; margin-bottom: 20px;
    flex-wrap: wrap;
}
.ep-crm-search {
    flex: 1; min-width: 200px;
    padding: 9px 14px;
    border: 1.5px solid #E2E8F0; border-radius: 10px;
    font-size: 14px; color: #334155; background: #fff;
    outline: none; transition: border-color .2s;
    font-family: inherit;
}
.ep-crm-search:focus { border-color: #2EAF7D; }
.ep-crm-filter-select {
    padding: 9px 12px;
    border: 1.5px solid #E2E8F0; border-radius: 10px;
    font-size: 13.5px; color: #334155; background: #fff;
    outline: none; cursor: pointer; font-family: inherit;
    transition: border-color .2s;
}
.ep-crm-filter-select:focus { border-color: #2EAF7D; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.ep-crm-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px; border-radius: 10px;
    font-size: 13.5px; font-weight: 600;
    cursor: pointer; border: none; text-decoration: none;
    transition: all .2s; white-space: nowrap;
    font-family: inherit;
}
.ep-crm-btn--primary  { background: #2EAF7D; color: #fff; }
.ep-crm-btn--primary:hover { background: #259e6e; }
.ep-crm-btn--ghost    { background: transparent; color: #64748B; border: 1.5px solid #E2E8F0; }
.ep-crm-btn--ghost:hover { background: #F8FAFC; color: #334155; }
.ep-crm-btn--full     { width: 100%; justify-content: center; }
.ep-crm-btn--sm       { padding: 6px 14px; font-size: 12.5px; border-radius: 8px; }

/* ── Empty States ────────────────────────────────────────────────────────── */
.ep-crm-empty {
    display: flex; flex-direction: column; align-items: center;
    padding: 40px 24px; gap: 8px; text-align: center;
}
.ep-crm-empty p { font-size: 13.5px; color: #94A3B8; }
.ep-crm-empty--sm { padding: 20px 24px; }
.ep-crm-empty--lg { padding: 60px 24px; }
.ep-crm-empty--lg h3 { font-size: 16px; font-weight: 700; color: #CBD5E1; }
.ep-crm-empty__link { background: none; border: none; color: #2EAF7D; cursor: pointer; font-size: inherit; font-family: inherit; font-weight: 600; text-decoration: underline; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.ep-crm-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(15,23,42,.6);
    backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999; padding: 20px;
    opacity: 0; visibility: hidden;
    transition: opacity .25s, visibility .25s;
}
.ep-crm-modal-overlay.open { opacity: 1; visibility: visible; }

.ep-crm-modal {
    background: #fff; border-radius: 20px;
    width: 100%; max-width: 640px; max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 32px 80px rgba(0,0,0,.25);
    transform: translateY(20px) scale(.97);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
}
.ep-crm-modal-overlay.open .ep-crm-modal { transform: translateY(0) scale(1); }
.ep-crm-modal--sm { max-width: 480px; }

.ep-crm-modal__header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 22px 28px 0;
}
.ep-crm-modal__header h3 { font-size: 17px; font-weight: 700; color: #0F172A; }
.ep-crm-modal__close {
    width: 32px; height: 32px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    background: #F1F5F9; border: none; color: #64748B;
    cursor: pointer; transition: all .2s;
}
.ep-crm-modal__close:hover { background: #E2E8F0; color: #334155; }

.ep-crm-modal__body { padding: 20px 28px; }
.ep-crm-modal__footer {
    padding: 16px 28px 24px;
    display: flex; justify-content: flex-end; gap: 10px;
    border-top: 1px solid #F1F5F9;
}

/* ── Form Grid ───────────────────────────────────────────────────────────── */
.ep-crm-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.ep-crm-form-field--full { grid-column: 1 / -1; }
.ep-crm-form-field label {
    display: block; font-size: 12px; font-weight: 600; color: #64748B;
    text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px;
}
.ep-crm-form-field input,
.ep-crm-form-field select,
.ep-crm-form-field textarea {
    width: 100%; padding: 9px 12px;
    border: 1.5px solid #E2E8F0; border-radius: 10px;
    font-size: 14px; color: #334155;
    background: #fff; outline: none; font-family: inherit;
    transition: border-color .2s;
}
.ep-crm-form-field input:focus,
.ep-crm-form-field select:focus,
.ep-crm-form-field textarea:focus { border-color: #2EAF7D; }
.ep-crm-form-field textarea { resize: vertical; min-height: 72px; }

/* ── Toast notifications ─────────────────────────────────────────────────── */
.ep-crm-toast-wrap {
    position: fixed; bottom: 24px; right: 24px;
    z-index: 99999; display: flex; flex-direction: column; gap: 10px;
    pointer-events: none;
}
.ep-crm-toast {
    background: #0F172A; color: #F1F5F9;
    padding: 12px 18px; border-radius: 12px;
    font-size: 13.5px; font-weight: 500;
    box-shadow: 0 8px 32px rgba(0,0,0,.25);
    display: flex; align-items: center; gap: 10px;
    animation: ep-crm-slideup .3s cubic-bezier(.4,0,.2,1);
    pointer-events: all;
    max-width: 320px;
}
.ep-crm-toast--success { border-left: 3px solid #2EAF7D; }
.ep-crm-toast--error   { border-left: 3px solid #EF4444; }
@keyframes ep-crm-slideup { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ── Loading spinner ─────────────────────────────────────────────────────── */
.ep-crm-spinner {
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ep-crm-spin .7s linear infinite;
}
@keyframes ep-crm-spin { to { transform: rotate(360deg); } }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
    .ep-crm-kpis { grid-template-columns: repeat(2, 1fr); }
    .ep-crm-row:has(.ep-crm-card--chart),
    .ep-crm-row:has(.ep-crm-card--table) { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .ep-crm-sidebar {
        position: fixed; left: 0; top: 0; bottom: 0;
        transform: translateX(-100%);
    }
    .ep-crm-sidebar.open { transform: translateX(0); }
    .ep-crm-sidebar-toggle { display: flex; }
    .ep-crm-content { padding: 20px 16px; }
    .ep-crm-topbar { padding: 0 16px; }
}
@media (max-width: 600px) {
    .ep-crm-kpis { grid-template-columns: 1fr 1fr; gap: 12px; }
    .ep-crm-form-grid { grid-template-columns: 1fr; }
    .ep-crm-form-field--full { grid-column: 1; }
    .ep-crm-topbar__right .ep-crm-date { display: none; }
    .ep-crm-table th:nth-child(n+3),
    .ep-crm-table td:nth-child(n+3) { display: none; }
}
@media (max-width: 400px) {
    .ep-crm-kpis { grid-template-columns: 1fr; }
}

/* ── Override WP Theme chrome when CRM is active ──────────────────────────── */
body.has-ecoplus-crm .ep-crm { min-height: 100vh; }

/* ── Clickable table name ────────────────────────────────────────────────── */
.ep-crm-table__namelink {
    background: none; border: none; padding: 0; cursor: pointer;
    font-size: 13.5px; font-weight: 600; color: #0F172A;
    text-align: left; font-family: inherit;
    transition: color .2s;
}
.ep-crm-table__namelink:hover { color: #2EAF7D; text-decoration: underline; }

/* ── Back button ─────────────────────────────────────────────────────────── */
.ep-crm-back-btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: none; border: none; color: #64748B;
    font-size: 13px; font-weight: 600; cursor: pointer;
    padding: 0; margin-bottom: 20px;
    font-family: inherit; transition: color .2s;
}
.ep-crm-back-btn:hover { color: #2EAF7D; }

/* ── Detail Header ───────────────────────────────────────────────────────── */
.ep-crm-detail__header {
    background: #fff; border: 1px solid #F1F5F9; border-radius: 16px;
    padding: 24px 28px; margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.ep-crm-detail__titlerow {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.ep-crm-avatar--lg {
    width: 56px; height: 56px; font-size: 20px; border-radius: 16px;
    background: linear-gradient(135deg, #2EAF7D, #1a8a60);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; color: #fff; flex-shrink: 0;
}
.ep-crm-detail__headinfo { flex: 1; min-width: 0; }
.ep-crm-detail__name { font-size: 22px; font-weight: 800; color: #0F172A; margin-bottom: 6px; }
.ep-crm-detail__meta {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    font-size: 13px; color: #64748B;
}
.ep-crm-detail__headactions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }

/* ── Detail Body ─────────────────────────────────────────────────────────── */
.ep-crm-detail__body {
    display: grid; grid-template-columns: 300px 1fr;
    gap: 20px; align-items: start;
}
.ep-crm-detail__sidebar { display: flex; flex-direction: column; gap: 16px; }
.ep-crm-detail__main {}

/* Info grid */
.ep-crm-info-grid { padding: 4px 24px 16px; }
.ep-crm-info-row {
    display: flex; justify-content: space-between; align-items: flex-start;
    padding: 10px 0; border-bottom: 1px solid #F8FAFC; gap: 16px;
}
.ep-crm-info-row:last-child { border-bottom: none; }
.ep-crm-info-row__label {
    font-size: 11.5px; font-weight: 700; color: #94A3B8;
    text-transform: uppercase; letter-spacing: .4px; flex-shrink: 0;
}
.ep-crm-info-row__val { font-size: 13.5px; color: #334155; font-weight: 500; text-align: right; word-break: break-all; }

.ep-crm-detail-obs { padding: 12px 24px 20px; border-top: 1px solid #F1F5F9; }
.ep-crm-detail-obs strong {
    font-size: 11.5px; font-weight: 700; color: #94A3B8;
    text-transform: uppercase; letter-spacing: .5px; display: block; margin-bottom: 6px;
}
.ep-crm-detail-obs p { font-size: 13.5px; color: #475569; line-height: 1.6; }

/* ── Timeline ────────────────────────────────────────────────────────────── */
.ep-crm-timeline { padding: 8px 24px 24px; }

.ep-crm-tl-item {
    display: grid; grid-template-columns: 2px 32px 1fr;
    gap: 0 14px; padding-bottom: 24px; position: relative;
}
.ep-crm-tl-item--last { padding-bottom: 0; }

.ep-crm-tl-connector {
    grid-column: 1; grid-row: 1 / 3;
    width: 2px; background: #E2E8F0;
    margin: 36px auto 0;
}
.ep-crm-tl-connector--hidden { background: transparent; }

.ep-crm-tl-dot {
    grid-column: 2; grid-row: 1;
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; margin-top: 2px; color: #fff;
    box-shadow: 0 0 0 3px #fff, 0 0 0 5px rgba(0,0,0,.07);
    z-index: 1;
}

.ep-crm-tl-body { grid-column: 3; grid-row: 1; min-width: 0; padding-bottom: 4px; }
.ep-crm-tl-header {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px;
}
.ep-crm-tl-tipo  { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.ep-crm-tl-date  { font-size: 11.5px; color: #94A3B8; margin-left: auto; white-space: nowrap; }
.ep-crm-tl-user  { font-size: 11px; color: #CBD5E1; }
.ep-crm-tl-title { font-size: 14px; font-weight: 600; color: #0F172A; margin-bottom: 4px; }
.ep-crm-tl-desc  {
    font-size: 13px; color: #64748B; line-height: 1.5;
    background: #F8FAFC; padding: 10px 14px; border-radius: 8px; margin-top: 6px;
}

/* ── Responsive (detail) ─────────────────────────────────────────────────── */
@media (max-width: 1000px) {
    .ep-crm-detail__body { grid-template-columns: 1fr; }
    .ep-crm-detail__headactions { margin-left: 0; width: 100%; }
}

/* ════════════════════════════════════════════════════════════════════════════
   PEDIDOS
   ════════════════════════════════════════════════════════════════════════════ */

/* Linha badge */
.ep-crm-linha-badge {
    display: inline-flex; align-items: center;
    padding: 3px 9px; border-radius: 5px;
    font-size: 11.5px; font-weight: 700; white-space: nowrap;
    background: #EFF6FF; color: #1D4ED8;
}

/* ════════════════════════════════════════════════════════════════════════════
   AGENDA / ALERTAS
   ════════════════════════════════════════════════════════════════════════════ */

.ep-crm-agenda-section { margin-bottom: 28px; }

.ep-crm-agenda-section__header {
    display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
}
.ep-crm-agenda-section__header h3 {
    font-size: 15px; font-weight: 700; color: #1E293B; margin: 0;
}
.ep-crm-agenda-section__icon {
    width: 30px; height: 30px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ep-crm-agenda-section__icon--alert  { background: #FEF3C7; color: #D97706; }
.ep-crm-agenda-section__icon--blue   { background: #EFF6FF; color: #2563EB; }
.ep-crm-agenda-section__icon--orange { background: #FFF7ED; color: #EA580C; }

/* Badge count */
.ep-crm-badge-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
    font-size: 11px; font-weight: 700;
}
.ep-crm-badge-count--red    { background: #FEE2E2; color: #DC2626; }
.ep-crm-badge-count--orange { background: #FFF7ED; color: #EA580C; }

/* Button xs */
.ep-crm-btn--xs { padding: 4px 10px; font-size: 11.5px; border-radius: 5px; }

/* Alert grid */
.ep-crm-alert-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px;
}
.ep-crm-alert-card {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px; background: #fff; border-radius: 10px;
    border: 1px solid #E2E8F0; border-left-width: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04); transition: box-shadow .2s;
}
.ep-crm-alert-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.ep-crm-alert-card--high   { border-left-color: #EF4444; }
.ep-crm-alert-card--medium { border-left-color: #F59E0B; }
.ep-crm-alert-card--low    { border-left-color: #6366F1; }

.ep-crm-alert-card__avatar {
    width: 38px; height: 38px; border-radius: 9px; flex-shrink: 0;
    background: #F1F5F9; display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 800; color: #475569;
}
.ep-crm-alert-card__body { flex: 1; min-width: 0; }
.ep-crm-alert-card__meta {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 3px;
    font-size: 12px; color: #64748B;
}

.ep-crm-alert-card__days { text-align: center; flex-shrink: 0; min-width: 44px; }
.ep-crm-alert-days {
    display: block; font-size: 24px; font-weight: 800; line-height: 1;
    color: #EF4444;
}
.ep-crm-alert-card--medium .ep-crm-alert-days { color: #F59E0B; }
.ep-crm-alert-card--low    .ep-crm-alert-days { color: #6366F1; }
.ep-crm-alert-days__label {
    font-size: 10px; color: #94A3B8; text-transform: uppercase; letter-spacing: .5px;
}
.ep-crm-alert-card__actions { display: flex; flex-direction: column; gap: 5px; flex-shrink: 0; }

/* Visit list */
.ep-crm-visit-list { display: flex; flex-direction: column; gap: 8px; }
.ep-crm-visit-item {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 16px; background: #fff; border-radius: 10px;
    border: 1px solid #E2E8F0; transition: border-color .2s;
}
.ep-crm-visit-item:hover { border-color: #94A3B8; }
.ep-crm-visit-item--late { border-left: 3px solid #EF4444; }
.ep-crm-visit-item__date { text-align: center; min-width: 44px; flex-shrink: 0; }
.ep-crm-visit-item__day   { display: block; font-size: 26px; font-weight: 800; line-height: 1; color: #1E293B; }
.ep-crm-visit-item__month { display: block; font-size: 11px; color: #94A3B8; text-transform: uppercase; letter-spacing: .5px; }
.ep-crm-visit-item__divider { width: 1px; height: 36px; background: #E2E8F0; flex-shrink: 0; }
.ep-crm-visit-item__body  { flex: 1; min-width: 0; }
.ep-crm-visit-item__title { font-size: 14px; font-weight: 600; color: #0F172A; }
.ep-crm-visit-item__meta  {
    display: flex; gap: 12px; flex-wrap: wrap; margin-top: 3px;
    font-size: 12px; color: #64748B;
}

/* Pedidos detalhe inside client detail */
.ep-crm-ped-linhas { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 20px 4px; }
.ep-crm-ped-mini {
    display: flex; flex-direction: column; gap: 6px; padding: 4px 20px 16px;
}
.ep-crm-ped-row {
    display: flex; align-items: center; gap: 10px; padding: 9px 12px;
    background: #F8FAFC; border-radius: 8px; font-size: 13px;
}
.ep-crm-ped-row__num  { font-weight: 700; color: #1E293B; min-width: 70px; }
.ep-crm-ped-row__date { color: #64748B; font-size: 12px; }

/* ═══ KANBAN PIPELINE ════════════════════════════════════════════════════ */
.ep-crm-content--kanban { overflow-x: auto; padding-bottom: 0; }
.ep-crm-kanban {
    display: flex;
    gap: 14px;
    padding-bottom: 28px;
    align-items: flex-start;
    min-width: max-content;
}
.ep-crm-kanban__col {
    width: 240px;
    min-width: 240px;
    background: #F8FAFC;
    border-radius: 14px;
    border: 1.5px solid #E2E8F0;
    overflow: hidden;
    flex-shrink: 0;
}
.ep-crm-kanban__col-head {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 14px 11px;
    background: #fff;
    border-bottom: 1.5px solid #E2E8F0;
    flex-wrap: wrap;
}
.ep-crm-kanban__col-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.ep-crm-kanban__col-name { font-size: 12.5px; font-weight: 700; color: #0F172A; flex: 1; white-space: nowrap; }
.ep-crm-kanban__col-count {
    background: #E2E8F0; color: #64748B;
    font-size: 11px; font-weight: 700;
    border-radius: 20px; padding: 1px 8px;
}
.ep-crm-kanban__col-val { font-size: 10.5px; color: #94A3B8; font-weight: 600; white-space: nowrap; width: 100%; padding-top: 2px; }
.ep-crm-kanban__col-body {
    padding: 10px;
    display: flex; flex-direction: column;
    gap: 8px;
    min-height: 160px;
}
.ep-crm-kan-card {
    background: #fff;
    border-radius: 10px;
    border: 1.5px solid #E2E8F0;
    padding: 11px 12px 10px;
    position: relative;
    transition: box-shadow .2s, border-color .2s;
}
.ep-crm-kan-card:hover {
    box-shadow: 0 4px 16px rgba(15,23,42,.09);
    border-color: #CBD5E1;
}
.ep-crm-kan-card__actions {
    position: absolute; top: 7px; right: 7px;
    display: none;
    gap: 3px;
    background: rgba(255,255,255,.96);
    border-radius: 8px; padding: 2px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    z-index: 2;
}
.ep-crm-kan-card:hover .ep-crm-kan-card__actions { display: flex; }
.ep-crm-kan-btn {
    width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 6px; border: none; background: none;
    color: #64748B; cursor: pointer;
    font-size: 16px; line-height: 1; font-weight: 700;
    transition: background .15s, color .15s;
}
.ep-crm-kan-btn:hover { background: #F1F5F9; color: #0F172A; }
.ep-crm-kan-btn--danger:hover { background: #FEE2E2; color: #EF4444; }
.ep-crm-kan-btn--move { font-size: 18px; }
.ep-crm-kan-card__title {
    font-size: 13px; font-weight: 600; color: #0F172A;
    line-height: 1.4; margin-bottom: 4px;
    padding-right: 30px;
}
.ep-crm-kan-card__client {
    font-size: 11.5px; color: #64748B; margin-bottom: 8px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ep-crm-kan-card__footer { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ep-crm-kan-card__val { font-size: 12px; font-weight: 700; color: #0F172A; }
.ep-crm-kan-card__prob {
    font-size: 11px; font-weight: 600;
    background: #EFF6FF; color: #3B82F6;
    border-radius: 20px; padding: 1px 7px;
}
.ep-crm-kan-card__date { font-size: 11px; color: #94A3B8; margin-left: auto; white-space: nowrap; }
.ep-crm-kan-add {
    width: 100%; padding: 8px;
    border-radius: 8px; border: 1.5px dashed #CBD5E1;
    background: none; font-size: 12px; color: #94A3B8;
    cursor: pointer; text-align: center; font-family: inherit;
    transition: border-color .2s, color .2s; margin-top: 2px;
}
.ep-crm-kan-add:hover { border-color: #2EAF7D; color: #2EAF7D; }
.ep-opp-prob-wrap { display: flex; align-items: center; gap: 10px; }
.ep-opp-prob-wrap input[type="range"] {
    flex: 1; height: 4px; cursor: pointer;
    accent-color: #2EAF7D; border: none; background: none; padding: 0;
}
.ep-crm-ped-row__linha { flex: 1; }
.ep-crm-ped-row__val  { font-weight: 600; color: #0F172A; margin-left: auto; white-space: nowrap; }

@media (max-width: 640px) {
    .ep-crm-alert-grid { grid-template-columns: 1fr; }
    .ep-crm-alert-card { flex-wrap: wrap; }
}

/* ═══ RELATÓRIOS ════════════════════════════════════════════════════════════ */
.ep-crm-kpi__icon--purple { background: #EDE9FE; color: #7C3AED; }
.ep-crm-kpi__icon--blue   { background: #DBEAFE; color: #2563EB; }

.ep-crm-chart--tall { min-height: 220px; padding: 0 8px 8px; }

.ep-crm-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 768px) { .ep-crm-two-col { grid-template-columns: 1fr; } }

/* Progress bars */
.ep-rel-progress {
    height: 7px;
    background: #F1F5F9;
    border-radius: 4px;
    overflow: hidden;
    margin: 4px 0 2px;
}
.ep-rel-progress__bar {
    height: 100%;
    background: #2EAF7D;
    border-radius: 4px;
    transition: width .6s ease;
}
.ep-rel-progress__bar--blue { background: #3B82F6; }

/* Linha row */
.ep-rel-linha-row { padding: 8px 0; border-bottom: 1px solid #F1F5F9; }
.ep-rel-linha-row:last-child { border-bottom: none; }
.ep-rel-linha-row__top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; }
.ep-rel-linha-row__name { font-size: 13px; font-weight: 600; color: #1E293B; }
.ep-rel-linha-row__val  { font-size: 13px; color: #64748B; }
.ep-rel-linha-row__sub  { font-size: 11px; color: #94A3B8; }

/* Status row */
.ep-rel-status-row { padding: 7px 0; border-bottom: 1px solid #F1F5F9; }
.ep-rel-status-row:last-child { border-bottom: none; }
.ep-rel-status-row__top { display: flex; align-items: center; gap: 7px; margin-bottom: 3px; }
.ep-rel-status-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.ep-rel-status-row__name { font-size: 13px; font-weight: 600; color: #1E293B; flex: 1; }
.ep-rel-status-row__val  { font-size: 12px; color: #64748B; }

/* Top clientes rank badge */
.ep-rel-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: #F1F5F9;
    font-size: 11px;
    font-weight: 700;
    color: #64748B;
}
tr:nth-child(1) .ep-rel-rank { background: #FEF3C7; color: #92400E; }
tr:nth-child(2) .ep-rel-rank { background: #E2E8F0; color: #334155; }
tr:nth-child(3) .ep-rel-rank { background: #FFEDD5; color: #9A3412; }

.ep-rel-value { color: #2EAF7D; }
