/* ------------------------------------------------------------------
   我的导航 · 设计系统
------------------------------------------------------------------ */

:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --ink: #182033;
  --ink-soft: #3c465c;
  --muted: #78829a;
  --line: #e4e8f2;
  --line-strong: #d3d9e8;
  --brand: #4d5dfb;
  --brand-2: #8b5cf6;
  --brand-soft: #eef0ff;
  --danger: #e5484d;
  --danger-soft: #fdecec;
  --ok: #12a06a;
  --warn: #e08a00;
  --shadow-sm: 0 1px 2px rgba(24, 32, 51, 0.05);
  --shadow: 0 12px 32px rgba(30, 41, 90, 0.09);
  --shadow-lg: 0 26px 60px rgba(24, 32, 70, 0.18);
  --radius: 16px;
  --radius-sm: 11px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(820px 460px at 8% -12%, rgba(210, 219, 255, 0.75), transparent 62%),
    radial-gradient(700px 440px at 102% -4%, rgba(240, 224, 255, 0.7), transparent 58%);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.logged-out {
  overflow: hidden;
}

.hidden {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--brand);
  text-decoration: none;
}

svg {
  display: block;
}

::selection {
  background: rgba(77, 93, 251, 0.18);
}

:focus-visible {
  outline: 2px solid rgba(77, 93, 251, 0.55);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------
   通用控件
------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease,
    background 0.16s ease;
}

.btn:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(28, 38, 90, 0.08);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 8px 20px rgba(77, 93, 251, 0.28);
}

.btn.primary:hover {
  box-shadow: 0 12px 26px rgba(77, 93, 251, 0.34);
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.btn.ghost:hover {
  background: #f2f4fa;
  box-shadow: none;
}

.btn.block {
  width: 100%;
  height: 44px;
  font-size: 15px;
}

.btn.small {
  height: 32px;
  padding: 0 11px;
  font-size: 13px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  transition: background 0.16s ease, color 0.16s ease;
}

.icon-btn:hover {
  background: #eef1f8;
  color: var(--ink);
}

.icon-btn.danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.icon-btn.star.on {
  color: #f0a029;
}

.icon-btn.star.on svg {
  fill: currentColor;
  stroke: currentColor;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field > span {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

.field > span i {
  color: var(--danger);
  font-style: normal;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fafbfe;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.field textarea {
  resize: vertical;
  min-height: 78px;
  line-height: 1.6;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #a8b0c2;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: #b9c0ff;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(77, 93, 251, 0.12);
}

.form-error {
  min-height: 18px;
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--danger);
}

.check {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 16px;
  font-size: 14px;
  color: var(--ink-soft);
  user-select: none;
}

.check input {
  width: 17px;
  height: 17px;
  accent-color: var(--brand);
}

/* ------------------------------------------------------------------
   登录
------------------------------------------------------------------ */

.login {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(400px, 100%);
  padding: 34px 32px 26px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(14px);
  animation: rise 0.45s ease both;
}

.login-logo {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 10px 22px rgba(77, 93, 251, 0.34);
}

.login-card h1 {
  margin: 18px 0 6px;
  font-size: 24px;
  letter-spacing: -0.02em;
}

.login-sub {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}

.login-foot {
  margin: 16px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* ------------------------------------------------------------------
   顶栏
------------------------------------------------------------------ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(228, 232, 242, 0.9);
}

.bar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 11px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 7px 16px rgba(77, 93, 251, 0.32);
}

.brand-name {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.tabs {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: 12px;
  background: #eff1f8;
  flex: none;
}

.tab {
  height: 30px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.tab:hover {
  color: var(--ink-soft);
}

.tab.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 2px 6px rgba(24, 32, 51, 0.08);
}

.tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  justify-content: flex-end;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #f7f8fc;
  flex: 0 1 300px;
  min-width: 150px;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.search:focus-within {
  background: #fff;
  border-color: #c2c8ff;
  box-shadow: 0 0 0 3px rgba(77, 93, 251, 0.12);
}

.search > svg {
  color: var(--muted);
  flex: none;
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14px;
  -webkit-appearance: none;
  appearance: none;
}

.search input::-webkit-search-cancel-button {
  display: none;
}

.search-clear {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #e2e6f2;
  color: #5c657a;
  flex: none;
}

.select {
  height: 38px;
  padding: 0 30px 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background-color: #f7f8fc;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2378829a' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-soft);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  flex: none;
}

.select:focus {
  outline: none;
  border-color: #c2c8ff;
  background-color: #fff;
}

.menu-wrap {
  position: relative;
  flex: none;
}

.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 176px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  z-index: 50;
  animation: pop 0.14s ease both;
}

.menu button {
  padding: 9px 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  text-align: left;
  font-size: 13.5px;
  color: var(--ink-soft);
}

.menu button:hover {
  background: #f2f4fa;
  color: var(--ink);
}

.menu button.danger {
  color: var(--danger);
}

.menu button.danger:hover {
  background: var(--danger-soft);
}

/* ------------------------------------------------------------------
   主体 / 书签
------------------------------------------------------------------ */

main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px 24px 48px;
}

.view {
  animation: fade 0.28s ease both;
}

.quick {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  min-width: 0;
}

.quick-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--muted);
  white-space: nowrap;
}

.quick-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 4px;
  scrollbar-width: none;
}

.quick-list::-webkit-scrollbar {
  display: none;
}

.quick-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 13px 5px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.quick-item:hover {
  border-color: #c7ccff;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(77, 93, 251, 0.14);
}

.quick-item .fav {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  font-size: 11px;
}

.cat-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #4a5468;
  font-size: 13.5px;
  font-weight: 600;
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease,
    background 0.16s ease;
}

.chip:hover {
  border-color: #c9cfff;
  transform: translateY(-1px);
}

.chip span {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: #f1f3fa;
  border-radius: 999px;
  padding: 2px 7px;
  min-width: 20px;
  text-align: center;
}

.chip.active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 8px 18px rgba(77, 93, 251, 0.26);
}

.chip.active span {
  color: #fff;
  background: rgba(255, 255, 255, 0.22);
}

.group {
  margin-bottom: 32px;
}

.group-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
}

.group-head h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-size: 15.5px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.swatch {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}

.swatch.s1 { background: linear-gradient(135deg, #f59e0b, #f97316); }
.swatch.s2 { background: linear-gradient(135deg, #10b981, #14b8a6); }
.swatch.s3 { background: linear-gradient(135deg, #ec4899, #f43f5e); }
.swatch.s4 { background: linear-gradient(135deg, #0ea5e9, #6366f1); }
.swatch.s5 { background: linear-gradient(135deg, #8b5cf6, #d946ef); }

.count {
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
}

.link-btn {
  margin-left: auto;
  padding: 4px 6px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--brand);
  font-size: 12.5px;
  font-weight: 600;
}

.link-btn:hover {
  background: var(--brand-soft);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(252px, 1fr));
  gap: 14px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 116px;
  padding: 14px 14px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: #d8dcff;
  box-shadow: 0 14px 30px rgba(36, 46, 100, 0.1);
}

.card-link {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  color: inherit;
}

.fav {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 11px;
  overflow: hidden;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  text-transform: uppercase;
}

.fav img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #fff;
}

.fav.c1 { background: linear-gradient(135deg, #0ea5e9, #2563eb); }
.fav.c2 { background: linear-gradient(135deg, #10b981, #0d9488); }
.fav.c3 { background: linear-gradient(135deg, #f59e0b, #ea580c); }
.fav.c4 { background: linear-gradient(135deg, #ec4899, #db2777); }
.fav.c5 { background: linear-gradient(135deg, #64748b, #334155); }

.card-titles {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-titles h3 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.host {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note {
  margin: 9px 0 8px;
  font-size: 12.5px;
  line-height: 1.55;
  color: #5a6379;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.note.muted {
  color: #a9b1c1;
}

.card-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  padding-top: 4px;
}

.tag {
  max-width: 96px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #f1f3fa;
  color: #5a6379;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.visits {
  font-size: 10.5px;
  color: #a3abbb;
  white-space: nowrap;
}

.spacer {
  flex: 1;
}

.card-foot .icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.card-foot .icon-btn svg {
  width: 16px;
  height: 16px;
}

.empty-slot {
  width: 100%;
  padding: 22px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.55);
  color: var(--muted);
  font-size: 13px;
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}

.empty-slot:hover {
  border-color: #b9c0ff;
  color: var(--brand);
  background: #fbfbff;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 64px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.6);
}

.empty-state .empty-art {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: var(--brand);
  background: var(--brand-soft);
  margin-bottom: 16px;
}

.empty-state h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.empty-state p {
  margin: 0 0 18px;
  max-width: 380px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.page-foot {
  margin-top: 34px;
  padding-top: 16px;
  border-top: 1px solid rgba(228, 232, 242, 0.8);
  color: #9aa3b5;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* ------------------------------------------------------------------
   文件库
------------------------------------------------------------------ */

.files-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  margin-bottom: 22px;
}

.dropzone {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px;
  border: 1.5px dashed #c9cfff;
  border-radius: 20px;
  background: linear-gradient(180deg, #fbfbff, #f7f8ff);
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.dropzone:hover,
.dropzone.drag {
  border-color: var(--brand);
  background: #f2f3ff;
}

.dropzone.drag {
  transform: scale(1.005);
}

.drop-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 14px;
  color: var(--brand);
  background: #fff;
  box-shadow: 0 6px 16px rgba(77, 93, 251, 0.14);
}

.drop-copy {
  min-width: 0;
  flex: 1;
}

.drop-copy strong {
  display: block;
  font-size: 14.5px;
  margin-bottom: 4px;
}

.drop-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.storage-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.storage-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
}

.storage-top strong {
  color: var(--ink-soft);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.meter {
  height: 7px;
  border-radius: 999px;
  background: #eef0f8;
  overflow: hidden;
}

.meter > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  transition: width 0.35s ease, background 0.2s ease;
}

.meter > span.warn {
  background: linear-gradient(90deg, #f59e0b, #f97316);
}

.meter > span.full {
  background: linear-gradient(90deg, #ef4444, #dc2626);
}

.storage-card p {
  margin: 0;
  color: #9aa3b5;
  font-size: 11.5px;
}

.files-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.seg {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: 11px;
  background: #eff1f8;
}

.seg-btn {
  height: 30px;
  padding: 0 13px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.seg-btn.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 2px 6px rgba(24, 32, 51, 0.08);
}

.files-count {
  margin-left: auto;
  color: #9aa3b5;
  font-size: 12px;
}

.file-list {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.file-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 86px 96px 62px 156px;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid #f0f2f8;
  transition: background 0.15s ease;
}

.file-row:last-child {
  border-bottom: 0;
}

.file-row:hover {
  background: #fbfbff;
}

.file-type {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #fff;
  background: linear-gradient(135deg, #64748b, #475569);
}

.file-type.t-img { background: linear-gradient(135deg, #10b981, #0d9488); }
.file-type.t-pdf { background: linear-gradient(135deg, #ef4444, #dc2626); }
.file-type.t-doc { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.file-type.t-sheet { background: linear-gradient(135deg, #22c55e, #15803d); }
.file-type.t-archive { background: linear-gradient(135deg, #f59e0b, #d97706); }
.file-type.t-media { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.file-type.t-text { background: linear-gradient(135deg, #64748b, #334155); }

.file-main {
  min-width: 0;
}

.file-name {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-name .file-star {
  color: #f0a029;
  font-size: 12px;
  flex: none;
}

.file-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size,
.file-date,
.file-downloads {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.file-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}

.file-actions .icon-btn {
  width: 28px;
  height: 28px;
}

.file-actions .icon-btn svg {
  width: 16px;
  height: 16px;
}

.file-sub-meta {
  display: none;
}

.file-list.empty-wrap {
  border: 0;
  background: transparent;
  box-shadow: none;
}

/* ------------------------------------------------------------------
   上传队列
------------------------------------------------------------------ */

.upload-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  width: min(360px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: rise 0.22s ease both;
}

.upload-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px 12px 16px;
  border-bottom: 1px solid #f0f2f8;
}

.upload-head strong {
  font-size: 13px;
}

.upload-items {
  max-height: 46vh;
  overflow-y: auto;
  padding: 6px 0;
}

.upload-item {
  padding: 9px 16px;
}

.upload-item + .upload-item {
  border-top: 1px solid #f5f6fa;
}

.upload-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
}

.upload-line .upload-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink-soft);
  font-weight: 500;
}

.upload-line .upload-state {
  flex: none;
  color: var(--muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.upload-item.error .upload-state {
  color: var(--danger);
}

.upload-bar {
  margin-top: 6px;
  height: 4px;
  border-radius: 999px;
  background: #eef0f8;
  overflow: hidden;
}

.upload-bar > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  transition: width 0.18s linear;
}

.upload-item.error .upload-bar > span {
  background: var(--danger);
}

.upload-cancel {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  padding: 0 2px;
}

.upload-cancel:hover {
  color: var(--danger);
}

/* ------------------------------------------------------------------
   弹窗
------------------------------------------------------------------ */

dialog {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
}

.sheet {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  padding: 22px 24px 20px;
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--shadow-lg);
}

dialog[open] {
  animation: pop 0.18s ease both;
}

dialog::backdrop {
  background: rgba(20, 26, 45, 0.45);
  backdrop-filter: blur(3px);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.sheet-head h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.grid2 {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.sheet .field + .field {
  margin-top: 14px;
}

.sheet-foot {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 20px;
}

.hint {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.cat-add {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.cat-add input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fafbfe;
  font-size: 14px;
  outline: none;
}

.cat-add input:focus {
  border-color: #b9c0ff;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(77, 93, 251, 0.12);
}

.cat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.cat-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 12px;
  border-bottom: 1px solid #f0f2f8;
}

.cat-list li:last-child {
  border-bottom: 0;
}

.cat-input {
  flex: 1;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  outline: none;
}

.cat-input:hover {
  background: #f8f9fd;
}

.cat-input:focus {
  background: #fff;
  border-color: #b9c0ff;
  box-shadow: 0 0 0 3px rgba(77, 93, 251, 0.12);
}

.cat-list .count {
  flex: none;
}

/* 预览 */

.preview-dialog {
  width: min(1040px, calc(100vw - 28px));
  max-height: calc(100dvh - 40px);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.preview-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.preview-title {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.preview-title strong {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-title span {
  color: var(--muted);
  font-size: 11.5px;
}

.preview-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.preview-body {
  min-height: 240px;
  height: min(72vh, 760px);
  background: #f6f7fb;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}

.preview-body img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.preview-body.is-image {
  height: auto;
  min-height: 0;
  padding: 14px;
}

.preview-body.is-image img {
  max-height: calc(72vh - 28px);
}

.preview-body iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.preview-body pre {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  padding: 20px 22px;
  background: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.65;
  color: #2b3548;
  white-space: pre-wrap;
  word-break: break-word;
  align-self: flex-start;
}

.preview-body .preview-note {
  max-width: 420px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.preview-loading {
  color: var(--muted);
  font-size: 13px;
}

/* ------------------------------------------------------------------
   Toast
------------------------------------------------------------------ */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 90;
  max-width: min(420px, calc(100vw - 40px));
  padding: 10px 16px;
  border-radius: 12px;
  background: #202a44;
  color: #fff;
  font-size: 13px;
  box-shadow: 0 16px 40px rgba(16, 24, 50, 0.3);
  transform: translate(-50%, 14px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  background: #b3261e;
}

/* ------------------------------------------------------------------
   动画
------------------------------------------------------------------ */

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pop {
  from { opacity: 0; transform: translateY(6px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ------------------------------------------------------------------
   响应式
------------------------------------------------------------------ */

@media (max-width: 1024px) {
  .bar-inner {
    flex-wrap: wrap;
    row-gap: 10px;
  }

  .tools {
    flex-basis: 100%;
    order: 3;
    margin-left: 0;
  }

  .search {
    flex: 1 1 auto;
    max-width: none;
  }

  .files-head {
    grid-template-columns: 1fr;
  }

  .storage-card {
    padding: 14px 16px;
  }
}

@media (max-width: 860px) {
  .file-row {
    grid-template-columns: 40px minmax(0, 1fr);
    grid-template-areas:
      "type main"
      "actions actions";
    row-gap: 8px;
    padding: 12px;
  }

  .file-type { grid-area: type; }
  .file-main { grid-area: main; }
  .file-actions { grid-area: actions; }

  .file-size,
  .file-date,
  .file-downloads {
    display: none;
  }

  .file-sub-meta {
    display: inline;
  }
}

@media (max-width: 720px) {
  .bar-inner {
    padding: 10px 16px;
    gap: 10px;
  }

  main {
    padding: 16px 16px 40px;
  }

  .brand-name {
    font-size: 15px;
  }

  .tab {
    padding: 0 12px;
  }

  .tools {
    gap: 8px;
  }

  .search {
    min-width: 0;
    flex: 1 1 140px;
  }

  .select {
    flex: none;
    max-width: 116px;
  }

  .btn.primary {
    padding: 0 13px;
  }

  .cat-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin: 0 -16px 22px;
    padding: 2px 16px 6px;
    scrollbar-width: none;
  }

  .cat-chips::-webkit-scrollbar {
    display: none;
  }

  .chip {
    flex: none;
  }

  .cards {
    grid-template-columns: 1fr;
  }

  .quick {
    margin-bottom: 14px;
  }

  .dropzone {
    flex-wrap: wrap;
    padding: 16px;
  }

  .drop-copy {
    order: 3;
    flex-basis: 100%;
  }

  .dropzone .btn {
    margin-left: auto;
  }

  .grid2 {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .login-card {
    padding: 28px 24px 22px;
  }

  .preview-body {
    height: min(66vh, 520px);
    min-height: 200px;
  }

  .page-foot {
    font-size: 11.5px;
  }

  .upload-panel {
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
  }
}

@media (max-width: 560px) {
  .tools {
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
  }

  .search {
    flex: 1 1 100%;
    order: 1;
  }

  .select {
    order: 2;
    max-width: 128px;
  }

  .tools > .btn.primary {
    order: 3;
    flex: 1 1 auto;
  }

  .menu-wrap {
    order: 4;
  }
}

@media (max-width: 420px) {
  .brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 9px;
  }

  .tabs {
    margin-left: auto;
  }

  .tab {
    height: 28px;
    padding: 0 10px;
    font-size: 12.5px;
  }

  .select {
    max-width: 104px;
    padding-left: 9px;
    font-size: 12.5px;
  }

  .btn.primary {
    font-size: 13px;
  }

  .card {
    padding: 13px 13px 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
