/* ── Google Font ─────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── CSS Variables ───────────────────────────── */
:root {
    --primary:      #1B4FD8;
    --primary-dark: #1440B3;
    --accent:       #10B981;
    --accent-dark:  #059669;
    --sidebar-bg:   #0F1B3D;
    --sidebar-hover:#1B4FD8;
    --topbar-bg:    #0F1B3D;
    --body-bg:      #F1F5F9;
    --card-bg:      #FFFFFF;
    --text-main:    #1E293B;
    --text-muted:   #64748B;
    --border:       #E2E8F0;
    --danger:       #EF4444;
    --warning:      #F59E0B;
    --success:      #10B981;
    --shadow-sm:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md:    0 4px 16px rgba(15,27,61,.12);
    --radius:       12px;
    --radius-sm:    8px;
    --sidebar-w:    240px;
}

/* ── Base ────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--body-bg);
    color: var(--text-main);
    font-size: 0.9rem;
    margin: 0;
}

/* ── Topbar ──────────────────────────────────── */
.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 60px;
    background: var(--topbar-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem 0 calc(var(--sidebar-w) + 1.5rem);
    z-index: 1030;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

.topbar-brand {
    padding: 0 1.5rem;
    width: var(--sidebar-w);
    position: fixed;
    left: 0;
    top: 0;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--sidebar-bg);
    border-bottom: 1px solid rgba(255,255,255,.06);
    z-index: 1031;
    text-decoration: none;
}

.topbar-brand .brand-icon {
    width: 36px; height: 36px;
    background: var(--primary);
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    color: #fff;
    flex-shrink: 0;
}

.topbar-brand .brand-name {
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.2;
}

.topbar-brand .brand-sub {
    color: rgba(255,255,255,.45);
    font-size: 0.7rem;
    font-weight: 400;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

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

.topbar-user .avatar {
    width: 36px; height: 36px;
    background: var(--primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.topbar-user .user-info .name {
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    line-height: 1.2;
}

.topbar-user .user-info .role-badge {
    font-size: 0.65rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--accent);
}

.btn-logout {
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
    color: rgba(255,255,255,.8);
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    font-size: 0.82rem;
    font-weight: 500;
    transition: all .2s;
    text-decoration: none;
    display: flex; align-items: center; gap: 6px;
}

.btn-logout:hover {
    background: rgba(255,255,255,.15);
    color: #fff;
}

/* ── Sidebar ─────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 60px; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1020;
    padding: 1rem 0.75rem 2rem;
    border-right: 1px solid rgba(255,255,255,.05);
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

.sidebar-section-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(255,255,255,.3);
    padding: 0.75rem 0.75rem 0.35rem;
    margin-top: 0.5rem;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255,255,255,.65);
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all .18s;
    margin-bottom: 2px;
    text-decoration: none;
}

.sidebar .nav-link i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar .nav-link:hover {
    background: rgba(255,255,255,.07);
    color: #fff;
}

.sidebar .nav-link.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(27,79,216,.4);
}

/* ── Main Content ────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-w);
    padding-top: 60px;
    min-height: 100vh;
}

.content-inner {
    padding: 2rem 2rem;
}

/* ── Page Header ─────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

.page-title span {
    color: var(--primary);
}

/* ── Cards ───────────────────────────────────── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.card-header-clean {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.card-header-clean h6 {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
    margin: 0;
}

/* ── Stat Cards ──────────────────────────────── */
.stat-card {
    border-radius: var(--radius);
    padding: 1.4rem 1.5rem;
    border: none;
    position: relative;
    overflow: hidden;
    transition: transform .2s, box-shadow .2s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-card .stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 4px;
}

.stat-card .stat-label {
    font-size: 0.78rem;
    font-weight: 500;
    opacity: .75;
}

.stat-card.blue   { background: linear-gradient(135deg, #1B4FD8, #2563EB); color: #fff; }
.stat-card.teal   { background: linear-gradient(135deg, #059669, #10B981); color: #fff; }
.stat-card.amber  { background: linear-gradient(135deg, #D97706, #F59E0B); color: #fff; }
.stat-card.rose   { background: linear-gradient(135deg, #DC2626, #EF4444); color: #fff; }
.stat-card.indigo { background: linear-gradient(135deg, #4338CA, #6366F1); color: #fff; }
.stat-card.slate  { background: linear-gradient(135deg, #334155, #475569); color: #fff; }

.stat-card .stat-icon.light { background: rgba(255,255,255,.2); color: #fff; }

/* ── Tables ──────────────────────────────────── */
.table-clean {
    width: 100%;
    border-collapse: collapse;
}

.table-clean thead th {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem;
    background: #F8FAFC;
}

.table-clean tbody td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
    vertical-align: middle;
}

.table-clean tbody tr:last-child td { border-bottom: none; }
.table-clean tbody tr:hover { background: #F8FAFC; }

/* ── Badges ──────────────────────────────────── */
.badge-paid    { background: #D1FAE5; color: #065F46; border-radius: 6px; padding: 3px 10px; font-size: 0.72rem; font-weight: 600; }
.badge-partial { background: #FEF3C7; color: #92400E; border-radius: 6px; padding: 3px 10px; font-size: 0.72rem; font-weight: 600; }
.badge-due     { background: #FEE2E2; color: #991B1B; border-radius: 6px; padding: 3px 10px; font-size: 0.72rem; font-weight: 600; }
.badge-active  { background: #DBEAFE; color: #1E40AF; border-radius: 6px; padding: 3px 10px; font-size: 0.72rem; font-weight: 600; }

/* ── Buttons ─────────────────────────────────── */
.btn-primary-custom {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 8px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, box-shadow .2s;
    display: inline-flex; align-items: center; gap: 6px;
    text-decoration: none;
}

.btn-primary-custom:hover {
    background: var(--primary-dark);
    color: #fff;
    box-shadow: 0 4px 12px rgba(27,79,216,.35);
}

.btn-accent-custom {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 8px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
    display: inline-flex; align-items: center; gap: 6px;
    text-decoration: none;
}

.btn-accent-custom:hover { background: var(--accent-dark); color: #fff; }

/* ── Forms ───────────────────────────────────── */
.form-control, .form-select {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    padding: 0.55rem 0.85rem;
    color: var(--text-main);
    transition: border-color .2s, box-shadow .2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(27,79,216,.12);
    outline: none;
}

.form-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

/* ── Auth Page ───────────────────────────────── */
.auth-wrapper {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--body-bg);
}

.auth-left {
    background: linear-gradient(160deg, #0F1B3D 0%, #1B4FD8 60%, #10B981 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #fff;
}

.auth-left .logo-box {
    width: 72px; height: 72px;
    background: rgba(255,255,255,.15);
    border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem;
    margin-bottom: 1.5rem;
    backdrop-filter: blur(8px);
}

.auth-left h1 {
    font-size: 1.8rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 0.75rem;
}

.auth-left p {
    color: rgba(255,255,255,.7);
    text-align: center;
    font-size: 0.9rem;
    max-width: 300px;
}

.auth-right {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 400px;
}

.auth-card .card-body { padding: 2.5rem; }

.auth-card h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.35rem;
}

.auth-card p.sub { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 2rem; }

@media (max-width: 768px) {
    .auth-wrapper { grid-template-columns: 1fr; }
    .auth-left { display: none; }
    .main-content { margin-left: 0; }
    .sidebar { transform: translateX(-100%); }
    .topbar { padding-left: 1rem; }
}

/* ── Alerts ──────────────────────────────────── */
.alert { border-radius: var(--radius-sm); font-size: 0.875rem; border: none; }
.alert-success { background: #D1FAE5; color: #065F46; }
.alert-danger   { background: #FEE2E2; color: #991B1B; }
.alert-info     { background: #DBEAFE; color: #1E40AF; }
.alert-warning  { background: #FEF3C7; color: #92400E; }

/* ── Utility ─────────────────────────────────── */
.text-muted-sm { font-size: 0.78rem; color: var(--text-muted); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
