/* =========================================================
   Nebula Nav · 星云导航
   设计基调：极地夜空的深蓝底 + 极光青/紫，低对比描边卡片
   ========================================================= */

:root {
  --bg: #070a12;
  --bg-deep: #05070d;
  --panel: #0d1420;
  --panel-2: #111a29;
  --panel-3: #16203180;
  --line: rgba(150, 180, 220, 0.13);
  --line-strong: rgba(150, 180, 220, 0.26);
  --text: #e7eef8;
  --muted: #8ea0b8;
  --dim: #61728a;
  --aurora: #4be1c0;
  --aurora-2: #8b7bff;
  --aurora-3: #59a8ff;
  --danger: #ff7a6b;
  --ok: #57d9a3;
  --radius: 14px;
  --radius-sm: 9px;
  --font: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei",
    system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;

  /* 表面色由基础色派生：换主题只改上面的基础值 */
  --surface: color-mix(in srgb, var(--panel) 82%, transparent);
  --surface-strong: color-mix(in srgb, var(--panel-2) 94%, transparent);
  --control: color-mix(in srgb, var(--bg) 72%, transparent);
  --card-top: color-mix(in srgb, var(--panel-2) 50%, transparent);
  --card-bottom: color-mix(in srgb, var(--bg) 50%, transparent);
  --card-hover-top: color-mix(in srgb, var(--panel-2) 72%, transparent);
  --card-hover-bottom: color-mix(in srgb, var(--panel) 72%, transparent);
  --icon-bg: color-mix(in srgb, var(--panel-2) 88%, #000 12%);
  --input-bg: color-mix(in srgb, var(--bg-deep) 85%, transparent);
  --block-bg: color-mix(in srgb, var(--panel) 62%, transparent);
  --modal-top: var(--panel-2);
  --modal-bottom: var(--panel);
  --gate-top: color-mix(in srgb, var(--panel-2) 92%, transparent);
  --gate-bottom: color-mix(in srgb, var(--bg-deep) 96%, transparent);
  --sidebar: color-mix(in srgb, var(--bg-deep) 86%, transparent);

  /* 叠加层、阴影与代码块：浅色主题会整体覆盖这些值 */
  --soft-1: rgba(255, 255, 255, 0.03);
  --soft-2: rgba(255, 255, 255, 0.07);
  --hover-1: rgba(255, 255, 255, 0.04);
  --hover-2: rgba(255, 255, 255, 0.025);
  --btn-bg: rgba(255, 255, 255, 0.06);
  --btn-bg-hover: rgba(255, 255, 255, 0.1);
  --code-bg: rgba(255, 255, 255, 0.06);
  --code-fg: #cfe0f2;
  --danger-fg: #ffd7d2;
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.55);
  --shadow-xl: 0 30px 80px rgba(0, 0, 0, 0.6);
  --mask-bg: rgba(3, 6, 11, 0.72);
}

/* ------------------------------------------------------------ 访客 IP */
.clock-stack {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
/* 同步徽章：贴时钟下方，宽度与时钟一致，不参与横向布局 */
.clock-stack #syncBadge {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  justify-content: center;
}
.visitor-ip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--control);
  color: var(--muted);
  font-size: 12.5px;
  cursor: default;
  user-select: none;
}
.visitor-ip-text {
  font-family: var(--mono);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.visitor-flag {
  width: 18px;
  height: 13px;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.28);
}
.visitor-flag-local {
  display: inline-grid;
  place-items: center;
  width: auto;
  min-width: 20px;
  height: 13px;
  padding: 0 3px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--aurora) 18%, transparent);
  color: var(--aurora);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  box-shadow: none;
}

/* ------------------------------------------------------------ 主题预设 */
html[data-theme="ocean"] {
  --bg: #050d18;
  --bg-deep: #03080f;
  --panel: #0b1727;
  --panel-2: #0f2033;
  --line: rgba(130, 180, 240, 0.14);
  --line-strong: rgba(130, 180, 240, 0.3);
  --text: #e6f0ff;
  --muted: #8fa6c4;
  --dim: #5d7392;
  --aurora: #4ea8ff;
  --aurora-2: #7b8cff;
  --aurora-3: #6fd6ff;
}

html[data-theme="forest"] {
  --bg: #06110c;
  --bg-deep: #040b08;
  --panel: #0c1a13;
  --panel-2: #11241a;
  --line: rgba(140, 220, 180, 0.14);
  --line-strong: rgba(140, 220, 180, 0.3);
  --text: #e8f6ee;
  --muted: #8fb2a0;
  --dim: #5f8271;
  --aurora: #4be1a0;
  --aurora-2: #9ad86b;
  --aurora-3: #3fd0c0;
}

html[data-theme="dusk"] {
  --bg: #0a0714;
  --bg-deep: #06040d;
  --panel: #140f24;
  --panel-2: #1b1430;
  --line: rgba(200, 160, 255, 0.14);
  --line-strong: rgba(200, 160, 255, 0.3);
  --text: #f1e9ff;
  --muted: #a99bc4;
  --dim: #756890;
  --aurora: #c084fc;
  --aurora-2: #f472b6;
  --aurora-3: #7c8bff;
}

html[data-theme="sunset"] {
  --bg: #120906;
  --bg-deep: #0b0504;
  --panel: #1d0f0a;
  --panel-2: #28150d;
  --line: rgba(255, 190, 150, 0.14);
  --line-strong: rgba(255, 190, 150, 0.3);
  --text: #fff1e6;
  --muted: #c4a294;
  --dim: #8f6f61;
  --aurora: #ffb347;
  --aurora-2: #ff7a6b;
  --aurora-3: #ffd36e;
}

html[data-theme="graphite"] {
  --bg: #0a0c0f;
  --bg-deep: #070809;
  --panel: #12161b;
  --panel-2: #171d24;
  --line: rgba(180, 195, 210, 0.12);
  --line-strong: rgba(180, 195, 210, 0.26);
  --text: #e8edf3;
  --muted: #9aa8b6;
  --dim: #6b7885;
  --aurora: #9fb3c8;
  --aurora-2: #6b7d92;
  --aurora-3: #c0ccd8;
}

/* ------------------------------------------------------------ 浅色主题 */

html[data-theme="dawn"] {
  --bg: #f6f2ea;
  --bg-deep: #ece5d8;
  --panel: #fffdf9;
  --panel-2: #f9f4ec;
  --line: rgba(90, 70, 40, 0.14);
  --line-strong: rgba(90, 70, 40, 0.28);
  --text: #2c2418;
  --muted: #6f6352;
  --dim: #9a8d78;
  --aurora: #d9772e;
  --aurora-2: #c2547a;
  --aurora-3: #e0a83c;
}

html[data-theme="paper"] {
  --bg: #f1f5fa;
  --bg-deep: #e4ebf4;
  --panel: #ffffff;
  --panel-2: #f6f9fd;
  --line: rgba(35, 60, 95, 0.13);
  --line-strong: rgba(35, 60, 95, 0.26);
  --text: #1d2a3a;
  --muted: #5f7085;
  --dim: #8a99ab;
  --aurora: #2f8f83;
  --aurora-2: #5b6ee1;
  --aurora-3: #3d8fd1;
}

/* 浅色主题统一把白色叠加换成深色叠加 */
html[data-theme="dawn"],
html[data-theme="paper"] {
  color-scheme: light;
  --soft-1: rgba(20, 40, 60, 0.05);
  --soft-2: rgba(20, 40, 60, 0.09);
  --hover-1: rgba(20, 40, 60, 0.06);
  --hover-2: rgba(20, 40, 60, 0.035);
  --btn-bg: rgba(20, 40, 60, 0.06);
  --btn-bg-hover: rgba(20, 40, 60, 0.1);
  --code-bg: rgba(20, 40, 60, 0.07);
  --code-fg: #24405c;
  --danger-fg: #b3261e;
  --shadow-lg: 0 24px 70px rgba(30, 45, 70, 0.16);
  --shadow-xl: 0 30px 80px rgba(30, 45, 70, 0.2);
  --mask-bg: rgba(28, 38, 52, 0.45);
}
html[data-theme="dawn"] .card-icon,
html[data-theme="paper"] .card-icon {
  color: color-mix(in srgb, var(--c, var(--aurora)) 72%, #1c2430);
}
html[data-theme="dawn"] .aurora::before,
html[data-theme="paper"] .aurora::before { opacity: 0.34; }
html[data-theme="dawn"] .aurora::after,
html[data-theme="paper"] .aurora::after { opacity: 0.18; }
html[data-theme="dawn"] .mode-switch button[aria-pressed="true"],
html[data-theme="paper"] .mode-switch button[aria-pressed="true"] { color: var(--text); }
/* 上传的图标常带白底：浅色主题下用 multiply 让白底融入卡片 */
html[data-theme="dawn"] .card-icon.is-custom img,
html[data-theme="paper"] .card-icon.is-custom img { mix-blend-mode: multiply; }

* { box-sizing: border-box; }

/* hidden 属性要能压住下方任何 display 声明 */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }

::selection { background: color-mix(in srgb, var(--aurora) 24%, transparent); }

/* ------------------------------------------------------------ 极光背景层 */

.aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.aurora::before,
.aurora::after {
  content: "";
  position: absolute;
  width: 120vw;
  height: 72vh;
  left: -10vw;
  filter: blur(64px);
  opacity: 0.62;
}

.aurora::before {
  top: -28vh;
  background:
    radial-gradient(42% 66% at 22% 60%, color-mix(in srgb, var(--aurora) 42%, transparent), transparent 70%),
    radial-gradient(38% 60% at 56% 30%, color-mix(in srgb, var(--aurora-3) 32%, transparent), transparent 72%),
    radial-gradient(46% 70% at 84% 66%, color-mix(in srgb, var(--aurora-2) 36%, transparent), transparent 70%);
  animation: drift 46s ease-in-out infinite alternate;
}

.aurora::after {
  top: -14vh;
  height: 42vh;
  opacity: 0.32;
  background:
    radial-gradient(50% 70% at 70% 40%, color-mix(in srgb, var(--aurora) 34%, transparent), transparent 72%),
    radial-gradient(40% 60% at 30% 70%, color-mix(in srgb, var(--aurora-2) 28%, transparent), transparent 74%);
  animation: drift 62s ease-in-out infinite alternate-reverse;
}

@keyframes drift {
  from { transform: translate3d(-3%, 0, 0) scaleY(1); }
  to { transform: translate3d(4%, 2vh, 0) scaleY(1.12); }
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% 0%, transparent 40%, color-mix(in srgb, var(--bg-deep) 72%, transparent) 100%),
    linear-gradient(180deg, transparent 55%, var(--bg-deep) 100%);
}

@media (prefers-reduced-motion: reduce) {
  .aurora::before, .aurora::after { animation: none; }
  * { scroll-behavior: auto !important; }
}

/* --------------------------------------------------------------- 页面骨架 */

.shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 24px 40px;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 18px 24px;
  justify-content: space-between;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.brand-mark {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 11px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(160deg, color-mix(in srgb, var(--aurora) 16%, transparent), color-mix(in srgb, var(--aurora-2) 12%, transparent));
  display: grid;
  place-items: center;
}

.brand-text { min-width: 0; }
.brand-name {
  display: block;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: 0.06em;
  line-height: 1.25;
}
.brand-sub {
  display: block;
  font-size: 12.5px;
  color: var(--dim);
  letter-spacing: 0.02em;
  margin-top: 2px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  /* 为时钟下方的同步徽章预留空间，负 margin 抵消对下方内容的影响 */
  padding-bottom: 34px;
  margin-bottom: -34px;
}

/* 网络模式切换 */
.mode-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--control);
}
.mode-switch button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  padding: 6px 12px;
  border-radius: 7px;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease;
}
.mode-switch button[aria-pressed="true"] {
  background: color-mix(in srgb, var(--aurora) 14%, transparent);
  color: #d8fff5;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--aurora) 28%, transparent);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 11px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--control);
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); }
.icon-btn svg { width: 15px; height: 15px; }

/* 前台主题选择：只影响当前浏览器，不写回站点设置 */
.theme-select {
  height: 34px;
  padding: 0 28px 0 10px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background-color: var(--control);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='m3 4.5 3 3 3-3' fill='none' stroke='%238ea0b8' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 12px;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.theme-select:hover { color: var(--text); border-color: var(--line-strong); }
.theme-select:focus-visible { outline: 2px solid color-mix(in srgb, var(--aurora) 45%, transparent); outline-offset: 1px; }
.theme-select option { background: var(--panel); color: var(--text); }

/* 前台时钟：只显示时:分，和主题选择器同一行 */
.clock {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 34px;
  padding: 4px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--control);
  color: var(--text);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  line-height: 1.1;
}
.clock-time {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.05em;
}
.clock-date {
  font-size: 11px;
  font-weight: 400;
  color: var(--dim);
  letter-spacing: 0.04em;
}

/* --------------------------------------------------------------- 欢迎区 */

.welcome {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  margin: 26px 0 0;
}
.welcome-greeting {
  margin: 0;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.35;
  color: var(--text);
}
.welcome-quote {
  border: 0;
  background: none;
  padding: 0;
  font-size: 13px;
  line-height: 1.5;
  text-align: left;
  color: var(--muted);
  cursor: pointer;
}
.welcome-quote:hover { color: var(--text); }
.welcome-quote:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--aurora) 45%, transparent);
  outline-offset: 2px;
  border-radius: 4px;
}
.welcome + .search-wrap { margin-top: 18px; }

/* --------------------------------------------------------------- 系统监控 */

.monitor { margin-top: 20px; }
.monitor-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.monitor-card {
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--card-top), var(--card-bottom));
  transition: border-color 0.18s ease;
}
.monitor-card:hover { border-color: var(--line-strong); }
.monitor-card-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}
.monitor-card-head svg { width: 15px; height: 15px; color: var(--dim); }
.monitor-cores {
  margin-left: auto;
  font-size: 11px;
  color: var(--dim);
  font-family: var(--mono);
}
.monitor-bar {
  height: 5px;
  border-radius: 3px;
  background: var(--control);
  overflow: hidden;
}
.monitor-bar-fill {
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--aurora), var(--aurora-2));
  transition: width 0.6s ease;
}
.monitor-num {
  margin-top: 7px;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.3;
}
.monitor-qbit-body {
  display: grid;
  gap: 4px;
  margin-top: 4px;
}
.monitor-qbit-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--dim);
}
.monitor-qbit-row strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.monitor-foot {
  margin-top: 6px;
  font-size: 11px;
  color: var(--dim);
  text-align: right;
  font-family: var(--mono);
}

/* 高占用时把进度条换成红色 */
.monitor-card.is-hot .monitor-bar-fill {
  background: linear-gradient(90deg, #ffb07a, #ff7a6b);
}

/* --------------------------------------------------------------- 搜索区 */

.search-wrap { margin: 30px 0 0; }

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 54px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  transition: border-color 0.2s ease, background 0.2s ease;
}
.search-box:focus-within {
  border-color: color-mix(in srgb, var(--aurora) 50%, transparent);
  background: var(--surface-strong);
}
.search-box svg { width: 18px; height: 18px; color: var(--dim); flex: none; }
.search-box input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 16px;
  letter-spacing: 0.01em;
}
.search-box input::placeholder { color: var(--dim); }
.search-engine {
  flex: none;
  max-width: 96px;
  height: 30px;
  padding: 0 22px 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control);
  color: var(--muted);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 12px) 13px, calc(100% - 8px) 13px;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}
.search-engine:hover { color: var(--text); border-color: var(--line-strong); }
.search-engine:focus { outline: none; border-color: color-mix(in srgb, var(--aurora) 50%, transparent); }
.search-kbd {
  flex: none;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
}
.search-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 9px;
  font-size: 12px;
  color: var(--dim);
}
.search-meta .clear-btn {
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  font-size: 12px;
}
.search-meta .clear-btn:hover { color: var(--text); }
.search-meta-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex: none;
}

/* --------------------------------------------------------------- 分类筛选 */

.filter-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 22px 0 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.filter-bar::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  border: 1px solid transparent;
  background: var(--soft-1);
  color: var(--muted);
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}
.chip .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c, var(--muted));
}
.chip:hover { color: var(--text); border-color: var(--line); }
.chip[aria-selected="true"] {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--soft-2);
}

/* ------------------------------------------------------------------- 内容 */

.content { margin-top: 18px; }

.recent {
  margin-bottom: 30px;
}
.recent-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}
.recent-head h2 { margin: 0; font-size: 14px; font-weight: 600; color: var(--muted); }
.recent-head .hint { font-size: 12px; color: var(--dim); }

.section { margin-bottom: 32px; }

.section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 13px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line);
}
.section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.section-title .bar {
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--c, var(--aurora));
}
.section-count {
  font-size: 12px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.section-spacer { flex: 1; }
.section-toggle {
  border: 0;
  background: none;
  color: var(--dim);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 2px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.section-toggle:hover { color: var(--text); }
.section-toggle svg { width: 13px; height: 13px; transition: transform 0.2s ease; }
.section.collapsed .cards { display: none; }
.section.collapsed .section-toggle svg { transform: rotate(-90deg); }

/* 卡片用 flex 排布：最后一行不会只剩孤零零一个窄格 */
.cards {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.cards > * { flex: 1 1 226px; min-width: 0; }

.card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 13px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--card-top), var(--card-bottom));
  position: relative;
  overflow: hidden;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}
.card:hover,
.card:focus-visible {
  border-color: color-mix(in srgb, var(--c, var(--aurora)) 55%, var(--line-strong));
  background: linear-gradient(180deg, var(--card-hover-top), var(--card-hover-bottom));
  transform: translateY(-2px);
}
.card:focus-visible { outline: 2px solid color-mix(in srgb, var(--aurora) 55%, transparent); outline-offset: 2px; }

.card-icon {
  position: relative;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--icon-bg);
  border: 1px solid var(--line);
  overflow: hidden;
  font-size: 15px;
  font-weight: 600;
  color: color-mix(in srgb, var(--c, var(--aurora)) 78%, #ffffff);
  text-transform: uppercase;
}
.card-icon img {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 22px;
  height: 22px;
  object-fit: contain;
}
.card-icon img.on-dark { filter: invert(1) hue-rotate(180deg) brightness(1.15); }
/* 自定义图标：去掉描边，让图片正好铺满整个图标框，按 cover 裁切 */
.card-icon.is-custom { border-width: 0; background: transparent; }
/* 自定义图标：完整显示整张图片，不裁切，四角随框圆角 */
.card-icon img.cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}
.card-icon.is-custom img {
  width: 100%;
  height: 100%;
  padding: 2px;
  box-sizing: border-box;
  object-fit: contain;
  border-radius: inherit;
}
.card-icon.is-letter { background: color-mix(in srgb, var(--c, var(--aurora)) 12%, var(--panel)); }
/* 已经有图标图片时隐藏首字母，避免透明图透出文字；加载失败会恢复 is-letter */
.card-icon:not(.is-letter) .letter { display: none; }

.card-body { min-width: 0; flex: 1; }
.card-name {
  display: block;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-desc {
  display: block;
  margin-top: 1px;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-host {
  display: none;
}
.card-badge {
  flex: none;
  font-size: 10.5px;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 4px;
  letter-spacing: 0.03em;
}

/* 首屏卡片淡入 */
.content.is-first .card { animation: card-in 0.32s ease; }

@keyframes card-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .content.is-first .card { animation: none; }
}

/* ---------------------------------------------------------- 卡片效果（9 种） */

/* ---------------------------------------------------------- 字体（8 种 + 自定义） */
body.font-system { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif; }
body.font-jetbrains { font-family: "JetBrains Mono", "Fira Code", "PingFang SC", "Microsoft YaHei", monospace; }
body.font-inter { font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
body.font-roboto { font-family: "Roboto", "PingFang SC", "Microsoft YaHei", sans-serif; }
body.font-noto { font-family: "Noto Sans SC", "Noto Sans", -apple-system, "Microsoft YaHei", sans-serif; }
body.font-sourcehan { font-family: "Source Han Sans SC", "Source Han Sans CN", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif; }
body.font-pingfang { font-family: "PingFang SC", "PingFang TC", "Microsoft YaHei", sans-serif; }
body.font-custom { font-family: var(--custom-font, inherit); }

/* 1. default — 默认（不追加覆盖，沿用 .card 基础样式） */

/* 2. emboss — 浮雕（凸起高光 + 底部暗边） */
body.card-style-emboss .card {
  border-top-color: color-mix(in srgb, var(--bg) 30%, var(--text));
  border-left-color: color-mix(in srgb, var(--bg) 25%, var(--text));
  border-bottom-color: color-mix(in srgb, var(--bg) 70%, black);
  border-right-color: color-mix(in srgb, var(--bg) 70%, black);
  box-shadow:
    inset 1px 1px 0 color-mix(in srgb, #fff 55%, transparent),
    inset -1px -1px 0 color-mix(in srgb, #000 35%, transparent),
    0 1px 2px color-mix(in srgb, #000 25%, transparent);
}
body.card-style-emboss .card:hover { transform: translateY(-1px); }

/* 3. inset — 凹陷（内凹 + 顶部暗边） */
body.card-style-inset .card {
  border-top-color: color-mix(in srgb, var(--bg) 70%, black);
  border-left-color: color-mix(in srgb, var(--bg) 70%, black);
  border-bottom-color: color-mix(in srgb, var(--bg) 25%, var(--text));
  border-right-color: color-mix(in srgb, var(--bg) 25%, var(--text));
  box-shadow:
    inset 2px 2px 4px color-mix(in srgb, #000 35%, transparent),
    inset -1px -1px 2px color-mix(in srgb, #fff 20%, transparent);
}
body.card-style-inset .card:hover { transform: none; box-shadow: inset 3px 3px 6px color-mix(in srgb, #000 45%, transparent); }

/* 4. glass — 玻璃拟态 */
body.card-style-glass .card {
  background: color-mix(in srgb, var(--panel) 45%, transparent);
  border: 1px solid color-mix(in srgb, var(--text) 15%, transparent);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
}
body.card-style-glass .card:hover {
  background: color-mix(in srgb, var(--panel) 60%, transparent);
  border-color: color-mix(in srgb, var(--c, var(--aurora)) 40%, transparent);
  transform: translateY(-3px);
  box-shadow: 0 8px 28px color-mix(in srgb, #000 30%, transparent);
}

/* 5. neon — 霓虹发光 */
body.card-style-neon .card {
  border-color: color-mix(in srgb, var(--c, var(--aurora)) 45%, var(--line-strong));
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--c, var(--aurora)) 25%, transparent),
    0 0 12px color-mix(in srgb, var(--c, var(--aurora)) 22%, transparent),
    0 0 24px color-mix(in srgb, var(--c, var(--aurora)) 12%, transparent);
}
body.card-style-neon .card:hover {
  border-color: color-mix(in srgb, var(--c, var(--aurora)) 80%, #fff);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--c, var(--aurora)) 45%, transparent),
    0 0 18px color-mix(in srgb, var(--c, var(--aurora)) 45%, transparent),
    0 0 36px color-mix(in srgb, var(--c, var(--aurora)) 22%, transparent);
}

/* 6. gradient — 渐变边框（用伪元素，内外描边 trick） */
body.card-style-gradient .card {
  border: none;
  background: var(--panel);
  isolation: isolate;
}
body.card-style-gradient .card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg,
    var(--c, var(--aurora)) 0%,
    color-mix(in srgb, var(--c, var(--aurora)) 40%, var(--panel-2)) 50%,
    color-mix(in srgb, var(--c, var(--aurora)) 15%, transparent) 100%);
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}
body.card-style-gradient .card:hover::before { opacity: 1; }
body.card-style-gradient .card:hover { background: var(--panel); }

/* 7. float3d — 3D 悬浮 */
body.card-style-float3d .card {
  transform-style: preserve-3d;
  perspective: 800px;
  transition: transform 0.22s cubic-bezier(.2,.8,.2,1), box-shadow 0.22s ease;
  box-shadow: 0 2px 6px color-mix(in srgb, #000 15%, transparent),
              0 1px 2px color-mix(in srgb, #000 10%, transparent);
}
body.card-style-float3d .card:hover {
  transform: translateY(-5px) rotateX(2deg) rotateY(-3deg);
  box-shadow: 0 14px 30px color-mix(in srgb, #000 30%, transparent),
              0 4px 10px color-mix(in srgb, #000 20%, transparent);
}

/* 8. minimal — 简约线条 */
body.card-style-minimal .card {
  background: transparent;
  border: 1px dashed var(--line);
  border-radius: 8px;
  box-shadow: none;
  transition: border-style 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
body.card-style-minimal .card:hover {
  background: color-mix(in srgb, var(--c, var(--aurora)) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--c, var(--aurora)) 60%, transparent);
  transform: none;
}

/* 9. shadow — 阴影立体（多层阴影） */
body.card-style-shadow .card {
  border: 1px solid color-mix(in srgb, var(--line-strong) 70%, transparent);
  background: var(--panel);
  box-shadow:
    0 1px 2px color-mix(in srgb, #000 12%, transparent),
    0 3px 8px color-mix(in srgb, #000 18%, transparent),
    0 8px 20px color-mix(in srgb, #000 10%, transparent);
  transition: box-shadow 0.22s ease, transform 0.22s ease;
}
body.card-style-shadow .card:hover {
  transform: translateY(-3px);
  box-shadow:
    0 2px 4px color-mix(in srgb, #000 15%, transparent),
    0 6px 16px color-mix(in srgb, #000 25%, transparent),
    0 14px 32px color-mix(in srgb, #000 15%, transparent);
}

/* 紧凑密度：缩小图标与留白，隐藏描述行 */
body.density-compact .cards { gap: 8px; }
body.density-compact .cards > * { flex: 1 1 200px; }
body.density-compact .card { padding: 8px 10px; gap: 9px; }
body.density-compact .card-icon { width: 30px; height: 30px; border-radius: 7px; }
body.density-compact .card-desc { display: none; }
body.density-compact .card-host { font-size: 10.5px; }

.empty {
  padding: 54px 20px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
}
.empty strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 6px; }
.empty p { margin: 0; font-size: 13px; color: var(--dim); }

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 20px;
  margin-top: 44px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--dim);
}
.footer a { color: var(--muted); border-bottom: 1px solid var(--line-strong); }
.footer a:hover { color: var(--text); }

/* ------------------------------------------------------------- 密码门禁页 */

.gate {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(90% 70% at 50% 26%, color-mix(in srgb, var(--bg-deep) 35%, transparent), color-mix(in srgb, var(--bg-deep) 92%, transparent));
}
.gate.hidden { display: none; }

.gate-panel {
  width: 100%;
  max-width: 380px;
  padding: 30px 28px 26px;
  border-radius: 18px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, var(--gate-top), var(--gate-bottom));
  box-shadow: var(--shadow-lg);
}
.gate-mark {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, color-mix(in srgb, var(--aurora) 18%, transparent), color-mix(in srgb, var(--aurora-2) 14%, transparent));
  margin-bottom: 18px;
}
.gate h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: 0.05em;
}
.gate p.lead {
  margin: 0 0 22px;
  font-size: 13px;
  color: var(--dim);
  line-height: 1.65;
}
.field-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 7px;
  letter-spacing: 0.02em;
}

.input {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: var(--input-bg);
  font-size: 16px;
  outline: none;
  transition: border-color 0.18s ease;
}
.input:focus { border-color: color-mix(in srgb, var(--aurora) 55%, transparent); }
.input::placeholder { color: var(--dim); font-size: 14px; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 44px;
  padding: 0 18px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: var(--btn-bg);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
}
.btn:hover { background: var(--btn-bg-hover); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-primary {
  background: linear-gradient(120deg, color-mix(in srgb, var(--aurora) 88%, #ffffff 12%), color-mix(in srgb, var(--aurora-2) 88%, #ffffff 12%));
  color: #06121a;
  font-weight: 600;
  border-color: transparent;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-block { width: 100%; margin-top: 18px; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 12.5px; border-radius: 7px; }
.btn-ghost { border-color: var(--line-strong); background: transparent; }
.btn-danger { color: var(--danger-fg); border-color: rgba(255, 122, 107, 0.35); background: rgba(255, 122, 107, 0.1); }
.btn-danger:hover { background: rgba(255, 122, 107, 0.18); }

.gate-foot {
  margin-top: 18px;
  font-size: 11.5px;
  color: var(--dim);
  text-align: center;
}

/* ------------------------------------------------------------------ 后台 */

.admin-body { background: var(--bg); }

.admin-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100vh;
}
.admin-shell > * { min-width: 0; }

.admin-side {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 16px 18px;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
  backdrop-filter: blur(6px);
}

.admin-side .brand { gap: 10px; padding: 0 6px; }
.admin-side .brand-mark { width: 34px; height: 34px; border-radius: 9px; }
.admin-side .brand-name { font-size: 15.5px; }
.admin-side .brand-sub { font-size: 11px; }

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 26px;
  min-width: 0;
}
.admin-nav button {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}
.admin-nav button svg { width: 16px; height: 16px; flex: none; opacity: 0.7; }
.admin-nav button:hover { color: var(--text); background: var(--hover-1); }
.admin-nav button[aria-current="true"] {
  color: var(--text);
  background: color-mix(in srgb, var(--aurora) 10%, transparent);
  box-shadow: inset 2px 0 0 var(--aurora);
}

.admin-side-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 0 4px;
}
.save-state {
  font-size: 11.5px;
  color: var(--dim);
  padding-left: 2px;
}
.save-state.dirty { color: #ffcf9a; }
.admin-side-foot .btn { width: 100%; }

.admin-main {
  width: 100%;
  max-width: 1240px;
  margin: 0;
  padding: 30px 34px 70px;
  min-width: 0;
}

.panel { display: none; }
.panel.active { display: block; }

.panel-head { margin-bottom: 22px; }
.panel-head h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: 0.02em;
}
.panel-head p {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--dim);
  max-width: 62ch;
}

.card-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--block-bg);
  padding: 20px 20px 22px;
  margin-bottom: 16px;
}
.card-block h2 {
  margin: 0 0 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}

.panel-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.stat {
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--hover-2);
}
.stat-num {
  display: block;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 12px; color: var(--dim); }

.tip-list {
  margin: 0;
  padding-left: 18px;
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--muted);
}
.tip-list li { margin-bottom: 5px; }
.tip-list li::marker { color: var(--aurora); }
code {
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--code-bg);
  color: var(--code-fg);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row.full { grid-column: 1 / -1; }
.form-row label { font-size: 12px; color: var(--muted); }
.form-hint { font-size: 11.5px; color: var(--dim); }

.input-sm {
  height: 38px;
  padding: 0 11px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--input-bg);
  font-size: 14px;
  outline: none;
  width: 100%;
}
.input-sm:focus { border-color: color-mix(in srgb, var(--aurora) 50%, transparent); }

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}
.check-row input { width: 16px; height: 16px; accent-color: var(--aurora); }
.check-list { display: flex; flex-direction: column; gap: 2px; }
.check-list .check-row { min-height: 32px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 620px; }
thead th {
  text-align: left;
  font-weight: 500;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--dim);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--hover-2);
  white-space: nowrap;
}
tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--muted);
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--hover-2); }
td.title-cell { color: var(--text); font-weight: 500; }
td.url-cell { font-family: var(--mono); font-size: 11.5px; color: var(--dim); max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.row-actions button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11.5px;
  cursor: pointer;
}
.row-actions button:hover { color: var(--text); border-color: var(--line-strong); }
.row-actions button.danger:hover { color: var(--danger-fg); border-color: rgba(255, 122, 107, 0.5); }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin-bottom: 14px;
}
.toolbar .grow { flex: 1; min-width: 160px; }
.toolbar .input-sm { max-width: 260px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--dim);
}

.cat-color {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: none;
  cursor: pointer;
}
.cat-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1.6fr) 34px 170px 30px 30px auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.cat-row:last-child { border-bottom: 0; }
.cat-move {
  width: 30px;
  padding: 0;
  line-height: 1;
  font-size: 14px;
}
.cat-move:disabled { opacity: 0.3; cursor: not-allowed; }
.engine-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.engine-row:last-child { border-bottom: 0; }
.cat-row .cat-icon-preview {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  background: var(--icon-bg);
}

select.input-sm { appearance: none; background-image: none; }

/* 保险箱 */
.vault-lock {
  display: grid;
  place-items: center;
  gap: 14px;
  padding: 46px 20px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
}
.vault-lock svg { width: 30px; height: 30px; color: var(--dim); }
.vault-lock p { margin: 0; font-size: 13px; color: var(--dim); max-width: 40ch; }
.vault-unlock-form { display: flex; gap: 8px; width: 100%; max-width: 320px; }
.vault-unlock-form .input-sm { flex: 1; }

.vault-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 8px;
}
.vault-item:last-child { margin-bottom: 0; }
.vault-title { font-size: 13.5px; color: var(--text); font-weight: 560; }
.vault-meta { font-size: 11.5px; color: var(--dim); margin-top: 3px; font-family: var(--mono); }
.vault-secret {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
}
.vault-secret .pw { letter-spacing: 0.12em; }
.vault-secret .pw.revealed { letter-spacing: 0; color: #b9f5e6; }
.mini-link {
  border: 0;
  background: none;
  color: var(--dim);
  font-size: 11.5px;
  cursor: pointer;
  padding: 0;
  border-bottom: 1px solid var(--line-strong);
}
.mini-link:hover { color: var(--text); }

/* 弹窗 */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  padding: 20px;
  background: var(--mask-bg);
  backdrop-filter: blur(3px);
}
.modal-mask.open { display: grid; }
.modal {
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 16px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, var(--modal-top), var(--modal-bottom));
  padding: 22px 22px 20px;
  box-shadow: var(--shadow-xl);
}
.modal-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 620; }
.modal-close {
  border: 0;
  background: none;
  color: var(--dim);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
}
.modal-close:hover { color: var(--text); }
.modal-form { display: grid; gap: 13px; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* 提示条 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 12px);
  z-index: 60;
  max-width: 86vw;
  padding: 10px 16px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--panel-2) 96%, transparent);
  color: var(--text);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: rgba(255, 122, 107, 0.5); color: var(--danger-fg); }

/* 后台登录 */
.admin-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  z-index: 1;
}
.admin-login .gate-panel { max-width: 400px; }

/* 响应式：先为窄屏写好，再向上扩展 */

@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .panel-cols { grid-template-columns: 1fr; }
  .admin-side {
    position: relative;
    height: auto;
    flex-direction: column;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 16px 16px 10px;
  }
  .admin-nav {
    flex-direction: row;
    overflow-x: auto;
    margin-top: 14px;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .admin-nav::-webkit-scrollbar { display: none; }
  .admin-nav button { white-space: nowrap; flex: 0 0 auto; box-shadow: none !important; }
  .admin-nav button[aria-current="true"] { border-bottom: 2px solid var(--aurora); border-radius: 6px 6px 0 0; }
  .admin-side-foot {
    flex-direction: row;
    align-items: center;
    margin-top: 8px;
  }
  .admin-side-foot .btn { width: auto; }
  .admin-main { padding: 22px 16px 60px; }
}

@media (max-width: 760px) {
  .shell { padding: 20px 16px 32px; }
  .topbar { gap: 14px; }
  .brand-mark { width: 36px; height: 36px; }
  .brand-name { font-size: 17px; }
  .top-actions { width: 100%; justify-content: space-between; }
  .mode-switch button { padding: 6px 10px; }
  .form-grid { grid-template-columns: 1fr; }
  .cat-row { grid-template-columns: 30px minmax(0, 1fr) 30px 30px auto; }
  .cat-row .cat-icon-select { display: none; }
  .cat-row .cat-color { display: none; }
  .cards > * { flex: 1 1 190px; }
  .card { padding: 11px; }
  .card-icon { width: 34px; height: 34px; }
  .search-box { height: 50px; padding: 0 13px; }
  .search-kbd { display: none; }
  .section { margin-bottom: 26px; }
  .admin-main { padding-top: 18px; }
}

@media (max-width: 480px) {
  .cards > * { flex: 1 1 100%; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-meta .hint-long { display: none; }
  .gate-panel { padding: 24px 20px 22px; }
  .modal { padding: 18px 16px; }
  .toolbar .input-sm { max-width: none; }
}

@media (min-width: 1200px) {
  .cards > * { flex: 1 1 232px; }
}

/* ---------- GitHub 同步状态（文字 + 圆点 + tooltip） ---------- */
.sync-badge {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.3;
  font-weight: 500;
  cursor: help;
  border: 1px solid transparent;
  white-space: nowrap;
  backdrop-filter: blur(4px);
}
.sync-badge .sync-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex: none;
  /* 不透明背景，避免被页面底色染透 */
  background: transparent;
  box-shadow: none;
  position: relative;
}
.sync-badge .sync-dot::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: 50%;
}
.sync-badge.sync-ok         { background: rgba(75, 225, 192, .08); border-color: rgba(75, 225, 192, .25); color: var(--aurora); }
.sync-badge.sync-ok .sync-dot::before { background: #4be1c0; box-shadow: 0 0 6px rgba(75,225,192,.7); }
.sync-badge.sync-syncing   { background: rgba(230, 169, 42, .10); border-color: rgba(230, 169, 42, .28); color: #d99a25; }
.sync-badge.sync-syncing .sync-dot::before {
  background: #e6a92a; box-shadow: 0 0 6px rgba(230,169,42,.75);
  animation: syncPulse 1.1s ease-in-out infinite;
}
.sync-badge.sync-err       { background: rgba(192, 72, 72, .10); border-color: rgba(192, 72, 72, .28); color: #c04848; }
.sync-badge.sync-err .sync-dot::before { background: #d24d4d; box-shadow: 0 0 6px rgba(192,72,72,.7); }
@keyframes syncPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .55; transform: scale(.85); }
}
.sync-badge:hover { transform: translateY(-1px); transition: transform .2s; }
.sync-label { font-variant-numeric: tabular-nums; }

/* ---------- 后台 GitHub 状态 chip ---------- */
.gh-chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid transparent;
}
.gh-chip.gh-ok { background: color-mix(in srgb, var(--aurora) 14%, transparent); color: var(--aurora); border-color: color-mix(in srgb, var(--aurora) 35%, transparent); }
.gh-chip.gh-off { background: color-mix(in srgb, var(--muted) 18%, transparent); color: var(--muted); border-color: color-mix(in srgb, var(--muted) 30%, transparent); }
.gh-chip.gh-pending { background: rgba(198, 141, 44, .12); color: #b5802c; border-color: rgba(198, 141, 44, .25); }
.gh-chip.gh-err { background: rgba(192, 72, 72, .12); color: #c04848; border-color: rgba(192, 72, 72, .28); }

/* 平板：卡片固定两列 */
@media (min-width: 641px) and (max-width: 1024px) {
  .shell .cards > * { flex: 1 1 calc(50% - 5px); max-width: calc(50% - 5px); }
  .monitor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 手机：单列卡片，控件换行铺满，不产生横向溢出 */
@media (max-width: 640px) {
  .shell { padding: 18px 14px 30px; }
  .monitor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .topbar { gap: 12px; }
  .brand { width: 100%; }
  .brand-name { font-size: 16.5px; }
  .brand-sub { font-size: 11.5px; }
  .top-actions { width: 100%; justify-content: flex-start; gap: 8px; }
  .clock { flex: none; height: auto; padding: 4px 10px; }
  .clock-time { font-size: 19px; }
  .clock-date { font-size: 10px; }
  .theme-select { flex: 1 1 120px; min-width: 0; height: 32px; }
  .mode-switch { width: 100%; }
  .mode-switch button { flex: 1; padding: 6px 8px; }
  .top-actions .icon-btn {
    flex: 1 1 auto;
    justify-content: center;
    height: 32px;
    padding: 0 9px;
  }
  .welcome { margin-top: 20px; gap: 2px 10px; }
  .welcome-greeting { font-size: 18px; }
  .welcome-quote { font-size: 12px; }
  .welcome + .search-wrap { margin-top: 14px; }
  .search-box { height: 46px; padding: 0 12px; }
  .search-meta { flex-wrap: wrap; row-gap: 6px; font-size: 11.5px; }
  .search-meta-actions { width: 100%; justify-content: space-between; }
  .filter-bar { margin: 0 -14px; padding: 16px 14px 4px; }
  .cards { gap: 8px; }
  .shell .cards > * { flex: 1 1 100%; max-width: 100%; }
  .card { padding: 11px; }
  .section { margin-bottom: 24px; }
  .footer { flex-direction: column; align-items: flex-start; gap: 6px; }
  .admin-main { padding: 16px 12px 56px; }
}

/* ------------------------------------------------- 后台：图标上传 */
.icon-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.icon-preview {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  border: 1px dashed var(--line-strong);
  background: var(--bg-deep) center / cover no-repeat;
}

.icon-preview.has-img { border-style: solid; border-color: var(--line); }

.icon-field .input-sm { flex: 1; min-width: 0; }

.field-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.field-hint.is-error { color: #ff8a8a; }
