:root {
  --bg: #f4f2ee;
  --panel: #ffffff;
  --ink: #1d2330;
  --muted: #6b7280;
  --line: #e7e3da;
  --brand: #1f3a5f;
  --brand-2: #2b5080;
  --gold: #c19a3e;
  --ok: #15803d;
  --ok-bg: #e7f6ec;
  --warn: #b45309;
  --warn-bg: #fdf3e2;
  --bad: #b91c1c;
  --bad-bg: #fdecec;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 6px 24px rgba(16, 24, 40, .06);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 Inter, system-ui, -apple-system, 'Segoe UI', sans-serif; }
a { color: var(--brand-2); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* ---------- tombol & form ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 15px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; font-weight: 600; font-size: 13.5px; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
}
.btn:hover { border-color: #cfc8b8; background: #fbfaf7; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: 0 4px 14px rgba(31, 58, 95, .25); }
.btn.primary:hover { background: var(--brand-2); }
.btn.gold { background: linear-gradient(135deg, #d6b25e, #b08530); color: #fff; border-color: #b08530; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); border-color: #f3c3c3; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(0, 0, 0, .04); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn.icon { width: 34px; padding: 0; height: 34px; }
.btn.block { width: 100%; }

label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 12.5px; font-weight: 600; color: #4b5563; margin-bottom: 5px; }
label.f > small, .hint { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.inp, select.inp, textarea.inp {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea.inp { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.inp:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(43, 80, 128, .14); }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.chk { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 13.5px; }
.chk input { width: 16px; height: 16px; accent-color: var(--brand); }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art {
  position: relative; overflow: hidden; color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: flex-end;
  background: radial-gradient(1200px 600px at -10% 110%, #b08530 0%, transparent 55%), linear-gradient(140deg, #0f2440, #1f3a5f 55%, #2b5080);
}
.login-art .ring { position: absolute; border: 1px solid rgba(214, 178, 94, .35); border-radius: 50%; }
.login-art h1 { font-family: 'Playfair Display', serif; font-size: 44px; font-weight: 700; max-width: 520px; }
.login-art p { opacity: .8; max-width: 460px; font-size: 15px; }
.login-art .mini-cert { position: absolute; top: 9%; right: 8%; width: 62%; transform: rotate(-4deg); border-radius: 6px; box-shadow: 0 30px 60px rgba(0, 0, 0, .35); }
.login-box { display: flex; align-items: center; justify-content: center; padding: 32px; }
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-size: 26px; margin-bottom: 6px; }
.login-card p.sub { color: var(--muted); margin: 0 0 26px; }
.logo-mark { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, #d6b25e, #b08530); color: #fff; margin-bottom: 20px; }
.logo-mark svg { width: 24px; height: 24px; }
.alert { padding: 10px 13px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; }
.alert.bad { background: var(--bad-bg); color: var(--bad); }
.alert.info { background: #eef4fb; color: #1e40af; }
.alert.warn { background: var(--warn-bg); color: var(--warn); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side {
  background: linear-gradient(180deg, #102641, #1a3355); color: #d9e2ee; padding: 22px 14px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 24px; }
.brand .logo-mark { width: 38px; height: 38px; margin: 0; border-radius: 10px; }
.brand b { display: block; color: #fff; font-size: 15px; }
.brand small { color: #9fb1c8; font-size: 11.5px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; color: #c4d0df; text-decoration: none; border-radius: 10px; margin-bottom: 3px; font-weight: 500;
}
.nav a svg { width: 18px; height: 18px; opacity: .85; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.on { background: rgba(214, 178, 94, .16); color: #f4dfa9; }
.side .foot { margin-top: auto; padding: 12px; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 12.5px; }
.side .foot .btn { margin-top: 10px; background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .1); color: #fff; }
.main { padding: 28px 34px 60px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.topbar h1 { font-size: 24px; font-weight: 700; }
.topbar .crumb { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.topbar .crumb a { color: var(--muted); text-decoration: none; }
.topbar .crumb a:hover { color: var(--brand); }
.mobile-bar { display: none; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 20px; }
.card h3 { font-size: 15px; margin-bottom: 14px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat { padding: 18px 20px; position: relative; overflow: hidden; }
.stat .k { color: var(--muted); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.stat .v { font-size: 30px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .ic { position: absolute; right: 16px; top: 16px; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.stat .ic svg { width: 20px; height: 20px; }

/* ---------- events ---------- */
.ev-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.ev-card { cursor: pointer; overflow: hidden; transition: transform .15s, box-shadow .15s; display: flex; flex-direction: column; }
.ev-card:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(16, 24, 40, .1); }
.ev-thumb { height: 150px; position: relative; overflow: hidden; border-bottom: 1px solid var(--line); background: #faf8f3; }
.ev-thumb .cert-frame { position: absolute; left: 50%; top: 14px; width: 230px; transform: translateX(-50%); box-shadow: 0 6px 18px rgba(0, 0, 0, .15); }
.ev-body { padding: 14px 16px 16px; flex: 1; display: flex; flex-direction: column; }
.ev-body h4 { font-size: 15px; margin-bottom: 6px; }
.ev-meta { color: var(--muted); font-size: 12.5px; display: flex; flex-direction: column; gap: 3px; }
.ev-meta span { display: flex; gap: 6px; align-items: center; }
.ev-meta svg { width: 14px; height: 14px; flex: none; }
.ev-foot { display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.pill { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #f1efe9; color: #4b5563; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.blue { background: #eaf1fb; color: #1e4f8f; }

.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty svg { width: 46px; height: 46px; opacity: .4; margin-bottom: 8px; }
.empty h3 { color: var(--ink); margin-bottom: 6px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 10px 16px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; gap: 7px; align-items: center; white-space: nowrap; }
.tabs a svg { width: 16px; height: 16px; }
.tabs a.on { color: var(--brand); border-color: var(--gold); }

/* ---------- tabel ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .search { position: relative; flex: 1; min-width: 200px; max-width: 340px; }
.toolbar .search svg { position: absolute; left: 11px; top: 11px; width: 16px; height: 16px; color: var(--muted); }
.toolbar .search input { padding-left: 34px; }
.toolbar .spacer { flex: 1; }
.selbar { display: flex; align-items: center; gap: 10px; padding: 9px 14px; background: #fbf6e8; border: 1px solid #efe0b9; border-radius: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; padding: 11px 12px; border-bottom: 1px solid var(--line); background: #fbfaf7; white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid #f0ede6; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: #fcfbf8; }
.tbl .num { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 12.5px; white-space: nowrap; }
.tbl .acts { display: flex; gap: 2px; justify-content: flex-end; }
.tbl .nm { font-weight: 600; min-width: 200px; }
.tbl .sub { color: var(--muted); font-size: 12px; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

/* ---------- editor desain ---------- */
.designer { display: grid; grid-template-columns: 420px 1fr; gap: 22px; align-items: start; }
.designer .controls { display: flex; flex-direction: column; gap: 12px; }
.sect { overflow: hidden; }
.sect > summary { list-style: none; cursor: pointer; padding: 14px 18px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.sect > summary::-webkit-details-marker { display: none; }
.sect > summary svg { width: 17px; height: 17px; color: var(--gold); }
.sect > summary::after { content: ''; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid #999; border-bottom: 2px solid #999; transform: rotate(45deg); transition: transform .2s; }
.sect[open] > summary::after { transform: rotate(-135deg); }
.sect .body { padding: 4px 18px 16px; }
.preview-col { position: sticky; top: 16px; }
.preview-box { padding: 18px; background: repeating-conic-gradient(#efece5 0 25%, #f7f5f0 0 50%) 50% / 22px 22px; border-radius: var(--radius); border: 1px solid var(--line); }
.preview-box .cert-frame { box-shadow: 0 18px 40px rgba(0, 0, 0, .18); border-radius: 3px; }
.preview-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; align-items: center; }
.save-state { color: var(--muted); font-size: 12.5px; margin-left: auto; }

.theme-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.theme-opt { border: 2px solid transparent; border-radius: 10px; padding: 6px; cursor: pointer; background: #faf8f4; transition: border-color .15s; }
.theme-opt:hover { border-color: #ddd3bd; }
.theme-opt.on { border-color: var(--gold); background: #fdf8ec; }
.theme-opt .cert-frame { border-radius: 4px; box-shadow: 0 2px 6px rgba(0, 0, 0, .12); pointer-events: none; }
.theme-opt b { display: block; font-size: 12px; text-align: center; margin-top: 6px; }

.color-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.color-row > span { flex: 1; font-weight: 600; font-size: 13px; color: #4b5563; }
.color-row input[type=color] { width: 44px; height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: #fff; cursor: pointer; }
.color-row code { font-size: 12px; color: var(--muted); width: 66px; }

.img-field { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.img-field .thumb { width: 64px; height: 64px; border-radius: 10px; border: 1px dashed #d4ccb9; display: grid; place-items: center; background: repeating-conic-gradient(#f1eee7 0 25%, #fff 0 50%) 50% / 12px 12px; overflow: hidden; flex: none; }
.img-field .thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.img-field .thumb svg { width: 22px; height: 22px; color: #b9ae94; }
.img-field .meta { flex: 1; min-width: 0; }
.img-field .meta b { display: block; font-size: 13px; margin-bottom: 6px; }
.img-field .meta .btns { display: flex; gap: 6px; flex-wrap: wrap; }

.kop-line { display: grid; grid-template-columns: 1fr 64px 34px 34px; gap: 6px; margin-bottom: 6px; align-items: center; }
.kop-line .inp { height: 34px; }
.bold-tg { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-weight: 800; cursor: pointer; }
.bold-tg.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.signer-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; background: #fdfcf9; }
.signer-card .hd { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.signer-card .hd b { flex: 1; }
.range-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.range-row span { width: 120px; font-size: 13px; font-weight: 600; color: #4b5563; }
.range-row input { flex: 1; accent-color: var(--brand); }
.range-row output { width: 40px; text-align: right; font-size: 12px; color: var(--muted); }
.ph-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.ph-list code { background: #f1ede3; padding: 2px 7px; border-radius: 6px; font-size: 11.5px; cursor: pointer; }
.ph-list code:hover { background: #e7dfcc; }

/* ---------- modal & toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow-y: auto; animation: fade .15s; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 520px; box-shadow: 0 30px 80px rgba(0, 0, 0, .3); animation: pop .18s; }
.modal.wide { max-width: 980px; }
.modal.mid { max-width: 720px; }
.modal .mh { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal .mh h3 { font-size: 17px; }
.modal .mb { padding: 20px 22px; }
.modal .mf { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); background: #fbfaf7; border-radius: 0 0 16px 16px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 80; }
.toast { background: #1d2330; color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); font-size: 13.5px; max-width: 360px; animation: pop .2s; display: flex; gap: 9px; align-items: flex-start; }
.toast.ok { background: #14532d; }
.toast.bad { background: #7f1d1d; }
.toast svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }

.progress { height: 10px; background: #efece5; border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--gold)); transition: width .25s; }
.log { max-height: 220px; overflow: auto; font-size: 12.5px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-top: 12px; background: #fcfbf8; }
.log div { padding: 3px 0; border-bottom: 1px dashed #eee8db; }
.log .ok { color: var(--ok); }
.log .bad { color: var(--bad); }
.busy { position: fixed; inset: 0; background: rgba(255, 255, 255, .7); backdrop-filter: blur(2px); z-index: 90; display: grid; place-items: center; }
.busy .box { background: #fff; padding: 22px 28px; border-radius: 14px; box-shadow: var(--shadow); display: flex; gap: 14px; align-items: center; font-weight: 600; }
.spinner { width: 22px; height: 22px; border: 3px solid #e5dfd1; border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.map-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.drop { border: 2px dashed #d8cfba; border-radius: 14px; padding: 30px; text-align: center; background: #fdfbf6; cursor: pointer; transition: background .15s, border-color .15s; }
.drop:hover, .drop.over { background: #f8f1e0; border-color: var(--gold); }
.drop svg { width: 36px; height: 36px; color: var(--gold); }

@media (max-width: 1180px) {
  .designer { grid-template-columns: 1fr; }
  .preview-col { position: static; order: -1; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 60; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .mobile-bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: #102641; color: #fff; position: sticky; top: 0; z-index: 40; }
  .mobile-bar .btn { background: transparent; border-color: rgba(255, 255, 255, .2); color: #fff; }
  .main { padding: 18px 16px 50px; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .grid2, .map-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
}
