* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; background: #f2f6ef; color: #21301d; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 16px 20px; background: #2e5b27; color: #fff; }
.topbar h1 { margin: 0; font-size: 20px; }
.topbar .sub { margin: 2px 0 0; opacity: .85; font-size: 13px; }
.alat { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; background: #b9c4b5; }
.dot.on { background: #7ee787; box-shadow: 0 0 6px #7ee787; }
.dot.off { background: #e8734a; }
.login-link { color: #fff; background: rgba(255,255,255,.16); padding: 6px 12px; border-radius: 8px; text-decoration: none; margin-left: 8px; }
.grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; padding: 16px; max-width: 1100px; margin: 0 auto; }
.admin-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 16px; padding: 16px; max-width: 1100px; margin: 0 auto; }
@media (max-width: 760px) { .grid, .admin-grid { grid-template-columns: 1fr; } }
.card { background: #fff; border-radius: 14px; padding: 16px; box-shadow: 0 2px 10px rgba(30,50,25,.08); }
.card h2 { margin: 0 0 12px; font-size: 16px; }
.card h3 { font-size: 14px; }
.foto-card img { width: 100%; border-radius: 10px; display: block; }
.waktu { color: #5c6b57; font-size: 13px; margin: 10px 0 0; }
.kosong { color: #5c6b57; text-align: center; padding: 40px 10px; line-height: 1.6; }
.kosong2 { color: #5c6b57; text-align: center; }
.badge { display: inline-block; font-weight: 700; font-size: 18px; padding: 10px 18px; border-radius: 10px; }
.badge.sehat { background: #e2f4dc; color: #2e6b22; }
.badge.sakit { background: #fbe3dd; color: #a02c14; }
.badge.ragu  { background: #fdf3d3; color: #7a5b00; }
.badge.tunggu { background: #e8ece7; color: #5c6b57; }
.mini-badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.mini-badge.sehat { background: #e2f4dc; color: #2e6b22; }
.mini-badge.sakit { background: #fbe3dd; color: #a02c14; }
.mini-badge.ragu  { background: #fdf3d3; color: #7a5b00; }
.mini-badge.tunggu { background: #e8ece7; color: #5c6b57; }
.label-besar { font-size: 22px; font-weight: 700; margin: 14px 0 4px; }
.keyakinan { color: #44543f; margin: 0; }
.tabel { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabel th, .tabel td { text-align: left; padding: 7px 6px; border-bottom: 1px solid #edf1ea; }
.tabel th { color: #5c6b57; font-weight: 600; }
.mt { margin-top: 22px; }
footer { text-align: center; color: #84917f; font-size: 12px; padding: 6px 0 20px; }
.login-page { display: grid; place-items: center; min-height: 100vh; }
.login-card { width: min(380px, 92vw); }
.login-card h1 { margin: 0 0 4px; font-size: 20px; }
.login-card label, .form label { display: block; font-size: 13px; color: #44543f; margin: 12px 0; }
.login-card input, .form input { width: 100%; margin-top: 5px; padding: 10px; border: 1px solid #ccd6c8; border-radius: 8px; font-size: 14px; }
button { background: #2e5b27; color: #fff; border: 0; border-radius: 8px; padding: 10px 18px; font-size: 14px; cursor: pointer; }
button.bahaya { background: #a02c14; }
.error { background: #fbe3dd; color: #a02c14; padding: 9px 12px; border-radius: 8px; font-size: 13px; }
.pesan { background: #e2f4dc; color: #2e6b22; margin: 16px; padding: 11px 14px; border-radius: 10px; font-size: 14px; }
.kembali { font-size: 13px; }
.ringkas { list-style: none; padding: 0; margin: 0; line-height: 2; font-size: 14px; }
.galeri { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.galeri figure { margin: 0; }
.galeri img { width: 100%; height: 110px; object-fit: cover; border-radius: 8px; display: block; }
.galeri figcaption { font-size: 12px; color: #44543f; margin-top: 5px; line-height: 1.5; }

/* === v2: Pemantau Kondisi Daun Anggur === */
.topbar.v2 { background: linear-gradient(120deg, #2e6b22, #3f8f2e); padding: 18px 20px; }
.brand2 { display: flex; gap: 12px; align-items: center; }
.logo2 { width: 46px; height: 46px; border-radius: 13px; background: rgba(255,255,255,.18); display: grid; place-items: center; font-size: 23px; }
.pill2 { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: 13px; padding: 7px 13px; border-radius: 999px; background: #e2f4dc; color: #2e6b22; }
.pill2.off { background: #fbe3dd; color: #a02c14; }
.pill2 small { display: block; font-weight: 600; font-size: 11px; color: #5c6b57; }
.wrap2 { max-width: 1180px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.stats2 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 760px) { .stats2 { grid-template-columns: 1fr 1fr; } }
.stat2 .t { font-size: 13px; color: #5c6b57; font-weight: 700; }
.stat2 .v { font-size: 29px; font-weight: 800; color: #2e6b22; margin-top: 4px; }
.stat2 .v small { font-size: 14px; color: #5c6b57; font-weight: 700; }
.stat2 .v.sm { font-size: 22px; padding-top: 4px; }
.stat2 .s { font-size: 12px; color: #5c6b57; margin-top: 3px; }
.grid2a { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .grid2a { grid-template-columns: 1fr; } }
.srcbadge { display: inline-block; background: #e2f4dc; color: #2e6b22; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; margin-right: 6px; }
.srcbadge.alt { background: #fdf3d3; color: #8a6d1a; }
.confbar { height: 10px; background: #e8ece7; border-radius: 99px; margin: 10px 0 6px; overflow: hidden; }
.confbar i { display: block; height: 100%; background: #2e6b22; border-radius: 99px; }
.confval { font-weight: 800; font-size: 17px; color: #2e6b22; margin: 0 0 6px; }
.sumber-note { font-size: 12.5px; color: #5c6b57; border-top: 1px dashed #e8ece7; padding-top: 10px; margin-top: 14px; line-height: 1.6; }
.sub2 { color: #5c6b57; font-size: 12.5px; margin: -6px 0 10px; }
.legend2 { display: flex; gap: 8px; margin: 4px 0; flex-wrap: wrap; }
.lchip { border: 1px solid #e8ece7; border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 600; color: #44543f; }
.lchip i { display: inline-block; width: 12px; height: 4px; border-radius: 2px; margin-right: 7px; vertical-align: middle; }
.chart2 { width: 100%; display: block; }
.setgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px 28px; }
.setgrid h3 { margin: 6px 0 2px; }

/* === v3: login & admin selaras halaman publik === */
body.auth3 { min-height: 100vh; display: grid; place-items: center; padding: 18px; background: linear-gradient(150deg, #2e6b22, #3f8f2e 55%, #57a047); }
.auth-card { background: #fff; border-radius: 22px; box-shadow: 0 24px 60px rgba(20,45,15,.35); padding: 30px 28px 24px; width: min(400px, 94vw); text-align: center; }
.auth-logo { width: 58px; height: 58px; border-radius: 17px; background: linear-gradient(140deg, #2e6b22, #57a047); display: inline-grid; place-items: center; font-size: 28px; margin-bottom: 12px; }
.auth-card h1 { font-size: 19px; margin: 0 0 4px; color: #24471d; }
.auth-sub { color: #5c6b57; font-size: 13px; margin: 0 0 8px; }
.auth-card label { display: block; text-align: left; font-size: 13px; font-weight: 600; color: #44543f; margin: 13px 0 0; }
.auth-card input { width: 100%; margin-top: 6px; padding: 12px 13px; border: 1.5px solid #d8e2d2; border-radius: 11px; font-size: 14.5px; background: #fbfdf9; }
.auth-card input:focus { outline: 2px solid #57a047; border-color: transparent; }
.auth-btn { width: 100%; margin-top: 20px; background: #2e6b22; color: #fff; border: 0; border-radius: 11px; padding: 13px; font-size: 15px; font-weight: 700; cursor: pointer; }
.auth-btn:hover { background: #265a1c; }
.auth-card .kembali { margin: 16px 0 0; }
.auth-card .kembali a { color: #2e6b22; font-weight: 600; text-decoration: none; font-size: 13px; }
.admin-wrap { max-width: 1180px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.devrow { display: flex; align-items: center; gap: 11px; padding: 11px 0; border-top: 1px solid #eef1ec; }
.devrow:first-of-type { border-top: none; }
.devrow .nm { flex: 1; min-width: 0; }
.devrow .nm b { display: block; font-size: 14.5px; }
.devrow .nm span { font-size: 12px; color: #5c6b57; }
.devstat { font-weight: 800; font-size: 13px; }
.devstat.on { color: #2e6b22; } .devstat.off { color: #a02c14; }

/* === v4: hamburger + laci navigasi === */
.burger { background: rgba(255,255,255,.16); color: #fff; border: 0; width: 44px; height: 44px; border-radius: 12px; font-size: 21px; cursor: pointer; flex: none; padding: 0; line-height: 1; }
.burger:hover { background: rgba(255,255,255,.28); }
.drawer-overlay { position: fixed; inset: 0; background: rgba(20,35,15,.45); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 40; }
.drawer-overlay.buka { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; left: 0; height: 100dvh; width: min(302px, 86vw); background: #fff; z-index: 50; transform: translateX(-106%); transition: transform .22s ease; box-shadow: 8px 0 30px rgba(20,45,15,.25); padding: 16px 14px; overflow-y: auto; }
.drawer.buka { transform: none; }
.drawer-head { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.drawer-head .logo2 { background: linear-gradient(140deg, #2e6b22, #57a047); color: #fff; flex: none; }
.drawer-head b { display: block; font-size: 14.5px; color: #24471d; }
.drawer-head small { color: #5c6b57; font-size: 12px; }
.drawer-x { margin-left: auto; background: #eef3ea; color: #44543f; width: 34px; height: 34px; border-radius: 9px; font-size: 19px; padding: 0; flex: none; }
.drawer a { display: block; padding: 10px 12px; border-radius: 10px; color: #21301d; text-decoration: none; font-weight: 600; font-size: 14.5px; }
.drawer a:hover { background: #eef6e9; }
.drawer a.sub { margin-left: 14px; font-weight: 500; font-size: 13.5px; color: #44543f; }
.drawer-judul { margin: 14px 12px 2px; font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #84917f; }

/* === v4: tabel riwayat & kelas === */
.tabel-bungkus { overflow-x: auto; }
.thumb { width: 54px; height: 40px; object-fit: cover; border-radius: 7px; display: block; }
.kelas-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 760px) { .kelas-grid { grid-template-columns: 1fr 1fr; } }
.kelas-item { border: 1px solid #edf1ea; border-radius: 12px; padding: 12px 14px; background: #fbfdf9; }
.kelas-item .kn { font-size: 13px; font-weight: 700; color: #44543f; }
.kelas-item .kv { font-size: 27px; font-weight: 800; margin-top: 2px; }
.kelas-item.ok .kv { color: #2e6b22; }
.kelas-item.bad .kv { color: #a02c14; }
.kelas-item .ks { font-size: 11.5px; color: #5c6b57; }
.pesan.salah { background: #fbe3dd; color: #a02c14; }

/* === v4.2: header mobile 3 elemen (acuan Ridho 5 Des) === */
.judul-pendek, .sub-pendek { display: none; }
.diperbarui { display: none; }
.drawer-sep { border-top: 1px solid #e8ece7; margin: 10px 4px 4px; }
/* Header: brand menempel kiri setelah hamburger, status tetap kanan (5 Des) */
.topbar.v2 { justify-content: flex-start; }
.topbar .alat { margin-left: auto; }
.tabel td.sel-kelas { white-space: normal; min-width: 128px; }
@media (max-width: 767px) {
  /* header: satu baris — hamburger 36px | judul+subjudul | pill ringkas */
  .topbar.v2 { flex-wrap: nowrap; align-items: center; padding: 10px 12px; gap: 10px; }
  .burger { width: 36px; height: 36px; font-size: 17px; border-radius: 9px; }
  .brand2 { flex: 1 1 auto; min-width: 0; gap: 0; }
  .brand2 .logo2 { display: none; }
  .brand-teks { min-width: 0; }
  .topbar h1 { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; }
  .topbar .sub { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 1px 0 0; }
  .judul-panjang, .sub-panjang { display: none; }
  .judul-pendek, .sub-pendek { display: inline; }
  .alat { width: auto; margin: 0; flex: none; gap: 0; }
  .alat .login-link { display: none; }
  .alat.tautan { display: none; }
  .pill2 { padding: 5px 11px; font-size: 12px; flex: none; }
  .pill2 small { display: none; }
  .kata-perangkat { display: none; }
  .diperbarui { display: block; font-size: 11px; color: #5c6b57; padding: 7px 14px 0; }
  /* konten */
  .wrap2, .admin-wrap { padding: 12px; gap: 12px; }
  .card { padding: 13px; border-radius: 12px; }
  .stats2 { gap: 10px; }
  .stat2 .v { font-size: 23px; }
  .stat2 .v.sm { font-size: 19px; }
  .label-besar { font-size: 19px; }
  .badge { font-size: 15.5px; padding: 8px 14px; }
  .tabel { font-size: 12.5px; }
  .tabel th, .tabel td { padding: 6px 5px; white-space: nowrap; }
  .tabel td.sel-kelas { white-space: normal; }
  .galeri { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .drawer a { padding: 11px 12px; }
}
.form label.cek { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; line-height: 1.5; background: #fdf6e0; border: 1px solid #efe0a8; border-radius: 9px; padding: 10px 12px; }
.form label.cek input { width: auto; margin-top: 3px; }
