* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #eef2f7;
    color: #1f2937;
}

a { color: #2563eb; text-decoration: none; }

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 270px 1fr;
}

.sidebar {
    background: #0f172a;
    color: #e5e7eb;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}

.brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: #2563eb;
    display: grid;
    place-items: center;
    font-weight: 800;
    color: #fff;
}

.brand { font-size: 20px; font-weight: bold; }
.brand-block small { color: #94a3b8; }

.side-nav { display: flex; flex-direction: column; gap: 8px; }
.side-nav a {
    color: #cbd5e1;
    padding: 11px 12px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}
.side-nav a:hover, .side-nav a.active { background: #1e293b; color: #fff; }
.side-nav span { width: 22px; display: inline-block; }

.user-box {
    margin-top: auto;
    background: rgba(255,255,255,.06);
    border-radius: 16px;
    padding: 14px;
}
.user-name { font-weight: 700; margin-bottom: 8px; }
.logout-link { display: block; margin-top: 10px; color: #fca5a5; font-size: 13px; }

.main-area { min-width: 0; }
.topbar {
    background: #fff;
    color: #111827;
    padding: 16px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e5e7eb;
}
.topbar small { display: block; color: #64748b; margin-top: 3px; }

.container {
    width: min(1180px, 94%);
    margin: 28px auto;
}

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}
.page-head h1 { margin: 0; font-size: 30px; }
.page-head p { margin: 6px 0 0; color: #6b7280; }

.cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.card {
    background: #fff;
    border-radius: 18px;
    padding: 20px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
    border: 1px solid #eef2f7;
}
.card span { color: #6b7280; display: block; margin-bottom: 10px; }
.card strong { font-size: 22px; display: block; }
.card small { color: #94a3b8; display: block; margin-top: 8px; }
.accent-debet { border-left: 5px solid #16a34a; }
.accent-kredit { border-left: 5px solid #dc2626; }
.accent-saldo { border-left: 5px solid #2563eb; }
.accent-status { border-left: 5px solid #7c3aed; }

.panel {
    background: #fff;
    border-radius: 18px;
    padding: 18px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
    border: 1px solid #eef2f7;
    margin-bottom: 20px;
}
.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.panel-head h2 { margin: 0; font-size: 20px; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 820px; }
th, td {
    border-bottom: 1px solid #e5e7eb;
    padding: 12px 10px;
    text-align: left;
    vertical-align: top;
    font-size: 14px;
}
th { background: #f8fafc; color: #334155; font-size: 13px; text-transform: uppercase; letter-spacing: .02em; }
tfoot th { background: #f1f5f9; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.muted { color: #64748b; font-size: 13px; }

.badge, .status-badge, .role-pill {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: bold;
}
.badge.pemasukan { background: #dcfce7; color: #166534; }
.badge.pengeluaran { background: #fee2e2; color: #991b1b; }
.status-badge.aktif { background: #dbeafe; color: #1d4ed8; }
.status-badge.dibatalkan { background: #fee2e2; color: #991b1b; }
.status-badge.dikoreksi { background: #fef3c7; color: #92400e; }
.role-pill.admin { background: #ede9fe; color: #5b21b6; }
.role-pill.operator { background: #dbeafe; color: #1d4ed8; }
.role-pill.owner { background: #dcfce7; color: #166534; }
.role-pill.auditor { background: #fef3c7; color: #92400e; }
.text-debet { color: #15803d; font-weight: 700; }
.text-kredit { color: #b91c1c; font-weight: 700; }
.row-status-dibatalkan, .row-status-dikoreksi { opacity: .72; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 0;
    background: #e5e7eb;
    color: #111827;
    border-radius: 11px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 14px;
}
.btn.primary { background: #2563eb; color: #fff; }
.btn.success { background: #16a34a; color: #fff; }
.btn.danger { background: #ef4444; color: #fff; }
.btn.warning { background: #f59e0b; color: #111827; }
.btn.small { padding: 7px 10px; border-radius: 9px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.button-group { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.alert { padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; }
.alert.success { background: #dcfce7; color: #166534; }
.alert.error { background: #fee2e2; color: #991b1b; }

.form-panel { max-width: 720px; }
.form-panel.wide { max-width: none; }
label { display: block; font-weight: bold; margin: 12px 0 6px; }
input, select, textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 11px;
    padding: 10px 12px;
    font-size: 14px;
    background: #fff;
}
textarea { resize: vertical; }
.actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.filter-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: end; }
.transaksi-filter { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.laporan-filter { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.filter-action { display: flex; gap: 8px; align-items: end; }

.role-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.role-card {
    background: #fff;
    border-radius: 16px;
    padding: 16px;
    border: 1px solid #eef2f7;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}
.role-card strong { display: block; margin-bottom: 6px; }
.role-card span { color: #64748b; font-size: 13px; }
.role-card.admin { border-left: 5px solid #7c3aed; }
.role-card.operator { border-left: 5px solid #2563eb; }
.role-card.owner { border-left: 5px solid #16a34a; }
.role-card.auditor { border-left: 5px solid #f59e0b; }

.summary-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 14px;
    border-radius: 14px;
    margin-bottom: 12px;
}
.summary-box p { margin: 5px 0; }
.saldo-awal-row td { background: #f8fafc; }

.print-body { background: #fff; }
.print-toolbar { padding: 16px; display: flex; gap: 8px; }
.print-sheet { width: 96%; margin: 0 auto; padding: 20px; }
.print-sheet h1 { margin-bottom: 4px; }
.summary-print { width: 420px; min-width: 0; margin-bottom: 18px; }

@media (max-width: 980px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: relative; height: auto; }
    .side-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cards, .role-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filter-grid, .transaksi-filter, .laporan-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .page-head, .topbar { align-items: flex-start; flex-direction: column; }
    .cards, .role-grid, .filter-grid, .transaksi-filter, .laporan-filter { grid-template-columns: 1fr; }
    .side-nav { grid-template-columns: 1fr; }
    table { min-width: 760px; }
}

@media print {
    .no-print, .sidebar, .topbar, .btn { display: none !important; }
    body { background: #fff; color: #000; }
    .app-shell { display: block; }
    .container { width: 100%; margin: 0; }
    .panel, .card { box-shadow: none; border: 0; }
    table { min-width: 0; font-size: 12px; }
    th, td { padding: 6px; }
}
