/* ==========================================================================
   235导航 · style.css
   设计令牌源自 Figma 导出组件（App.tsx / index.css）：
   - 字体：Inter（正文）+ JetBrains Mono（倒计时/数字）
   - 颜色：Tailwind slate 色板 + 8 个渠道品牌色 + emerald 角标色
   - 圆角：24px 搜索框 / 12px 卡片 / 8px 按钮 / 6px 徽标
   - 布局：左栏 80px | 主内容（居中 max-width 768px）| 右栏 340px
   - 主题：CSS 变量驱动 [data-theme="light"] / [data-theme="dark"]
   ========================================================================== */

/* Google Fonts 导入（Figma index.css 同源；失败时回退系统字体栈） */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ---------- 1. 设计令牌 ---------- */
:root {
  /* 字体 */
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', 'PingFang SC',
    'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* 圆角 */
  --radius-search: 24px;   /* rounded-3xl */
  --radius-card: 12px;     /* rounded-xl */
  --radius-btn: 8px;       /* rounded-lg */
  --radius-sm: 6px;        /* rounded-md */

  /* 阴影 */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.16);

  /* 间距 / 布局 */
  --sidebar-w: 80px;       /* w-20 */
  --aside-w: 340px;        /* w-[340px] */
  --search-h: 48px;        /* h-12 */
  --content-max: 960px;    /* 主内容最大宽度（按反馈由 768px 加宽） */

  /* 品牌色（渠道图标背景） */
  --brand-doubao: #6366f1;
  --brand-douyin: #161823;
  --brand-bilibili: #fb7299;
  --brand-weibo: #e6162d;
  --brand-zhihu: #0084ff;
  --brand-taobao: #ff4400;
  --brand-jd: #e1251b;
  --brand-xiaohongshu: #fe2c55;

  /* 遮罩 / 焦点 */
  --overlay: rgba(15, 23, 42, 0.45);
  --focus-ring: 0 0 0 3px rgba(100, 116, 139, 0.35);
}

/* 亮色模式 */
:root,
[data-theme="light"] {
  --bg: #ffffff;                          /* bg-white */
  --bg-subtle: #f8fafc;                   /* bg-slate-50 */
  --bg-hover: #f1f5f9;                    /* hover:bg-slate-100 */
  --bg-active: #e2e8f0;                   /* hover:bg-slate-200 */
  --card: #f8fafc;                        /* 卡片背景 slate-50 */
  --text: #0f172a;                        /* text-slate-900 */
  --text-strong: #1e293b;                 /* text-slate-800 */
  --text-secondary: #64748b;              /* text-slate-500 */
  --text-tertiary: #94a3b8;               /* text-slate-400 */
  --text-muted: #475569;                  /* text-slate-600 / slate-700 */
  --border: #e2e8f0;                      /* border-slate-200 */
  --border-strong: #cbd5e1;               /* border-slate-300 */
  --border-subtle: #f1f5f9;               /* border-slate-100 */
  --accent: #0f172a;                      /* bg-slate-900（主按钮/激活态） */
  --accent-fg: #ffffff;
  --accent-soft: #f1f5f9;
  --danger: #ef4444;                      /* text-red-500 */
  --danger-soft: #fef2f2;
  --emerald-soft: #ecfdf5;                /* bg-emerald-50 */
  --emerald: #047857;                     /* text-emerald-700 */
  --emerald-border: #a7f3d0;              /* border-emerald-200 */
}

/* 暗色模式 */
[data-theme="dark"] {
  --bg: #0f172a;                          /* dark:bg-slate-900 */
  --bg-subtle: rgba(30, 41, 59, 0.6);     /* dark:bg-slate-800/60 */
  --bg-hover: #334155;                    /* dark:hover:bg-slate-700 */
  --bg-active: #334155;                   /* dark:bg-slate-700 */
  --card: rgba(30, 41, 59, 0.6);          /* dark:bg-slate-800/60 */
  --text: #f1f5f9;                        /* dark:text-slate-100 */
  --text-strong: #f1f5f9;                 /* dark:text-slate-100 */
  --text-secondary: #94a3b8;              /* dark:text-slate-400 */
  --text-tertiary: #64748b;               /* dark:text-slate-500 */
  --text-muted: #cbd5e1;                  /* dark:text-slate-300 */
  --border: rgba(51, 65, 85, 0.6);        /* dark:border-slate-700/60 */
  --border-strong: #334155;               /* dark:border-slate-700 */
  --border-subtle: rgba(51, 65, 85, 0.6);
  --accent: #f1f5f9;                      /* dark:bg-slate-100 */
  --accent-fg: #0f172a;                   /* dark:text-slate-900 */
  --accent-soft: #1e293b;
  --danger: #ef4444;
  --danger-soft: #3b1f24;
  --emerald-soft: rgba(6, 78, 59, 0.3);   /* dark:bg-emerald-900/30 */
  --emerald: #34d399;                     /* dark:text-emerald-400 */
  --emerald-border: #065f46;              /* dark:border-emerald-800 */
  --overlay: rgba(0, 0, 0, 0.6);
  --focus-ring: 0 0 0 3px rgba(148, 163, 184, 0.4);
}

/* ---------- 2. Reset & 基础 ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, p {
  margin: 0;
}

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

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  padding: 0;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ---------- 3. 隐私模式警告条（原顶部安全提示条已移除，缩简为交易模块内提示） ---------- */
.privacy-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--danger-soft);
  border-bottom: 1px solid var(--danger);
  color: var(--danger);
  padding: 8px 20px;
  font-size: 13px;
}

.privacy-banner__icon {
  flex: none;
  font-size: 15px;
}

/* ---------- 4. 主体布局：左导航 80px | 主内容 | 右日历 340px ---------- */
.app-layout {
  flex: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--aside-w);
  grid-template-rows: auto minmax(0, 1fr);
  width: 100%;
}

/* 工作台视图：收起右栏列，主内容全屏（仅保留左导航） */
.app-layout--workbench {
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
}

/* 左导航 */
.sidebar {
  grid-column: 1;
  grid-row: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 0;
  background: var(--bg-subtle);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100dvh;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-card);
  color: var(--text-tertiary);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  display: block;
}

.nav-item .nav-item__label {
  font-size: 9px;
  font-weight: 500;
  line-height: 1;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-muted);
}

.nav-item.is-active {
  background: var(--accent);
  color: var(--accent-fg);
  box-shadow: var(--shadow-sm);
}

/* 主内容列 */
.main-area {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* 视图容器：内容居中（max-w-3xl = 768px） */
.view {
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
  padding: 24px 32px 48px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  animation: viewFade 0.18s ease;
}

/* 工作台视图全屏（无最大宽度限制，铺满主内容区） */
.view--full {
  max-width: none;
  margin: 0;
}

@keyframes viewFade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* 右栏日历（位于顶部分区下方 · 第 3 列第 2 行） */
.home-aside {
  grid-column: 3;
  grid-row: 2;
  position: sticky;
  top: 0;
  max-height: 100dvh;
  overflow-y: auto;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.home-aside::-webkit-scrollbar { width: 6px; }
.home-aside::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ---------- 5. 顶部品牌条（跨到右侧边框 + 底部分隔线） ---------- */
.brand-bar {
  grid-column: 2 / -1;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 32px;
  border-bottom: 1px solid var(--border);
}

.brand-bar--minimal {
  align-items: center;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: var(--text);
}

.brand__line {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.brand__title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  color: var(--text);
  display: flex;
  align-items: center;
}

.brand__logo {
  height: 24px;
  width: auto;
  display: inline-block;
  vertical-align: middle;
}

.brand__title-light {
  font-weight: 300;
  color: var(--text-tertiary);
}

.brand__tagline {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.brand__slogan {
  font-size: 11px;
  color: var(--text-tertiary);
}

.brand-bar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 通用按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-btn);
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  min-height: 40px;
}

.btn:hover {
  background: var(--bg-hover);
}

/* 设为首页：小号描边按钮（Figma px-3 py-1.5 text-xs rounded-lg） */
.btn-outline {
  min-height: 0;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-btn);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
}

.btn-outline:hover {
  background: var(--bg-hover);
}

/* 图标按钮（主题切换：32px = w-8 h-8） */
.btn-icon {
  width: 32px;
  height: 32px;
  min-height: 0;
  padding: 0;
  border-radius: var(--radius-btn);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon svg {
  width: 14px;
  height: 14px;
  display: block;
}

.btn-icon:hover {
  background: var(--bg-hover);
}

.btn--muted {
  color: var(--text-secondary);
  border-color: var(--border);
}

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

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

/* ---------- 6. 搜索区 ---------- */
.search {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 统一搜索框：引擎 + 输入 + 搜索按钮包裹在内，流动彩色渐变色边框 */
.search__box {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  height: var(--search-h);
  padding: 6px;
  border-radius: var(--radius-search);
  background: var(--bg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease;
}

.search__box:focus-within {
  box-shadow: var(--shadow-md);
}

/* 渐变边框：静态五色，聚焦时缓慢呼吸（opacity 脉动） */
.search__box::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2px;
  background: linear-gradient(90deg, #6366f1, #0084ff, #06b6d4, #fb7299, #fe2c55);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: 0.55;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

/* 聚焦时缓慢呼吸 */
.search__box:focus-within::before {
  animation: search-border-breath 2.4s ease-in-out infinite;
}

@keyframes search-border-breath {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* 引擎下拉：容器 + 隐藏原生箭头 + chevron */
.search__engine-wrap {
  position: relative;
  flex: none;
}

.search__engine {
  height: 36px;
  padding: 0 30px 0 14px;   /* 右侧留出 chevron 空间 */
  border: none;
  border-right: 1px solid var(--border);  /* 与输入区之间的分隔线 */
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  white-space: nowrap;
}

.search__engine-chevron {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  pointer-events: none;
  color: var(--text-tertiary);
}

.search__input {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 12px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.search__input::placeholder {
  color: var(--text-tertiary);
}

.search__btn {
  flex: none;
  height: 36px;
  padding: 0 22px;
  border-radius: 18px;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 14px;
  font-weight: 500;
  transition: filter 0.2s ease;
}

.search__btn:hover {
  filter: brightness(1.08);
}

/* 渠道：文字 pill 形式（无图标） */
.channel-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 4px;
}

.channel-tile {
  display: inline-flex;
  align-items: center;
  padding: 7px 16px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  line-height: 1.3;
}

.channel-tile:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--border-strong);
}

.channel-tile__label {
  line-height: 1;
}

/* 剪贴板降级文本框 */
.clipboard-fallback {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
  animation: viewFade 0.18s ease;
}

.clipboard-fallback input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  padding: 8px 12px;
  background: var(--card);
  min-width: 0;
}

/* ---------- 7. 内容区 ---------- */
.content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* 模块标题（Figma SectionHeader：标题 + 角标 + 分隔线） */
.module__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.module__title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
  margin-left: 4px;
}

.module__badge {
  font-size: 10px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--emerald-soft);
  color: var(--emerald);
  border: 1px solid var(--emerald-border);
  line-height: 1.4;
  white-space: nowrap;
}

/* 交易模块安全提示（缩简版，位于官方认证角标之后） */
.module__hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 8. 常用网站网格（grid-cols-9） ---------- */
.sites-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 8px;
}

/* 空状态横跨整个网格 */
.sites-grid .empty-state {
  grid-column: 1 / -1;
}

.site-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 4px;
  border-radius: var(--radius-card);
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.site-card:hover {
  background: var(--bg-hover);
  transform: translateY(-2px);
}

.site-card__icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.site-card__icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.2s ease;
}

.site-card__icon img.fav-loaded {
  opacity: 1;
}

.site-card__name {
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-card__actions {
  position: absolute;
  top: 4px;
  right: 4px;
  display: none;
  gap: 4px;
  z-index: 2;
}

.site-card:hover .site-card__actions,
.site-card:focus-within .site-card__actions {
  display: flex;
}

.site-card__action {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.site-card__action:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.add-site {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 4px;
  border-radius: var(--radius-card);
  color: var(--text-tertiary);
  font-size: 11px;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.add-site .add-site__icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-card);
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border: 1px dashed var(--border-strong);
}

.add-site:hover {
  color: var(--text-muted);
  background: var(--bg-hover);
}

.restore-default {
  margin-top: 12px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  padding: 10px;
  color: var(--text-secondary);
  background: var(--card);
  font-size: 13px;
}

.restore-default:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
  border: 1px dashed var(--border);
  border-radius: var(--radius-card);
}

.empty-state__icon {
  font-size: 40px;
  display: block;
  margin-bottom: 10px;
}

/* ---------- 9. 交易导航（grid-cols-4 · 纵向卡片） ---------- */
.trade-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.trade-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-card);
  background: var(--card);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  text-align: left;
}

.trade-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.trade-card__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  background: var(--trade-color, var(--text-tertiary));
}

.trade-card__icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.trade-card__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-strong);
}

.trade-card__users {
  font-size: 12px;
  color: var(--text-tertiary);
}

.trade-card__badge {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--emerald-soft);
  color: var(--emerald);
  border: 1px solid var(--emerald-border);
  line-height: 1.4;
  white-space: nowrap;
}

/* 角标变体（安全保障 / 正版授权 / 老牌平台） */
.trade-card__badge--security { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.trade-card__badge--authorized { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.trade-card__badge--platform { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }

[data-theme="dark"] .trade-card__badge--security { background: rgba(120, 53, 15, 0.3); color: #fbbf24; border-color: #92400e; }
[data-theme="dark"] .trade-card__badge--authorized { background: rgba(6, 78, 59, 0.3); color: #34d399; border-color: #065f46; }
[data-theme="dark"] .trade-card__badge--platform { background: rgba(30, 58, 138, 0.3); color: #60a5fa; border-color: #1e3a8a; }

/* ---------- 10. 游戏日历（右栏） ---------- */
.calendar__section {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.calendar__section:last-child {
  border-bottom: 0;
}

.calendar__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 16px;
}

.calendar__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-strong);
}

.calendar__subtitle {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.calendar__date {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.calendar__update-tip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-btn);
  background: var(--accent-soft);
  border: 1px solid var(--border-strong);
  font-size: 13px;
  color: var(--text);
  margin-bottom: 12px;
}

.calendar__update-tip .btn {
  min-height: 28px;
  padding: 3px 12px;
  font-size: 12px;
}

.calendar__update-tip .tip-close {
  margin-left: auto;
  color: var(--text-tertiary);
}

/* 游戏卡片：列表行（Figma border-b）；app.js 平铺渲染 name/time/countdown，
   用 grid-template-areas 定位为「左名称+时间 / 右倒计时」 */
.game-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "name side"
    "time side";
  column-gap: 12px;
  row-gap: 2px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color 0.15s ease;
}

.game-card:last-child {
  border-bottom: 0;
}

.game-card__name {
  grid-area: name;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-card__time {
  grid-area: time;
  font-size: 12px;
  color: var(--text-tertiary);
}

.game-card__countdown,
.game-card__days {
  grid-area: side;
  justify-self: end;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.game-card__countdown {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.game-card__countdown.is-urgent {
  color: var(--danger);
}

.game-card__days {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.calendar__empty,
.calendar__error {
  padding: 20px;
  text-align: center;
  color: var(--text-secondary);
  border: 1px dashed var(--border);
  border-radius: var(--radius-card);
  font-size: 13px;
}

.calendar__error {
  border-color: var(--danger);
  color: var(--danger);
}

.calendar__error .btn {
  margin-top: 10px;
}

/* 骨架屏 */
.skeleton {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skeleton__item {
  height: 56px;
  border-radius: var(--radius-btn);
  background: var(--card);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.skeleton__item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--bg-hover), transparent);
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

/* ---------- 11. 工作台 ---------- */
.workbench__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 4px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.workbench__header h1 {
  font-size: 20px;
  font-weight: 700;
}

.workbench__heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.workbench__tagline {
  font-size: 12px;
  color: var(--text-tertiary);
}

.workbench__header .wb-date {
  font-size: 14px;
  color: var(--text-secondary);
}

.workbench__header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(10px, 1vw, 16px);
  align-items: start;
}

.tool-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.2s ease;
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

/* 尺寸：记账本 2/3、计算器 1/3、小组件 1/4（12 列网格） */
.tool-card--large {
  grid-column: span 8;
  padding: 24px;
}

.tool-card--medium {
  grid-column: span 4;
  padding: 20px;
}

.tool-card--small {
  grid-column: span 3;
  padding: 16px;
}

/* 拖拽状态 */
.tool-card.is-dragging {
  opacity: 0.45;
  transform: scale(0.98);
  box-shadow: var(--shadow-lg);
}

.tool-card.drag-over {
  border-style: dashed;
  background: var(--accent-soft);
}

.tool-card__title {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 28px; /* 给拖拽手柄留空间 */
}

.tool-card--placeholder {
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  border-style: dashed;
  min-height: 200px;
  text-align: center;
}

/* 拖拽手柄（悬停显示） */
.drag-handle {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 15px;
  line-height: 1;
  color: var(--text-tertiary);
  cursor: grab;
  opacity: 0;
  transition: opacity 0.2s ease, color 0.2s ease;
  user-select: none;
  z-index: 2;
}

.tool-card:hover .drag-handle,
.tool-card.is-dragging .drag-handle {
  opacity: 1;
}

.drag-handle:hover {
  color: var(--text);
}

.drag-handle:active {
  cursor: grabbing;
}

/* ---------- 工作台小组件（待办 / 灵感 / 日历） ---------- */
.ws-input-row {
  display: flex;
  gap: 8px;
}

.ws-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  padding: 8px 12px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.ws-input:focus {
  border-color: var(--border-strong);
}

.ws-textarea {
  resize: none;
  font-family: inherit;
}

/* 行内编辑输入框 */
.ws-edit-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  outline: none;
}

.ws-stats {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.ws-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
}

/* 待办项 */
.ws-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-btn);
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 13px;
}

.ws-item__checkbox {
  flex: none;
  margin-top: 2px;
  cursor: pointer;
}

.ws-item__text {
  flex: 1;
  min-width: 0;
  word-break: break-word;
  line-height: 1.5;
}

.ws-item.is-done .ws-item__text {
  text-decoration: line-through;
  color: var(--text-tertiary);
}

.ws-item__del {
  flex: none;
  color: var(--text-tertiary);
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.ws-item:hover .ws-item__del {
  opacity: 1;
}

.ws-item__del:hover {
  color: var(--danger);
}

/* 灵感项 */
.ws-spark {
  padding: 8px 10px;
  border-radius: var(--radius-btn);
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.5;
  position: relative;
}

.ws-spark__text {
  word-break: break-word;
  white-space: pre-wrap;
}

.ws-spark__meta {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* #标签 Chip */
.ws-tag {
  display: inline-block;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  margin-right: 4px;
}

/* 日历 */
.ws-cal__nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.ws-cal__title {
  font-size: 14px;
  font-weight: 600;
}

.ws-cal__nav button {
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
}

.ws-cal__nav button:hover {
  background: var(--bg-hover);
}

.ws-cal__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
}

.ws-cal__weekday {
  font-size: 11px;
  color: var(--text-tertiary);
  padding: 4px 0;
}

.ws-cal__weekday.rest {
  color: var(--text-tertiary);
}

.ws-cal__cell {
  position: relative;
  min-height: 40px;
  padding: 4px 0;
  font-size: 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
}

.ws-cal__cell:hover {
  background: var(--bg-hover);
}

.ws-cal__cell.dim {
  color: var(--text-tertiary);
}

.ws-cal__cell.rest {
  color: var(--text-tertiary);
}

.ws-cal__cell.today {
  box-shadow: inset 0 0 0 1.5px var(--accent);
  font-weight: 700;
}

.ws-cal__cell.selected {
  background: var(--accent-soft);
}

.ws-cal__detail {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-btn);
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
}

/* 日历格里的农历/节气/节日小字 */
.ws-cal__cell {
  gap: 1px;
}

.ws-cal__lunar {
  font-size: 10px;
  line-height: 1;
  color: var(--text-tertiary);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-cal__lunar.term {
  color: #16a34a;
  font-weight: 600;
}

.ws-cal__lunar.fest {
  color: #dc2626;
  font-weight: 600;
}

.ws-cal__lunar.lunar-first {
  color: var(--text-secondary);
  font-weight: 600;
}

/* 日历格右上角：当日盈亏（账册联动） */
.ws-cal__profit {
  position: absolute;
  top: 2px;
  right: 3px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.ws-cal__profit.pos { color: var(--danger); }
.ws-cal__profit.neg { color: #16a34a; }

/* 日历下方：本月/本周盈亏汇总 */
.ws-cal__summary {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.ws-cal__stat {
  flex: 1;
  text-align: center;
  padding: 8px 4px;
  border-radius: var(--radius-btn);
  background: var(--bg);
  border: 1px solid var(--border);
}

.ws-cal__stat-label {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.ws-cal__stat-value {
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ws-cal__stat-value.pos { color: var(--danger); }
.ws-cal__stat-value.neg { color: #16a34a; }

/* ---------- 卡片折叠 / 展开 ---------- */
.tool-card__title.is-collapsible {
  cursor: pointer;
  user-select: none;
  padding-right: 56px;
}

.tool-card__title.is-collapsible::after {
  content: '▾';
  margin-left: auto;
  font-size: 12px;
  color: var(--text-tertiary);
}

.tool-card.is-collapsed .tool-card__title.is-collapsible::after {
  content: '▸';
}

.tool-card.is-collapsed .tool-card__body {
  display: none;
}

/* ---------- 待办优先级 P0-P4 ---------- */
.ws-prio {
  flex: none;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--card);
}

.ws-prio.p0 { color: #dc2626; border-color: #fca5a5; }
.ws-prio.p1 { color: #db2777; border-color: #f9a8d4; }
.ws-prio.p2 { color: #d97706; border-color: #fcd34d; }
.ws-prio.p3 { color: #16a34a; border-color: #86efac; }
.ws-prio.p4 { color: #64748b; border-color: #cbd5e1; }

/* ---------- 子任务 / 二级灵感 ---------- */
.ws-sub {
  margin-left: 20px;
  padding-left: 10px;
  border-left: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ws-add-sub {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}

.ws-add-sub input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 12px;
  background: var(--bg);
  color: var(--text);
  outline: none;
}

/* 待办行操作按钮 */
.ws-item__op {
  flex: none;
  font-size: 12px;
  color: var(--text-tertiary);
  opacity: 0;
  transition: opacity 0.15s ease;
  white-space: nowrap;
}

.ws-item:hover .ws-item__op {
  opacity: 1;
}

.ws-item__op:hover {
  color: var(--accent);
}

/* 灵感操作按钮 */
.ws-spark__ops {
  display: flex;
  gap: 6px;
  align-items: center;
}

.ws-spark__ops button {
  font-size: 12px;
  color: var(--text-tertiary);
}

.ws-spark__ops button:hover {
  color: var(--accent);
}

.ws-spark:hover .ws-item__del {
  opacity: 1;
}

/* 待办拖拽 */
.ws-item.is-dragging {
  opacity: 0.5;
}

.ws-item.drag-over {
  border-top: 2px solid var(--accent);
}

.timer__display {
  font-family: var(--font-mono);
  font-size: 44px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
}

.timer__controls {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* 全局总览（6 指标） */
.ledger__overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  text-align: center;
}

.ledger__stat {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  padding: 10px;
}

.ledger__stat-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.ledger__stat-value {
  font-size: 18px;
  font-weight: 700;
}

.ledger__stat-value.income { color: var(--danger); }
.ledger__stat-value.expense { color: #16a34a; }
.ledger__stat-value.profit { color: var(--text); }

/* 按游戏分账 */
.ledger__subtitle {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-top: 4px;
}

.ledger__bygame {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.ledger-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  white-space: nowrap;
}

.ledger-table th,
.ledger-table td {
  padding: 8px 10px;
  text-align: right;
  border-bottom: 1px solid var(--border-subtle);
}

.ledger-table th:first-child,
.ledger-table td:first-child {
  text-align: left;
}

.ledger-table thead th {
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.ledger-table__pos { color: var(--danger); }
.ledger-table__neg { color: #16a34a; }

/* 记账本左右分栏：左主体 + 右账册记录（可滚动） */
.ledger__split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-height: 0;
}

.ledger__col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ledger__col--records {
  max-height: 460px;
}

.ledger__col--records .ledger__list {
  flex: 1;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
}

.ledger__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}

.ledger-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-btn);
  background: var(--bg);
  border: 1px solid var(--border);
}

.ledger-item__type {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-btn);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  background: var(--bg-hover);
}

.ledger-item__main {
  flex: 1;
  min-width: 0;
}

.ledger-item__category {
  font-size: 13px;
  font-weight: 600;
}

.ledger-item__meta {
  font-size: 11px;
  color: var(--text-secondary);
}

.ledger-item__sub {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 1px;
}

.ledger-item__rate {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.ledger-item__rate.is-pos { color: var(--danger); }
.ledger-item__rate.is-neg { color: #16a34a; }

.ledger-item__amount {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ledger-item__amount.income { color: var(--danger); }
.ledger-item__amount.expense { color: #16a34a; }

.ledger-item__delete {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-btn);
  color: var(--text-secondary);
  font-size: 14px;
}

.ledger-item__delete:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.ledger__actions {
  display: flex;
  gap: 10px;
}

.ledger__actions .btn {
  flex: 1;
}

.calc__display {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-height: 56px;
}

.calc__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.calc__key {
  padding: 14px 0;
  border-radius: var(--radius-btn);
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 17px;
  font-weight: 600;
  transition: background-color 0.15s ease;
}

.calc__key:hover {
  background: var(--bg-hover);
}

.calc__key--op {
  background: var(--accent-soft);
  color: var(--text);
}

.calc__key--eq {
  background: var(--accent);
  color: var(--accent-fg);
}

/* 计算器模式切换 */
.calc__modes {
  display: flex;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  padding: 4px;
}

.calc__mode {
  flex: 1;
  padding: 8px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  color: var(--text-secondary);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.calc__mode.is-active {
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.calc__panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 搬砖专用子 Tab */
.calc__subtabs {
  display: flex;
  gap: 6px;
}

.calc__subtab {
  flex: 1;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.calc__subtab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}

.calc__farming-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.calc__farming-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.calc__farming-result {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
}

.calc__farming-result .is-neg {
  color: #16a34a;
}

/* ---------- 12. 模态弹窗 ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  animation: overlayFade 0.18s ease;
}

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

.modal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 440px;
  max-height: 85dvh;
  display: flex;
  flex-direction: column;
  animation: modalPop 0.2s ease;
}

@keyframes modalPop {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 12px;
}

.modal__title {
  font-size: 17px;
  font-weight: 700;
}

.modal__close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-btn);
  font-size: 16px;
  color: var(--text-secondary);
}

.modal__close:hover {
  background: var(--bg-hover);
}

.modal__body {
  padding: 4px 20px 20px;
  overflow-y: auto;
}

.modal__footer {
  padding: 0 20px 20px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.form-field {
  margin-bottom: 14px;
}

.form-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  padding: 9px 12px;
  background: var(--card);
  color: var(--text);
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.form-field .form-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.form-field .form-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
}

.form-row {
  display: flex;
  gap: 10px;
}

.form-row .form-field {
  flex: 1;
}

.segmented {
  display: flex;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  padding: 4px;
}

.segmented button {
  flex: 1;
  padding: 8px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  color: var(--text-secondary);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.segmented button.is-active {
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.guide-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.guide-tabs button {
  flex: 1;
  padding: 8px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.guide-tabs button.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}

.guide-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.guide-head__icon {
  font-size: 28px;
  line-height: 1;
}

.guide-head__name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.guide-step {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  align-items: flex-start;
}

.guide-step__num {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.guide-step__text {
  font-size: 14px;
  color: var(--text);
}

/* ---------- 13. Toast ---------- */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  align-items: center;
  width: max-content;
  max-width: calc(100vw - 40px);
}

.toast {
  padding: 10px 18px;
  border-radius: var(--radius-card);
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.2s ease;
  max-width: 100%;
}

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

.toast.is-leaving {
  opacity: 0;
  transition: opacity 0.2s ease;
}

/* ---------- 14. Bottom Sheet ---------- */
.bottom-sheet {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.bottom-sheet__mask {
  position: absolute;
  inset: 0;
  background: var(--overlay);
  animation: overlayFade 0.18s ease;
}

.bottom-sheet__panel {
  position: relative;
  width: 100%;
  max-width: 560px;
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  padding: 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  animation: sheetUp 0.24s ease;
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to { transform: none; }
}

.bottom-sheet__title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
}

/* ---------- 15. 页脚 ---------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 20px;
  margin-top: 24px;
}

.footer__inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.footer__links a,
.footer__links button {
  color: var(--text-secondary);
  font-size: 12px;
  text-decoration: none;
}

.footer__links a:hover,
.footer__links button:hover {
  color: var(--accent);
  text-decoration: underline;
}

.footer__icp {
  color: var(--text-secondary);
  font-size: 12px;
  text-decoration: none;
}

.footer__icp:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* ---------- 16. 底部 Tab（移动端） ---------- */
.bottom-tab {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  z-index: 90;
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-tab__inner {
  display: flex;
  height: 64px;
}

.bottom-tab .nav-item {
  flex: 1;
  width: auto;
  height: auto;
  gap: 2px;
  border-radius: 0;
  padding: 8px 0;
}

.bottom-tab .nav-item svg {
  width: 22px;
  height: 22px;
}

.bottom-tab .nav-item .nav-item__label {
  font-size: 11px;
}

/* 持久存储警告条 */
.storage-warning {
  background: var(--danger-soft);
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 8px 14px;
  border-radius: var(--radius-btn);
  font-size: 13px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------- 17. 响应式 ---------- */
@media (max-width: 1100px) {
  .app-layout {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr) 300px;
  }

  /* 中等屏：工具卡 2 列（大/中卡片整行、小卡片半行） */
  .tools-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .tool-card--large,
  .tool-card--medium {
    grid-column: 1 / -1;
  }

  .tool-card--small {
    grid-column: span 1;
  }
}

@media (max-width: 900px) {
  .app-layout {
    grid-template-columns: 64px minmax(0, 1fr);
    grid-template-rows: auto auto auto;
  }

  .sidebar {
    grid-row: 1 / 3;
    padding: 24px 0;
  }

  .home-aside {
    grid-column: 1 / -1;
    grid-row: 3;
    position: static;
    max-height: none;
    border-left: 0;
    border-top: 1px solid var(--border);
  }

  .home-aside .calendar__upcoming,
  .home-aside .calendar__recent {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
  }

  .sites-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (max-width: 767px) {
  body {
    padding-bottom: 64px;
  }

  .view {
    padding: 24px 16px 32px;
    gap: 24px;
  }

  .app-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }

  .sidebar {
    display: none;
  }

  .bottom-tab {
    display: block;
  }

  .brand-bar {
    grid-column: 1;
    grid-row: 1;
    padding: 16px;
  }

  .main-area {
    grid-column: 1;
    grid-row: 2;
  }

  .home-aside {
    grid-column: 1;
    grid-row: 3;
  }

  .sites-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
  }

  .trade-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

  /* 移动端：所有卡片单列，禁用拖拽（手柄隐藏） */
  .tool-card--large,
  .tool-card--medium,
  .tool-card--small {
    grid-column: span 1;
  }

  /* 记账本左右分栏在移动端改为上下堆叠 */
  .ledger__split {
    grid-template-columns: 1fr;
  }

  .ledger__col--records {
    max-height: 320px;
  }

  .drag-handle {
    display: none;
  }

  .workbench__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .search__btn {
    padding: 0 16px;
  }
}

@media (min-width: 768px) {
  .bottom-tab {
    display: none;
  }
}

/* 触摸设备：悬停操作按钮常驻但弱化 */
@media (pointer: coarse) {
  .site-card__actions {
    display: flex;
    opacity: 0.85;
  }
}
