:root, [data-tema="gelap"] {
  --bg: #0f1216; --bg2: #171b21; --bg3: #20262e; --garis: #2c333d;
  --teks: #e6e9ee; --redup: #8b95a3; --aksen: #4f8cff; --aksen2: #3a6fd6;
  --bahaya: #e5484d; --ok: #30a46c; --kuning: #f5a524;
}
[data-tema="terang"] {
  --bg: #f6f7f9; --bg2: #ffffff; --bg3: #eef0f3; --garis: #d9dde3;
  --teks: #1b1f24; --redup: #66707c; --aksen: #2f6fe4; --aksen2: #1f57bd;
  --bahaya: #d93036; --ok: #1f8a55; --kuning: #b9770e;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--teks); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
[hidden] { display: none !important; }
a { color: var(--aksen); }
h1 { font-size: 1.4rem; margin: 0 0 .5rem; }
h3 { margin: 0 0 .6rem; font-size: 1.05rem; }
.redup { color: var(--redup); }
.kecil { font-size: .82rem; }
.tersembunyi { display: none; }
code { background: var(--bg3); padding: 0 .3em; border-radius: 4px; word-break: break-all; }

input, select, textarea, button {
  font: inherit; color: inherit; background: var(--bg3); border: 1px solid var(--garis);
  border-radius: 8px; padding: .5rem .7rem; min-height: 38px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--aksen); outline-offset: -1px; }
textarea { width: 100%; resize: vertical; font-family: ui-monospace, Consolas, monospace; }
label { display: block; margin: .4rem 0; color: var(--redup); font-size: .9rem; }
label > input, label > select, label > textarea { display: block; width: 100%; margin-top: .25rem; color: var(--teks); }
label.cek { display: inline-flex; gap: .4rem; align-items: center; color: var(--teks); }
label.cek > input { width: auto; min-height: 0; margin: 0; }
button { background: var(--aksen); border-color: var(--aksen); color: #fff; cursor: pointer; white-space: nowrap; }
button:hover { background: var(--aksen2); }
button:disabled { opacity: .5; cursor: wait; }
button.sekunder { background: var(--bg3); border-color: var(--garis); color: var(--teks); }
button.sekunder:hover { border-color: var(--aksen); }
button.bahaya { background: transparent; border-color: var(--bahaya); color: var(--bahaya); }
button.bahaya:hover { background: var(--bahaya); color: #fff; }
button.kecil { min-height: 30px; padding: .2rem .55rem; font-size: .82rem; }
button.aktif { background: var(--aksen); border-color: var(--aksen); color: #fff; }

.tengah { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.kartu { background: var(--bg2); border: 1px solid var(--garis); border-radius: 12px; padding: 1rem; margin-bottom: 1rem; }
.login { width: min(380px, 100%); display: flex; flex-direction: column; gap: .3rem; }
.login button[type=submit] { margin-top: .5rem; }
.galat-teks { color: var(--bahaya); min-height: 1.2em; margin: .2rem 0; font-size: .9rem; }

.atas { position: sticky; top: 0; z-index: 10; display: flex; gap: .8rem; align-items: center; flex-wrap: wrap;
  padding: .55rem 1rem; background: var(--bg2); border-bottom: 1px solid var(--garis); }
.tab-utama { display: flex; gap: .3rem; flex: 1; overflow-x: auto; }
.tab-utama button { background: transparent; border-color: transparent; color: var(--teks); }
.tab-utama button.aktif { background: var(--bg3); border-color: var(--garis); color: var(--aksen); }
.akun { display: flex; gap: .5rem; align-items: center; }
#isi { padding: 1rem; max-width: 1400px; margin: 0 auto; }

.bilah { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: .7rem; }
.bilah input[type=search] { flex: 1; min-width: 180px; }
.tab-sheet { display: flex; gap: .3rem; overflow-x: auto; margin-bottom: .7rem; padding-bottom: .2rem; }
.bilah-rumus { display: flex; gap: .4rem; margin-bottom: .5rem; }
.bilah-rumus .ref { min-width: 56px; display: grid; place-items: center; background: var(--bg3); border: 1px solid var(--garis); border-radius: 8px; font-weight: 600; }
.bilah-rumus input { flex: 1; font-family: ui-monospace, Consolas, monospace; }

.grid-wadah { overflow: auto; max-height: 68vh; border: 1px solid var(--garis); border-radius: 8px; }
.grid { border-collapse: collapse; }
.grid th { position: sticky; top: 0; background: var(--bg3); color: var(--redup); font-weight: 500; font-size: .8rem;
  border: 1px solid var(--garis); padding: 0 .4rem; min-width: 34px; z-index: 1; }
.grid tbody th { position: sticky; left: 0; z-index: 1; }
.grid th.sudut { left: 0; z-index: 2; }
.grid td { border: 1px solid var(--garis); padding: 0; }
.sel { width: 110px; min-height: 30px; height: 30px; border: 0; border-radius: 0; background: var(--bg2); padding: 0 .35rem; font-size: .88rem; }
.sel:focus { outline: 2px solid var(--aksen); position: relative; z-index: 1; }
.sel.angka { text-align: right; }
.sel.rumus { color: var(--ok); }
.sel.galat { color: var(--bahaya); }

.remah { margin-bottom: .6rem; }
.zona-unggah { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; padding: .8rem; margin-bottom: .7rem;
  border: 2px dashed var(--garis); border-radius: 10px; }
.zona-unggah.di-atas { border-color: var(--aksen); background: var(--bg3); }
.progres { display: flex; gap: .6rem; align-items: center; margin-bottom: .4rem; font-size: .85rem; }
.progres progress { flex: 1; }
.daftar-file { display: flex; flex-direction: column; gap: .4rem; }
.baris-file { display: flex; gap: .6rem; align-items: center; justify-content: space-between; padding: .55rem .7rem;
  background: var(--bg2); border: 1px solid var(--garis); border-radius: 10px; }
.baris-file .nama { cursor: pointer; min-width: 0; overflow-wrap: anywhere; flex: 1; }
.baris-file.folder { cursor: pointer; }
.aksi { display: flex; gap: .3rem; flex-wrap: wrap; justify-content: flex-end; }
.pilih-anggota { display: flex; flex-direction: column; gap: .3rem; max-height: 240px; overflow: auto; }

.tabel { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tabel th, .tabel td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--garis); vertical-align: top; }
.tabel tr.peringatan td { color: var(--kuning); }
.gulir { overflow-x: auto; max-height: 60vh; }

.modal-latar { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); display: grid; place-items: center; z-index: 50; padding: 1rem; }
.modal { background: var(--bg2); border: 1px solid var(--garis); border-radius: 12px; padding: 1rem; width: min(560px, 100%); max-height: 88vh; overflow: auto; }
.modal-aksi { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1rem; }
.riwayat { display: flex; flex-direction: column; gap: .4rem; }
.riwayat-baris { display: flex; justify-content: space-between; gap: .6rem; padding: .4rem 0; border-bottom: 1px solid var(--garis); font-size: .86rem; }

.toast-wadah { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: .4rem; z-index: 60; width: min(420px, 92vw); }
.toast { background: var(--bg3); border: 1px solid var(--garis); border-left: 4px solid var(--ok); padding: .6rem .8rem; border-radius: 8px; transition: opacity .4s; }
.toast.galat { border-left-color: var(--bahaya); }
.toast.pergi { opacity: 0; }

@media (max-width: 640px) {
  #isi { padding: .6rem; }
  .atas { padding: .5rem .6rem; gap: .4rem; }
  .atas > strong { display: none; }
  .tab-utama { order: 3; flex-basis: 100%; }
  .sel { width: 88px; }
  .baris-file { flex-direction: column; align-items: stretch; }
  .aksi { justify-content: flex-start; }
}
