/* ---------- Tokens ---------- */
:root {
  --bg: #0f0c1b;
  --ink: #f3f2f8;
  --ink-2: rgba(243, 242, 248, 0.72);
  --ink-3: rgba(243, 242, 248, 0.46);
  --line: rgba(255, 255, 255, 0.1);
  --line-hi: rgba(255, 255, 255, 0.22);
  --fill: rgba(255, 255, 255, 0.05);
  --fill-hi: rgba(255, 255, 255, 0.1);
  --purple: #a855f7;
  --gold: #f5c451;
  --rose: #f43f5e;
  --link: #8ab4f8;
  --focus: #93c5fd;
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  overflow: hidden;
  position: relative;
  color-scheme: dark;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
svg { flex-shrink: 0; }
[data-icon] { display: inline-flex; align-items: center; justify-content: center; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- Loading screen ---------- */
.splash {
  position: fixed; inset: 0; z-index: 200;
  background: #202124;
  display: grid; place-items: center;
  transition: opacity 0.45s ease;
}
.splash.hide { opacity: 0; pointer-events: none; }
.splash-center { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.splash-logo {
  width: 76px; height: 76px; border-radius: 22px;
  box-shadow: 0 0 60px rgba(60, 110, 255, 0.28), 0 14px 30px rgba(0, 0, 0, 0.5);
}
.splash-name { font-size: 28px; font-weight: 400; letter-spacing: 0.01em; color: #f1f3f4; text-align: center; padding: 0 20px; }
.splash-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.splash-bar i {
  display: block; height: 100%; width: 34%;
  background: linear-gradient(90deg, transparent, #5b8cff 30%, #8ab4f8 70%, transparent);
  animation: splash-slide 1.25s ease-in-out infinite;
}
@keyframes splash-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(300%); }
}

/* ---------- Ambient glow ---------- */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  z-index: 0;
  opacity: 0.55;
  pointer-events: none;
}
.orb-1 { width: 520px; height: 520px; background: linear-gradient(135deg, #a855f7, #6366f1); top: -130px; left: -130px; }
.orb-2 { width: 580px; height: 580px; background: linear-gradient(135deg, #ec4899, #3b82f6); bottom: -180px; right: -120px; }
.orb-3 { width: 420px; height: 420px; background: linear-gradient(135deg, #06b6d4, #8b5cf6); top: 32%; left: 46%; opacity: 0.4; }

/* ---------- Buttons ---------- */
.icon-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink);
  transition: background 0.2s;
}
.icon-btn:hover { background: var(--fill-hi); }

.btn-primary {
  background: linear-gradient(135deg, #a855f7, #6366f1);
  color: #fff;
  font-weight: 600;
  padding: 11px 22px;
  border-radius: 999px;
  box-shadow: 0 12px 26px -10px rgba(99, 102, 241, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: transform 0.2s, filter 0.2s;
}
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: default; transform: none; }
.btn-primary.danger { background: linear-gradient(135deg, #f43f5e, #ec4899); box-shadow: 0 12px 26px -10px rgba(244, 63, 94, 0.6), inset 0 1px 0 rgba(255,255,255,.3); }

.btn-glass {
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid var(--line-hi);
  color: var(--ink);
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 999px;
  transition: background 0.2s;
}
.btn-glass:hover { background: rgba(255, 255, 255, 0.18); }
.btn-glass.small { padding: 7px 16px; font-size: 13px; }

/* ---------- Sign in (on top of the dimmed Drive) ---------- */
.auth {
  position: fixed; inset: 0; z-index: 150;
  display: grid; place-items: center;
  padding: 20px; overflow-y: auto;
  background: rgba(8, 7, 16, 0.6);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.auth-card {
  width: 100%; max-width: 420px;
  border-radius: 22px;
  background: rgba(46, 45, 62, 0.74);
  backdrop-filter: blur(28px) saturate(140%); -webkit-backdrop-filter: blur(28px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 40px 80px -24px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.auth-head { padding: 18px 20px; font-size: 17px; font-weight: 700; border-bottom: 1px solid rgba(255, 255, 255, 0.12); }
.auth-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.field > input, .input-group {
  width: 100%;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line-hi);
  border-radius: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field > input { padding: 12px 14px; color: var(--ink); }
.input-group { display: flex; overflow: hidden; }
.input-group input { flex: 1; min-width: 0; padding: 12px 14px; background: transparent; border: none; outline: none; color: var(--ink); }
.suffix { display: grid; place-items: center; padding: 0 14px; background: rgba(255, 255, 255, 0.08); color: var(--ink-2); font-size: 13px; white-space: nowrap; }
.field > input:focus, .input-group:focus-within {
  border-color: rgba(138, 180, 248, 0.8);
  box-shadow: 0 0 0 3px rgba(138, 180, 248, 0.2);
}
/* keep browser-filled fields dark */
input:-webkit-autofill, input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink);
  caret-color: var(--ink);
  box-shadow: 0 0 0 100px #34334a inset;
  transition: background-color 9999s;
}

/* show / hide password button */
.pw-toggle { display: grid; place-items: center; width: 46px; color: var(--ink-2); transition: color .2s, background .2s; }
.pw-toggle:hover { color: var(--ink); background: rgba(255, 255, 255, 0.08); }
.pw-toggle .eye-off { display: none; }
.pw-toggle.on .eye { display: none; }
.pw-toggle.on .eye-off { display: block; }

.form-error { color: #fda4af; font-size: 13px; }
.form-error:empty { display: none; }
.notice {
  background: rgba(245, 196, 81, 0.12);
  border: 1px solid rgba(245, 196, 81, 0.35);
  color: #fde7a8;
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 13px;
}
.notice code { background: rgba(255,255,255,.1); padding: 1px 6px; border-radius: 6px; }

.btn-signin, .btn-google {
  width: 100%; padding: 13px 16px;
  border-radius: 14px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  transition: background 0.2s;
}
.btn-signin { background: rgba(255, 255, 255, 0.24); }
.btn-signin:hover { background: rgba(255, 255, 255, 0.34); }
.btn-google { background: rgba(255, 255, 255, 0.07); margin-top: -4px; }
.btn-google:hover { background: rgba(255, 255, 255, 0.15); }
.btn-signin:disabled, .btn-google:disabled { opacity: 0.55; cursor: default; }
.auth-foot { text-align: center; color: var(--ink-2); margin-top: 2px; }
.auth-foot a { color: var(--link); font-weight: 700; text-decoration: none; }
.auth-foot a:hover { text-decoration: underline; }

/* ---------- App shell ---------- */
.app {
  position: relative; z-index: 10;
  display: flex;
  height: 100vh; height: 100dvh;
  width: 100vw;
}
.app.locked { pointer-events: none; user-select: none; }

.sidebar {
  width: 276px; flex-shrink: 0;
  display: flex; flex-direction: column;
  padding: 18px 14px 16px;
  gap: 14px;
  z-index: 30;
  transition: width 0.25s ease;
}
.sidebar-header { display: flex; align-items: center; gap: 12px; padding: 0 6px; height: 44px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo { width: 34px; height: 34px; border-radius: 10px; display: block; }
.brand-text { font-size: 21px; font-weight: 500; letter-spacing: 0.005em; }

.new-btn {
  display: inline-flex; align-items: center; gap: 12px;
  width: max-content; height: 52px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.26);
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255,255,255,.22);
  padding: 0 28px 0 20px;
  border-radius: 28px;
  font-weight: 600; font-size: 15px;
  margin: 4px 0 6px 6px;
  transition: background 0.2s, transform 0.2s;
}
.new-btn:hover { background: rgba(255, 255, 255, 0.22); transform: translateY(-1px); }

.nav-list { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; flex: 1; min-height: 0; }
.nav-item {
  display: flex; align-items: center; gap: 16px;
  width: 100%; text-align: left;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--ink-2);
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}
.nav-item:hover { background: var(--fill-hi); color: var(--ink); }
.nav-item.active {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.24);
  color: var(--ink);
  font-weight: 700;
}
.nav-item.drop-over { background: rgba(168, 85, 247, 0.28); border-color: var(--purple); }
.nav-icon { display: inline-flex; color: inherit; }
.more-toggle { font-size: 13.5px; padding-top: 8px; padding-bottom: 8px; }

.expandable-group {
  max-height: 0; opacity: 0; overflow: hidden;
  display: flex; flex-direction: column; gap: 3px;
  transition: max-height 0.35s ease-in-out, opacity 0.25s ease-in-out;
}
.expandable-group.open { max-height: 320px; opacity: 1; }
.arrow-icon { transition: transform 0.3s ease; }
.arrow-icon.rotated { transform: rotate(180deg); }

.storage {
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--fill);
  border: 1px solid var(--line);
}
.storage-text { font-size: 13px; color: var(--ink-2); margin-bottom: 10px; }
.storage-bar { height: 6px; border-radius: 999px; background: rgba(255,255,255,.1); overflow: hidden; }
.storage-fill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #a855f7, #06b6d4); transition: width 0.5s ease; }
.storage-fill.warn { background: linear-gradient(90deg, #f59e0b, #f43f5e); }

/* smaller sidebar on computers */
@media (min-width: 861px) {
  .app.collapsed .sidebar { width: 88px; padding-left: 12px; padding-right: 12px; }
  .app.collapsed .brand, .app.collapsed .label, .app.collapsed .storage { display: none; }
  .app.collapsed .new-btn { width: 54px; height: 54px; padding: 0; justify-content: center; border-radius: 18px; margin-left: 5px; }
  .app.collapsed .nav-item { justify-content: center; padding: 12px 0; }
  .app.collapsed .sidebar-header { justify-content: center; padding: 0; }
}

/* ---------- Main card ---------- */
.main-view { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 16px 16px 16px 0; }
.content-card {
  flex: 1; min-height: 0;
  border-radius: 32px;
  display: flex; flex-direction: column;
  overflow: hidden;
  background: rgba(22, 20, 38, 0.84);
  backdrop-filter: blur(30px) saturate(140%); -webkit-backdrop-filter: blur(30px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 30px 60px -28px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.main-header {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
}
.search-box {
  flex: 1; max-width: 650px; height: 44px;
  display: flex; align-items: center; gap: 12px;
  padding: 0 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  color: var(--ink-3);
  transition: border-color 0.2s, background 0.2s;
}
.search-box:focus-within { border-color: var(--line-hi); background: rgba(255, 255, 255, 0.11); color: var(--ink); }
.search-box input { flex: 1; min-width: 0; background: transparent; border: none; outline: none; color: var(--ink); font-size: 14px; }
.search-box input::placeholder { color: var(--ink-3); }
.main-header .avatar-btn { margin-left: auto; }

.avatar-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid var(--line-hi);
  font-weight: 700; color: #fff;
  transition: background 0.2s;
}
.avatar-btn:hover { background: rgba(255, 255, 255, 0.26); }

.toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 8px 22px;
  min-height: 54px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--line);
}
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; min-width: 0; font-size: 15px; }
.crumb { color: var(--ink-2); padding: 5px 10px; border-radius: 999px; font-weight: 500; transition: color .2s, background .2s; }
.crumb:hover { color: var(--ink); background: var(--fill-hi); }
.crumb.drop-over { background: rgba(168,85,247,.3); color: #fff; }
.crumb-current { padding: 5px 10px; font-weight: 700; overflow-wrap: anywhere; }
.crumb-sep { display: inline-flex; color: var(--ink-3); }

.tools { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.count { color: var(--ink-2); font-size: 13px; margin-right: 4px; white-space: nowrap; }
.select {
  appearance: none; -webkit-appearance: none;
  background: rgba(255,255,255,.08) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='%23ffffffb0'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 10px center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 32px 7px 16px;
  font-size: 13px; font-weight: 600;
  color: var(--ink);
}
.select option { background: #1a1530; color: #fff; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: rgba(255,255,255,.08); border: 1px solid var(--line); }
.seg button { width: 34px; height: 28px; border-radius: 999px; color: var(--ink-3); display: inline-flex; align-items: center; justify-content: center; transition: background .2s, color .2s; }
.seg button.on { background: rgba(255,255,255,.2); color: var(--ink); }

.mobile-only { display: none !important; }

/* ---------- Content ---------- */
.content { flex: 1; min-height: 0; overflow-y: auto; }
.content::-webkit-scrollbar { width: 8px; }
.content::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 10px; }

.trash-note { color: var(--ink-3); font-size: 13px; padding: 14px 22px 0; }

/* list rows, like the Mail list */
.row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 90px 88px 44px;
  align-items: center; gap: 8px;
  padding: 8px 14px 8px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  cursor: pointer;
  transition: background .15s;
}
.row:hover { background: rgba(255, 255, 255, 0.05); }
.row .lead { display: flex; align-items: center; gap: 12px; min-width: 0; }
.row .lead .name { flex: 0 1 auto; max-width: 60%; font-size: 14px; }
.row .where { flex: 1 1 0; min-width: 0; color: var(--ink-3); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .col { color: var(--ink-2); font-size: 13px; white-space: nowrap; }
.row .col.size { text-align: right; color: var(--ink-3); }
.row .col.date { text-align: right; }
.tile {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center; flex-shrink: 0;
  background: rgba(255,255,255,.06);
  background: color-mix(in srgb, var(--tint) 18%, transparent);
  color: var(--tint);
}

/* stars */
.star-btn {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: rgba(255, 255, 255, 0.3);
  transition: color .15s, background .15s;
}
button.star-btn:hover { color: rgba(255, 255, 255, 0.75); background: rgba(255,255,255,.1); }
.star-btn.on, button.star-btn.on:hover { color: var(--gold); }
.star-mark { color: var(--gold); display: inline-flex; }

.more {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-2);
  flex-shrink: 0;
}
.more:hover { background: rgba(255,255,255,.16); color: #fff; }

.name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub { color: var(--ink-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* grid */
.folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 20px 22px 4px; }
.folders:empty { display: none; }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin: 16px 22px 24px; }
.files:empty { display: none; }

.chip, .card {
  position: relative;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line);
  border-radius: 18px;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.chip:hover, .card:hover { background: rgba(255,255,255,.1); border-color: var(--line-hi); }
.chip { display: flex; align-items: center; gap: 12px; padding: 12px 8px 12px 14px; }
.chip .name { flex: 1; min-width: 0; }

.card { padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.thumb {
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  display: grid; place-items: center;
  overflow: hidden;
  background: rgba(255,255,255,.06);
  background: color-mix(in srgb, var(--tint) 16%, transparent);
  color: var(--tint);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-body { display: flex; align-items: flex-start; gap: 4px; padding: 0 2px 2px 4px; }
.card-text { flex: 1; min-width: 0; }
.card .star-btn {
  position: absolute; top: 16px; left: 16px;
  width: 30px; height: 30px;
  background: rgba(15, 12, 27, 0.6);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0;
}
.card:hover .star-btn, .card:focus-within .star-btn, .card .star-btn.on { opacity: 1; }
.card span.star-btn { display: none; }

.drop-over { outline: 2px dashed var(--purple); outline-offset: -2px; background: rgba(168,85,247,.18) !important; }
.dragging { opacity: .45; }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 80px 20px; color: var(--ink-2); }
.empty .big { color: rgba(255,255,255,.22); }
.empty h2 { font-size: 21px; font-weight: 600; color: var(--ink); }
.empty p { max-width: 380px; }
.empty .btn-glass { margin-top: 8px; }

/* ---------- Popover menu ---------- */
.popover {
  position: fixed; z-index: 180;
  min-width: 220px;
  padding: 6px;
  border-radius: 18px;
  background: rgba(30, 27, 48, 0.9);
  backdrop-filter: blur(30px) saturate(150%); -webkit-backdrop-filter: blur(30px) saturate(150%);
  border: 1px solid var(--line-hi);
  box-shadow: 0 24px 50px -16px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,255,255,.14);
}
.popover .item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  padding: 9px 12px; border-radius: 12px;
  color: var(--ink);
}
.popover .item:hover, .popover .item:focus-visible { background: rgba(255,255,255,.12); }
.popover .item.danger { color: #fda4af; }
.popover .item svg { color: var(--ink-2); }
.popover .item.danger svg { color: #fda4af; }
.popover .sep { height: 1px; background: var(--line); margin: 5px 6px; }
.popover .who { padding: 10px 12px 8px; color: var(--ink-2); font-size: 13px; overflow-wrap: anywhere; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 170;
  background: rgba(8, 6, 16, 0.55);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 20px;
}
.modal {
  width: 100%; max-width: 440px;
  max-height: 86vh; display: flex; flex-direction: column; gap: 16px;
  padding: 24px;
  border-radius: 24px;
  background: rgba(38, 36, 56, 0.86);
  backdrop-filter: blur(34px) saturate(150%); -webkit-backdrop-filter: blur(34px) saturate(150%);
  border: 1px solid var(--line-hi);
  box-shadow: 0 40px 80px -24px rgba(0,0,0,.8), inset 0 1px 0 rgba(255,255,255,.14);
}
.modal h2 { font-size: 19px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.modal p { color: var(--ink-2); overflow-wrap: anywhere; }
.modal input[type='text'] {
  width: 100%;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line-hi);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--ink);
  outline: none;
}
.modal input[type='text']:focus { border-color: rgba(138, 180, 248, 0.8); box-shadow: 0 0 0 3px rgba(138, 180, 248, 0.2); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.modal .picker { overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding: 4px; margin: 0 -4px; min-height: 120px; }
.picker button {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 9px 12px; border-radius: 12px; border: 1px solid transparent;
}
.picker button:hover { background: rgba(255,255,255,.1); }
.picker button.on { background: rgba(168,85,247,.24); border-color: rgba(168,85,247,.6); }
.picker svg { color: var(--purple); }

/* ---------- Preview ---------- */
.preview {
  position: fixed; inset: 0; z-index: 165;
  background: rgba(9, 7, 18, 0.9);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  display: flex; flex-direction: column;
}
.preview-bar { display: flex; align-items: center; gap: 12px; padding: 14px 20px; }
.preview-bar .name { flex: 1; font-size: 15px; }
.preview-body { flex: 1; min-height: 0; display: grid; place-items: center; padding: 0 20px 24px; }
.preview-body img, .preview-body video { max-width: 100%; max-height: 100%; border-radius: 14px; object-fit: contain; }
.preview-body audio { width: min(520px, 100%); }
.preview-body iframe { width: min(1000px, 100%); height: 100%; border: none; border-radius: 14px; background: #fff; }
.preview-body pre {
  width: min(900px, 100%); max-height: 100%; overflow: auto;
  padding: 20px; border-radius: 18px;
  background: rgba(255,255,255,.06); border: 1px solid var(--line);
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.preview-msg { display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--ink-2); text-align: center; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid rgba(255,255,255,.2); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Uploads, toasts, drop zone ---------- */
.tray {
  position: fixed; right: 20px; bottom: 20px; z-index: 140;
  width: 350px; max-width: calc(100vw - 32px);
  border-radius: 22px; overflow: hidden;
  background: rgba(30, 27, 48, 0.86);
  backdrop-filter: blur(28px) saturate(140%); -webkit-backdrop-filter: blur(28px) saturate(140%);
  border: 1px solid var(--line-hi);
  box-shadow: 0 30px 60px -28px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.tray-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 12px 18px; font-weight: 700; border-bottom: 1px solid var(--line); min-height: 52px; }
.tray-list { max-height: 260px; overflow-y: auto; padding: 6px 0; }
.job { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 8px 14px 8px 18px; }
.job .name { font-size: 13px; font-weight: 500; }
.job .state { color: var(--ink-3); font-size: 12px; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.job .bar { grid-column: 1 / -1; height: 4px; border-radius: 999px; background: rgba(255,255,255,.12); overflow: hidden; }
.job .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #a855f7, #06b6d4); border-radius: 999px; transition: width .15s linear; }
.job.done .bar i { width: 100% !important; background: #10b981; }
.job.error .bar i { width: 100% !important; background: var(--rose); }
.job .err { grid-column: 1 / -1; color: #fda4af; font-size: 12px; }
.job .cancel { color: var(--ink-3); display: inline-flex; padding: 2px; border-radius: 50%; }
.job .cancel:hover { color: #fff; background: rgba(255,255,255,.14); }

.toasts { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 190; display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 20px; border-radius: 999px;
  background: rgba(30, 27, 48, 0.92);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--line-hi);
  box-shadow: 0 18px 40px -14px rgba(0,0,0,.7);
}
.toast.error { border-color: rgba(244,63,94,.6); }
.toast.error > svg { color: #fda4af; }
.toast button { color: var(--link); font-weight: 700; }

.dropzone {
  position: fixed; inset: 14px; z-index: 160;
  border: 2px dashed rgba(168,85,247,.85);
  border-radius: 32px;
  background: rgba(15,12,27,.72);
  backdrop-filter: blur(6px);
  display: grid; place-items: center;
  pointer-events: none;
}
.dropzone div { font-size: 26px; font-weight: 600; }

.scrim { display: none; }

/* ---------- Phones and small windows ---------- */
@media (max-width: 860px) {
  .mobile-only { display: inline-flex !important; }
  .app { display: block; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(310px, 86vw);
    background: rgba(24, 19, 42, 0.95);
    backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
    border-right: 1px solid var(--line);
    transform: translateX(-102%);
    transition: transform .3s ease;
  }
  .app.sidebar-open .sidebar { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 25; background: rgba(8,6,16,.55); opacity: 0; pointer-events: none; transition: opacity .3s; display: block; }
  .app.sidebar-open .scrim { opacity: 1; pointer-events: auto; }
  .main-view { height: 100%; padding: 10px; }
  .content-card { border-radius: 24px; }
  .main-header { padding: 12px 14px; gap: 10px; }
  .toolbar { padding: 8px 14px; flex-wrap: wrap; }
  .count { display: none; }
  .row { grid-template-columns: 36px minmax(0, 1fr) 76px 40px; padding: 8px 8px 8px 10px; }
  .row .col.size { display: none; }
  .row .where { display: none; }
  .folders { grid-template-columns: 1fr 1fr; margin: 14px 14px 4px; }
  .files { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 12px 14px 20px; }
  .tray { right: 10px; left: 10px; bottom: 10px; width: auto; max-width: none; }
  .toasts { bottom: auto; top: 14px; }
  .select { max-width: 150px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .splash-bar i { width: 100%; opacity: 0.5; }
}