/* ============================================================
   CRM APP - Cuality X — Light Theme
   Customer Relationship Management
   ============================================================ */

/* ---- Shell ---- */
.crm-shell{display:flex;flex-direction:column;height:100%;background:#ebebeb;overflow:hidden}

/* ---- Header (red gradient) ---- */
.crm-header{
    background:linear-gradient(135deg,#EF4444,#DC2626);
    padding:0 24px;flex-shrink:0;
}
.crm-header-inner{
    max-width:1180px;margin:0 auto;
    display:flex;align-items:center;gap:14px;height:48px;
}
.crm-header-brand{
    display:flex;align-items:center;gap:8px;flex-shrink:0;
}
.crm-header-brand svg{color:#fff}
.crm-header-brand span{font-size:17px;font-weight:700;color:#fff}
.crm-header-brand small{font-size:10px;color:rgba(255,255,255,.6)}
.crm-header-search-wrap{flex:1;max-width:340px;margin:0 auto}
.crm-header-search{
    width:100%;padding:7px 12px 7px 32px;border-radius:8px;border:none;
    background:rgba(255,255,255,.18);color:#fff;font-size:12.5px;outline:none;
    transition:background .15s;
}
.crm-header-search::placeholder{color:rgba(255,255,255,.55)}
.crm-header-search:focus{background:rgba(255,255,255,.28)}
.crm-header-search-icon{
    position:absolute;left:9px;top:50%;transform:translateY(-50%);
    color:rgba(255,255,255,.55);pointer-events:none;
}
.crm-header-actions{display:flex;align-items:center;gap:8px;flex-shrink:0}
.crm-header-btn{
    padding:6px 14px;border-radius:8px;border:1px solid rgba(255,255,255,.25);
    background:rgba(255,255,255,.12);color:#fff;font-size:12px;font-weight:600;
    cursor:pointer;transition:all .15s;display:flex;align-items:center;gap:5px;
}
.crm-header-btn:hover{background:rgba(255,255,255,.22)}
.crm-header-icon-btn{
    width:32px;height:32px;border-radius:8px;border:none;
    background:rgba(255,255,255,.12);color:#fff;cursor:pointer;
    display:flex;align-items:center;justify-content:center;position:relative;
    transition:all .15s;padding:0;
}
.crm-header-icon-btn:hover{background:rgba(255,255,255,.22)}
.crm-header-badge{
    position:absolute;top:-4px;right:-4px;
    min-width:16px;height:16px;border-radius:8px;
    background:#fff;color:#EF4444;font-size:9px;font-weight:700;
    display:flex;align-items:center;justify-content:center;padding:0 4px;
}
.crm-header-badge:empty{display:none}

/* ---- Nav Bar ---- */
.crm-nav-bar{
    background:#fff;border-bottom:1px solid #ddd;flex-shrink:0;
    padding:0 24px;overflow-x:auto;
}
.crm-nav{
    max-width:1180px;margin:0 auto;
    display:flex;align-items:stretch;gap:0;height:40px;
}
.crm-nav-tab{
    padding:0 16px;display:flex;align-items:center;gap:5px;
    font-size:12.5px;font-weight:500;color:#666;
    border:none;background:none;cursor:pointer;
    border-bottom:2px solid transparent;transition:all .15s;white-space:nowrap;
}
.crm-nav-tab:hover{color:#333}
.crm-nav-tab.crm-nav-tab-active{color:#EF4444;border-bottom-color:#EF4444;font-weight:600}
.crm-nav-tab svg{width:14px;height:14px}

/* ---- Body ---- */
.crm-body{flex:1;overflow:hidden;display:flex;flex-direction:column}
.crm-body-inner{
    max-width:1180px;width:100%;margin:0 auto;
    flex:1;overflow:hidden;display:flex;flex-direction:column;
}
#crm-content{flex:1;overflow-y:auto;overflow-x:hidden}

/* ---- View Header (inside each view) ---- */
.crm-view-header{
    display:flex;align-items:center;justify-content:space-between;
    padding:18px 0 14px;flex-wrap:wrap;gap:8px;
}
.crm-view-title{font-size:18px;font-weight:700;color:#333}
.crm-view-actions{display:flex;gap:8px;align-items:center}

/* ---- Content Wrap ---- */
.crm-content-wrap{padding:0 24px 24px}

/* ---- Icon Button ---- */
.crm-icon-btn{
    width:28px;height:28px;border-radius:7px;border:1px solid #ddd;
    background:#fff;color:#999;cursor:pointer;
    display:flex;align-items:center;justify-content:center;transition:all .15s;padding:0;
}
.crm-icon-btn:hover{background:#fef2f2;color:#EF4444;border-color:#fca5a5}

/* ---- Modals ---- */
.crm-modal{
    position:absolute;top:0;left:0;width:100%;height:100%;
    background:rgba(0,0,0,.45);backdrop-filter:blur(6px);
    z-index:100;display:flex;align-items:center;justify-content:center;
}
.crm-modal-box{
    background:#fff;border:1px solid #ddd;border-radius:16px;
    width:92%;box-shadow:0 25px 60px rgba(0,0,0,.18);overflow:hidden;
}
.crm-modal-header{
    display:flex;align-items:center;justify-content:space-between;
    padding:15px 20px;border-bottom:1px solid #eee;
    font-size:15px;font-weight:600;color:#333;
}
.crm-modal-body{padding:20px}
.crm-modal-footer{
    display:flex;justify-content:flex-end;gap:8px;
    padding:14px 20px;border-top:1px solid #eee;background:#fafafa;
}
.crm-modal-close{
    width:28px;height:28px;border-radius:8px;border:none;
    background:#f5f5f5;color:#999;
    font-size:18px;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .15s;
}
.crm-modal-close:hover{background:#fef2f2;color:#ef4444}

/* ---- Buttons ---- */
.crm-btn-primary{
    padding:9px 20px;border-radius:10px;border:none;
    background:linear-gradient(135deg,#EF4444,#DC2626);color:#fff;
    font-weight:600;font-size:13px;cursor:pointer;transition:all .15s;
}
.crm-btn-primary:hover{box-shadow:0 4px 15px rgba(239,68,68,.3);transform:translateY(-1px)}
.crm-btn-primary:disabled{opacity:.4;cursor:default;transform:none;box-shadow:none}

.crm-btn-secondary{
    padding:9px 20px;border-radius:10px;
    border:1px solid #ddd;background:#fff;
    color:#666;font-weight:500;font-size:13px;cursor:pointer;transition:all .15s;
}
.crm-btn-secondary:hover{background:#f5f5f5;color:#333}

.crm-btn-danger{
    padding:9px 20px;border-radius:10px;border:none;
    background:#fef2f2;color:#ef4444;
    font-weight:600;font-size:13px;cursor:pointer;transition:all .15s;
}
.crm-btn-danger:hover{background:#fee2e2}

.crm-btn-sm{padding:5px 12px;font-size:11px;border-radius:7px}
.crm-btn-ghost{
    padding:5px 10px;border-radius:7px;border:none;
    background:transparent;color:#999;
    font-size:11px;cursor:pointer;transition:all .15s;
}
.crm-btn-ghost:hover{background:#f5f5f5;color:#333}
.crm-deals-filter-active{background:#fef2f2 !important;color:#EF4444 !important;font-weight:600}

.crm-btn-gold{
    padding:9px 20px;border-radius:10px;border:none;
    background:linear-gradient(135deg,#fcd681,#f5c542);color:#000;
    font-weight:600;font-size:13px;cursor:pointer;transition:all .15s;
}
.crm-btn-gold:hover{box-shadow:0 4px 15px rgba(252,214,129,.3);transform:translateY(-1px)}

/* ---- Form ---- */
.crm-label{display:block;font-size:11px;font-weight:600;color:#999;margin-bottom:5px;text-transform:uppercase;letter-spacing:.5px}
.crm-input{
    width:100%;padding:9px 12px;border-radius:9px;
    border:1px solid #ddd;background:#fff;
    color:#333;font-size:13px;outline:none;transition:border-color .15s;box-sizing:border-box;
}
.crm-input:focus{border-color:#EF4444}
.crm-input::placeholder{color:#bbb}
.crm-textarea{
    width:100%;padding:9px 12px;border-radius:9px;
    border:1px solid #ddd;background:#fff;
    color:#333;font-size:13px;outline:none;resize:vertical;min-height:55px;
    font-family:inherit;transition:border-color .15s;box-sizing:border-box;
}
.crm-textarea:focus{border-color:#EF4444}
.crm-select{
    width:100%;padding:9px 12px;border-radius:9px;
    border:1px solid #ddd;background:#fff;
    color:#333;font-size:13px;outline:none;box-sizing:border-box;
}

/* ---- Dashboard Cards ---- */
.crm-dash-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:14px;margin-bottom:22px}
.crm-dash-card{
    padding:18px;border-radius:14px;border:1px solid #e8e8e8;
    background:#fff;transition:box-shadow .2s,border-color .2s;
}
.crm-dash-card:hover{box-shadow:0 4px 16px rgba(0,0,0,.06);border-color:#ddd}
.crm-dash-card-icon{margin-bottom:8px;opacity:.85}
.crm-dash-card-label{font-size:10px;color:#999;text-transform:uppercase;letter-spacing:.5px;margin-bottom:6px}
.crm-dash-card-value{font-size:26px;font-weight:700;color:#333;font-variant-numeric:tabular-nums}
.crm-dash-card-sub{font-size:10px;color:#999;margin-top:3px}

/* ---- Pipeline Kanban ---- */
.crm-pipeline{display:flex;gap:10px;padding:16px;overflow-x:auto;height:100%;align-items:flex-start}
.crm-pipeline-col{
    min-width:220px;max-width:260px;flex:1;display:flex;flex-direction:column;
    background:#fff;border:1px solid #eee;
    border-radius:14px;overflow:hidden;max-height:100%;
}
.crm-pipeline-col-header{
    padding:12px 14px;border-bottom:1px solid #eee;
    display:flex;align-items:center;justify-content:space-between;flex-shrink:0;
}
.crm-pipeline-col-name{font-size:12px;font-weight:600;color:#333}
.crm-pipeline-col-count{
    font-size:10px;color:#999;
    background:#f5f5f5;padding:2px 7px;border-radius:10px;
}
.crm-pipeline-col-value{font-size:10px;color:#999;margin-top:1px}
.crm-pipeline-cards{flex:1;overflow-y:auto;padding:8px;display:flex;flex-direction:column;gap:6px}

/* ---- Deal Card ---- */
.crm-deal-card{
    padding:12px;border-radius:10px;border:1px solid #eee;
    background:#fff;cursor:pointer;transition:all .15s;
}
.crm-deal-card:hover{background:#fafafa;border-color:#ddd;box-shadow:0 2px 8px rgba(0,0,0,.06)}
.crm-deal-card-title{font-size:13px;font-weight:600;color:#333;margin-bottom:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.crm-deal-card-company{font-size:11px;color:#999;margin-bottom:6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.crm-deal-card-bottom{display:flex;align-items:center;justify-content:space-between}
.crm-deal-card-value{font-size:13px;font-weight:700;color:#22c55e;font-variant-numeric:tabular-nums}
.crm-deal-card-date{font-size:10px;color:#999}

/* ---- Stage Badge ---- */
.crm-stage-badge{
    display:inline-block;padding:2px 8px;border-radius:10px;
    font-size:9px;font-weight:600;text-transform:uppercase;letter-spacing:.3px;
}

/* ---- Deal List Row ---- */
.crm-deal-row{
    display:grid;grid-template-columns:1fr 130px 100px 90px 80px 36px;align-items:center;gap:8px;
    padding:11px 14px;border-radius:10px;border:1px solid #eee;
    background:#fff;cursor:pointer;transition:all .12s;margin-bottom:4px;
}
.crm-deal-row:hover{background:#fafafa;border-color:#ddd}
.crm-deal-row-title{font-size:13px;font-weight:600;color:#333;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.crm-deal-row-sub{font-size:10px;color:#999;margin-top:1px}

/* ---- Contact Row ---- */
.crm-contact-row{
    display:flex;align-items:center;gap:12px;
    padding:10px 14px;border-radius:10px;border:1px solid #eee;
    background:#fff;cursor:pointer;transition:all .12s;margin-bottom:4px;
}
.crm-contact-row:hover{background:#fafafa}
.crm-contact-avatar{
    width:36px;height:36px;border-radius:50%;
    background:#fef2f2;color:#EF4444;
    display:flex;align-items:center;justify-content:center;
    font-size:14px;font-weight:700;flex-shrink:0;
}
.crm-contact-info{flex:1;min-width:0}
.crm-contact-name{font-size:13px;font-weight:600;color:#333;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.crm-contact-meta{font-size:11px;color:#999;margin-top:1px}

/* ---- Activity Timeline ---- */
.crm-timeline{position:relative;padding-left:24px}
.crm-timeline::before{
    content:'';position:absolute;left:8px;top:0;bottom:0;width:1px;
    background:#eee;
}
.crm-timeline-item{position:relative;padding:10px 0 10px 16px;margin-bottom:2px}
.crm-timeline-dot{
    position:absolute;left:-20px;top:14px;width:10px;height:10px;
    border-radius:50%;border:2px solid #fff;
}
.crm-timeline-dot-call{background:#3b82f6}
.crm-timeline-dot-email{background:#8b5cf6}
.crm-timeline-dot-meeting{background:#f59e0b}
.crm-timeline-dot-task{background:#22c55e}
.crm-timeline-dot-note{background:#6b7280}
.crm-timeline-content{
    padding:10px 14px;border-radius:10px;border:1px solid #eee;
    background:#fff;
}
.crm-timeline-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:4px}
.crm-timeline-title{font-size:12px;font-weight:600;color:#333}
.crm-timeline-time{font-size:10px;color:#999}
.crm-timeline-body{font-size:12px;color:#666;line-height:1.4}
.crm-timeline-contact{font-size:10px;color:#999;margin-top:4px}

/* ---- Task Row ---- */
.crm-task-row{
    display:flex;align-items:center;gap:10px;
    padding:10px 14px;border-radius:10px;border:1px solid #eee;
    background:#fff;margin-bottom:4px;transition:all .12s;
}
.crm-task-check{
    width:20px;height:20px;border-radius:6px;border:2px solid #ddd;
    background:transparent;cursor:pointer;flex-shrink:0;display:flex;align-items:center;
    justify-content:center;transition:all .15s;padding:0;
}
.crm-task-check:hover{border-color:rgba(34,197,94,.5)}
.crm-task-check.crm-checked{background:#22c55e;border-color:#22c55e}
.crm-task-check.crm-checked::after{content:'\2713';color:#fff;font-size:11px;font-weight:700}
.crm-task-text{flex:1;font-size:13px;color:#333}
.crm-task-text.crm-task-done{text-decoration:line-through;color:#bbb}
.crm-task-deal{font-size:10px;color:#999;white-space:nowrap}
.crm-task-due{font-size:10px;white-space:nowrap}
.crm-task-due.crm-overdue{color:#ef4444}
.crm-task-due.crm-upcoming{color:#999}

/* ---- Lead Score ---- */
.crm-lead-score{
    width:40px;height:40px;border-radius:50%;display:flex;align-items:center;justify-content:center;
    font-size:14px;font-weight:700;flex-shrink:0;
}
.crm-lead-hot{background:rgba(239,68,68,.12);color:#ef4444}
.crm-lead-warm{background:rgba(245,158,11,.12);color:#f59e0b}
.crm-lead-cold{background:rgba(107,114,128,.12);color:#9ca3af}

/* ---- Tip Box ---- */
.crm-tip-box{
    display:flex;align-items:flex-start;gap:10px;padding:12px;
    border-radius:10px;background:#fef2f2;
    border:1px solid #fecaca;
}
.crm-tip-box svg{flex-shrink:0;margin-top:1px}
.crm-tip-box span{font-size:12px;color:#666;line-height:1.45}

/* ---- Progress ---- */
.crm-progress{height:5px;border-radius:3px;background:#eee;overflow:hidden}
.crm-progress-fill{height:100%;border-radius:3px;transition:width .3s}
.crm-progress-red{background:linear-gradient(90deg,#ef4444,#dc2626)}
.crm-progress-green{background:linear-gradient(90deg,#22c55e,#16a34a)}
.crm-progress-gold{background:linear-gradient(90deg,#fcd681,#f5c542)}
.crm-progress-blue{background:linear-gradient(90deg,#3b82f6,#2563eb)}

/* ---- Section ---- */
.crm-section-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}
.crm-section-title{font-size:17px;font-weight:700;color:#333}
.crm-section-sub{font-size:11px;color:#999;margin-top:2px}

/* ---- Empty State ---- */
.crm-empty{
    display:flex;flex-direction:column;align-items:center;justify-content:center;
    padding:50px 30px;text-align:center;
}
.crm-empty svg{margin-bottom:14px;opacity:.25;color:#999}
.crm-empty-title{font-size:14px;font-weight:600;color:#999;margin-bottom:5px}
.crm-empty-sub{font-size:11px;color:#bbb;max-width:280px;line-height:1.5}

/* ---- Guide ---- */
.crm-guide-section{margin-bottom:26px}
.crm-guide-section h3{font-size:15px;font-weight:700;color:#333;margin:0 0 8px}
.crm-guide-section p{font-size:13px;color:#666;line-height:1.6;margin:0 0 6px}
.crm-guide-highlight{
    padding:12px 16px;border-radius:10px;
    background:#fef2f2;border-left:3px solid #ef4444;
    font-size:13px;color:#555;line-height:1.5;margin:8px 0;
}
.crm-guide-stat{
    display:inline-flex;align-items:center;gap:4px;padding:3px 8px;border-radius:7px;
    background:rgba(59,130,246,.08);color:#3b82f6;font-size:11px;font-weight:600;margin:1px 3px;
}

/* ---- Funnel (real trapezoid shape) ---- */
.crm-funnel{
    display:flex;flex-direction:column;align-items:center;
    gap:3px;padding:16px 0;margin-bottom:22px;
}
.crm-funnel-stage{
    position:relative;height:42px;
    display:flex;align-items:center;justify-content:center;
    color:#fff;font-size:12px;font-weight:600;
    border-radius:0;cursor:default;
    transition:all .3s;text-shadow:0 1px 2px rgba(0,0,0,.2);
    letter-spacing:.3px;
}
.crm-funnel-stage:hover{filter:brightness(1.1);transform:scale(1.02)}

/* ---- Sidebar mini-deal (reused in dashboard) ---- */
.crm-mini-deal{
    padding:8px 10px;border-radius:8px;border:1px solid #eee;
    background:#fff;cursor:pointer;transition:all .12s;margin-bottom:4px;
}
.crm-mini-deal:hover{background:#fafafa}
.crm-mini-deal-title{font-size:11px;font-weight:600;color:#333;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.crm-mini-deal-meta{font-size:9px;color:#999;display:flex;gap:6px;margin-top:2px}

/* ---- Dashboard Sidebar Section (now inline in dashboard) ---- */
.crm-dash-sidebar-section{
    padding:14px;border-radius:12px;border:1px solid #eee;background:#fff;
}
.crm-dash-sidebar-title{font-size:10px;font-weight:600;color:#999;text-transform:uppercase;letter-spacing:.8px;margin-bottom:8px}

/* ---- Nav bar compact for many tabs ---- */
.crm-nav-tab{padding:0 11px}

/* ---- Form Tabs ---- */
.crm-form-tabs{
    display:flex;gap:0;border-bottom:1px solid #eee;margin:-20px -20px 16px;padding:0 20px;
}
.crm-form-tab{
    padding:10px 16px;font-size:12px;font-weight:500;color:#999;
    background:none;border:none;cursor:pointer;
    border-bottom:2px solid transparent;transition:all .15s;white-space:nowrap;
}
.crm-form-tab:hover{color:#666}
.crm-form-tab.crm-form-tab-active{color:#EF4444;border-bottom-color:#EF4444;font-weight:600}
.crm-form-tab-panel{display:none}
.crm-form-tab-panel.crm-form-tab-panel-active{display:block}

/* ---- Tags ---- */
.crm-tags-input-wrap{
    display:flex;flex-wrap:wrap;gap:4px;padding:6px 10px;border:1px solid #ddd;
    border-radius:9px;min-height:36px;align-items:center;background:#fff;cursor:text;
}
.crm-tags-input-wrap:focus-within{border-color:#EF4444}
.crm-tag{
    display:inline-flex;align-items:center;gap:3px;padding:2px 8px;border-radius:6px;
    background:#fef2f2;color:#EF4444;font-size:11px;font-weight:500;white-space:nowrap;
}
.crm-tag-remove{
    width:14px;height:14px;border-radius:50%;border:none;background:rgba(239,68,68,.15);
    color:#ef4444;font-size:10px;cursor:pointer;display:flex;align-items:center;
    justify-content:center;padding:0;line-height:1;
}
.crm-tag-remove:hover{background:rgba(239,68,68,.3)}
.crm-tags-input{
    border:none;outline:none;font-size:12px;color:#333;background:transparent;
    flex:1;min-width:60px;padding:2px 0;
}

/* ---- Contact/Product Field Rows ---- */
.crm-contact-field-row,.crm-product-field-row{
    display:flex;gap:6px;align-items:center;margin-bottom:6px;
}
.crm-contact-field-row .crm-input,.crm-product-field-row .crm-input,
.crm-contact-field-row .crm-select,.crm-product-field-row .crm-select{
    padding:7px 8px;font-size:11.5px;
}
.crm-field-row-remove{
    width:22px;height:22px;border-radius:6px;border:none;background:#fef2f2;
    color:#ef4444;font-size:12px;cursor:pointer;display:flex;align-items:center;
    justify-content:center;flex-shrink:0;padding:0;transition:all .15s;
}
.crm-field-row-remove:hover{background:#fee2e2}
.crm-product-total{
    font-size:12px;font-weight:600;color:#333;min-width:80px;text-align:right;
}

/* ---- Notes Feed ---- */
.crm-note-entry{
    padding:10px 14px;border-radius:10px;border:1px solid #eee;
    background:#fff;margin-bottom:6px;
}
.crm-note-header{
    display:flex;align-items:center;justify-content:space-between;margin-bottom:4px;
}
.crm-note-author{font-size:11px;font-weight:600;color:#666}
.crm-note-date{font-size:10px;color:#999}
.crm-note-text{font-size:12.5px;color:#444;line-height:1.5;white-space:pre-wrap}

/* ---- Chart Bars (Reports) ---- */
.crm-chart-bar-container{
    display:flex;align-items:flex-end;gap:8px;height:200px;padding:10px 0;
}
.crm-chart-bar-group{
    flex:1;display:flex;gap:3px;align-items:flex-end;height:100%;
}
.crm-chart-bar{
    flex:1;border-radius:6px 6px 0 0;transition:height .4s ease;min-height:2px;
    position:relative;
}
.crm-chart-bar-won{background:linear-gradient(180deg,#22c55e,#16a34a)}
.crm-chart-bar-lost{background:linear-gradient(180deg,#ef4444,#dc2626)}
.crm-chart-bar-label{
    position:absolute;bottom:-20px;left:50%;transform:translateX(-50%);
    font-size:9px;color:#999;white-space:nowrap;
}
.crm-chart-bar-value{
    position:absolute;top:-18px;left:50%;transform:translateX(-50%);
    font-size:9px;font-weight:600;color:#333;white-space:nowrap;
}
.crm-chart-labels{
    display:flex;gap:8px;justify-content:center;padding-top:26px;
}
.crm-chart-legend{
    display:flex;align-items:center;gap:4px;font-size:10px;color:#666;
}
.crm-chart-legend-dot{width:8px;height:8px;border-radius:2px;flex-shrink:0}

/* ---- Horizontal Bars (ranking) ---- */
.crm-chart-hbar-row{
    display:flex;align-items:center;gap:10px;margin-bottom:8px;
}
.crm-chart-hbar-label{font-size:11px;color:#666;min-width:100px;text-align:right;flex-shrink:0}
.crm-chart-hbar-track{flex:1;height:22px;background:#f5f5f5;border-radius:6px;overflow:hidden}
.crm-chart-hbar-fill{height:100%;border-radius:6px;transition:width .4s ease;display:flex;align-items:center;padding:0 8px}
.crm-chart-hbar-val{font-size:10px;font-weight:600;color:#fff;white-space:nowrap}

/* ---- Conversion & Forecast Tables ---- */
.crm-conversion-table,.crm-forecast-table{
    width:100%;border-collapse:collapse;font-size:12px;
}
.crm-conversion-table th,.crm-forecast-table th{
    text-align:left;font-size:10px;color:#999;text-transform:uppercase;
    letter-spacing:.5px;padding:8px 10px;border-bottom:1px solid #eee;font-weight:600;
}
.crm-conversion-table td,.crm-forecast-table td{
    padding:8px 10px;border-bottom:1px solid #f5f5f5;color:#333;
}
.crm-conv-row:hover,.crm-forecast-table tr:hover{background:#fafafa}

/* ---- Search Dropdown ---- */
.crm-search-dropdown{
    position:absolute;top:100%;left:0;right:0;margin-top:4px;
    background:#fff;border:1px solid #ddd;border-radius:10px;
    box-shadow:0 8px 30px rgba(0,0,0,.12);z-index:200;
    max-height:320px;overflow-y:auto;
}
.crm-search-result{
    display:flex;align-items:center;gap:10px;padding:9px 14px;cursor:pointer;
    transition:background .1s;
}
.crm-search-result:first-child{border-radius:10px 10px 0 0}
.crm-search-result:last-child{border-radius:0 0 10px 10px}
.crm-search-result:hover{background:#fef2f2}
.crm-search-result-text{flex:1;font-size:12px;color:#333;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.crm-search-result-sub{font-size:10px;color:#999}
.crm-search-type{
    font-size:9px;font-weight:600;padding:2px 6px;border-radius:4px;
    text-transform:uppercase;letter-spacing:.3px;flex-shrink:0;
}
.crm-search-type-deal{background:rgba(34,197,94,.1);color:#22c55e}
.crm-search-type-activity{background:rgba(59,130,246,.1);color:#3b82f6}
.crm-search-type-task{background:rgba(139,92,246,.1);color:#8b5cf6}
.crm-search-type-contact{background:rgba(245,158,11,.1);color:#f59e0b}

/* ---- Calendar ---- */
.crm-cal-header{
    display:flex;align-items:center;justify-content:space-between;margin-bottom:12px;
}
.crm-cal-nav{display:flex;align-items:center;gap:8px}
.crm-cal-month{font-size:16px;font-weight:700;color:#333;min-width:180px;text-align:center}
.crm-cal-grid{
    display:grid;grid-template-columns:repeat(7,1fr);gap:1px;
    background:#eee;border:1px solid #eee;border-radius:10px;overflow:hidden;
}
.crm-cal-day-header{
    padding:6px;text-align:center;font-size:10px;font-weight:600;
    color:#999;background:#fafafa;text-transform:uppercase;
}
.crm-cal-cell{
    min-height:80px;background:#fff;padding:4px;vertical-align:top;
    position:relative;
}
.crm-cal-cell-other{background:#fafafa}
.crm-cal-cell-other .crm-cal-date{color:#ccc}
.crm-cal-today{background:#fffbeb}
.crm-cal-today .crm-cal-date{
    background:#EF4444;color:#fff;border-radius:50%;
    width:22px;height:22px;display:flex;align-items:center;justify-content:center;
}
.crm-cal-date{
    font-size:11px;font-weight:600;color:#666;margin-bottom:2px;
    width:22px;height:22px;display:flex;align-items:center;justify-content:center;
}
.crm-cal-event{
    font-size:9px;padding:2px 4px;border-radius:4px;margin-bottom:1px;
    white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer;
    color:#fff;font-weight:500;
}
.crm-cal-event:hover{filter:brightness(1.1)}
.crm-cal-event-activity{background:#3b82f6}
.crm-cal-event-close{background:#f59e0b}
.crm-cal-event-task{background:#ef4444}

/* ---- Sort Headers ---- */
.crm-sort-header{
    cursor:pointer;display:flex;align-items:center;gap:3px;
    font-size:10px;color:#999;text-transform:uppercase;user-select:none;
    transition:color .15s;
}
.crm-sort-header:hover{color:#666}
.crm-sort-active{color:#EF4444 !important;font-weight:700}
.crm-sort-arrow{font-size:8px;opacity:.6}

/* ---- Deal Card Time Badge ---- */
.crm-deal-card-time{
    font-size:9px;font-weight:600;padding:1px 5px;border-radius:4px;
    display:inline-block;margin-top:4px;
}
.crm-deal-card-time-green{background:rgba(34,197,94,.1);color:#22c55e}
.crm-deal-card-time-yellow{background:rgba(245,158,11,.1);color:#f59e0b}
.crm-deal-card-time-red{background:rgba(239,68,68,.1);color:#ef4444}

/* ---- Onboarding ---- */
.crm-onboarding{
    padding:18px;border-radius:14px;border:1px solid #e8e8e8;
    background:#fff;margin-bottom:18px;
}
.crm-onboarding-title{font-size:14px;font-weight:700;color:#333;margin-bottom:10px}
.crm-onboarding-progress{
    height:6px;border-radius:3px;background:#eee;overflow:hidden;margin-bottom:12px;
}
.crm-onboarding-progress-fill{height:100%;border-radius:3px;background:linear-gradient(90deg,#EF4444,#f59e0b);transition:width .4s}
.crm-onboarding-step{
    display:flex;align-items:center;gap:10px;padding:8px 0;
}
.crm-onboarding-check{
    width:20px;height:20px;border-radius:50%;border:2px solid #ddd;
    display:flex;align-items:center;justify-content:center;flex-shrink:0;
    font-size:10px;transition:all .2s;
}
.crm-onboarding-check-done{background:#22c55e;border-color:#22c55e;color:#fff}
.crm-onboarding-label{font-size:12px;color:#666}
.crm-onboarding-label-done{color:#bbb;text-decoration:line-through}

/* ---- Notification Panel ---- */
.crm-notif-panel{
    position:absolute;top:52px;right:12px;width:320px;
    background:#fff;border:1px solid #ddd;border-radius:12px;
    box-shadow:0 12px 40px rgba(0,0,0,.15);z-index:200;
    max-height:400px;overflow-y:auto;
}
.crm-notif-header{
    padding:12px 16px;border-bottom:1px solid #eee;
    font-size:13px;font-weight:600;color:#333;
}
.crm-notif-item{
    display:flex;align-items:flex-start;gap:10px;padding:10px 16px;
    border-bottom:1px solid #f5f5f5;cursor:pointer;transition:background .1s;
}
.crm-notif-item:hover{background:#fef2f2}
.crm-notif-item:last-child{border-bottom:none}
.crm-notif-icon{
    width:28px;height:28px;border-radius:8px;display:flex;align-items:center;
    justify-content:center;flex-shrink:0;font-size:12px;
}
.crm-notif-text{font-size:11.5px;color:#444;line-height:1.4;flex:1}
.crm-notif-time{font-size:9px;color:#bbb;margin-top:2px}
.crm-notif-empty{padding:24px;text-align:center;color:#bbb;font-size:12px}

/* ---- Attachment Row ---- */
.crm-attachment-row{
    display:flex;align-items:center;gap:8px;padding:7px 12px;
    border-radius:8px;border:1px solid #eee;background:#fff;margin-bottom:4px;
}
.crm-attachment-icon{
    width:28px;height:28px;border-radius:6px;background:#f0f9ff;color:#3b82f6;
    display:flex;align-items:center;justify-content:center;flex-shrink:0;
}
.crm-attachment-name{
    flex:1;font-size:12px;color:#3b82f6;text-decoration:none;
    white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.crm-attachment-name:hover{text-decoration:underline}
.crm-attachment-meta{font-size:10px;color:#999;flex-shrink:0}

/* ---- Drag Clone (Touch) ---- */
.crm-drag-clone{
    position:fixed;z-index:9999;pointer-events:none;opacity:.85;
    transform:rotate(3deg);box-shadow:0 8px 25px rgba(0,0,0,.2);
}

/* ---- Automation Rule ---- */
.crm-auto-rule{
    display:flex;align-items:center;gap:10px;padding:10px 14px;
    border-radius:10px;border:1px solid #eee;background:#fff;margin-bottom:6px;
}
.crm-auto-rule-text{flex:1;font-size:12px;color:#444}
.crm-auto-rule-badge{
    font-size:9px;font-weight:600;padding:2px 7px;border-radius:10px;
}
.crm-auto-rule-on{background:rgba(34,197,94,.1);color:#22c55e}
.crm-auto-rule-off{background:rgba(107,114,128,.1);color:#9ca3af}

/* ---- Sparkline ---- */
.crm-sparkline{display:block;margin-top:6px}

/* ---- Goal Bar ---- */
.crm-goal-bar{
    height:8px;border-radius:4px;background:#eee;overflow:hidden;margin-top:6px;
}
.crm-goal-bar-fill{height:100%;border-radius:4px;transition:width .4s}

/* ---- Pipeline Selector ---- */
.crm-pipeline-selector{
    display:flex;align-items:center;gap:8px;
}
.crm-pipeline-select{
    padding:5px 10px;border-radius:7px;border:1px solid #ddd;background:#fff;
    font-size:12px;color:#333;cursor:pointer;
}

/* ---- Audit Log ---- */
.crm-audit-row{
    display:flex;align-items:center;gap:8px;padding:6px 0;
    border-bottom:1px solid #f5f5f5;font-size:11px;color:#666;
}
.crm-audit-time{font-size:10px;color:#bbb;flex-shrink:0;min-width:70px}
.crm-audit-action{flex:1}

/* ---- Scrollbar ---- */
#win-crm ::-webkit-scrollbar{width:5px}
#win-crm ::-webkit-scrollbar-track{background:transparent}
#win-crm ::-webkit-scrollbar-thumb{background:#ccc;border-radius:3px}
#win-crm ::-webkit-scrollbar-thumb:hover{background:#aaa}

/* ---- Responsive ---- */
@media(max-width:700px){
    .crm-header-search-wrap{display:none}
    .crm-content-wrap{padding:0 12px 16px}
    .crm-deal-row{grid-template-columns:1fr 100px 80px !important}
    .crm-deal-row>*:nth-child(n+4){display:none !important}
    .crm-cal-cell{min-height:50px}
    .crm-notif-panel{width:280px;right:4px}
}
