/* ==========================================================================
   工具坞 TOOLDOCK — 共享设计系统
   参考 mirrorchyan.com(Tailwind + HeroUI):蓝色主色 · 浅色净面 · 柔和圆角
   浅色 + 深色双主题 · 平稳过渡(无弹跳 / 抖动)
   ========================================================================== */

:root {
  /* 中性面 —— 浅色 */
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f2f4;
  --surface-3: #e8eaed;
  --fg: #11181c;
  --fg-2: #3f4750;
  --muted: #6b7280;
  --muted-2: #9ca3af;
  --border: #e5e7eb;
  --border-strong: #d5d8dd;
  --card-border: #eef0f3;

  /* 强调色 —— 白灰黑单色系(近黑) */
  --accent: #1a1a1e;
  --accent-hover: #333338;
  --accent-active: #0a0a0c;
  --accent-fg: #ffffff;
  --accent-text: #1a1a1e;
  --accent-soft: #f2f2f4;
  --accent-soft-border: #e3e3e6;
  --sky: #1a1a1e;

  /* 语义色 */
  --success: #15ba11;
  --success-soft: #e4f8e3;
  --success-fg: #0b6a26;

  /* 圆角(柔和,无全椭圆) */
  --r-xs: 6px;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 14px;
  --r-xl: 18px;
  --r-2xl: 24px;

  /* 阴影(柔和) */
  --shadow-sm: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
  --shadow: 0 2px 8px rgba(16,24,40,.06), 0 6px 18px rgba(16,24,40,.05);
  --shadow-lg: 0 10px 28px rgba(16,24,40,.10), 0 3px 10px rgba(16,24,40,.06);
  --shadow-xl: 0 24px 56px rgba(16,24,40,.18), 0 8px 20px rgba(16,24,40,.10);

  /* 字体 */
  --font-display: "Plus Jakarta Sans", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-body: "Inter", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;

  /* 缓动(平稳,无过冲) */
  --ease: cubic-bezier(.4, 0, .2, 1);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --dur: .18s;

  --focus: var(--accent);
  --maxw: 1200px;
}

html[data-theme="dark"] {
  --bg: #0a0a0b;
  --surface: #141416;
  --surface-2: #1c1c1f;
  --surface-3: #26262b;
  --fg: #ececee;
  --fg-2: #c2c6ca;
  --muted: #9aa0a6;
  --muted-2: #6b7076;
  --border: rgba(255,255,255,.10);
  --border-strong: rgba(255,255,255,.17);
  --card-border: rgba(255,255,255,.08);

  --accent: #f4f4f5;
  --accent-hover: #e2e2e6;
  --accent-active: #cfcfd4;
  --accent-fg: #17171a;
  --accent-text: #f4f4f5;
  --accent-soft: rgba(255,255,255,.10);
  --accent-soft-border: rgba(255,255,255,.20);
  --sky: #f4f4f5;

  --success: #2ec25a;
  --success-soft: rgba(46,194,90,.16);
  --success-fg: #56d364;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.5);
  --shadow: 0 4px 14px rgba(0,0,0,.55);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.6);
  --shadow-xl: 0 28px 64px rgba(0,0,0,.7);
}

/* ---------- 复位 ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--fg-2);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* ---------- 排版 ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--fg);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -.02em;
}
h1 { font-size: clamp(30px, 4vw, 46px); letter-spacing: -.03em; }
h2 { font-size: clamp(22px, 2.4vw, 28px); }
h3 { font-size: 19px; letter-spacing: -.01em; font-weight: 600; }
h4 { font-size: 15px; font-weight: 600; letter-spacing: 0; }

.eyebrow {
  font-family: var(--font-body);
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--accent-text);
}
.mono { font-family: var(--font-mono); font-feature-settings: "zero" 1; }
.muted { color: var(--muted); }
::selection { background: var(--accent-soft); color: var(--accent-active); }

/* ---------- 焦点 ---------- */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-xs); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border-radius: var(--r);
  font-family: var(--font-body); font-weight: 600; font-size: 15px;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--accent); color: var(--accent-fg); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-hover); box-shadow: var(--shadow); }
.btn-primary:active { background: var(--accent-active); }

.btn-secondary { background: var(--surface); color: var(--fg); border: 1px solid var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--muted-2); }

.btn-soft { background: var(--accent-soft); color: var(--accent-text); border: 1px solid var(--accent-soft-border); }
.btn-soft:hover { background: var(--accent-soft-border); }

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

.btn-sm { min-height: 36px; padding: 0 13px; font-size: 13.5px; border-radius: var(--r-sm); }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: var(--r-sm);
  color: var(--fg-2); border: 1px solid var(--border); background: var(--surface);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--fg); border-color: var(--border-strong); }
.icon-btn:active { transform: translateY(1px); }

/* ---------- 输入 ---------- */
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--fg); margin-bottom: 7px; }
.input, .textarea, .select {
  width: 100%; min-height: 44px; padding: 10px 14px;
  background: var(--surface); color: var(--fg);
  border: 1px solid var(--border-strong); border-radius: var(--r);
  font-size: 15px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 38px;
}
.search { position: relative; display: flex; align-items: center; }
.search .fa-magnifying-glass { position: absolute; left: 15px; color: var(--muted); font-size: 14px; pointer-events: none; }
.search .input { padding-left: 40px; }

/* ---------- 卡片 ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }

/* ---------- 图标位(圆角方块) ---------- */
.icon-tile {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r); background: var(--surface-2); color: var(--fg);
  border: 1px solid var(--border); flex: none;
}
.icon-tile.accent { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-soft-border); }
.icon-tile.lg { width: 60px; height: 60px; font-size: 26px; border-radius: var(--r-lg); }
.icon-tile.md { width: 50px; height: 50px; font-size: 22px; }
.icon-tile.sm { width: 38px; height: 38px; font-size: 16px; border-radius: var(--r-sm); }

/* ---------- 分类筹码(圆角矩形) ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 38px; padding: 0 15px; border-radius: var(--r-sm);
  background: var(--surface); color: var(--fg-2);
  border: 1px solid var(--border);
  font-size: 14px; font-weight: 550; white-space: nowrap;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.chip:hover { background: var(--surface-2); color: var(--fg); border-color: var(--border-strong); }
.chip.active { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }

/* ---------- 标签 ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  height: 23px; padding: 0 9px; border-radius: var(--r-xs);
  background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--border); font-size: 12px; font-weight: 550;
}
.tag.accent { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-soft-border); }
.tag.success { background: var(--success-soft); color: var(--success-fg); border-color: transparent; }
.tag.solid { background: var(--fg); color: var(--bg); border-color: var(--fg); }

/* ---------- 分段控件(系统 / 架构 / 渠道) ---------- */
.segmented {
  display: inline-flex; gap: 4px; padding: 4px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r);
}
.segmented button {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 34px; padding: 0 14px; border-radius: var(--r-sm);
  color: var(--muted); font-size: 13.5px; font-weight: 550;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.segmented button:hover { color: var(--fg); }
.segmented button[aria-selected="true"] { background: var(--accent); color: var(--accent-fg); }
.segmented button:disabled { opacity: .34; cursor: not-allowed; }

.divider { height: 1px; background: var(--border); border: 0; }

/* ---------- 3 行截断 ---------- */
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- 入场过渡(平稳,无过冲) ---------- */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 10px; z-index: 200; pointer-events: none; }
.toast {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 18px; background: var(--fg); color: var(--bg);
  border-radius: var(--r); font-size: 14px; font-weight: 550;
  box-shadow: var(--shadow-lg); animation: pop-in .22s var(--ease-out);
}
.toast i { font-size: 15px; }
.toast i.ok { color: var(--success); }

/* ---------- 顶栏 / 导航 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in oklch, var(--bg) 80%, transparent);
  backdrop-filter: saturate(1.5) blur(14px); -webkit-backdrop-filter: saturate(1.5) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { max-width: var(--maxw); margin: 0 auto; padding: 13px 24px; display: flex; align-items: center; gap: 18px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 18px; color: var(--fg); letter-spacing: -.02em; }
.brand .mark { width: 34px; height: 34px; border-radius: var(--r-sm); background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; box-shadow: var(--shadow-sm); }
.brand small { font-family: var(--font-mono); font-size: 10px; letter-spacing: .16em; color: var(--muted); font-weight: 500; }

.navlinks { display: flex; align-items: center; gap: 4px; }
.navlinks a { padding: 8px 12px; border-radius: var(--r-sm); font-size: 14.5px; font-weight: 550; color: var(--fg-2); transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
.navlinks a:hover { background: var(--surface-2); color: var(--fg); }
.navlinks a.active { color: var(--accent-text); background: var(--accent-soft); }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------- 主题切换(圆角矩形段控) ---------- */
.theme-toggle { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); }
.theme-toggle button { width: 34px; height: 32px; border-radius: var(--r-xs); color: var(--muted); font-size: 13px; transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
.theme-toggle button[aria-pressed="true"] { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }

/* ---------- 降低动效 ---------- */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; } }

/* ---------- 滚动条 ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 3px solid var(--bg); }
*::-webkit-scrollbar-track { background: transparent; }
