@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&display=swap');

:root {
    --navy-1: #050B1C;
    --navy-2: #0B1B42;
    --blue: #1E88FF;
    --gold: #FAD20A;
    --gold-light: #FFE873;
    --off-white: #F3F6FC;
    --muted: #7C93C4;
    --sidebar-w: 240px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Cairo', sans-serif;
    background: #F0F3FA;
    color: #14203D;
    direction: rtl;
}

a { text-decoration: none; color: inherit; }

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    top: 0; right: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: linear-gradient(180deg, var(--navy-1), var(--navy-2));
    color: var(--off-white);
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    z-index: 100;
}

.sidebar .logo {
    padding: 0 20px 24px;
    font-size: 22px;
    font-weight: 800;
    color: var(--gold);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 12px;
}
.sidebar .logo span { color: var(--off-white); font-weight: 400; font-size: 13px; display:block; margin-top:4px;}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: var(--muted);
    font-weight: 600;
    font-size: 14.5px;
    border-right: 3px solid transparent;
    transition: all .15s;
}
.sidebar nav a:hover, .sidebar nav a.active {
    background: rgba(30,136,255,0.12);
    color: var(--off-white);
    border-right-color: var(--blue);
}

.sidebar .user-box {
    margin-top: auto;
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 13px;
}
.sidebar .user-box .name { color: var(--off-white); font-weight: 700; }
.sidebar .user-box .role { color: var(--muted); font-size: 12px; }
.sidebar .user-box a.logout { color: #FF8787; font-weight: 600; margin-top: 6px; display:inline-block;}

/* ===== Layout ===== */
.main {
    margin-right: var(--sidebar-w);
    padding: 28px 32px;
    min-height: 100vh;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.page-header h1 { font-size: 22px; font-weight: 800; color: var(--navy-2); }
.page-header .subtitle { color: #7A88A6; font-size: 13.5px; margin-top: 2px; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--blue);
    color: #fff;
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: transform .1s, box-shadow .15s;
}
.btn:hover { box-shadow: 0 6px 16px rgba(30,136,255,0.35); transform: translateY(-1px); }
.btn.gold { background: var(--gold); color: var(--navy-1); }
.btn.outline { background: transparent; border: 1.5px solid var(--blue); color: var(--blue); }
.btn.danger { background: #E74C3C; }
.btn.sm { padding: 6px 12px; font-size: 12.5px; }

/* ===== Cards / Stats ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}
.stat-card {
    background: #fff;
    border-radius: 14px;
    padding: 18px 20px;
    box-shadow: 0 2px 10px rgba(20,32,61,0.05);
    border-right: 4px solid var(--blue);
}
.stat-card .value { font-size: 26px; font-weight: 800; color: var(--navy-2); }
.stat-card .label { font-size: 13px; color: #7A88A6; margin-top: 4px; font-weight: 600;}

.card {
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(20,32,61,0.05);
}

/* ===== Kanban Board ===== */
.kanban {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 14px;
    align-items: start;
}
.kanban-col {
    background: #E8EDF7;
    border-radius: 14px;
    padding: 12px;
    min-height: 200px;
}
.kanban-col-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: 13.5px;
    padding: 4px 6px 12px;
    color: var(--navy-2);
}
.kanban-col-header .count {
    background: rgba(11,27,66,0.08);
    border-radius: 20px;
    padding: 1px 9px;
    font-size: 12px;
}
.lead-card {
    background: #fff;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: 0 1px 4px rgba(20,32,61,0.08);
    cursor: grab;
    border-right: 3px solid var(--blue);
    font-size: 13.5px;
}
.lead-card:active { cursor: grabbing; opacity: .7; }
.lead-card .biz-name { font-weight: 700; color: var(--navy-2); margin-bottom: 4px; }
.lead-card .meta { color: #8A96B3; font-size: 12px; }
.lead-card .assignee {
    margin-top: 8px;
    display: inline-block;
    background: var(--off-white);
    border-radius: 20px;
    padding: 2px 8px;
    font-size: 11px;
    color: var(--navy-2);
    font-weight: 600;
}
.kanban-col.drag-over { background: #D7E4FB; }

/* ===== Table ===== */
table { width: 100%; border-collapse: collapse; }
table th {
    text-align: right;
    font-size: 12.5px;
    color: #7A88A6;
    font-weight: 700;
    padding: 10px 12px;
    border-bottom: 2px solid #EEF1F8;
}
table td {
    padding: 12px;
    font-size: 13.5px;
    border-bottom: 1px solid #EEF1F8;
}
table tr:hover td { background: #FAFBFE; }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
}

/* ===== Forms ===== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: 13px; font-weight: 700; color: var(--navy-2); }
.form-group input, .form-group select, .form-group textarea {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1.5px solid #E1E7F3;
    font-family: 'Cairo', sans-serif;
    font-size: 14px;
    background: #fff;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--blue);
}

.tabs { display: flex; gap: 4px; border-bottom: 2px solid #EEF1F8; margin-bottom: 20px; }
.tabs a { padding: 10px 18px; font-weight: 700; font-size: 13.5px; color: #8A96B3; border-bottom: 2.5px solid transparent; margin-bottom: -2px; }
.tabs a.active { color: var(--blue); border-bottom-color: var(--blue); }

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--navy-1), var(--navy-2));
    padding: 20px;
}
.login-box {
    background: #fff;
    border-radius: 18px;
    padding: 40px;
    width: 440px;
    max-width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-box .logo { text-align:center; font-size: 24px; font-weight: 800; color: var(--navy-2); margin-bottom: 4px;}
.login-box .logo span { color: var(--blue); }
.login-box .tagline { text-align:center; color:#8A96B3; font-size:13px; margin-bottom: 28px;}
.error-msg { background: #FDEDEC; color: #C0392B; padding: 10px 14px; border-radius: 8px; font-size: 13.5px; margin-bottom: 16px; }

.followup-item { padding: 10px 0; border-bottom: 1px solid #EEF1F8; display:flex; justify-content:space-between; align-items:flex-start; gap: 10px;}
.followup-item .fdate { font-size: 12px; color: #8A96B3; font-weight: 600; white-space:nowrap;}
.followup-item.done { opacity: 0.55; }
.followup-item.overdue .fdate { color: #E74C3C; }

.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 200;
    background: linear-gradient(135deg, var(--navy-1), var(--navy-2));
    color: var(--gold);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
}
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(5,11,28,0.75);
    z-index: 99;
}
.sidebar-overlay.show { display: block; }

@media (max-width: 900px) {
    .sidebar { display: flex; width: 78%; max-width: 300px; transform: translateX(100%); transition: transform .25s ease; box-shadow: -6px 0 24px rgba(0,0,0,0.3); z-index: 150; }
    .sidebar.open { transform: translateX(0); }
    .mobile-menu-btn { display: block; }
    .main { margin-right: 0; padding: 16px; padding-top: 70px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .kanban { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .login-box { padding: 26px 22px; border-radius: 14px; }
    .login-box .tagline { margin-bottom: 20px; }
}

@media (max-width: 480px) {
    .login-box { padding: 20px 16px; }
    .login-box > div:first-child { padding: 10px !important; }
    .login-box img { height: 70px !important; }
    .stats-grid { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
}
