:root {
  --biru: #1d4ed8; --biru-tua: #1e3a8a; --biru-hover: #1e40af;
  --biru-muda: #e8f0fe; --biru-garis: #c7d7fb;
  --teks: #1f2937; --abu: #6b7280; --abu-muda: #f3f4f6; --garis: #e5e7eb;
  --latar: #f6f8fc; --putih: #fff; --merah: #c81e1e; --merah-muda: #fdecec;
  --hijau: #0e9f6e; --folder: #5b8def;
  --login-bg: linear-gradient(150deg, #1d4ed8 0%, #1e3a8a 100%);
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 4px 16px rgba(16,24,40,.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--latar); color: var(--teks); font-size: 14px; line-height: 1.45;
}
a { color: var(--biru); }
svg.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8;
        stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.hidden { display: none !important; }
.muted { color: var(--abu); font-size: 12px; }

/* ---------- Form & tombol ---------- */
label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 6px; }
input[type=text], input[type=password], input[type=search], select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--garis); border-radius: 10px;
  font: inherit; background: #fff; color: inherit;
}
input:focus, select:focus { outline: 2px solid var(--biru); outline-offset: -1px; border-color: transparent; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--biru); margin: 0; }
button { font: inherit; cursor: pointer; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 10px; padding: 9px 16px; font-weight: 600;
  background: var(--biru); color: #fff; white-space: nowrap;
}
.btn:hover { background: var(--biru-hover); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.light { background: var(--putih); color: var(--teks); border: 1px solid var(--garis); }
.btn.light:hover { background: var(--abu-muda); }
.btn.danger { background: var(--merah); }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: transparent; color: var(--abu);
}
.icon-btn:hover { background: var(--abu-muda); color: var(--teks); }
.icon-btn.on { background: var(--biru-muda); color: var(--biru); }
.icon-btn.spin svg { animation: putar 1s linear infinite; color: var(--biru); }
@keyframes putar { to { transform: rotate(-360deg); } }
.alert { border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-top: 14px; }
.alert.err { background: var(--merah-muda); color: var(--merah); }
.alert.info { background: var(--biru-muda); color: var(--biru-tua); }

/* ---------- Logo ---------- */
.logo {
  width: 40px; height: 40px; border-radius: 10px; background: var(--biru); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 18px; flex: none; overflow: hidden;
}
.logo.has-img { background: transparent; }
.logo img { width: 100%; height: 100%; object-fit: contain; }

/* ================= HALAMAN LOGIN ================= */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-hero {
  background: var(--login-bg); background-size: cover; background-position: center;
  color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.login-hero > * { position: relative; }
.login-hero .brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 20px; }
.login-hero .logo { width: 52px; height: 52px; background: #fff; color: var(--biru); }
.login-hero .logo.has-img { background: rgba(255,255,255,.95); padding: 4px; }
.login-hero h1 { font-size: 34px; line-height: 1.25; margin: 0 0 14px; max-width: 520px; text-shadow: 0 1px 12px rgba(0,0,0,.25); }
.login-hero p { opacity: .9; max-width: 460px; margin: 0; font-size: 15px; }
.login-hero ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 10px; font-size: 15px; }
.login-hero li { display: flex; gap: 10px; align-items: center; }
.login-hero li svg { color: #93c5fd; }
.login-form-wrap { display: grid; place-items: center; padding: 32px 16px; background: var(--putih); }
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-size: 26px; margin: 0 0 4px; }
.login-card .sub { color: var(--abu); margin: 0 0 18px; font-size: 15px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 90px; }
.pw-wrap button {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--biru); padding: 6px 8px; font-size: 12px; font-weight: 600;
}
.login-card .btn.full { width: 100%; margin-top: 18px; padding: 12px; font-size: 15px; }
.login-foot { margin-top: 28px; text-align: center; }
@media (max-width: 860px) {
  .login-page { grid-template-columns: 1fr; }
  .login-hero { padding: 28px 16px 32px; min-height: 220px; }
  .login-hero h1 { font-size: 22px; margin-top: 24px; }
  .login-hero ul, .login-hero .foot { display: none; }
  .login-form-wrap { align-items: start; }
}

/* ================= APLIKASI ================= */
.app { display: grid; grid-template-columns: 256px minmax(0, 1fr); height: 100vh; }
.sidebar { background: var(--latar); padding: 12px 12px 16px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; font-weight: 700; font-size: 18px; }
.sidebar .brand small { display: block; font-weight: 400; font-size: 11px; color: var(--abu); line-height: 1.3; }
.btn-new {
  display: inline-flex; align-items: center; gap: 10px; align-self: flex-start;
  padding: 14px 22px 14px 18px; border: 0; border-radius: 16px; background: var(--putih);
  box-shadow: var(--shadow); font-weight: 600; font-size: 14px; margin: 0 0 12px 4px; color: var(--teks);
}
.btn-new:hover { background: var(--biru-muda); }
.btn-new svg { color: var(--biru); width: 22px; height: 22px; }
.nav a {
  display: flex; align-items: center; gap: 14px; padding: 9px 16px; border-radius: 999px;
  color: var(--teks); text-decoration: none; cursor: pointer; font-weight: 500;
}
.nav a:hover { background: #e9edf5; }
.nav a.active { background: var(--biru-muda); color: var(--biru-tua); font-weight: 700; }
.nav a.active svg { color: var(--biru); }
.nav-label { font-size: 11px; font-weight: 700; color: var(--abu); text-transform: uppercase; letter-spacing: .06em; padding: 16px 16px 6px; }
.storage-box { margin-top: auto; padding: 16px 16px 0; font-size: 12px; color: var(--abu); }
.storage-bar { height: 4px; background: var(--garis); border-radius: 2px; overflow: hidden; margin: 6px 0; }
.storage-bar i { display: block; height: 100%; background: var(--biru); width: 0; }

.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 20px 10px 8px; background: var(--latar); }
.menu-btn { display: none; }
.search { flex: 1; max-width: 720px; position: relative; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--abu); }
.search input { border: 0; background: #e9eef6; border-radius: 999px; padding: 12px 16px 12px 46px; font-size: 15px; }
.search input:focus { background: #fff; box-shadow: var(--shadow); outline: 0; }
.account { margin-left: auto; position: relative; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--biru); color: #fff; border: 0;
  font-weight: 700; display: grid; place-items: center;
}

.content-card {
  flex: 1; min-height: 0; background: var(--putih); border-radius: 16px; margin: 0 16px 16px 0;
  display: flex; flex-direction: column; overflow: hidden;
}
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.view-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px 8px; min-height: 60px; flex-wrap: wrap; }
.view-head h1 { font-size: 22px; font-weight: 500; margin: 0; }
.view-head .spacer { flex: 1; }
.crumbs { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; font-size: 20px; min-width: 0; }
.crumbs button {
  border: 0; background: transparent; padding: 4px 10px; border-radius: 999px; font-size: inherit; color: var(--abu);
  max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.crumbs button:hover { background: var(--abu-muda); color: var(--teks); }
.crumbs button:last-child { color: var(--teks); }
.crumbs svg { color: var(--abu); width: 18px; height: 18px; }
.selbar {
  display: flex; align-items: center; gap: 4px; background: var(--biru-muda); border-radius: 999px;
  padding: 4px 8px 4px 4px; margin: 0 20px 8px; font-weight: 600; color: var(--biru-tua);
}
.selbar .icon-btn { color: var(--biru-tua); }
.scroll { flex: 1; overflow-y: auto; padding: 0 20px 100px; position: relative; }
.scroll.drag::after {
  content: "Lepaskan untuk mengunggah ke folder ini"; position: absolute; inset: 0 20px 20px;
  border: 2px dashed var(--biru); background: rgba(232,240,254,.85); border-radius: 12px;
  display: grid; place-items: center; font-size: 16px; font-weight: 600; color: var(--biru-tua);
}
.empty { text-align: center; padding: 70px 16px; color: var(--abu); }
.empty svg { width: 64px; height: 64px; color: var(--biru-garis); margin-bottom: 8px; }
.empty b { display: block; color: var(--teks); font-size: 16px; margin-bottom: 4px; }
.loading { padding: 40px; text-align: center; color: var(--abu); }

/* ---- Daftar (list) ---- */
.list-head, .row {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) 180px 150px 100px 40px;
  align-items: center; gap: 8px;
}
.list-head { position: sticky; top: 0; background: var(--putih); z-index: 1; font-size: 13px; font-weight: 600; color: var(--abu); border-bottom: 1px solid var(--garis); padding: 10px 0; }
.list-head .sort { cursor: pointer; user-select: none; }
.list-head .sort:hover { color: var(--teks); }
.row { border-bottom: 1px solid var(--garis); padding: 6px 0; min-height: 50px; cursor: default; border-radius: 0; }
.row:hover { background: var(--abu-muda); }
.row.sel { background: var(--biru-muda); }
.row .name { display: flex; align-items: center; gap: 12px; min-width: 0; cursor: pointer; font-weight: 500; }
.row .name > div { min-width: 0; overflow: hidden; }
.row .name > div > span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .name:hover span { color: var(--biru); text-decoration: underline; }
.row .meta-sm { display: none; }
.row .c { color: var(--abu); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.row .shared { color: var(--abu); width: 15px; height: 15px; margin-left: -4px; }
.cb { display: grid; place-items: center; }
.cb input { width: 16px; height: 16px; accent-color: var(--biru); }

/* ---- Kisi (grid) ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; padding-top: 8px; }
.grid-title { grid-column: 1 / -1; font-size: 13px; font-weight: 600; color: var(--abu); margin-top: 8px; }
.tile {
  background: var(--abu-muda); border-radius: 12px; padding: 10px; cursor: pointer; position: relative;
  border: 2px solid transparent; transition: background .1s;
}
.tile:hover { background: #e9edf3; }
.tile.sel { background: var(--biru-muda); border-color: var(--biru-garis); }
.tile .top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tile .top span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.tile .icon-btn { width: 30px; height: 30px; margin-right: -4px; }
.tile .thumb { height: 120px; background: var(--putih); border-radius: 8px; margin-top: 10px; display: grid; place-items: center; }
.tile .thumb .ft { width: 56px; height: 56px; font-size: 13px; border-radius: 10px; }
.tile.folder .thumb { display: none; }
.tile .cb { position: absolute; top: 8px; left: 8px; display: none; }
.grid.selecting .tile .cb, .tile.sel .cb { display: grid; }
.grid.selecting .tile .top .ficon, .tile.sel .top .ficon { visibility: hidden; }

/* ---- Ikon file ---- */
.ft {
  width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; flex: none;
  color: #fff; font-size: 9px; font-weight: 800; letter-spacing: .02em; background: #6b7280;
}
.ft.pdf { background: #e5383b; } .ft.doc { background: #2b6cde; } .ft.xls { background: #16a34a; }
.ft.ppt { background: #ea7317; } .ft.img { background: #9333ea; } .ft.vid { background: #db2777; }
.ft.aud { background: #0d9488; } .ft.zip { background: #b7791f; }
.ficon-folder { width: 28px; height: 28px; color: var(--folder); fill: currentColor; stroke: none; flex: none; }

/* ---- Tabel admin ---- */
.panel { max-width: 920px; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--garis); }
.table th { font-size: 12px; color: var(--abu); font-weight: 600; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--abu-muda); color: var(--abu); }
.badge.blue { background: var(--biru-muda); color: var(--biru-tua); }
.badge.green { background: #def7ec; color: #03543f; }
.badge.red { background: var(--merah-muda); color: var(--merah); }
.set-card { border: 1px solid var(--garis); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.set-card h3 { margin: 0 0 4px; font-size: 16px; }
.set-card > p { margin: 0 0 8px; color: var(--abu); }
.img-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 12px; }
.img-prev {
  width: 88px; height: 88px; border-radius: 12px; border: 1px dashed var(--garis); background: var(--abu-muda);
  display: grid; place-items: center; overflow: hidden; color: var(--abu); font-size: 12px; text-align: center;
}
.img-prev img { width: 100%; height: 100%; object-fit: contain; }
.img-prev.fav { width: 48px; height: 48px; }
.bg-prev { width: 260px; height: 140px; border-radius: 12px; background: var(--login-bg); background-size: cover; background-position: center;
           display: flex; align-items: flex-end; padding: 12px; color: #fff; font-weight: 700; font-size: 13px; }
.color-in, .check input.color-in { width: 48px; height: 38px; padding: 2px; border: 1px solid var(--garis); border-radius: 8px; background: #fff; cursor: pointer; }

/* ---------- Menu melayang ---------- */
.menu {
  position: fixed; z-index: 50; background: var(--putih); border-radius: 10px; box-shadow: 0 8px 30px rgba(16,24,40,.18);
  padding: 6px 0; min-width: 220px;
}
.menu button {
  display: flex; align-items: center; gap: 14px; width: 100%; border: 0; background: transparent;
  padding: 9px 18px; text-align: left; color: var(--teks); font-size: 14px;
}
.menu button:hover { background: var(--abu-muda); }
.menu button:disabled { opacity: .4; cursor: default; background: transparent; }
.menu button svg { color: var(--abu); }
.menu hr { border: 0; border-top: 1px solid var(--garis); margin: 6px 0; }
.menu .head { padding: 10px 18px; border-bottom: 1px solid var(--garis); margin-bottom: 6px; }

/* ---------- Dialog ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(17,24,39,.45); z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal {
  background: var(--putih); border-radius: 16px; width: 100%; max-width: 440px; padding: 22px 24px 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25); max-height: calc(100vh - 32px); overflow-y: auto;
}
.modal.wide { max-width: 560px; }
.modal h3 { margin: 0 0 12px; font-size: 20px; font-weight: 500; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.share-row { display: flex; gap: 8px; margin-top: 12px; }
.share-row input { flex: 1; color: var(--abu); }
.access {
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--abu-muda); margin-top: 6px;
}
.access .dot { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--garis); color: var(--abu); flex: none; }
.access.pub .dot { background: #def7ec; color: var(--hijau); }
.access select { width: auto; flex: none; padding: 6px 8px; }
.picker { border: 1px solid var(--garis); border-radius: 10px; height: 280px; overflow-y: auto; margin-top: 8px; }
.picker button {
  display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: transparent; padding: 10px 12px; text-align: left;
}
.picker button:hover { background: var(--abu-muda); }
.picker .ficon-folder { width: 22px; height: 22px; }
.picker-crumbs { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 4px; }
.picker-crumbs button { border: 0; background: transparent; padding: 4px 8px; border-radius: 6px; color: var(--biru); font-size: 13px; }
.picker-crumbs button:hover { background: var(--biru-muda); }

/* ---------- Panel upload ---------- */
.uploads {
  position: fixed; right: 24px; bottom: 0; width: 380px; z-index: 40; background: var(--putih);
  border-radius: 14px 14px 0 0; box-shadow: 0 8px 30px rgba(16,24,40,.22); overflow: hidden;
}
.uploads .uh { display: flex; align-items: center; gap: 4px; background: var(--biru-tua); color: #fff; padding: 8px 8px 8px 18px; font-weight: 600; }
.uploads .uh span { flex: 1; }
.uploads .uh .icon-btn { color: #fff; }
.uploads .uh .icon-btn:hover { background: rgba(255,255,255,.15); }
.uploads .ub { max-height: 300px; overflow-y: auto; }
.uploads.min .ub { display: none; }
.q { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--garis); }
.q .qi { flex: 1; min-width: 0; }
.q .qn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q .qs { font-size: 12px; color: var(--abu); }
.q.fail .qs { color: var(--merah); }
.bar { height: 4px; background: var(--garis); border-radius: 2px; margin-top: 5px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--biru); transition: width .2s; }
.q.ok .bar { display: none; }
.q .st-ic { width: 22px; height: 22px; }
.q.ok .st-ic { color: var(--hijau); }
.q.fail .st-ic { color: var(--merah); }

.toast {
  position: fixed; left: 24px; bottom: 24px; z-index: 70; background: #1f2937; color: #fff;
  padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow); max-width: calc(100vw - 48px);
  transform: translateY(20px); opacity: 0; visibility: hidden; transition: .2s;
}
.toast.show { transform: none; opacity: 1; visibility: visible; }
.fab { display: none; }
.backdrop { display: none; }

/* ---------- Tablet & HP ---------- */
@media (max-width: 1100px) {
  .list-head, .row { grid-template-columns: 36px minmax(0, 1fr) 150px 100px 40px; }
  .col-owner { display: none; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 280px; z-index: 55; background: var(--putih);
    transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow);
  }
  .sidebar.open { transform: none; }
  .backdrop.open { display: block; position: fixed; inset: 0; background: rgba(17,24,39,.4); z-index: 54; }
  .sidebar .btn-new { display: none; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 8px 12px 8px 6px; gap: 6px; }
  .search input { padding: 10px 14px 10px 42px; font-size: 14px; }
  .content-card { border-radius: 16px 16px 0 0; margin: 0; }
  .view-head { padding: 12px 16px 6px; min-height: 52px; }
  .view-head h1, .crumbs { font-size: 17px; }
  .scroll { padding: 0 12px 100px; }
  .list-head { display: none; }
  .list-head, .row { grid-template-columns: 0 minmax(0, 1fr) 40px; }
  .row .cb { visibility: hidden; }
  .row.sel .cb, .list.selecting .row .cb { visibility: visible; }
  .list.selecting .list-head, .list.selecting .row { grid-template-columns: 32px minmax(0, 1fr) 40px; }
  .row .c { display: none; }
  .row .meta-sm { display: block; font-size: 12px; color: var(--abu); font-weight: 400; }
  .row .name { align-items: center; }
  .row .name > div { min-width: 0; }
  .row .name span { display: block; }
  .row .name:hover span { text-decoration: none; color: inherit; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile .thumb { height: 96px; }
  .fab {
    display: grid; place-items: center; position: fixed; right: 18px; bottom: 22px; z-index: 30;
    width: 58px; height: 58px; border-radius: 18px; border: 0; background: var(--biru); color: #fff;
    box-shadow: 0 6px 20px rgba(29,78,216,.4);
  }
  .fab svg { width: 26px; height: 26px; }
  .uploads { right: 0; left: 0; width: auto; }
  .selbar { margin: 0 12px 8px; }
  .table .hide-sm { display: none; }
  .bg-prev { width: 100%; }
  .toast { left: 16px; bottom: 90px; }
}
