/* =========================================================
   内网网盘 · 样式
   ========================================================= */
:root {
  --bg: #fff;
  --panel: #ffffff;
  --sidebar: #f6f6f8;
  --line: #e5e5ea;
  --line-soft: #efeff2;
  --text: #1d1d1f;
  --text-2: #48484f;
  --muted: #66666d;
  --primary: #0068d1;
  --primary-dark: #005bb8;
  --primary-soft: #e8f2ff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --ok: #059669;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(23, 33, 55, .05);
  --shadow-md: 0 8px 28px rgba(23, 33, 55, .10);
  --shadow-lg: 0 24px 60px rgba(23, 33, 55, .16);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button, input { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--primary); text-decoration: none; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.ic {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
.ic.big { width: 40px; height: 40px; stroke-width: 1.4; }

/* ------------------------------ 登录 ------------------------------ */
.welcome {
  min-height: 100svh;
  background:
    radial-gradient(ellipse at 50% 38%, #f2f8ff 0%, transparent 43%),
    linear-gradient(180deg, #fff 0%, #fcfdff 100%);
}
.welcome-bar {
  display: flex; align-items: center; gap: 3px;
  height: 58px; padding: 0 24px;
  background: rgba(255, 255, 255, .78);
  color: #1d1d1f; font-size: 16px; font-weight: 650; letter-spacing: -.02em;
  border-bottom: 1px solid #1d1d1f08;
}
.welcome-bar svg { width: 24px; height: 24px; fill: #0874df; }
.welcome-hero {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center;
  min-height: calc(100svh - 58px);
  padding: 30px 20px 46px;
  text-align: center;
}
.welcome-art, .login-art {
  position: relative;
  aspect-ratio: 1;
}
.welcome-art {
  width: clamp(280px, 29vw, 420px);
  flex: none;
  animation: welcome-arrive .8s cubic-bezier(.2, .75, .3, 1) both;
}
.welcome-icon {
  position: absolute;
  width: var(--size);
  aspect-ratio: 1;
  translate: -50% -50%;
  background-image: var(--welcome-sprite);
  background-repeat: no-repeat;
  background-size: 300% 200%;
}
.welcome-art .welcome-icon { animation: welcome-float var(--period) cubic-bezier(.4, 0, .26, 1) var(--phase) infinite; }
.welcome-icon-cloud {
  top: 51%; left: 50%; --size: 58%;
  background-position: 0 0;
}
.welcome-art .welcome-icon-cloud { animation: welcome-breathe 6.2s ease-in-out infinite; }
.welcome-icon-shared {
  top: 17%; left: 43%; --size: 27%;
  --period: 5.8s; --phase: -.7s; --travel-x: -25%; --travel-y: -13%; --tilt: -12deg;
  background-position: 50% 0;
}
.welcome-icon-link {
  top: 29%; left: 80%; --size: 22%;
  --period: 6.8s; --phase: -2.4s; --travel-x: 31%; --travel-y: -27%; --tilt: 14deg;
  background-position: 100% 0;
}
.welcome-icon-photo {
  top: 42%; left: 20%; --size: 24%;
  --period: 5.2s; --phase: -1.1s; --travel-x: -27%; --travel-y: 21%; --tilt: -11deg;
  background-position: 0 100%;
}
.welcome-icon-folder {
  top: 74%; left: 25%; --size: 35%;
  --period: 6.3s; --phase: -3.1s; --travel-x: -16%; --travel-y: 16%; --tilt: 9deg;
  background-position: 50% 100%;
}
.welcome-icon-document {
  top: 77%; left: 75%; --size: 30%;
  --period: 5.6s; --phase: -4.2s; --travel-x: 22%; --travel-y: 18%; --tilt: 11deg;
  background-position: 100% 100%;
}
@keyframes welcome-arrive {
  0% { opacity: 0; transform: translateY(12px) scale(.9); }
  74% { opacity: 1; transform: scale(1.025); }
  100% { opacity: 1; transform: none; }
}
@keyframes welcome-float {
  0%, 100% { transform: translate(0, 0) rotate(0) scale(1); }
  34% { transform: translate(var(--travel-x), var(--travel-y)) rotate(var(--tilt)) scale(1.08); }
  47% { transform: translate(calc(.82 * var(--travel-x)), calc(.76 * var(--travel-y))) rotate(calc(.75 * var(--tilt))) scale(1.02); }
  76% { transform: translate(calc(-.24 * var(--travel-x)), calc(-.42 * var(--travel-y))) rotate(calc(-.45 * var(--tilt))) scale(.96); }
}
@keyframes welcome-breathe {
  0%, 100% { transform: translate(1%, 2%) rotate(-3deg); }
  34% { transform: translate(-2%, -5%) rotate(3deg) scale(1.045); }
  63% { transform: translate(0, -1%) rotate(1deg) scale(1.015); }
}
.welcome:has(.login-dialog[open]) .welcome-art .welcome-icon { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) {
  .welcome-art, .welcome-art .welcome-icon { animation: none; }
}
.welcome-hero h1 {
  margin: 0;
  font-size: clamp(56px, 6.2vw, 86px);
  line-height: 1.16; font-weight: 680; letter-spacing: -.055em;
}
.welcome-signin {
  min-width: 160px; min-height: 48px;
  margin-top: clamp(20px, 2.8vh, 28px); padding: 0 30px;
  background: #080808; color: #fff;
  border-radius: 999px;
  font-size: 16px; font-weight: 650;
}
.welcome-signin:hover { background: #303030; }
.welcome-hero p {
  margin: clamp(19px, 2.8vh, 29px) 0 0;
  max-width: 20em;
  color: #42434a;
  font-size: clamp(20px, 2.25vw, 28px);
  line-height: 1.45; font-weight: 550; letter-spacing: -.025em;
  text-wrap: balance;
}

@media (max-width: 570px) {
  .welcome-bar { height: 52px; padding: 0 18px; font-size: 15px; }
  .welcome-bar svg { width: 22px; height: 22px; }
  .welcome-hero {
    min-height: calc(100svh - 52px);
    padding: 28px 18px 38px;
  }
  .welcome-art { width: clamp(235px, 68vw, 315px); }
  .welcome-hero h1 { font-size: clamp(54px, 13vw, 68px); }
  .welcome-signin { min-height: 48px; margin-top: 21px; }
  .welcome-hero p { margin-top: 21px; font-size: clamp(20px, 5.5vw, 24px); }
}

@media (max-height: 700px) and (min-width: 571px) {
  .welcome-art { width: clamp(270px, 42vh, 340px); }
  .welcome-hero { padding-block: 22px; }
  .welcome-signin, .welcome-hero p { margin-top: 18px; }
}

.login-dialog {
  width: min(calc(100% - 28px), 388px);
  max-height: calc(100% - 28px);
  padding: 0; border: 1px solid var(--line-soft);
  border-radius: 26px;
  background: var(--panel); color: var(--text);
  box-shadow: 0 20px 70px #0003;
}
.login-dialog::backdrop { background: #0004; backdrop-filter: blur(5px); }
.login-card {
  position: relative;
  padding: 22px clamp(19px, 6vw, 29px) 24px;
  display: flex; flex-direction: column;
}
.login-close { position: absolute; top: 12px; right: 12px; background: #f1f1f4; }

.login-art { align-self: center; width: 126px; }
.login-card h2 {
  margin: 0 0 17px; font-size: 23px; font-weight: 650;
  text-align: center; letter-spacing: -.04em;
}
.login-card .field { margin-bottom: 10px; }
.login-card .field > span { margin-bottom: 5px; }
.login-card .field input { height: 44px; border-color: #d8dce5; background: #fff; font-size: 16px; }
.login-card .field input:focus { border-color: var(--primary); }
.login-card .btn-primary { height: 44px; margin-top: 4px; background: #080808; }
.login-card .btn-primary:enabled:hover { background: #303030; }
.login-card .btn-primary:disabled { background: #64646a; }

.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block; margin-bottom: 6px;
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
}
.field input,
.dlg-body input[type=text],
.dlg-body input[type=password],
.dlg-body input[type=number],
.dlg-body select {
  width: 100%;
  height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfe;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field input:focus,
.dlg-body input:focus,
.dlg-body select:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

/* Styled dropdown controls */
.dlg-body select {
  -webkit-appearance: none;
  appearance: none;
  height: 44px;
  padding-right: 40px;
  border-color: var(--line);
  border-radius: 10px;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2366666d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  background-size: 16px 16px;
  color: var(--text);
  color-scheme: light;
  font: inherit;
  cursor: pointer;
}
.dlg-body select:focus { background-color: #fff; }
.dlg-body select:hover:not(:focus) { border-color: #d2d2d7; }
.dlg-body select option { background: #fff; color: var(--text); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 15px;
  border-radius: 10px;
  font-size: 13.5px; font-weight: 600;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s, color .15s, transform .06s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { background: #9db6ef; box-shadow: none; cursor: not-allowed; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--text-2); }
.btn-ghost:hover { border-color: #cfd6e4; color: var(--text); background: #fafbfd; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-soft-danger { background: var(--danger-soft); color: var(--danger); }
.btn-soft-danger:hover { background: #fee2e2; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; }
.btn-block { width: 100%; height: 46px; margin-top: 8px; font-size: 15px; border-radius: 999px; }

.login-err {
  margin-top: 12px;
  color: var(--danger); font-size: 12.5px; text-align: center;
}
.login-err:empty { margin-top: 0; }

/* ------------------------------ 应用骨架 ------------------------------ */
.app {
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr);
  height: 100%;
  overflow: hidden;
}

.sidebar {
  display: flex; flex-direction: column;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  padding: 18px 14px 14px;
  overflow: auto;
  z-index: 30;
}

.brand {
  display: flex; align-items: center; gap: 9px;
  padding: 0 8px 26px;
  font-size: 18px; font-weight: 650; letter-spacing: -.035em;
}
.brand-logo { width: 34px; height: 34px; flex: none; fill: var(--primary); }

.nav { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 11px;
  border-radius: 10px;
  color: var(--text-2);
  font-size: 13.5px; font-weight: 500;
  transition: background .13s, color .13s;
  text-align: left;
}
.nav-item:hover { background: #ebebef; color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item.active .ic { stroke-width: 2; }

.side-bottom { margin-top: auto; padding-top: 14px; }

.usage-box {
  padding: 11px 12px;
  border-radius: 11px;
  background: #eeeef2;
  margin-bottom: 10px;
}
.usage-label {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.usage-label + .usage-label { margin-top: 5px; }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: #fcfdff;
}
.avatar {
  width: 34px; height: 34px; flex: none;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-dark); font-weight: 650; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  text-transform: uppercase;
}
.user-meta { min-width: 0; flex: 1; }
.user-name {
  font-size: 13px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-role { font-size: 11px; color: var(--muted); margin-top: 1px; }
.password-shortcut {
  flex: none; height: 28px; padding: 0 7px; border-radius: 8px;
  color: var(--muted); font-size: 11px; white-space: nowrap;
  transition: background .13s, color .13s;
}
.password-shortcut:hover { background: #eef1f7; color: var(--text); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: 9px;
  color: var(--muted);
  transition: background .13s, color .13s;
  flex: none;
}
.icon-btn:hover { background: #eef1f7; color: var(--text); }

/* ------------------------------ 主区 ------------------------------ */
.main {
  display: flex; flex-direction: column;
  min-width: 0;
  position: relative;
  overflow: hidden;
}

.topbar {
  display: flex; align-items: center; gap: 14px;
  height: 62px; padding: 0 clamp(16px, 2.7vw, 36px);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex: none;
}

.crumbs {
  display: flex; align-items: center; gap: 4px;
  min-width: 0; flex: 1;
  font-size: 13.5px;
  overflow: hidden;
}
.crumb {
  display: block;
  max-width: 220px;
  min-width: 0;
  padding: 5px 6px;
  border-radius: 7px;
  color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background .12s, color .12s;
}
.crumb:hover { background: #f2f5fa; color: var(--text); }
.crumb-sep { flex: none; color: #9a9aa1; font-size: 12px; user-select: none; }

.tools { display: flex; align-items: center; gap: 9px; flex: none; }

.search-wrap {
  position: relative;
  display: flex; align-items: center;
}
.search-wrap .ic {
  position: absolute; left: 11px;
  width: 15px; height: 15px; color: var(--muted);
  pointer-events: none;
}
.search-wrap input {
  width: clamp(154px, 16vw, 238px); height: 36px;
  padding: 0 12px 0 33px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: #f1f1f4;
  outline: none;
  font-size: 13px;
  transition: border-color .15s, box-shadow .15s;
}
.search-wrap input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.search-wrap input::-webkit-search-cancel-button { cursor: pointer; }

.content {
  flex: 1;
  overflow-y: auto;
  padding: 28px clamp(16px, 2.7vw, 36px) 40px;
}

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-heading { min-width: 0; }
.page-heading h1 {
  margin: 0;
  font-size: clamp(25px, 3vw, 33px); font-weight: 650; letter-spacing: -.045em;
  overflow-wrap: anywhere;
}
.page-heading p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.file-controls { display: flex; align-items: center; gap: 9px; }
.sort-picker { position: relative; z-index: 3; }
.sort-trigger {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 154px; height: 36px; padding: 0 10px 0 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel); color: var(--text-2); font-size: 12px;
  text-align: left; transition: border-color .15s, background .15s, box-shadow .15s;
}
.sort-trigger:hover { border-color: #d2d2d7; background: #fafafd; }
.sort-trigger[aria-expanded="true"] { border-color: #d2d2d7; }
.sort-trigger:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(0, 104, 209, .13); }
.sort-trigger svg {
  width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
  transition: transform .18s ease;
}
.sort-trigger[aria-expanded="true"] svg { transform: rotate(180deg); }
.sort-menu {
  position: absolute; top: calc(100% + 7px); right: 0; z-index: 30;
  width: max(100%, 190px); padding: 5px;
  border: 1px solid rgba(60, 60, 67, .12); border-radius: 12px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 10px 30px rgba(23, 33, 55, .13), 0 2px 6px rgba(23, 33, 55, .05);
  backdrop-filter: blur(18px);
  transform-origin: top right;
  animation: sort-menu-in .16s cubic-bezier(.2, .7, .3, 1) both;
}
.sort-option {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 34px; padding: 0 9px; border-radius: 8px;
  color: var(--text-2); font-size: 12px; cursor: pointer; user-select: none;
}
.sort-option:hover, .sort-option:focus { outline: none; background: #f3f4f6; color: var(--text); }
.sort-option[aria-selected="true"] { background: #eef5ff; color: var(--primary); font-weight: 550; }
.sort-option[aria-selected="true"]::after { content: "✓"; font-size: 12px; font-weight: 600; }
@keyframes sort-menu-in {
  from { opacity: 0; transform: translateY(-4px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .sort-menu { animation: none; }
}
.view-switch {
  display: flex; gap: 2px; padding: 3px;
  border-radius: 10px; background: #f1f1f4;
}
.view-switch .icon-btn { width: 33px; height: 30px; border-radius: 7px; }
.view-switch [aria-pressed="true"] {
  color: var(--primary);
  background: var(--panel);
  box-shadow: 0 1px 3px #15153224;
}

/* ------------------------------ 文件列表 ------------------------------ */
.list-head,
.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(62px, 10%) minmax(105px, 16%) 158px;
  align-items: center;
  gap: 10px;
}

.list-head {
  position: sticky; top: -28px;
  padding: 7px 12px;
  background: var(--bg);
  z-index: 5;
  font-size: 12px; font-weight: 600; color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.list-head > button { justify-self: start; padding: 5px 0; text-align: left; white-space: nowrap; }
.list-head > button[data-direction="asc"]::after { content: " ↑"; }
.list-head > button[data-direction="desc"]::after { content: " ↓"; }
.list-head > button:hover { color: var(--primary); }

.rows { display: flex; flex-direction: column; gap: 1px; }

.row {
  padding: 7px 11px;
  border-radius: 8px;
  cursor: default;
  transition: background .1s;
  border: 1px solid transparent;
}
.row:hover, .row:focus-within { background: #f5f8fc; }
.row.selected { background: var(--primary-soft); border-color: #cfe0ff; }

.cell-name {
  display: flex; align-items: center; gap: 10px;
  min-width: 0;
}
button.cell-name { width: 100%; text-align: left; padding: 0; border-radius: 6px; }
.cell-name .txt {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13.5px;
}
.row.is-dir .cell-name .txt { font-weight: 500; }

.fico {
  --file-accent: #546377;
  width: 27px; height: 32px; flex: none;
  position: relative;
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 4px;
  border-radius: 4px 0 4px 4px;
  background: linear-gradient(#fff, #f3f5f8);
  box-shadow: inset 0 0 0 1px #dce1e8;
  clip-path: polygon(0 0, 72% 0, 100% 24%, 100% 100%, 0 100%);
  font-size: 7px; font-weight: 750; letter-spacing: .035em;
  color: var(--file-accent);
  text-transform: uppercase;
}
.fico::before {
  content: "";
  position: absolute; inset: 0 0 auto auto;
  width: 28%; height: 24%;
  background: #dfe6ef; border-bottom-left-radius: 3px;
}
.fico.folder {
  width: 33px; height: 25px;
  clip-path: none; box-shadow: none;
  border-radius: 4px; background: none;
}
.fico.folder::before {
  inset: 0 auto auto 0; width: 53%; height: 40%;
  border-radius: 22% 40% 0 0; background: #45a7f1;
}
.fico.folder::after {
  content: "";
  position: absolute; inset: 16% 0 0;
  border-radius: 11% / 17%;
  background: linear-gradient(#8fd7ff, #39a8f4 48%, #248fe9);
  box-shadow: inset 0 1px 0 #ffffff80, inset 0 -1px 0 #0073ca36, 0 2px 5px #0572c527;
}
.fico.img { --file-accent: #147459; }
.fico.vid, .fico.aud { --file-accent: #7944ae; }
.fico.doc, .fico.code { --file-accent: #1365bc; }
.fico.xls { --file-accent: #147449; }
.fico.ppt { --file-accent: #a14c16; }
.fico.pdf { --file-accent: #ba303c; }

.cell-size, .cell-time {
  font-size: 12.5px; color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cell-act {
  display: flex; align-items: center; justify-content: flex-end; gap: 2px;
  opacity: 0; transition: opacity .12s;
}
.row:hover .cell-act, .row:focus-within .cell-act, .row.selected .cell-act { opacity: 1; }

.mini-btn {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  color: var(--text-2);
  transition: background .12s, color .12s;
}
.mini-btn:hover { background: #eef1f7; color: var(--text); }
.mini-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 152px), 1fr));
  gap: 12px;
}
.file-grid .row {
  display: flex; flex-direction: column; align-items: stretch;
  gap: 3px; min-width: 0; padding: 12px 5px 5px; border-radius: 12px;
}
.file-grid .cell-name { flex-direction: column; justify-content: center; gap: 9px; padding-top: 4px; }
.file-grid .txt { max-width: 100%; padding: 0 4px; text-align: center; }
.file-grid .fico { width: 44px; height: 55px; border-radius: 6px 0 6px 6px; padding-bottom: 9px; font-size: 10px; }
.file-grid .fico.folder { width: 66px; border-radius: 6px; }
.file-grid .fico.folder::before { top: 4px; }
.file-grid .fico.folder::after { inset: 24% 0 3%; }
.file-grid .cell-size, .file-grid .cell-time { display: none; }
.file-grid .cell-act { min-height: 30px; justify-content: center; gap: 0; }
.file-grid .mini-btn { width: clamp(25px, 3vw, 28px); padding: 0; }
.file-grid .mini-btn .ic { width: 16px; height: 16px; }

.empty {
  min-height: 275px;
  padding: 60px 18px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  color: var(--muted);
}
.empty .ic { width: 48px; height: 48px; stroke-width: 1.35; color: #6e8bb0; margin-bottom: 16px; }
.empty .fico.folder { width: 70px; height: 54px; margin-bottom: 19px; }
.empty h4 { margin: 0 0 8px; font-size: 16px; color: var(--text); font-weight: 600; }
.empty p { margin: 0; font-size: 13px; }

/* ------------------------------ 上传面板 ------------------------------ */
.upload-panel {
  position: fixed; right: 20px; bottom: 20px;
  width: 340px; max-height: 46vh;
  background: var(--panel);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--line);
  display: flex; flex-direction: column;
  z-index: 60;
  overflow: hidden;
}
.up-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 12px 11px 16px;
  font-size: 12.5px; font-weight: 600;
  border-bottom: 1px solid var(--line-soft);
}
.up-list { overflow-y: auto; padding: 6px 0; }
.up-item { padding: 9px 16px; }
.up-line {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px;
}
.up-name {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.up-pct { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.up-bar {
  height: 4px; margin-top: 6px;
  background: #eef1f7; border-radius: 999px; overflow: hidden;
}
.up-bar > i {
  display: block; height: 100%; width: 0;
  background: var(--primary); border-radius: 999px; transition: width .18s;
}
.up-item.done .up-bar > i { background: var(--ok); }
.up-item.fail .up-bar > i { background: var(--danger); }
.up-item.fail .up-pct { color: var(--danger); }

/* ------------------------------ 拖拽蒙层 ------------------------------ */
.drop-mask {
  position: absolute; inset: 10px;
  border: 2px dashed var(--primary);
  border-radius: 18px;
  background: rgba(37, 99, 235, .06);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center; justify-content: center;
  z-index: 50;
  pointer-events: none;
}
.drop-mask.on { display: flex; }
.drop-inner {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  color: var(--primary); font-size: 14px; font-weight: 600;
  background: #fff; padding: 26px 34px; border-radius: 16px;
  box-shadow: var(--shadow-md);
}

/* ------------------------------ 弹窗 ------------------------------ */
.modal {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  z-index: 100;
}
.modal-mask {
  position: absolute; inset: 0;
  background: rgba(18, 25, 40, .42);
  backdrop-filter: blur(3px);
  animation: fade .16s ease-out;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }

.dialog-box {
  position: relative;
  width: 100%; max-width: 424px;
  background: var(--panel);
  border-radius: 18px;
  padding: 24px 24px 20px;
  box-shadow: var(--shadow-lg);
  animation: pop .18s cubic-bezier(.22, 1, .36, 1);
  max-height: 86vh; overflow-y: auto;
}
.dialog-box h3 { margin: 0 0 6px; font-size: 16.5px; font-weight: 700; }
.dlg-body { font-size: 13.5px; color: var(--text-2); line-height: 1.65; }
.dlg-body p { margin: 0 0 12px; }
.dlg-body .field { margin-top: 12px; margin-bottom: 0; }
.dlg-body .hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.dlg-body .err { color: var(--danger); font-size: 12.5px; margin-top: 8px; min-height: 16px; }
.dlg-actions {
  display: flex; justify-content: flex-end; gap: 9px;
  margin-top: 20px;
}

.preview-box {
  position: relative;
  width: 100%; max-width: 1080px;
  height: 100%; max-height: 88vh;
  background: var(--panel);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: pop .18s cubic-bezier(.22, 1, .36, 1);
}
.preview-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px 12px 20px;
  border-bottom: 1px solid var(--line-soft);
  flex: none;
}
.preview-title {
  font-size: 13.5px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.preview-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.preview-body {
  flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  background: #0f172a;
  overflow: auto;
}
.preview-body img,
.preview-body video { max-width: 100%; max-height: 100%; display: block; }
.preview-body audio { width: min(560px, 86%); }
.preview-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.preview-body pre {
  margin: 0; padding: 20px;
  width: 100%; height: 100%;
  overflow: auto;
  background: #fff; color: #1f2937;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12.5px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word;
}
.preview-fallback {
  color: #cbd5e1; text-align: center; padding: 40px;
}
.preview-fallback .ic { width: 52px; height: 52px; margin-bottom: 14px; stroke-width: 1.2; }
.preview-fallback p { margin: 0 0 16px; font-size: 13.5px; }

/* ------------------------------ 提示 ------------------------------ */
.toasts {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px;
  z-index: 200; pointer-events: none;
}
.toast {
  padding: 10px 18px;
  border-radius: 10px;
  background: #1f2937; color: #fff;
  font-size: 13px;
  box-shadow: var(--shadow-md);
  animation: toastIn .2s ease-out;
  max-width: 70vw;
}
.toast.ok { background: #065f46; }
.toast.err { background: #9f1239; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ------------------------------ 用户管理 ------------------------------ */
.admin-wrap {
  width: 100%;
  max-width: none;
  display: grid;
  gap: 18px;
  container-type: inline-size;
}
.admin-card {
  --admin-inset: 22px;
  min-width: 0;
  background: var(--panel);
  border: 0;
  border-radius: 16px;
  box-shadow: 0 14px 40px rgba(23, 33, 55, .12), 0 3px 10px rgba(23, 33, 55, .04);
}
.admin-card-head {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 12px; padding: 18px var(--admin-inset);
}
.admin-card-head h2 { margin: 0; font-size: 17px; font-weight: 650; }
.admin-card-head p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.admin-user-head, .admin-user {
  display: grid; align-items: center; gap: 14px;
  grid-template-columns: minmax(0, 1.7fr) minmax(68px, .55fr) minmax(88px, .7fr) 154px;
  padding-inline: var(--admin-inset);
}
.admin-user-head {
  padding-block: 9px;
  background: var(--sidebar);
  border-block: 1px solid var(--line-soft);
  color: var(--muted); font-size: 12px; font-weight: 600;
}
.admin-user-head > :last-child { text-align: right; }
.admin-users { margin: 0; padding: 0; list-style: none; }
.admin-user { padding-block: 13px; }
.admin-user + .admin-user { border-top: 1px solid var(--line-soft); }
.admin-user:hover, .admin-user:focus-within { background: #f8faff; }
.admin-identity { display: flex; align-items: center; gap: 11px; min-width: 0; }
.admin-avatar {
  display: grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--sidebar); color: var(--text-2);
  font-weight: 650; text-transform: uppercase;
}
.admin-person { min-width: 0; }
.admin-person strong, .admin-username { overflow-wrap: anywhere; }
.admin-person strong { font-weight: 650; }
.admin-person-details { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 4px; }
.admin-username { font-size: 12px; color: var(--muted); min-width: 0; }
.admin-role {
  border-radius: 999px; padding: 2px 7px;
  background: var(--sidebar); color: var(--text-2);
  font-size: 11px; line-height: 1.4; white-space: nowrap;
}
.admin-avatar-accent, .admin-role-accent { background: var(--primary-soft); color: var(--primary-dark); }
.admin-meta { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.admin-meta-label {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.admin-user-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.admin-user-actions .btn { height: 34px; padding-inline: 10px; font-size: 12px; }
.admin-user-actions [data-uact="reset"],
.admin-user-actions [data-uact="del"],
.admin-user-actions [data-uact="own"],
#admin-password-form #btn-change-pw {
  box-shadow: 0 2px 7px rgba(23, 33, 55, .12);
}
.admin-user-actions [data-uact="reset"]:hover,
.admin-user-actions [data-uact="del"]:hover,
.admin-user-actions [data-uact="own"]:hover,
#admin-password-form #btn-change-pw:hover {
  box-shadow: 0 4px 12px rgba(23, 33, 55, .16);
}
.admin-delete { color: var(--danger); }
.admin-delete:hover { color: var(--danger); background: var(--danger-soft); border-color: var(--danger-soft); }
.admin-storage {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  padding: 12px var(--admin-inset);
  border-top: 1px solid var(--line-soft);
  color: var(--muted); font-size: 12px;
}
.admin-storage strong { color: var(--text-2); font-weight: 650; }
#admin-password-form {
  display: grid; align-items: end; gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  padding: 0 var(--admin-inset) 20px;
}
#admin-password-form .field { margin: 0; }
#admin-password-form .btn { height: 42px; }
.admin-password-error { margin: 0; grid-column: 1 / -1; font-size: 13px; color: var(--danger); }
.admin-password-error:empty { position: absolute; }
#dialog:has(.admin-dialog-content) .dialog-box {
  max-width: 460px; max-height: calc(100dvh - 32px);
  padding: clamp(16px, 5vw, 24px);
  border-radius: 20px;
}
#dialog:has(.admin-dialog-content) .dialog-box h3 { font-size: 20px; }
.admin-dialog-content { overflow-wrap: anywhere; }
.admin-dialog-content .field input, .admin-dialog-content .field select { font-size: 16px; }
.admin-dialog-content .err:empty { min-height: 0; margin-top: 0; }

@container (max-width: 620px) {
  .admin-card { --admin-inset: 15px; }
  .admin-user-head { display: none; }
  .admin-users { border-top: 1px solid var(--line-soft); }
  .admin-user { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; }
  .admin-identity, .admin-user-actions { grid-column: 1 / -1; }
  .admin-meta-label {
    position: static; width: auto; height: auto;
    clip-path: none; display: block;
    margin-bottom: 3px; color: var(--muted); font-size: 11px;
  }
  .admin-user-actions { justify-content: flex-start; }
  .admin-user-actions .btn, .admin-card-head .btn { height: 42px; }
  #admin-password-form { grid-template-columns: minmax(0, 1fr); }
  #admin-password-form input { font-size: 16px; }
}

/* ------------------------------ 分享浮层 ------------------------------ */
.share-link {
  display: flex; gap: 8px; margin-top: 12px;
}
.share-link input {
  flex: 1; height: 38px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fbfcfe; font-size: 12.5px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  color: var(--text-2);
}
.seg {
  display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px;
}
.seg button {
  padding: 7px 13px; border-radius: 9px;
  border: 1px solid var(--line); background: #fff;
  font-size: 12.5px; color: var(--text-2);
  transition: all .13s;
}
.seg button:hover { border-color: #c8d2e4; }
.seg button.on {
  background: var(--primary-soft); border-color: #bcd3ff;
  color: var(--primary); font-weight: 600;
}

/* ------------------------------ 响应式 ------------------------------ */
.only-mobile { display: none; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0;
    width: min(262px, 80vw);
    visibility: hidden;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; visibility: visible; }
  .only-mobile { display: inline-flex; }
  .crumbs .only-mobile { font-weight: 600; }
  .topbar { padding: 0 14px; gap: 8px; }
  .tools .btn { width: 36px; height: 36px; padding: 0; gap: 0; font-size: 0; }
  .search-wrap input { width: clamp(110px, 29vw, 180px); }
  .content { padding: 22px 14px 40px; }
  .list-head { top: -22px; }
  .upload-panel { right: 10px; left: 10px; width: auto; bottom: 10px; }
  .modal { padding: 10px; }
}

@media (max-width: 570px) {
  .topbar { flex-wrap: wrap; height: auto; min-height: 54px; padding-block: 8px; }
  .crumbs { flex-basis: calc(100% - 40px); }
  .tools { width: 100%; }
  .search-wrap { flex: 1; }
  .search-wrap input { width: 100%; }
  .list-head, .row { grid-template-columns: minmax(0, 1fr) 64px; }
  .col-time, .cell-time, .col-act { display: none; }
  .row .cell-act { grid-column: 1 / -1; }
  .file-grid { gap: 7px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 139px), 1fr)); }
  .page-head { margin-bottom: 16px; }
  .file-controls { margin-left: auto; }
}

@media (hover: none), (max-width: 570px) {
  .cell-act { opacity: 1; }
}
