/* =========================================================
   ROOT VARIABLES
========================================================= */
:root{
    --primary:#38ab30;
    --bg:#f6f8fa;
    --card:#ffffff;
    --text:#1f2937;
    --muted:#6b7280;
    --border:#e5e7eb;
}

/* =========================================================
   BASE RESET
========================================================= */
*{
    box-sizing:border-box;
    font-family:'Inter', sans-serif;
}

body{
    margin:0;
    background:var(--bg);
    color:var(--text);
}

/* =========================================================
   HEADER & SEARCH
========================================================= */
.header{
    background:#fff;
    padding:16px;
    position:sticky;
    top:0;
    z-index:10;
    border-bottom:1px solid var(--border);
}

.search-row{
    display:flex;
    gap:12px;
    align-items:center;
}

.search-box{
    flex:1;
    display:flex;
    align-items:center;
    background:#f9fafb;
    border:1px solid var(--border);
    border-radius:12px;
    padding:10px 14px;
}

.search-box input{
    border:none;
    background:none;
    outline:none;
    flex:1;
    font-size:14px;
}

.action-btn{
    width:42px;
    height:42px;
    border-radius:10px;
    border:1px solid var(--border);
    background:#fff;
    cursor:pointer;
    font-size:16px;
    color:var(--muted);
    transition:.2s;
}

.action-btn:hover{
    background:var(--primary);
    color:#fff;
    border-color:var(--primary);
}

/* =========================================================
   LAYOUT
========================================================= */
.container{
    padding:20px;
}

.cards{
    display:grid;
    grid-template-columns:repeat(auto-fill,minmax(300px,1fr));
    gap:18px;
}

/* =========================================================
   CARD
========================================================= */
.card{
    position:relative;
    background:var(--card);
    border-radius:16px;
    padding:16px;
    border:1px solid var(--border);
    transition:.25s;
}

.card:hover{
    box-shadow:0 12px 25px rgba(0,0,0,0.08);
    transform:translateY(-3px);
}

.card-title{
    font-size:16px;
    font-weight:600;
    margin-bottom:20px;
}

.card p{
    margin:6px 0;
    font-size:13px;
    color:var(--muted);
}

.card i{
    margin-right:6px;
    color:var(--primary);
}

/* =========================================================
   CARD ACTIONS
========================================================= */
.edit-btn{
    position:absolute;
    top:14px;
    right:14px;
    width:34px;
    height:34px;
    border-radius:50%;
    border:none;
    background:#f3f4f6;
    color:#555;
    cursor:pointer;
    display:flex;
    align-items:center;
    justify-content:center;
    transition:.2s;
}

.edit-btn:hover{
    background:var(--primary);
    color:#fff;
}

/* =========================================================
   CARD DETAILS
========================================================= */
.phone a{
    color:var(--primary);
    text-decoration:none;
    font-weight:500;
}

.phone a:hover{
    text-decoration:underline;
}

.info-row{
    display:flex;
    justify-content:space-between;
    font-size:12px;
    color:var(--muted);
    margin:8px 0;
    gap:10px;
    flex-wrap:wrap;
}

/* =========================================================
   FOLLOW UP
========================================================= */
.followup-box{
    margin-top:10px;
    padding:10px 12px;
    border-radius:12px;
    background:#fff7ed;
    color:#b45309;
    font-size:13px;
    display:flex;
    align-items:center;
    gap:8px;
    border:1px solid #fed7aa;
}

.followup-box i{
    color:#f59e0b;
}

.followup-box.overdue{
    background:#fee2e2;
    color:#b91c1c;
    border-color:#fecaca;
}

/* =========================================================
   STATUS BADGES
========================================================= */
.meta{
    display:flex;
    justify-content:space-between;
    align-items:center;
    margin-top:12px;
}

.status{
    font-size:12px;
    padding:6px 14px;
    border-radius:999px;
    font-weight:500;
}

.closed{
    background:#e6f4ea;
    color:#1e7f3c;
}

.followup{
    background:#fff4e5;
    color:#b45309;
}

.nodeal{
    background:#fdecec;
    color:#c0392b;
}

/* =========================================================
   FLOATING ACTION BUTTON
========================================================= */
.fab{
    position:fixed;
    bottom:22px;
    right:22px;
    width:60px;
    height:60px;
    border-radius:50%;
    background:var(--primary);
    border:none;
    color:#fff;
    font-size:24px;
    cursor:pointer;
    box-shadow:0 10px 25px rgba(56,171,48,0.45);
    transition:.25s;
}

.fab:hover{
    transform:scale(1.08);
}

/* =========================================================
   MODAL
========================================================= */
.modal-overlay{
    position:fixed;
    inset:0;
    background:rgba(0,0,0,0.4);
    display:none;
    justify-content:center;
    align-items:center;
    z-index:100;
    backdrop-filter:blur(4px);
}

.modal{
    background:#fff;
    width:100%;
    max-width:420px;
    border-radius:18px;
    padding:20px;
    animation:slideUp .3s ease;
}

@keyframes slideUp{
    from{ transform:translateY(40px); opacity:0; }
    to{ transform:translateY(0); opacity:1; }
}

.modal-header{
    display:flex;
    justify-content:space-between;
    align-items:center;
    margin-bottom:15px;
}

.modal-header h2{
    font-size:18px;
    margin:0;
}

.close-btn{
    background:none;
    border:none;
    font-size:18px;
    cursor:pointer;
    color:#666;
}

/* =========================================================
   FORM
========================================================= */
.form-group{
    margin-bottom:14px;
}

.form-group label{
    font-size:13px;
    color:#555;
    margin-bottom:6px;
    display:block;
}

.form-group input,
.form-group textarea,
.form-group select{
    width:100%;
    padding:10px 12px;
    border-radius:10px;
    border:1px solid var(--border);
    outline:none;
    font-size:14px;
}

.form-group textarea{
    resize:none;
    height:70px;
}

.modal-footer{
    display:flex;
    justify-content:flex-end;
    gap:10px;
    margin-top:15px;
}

.btn{
    padding:10px 18px;
    border-radius:10px;
    border:none;
    cursor:pointer;
    font-size:14px;
}

.btn.primary{
    background:var(--primary);
    color:#fff;
}

.btn.secondary{
    background:#f3f4f6;
    color:#333;
}

/* =========================================================
   FILTER SIDEBAR
========================================================= */
.filter-overlay{
    position:fixed;
    inset:0;
    background:rgba(0,0,0,0.35);
    display:none;
    z-index:90;
}

.filter-sidebar{
    position:fixed;
    top:0;
    right:-360px;
    width:340px;
    height:100dvh; /* mobile-safe viewport */
    background:#fff;
    z-index:100;
    box-shadow:-10px 0 30px rgba(0,0,0,0.15);
    display:flex;
    flex-direction:column;
    transition:.3s ease;
}



.filter-sidebar.open{
    right:0;
}

.filter-header,
.filter-footer{
    padding:16px;
    border-bottom:1px solid var(--border);
}

.filter-header{
    display:flex;
    align-items:center;
    justify-content:space-between; /* pushes title left, close button right */
    gap:12px;
    padding:16px;
    border-bottom:1px solid var(--border);
}


.filter-footer{
    border-top:1px solid var(--border);
    display:flex;
    gap:10px;
}

.filter-body{
    padding:16px;
    flex:1;
    overflow-y:auto;
    -webkit-overflow-scrolling:touch;
}


.filter-group{
    margin-bottom:16px;
}

.filter-group label{
    font-size:13px;
    color:#555;
    margin-bottom:6px;
    display:block;
}

.filter-group input,
.filter-group select{
    width:100%;
    padding:10px 12px;
    border-radius:10px;
    border:1px solid var(--border);
    font-size:14px;
}

/* =========================================================
   SORT PANEL
========================================================= */
.sort-panel{
    position:absolute;
    top:72px;
    right:90px;
    width:240px;
    background:#fff;
    border-radius:14px;
    box-shadow:0 12px 30px rgba(0,0,0,0.15);
    border:1px solid var(--border);
    display:none;
    z-index:50;
}

.sort-header{
    display:flex;
    justify-content:space-between;
    align-items:center;
    padding:12px 14px;
    border-bottom:1px solid var(--border);
    font-weight:500;
}

.sort-options{
    padding:10px;
}

.sort-options button{
    width:100%;
    text-align:left;
    padding:10px 12px;
    border:none;
    background:none;
    border-radius:10px;
    cursor:pointer;
    font-size:14px;
    color:var(--text);
    transition:.2s;
}

.sort-options button:hover{
    background:var(--bg);
    color:var(--primary);
}

/* =========================================================
   RESPONSIVE
========================================================= */
@media(max-width:768px){
    .search-row{
        flex-wrap:wrap;
    }
    .action-btn{
        flex:1;
    }
    .sort-panel{
        right:16px;
        width:90%;
    }
}
