/* ============================================
   A2Z Solar Energy - CRM Admin Styles
   ============================================ */

:root {
    --sun-yellow: #FFC93C;
    --sun-yellow-deep: #F5A623;
    --leaf-green: #1B8A3F;
    --leaf-green-dark: #0F5C2A;
    --sky-mint: #E8F7EE;
    --ink: #10241A;
    --ink-soft: #5A6B60;
    --bg: #F6F8F6;
    --white: #FFFFFF;
    --border: #E3E9E4;
    --radius: 12px;
    --shadow: 0 4px 16px rgba(16,36,26,0.06);
    --danger: #E5484D;
    --warning: #F5A623;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* ---------- Login Page ---------- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 20% 20%, rgba(255,201,60,0.25), transparent 50%), var(--leaf-green-dark);
}
.login-card {
    background: var(--white);
    border-radius: 20px;
    padding: 44px 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.login-logo {
    display: flex; align-items: center; gap: 10px;
    font-family: 'Sora', sans-serif; font-weight: 700; font-size: 20px;
    margin-bottom: 6px;
}
.login-logo .mark {
    width: 42px; height: 42px; border-radius: 10px;
    background: linear-gradient(135deg, var(--sun-yellow), var(--leaf-green));
    display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.login-sub { color: var(--ink-soft); font-size: 13px; margin-bottom: 28px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 12px 14px; border-radius: 10px;
    border: 1.5px solid var(--border); font-family: inherit; font-size: 14px;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--leaf-green); }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 22px; border-radius: 10px; font-weight: 600; font-size: 14px;
    border: none; cursor: pointer; transition: all 0.2s ease;
}
.btn-primary { background: var(--leaf-green); color: var(--white); }
.btn-primary:hover { background: var(--leaf-green-dark); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 12.5px; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--ink); }
.btn-outline:hover { border-color: var(--leaf-green); color: var(--leaf-green); }
.btn-danger { background: #FDEAEA; color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: var(--white); }
.alert { padding: 12px 16px; border-radius: 10px; font-size: 13.5px; margin-bottom: 18px; font-weight: 500; }
.alert-error { background: #FDEAEA; color: var(--danger); }
.alert-success { background: var(--sky-mint); color: var(--leaf-green-dark); }

/* ---------- Layout ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 250px; background: var(--leaf-green-dark); color: rgba(255,255,255,0.85);
    display: flex; flex-direction: column; flex-shrink: 0;
    position: sticky; top: 0; height: 100vh;
}
.sidebar-logo {
    display: flex; align-items: center; gap: 10px; padding: 22px 20px;
    font-family: 'Sora', sans-serif; font-weight: 700; color: var(--white); font-size: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logo .mark {
    width: 36px; height: 36px; border-radius: 9px;
    background: linear-gradient(135deg, var(--sun-yellow), var(--leaf-green));
    display: flex; align-items: center; justify-content: center; font-size: 17px;
}
.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 12px; padding: 11px 14px;
    border-radius: 9px; font-size: 13.5px; font-weight: 500; margin-bottom: 3px;
    transition: background 0.2s ease;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.08); color: var(--white); }
.sidebar-nav a.active { background: var(--sun-yellow); color: var(--ink); font-weight: 700; }
.sidebar-nav .nav-icon { width: 18px; text-align: center; }
.sidebar-foot { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.1); font-size: 12.5px; }

.main-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    background: var(--white); border-bottom: 1px solid var(--border);
    padding: 16px 28px; display: flex; align-items: center; justify-content: space-between;
}
.topbar h1 { font-family: 'Sora', sans-serif; font-size: 19px; font-weight: 700; }
.topbar-user { display: flex; align-items: center; gap: 12px; font-size: 13.5px; }
.topbar-user .avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--sky-mint); color: var(--leaf-green-dark);
    display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.page-body { padding: 28px; flex: 1; }

/* ---------- Cards / Stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 28px; }
.stat-card {
    background: var(--white); border-radius: var(--radius); padding: 22px;
    box-shadow: var(--shadow); border: 1px solid var(--border);
    display: flex; align-items: center; gap: 16px;
}
.stat-card .ic {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0;
}
.stat-card .num { font-family: 'Sora', sans-serif; font-size: 24px; font-weight: 800; }
.stat-card .lbl { font-size: 12.5px; color: var(--ink-soft); }

.card {
    background: var(--white); border-radius: var(--radius); border: 1px solid var(--border);
    box-shadow: var(--shadow); margin-bottom: 24px;
}
.card-head {
    padding: 18px 22px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.card-head h3 { font-family: 'Sora', sans-serif; font-size: 15.5px; font-weight: 700; }
.card-body { padding: 22px; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
    text-align: left; padding: 12px 16px; background: var(--sky-mint);
    color: var(--leaf-green-dark); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px;
    white-space: nowrap;
}
thead th:first-child { border-radius: 8px 0 0 8px; }
thead th:last-child { border-radius: 0 8px 8px 0; }
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: #FAFBF9; }
tbody tr:last-child td { border-bottom: none; }

.badge {
    display: inline-block; padding: 4px 11px; border-radius: 999px;
    font-size: 11.5px; font-weight: 700;
}
.badge-new { background: #E3F2FD; color: #1565C0; }
.badge-contacted { background: #FFF3E0; color: #E65100; }
.badge-followup { background: #FFF8E1; color: #F57F17; }
.badge-quoted { background: #F3E5F5; color: #6A1B9A; }
.badge-converted { background: #E8F5E9; color: #2E7D32; }
.badge-lost { background: #FFEBEE; color: #C62828; }
.badge-pending { background: #FFF3E0; color: #E65100; }
.badge-progress { background: #E3F2FD; color: #1565C0; }
.badge-completed { background: #E8F5E9; color: #2E7D32; }
.badge-paid { background: #E8F5E9; color: #2E7D32; }
.badge-partial { background: #FFF8E1; color: #F57F17; }
.badge-unpaid { background: #FFEBEE; color: #C62828; }
.badge-draft { background: #ECEFF1; color: #455A64; }
.badge-sent { background: #E3F2FD; color: #1565C0; }
.badge-accepted { background: #E8F5E9; color: #2E7D32; }
.badge-rejected { background: #FFEBEE; color: #C62828; }

.action-icons { display: flex; gap: 8px; }
.action-icons a, .action-icons button {
    width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--white); display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 13px; color: var(--ink-soft); transition: all 0.15s ease;
}
.action-icons a:hover, .action-icons button:hover { background: var(--sky-mint); color: var(--leaf-green-dark); border-color: var(--leaf-green); }

.empty-state { text-align: center; padding: 50px 20px; color: var(--ink-soft); }
.empty-state .ic { font-size: 40px; margin-bottom: 12px; }

.filter-bar { display: flex; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; align-items: center; }
.filter-bar input, .filter-bar select {
    padding: 10px 14px; border-radius: 9px; border: 1.5px solid var(--border); font-size: 13.5px; font-family: inherit;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

@media (max-width: 900px) {
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .sidebar { position: fixed; left: -260px; z-index: 300; transition: left 0.3s ease; }
    .sidebar.open { left: 0; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
