/* Drivemu — mengikuti STYLE-RULES.md: rem kelipatan 0.2 (kecuali 0.1rem/1px/2px), tanpa em,
   tinggi tetap hanya untuk elemen yang tingginya tak berubah, jarak antar anak lewat gap. */
:root {
  --bg: #f3f4f8; --surface: #ffffff; --surface-2: #f6f7fa; --hover: #f0f1f6; --line: #e6e8ee;
  --text: #121623; --muted: #667085;
  --accent: #4f46e5; --accent-2: #7c3aed; --accent-ink: #ffffff; --accent-soft: #eceeff;
  --danger: #dc2626; --danger-soft: #fdeaea;
  --shadow: 0 0.1rem 0.2rem rgba(16, 24, 40, .06), 0 0.2rem 0.8rem rgba(16, 24, 40, .05);
  --shadow-lg: 0 1.6rem 4rem rgba(16, 24, 40, .22);
  --r-s: 0.6rem; --r-m: 1rem; --r-l: 1.4rem;
  --control-h: 2.4rem;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light dark; /* scrollbar dan kontrol bawaan ikut tema */
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0c12; --surface: #11141c; --surface-2: #161a24; --hover: #1a1f2b; --line: #222837;
    --text: #e8eaf1; --muted: #8e97ab;
    --accent: #8186ff; --accent-2: #a78bfa; --accent-ink: #0a0c12; --accent-soft: #1b1f3d;
    --danger: #f87171; --danger-soft: #3a1b1f;
    --shadow: 0 0.1rem 0.2rem rgba(0, 0, 0, .4), 0 0.2rem 0.8rem rgba(0, 0, 0, .3);
    --shadow-lg: 0 1.6rem 4rem rgba(0, 0, 0, .6);
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 1rem/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
.hidden { display: none !important; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
a { color: var(--accent); }
p, h1, h2, h3, ul { margin: 0; padding: 0; }
ul { list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button { font: inherit; color: inherit; }

/* ---------- Ikon (mask dari folder icons/, warna = currentColor) ---------- */
.icon { display: block; flex: none; width: var(--is, 1.2rem); height: var(--is, 1.2rem); background: currentColor;
  -webkit-mask: var(--src) center / contain no-repeat; mask: var(--src) center / contain no-repeat; }
.i-logo { --src: url(icons/logo.svg); }
.i-folder { --src: url(icons/folder.svg); }
.i-folder-open { --src: url(icons/folder-open.svg); }
.i-folder-plus { --src: url(icons/folder-plus.svg); }
.i-folder-up { --src: url(icons/folder-up.svg); }
.i-image { --src: url(icons/image.svg); }
.i-video { --src: url(icons/video.svg); }
.i-audio { --src: url(icons/audio.svg); }
.i-file { --src: url(icons/file.svg); }
.i-file-text { --src: url(icons/file-text.svg); }
.i-pdf { --src: url(icons/pdf.svg); }
.i-archive { --src: url(icons/archive.svg); }
.i-download { --src: url(icons/download.svg); }
.i-upload { --src: url(icons/upload.svg); }
.i-pencil { --src: url(icons/pencil.svg); }
.i-trash { --src: url(icons/trash.svg); }
.i-refresh { --src: url(icons/refresh.svg); }
.i-grid { --src: url(icons/grid.svg); }
.i-list { --src: url(icons/list.svg); }
.i-close { --src: url(icons/close.svg); }
.i-external { --src: url(icons/external.svg); }
.i-chevron-right { --src: url(icons/chevron-right.svg); }
.i-plus { --src: url(icons/plus.svg); }
.i-search { --src: url(icons/search.svg); }
.i-logout { --src: url(icons/logout.svg); }
.i-hard-drive { --src: url(icons/hard-drive.svg); }
.i-check { --src: url(icons/check.svg); }
.i-alert { --src: url(icons/alert.svg); }
.i-arrow-up { --src: url(icons/arrow-up.svg); }
.i-arrow-down { --src: url(icons/arrow-down.svg); }
.i-lock { --src: url(icons/lock.svg); }
.i-zap { --src: url(icons/zap.svg); }
.i-git-branch { --src: url(icons/git-branch.svg); }
.i-layers { --src: url(icons/layers.svg); }
.i-star { --src: url(icons/star.svg); }
.i-sliders { --src: url(icons/sliders.svg); }
.i-chevron-down { --src: url(icons/chevron-down.svg); }
.i-chevron-left { --src: url(icons/chevron-left.svg); }

/* Warna per jenis file (--tc), dipakai oleh .tile dan ikon kecil */
.k-folder { --tc: #f59e0b; } .k-image { --tc: #10b981; } .k-video { --tc: #8b5cf6; } .k-audio { --tc: #ec4899; }
.k-pdf { --tc: #ef4444; } .k-text { --tc: #3b82f6; } .k-archive { --tc: #b45309; } .k-file { --tc: #8e97ab; }
.tile { display: flex; align-items: center; justify-content: center; flex: none; width: 2.4rem; height: 2.4rem;
  border-radius: var(--r-s); color: var(--tc); background: color-mix(in srgb, var(--tc) 14%, transparent); }
.tile.lg { --is: 1.8rem; width: 4rem; height: 4rem; border-radius: var(--r-m); }

/* ---------- Tombol & input: tinggi tetap, padding kiri-kanan saja ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 0.8rem;
  height: var(--control-h); padding: 0 1.4rem;
  font-size: 0.8rem; font-weight: 600; white-space: nowrap; cursor: pointer; text-decoration: none;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: var(--r-s);
  transition: background .15s, border-color .15s, box-shadow .15s, transform .15s var(--ease);
}
.btn .icon { --is: 1rem; }
.btn:hover { background: var(--hover); }
.btn:active { transform: translateY(1px); }
.btn.primary { color: var(--accent-ink); border-color: transparent; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 0.2rem 0.8rem color-mix(in srgb, var(--accent) 35%, transparent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.btn.danger:hover { filter: brightness(.97); }
.btn.ghost { border-color: transparent; background: transparent; padding: 0 1rem; color: var(--muted); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
/* pengecualian: tombol aksi utama lebih tinggi (3rem) agar jadi titik fokus */
.cta { height: 3rem; font-size: 1rem; }
.cta .icon { --is: 1.2rem; }
input[type=text], input[type=password], input[type=search] {
  width: 100%; height: var(--control-h); padding: 0 1.2rem; font: inherit; color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: var(--muted); }
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--accent) 22%, transparent); }

.logo { display: flex; align-items: center; gap: 1rem; font-weight: 700; font-size: 1.4rem; }
.logo-mark { --is: 1.4rem; display: flex; align-items: center; justify-content: center; width: 2.4rem; height: 2.4rem;
  border-radius: var(--r-s); color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 0.2rem 0.8rem color-mix(in srgb, var(--accent) 40%, transparent); }
.logo.light { color: #fff; }
.logo.light .logo-mark { background: rgba(255, 255, 255, .18); box-shadow: none; }
.mobile-only { display: none !important; }

/* ---------- Halaman masuk ---------- */
.login { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); min-height: 100%; }
.brand {
  display: flex; flex-direction: column; justify-content: space-between; gap: 3.2rem; padding: 3.2rem 4rem; color: #fff;
  background:
    radial-gradient(60rem 40rem at 0% 0%, rgba(255, 255, 255, .16), transparent 60%),
    radial-gradient(50rem 40rem at 100% 100%, rgba(255, 255, 255, .12), transparent 60%),
    linear-gradient(145deg, #4338ca, #7c3aed 60%, #a855f7);
}
.brand-copy { display: flex; flex-direction: column; gap: 1.6rem; max-width: 30rem; }
.brand h1 { font-size: 2.4rem; line-height: 1.2; font-weight: 700; }
.brand-copy > p { color: rgba(255, 255, 255, .8); font-size: 1rem; }
.feats { display: flex; flex-direction: column; gap: 1.6rem; padding-top: 1.2rem; }
.feats li { display: flex; align-items: flex-start; gap: 1.2rem; }
.feats li div { display: flex; flex-direction: column; }
.feats li span { color: rgba(255, 255, 255, .75); font-size: 0.8rem; }
.feat-ico { display: flex; align-items: center; justify-content: center; flex: none; width: 2.8rem; height: 2.8rem; border-radius: var(--r-s); background: rgba(255, 255, 255, .16); }
.login-pane { display: flex; align-items: center; justify-content: center; padding: 3.2rem 2rem; background: var(--surface); }
.login-card { width: min(28rem, 100%); display: flex; flex-direction: column; gap: 2rem; }
.login-head { display: flex; flex-direction: column; gap: 0.4rem; }
.login-head h2 { font-size: 1.8rem; font-weight: 700; }
.step { display: flex; flex-direction: column; gap: 0.8rem; }
.step-title { display: flex; align-items: center; gap: 1rem; font-weight: 600; }
.num { display: flex; align-items: center; justify-content: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; font-size: 0.8rem; font-weight: 700; color: var(--accent); background: var(--accent-soft); }
.hint { font-size: 0.8rem; color: var(--muted); }
.hint b { color: var(--text); font-weight: 600; }
.error { color: var(--danger); font-size: 0.8rem; }
.error:empty { display: none; }
.login-card summary { cursor: pointer; }
.login-card details p { padding-top: 0.8rem; }

/* ---------- Pemilih drive ---------- */
.tile.accent { --tc: var(--accent); }
.drives { height: 100%; display: flex; flex-direction: column; }
.drives-top { display: flex; align-items: center; gap: 1rem; height: 4.8rem; flex: none; padding: 0 3.2rem; border-bottom: 1px solid var(--line); background: var(--surface); }
.drives-scroll { flex: 1; overflow: auto; display: flex; justify-content: center; }
.drives-body { width: min(64rem, 100%); display: flex; flex-direction: column; gap: 2.4rem; padding: 4rem 2rem; }
.drives-head { display: flex; flex-direction: column; gap: 0.4rem; }
.drives-head h2 { font-size: 2.4rem; font-weight: 700; }
.drive-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(16.6rem, 1fr)); gap: 1.6rem; }
.drive-card { display: flex; flex-direction: column; align-items: flex-start; gap: 0.6rem; padding: 1.6rem; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); cursor: pointer; text-align: left; box-shadow: var(--shadow); transition: transform .2s var(--ease), border-color .15s, box-shadow .2s var(--ease); }
.drive-card .tile { margin-bottom: 0.6rem; }
.drive-card:hover { transform: translateY(-0.2rem); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: var(--shadow-lg); }
.drive-name { font-size: 1.2rem; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drive-card .meta { font-size: 0.8rem; color: var(--muted); }
.drive-card .meta.def { color: var(--accent); font-weight: 600; }
.drive-card { position: relative; }
.drive-card .acts { position: absolute; top: 1rem; right: 1rem; }
.drive-card:hover .acts, .drive-card:focus-within .acts { opacity: 1; }
@media (max-width: 56rem) { .drive-card .acts { opacity: 1; } }
.drive-card.new { justify-content: center; border-style: dashed; background: transparent; box-shadow: none; }
.drive-card.new .tile { color: var(--muted); background: var(--hover); }
.drive-card.new:hover { box-shadow: none; }
.repo-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem; padding-top: 0.4rem; }
.badge { display: inline-flex; align-items: center; height: 1.8rem; padding: 0 0.8rem; border-radius: 1.8rem; font-size: 0.8rem; font-weight: 600; color: var(--accent); background: var(--accent-soft); }
select { width: 100%; height: var(--control-h); padding: 0 1.2rem; font: inherit; color: var(--text); border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); cursor: pointer; }
select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--accent) 22%, transparent); }

/* ---------- Pengaturan ---------- */
/* .dlg.settings (2 kelas) agar menang atas .dlg yang didefinisikan lebih bawah */
.dlg.settings { width: min(52rem, 94vw); max-height: 90vh; padding: 0; overflow: hidden; }
.dlg.settings[open] { display: flex; flex-direction: column; }
.settings .preview-head { flex: none; }
.settings-body { display: flex; flex-direction: column; gap: 2.8rem; padding: 2rem; overflow: auto; }
.settings-body > .spinner { align-self: center; }
.ssec { display: flex; flex-direction: column; gap: 1.2rem; }
.ssec h4 { margin: 0; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.1rem; text-transform: uppercase; color: var(--muted); }
.profile { display: flex; align-items: center; gap: 1.6rem; }
.profile img { width: 6.4rem; height: 6.4rem; flex: none; border-radius: 50%; border: 1px solid var(--line); background: var(--hover); }
.who { display: flex; flex-direction: column; min-width: 0; }
.who b { font-size: 1.4rem; line-height: 1.3; }
.who .bio { padding-top: 0.4rem; font-size: 0.8rem; color: var(--muted); }
.srows { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; }
.srow { display: flex; align-items: center; justify-content: space-between; gap: 1.6rem; padding: 1rem 1.4rem; border-bottom: 1px solid var(--line); }
.srow:last-child { border-bottom: 0; }
.sk { flex: none; font-size: 0.8rem; color: var(--muted); }
.sv { min-width: 0; text-align: right; overflow-wrap: break-word; }
.chips { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.4rem; }
.inline { display: flex; gap: 0.8rem; }
.inline .btn { flex: none; }
@media (max-width: 56rem) { .drives-top { padding: 0 1.2rem; } .drives-body { padding: 2.4rem 1.6rem; } }

/* ---------- Kerangka aplikasi ---------- */
.app { height: 100%; display: grid; grid-template-columns: 15.6rem minmax(0, 1fr); gap: 0.8rem; padding: 0.8rem; }
.side { display: flex; flex-direction: column; gap: 2rem; padding: 1.2rem 0.4rem 0.4rem 0.8rem; min-height: 0; }
.side .cta { width: 100%; justify-content: flex-start; padding: 0 1.6rem; }
.nav { display: flex; flex-direction: column; gap: 0.2rem; }
.nav-item { display: flex; align-items: center; gap: 1.2rem; height: var(--control-h); padding: 0 1.2rem; border: 0; border-radius: var(--r-s); background: none; font-size: 1rem; cursor: pointer; text-align: left; color: var(--muted); }
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.usage { display: flex; flex-direction: column; gap: 0.8rem; padding: 1.4rem; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); }
.usage-head { display: flex; align-items: center; gap: 0.8rem; font-size: 0.8rem; }
.usage-head .icon { --is: 1rem; color: var(--accent); }
.meter { height: 0.6rem; border-radius: 0.6rem; background: var(--hover); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; border-radius: 0.6rem; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .5s var(--ease); }

.content { display: flex; flex-direction: column; min-width: 0; min-height: 0; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--surface); overflow: hidden; box-shadow: var(--shadow); }
.topbar { display: flex; align-items: center; gap: 1rem; height: 4.8rem; padding: 0 1.6rem; border-bottom: 1px solid var(--line); }
.searchbox { position: relative; display: flex; align-items: center; flex: 1; max-width: 36rem; }
.searchbox .icon { --is: 1.2rem; position: absolute; left: 1.2rem; color: var(--muted); pointer-events: none; }
.searchbox input { padding-left: 3.6rem; background: var(--surface-2); border-color: transparent; }
.searchbox input:focus { background: var(--surface); }
.seg { display: flex; align-items: center; gap: 0.2rem; height: var(--control-h); padding: 0.2rem; border-radius: var(--r-s); background: var(--surface-2); }
/* pengecualian: tombol di dalam .seg 2rem agar muat dalam padding 0.2rem */
.seg button { display: flex; align-items: center; justify-content: center; width: 2.4rem; height: 2rem; border: 0; border-radius: 0.4rem; background: none; color: var(--muted); cursor: pointer; }
.seg button .icon { --is: 1rem; }
.seg button.on { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }
.acct-btn { display: flex; align-items: center; gap: 0.8rem; height: var(--control-h); padding: 0 0.8rem; border: 0; border-radius: var(--r-s); background: none; font-size: 0.8rem; font-weight: 500; color: var(--muted); cursor: pointer; transition: background .15s; }
.acct-btn:hover { background: var(--hover); color: var(--text); }
.acct-btn img { width: 2rem; height: 2rem; border-radius: 50%; border: 1px solid var(--line); background: var(--hover); }
.acct-btn .icon { --is: 1rem; }
.login-card .back { align-self: flex-start; padding: 0 1rem 0 0.6rem; }
.menu.acct { min-width: 26rem; }
.acct-row { display: flex; align-items: center; gap: 1.2rem; height: 4rem; padding: 0 0.6rem 0 1.2rem; border-radius: var(--r-s); cursor: pointer; }
.acct-row:hover, .acct-row:focus-visible { background: var(--hover); }
.acct-row img { width: 2.4rem; height: 2.4rem; flex: none; border-radius: 50%; border: 1px solid var(--line); background: var(--hover); }
.acct-row .icon { --is: 1.2rem; color: var(--accent); }
.acct-row .ibtn { opacity: 0; }
.acct-row:hover .ibtn, .acct-row:focus-within .ibtn { opacity: 1; }
.acct-txt { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.3; }
.acct-txt b { font-size: 1rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-txt span { font-size: 0.8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { position: relative; flex: 1; overflow: auto; padding: 0 2rem 2rem; }
.titlebar { display: flex; align-items: center; height: 4.8rem; position: sticky; top: 0; z-index: 3; background: var(--surface); }
.crumbs { display: flex; flex-wrap: nowrap; align-items: center; gap: 0.2rem; min-width: 0; }
.crumbs button { display: flex; align-items: center; height: var(--control-h); padding: 0 1rem; border: 0; border-radius: var(--r-s); background: none; font-size: 1.4rem; font-weight: 500; color: var(--muted); cursor: pointer; white-space: nowrap; }
.crumbs button:hover { background: var(--hover); color: var(--text); }
.crumbs button:last-child { color: var(--text); font-weight: 700; }
.crumbs .sep { --is: 1rem; color: var(--muted); }
.selbar { display: flex; align-items: center; gap: 1rem; flex: 1; height: 3.6rem; padding: 0 0.8rem; border-radius: var(--r-m); background: var(--accent-soft); color: var(--accent); }
.statusbar { padding: 0.8rem 2rem; font-size: 0.8rem; color: var(--muted); border-top: 1px solid var(--line); }

/* ---------- Daftar: tabel ---------- */
.sec { padding: 1.2rem 0 0.8rem; font-size: 0.8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1rem; }
.list.list .table { border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; }
.row { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr) 8rem 7.2rem 7.2rem; align-items: center; gap: 1rem; height: 3.8rem; padding: 0 1.2rem; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row.head { height: 3rem; background: var(--surface-2); font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.row.item { cursor: pointer; transition: background .12s; }
.row.item:hover { background: var(--hover); }
.row.item.selected { background: var(--accent-soft); }
.sortbtn { display: flex; align-items: center; gap: 0.4rem; height: 2rem; padding: 0; border: 0; background: none; color: inherit; font-weight: 600; cursor: pointer; justify-self: start; }
.sortbtn .icon { --is: 0.8rem; }
.sortbtn.on { color: var(--text); }
.namecell { display: flex; align-items: center; gap: 1.2rem; min-width: 0; }
.name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell { font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num-r { text-align: left; font-variant-numeric: tabular-nums; }

/* checkbox kustom */
.chk { appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 1.4rem; height: 1.4rem; margin: 0; border: 2px solid var(--muted); border-radius: 0.4rem; background: var(--surface); cursor: pointer; opacity: 0; transition: opacity .12s, background .12s, border-color .12s; }
.chk:checked { opacity: 1; background: var(--accent); border-color: var(--accent); }
.chk:checked::after { content: ""; position: absolute; inset: 0; background: var(--accent-ink); -webkit-mask: url(icons/check.svg) center / 1rem no-repeat; mask: url(icons/check.svg) center / 1rem no-repeat; }
.chk.always { opacity: 1; }
.item:hover .chk, .selecting .chk { opacity: 1; }

/* tombol aksi per item */
.acts { display: flex; align-items: center; justify-content: flex-end; gap: 0.2rem; opacity: 0; transition: opacity .12s; }
.item:hover .acts, .item:focus-within .acts { opacity: 1; }
/* pengecualian: tombol ikon kecil 2.2rem agar muat di dalam baris dan kartu */
.ibtn { display: flex; align-items: center; justify-content: center; width: 2.2rem; height: 2.2rem; padding: 0; border: 0; border-radius: var(--r-s); background: none; color: var(--muted); cursor: pointer; }
.ibtn .icon { --is: 1.2rem; }
.ibtn:hover { background: color-mix(in srgb, var(--text) 10%, transparent); color: var(--text); }
.ibtn.del:hover { color: var(--danger); background: var(--danger-soft); }

/* ---------- Daftar: grid ---------- */
.folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(15.6rem, 1fr)); gap: 1.2rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(16.6rem, 1fr)); gap: 1.6rem; }
.fchip { display: flex; align-items: center; gap: 1.2rem; height: 4.2rem; padding: 0 0.8rem 0 1.2rem; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); cursor: pointer; transition: background .12s, box-shadow .15s, border-color .12s; }
.fchip .name { flex: 1; min-width: 0; }
.fchip { position: relative; }
.fchip .acts { position: absolute; right: 3.6rem; padding: 0.2rem; border-radius: var(--r-s); background: var(--surface); box-shadow: -0.8rem 0 0.8rem var(--surface); }
.fchip:hover .acts { background: var(--surface); }
.fchip.selected .acts { background: var(--accent-soft); box-shadow: -0.8rem 0 0.8rem var(--accent-soft); }
.card { position: relative; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); cursor: pointer; overflow: hidden; transition: box-shadow .2s var(--ease), border-color .12s, transform .2s var(--ease); }
.fchip:hover, .card:hover { box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.card:hover { transform: translateY(-0.2rem); }
.fchip.selected, .card.selected { background: var(--accent-soft); border-color: var(--accent); }
.thumb { position: relative; display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; }
.card.selected .thumb { background: color-mix(in srgb, var(--accent) 8%, var(--surface-2)); }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .3s; }
.thumb img.ready { opacity: 1; }
.thumb .chk { position: absolute; top: 1rem; left: 1rem; z-index: 2; }
.thumb .acts { position: absolute; top: 0.8rem; right: 0.8rem; z-index: 2; padding: 0.2rem; border-radius: var(--r-s); background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(0.8rem); }
.foot { display: flex; align-items: center; gap: 1rem; padding: 1.2rem; border-top: 1px solid var(--line); min-width: 0; }
.foot > .icon { --is: 1.4rem; color: var(--tc); }
.foot .txt { display: flex; flex-direction: column; min-width: 0; }
.foot .meta { font-size: 0.8rem; color: var(--muted); }

/* ---------- State kosong, loading, drop ---------- */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.2rem; text-align: center; padding: 6rem 2rem; }
.empty-art { --is: 3.2rem; display: flex; align-items: center; justify-content: center; width: 8rem; height: 8rem; border-radius: 50%; color: var(--accent); background: var(--accent-soft); }
.empty h3 { font-size: 1.4rem; }
.empty p { max-width: 24rem; }
.loading { display: flex; flex-direction: column; gap: 0.8rem; padding-top: 0.8rem; }
.loading::before, .loading::after, .loading i { content: ""; display: block; height: 3.8rem; border-radius: var(--r-m); background: linear-gradient(90deg, var(--surface-2) 25%, var(--hover) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.drop-overlay { position: absolute; inset: 0.8rem; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.2rem; border: 2px dashed var(--accent); border-radius: var(--r-l); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); color: var(--accent); font-size: 1.4rem; font-weight: 600; pointer-events: none; animation: fade .15s; }
.drop-overlay .icon { --is: 3.2rem; }
@keyframes fade { from { opacity: 0; } }

/* ---------- Menu "New" ---------- */
.menu { position: fixed; z-index: 40; display: flex; flex-direction: column; gap: 0.2rem; min-width: 16rem; padding: 0.6rem; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); box-shadow: var(--shadow-lg); animation: pop .14s var(--ease); }
.menu button { display: flex; align-items: center; gap: 1.2rem; height: var(--control-h); padding: 0 1.2rem; border: 0; border-radius: var(--r-s); background: none; font-size: 1rem; cursor: pointer; text-align: left; }
.menu button:hover { background: var(--hover); }
.menu .icon { --is: 1.2rem; color: var(--muted); }
.menu hr { width: 100%; height: 1px; margin: 0; border: 0; background: var(--line); }

/* ---------- Dialog ---------- */
.dlg { border: 1px solid var(--line); border-radius: var(--r-l); background: var(--surface); color: var(--text); padding: 2rem; width: min(28rem, 92vw); box-shadow: var(--shadow-lg); }
.dlg[open] { animation: pop .18s var(--ease); }
.dlg::backdrop { background: rgba(10, 12, 20, .55); backdrop-filter: blur(0.4rem); }
@keyframes pop { from { opacity: 0; transform: translateY(0.8rem) scale(.98); } }
.dlg h3 { font-size: 1.4rem; }
.dlg form { display: flex; flex-direction: column; gap: 1.2rem; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 0.8rem; padding-top: 0.4rem; }
.preview { width: min(64rem, 96vw); max-height: 92vh; padding: 0; overflow: hidden; }
.preview[open] { display: flex; flex-direction: column; }
.preview-head { display: flex; align-items: center; gap: 0.8rem; height: 4.8rem; padding: 0 1.2rem 0 2rem; border-bottom: 1px solid var(--line); }
.preview-head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-body { display: grid; place-items: center; padding: 1.6rem; overflow: auto; min-height: 14rem; background: var(--surface-2); }
.preview-body img, .preview-body video { max-width: 100%; max-height: 74vh; border-radius: var(--r-s); }
.preview-body audio { width: 100%; }
.preview-body iframe { width: 100%; height: 74vh; border: 0; border-radius: var(--r-s); background: #fff; }
.preview-body pre { margin: 0; width: 100%; white-space: pre-wrap; word-break: break-word; font: 0.8rem/1.6 ui-monospace, "Cascadia Code", Consolas, monospace; }
.spinner { width: 2.4rem; height: 2.4rem; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Toast ---------- */
.toasts { position: fixed; left: 50%; bottom: 2rem; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 0.8rem; z-index: 60; width: min(32rem, 92vw); pointer-events: none; }
.toast { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 0.6rem 1.2rem; width: 100%; padding: 1.2rem 1.6rem; border-radius: var(--r-m); background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); font-size: 0.8rem; font-weight: 500; animation: pop .2s var(--ease); pointer-events: auto; }
.toast .icon { --is: 1.2rem; color: #34d399; }
.toast.err { background: var(--danger); color: #fff; }
.toast.err .icon { color: #fff; }
.toast .bar { grid-column: 1 / -1; height: 0.4rem; border-radius: 0.4rem; background: color-mix(in srgb, var(--bg) 25%, transparent); overflow: hidden; }
.toast .bar i { display: block; height: 100%; width: 0; border-radius: 0.4rem; background: #34d399; transition: width .2s; }

/* ---------- Responsif ---------- */
@media (max-width: 56rem) {
  .login { grid-template-columns: 1fr; }
  .brand { display: none; }
  .mobile-only { display: flex !important; }
  .login-card .logo.mobile-only { margin-bottom: 0.4rem; }
  .app { grid-template-columns: minmax(0, 1fr); padding: 0; gap: 0; }
  .side { display: none; }
  .content { border: 0; border-radius: 0; box-shadow: none; }
  .topbar { padding: 0 1.2rem; gap: 0.8rem; }
  .acct-btn span, .btn.ghost#refreshBtn { display: none; }
  .main { padding: 0 1.2rem 1.6rem; }
  .row { grid-template-columns: 2.4rem minmax(0, 1fr) 5.6rem; }
  .row > :nth-child(3), .row > :nth-child(5) { display: none; }
  .acts { opacity: 1; }
  .chk { opacity: 1; }
  .thumb .chk { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
