:root {
  --ink: #0d1b34;
  --ink-2: #243654;
  --muted: #7b8bab;
  --muted-2: #9fb0cb;
  --primary: #2e7cf6;
  --primary-2: #63a6ff;
  --primary-soft: #eaf3ff;
  --green: #1fb573;
  --red: #f0444d;
  --orange: #ff9f43;
  --shadow: 0 20px 50px rgba(40, 100, 200, 0.14);
  --line: rgba(20, 60, 130, 0.08);
  --radius: 26px;
  --tabbar-h: 74px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3, p { margin: 0; }
img { max-width: 100%; }

.ic {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.ic.tiny { width: 16px; height: 16px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ══════════════════ app shell ══════════════════ */
.app-body {
  min-height: 100vh;
  background:
    radial-gradient(900px 620px at 6% -12%, rgba(158, 204, 255, 0.55), transparent 62%),
    radial-gradient(820px 520px at 104% -4%, rgba(214, 235, 255, 0.9), transparent 58%),
    linear-gradient(180deg, #eef6ff 0%, #f9fbff 44%, #eef5ff 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}
.app-body::before,
.app-body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(circle at 40% 40%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 70%);
}
.app-body::before { width: 460px; height: 460px; left: -150px; top: 34%; opacity: 0.75; }
.app-body::after { width: 380px; height: 380px; right: -130px; bottom: 6%; opacity: 0.6; }

.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 26px 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.56));
  border-right: 1px solid rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  z-index: 60;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 2px 8px 12px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 16px;
  background: linear-gradient(150deg, #6fb2ff, #2e7cf6);
  color: #fff;
  box-shadow: 0 10px 22px rgba(46, 124, 246, 0.35);
  flex: none;
}
.brand-mark .ic { width: 26px; height: 26px; }
.brand-mark.big { width: 64px; height: 64px; border-radius: 22px; }
.brand-name { font-weight: 800; letter-spacing: 0.05em; font-size: 17px; white-space: nowrap; }
.brand-name span { color: var(--primary); font-weight: 600; margin-left: 0.28em; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 15px;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
  text-align: left;
}
.nav-item .ic { color: var(--muted); }
.nav-item:hover { background: rgba(255, 255, 255, 0.72); }
.nav-item.is-active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 10px 24px rgba(46, 124, 246, 0.14);
}
.nav-item.is-active .ic { color: var(--primary); }
.sidebar-spacer { flex: 1; }

.sidebar-storage {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  padding: 13px 14px;
}
.sidebar-storage-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); margin-bottom: 9px; }
.sidebar-storage-row .ic { width: 18px; height: 18px; color: var(--primary); }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 6px 4px 0; }
.sidebar-user-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sidebar-user-text strong { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-text small { font-size: 11.5px; color: var(--muted); }

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(150deg, #8fc2ff, #2e7cf6);
  color: #fff;
  font-weight: 700;
  display: grid;
  place-items: center;
  font-size: 16px;
  box-shadow: 0 8px 18px rgba(46, 124, 246, 0.3);
  flex: none;
  user-select: none;
}
.avatar-top { width: 40px; height: 40px; font-size: 15px; }

.main { width: 100%; max-width: 1120px; margin: 0 auto; padding: 26px 36px 150px; }

.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.topbar .menu-btn { display: none; }
.topbar-title { flex: 1; min-width: 0; }
.topbar-brand { display: none; font-size: 10.5px; letter-spacing: 0.16em; color: var(--muted); font-weight: 800; margin-bottom: 2px; }
.topbar-title h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.62);
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}
.icon-btn:hover { background: #fff; color: var(--primary); box-shadow: 0 8px 20px rgba(46, 124, 246, 0.12); }

.searchbar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border-radius: 16px;
  padding: 6px 8px 6px 14px;
  box-shadow: 0 12px 28px rgba(40, 100, 200, 0.12);
  margin-bottom: 16px;
}
.searchbar .ic { color: var(--muted); }
.searchbar input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 15px;
  padding: 8px 0;
}
.searchbar .icon-btn { width: 36px; height: 36px; border-radius: 11px; background: #f2f7ff; }

/* ══════════════════ storage card ══════════════════ */
.storage-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(243, 249, 255, 0.78));
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 24px;
  padding: 16px 18px 15px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  margin-bottom: 20px;
}
.storage-head { display: flex; align-items: center; gap: 12px; }
.cloud-badge {
  width: 44px;
  height: 44px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, #a8d1ff, #4f96ff);
  color: #fff;
  box-shadow: 0 10px 20px rgba(79, 150, 255, 0.28);
  flex: none;
}
.storage-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; gap: 2px; }
.storage-copy strong { font-size: 17px; font-weight: 750; }
.storage-copy span { font-size: 12.5px; color: var(--muted); }
.pill {
  padding: 9px 14px;
  border-radius: 999px;
  background: #eaf3ff;
  color: var(--primary);
  font-weight: 650;
  font-size: 12.5px;
  white-space: nowrap;
}
.pill:hover { background: #e0edff; }
.storage-bar { height: 8px; border-radius: 999px; background: #e3edfb; margin-top: 14px; overflow: hidden; }
.storage-bar.slim { height: 6px; margin-top: 0; }
.storage-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  width: 0;
  background: linear-gradient(90deg, #6fb2ff, #2e7cf6);
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.mounts { display: flex; gap: 8px; overflow-x: auto; padding: 0 2px 14px; scrollbar-width: none; }
.mounts::-webkit-scrollbar { display: none; }
.mount-chip {
  flex: none;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.85);
  font-weight: 650;
  font-size: 12.5px;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.mount-chip .lock { color: var(--muted-2); display: inline-flex; }
.mount-chip.is-active {
  background: linear-gradient(135deg, #4d97ff, #2e7cf6);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 20px rgba(46, 124, 246, 0.28);
}
.mount-chip.is-active .lock { color: rgba(255, 255, 255, 0.8); }

.crumbs { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.crumbs a { color: var(--muted); padding: 4px 6px; border-radius: 8px; }
.crumbs a:hover { background: rgba(255, 255, 255, 0.72); color: var(--primary); }
.crumbs .sep { opacity: 0.45; font-size: 11px; }
.crumbs .current { color: var(--ink); font-weight: 650; padding: 4px 6px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 10px; }
.sort-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 650;
  font-size: 14px;
  color: var(--ink-2);
  padding: 8px 10px;
  border-radius: 12px;
}
.sort-btn:hover { background: rgba(255, 255, 255, 0.72); }
.sort-btn .ic { width: 17px; height: 17px; color: var(--muted); }
.view-toggle { display: flex; background: rgba(255, 255, 255, 0.66); border-radius: 14px; padding: 3px; }
.view-toggle button {
  width: 38px;
  height: 34px;
  border-radius: 11px;
  color: var(--muted);
  display: grid;
  place-items: center;
  transition: 0.16s;
}
.view-toggle button .ic { width: 19px; height: 19px; }
.view-toggle button.is-active { background: #fff; color: var(--primary); box-shadow: 0 6px 14px rgba(46, 124, 246, 0.16); }

/* ══════════════════ files ══════════════════ */
.files-card {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 26px;
  padding: 8px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 18px 40px rgba(40, 100, 200, 0.08);
}
.files-card.is-plain {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.files { display: flex; flex-direction: column; gap: 2px; min-height: 120px; }

.file-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-radius: 18px;
  transition: background 0.16s, box-shadow 0.16s;
  position: relative;
  text-align: left;
  width: 100%;
}
.file-row:hover { background: #fff; box-shadow: 0 10px 24px rgba(40, 100, 200, 0.08); }

.file-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  flex: none;
  color: #fff;
  background: linear-gradient(150deg, #6fb2ff, #2e7cf6);
  position: relative;
  overflow: hidden;
}
.file-icon .ic { width: 24px; height: 24px; }
.file-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-icon[data-kind="folder"] { background: linear-gradient(150deg, #6fb2ff, #2e7cf6); }
.file-icon[data-kind="pdf"] { background: linear-gradient(150deg, #ff7a80, #f0444d); }
.file-icon[data-kind="sheet"] { background: linear-gradient(150deg, #3ecf8e, #12a05c); }
.file-icon[data-kind="doc"] { background: linear-gradient(150deg, #63a6ff, #2e7cf6); }
.file-icon[data-kind="slide"] { background: linear-gradient(150deg, #ffb15c, #ff8a1f); }
.file-icon[data-kind="image"] { background: linear-gradient(150deg, #a79bff, #6a53f5); }
.file-icon[data-kind="video"] { background: linear-gradient(150deg, #a78bfa, #7c3aed); }
.file-icon[data-kind="audio"] { background: linear-gradient(150deg, #38d0e6, #0891b2); }
.file-icon[data-kind="archive"] { background: linear-gradient(150deg, #fbbf24, #d97706); }
.file-icon[data-kind="text"],
.file-icon[data-kind="code"] { background: linear-gradient(150deg, #94a3b8, #5b6b82); }
.file-icon[data-kind="other"] { background: linear-gradient(150deg, #a9b7cc, #7d8da6); }
.file-ext { font-size: 10px; font-weight: 800; letter-spacing: 0.04em; }

.file-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.file-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; white-space: nowrap; overflow: hidden; }
.file-meta .dot { opacity: 0.5; }
.file-more {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--muted);
  flex: none;
  transition: 0.15s;
}
.file-more:hover { background: #eef5ff; color: var(--primary); }

.files.is-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 4px; }
.file-card {
  position: relative;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 22px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-height: 168px;
  transition: transform 0.18s, box-shadow 0.18s, background 0.18s;
  text-align: left;
  width: 100%;
}
.file-card:hover { transform: translateY(-2px); box-shadow: 0 16px 34px rgba(40, 100, 200, 0.13); background: #fff; }
.file-card .thumb {
  height: 92px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #eef5ff;
}
.file-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-card .thumb .file-icon { width: 56px; height: 56px; border-radius: 18px; }
.file-card .file-name {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
  min-height: 35px;
}
.file-card .file-meta { font-size: 11.5px; margin-top: auto; }
.file-card .file-more {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(6px);
  width: 32px;
  height: 32px;
  border-radius: 10px;
  opacity: 0;
}
.file-card:hover .file-more,
.file-card:focus-within .file-more { opacity: 1; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 46px 20px; text-align: center; color: var(--muted); }
.more-wrap { display: flex; justify-content: center; padding: 14px 8px 8px; }
.more-wrap .btn { font-size: 13px; padding: 10px 16px; }
.empty .ic { width: 46px; height: 46px; color: #b9cbe6; }
.empty strong { font-size: 15px; color: var(--ink-2); }
.empty p { font-size: 13px; max-width: 320px; line-height: 1.5; margin: 0; }

.skeleton-row { height: 68px; border-radius: 18px; background: linear-gradient(90deg, #eef4fd, #f9fcff, #eef4fd); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.fab {
  position: fixed;
  right: max(24px, calc((100vw - 1120px) / 2 + 16px));
  bottom: 34px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(150deg, #63a6ff, #2e7cf6);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 16px 34px rgba(46, 124, 246, 0.42);
  z-index: 30;
  transition: transform 0.18s, box-shadow 0.18s;
}
.fab:hover { transform: translateY(-2px); box-shadow: 0 20px 40px rgba(46, 124, 246, 0.48); }
.fab .ic { width: 28px; height: 28px; stroke-width: 2; }

.tabbar { display: none; }
.scrim { position: fixed; inset: 0; background: rgba(10, 24, 48, 0.35); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); z-index: 50; }

/* ══════════════════ sheet / modal / toast ══════════════════ */
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  background: #fff;
  border-radius: 28px 28px 0 0;
  padding: 10px 16px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -20px 60px rgba(20, 50, 110, 0.22);
  animation: fadeUp 0.2s ease;
  max-height: 86vh;
  overflow: auto;
}
.sheet-grip { width: 42px; height: 4px; border-radius: 999px; background: #e2eaf6; margin: 4px auto 12px; }
.sheet-title { font-weight: 750; font-size: 16px; margin: 0 0 8px; padding: 0 6px; }
.sheet-sub { color: var(--muted); font-size: 12.5px; padding: 0 6px 8px; margin-top: -4px; }
.sheet-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 10px;
  border-radius: 16px;
  font-weight: 650;
  font-size: 15px;
  text-align: left;
}
.sheet-item:hover { background: #f3f8ff; }
.sheet-item .ic { color: var(--primary); }
.sheet-item.danger { color: #e23b44; }
.sheet-item.danger .ic { color: #e23b44; }
.sheet-sep { height: 1px; background: #eef3fb; margin: 6px 8px; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 18px; background: rgba(8, 20, 40, 0.42); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.modal-card {
  width: min(680px, 100%);
  max-height: 92vh;
  background: #fff;
  border-radius: 26px;
  box-shadow: 0 30px 80px rgba(15, 35, 80, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: pop 0.18s ease;
  position: relative;
}
.modal-card.bare .modal-head { display: none; }
.modal-close-float { position: absolute; top: 12px; right: 12px; z-index: 3; background: #f2f7ff; }
.modal-card.wide { width: min(980px, 100%); }
.modal-card.narrow { width: min(460px, 100%); }
@keyframes pop { from { opacity: 0.6; transform: scale(0.985); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 15px 18px; border-bottom: 1px solid #eef3fb; }
.modal-title { flex: 1; font-size: 16px; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal-body { padding: 18px; overflow: auto; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid #eef3fb; background: #fbfdff; flex-wrap: wrap; }

.toasts {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + 26px);
  z-index: 130;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(16, 33, 64, 0.92);
  color: #fff;
  font-size: 13px;
  font-weight: 650;
  backdrop-filter: blur(8px);
  animation: toastIn 0.2s;
  box-shadow: 0 12px 30px rgba(10, 25, 55, 0.3);
  max-width: 86vw;
}
.toast.ok { background: rgba(18, 120, 70, 0.95); }
.toast.err { background: rgba(190, 40, 50, 0.95); }
.toast .ic { width: 17px; height: 17px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ══════════════════ buttons / forms ══════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 14px;
  background: #eef4ff;
  color: var(--primary);
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.btn:hover { background: #e4efff; }
.btn.primary { background: linear-gradient(135deg, #4d97ff, #2e7cf6); color: #fff; box-shadow: 0 12px 26px rgba(46, 124, 246, 0.3); }
.btn.primary:hover { box-shadow: 0 16px 32px rgba(46, 124, 246, 0.38); }
.btn.ghost { background: #f2f6fc; color: var(--ink-2); }
.btn.danger { background: #ffecec; color: #d3343d; }
.btn.big { padding: 14px 22px; font-size: 15px; border-radius: 16px; }
.btn:disabled { opacity: 0.6; cursor: default; transform: none; }
.btn .ic { width: 19px; height: 19px; }

.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; font-size: 12.5px; font-weight: 650; color: var(--ink-2); }
.field input, .field select, .field textarea {
  padding: 13px 14px;
  border-radius: 14px;
  border: 1.5px solid #e3ecf8;
  background: #f8fbff;
  font-size: 15px;
  font-weight: 500;
  outline: none;
  transition: 0.15s;
  width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: #8fc0ff;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(46, 124, 246, 0.1);
}
.field-hint { font-size: 12px; color: var(--muted); font-weight: 500; line-height: 1.4; }
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; min-width: 0; }

/* ══════════════════ preview ══════════════════ */
.preview-shell { display: flex; flex-direction: column; gap: 14px; }
.preview-toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.preview-body { background: #f5faff; border-radius: 18px; padding: 16px; min-height: 180px; }
.preview-image { display: block; max-width: 100%; max-height: 68vh; margin: 0 auto; border-radius: 12px; box-shadow: 0 14px 30px rgba(20, 50, 110, 0.14); }
.preview-video { width: 100%; max-height: 68vh; border-radius: 12px; background: #000; }
.preview-audio { width: 100%; }
.preview-pdf { width: 100%; height: 68vh; border: 0; border-radius: 12px; background: #fff; }
.docx-body {
  background: #fff;
  padding: 26px 30px;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(20, 50, 110, 0.08);
  font-size: 15px;
  line-height: 1.55;
  color: #1b2a44;
  max-height: 68vh;
  overflow: auto;
}
.docx-body table { border-collapse: collapse; width: 100%; }
.docx-body td, .docx-body th { border: 1px solid #e6eef9; padding: 6px 8px; }
.docx-body img { max-height: 500px; }
.docx-body h1, .docx-body h2, .docx-body h3 { line-height: 1.25; }
.preview-table-wrap { overflow: auto; max-height: 68vh; background: #fff; border-radius: 12px; }
.preview-table { border-collapse: collapse; font-size: 13px; min-width: 100%; }
.preview-table th, .preview-table td { border: 1px solid #e8eff9; padding: 7px 9px; text-align: left; vertical-align: top; white-space: pre-wrap; min-width: 60px; }
.preview-table thead th { background: #f3f8ff; font-weight: 700; position: sticky; top: 0; z-index: 1; }
.preview-text {
  margin: 0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 68vh;
  overflow: auto;
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  color: #1b2a44;
}
.preview-note { color: var(--muted); font-size: 12.5px; margin: 10px 2px 0; }
.preview-placeholder { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 30px 16px; color: var(--muted); }
.preview-placeholder .file-icon { width: 64px; height: 64px; border-radius: 20px; }
.preview-placeholder strong { color: var(--ink); font-size: 15px; }
.preview-placeholder p { font-size: 13px; max-width: 340px; line-height: 1.5; }
.sheet-tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 10px; scrollbar-width: none; }
.sheet-tabs::-webkit-scrollbar { display: none; }
.sheet-tab { flex: none; padding: 7px 12px; border-radius: 999px; background: #eaf2ff; font-size: 12.5px; font-weight: 650; color: var(--ink-2); }
.sheet-tab.is-active { background: var(--primary); color: #fff; }
.editor-area {
  width: 100%;
  min-height: 52vh;
  border: 1.5px solid #e3ecf8;
  border-radius: 14px;
  padding: 14px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  line-height: 1.55;
  background: #f8fbff;
  resize: vertical;
  outline: none;
}
.editor-area:focus { border-color: #8fc0ff; background: #fff; box-shadow: 0 0 0 4px rgba(46, 124, 246, 0.1); }
.editor-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12px; margin-top: 8px; flex-wrap: wrap; }
.conflict-box { background: #fff8e8; border-radius: 14px; padding: 12px 14px; color: #8a5a00; font-size: 13px; line-height: 1.5; margin-bottom: 12px; }

/* ══════════════════ settings / admin ══════════════════ */
.settings-grid { display: flex; flex-direction: column; gap: 14px; }
.panel {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 22px;
  padding: 18px;
  backdrop-filter: blur(14px);
}
.panel h2 { font-size: 15.5px; font-weight: 750; margin-bottom: 12px; }
.panel h3 { font-size: 13.5px; font-weight: 750; margin: 16px 0 8px; }
.panel .muted { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.profile-row { display: flex; align-items: center; gap: 12px; }
.profile-row .avatar { width: 52px; height: 52px; font-size: 19px; }
.profile-row strong { display: block; font-size: 16px; }
.profile-row small { color: var(--muted); font-size: 12.5px; }
.user-row { display: flex; align-items: center; gap: 10px; padding: 9px 6px; border-radius: 14px; flex-wrap: wrap; }
.user-row:hover { background: #f7fbff; }
.user-row .grow { flex: 1; min-width: 150px; }
.user-row strong { display: block; font-size: 14px; }
.user-row small { color: var(--muted); font-size: 12px; }
.badge { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; background: #eef5ff; color: var(--primary); white-space: nowrap; }
.badge.admin { background: #e9f9ef; color: #0f9a58; }
.badge.off { background: #f1f4f9; color: #8f9db5; }
.badge.danger { background: #ffecec; color: #d3343d; }
.settings-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.mini-btn { padding: 7px 11px; border-radius: 10px; background: #eef4ff; color: var(--primary); font-size: 12px; font-weight: 650; }
.mini-btn.danger { background: #ffecec; color: #d3343d; }
.mini-btn:hover { filter: brightness(0.97); }
.share-link-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid #f0f5fc; flex-wrap: wrap; }
.share-link-row:last-child { border-bottom: 0; }
.share-link-row .grow { flex: 1; min-width: 160px; }
.share-link-row code { font-size: 11.5px; color: var(--muted); word-break: break-all; }
.install-cta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.install-cta .ic { color: var(--primary); width: 26px; height: 26px; }
.install-cta .grow { flex: 1; min-width: 180px; }
.install-cta strong { display: block; font-size: 14px; }
.install-cta small { color: var(--muted); font-size: 12px; line-height: 1.4; }

.install-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 6px 6px 2px; }
.install-icon { width: 84px; height: 84px; border-radius: 24px; box-shadow: 0 18px 36px rgba(46, 124, 246, 0.3); }
.install-hero h3 { margin-top: 4px; font-size: 20px; font-weight: 800; }
.install-hero p { color: var(--muted); font-size: 13.5px; line-height: 1.5; max-width: 340px; }
.install-steps { display: flex; flex-direction: column; gap: 10px; margin: 14px 0 4px; }
.install-step { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; line-height: 1.45; }
.install-step b { color: var(--primary); }
.install-step .num {
  width: 24px; height: 24px; border-radius: 50%; background: #eaf3ff; color: var(--primary);
  font-size: 12px; font-weight: 800; display: grid; place-items: center; flex: none;
}

/* ══════════════════ login ══════════════════ */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #e6f2ff 0%, #f9fcff 46%, #dbeaff 100%);
  position: relative;
  overflow: hidden;
  padding: 24px 18px 60px;
}
.login-bg .cloud { position: absolute; border-radius: 50%; pointer-events: none; }
.cloud-a { width: 560px; height: 560px; left: -180px; bottom: -160px; background: radial-gradient(circle at 40% 40%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 68%); }
.cloud-b { width: 460px; height: 460px; right: -150px; top: -120px; background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 70%); }
.cloud-c { width: 320px; height: 320px; right: 12%; bottom: 4%; background: radial-gradient(circle at 50% 50%, rgba(186, 220, 255, 0.55), rgba(255, 255, 255, 0) 70%); }
.login-wrap { position: relative; z-index: 1; width: 100%; display: flex; justify-content: center; }
.login-card {
  width: min(430px, 100%);
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(26px);
  -webkit-backdrop-filter: blur(26px);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 30px;
  padding: 30px 28px 24px;
  box-shadow: 0 30px 70px rgba(40, 90, 180, 0.18);
}
.login-brand { display: flex; align-items: center; gap: 14px; }
.login-brand-text { display: flex; flex-direction: column; line-height: 1; }
.login-eyebrow { font-size: 11px; letter-spacing: 0.24em; color: var(--primary); font-weight: 800; margin-bottom: 5px; }
.login-brand-text h1 { font-size: 27px; letter-spacing: 0.06em; font-weight: 800; margin: 0; }
.login-sub { color: var(--muted); font-size: 13.5px; line-height: 1.55; margin: 16px 0 22px; }
.login-form .field span { font-size: 12.5px; }
.login-form .btn { width: 100%; margin-top: 4px; }
.login-error { background: #fff0f0; color: #c22b35; border-radius: 12px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; line-height: 1.4; }
.login-hint { display: flex; align-items: center; gap: 6px; justify-content: center; color: var(--muted-2); font-size: 12px; margin: 18px 0 0; }
.login-footer { position: absolute; bottom: 16px; left: 0; right: 0; text-align: center; color: #9fb2d0; font-size: 11.5px; letter-spacing: 0.04em; }

/* ══════════════════ share page ══════════════════ */
.share-body {
  min-height: 100vh;
  background:
    radial-gradient(800px 500px at 10% -10%, rgba(170, 213, 255, 0.5), transparent 60%),
    linear-gradient(180deg, #eef6ff, #f9fbff 50%, #eef5ff);
  padding: 0 16px 40px;
}
.share-top { max-width: 920px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 22px 4px; gap: 10px; }
.share-brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.share-brand .brand-name { font-size: 15px; }
.share-mode { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); background: rgba(255, 255, 255, 0.72); padding: 7px 12px; border-radius: 999px; white-space: nowrap; }
.share-main { max-width: 920px; margin: 0 auto; }
.share-card {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  padding: 26px 26px 18px;
}
.share-head h1 { font-size: 23px; letter-spacing: -0.01em; word-break: break-word; }
.share-head p { color: var(--muted); font-size: 12.5px; margin-top: 6px; line-height: 1.5; }
.share-back { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.share-back:hover { color: var(--primary); }
.share-crumbs { display: flex; flex-wrap: wrap; gap: 2px; align-items: center; font-size: 12.5px; color: var(--muted); margin: 16px 0 4px; }
.share-crumbs a { color: var(--muted); padding: 4px 6px; border-radius: 8px; }
.share-crumbs a:hover { background: #f0f6ff; color: var(--primary); }
.share-crumb-sep { opacity: 0.5; }
.share-list { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.share-row { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 16px; color: inherit; }
.share-row:hover { background: #f4f9ff; }
.share-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.share-row-text strong { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.share-row-text small { color: var(--muted); font-size: 12px; }
.share-row-side { display: flex; align-items: center; gap: 4px; color: var(--muted); }
.share-row-side .icon-btn { width: 34px; height: 34px; border-radius: 10px; background: #eef5ff; }
.share-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 40px 16px; color: var(--muted); }
.share-empty .ic { width: 40px; height: 40px; color: #b9cbe6; }
.share-preview { margin-top: 16px; background: #f6faff; border-radius: 18px; padding: 16px; }
.share-image { max-width: 100%; max-height: 70vh; border-radius: 12px; display: block; margin: 0 auto; }
.share-video { width: 100%; max-height: 70vh; border-radius: 12px; background: #000; }
.share-audio { width: 100%; }
.share-pdf { width: 100%; height: 70vh; border: 0; border-radius: 12px; background: #fff; }
.share-doc { background: #fff; border-radius: 14px; padding: 22px; max-height: 70vh; overflow: auto; font-size: 14.5px; line-height: 1.55; color: #1b2a44; }
.share-doc table { border-collapse: collapse; width: 100%; }
.share-doc td, .share-doc th { border: 1px solid #e6eef9; padding: 6px 8px; }
.share-doc img { max-width: 100%; }
.share-doc .preview-table-wrap { max-height: none; }
.share-placeholder { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 34px 16px; color: var(--muted); }
.share-placeholder .file-icon { width: 68px; height: 68px; border-radius: 22px; }
.share-placeholder strong { color: var(--ink); font-size: 15px; }
.share-placeholder p { font-size: 13px; max-width: 340px; line-height: 1.5; }
.share-actions { margin-top: 18px; display: flex; justify-content: center; }
.share-footer { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; border-top: 1px solid #eef3fb; margin-top: 20px; padding-top: 14px; color: var(--muted); font-size: 11.5px; }

/* ══════════════════ message page ══════════════════ */
.message-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #e6f2ff, #f9fcff 50%, #dbeaff);
  padding: 24px;
}
.message-wrap { width: 100%; display: flex; justify-content: center; }
.message-card {
  width: min(440px, 100%);
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 28px;
  padding: 30px 26px 24px;
  text-align: center;
  box-shadow: 0 30px 70px rgba(40, 90, 180, 0.18);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  backdrop-filter: blur(20px);
}
.message-card h1 { font-size: 21px; font-weight: 800; }
.message-card p { color: var(--muted); font-size: 13.5px; line-height: 1.55; margin: 0 0 8px; }
.message-version { color: var(--muted-2); font-size: 11.5px; margin-top: 8px; }

/* ══════════════════ responsive ══════════════════ */
@media (max-width: 979px) {
  .app { display: block; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 286px;
    transform: translateX(-104%);
    transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
    border-right: 0;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 24px 0 60px rgba(20, 50, 110, 0.16);
  }
  .sidebar.open { transform: none; }
  .main { padding: 14px 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 34px); max-width: none; }
  .menu-btn { display: grid; }
  .topbar .menu-btn { display: grid; }
  .topbar { gap: 10px; margin-bottom: 14px; }
  .topbar-brand { display: block; }
  .topbar-title h1 { font-size: 26px; }
  .topbar-actions { gap: 8px; }
  .icon-btn { width: 40px; height: 40px; border-radius: 13px; }
  .avatar-top { width: 40px; height: 40px; }
  .storage-card { border-radius: 22px; padding: 14px 15px 13px; margin-bottom: 14px; }
  .storage-copy strong { font-size: 16px; }
  .pill { padding: 8px 12px; font-size: 12px; }
  .files-card { border-radius: 22px; padding: 6px; }
  .file-row { padding: 9px 8px; gap: 11px; border-radius: 16px; }
  .file-icon { width: 44px; height: 44px; border-radius: 14px; }
  .file-icon .ic { width: 22px; height: 22px; }
  .file-name { font-size: 14.5px; }
  .files.is-grid { grid-template-columns: repeat(auto-fill, minmax(142px, 1fr)); gap: 9px; }
  .fab { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px); right: 18px; }
  .tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding: 7px 6px env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid rgba(255, 255, 255, 0.95);
    box-shadow: 0 -10px 30px rgba(30, 70, 150, 0.08);
    z-index: 40;
    justify-content: space-around;
  }
  .tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 650;
    padding: 6px 0 4px;
    border-radius: 14px;
  }
  .tab-item .ic { width: 23px; height: 23px; }
  .tab-item.is-active { color: var(--primary); }
  .toasts { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 20px); }
  .modal { padding: 0; align-items: end; }
  .modal-card { border-radius: 24px 24px 0 0; max-height: 94vh; width: 100%; animation: fadeUp 0.2s ease; }
  .modal-card.narrow { width: 100%; }
  .modal-head { padding: 14px 16px; }
  .modal-body { padding: 16px; }
  .modal-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .preview-pdf { height: 62vh; max-height: 62vh; }
  .share-pdf { height: 62vh; max-height: 62vh; }
  .preview-video { max-height: 62vh; }
  .docx-body, .preview-table-wrap, .preview-text { max-height: 58vh; }
  .share-doc { max-height: 58vh; }
  .share-card { padding: 20px 16px 14px; border-radius: 24px; }
  .share-head h1 { font-size: 20px; }
  .share-preview { padding: 10px; }
  .share-doc { padding: 16px; }
  .share-footer { flex-direction: column; gap: 4px; }
  .form-row { flex-direction: column; gap: 0; }
  .login-card { padding: 26px 22px 20px; border-radius: 26px; }
  .login-brand-text h1 { font-size: 24px; }
}

@media (hover: none) {
  .file-card .file-more { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
