/* ========== 设计令牌（Design Tokens） ========== */
:root {
  /* 主色 / 强调色 —— 深青绿 */
  --color-primary: #0F766E;
  --color-primary-hover: #0D5D56;
  --color-primary-light: #CCFBF1;
  --color-primary-soft: #99F6E4;

  /* 中性色 —— 暖灰 */
  --color-bg: #F5F5F4;
  --color-surface: #FFFFFF;
  --color-text: #1C1917;
  --color-text-secondary: #78716C;
  --color-text-muted: #A8A29E;
  --color-border: #E7E5E4;
  --color-border-light: #FAFAF9;

  /* 功能色 */
  --color-success: #059669;
  --color-success-bg: #D1FAE5;
  --color-warning: #D97706;
  --color-warning-bg: #FEF3C7;
  --color-danger: #DC2626;
  --color-danger-bg: #FEE2E2;
  --color-info: #0284C7;
  --color-info-bg: #E0F2FE;
  --color-muted-bg: #F5F5F4;
  --color-muted-text: #78716C;

  /* 圆角 */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  /* 阴影 */
  --shadow-xs: 0 1px 2px rgba(28, 25, 23, 0.04);
  --shadow-sm: 0 1px 3px rgba(28, 25, 23, 0.06), 0 1px 2px rgba(28, 25, 23, 0.04);
  --shadow-md: 0 4px 12px rgba(28, 25, 23, 0.08);
  --shadow-lg: 0 12px 32px rgba(28, 25, 23, 0.12);

  /* 间距 */
  --sidebar-width: 232px;
  --sidebar-collapsed: 72px;
  --topbar-height: 60px;
}

/* ========== Reset ========== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
table { border-collapse: collapse; width: 100%; }

/* ========== 通用按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.18s ease;
  white-space: nowrap;
  background: var(--color-surface);
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
}
.btn-ghost {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--color-border-light);
  border-color: var(--color-border);
}
.btn-text {
  background: transparent;
  color: var(--color-primary);
  height: auto;
  padding: 4px 8px;
}
.btn-text:hover { background: var(--color-primary-light); }

/* ========== 表单控件 ========== */
.form-control {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  outline: none;
}
.form-control::placeholder { color: var(--color-text-muted); }
.form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}
textarea.form-control { padding: 10px 12px; height: auto; min-height: 80px; resize: vertical; }
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ========== 状态徽标 ========== */
.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}
.badge-success { background: var(--color-success-bg); color: var(--color-success); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-danger  { background: var(--color-danger-bg);  color: var(--color-danger); }
.badge-info    { background: var(--color-info-bg);    color: var(--color-info); }
.badge-muted   { background: var(--color-muted-bg);   color: var(--color-muted-text); }

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

/* ========== 工具类 ========== */
.text-muted { color: var(--color-text-secondary); }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* ========== Toast 轻提示 ========== */
.toast-wrap {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  min-width: 240px;
  max-width: 420px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toast-in 0.22s ease;
}
.toast.toast-error { border-left: 4px solid var(--color-danger); }
.toast.toast-success { border-left: 4px solid var(--color-success); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ========== 加载遮罩 ========== */
.mask {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(2px);
  z-index: 9000;
  display: none;
}
.mask.active { display: block; }
.spinner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-primary-soft);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

/* ========== 空状态 ========== */
.empty {
  padding: 56px 0;
  text-align: center;
  color: var(--color-text-muted);
}
.empty svg { margin-bottom: 12px; }
.empty p { margin: 0; font-size: 14px; }
