:root {
  --primary: #00875a; --on-primary: #fff;
  --bg: #f1f4f2; --surface: #ffffff; --surface-2: #f6f8f7; --text: #16202a; --muted: #5a6872; --border: #d9e0dc;
  --danger: #b3261e; --warn: #f5b700; --link: var(--primary);
  --tint: color-mix(in srgb, var(--primary) 10%, transparent);
  --radius: 8px; --shadow: 0 1px 2px rgba(15, 25, 20, .06), 0 8px 24px rgba(15, 25, 20, .08);
  --c1: #00875a; --c2: #3b7dd8; --c3: #e08a00; --c4: #8a5cd1; --c5: #cf4b6b; --c6: #7b8794;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1416; --surface: #161e21; --surface-2: #1b2528; --text: #e6edea; --muted: #94a39d; --border: #2a373a;
    --danger: #f07a6e; --link: color-mix(in srgb, var(--primary) 62%, #fff);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1416; --surface: #161e21; --surface-2: #1b2528; --text: #e6edea; --muted: #94a39d; --border: #2a373a;
  --danger: #f07a6e; --link: color-mix(in srgb, var(--primary) 62%, #fff);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 14px; }
a { color: var(--link); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Tombol & form ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 500; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: color-mix(in srgb, var(--primary) 88%, #000); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 88%, #000); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 6px; border: 0; background: transparent;
  color: var(--muted); cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--tint); color: var(--text); }
.input, select.input, textarea.input {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font: inherit;
}
textarea.input { min-height: 90px; resize: vertical; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
input[type="color"].input { padding: 2px; height: 38px; width: 64px; }
.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field > span { font-weight: 600; font-size: 13px; }
.hint { color: var(--muted); font-size: 12.5px; }
.row { display: flex; gap: 10px; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }
.row.wrap { flex-wrap: wrap; }
.row > select.input, .row > input[type="password"].input { width: auto; flex: none; }
.row > .grow.min { min-width: 180px; }
.check { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.error-text { color: var(--danger); font-size: 13px; min-height: 1.2em; }

/* ---------- Masuk ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding: 24px 24px 0; }
.login-card { margin: auto; }
.login .site-footer { margin: 0 -24px; padding: 16px 24px; }
.login-card {
  width: min(440px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 0; overflow: hidden; box-shadow: var(--shadow);
}
.stripe { display: none; }
.login-body { padding: 28px; }
.login-title { font-size: 21px; font-weight: 800; line-height: 1.2; margin: 18px 0 4px; }
.login-sub { margin: 0 0 18px; font-weight: 700; letter-spacing: .04em; color: var(--muted); font-size: 13px; }
.login-note { background: var(--tint); border-left: 3px solid var(--primary); padding: 8px 12px; border-radius: 4px; margin: 0 0 16px; font-size: 13px; }

/* ---------- Kerangka ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.brand-shield { color: var(--primary); display: inline-flex; }
.logo-plate { background: #fff; border-radius: 6px; display: grid; place-items: center; }
.logo-plate img { display: block; max-width: 100%; height: auto; }
.logo-lg { padding: 10px 14px; border: 1px solid var(--border); }
.logo-lg img { max-height: 120px; width: auto; }
.logo-side { padding: 8px 10px; border: 1px solid var(--border); }
.logo-side img { width: 100%; }
.logo-sm { padding: 3px 8px; flex: none; border: 1px solid var(--border); }
.logo-sm img { height: 30px; width: auto; }
.brand-text { min-width: 0; }
.brand-text b { display: block; font-weight: 800; line-height: 1.25; }
.brand-text span { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; color: var(--link); margin-top: 2px; }
.shell { display: grid; grid-template-columns: 268px 1fr; min-height: 100vh; }
.side {
  background: var(--surface); border-right: 1px solid var(--border); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.side .brand-text { padding: 12px 6px 14px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.side .brand-text b { font-size: 14.5px; }
.nav-h { font-size: 12px; color: var(--muted); padding: 14px 10px 4px; font-weight: 600; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius); color: var(--text);
  text-decoration: none; font-weight: 500;
}
.nav a:hover { background: var(--surface-2); }
.sub.ok { color: var(--link); display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.nav a[aria-current="page"] { background: var(--tint); color: var(--link); box-shadow: inset 3px 0 0 var(--primary); }
.meter-box { margin-top: auto; padding: 14px 10px 4px; border-top: 1px solid var(--border); font-size: 12.5px; }
.meter { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; margin: 6px 0; }
.meter > i { display: block; height: 100%; background: var(--primary); border-radius: 3px; }
.meter.warn > i { background: var(--warn); } .meter.full > i { background: var(--danger); }
.content { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 24px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.search { flex: 1; max-width: 520px; position: relative; }
.search svg { position: absolute; left: 10px; top: 9px; color: var(--muted); }
.search input { padding-left: 34px; background: var(--surface-2); }
.topbar .spacer { flex: 1; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-weight: 700; border: 0; cursor: pointer; }
main#view { padding: 20px 24px 80px; flex: 1; }
.view-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.view-head h1 { flex: 1; min-width: 200px; }
.view-head .row { flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; flex: 1; min-width: 200px; font-size: 16px; font-weight: 600; }
.crumbs a, .crumbs span.cur { padding: 4px 6px; border-radius: 6px; color: var(--text); text-decoration: none; }
.crumbs a { color: var(--muted); font-weight: 500; }
.crumbs a:hover { background: var(--surface-2); color: var(--text); }
.crumbs svg { color: var(--muted); flex: none; }

/* ---------- Daftar berkas ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
table.files { width: 100%; border-collapse: collapse; }
.files th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.files th button { background: none; border: 0; padding: 0; font-weight: 600; color: inherit; cursor: pointer; }
.files td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.files tbody tr:last-child td { border-bottom: 0; }
.files tbody tr:hover { background: var(--surface-2); }
.files tr.drop-target { background: var(--tint); outline: 2px dashed var(--primary); outline-offset: -2px; }
.files .c-size, .files .c-date { color: var(--muted); white-space: nowrap; width: 1%; font-variant-numeric: tabular-nums; }
.files .c-act { width: 1%; white-space: nowrap; text-align: right; }
.name-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.name-cell .nm { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; font-weight: 500; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.name-cell .nm:hover { color: var(--link); text-decoration: underline; }
.sub { color: var(--muted); font-size: 12px; }
.ft {
  flex: none; width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; font-size: 10.5px; font-weight: 700;
  letter-spacing: .02em; text-transform: uppercase; color: #fff; background: var(--c6);
}
.ft-folder { background: var(--tint); color: var(--link); }
.ft-pdf { background: #c8402f; } .ft-doc { background: var(--c2); } .ft-xls { background: var(--c1); } .ft-ppt { background: var(--c3); }
.ft-img { background: var(--c4); } .ft-vid { background: var(--c5); } .ft-aud { background: #2f8f9d; } .ft-zip { background: #6b7280; }
.row-acts { display: inline-flex; gap: 2px; opacity: .55; }
tr:hover .row-acts, tr:focus-within .row-acts { opacity: 1; }
.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty h2 { color: var(--text); margin-bottom: 6px; }
.empty .btn { margin-top: 14px; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: var(--tint); color: var(--link); font-weight: 600; }
.pill-warn { background: color-mix(in srgb, var(--warn) 25%, transparent); color: var(--text); }
.pill-off { background: var(--border); color: var(--muted); }

/* ---------- Menu popover ---------- */
.menu {
  position: fixed; z-index: 60; min-width: 190px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow); padding: 6px;
}
.menu button, .menu .menu-info { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 6px; cursor: pointer; text-align: left; }
.menu button:hover { background: var(--surface-2); }
.menu .menu-info { cursor: default; color: var(--muted); font-size: 12.5px; }
.menu .danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }

/* ---------- Modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(8, 14, 12, .55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--surface); border-radius: 12px; width: min(480px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow); }
.modal-wide { width: min(720px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 18px 20px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); }
.modal-body p { margin: 0; }

/* ---------- Pratinjau ---------- */
.preview { position: fixed; inset: 0; z-index: 55; background: rgba(6, 10, 9, .97); display: flex; flex-direction: column; color: #eef3f0; }
.preview-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: rgba(0, 0, 0, .35); }
.preview-bar .t { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-bar .btn { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .18); color: #fff; }
.preview-bar .icon-btn { color: #dfe8e4; }
.preview-bar .icon-btn:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.preview-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 12px; position: relative; }
.preview-stage img, .preview-stage video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
.preview-stage iframe { width: min(1100px, 100%); height: 100%; border: 0; background: #fff; border-radius: 4px; }
.preview-stage audio { width: min(520px, 100%); }
.preview-stage pre { width: min(900px, 100%); max-height: 100%; overflow: auto; margin: 0; padding: 16px; background: #0d1412; border-radius: 6px; color: #dbe5e0; font: 13px/1.55 ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.preview-none { text-align: center; color: #c5d1cc; }
.preview-none .btn { margin-top: 14px; }

/* ---------- Unggahan ---------- */
.drop-overlay {
  position: fixed; inset: 0; z-index: 70; display: none; place-items: center; pointer-events: none;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(2px);
}
.drop-overlay.on { display: grid; }
.drop-overlay::before {
  content: ""; position: absolute; inset: 14px; border: 12px solid transparent; border-radius: 6px;
  border-image: repeating-linear-gradient(-45deg, var(--warn) 0 14px, #1c2124 14px 28px) 12;
}
.drop-overlay .msg { text-align: center; background: var(--surface); padding: 22px 32px; border-radius: 12px; box-shadow: var(--shadow); font-size: 18px; font-weight: 700; }
.drop-overlay .msg small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; margin-top: 4px; }
.upl { position: fixed; right: 20px; bottom: 20px; width: min(360px, calc(100vw - 24px)); z-index: 40; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.upl-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 16px; font-weight: 600; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.upl-head .grow { flex: 1; }
.upl-list { max-height: 240px; overflow-y: auto; }
.upl-row { padding: 8px 16px; border-bottom: 1px solid var(--border); font-size: 13px; }
.upl-row:last-child { border-bottom: 0; }
.upl-row .top { display: flex; justify-content: space-between; gap: 8px; }
.upl-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upl-row .st { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.upl-row.err .st { color: var(--danger); }
.upl-row .meter { margin: 4px 0 0; height: 4px; }
.upl-err { color: var(--danger); font-size: 12px; margin-top: 2px; }

/* ---------- Toast ---------- */
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { pointer-events: auto; background: #1b2427; color: #f2f6f4; padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); display: flex; gap: 14px; align-items: center; max-width: min(520px, 92vw); }
.toast-error { background: #7a1d16; }
.toast-action { background: none; border: 0; color: #8be0bd; font-weight: 700; cursor: pointer; }

/* ---------- Berbagi ---------- */
.sec { margin-bottom: 22px; }
.sec > h3 { margin-bottom: 8px; }
.share-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.share-item:last-child { border-bottom: 0; }
.share-item .who { flex: 1; min-width: 0; }
.share-item .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-item select { width: auto; }
.mini-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--tint); color: var(--link); display: grid; place-items: center; font-weight: 700; flex: none; }
.linkbox { display: flex; gap: 6px; }
.linkbox input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }

/* ---------- Admin ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--primary); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { padding: 14px 16px; }
.stat .v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 12.5px; }
.stackbar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--border); margin: 10px 0 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }
.pad { padding: 16px 18px; }
.cols2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.settings-card { padding: 18px 20px; margin-bottom: 16px; max-width: 820px; }
.settings-card h2 { margin-bottom: 2px; }
.settings-card > .hint { margin-bottom: 14px; }
.settings-card .actions { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; align-items: start; }
.perm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.perm-table th, .perm-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: center; }
.perm-table th:first-child, .perm-table td:first-child { text-align: left; }
.perm-table input.input { padding: 5px 8px; }
.sizeinput { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sizeinput .input { width: 110px; }
.sizeinput select.input { width: 80px; }

/* ---------- Picker / editor ---------- */
.picker { display: flex; flex-direction: column; height: 100vh; }
.picker-top { padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.picker-list { flex: 1; overflow: auto; padding: 8px 16px; }
.picker-foot { padding: 10px 16px; border-top: 1px solid var(--border); background: var(--surface); display: flex; gap: 8px; align-items: center; }
.picker-foot .grow { flex: 1; }
.dim { opacity: .45; }
.editor-frame { position: fixed; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.center-msg { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 24px; }

.loading { padding: 40px; text-align: center; color: var(--muted); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px; gap: 2px; border-right: 0; border-bottom: 1px solid var(--border); }
  .logo-side { width: 120px; flex: none; }
  .side .brand-text { border: 0; margin: 0; padding: 0; flex: 1; min-width: 160px; }
  .side .brand-text b { font-size: 13px; }
  .nav { width: 100%; }
  .login-body { padding: 20px; }
  .nav { display: flex; flex-wrap: wrap; gap: 2px; }
  .nav-h, .meter-box { display: none; }
  .topbar { padding: 10px 14px; position: static; }
  main#view { padding: 14px 12px 90px; }
  .files .c-size, .files .c-date { display: none; }
  .search { max-width: none; min-width: 0; }
  .modal-wide .row { flex-wrap: wrap; }
  .grid2 { grid-template-columns: 1fr; }
  .upl { right: 8px; bottom: 8px; }
}
@media (prefers-reduced-motion: no-preference) {
  .modal { animation: pop .14s ease-out; }
  @keyframes pop { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }
}

/* ---------- Footer hak cipta ---------- */
.site-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 24px; padding: 18px 24px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
