/* ============================================================
   Fincrime Expert LMS CRM — Dark Theme
   Brand: #56529f | Font: Poppins
   ============================================================ */

:root {
    --brand: #56529f;
    --brand-light: #7b76c4;
    --brand-dark: #403c7d;
    --bg: #121218;
    --bg-alt: #181820;
    --surface: #1c1c26;
    --surface-2: #23232f;
    --border: #2e2e3d;
    --text: #e8e8f0;
    --text-muted: #9797ab;
    --text-faint: #6b6b7f;
    --success: #3fbf7f;
    --warning: #e0a83e;
    --danger: #e0546a;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 4px 18px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--brand-light); text-decoration: none; }
a:hover { color: var(--brand); }

h1, h2, h3, h4, h5 { font-weight: 600; margin: 0 0 8px; }

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

.sidebar {
    width: 250px;
    flex-shrink: 0;
    background: var(--bg-alt);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 22px 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand .logo-mark {
    height: 26px;
    display: flex; align-items: center;
    flex-shrink: 0;
}
.sidebar-brand .logo-mark img {
    height: 100%;
    width: auto;
    max-width: 140px;
    object-fit: contain;
    background: transparent;
    border: none;
    display: block;
}

.sidebar-brand .brand-text { font-weight: 600; font-size: 15px; color: #fff; line-height: 1.2; }
.sidebar-brand .brand-text small { display: block; font-weight: 400; font-size: 11px; color: var(--text-muted); }

.nav-section-label {
    padding: 16px 20px 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-faint);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all .15s ease;
}

.nav-link i { width: 18px; text-align: center; font-size: 15px; }

.nav-link:hover { background: var(--surface); color: var(--text); }

.nav-link.active {
    background: var(--surface);
    color: #fff;
    border-left-color: var(--brand-light);
}

.nav-badge {
    margin-left: auto;
    background: var(--brand);
    color: #fff;
    font-size: 10.5px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 20px;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-faint);
}

.main {
    margin-left: 250px;
    flex: 1;
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 28px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar h1 { font-size: 19px; color: #fff; }
.topbar .subtitle { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }

.topbar-user {
    display: flex; align-items: center; gap: 10px;
}

.avatar-circle {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    color: var(--brand-light); font-weight: 600; font-size: 13px;
}

.content { padding: 26px 28px; }

/* ---------- Cards / Stats ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
    margin-bottom: 26px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--brand), var(--brand-light));
}

.stat-card .stat-icon {
    width: 38px; height: 38px;
    border-radius: 9px;
    background: rgba(86, 82, 159, 0.18);
    color: var(--brand-light);
    display: flex; align-items: center; justify-content: center;
    font-size: 17px;
    margin-bottom: 12px;
}

.stat-card .stat-value { font-size: 26px; font-weight: 700; color: #fff; }
.stat-card .stat-label { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.card-header h2 { font-size: 15.5px; color: #fff; }
.card-body { padding: 20px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

table.data-table th {
    text-align: left;
    padding: 12px 16px;
    background: var(--surface-2);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}

table.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

table.data-table tbody tr:hover { background: var(--surface-2); }
table.data-table tbody tr:last-child td { border-bottom: none; }

.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); font-size: 12px; }
.mono { font-family: 'Courier New', monospace; font-size: 12px; }

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.badge-new { background: rgba(224,168,62,0.18); color: var(--warning); }
.badge-progress { background: rgba(86,82,159,0.22); color: var(--brand-light); }
.badge-success { background: rgba(63,191,127,0.18); color: var(--success); }
.badge-muted { background: rgba(151,151,171,0.15); color: var(--text-muted); }

/* ---------- Forms / Buttons ---------- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-muted); margin-bottom: 6px; }

.form-control {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text);
    font-family: inherit;
    font-size: 13.5px;
    transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: var(--brand-light); }
.form-control::placeholder { color: var(--text-faint); }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: opacity .15s, transform .1s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { opacity: .9; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--brand-light); color: var(--brand-light); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

.search-box {
    display: flex; align-items: center; gap: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    min-width: 260px;
}
.search-box input {
    background: transparent; border: none; outline: none; color: var(--text);
    font-family: inherit; font-size: 13px; width: 100%;
}
.search-box i { color: var(--text-faint); }

/* ---------- Auth (Login) Page ---------- */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 20% 20%, rgba(86,82,159,0.25), transparent 45%),
                radial-gradient(circle at 80% 80%, rgba(86,82,159,0.15), transparent 45%),
                var(--bg);
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 36px 32px;
    box-shadow: var(--shadow);
}

.auth-logo {
    height: 38px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 20px;
}
.auth-logo img {
    height: 100%;
    width: auto;
    max-width: 220px;
    object-fit: contain;
    background: transparent;
    border: none;
    display: block;
}

.auth-card h1 { text-align: center; font-size: 18px; color: #fff; }
.auth-card p.subtitle { text-align: center; color: var(--text-muted); font-size: 12.5px; margin-bottom: 26px; }

.otp-inputs {
    display: flex;
    gap: 8px;
    justify-content: space-between;
    margin-bottom: 18px;
}
.otp-inputs input {
    width: 42px; height: 50px;
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: #fff;
}
.otp-inputs input:focus { outline: none; border-color: var(--brand-light); }

.alert {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    margin-bottom: 16px;
}
.alert-error { background: rgba(224,84,106,0.14); color: var(--danger); border: 1px solid rgba(224,84,106,0.3); }
.alert-success { background: rgba(63,191,127,0.14); color: var(--success); border: 1px solid rgba(63,191,127,0.3); }
.alert-info { background: rgba(86,82,159,0.14); color: var(--brand-light); border: 1px solid rgba(86,82,159,0.3); }

.hint-box {
    margin-top: 18px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: 1px dashed var(--border);
    font-size: 11.5px;
    color: var(--text-faint);
    text-align: center;
}

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 6px; justify-content: flex-end; padding: 16px 20px; }
.pagination a, .pagination span {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 12.5px;
    color: var(--text-muted);
}
.pagination a:hover { border-color: var(--brand-light); color: var(--brand-light); }
.pagination .active { background: var(--brand); color: #fff; border-color: var(--brand); }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-faint);
}
.empty-state i { font-size: 34px; margin-bottom: 12px; display: block; color: var(--text-faint); }

/* ---------- Detail / View pages ---------- */
.detail-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}

.detail-avatar {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--brand-light));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 20px;
    flex-shrink: 0;
}

.detail-header h2 { color: #fff; font-size: 18px; }
.detail-header .text-muted { font-size: 13px; }

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

.detail-item .detail-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-faint);
    margin-bottom: 4px;
}

.detail-item .detail-value {
    font-size: 14px;
    color: var(--text);
    word-break: break-word;
}

.detail-item .detail-value.mono { font-size: 13px; }

.detail-message-box {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    white-space: pre-wrap;
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--text);
}

.breadcrumb {
    font-size: 12.5px;
    color: var(--text-faint);
    margin-bottom: 6px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--brand-light); }

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s; z-index: 100; }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .content { padding: 18px; }
}
