:root {
  --bg: #f1f5f9;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #0f766e;
  --brand-2: #14b8a6;
  --blue: #2563eb;
  --amber: #f59e0b;
  --red: #dc2626;
  --pink: #db2777;
  --violet: #7c3aed;
  --slate: #64748b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px -12px rgba(15, 23, 42, .18);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px;
  flex: 0 0 250px;
  background: linear-gradient(180deg, #0f766e 0%, #115e59 100%);
  color: #e2f5f2;
  padding: 20px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.brand .logo {
  width: 38px; height: 38px; border-radius: 10px;
  background: rgba(255,255,255,.16); display: grid; place-items: center;
  font-weight: 700; font-size: 16px; color: #fff;
}
.brand h1 { font-size: 15px; margin: 0; line-height: 1.25; color: #fff; }
.brand span { font-size: 11px; opacity: .75; display: block; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav button {
  display: flex; align-items: center; gap: 10px;
  background: transparent; border: 0; color: #d3ece9;
  padding: 10px 12px; border-radius: 10px; cursor: pointer;
  font-size: 13.5px; text-align: left; font-family: inherit;
}
.nav button:hover { background: rgba(255,255,255,.10); color: #fff; }
.nav button.active { background: rgba(255,255,255,.18); color: #fff; font-weight: 600; }
.nav .ico { width: 18px; text-align: center; font-size: 15px; }
.nav .grup { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; opacity: .55; margin: 16px 0 6px 12px; }

.main { flex: 1; min-width: 0; padding: 22px 26px 60px; }

.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.topbar h2 { margin: 0; font-size: 21px; }
.topbar p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.bar-peran { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-bottom: 14px; flex-wrap: wrap; }

/* ---------- komponen ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card h3 { margin: 0 0 4px; font-size: 15px; }
.card .sub { color: var(--muted); font-size: 12.5px; margin: 0 0 14px; }

.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.c5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1200px) { .grid.c5, .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.c3 { grid-template-columns: 1fr; } }

.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.kpi .label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi .nilai { font-size: 20px; font-weight: 700; margin-top: 8px; letter-spacing: -.02em; }
.kpi .ket { font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.kpi.teal { border-top: 3px solid var(--brand); }
.kpi.blue { border-top: 3px solid var(--blue); }
.kpi.amber { border-top: 3px solid var(--amber); }
.kpi.red { border-top: 3px solid var(--red); }
.kpi.violet { border-top: 3px solid var(--violet); }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid #f1f5f9; font-size: 13px; vertical-align: middle; }
tbody tr:hover { background: #f8fafc; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wrap-table { overflow-x: auto; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge.green { background: #dcfce7; color: #15803d; }
.badge.blue { background: #dbeafe; color: #1d4ed8; }
.badge.amber { background: #fef3c7; color: #b45309; }
.badge.red { background: #fee2e2; color: #b91c1c; }
.badge.gray { background: #f1f5f9; color: #475569; }
.badge.violet { background: #ede9fe; color: #6d28d9; }
.badge.pink { background: #fce7f3; color: #be185d; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 8px 13px; border-radius: 9px; cursor: pointer; font-size: 13px; font-family: inherit; font-weight: 500;
}
.btn:hover { background: #f8fafc; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #0d5f59; }
.btn.blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.blue:hover { background: #1d4ed8; }
.btn.danger { color: var(--red); border-color: #fecaca; }
.btn.danger:hover { background: #fef2f2; }
.btn.sm { padding: 5px 9px; font-size: 12px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

input, select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px;
  font-size: 13px; font-family: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #99f6e4; border-color: var(--brand-2); }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
.hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }
.toolbar input[type="search"] { max-width: 260px; }
.toolbar input[type="month"] { max-width: 170px; }

.progress { height: 7px; background: #e2e8f0; border-radius: 999px; overflow: hidden; min-width: 90px; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-2), var(--brand)); border-radius: 999px; }

.donut-wrap { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.donut { width: 190px; height: 190px; border-radius: 50%; position: relative; flex: 0 0 auto; }
.donut::after { content: ""; position: absolute; inset: 26px; background: #fff; border-radius: 50%; }
.donut .tengah { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; z-index: 2; }
.donut .tengah b { display: block; font-size: 15px; }
.donut .tengah span { font-size: 11px; color: var(--muted); }

.legend { display: flex; flex-direction: column; gap: 9px; min-width: 240px; flex: 1; }
.legend .baris { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.legend .dot { width: 11px; height: 11px; border-radius: 3px; }
.legend .nm { color: var(--ink); }
.legend .vl { font-weight: 600; font-variant-numeric: tabular-nums; }

.bar-row { display: grid; grid-template-columns: 190px 1fr 62px; gap: 12px; align-items: center; margin-bottom: 12px; font-size: 13px; }
.bar-track { height: 22px; background: #f1f5f9; border-radius: 7px; overflow: hidden; position: relative; }
.bar-track > i { display: block; height: 100%; border-radius: 7px; }

.list { display: flex; flex-direction: column; }
.list .item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid #f1f5f9; }
.list .item:last-child { border-bottom: 0; }
.list .item .tgl { font-size: 11.5px; color: var(--muted); white-space: nowrap; min-width: 78px; }
.list .item .isi { flex: 1; font-size: 13px; }
.list .item .isi small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .55); display: grid; place-items: center; padding: 24px; z-index: 60; }
.modal { background: #fff; border-radius: 16px; width: min(760px, 100%); max-height: 88vh; overflow: auto; box-shadow: 0 30px 70px -25px rgba(15,23,42,.5); }
.modal header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 2; }
.modal header h3 { margin: 0; font-size: 16px; }
.modal header .sub { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.modal .body { padding: 20px; }
.modal footer { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; position: sticky; bottom: 0; background: #fff; }
.icon-btn { background: transparent; border: 0; font-size: 20px; line-height: 1; color: var(--muted); cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.icon-btn:hover { background: #f1f5f9; }

.email-frame { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.email-frame iframe { width: 100%; height: 460px; border: 0; }

.toast { position: fixed; right: 22px; bottom: 22px; z-index: 90; display: flex; flex-direction: column; gap: 10px; }
.toast .pesan { background: #0f172a; color: #fff; padding: 12px 16px; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow); max-width: 380px; }
.toast .pesan.ok { background: #0f766e; }
.toast .pesan.err { background: #b91c1c; }

.empty { text-align: center; padding: 34px 16px; color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.section-title { font-size: 13px; font-weight: 700; margin: 0 0 10px; }

.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.info-box { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; }
.info-box .l { font-size: 11.5px; color: var(--muted); }
.info-box .v { font-size: 15px; font-weight: 700; margin-top: 4px; }

.alert { border-radius: 10px; padding: 12px 14px; font-size: 13px; margin-bottom: 14px; border: 1px solid; }
.alert.warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert.info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.alert.ok { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }

.checkbox { width: 16px; height: 16px; cursor: pointer; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- profil koperasi ---------- */
textarea { resize: vertical; min-height: 70px; }

/* ---------- pengajuan pembiayaan (timeline persetujuan) ---------- */
.tl-item { display: flex; gap: 12px; }
.tl-titik { width: 26px; display: flex; flex-direction: column; align-items: center; flex: none; }
.tl-bulat { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #fff; font-weight: 700; background: #cbd5e1; }
.tl-bulat.ok { background: #059669; }
.tl-bulat.no { background: #dc2626; }
.tl-garis { flex: 1; width: 2px; background: var(--line); margin: 2px 0; min-height: 14px; }
.tl-isi { padding-bottom: 16px; }
.tl-nama { font-size: 13.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-ket { font-size: 12.5px; color: var(--muted); margin-top: 2px; word-break: break-word; }

/* ---------- usaha dagang ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: #fff; color: var(--muted); padding: 8px 14px; border-radius: 999px; cursor: pointer; font-size: 13px; font-family: inherit; font-weight: 500; }
.tab:hover { background: #f8fafc; }
.tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.tab .jml { background: rgba(15, 23, 42, .08); border-radius: 999px; padding: 1px 8px; font-size: 11px; font-weight: 600; }
.tab.active .jml { background: rgba(255, 255, 255, .25); }
.udg-items input { padding: 6px 8px; font-size: 12.5px; }

/* ---------- laporan & cetak ---------- */
.lap-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; flex-wrap: wrap; }
.lap-nama { font-size: 17px; font-weight: 700; }
.lap-alamat { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.lap-kanan { text-align: right; }
.lap-judul { font-size: 14px; font-weight: 700; letter-spacing: .06em; }
.lap-periode { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

.baris-awal td, .baris-akhir td { background: #f8fafc; }
.baris-setoran td { background: #f1f5f9; }
.baris-akhir td { border-top: 2px solid var(--line); }

.lap-ttd { display: flex; justify-content: space-between; gap: 24px; margin-top: 34px; flex-wrap: wrap; }
.ttd-blok { text-align: center; font-size: 12.5px; min-width: 200px; flex: 1; }
.ttd-label { color: var(--muted); }
.ttd-ruang { height: 64px; }
.ttd-nama { font-weight: 600; border-top: 1px solid var(--ink); padding-top: 5px; display: inline-block; min-width: 180px; }

.lap-footer { margin-top: 22px; font-size: 11px; color: var(--muted); text-align: right; }

@media print {
  body { background: #fff; font-size: 12px; }
  .sidebar, .topbar, .no-print, .toast, .modal-backdrop { display: none !important; }
  .app { display: block; }
  .main { padding: 0; }
  .card { box-shadow: none; border: 0; border-radius: 0; padding: 0; }
  .card + .card { margin-top: 12px; }
  .wrap-table { overflow: visible; }
  .grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpi { box-shadow: none; break-inside: avoid; }
  tr { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
  @page { margin: 12mm; }
}
