/* =====================================================================
   Aurora UI · 设计系统
   深色为默认主题，浅色可切换；所有颜色走变量，勿在组件里写死色值
   ===================================================================== */

/* ---------------- Tokens ---------------- */
:root {
  --brand: #ff4d8d;
  --brand-2: #8b5cf6;
  --brand-3: #22d3ee;
  --brand-soft: rgba(255, 77, 141, .13);
  --grad: linear-gradient(135deg, #ff4d8d 0%, #a855f7 52%, #6d5cff 100%);
  --grad-2: linear-gradient(135deg, #22d3ee 0%, #8b5cf6 55%, #ff4d8d 100%);
  --ok: #2ee6a8;
  --warn: #ffb340;
  --bad: #ff5d6c;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-sm: 10px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --font: "Inter var", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI",
          "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --side-w: 238px;
  --top-h: 60px;
}

html[data-theme="dark"] {
  --bg: #08090d;
  --bg-2: #0d0f15;
  --surface: rgba(20, 22, 30, .82);
  --surface-solid: #14161e;
  --surface-2: rgba(255, 255, 255, .045);
  --surface-3: rgba(255, 255, 255, .08);
  --line: rgba(255, 255, 255, .075);
  --line-2: rgba(255, 255, 255, .14);
  --text: #eef1f7;
  --text-2: #a3abbb;
  --text-3: #6d7686;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 12px 32px -12px rgba(0,0,0,.7);
  --shadow-lg: 0 24px 64px -20px rgba(0,0,0,.85);
  --glow: radial-gradient(600px 300px at 12% -8%, rgba(255, 77, 141, .20), transparent 62%),
          radial-gradient(700px 340px at 88% -12%, rgba(34,211,238,.14), transparent 60%),
          radial-gradient(900px 500px at 50% 118%, rgba(168,85,247,.10), transparent 65%);
  --img-bg: #1a1d26;
}

html[data-theme="light"] {
  --bg: #f4f5f9;
  --bg-2: #ffffff;
  --surface: rgba(255, 255, 255, .9);
  --surface-solid: #ffffff;
  --surface-2: rgba(16, 20, 32, .035);
  --surface-3: rgba(16, 20, 32, .07);
  --line: rgba(16, 20, 32, .085);
  --line-2: rgba(16, 20, 32, .16);
  --text: #101319;
  --text-2: #596072;
  --text-3: #8a92a2;
  --shadow: 0 1px 2px rgba(16,20,32,.04), 0 10px 28px -14px rgba(16,20,32,.18);
  --shadow-lg: 0 28px 64px -24px rgba(16,20,32,.28);
  --glow: radial-gradient(600px 300px at 12% -8%, rgba(255, 77, 141, .13), transparent 62%),
          radial-gradient(700px 340px at 88% -12%, rgba(34,211,238,.12), transparent 60%),
          radial-gradient(900px 500px at 50% 118%, rgba(168,85,247,.07), transparent 65%);
  --img-bg: #eceef4;
}

/* ---------------- Reset ---------------- */
* { box-sizing: border-box; }
*::selection { background: rgba(255, 77, 141, .3); }

html, body { height: 100%; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.62;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: var(--glow);
  pointer-events: none;
  z-index: 0;
}

h1, h2, h3, h4, h5 { margin: 0; font-weight: 650; letter-spacing: -.015em; line-height: 1.3; }
h1 { font-size: 19px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border-radius: 20px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

.i { width: 18px; height: 18px; flex: 0 0 auto; stroke: currentColor; fill: none;
     stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.i-sm { width: 15px; height: 15px; }
.i-lg { width: 22px; height: 22px; }

/* ---------------- Shell ---------------- */
.shell { position: relative; z-index: 1; display: flex; min-height: 100vh; }

.side {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--side-w);
  z-index: 60;
  display: flex;
  flex-direction: column;
  padding: 16px 12px 12px;
  background: var(--surface);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  border-right: 1px solid var(--line);
  transition: transform .3s var(--ease);
}

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px 16px;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px;
  background: var(--grad);
  display: grid; place-items: center;
  color: #fff;
  box-shadow: 0 6px 18px -6px rgba(255, 77, 141, .8);
}
.brand-name { font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; }
.brand-sub { font-size: 11px; color: var(--text-3); letter-spacing: .06em; text-transform: uppercase; }

.nav {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
  margin: 0 -4px; padding: 0 4px 8px;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
/* 以前滚动条宽度是 0（完全藏起来）。笔记本矮屏（1366×660 / 1280×600）
   菜单到底会被下方用户卡片盖住 160~230px，用户看不出还有内容可滚，
   会以为左边菜单缺项 —— 改成一条 4px 的淡滚动条，滚动时更明显。 */
.nav::-webkit-scrollbar { width: 4px; }
.nav::-webkit-scrollbar-track { background: transparent; }
.nav::-webkit-scrollbar-thumb { background: var(--line-2, var(--line)); border-radius: 4px; }
.nav::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

.nav-group {
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 14px 10px 6px;
  font-weight: 600;
}

.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  height: 38px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  transition: background .18s, color .18s, transform .18s;
  white-space: nowrap;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: var(--brand-soft);
  color: var(--text);
  font-weight: 600;
}
.nav-item.active .i { color: var(--brand); }
.nav-item.active::before {
  content: "";
  position: absolute; left: -4px; top: 9px; bottom: 9px; width: 3px;
  border-radius: 3px; background: var(--grad);
}
.nav-item .dot {
  margin-left: auto; width: 6px; height: 6px; border-radius: 50%;
  background: var(--bad); box-shadow: 0 0 0 3px rgba(255, 93, 108, .18);
}

/* 品牌区 / 底部用户卡片不许被压缩，只让 .nav 让出空间 */
.brand, .side-foot { flex-shrink: 0; }
.side-foot { padding-top: 10px; border-top: 1px solid var(--line); }

.user-card {
  display: flex; align-items: center; gap: 9px;
  padding: 8px; border-radius: 12px;
  transition: background .18s;
  cursor: pointer;
}
.user-card:hover { background: var(--surface-2); }
.user-card .avatar { width: 32px; height: 32px; font-size: 12px; }
.user-card .uc-name { font-size: 13px; font-weight: 600; line-height: 1.25; }
.user-card .uc-sub { font-size: 11px; color: var(--text-3); }

/* ---------------- Main ---------------- */
.main {
  flex: 1;
  min-width: 0;
  margin-left: var(--side-w);
  display: flex;
  flex-direction: column;
}

.top {
  position: sticky; top: 0; z-index: 40;
  height: var(--top-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px;
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.top h1 { font-size: 16px; font-weight: 650; }
.top .crumb { font-size: 12px; color: var(--text-3); }

/* 顶栏改为单行面包屑，避免与页面内大标题重复 */
.top-title {
  display: flex; align-items: center; gap: 7px;
  min-width: 0; font-size: 12.5px;
}
.top-title .tt-name { font-weight: 650; color: var(--text); letter-spacing: -.01em; white-space: nowrap; }
.top-title .tt-sep { color: var(--text-3); }
.top-title .tt-sub {
  color: var(--text-3); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 46vw;
}
.spacer { flex: 1; }

.content {
  flex: 1;
  width: 100%;
  max-width: 1360px;
  padding: 24px;
  animation: fade-up .4s var(--ease);
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.page-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { font-size: 20px; }
.page-head .sub { font-size: 12.5px; color: var(--text-3); margin-top: 3px; }
.page-head .spacer { min-width: 8px; }

/* ---------------- 七日柱状图 ---------------- */
.spark {
  display: flex; align-items: flex-end; gap: 10px;
  height: 138px; padding: 10px 2px 0;
  border-bottom: 1px solid var(--line);
  background-image: repeating-linear-gradient(to top, var(--line) 0 1px, transparent 1px 36px);
  background-position: bottom;
}
.spark-col {
  flex: 1; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  gap: 6px; min-width: 0;
}
.spark-n { font-size: 10.5px; color: var(--text-3); height: 13px; font-variant-numeric: tabular-nums; }
.spark-bar {
  width: 100%; max-width: 46px;
  border-radius: 7px 7px 3px 3px;
  background: var(--surface-3);
  transition: height .5s var(--ease);
}
.spark-bar.on {
  background: var(--grad);
  box-shadow: 0 8px 16px -10px rgba(255, 77, 141, .95);
}
.spark-l { font-size: 10.5px; color: var(--text-3); white-space: nowrap; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 15px;
  border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 550;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: all .18s var(--ease);
  white-space: nowrap;
  user-select: none;
}
.btn:hover { background: var(--surface-3); border-color: var(--line-2); }
.btn:active { transform: scale(.975); }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }

.btn-primary {
  background: var(--grad);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 22px -10px rgba(255, 77, 141, .9);
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 10px 26px -8px rgba(255, 77, 141, .95); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-soft { background: var(--brand-soft); border-color: transparent; color: #b9a7ff; }
html[data-theme="light"] .btn-soft { color: #5b3fd6; }
.btn-soft:hover { background: rgba(255, 77, 141, .22); }

.btn-danger { background: rgba(255, 93, 108, .12); border-color: rgba(255, 93, 108, .28); color: #ff8b96; }
.btn-danger:hover { background: rgba(255, 93, 108, .2); }

.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 9px; }
.btn-xs { height: 27px; padding: 0 9px; font-size: 12px; border-radius: 7px; }
.btn-lg { height: 44px; padding: 0 22px; font-size: 14.5px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }

/* ---------------- Inputs ---------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 12.5px; color: var(--text-2); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.label .req { color: var(--bad); }
.hint { font-size: 11.5px; color: var(--text-3); }

.input, .textarea, .select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13.5px;
  outline: none;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.65; }
.select { appearance: none; cursor: pointer; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238a92a2' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .textarea:focus, .select:focus {
  border-color: rgba(255, 77, 141, .6);
  box-shadow: 0 0 0 3px rgba(255, 77, 141, .16);
  background: var(--surface-3);
}
.input:disabled { opacity: .6; }

.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }

/* 搜索框 */
.search { position: relative; }
.search .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search .input { padding-left: 34px; }

/* 开关 */
.switch { position: relative; width: 38px; height: 22px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span {
  position: absolute; inset: 0; border-radius: 20px;
  background: var(--surface-3); border: 1px solid var(--line);
  transition: background .22s var(--ease);
}
.switch span::after {
  content: ""; position: absolute; left: 2px; top: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--text-2); transition: transform .22s var(--ease), background .22s;
}
.switch input:checked + span { background: var(--grad); border-color: transparent; }
.switch input:checked + span::after { transform: translateX(16px); background: #fff; }

/* ---------------- Card ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.card-pad { padding: 18px; }
.card-h {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.card-h h3 { font-size: 14.5px; font-weight: 650; }
.card-h .sub { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.card-b { padding: 18px; }
.card-f { padding: 13px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }

/* ---------------- Stat ---------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px;
}
.stat {
  position: relative;
  padding: 15px 16px 15px 19px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
}
/* 与资产卡统一：左侧细色条代替模糊光斑 */
.stat::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--grad); opacity: .55;
}
.stat .k { font-size: 11.5px; color: var(--text-3); display: flex; align-items: center; gap: 5px; }
.stat .v { font-size: 23px; font-weight: 700; letter-spacing: -.03em; margin-top: 5px; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 12px; font-weight: 500; color: var(--text-3); margin-left: 3px; }
.stat .d { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ---------------- Segmented ---------------- */
.seg {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.seg button {
  height: 30px; padding: 0 12px;
  border-radius: 7px;
  font-size: 12.5px; font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
  transition: all .16s;
}
.seg button:hover { color: var(--text); }
.seg button.active {
  background: var(--surface-solid);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .18);
}
html[data-theme="light"] .seg button.active { box-shadow: 0 1px 3px rgba(16, 20, 32, .12); }
.seg-sm button { height: 26px; padding: 0 9px; font-size: 12px; }
.seg-wrap { overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.seg-wrap::-webkit-scrollbar { display: none; }

/* ---------------- Chips / Badge ---------------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 10px;
  border-radius: 20px;
  font-size: 12px; font-weight: 500;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-2);
  transition: all .16s;
  white-space: nowrap;
}
.chip:hover { border-color: var(--line-2); color: var(--text); }
.chip.active { background: var(--brand-soft); border-color: rgba(255, 77, 141, .4); color: #b9a7ff; }
html[data-theme="light"] .chip.active { color: #5b3fd6; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 21px; padding: 0 7px;
  border-radius: 6px;
  font-size: 11px; font-weight: 600;
  letter-spacing: .01em;
  background: var(--surface-3); color: var(--text-2);
}
.badge-ok { background: rgba(46, 230, 168, .14); color: #35e6ac; }
.badge-warn { background: rgba(255, 179, 64, .14); color: #ffbe5c; }
.badge-bad { background: rgba(255, 93, 108, .14); color: #ff8291; }
.badge-info { background: rgba(34, 211, 238, .14); color: #45d8ee; }
.badge-brand { background: var(--brand-soft); color: #b9a7ff; }
html[data-theme="light"] .badge-ok { color: #0e9c6b; }
html[data-theme="light"] .badge-warn { color: #b26a00; }
html[data-theme="light"] .badge-bad { color: #d33a48; }
html[data-theme="light"] .badge-info { color: #0e8fa6; }
html[data-theme="light"] .badge-brand { color: #5b3fd6; }

.tag-list { display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
  font-size: 11px; padding: 2px 7px; border-radius: 5px;
  background: var(--surface-2); color: var(--text-3);
  border: 1px solid var(--line);
}

/* ---------------- Avatar ---------------- */
.avatar {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  font-size: 14px; font-weight: 650; color: #fff;
  background: var(--grad);
  overflow: hidden; flex: 0 0 auto;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 64px; height: 64px; border-radius: 20px; font-size: 22px; }
.avatar-sm { width: 28px; height: 28px; border-radius: 9px; font-size: 11px; }

/* ---------------- Table ---------------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.tb { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tb th {
  text-align: left; font-weight: 550; font-size: 11.5px;
  color: var(--text-3); text-transform: uppercase; letter-spacing: .05em;
  padding: 9px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.tb td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tb tbody tr:last-child td { border-bottom: none; }
table.tb tbody tr:hover { background: var(--surface-2); }
table.tb .num { font-variant-numeric: tabular-nums; }
.tb-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------------- Empty / Loading ---------------- */
.empty {
  padding: 52px 20px; text-align: center; color: var(--text-3);
}
.empty .ic {
  width: 52px; height: 52px; margin: 0 auto 12px;
  border-radius: 16px; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--text-3);
}
.empty .t { font-size: 13.5px; color: var(--text-2); font-weight: 550; margin-bottom: 3px; }
.empty .s { font-size: 12px; }

.spin {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--line-2);
  border-top-color: var(--brand);
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.sk {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: sk 1.4s ease infinite;
  border-radius: 8px;
}
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------------- Toast ---------------- */
#toasts {
  position: fixed; z-index: 300; left: 50%; top: 18px; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
  width: max-content; max-width: min(420px, calc(100vw - 32px));
}
.toast {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 15px;
  border-radius: 12px;
  background: var(--surface-solid);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow-lg);
  font-size: 13px; font-weight: 500;
  animation: toast-in .26s var(--ease);
}
.toast.ok { border-color: rgba(46, 230, 168, .45); color: #35e6ac; }
.toast.bad { border-color: rgba(255, 93, 108, .45); color: #ff8291; }
.toast.info { border-color: rgba(255, 77, 141, .45); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-10px) scale(.96); }
  to { opacity: 1; transform: none; }
}

/* ---------------- Modal / Drawer ---------------- */
.mask {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(4, 5, 8, .62);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 100%; max-width: 480px;
  max-height: calc(100vh - 40px);
  display: flex; flex-direction: column;
  background: var(--surface-solid);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: pop .26s var(--ease);
  overflow: hidden;
}
.modal-wide { max-width: 720px; }
@keyframes pop {
  from { opacity: 0; transform: scale(.96) translateY(10px); }
  to { opacity: 1; transform: none; }
}
.modal-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-h h3 { flex: 1; font-size: 15px; }
.modal-b { padding: 18px; overflow-y: auto; }
.modal-f { padding: 13px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }

/* ---------------- Utilities ---------------- */
.row { display: flex; align-items: center; gap: 10px; }
.row-top { align-items: flex-start; }
.col { display: flex; flex-direction: column; gap: 10px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.tnum { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.center { text-align: center; }
.right { text-align: right; }
.fs12 { font-size: 12px; }
.fs13 { font-size: 13px; }
.bold { font-weight: 650; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.scroll-x { overflow-x: auto; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.hide { display: none !important; }

.progress { height: 6px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 4px; background: var(--grad); transition: width .4s var(--ease); }

/* ---------------- 生图页 ---------------- */
.gen { display: grid; grid-template-columns: 392px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1320px) { .gen { grid-template-columns: 360px minmax(0, 1fr); } }

/* 左栏独立滚动，底部按钮常驻可见 */
.gen-panel {
  position: sticky; top: calc(var(--top-h) + 16px);
  display: flex; flex-direction: column;
  max-height: calc(100vh - var(--top-h) - 96px);
  overflow: hidden;
}
.gen-panel > .card-b { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; }
.gen-panel > .card-b::-webkit-scrollbar { width: 6px; }
.gen-foot {
  flex: 0 0 auto;
  padding: 10px 16px 12px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  display: flex; flex-direction: column; gap: 8px;
}

.prompt-box { position: relative; }
.prompt-box .textarea { min-height: 74px; }
/* 画质 / 数量并排：单列太占高度，左栏放不下会把「数量」压到按钮底下 */
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.two-col .seg button { padding: 0 4px; font-size: 12px; }
.prompt-tools {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-bottom: 9px;
}

.ratio-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.ratio {
  height: 37px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  font-size: 9px; color: var(--text-3); line-height: 1.25;
  transition: all .16s;
}
.ratio b { font-size: 11px; font-weight: 650; color: var(--text-2); line-height: 1.2; }
.ratio:hover { border-color: var(--line-2); }
.ratio.active { border-color: rgba(255, 77, 141, .55); background: var(--brand-soft); }
.ratio.active b, .ratio.active { color: #b9a7ff; }
html[data-theme="light"] .ratio.active b, html[data-theme="light"] .ratio.active { color: #5b3fd6; }

.ref-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.ref-add {
  width: 62px; height: 62px; flex: 0 0 auto;
  border-radius: 11px; border: 1px dashed var(--line-2);
  display: grid; place-items: center;
  color: var(--text-3); background: var(--surface-2);
  transition: all .16s;
}
.ref-add:hover { border-color: var(--brand); color: var(--brand); }
.ref-thumb {
  position: relative; width: 62px; height: 62px; flex: 0 0 auto;
  border-radius: 11px; overflow: hidden; border: 1px solid var(--line);
}
.ref-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ref-thumb button {
  position: absolute; right: 2px; top: 2px;
  width: 17px; height: 17px; border-radius: 50%;
  background: rgba(0, 0, 0, .65); color: #fff;
  display: grid; place-items: center; font-size: 10px;
}

.result-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(172px, 1fr)); gap: 12px; }

.tile {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--img-bg);
  border: 1px solid var(--line);
  aspect-ratio: 1;
  transition: transform .25s var(--ease), box-shadow .25s;
}
.tile:hover { transform: translateY(-2px); box-shadow: 0 16px 36px -16px rgba(0,0,0,.7); }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile .ov {
  position: absolute; inset: auto 0 0 0;
  padding: 24px 10px 10px;
  background: linear-gradient(to top, rgba(0,0,0,.82), transparent);
  opacity: 0; transition: opacity .22s;
  display: flex; gap: 5px;
  color: #fff;
}
.tile:hover .ov { opacity: 1; }
.tile .ov .btn {
  height: 26px; padding: 0 8px; font-size: 11.5px;
  background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.2);
  color: #fff; backdrop-filter: blur(6px);
}
.tile .ov .btn:hover { background: rgba(255,255,255,.28); }
.tile .state {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: var(--img-bg); color: var(--text-3);
  text-align: center; padding: 16px; font-size: 12px;
}
.tile .pbar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: rgba(255,255,255,.1); overflow: hidden; }
.tile .pbar i { display: block; height: 100%; width: 40%; background: var(--grad);
  animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(350%); } }

/* 提示词气泡 */
.prompt-chip {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 9px 11px; margin-top: 8px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 11.5px; color: var(--text-3);
  line-height: 1.55;
}

/* ---------------- Chat ---------------- */
.chat { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 14px; height: calc(100vh - var(--top-h) - 48px); }
.chat-side { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.chat-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.chat-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; border-radius: 9px;
  font-size: 12.5px; color: var(--text-2);
  cursor: pointer;
}
.chat-item:hover { background: var(--surface-2); }
.chat-item.active { background: var(--brand-soft); color: var(--text); }
.chat-item .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item .x { opacity: 0; color: var(--text-3); font-size: 15px; line-height: 1; }
.chat-item:hover .x { opacity: 1; }

.chat-main { display: flex; flex-direction: column; min-height: 0; }
.chat-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.msg { display: flex; gap: 10px; max-width: 86%; }
.msg .bubble {
  padding: 10px 14px; border-radius: 14px;
  font-size: 13.5px; line-height: 1.72;
  background: var(--surface-2);
  border: 1px solid var(--line);
  white-space: pre-wrap; word-break: break-word;
}
.msg.me { margin-left: auto; flex-direction: row-reverse; }
.msg.me .bubble { background: var(--grad); border-color: transparent; color: #fff; }
.msg .who { font-size: 11px; color: var(--text-3); margin-bottom: 4px; }

.chat-input { padding: 12px 16px 16px; border-top: 1px solid var(--line); }
.chat-input .box {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 14px; padding: 8px 8px 8px 12px;
  transition: border-color .18s, box-shadow .18s;
}
.chat-input .box:focus-within { border-color: rgba(255, 77, 141, .5); box-shadow: 0 0 0 3px rgba(255, 77, 141, .13); }
.chat-input textarea {
  flex: 1; border: none; background: none; outline: none; resize: none;
  max-height: 140px; min-height: 24px; font-size: 13.5px; line-height: 1.6; padding: 4px 0;
}

/* ---------------- Tools ---------------- */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; grid-auto-rows: 1fr; }
.tool-card {
  text-align: left; padding: 15px;
  border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  transition: all .2s var(--ease);
  display: flex; flex-direction: column; gap: 7px;
  height: 100%;
}
.tool-card:hover { transform: translateY(-2px); border-color: rgba(255, 77, 141, .4); box-shadow: var(--shadow); }
.tool-card .ic {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
  font-size: 17px;
}
.tool-card .n { font-size: 13.5px; font-weight: 600; }
.tool-card .d { font-size: 11.5px; color: var(--text-3); line-height: 1.5; flex: 1 1 auto; }
/* 卡片底部（标签 + 积分）统一贴底，避免高度参差 */
.tool-card > .row:last-child { margin-top: auto; }

/* ---------------- 商城商品卡 ---------------- */
.goods-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.goods-head { display: flex; align-items: flex-start; gap: 11px; }
.goods-ic {
  width: 38px; height: 38px; flex: 0 0 auto;
  border-radius: 11px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
}
.goods-title { font-size: 14px; font-weight: 650; letter-spacing: -.01em; }
.goods-sub { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.goods-body { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: auto; }
.goods-price { font-size: 23px; font-weight: 750; letter-spacing: -.035em; color: var(--c-pink); line-height: 1.1; }
.goods-pts { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.goods-foot {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text-3);
  border-top: 1px solid var(--line); padding-top: 10px;
}

/* ---------------- Bead ---------------- */
.bead-wrap { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; align-items: start; }
.bead-canvas { overflow: auto; max-height: 70vh; padding: 14px; border-radius: var(--radius); background: var(--surface-2); }
.bead-canvas .gridpix { display: grid; gap: 1px; width: max-content; }
.bead-canvas .gridpix i { width: 9px; height: 9px; border-radius: 1.5px; }
.bead-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.bead-legend .lg { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-2); }
.bead-legend .sw { width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--line-2); }

/* ---------------- Wallet ---------------- */
.asset-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.asset-card {
  position: relative; overflow: hidden;
  padding: 16px 16px 16px 20px; border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
}
/* 三张卡统一白底，只用左侧色条区分主次 */
.asset-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--line-2);
}
.asset-card.hl { border-color: rgba(255, 77, 141, .3); }
.asset-card.hl::before { background: var(--grad); }
.asset-card .k { font-size: 11.5px; color: var(--text-2); display: flex; align-items: center; gap: 5px; }
.asset-card .v { font-size: 26px; font-weight: 700; letter-spacing: -.03em; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.asset-card .a { position: absolute; right: 12px; top: 12px; opacity: .18; }

.amount-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.amount {
  height: 52px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 650; font-size: 15px;
  transition: all .16s;
}
.amount small { font-size: 10px; font-weight: 400; color: var(--text-3); }
.amount:hover { border-color: var(--line-2); }
.amount.active { border-color: rgba(255, 77, 141, .6); background: var(--brand-soft); }

.pay-methods { display: grid; gap: 8px; }
.pay-m { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface-2); transition: all .16s; cursor: pointer; }
.pay-m:hover { border-color: var(--line-2); }
.pay-m.active { border-color: rgba(255, 77, 141, .55); background: var(--brand-soft); }
.pay-m .lg { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: #fff; font-size: 15px; }

/* ---------------- Checkin 日历 ---------------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal .wd { text-align: center; font-size: 11px; color: var(--text-3); padding: 4px 0; }
.cal .d {
  aspect-ratio: 1; border-radius: 9px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 12px; color: var(--text-3);
  border: 1px solid transparent;
  font-variant-numeric: tabular-nums;
}
.cal .d.on { background: var(--brand-soft); color: #b9a7ff; border-color: rgba(255, 77, 141, .35); font-weight: 600; }
html[data-theme="light"] .cal .d.on { color: #5b3fd6; }
.cal .d.today { border-color: var(--line-2); color: var(--text); }
.cal .d.blank { visibility: hidden; }

/* ---------------- 邀请 ---------------- */
.inv-hero {
  position: relative; overflow: hidden;
  padding: 26px; border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(255, 77, 141, .3), rgba(34,211,238,.16));
  border: 1px solid rgba(255, 77, 141, .3);
}
.inv-hero::after {
  content: ""; position: absolute; right: -60px; top: -60px;
  width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 77, 141, .5), transparent 70%);
}

/* ---------------- 认证页 ---------------- */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  position: relative; z-index: 1;
}
.auth-card {
  width: 100%; max-width: 392px;
  padding: 30px;
  border-radius: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}
.auth-card .logo { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.auth-tabs { display: flex; gap: 4px; padding: 3px; background: var(--surface-2); border-radius: 11px; margin-bottom: 20px; }
.auth-tabs a {
  flex: 1; text-align: center; height: 32px; line-height: 32px;
  border-radius: 8px; font-size: 13px; color: var(--text-2);
}
.auth-tabs a.active { background: var(--surface-solid); color: var(--text); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.15); }

/* ---------------- Alert ---------------- */
.alert {
  padding: 10px 14px; border-radius: 11px; margin-bottom: 14px;
  font-size: 13px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.alert-ok { background: rgba(46,230,168,.1); border-color: rgba(46,230,168,.32); color: #35e6ac; }
.alert-bad { background: rgba(255,93,108,.1); border-color: rgba(255,93,108,.32); color: #ff8291; }
.alert-info { background: var(--brand-soft); border-color: rgba(255, 77, 141, .32); color: #b9a7ff; }
html[data-theme="light"] .alert-ok { color: #0e9c6b; }
html[data-theme="light"] .alert-bad { color: #d33a48; }
html[data-theme="light"] .alert-info { color: #5b3fd6; }

/* ---------------- 下拉菜单 ---------------- */
.menu-pop {
  background: var(--surface-solid) !important;
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow-lg);
  animation: pop .18s var(--ease);
}
.menu-pop a, .menu-pop button {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 10px;
  border-radius: 8px;
  font-size: 12.5px; color: var(--text-2);
  text-align: left;
}
.menu-pop a:hover, .menu-pop button:hover { background: var(--surface-2); color: var(--text); }
.menu-pop .sep { height: 1px; background: var(--line); margin: 5px 4px; }
.menu-pop .danger { color: #ff8291; }

/* ---------------- 遮罩 / 移动端 ---------------- */
.scrim {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(4, 5, 8, .6);
  backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none;
  transition: opacity .26s;
}
.scrim.show { opacity: 1; pointer-events: auto; }

.tabbar { display: none; }

@media (max-width: 1180px) {
  .gen { grid-template-columns: 1fr; }
  .gen-panel { position: static; }
  .bead-wrap { grid-template-columns: 1fr; }
  .chat { grid-template-columns: 210px minmax(0, 1fr); }
}

@media (max-width: 860px) {
  :root { --top-h: 54px; }

  .side { transform: translateX(-100%); width: 268px; box-shadow: var(--shadow-lg); }
  .side.open { transform: none; }
  .main { margin-left: 0; }
  .content { padding: 14px 14px 84px; }

  .top { padding: 0 14px; }
  .top h1 { font-size: 15px; }
  .top .crumb { display: none; }
  /* 手机上顶栏只留页面名，副标题收起来，避免标题被挤成两行 */
  .top-title .tt-sub, .top-title .tt-sep { display: none; }
  .top-title .tt-name { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; }

  /* 生成按钮吸在 tabbar 上方，始终点得到 */
  .gen-panel { max-height: none; overflow: visible; }
  .gen-foot {
    position: sticky; bottom: calc(62px + env(safe-area-inset-bottom));
    z-index: 21; border-radius: 14px 14px 10px 10px;
    border: 1px solid var(--line); border-bottom: none;
    background: var(--surface-solid);
    box-shadow: 0 -8px 24px -14px rgba(0, 0, 0, .3);
    padding: 10px 12px 8px;
  }

  /* 对话页：会话列表变抽屉，输入框必须在 tabbar 之上 */
  .chat { grid-template-columns: 1fr; height: auto; gap: 0; }
  .chat-side {
    position: fixed; left: 0; top: var(--top-h); bottom: 0; width: 268px; z-index: 60;
    padding: 10px; border-right: 1px solid var(--line);
    background: var(--surface-solid);
    transform: translateX(-100%); transition: transform .24s var(--ease);
    box-shadow: none;
  }
  .chat-side.open { transform: none; box-shadow: var(--shadow-lg); }
  .chat-main { height: calc(100dvh - var(--top-h) - 62px - 146px); min-height: 340px; }

  /* 钱包三张资产卡在手机上并排，省一屏 */
  .asset-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .asset-card { padding: 11px 11px 11px 14px; border-radius: var(--radius-sm); }
  .asset-card .v { font-size: 18px; margin: 4px 0 1px; }
  .asset-card .k { font-size: 10.5px; gap: 3px; }
  .asset-card .k svg { display: none; }
  .asset-card div.fs12 { font-size: 10px !important; line-height: 1.35; }
  .asset-card .a { display: none; }

  .page-head { margin-bottom: 14px; }
  .page-head h2 { font-size: 18px; }

  .tabbar {
    display: flex;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 55;
    height: 62px; padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface);
    backdrop-filter: blur(22px) saturate(150%);
    -webkit-backdrop-filter: blur(22px) saturate(150%);
    border-top: 1px solid var(--line);
  }
  .tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; font-size: 10px; color: var(--text-3);
    transition: color .16s;
  }
  .tabbar a.active { color: var(--brand); }
  .tabbar a .i { width: 21px; height: 21px; }

  .chat { grid-template-columns: 1fr; height: auto; }
  .chat-main { height: calc(100dvh - var(--top-h) - 62px - 146px); min-height: 340px; }
  .msg { max-width: 94%; }

  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .stat-grid.stat-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-grid.stat-3 .stat { padding: 10px 11px; }
  .stat-grid.stat-3 .stat .v { font-size: 16px; }
  .stat-grid.stat-3 .stat .k { font-size: 10.5px; }
  .stat-grid.stat-3 .stat .k svg { display: none; }
  .stat-grid.stat-3 .stat .d { font-size: 9.5px; line-height: 1.3; white-space: nowrap; }
  .stat { padding: 12px 13px; }

  /* 表格：首末列不折行，避免「基础模型」被压成竖排单字 */
  table.tb th, table.tb td { padding: 9px 9px; font-size: 12px; }
  table.tb td:first-child, table.tb th:first-child,
  table.tb td:last-child, table.tb th:last-child { white-space: nowrap; }
  .stat .v { font-size: 19px; }
  .result-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 9px; }
  .amount-grid { grid-template-columns: repeat(3, 1fr); }
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .tool-card { padding: 12px; }
  .card-pad, .card-b { padding: 14px; }
  .card-h { padding: 13px 14px; }
  .modal { max-width: 100%; }
  .mask { padding: 0; align-items: flex-end; }
  .modal { border-radius: 20px 20px 0 0; max-height: 88vh; }
}

@media (max-width: 420px) {
  /* 工具卡两列更紧凑，一屏能看到 4 个 */
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .tool-card { padding: 11px; gap: 5px; }
  .tool-card .ic { width: 28px; height: 28px; border-radius: 9px; }
  .tool-card .n { font-size: 12.5px; }
  .tool-card .d {
    font-size: 10.5px; line-height: 1.45; flex: 0 0 auto;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
  .ratio-grid { grid-template-columns: repeat(3, 1fr); }
}

/* =====================================================================
   彩色增强层：糖果色标签 / 渐变描边 / 轻动效
   ===================================================================== */

:root {
  --c-pink: #ff4d8d;
  --c-violet: #8b5cf6;
  --c-sky: #38bdf8;
  --c-mint: #22d3a6;
  --c-amber: #fbbf24;
  --c-orange: #fb7185;
}

/* 背景极光缓慢漂浮 */
body::before { animation: aurora 22s ease-in-out infinite alternate; }
@keyframes aurora {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(-1.5%, 1.2%, 0) scale(1.04); }
  100% { transform: translate3d(1.2%, -1%, 0) scale(1.02); }
}

/* 彩色标签 */
.tg {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 8px;
  border-radius: 7px;
  font-size: 11px; font-weight: 650;
  letter-spacing: .01em;
  white-space: nowrap;
}
.tg-pink   { background: rgba(255,77,141,.14);  color: #ff6f9f; box-shadow: inset 0 0 0 1px rgba(255,77,141,.22); }
.tg-violet { background: rgba(139,92,246,.15);  color: #a78bfa; box-shadow: inset 0 0 0 1px rgba(139,92,246,.24); }
.tg-sky    { background: rgba(56,189,248,.14);  color: #4fc3f7; box-shadow: inset 0 0 0 1px rgba(56,189,248,.22); }
.tg-mint   { background: rgba(34,211,166,.14);  color: #34e0b1; box-shadow: inset 0 0 0 1px rgba(34,211,166,.22); }
.tg-amber  { background: rgba(251,191,36,.15);  color: #fbbf24; box-shadow: inset 0 0 0 1px rgba(251,191,36,.24); }
.tg-slate  { background: var(--surface-2); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--line); }

html[data-theme="light"] .tg-pink { color: #e01f66; }
html[data-theme="light"] .tg-violet { color: #6d3ff0; }
html[data-theme="light"] .tg-sky { color: #0b84c4; }
html[data-theme="light"] .tg-mint { color: #0a9a72; }
html[data-theme="light"] .tg-amber { color: #b47400; }

/* 渐变描边卡片（选中态） */
.ring-grad { position: relative; }
.ring-grad::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1.5px;
  background: var(--grad);
  -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: .95;
}

/* 主按钮流光 */
.btn-primary { position: relative; overflow: hidden; }
.btn-primary::after {
  content: ""; position: absolute; top: 0; left: -60%; width: 45%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.38), transparent);
  transform: skewX(-18deg);
  animation: sheen 3.6s ease-in-out infinite;
}
@keyframes sheen {
  0%, 55% { left: -60%; }
  85%, 100% { left: 130%; }
}

/* 呼吸圆点 */
.pulse-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--c-mint); position: relative; flex: 0 0 auto;
}
.pulse-dot::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 1.5px solid var(--c-mint); opacity: .5;
  animation: ping 1.8s cubic-bezier(0,0,.2,1) infinite;
}
.pulse-dot.warn { background: var(--c-amber); }
.pulse-dot.warn::after { border-color: var(--c-amber); }
.pulse-dot.bad { background: var(--bad); }
.pulse-dot.bad::after { border-color: var(--bad); }
@keyframes ping { 75%, 100% { transform: scale(2.1); opacity: 0; } }

/* 卡片悬停微光 */
.card { transition: border-color .28s, box-shadow .28s, transform .28s var(--ease); }
.card.hoverable:hover { transform: translateY(-2px); border-color: rgba(255,77,141,.32); }

/* 工具卡彩色图标 */
.tool-card .ic.pink   { background: rgba(255,77,141,.14); color: var(--c-pink); }
.tool-card .ic.violet { background: rgba(139,92,246,.14); color: var(--c-violet); }
.tool-card .ic.sky    { background: rgba(56,189,248,.14); color: var(--c-sky); }
.tool-card .ic.mint   { background: rgba(34,211,166,.14); color: var(--c-mint); }
.tool-card .ic.amber  { background: rgba(251,191,36,.16); color: var(--c-amber); }
.tool-card .ic.orange { background: rgba(251,113,133,.14); color: var(--c-orange); }

/* 模型选择卡 */
/* 模型选择：两列自适应网格。原来是横向滚动 + 定宽卡片，
   在 344px 的左栏里 2 张卡就等于 345px，第二张被裁掉一截 */
.model-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
@media (min-width: 1500px) { .model-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.model-card {
  flex: none; min-width: 0; width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: var(--surface-2);
  text-align: left;
  transition: all .22s var(--ease);
  position: relative;
}
.model-card:hover { border-color: rgba(255,77,141,.4); transform: translateY(-1px); }
.model-card.active {
  border-color: var(--c-pink);
  background: linear-gradient(135deg, rgba(255,77,141,.14), rgba(139,92,246,.08));
  box-shadow: 0 8px 24px -14px rgba(255,77,141,.9);
}
.model-card .mn { font-size: 12.5px; font-weight: 650; display: flex; align-items: center; gap: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.model-card .mt { font-size: 10.5px; color: var(--text-3); margin-top: 3px; display: flex; gap: 4px; flex-wrap: wrap; }

/* 选项卡选中（比例/画质/数量） */
.ratio, .amount {
  border-width: 1.5px;
  transition: all .2s var(--ease);
}
.ratio.active, .amount.active {
  border-color: var(--c-pink) !important;
  background: linear-gradient(135deg, rgba(255,77,141,.15), rgba(139,92,246,.07)) !important;
  box-shadow: 0 6px 18px -12px rgba(255,77,141,.9);
}
.ratio.active b, .ratio.active span,
.amount.active { color: #ff6f9f !important; }
html[data-theme="light"] .ratio.active b, html[data-theme="light"] .ratio.active span,
html[data-theme="light"] .amount.active { color: #e01f66 !important; }

/* seg 选中态加洋红 */
.seg button.active { color: var(--text); }
.seg button.active::after {
  content: ""; position: absolute; left: 50%; bottom: 2px; transform: translateX(-50%);
  width: 14px; height: 2px; border-radius: 2px; background: var(--grad);
}
.seg button { position: relative; }

/* 侧栏导航 active 更亮 */
.nav-item.active { background: linear-gradient(90deg, rgba(255,77,141,.18), rgba(139,92,246,.08)); }
.nav-item.active .i { color: var(--c-pink); }

/* 统计卡彩色左上角标 */
.stat { border-width: 1px; transition: transform .25s var(--ease), border-color .25s; }
.stat:hover { transform: translateY(-2px); border-color: rgba(255,77,141,.28); }
.stat .v { background: linear-gradient(135deg, var(--text), var(--text)); -webkit-background-clip: text; background-clip: text; }

/* 页头标题渐变字 */
.page-head h2 {
  background: linear-gradient(100deg, var(--text) 30%, #ff6f9f 75%, #a78bfa 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* 悬浮新标签 */
.new-dot {
  position: absolute; top: -4px; right: -6px;
  background: var(--grad); color: #fff;
  font-size: 9px; font-weight: 700; letter-spacing: .04em;
  padding: 1px 5px; border-radius: 5px;
  box-shadow: 0 2px 8px -2px rgba(255,77,141,.9);
}

@media (prefers-reduced-motion: reduce) {
  body::before, .btn-primary::after, .pulse-dot::after { animation: none; }
}

/* 彩色药丸按钮（提示词工具条） */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 28px; padding: 0 10px;
  border-radius: 9px;
  font-size: 11.5px; font-weight: 600;
  border: 1px solid transparent;
  transition: all .18s var(--ease);
  white-space: nowrap;
}
.pill:hover { transform: translateY(-1px); filter: brightness(1.12); }
.pill:active { transform: scale(.96); }
.pill-pink   { background: rgba(255,77,141,.13);  color: #ff6f9f; border-color: rgba(255,77,141,.24); }
.pill-violet { background: rgba(139,92,246,.13);  color: #a78bfa; border-color: rgba(139,92,246,.26); }
.pill-sky    { background: rgba(56,189,248,.13);  color: #4fc3f7; border-color: rgba(56,189,248,.24); }
.pill-mint   { background: rgba(34,211,166,.12);  color: #34e0b1; border-color: rgba(34,211,166,.24); }
.pill-amber  { background: rgba(251,191,36,.14);  color: #fbbf24; border-color: rgba(251,191,36,.26); }
.pill-slate  { background: var(--surface-3); color: var(--text-2); border-color: var(--line); }
html[data-theme="light"] .pill-pink { color: #e01f66; }
html[data-theme="light"] .pill-violet { color: #6d3ff0; }
html[data-theme="light"] .pill-sky { color: #0b84c4; }
html[data-theme="light"] .pill-mint { color: #0a9a72; }
html[data-theme="light"] .pill-amber { color: #b47400; }

/* 灵感卡 */
.insp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.insp {
  text-align: left; padding: 11px 12px; border-radius: 11px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 12px; line-height: 1.55; color: var(--text-2);
  transition: all .18s var(--ease);
}
.insp:hover { border-color: rgba(255,77,141,.4); color: var(--text); transform: translateY(-1px); }
.insp b { display: block; font-size: 12.5px; color: var(--text); margin-bottom: 3px; }
@media (max-width: 560px) { .insp-grid { grid-template-columns: 1fr; } }

/* ---------------- 矮屏（笔记本 1366×660 / 1280×600） ----------------
   13 个菜单项 + 3 个分组标题在 660px 高的视口里装不下，底部会压到用户卡片上。
   这里把品牌区、分组间距、菜单项高度整体压一档，一屏尽量全部露出；
   真的还装不下时 .nav 自己会滚（滚动条已可见）。 */
@media (max-height: 860px) and (min-width: 861px) {
  .side { padding: 8px 12px 6px; }
  .brand { padding: 0 8px 6px; }
  .brand-mark { width: 24px; height: 24px; border-radius: 8px; }
  .brand-mark .i { width: 15px; height: 15px; }
  .brand-name { font-size: 12.5px; }
  .brand-sub { display: none; }
  .nav { padding: 0 4px 4px; }
  .nav-group { padding: 5px 10px 2px; font-size: 9px; line-height: 1.25; }
  .nav-item { height: 27px; }
  .nav-item .i { width: 15px; height: 15px; }
  .side-foot { padding-top: 4px; }
  /* 矮屏下把「积分/充值」两个快捷入口收起来，空间全留给 13 个菜单项 */
  .side-glance { display: none; }
  .user-card { padding: 5px; }
  .user-card .avatar { width: 26px; height: 26px; }
  .user-card .uc-sub { font-size: 10px; }
}

/* 菜单还能往下滚时，底部渐隐，提示「下面还有」—— 光靠 4px 滚动条不够显眼 */
.nav.is-scrollable:not(.at-bottom) {
  -webkit-mask-image: linear-gradient(180deg, #000 0, #000 calc(100% - 30px), transparent 100%);
  mask-image: linear-gradient(180deg, #000 0, #000 calc(100% - 30px), transparent 100%);
}

/* 更矮的窗口（1280×600 这类）：再收一档，13 项也能一屏放下 */
@media (max-height: 640px) and (min-width: 861px) {
  .nav-group { padding: 3px 10px 1px; font-size: 8.5px; }
  .nav-item { height: 24px; font-size: 12px; }
  .side-foot { padding-top: 3px; }
  .user-card .uc-sub { display: none; }
}

/* 移动端抽屉打开时：整个 shell 抬到 tabbar(z-index:55) 之上，
   否则 .shell 自身 z-index:1 形成的层叠上下文会把 .side 关在下面，
   抽屉底部会被 tabbar 压掉 62px。 */
@media (max-width: 860px) {
  body.drawer-open .shell { z-index: 90; }
  body.drawer-open { overflow: hidden; }
}
