* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); min-height: 100vh; padding: 20px; color: #333; }
.container { max-width: 1200px; margin: 0 auto; background: #fff; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); overflow: hidden; }
header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #fff; padding: 30px; }
.header-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.header-top h1 { font-size: 24px; margin: 0; flex: 1; min-width: 250px; text-align: center; }
.btn-refresh { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,0.15); color: #fff; border: 2px solid rgba(255,255,255,0.5); padding: 10px 18px; border-radius: 10px; font-size: 14px; font-weight: 700; cursor: pointer; transition: all 0.2s; backdrop-filter: blur(6px); box-shadow: 0 2px 10px rgba(0,0,0,0.15); }
.btn-refresh:hover { background: #fff; color: #667eea; transform: translateY(-1px); box-shadow: 0 4px 18px rgba(0,0,0,0.2); }
.btn-refresh:active { transform: scale(0.97); }
header h1 { font-size: 24px; margin-bottom: 20px; text-align: center; }
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; }
.summary-card { background: rgba(255,255,255,0.95); padding: 18px; border-radius: 12px; text-align: center; color: #333; transition: transform 0.2s; }
.summary-card:hover { transform: translateY(-3px); }
.summary-card .label { display: block; font-size: 12px; color: #666; text-transform: uppercase; margin-bottom: 8px; }
.summary-card .value { display: block; font-size: 20px; font-weight: bold; }
.summary-card.income .value { color: #16a34a; }
.summary-card.expense .value { color: #dc2626; }
.summary-card.balance .value { color: #2563eb; }
.summary-card.assets .value { color: #9333ea; }
.summary-card.payables .value { color: #be185d; }
.summary-card.receivables .value { color: #ea580c; }
.tabs { display: flex; background: #f1f5f9; padding: 0; overflow-x: auto; border-bottom: 2px solid #e2e8f0; }
.tab-btn { flex: 1; min-width: 120px; padding: 16px 12px; border: none; background: transparent; cursor: pointer; font-size: 14px; font-weight: 600; color: #64748b; border-bottom: 3px solid transparent; transition: all 0.2s; }
.tab-btn:hover { background: #e2e8f0; color: #475569; }
.tab-btn.active { background: #fff; color: #667eea; border-bottom-color: #667eea; }
main { padding: 30px; }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
h2 { color: #1e293b; margin-bottom: 20px; font-size: 22px; }
h3 { color: #475569; margin: 25px 0 12px; font-size: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; background: #f8fafc; padding: 24px; border-radius: 12px; margin-bottom: 25px; border: 1px solid #e2e8f0; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid label { display: block; font-size: 13px; font-weight: 600; color: #475569; margin-bottom: 6px; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 14px; transition: border 0.2s; font-family: inherit; }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus { outline: none; border-color: #667eea; box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1); }
.btn-primary, .btn-success, .btn-info, .btn-danger, .btn-sm { padding: 12px 20px; border: none; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 14px; transition: all 0.2s; }
.btn-primary { background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; width: 100%; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(102,126,234,0.4); }
.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-info { background: #2563eb; color: #fff; }
.btn-info:hover { background: #1d4ed8; }
.btn-warning { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; }
.btn-warning:hover { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(245,158,11,0.35); }
.btn-danger { background: #dc2626; color: #fff; padding: 6px 12px; font-size: 12px; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-secondary { background: #64748b; color: #fff; padding: 5px 10px; font-size: 12px; border-radius: 6px; border: none; cursor: pointer; }
.btn-secondary:hover { background: #475569; }
.btn-link { background: none; border: none; color: #2563eb; cursor: pointer; text-decoration: underline; padding: 3px 5px; font-size: 12px; }
.btn-link:hover { color: #1d4ed8; }
.btn-toggle { background: #0ea5e9; color: #fff; padding: 5px 10px; font-size: 12px; }
.btn-toggle:hover { background: #0284c7; }
.btn-view { background: #7c3aed; color: #fff; padding: 5px 10px; font-size: 12px; }
.btn-view:hover { background: #6d28d9; }
.hint { display: block; font-size: 11px; color: #94a3b8; margin-top: 4px; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.act-belum { background: #e0e7ff; color: #3730a3; }
.act-pending { background: #fef3c7; color: #92400e; }
.act-berjalan { background: #dcfce7; color: #166534; }
.act-selesai { background: #dcfce7; color: #14532d; border:1px solid #86efac; }
.act-tunda { background: #fce7f3; color: #9d174d; }
.act-batal { background: #fee2e2; color: #7f1d1d; border:1px solid #fca5a5; }
input[type="file"] {
    padding: 8px;
    border: 2px dashed #cbd5e1;
    background: #fff;
    cursor: pointer;
}
input[type="file"]:hover { border-color: #667eea; }
.table-wrapper { overflow-x: auto; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
table { width: 100%; border-collapse: collapse; background: #fff; }
table th, table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid #e2e8f0; font-size: 14px; }
table th { background: #f1f5f9; font-weight: 700; color: #334155; position: sticky; top: 0; }
table tbody tr:hover { background: #f8fafc; }
table td:last-child { width: 140px; white-space: nowrap; }
table td:nth-last-child(2) { white-space: nowrap; }
.report-filters { display: flex; gap: 15px; align-items: flex-end; flex-wrap: wrap; background: #f8fafc; padding: 20px; border-radius: 12px; margin-bottom: 25px; }
.report-filters > div { display: flex; flex-direction: column; }
.report-filters label { font-size: 13px; font-weight: 600; color: #475569; margin-bottom: 6px; }
.report-filters select { padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 8px; min-width: 150px; }
.filter-actions { flex-direction: row !important; gap: 10px; }
.chart-card { background: linear-gradient(135deg,#fafbff,#f5f3ff); border:1px solid #e2e8f0; border-radius: 14px; padding: 22px; box-shadow: 0 4px 14px rgba(102,126,234,0.08); }
.chart-box { background:#fff; border-radius: 10px; padding: 14px; border:1px solid #e2e8f0; min-height: 350px; max-height: 420px; }
.activity-filters { margin: -10px 0 20px; padding: 14px; background:#f8fafc; border-radius:10px; border:1px solid #e2e8f0; }
.progress-wrap { height: 10px; background: #e2e8f0; border-radius: 99px; overflow: hidden; margin-top: 4px; min-width: 120px; }
.progress-bar { height: 100%; background: linear-gradient(90deg,#16a34a,#65a30d,#f59e0b,#dc2626); background-size: 300% 100%; transition: width 0.4s; }
.progress-text { font-size: 11px; color: #475569; }
#reportPreview { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 30px; font-family: 'Times New Roman', serif; }
#reportPreview h1 { text-align: center; font-size: 20px; margin-bottom: 5px; }
#reportPreview h2 { text-align: center; font-size: 16px; color: #666; font-weight: normal; margin-bottom: 25px; border-bottom: 2px solid #333; padding-bottom: 15px; }
#reportPreview .info-line { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 13px; }
#reportPreview table { margin: 15px 0; }
#reportPreview table th, #reportPreview table td { border: 1px solid #ccc; padding: 8px; font-size: 13px; }
#reportPreview .total-row { font-weight: bold; background: #f1f5f9; }
#reportPreview .sign-area { margin-top: 50px; display: flex; justify-content: space-between; }
#reportPreview .sign-box { text-align: center; width: 200px; }
.asset-split { margin-top: 20px; }
.backup-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 22px; margin-bottom: 20px; }
.backup-card { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 14px; padding: 24px; box-shadow: 0 4px 14px rgba(0,0,0,0.05); }
.backup-card h3 { margin: 0 0 10px; color: #1e293b; font-size: 17px; }
.backup-card label { display: block; font-size: 13px; font-weight: 600; color: #475569; margin: 14px 0 6px; }
.backup-card input[type="file"] { width: 100%; padding: 10px; border: 2px dashed #cbd5e1; border-radius: 8px; background: #fff; cursor: pointer; }
.muted { font-size: 13px; color: #64748b; line-height: 1.5; margin-bottom: 12px; }
.btn-block { display: block; width: 100%; margin-top: 16px; padding: 13px; font-size: 14px; }
.master-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 26px; }
.master-col { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 14px; padding: 22px; box-shadow: 0 4px 14px rgba(0,0,0,0.04); }
.master-col h3 { margin: 0 0 14px; color: #1e293b; font-size: 17px; }
button[disabled], .btn-primary:disabled, .btn-danger:disabled, .btn-success:disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(0.4); }
.stat-box { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px 14px; margin: 12px 0; }
.stat-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13px; border-bottom: 1px dashed #f1f5f9; }
.stat-row:last-child { border-bottom: none; }
.stat-row.total { margin-top: 6px; padding-top: 8px; border-top: 2px solid #e2e8f0; border-bottom: none; font-weight: 700; color: #334155; }
.checkbox-row { display: flex; gap: 10px; align-items: flex-start; margin: 18px 0 4px; padding: 10px 12px; background: #fff; border: 1px solid #fecaca; border-radius: 8px; font-size: 13px; color: #7f1d1d; cursor: pointer; line-height: 1.4; }
.checkbox-row input { transform: translateY(2px); }
.restore-info { background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: 8px; padding: 10px 12px; margin-top: 10px; font-size: 13px; color: #065f46; display: none; }
.restore-info.show { display: block; }
footer { text-align: center; padding: 20px; background: #f1f5f9; color: #64748b; font-size: 12px; }
.empty-state { text-align: center; padding: 40px; color: #94a3b8; font-style: italic; }
/* ===== Modal Detail Kegiatan ===== */
.modal { position: fixed; inset: 0; background: rgba(15,23,42,0.55); z-index: 9999; display: flex; align-items: flex-start; justify-content: center; padding: 30px 15px; overflow-y: auto; }
.modal-content { width: 100%; max-width: 960px; background: #fff; border-radius: 16px; box-shadow: 0 25px 80px rgba(0,0,0,0.3); overflow: hidden; animation: fadeIn 0.25s; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 18px 26px; background: linear-gradient(135deg,#667eea,#764ba2); color: #fff; }
.modal-header h2 { color: #fff; font-size: 18px; margin: 0; }
#mdlActBody { padding: 24px 26px; }
.mdl-section { margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid #e2e8f0; }
.mdl-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.mdl-section h4 { color: #334155; font-size: 15px; margin-bottom: 12px; padding-left: 10px; border-left: 4px solid #667eea; }
.mdl-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 10px 20px; font-size: 13px; }
.mdl-grid .k { color: #64748b; font-weight: 600; }
.mdl-grid .v { color: #0f172a; font-weight: 700; }
.attach-list { display: flex; flex-wrap: wrap; gap: 12px; }
.attach-card { width: 150px; border: 1px solid #e2e8f0; border-radius: 10px; overflow: hidden; background: #f8fafc; }
.attach-card .thumb { height: 90px; display: flex; align-items: center; justify-content: center; font-size: 28px; background: #eef2ff; color: #4f46e5; }
.attach-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.attach-card .nm { padding: 6px 8px; font-size: 11px; color: #475569; word-break: break-all; line-height: 1.2; }
.attach-card .del { width: 100%; border: none; background: #fecaca; color: #7f1d1d; padding: 4px; cursor: pointer; font-size: 11px; font-weight: 700; }
.attach-card .del:hover { background: #fca5a5; }
.inline-form { display: grid; grid-template-columns: 2fr 70px 90px 1fr auto; gap: 8px; margin-bottom: 10px; }
.inline-form input { padding: 7px 10px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 13px; }
.inline-form button { padding: 0 14px; background: #16a34a; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-weight: 700; font-size: 12px; }
@media print {
    body { background: #fff; padding: 0; }
    .container { box-shadow: none; border-radius: 0; }
    header, .tabs, .report-filters, footer, .form-grid, .activity-filters,
    td:last-child, th:last-child:not(:nth-child(2)) { display: none !important; }
    main { padding: 0; }
    #reportPreview, .chart-card { border: none; box-shadow: none; }
    .chart-card { page-break-after: always; margin-bottom: 30px; }
}
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.toast {
    min-width: 300px;
    max-width: 450px;
    padding: 14px 18px 14px 52px;
    border-radius: 12px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    position: relative;
    pointer-events: auto;
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
    display: flex;
    align-items: center;
}
.toast::before {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    font-weight: 700;
}
.toast-success { background: linear-gradient(135deg, #16a34a, #15803d); }
.toast-success::before { content: '✓'; }
.toast-warning { background: linear-gradient(135deg, #f59e0b, #d97706); }
.toast-warning::before { content: '⏳'; }
.toast-error { background: linear-gradient(135deg, #dc2626, #b91c1c); }
.toast-error::before { content: '✕'; }
.toast-info { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.toast-info::before { content: 'ℹ'; }
@keyframes slideIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes fadeOut {
    to { opacity: 0; transform: translateX(120%); }
}
.edit-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15,23,42,0.6);
    z-index: 9998;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 30px 15px;
    overflow-y: auto;
}
.edit-modal-overlay.show { display: flex; animation: fadeBg 0.2s; }
@keyframes fadeBg { from { opacity: 0; } to { opacity: 1; } }
.edit-modal {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 620px;
    box-shadow: 0 25px 80px rgba(0,0,0,0.35);
    overflow: hidden;
    animation: popIn 0.25s ease;
    margin-top: 30px;
}
@keyframes popIn {
    from { transform: scale(0.92) translateY(-10px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}
.edit-modal-header {
    padding: 18px 26px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg,#667eea,#764ba2);
    color: #fff;
}
.edit-modal-header h3 { margin: 0; color: #fff; font-size: 18px; }
.edit-modal-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 34px; height: 34px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.edit-modal-close:hover { background: rgba(255,255,255,0.35); }
.edit-modal-body { padding: 24px 26px; }
.edit-modal-footer {
    padding: 14px 26px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    background: #f8fafc;
}
.btn-edit {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    padding: 5px 11px;
    font-size: 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-right: 4px;
    font-weight: 700;
}
.btn-edit:hover { filter: brightness(1.08); transform: translateY(-1px); }
table td:last-child { width: auto; min-width: 170px; white-space: nowrap; }

/* ===================== LOGIN FIREBASE & HAK AKSES ===================== */
.auth-pending .container { display: none !important; }

.login-overlay {
    position: fixed; inset: 0; z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px; overflow: auto;
}
.login-overlay.hidden { display: none; }
.login-box {
    background: #fff; border-radius: 16px; padding: 30px;
    width: 100%; max-width: 430px; max-height: 94vh; overflow: auto;
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.35);
}
.login-logo { font-size: 42px; text-align: center; line-height: 1; margin-bottom: 8px; }
.login-box h2 { font-size: 18px; text-align: center; color: #1e293b; margin: 0 0 6px; }
.login-sub { text-align: center; color: #64748b; font-size: 13px; margin: 0 0 8px; }
.login-form label { display: block; font-size: 13px; font-weight: 600; color: #334155; margin: 13px 0 6px; }
.login-form input[type="text"], .login-form input[type="password"] {
    width: 100%; padding: 11px 13px; border: 1px solid #cbd5e1; border-radius: 8px;
    font-size: 14px; box-sizing: border-box; font-family: inherit;
}
.login-form input[type="text"]:focus, .login-form input[type="password"]:focus {
    outline: none; border-color: #667eea; box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}
.login-remember { display: flex !important; align-items: center; gap: 8px; font-weight: 500 !important; color: #475569 !important; margin-top: 14px !important; cursor: pointer; }
.login-remember input { width: auto !important; }
.login-note { padding: 11px 14px; background: #eff6ff; border-left: 4px solid #2563eb; border-radius: 8px; font-size: 13px; color: #1e3a8a; line-height: 1.55; }
.login-error { display: none; margin-top: 12px; padding: 10px 13px; background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; border-radius: 8px; font-size: 13px; line-height: 1.5; }
.login-error.show { display: block; }
.login-foot { margin-top: 18px; text-align: center; font-size: 11px; color: #94a3b8; line-height: 1.6; }
.login-link { display: block; text-align: center; margin-top: 14px; font-size: 12px; color: #667eea; background: none; border: none; cursor: pointer; text-decoration: underline; font-family: inherit; }

.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.user-badge {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(255, 255, 255, 0.2); border: 1.5px solid rgba(255, 255, 255, 0.45);
    color: #fff; padding: 8px 14px; border-radius: 20px; font-size: 13px; font-weight: 700;
}
.user-badge small { opacity: 0.85; font-weight: 500; }
.btn-logout {
    background: rgba(220, 38, 38, 0.85); border: 1.5px solid rgba(255, 255, 255, 0.5);
    color: #fff; padding: 9px 16px; border-radius: 9px; font-size: 13px; font-weight: 700; cursor: pointer;
    transition: all 0.2s;
}
.btn-logout:hover { background: #dc2626; transform: translateY(-1px); }

.perm-hidden { display: none !important; }
.perm-hide-aksi th:last-child, .perm-hide-aksi td:last-child { display: none !important; }
section.perm-readonly form.form-grid { display: none !important; }
section.perm-readonly form#myPassForm { display: grid !important; }
.perm-banner {
    margin-bottom: 18px; padding: 11px 16px; background: #fffbeb; border: 1px solid #fde68a;
    border-left: 5px solid #f59e0b; border-radius: 10px; color: #92400e; font-size: 13px; font-weight: 700;
}
.perm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 8px; }
.perm-row {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 8px 12px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px;
}
.perm-row .perm-name { font-size: 13px; font-weight: 600; color: #334155; }
.perm-row select { padding: 6px 9px; border: 1px solid #cbd5e1; border-radius: 7px; font-size: 12px; max-width: 62%; font-family: inherit; }
.perm-row select:disabled { background: #e2e8f0; color: #64748b; cursor: not-allowed; }
.perm-tag { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 11px; font-weight: 700; margin: 1px 3px 1px 0; white-space: nowrap; }
.perm-tag.edit { background: #dcfce7; color: #166534; }
.perm-tag.view { background: #dbeafe; color: #1e40af; }
.perm-tag.none { background: #f1f5f9; color: #64748b; }


