/* Official Leads Portal - Mansory Consultants (Red & Black Shadow Theme) */
:root {
    --m-red: #dc2626;
    --m-red-hover: #b91c1c;
    --m-red-glow: rgba(220, 38, 38, 0.4);
    --m-black: #090d16;
    --m-card-bg: #111827;
    --m-card-inner: #1f2937;
    --m-border: #374151;
    --m-text: #f9fafb;
    --m-muted: #9ca3af;
    --m-success: #10b981;
    --m-warning: #f59e0b;
    --m-orange: #ea580c;
}

.m-crm-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--m-text);
    background-color: var(--m-black);
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.9), 0 0 30px rgba(220, 38, 38, 0.15);
    max-width: 1440px;
    margin: 20px auto;
    border: 1px solid #1f2937;
}

/* 1. Header Top Bar */
.m-crm-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #0f172a;
    border: 1px solid #1e293b;
    border-bottom: 2px solid var(--m-red);
    padding: 16px 24px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.7);
    flex-wrap: wrap;
    gap: 15px;
}

.m-brand-flex {
    display: flex;
    align-items: center;
    gap: 14px;
}

.m-brand-logo {
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    color: #fff;
    font-weight: 900;
    font-size: 16px;
    letter-spacing: 1.5px;
    padding: 8px 14px;
    border-radius: 8px;
    box-shadow: 0 4px 15px var(--m-red-glow);
}

.m-brand-titles h1 {
    font-size: 20px !important;
    font-weight: 800 !important;
    color: #fff !important;
    margin: 0 0 2px 0 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.m-brand-titles span {
    font-size: 12px;
    color: var(--m-muted);
}

.m-top-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.m-user-badge-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #1e293b;
    padding: 6px 14px;
    border-radius: 30px;
    border: 1px solid var(--m-border);
}

.m-user-avatar-small {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    overflow: hidden;
    background: #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--m-red);
}

.m-user-avatar-small img { width: 100%; height: 100%; object-fit: cover; }

.m-user-details strong { display: block; font-size: 13px; color: #fff; }

.m-role-pill {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    text-transform: uppercase;
}

.badge-ceo { background: #fee2e2; color: #991b1b; }
.badge-hr { background: #fef3c7; color: #b45309; }
.badge-staff { background: #dbeafe; color: #1e40af; }

/* 2. Welcome Card */
.m-welcome-card {
    background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
    border: 1px solid var(--m-border);
    border-left: 5px solid var(--m-red);
    padding: 18px 24px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.5);
}

.m-welcome-left { display: flex; align-items: center; gap: 14px; }
.m-greeting-icon { font-size: 30px; background: rgba(220, 38, 38, 0.15); padding: 8px; border-radius: 50%; }
.m-welcome-left h3 { margin: 0 0 4px 0 !important; color: #fff !important; font-size: 18px !important; }
.m-welcome-left p { margin: 0; font-size: 13px; color: #cbd5e1; }

.m-welcome-right {
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.m-pulse-dot {
    width: 8px; height: 8px; border-radius: 50%; background: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.4);
    animation: m-pulse 1.5s infinite;
}
@keyframes m-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* 3. Action Panel */
.m-actions-panel {
    background: var(--m-card-bg);
    border: 1px solid var(--m-border);
    padding: 14px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.m-panel-label { font-size: 13px; font-weight: 700; color: var(--m-muted); text-transform: uppercase; }
.m-btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* 4. Alerts */
.m-alerts-grid {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.m-alert-box {
    flex: 1;
    min-width: 280px;
    padding: 14px 18px;
    border-radius: 10px;
    display: flex;
    gap: 12px;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

.m-alert-today { background: #172554; border: 1px solid #1e40af; border-left: 4px solid #3b82f6; color: #93c5fd; }
.m-alert-overdue { background: #450a0a; border: 1px solid #991b1b; border-left: 4px solid var(--m-red); color: #fca5a5; }
.m-alert-icon { font-size: 24px; }
.m-alert-box strong { font-size: 14px; display: block; margin-bottom: 2px; }
.m-alert-box p { margin: 0; font-size: 12px; opacity: 0.9; }

/* 5. Stats Cards */
.m-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.m-stat-card {
    background: var(--m-card-bg);
    border: 1px solid var(--m-border);
    border-radius: 12px;
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
}

.border-white { border-left: 4px solid #94a3b8; }
.border-green { border-left: 4px solid var(--m-success); }
.border-yellow { border-left: 4px solid var(--m-warning); }
.border-red { border-left: 4px solid var(--m-red); }

.m-stat-tag { font-size: 11px; text-transform: uppercase; color: var(--m-muted); font-weight: 700; display: block; margin-bottom: 4px; }
.m-stat-num { font-size: 26px; font-weight: 800; color: #fff; }
.text-green { color: var(--m-success) !important; }
.text-yellow { color: var(--m-warning) !important; }
.text-red { color: var(--m-red) !important; }
.m-stat-emoji { font-size: 26px; }

/* 6. Main Card & Table */
.m-main-card {
    background: var(--m-card-bg);
    border: 1px solid var(--m-border);
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.7);
}

.m-filters-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.m-filters-bar input, .m-filters-bar select {
    background: var(--m-card-inner);
    color: #fff;
    padding: 10px 14px;
    border: 1px solid var(--m-border);
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    transition: 0.2s;
}

.m-filters-bar input { flex-grow: 1; min-width: 250px; }
.m-filters-bar input:focus, .m-filters-bar select:focus { border-color: var(--m-red); box-shadow: 0 0 10px var(--m-red-glow); }

.m-table-responsive { overflow-x: auto; border: 1px solid var(--m-border); border-radius: 10px; }
.m-leads-table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; background: var(--m-card-inner); }
.m-leads-table th {
    background: #0f172a;
    color: #cbd5e1;
    font-weight: 700;
    padding: 14px;
    border-bottom: 2px solid var(--m-border);
    white-space: nowrap;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.m-leads-table td { padding: 14px; border-bottom: 1px solid #2d3748; vertical-align: middle; color: #f3f4f6; }
.m-leads-table tr:hover { background-color: rgba(220, 38, 38, 0.05); }

.m-row-overdue { background-color: rgba(220, 38, 38, 0.12) !important; }
.m-row-today { background-color: rgba(37, 99, 235, 0.12) !important; }

.m-id-pill { font-weight: 700; color: var(--m-red); background: rgba(220, 38, 38, 0.1); padding: 4px 8px; border-radius: 6px; font-size: 12px; }
.m-client-name { font-weight: 700; font-size: 14px; color: #fff; margin-bottom: 5px; }
.m-client-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.m-action-badge {
    text-decoration: none;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    transition: 0.2s;
}

.m-call-badge { background: #1e3a8a; color: #bfdbfe; border: 1px solid #2563eb; }
.m-wa-badge { background: #064e3b; color: #a7f3d0; border: 1px solid #059669; }
.m-call-badge:hover, .m-wa-badge:hover { transform: translateY(-2px); }

.m-service-tag { background: #1e293b; color: #e2e8f0; padding: 4px 10px; border-radius: 6px; font-size: 12px; border: 1px solid #334155; }
.m-input-sm {
    background: #0f172a;
    color: #fff;
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 7px 10px;
    font-size: 12px;
    width: 100%;
    box-sizing: border-box;
}

.m-save-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    background: #064e3b;
    color: #34d399;
    border: 1px solid #059669;
    white-space: nowrap;
}
.m-save-pill.saving { background: #78350f; color: #fcd34d; border-color: #d97706; }
.m-save-pill.error { background: #7f1d1d; color: #fca5a5; border-color: #dc2626; }

.m-btn-trash { background: none; border: none; cursor: pointer; font-size: 16px; opacity: 0.7; transition: 0.2s; }
.m-btn-trash:hover { opacity: 1; transform: scale(1.15); }

/* 7. Buttons */
.m-btn {
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.m-btn-red { background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%); color: #fff !important; box-shadow: 0 4px 15px var(--m-red-glow); }
.m-btn-red:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(220, 38, 38, 0.6); }

.m-btn-dark { background: #1e293b; color: #fff !important; border: 1px solid #334155; }
.m-btn-dark:hover { background: #334155; }

.m-btn-orange { background: #c2410c; color: #fff !important; }
.m-btn-orange:hover { background: #9a3412; }

.m-btn-logout { background: #450a0a; color: #fca5a5 !important; border: 1px solid #7f1d1d; font-size: 12px; padding: 6px 14px; }
.m-btn-logout:hover { background: #7f1d1d; color: #fff !important; }

.m-btn-mini-edit { background: #1e3a8a; color: #93c5fd; border: 1px solid #3b82f6; padding: 4px 8px; border-radius: 4px; font-size: 11px; cursor: pointer; font-weight: 700; }
.m-btn-mini-danger { background: #7f1d1d; color: #fca5a5; border: 1px solid #dc2626; padding: 4px 8px; border-radius: 4px; font-size: 11px; cursor: pointer; font-weight: 700; }
.m-btn-mini-dark { background: #334155; color: #fff; border: 1px solid #475569; padding: 4px 8px; border-radius: 4px; font-size: 11px; cursor: pointer; }

/* 8. Login Wrap */
.m-portal-login-wrap {
    max-width: 440px;
    margin: 60px auto;
    padding: 35px;
    background: var(--m-card-bg);
    border: 1px solid var(--m-border);
    border-top: 5px solid var(--m-red);
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.9), 0 0 30px var(--m-red-glow);
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.m-portal-brand { text-align: center; margin-bottom: 25px; }
.m-brand-badge { display: inline-block; background: var(--m-red); color: #fff; font-weight: 900; letter-spacing: 2px; font-size: 14px; padding: 6px 16px; border-radius: 6px; margin-bottom: 12px; }
.m-portal-brand h2 { font-size: 22px !important; color: #fff !important; margin: 0 0 6px 0 !important; font-weight: 800; }
.m-portal-brand p { color: var(--m-muted); font-size: 12px; margin: 0; }
.m-login-welcome { background: #1e293b; padding: 8px 12px; border-radius: 8px; font-size: 13px; color: #93c5fd; text-align: center; margin-bottom: 16px; border: 1px solid #3b82f6; }

.m-portal-login-wrap input[type="text"], .m-portal-login-wrap input[type="password"] {
    width: 100%;
    background: #0f172a;
    border: 1px solid #334155;
    padding: 11px 14px;
    border-radius: 8px;
    color: #fff;
    margin-bottom: 16px;
    box-sizing: border-box;
}

.m-portal-login-wrap input[type="submit"] {
    width: 100%;
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    color: #fff;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 800;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 4px 15px var(--m-red-glow);
}

/* 9. Modals */
.m-modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 15px;
}

.m-modal-card {
    background: var(--m-card-bg);
    border: 1px solid var(--m-border);
    border-top: 4px solid var(--m-red);
    border-radius: 14px;
    padding: 26px;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.95);
    color: #fff;
}

.m-modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; border-bottom: 1px solid #1f2937; padding-bottom: 12px; }
.m-modal-header h3 { margin: 0; font-size: 18px; color: #fff; font-weight: 800; }
.m-close { font-size: 24px; cursor: pointer; color: var(--m-muted); }
.m-close:hover { color: var(--m-red); }

.m-form-group { margin-bottom: 16px; }
.m-form-group label { display: block; font-size: 12px; font-weight: 700; margin-bottom: 6px; color: #e2e8f0; }
.m-input {
    width: 100%;
    background: #0f172a;
    color: #fff;
    border: 1px solid var(--m-border);
    border-radius: 8px;
    padding: 10px 14px;
    box-sizing: border-box;
    font-size: 13px;
}

.m-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

.m-staff-manage-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.m-staff-manage-table th { background: #0f172a; padding: 10px; color: var(--m-muted); text-align: left; }
.m-staff-manage-table td { padding: 12px 10px; border-bottom: 1px solid #1f2937; }
.m-staff-item-flex { display: flex; align-items: center; gap: 10px; }
.m-staff-mini-avatar { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; background: #334155; display: flex; align-items: center; justify-content: center; }
.m-staff-mini-avatar img { width: 100%; height: 100%; object-fit: cover; }
.m-subtext { font-size: 11px; color: var(--m-muted); display: block; }
.m-link-input { width: 160px; font-size: 11px; padding: 4px 8px; background: #0f172a; color: #93c5fd; border: 1px solid #334155; border-radius: 4px; }

/* Responsive Mobile Rules */
@media (max-width: 768px) {
    .m-crm-wrapper { padding: 12px; }
    .m-crm-top-bar { flex-direction: column; align-items: flex-start; }
    .m-actions-panel { flex-direction: column; align-items: flex-start; }
    .m-btn-group { width: 100%; }
    .m-btn-group button { width: 100%; }
    .m-stats-grid { grid-template-columns: 1fr; }
}
