/* Reboister Web - stylesheet mandiri (tanpa CDN). */
:root {
  --bg: #F4F7F4;
  --surface: #FFFFFF;
  --surface-2: #EDF2ED;
  --soft: #E6F4EA;
  --border: #C5D3C7;
  --text: #131D16;
  --muted: #3E4E43;
  --primary: #145A32;
  --primary-dark: #0E4425;
  --danger: #8A1C1C;
  --danger-soft: #FCE8E8;
  --warn: #7A3A00;
  --focus: #1565C0;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(19, 29, 22, .06), 0 4px 16px rgba(19, 29, 22, .04);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1511; --surface: #15201A; --surface-2: #1B2922; --soft: #1D3327;
    --border: #2C4236; --text: #E7F0EA; --muted: #A9BDB0; --primary: #3FA66A;
    --primary-dark: #2F8A56; --danger: #FF8A8A; --danger-soft: #3A1E1E; --warn: #F5B26B; --focus: #7DB8FF;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1511; --surface: #15201A; --surface-2: #1B2922; --soft: #1D3327;
  --border: #2C4236; --text: #E7F0EA; --muted: #A9BDB0; --primary: #3FA66A;
  --primary-dark: #2F8A56; --danger: #FF8A8A; --danger-soft: #3A1E1E; --warn: #F5B26B; --focus: #7DB8FF;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}
img { max-width: 100%; display: block; }
a { color: var(--primary); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4rem; }
h1 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); font-weight: 800; }
h2 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 .6rem; }
.lead { color: var(--muted); max-width: 62ch; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Layout */
.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.stack { display: grid; gap: 20px; padding-top: 24px; padding-bottom: 32px; }
.hero-grid, .grid-2 { display: grid; gap: 20px; }
@media (min-width: 900px) {
  .hero-grid { grid-template-columns: 3fr 2fr; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.section-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
@media (min-width: 700px) {
  .section-head { flex-direction: row; justify-content: space-between; align-items: center; }
}

/* Header */
.topbar { position: sticky; top: 0; z-index: 1000; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar__inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; }
.brand__name { font-weight: 800; font-size: 1.1rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.brand p { margin: 0; }
.pill {
  font-size: .68rem; font-weight: 700; letter-spacing: .04em;
  padding: 2px 9px; border-radius: 999px;
  background: var(--soft); color: var(--primary-dark); border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
}
.topbar__actions { display: flex; align-items: center; gap: 10px; }
@media (max-width: 640px) {
  .brand p { display: none; }
  #apiStatus { display: none; }
}

.status {
  font-size: .78rem; font-weight: 600; padding: 6px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status--ok { background: var(--soft); color: var(--primary-dark); }
.status--ok::before { background: var(--primary); }
.status--bad { background: var(--danger-soft); color: var(--danger); }
.status--bad::before { background: var(--danger); }

/* Hero */
.eyebrow {
  display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  background: var(--soft); color: var(--primary-dark); padding: 4px 10px; border-radius: 8px; margin-bottom: 12px;
}
.stats {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px;
  margin: 22px 0 8px; padding-top: 16px; border-top: 1px solid var(--border);
}
@media (min-width: 640px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stats dt { font-size: .78rem; color: var(--muted); font-weight: 600; }
.stats dd { margin: 2px 0 0; font-size: 1.35rem; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; }

/* Forms & buttons */
.form { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: .88rem; color: var(--text); }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; color: var(--muted); }
label.check input { margin-top: 4px; }
.input, select, textarea, input[type="number"], input[type="text"], input[type="email"] {
  width: 100%; font: inherit; font-weight: 400; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
}
.input:focus, select:focus, textarea:focus, input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
textarea { resize: vertical; min-height: 64px; }
.field-row { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.field-row > .input { flex: 1 1 200px; }
.field-row > label { flex: 1 1 140px; }
.output { font-weight: 700; color: var(--primary); padding: 10px 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; font-size: .88rem; border-radius: 10px; padding: 10px 16px;
  border: 1px solid transparent; cursor: pointer; text-decoration: none; transition: background .15s, transform .05s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn--ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn--ghost:hover:not(:disabled) { background: var(--soft); }
.btn--block { width: 100%; }
.btn--sm { padding: 6px 10px; font-size: .8rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: .8rem; font-weight: 700; padding: 8px 12px; border-radius: 10px; cursor: pointer;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
}
.chip[aria-pressed="true"] { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Result boxes */
.result { margin-top: 12px; }
.notice {
  padding: 12px 14px; border-radius: 12px; font-size: .9rem;
  background: var(--soft); border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
}
.notice--error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }
.token-box { text-align: center; padding: 16px; }
.token-box .code-big { font-size: 1.5rem; font-weight: 800; letter-spacing: .08em; color: var(--primary-dark); font-family: ui-monospace, Menlo, Consolas, monospace; word-break: break-all; }
.ticket-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; margin-bottom: 8px; }
.badge {
  font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 7px;
  background: var(--primary); color: #fff; white-space: nowrap;
}
.badge--muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.badge--warn { background: #FFF1DE; color: var(--warn); }
.badge--bad { background: var(--danger-soft); color: var(--danger); }

/* Tables & lists */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; margin-top: 10px; }
table { width: 100%; border-collapse: collapse; font-size: .84rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-2); font-weight: 700; color: var(--muted); }
tr:last-child td { border-bottom: 0; }

.feed { display: grid; gap: 12px; max-height: 560px; overflow-y: auto; padding-right: 4px; }
.report { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.report img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; background: var(--border); }
.report__ph { width: 96px; height: 96px; border-radius: 10px; background: var(--border); display: grid; place-items: center; font-size: .72rem; color: var(--muted); text-align: center; padding: 6px; }
.report__meta { font-size: .78rem; color: var(--muted); }
.report__title { font-weight: 700; font-size: .92rem; }
.report p { margin: 4px 0 0; font-size: .86rem; }
@media (max-width: 380px) { .report { grid-template-columns: 1fr; } .report img, .report__ph { width: 100%; height: 160px; } }

#map {
  height: 420px; width: 100%; border-radius: var(--radius);
  border: 1px solid var(--border); z-index: 1;
}
@media (max-width: 640px) { #map { height: 320px; } }
.leaflet-popup-content { font-size: .86rem; line-height: 1.45; margin: 12px 14px; }
.leaflet-popup-content h3 { font-size: .95rem; margin-bottom: 4px; }
.leaflet-popup-content .btn { margin-top: 6px; }

.code {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem;
  white-space: pre-wrap; word-break: break-all; margin: 8px 0 12px;
}

footer { border-top: 1px solid var(--border); background: var(--surface); padding: 18px 0; color: var(--muted); font-size: .85rem; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }

/* Embed widget */
.widget { padding: 16px; }
.widget__title { font-size: .85rem; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.widget__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.widget__grid dt { font-size: .7rem; color: var(--muted); font-weight: 600; }
.widget__grid dd { margin: 0; font-size: 1.1rem; font-weight: 800; color: var(--primary); }
.widget__foot { margin-top: 10px; font-size: .72rem; color: var(--muted); }
