/* ============================================================
   Manajemen Pembayaran Talent — UI Modern
   Self-contained, tanpa dependensi eksternal.
   ============================================================ */

:root {
    --bg:          #eef2f9;
    --surface:     #ffffff;
    --text:        #1e293b;
    --muted:       #64748b;
    --border:      #e2e8f0;
    --primary:     #4f46e5;
    --primary-600: #4338ca;
    --primary-50:  #eef2ff;
    --success:     #059669;
    --success-bg:  #ecfdf5;
    --danger:      #dc2626;
    --danger-bg:   #fef2f2;
    --warn:        #d97706;
    --radius:      14px;
    --radius-sm:   9px;
    --shadow:      0 1px 3px rgba(15,23,42,.08), 0 8px 24px rgba(15,23,42,.05);
    --shadow-lg:   0 20px 45px rgba(15,23,42,.12);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background:
        radial-gradient(1200px 600px at 100% -10%, #e0e7ff 0%, transparent 55%),
        radial-gradient(900px 500px at -10% 0%, #dbeafe 0%, transparent 50%),
        var(--bg);
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
}

.container { width: min(1180px, 100% - 32px); margin: 0 auto; }
main.container { padding: 28px 0 60px; }

/* ============================================================
   Layout dengan sidebar kiri
   ============================================================ */
.brand-logo {
    width: 38px; height: 38px; border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff; display: grid; place-items: center; font-size: 15px; letter-spacing: .5px;
    box-shadow: 0 6px 16px rgba(79,70,229,.35); flex: none;
}
.brand-text { font-size: 15px; font-weight: 700; }

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

/* ---------- Sidebar ---------- */
.sidebar {
    width: 258px; flex: none;
    background: #0f172a;
    color: #cbd5e1;
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
    z-index: 40;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 11px;
    padding: 20px 20px; color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-nav { padding: 16px 12px; flex: 1; overflow-y: auto; }
.nav-section {
    font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
    color: #64748b; font-weight: 700; padding: 6px 12px 10px;
}
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 12px; margin-bottom: 4px; border-radius: 10px;
    color: #cbd5e1; text-decoration: none; font-weight: 600; font-size: 14px;
    transition: .15s;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: linear-gradient(135deg, var(--primary), #7c3aed); color: #fff; box-shadow: 0 6px 16px rgba(79,70,229,.4); }
.nav-ico { font-size: 16px; width: 20px; text-align: center; }

.sidebar-foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.08); }
.user-card { display: flex; align-items: center; gap: 11px; margin-bottom: 12px; }
.user-avatar {
    width: 40px; height: 40px; border-radius: 50%; flex: none;
    background: linear-gradient(135deg, #7c3aed, var(--primary));
    color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 16px;
}
.user-meta { min-width: 0; }
.user-meta .user-name { color: #fff; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-block { width: 100%; }
.sidebar .btn-ghost { color: #cbd5e1; border-color: rgba(255,255,255,.15); }
.sidebar .btn-ghost:hover { background: rgba(255,255,255,.08); color: #fff; }

/* ---------- Content ---------- */
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content-inner { flex: 1; width: min(1180px, 100% - 48px); margin: 0 auto; padding: 28px 0 40px; }
.footer { color: var(--muted); font-size: 13px; padding: 18px 24px 26px; text-align: center; }

/* ---------- Mobile bar + sidebar toggle ---------- */
.mobile-bar { display: none; }
.sidebar-overlay { display: none; }
.hamburger { display: flex; flex-direction: column; gap: 4px; cursor: pointer; padding: 8px; }
.hamburger span { width: 22px; height: 2px; background: var(--text); border-radius: 2px; }

.page-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px; flex-wrap: wrap; margin-bottom: 20px;
}
.page-head h1 { font-size: 24px; margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

/* ---------- Card ---------- */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px;
}
.card + .card { margin-top: 20px; }

/* ---------- Stat cards ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 16px; margin-bottom: 22px; }
.stat {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px 20px; box-shadow: var(--shadow);
}
.stat .label { color: var(--muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 24px; font-weight: 800; margin-top: 6px; }
.stat.accent { background: linear-gradient(135deg, var(--primary), #7c3aed); border: none; color: #fff; }
.stat.accent .label { color: rgba(255,255,255,.85); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    border: 1px solid var(--border); background: #fff; color: var(--text);
    padding: 10px 16px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
    cursor: pointer; text-decoration: none; transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(79,70,229,.28); }
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.inline { display: inline; }

/* ---------- Badge ---------- */
.badge { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; display: inline-block; }
.badge-cash { background: var(--success-bg); color: var(--success); }
.badge-transfer { background: #dbeafe; color: #1d4ed8; }
.badge-role.badge-admin { background: #fef3c7; color: #b45309; }
.badge-role.badge-contributor { background: var(--primary-50); color: var(--primary-600); }
.badge-role.badge-komisaris { background: #f3e8ff; color: #7c3aed; }
.badge-role.badge-user { background: #f1f5f9; color: var(--muted); }
.badge-inactive { background: #f1f5f9; color: var(--muted); }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 760px; }
table.data th, table.data td { padding: 13px 14px; border-bottom: 1px solid var(--border); text-align: left; }
table.data thead th {
    background: #f8fafc; color: var(--muted); font-size: 12px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em; position: sticky; top: 0;
}
table.data tbody tr:hover { background: #fafbff; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .actions { white-space: nowrap; }
table.data tfoot td { background: var(--primary-50); font-weight: 800; border-top: 2px solid var(--primary); }
.empty { text-align: center; color: var(--muted); padding: 34px 0 !important; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--muted); }
.form-control {
    width: 100%; padding: 11px 13px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: 14px; font-family: inherit; background: #fff;
    transition: .15s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.15); }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }
.hint { font-size: 12px; color: var(--muted); }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: 14px; font-weight: 500; }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #a7f3d0; }
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #fecaca; }

/* ---------- Login ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(410px, 100%); background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 34px 30px; }
.auth-logo { width: 56px; height: 56px; border-radius: 15px; background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 20px; margin: 0 auto 16px; box-shadow: 0 10px 24px rgba(79,70,229,.35); }
.auth-card h1 { text-align: center; font-size: 21px; margin: 0 0 4px; }
.auth-card .sub { text-align: center; color: var(--muted); font-size: 14px; margin: 0 0 24px; }
.auth-card .form-group { margin-bottom: 15px; }
.auth-card .btn { width: 100%; }
.cred-hint { margin-top: 18px; text-align: center; font-size: 12px; color: var(--muted); }

/* ---------- Filter bar ---------- */
.filter-bar {
    display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
    margin-bottom: 18px;
}
.filter-bar .form-group { gap: 5px; }
.filter-bar label { font-size: 12px; }
.filter-bar .form-control { padding: 9px 11px; }
.filter-bar .filter-actions { display: flex; gap: 8px; }
.filter-spacer { flex: 1; }
.export-group { display: flex; gap: 8px; }
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--primary-50); color: var(--primary-600);
    padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
    text-decoration: none;
}
.chip .x { font-weight: 800; }

/* ---------- Profile / two-column cards ---------- */
.profile-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    align-items: start;
}
.card-title { font-size: 16px; margin: 0 0 16px; }
.profile-summary { display: flex; align-items: center; gap: 16px; }
.profile-avatar { width: 56px; height: 56px; font-size: 22px; }
@media (max-width: 720px) {
    .profile-grid { grid-template-columns: 1fr; }
    .profile-grid .card[style*="span 2"] { grid-column: auto !important; }
}

/* ---------- Quick range buttons ---------- */
.quick-range { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.chip-btn {
    display: inline-flex; align-items: center; padding: 7px 14px; border-radius: 999px;
    border: 1px solid var(--border); background: #fff; color: var(--muted);
    font-size: 13px; font-weight: 600; text-decoration: none; transition: .15s;
}
.chip-btn:hover { border-color: #cbd5e1; background: #f8fafc; color: var(--text); }
.chip-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(79,70,229,.28); }

/* ---------- Charts ---------- */
.chart-legend { display: flex; gap: 18px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.chart-legend .dot { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }
.dot-income { background: #4f46e5; }
.dot-expense { background: #f59e0b; }
.chart-scroll { width: 100%; overflow-x: auto; }
.chart-svg { width: 100%; min-width: 520px; height: auto; display: block; }

.cat-bars { display: flex; flex-direction: column; gap: 12px; }
.cat-row { display: grid; grid-template-columns: 160px 1fr 140px; align-items: center; gap: 12px; }
.cat-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-track { background: #f1f5f9; border-radius: 999px; height: 16px; overflow: hidden; }
.cat-fill { height: 100%; border-radius: 999px; min-width: 2px; transition: width .3s; }
.cat-val { text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }
@media (max-width: 640px) {
    .cat-row { grid-template-columns: 100px 1fr; }
    .cat-val { grid-column: 2; text-align: left; }
}

/* ---------- Report filter grid ---------- */
.rf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    align-items: end;
}
.rf-actions label { visibility: hidden; }

/* ---------- Pagination ---------- */
.pagination {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap; margin-top: 18px;
}
.pagination .info { color: var(--muted); font-size: 13px; }
.pager { display: flex; gap: 4px; flex-wrap: wrap; }
.pager a, .pager span {
    min-width: 36px; height: 36px; padding: 0 10px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); border-radius: 8px; background: #fff;
    color: var(--text); text-decoration: none; font-size: 14px; font-weight: 600;
}
.pager a:hover { background: #f8fafc; border-color: #cbd5e1; }
.pager .current { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager .disabled { color: #cbd5e1; background: #f8fafc; cursor: not-allowed; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .layout { display: block; }
    .sidebar {
        position: fixed; top: 0; left: 0; height: 100vh;
        transform: translateX(-100%); transition: transform .25s ease;
    }
    .sidebar-toggle-cb:checked ~ .layout .sidebar { transform: translateX(0); }
    .sidebar-toggle-cb:checked ~ .layout .sidebar-overlay {
        display: block; position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 35;
    }
    .mobile-bar {
        display: flex; align-items: center; gap: 10px;
        padding: 10px 16px; background: rgba(255,255,255,.9);
        backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
        position: sticky; top: 0; z-index: 30;
    }
    .mobile-title { font-weight: 700; font-size: 15px; }
    .content-inner { width: 100% - 32px; width: calc(100% - 32px); padding: 20px 0 30px; }
}
@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
    .page-head h1 { font-size: 20px; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .filter-spacer { display: none; }
    .export-group, .filter-actions { flex-wrap: wrap; }
}

/* ---------- Print (untuk cetak/PDF via browser jika perlu) ---------- */
@media print {
    .sidebar, .mobile-bar, .filter-bar, .page-head .btn, .actions, .pagination, .footer { display: none !important; }
    body { background: #fff; }
    .card { box-shadow: none; border: none; }
}
