:root {
    --color-bg: #0b0e14;
    --color-surface: #12161f;
    --color-surface-alt: #161b26;
    --color-text: #e6e9ef;
    --color-text-muted: #9aa4b2;
    --color-primary: #3d8bfd;
    --color-border: #232836;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    padding: 24px 16px;
}

.sidebar-logo {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 28px;
    padding: 0 8px;
}
.sidebar-logo span { color: var(--color-primary); }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }

.nav-item {
    color: var(--color-text-muted);
    text-decoration: none;
    padding: 10px 12px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
}

.nav-item:hover { background: var(--color-surface-alt); color: var(--color-text); }
.nav-item.active { background: var(--color-primary); color: #fff; }

.main { flex: 1; min-width: 0; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 32px;
    border-bottom: 1px solid var(--color-border);
}

.topbar h1 { margin: 0; font-size: 1.3rem; }
.topbar-user { color: var(--color-text-muted); font-size: 0.9rem; }

.content { padding: 32px; }

.placeholder-banner {
    background: var(--color-surface);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius);
    padding: 24px 28px;
    margin-bottom: 28px;
}
.placeholder-banner h2 { margin: 0 0 8px; font-size: 1.1rem; }
.placeholder-banner p { margin: 0; color: var(--color-text-muted); font-size: 0.95rem; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px;
}

.stat-label { color: var(--color-text-muted); font-size: 0.85rem; margin-bottom: 8px; }
.stat-value { font-size: 1.8rem; font-weight: 700; }

@media (max-width: 720px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--color-border); }
    .sidebar-nav { flex-direction: row; flex-wrap: wrap; }
}

/* Leads list / detail */

.filters-row { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }

.field-input {
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text);
    padding: 9px 12px;
    font-size: 0.9rem;
}

.field-label {
    display: block;
    font-size: 0.82rem;
    color: var(--color-text-muted);
    margin-bottom: 14px;
}
.field-label .field-input,
.field-label select,
.field-label textarea {
    display: block;
    width: 100%;
    margin-top: 6px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 18px;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.88rem;
    border: 1px solid transparent;
    cursor: pointer;
}
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-ghost { border-color: var(--color-border); color: var(--color-text); background: transparent; }

.result-count { color: var(--color-text-muted); font-size: 0.85rem; margin-bottom: 12px; }

.table-wrap { overflow-x: auto; }

.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.data-table th {
    text-align: left;
    color: var(--color-text-muted);
    font-weight: 500;
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}
.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}
.data-table tbody tr { cursor: pointer; }
.data-table tbody tr:hover { background: var(--color-surface-alt); }
.empty-row { text-align: center; color: var(--color-text-muted); cursor: default; }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.08);
    color: var(--color-text-muted);
}
.badge-new { background: rgba(61, 139, 253, 0.16); color: #6fa8ff; }
.badge-contacted { background: rgba(255, 199, 79, 0.16); color: #ffc74f; }
.badge-qualified { background: rgba(79, 214, 140, 0.16); color: #4fd68c; }
.badge-converted { background: rgba(79, 214, 140, 0.28); color: #4fd68c; }
.badge-not_interested,
.badge-invalid,
.badge-duplicate { background: rgba(242, 84, 91, 0.16); color: #f2545b; }

.badge-kyc-not_submitted { background: rgba(255, 255, 255, 0.08); color: var(--color-text-muted); }
.badge-kyc-pending { background: rgba(255, 199, 79, 0.16); color: #ffc74f; }
.badge-kyc-approved { background: rgba(79, 214, 140, 0.16); color: #4fd68c; }
.badge-kyc-rejected { background: rgba(242, 84, 91, 0.16); color: #f2545b; }

.back-link { display: inline-block; margin-bottom: 20px; color: var(--color-text-muted); font-size: 0.88rem; }
.back-link:hover { color: var(--color-text); }

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    align-items: start;
}

.detail-grid .card h3 { margin: 0 0 16px; font-size: 1rem; }

.detail-list { margin: 0; }
.detail-list dt { color: var(--color-text-muted); font-size: 0.8rem; margin-top: 10px; }
.detail-list dt:first-child { margin-top: 0; }
.detail-list dd { margin: 2px 0 0; font-size: 0.95rem; }

.kyc-doc-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.88rem;
}
.kyc-doc-row:last-child { border-bottom: none; }
.kyc-actions { display: flex; gap: 8px; }

.messages { margin-bottom: 20px; }
.message {
    background: rgba(79, 214, 140, 0.12);
    color: #4fd68c;
    border: 1px solid rgba(79, 214, 140, 0.3);
    border-radius: var(--radius);
    padding: 10px 16px;
    font-size: 0.88rem;
}

/* Login page */

.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 32px 28px;
    width: 100%;
    max-width: 360px;
}
.login-card .btn { width: 100%; margin-top: 8px; }
.form-error { color: #f2545b; font-size: 0.85rem; margin: 0 0 14px; }
