:root {
  --bg: #0b1020;
  --surface: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --accent-2: #7c3aed;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.10);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

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

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

button, input, select, textarea { font-family: inherit; }
button { -webkit-appearance: none; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(100, 116, 139, 0.35); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(100, 116, 139, 0.55); }

/* ============ 启动器 ============ */
.launcher { position: fixed; inset: 0; overflow: hidden; }

.wall {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: calc(10px + var(--safe-top)) 20px calc(16px + var(--safe-bottom));
  background:
    radial-gradient(900px 620px at 18% 6%, #26386e 0%, rgba(38, 56, 110, 0) 62%),
    radial-gradient(760px 560px at 84% 22%, #4b2a6b 0%, rgba(75, 42, 107, 0) 58%),
    radial-gradient(900px 700px at 30% 100%, #123a52 0%, rgba(18, 58, 82, 0) 60%),
    linear-gradient(160deg, #0e1428 0%, #0a0e1c 55%, #070a14 100%);
}

.wall::before,
.wall::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.5;
  pointer-events: none;
}

.wall::before {
  width: 320px;
  height: 320px;
  left: -80px;
  top: 8%;
  background: radial-gradient(circle, #3b82f6, transparent 70%);
}

.wall::after {
  width: 380px;
  height: 380px;
  right: -120px;
  bottom: 4%;
  background: radial-gradient(circle, #8b5cf6, transparent 70%);
}

.statusbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  font-weight: 600;
  padding: 2px 6px;
  letter-spacing: 0.2px;
}

.status-right { display: flex; align-items: center; gap: 7px; }
.status-right svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.status-right svg.battery { width: 21px; }
.status-right .fill { fill: currentColor; stroke: none; }

.clockwidget {
  position: relative;
  z-index: 2;
  text-align: center;
  margin-top: clamp(28px, 7vh, 64px);
  color: #fff;
  user-select: none;
}

.clock {
  font-size: clamp(52px, 13vw, 82px);
  font-weight: 200;
  line-height: 1;
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 6px 30px rgba(0, 0, 0, 0.4);
}

.date {
  margin-top: 12px;
  font-size: 13.5px;
  letter-spacing: 1px;
  opacity: 0.7;
}

.appgrid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px 8px;
  width: 100%;
  max-width: 520px;
  margin: clamp(28px, 6vh, 52px) auto 0;
  align-content: start;
  flex: 1;
}

.app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 6px 2px;
  border: none;
  background: none;
  color: #fff;
  cursor: pointer;
  border-radius: 16px;
  user-select: none;
  transition: transform 0.16s ease;
}

.app:hover .app-icon { transform: translateY(-2px); }
.app:active { transform: scale(0.92); }

.app-icon {
  position: relative;
  width: clamp(56px, 14vw, 64px);
  aspect-ratio: 1;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--c1), var(--c2));
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  overflow: hidden;
  transition: transform 0.2s ease;
}

.app-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0) 55%);
  pointer-events: none;
}

.app-icon svg {
  position: relative;
  z-index: 1;
  width: 54%;
  height: 54%;
  stroke: #fff;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}

.app-label {
  max-width: 100%;
  font-size: 12.5px;
  color: #fff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dock {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 330px;
  margin: 18px auto 0;
  padding: 10px 12px;
  display: flex;
  justify-content: space-around;
  gap: 6px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.dock .app { gap: 0; }
.dock .app-icon { width: 50px; border-radius: 16px; }
.dock .app-label { display: none; }

/* ============ 应用窗口 ============ */
.app-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  background: #f5f6fa;
  animation: appOpen 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.app-screen[hidden] { display: none; }

@keyframes appOpen {
  from { transform: translateY(26px) scale(0.988); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.appbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 2px;
  height: calc(56px + var(--safe-top));
  padding: var(--safe-top) 8px 0;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 6;
}

.appbar-title {
  flex: 1;
  min-width: 0;
  margin-left: 2px;
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appbar-actions { display: flex; align-items: center; gap: 4px; flex: none; }

.iconbtn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #1f2937;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.iconbtn:hover { background: #f1f2f6; }
.iconbtn:active { transform: scale(0.94); }

.iconbtn svg,
.btn svg,
.mini svg {
  width: 21px;
  height: 21px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mini svg { width: 17px; height: 17px; }

.appbody {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.appbody.no-scroll { overflow: hidden; }

/* ============ 通用组件 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: #1f2937;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease, filter 0.15s ease;
}

.btn:hover { background: #f7f8fb; }
.btn:active { transform: scale(0.97); }
.btn svg { width: 17px; height: 17px; }

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn.primary:hover { filter: brightness(1.07); }

.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: #eef0f5; }

.btn.danger { color: #dc2626; border-color: #fecaca; background: #fff5f5; }

.btn[disabled] { opacity: 0.5; pointer-events: none; }

.panel {
  max-width: 980px;
  margin: 0 auto;
  padding: 14px 16px calc(34px + var(--safe-bottom));
}

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

.crumbs {
  flex: 1;
  min-width: 130px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1px;
  font-size: 13px;
}

.crumb {
  padding: 5px 7px;
  border: none;
  border-radius: 7px;
  background: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crumb:hover { background: #eef0f5; color: var(--ink); }
.crumb.current { color: var(--ink); font-weight: 600; }
.crumb-sep { color: #c3c7d1; font-size: 12px; padding: 0 1px; }

.empty {
  padding: 52px 20px;
  text-align: center;
  color: #9aa1ae;
  font-size: 14px;
  line-height: 1.7;
}

.empty svg {
  width: 42px;
  height: 42px;
  margin-bottom: 8px;
  stroke: #c6ccd8;
  fill: none;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.loading { padding: 40px 20px; text-align: center; color: #9aa1ae; font-size: 14px; }

/* ============ 文件 ============ */
.filelist {
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid #f1f2f6;
}

.file-row:last-child { border-bottom: none; }
.file-row:hover { background: #fafbfe; }
.file-row.dir { cursor: pointer; }

.file-ico {
  flex: none;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #f1f5f9;
  color: #64748b;
}

.file-ico svg {
  width: 21px;
  height: 21px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.file-ico.dir { background: #eef4ff; color: #2563eb; }
.file-ico.img { background: #fff4e6; color: #ea580c; }
.file-ico.vid { background: #f3e8ff; color: #7c3aed; }
.file-ico.aud { background: #e0f7f1; color: #0d9488; }
.file-ico.pdf { background: #feecec; color: #dc2626; }
.file-ico.zip { background: #fff7e0; color: #b45309; }
.file-ico.code { background: #eef2ff; color: #4f46e5; }

.file-meta { flex: 1; min-width: 0; }
.file-name { font-size: 14.5px; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-sub { margin-top: 2px; font-size: 12px; color: #9aa1ae; }

.file-actions { display: flex; gap: 2px; opacity: 0; transition: opacity 0.15s ease; }
.file-row:hover .file-actions,
.file-row:focus-within .file-actions { opacity: 1; }

.mini {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
}

.mini:hover { background: #eef0f5; color: var(--ink); }
.mini.danger:hover { background: #fff1f2; color: #dc2626; }

.dropzone { outline: 3px dashed rgba(37, 99, 235, 0.5); outline-offset: -6px; border-radius: 14px; }

.hint { margin-top: 12px; font-size: 12px; color: #9aa1ae; text-align: center; }

/* ============ 相册 ============ */
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 14px;
}

.album-card {
  position: relative;
  aspect-ratio: 1;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(145deg, #dbe4f5, #c7d4ee);
  box-shadow: var(--shadow);
  cursor: pointer;
}

.album-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.album-card:hover img { transform: scale(1.06); }

.album-card .album-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #93a3c4;
}

.album-card .album-fallback svg { width: 40%; height: 40%; stroke: currentColor; fill: none; stroke-width: 1.2; }

.album-info {
  position: absolute;
  inset: auto 0 0 0;
  padding: 28px 12px 11px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.74));
  color: #fff;
  pointer-events: none;
}

.album-name { font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.album-count { margin-top: 2px; font-size: 12px; opacity: 0.8; }

.album-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.album-tools .grow { flex: 1; }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
  gap: 8px;
}

.photo-cell {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: #e9edf5;
  cursor: zoom-in;
}

.photo-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.photo-cell:hover img { transform: scale(1.05); }

/* ============ 灯箱 ============ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 7, 14, 0.94);
  animation: fadeIn 0.18s ease;
}

.lightbox img {
  max-width: calc(100vw - 20px);
  max-height: calc(100vh - 130px);
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  user-select: none;
}

.lb-top {
  position: absolute;
  top: calc(10px + var(--safe-top));
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #fff;
}

.lb-title { font-size: 13px; opacity: 0.75; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-actions { display: flex; gap: 8px; }

.lb-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.lb-btn:hover { background: rgba(255, 255, 255, 0.22); }
.lb-btn svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.lb-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
}

.lb-arrow:hover { background: rgba(255, 255, 255, 0.2); }
.lb-arrow.left { left: 10px; }
.lb-arrow.right { right: 10px; }
.lb-arrow svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.lb-bottom {
  position: absolute;
  bottom: calc(14px + var(--safe-bottom));
  left: 0;
  right: 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
  letter-spacing: 0.5px;
}

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

/* ============ 文档 ============ */
.docs-layout {
  display: grid;
  grid-template-columns: 252px 1fr;
  height: 100%;
}

.docs-side {
  border-right: 1px solid var(--line);
  background: #fbfcff;
  overflow: auto;
  padding: 8px 8px 24px;
}

.docs-side-head {
  display: flex;
  gap: 4px;
  padding: 4px 4px 8px;
  position: sticky;
  top: 0;
  background: #fbfcff;
  z-index: 2;
}

.docs-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  background: #fff;
}

.docs-toolbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.docs-title {
  flex: 1;
  min-width: 80px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.docs-edit {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.docs-edit.single { grid-template-columns: 1fr; }
.docs-edit.single .docs-preview { display: none; }
.docs-edit.single.show-preview { grid-template-columns: 1fr; }
.docs-edit.single.show-preview .docs-editor { display: none; }
.docs-edit.single.show-preview .docs-preview { display: block; }

.docs-editor {
  min-width: 0;
  min-height: 0;
  display: flex;
}

.docs-editor textarea {
  flex: 1;
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  padding: 18px 20px;
  font: 14.5px/1.8 var(--mono);
  color: #1f2937;
  background: #fff;
  tab-size: 2;
}

.docs-preview {
  min-width: 0;
  overflow: auto;
  padding: 18px 26px calc(60px + var(--safe-bottom));
  border-left: 1px solid var(--line);
  background: #fff;
}

.docs-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #9aa1ae;
  font-size: 14px;
  text-align: center;
  padding: 30px;
}

.docs-empty svg { width: 46px; height: 46px; stroke: #c6ccd8; fill: none; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }

.preview-toggle { display: none; }

@media (max-width: 820px) {
  .preview-toggle { display: inline-flex; }
}

.tree-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 8px;
  border-radius: 8px;
  font-size: 13.5px;
  color: #3f4653;
  cursor: pointer;
  user-select: none;
}

.tree-item:hover { background: #eef1f7; }
.tree-item.active { background: #e5edff; color: #1d4ed8; font-weight: 600; }
.tree-item.folder-active { color: #1d4ed8; }

.tree-item .tw {
  flex: none;
  width: 14px;
  height: 14px;
  display: grid;
  place-items: center;
  color: #9aa1ae;
  transition: transform 0.15s ease;
}

.tree-item .tw svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.tree-item.open .tw { transform: rotate(90deg); }

.tree-item .tico { flex: none; width: 16px; height: 16px; color: #8b93a3; }
.tree-item .tico svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.tree-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-children { margin-left: 14px; padding-left: 4px; border-left: 1px solid #eceef3; }

/* markdown 渲染 */
.md { color: #24292f; font-size: 15px; line-height: 1.8; word-wrap: break-word; }
.md > :first-child { margin-top: 0; }
.md h1, .md h2, .md h3, .md h4 { font-weight: 650; line-height: 1.35; margin: 1.3em 0 0.6em; }
.md h1 { font-size: 1.72em; padding-bottom: 0.3em; border-bottom: 1px solid #eaecef; }
.md h2 { font-size: 1.4em; padding-bottom: 0.25em; border-bottom: 1px solid #eaecef; }
.md h3 { font-size: 1.16em; }
.md h4 { font-size: 1em; }
.md p { margin: 0.72em 0; }
.md a { color: var(--accent); text-decoration: none; }
.md a:hover { text-decoration: underline; }
.md code { background: #f2f4f8; padding: 0.15em 0.4em; border-radius: 5px; font-size: 0.88em; font-family: var(--mono); }
.md pre { background: #0f172a; color: #e2e8f0; padding: 14px 16px; border-radius: 10px; overflow: auto; line-height: 1.6; }
.md pre code { background: none; padding: 0; color: inherit; font-size: 0.86em; }
.md blockquote { margin: 0.8em 0; padding: 0.1em 1em; border-left: 3px solid #d0d7de; color: #57606a; background: #f6f8fa; border-radius: 0 8px 8px 0; }
.md ul, .md ol { padding-left: 1.6em; margin: 0.6em 0; }
.md li { margin: 0.25em 0; }
.md table { border-collapse: collapse; margin: 1em 0; display: block; overflow: auto; width: 100%; }
.md th, .md td { border: 1px solid #d0d7de; padding: 6px 12px; }
.md th { background: #f6f8fa; font-weight: 600; }
.md img { max-width: 100%; border-radius: 8px; }
.md hr { border: none; border-top: 1px solid #e5e7eb; margin: 1.6em 0; }
.md input[type="checkbox"] { margin-right: 0.4em; }

/* ============ MQTT ============ */
.mq-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow);
  font-size: 13px;
  color: #4b5563;
}

.mq-status .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #cbd5e1;
  box-shadow: 0 0 0 3px rgba(203, 213, 225, 0.25);
}

.dot.on { background: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18); }

.mq-form {
  display: grid;
  gap: 10px;
  padding: 14px;
  margin-bottom: 14px;
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.field label { display: block; margin-bottom: 5px; font-size: 12px; font-weight: 500; color: #6b7280; }

.input, select.input, textarea.input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #dfe3ea;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:focus { border-color: #93b4ff; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }

textarea.input { min-height: 78px; resize: vertical; font-family: var(--mono); font-size: 13px; line-height: 1.55; }

.row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.row .field { flex: 1; min-width: 110px; }
.row .check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #4b5563; padding-bottom: 10px; }

.mq-list { display: flex; flex-direction: column; gap: 8px; }

.mq-msg {
  padding: 10px 13px;
  background: #fff;
  border-radius: 12px;
  border-left: 3px solid #8b5cf6;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}

.mq-head { display: flex; align-items: baseline; gap: 10px; }
.mq-topic { font-size: 13px; font-weight: 600; color: #6d28d9; word-break: break-all; }
.mq-time { margin-left: auto; flex: none; font-size: 11px; color: #9aa1ae; font-variant-numeric: tabular-nums; }

.mq-payload {
  margin: 8px 0 0;
  padding: 8px 10px;
  max-height: 220px;
  overflow: auto;
  background: #f7f8fb;
  border-radius: 8px;
  font: 12.5px/1.55 var(--mono);
  color: #374151;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ============ API 页 ============ */
.api-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 14px;
}

.api-card h4 {
  margin: 0;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  background: #fafbfe;
  border-bottom: 1px solid #f1f2f6;
}

.api-item { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid #f6f7fa; }
.api-item:last-child { border-bottom: none; }

.api-method {
  flex: none;
  margin-top: 1px;
  padding: 4px 7px;
  border-radius: 6px;
  background: #eef2ff;
  color: #4338ca;
  font: 600 11px/1 var(--mono);
}

.api-method.post { background: #fff1e8; color: #c2410c; }

.api-path { font: 13px/1.45 var(--mono); color: var(--ink); word-break: break-all; }
.api-desc { margin-top: 3px; font-size: 12px; color: #8a92a0; }

.api-note { font-size: 12.5px; color: #6b7280; line-height: 1.7; padding: 0 2px 12px; }

/* ============ 弹窗 / 提示 ============ */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.44);
  backdrop-filter: blur(2px);
  animation: fadeIn 0.15s ease;
}

.modal {
  width: 100%;
  max-width: 380px;
  padding: 20px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
  animation: pop 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.modal h3 { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.modal p { margin: 0 0 14px; font-size: 13.5px; line-height: 1.55; color: #6b7280; white-space: pre-wrap; }
.modal .input { margin-top: 2px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

@keyframes pop { from { transform: scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + var(--safe-bottom));
  z-index: 200;
  transform: translateX(-50%);
  max-width: 90vw;
  padding: 10px 16px;
  border-radius: 10px;
  background: rgba(17, 24, 39, 0.94);
  color: #fff;
  font-size: 13.5px;
  text-align: center;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.32);
  animation: toastIn 0.2s ease;
}

@keyframes toastIn { from { transform: translate(-50%, 8px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

.progress-wrap {
  position: fixed;
  left: 50%;
  bottom: calc(28px + var(--safe-bottom));
  z-index: 210;
  transform: translateX(-50%);
  width: min(88vw, 360px);
  padding: 11px 14px;
  border-radius: 12px;
  background: rgba(17, 24, 39, 0.95);
  color: #fff;
  font-size: 12.5px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.34);
}

.progress-track { margin-top: 8px; height: 5px; border-radius: 4px; background: rgba(255, 255, 255, 0.2); overflow: hidden; }
.progress-bar { height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, #60a5fa, #a78bfa); transition: width 0.15s ease; }

/* ============ 登录 ============ */
.login-page {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 700px at 18% 8%, #23335f 0%, rgba(35, 51, 95, 0) 60%),
    radial-gradient(800px 600px at 86% 90%, #3d2260 0%, rgba(61, 34, 96, 0) 60%),
    linear-gradient(160deg, #0d1326 0%, #080b15 100%);
}

.login-card {
  width: 100%;
  max-width: 366px;
  padding: 32px 26px 28px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.075);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.45);
  color: #fff;
}

.login-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 10px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(145deg, #3b82f6, #7c3aed);
  box-shadow: 0 14px 34px rgba(59, 130, 246, 0.4);
}

.login-logo svg { width: 32px; height: 32px; stroke: #fff; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.login-card h1 { margin: 10px 0 4px; font-size: 20px; font-weight: 600; text-align: center; letter-spacing: 0.5px; }
.login-card .sub { margin-bottom: 24px; font-size: 12.5px; text-align: center; color: rgba(255, 255, 255, 0.5); letter-spacing: 0.5px; }

.login-field { margin-bottom: 14px; }
.login-field label { display: block; margin-bottom: 6px; font-size: 12px; color: rgba(255, 255, 255, 0.55); }

.login-card .input {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  color: #fff;
  height: 44px;
}

.login-card .input::placeholder { color: rgba(255, 255, 255, 0.35); }
.login-card .input:focus { border-color: rgba(147, 180, 255, 0.85); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18); }

.login-card .btn.primary {
  width: 100%;
  height: 44px;
  margin-top: 8px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #3b82f6, #7c3aed);
  font-size: 15px;
}

.login-error { min-height: 18px; margin-top: 10px; font-size: 13px; text-align: center; color: #fca5a5; }

.login-card .btn.ghost {
  width: 100%;
  height: 42px;
  margin-top: 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 14px;
}

.shake { animation: shake 0.4s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

/* ============ 响应式 ============ */
@media (max-width: 820px) {
  .docs-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(90px, 34%) 1fr;
  }

  .docs-side {
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding-bottom: 8px;
  }

  .docs-edit { grid-template-columns: 1fr; }
  .docs-edit:not(.single) .docs-preview { display: none; }
  .docs-edit:not(.single).show-preview { grid-template-columns: 1fr; }
  .docs-edit:not(.single).show-preview .docs-editor { display: none; }
  .docs-edit:not(.single).show-preview .docs-preview { display: block; border-left: none; }
}

@media (min-width: 821px) {
  .docs-edit.single { grid-template-columns: 1fr; }
  .docs-edit.single.show-preview { grid-template-columns: 1fr; }
}

@media (max-width: 380px) {
  .album-grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
  .file-actions { opacity: 1; }
}

body.guest .guest-hide { display: none !important; }
