/* Asisten Jaringan — tampilan gelap, dibuat supaya terbaca di layar HP yang
   dipegang sambil berdiri di depan tiang, maupun di monitor kantor. */

:root {
  --latar:      #070b18;
  --latar-2:    #0d1426;
  --kaca:       rgba(255,255,255,.055);
  --garis:      rgba(255,255,255,.10);
  --teks:       #e8eefc;
  --redup:      #8a97b8;
  --biru:       #4da3ff;
  --sian:       #35e4d0;
  --ungu:       #8b7bff;
  --bahaya:     #ff6b6b;
  --sukses:     #3ddc84;
  --radius:     18px;
  --sf: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; height: 100%;
  background: var(--latar);
  color: var(--teks);
  font-family: var(--sf);
  font-size: 16px;
  overscroll-behavior: none;
}

/* cahaya latar yang bergerak pelan — memberi kesan "hidup" tanpa mengganggu */
body::before {
  content: ""; position: fixed; inset: -30%;
  background:
    radial-gradient(38% 38% at 22% 18%, rgba(77,163,255,.20), transparent 70%),
    radial-gradient(34% 34% at 80% 26%, rgba(139,123,255,.18), transparent 70%),
    radial-gradient(42% 42% at 52% 92%, rgba(53,228,208,.13), transparent 70%);
  filter: blur(28px); z-index: -1;
  animation: hanyut 26s ease-in-out infinite alternate;
}
@keyframes hanyut { from { transform: translate3d(-2%,-1%,0) scale(1); } to { transform: translate3d(3%,2%,0) scale(1.08); } }

.tersembunyi { display: none !important; }
.redup  { color: var(--redup); }
.kecil  { font-size: .82rem; }
.tengah-teks { text-align: center; }

/* ————————————————————————————————— gerbang sandi */
.gerbang { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; z-index: 50; }
.kartu-masuk {
  width: min(360px, 100%); padding: 30px 24px; text-align: center;
  background: var(--kaca); border: 1px solid var(--garis);
  border-radius: 22px; backdrop-filter: blur(14px);
}
.kartu-masuk h1 { margin: 10px 0 4px; font-size: 1.35rem; letter-spacing: -.01em; }
.logo-kecil { font-size: 2.3rem; }
.kartu-masuk input, .kartu-masuk button {
  width: 100%; margin-top: 14px; padding: 13px 16px; border-radius: 12px;
  border: 1px solid var(--garis); font-size: 1rem; font-family: inherit;
}
.kartu-masuk input { background: rgba(0,0,0,.28); color: var(--teks); }
.kartu-masuk input:focus { outline: 2px solid var(--biru); outline-offset: 1px; }
.kartu-masuk button {
  background: linear-gradient(135deg, var(--biru), var(--ungu));
  color: #fff; border: 0; font-weight: 600; cursor: pointer;
}
.galat { color: var(--bahaya); min-height: 1.2em; font-size: .85rem; margin: 10px 0 0; }

/* ————————————————————————————————— kerangka */
.app { display: flex; flex-direction: column; height: 100dvh; }

.atas {
  display: flex; align-items: center; gap: 10px;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px;
  border-bottom: 1px solid var(--garis);
}
.merek { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.merek strong { font-size: 1.02rem; letter-spacing: -.01em; }
.merek .kecil { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.titik {
  width: 9px; height: 9px; border-radius: 50%; background: var(--redup);
  box-shadow: 0 0 0 0 rgba(61,220,132,.6); align-self: center; flex: none;
}
.titik.hidup { background: var(--sukses); animation: denyut 2.4s infinite; }
@keyframes denyut { 0%{box-shadow:0 0 0 0 rgba(61,220,132,.55)} 70%{box-shadow:0 0 0 9px rgba(61,220,132,0)} 100%{box-shadow:0 0 0 0 rgba(61,220,132,0)} }

.lencana { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.pil {
  font-size: .7rem; padding: 4px 9px; border-radius: 999px;
  background: var(--kaca); border: 1px solid var(--garis); color: var(--redup); white-space: nowrap;
}
.pil.ok    { color: var(--sukses); border-color: rgba(61,220,132,.35); }
.pil.awas  { color: #ffc86b;      border-color: rgba(255,200,107,.35); }

.ikon {
  background: var(--kaca); border: 1px solid var(--garis); color: var(--teks);
  width: 38px; height: 38px; border-radius: 11px; font-size: 1rem; cursor: pointer; flex: none;
}

/* ————————————————————————————————— panggung + bola */
.tengah { flex: 1; overflow-y: auto; padding: 18px 16px 8px; -webkit-overflow-scrolling: touch; }
.panggung { display: grid; place-items: center; gap: 12px; padding: 10px 0 18px; }

.bola { position: relative; width: 168px; height: 168px; cursor: pointer; display: grid; place-items: center; }
.bola:focus-visible { outline: 2px solid var(--biru); outline-offset: 8px; border-radius: 50%; }
.cincin {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1px solid rgba(77,163,255,.32);
}
.c2 { inset: 14px; border-color: rgba(139,123,255,.28); }
.c3 { inset: 28px; border-color: rgba(53,228,208,.24); }
.inti {
  width: 92px; height: 92px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #7fc4ff, #4da3ff 42%, #6a5cff 100%);
  box-shadow: 0 0 44px rgba(77,163,255,.5), inset 0 0 26px rgba(255,255,255,.22);
  transition: transform .3s ease, box-shadow .3s ease;
}

/* keadaan: diam / dengar / pikir / bicara */
.bola[data-keadaan="diam"]   .cincin { animation: putar 18s linear infinite; }
.bola[data-keadaan="dengar"] .inti   { transform: scale(1.1); box-shadow: 0 0 66px rgba(53,228,208,.7); background: radial-gradient(circle at 34% 30%, #9cffe9, #35e4d0 45%, #21a4d8 100%); }
.bola[data-keadaan="dengar"] .cincin { animation: memancar 1.5s ease-out infinite; border-color: rgba(53,228,208,.5); }
.bola[data-keadaan="pikir"]  .cincin { animation: putar 2.4s linear infinite; border-color: rgba(139,123,255,.55); border-style: dashed; }
.bola[data-keadaan="pikir"]  .inti   { animation: napas 1.5s ease-in-out infinite; }
.bola[data-keadaan="bicara"] .inti   { animation: napas .7s ease-in-out infinite; box-shadow: 0 0 60px rgba(139,123,255,.65); }

@keyframes putar    { to { transform: rotate(360deg); } }
@keyframes napas    { 0%,100% { transform: scale(1); } 50% { transform: scale(1.09); } }
@keyframes memancar { 0% { transform: scale(.82); opacity: .9; } 100% { transform: scale(1.22); opacity: 0; } }

.gelombang { position: absolute; bottom: -4px; display: flex; gap: 3px; height: 22px; align-items: flex-end; opacity: 0; transition: opacity .2s; }
.bola[data-keadaan="dengar"] .gelombang { opacity: 1; }
.gelombang i { width: 3px; background: var(--sian); border-radius: 2px; height: 20%; animation: naik .9s ease-in-out infinite; }
@keyframes naik { 0%,100% { height: 18%; } 50% { height: 100%; } }

.keterangan { margin: 0; color: var(--redup); font-size: .88rem; text-align: center; min-height: 1.3em; padding: 0 10px; }

/* ————————————————————————————————— percakapan */
.percakapan { display: flex; flex-direction: column; gap: 10px; max-width: 760px; margin: 0 auto; padding-bottom: 12px; }
.balon {
  padding: 11px 14px; border-radius: 16px; line-height: 1.5;
  max-width: 88%; word-wrap: break-word; animation: muncul .22s ease-out;
}
@keyframes muncul { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.balon.saya {
  align-self: flex-end; background: linear-gradient(135deg, rgba(77,163,255,.28), rgba(139,123,255,.26));
  border: 1px solid rgba(77,163,255,.32); border-bottom-right-radius: 5px;
}
.balon.dia {
  align-self: flex-start; background: var(--kaca); border: 1px solid var(--garis);
  border-bottom-left-radius: 5px;
}
.balon.galat { border-color: rgba(255,107,107,.45); color: #ffc9c9; }

.jejak { align-self: flex-start; display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: .72rem; padding: 4px 10px; border-radius: 999px;
  background: rgba(53,228,208,.10); border: 1px solid rgba(53,228,208,.28); color: var(--sian);
}

/* ————————————————————————————————— konfirmasi */
.lapis { position: fixed; inset: 0; background: rgba(4,7,16,.78); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 20px; z-index: 40; }
.kartu-konfirmasi {
  width: min(430px, 100%); padding: 26px 22px; text-align: center;
  background: linear-gradient(180deg, #16203a, #0f1628);
  border: 1px solid rgba(255,200,107,.38); border-radius: 22px;
  box-shadow: 0 24px 70px rgba(0,0,0,.6);
  animation: muncul .2s ease-out;
}
.kartu-konfirmasi .tanda { font-size: 2.1rem; }
.kartu-konfirmasi h2 { margin: 6px 0 10px; font-size: 1.12rem; letter-spacing: .02em; text-transform: uppercase; color: #ffc86b; }
.kartu-konfirmasi p  { margin: 0 0 18px; line-height: 1.55; }
.tombol-baris { display: flex; gap: 10px; }
.tombol-baris button { flex: 1; padding: 14px; border-radius: 13px; border: 0; font-size: 1rem; font-weight: 600; font-family: inherit; cursor: pointer; }
.tolak  { background: rgba(255,255,255,.10); color: var(--teks); }
.setuju { background: linear-gradient(135deg, #ff9f43, #ff6b6b); color: #fff; }
.jam-mundur { margin-top: 12px; font-size: .75rem; color: var(--redup); }

/* ————————————————————————————————— laci */
.laci {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(330px, 86vw); z-index: 45;
  background: var(--latar-2); border-left: 1px solid var(--garis);
  padding: max(18px, env(safe-area-inset-top)) 18px 18px; overflow-y: auto;
  animation: geser .2s ease-out;
}
@keyframes geser { from { transform: translateX(100%); } to { transform: none; } }
.laci h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--redup); margin: 18px 0 8px; }
.laci h3:first-child { margin-top: 0; }
.contoh { margin: 0; padding-left: 18px; color: var(--redup); font-size: .86rem; line-height: 1.9; }
.samar {
  width: 100%; margin-top: 12px; padding: 11px; border-radius: 11px;
  background: var(--kaca); border: 1px solid var(--garis); color: var(--teks);
  font-family: inherit; font-size: .9rem; cursor: pointer;
}

/* ————————————————————————————————— bilah bawah */
.bawah {
  display: flex; gap: 8px; align-items: center;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--garis); background: rgba(7,11,24,.86); backdrop-filter: blur(10px);
}
.bawah input {
  flex: 1; min-width: 0; padding: 12px 15px; border-radius: 13px;
  background: rgba(0,0,0,.3); border: 1px solid var(--garis); color: var(--teks);
  font-size: 1rem; font-family: inherit;
}
.bawah input:focus { outline: 1px solid var(--biru); }
.mic, .kirim {
  width: 46px; height: 46px; flex: none; border-radius: 14px; border: 0; cursor: pointer;
  color: #fff; display: grid; place-items: center; font-size: 1.05rem;
}
.mic   { background: linear-gradient(135deg, var(--biru), var(--ungu)); }
.mic.aktif { background: linear-gradient(135deg, var(--sian), #21a4d8); animation: napas 1.2s ease-in-out infinite; }
.mic:disabled, .kirim:disabled { opacity: .45; cursor: not-allowed; animation: none; }
.kirim { background: var(--kaca); border: 1px solid var(--garis); color: var(--teks); }

/* ————————————————————————————————— layar lebar */
@media (min-width: 900px) {
  .tengah { display: grid; grid-template-columns: 300px 1fr; gap: 28px; align-items: start; padding: 26px 28px 8px; }
  .panggung { position: sticky; top: 8px; }
  .percakapan { margin: 0; max-width: none; }
  .bola { width: 200px; height: 200px; }
  .inti { width: 108px; height: 108px; }
  .bawah { padding: 12px 28px; }
  .bawah input { padding: 13px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}

/* ————————————————————————————————— tabel hasil */
.kartu-tabel { max-width: 100%; width: 100%; padding: 13px 14px; }
.tabel-judul { font-weight: 600; margin-bottom: 3px; }
.tabel-ket   { font-size: .78rem; color: var(--redup); margin-bottom: 9px; }
.tabel-ket:last-child { margin: 9px 0 0; }
/* Tabel boleh lebih lebar dari layar, tapi hanya di dalam kotaknya sendiri -
   badan halaman tidak ikut bergeser. */
.tabel-gulir { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 10px; border: 1px solid var(--garis); }
.tabel-gulir table { border-collapse: collapse; width: 100%; font-size: .8rem; white-space: nowrap; }
.tabel-gulir th {
  text-align: left; padding: 8px 11px; position: sticky; top: 0;
  background: #121a2e; color: var(--redup); font-weight: 600;
  font-size: .7rem; text-transform: uppercase; letter-spacing: .05em;
}
.tabel-gulir td { padding: 8px 11px; border-top: 1px solid var(--garis); }
.tabel-gulir tbody tr:nth-child(odd) { background: rgba(255,255,255,.022); }
.tabel-gulir td:nth-child(4) { max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
.jarak-atas { margin-top: 10px; }

/* Peringatan yang perlu dibaca, bukan sekadar balon biasa */
.balon.peringatan {
  max-width: 100%; border-color: rgba(255,200,107,.42);
  background: linear-gradient(180deg, rgba(255,200,107,.09), rgba(255,200,107,.04));
}
.balon.peringatan strong { color: #ffc86b; }
.balon.peringatan code {
  background: rgba(0,0,0,.42); padding: 2px 6px; border-radius: 5px;
  font-size: .84em; word-break: break-all;
}

/* ————————————————————————————————— pengelolaan pengguna */
.daftar-pengguna { display: flex; flex-direction: column; gap: 6px; }
.pengguna-baris {
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
  padding: 8px 10px; border-radius: 10px;
  background: var(--kaca); border: 1px solid var(--garis); font-size: .82rem;
}
.pengguna-baris.mati { opacity: .5; }
.pengguna-aksi { display: flex; gap: 4px; flex: none; }
.pengguna-aksi button {
  background: rgba(0,0,0,.28); border: 1px solid var(--garis); color: var(--teks);
  width: 28px; height: 28px; border-radius: 7px; cursor: pointer; font-size: .8rem; line-height: 1;
}
.pengguna-aksi button:hover { background: rgba(255,255,255,.10); }

.form-kecil { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; }
.form-kecil input, .form-kecil select, .form-kecil button {
  width: 100%; padding: 9px 11px; border-radius: 9px; font-size: .86rem;
  font-family: inherit; border: 1px solid var(--garis);
}
.form-kecil input, .form-kecil select { background: rgba(0,0,0,.3); color: var(--teks); }
.form-kecil button {
  background: linear-gradient(135deg, var(--biru), var(--ungu));
  color: #fff; border: 0; font-weight: 600; cursor: pointer;
}
.bahaya-teks { color: #ff9b9b; }
