:root {
  --bg: #0f1115; --panel: #171a21; --line: #262b36; --fg: #e6e9ef;
  --muted: #8b93a3; --accent: #4f8cff; --accent2: #2f6fe0;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }

/* auth */
.auth { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 26px; width: 100%; max-width: 380px; }
.auth-card h1 { margin: 0 0 6px; }
.auth-card label { display: block; margin: 14px 0 0; font-size: 13px; color: var(--muted); }
input, select {
  width: 100%; margin-top: 6px; padding: 11px 12px; border-radius: 9px;
  border: 1px solid var(--line); background: #0c0e12; color: var(--fg); font-size: 15px;
}
input:focus, select:focus { outline: 2px solid var(--accent); border-color: transparent; }
button, .btn {
  cursor: pointer; border: 0; border-radius: 9px; padding: 11px 16px;
  font-size: 15px; background: #232837; color: var(--fg); text-decoration: none; display: inline-block;
}
button.primary, .primary { background: var(--accent); color: #fff; width: 100%; margin-top: 18px; }
button.primary:disabled { opacity: .5; }
button.ghost { background: transparent; color: var(--muted); padding: 6px 10px; }
button.ghost:hover { color: var(--fg); }
.msg { color: #ff7b72; font-size: 13px; min-height: 18px; margin: 10px 0 0; }

/* app */
.app { max-width: 820px; margin: 0 auto; padding: 18px 16px 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.topbar h1 { margin: 0; font-size: 20px; }
.who { display: flex; align-items: center; gap: 8px; font-size: 13px; }

.storage { margin-bottom: 16px; font-size: 12px; }
.bar { height: 6px; border-radius: 4px; background: #232837; overflow: hidden; margin-bottom: 5px; }
.bar.sm { height: 4px; margin: 4px 0 0; }
.bar .fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #7aa8ff); transition: width .3s; }

.drop {
  border: 2px dashed var(--line); border-radius: 12px; padding: 26px; text-align: center;
  background: var(--panel); transition: border-color .15s, background .15s;
}
.drop.over { border-color: var(--accent); background: #1a2233; }
.drop p { margin: 4px 0; }
.picker { color: var(--accent); cursor: pointer; font-weight: 600; }
.picker input { display: none; }

.uprow { display: flex; align-items: center; gap: 10px; padding: 8px 4px; font-size: 13px; }
.uprow .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uprow .bar { flex: 2; margin: 0; }

.toolbar { display: flex; gap: 10px; margin: 16px 0 8px; }
.toolbar input { flex: 1; margin: 0; }
.toolbar select { width: 130px; margin: 0; }

.files { list-style: none; margin: 0; padding: 0; }
.files li { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.row {
  flex: 1; display: flex; align-items: center; gap: 12px; background: none; text-align: left;
  padding: 12px 6px; border-radius: 8px; min-width: 0;
}
.row:hover { background: #1a1e28; }
.ico { font-size: 18px; }
.nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta { font-size: 12px; white-space: nowrap; }
.del { opacity: .35; }
.del:hover { opacity: 1; color: #ff7b72; }

/* viewer */
dialog {
  width: min(940px, 96vw); max-width: none; height: min(86vh, 900px); padding: 0;
  border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--fg);
}
dialog::backdrop { background: rgba(0,0,0,.65); }
.viewer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.viewer-head span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-actions { display: flex; gap: 6px; }
.viewer-body { padding: 16px; overflow: auto; height: calc(100% - 62px); display: grid; place-items: center; }
.viewer-body img, .viewer-body video { max-width: 100%; max-height: 100%; border-radius: 8px; }
.viewer-body audio { width: 100%; }
.viewer-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.viewer-body pre { width: 100%; margin: 0; white-space: pre-wrap; word-break: break-word; font: 13px/1.5 ui-monospace, monospace; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #232837; border: 1px solid var(--line); color: var(--fg);
  padding: 11px 18px; border-radius: 10px; font-size: 14px; z-index: 99;
  box-shadow: 0 8px 30px rgba(0,0,0,.5); max-width: 90vw;
}

@media (max-width: 560px) {
  .who span { display: none; }
  .files li { flex-wrap: wrap; }
  .row .meta { width: 100%; padding-left: 30px; }
}

/* toolbar extras */
.toolbar { flex-wrap: wrap; }
.toolbar .ghost { white-space: nowrap; }

/* bulk bar */
.bulkbar {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 8px;
  background: #1a2233; border: 1px solid var(--accent); border-radius: 10px; font-size: 13px;
}
.bulkbar .grow { flex: 1; }
.chk { display: flex; align-items: center; gap: 6px; font-size: 13px; user-select: none; }
.chk input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; }
button.danger { background: #7f1d1d; color: #fecaca; }
button.danger:hover { background: #991b1b; }

/* file rows */
.files li.sel { background: #1a2233; }
.files li.sel .row:hover { background: #1a2233; }
.row .chk { padding-right: 4px; }
.row .ico { font-size: 18px; }
.row .folder { font-size: 18px; }
.row .meta { font-size: 12px; white-space: nowrap; }

/* breadcrumbs */
.crumbs { margin: 0 0 8px; }
.crumbs a { color: var(--accent); cursor: pointer; text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs .sep { opacity: .5; margin: 0 4px; }

.fallback { width: 100%; }
.fallback .btn { margin: 0 4px; }
