/* ===== Tokens ===== */
:root {
  --bg: #eef2f7; --surface: #ffffff; --surface-2: #f6f8fb; --text: #1b2433; --muted: #617088; --line: #e2e8f0;
  --brand: #2563eb; --brand-ink: #ffffff; --brand-soft: #e8efff;
  --ok: #15803d;   --ok-bg: #dcfce7;
  --warn: #b45309; --warn-bg: #fef3c7;
  --bad: #b91c1c;  --bad-bg: #fee2e2;
  --off: #475569;  --off-bg: #e2e8f0;
  --s1: #2563eb; --s2: #9333ea; --s3: #d97706;          /* warna seri grafik: 3 titik */
  --radius: 14px; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 4px 18px rgba(16,24,40,.06);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1522; --surface: #172033; --surface-2: #1c2740; --text: #e6ecf5; --muted: #98a6bd; --line: #2a3650;
    --brand: #6ea0ff; --brand-ink: #0b1220; --brand-soft: #1d2c4d;
    --ok: #4ade80;   --ok-bg: #12351f;
    --warn: #fbbf24; --warn-bg: #3a2c0b;
    --bad: #fca5a5;  --bad-bg: #4a1818;
    --off: #b6c2d6;  --off-bg: #263248;
    --s1: #7aa8ff; --s2: #c58bff; --s3: #fbbf24;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 18px rgba(0,0,0,.25);
  }
}

/* ===== Dasar ===== */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.05rem; } h3 { font-size: .95rem; }
p { margin: 0; }
a { color: var(--brand); }
code { font-family: var(--mono); font-size: .85em; background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; word-break: break-all; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; border: 1px solid var(--line); }
.card-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.sec-title { margin: 8px 0 10px; font-size: 1.05rem; }

/* ===== Tombol & form ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; padding: 9px 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); background: var(--brand); }
.btn.ghost { background: transparent; } .btn.sm { padding: 5px 12px; font-size: .85rem; } .btn.block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: wait; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .88rem; margin-bottom: 14px; }
.field.inline { margin: 0; } .field.narrow { max-width: 190px; }
input[type=text], input[type=password], input[type=number], select {
  font: inherit; font-weight: 400; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; width: 100%; min-height: 40px; }
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
select { width: auto; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand); }
.form-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.form-row .field { margin: 0; flex: 1 1 200px; } .form-row .field.narrow { flex: 0 1 190px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.card form > .actions { margin-top: 14px; } .form-row .actions { margin: 0; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.kv { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.kv > span { min-width: 80px; color: var(--muted); font-size: .85rem; } .kv form { margin: 0; }
.step { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-size: .78rem; margin-right: 6px; }
.ping { margin-top: 12px; padding: 10px 14px; border-radius: 10px; font-weight: 600; }
.ping.ok { background: var(--ok-bg); color: var(--ok); } .ping.bad { background: var(--bad-bg); color: var(--bad); }
.alert { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; font-weight: 600; font-size: .92rem; }
.alert.ok { background: var(--ok-bg); color: var(--ok); } .alert.warn { background: var(--warn-bg); color: var(--warn); } .alert.bad { background: var(--bad-bg); color: var(--bad); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { font: inherit; font-weight: 600; font-size: .88rem; padding: 8px 14px; border: 0; background: var(--surface); color: var(--muted); cursor: pointer; }
.seg button[aria-pressed=true] { background: var(--brand); color: var(--brand-ink); }
.ctrls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ===== Logo / brand ===== */
.logo { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--brand); color: var(--brand-ink); flex: none; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.brand b { display: block; font-size: 1rem; line-height: 1.2; } .brand small { display: block; color: var(--muted); font-size: .78rem; }

/* ===== Indikator langsung ===== */
.live { display: inline-flex; align-items: center; gap: 8px; font-size: .82rem; font-weight: 600; padding: 6px 12px; border-radius: 999px; background: var(--off-bg); color: var(--off); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.live.ok { background: var(--ok-bg); color: var(--ok); } .live.ok i { animation: pulse 2s infinite; }
.live.bad { background: var(--bad-bg); color: var(--bad); }
@keyframes pulse { 50% { opacity: .35; } }

/* ===== Status pill ===== */
.pill { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.pill.aman { background: var(--ok-bg); color: var(--ok); } .pill.waspada { background: var(--warn-bg); color: var(--warn); }
.pill.bahaya { background: var(--bad-bg); color: var(--bad); } .pill.offline, .pill.belum { background: var(--off-bg); color: var(--off); }

/* ===== Banner ===== */
.banner { display: flex; gap: 14px; align-items: center; padding: 16px 20px; border-radius: var(--radius); margin-bottom: 18px; border: 1px solid transparent; }
.banner b { font-size: 1.05rem; } .banner p { margin-top: 2px; font-size: .92rem; }
.banner-ico { font-size: 1.4rem; line-height: 1; }
.banner.is-aman { background: var(--ok-bg); color: var(--ok); } .banner.is-waspada { background: var(--warn-bg); color: var(--warn); }
.banner.is-bahaya { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); animation: alarm 1.2s ease-in-out infinite; }
.banner.is-offline, .banner.is-belum { background: var(--off-bg); color: var(--off); }
@keyframes alarm { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--bad) 25%, transparent); } }

/* ===== Kartu statistik ===== */
.grid2, .grid3 { display: grid; gap: 18px; margin-bottom: 18px; }
.grid2 { grid-template-columns: repeat(2, 1fr); } .grid3 { grid-template-columns: repeat(3, 1fr); }
.stat-h { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.stat-ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); }
.stat-ico.g { background: var(--warn-bg); color: var(--warn); } .stat-ico.e { background: var(--off-bg); color: var(--off); }
.stat-v { font-size: 2.2rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-v small { font-size: 1rem; font-weight: 600; color: var(--muted); margin-left: 4px; }
.stat .muted { margin-top: 6px; font-size: .88rem; }
#flameCard.is-aman .stat-v { color: var(--ok); } #flameCard.is-bahaya .stat-v { color: var(--bad); } #flameCard.is-belum .stat-v { color: var(--off); }
#gasCard.is-aman .stat-v { color: var(--ok); } #gasCard.is-waspada .stat-v { color: var(--warn); } #gasCard.is-bahaya .stat-v { color: var(--bad); }
#gasCard.is-offline .stat-v, #gasCard.is-belum .stat-v, #espCard .stat-v.off { color: var(--off); } #espCard .stat-v.on { color: var(--ok); }

/* ===== Kartu titik ===== */
.points { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 18px; }
.point { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--off); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.point.is-aman { border-top-color: var(--ok); } .point.is-waspada { border-top-color: var(--warn); }
.point.is-bahaya { border-top-color: var(--bad); background: color-mix(in srgb, var(--bad-bg) 55%, var(--surface)); }
.point header { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.point .code { font-family: var(--mono); font-size: .72rem; color: var(--muted); letter-spacing: .04em; }
.point h3 { font-size: 1.05rem; } .point header p { color: var(--muted); font-size: .85rem; }
.gauge { position: relative; height: 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); margin: 14px 0 12px; }
.gauge .fill { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--off); transition: width .4s; }
.is-aman .gauge .fill { background: var(--ok); } .is-waspada .gauge .fill { background: var(--warn); } .is-bahaya .gauge .fill { background: var(--bad); }
.gauge i { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--muted); opacity: .7; }
.point dl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 0; }
.point dt { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.point dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.point dd.flame-on { color: var(--bad); }

/* ===== Grafik ===== */
.grid-main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; margin-bottom: 18px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.legend button { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: .84rem; font-weight: 600; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 99px; padding: 4px 12px; cursor: pointer; }
.legend button i { width: 12px; height: 4px; border-radius: 2px; background: var(--c); }
.legend button[aria-pressed=false] { opacity: .45; text-decoration: line-through; }
.chart { position: relative; min-height: 270px; }
.chart svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.chart .grid { stroke: var(--line); stroke-width: 1; } .chart .axis { fill: var(--muted); font-size: 11px; }
.chart .thr { stroke-width: 1.5; stroke-dasharray: 5 4; } .chart .thr.w { stroke: var(--warn); } .chart .thr.d { stroke: var(--bad); }
.chart .thr-l { font-size: 10.5px; font-weight: 700; } .chart .thr-l.w { fill: var(--warn); } .chart .thr-l.d { fill: var(--bad); }
.chart .line { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart .cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.tip { position: absolute; pointer-events: none; z-index: 2; min-width: 160px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 8px 12px; font-size: .82rem; }
.tip b { display: block; margin-bottom: 4px; }
.tip div { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tip span.k { display: inline-flex; align-items: center; gap: 6px; } .tip i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.empty { color: var(--muted); text-align: center; padding: 40px 10px; font-size: .92rem; }

/* ===== Notifikasi ===== */
.notifs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; max-height: 380px; overflow: auto; }
.notifs li { display: flex; gap: 10px; padding: 10px 12px; background: var(--surface-2); border-radius: 10px; border-left: 4px solid var(--off); font-size: .88rem; }
.notifs li.api, .notifs li.gas_bahaya { border-color: var(--bad); } .notifs li.gas_waspada { border-color: var(--warn); } .notifs li.pulih { border-color: var(--ok); }
.notifs time { display: block; color: var(--muted); font-size: .76rem; margin-top: 2px; }
.notifs li.empty { border: 0; justify-content: center; padding: 30px 10px; }

/* ===== Trafik ===== */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.tile span { display: block; font-size: .76rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.tile b { font-size: 1.5rem; font-variant-numeric: tabular-nums; } .tile b.bad { color: var(--bad); }
.bars-wrap { margin-bottom: 16px; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 70px; margin-top: 8px; }
.bars span { flex: 1; min-height: 2px; background: var(--brand); border-radius: 3px 3px 0 0; opacity: .85; }
.bars span.z { background: var(--line); opacity: 1; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table th.num { text-align: right; }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table td.empty { padding: 26px 10px; }
.form-table input[type=text] { min-width: 150px; }

/* ===== Layout halaman ===== */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar-in { max-width: 1120px; margin: 0 auto; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.topbar-r { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 22px 16px 10px; }
.wrap > section { margin-bottom: 18px; }
.wrap .grid2, .wrap .points { margin-bottom: 18px; }
.foot { text-align: center; color: var(--muted); font-size: .82rem; padding: 18px 16px 32px; }
.export { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.export .field { flex-direction: column; }
.safety ol { margin: 10px 0 0; padding-left: 20px; color: var(--muted); } .safety li { margin-bottom: 4px; }

/* ===== Admin shell ===== */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.side nav { display: flex; flex-direction: column; gap: 4px; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 600; }
.side nav a:hover { background: var(--surface-2); color: var(--text); }
.side nav a.on { background: var(--brand-soft); color: var(--brand); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.who { display: flex; align-items: center; gap: 10px; } .who b { display: block; font-size: .9rem; } .who small { color: var(--muted); text-transform: capitalize; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 800; }
.main { padding: 26px 28px 40px; min-width: 0; }
.main > section, .main > .alert { margin-bottom: 18px; }
.main .grid3, .main .points, .main .grid-main { margin-bottom: 18px; }
.page-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }

/* ===== Login ===== */
body.auth { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.auth-wrap { width: 100%; max-width: 400px; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 32px 28px; }
.auth-brand { display: flex; justify-content: center; margin-bottom: 14px; } .auth-brand .logo { width: 52px; height: 52px; border-radius: 15px; }
.auth-card h1 { text-align: center; } .auth-card > .muted { text-align: center; margin: 4px 0 22px; font-size: .9rem; }
.auth-card .field { margin-bottom: 16px; } .auth-card .btn { margin-top: 4px; }

/* ===== Responsif ===== */
@media (max-width: 980px) {
  .points, .grid3 { grid-template-columns: 1fr; } .grid-main { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side nav { flex-direction: row; flex-wrap: wrap; order: 3; width: 100%; } .side-foot { margin: 0 0 0 auto; flex-direction: row; align-items: center; }
  .who small { display: none; } .main { padding: 18px 16px 32px; }
}
@media (max-width: 600px) {
  .grid2 { grid-template-columns: 1fr; } .stat-v { font-size: 1.9rem; }
  .card { padding: 16px; } .field.narrow { max-width: none; } .form-row .field.narrow { flex: 1 1 140px; }
}
@media (prefers-reduced-motion: reduce) { .banner.is-bahaya, .live.ok i { animation: none; } .gauge .fill { transition: none; } }

/* ================== Denah ruko (pin sensor hidup) ================== */
.denah { position: relative; overflow: hidden; border-radius: 10px; background: #f6f1e7; }
.denah-zoom { position: relative; transition: transform .9s ease; will-change: transform; }
.denah-img { display: block; width: 100%; height: auto; }
.pin { position: absolute; transform: translate(-50%, -88%); background: none; border: 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 0; z-index: 3;
  animation: pinFloat 3.2s ease-in-out infinite; }
.pin-dot { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 1.15rem; color: #fff; background: #9aa7b4;
  border: 3px solid #fff; box-shadow: 0 6px 14px rgba(16,24,40,.35); }
.pin::after { content: ""; width: 26px; height: 8px; border-radius: 50%; background: rgba(16,24,40,.28);
  filter: blur(2px); margin-top: 1px; }
.pin-tag { background: rgba(255,255,255,.94); border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 10px; display: flex; gap: 7px; align-items: baseline; white-space: nowrap;
  box-shadow: 0 2px 8px rgba(16,24,40,.12); font-size: .78rem; color: var(--text); }
.pin-tag b { font-size: .8rem; }
.pin-tag i { font-style: normal; color: var(--muted); }
.pin-tag .pin-gas { font-weight: 700; color: var(--text); }
.pin-pulse { position: absolute; left: 50%; top: 22px; width: 46px; height: 46px; border-radius: 50%;
  transform: translate(-50%, -50%); pointer-events: none; opacity: 0; }
.pin.is-aman .pin-dot { background: var(--ok); }
.pin.is-waspada .pin-dot { background: #e0a800; }
.pin.is-waspada .pin-status { color: var(--warn); font-weight: 700; }
.pin.is-bahaya { z-index: 5; }
.pin.is-bahaya .pin-dot { background: var(--bad); animation: pinBlink 1s steps(2, start) infinite; }
.pin.is-bahaya .pin-status { color: var(--bad); font-weight: 800; }
.pin.is-bahaya .pin-pulse { opacity: 1; border: 3px solid var(--bad); animation: pinPulse 1.6s ease-out infinite; }
.pin.is-offline .pin-dot, .pin.is-belum .pin-dot { background: #9aa7b4; }
.pin.is-offline, .pin.is-belum { opacity: .75; }
.pin-flame, .pin-buzzer { border-radius: 999px; padding: 2px 9px; font-size: .72rem; font-weight: 800;
  letter-spacing: .02em; color: #fff; box-shadow: 0 2px 8px rgba(16,24,40,.25); }
.pin-flame { background: #ea580c; }
.pin-buzzer { background: var(--bad); animation: pinBlink 1s steps(2, start) infinite; }
.denah-legend { margin-top: 10px; display: flex; gap: 16px; flex-wrap: wrap; }
.denah-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.denah-legend .dot.aman { background: var(--ok); } .denah-legend .dot.waspada { background: #e0a800; }
.denah-legend .dot.bahaya { background: var(--bad); } .denah-legend .dot.offline { background: #9aa7b4; }
.point.flash { outline: 3px solid var(--brand); outline-offset: 2px; transition: outline-color .3s; }
@keyframes pinFloat { 0%, 100% { margin-top: 0; } 50% { margin-top: -6px; } }
@keyframes pinBlink { 50% { opacity: .45; } }
@keyframes pinPulse { 0% { transform: translate(-50%, -50%) scale(.6); opacity: .9; }
  100% { transform: translate(-50%, -50%) scale(2.1); opacity: 0; } }
@media (max-width: 600px) { .pin-dot { width: 36px; height: 36px; font-size: 1rem; }
  .pin-tag { font-size: .68rem; padding: 2px 8px; } }
@media (prefers-reduced-motion: reduce) { .pin, .pin.is-bahaya .pin-dot, .pin-buzzer { animation: none; }
  .pin.is-bahaya .pin-pulse { display: none; } .denah-zoom { transition: none; } }
.denah-card #denahReset[hidden] { display: none; }

/* Halaman PUBLIK selalu terang — ilustrasi denah terang tidak menyatu dengan mode gelap.
   Panel admin tetap mengikuti mode perangkat. */
@media (prefers-color-scheme: dark) {
  body.public {
    --bg: #eef2f7; --surface: #ffffff; --surface-2: #f6f8fb; --text: #1b2433; --muted: #617088; --line: #e2e8f0;
    --brand: #2563eb; --brand-ink: #ffffff; --brand-soft: #e8efff;
    --ok: #15803d; --ok-bg: #dcfce7;
    --warn: #b45309; --warn-bg: #fef3c7;
    --bad: #b91c1c; --bad-bg: #fee2e2;
    --off: #475569; --off-bg: #e2e8f0;
    --s1: #2563eb; --s2: #9333ea; --s3: #d97706;
    --shadow: 0 1px 2px rgba(16,24,40,.05), 0 4px 18px rgba(16,24,40,.06);
    color-scheme: light;
  }
}

/* Halaman publik di layar lebar: denah besar di kiri + kartu titik di kanan,
   biar komposisinya persegi panjang (bukan kotak menumpuk). HP tetap menumpuk. */
@media (min-width: 1024px) {
  body.public .wrap, body.public .topbar-in { max-width: 1380px; }
  body.public main.wrap { display: grid; grid-template-columns: minmax(0, 1fr) 330px;
    column-gap: 18px; align-items: start; }
  body.public main.wrap > section { margin-bottom: 0; }
  body.public main.wrap > .banner { grid-column: 1 / -1; margin-bottom: 18px; }
  body.public .points { grid-template-columns: 1fr; gap: 12px; }
}

/* === Blueprint web vs dashboard (diskusi Strix, 4 Des) === */
:root { --radius: 18px; }
@media (prefers-color-scheme: light) {
  :root { --shadow: 0 1px 2px rgba(16,24,40,.04), 0 10px 30px rgba(16,24,40,.06); }
}
.card, .point { border-color: color-mix(in srgb, var(--line) 70%, transparent); }
.point { transition: border-color .2s ease, box-shadow .2s ease; }
.main > section.card { margin-bottom: 18px; }

/* Kartu titik halaman publik: level gas jadi angka utama */
.point .hero dd { font-size: 1.55rem; font-weight: 800; line-height: 1.1; }

/* Denah mini di admin */
.minimap { display: flex; align-items: center; gap: 16px; padding: 12px 16px; margin-bottom: 14px; }
.minimap svg { width: 300px; max-width: 60vw; height: auto; flex: none; }
.minimap p { margin: 0; }
.mm-room { fill: var(--surface-2); stroke: var(--line); }
.mm-zone { fill: color-mix(in srgb, var(--brand-soft) 55%, var(--surface)); stroke: var(--line); }
.mm-dot { fill: var(--off); stroke: var(--surface); stroke-width: 2.5; }
.mm-dot.is-aman { fill: var(--ok); } .mm-dot.is-waspada { fill: var(--warn); }
.mm-dot.is-bahaya { fill: var(--bad); animation: pinPulse 1s ease-in-out infinite; }
.mm-num { fill: #fff; font: 700 11px var(--font, sans-serif); text-anchor: middle; pointer-events: none; }

/* Panel Log & Alarm bertab */
.tabs { display: inline-flex; gap: 4px; background: var(--surface-2); border-radius: 999px; padding: 4px; }
.tabs .tab { font: inherit; font-weight: 600; font-size: .85rem; border: 0; background: transparent; color: var(--muted);
  padding: 6px 14px; border-radius: 999px; cursor: pointer; transition: background .2s, color .2s; }
.tabs .tab.is-on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(16,24,40,.12); }
.tabpane[hidden] { display: none; }

/* === PREVIEW v2 halaman publik: rasa "web", bukan dashboard (BELUM deploy) === */
body.public { background: linear-gradient(180deg, #e9f4e7 0%, #f6efdb 55%, #eef2f7 100%); background-attachment: fixed; }
body.public .topbar { background: transparent; border-bottom: 0; box-shadow: none; }
body.public .banner { border-radius: 18px; box-shadow: 0 10px 30px rgba(90,70,20,.12); border: 1px solid rgba(255,255,255,.65); }
body.public .denah-card { background: rgba(255,255,255,.72); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,.75);
  border-radius: 24px; box-shadow: 0 24px 60px rgba(60,80,40,.16); }
body.public .point { background: rgba(255,255,255,.86); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,.8);
  box-shadow: 0 12px 32px rgba(60,80,40,.12); }
body.public .sec-title { color: #33513a; letter-spacing: .01em; }

/* === DESAIN 3 (5 Des, disetujui Ridho): hijau tabung gas + merah bahaya,
   tampilan HP rapi, login dua peran (Pemilik/Pekerja), halaman pekerja === */
:root { --brand: #12964a; --brand-soft: #e3f6ea; --ok: #12964a; }
.logo { background: #12964a; }
.step { background: #12964a; }
body.public { background: #e9f4ec; background-attachment: scroll; color-scheme: light;
  --bg: #e9f4ec; --surface: #ffffff; --surface-2: #f2f8f3; --text: #17301f; --muted: #5c7263; --line: #dcebe0;
  --brand: #12964a; --brand-soft: #e3f6ea; --ok: #12964a; --ok-bg: #dcfae6;
  --warn: #b54708; --warn-bg: #fef0c7; --bad: #b42318; --bad-bg: #fdeceb; --off: #475467; --off-bg: #eaecf0;
  --shadow: 0 3px 10px rgba(11,110,54,.10); }
body.public .topbar { background: linear-gradient(135deg, #0b6e36, #12964a); border-bottom: 0;
  border-radius: 0 0 22px 22px; box-shadow: 0 8px 22px rgba(11,110,54,.28); }
body.public .brand { color: #fff; } body.public .brand small { color: rgba(255,255,255,.85); }
body.public .logo { background: #fff; color: #0b6e36; }
body.public .live { background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.35); }
body.public .live.ok { background: rgba(255,255,255,.16); color: #fff; }
body.public .live.bad { background: #d92d20; color: #fff; border-color: #d92d20; }
body.public .banner { border: 0; box-shadow: 0 6px 16px rgba(23,48,31,.10); }
body.public .banner.is-bahaya { background: #d92d20; color: #fff; box-shadow: 0 8px 20px rgba(217,45,32,.35); }
body.public .banner.is-bahaya p { color: rgba(255,255,255,.95); }
body.public .banner.is-waspada { background: #dc6803; color: #fff; }
body.public .banner.is-waspada p { color: rgba(255,255,255,.95); }
body.public .banner.is-aman { background: #dcfae6; color: #067647; }
body.public .banner.is-offline, body.public .banner.is-belum { background: #eaecf0; color: #475467; }
body.public .denah-card, body.public .point { background: #fff; backdrop-filter: none;
  border: 1px solid #e2efe5; border-radius: 20px; box-shadow: 0 3px 10px rgba(11,110,54,.10); }
body.public .point.is-bahaya { background: #fff7f6; }
body.public .sec-title { color: #0b6e36; letter-spacing: .4px; }
body.public .card-h h2 { color: #0b6e36; }
.who-chip { display: inline-flex; align-items: center; gap: 7px; background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.35); color: #fff; padding: 6px 12px; border-radius: 999px;
  font-size: .82rem; font-weight: 600; white-space: nowrap; }
.who-chip .dot-on { width: 8px; height: 8px; border-radius: 50%; background: #7dff9a; }
.btn.light { color: #fff; border-color: rgba(255,255,255,.5); background: transparent; }
.btn.light:hover { background: rgba(255,255,255,.14); }

/* Login dua peran */
body.auth { background: linear-gradient(160deg, #0b6e36 0%, #12964a 55%, #0a5c2e 100%); color-scheme: light;
  --surface: #ffffff; --surface-2: #f7fbf8; --text: #17301f; --muted: #5c7263; --line: #d8e6dc;
  --brand: #12964a; --brand-ink: #ffffff; --brand-soft: #e3f6ea; --shadow: 0 14px 30px rgba(0,0,0,.28); }
body.auth .auth-card { border-radius: 22px; border: 0; padding: 30px 26px; }
body.auth .auth-brand .logo { background: #e3f6ea; color: #0b6e36; width: 60px; height: 60px; border-radius: 18px; }
body.auth .auth-brand .logo svg { width: 30px; height: 30px; }
.role-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.role-tabs button { flex: 1; font: inherit; font-weight: 700; font-size: .95rem; padding: 11px 4px;
  border-radius: 12px; border: 2px solid var(--line); background: #fff; color: var(--muted); cursor: pointer; }
.role-tabs button.on { border-color: #12964a; color: #0b6e36; background: #e3f6ea; }
.role-note { font-size: .82rem; color: var(--muted); text-align: center; margin-top: 14px; line-height: 1.55; }

/* HP: kartu titik menumpuk rapi, angka level besar */
@media (max-width: 600px) {
  body.public .wrap { padding: 16px 12px 8px; }
  body.public .banner { padding: 14px 16px; }
  body.public .points { gap: 12px; }
  body.public .point { padding: 14px 16px; }
  body.public .point .hero dd { font-size: 1.7rem; }
  .who-chip { font-size: .78rem; padding: 5px 10px; }
}

/* Ekspor Data (dashboard admin) */
.export-form{display:flex;gap:14px;align-items:end;flex-wrap:wrap}
.export-form label{display:flex;flex-direction:column;gap:6px;font-size:13px;font-weight:600}
.export-form select{border:1px solid var(--line);background:var(--surface);color:var(--text);border-radius:9px;padding:9px 11px;font-size:14px;min-width:170px}
.export-btns{display:flex;gap:9px}
