:root {
  --bg: #e7eeea;
  --paper: #fbfcfb;
  --ink: #1b2c31;
  --muted: #5c7176;
  --line: #d3e1db;
  --navy: #12343c;
  --teal: #1a7464;
  --teal-d: #145e52;
  --soft: #e7f3ef;
  --gold: #e2b657;
  --kritis: #9d342c;
  --tinggi: #8d5310;
  --sedang: #1d6840;
  --rendah: #1d5164;
  --shadow: 0 12px 32px rgba(18, 52, 60, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
}
h1, h2, h3 { font-weight: 700; letter-spacing: -0.02em; }
h1 { font-size: 30px; margin: 0; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 0 0 8px; }
p { margin: 0 0 10px; }
a { color: var(--teal-d); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: 0.65; cursor: wait; }
::selection { background: #cfe7e1; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 0.85fr; }
.login-hero {
  background:
    radial-gradient(circle at 18% 0%, rgba(226, 182, 87, 0.16), transparent 28%),
    linear-gradient(165deg, #0e2a31 0%, #143e46 52%, #1a7464 140%);
  color: white;
  padding: 28px 40px 22px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 16px;
  min-height: 100vh;
}
.brand { display: flex; gap: 12px; align-items: center; color: white; text-decoration: none; padding: 0 8px 16px; }
.brand img { width: 48px; height: 54px; object-fit: contain; flex: none; }
.login-hero .brand { gap: 16px; padding: 0; }
.login-hero .brand img { width: 76px; height: 86px; }
.brand strong { display: block; font-size: 20px; letter-spacing: 0.06em; }
.login-hero .brand strong { font-size: 28px; letter-spacing: 0.08em; }
.brand small { display: block; color: #c5dbd6; font-size: 12px; }
.tim-login {
  margin: 0;
  width: 100%;
  display: grid;
  justify-items: start;
  gap: 10px;
}
.tim-bingkai {
  width: fit-content;
  max-width: 100%;
  padding: 7px;
  border: 1px solid rgba(226, 182, 87, 0.8);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}
.tim-bingkai img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: min(520px, calc(100vh - 356px));
  object-fit: contain;
  border-radius: 10px;
  background: #d9cfc3;
}
.tim-login figcaption { display: grid; gap: 2px; }
.tim-login figcaption span {
  color: #f4f8f7;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.tim-login figcaption small { color: #d5e6e2; font-size: 13px; }
.login-hero h1 {
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid rgba(226, 182, 87, 0.45);
  max-width: none;
  font-size: inherit;
  line-height: 1.15;
}
.judul-fungsi {
  display: block;
  max-width: 22em;
  margin-bottom: 8px;
  color: #e2b657;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.55;
  text-transform: uppercase;
}
.judul-nama {
  display: block;
  max-width: 14em;
  color: white;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.08;
}
.login-panel { display: grid; align-items: center; padding: 36px 28px; }
.login-card {
  width: min(440px, 100%);
  margin: 0 auto;
  background: white;
  border-radius: 18px;
  padding: 32px 28px 26px;
  border-top: 3px solid var(--gold);
  box-shadow: var(--shadow);
}
.login-card h2 { font-size: 28px; margin-bottom: 8px; }
.cepat { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.cepat-tombol { display: flex; flex-wrap: wrap; gap: 8px; }

.app { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--navy);
  color: #e7f0ee;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 22px 14px 16px;
  display: flex;
  flex-direction: column;
}
.nav { display: grid; gap: 2px; align-content: start; }
.nav-grup {
  margin: 14px 12px 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8eada6;
}
.nav-grup:first-child { margin-top: 2px; }
.nav a {
  color: #e7f0ee;
  text-decoration: none;
  display: block;
  padding: 8px 12px;
  border-radius: 10px;
}
.nav a:hover { background: rgba(255, 255, 255, 0.06); }
.nav a.aktif { background: rgba(255, 255, 255, 0.08); box-shadow: inset 3px 0 0 var(--gold); }
.side-foot {
  margin-top: auto;
  padding: 12px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: grid;
  gap: 8px;
}
.side-foot .akun {
  color: #e7f0ee;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 10px;
}
.side-foot .akun:hover,
.side-foot .akun.aktif { background: rgba(255, 255, 255, 0.08); }
.side-foot span { color: #b7ccc7; font-size: 12px; line-height: 1.4; padding: 0 12px; }
.side-foot .btn { width: 100%; color: white; border-color: rgba(255, 255, 255, 0.28); background: transparent; }

.main { min-width: 0; }
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  padding: 22px 28px 8px;
}
.identitas { display: grid; gap: 1px; margin: 0 0 6px; }
.identitas-rs {
  color: var(--teal-d);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.4;
  text-transform: uppercase;
}
.identitas-unit { color: var(--navy); font-size: 14px; font-weight: 700; line-height: 1.3; }
.who { display: flex; align-items: center; gap: 12px; text-align: right; min-width: 0; }
.who-teks { max-width: 240px; }
.who-teks span { display: block; font-weight: 700; line-height: 1.25; }
.who small { color: var(--muted); }
.main { position: relative; }
.lonceng {
  position: relative;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--navy);
  display: grid;
  place-items: center;
  flex: none;
}
.lonceng b {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--kritis);
  color: white;
  font-size: 11px;
  line-height: 18px;
}
.notifikasi {
  position: absolute;
  top: 76px;
  right: 28px;
  width: min(360px, calc(100vw - 40px));
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  z-index: 50;
  padding: 8px;
  display: grid;
  gap: 4px;
}
.notifikasi[hidden] { display: none; }
.notifikasi a, .notifikasi p { margin: 0; padding: 10px; border-radius: 10px; }
.notifikasi a { display: grid; gap: 2px; text-decoration: none; color: inherit; }
.notifikasi a:hover { background: var(--soft); }
.notifikasi span { color: var(--muted); font-size: 13px; }
.notifikasi button { justify-self: start; margin: 4px 8px 8px; }
.galeri { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.bukti { display: grid; gap: 8px; text-decoration: none; color: inherit; }
.bukti img { width: 100%; height: 160px; object-fit: cover; border-radius: 12px; background: #dce7e3; }
.bukti div { display: grid; gap: 2px; }
.bukti span { color: var(--muted); font-size: 13px; }
.content { padding: 8px 28px 48px; max-width: 1120px; }
.tumpuk { display: grid; gap: 14px; }
.intro { color: var(--muted); margin: 0; }

.banner, .peringatan {
  background: #fff6e8;
  border: 1px solid #efd3a4;
  color: #6d4a12;
  border-radius: 14px;
  padding: 12px 14px;
}
.peringatan { background: #fff4f2; border-color: #efc7c1; color: #7c2e28; }
.form-lapor { max-width: 720px; }
.pasangan-selesai { color: var(--muted); font-size: 12px; margin-top: 4px; }
.peringatan-ketat {
  background: #fff4f2;
  border: 1px solid #efc7c1;
  border-left: 4px solid #8d2f28;
  color: #7c2e28;
  border-radius: 14px;
  padding: 12px 14px;
  margin: 0 0 8px;
}
.contoh-gejala { display: block; margin-top: 6px; font-weight: 700; }
.isian-lain { margin-top: 8px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat, .card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 18px;
}
.stat span { display: block; color: var(--muted); font-size: 13px; }
.stat strong {
  display: block;
  margin-top: 6px;
  font-size: 32px;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.stat em { font-style: normal; color: var(--muted); font-size: 12px; }
.stat-telat { background: #fff7f5; border-color: #efc7c1; }
.stat-telat strong { color: var(--kritis); }
.grid-2 { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 14px; }
.grid-2 > * { min-width: 0; }

.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(160px, 220px) 1fr 28px; gap: 10px; align-items: center; }
.bar-row span { font-size: 13px; line-height: 1.25; }
.track { height: 10px; background: #e6efeb; border-radius: 99px; overflow: hidden; }
.fill { height: 100%; background: var(--teal); border-radius: 99px; }
.vbars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.vbar { text-align: center; font-size: 12px; color: var(--muted); }
.vtrack { height: 120px; display: flex; align-items: flex-end; justify-content: center; }
.vcol { width: 26px; background: var(--teal); border-radius: 8px 8px 3px 3px; min-height: 4px; }
.vbar b { display: block; color: var(--ink); font-size: 13px; }

.tiket-list { display: grid; gap: 10px; }
.tiket {
  display: block;
  text-decoration: none;
  color: inherit;
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}
.tiket:hover { border-color: #9fc8bc; }
.tiket.telat { border-color: #e4b2aa; background: #fffdfc; }
.tiket-atas, .tiket-meta, .aksi, .meta-baris { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tiket-atas { justify-content: space-between; }
.tiket strong { display: block; margin: 6px 0 2px; }
.tiket p { margin: 0; color: var(--muted); }
.tiket-meta { margin-top: 8px; color: var(--muted); font-size: 13px; }
.mono { font-family: Consolas, "Segoe UI Mono", monospace; font-size: 13px; }

.status, .tingkat, .chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
}
.status.masuk { background: #fff1d8; color: var(--tinggi); }
.status.diproses { background: var(--soft); color: var(--teal-d); }
.status.selesai { background: #e5f6ea; color: var(--sedang); }
.tingkat.kritis { background: #fde8e6; color: var(--kritis); }
.tingkat.tinggi { background: #f8ecd9; color: var(--tinggi); }
.tingkat.sedang { background: #e7f6ec; color: var(--sedang); }
.tingkat.rendah { background: #e7f1f6; color: var(--rendah); }
.chip { background: #eef3f1; color: #3e5559; font-weight: 650; }
.chip.bahaya { background: #fde8e6; color: var(--kritis); }

.field { margin-bottom: 14px; }
.lbl { display: block; font-weight: 700; margin-bottom: 6px; }
.wajib::after { content: " *"; color: var(--kritis); }
input, select, textarea {
  width: 100%;
  border: 1px solid #c5d6cf;
  background: white;
  border-radius: 12px;
  padding: 10px 12px;
  min-height: 44px;
}
textarea { min-height: 120px; resize: vertical; }
.bantuan, .muted { color: var(--muted); font-size: 13px; }
.bantuan { margin-top: 6px; }
.dua { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.filter { display: grid; grid-template-columns: 1.4fr 0.8fr 1.1fr auto; gap: 8px; align-items: end; }
.kepala-baris { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.kepala-baris h2 { margin: 0; }
.tabel-bungkus { overflow-x: auto; }
.tabel a { font-weight: 700; text-decoration: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--teal);
  color: white;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 16px;
  min-height: 44px;
  text-decoration: none;
  font-weight: 700;
}
.btn:hover { background: var(--teal-d); }
.btn-secondary { background: var(--soft); color: var(--teal-d); }
.btn-secondary:hover { background: #d7ebe4; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: white; }
.btn-danger { background: #f8e8e6; color: #8d2f28; }
.btn-danger:hover { background: #f3d6d2; }
.btn-kecil { min-height: 36px; padding: 6px 10px; font-size: 13px; }

.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin: 0; }
.kv dt { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.kv dd { margin: 2px 0 0; font-weight: 700; }
.uraian { white-space: pre-wrap; overflow-wrap: anywhere; }
.foto-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.foto-grid img, .pratinjau img { width: 100%; height: 140px; object-fit: cover; border-radius: 12px; background: #dce7e3; }
.pratinjau { display: flex; gap: 8px; margin-top: 8px; }
.pratinjau img { width: 88px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 0 0 14px 14px; border-left: 2px solid var(--line); }
.timeline strong { display: block; }

.tabel { width: 100%; border-collapse: collapse; }
.tabel th, .tabel td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tabel th { font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.skala { display: flex; gap: 8px; }
.skala label { display: grid; justify-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.skala input { width: 22px; min-height: 22px; }
.cek { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; }
.cek input { width: 18px; min-height: 18px; margin-top: 3px; }

.stiker-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stiker {
  border: 1px dashed #8eaea6;
  border-radius: 16px;
  padding: 14px;
  text-align: center;
  background: white;
}
.stiker img { width: min(240px, 100%); height: auto; background: white; }
.alamat-qr { margin: 8px 0 0; font-family: Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; text-align: center; direction: ltr; }
#tautan { direction: ltr; text-align: left; }
.stiker strong { display: block; letter-spacing: 0.08em; }
.sop h2 { margin-top: 18px; }
.sop ol, .sop ul { margin-top: 0; }
.empty { text-align: center; padding: 28px 16px; }
.bottomnav, .sheet, .print-head { display: none; }

.toast {
  position: fixed;
  left: 50%;
  top: 16px;
  transform: translateX(-50%) translateY(-12px);
  background: var(--navy);
  color: white;
  padding: 12px 16px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
  z-index: 60;
  max-width: min(560px, calc(100% - 24px));
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { background: #8d2f28; }
.unggah-baris { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
input.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login-hero { min-height: 0; padding: 28px 20px 22px; }
  .tim-bingkai img { width: 100%; max-height: none; }
  .login-hero .brand img { width: 78px; height: 88px; }
  .login-hero .brand strong { font-size: 26px; }
  .judul-fungsi { font-size: 12px; letter-spacing: 0.11em; }
  .judul-nama { font-size: 32px; }
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .who { text-align: left; }
  h1 { font-size: 26px; }
  .content { padding-bottom: 104px; }
  .grid-2, .dua, .kv, .filter, .stiker-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .bar-row { grid-template-columns: minmax(120px, 46%) 1fr 24px; }
  .bottomnav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    border-top: 1px solid var(--line);
    z-index: 30;
  }
  .notifikasi { right: 16px; }
  .bottomnav a, .bottomnav button {
    flex: 1;
    background: none;
    border: 0;
    padding: 10px 4px 12px;
    text-decoration: none;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }
  .bottomnav a.aktif { color: var(--teal-d); }
  .sheet {
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 64px;
    background: white;
    border-top: 1px solid var(--line);
    z-index: 40;
    padding: 8px 8px 10px;
    max-height: calc(100vh - 150px);
    overflow: hidden;
    box-shadow: 0 -10px 28px rgba(18, 52, 60, 0.08);
  }
  .sheet[hidden] { display: none; }
  .sheet-isi { overflow: auto; min-height: 0; }
  .sheet a { display: block; padding: 10px 12px; text-decoration: none; color: var(--ink); border-radius: 10px; }
  .sheet .nav-grup { color: #5c7176; margin: 12px 12px 0; }
  .sheet .btn { width: 100%; margin-top: 8px; flex: none; }
}

@media print {
  body { background: white; }
  .sidebar, .topbar, .bottomnav, .sheet, .toast, .no-print, .banner { display: none !important; }
  .app { display: block; }
  .content { max-width: none; padding: 0; }
  .card, .stat, .tiket, .stiker { box-shadow: none; break-inside: avoid; }
  .print-head { display: flex; align-items: center; gap: 12px; border-bottom: 2px solid #12343c; margin-bottom: 12px; padding-bottom: 8px; }
  .print-head img { width: 52px; height: 58px; object-fit: contain; }
  .print-head strong { letter-spacing: 0.04em; }
  @page { size: A4; margin: 12mm; }
}
