/* ==========================================================
   LEXORA — Stylesheet tunggal
   Mobile-first · CSS variables · tema terang/gelap via [data-theme]
   ========================================================== */

/* ---------- 1. Variabel tema ---------- */
:root,
[data-theme="light"] {
  --primary: #8b0000;          /* merah marun */
  --primary-hover: #a50f0f;
  --primary-soft: #fbeaea;
  --primary-text: #8b0000;     /* teks berwarna primer di atas latar terang */
  --on-primary: #ffffff;

  --secondary: #006400;        /* hijau tua */
  --secondary-hover: #0a7a0a;
  --secondary-soft: #e6f4e6;
  --secondary-text: #006400;
  --on-secondary: #ffffff;

  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --surface-3: #eef0f3;
  --text: #1f2328;
  --text-muted: #5b6470;
  --border: #e1e4e8;
  --border-strong: #c9ced6;
  --focus: #1a73e8;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 2px 10px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .16);
  --overlay: rgba(15, 18, 24, .55);

  /* Status */
  --st-terkirim: #1d4ed8;  --st-terkirim-bg: #e3ecff;
  --st-proses:   #a15c00;  --st-proses-bg:   #fff1d6;
  --st-selesai:  #006400;  --st-selesai-bg:  #e3f4e3;

  /* Urgensi */
  --u-rendah:  #475467;  --u-rendah-bg:  #eef0f3;
  --u-sedang:  #1d4ed8;  --u-sedang-bg:  #e3ecff;
  --u-tinggi:  #b45309;  --u-tinggi-bg:  #ffedd5;
  --u-darurat: #ffffff;  --u-darurat-bg: #c40000;

  /* Info / peringatan */
  --info: #1d4ed8;       --info-bg: #e8f0ff;
  --warning: #8a5300;    --warning-bg: #fff4dc;
  --danger: #b00020;     --danger-bg: #fdecee;
  --success: #006400;    --success-bg: #e6f4e6;

  /* Warna grafik (dibaca chart.js lewat getComputedStyle) */
  --chart-1: #8b0000; --chart-2: #006400; --chart-3: #1d4ed8;
  --chart-4: #d97706; --chart-5: #7c3aed; --chart-6: #0891b2;
  --chart-grid: #e5e7eb; --chart-text: #5b6470;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --tap: 48px;                 /* tinggi minimum target sentuh */
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}

[data-theme="dark"] {
  /* Primer/sekunder dicerahkan agar kontras tetap baik di latar gelap */
  --primary: #b3261e;
  --primary-hover: #c9372e;
  --primary-soft: #3a1a1a;
  --primary-text: #ff8a80;
  --on-primary: #ffffff;

  --secondary: #2e7d32;
  --secondary-hover: #388e3c;
  --secondary-soft: #15301a;
  --secondary-text: #81c784;
  --on-secondary: #ffffff;

  --bg: #111317;
  --surface: #1a1d23;
  --surface-2: #20242b;
  --surface-3: #272b33;
  --text: #e8eaed;
  --text-muted: #a3aab5;
  --border: #2f343d;
  --border-strong: #3d444f;
  --focus: #8ab4f8;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 2px 12px rgba(0, 0, 0, .45);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .6);
  --overlay: rgba(0, 0, 0, .7);

  --st-terkirim: #9ab8ff;  --st-terkirim-bg: #1e2a47;
  --st-proses:   #ffc266;  --st-proses-bg:   #3a2c12;
  --st-selesai:  #81c784;  --st-selesai-bg:  #183020;

  --u-rendah:  #c3c9d2;  --u-rendah-bg:  #2a2f37;
  --u-sedang:  #9ab8ff;  --u-sedang-bg:  #1e2a47;
  --u-tinggi:  #ffb36b;  --u-tinggi-bg:  #3d2a14;
  --u-darurat: #ffffff;  --u-darurat-bg: #d32f2f;

  --info: #9ab8ff;       --info-bg: #1b2640;
  --warning: #ffc266;    --warning-bg: #352a12;
  --danger: #ff8a80;     --danger-bg: #3a1a1c;
  --success: #81c784;    --success-bg: #173020;

  --chart-1: #ff6f61; --chart-2: #66bb6a; --chart-3: #7aa7ff;
  --chart-4: #ffb74d; --chart-5: #b39ddb; --chart-6: #4dd0e1;
  --chart-grid: #2f343d; --chart-text: #a3aab5;
  color-scheme: dark;
}

/* ---------- 2. Reset & dasar ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s var(--ease), color .25s var(--ease);
}
body > main { flex: 1 0 auto; }
img, video, canvas, svg { max-width: 100%; }
img, video { height: auto; display: block; }
a { color: var(--primary-text); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration: none; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; font-weight: 800; }
h1, .h1 { font-size: 1.6rem; }
h2, .h2 { font-size: 1.3rem; }
h3, .h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
small, .small { font-size: .875rem; }
code, .mono { font-family: var(--mono); font-size: .9em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--primary); color: var(--on-primary); }
[hidden] { display: none !important; }

.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 1000;
  background: var(--primary); color: var(--on-primary); padding: 10px 16px; border-radius: var(--radius-sm);
}
.skip-link:focus { left: 8px; }

/* ---------- 3. Tata letak ---------- */
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.container.narrow { max-width: 640px; }
.container.medium { max-width: 860px; }
main.container { padding-top: 16px; padding-bottom: 32px; }

.grid { display: grid; gap: 16px; }
.grid-2, .grid-3, .grid-4 { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }
.grow { flex: 1 1 auto; }

/* ---------- 4. Header ---------- */
.app-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding-top: env(safe-area-inset-top);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); min-width: 0; }
.brand .logo { flex: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-weight: 800; font-size: 1.25rem; letter-spacing: .08em; color: var(--primary-text); line-height: 1.1; }
.brand-tagline { font-size: .75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.user-chip {
  display: none; align-items: center; gap: 6px; padding: 6px 10px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; font-size: .85rem; font-weight: 700;
}
.user-chip-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-tag { background: var(--primary-soft); color: var(--primary-text); border-radius: 999px; padding: 1px 8px; font-size: .72rem; }
@media (min-width: 720px) { .user-chip { display: inline-flex; } }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  cursor: pointer; transition: background-color .2s, transform .15s var(--ease);
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn:active { transform: scale(.92); }
.theme-toggle .when-dark { display: none; }
[data-theme="dark"] .theme-toggle .when-dark { display: inline-flex; }
[data-theme="dark"] .theme-toggle .when-light { display: none; }
.theme-toggle .ico { transition: transform .4s var(--ease); }
.inline-form { display: inline; margin: 0; }

/* Logo Otomatis Sesuai Tema (Light / Dark) */
.logo-dark { display: none !important; }
.logo-light { display: inline-block; }
[data-theme="dark"] .logo-light { display: none !important; }
[data-theme="dark"] .logo-dark { display: inline-block !important; }
.brand .logo-light, .brand .logo-dark { display: block; }
[data-theme="dark"] .brand .logo-light { display: none !important; }
[data-theme="dark"] .brand .logo-dark { display: block !important; }
.landing-logo, .login-logo { margin: 0 auto; display: block; }
[data-theme="dark"] .landing-logo.logo-dark, [data-theme="dark"] .login-logo.logo-dark { display: block !important; margin: 0 auto; }

/* Navigasi */
.app-nav { border-top: 1px solid var(--border); background: var(--surface); }
.nav-inner { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.nav-inner::-webkit-scrollbar { display: none; }
.nav-link {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  padding: 12px 14px; color: var(--text-muted); text-decoration: none; font-weight: 700; font-size: .92rem;
  border-bottom: 3px solid transparent; transition: color .2s, border-color .2s;
}
.nav-link:hover { color: var(--text); }
.nav-link.active { color: var(--primary-text); border-bottom-color: var(--primary); }

/* Banner darurat */
.emergency-bar { background: linear-gradient(90deg, #8b0000, #c40000); color: #fff; }
[data-theme="dark"] .emergency-bar { background: linear-gradient(90deg, #7a1010, #b3261e); }
.emergency-inner { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 8px; padding-bottom: 8px; }
.emergency-text { display: inline-flex; align-items: center; gap: 8px; font-size: .92rem; }
.emergency-text .ico { animation: pulse-ico 1.8s ease-in-out infinite; }

/* Footer */
.app-footer { margin-top: auto; padding: 20px 0 calc(20px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--surface); font-size: .85rem; text-align: center; }
.app-footer p { margin: 2px 0; }

/* ---------- 5. Kartu ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px; box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 16px; }
.card-title { font-size: 1.1rem; font-weight: 800; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.card-sub { color: var(--text-muted); font-size: .9rem; margin-top: -6px; margin-bottom: 12px; }
.card-flat { box-shadow: none; }
.card-accent { border-top: 4px solid var(--primary); }
@media (min-width: 640px) { .card { padding: 22px; } }

/* ---------- 6. Tombol ---------- */
.btn {
  --btn-bg: #e5e7eb; --btn-fg: #1f2937; --btn-bd: #cbd5e1;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 10px 18px;
  font: inherit; font-weight: 800; font-size: 1rem; line-height: 1.2; text-decoration: none; text-align: center;
  color: var(--btn-fg); background: var(--btn-bg); border: 1.5px solid var(--btn-bd); border-radius: var(--radius);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .04);
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: background-color .15s, border-color .15s, transform .12s var(--ease), box-shadow .15s, opacity .15s;
}
.btn:hover {
  background: #d1d5db;
  border-color: #9ca3af;
  color: #111827;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, .14);
}
.btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .1);
}
.btn[disabled], .btn.disabled { opacity: .55; cursor: not-allowed; transform: none; filter: none; box-shadow: none; }

/* Tombol utama merah (primary) */
.btn-primary {
  --btn-bg: var(--primary);
  --btn-fg: #ffffff;
  --btn-bd: var(--primary);
  color: #ffffff !important;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-hover) 100%);
  box-shadow: 0 3px 8px rgba(139, 0, 0, .28);
}
.btn-primary:hover {
  background: var(--primary-hover);
  color: #ffffff !important;
  box-shadow: 0 6px 16px rgba(139, 0, 0, .38);
}
.btn-primary:active {
  box-shadow: 0 2px 4px rgba(139, 0, 0, .25);
}

/* Tombol utama hijau (secondary / success) */
.btn-secondary {
  --btn-bg: var(--secondary);
  --btn-fg: #ffffff;
  --btn-bd: var(--secondary);
  color: #ffffff !important;
  background: linear-gradient(180deg, var(--secondary) 0%, var(--secondary-hover) 100%);
  box-shadow: 0 3px 8px rgba(0, 100, 0, .28);
}
.btn-secondary:hover {
  background: var(--secondary-hover);
  color: #ffffff !important;
  box-shadow: 0 6px 16px rgba(0, 100, 0, .38);
}
.btn-secondary:active {
  box-shadow: 0 2px 4px rgba(0, 100, 0, .25);
}

/* Tombol biasa: Outline gray & dark gray */
.btn-outline {
  --btn-bg: transparent;
  --btn-fg: #374151;
  --btn-bd: #9ca3af;
  border-width: 1.5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}
.btn-outline:hover {
  background: #e5e7eb;
  border-color: #6b7280;
  color: #111827;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .1);
}

/* Tombol biasa: Neutral & Ghost */
.btn-neutral, .btn-ghost {
  --btn-bg: #f3f4f6;
  --btn-fg: #374151;
  --btn-bd: #d1d5db;
  border-width: 1.5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
}
.btn-neutral:hover, .btn-ghost:hover {
  background: #e5e7eb;
  border-color: #9ca3af;
  color: #111827;
}

/* Helper varian warna gray & dark gray */
.btn-gray {
  background: #e5e7eb;
  color: #1f2937;
  border: 1.5px solid #cbd5e1;
}
.btn-gray:hover {
  background: #d1d5db;
  border-color: #9ca3af;
  color: #111827;
}
.btn-dark-gray {
  background: #374151;
  color: #ffffff !important;
  border: 1.5px solid #1f2937;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .2);
}
.btn-dark-gray:hover {
  background: #1f2937;
  color: #ffffff !important;
  border-color: #111827;
}

[data-theme="dark"] .btn {
  --btn-bg: #272b33;
  --btn-fg: #e8eaed;
  --btn-bd: #3d444f;
}
[data-theme="dark"] .btn:hover {
  background: #374151;
  border-color: #4b5563;
  color: #ffffff;
}
[data-theme="dark"] .btn-outline {
  --btn-bg: transparent;
  --btn-fg: #d1d5db;
  --btn-bd: #4b5563;
}
[data-theme="dark"] .btn-outline:hover {
  background: #272b33;
  border-color: #9ca3af;
  color: #ffffff;
}
[data-theme="dark"] .btn-neutral,
[data-theme="dark"] .btn-ghost {
  --btn-bg: #20242b;
  --btn-fg: #d1d5db;
  --btn-bd: #3d444f;
}
[data-theme="dark"] .btn-neutral:hover,
[data-theme="dark"] .btn-ghost:hover {
  background: #2d333b;
  border-color: #4b5563;
  color: #ffffff;
}
[data-theme="dark"] .btn-gray {
  background: #374151;
  color: #f3f4f6;
  border-color: #4b5563;
}
[data-theme="dark"] .btn-gray:hover {
  background: #4b5563;
  color: #ffffff;
}
[data-theme="dark"] .btn-dark-gray {
  background: #1f2937;
  color: #ffffff !important;
  border-color: #111827;
}
[data-theme="dark"] .btn-dark-gray:hover {
  background: #111317;
}

.btn-danger {
  --btn-bg: var(--danger-bg);
  --btn-fg: var(--danger);
  --btn-bd: var(--danger);
  border-width: 1.5px;
  box-shadow: 0 2px 5px rgba(176, 0, 32, .12);
}
.btn-danger:hover {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 4px 10px rgba(176, 0, 32, .25);
}

.btn-emergency {
  --btn-bg: #fff;
  --btn-fg: #8b0000;
  --btn-bd: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
}
.btn-emergency:hover {
  background: #fdf2f2;
}

.btn-success {
  --btn-bg: var(--success);
  --btn-fg: #fff;
  --btn-bd: var(--success);
  box-shadow: 0 2px 8px rgba(0, 100, 0, .25);
}

.btn-block { display: flex; width: 100%; }
.btn-lg { min-height: 56px; font-size: 1.08rem; padding: 14px 22px; border-radius: var(--radius-lg); }
.btn-sm { min-height: 38px; padding: 6px 14px; font-size: .88rem; border-radius: var(--radius-sm); }
.btn-link { background: none; border: 0; padding: 0; color: var(--primary-text); font: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; box-shadow: none; }
.btn .spinner { width: 18px; height: 18px; border-width: 2.5px; }

/* Tombol media foto/video */
.media-btn-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 10px;
}
.btn-media {
  min-height: 52px;
  font-size: .95rem;
  font-weight: 800;
  border-radius: var(--radius);
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .08);
  transition: all .15s ease;
  white-space: nowrap;
}
@media (max-width: 380px) {
  .media-btn-grid { gap: 8px; }
  .btn-media { font-size: .84rem; padding: 8px 6px; gap: 6px; }
  .btn-media .ico { width: 18px; height: 18px; }
}
.btn-media:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 12px rgba(0, 0, 0, .15);
}
.btn-media:active {
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .1);
}
.btn-camera, #btn-foto {
  border: 2px solid var(--primary);
  background: var(--primary-soft);
  color: var(--primary-text);
  box-shadow: 0 2px 6px rgba(139, 0, 0, .15);
}
.btn-camera:hover, #btn-foto:hover {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 5px 14px rgba(139, 0, 0, .3);
}
.btn-video, #btn-video {
  border: 2px solid var(--primary);
  background: var(--primary-soft);
  color: var(--primary-text);
  box-shadow: 0 2px 6px rgba(139, 0, 0, .15);
}
.btn-video:hover, #btn-video:hover {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 5px 14px rgba(139, 0, 0, .3);
}
.btn-gallery, #btn-galeri {
  display: flex;
  width: 100%;
  border: 2px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 2px 5px rgba(0, 0, 0, .08);
}
.btn-gallery:hover, #btn-galeri:hover {
  border-color: var(--primary);
  background: var(--surface-2);
  color: var(--primary-text);
  box-shadow: 0 5px 12px rgba(0, 0, 0, .14);
}

/* ---------- 7. Formulir ---------- */
.field { margin-bottom: 16px; }
.label, label.label { display: block; font-weight: 700; margin-bottom: 6px; font-size: .95rem; }
.label .req { color: var(--danger); margin-left: 2px; }
.input, .select, .textarea {
  display: block; width: 100%; min-height: var(--tap);
  padding: 11px 14px; font: inherit; font-size: 1rem; color: var(--text);
  background: var(--surface); border: 1.5px solid var(--border-strong); border-radius: var(--radius);
  transition: border-color .2s, box-shadow .2s, background-color .25s;
  -webkit-appearance: none; appearance: none;
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.select {
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent); }
.input::placeholder, .textarea::placeholder { color: var(--text-muted); opacity: .8; }
.input[readonly] { background: var(--surface-2); }
.is-invalid { border-color: var(--danger) !important; }
.help { font-size: .85rem; color: var(--text-muted); margin-top: 6px; }
.error-text { font-size: .85rem; color: var(--danger); margin-top: 6px; font-weight: 600; }
input[type="datetime-local"].input { min-height: var(--tap); }

/* Checkbox & radio besar */
.check { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; padding: 12px; border: 1.5px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--primary); flex: none; }
.check-body { font-weight: 700; }
.check-body small { display: block; font-weight: 400; color: var(--text-muted); margin-top: 2px; }

/* Pilihan berbentuk tombol (jenis, urgensi) */
.choice-group { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); }
.choice-group.cols-2 { grid-template-columns: repeat(2, 1fr); }
.choice-group.cols-3 { grid-template-columns: repeat(3, 1fr); gap: 10px; }
.choice-group.cols-4 { grid-template-columns: repeat(4, 1fr); gap: 8px; }

@media (max-width: 560px) {
  /* Jenis pengaduan: 3 item 1 baris di mobile */
  .choice-group.cols-3 {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  .choice-group.cols-3 .choice span {
    min-height: 56px;
    padding: 6px 3px;
    font-size: .74rem;
    line-height: 1.15;
    gap: 4px;
    word-break: break-word;
    text-align: center;
  }
  .choice-group.cols-3 .choice span .ico {
    width: 20px;
    height: 20px;
  }

  /* Tingkat urgensi: 4 item 1 baris di mobile */
  .choice-group.cols-4 {
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
  }
  .choice-group.cols-4 .choice span {
    min-height: 42px;
    padding: 6px 2px;
    font-size: .75rem;
    line-height: 1.1;
  }
}
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 64px; padding: 10px; text-align: center; font-weight: 800;
  border: 2px solid var(--border-strong); border-radius: var(--radius); background: var(--surface);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .03);
  cursor: pointer; transition: border-color .15s, background-color .15s, transform .12s var(--ease), box-shadow .15s;
}
.choice span:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, .12);
}
.choice span:active {
  transform: translateY(1px) scale(.98);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}
.choice input:checked + span {
  border-color: var(--secondary);
  background: var(--secondary-soft);
  color: var(--secondary-text);
  box-shadow: 0 0 0 1px var(--secondary), 0 3px 6px rgba(139, 0, 0, .15);
}
.choice input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.choice.u-rendah  input:checked + span { border-color: var(--u-rendah);  background: var(--u-rendah-bg);  color: var(--u-rendah); box-shadow: 0 0 0 1px var(--u-rendah); }
.choice.u-sedang  input:checked + span { border-color: var(--u-sedang);  background: var(--u-sedang-bg);  color: var(--u-sedang); box-shadow: 0 0 0 1px var(--u-sedang); }
.choice.u-tinggi  input:checked + span { border-color: var(--u-tinggi);  background: var(--u-tinggi-bg);  color: var(--u-tinggi); box-shadow: 0 0 0 1px var(--u-tinggi); }
.choice.u-darurat input:checked + span { border-color: var(--u-darurat-bg); background: var(--u-darurat-bg); color: var(--u-darurat); box-shadow: 0 0 0 1px var(--u-darurat-bg), 0 4px 10px rgba(196, 0, 0, .3); }

/* Honeypot anti-spam (disembunyikan dari manusia) */
.hp-field { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }

/* ---------- 8. Badge ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px;
  border-radius: 999px; font-size: .78rem; font-weight: 800; line-height: 1.4; white-space: nowrap;
  background: var(--surface-3); color: var(--text-muted);
}
.badge-terkirim { background: var(--st-terkirim-bg); color: var(--st-terkirim); }
.badge-proses   { background: var(--st-proses-bg);   color: var(--st-proses); }
.badge-selesai  { background: var(--st-selesai-bg);  color: var(--st-selesai); }
.badge-u-rendah  { background: var(--u-rendah-bg);  color: var(--u-rendah); }
.badge-u-sedang  { background: var(--u-sedang-bg);  color: var(--u-sedang); }
.badge-u-tinggi  { background: var(--u-tinggi-bg);  color: var(--u-tinggi); }
.badge-u-darurat { background: var(--u-darurat-bg); color: var(--u-darurat); }
.badge-terlambat { background: var(--danger); color: #fff; animation: pulse-badge 2s ease-in-out infinite; }
[data-theme="dark"] .badge-terlambat { background: #d32f2f; }
.badge-luar  { background: var(--warning-bg); color: var(--warning); border: 1px dashed currentColor; }
.badge-anonim { background: var(--surface-3); color: var(--text-muted); }
.badge-count { background: var(--secondary-soft); color: var(--secondary-text); }

/* ---------- 9. Alert ---------- */
.alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--radius); border: 1px solid transparent; margin-bottom: 12px; font-weight: 600;
  animation: fade-in .3s var(--ease);
}
.alert .ico { flex: none; margin-top: 2px; }
.alert-info       { background: var(--info-bg);    color: var(--info);    border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.alert-sukses     { background: var(--success-bg); color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.alert-peringatan { background: var(--warning-bg); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.alert-error      { background: var(--danger-bg);  color: var(--danger);  border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.flash-wrap { padding-top: 12px; }

/* Kotak peringatan darurat besar */
.emergency-box {
  border: 2px solid var(--u-darurat-bg); background: var(--danger-bg); color: var(--text);
  border-radius: var(--radius-lg); padding: 16px; text-align: center; animation: fade-in .3s var(--ease);
}
.emergency-box h3 { color: var(--danger); display: flex; align-items: center; justify-content: center; gap: 8px; }

/* Banner merah SLA (petugas) */
.sla-banner {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px; margin-bottom: 16px;
  background: var(--danger); color: #fff; border-radius: var(--radius); font-weight: 800;
}
[data-theme="dark"] .sla-banner { background: #b71c1c; }

/* ---------- 10. Kartu status GPS ---------- */
.gps-card {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 16px;
  border-radius: var(--radius); border: 1.5px solid var(--border); background: var(--surface-2); font-weight: 700;
}
.gps-card .gps-ico { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); }
.gps-card.mencari .gps-ico { color: var(--info); animation: pulse-ico 1.4s ease-in-out infinite; }
.gps-card.ok { border-color: var(--success); background: var(--success-bg); color: var(--success); }
.gps-card.ok .gps-ico { background: var(--success); color: #fff; }
.gps-card.lemah { border-color: var(--warning); background: var(--warning-bg); color: var(--warning); }
.gps-card.error { border-color: var(--danger); background: var(--danger-bg); color: var(--danger); }
.gps-card small { display: block; font-weight: 400; color: var(--text-muted); }

/* ---------- 11. Tabel ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { background: var(--surface-2); font-weight: 800; color: var(--text-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- 12. Daftar laporan (kartu) ---------- */
.report-list { display: grid; gap: 12px; }
.report-item {
  display: block; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-left: 5px solid var(--border-strong);
  border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow-sm);
  transition: transform .15s var(--ease), box-shadow .2s;
}
.report-item:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.report-item.p-4 { border-left-color: var(--u-darurat-bg); }
.report-item.p-3 { border-left-color: var(--u-tinggi); }
.report-item.p-2 { border-left-color: var(--u-sedang); }
.report-item.p-1 { border-left-color: var(--u-rendah); }
.report-item.is-new { animation: highlight 2s var(--ease); }
.report-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; font-size: .85rem; color: var(--text-muted); }
.ticket { font-family: var(--mono); font-weight: 700; font-size: .9rem; color: var(--primary-text); }

/* ---------- 13. Timeline status ---------- */
.timeline { list-style: none; margin: 0; padding: 0 0 0 22px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.timeline li { position: relative; padding-bottom: 14px; }
.timeline li::before {
  content: ""; position: absolute; left: -22px; top: 5px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--border-strong);
}
.timeline li.t-terkirim::before { border-color: var(--st-terkirim); }
.timeline li.t-proses::before   { border-color: var(--st-proses); }
.timeline li.t-selesai::before  { border-color: var(--st-selesai); background: var(--st-selesai); }
.timeline .t-time { font-size: .8rem; color: var(--text-muted); }

/* ---------- 14. Percakapan (komentar) ---------- */
.chat { display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 85%; padding: 10px 14px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); word-wrap: break-word; }
.bubble .b-meta { font-size: .75rem; color: var(--text-muted); margin-bottom: 2px; font-weight: 700; }
.bubble.me { align-self: flex-end; background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 25%, transparent); border-bottom-right-radius: 4px; }
.bubble.staf { align-self: flex-start; background: var(--secondary-soft); border-color: color-mix(in srgb, var(--secondary) 25%, transparent); border-bottom-left-radius: 4px; }
.bubble.sistem { align-self: center; background: transparent; border-style: dashed; font-size: .85rem; color: var(--text-muted); text-align: center; }
.bubble p { margin: 0; white-space: pre-wrap; }

/* ---------- 15. Galeri & media ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.gallery a, .gallery .thumb { position: relative; display: block; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-3); }
.gallery img { width: 100%; height: 100%; object-fit: cover; }
.thumb .thumb-del {
  position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; border-radius: 50%; border: 0;
  background: rgba(0, 0, 0, .65); color: #fff; display: grid; place-items: center; cursor: pointer;
}
.media-video { width: 100%; max-height: 420px; border-radius: var(--radius); background: #000; }

/* Progress bar unggah */
.progress { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--secondary); border-radius: 999px; transition: width .25s linear; }
.progress.gagal .progress-bar { background: var(--danger); }
.upload-item { display: flex; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.upload-item .u-info { flex: 1; min-width: 0; font-size: .82rem; }
.upload-item .u-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 16. Statistik ---------- */
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow-sm);
}
.stat-label { font-size: .82rem; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.stat-value { font-size: 1.9rem; font-weight: 800; line-height: 1.2; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-note { font-size: .82rem; color: var(--text-muted); }
.stat.primary .stat-value { color: var(--primary-text); }
.stat.secondary .stat-value { color: var(--secondary-text); }
.chart-box { position: relative; width: 100%; min-height: 240px; }
.chart-box canvas { height: 260px; display: block; }

/* Bintang rating */
.stars { display: inline-flex; flex-direction: row-reverse; gap: 4px; }
.stars input { position: absolute; opacity: 0; pointer-events: none; }
.stars label { cursor: pointer; color: var(--border-strong); transition: color .15s, transform .15s var(--ease); }
.stars label svg { width: 40px; height: 40px; }
.stars label:hover, .stars label:hover ~ label, .stars input:checked ~ label { color: #f5a400; }
.stars label:active { transform: scale(.9); }
.stars-static { color: #f5a400; letter-spacing: 2px; }
.stars-static .off { color: var(--border-strong); }

/* ---------- 17. Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: flex-end; justify-content: center; background: var(--overlay); padding: 0; animation: fade-in .2s var(--ease); }
.modal[hidden] { display: none !important; }
.modal-dialog {
  width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
  background: var(--surface); border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding: 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-lg); animation: slide-up .28s var(--ease);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.modal-head h2 { margin: 0; font-size: 1.2rem; }
.modal-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
@media (min-width: 640px) {
  .modal { align-items: center; padding: 16px; }
  .modal-dialog { border-radius: var(--radius-lg); }
  .modal-actions { flex-direction: row; justify-content: flex-end; }
}
body.modal-open { overflow: hidden; }

/* ---------- 18. Toast ---------- */
.toast-wrap { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  background: #1f2328; color: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); font-weight: 700;
  animation: toast-in .3s var(--ease);
}
[data-theme="dark"] .toast { background: #e8eaed; color: #111317; }
.toast.sukses { border-left: 5px solid #2e7d32; }
.toast.error { border-left: 5px solid #d32f2f; }
.toast.info { border-left: 5px solid #1d4ed8; }
.toast.keluar { animation: toast-out .25s var(--ease) forwards; }

/* ---------- 19. Spinner & skeleton ---------- */
.spinner { display: inline-block; width: 22px; height: 22px; border: 3px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: middle; }
.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius-sm); min-height: 16px; }

/* ---------- 20. Tab Navigasi Petugas & Filter ---------- */
.nav-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }
.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-weight: 800;
  font-size: .96rem;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all .15s ease;
  white-space: nowrap;
}
.nav-tab:hover {
  color: var(--text);
  border-bottom-color: var(--border-strong);
}
.nav-tab.active {
  color: var(--primary-text);
  border-bottom-color: var(--primary);
}
.nav-tab .tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  font-size: .75rem;
  font-weight: 800;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text);
}
.nav-tab.active .tab-badge {
  background: var(--primary-soft);
  color: var(--primary-text);
}

.filter-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  align-items: end;
}
@media (max-width: 600px) {
  .filter-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- 20. Filter chips & tab ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 14px;
  border: 1.5px solid var(--border-strong); border-radius: 999px; background: var(--surface);
  color: var(--text); font-weight: 700; font-size: .9rem; text-decoration: none; cursor: pointer;
}
.chip.active, .chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.chip .chip-count { background: rgba(0, 0, 0, .12); border-radius: 999px; padding: 0 7px; font-size: .78rem; }

/* ---------- 21. Kosong / ilustrasi ---------- */
.empty { text-align: center; padding: 32px 16px; color: var(--text-muted); }
.empty-ico { color: var(--text-muted); display: flex; justify-content: center; margin-bottom: 8px; opacity: .7; }

/* Halaman login */
.auth-wrap { max-width: 420px; margin: 6vh auto 0; }
.auth-head { text-align: center; margin-bottom: 18px; }
.auth-head .logo { margin: 0 auto 8px; display: block; }
.auth-head .brand-name { font-size: 1.8rem; }

/* Panduan izin (GPS/kamera) */
.guide-tabs { display: flex; gap: 4px; padding: 4px; margin-bottom: 14px; background: var(--surface-3); border-radius: 999px; }
.guide-tab {
  flex: 1; min-height: 38px; padding: 6px 10px; border: 0; border-radius: 999px; background: transparent;
  font: inherit; font-size: .85rem; font-weight: 800; color: var(--text-muted); cursor: pointer; transition: background-color .2s, color .2s;
}
.guide-tab.active { background: var(--surface); color: var(--primary-text); box-shadow: var(--shadow-sm); }
.guide-panel { animation: fade-in .25s var(--ease); }
.guide-steps { counter-reset: langkah; list-style: none; padding: 0; margin: 14px 0 10px; }
.guide-steps li { counter-increment: langkah; position: relative; padding-left: 40px; min-height: 28px; margin-bottom: 12px; line-height: 1.5; }
.guide-steps li::before {
  content: counter(langkah); position: absolute; left: 0; top: -1px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-weight: 800; font-size: .85rem;
}
.guide-figure { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; display: flex; justify-content: center; align-items: center; }
.guide-figure svg { height: auto; max-height: 240px; }
.guide-figure img, .guide-img { max-width: 100%; height: auto; max-height: 260px; object-fit: contain; border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); display: block; }
.guide-card { border-left: 4px solid var(--danger); }

/* Tombol pasang aplikasi / status offline */
.offline-bar { background: var(--warning-bg); color: var(--warning); text-align: center; padding: 8px 12px; font-weight: 700; font-size: .9rem; }

/* ---------- 22. Utilitas ---------- */
.muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--primary-text); }
.text-secondary { color: var(--secondary-text); }
.text-danger { color: var(--danger); }
.fw-bold { font-weight: 800; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 20px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 20px; }
.w-100 { width: 100%; }
.nowrap { white-space: nowrap; }
.break { word-break: break-word; overflow-wrap: anywhere; }
.pre { white-space: pre-wrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.only-print { display: none; }
.ico { flex: none; vertical-align: middle; }
.divider-text { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: .85rem; margin: 14px 0; }
.divider-text::before, .divider-text::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
dl.kv { display: grid; grid-template-columns: minmax(110px, 35%) 1fr; gap: 8px 12px; margin: 0; }
dl.kv dt { color: var(--text-muted); font-weight: 700; font-size: .9rem; }
dl.kv dd { margin: 0; word-break: break-word; }

/* ---------- 23. Animasi ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toast-in { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toast-out { to { transform: translateY(16px); opacity: 0; } }
@keyframes pulse-ico { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes pulse-badge { 0%, 100% { box-shadow: 0 0 0 0 rgba(211, 47, 47, .5); } 50% { box-shadow: 0 0 0 5px rgba(211, 47, 47, 0); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes highlight { from { background: var(--warning-bg); } to { background: var(--surface); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Layar sangat kecil */
@media (max-width: 380px) {
  .brand-tagline { display: none; }
  .emergency-text { font-size: .82rem; }
}

/* ---------- 23b. Perapian komponen halaman ---------- */
/* Cegah konten melebar keluar layar */
.grid > *, .grid-2 > *, .grid-3 > *, .grid-4 > *, .row > *, .row-between > * { min-width: 0; }
.emergency-text { min-width: 0; }
.emergency-inner .btn { flex: none; }
.gps-card .grow { min-width: 0; }
.gps-card .btn { flex: none; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.page-head h1 { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.page-head p { margin: 0; }
h1 .ico, h2 .ico, .label .ico { vertical-align: -3px; }
.badge-info { background: var(--info-bg); color: var(--info); }
.p-2 { padding: 10px !important; } .p-3 { padding: 14px !important; }
.mb-0.card-title { margin-bottom: 0; }

/* Statistik: 2 kolom di ponsel */
.grid.grid-3, .grid.grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 960px) { .grid.grid-3 { grid-template-columns: repeat(3, 1fr); gap: 16px; } .grid.grid-4 { grid-template-columns: repeat(4, 1fr); gap: 16px; } }
@media (max-width: 639px) {
  .stat, .grid > .card { padding: 14px; }
  .stat-value { font-size: 1.5rem; }
  .stat-label { font-size: .72rem; }
  .chart-box { min-height: 200px; }
  .chart-box canvas { height: 220px; }
}

/* Daftar laporan petugas */
.report-item .report-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.report-item .report-badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.report-item .report-title { font-weight: 700; margin-top: 8px; display: flex; gap: 6px; align-items: center; }
.toolbar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.search-row { display: flex; gap: 8px; }
.search-row .input { flex: 1; }
.chip-sep { width: 1px; align-self: stretch; background: var(--border); flex: none; }

/* Aksi petugas */
.action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.action-grid form { margin: 0; }
.action-grid .btn { min-height: 52px; }
.status-pill { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 52px; border-radius: var(--radius); background: var(--st-proses-bg); color: var(--st-proses); font-weight: 800; }
.done-card { border-left: 5px solid var(--secondary); background: var(--secondary-soft); }
.done-card .done-ico { width: 40px; height: 40px; border-radius: 50%; background: var(--secondary); color: #fff; display: grid; place-items: center; flex: none; }
.note-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; margin-top: 10px; }
.kv-table { width: 100%; font-size: .9rem; border-collapse: collapse; }
.kv-table td { padding: 6px 0; border-bottom: 1px dashed var(--border); vertical-align: top; }
.kv-table tr:last-child td { border-bottom: 0; }
.kv-table td:first-child { color: var(--text-muted); width: 42%; padding-right: 10px; }
.info-card .label { color: var(--text-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; display: flex; align-items: center; gap: 6px; }
.info-card .label + * { margin-top: 6px; }
.gallery img, .gallery video { border-radius: var(--radius-sm); }
.gallery video { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 1; background: #000; }
.gallery > img.gallery-img { width: 100%; height: 100% !important; max-width: none !important; max-height: none !important; aspect-ratio: 1; object-fit: cover; }

/* Kartu "Laporan Saya" */
.report-card { border-left: 5px solid var(--border-strong); padding: 0; overflow: hidden; }
.report-card-head { padding: 14px 16px; cursor: pointer; user-select: none; }
.report-card-head:hover { background: var(--surface-2); }
.report-card .report-detail { padding: 0 16px 16px; }
.report-card .report-detail > hr { margin-top: 0; }
.report-card-head .chev { transition: transform .2s var(--ease); color: var(--text-muted); }
.report-card.open .chev { transform: rotate(180deg); }

/* Timeline (varian div) */
.timeline .timeline-item { position: relative; padding: 0 0 14px 4px; }
.timeline .timeline-dot { position: absolute; left: -22px; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 3px solid var(--border-strong); }
.timeline .timeline-dot.terkirim { border-color: var(--st-terkirim); }
.timeline .timeline-dot.proses { border-color: var(--st-proses); }
.timeline .timeline-dot.selesai { border-color: var(--st-selesai); background: var(--st-selesai); }
.timeline .timeline-content p { margin: 4px 0 0; }

/* Percakapan (varian chat-bubble) */
.chat-area { display: flex; flex-direction: column; gap: 10px; }
.chat-bubble { max-width: 85%; padding: 10px 14px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); word-wrap: break-word; }
.chat-bubble p { margin: 2px 0; white-space: pre-wrap; }
.chat-author { display: block; font-size: .75rem; font-weight: 800; color: var(--text-muted); }
.chat-time { display: block; font-size: .72rem; color: var(--text-muted); text-align: right; }
.chat-pelapor { align-self: flex-end; background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 25%, transparent); border-bottom-right-radius: 4px; }
.chat-staf { align-self: flex-start; background: var(--secondary-soft); border-color: color-mix(in srgb, var(--secondary) 25%, transparent); border-bottom-left-radius: 4px; }
.chat-sistem { align-self: center; background: transparent; border-style: dashed; text-align: center; font-size: .85rem; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; margin-top: 12px; }
.chat-form .textarea { min-height: 48px; flex: 1; }
.chat-form .btn { flex: none; }

/* Rating bintang (laporan saya) */
.stars-input { display: inline-flex; gap: 4px; }
.star-btn { font-size: 2rem; line-height: 1; cursor: pointer; color: var(--border-strong); transition: transform .12s var(--ease), color .15s; }
.star-btn:active { transform: scale(.88); }

/* Filter supervisor */
.filter-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-checks .check { padding: 8px 12px; align-items: center; }
.filter-checks .check input { margin: 0; }
.filter-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 639px) { .filter-actions { width: 100%; } .filter-actions .btn { flex: 1; } }
.table td .badge + .badge { margin-left: 4px; }
.detail-block { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.dist-row { display: flex; align-items: center; gap: 10px; }
.dist-row .dist-label { width: 74px; font-weight: 700; font-size: .88rem; white-space: nowrap; }
.dist-row .dist-val { width: 80px; text-align: right; font-size: .85rem; color: var(--text-muted); white-space: nowrap; }
.big-score { font-size: 3.2rem; font-weight: 800; line-height: 1; color: #f5a400; }

/* Dokumen rekap (layar) — selalu terang agar mirip kertas */
.rekap-doc {
  --surface: #fff; --surface-2: #f8f9fb; --surface-3: #eef0f3; --text: #1f2328; --text-muted: #5b6470;
  --border: #d0d5dc; --border-strong: #9aa3ae; --primary-text: #8b0000; --secondary-text: #006400;
  background: #fff; color: #1f2328;
}
.kop-rekap { text-align: center; border-bottom: 3px double #1f2328; padding-bottom: 10px; margin-bottom: 16px; }
.kop-instansi { font-size: 1.1rem; font-weight: 800; text-transform: uppercase; letter-spacing: .02em; }
.kop-app { font-weight: 700; font-size: .95rem; }
.kop-sub { font-size: .88rem; color: #5b6470; }
.rekap-summary-table, .print-table { width: 100%; border-collapse: collapse; font-size: .88rem; margin-bottom: 16px; }
.rekap-summary-table th, .rekap-summary-table td, .print-table th, .print-table td { border: 1px solid #d0d5dc; padding: 8px 10px; text-align: left; vertical-align: top; }
.rekap-summary-table th, .print-table th { background: #f2f4f7; font-weight: 800; }
.print-table tbody tr:nth-child(even) td { background: #fafbfc; }
.rekap-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.rekap-scroll .print-table { min-width: 640px; }
.signature-box { margin-top: 28px; align-items: flex-end; }
.signature-box .ttd { text-align: right; min-width: 240px; }
.signature-box .ttd-space { height: 60px; }
.rekap-period { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.rekap-period .field { margin: 0; min-width: 140px; }

/* ---------- 24. Cetak (A4) ---------- */
@page { size: A4; margin: 15mm 14mm; }
@media print {
  :root, [data-theme="dark"] {
    --bg: #fff; --surface: #fff; --surface-2: #fff; --surface-3: #f2f2f2; --text: #000; --text-muted: #444;
    --border: #bbb; --border-strong: #999; --primary-text: #8b0000; --secondary-text: #006400;
    color-scheme: light;
  }
  body { background: #fff; color: #000; font-size: 11pt; display: block; }
  .app-header, .app-nav, .app-footer, .emergency-bar, .toast-wrap, .no-print, .btn, .skip-link, .flash-wrap { display: none !important; }
  .only-print { display: block !important; }
  .card, .stat, .table-wrap { box-shadow: none !important; border-color: #bbb; break-inside: avoid; }
  main.container { max-width: none; padding: 0; }
  a { color: #000; text-decoration: none; }
  .badge { border: 1px solid currentColor; }
  .badge-terlambat { animation: none; }
  .table th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-break { break-before: page; }
  img { max-height: 70mm; }
}

/* ---------- 25. Lightbox Foto Fullscreen (Modal Full) ---------- */
.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: flex;
  flex-direction: column;
  background: rgba(10, 12, 16, .94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fade-in .2s var(--ease);
  user-select: none;
}
.image-lightbox[hidden] {
  display: none !important;
}
.il-backdrop {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.il-container {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}
.il-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: rgba(0, 0, 0, .45);
  color: #fff;
  flex-shrink: 0;
}
.il-caption {
  font-weight: 700;
  font-size: .95rem;
  color: #e5e7eb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 12px;
}
.il-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.il-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .18);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, .3);
  cursor: pointer;
  text-decoration: none;
  transition: background-color .2s, transform .1s;
}
.il-btn:hover {
  background: rgba(255, 255, 255, .32);
}
.il-btn:active {
  transform: scale(.92);
}
.il-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  overflow: hidden;
  cursor: zoom-out;
}
.il-body img {
  max-width: 96vw;
  max-height: 84vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .65);
  cursor: default;
  animation: zoom-in .25s var(--ease);
}
.gallery-img, .gallery img, .gallery a img {
  cursor: pointer;
  transition: transform .15s var(--ease), opacity .15s;
}
.gallery-img:hover, .gallery img:hover, .gallery a img:hover {
  transform: scale(1.03);
  opacity: .92;
}
@keyframes zoom-in {
  from { transform: scale(.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ---------- 23. Halaman Landing & Onboarding ---------- */
.layar-view {
  animation: fade-in .25s var(--ease);
}
.landing-hero {
  text-align: center;
  padding: 14px 10px 18px;
}
.landing-hero .logo {
  margin: 0 auto 10px;
  display: block;
}
.landing-hero h1 {
  font-size: 1.85rem;
  font-weight: 800;
  margin: 0 0 4px;
}
.landing-hero .landing-subtitle {
  font-size: .98rem;
  color: var(--primary-text);
  font-weight: 700;
  margin-bottom: 6px;
}
.landing-hero .landing-instansi {
  font-size: .88rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.landing-slogan-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--secondary-soft);
  color: var(--secondary-text);
  border: 1px solid color-mix(in srgb, var(--secondary) 30%, transparent);
  border-radius: 999px;
  padding: 5px 16px;
  font-weight: 800;
  font-size: .9rem;
}
.access-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}
@media (min-width: 600px) {
  .access-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.access-card {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.access-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: .95rem;
}
.access-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--primary-text);
  flex: none;
}
.access-card p {
  font-size: .85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}
.mini-status-bar {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
}
@media (min-width: 560px) {
  .mini-status-bar {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---------- 25. Panel Admin UI Styling ---------- */
.admin-stat-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s;
}
.admin-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
}
.admin-stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex: none;
}
.admin-stat-icon.primary { background: rgba(139, 0, 0, .12); color: var(--primary-text); }
.admin-stat-icon.secondary { background: rgba(0, 100, 0, .12); color: var(--secondary-text); }
.admin-stat-icon.info { background: rgba(29, 78, 216, .12); color: var(--info); }
.admin-stat-icon.warning { background: rgba(245, 158, 11, .15); color: var(--warning); }
.admin-stat-icon.danger { background: rgba(220, 38, 38, .12); color: var(--danger); }
.admin-stat-icon.purple { background: rgba(139, 92, 246, .14); color: #8b5cf6; }

.admin-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}
.admin-quick-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-decoration: none;
  color: var(--text);
  transition: all .2s var(--ease);
}
.admin-quick-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  text-decoration: none;
}
.admin-quick-card:hover .admin-quick-title {
  color: var(--primary-text);
}
.admin-quick-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.admin-quick-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex: none;
}
.admin-quick-title {
  font-weight: 800;
  font-size: .98rem;
  margin: 0;
  line-height: 1.25;
  transition: color .15s;
}
.admin-quick-desc {
  font-size: .84rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0;
}

/* User avatar initial chip */
.user-avatar-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text);
  font-weight: 800;
  font-size: .85rem;
  display: grid;
  place-items: center;
  flex: none;
  border: 1px solid var(--border);
}


