/* ==========================================================================
   File Portal — glass theme
   ========================================================================== */

:root {
  --bg: #070912;
  --text: #eef0ff;
  --muted: #9aa0bd;
  --faint: #6b7192;

  --glass: rgba(255, 255, 255, .055);
  --glass-strong: rgba(255, 255, 255, .085);
  --glass-hover: rgba(255, 255, 255, .09);
  --stroke: rgba(255, 255, 255, .11);
  --stroke-strong: rgba(255, 255, 255, .2);
  --input: rgba(5, 7, 18, .45);

  --violet: #8b5cf6;
  --cyan: #22d3ee;
  --pink: #ec4899;
  --accent: #a78bfa;
  --grad: linear-gradient(135deg, #8b5cf6 0%, #6366f1 45%, #06b6d4 100%);

  --ok: #34d399;
  --danger: #fb7185;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 40px -10px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .06);
  --blur: blur(22px) saturate(160%);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font: 15px/1.55 "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; transition: color .2s; }
a:hover { color: #c4b5fd; }
h1 { font-size: clamp(1.6rem, 2.5vw + 1rem, 2.2rem); line-height: 1.15; margin: 0; letter-spacing: -.02em; font-weight: 700; }
h2 { font-size: 1rem; margin: 0 0 1rem; font-weight: 600; display: flex; align-items: center; gap: .5rem; }
h2 .icon { color: var(--accent); }
h3 { margin: .25rem 0; font-size: 1.1rem; }
.muted { color: var(--muted); }
::selection { background: rgba(139, 92, 246, .45); }

.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }

/* ---------- Animated background ---------- */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(99, 102, 241, .18), transparent 60%),
    radial-gradient(900px 600px at 110% 110%, rgba(6, 182, 212, .14), transparent 60%),
    var(--bg);
}
.orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .55; will-change: transform; }
.orb-1 { width: 520px; height: 520px; background: #7c3aed; top: -140px; left: -120px; animation: drift1 26s ease-in-out infinite alternate; }
.orb-2 { width: 460px; height: 460px; background: #0891b2; bottom: -160px; right: -100px; animation: drift2 30s ease-in-out infinite alternate; }
.orb-3 { width: 340px; height: 340px; background: #db2777; top: 40%; left: 55%; opacity: .32; animation: drift3 34s ease-in-out infinite alternate; }
.grain { position: absolute; inset: 0; opacity: .06; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@keyframes drift1 { to { transform: translate(18vw, 22vh) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-20vw, -18vh) scale(1.1); } }
@keyframes drift3 { to { transform: translate(-30vw, -10vh) scale(.85); } }

/* ---------- Glass surfaces ---------- */
.glass {
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}
.glass-strong { background: var(--glass-strong); border-color: var(--stroke-strong); }
.card { padding: 1.4rem; margin-bottom: 1.25rem; animation: rise .5s var(--ease) both; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 12px; z-index: 10;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  width: calc(100% - 24px); max-width: 1100px; margin: 12px auto 0; padding: .6rem .75rem .6rem 1rem;
  border-radius: 999px;
}
@supports not (top: max(0px)) { .topbar { top: 0; } }
.brand { display: flex; align-items: center; gap: .6rem; color: var(--text); font-weight: 700; letter-spacing: -.01em; }
.brand:hover { color: var(--text); }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--grad); color: #fff; box-shadow: 0 4px 18px -4px rgba(139, 92, 246, .8); }
.brand-mark .icon { width: 18px; height: 18px; }
.nav { display: flex; align-items: center; gap: .5rem; }
.nav-link { display: flex; align-items: center; gap: .45rem; padding: .45rem .85rem; border-radius: 999px; color: var(--muted); font-weight: 500; transition: background .2s, color .2s; }
.nav-link:hover, .nav-link.active { color: var(--text); background: var(--glass-hover); }
.user-chip { display: flex; align-items: center; gap: .5rem; padding: .25rem .75rem .25rem .25rem; border-radius: 999px; background: rgba(255, 255, 255, .04); border: 1px solid var(--stroke); }
.user-name { font-size: .9rem; max-width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.avatar { display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; font-weight: 700; font-size: .8rem; color: #fff; background: var(--grad); }
.avatar.lg { width: 42px; height: 42px; font-size: 1rem; border-radius: 14px; }
.avatar.xl { width: 60px; height: 60px; font-size: 1.5rem; border-radius: 18px; box-shadow: 0 8px 30px -8px rgba(139, 92, 246, .7); }
.hue-0 { background: linear-gradient(135deg, #8b5cf6, #6366f1); }
.hue-1 { background: linear-gradient(135deg, #06b6d4, #3b82f6); }
.hue-2 { background: linear-gradient(135deg, #ec4899, #f43f5e); }
.hue-3 { background: linear-gradient(135deg, #10b981, #06b6d4); }
.hue-4 { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.hue-5 { background: linear-gradient(135deg, #a855f7, #ec4899); }

/* ---------- Layout ---------- */
.container { max-width: 1100px; margin: 0 auto; padding: 2.25rem 1rem 4rem; }
.container.wide { max-width: 1280px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.5rem; animation: rise .5s var(--ease) both; }
.head-user { display: flex; align-items: center; gap: 1rem; }
.eyebrow { margin: 0 0 .3rem; font-size: .75rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.section-title { margin-top: 2rem; font-size: 1.15rem; }
.back-link { display: inline-flex; align-items: center; gap: .4rem; margin-bottom: 1rem; color: var(--muted); font-size: .9rem; }
.back-link:hover { color: var(--text); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.25rem; }
.grid2 .card { margin: 0; }
.wave { display: inline-block; transform-origin: 70% 70%; animation: wave 2.4s ease-in-out 1s 2; }
@keyframes wave { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(14deg); } 20% { transform: rotate(-8deg); } 40% { transform: rotate(-4deg); } 50% { transform: rotate(10deg); } }

/* ---------- Forms ---------- */
.stack { display: flex; flex-direction: column; gap: 1rem; }
.row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.row .input-wrap { flex: 1 1 200px; }
.field { display: flex; flex-direction: column; gap: .4rem; }
.field-label { font-size: .8rem; font-weight: 500; color: var(--muted); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > .icon { position: absolute; left: .85rem; color: var(--faint); pointer-events: none; transition: color .2s; }
.input-wrap:focus-within > .icon { color: var(--accent); }
input:not([type=checkbox]):not([type=file]) {
  width: 100%; padding: .75rem .9rem; font: inherit; color: var(--text);
  background: var(--input); border: 1px solid var(--stroke); border-radius: var(--radius-sm);
  outline: none; transition: border-color .2s, box-shadow .2s, background .2s;
}
.input-wrap > .icon ~ input { padding-left: 2.6rem; }
.input-wrap:has(.reveal) input { padding-right: 2.8rem; }
input::placeholder { color: var(--faint); }
input:focus { border-color: rgba(167, 139, 250, .7); box-shadow: 0 0 0 4px rgba(139, 92, 246, .18); background: rgba(5, 7, 18, .6); }
input:-webkit-autofill { -webkit-text-fill-color: var(--text); -webkit-box-shadow: 0 0 0 100px #12142a inset; caret-color: var(--text); }
.reveal { position: absolute; right: .4rem; display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 9px; background: transparent; color: var(--faint); cursor: pointer; }
.reveal:hover, .reveal.on { color: var(--text); background: var(--glass-hover); }

.toggle { display: inline-flex; align-items: center; gap: .55rem; color: var(--muted); cursor: pointer; user-select: none; font-size: .9rem; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle .track { position: relative; width: 40px; height: 22px; border-radius: 99px; background: rgba(255, 255, 255, .1); border: 1px solid var(--stroke); transition: background .25s; }
.toggle .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .25s var(--ease); box-shadow: 0 1px 4px rgba(0, 0, 0, .4); }
.toggle input:checked + .track { background: var(--grad); border-color: transparent; }
.toggle input:checked + .track::after { transform: translateX(18px); }
.toggle input:focus-visible + .track { box-shadow: 0 0 0 4px rgba(139, 92, 246, .3); }
.toggle:has(input:checked) { color: var(--text); }

/* ---------- Buttons ---------- */
.btn, button.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .7rem 1.1rem; font: inherit; font-weight: 600; font-size: .9rem; line-height: 1.2;
  color: var(--text); background: var(--glass-strong); border: 1px solid var(--stroke);
  border-radius: var(--radius-sm); cursor: pointer; white-space: nowrap;
  transition: transform .15s var(--ease), background .2s, border-color .2s, box-shadow .25s, opacity .2s;
}
.btn:hover { color: var(--text); background: rgba(255, 255, 255, .12); border-color: var(--stroke-strong); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:focus-visible, .icon-btn:focus-visible { outline: none; box-shadow: 0 0 0 4px rgba(139, 92, 246, .35); }
.btn.primary { color: #fff; border: 0; background: var(--grad); background-size: 160% 160%; background-position: 0 50%;
  box-shadow: 0 8px 24px -8px rgba(124, 58, 237, .8), inset 0 1px 0 rgba(255, 255, 255, .25); }
.btn.primary:hover { background-position: 100% 50%; box-shadow: 0 12px 32px -8px rgba(99, 102, 241, .9), inset 0 1px 0 rgba(255, 255, 255, .25); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--glass-hover); border-color: var(--stroke); color: var(--text); }
.btn.danger { background: rgba(251, 113, 133, .08); border-color: rgba(251, 113, 133, .2); color: var(--danger); }
.btn.danger:hover { background: rgba(251, 113, 133, .18); border-color: rgba(251, 113, 133, .45); color: #fecdd3; }
.btn.sm { padding: .45rem .75rem; font-size: .82rem; border-radius: 10px; }
.btn.lg { padding: .9rem 1.2rem; font-size: 1rem; }
.btn.full { width: 100%; }
.btn.icon-only { padding: .45rem; }
.btn.lg .icon { transition: transform .25s var(--ease); }
.btn.lg:hover .icon { transform: translateX(3px); }
.btn.busy { pointer-events: none; opacity: .75; }
.btn.busy::after { content: ""; width: 14px; height: 14px; margin-left: .3rem; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--stroke); background: rgba(255, 255, 255, .04); color: var(--muted); cursor: pointer; transition: background .2s, color .2s, transform .2s; }
.icon-btn:hover { color: var(--text); background: var(--glass-hover); transform: translateY(-1px); }
form.inline { display: inline-flex; margin: 0; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem; }
.login-card { position: relative; width: 100%; max-width: 410px; padding: 2.5rem 2rem 1.75rem; border-radius: 26px; text-align: center; animation: rise .7s var(--ease) both; }
.login-card::before { /* soft gradient rim */
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(140deg, rgba(167, 139, 250, .7), rgba(255, 255, 255, .05) 35%, rgba(255, 255, 255, .02) 65%, rgba(34, 211, 238, .6));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.login-card h1 { font-size: 1.75rem; margin-top: 1.1rem; }
.login-card > .muted { margin: .4rem 0 1.75rem; }
.login-card form { text-align: left; }
.login-card .btn { margin-top: .5rem; }
.login-logo { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; background: var(--grad); color: #fff;
  box-shadow: 0 14px 40px -10px rgba(139, 92, 246, .9), inset 0 1px 0 rgba(255, 255, 255, .35); animation: float 6s ease-in-out infinite; }
.login-logo .icon { width: 30px; height: 30px; }
.login-foot { display: flex; align-items: center; justify-content: center; gap: .4rem; margin: 1.5rem 0 0; font-size: .8rem; color: var(--faint); }
@keyframes float { 50% { transform: translateY(-6px); } }

.error-card { padding-top: 2rem; }
.error-code { font-size: 5rem; font-weight: 800; line-height: 1; letter-spacing: -.04em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.error-card p { color: var(--muted); margin: .75rem 0 1.5rem; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; top: 84px; right: 16px; z-index: 50; display: flex; flex-direction: column; gap: .6rem; max-width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; }
.login-wrap .toasts { top: 16px; }
.toast { display: flex; align-items: flex-start; gap: .6rem; padding: .85rem 1rem; border-radius: 14px; font-size: .9rem; background: rgba(20, 22, 40, .7); animation: toast-in .45s var(--ease) both; }
.toast .icon { margin-top: .1rem; }
.toast.success { border-color: rgba(52, 211, 153, .35); } .toast.success .icon { color: var(--ok); }
.toast.error { border-color: rgba(251, 113, 133, .4); } .toast.error .icon { color: var(--danger); }
.toast.leaving { animation: toast-out .4s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat { display: flex; align-items: center; gap: .9rem; padding: 1.1rem 1.2rem; animation: rise .5s var(--ease) both; transition: transform .25s var(--ease), border-color .25s; }
.stat:nth-child(2) { animation-delay: .05s; } .stat:nth-child(3) { animation-delay: .1s; } .stat:nth-child(4) { animation-delay: .15s; }
.stat:hover { transform: translateY(-3px); border-color: var(--stroke-strong); }
.stat-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; color: #fff; background: var(--grad); box-shadow: 0 8px 22px -8px rgba(139, 92, 246, .8); }
.stat:nth-child(2) .stat-icon { background: linear-gradient(135deg, #ec4899, #8b5cf6); }
.stat:nth-child(3) .stat-icon { background: linear-gradient(135deg, #06b6d4, #3b82f6); }
.stat:nth-child(4) .stat-icon { background: linear-gradient(135deg, #10b981, #06b6d4); }
.stat b { display: block; font-size: 1.35rem; line-height: 1.2; letter-spacing: -.01em; }
.stat span:not(.stat-icon) { font-size: .8rem; color: var(--muted); }

/* ---------- Lists (files & users) ---------- */
.list-tools { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 0 0 .85rem; }
.count-pill { font-size: .8rem; font-weight: 600; color: var(--muted); padding: .3rem .75rem; border-radius: 99px; background: rgba(255, 255, 255, .05); border: 1px solid var(--stroke); }
.search { display: flex; align-items: center; gap: .5rem; padding: 0 .9rem; border-radius: 999px; width: min(320px, 100%); box-shadow: none; }
.search .icon { color: var(--faint); }
.search:focus-within { border-color: rgba(167, 139, 250, .6); box-shadow: 0 0 0 4px rgba(139, 92, 246, .15); }
.search:focus-within .icon { color: var(--accent); }
.search input[type=search] { padding: .6rem 0; border: 0; background: transparent !important; box-shadow: none !important; border-radius: 0; }
.search input::-webkit-search-cancel-button { filter: invert(1) opacity(.5); }

.file-list { padding: .4rem; overflow: hidden; }
.file-row { display: flex; align-items: center; gap: 1rem; padding: .75rem .85rem; border-radius: 13px; transition: background .2s;
  animation: rise .45s var(--ease) both; animation-delay: calc(min(var(--i, 0), 12) * 35ms); }
.file-row + .file-row { margin-top: 2px; }
.file-row:hover { background: rgba(255, 255, 255, .055); }
.file-row[hidden] { display: none; }
.ficon { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 12px; color: var(--c, #a5b4fc);
  background: color-mix(in srgb, var(--c, #a5b4fc) 14%, transparent); border: 1px solid color-mix(in srgb, var(--c, #a5b4fc) 28%, transparent); }
.ficon .icon { width: 20px; height: 20px; }
.k-pdf { --c: #f87171; } .k-docx { --c: #60a5fa; } .k-pptx { --c: #fb923c; } .k-sheet { --c: #34d399; }
.k-image { --c: #f472b6; } .k-video { --c: #c084fc; } .k-audio { --c: #22d3ee; } .k-text { --c: #cbd5e1; } .k-other { --c: #94a3b8; }
.fmeta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fname { display: flex; align-items: center; gap: .5rem; color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.fname:hover { color: #fff; }
a.fname:hover { text-decoration: underline; text-decoration-color: rgba(167, 139, 250, .6); text-underline-offset: 3px; }
.fsub { font-size: .8rem; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.factions { display: flex; align-items: center; gap: .25rem; flex: none; }
.no-match { margin: 0; padding: 1.5rem; text-align: center; color: var(--muted); }
.badge { font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: .15rem .5rem; border-radius: 99px; color: #fff; background: var(--grad); }
.badge.subtle { background: rgba(255, 255, 255, .1); color: var(--muted); }

.empty { padding: 3rem 1.5rem; text-align: center; animation: rise .5s var(--ease) both; }
.empty-icon { display: inline-grid; place-items: center; width: 64px; height: 64px; margin-bottom: .75rem; border-radius: 20px; color: var(--accent);
  background: rgba(139, 92, 246, .12); border: 1px solid rgba(139, 92, 246, .3); }
.empty-icon .icon { width: 28px; height: 28px; }
.empty p { margin: .25rem 0 0; }
.empty.error { border-color: rgba(251, 113, 133, .4); color: var(--danger); }

/* ---------- Dropzone ---------- */
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: 1.6rem 1rem; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--stroke-strong); border-radius: 16px; background: rgba(255, 255, 255, .025); transition: border-color .2s, background .2s, transform .2s; }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: rgba(139, 92, 246, .1); }
.dropzone.drag { transform: scale(1.015); }
.dropzone.has-files { border-style: solid; border-color: rgba(52, 211, 153, .5); background: rgba(52, 211, 153, .06); }
.dz-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--grad); color: #fff; margin-bottom: .3rem; transition: transform .3s var(--ease); }
.dropzone:hover .dz-icon, .dropzone.drag .dz-icon { transform: translateY(-3px); }
.dz-title { font-weight: 600; }
.dz-title u { text-decoration-color: var(--accent); text-underline-offset: 3px; }
.dz-files { font-size: .8rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Viewer ---------- */
.viewer-bar { display: flex; align-items: center; gap: .85rem; padding: .6rem .75rem; margin-bottom: 1rem; border-radius: 16px; animation: rise .4s var(--ease) both; }
.viewer-bar .ficon { width: 36px; height: 36px; border-radius: 10px; }
.viewer-title { flex: 1; min-width: 0; font-size: 1.05rem; font-weight: 600; letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-frame { display: block; width: 100%; height: calc(100vh - 200px); min-height: 420px; border: 1px solid var(--stroke); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); animation: rise .5s var(--ease) both; }
.viewer-media { padding: 1rem; text-align: center; animation: rise .5s var(--ease) both; }
.viewer-media img, .viewer-media video { max-width: 100%; max-height: calc(100vh - 220px); border-radius: 10px; }
.viewer-media audio { width: 100%; }
#doc-status { display: flex; align-items: center; justify-content: center; gap: .75rem; padding: 2rem; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, .15); border-top-color: var(--accent); animation: spin .8s linear infinite; }

.doc-viewer { border-radius: var(--radius); overflow: auto; max-height: calc(100vh - 170px); border: 1px solid var(--stroke); box-shadow: var(--shadow); }
.doc-viewer:empty { display: none; }
.doc-docx { background: rgba(10, 12, 26, .55); }
.doc-docx .docx-wrapper { background: transparent !important; padding: 1.5rem !important; }
.doc-docx .docx-wrapper > section.docx { box-shadow: 0 10px 40px -10px rgba(0, 0, 0, .6) !important; margin-bottom: 1.5rem !important; border-radius: 4px; }
.doc-pptx { padding: 1.25rem; background: rgba(10, 12, 26, .55); display: flex; justify-content: center; }
.doc-pptx .pptx-preview-wrapper { height: auto !important; overflow: visible !important; background: transparent !important; }
.doc-pptx .pptx-preview-slide-wrapper { margin: 0 auto 1.25rem; border-radius: 8px; overflow: hidden; box-shadow: 0 10px 40px -10px rgba(0, 0, 0, .7); }
.doc-sheet { background: rgba(10, 12, 26, .65); color: var(--text); }
.sheet-tabs { position: sticky; top: 0; display: flex; gap: .3rem; padding: .5rem; overflow-x: auto; border-bottom: 1px solid var(--stroke); background: rgba(16, 18, 36, .92); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.sheet-tabs button { padding: .4rem .85rem; font: inherit; font-size: .85rem; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 9px; cursor: pointer; }
.sheet-tabs button:hover { color: var(--text); background: var(--glass-hover); }
.sheet-tabs button.active { color: #fff; background: var(--grad); }
.sheet-body { padding: .5rem; }
.sheet-body table { border-collapse: collapse; font-size: .85rem; }
.sheet-body td { padding: .35rem .65rem; border: 1px solid rgba(255, 255, 255, .08); white-space: nowrap; }
.sheet-body tr:first-child td { font-weight: 600; background: rgba(139, 92, 246, .12); }
.sheet-body tr:hover td { background: rgba(255, 255, 255, .04); }

/* ---------- Motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}

/* Fallback when the browser can't blur behind elements. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: rgba(22, 24, 44, .92); }
}

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  .topbar { top: 8px; width: calc(100% - 16px); margin: 8px auto 0; padding: .45rem .5rem .45rem .7rem; }
  .brand > span:last-child, .user-name, .nav-link span { display: none; }
  .nav-link { padding: .5rem; }
  .user-chip { padding: .2rem; }
  .container { padding: 1.5rem 1rem 3rem; }
  .list-tools { flex-direction: column-reverse; align-items: stretch; }
  .count-pill { align-self: flex-start; }
  .search { width: 100%; }
  .file-row { gap: .75rem; padding: .7rem .6rem; }
  .factions .btn span { display: none; }
  .factions .btn { padding: .5rem; }
  .ficon { width: 38px; height: 38px; }
  .login-card { padding: 2rem 1.35rem 1.5rem; }
  .viewer-bar .ficon { display: none; }
  .viewer-bar .btn span { display: none; }
  .toasts, .login-wrap .toasts { top: auto; bottom: 16px; right: 16px; left: 16px; max-width: none; }
}

/* ---------- Custom images (static/custom/) ---------- */
.bg-image { position: absolute; inset: 0; background-size: cover; background-position: center; }
.bg.has-image::after { /* darken the photo so glass panels and text stay readable */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(7, 9, 18, .35), rgba(7, 9, 18, .6));
}
.bg.has-image .orb { opacity: .22; }
.bg.has-image .grain { z-index: 1; }
.custom-logo { background: none !important; box-shadow: none !important; overflow: hidden; }
.custom-logo img { width: 100%; height: 100%; object-fit: contain; }
