:root {
  --bg: #f3f7fc;
  --surface: #ffffff;
  --border: #dbe6f3;
  --text: #14213a;
  --muted: #5c6b7c;
  --blue: #1c5fae;
  --blue-dark: #123f78;
  --blue-soft: #e6f0fb;
  --red: #c62828;
  --red-soft: #fdecec;
  --green: #1e8e3e;
  --radius: 12px;
  --font-h: "Archivo", "Inter", sans-serif;
  --font: "Plus Jakarta Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--font-h); letter-spacing: -0.01em; line-height: 1.2; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
a { color: var(--blue); }
button, input, select, textarea { font: inherit; color: inherit; }
.memuat { display: grid; place-items: center; min-height: 100vh; color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- tombol & input ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 10px; padding: 10px 16px;
  font-weight: 600; cursor: pointer; background: var(--blue); color: #fff; white-space: nowrap;
}
.btn:hover { background: var(--blue-dark); }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn-garis { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-garis:hover { background: var(--blue-soft); }
.btn-bahaya { background: var(--red); }
.btn-bahaya:hover { background: #a11f1f; }
.btn-kecil { padding: 6px 12px; font-size: 13px; }
.btn-blok { width: 100%; }

label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.isian { margin-bottom: 14px; }
.isian small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
input[type=text], input[type=password], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: #fff;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.galat { background: var(--red-soft); color: var(--red); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 14px; }

/* ---------- halaman masuk ---------- */
.masuk-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: linear-gradient(160deg, var(--blue) 0%, var(--blue-dark) 100%); }
.masuk-kartu { width: 100%; max-width: 380px; background: var(--surface); border-radius: 16px; padding: 28px; box-shadow: 0 20px 50px rgba(0,0,0,.2); }
.masuk-logo { display: block; height: 44px; margin: 0 auto 18px; background: var(--blue); border-radius: 10px; padding: 8px 12px; }
.masuk-kartu h1 { text-align: center; margin-bottom: 6px; }
.masuk-kartu p.sub { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 20px; }

/* ---------- tata letak panel ---------- */
.panel { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sisi { background: var(--blue-dark); color: #fff; padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.sisi-logo { height: 34px; width: auto; margin: 0 8px 22px; align-self: flex-start; }
.sisi a { color: rgba(255,255,255,.85); text-decoration: none; padding: 10px 12px; border-radius: 10px; font-weight: 600; font-size: 14px; display: flex; justify-content: space-between; align-items: center; }
.sisi a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sisi a.aktif { background: rgba(255,255,255,.15); color: #fff; }
.sisi .lencana { font-size: 10px; background: rgba(255,255,255,.18); padding: 2px 7px; border-radius: 99px; font-weight: 700; }
.sisi-bawah { margin-top: auto; padding: 12px; font-size: 13px; color: rgba(255,255,255,.75); border-top: 1px solid rgba(255,255,255,.15); }
.sisi-bawah b { color: #fff; display: block; }

.utama { padding: 28px 32px 60px; min-width: 0; }
.kepala { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.kepala p { color: var(--muted); font-size: 14px; margin-top: 4px; }
.kartu { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.kartu h2 { margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.kosong { color: var(--muted); text-align: center; padding: 30px 10px; }

.atas-hp { display: none; }

/* ---------- ringkasan ---------- */
.tahap { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.tahap li { display: flex; gap: 10px; align-items: flex-start; }
.tahap .titik { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--blue-soft); color: var(--blue); }
.tahap .selesai .titik { background: var(--green); color: #fff; }
.tahap span.ket { color: var(--muted); font-size: 13px; display: block; }

/* ---------- galeri ---------- */
.zona-unggah { border: 2px dashed var(--border); border-radius: var(--radius); background: var(--surface); padding: 26px; text-align: center; cursor: pointer; margin-bottom: 16px; transition: .15s; }
.zona-unggah:hover, .zona-unggah.seret { border-color: var(--blue); background: var(--blue-soft); }
.zona-unggah b { display: block; font-size: 16px; margin-bottom: 4px; }
.zona-unggah span { color: var(--muted); font-size: 13px; }
.antrean { list-style: none; margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.antrean li { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; font-size: 13px; display: flex; justify-content: space-between; gap: 10px; }
.antrean .ok { color: var(--green); font-weight: 600; }
.antrean .gagal { color: var(--red); font-weight: 600; }
.bar-cari { display: flex; gap: 10px; margin-bottom: 16px; }
.galeri { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.foto { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; cursor: pointer; text-align: left; padding: 0; }
.foto:hover { border-color: var(--blue); }
.foto .gbr { aspect-ratio: 1; background: #eef2f7 center/contain no-repeat; display: block; width: 100%; object-fit: contain; }
.foto .nama { padding: 8px 10px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foto .tanpa-alt { color: #b26a00; font-size: 11px; padding: 0 10px 8px; display: block; }

/* ---------- tabel akun & log ---------- */
.tabel { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabel th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--border); }
.tabel td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tabel tr:last-child td { border-bottom: 0; }
.tabel .aksi { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.gulir-x { overflow-x: auto; }
.pil { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--blue-soft); color: var(--blue); }
.pil.owner { background: #fff3d6; color: #8a5a00; }
.pil.mati { background: #eceff3; color: var(--muted); }
.pil.kunci { background: var(--red-soft); color: var(--red); }
.redup { color: var(--muted); font-size: 13px; }

/* ---------- dialog ---------- */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(10, 20, 40, .45); }
.dlg-isi { padding: 22px; }
.dlg-isi h2 { margin-bottom: 16px; }
.dlg-aksi { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }
.dlg-aksi .kiri { margin-right: auto; }
.pratinjau { width: 100%; max-height: 300px; object-fit: contain; background: #eef2f7; border-radius: 10px; margin-bottom: 14px; display: block; }
.info-foto { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.salin { display: flex; gap: 8px; }

/* ---------- notifikasi ---------- */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 50; pointer-events: none; }
#toast div { background: var(--text); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
#toast div.err { background: var(--red); }

/* ---------- HP ---------- */
@media (max-width: 860px) {
  .panel { grid-template-columns: 1fr; }
  .atas-hp { display: flex; align-items: center; justify-content: space-between; background: var(--blue-dark); padding: 12px 16px; position: sticky; top: 0; z-index: 20; }
  .atas-hp img { height: 28px; }
  .atas-hp button { background: none; border: 0; color: #fff; font-size: 26px; line-height: 1; cursor: pointer; padding: 4px 8px; }
  .sisi { position: fixed; inset: 0 30% 0 0; z-index: 30; height: auto; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .sisi.buka { transform: none; }
  .utama { padding: 20px 16px 60px; }
  .tabel .sembunyi-hp { display: none; }
}
