/* ===== Reset & dasar ===== */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #1f2933;
  background: #f4f6f9;
  line-height: 1.55;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; color: #111827; }
.muted { color: #6b7280; font-size: .92em; }
.container { max-width: 760px; margin: 0 auto; padding: 0 16px; }

/* ===== Tombol ===== */
.btn {
  display: inline-block; padding: 9px 16px; border-radius: 8px;
  border: 1px solid #d1d5db; background: #fff; color: #1f2933;
  font-size: .92rem; cursor: pointer; text-align: center; transition: .15s;
}
.btn:hover { background: #f3f4f6; text-decoration: none; }
.btn-primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-danger { color: #b91c1c; border-color: #fecaca; background: #fef2f2; }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { padding: 5px 10px; font-size: .82rem; }
.btn-lg { padding: 13px 26px; font-size: 1.05rem; }
.btn-block { display: block; width: 100%; }

/* ===== Form fields ===== */
label { display: block; font-weight: 600; margin-bottom: 4px; color: #374151; }
input[type=text], input[type=email], input[type=tel], input[type=url],
input[type=number], input[type=date], input[type=time], input[type=datetime-local],
input[type=password], input[type=file], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px;
  font-size: 1rem; font-family: inherit; background: #fff; color: #1f2933;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #93c5fd; border-color: #2563eb; }
textarea { resize: vertical; }
.field { margin-bottom: 18px; }
.field-label { font-weight: 600; margin-bottom: 6px; }
.field-help { color: #6b7280; font-size: .85rem; margin: 4px 0 0; }
.field-error { color: #b91c1c; font-size: .85rem; margin: 4px 0 0; }
.req { color: #dc2626; }
.options { display: flex; flex-direction: column; gap: 8px; }
.opt { display: flex; align-items: flex-start; gap: 8px; font-weight: 400; cursor: pointer; }
.opt input { width: auto; margin-top: 4px; }
.opt.consent { padding: 10px; background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px; }
.check { font-weight: 400; display: flex; align-items: center; gap: 8px; }
.check input { width: auto; }
.field-section { margin-top: 26px; }
.section-title { border-bottom: 2px solid #e5e7eb; padding-bottom: 6px; margin-bottom: 4px; }
.section-desc { margin: 0 0 6px; color: #6b7280; font-size: .9rem; }
.content-block { background: #f8fafc; border: 1px solid #e2e8f0; border-left: 4px solid #2563eb; border-radius: 8px; padding: 14px 16px; }
.content-title { margin: 0 0 8px; font-size: 1rem; }
.content-body { font-size: .93rem; color: #374151; }
.content-body p { margin: 0 0 8px; }
.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }

/* Fee estimator */
.fee-estimator {
  background: linear-gradient(135deg, #ecfdf5, #f0fdfa);
  border: 1px solid #99f6e4; border-radius: 12px; padding: 16px 18px; text-align: center;
}
.fee-estimator-title { font-size: .9rem; color: #047857; font-weight: 600; }
.fee-estimator-amount { font-size: 1.8rem; font-weight: 800; color: #065f46; margin: 4px 0; }
.fee-estimator-note { font-size: .82rem; color: #6b7280; }

/* ===== Card & layout publik ===== */
.card { background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 24px; margin-bottom: 20px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.public-header { background: #fff; border-bottom: 1px solid #e5e7eb; padding: 14px 0; }
.brand { font-weight: 700; font-size: 1.1rem; color: #111827; }
.public-footer { padding: 24px 0; text-align: center; color: #9ca3af; font-size: .85rem; }
main.container { padding-top: 24px; padding-bottom: 24px; }
.form-card h1 { margin-top: 0; }
.form-desc { margin-bottom: 20px; }
.form-actions { margin-top: 22px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.form-list { list-style: none; padding: 0; }
.form-list li { border: 1px solid #e5e7eb; border-radius: 10px; margin-bottom: 10px; }
.form-list a { display: flex; flex-direction: column; padding: 14px 16px; }
.success-card { text-align: center; }
.success-icon { width: 64px; height: 64px; border-radius: 50%; background: #d1fae5; color: #059669; font-size: 2rem; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }

/* ===== Alerts ===== */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-size: .92rem; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* ===== Badges & tables ===== */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.badge-baru { background: #dbeafe; color: #1e40af; }
.badge-review { background: #fef3c7; color: #92400e; }
.badge-diterima { background: #d1fae5; color: #065f46; }
.badge-ditolak { background: #fee2e2; color: #991b1b; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #eef0f3; vertical-align: top; font-size: .9rem; }
.table th { color: #6b7280; font-weight: 600; }
.table .actions { display: flex; flex-wrap: wrap; gap: 6px; }
.inline { display: inline; }

/* ===== Login ===== */
.admin-login { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-box { background: #fff; padding: 32px; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,.08); width: 100%; max-width: 380px; }
.login-box h1 { margin: 0 0 4px; font-size: 1.4rem; }
.login-box label { margin-top: 14px; }

/* ===== Admin shell ===== */
.admin-shell { display: flex; min-height: 100vh; }
.sidebar { width: 230px; background: #111827; color: #d1d5db; display: flex; flex-direction: column; padding: 18px 0; flex-shrink: 0; }
.sidebar-brand { font-weight: 700; color: #fff; padding: 0 20px 16px; font-size: 1.05rem; border-bottom: 1px solid #1f2937; }
.sidebar nav { display: flex; flex-direction: column; padding: 10px 0; flex: 1; }
.sidebar nav a { color: #d1d5db; padding: 11px 20px; font-size: .92rem; }
.sidebar nav a:hover { background: #1f2937; text-decoration: none; }
.sidebar nav a.active { background: #2563eb; color: #fff; }
.logout-form { padding: 12px 20px; border-top: 1px solid #1f2937; }
.logout-form button { width: 100%; background: transparent; border: 1px solid #374151; color: #d1d5db; padding: 8px; border-radius: 8px; cursor: pointer; }
.logout-form button:hover { background: #1f2937; }
.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-topbar { background: #fff; border-bottom: 1px solid #e5e7eb; padding: 14px 24px; display: flex; justify-content: space-between; align-items: center; }
.page-title { font-weight: 700; }
.user-chip { background: #eff6ff; color: #1e40af; padding: 5px 12px; border-radius: 999px; font-size: .85rem; }
.admin-content { padding: 24px; max-width: 1100px; width: 100%; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 1.2rem; }

/* Stats */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 18px; }
.stat-num { font-size: 1.9rem; font-weight: 800; }
.stat-label { color: #6b7280; font-size: .85rem; }
.stat-new .stat-num { color: #2563eb; }
.stat-ok .stat-num { color: #059669; }
.stat-review .stat-num { color: #d97706; }

/* Forms admin */
.stacked label { margin-top: 14px; }
.stacked label:first-child { margin-top: 0; }
.fieldset { border: 1px solid #e5e7eb; border-radius: 10px; padding: 14px 16px; margin-top: 16px; }
.fieldset legend { font-weight: 700; padding: 0 6px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Filter bar */
.filter-bar { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-tabs a { padding: 5px 12px; border-radius: 999px; font-size: .82rem; background: #f3f4f6; color: #374151; }
.filter-tabs a.active { background: #2563eb; color: #fff; }
.filter-search { display: flex; gap: 6px; }
.filter-search input { width: 200px; }

/* Detail */
.detail-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }
.detail-table th { width: 38%; }
.meta-info { margin: 16px 0; padding: 12px; background: #f9fafb; border-radius: 8px; font-size: .9rem; }
.meta-info p { margin: 4px 0; }

/* ===== Builder ===== */
.builder { display: grid; grid-template-columns: 260px 1fr; gap: 18px; align-items: start; }
.builder-head { align-items: flex-start; }
.builder-head-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.builder-palette { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 16px; position: sticky; top: 16px; }
.builder-palette h3 { margin: 0 0 10px; font-size: .95rem; }
.palette-list { display: flex; flex-direction: column; gap: 6px; }
.palette-item { text-align: left; padding: 8px 12px; border: 1px solid #e5e7eb; border-radius: 8px; background: #f9fafb; cursor: pointer; font-size: .86rem; }
.palette-item:hover { background: #eff6ff; border-color: #bfdbfe; }
.builder-save { margin-top: 16px; border-top: 1px solid #eef0f3; padding-top: 14px; }
.builder-status { font-size: .82rem; text-align: center; margin: 8px 0 0; min-height: 18px; }
.builder-canvas { display: flex; flex-direction: column; gap: 10px; min-height: 80px; }
.builder-empty { text-align: center; padding: 30px; border: 2px dashed #e5e7eb; border-radius: 12px; }
.fcard { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; }
.fcard-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.fcard-drag { cursor: grab; color: #9ca3af; font-size: 1.1rem; }
.fcard-type { font-size: .72rem; text-transform: uppercase; background: #eef2ff; color: #4338ca; padding: 2px 8px; border-radius: 6px; font-weight: 700; }
.fcard-title { font-weight: 600; font-size: .92rem; }
.fcard-spacer { flex: 1; }
.fcard-body { padding: 6px 14px 16px; border-top: 1px solid #f1f3f5; }
.fcard-body label { margin-top: 10px; font-size: .85rem; }
.fcard-body .grid-2 { gap: 10px; }
.fcard-opt-row { display: flex; gap: 6px; margin-bottom: 6px; }
.sortable-ghost { opacity: .4; }
.sortable-chosen { box-shadow: 0 4px 12px rgba(0,0,0,.1); }

/* Fee rules table */
.fee-table input { padding: 6px 8px; font-size: .85rem; }
.fee-table th { font-size: .78rem; }
.fee-help { margin-top: 20px; padding: 14px; background: #f9fafb; border-radius: 8px; font-size: .88rem; }
.fee-help ul { margin: 6px 0 0; padding-left: 18px; }

@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
  .builder { grid-template-columns: 1fr; }
  .builder-palette { position: static; }
  .sidebar { width: 180px; }
}
@media (max-width: 640px) {
  .admin-shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; overflow-x: auto; padding: 8px; }
  .sidebar nav { flex-direction: row; }
  .sidebar-brand, .logout-form { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}
