:root {
  --color-primary: #0f6e4f;
  --color-primary-dark: #0a4f38;
  --color-danger: #b3261e;
  --color-warning: #8a5a00;
  --color-bg: #f4f6f5;
  --color-card: #ffffff;
  --color-border: #dde3e0;
  --color-text: #1c2321;
  --color-text-muted: #5b6462;
  --radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 14px;
}
.hidden { display: none !important; }

/* ---------------- Login ---------------- */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f6e4f, #0a4f38);
}
.login-card {
  background: var(--color-card);
  padding: 32px;
  border-radius: var(--radius);
  width: 340px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  text-align: center;
}
.login-logo { width: 64px; height: 64px; object-fit: contain; margin-bottom: 8px; }
.login-card h1 { font-size: 18px; margin: 4px 0; }
.login-sub { color: var(--color-text-muted); margin-bottom: 20px; font-size: 13px; }
.login-card form { text-align: left; display: flex; flex-direction: column; gap: 12px; }
.login-card label { font-size: 13px; font-weight: 600; display: flex; flex-direction: column; gap: 4px; }
.login-card input { padding: 9px 10px; border: 1px solid var(--color-border); border-radius: 6px; font-size: 14px; }

/* ---------------- Layout ---------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-card);
  border-bottom: 1px solid var(--color-border);
  padding: 0 20px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.logo { width: 30px; height: 30px; object-fit: contain; }
.app-title { font-weight: 700; color: var(--color-primary-dark); }
.topbar-nav { display: flex; gap: 18px; }
.topbar-nav a { color: var(--color-text-muted); text-decoration: none; font-weight: 600; padding: 6px 2px; border-bottom: 2px solid transparent; }
.topbar-nav a.active { color: var(--color-primary-dark); border-bottom-color: var(--color-primary); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-info { font-size: 13px; color: var(--color-text-muted); }
.view-root { max-width: 1100px; margin: 0 auto; padding: 20px; }

/* ---------------- Buttons ---------------- */
.btn {
  border: 1px solid var(--color-border);
  background: #fff;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--color-text);
}
.btn:hover { background: #f0f2f1; }
.btn-primary { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-danger { background: var(--color-danger); border-color: var(--color-danger); color: #fff; }
.btn-warning { background: #fff; border-color: var(--color-warning); color: var(--color-warning); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---------------- Cards / tables ---------------- */
.card { background: var(--color-card); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card h2 { margin-top: 0; font-size: 16px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { background: var(--color-card); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 14px; }
.stat-card .stat-num { font-size: 24px; font-weight: 700; color: var(--color-primary-dark); }
.stat-card .stat-label { font-size: 12px; color: var(--color-text-muted); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
table th, table td { padding: 8px 10px; border-bottom: 1px solid var(--color-border); text-align: left; }
table th { color: var(--color-text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
table tr.task-row { background: #fff8e8; }
table tr:hover { background: #f7f9f8; }
.table-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge-DRAFT { background: #e5e7eb; color: #374151; }
.badge-DIAJUKAN, .badge-TERVERIFIKASI, .badge-DIREKOMENDASIKAN, .badge-DIREKOMENDASIKAN_TOLAK { background: #fef3c7; color: #92400e; }
.badge-PERLU_PERBAIKAN { background: #fee2e2; color: #991b1b; }
.badge-DISETUJUI { background: #d1fae5; color: #065f46; }
.badge-DITOLAK, .badge-DITOLAK_ADMIN, .badge-DIBATALKAN { background: #e5e7eb; color: #6b7280; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filters input, .filters select { padding: 7px 8px; border: 1px solid var(--color-border); border-radius: 6px; font-size: 13px; }

/* ---------------- Forms ---------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; font-weight: 700; color: var(--color-text-muted); }
.field input, .field select, .field textarea {
  padding: 8px 10px; border: 1px solid var(--color-border); border-radius: 6px; font-size: 13px; font-family: inherit;
}
.field .err { color: var(--color-danger); font-size: 12px; }
.form-error { background: #fee2e2; color: #991b1b; padding: 8px 10px; border-radius: 6px; font-size: 13px; }
.form-actions { display: flex; gap: 10px; margin-top: 16px; }

/* ---------------- Misc ---------------- */
.muted { color: var(--color-text-muted); }
.section-title { font-size: 13px; font-weight: 700; color: var(--color-text-muted); text-transform: uppercase; margin: 18px 0 8px; }
.timeline-item { border-left: 2px solid var(--color-border); padding: 6px 0 6px 14px; margin-left: 4px; font-size: 13px; }
.timeline-item .meta { color: var(--color-text-muted); font-size: 12px; }
.attachment-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--color-border); font-size: 13px; }
.comment-item { padding: 8px 0; border-bottom: 1px solid var(--color-border); font-size: 13px; }
.comment-item .meta { color: var(--color-text-muted); font-size: 12px; }
.pagination { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--color-border); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { background: none; border: none; padding: 8px 12px; font-weight: 600; color: var(--color-text-muted); cursor: pointer; border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--color-primary-dark); border-bottom-color: var(--color-primary); }

/* ---------------- Toast / dialog ---------------- */
.toast-root { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: #1c2321; color: #fff; padding: 10px 14px; border-radius: 6px; font-size: 13px; max-width: 320px; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.toast.error { background: var(--color-danger); }
.toast.success { background: var(--color-primary-dark); }

.dialog-root { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 200; }
.dialog-box { background: #fff; padding: 20px; border-radius: var(--radius); width: 420px; max-width: 90vw; }
.dialog-box h3 { margin-top: 0; }
.dialog-box textarea { width: 100%; min-height: 70px; padding: 8px; border: 1px solid var(--color-border); border-radius: 6px; font-family: inherit; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }

  /* Header: di layar sempit disusun jadi 2 baris supaya tidak berdesakan/menumpuk -
     baris 1 = logo + tombol keluar, baris 2 = menu navigasi memenuhi lebar. */
  .topbar {
    flex-wrap: wrap;
    height: auto;
    min-height: 56px;
    padding: 10px 14px;
    row-gap: 8px;
  }
  .topbar-left { flex: 1 1 auto; min-width: 0; }
  .app-title { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-right { order: 2; flex: 0 0 auto; gap: 8px; }
  .user-info { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-nav {
    order: 3;
    flex: 1 1 100%;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
  }
  .view-root { padding: 14px; }
}
