:root {
  --bg: #f4f7fb; --surface: #fff; --line: #e2e8f0; --ink: #14202e;
  --ink-2: #475569; --muted: #94a3b8; --accent: #2563eb; --accent-d: #1d4ed8;
  --ok-bg: #dcfce7; --ok: #15803d; --draft-bg: #fef3c7; --draft: #b45309;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--sans); background: var(--bg); color: var(--ink); line-height: 1.6; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 500;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; }
.brand:hover { text-decoration: none; }
.logo {
  background: linear-gradient(135deg, var(--accent), #22d3ee); color: #fff;
  width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center;
  font-size: 13px; font-weight: 800; letter-spacing: .5px;
}
.brand-txt { font-size: 15px; }
.topnav { display: flex; align-items: center; gap: 18px; font-size: 14px; }
.linkbtn { background: none; border: none; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }

.main { max-width: 1120px; margin: 0 auto; padding: 28px 24px 80px; }

/* hero + grid */
.hero { text-align: center; padding: 40px 0 30px; }
.hero h1 { font-size: 32px; margin: 0 0 8px; letter-spacing: -.02em; }
.hero p { color: var(--ink-2); margin: 0; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.page-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; color: var(--ink); transition: .15s; display: block;
}
.page-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(30,58,95,.12); text-decoration: none; }
.card-cover { height: 130px; background-size: cover; background-position: center; background: linear-gradient(135deg, #dbeafe, #e0f2fe); }
.card-cover-empty { display: grid; place-items: center; font-size: 40px; }
.card-body { padding: 14px 16px; }
.card-body h3 { margin: 0 0 4px; font-size: 16px; }
.card-body p { margin: 0; font-size: 13px; color: var(--ink-2); }

.empty { text-align: center; color: var(--muted); padding: 60px 0; }
.btn {
  display: inline-block; background: var(--accent); color: #fff; padding: 10px 18px;
  border-radius: 9px; border: none; cursor: pointer; font: inherit; font-weight: 600;
}
.btn:hover { background: var(--accent-d); text-decoration: none; }
.btn-sm { font-size: 13px; background: var(--surface); border: 1px solid var(--line); padding: 5px 11px; border-radius: 8px; color: var(--accent); }

/* page + blocks */
.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 28px; margin: 0 0 6px; letter-spacing: -.01em; }
.page-summary { color: var(--ink-2); margin: 6px 0 0; }
.badge-draft { background: var(--draft-bg); color: var(--draft); font-size: 11px; padding: 2px 9px; border-radius: 20px; font-weight: 600; }
.block { margin: 28px 0; }
.block-title { font-size: 18px; margin: 0 0 12px; }
.prose { max-width: 72ch; color: var(--ink-2); }
.prose :first-child { margin-top: 0; }
.map-block { width: 100%; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
.block-figure { margin: 0; }
.block-figure img { max-width: 100%; border-radius: 12px; display: block; }
.block-figure figcaption { color: var(--muted); font-size: 13px; margin-top: 6px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.data-table { border-collapse: collapse; width: 100%; font-size: 13.5px; min-width: 480px; }
.data-table th { text-align: left; background: #f1f5f9; padding: 10px 14px; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-2); }
.data-table td { padding: 9px 14px; border-top: 1px solid var(--line); }

.stat-block { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px 26px; display: inline-block; }
.stat-value { font-size: 34px; font-weight: 800; color: var(--accent); line-height: 1; }
.stat-value small { font-size: 15px; color: var(--muted); font-weight: 600; }
.stat-label { color: var(--ink-2); font-size: 13px; margin-top: 6px; }
.muted { color: var(--muted); }

/* auth */
.auth-box { max-width: 380px; margin: 40px auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 30px; }
.auth-box h1 { margin: 0 0 4px; font-size: 22px; }
.field { display: block; margin: 16px 0; }
.field span { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 5px; }
.field input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; font: inherit; }
.err { color: #dc2626; font-size: 12.5px; font-style: normal; }

/* editor */
.editor h1 { margin: 0 0 4px; }
.editor-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; margin-top: 22px; }
.ed-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.ed-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.ed-head h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); margin: 0; }
.ed-list { list-style: none; margin: 0; padding: 0; }
.ed-list li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.ed-list li:first-child { border-top: none; }
.ed-list .edit { margin-left: auto; font-size: 12px; color: var(--muted); }
.tag { font-size: 11px; background: #f1f5f9; color: var(--ink-2); padding: 1px 8px; border-radius: 12px; }
.tag-published { background: var(--ok-bg); color: var(--ok); }
.tag-draft { background: var(--draft-bg); color: var(--draft); }

@media (max-width: 640px) { .main { padding: 20px 14px 60px; } .brand-txt { display: none; } }

/* ---------------- Editor halaman (M4) ---------------- */
.ed-page { max-width: 780px; margin: 0 auto; }
.ed-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.back { font-size: 14px; }
.ed-head-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; margin-bottom: 18px; }
.ed-settings { display: flex; flex-direction: column; gap: 10px; }
.ed-title { font-size: 22px; font-weight: 700; border: none; border-bottom: 2px solid transparent; padding: 4px 0; color: var(--ink); }
.ed-title:focus { outline: none; border-bottom-color: var(--accent); }
.ed-summary { border: none; color: var(--ink-2); font-size: 14px; padding: 2px 0; }
.ed-summary:focus { outline: none; }
.ed-settings-row { display: flex; align-items: center; gap: 12px; }
.ed-settings-row select { padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.ed-slug { color: var(--muted); font-size: 12px; margin-left: auto; font-family: monospace; }

.ed-add { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.ed-add-label { font-size: 13px; color: var(--ink-2); }
.chip { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 6px 13px; font-size: 13px; cursor: pointer; color: var(--accent); font-weight: 600; }
.chip:hover { background: #eff6ff; border-color: var(--accent); }

.ed-blocklist { display: flex; flex-direction: column; gap: 12px; }
.ed-block { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.ed-block.editing { border-color: var(--accent); box-shadow: 0 0 0 3px #dbeafe; }
.ed-block-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: #f8fafc; border-bottom: 1px solid var(--line); }
.ed-block-type { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
.ed-block-tools { display: flex; gap: 4px; }
.icon { width: 30px; height: 30px; border: 1px solid var(--line); background: #fff; border-radius: 7px; cursor: pointer; font-size: 14px; color: var(--ink-2); }
.icon:hover { background: #f1f5f9; }
.icon.danger:hover { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }
.ed-block-preview { padding: 12px 14px; font-size: 13.5px; color: var(--ink-2); }
.ed-block-preview .prose { max-height: 120px; overflow: hidden; }
.ed-empty { text-align: center; color: var(--muted); padding: 30px; border: 1px dashed var(--line); border-radius: 12px; }

.ed-form { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.f { display: flex; flex-direction: column; gap: 4px; }
.f span { font-size: 12px; color: var(--ink-2); }
.f input, .f select, .f textarea { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; width: 100%; }
.f textarea { resize: vertical; font-family: monospace; font-size: 13px; }
.f-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
