/* --- CORE SETUP --- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    margin: 0; padding: 0; background: #050505; color: #e0f0ff;
    font-family: 'Inter', sans-serif; overflow-x: hidden; 
    padding-bottom: 120px; 
}

/* --- VARIABLES --- */
:root {
    --p-blue: #00f3ff;
    --p-orange: #ff7b00;
    --p-green: #00ff66;
    --p-red: #ff003c;
    --p-dark: #050505;
    --glass: rgba(10, 10, 10, 0.95);
    --glass-border: rgba(255, 255, 255, 0.1);
    --card-bg: rgba(255, 255, 255, 0.05);
}

/* --- STATUS COLORS (GLOBAL FIX) --- */
.status-lead { --status-color: var(--p-green); }
.status-active { --status-color: var(--p-orange); }
.status-customer, .status-sold { --status-color: var(--p-blue); }

/* --- TOP CONTROLS --- */
.top-control-deck {
    position: sticky; top: 0; z-index: 100;
    background: rgba(5,5,5,0.95); backdrop-filter: blur(10px);
    border-bottom: 1px solid #333; padding: 15px;
    display: flex; gap: 10px; flex-direction: column;
}

.search-wrap {
    background: #111; border: 1px solid #333; border-radius: 6px;
    padding: 0 10px; display: flex; align-items: center; height: 40px;
}
.search-wrap i { color: #555; margin-right: 10px; }
.hyper-search {
    background: none; border: none; color: #fff; width: 100%; outline: none;
    font-family: 'JetBrains Mono'; font-size: 12px;
}

.filter-row {
    display: flex; gap: 10px; width: 100%;
}

.cyber-select {
    width: 100%; background: #111; color: var(--p-blue); border: 1px solid var(--p-blue);
    height: 40px; padding: 0 10px; font-family: 'Chakra Petch'; font-weight: 700;
    border-radius: 4px; outline: none; text-transform: uppercase;
    flex: 1; 
}

/* --- CARDS --- */
.client-card {
    /* Default fallback if class is missing */
    --status-color: #444; 

    position: relative;
    
    /* Background Layering for Cyber Corners */
    background: 
        linear-gradient(to right, var(--status-color) 2px, transparent 2px) 0 0,
        linear-gradient(to bottom, var(--status-color) 2px, transparent 2px) 0 0,
        linear-gradient(to left, var(--status-color) 2px, transparent 2px) 100% 0,
        linear-gradient(to bottom, var(--status-color) 2px, transparent 2px) 100% 0,
        linear-gradient(to right, var(--status-color) 2px, transparent 2px) 0 100%,
        linear-gradient(to top, var(--status-color) 2px, transparent 2px) 0 100%,
        linear-gradient(to left, var(--status-color) 2px, transparent 2px) 100% 100%,
        linear-gradient(to top, var(--status-color) 2px, transparent 2px) 100% 100%,
        rgba(255,255,255,0.02);
    
    background-repeat: no-repeat;
    background-size: 8px 8px, 8px 8px, 8px 8px, 8px 8px, 8px 8px, 8px 8px, 8px 8px, 8px 8px, 100% 100%;
        
    border: 1px solid #222;
    border-radius: 4px; 
    padding: 15px;
    display: flex; align-items: center; justify-content: space-between;
    transition: 0.2s; margin-bottom: 10px;
}

.client-card:active { transform: scale(0.98); background-color: rgba(255,255,255,0.05); }

.staff-card-row {
    background: rgba(255,255,255,0.02); border-bottom: 1px solid #222;
    padding: 15px; display: flex; align-items: center; gap: 15px;
    cursor: pointer;
}
.staff-avatar {
    width: 40px; height: 40px; background: #111; color: #fff;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-family: 'Chakra Petch'; font-weight: 700; border: 1px solid #333;
}
.staff-info { flex: 1; }
.staff-name { font-family: 'Chakra Petch'; font-weight: 700; color: #fff; }
.staff-role { font-family: 'JetBrains Mono'; font-size: 10px; color: #888; margin-top: 2px; }

.cc-btn {
    width: 30px; height: 30px; border-radius: 4px; border: 1px solid #333;
    background: #111; color: #ccc; cursor: pointer;
}

/* --- CALENDAR --- */
.calendar-wrapper {
    display: flex; gap: 10px; overflow-x: auto; padding-bottom: 10px;
}
.calendar-day {
    min-width: 140px; background: rgba(255,255,255,0.02);
    border: 1px solid #333; border-radius: 6px; flex-shrink: 0;
}
.cd-header {
    background: #111; padding: 10px; text-align: center;
    font-family: 'Chakra Petch'; font-weight: 700; font-size: 12px;
    border-bottom: 1px solid #333; color: var(--p-blue);
}
.cd-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.appt-chip {
    background: #1a1a1a; padding: 10px; border-radius: 4px;
    border-left: 2px solid var(--p-green); cursor: pointer; transition: 0.2s;
    border: 1px solid #333; border-left-width: 2px;
}
.appt-chip:hover { border-color: #fff; }
.ac-time { font-family: 'JetBrains Mono'; font-size: 9px; color: var(--p-green); margin-bottom: 4px; }
.ac-name { font-family: 'Inter'; font-size: 11px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- MODALS (CYBER DOSSIER) --- */
.modal-overlay, .staff-portfolio-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85); 
    backdrop-filter: blur(8px);
    z-index: 5000; display: none; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.2s ease;
}

.modal-overlay.active, .staff-portfolio-modal.active { 
    display: flex; opacity: 1; 
}

.modal-card {
    width: 90%; max-width: 500px; 
    height: auto; max-height: 85vh;
    background: #0a0a0a; 
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 16px; 
    display: flex; flex-direction: column; overflow: hidden;
    box-shadow: 0 20px 50px rgba(0,0,0,0.9);
    
    transform: scale(0.95); opacity: 0;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

.modal-overlay.active .modal-card, 
.staff-portfolio-modal.active .modal-card {
    transform: scale(1); opacity: 1;
}

.modal-header {
    background: rgba(20,20,20,0.9); 
    padding: 20px; border-bottom: 1px solid #222;
    display: flex; justify-content: space-between; align-items: center;
}
.modal-header h2 { margin: 0; font-family: 'Chakra Petch'; font-size: 18px; color: #fff; letter-spacing: 1px; }

.close-x { 
    background: rgba(255,255,255,0.1); width: 32px; height: 32px; 
    border-radius: 50%; border: none; color: #fff; font-size: 18px; 
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: 0.2s;
}
.close-x:hover { background: var(--p-red); transform: rotate(90deg); }

.modal-body { padding: 25px; overflow-y: auto; flex: 1; }

.dossier-grid {
    display: grid; grid-template-columns: 1fr; gap: 15px; margin-bottom: 20px;
}
.dossier-item {
    background: rgba(255,255,255,0.03); padding: 12px; border-radius: 4px;
    border: 1px solid #222;
}
.dossier-label { font-family: 'JetBrains Mono'; font-size: 9px; color: #666; margin-bottom: 5px; text-transform: uppercase; }
.dossier-value { font-family: 'Inter'; font-size: 14px; color: #fff; font-weight: 600; }

.stage-dock { 
    display: flex; gap: 5px; background: #111; padding: 5px; 
    border-radius: 8px; margin-bottom: 25px; border: 1px solid #222;
}
.stage-btn {
    flex: 1; background: none; border: 1px solid transparent; color: #666; padding: 10px;
    font-family: 'JetBrains Mono'; font-size: 10px; cursor: pointer; border-radius: 6px; transition: 0.2s;
}
.stage-btn.active { background: #222; color: #fff; border-color: #444; box-shadow: 0 2px 5px rgba(0,0,0,0.5); }
.stage-btn:hover { color: #ccc; }

.btn-save {
    width: 100%; background: var(--p-blue); color: #000; font-weight: 800;
    padding: 16px; border: none; font-family: 'Chakra Petch'; cursor: pointer;
    margin-top: 20px; border-radius: 8px; letter-spacing: 1px; text-transform: uppercase;
    transition: 0.2s;
}
.btn-save:hover { background: #fff; box-shadow: 0 0 15px var(--p-blue); }

/* TAB NAV */
.tab-nav { display: flex; border-bottom: 1px solid #333; margin-bottom: 20px; }
.tab-btn {
    flex: 1; background: none; border: none; color: #666; padding: 12px;
    font-family: 'JetBrains Mono'; font-size: 10px; font-weight: 700; cursor: pointer;
    border-bottom: 2px solid transparent; transition: 0.3s;
}
.tab-btn.active { color: var(--p-blue); border-bottom-color: var(--p-blue); }

.list-row {
    padding: 12px; border-bottom: 1px solid #222; display: flex; justify-content: space-between; align-items: center;
}
.history-row {
    padding: 12px; border-bottom: 1px solid #222; display: flex; gap: 12px;
}
.h-icon { color: #555; font-size: 12px; margin-top: 3px; }
.h-note { font-size: 13px; color: #ccc; line-height: 1.4; margin-bottom: 4px; }
.h-time { font-size: 10px; color: #666; font-family: 'JetBrains Mono'; }

/* --- 5-COLUMN NAVIGATION (MATCHING INDEX.HTML EXACTLY) --- */
.bottom-nav {
    position: fixed; 
    bottom: 0; left: 0; width: 100%; 
    height: 90px;
    background: rgba(5,5,5,0.98); backdrop-filter: blur(15px);
    border-top: 1px solid rgba(255,255,255,0.1);
    display: grid; 
    grid-template-columns: 1fr 1fr 80px 1fr 1fr; /* EXACT 5 COLUMNS */
    align-items: center; justify-items: center;
    z-index: 9999;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-group {
    width: 100%; height: 100%; 
    display: flex; align-items: center; justify-content: center; 
    position: relative;
}

.nav-trigger {
    background: none; border: none; color: #666; font-size: 20px;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    cursor: pointer; transition: 0.3s; width: 100%;
}

.nav-trigger:hover, .nav-trigger.active {
    color: var(--p-orange); 
    text-shadow: 0 0 10px rgba(255, 123, 0, 0.4);
}

.nav-label {
    font-size: 9px; font-weight: 800; font-family: 'Chakra Petch'; 
    text-transform: uppercase; letter-spacing: 0.5px;
}

/* Center Add Button Float Position */
.center-btn-wrapper {
    position: relative; width: 60px; height: 60px; 
    display: flex; align-items: center; justify-content: center;
    top: -15px; /* Floats above the bar */
}

.center-master-btn {
    width: 50px; height: 50px; border-radius: 50%;
    background: var(--p-orange); border: 3px solid #000; color: #000;
    font-size: 20px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; box-shadow: 0 0 20px rgba(255, 123, 0, 0.4);
    transition: 0.3s;
}

.center-master-btn:hover { transform: scale(1.05); box-shadow: 0 0 30px rgba(255, 123, 0, 0.6); }

/* POP-UP STACKS */
.nav-stack {
    position: absolute; bottom: 85px; left: 50%; transform: translateX(-50%) translateY(20px);
    width: 160px; background: rgba(10, 10, 10, 0.95);
    border: 1px solid rgba(255,255,255,0.1); border-radius: 8px;
    display: flex; flex-direction: column; opacity: 0; pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 -10px 30px rgba(0,0,0,0.8); z-index: 10000; padding: 5px 0;
}

.nav-stack.active { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); border-color: var(--p-orange); }

.nav-stack a {
    text-decoration: none; color: #ccc; font-family: 'JetBrains Mono';
    font-size: 10px; padding: 12px 15px; text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.05); transition: 0.2s;
    text-transform: uppercase; letter-spacing: 1px; display: block;
}
.nav-stack a:hover { background: rgba(255, 123, 0, 0.1); color: #fff; }
.nav-stack a:last-child { border-bottom: none; }

/* --- STAFF MODAL DETAILS --- */
.cyber-section-header {
    font-family: 'Chakra Petch'; font-size: 12px; font-weight: 700;
    padding-bottom: 5px; border-bottom: 1px solid #333; margin-bottom: 10px;
    letter-spacing: 1px;
}

.staff-client-row {
    background: rgba(255,255,255,0.03); 
    border: 1px solid #222; border-left-width: 3px; 
    border-radius: 4px; 
    padding: 12px; margin-bottom: 8px;
    display: flex; justify-content: space-between; align-items: center;
    transition: 0.2s;
}
.staff-client-row:hover { background: rgba(255,255,255,0.08); transform: translateX(2px); }

.status-border-lead { border-left-color: var(--p-green); }
.status-border-active { border-left-color: var(--p-orange); }
.status-border-sold { border-left-color: var(--p-blue); }

.transfer-btn {
    background: #111; color: #666; width: 28px; height: 28px;
    border: 1px solid #333; border-radius: 4px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: 0.2s;
}
.transfer-btn:hover { border-color: #fff; color: #fff; background: #222; }