/* ============================================================
   base.css — 变量 / 重置 / 通用
   ============================================================ */

/* ---------- 重置 ---------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

button {
  font: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
  outline: none;
}

button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

input,
select,
textarea {
  font: inherit;
  color: inherit;
  outline: none;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

/* ---------- 变量 ---------- */
:root {
  --primary: #4f46e5;
  --primary-2: #7c3aed;
  --primary-grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  --primary-soft: #eef2ff;

  --bg: #f7f8fc;
  --card: #ffffff;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #94a3b8;
  --border: #e8ebf2;
  --border-2: #dfe3ec;

  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;

  --sidebar-bg: #0b1020;
  --sidebar-hover: #1a2035;
  --sidebar-width: 248px;

  --radius: 16px;
  --radius-sm: 10px;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, .06);
  --shadow: 0 8px 24px rgba(15, 23, 42, .08);
  --shadow-lg: 0 24px 48px rgba(15, 23, 42, .14);

  --topbar-bg: rgba(255, 255, 255, .85);
  --topbar-height: 68px;

  --content-pad-x: 28px;
  --content-pad-y: 26px;
}

body.dark {
  --bg: #0a0e1a;
  --card: #141a2e;
  --text: #e2e8f0;
  --text-2: #94a3b8;
  --muted: #64748b;
  --border: #232a44;
  --border-2: #2d3450;
  --sidebar-bg: #050810;
  --sidebar-hover: #141a2e;
  --topbar-bg: rgba(20, 26, 46, .85);
  --primary-soft: #1e1b4b;
}

/* ---------- 全局 ---------- */
html,
body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Inter", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
  min-width: 320px;
  overflow-x: hidden;
}

::selection {
  background: rgba(79, 70, 229, .18);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* ---------- 小屏变量调整 ---------- */
@media (max-width: 640px) {
  :root {
    --content-pad-x: 16px;
    --content-pad-y: 16px;
    --topbar-height: 60px;
    --radius: 12px;
  }
}