* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
  background: #f1f4f8;
  color: #1f2937;
}
a { text-decoration: none; color: inherit; }

/* ---------- LOGIN ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #5F7A56 0%, #6B8862 100%);
}
.login-box {
  background: #fff; border-radius: 12px; padding: 40px; width: 380px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.login-box h1 { font-size: 20px; margin-bottom: 4px; color: #5F7A56; }
.login-box p.sub { color: #6b7280; font-size: 13px; margin-bottom: 24px; }
.login-box label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 6px; }
.login-box input {
  width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px;
}
.login-box button {
  width: 100%; margin-top: 22px; padding: 11px; background: #5F7A56; color: #fff; border: none;
  border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.login-box button:hover { background: #4F6449; }
.login-error { background: #fee2e2; color: #b91c1c; padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 10px; }
.login-hint { margin-top: 18px; font-size: 12px; color: #9ca3af; text-align: center; }

/* ---------- APP LAYOUT ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px; background: #3E4F38; color: #e5f2ea; flex-shrink: 0;
  display: flex; flex-direction: column;
}
.sidebar .brand { padding: 20px 18px; font-weight: 700; font-size: 15px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar .brand small { display: block; font-weight: 400; opacity: .7; font-size: 11px; margin-top: 2px; }
.sidebar nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 18px; font-size: 13.5px;
  color: #DCE8D6; border-left: 3px solid transparent;
}
.sidebar nav a:hover, .sidebar nav a.active { background: rgba(255,255,255,0.08); border-left-color: #A8C6A0; color: #fff; }
.sidebar .user-box { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,0.1); font-size: 12.5px; }
.sidebar .user-box .role-badge {
  display: inline-block; margin-top: 4px; background: #6B8862; padding: 2px 8px; border-radius: 20px; font-size: 10.5px;
}
.sidebar .logout-btn { display: block; margin-top: 8px; color: #fca5a5; font-size: 12px; }

.main { flex: 1; padding: 26px 30px; max-width: 1200px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.topbar h1 { font-size: 21px; color: #111827; }
.topbar .breadcrumb { font-size: 12.5px; color: #9ca3af; margin-top: 3px; }

.card { background: #fff; border-radius: 10px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); margin-bottom: 20px; }
.card h2 { font-size: 15px; margin-bottom: 14px; color: #111827; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card { background: #fff; border-radius: 10px; padding: 18px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); border-left: 4px solid #5F7A56; }
.stat-card .num { font-size: 26px; font-weight: 700; color: #3E4F38; }
.stat-card .label { font-size: 12.5px; color: #6b7280; margin-top: 4px; }

table.dtable { width: 100%; border-collapse: collapse; font-size: 13px; }
table.dtable th { text-align: left; background: #f3f6f4; padding: 9px 10px; font-weight: 600; color: #374151; border-bottom: 2px solid #e5e7eb; }
table.dtable td { padding: 9px 10px; border-bottom: 1px solid #f0f0f0; vertical-align: top; }
table.dtable tr:hover td { background: #fafdfb; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-yellow { background: #fef9c3; color: #854d0e; }
.badge-gray { background: #f3f4f6; color: #4b5563; }
.badge-blue { background: #dbeafe; color: #1e40af; }

.btn { display: inline-block; padding: 8px 16px; border-radius: 7px; font-size: 13px; font-weight: 600; border: none; cursor: pointer; }
.btn-primary { background: #5F7A56; color: #fff; }
.btn-primary:hover { background: #4F6449; }
.btn-outline { background: #fff; border: 1px solid #d1d5db; color: #374151; }
.btn-outline:hover { background: #f9fafb; }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-danger { background: #fee2e2; color: #b91c1c; }

form .form-row { margin-bottom: 14px; }
form label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: #374151; }
form input[type=text], form input[type=date], form input[type=password], form select, form textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #d1d5db; border-radius: 7px; font-size: 13.5px; font-family: inherit;
}
form textarea { resize: vertical; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.checklist-box { max-height: 260px; overflow-y: auto; border: 1px solid #e5e7eb; border-radius: 8px; padding: 10px; }
.checklist-box .grp-title { font-weight: 700; font-size: 12px; color: #5F7A56; margin: 10px 0 4px; text-transform: uppercase; }
.checklist-box label { display: flex; align-items: center; gap: 7px; font-weight: 400; font-size: 13px; padding: 3px 0; }

.kegiatan-row { border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px; margin-bottom: 10px; position: relative; background: #fafafa; }
.kegiatan-row .remove-row { position: absolute; top: 8px; right: 10px; color: #ef4444; cursor: pointer; font-size: 12px; font-weight: 600; }

.alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-error { background: #fee2e2; color: #b91c1c; }

.empty-state { text-align: center; padding: 40px 20px; color: #9ca3af; font-size: 13.5px; }

/* ---------- MODAL EDIT ---------- */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  align-items: center; justify-content: center; z-index: 100;
}
.modal-overlay.open { display: flex; }
.modal-box { background: #fff; border-radius: 10px; padding: 22px; width: 420px; max-width: 92vw; box-shadow: 0 20px 50px rgba(0,0,0,0.3); }
.modal-box h3 { font-size: 15px; margin-bottom: 14px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* ---------- CETAK / PRINT ---------- */
.print-page {
  width: 210mm; min-height: 297mm; margin: 20px auto; background: #fff; padding: 18mm 20mm;
  box-shadow: 0 0 12px rgba(0,0,0,0.15); font-family: 'Times New Roman', Times, serif; font-size: 12pt; color: #000;
}
.kop { display: flex; align-items: center; gap: 14px; border-bottom: 3px solid #000; padding-bottom: 8px; margin-bottom: 4px; }
.kop .logo-box { width: 70px; height: 70px; flex-shrink: 0; display:flex; align-items:center; justify-content:center; }
.kop .logo-box img { max-width: 100%; max-height: 100%; }
.kop .kop-text { text-align: center; flex: 1; }
.kop .kop-text .yayasan { font-size: 10.5pt; font-weight: bold; }
.kop .kop-text .univ { font-size: 17pt; font-weight: bold; letter-spacing: 0.5px; }
.kop .kop-text .alamat { font-size: 9.5pt; margin-top: 2px; }
.kop-line2 { border-bottom: 1px solid #000; margin-bottom: 14px; }
.surat-meta { margin-bottom: 12px; font-size: 12pt; }
.surat-meta table td { vertical-align: top; padding: 1px 0; }
.surat-meta table td.label { width: 90px; }
.surat-meta table td.colon { width: 12px; }
.yth-block { margin: 10px 0; }
.yth-block .yth-title { margin-bottom: 4px; }
.yth-table { width: 100%; border-collapse: collapse; }
.yth-table td { padding: 1px 8px 1px 0; font-size: 12pt; vertical-align: top; }
.surat-body p { margin-bottom: 10px; text-align: justify; line-height: 1.5; }
.kegiatan-table { width: 100%; margin: 6px 0 12px 30px; width: calc(100% - 30px); border-collapse: collapse; }
.kegiatan-table td { padding: 1px 8px 1px 0; vertical-align: top; font-size: 12pt; }
.kegiatan-table td.label-col { width: 110px; }
.kegiatan-multitable { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 11.5pt; }
.kegiatan-multitable th, .kegiatan-multitable td { border: 1px solid #000; padding: 5px 8px; text-align: left; }
.kegiatan-multitable th { background: #f0f0f0; }
.ttd-block { margin-top: 24px; text-align: right; }
.ttd-block .ttd-inner { display: inline-block; text-align: center; min-width: 260px; }
.ttd-space { height: 70px; }
.catatan-block { margin-top: 20px; font-size: 11.5pt; }
.print-toolbar { text-align: center; padding: 14px; background: #3E4F38; position: sticky; top: 0; z-index: 10; }
.print-toolbar button, .print-toolbar a { margin: 0 6px; padding: 9px 18px; border-radius: 7px; border: none; font-size: 13px; font-weight: 600; cursor: pointer; }
@media print {
  .print-toolbar { display: none; }
  .print-page { box-shadow: none; margin: 0; width: auto; min-height: auto; }
  body { background: #fff; }
}
