/* Sistem Aduan Bencana Geologi JMG — reka bentuk mudah alih dahulu */

:root {
  color-scheme: light;
  --green-950: #06342a;
  --green-900: #0b4f3c;
  --green-800: #12654d;
  --green-600: #1c8365;
  --green-100: #e4f1ec;
  --green-050: #f2f8f5;
  --gold: #b8860b;
  --gold-bg: #fdf5e2;

  --ink: #12211d;
  --ink-soft: #43554f;
  --muted: #6b7d77;
  --line: #d9e3df;
  --line-soft: #e9efec;
  --surface: #ffffff;
  --surface-2: #f7faf9;
  --wash: #f1f5f3;

  --danger: #b42318;
  --danger-bg: #fef1ef;
  --warn: #8a5a00;
  --warn-bg: #fff6e5;
  --ok: #1a7f4b;
  --ok-bg: #e8f6ee;
  --info: #1a5fb4;
  --info-bg: #eaf1fc;

  --radius-lg: 20px;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(6, 52, 42, .06), 0 1px 3px rgba(6, 52, 42, .05);
  --shadow: 0 4px 20px rgba(6, 52, 42, .08);
  --shadow-lg: 0 18px 48px rgba(6, 52, 42, .14);
  --tap: 48px;
  --max: 1080px;
  --font: ui-rounded, "SF Pro Rounded", "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ink: #e8efec;
    --ink-soft: #b9c8c3;
    --muted: #8fa39d;
    --line: #24352f;
    --line-soft: #1d2b26;
    --surface: #12201c;
    --surface-2: #16261f;
    --wash: #0b1613;
    --green-100: #12332a;
    --green-050: #0f2721;
    --gold-bg: #2c2410;
    --danger-bg: #33191a;
    --warn-bg: #2e2410;
    --ok-bg: #102f22;
    --info-bg: #14243d;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 4px 20px rgba(0, 0, 0, .45);
    --shadow-lg: 0 18px 48px rgba(0, 0, 0, .55);
  }
}

html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="dark"] body { --ink: #e8f1f8; --ink-soft: #c0cfdb; --muted: #a0b6c6; --line: #304655; --line-soft: #243a49; --surface: #132837; --surface-2: #193140; --wash: #0c1d29; --green-800: #80cafa; --green-600: #4babe4; --green-100: #213e52; --green-050: #1a3548; }
html[data-theme="dark"] .leaflet-tile { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.9) saturate(.75); }

* { box-sizing: border-box; }
/* Atribut hidden mesti mengatasi sebarang display yang ditetapkan komponen. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--wash);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 .65rem; letter-spacing: -.01em; }
h1 { font-size: clamp(1.75rem, 5.4vw, 2.4rem); }
h2 { font-size: clamp(1.3rem, 3.8vw, 1.6rem); }
h3 { font-size: 1.12rem; }
p { margin: 0 0 1.1rem; }
a { color: var(--green-800); text-decoration-thickness: 1px; text-underline-offset: 3px; }
small { font-size: .88rem; }
:focus-visible { outline: 3px solid var(--green-600); outline-offset: 2px; border-radius: 6px; }

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 60;
  background: var(--green-900); color: #fff; padding: .7rem 1rem;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm); transition: top .15s;
}
.skip-link:focus { top: 0; }

/* ---------------------------------------------------------------- header */

.site-header {
  position: sticky; top: 0; z-index: 60;
  background: var(--green-900);
  color: #fff;
  padding: .7rem 1rem;
  padding-top: calc(.7rem + env(safe-area-inset-top));
  display: flex; align-items: center; gap: .75rem;
  box-shadow: var(--shadow-sm);
}
.brand { display: flex; align-items: center; gap: .65rem; color: #fff; text-decoration: none; min-height: var(--tap); flex: 1; min-width: 0; }
.brand-mark {
  width: 40px; height: 40px; flex: 0 0 40px; border-radius: 11px;
  background: linear-gradient(140deg, var(--gold), #8c6407);
  display: grid; place-items: center; font-weight: 800; font-size: .78rem; letter-spacing: .02em; color: #fff;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: .98rem; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { color: rgba(255, 255, 255, .72); font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-actions { display: flex; align-items: center; gap: .4rem; }
.header-link {
  /* Digunakan pada <a> dan <button>: tetapkan semula gaya lalai butang. */
  color: #fff; text-decoration: none; font-family: inherit; font-size: .85rem; font-weight: 600;
  background: transparent; cursor: pointer;
  padding: .55rem .8rem; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .28);
  min-height: 40px; display: inline-flex; align-items: center; white-space: nowrap;
}
.header-link:hover { background: rgba(255, 255, 255, .12); }

/* ------------------------------------------------------------- structure */

.shell { max-width: var(--max); margin: 0 auto; padding: 1.4rem 1.15rem 3.5rem; }
.stack > * + * { margin-top: 1.35rem; }
.shell > section + section, .shell > div + section, .shell > section + div { margin-top: 1.35rem; }
.grid { display: grid; gap: 1.35rem; }
@media (min-width: 720px) {
  body { font-size: 18px; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .card { padding: 1.65rem; }
  .shell { padding: 1.8rem 1.5rem 4rem; }
}
@media (min-width: 900px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } .split { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; } }

.card {
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg); padding: 1.4rem; box-shadow: var(--shadow-sm);
}
.card-tight { padding: 1rem 1.15rem; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.section-title h2 { margin: 0; }
.muted { color: var(--muted); }
.tiny { font-size: .88rem; }
.center { text-align: center; }
.divider { height: 1px; background: var(--line-soft); border: 0; margin: 1.35rem 0; }

/* ------------------------------------------------------------------ hero */

.hero {
  background: linear-gradient(155deg, var(--green-900), var(--green-950) 70%);
  color: #fff; border-radius: var(--radius-lg); padding: 1.6rem 1.25rem;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -70px; width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(184, 134, 11, .35), transparent 65%);
}
.hero h1 { color: #fff; margin-bottom: .6rem; position: relative; }
.hero p { color: rgba(255, 255, 255, .85); margin-bottom: 1.2rem; position: relative; max-width: 46ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .6rem; position: relative; }

.eyebrow {
  display: inline-flex; align-items: center; gap: .4rem; margin-bottom: .7rem;
  font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--gold); background: rgba(184, 134, 11, .16); padding: .3rem .7rem; border-radius: 999px;
}

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 52px; padding: .8rem 1.45rem; border-radius: 999px;
  font-weight: 650; font-size: 1.02rem; border: 1px solid transparent; cursor: pointer;
  text-decoration: none; transition: transform .08s ease, background .15s ease, box-shadow .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--gold); color: #16120a; box-shadow: 0 6px 18px rgba(184, 134, 11, .32); }
.btn-primary:hover { background: #cc9612; }
.btn-green { background: var(--green-800); color: #fff; }
.btn-green:hover { background: var(--green-600); }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .45); }
.btn-ghost:hover { background: rgba(255, 255, 255, .12); }
.btn-outline { background: var(--surface); color: var(--green-800); border-color: var(--line); }
.btn-outline:hover { background: var(--green-050); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: rgba(180, 35, 24, .25); }
.btn-block { width: 100%; }
.btn-sm { min-height: 40px; padding: .5rem .95rem; font-size: .85rem; }
.btn[disabled] { opacity: .55; pointer-events: none; }

/* ----------------------------------------------------------------- forms */

.field { margin-bottom: 1.3rem; }
.field > label, .field-label { display: block; font-weight: 620; font-size: 1rem; margin-bottom: .4rem; }
.field .hint { display: block; color: var(--muted); font-size: .9rem; margin-bottom: .55rem; line-height: 1.5; }
.req { color: var(--danger); font-weight: 700; }

input[type="text"], input[type="email"], input[type="tel"], input[type="password"],
input[type="date"], input[type="search"], input[type="number"], select, textarea {
  width: 100%; min-height: 52px; padding: .8rem .95rem;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { min-height: 150px; resize: vertical; line-height: 1.6; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 2.5rem; }
input:focus, select:focus, textarea:focus { border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(28, 131, 101, .18); outline: none; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }

.choice-grid { display: grid; gap: .7rem; }
@media (min-width: 620px) { .choice-grid { grid-template-columns: 1fr 1fr; } }
.choice {
  display: flex; gap: .7rem; align-items: flex-start; padding: .85rem .95rem;
  border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--surface);
  cursor: pointer; min-height: 58px; transition: border-color .15s, background .15s;
}
.choice:hover { border-color: var(--green-600); }
.choice input { margin: .25rem 0 0; width: 20px; height: 20px; flex: 0 0 20px; accent-color: var(--green-800); }
.choice-body strong { display: block; font-size: 1.02rem; font-weight: 620; }
.choice-body span { display: block; color: var(--muted); font-size: .89rem; line-height: 1.45; }
.choice:has(input:checked) { border-color: var(--green-800); background: var(--green-050); box-shadow: 0 0 0 1px var(--green-800) inset; }

.consent { display: flex; gap: .7rem; align-items: flex-start; background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: .9rem; }
.consent input { width: 22px; height: 22px; flex: 0 0 22px; margin-top: .1rem; accent-color: var(--green-800); }
.consent span { font-size: .95rem; color: var(--ink-soft); line-height: 1.55; }

.field-row { display: grid; gap: 1rem; }
@media (min-width: 620px) { .field-row-2 { grid-template-columns: 1fr 1fr; } }

/* --------------------------------------------------------------- wizard */

.wizard-head { position: sticky; top: 62px; z-index: 30; background: var(--wash); padding: .55rem 0 .75rem; }
.progress-track { height: 6px; background: var(--line-soft); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; width: 33%; background: linear-gradient(90deg, var(--green-600), var(--gold)); border-radius: 999px; transition: width .3s ease; }
.progress-meta { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); margin-top: .4rem; font-weight: 600; }
.wizard-step[hidden] { display: none; }
.wizard-nav { display: flex; gap: .6rem; margin-top: 1.2rem; }
.wizard-nav .btn { flex: 1; }

.uploader { border: 2px dashed var(--line); border-radius: var(--radius); padding: 1.2rem; text-align: center; background: var(--surface-2); }
.uploader input[type="file"] { display: block; margin: .6rem auto 0; max-width: 100%; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: .5rem; margin-top: .8rem; }
.thumbs img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); }

.gps-box { display: flex; flex-direction: column; gap: .6rem; background: var(--green-050); border: 1px solid var(--green-100); border-radius: var(--radius); padding: .95rem; }
.gps-status { font-size: .86rem; color: var(--ink-soft); display: flex; align-items: center; gap: .45rem; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: 0 0 9px; }
.dot-ok { background: var(--ok); }
.dot-busy { background: var(--gold); animation: pulse 1.1s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------------------------------------------------------------- alerts */

.alert { border-radius: var(--radius); padding: 1rem 1.15rem; font-size: .97rem; line-height: 1.55; border: 1px solid; display: flex; gap: .6rem; align-items: flex-start; }
.alert strong { font-weight: 700; }
.alert-error { background: var(--danger-bg); border-color: rgba(180, 35, 24, .28); color: var(--danger); }
.alert-success { background: var(--ok-bg); border-color: rgba(26, 127, 75, .28); color: var(--ok); }
.alert-info { background: var(--info-bg); border-color: rgba(26, 95, 180, .25); color: var(--info); }
.alert-warn { background: var(--warn-bg); border-color: rgba(138, 90, 0, .28); color: var(--warn); }
.toast-wrap { max-width: var(--max); margin: .9rem auto 0; padding: 0 1rem; display: grid; gap: .6rem; }

.badge {
  display: inline-flex; align-items: center; gap: .35rem; padding: .34rem .8rem;
  border-radius: 999px; font-size: .85rem; font-weight: 650; white-space: nowrap;
}
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: var(--line-soft); color: var(--muted); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-gold { background: var(--gold-bg); color: var(--gold); }

/* ------------------------------------------------------------- data list */

.kv { display: grid; gap: .1rem; margin: 0; }
.kv > div { display: flex; justify-content: space-between; gap: 1rem; padding: .75rem 0; border-bottom: 1px solid var(--line-soft); }
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); font-size: .92rem; flex: 0 0 auto; }
.kv dd { margin: 0; text-align: right; font-weight: 560; font-size: 1rem; word-break: break-word; }

.stat-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
@media (min-width: 620px) { .stat-row { grid-template-columns: repeat(4, 1fr); } }
.stat {
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 1.05rem; text-align: left; text-decoration: none; color: inherit; box-shadow: var(--shadow-sm);
}
.stat:hover { border-color: var(--green-600); }
.stat b { display: block; font-size: 1.75rem; line-height: 1.2; font-weight: 700; }
.stat span { font-size: .85rem; color: var(--muted); }

.list { display: grid; gap: .9rem; }
.list-item {
  display: block; background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 1.15rem; text-decoration: none; color: inherit; box-shadow: var(--shadow-sm);
}
.list-item:hover { border-color: var(--green-600); box-shadow: var(--shadow); }
.list-top { display: flex; justify-content: space-between; gap: .6rem; align-items: center; margin-bottom: .35rem; flex-wrap: wrap; }
.list-no { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: .84rem; font-weight: 650; color: var(--green-800); }
.list-title { font-weight: 620; margin: 0 0 .2rem; }
.list-meta { display: flex; flex-wrap: wrap; gap: .4rem 1rem; color: var(--muted); font-size: .88rem; }

.filters { display: grid; gap: .6rem; }
@media (min-width: 720px) { .filters { grid-template-columns: 2fr 1fr 1fr auto; align-items: end; } }
.filters .field { margin: 0; }

/* -------------------------------------------------------------- timeline */

.timeline { list-style: none; margin: 0; padding: 0 0 0 1.4rem; position: relative; }
.timeline::before { content: ""; position: absolute; left: 5px; top: .5rem; bottom: .5rem; width: 2px; background: var(--line); }
.timeline li { position: relative; padding-bottom: 1.2rem; }
.timeline li::before {
  content: ""; position: absolute; left: -1.4rem; top: .45rem; width: 12px; height: 12px;
  border-radius: 50%; background: var(--surface); border: 2.5px solid var(--green-600);
}
.timeline li.is-internal::before { border-color: var(--muted); }
.timeline-head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .2rem; }
.timeline-head strong { font-size: 1rem; font-weight: 640; }
.timeline-head time { color: var(--muted); font-size: .85rem; }
.timeline p { margin: 0; font-size: .98rem; color: var(--ink-soft); white-space: pre-line; line-height: 1.6; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .6rem; }
.photo-grid a { display: block; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); }
.photo-grid img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line-soft); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .93rem; background: var(--surface); }
th, td { padding: .85rem .9rem; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { background: var(--surface-2); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }

.steps { list-style: none; counter-reset: s; margin: 0; padding: 0; display: grid; gap: 1.1rem; }
.steps li { counter-increment: s; display: flex; gap: .8rem; align-items: flex-start; }
.steps li::before {
  content: counter(s); flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--green-100); color: var(--green-800); display: grid; place-items: center;
  font-weight: 700; font-size: .85rem;
}
.steps strong { display: block; font-size: 1.05rem; }
.steps span { color: var(--muted); font-size: .93rem; line-height: 1.55; }

.code-plate {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 1.35rem; font-weight: 700;
  letter-spacing: .03em; background: var(--green-050); border: 1.5px dashed var(--green-600);
  color: var(--green-800); border-radius: var(--radius); padding: .8rem 1rem; text-align: center; white-space: nowrap; word-break: normal; font-size: clamp(.78rem, 2.8vw, 1.35rem);
}
.field-inline { display: flex; gap: .5rem; align-items: center; }
.field-inline input { min-width: 0; }
.status-no { color: var(--green-800); font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-weight: 700; text-decoration: none; white-space: nowrap; }
.status-no:hover { text-decoration: underline; }

/* ------------------------------------------------------------ bottom nav */

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 55;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -2px 16px rgba(6, 52, 42, .07);
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem;
  min-height: 60px; text-decoration: none; color: var(--muted); font-size: .7rem; font-weight: 600;
}
.bottom-nav a svg { width: 22px; height: 22px; }
.bottom-nav a.is-active { color: var(--green-800); }
body.has-nav { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }

.site-footer { border-top: 1px solid var(--line-soft); margin-top: 2rem; padding: 1.3rem 1rem 2rem; text-align: center; color: var(--muted); font-size: .82rem; }
.site-footer a { color: var(--muted); }

@media print {
  .site-header, .bottom-nav, .site-footer, .btn, form { display: none !important; }
  body { background: #fff; padding: 0; }
  .card { box-shadow: none; border-color: #ccc; }
}

/* --------------------------------------------------------------- utiliti
   Kelas ini menggantikan atribut style="" sepenuhnya. Content-Security-Policy
   `style-src 'self'` menyekat gaya sebaris, jadi semua penyesuaian jarak dan
   susun atur mesti datang daripada fail ini. */

.u-flush { margin: 0; }
.u-tight { margin: .2rem 0 0; }
.u-mt-2xs { margin-top: .4rem; }
.u-mt-xs { margin-top: .55rem; }
.u-mt-sm { margin-top: .85rem; }
.u-mt-md { margin-top: 1.05rem; }
.u-mt-lg { margin-top: 1.2rem; }
.u-mt-xl { margin-top: 1.4rem; }
.u-mb-xs { margin: 0 0 .3rem; }
.u-mb-sm { margin-bottom: .9rem; }
.u-mb-md { margin-bottom: 1rem; }
.u-my-md { margin: 1.2rem auto; }
.u-my-lg { margin: 2rem auto; }

.u-prewrap { margin: 0; white-space: pre-line; }
.u-text-left { text-align: left; }
.u-center { justify-content: center; }

.u-panel { max-width: 520px; margin-inline: auto; }
.u-panel-sm { max-width: 460px; margin-inline: auto; }
.u-codes { max-width: 420px; margin: 1.4rem auto 0; text-align: left; }

.u-one-col { grid-template-columns: 1fr; }
.u-row { display: flex; gap: .5rem; align-items: center; }
.u-row-tight { display: flex; gap: .4rem; align-items: center; }
.u-cell-form { display: grid; gap: .4rem; min-width: 190px; }
.u-checkbox-sm { width: 18px; height: 18px; }
.u-textarea-sm { min-height: 90px; }

/* -------------------------------------------------------------- peta lokasi */

.map-shell {
  /* isolation + z-index:0 mengurung z-index dalaman Leaflet (sehingga 800)
     supaya peta tidak menutupi header melekat atau navigasi bawah. */
  position: relative;
  isolation: isolate;
  z-index: 0;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.map-canvas { height: 340px; width: 100%; background: var(--surface-2); }
@media (min-width: 720px) { .map-canvas { height: 440px; } }

.map-locate {
  position: absolute; right: .75rem; top: .75rem; z-index: 1000;
  display: inline-flex; align-items: center; gap: .45rem;
  min-height: 44px; padding: .55rem .95rem; border-radius: 999px;
  background: var(--surface); color: var(--green-800);
  border: 1.5px solid var(--line); box-shadow: var(--shadow);
  font-family: inherit; font-size: .92rem; font-weight: 640; cursor: pointer;
}
.map-locate:hover { background: var(--green-050); border-color: var(--green-600); }
.map-locate svg { width: 19px; height: 19px; }

/* Pin tersuai: tiada fail imej, jadi tiada permintaan luar tambahan. */
.map-pin { position: relative; }
.map-pin-head {
  position: absolute; left: 3px; top: 0; width: 24px; height: 24px;
  border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: var(--danger); border: 3px solid #fff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .35);
}
.map-pin-tail {
  position: absolute; left: 12px; top: 30px; width: 6px; height: 6px;
  border-radius: 50%; background: rgba(0, 0, 0, .3);
}
.leaflet-marker-draggable { cursor: grab; }
.leaflet-marker-draggable:active { cursor: grabbing; }
.leaflet-container { font: inherit; background: var(--surface-2); }
.leaflet-tile { border: 0; outline: 0; image-rendering: auto; backface-visibility: hidden; transform: translateZ(0); }
.leaflet-container .leaflet-control-attribution {
  font-size: .74rem; background: rgba(255, 255, 255, .92); color: #33403c; padding: .15rem .5rem;
}
.leaflet-container .leaflet-control-attribution a { color: var(--green-800); }

.locality {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin-top: 1rem; padding: .95rem 1.1rem;
  background: var(--green-050); border: 1px solid var(--green-100); border-radius: var(--radius);
}
.locality-label { display: block; font-size: .82rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.locality strong { font-size: 1.05rem; font-weight: 650; }

.more { margin-top: 1.2rem; border-top: 1px solid var(--line-soft); padding-top: 1rem; }
.more > summary {
  cursor: pointer; font-weight: 620; color: var(--green-800);
  min-height: 44px; display: flex; align-items: center; list-style: none;
}
.more > summary::-webkit-details-marker { display: none; }
.more > summary::before { content: "＋"; margin-right: .5rem; font-weight: 700; }
.more[open] > summary::before { content: "－"; }

/* Mod gelap: tile peta ditapis supaya tidak menyilaukan, pin kekal terang. */
@media (prefers-color-scheme: dark) {
  .leaflet-tile { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.9) saturate(.75); }
  .leaflet-container .leaflet-control-attribution { background: rgba(18, 32, 28, .92); color: var(--ink-soft); }
  .leaflet-container .leaflet-control-attribution a { color: var(--green-600); }
  .leaflet-container .leaflet-control-zoom a { background: var(--surface); color: var(--ink); border-bottom-color: var(--line); }
  .map-pin-head { border-color: var(--surface); }
}

/* Pemilih gambar mudah disentuh pada telefon. */
.uploader { padding: 1rem; text-align: left; }
.uploader input[type="file"] { width: 100%; margin: 0; font: inherit; font-size: .9rem; }
.uploader input::file-selector-button { min-height: 48px; padding: .7rem 1rem; margin-right: .6rem; border: 0; border-radius: var(--radius-sm); background: var(--green-800); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.uploader input:focus-visible { outline: 3px solid var(--green-800); outline-offset: 4px; }
.photo-preview { margin: 0; min-width: 0; }
.photo-remove { width: 100%; min-height: 44px; margin-top: .25rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--danger); font: inherit; font-size: .85rem; cursor: pointer; }

/* MyGEMS: biru, hijau dan jingga logo JMG. */
:root {
  --green-950: #073958; --green-900: #075986; --green-800: #06669e; --green-600: #087bb9;
  --green-100: #e1f0fa; --green-050: #f0f7fc; --gold: #df820f; --gold-bg: #fff3dd;
  --ink: #142b3c; --ink-soft: #415769; --muted: #5e7180;
  --line: #d6e2ec; --line-soft: #e4edf3; --surface: #fff; --surface-2: #f5f9fc; --wash: #f3f7fb;
}
body.has-nav { min-height: 100dvh; display: flex; flex-direction: column; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
.shell { width: 100%; flex: 1; padding-bottom: 1.5rem; }
.site-header { background: var(--surface); color: var(--ink); border-bottom: 3px solid #f6a126; box-shadow: none; }
.brand { color: var(--ink); }
.brand-logo { width: 52px; height: 44px; flex-shrink: 0; object-fit: contain; background: #fff; border-radius: 8px; }
.brand-text strong { font-size: clamp(.8rem, 2.7vw, 1.02rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.25; }
.brand-text strong span { display: inline; color: var(--green-800); }
.brand-text small { color: var(--muted); font-size: .63rem; white-space: normal; line-height: 1.3; margin-top: .2rem; }
.header-link { color: var(--green-800); border-color: var(--line); }
.header-link:hover { background: var(--green-050); }
.icon-button { width: 44px; min-height: 44px; padding: .6rem; justify-content: center; border-radius: 12px; }
.staff-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; font-size: .8rem; }
.app-icon { display: inline-flex; width: 24px; height: 24px; flex: 0 0 24px; align-items: center; justify-content: center; }
.app-icon svg { width: 100%; height: 100%; }
.bottom-nav { position: fixed; inset: auto 0 0; min-height: 68px; padding: .3rem .5rem calc(.3rem + env(safe-area-inset-bottom)); z-index: 100; }
.bottom-nav a { min-height: 56px; gap: .2rem; border-radius: 12px; font-size: .68rem; }
.bottom-nav a.is-active { background: var(--green-050); box-shadow: none; color: var(--green-800); }
.site-footer { margin-top: auto; padding: .65rem 1rem; font-size: .7rem; }
.site-footer p { margin: 0; }
.home-panel { width: min(100%, 560px); margin: auto; display: grid; gap: 1.2rem; }
.home-intro { text-align: center; }
.home-intro h1 { font-size: clamp(1.65rem, 5vw, 2.4rem); }
.home-intro p { color: var(--muted); margin: 0; }
.home-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.home-actions a { min-height: 60px; font-size: 1rem; }
.home-actions a:first-child { grid-column: 1 / -1; background: #06669e; color: #fff; border-bottom: 4px solid #91c73e; }
.emergency-box { display: flex; align-items: center; justify-content: center; gap: .85rem; padding: .9rem 1rem; border: 1px solid #f1cb92; background: #fff5e7; border-radius: var(--radius); color: #7a4700; text-decoration: none; font-size: .88rem; }
.emergency-box strong { display: block; font-size: 1rem; }
body[data-page="utama"] { height: 100dvh; min-height: 0; overflow: hidden; }
body[data-page="utama"] .shell { display: flex; min-height: 0; padding-block: 1rem; }
body[data-page="utama"] .site-footer { flex-shrink: 0; }
.login-card { margin: .5rem auto; }
.login-card h1 { font-size: 1.65rem; }
.login-icon { width: 48px; height: 48px; display: grid; place-items: center; margin-bottom: 1rem; border-radius: 14px; background: var(--green-050); color: var(--green-800); }
.draft-bar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .7rem; }
.draft-bar .btn { flex-shrink: 0; }
.status-result { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding-block: 1rem; border-top: 1px solid var(--line); }
.status-result p { width: 100%; }
@media (max-width: 380px) {
  .site-header { padding-inline: .65rem; gap: .4rem; }
  .brand { gap: .45rem; }
  .brand-logo { width: 44px; height: 38px; }
  .shell { padding-inline: .85rem; }
  .card { padding: 1rem; }
  .home-actions a { font-size: .9rem; }
}
@media (max-height: 650px) {
  body[data-page="utama"] .site-footer { display: none; }
  .home-panel { gap: .75rem; }
  .home-intro h1 { font-size: 1.5rem; margin-bottom: .25rem; }
  .home-intro p { font-size: .85rem; }
  .home-actions a { min-height: 48px; }
  .emergency-box { padding: .6rem 1rem; }
}
/* Skrin landskap pendek: semua tindakan kekal boleh dicapai. */
@media (max-height: 460px) and (min-width: 540px) {
  body[data-page="utama"] .brand-text small { display: none; }
  body[data-page="utama"] .site-header { padding-block: .3rem; }
  .home-panel { grid-template-columns: 1fr 1.3fr; align-items: center; max-width: 800px; gap: .5rem 1rem; }
  .home-actions { grid-row: span 2; }
  .home-intro h1 { font-size: 1.2rem; }
  .home-intro p { display: none; }
  .emergency-box { grid-column: 1; grid-row: 2; font-size: .75rem; }
  .emergency-box strong { font-size: .85rem; }
}
@media (prefers-color-scheme: dark) {
  :root { --ink: #e8f1f8; --ink-soft: #c0cfdb; --muted: #a0b6c6; --line: #304655; --line-soft: #243a49; --surface: #132837; --surface-2: #193140; --wash: #0c1d29; --green-800: #80cafa; --green-600: #4babe4; --green-100: #213e52; --green-050: #1a3548; }
  .btn-green, .uploader input::file-selector-button { background: #08689f; color: #fff; }
  .emergency-box { color: #ffcf86; background: #302719; border-color: #665031; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; } }

.home-actions a { padding-inline: .6rem; font-size: clamp(.82rem, 3.6vw, .95rem); white-space: nowrap; }

/* Latar imej asal diberi lapisan cerah tanpa mengubah fail imej. */
body[data-page="utama"] {
  background: linear-gradient(rgba(243,247,251,.79), rgba(243,247,251,.87)), url('../images/landslide-background.png') center / cover no-repeat;
}
body[data-page="utama"] .site-footer { background: rgba(255,255,255,.72); }
.home-intro h1 { color: #102f45; text-shadow: 0 1px 8px rgba(255,255,255,.7); }
.btn { border: 0; }
.btn-outline { background: var(--green-050); }
.home-actions a:first-child { border: 0; }
.home-actions .btn-outline { background: rgba(255,255,255,.9); color: #075986; }
.draft-reset { border: 0; background: none; padding: .35rem .2rem; min-height: 44px; font: inherit; font-size: .8rem; color: var(--green-800); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; flex-shrink: 0; }
.submit-overlay { position: fixed; inset: 0; z-index: 200; background: rgba(12,29,41,.6); display: grid; place-items: center; padding: 1.5rem; }
.submit-message { width: min(100%, 360px); padding: 2rem 1.5rem; border-radius: 20px; background: var(--surface); color: var(--ink); text-align: center; box-shadow: var(--shadow-lg); }
.submit-message strong { display: block; }
.submit-message p { margin: .5rem 0 0; font-size: .9rem; color: var(--muted); }
.submit-spinner { display: block; width: 36px; height: 36px; margin: 0 auto 1rem; border: 3px solid var(--line); border-top-color: var(--green-800); border-radius: 50%; animation: submit-spin .8s linear infinite; }
@keyframes submit-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .submit-spinner { animation: none; } }
@media (prefers-color-scheme: dark) {
  body[data-page="utama"] { background-image: linear-gradient(rgba(12,29,41,.78), rgba(12,29,41,.86)), url('../images/landslide-background.png'); }
  body[data-page="utama"] .site-footer { background: rgba(12,29,41,.8); }
  .home-intro h1 { color: #edf7ff; text-shadow: none; }
}
