/* ============================================================
   Art Design Pro — 可移植设计令牌
   用法：在需要 Art 视觉的页面单独引入（本文件目前仅被
   web_user/index.html 与 backstage/welcome.html 引用）。
   不依赖 Tailwind；同时给出 Element Plus 变量映射。
   实测来源：artd.pro v3.0.2
   ============================================================ */

:root {
  --main-color: #5d87ff;
  --custom-radius: 0.75rem;
  --theme-color: var(--main-color);

  /* 语义色（OKLCH，现代浏览器；旧浏览器回退由浏览器自动降级为近似 sRGB） */
  --art-primary: oklch(70% 0.23 260);
  --art-secondary: oklch(72% 0.19 231.6);
  --art-success: oklch(78% 0.17 166.1);
  --art-warning: oklch(78% 0.14 75.5);
  --art-error: oklch(73% 0.15 25.3);
  --art-danger: oklch(68% 0.22 25.3);
  --art-info: oklch(58% 0.03 254.1);

  /* 灰阶 9 档（浅 → 深） */
  --art-gray-100: #f9fafb;
  --art-gray-200: #f2f4f5;
  --art-gray-300: #e6eaeb;
  --art-gray-400: #dbdfe1;
  --art-gray-500: #949eb7;
  --art-gray-600: #7987a1;
  --art-gray-700: #4d5875;
  --art-gray-800: #383853;
  --art-gray-900: #323251;

  /* 容器 */
  --default-bg-color: #fafbfc;
  --default-box-color: #ffffff;
  --default-border: #e2e8ee;
  --default-border-dashed: #dbdfe9;
  --art-card-border: #00000014;
  --art-hover-color: #f2f4f5;
  --art-active-color: #f2f4f5;
  --art-el-active-color: #f2f4f5;

  /* 主色派生（供不支持 color-mix 的旧浏览器兜底） */
  --art-primary-soft: rgba(93, 135, 255, 0.08);
  --art-primary-soft-hover: rgba(93, 135, 255, 0.14);
  --art-primary-border: rgba(93, 135, 255, 0.32);

  /* 圆角 */
  --radius-card: calc(var(--custom-radius) + 4px);   /* 16px */
  --radius-card-sm: calc(var(--custom-radius) + 2px);/* 14px */
  --radius-card-xs: calc(var(--custom-radius) - 4px);/* 8px */
  --radius-control: calc(var(--custom-radius) / 3 + 2px); /* 6px */

  /* 布局 */
  --layout-sidebar-width: 230px;
  --layout-header-height: 60px;
  --layout-tabs-height: 32px;
  --layout-gutter: 20px;
  --control-height: 36px;

  /* 字体 */
  --font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei";
  --text-body: 14px;
  --text-caption: 12px;
  --text-card-title: 16px;
  --text-stat: 26px;

  /* Element Plus 映射（若有 Element Plus） */
  --el-color-primary: var(--main-color);
  --el-color-success: #13deb9;
  --el-color-warning: #ffae1f;
  --el-color-error: #fa896b;
  --el-color-danger: #ff4d4f;
  --el-color-info: #909399;
  --el-font-size-base: 14px;
  --el-component-size: var(--control-height);
  --el-border-radius-base: var(--radius-control);
  --el-border-radius-small: calc(var(--custom-radius) / 3 + 4px);
  --el-bg-color: var(--default-box-color);
  --el-bg-color-page: var(--default-bg-color);
  --el-border-color: var(--default-border);
  --el-border-color-light: var(--art-gray-300);
  --el-border-color-lighter: var(--art-gray-200);
  --el-fill-color-light: var(--art-gray-100);
}

html.dark {
  --art-gray-100: #110f0f;
  --art-gray-200: #17171c;
  --art-gray-300: #393946;
  --art-gray-400: #505062;
  --art-gray-500: #73738c;
  --art-gray-600: #8f8fa3;
  --art-gray-700: #ababba;
  --art-gray-800: #c7c7d1;
  --art-gray-900: #e3e3e8;

  --default-bg-color: #070707;
  --default-box-color: #161618;
  --default-border: #ffffff1a;
  --default-border-dashed: #363843;
  --art-card-border: #ffffff14;
  --art-hover-color: #252530;
  --art-active-color: #202226;
  --art-el-active-color: #2e2e38;

  --el-text-color-primary: #e5eaf3;
  --el-text-color-regular: #cfd3dc;
  --el-border-color: #4c4d4f;
  --el-fill-color-light: #262727;
}

/* ============================================================
   基础元素
   ============================================================ */
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-body);
  color: var(--art-gray-900);
  background: var(--default-bg-color);
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   卡片
   ============================================================ */
.art-card,
.art-card-sm,
.art-card-xs {
  position: relative;
  background: var(--default-box-color);
  border: 1px solid var(--art-card-border);
  box-sizing: border-box;
}
.art-card    { border-radius: var(--radius-card);    padding: 20px; }
.art-card-sm { border-radius: var(--radius-card-sm); padding: 20px; }
.art-card-xs { border-radius: var(--radius-card-xs); padding: 15px 20px; }

.art-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.art-card-header .title h4 {
  margin: 0;
  font-size: var(--text-card-title);
  font-weight: 500;
  color: var(--art-gray-900);
}
.art-card-header .title p {
  margin: 4px 0 0;
  font-size: var(--text-body);
  color: var(--art-gray-600);
}

/* ============================================================
   统计卡
   ============================================================ */
.art-stat-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 140px;
  padding: 0 20px;
  margin-bottom: 20px;
}
.art-stat-card .label { font-size: var(--text-body); color: var(--art-gray-700); }
.art-stat-card .value {
  margin-top: 8px;
  font-size: var(--text-stat);
  font-weight: 500;
  color: var(--art-gray-900);
  font-variant-numeric: tabular-nums;
}
.art-stat-card .trend { margin-top: 4px; font-size: var(--text-caption); color: var(--art-gray-600); }
.art-stat-card .trend .up { color: #13deb9; font-weight: 600; }
.art-stat-card .trend .down { color: #fa896b; font-weight: 600; }
.art-stat-card .icon-box {
  position: absolute;
  top: 0; bottom: 0; right: 20px;
  margin: auto;
  width: 50px; height: 50px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: var(--main-color);
  background: var(--art-primary-soft);
  background: color-mix(in srgb, var(--main-color) 10%, transparent);
  font-size: 22px;
}

/* ============================================================
   状态标签
   ============================================================ */
.art-tag {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}
.art-tag--success { color: #0fa98f; background: #e8f8f2; }
.art-tag--warning { color: #c78a2c; background: #fdf6ec; }
.art-tag--danger  { color: #e05c5c; background: #fef0f0; }
.art-tag--info    { color: var(--art-gray-600); background: var(--art-gray-200); }

html.dark .art-tag--success { color: #13deb9; background: rgba(19, 222, 185, 0.12); }
html.dark .art-tag--warning { color: #ffae1f; background: rgba(255, 174, 31, 0.12); }
html.dark .art-tag--danger  { color: #fa896b; background: rgba(250, 137, 107, 0.12); }

/* ============================================================
   按钮（无 UI 库时可直接用）
   ============================================================ */
.art-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--control-height);
  padding: 0 15px;
  border-radius: var(--radius-control);
  border: 1px solid var(--default-border);
  background: var(--default-box-color);
  color: var(--main-color);
  font-size: var(--text-body);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.art-btn:hover { background: var(--art-hover-color); }
.art-btn--primary {
  background: var(--main-color);
  border-color: var(--main-color);
  color: #fff;
}
.art-btn--primary:hover { filter: brightness(1.06); background: var(--main-color); }
.art-btn--danger {
  background: #fef0f0;
  border-color: #fde2e2;
  color: #f56c6c;
}
.art-btn--icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 8px;
}
.art-btn--icon-edit { color: var(--main-color); background: var(--art-primary-soft); background: color-mix(in srgb, var(--main-color) 10%, transparent); }
.art-btn--icon-del  { color: #f56c6c; background: #fef0f0; }

/* 图标占位：配合 Iconify / ArtSvgIcon 使用，避免 emoji */
.art-icon { width: 1em; height: 1em; display: inline-block; vertical-align: -0.125em; }
.art-icon-box {
  width: 50px; height: 50px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  color: var(--main-color);
  background: var(--art-primary-soft);
  background: color-mix(in srgb, var(--main-color) 10%, transparent);
}

/* ============================================================
   布局骨架
   ============================================================ */
.art-layout {
  display: flex;
  min-height: 100vh;
  background: var(--default-bg-color);
}
.art-sidebar {
  width: var(--layout-sidebar-width);
  flex: 0 0 var(--layout-sidebar-width);
  background: var(--default-box-color);
  border-right: 1px solid var(--default-border);
  display: flex;
  flex-direction: column;
}
.art-sidebar__brand {
  height: var(--layout-header-height);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  font-size: 16px;
  font-weight: 600;
  color: var(--art-gray-900);
}
.art-menu { padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.art-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 14px;
  color: #29343d;
  cursor: pointer;
  transition: background 0.2s;
}
html.dark .art-menu__item { color: var(--art-gray-800); }
.art-menu__item:hover { background: var(--art-hover-color); }
.art-menu__item.is-active {
  background: var(--art-primary-soft);
  background: color-mix(in srgb, var(--main-color) 10%, transparent);
  color: var(--main-color);
  font-weight: 500;
}
.art-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.art-header {
  height: var(--layout-header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex: none;
}
.art-tabs {
  height: var(--layout-tabs-height);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 20px;
  margin-bottom: 12px;
  flex: none;
}
.art-tab {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 8px 0 12px;
  border-radius: 8px;
  border: 1px solid var(--art-card-border);
  background: var(--default-box-color);
  font-size: 12px;
  color: var(--art-gray-700);
  cursor: pointer;
}
.art-tab.is-active {
  color: var(--main-color);
  border-color: var(--art-primary-border);
  border-color: color-mix(in srgb, var(--main-color) 30%, transparent);
}
.art-content {
  flex: 1;
  padding: 0 20px 20px;
  overflow: auto;
}

/* ============================================================
   工具类（无 Tailwind 时的最小替代）
   ============================================================ */
.flex-c  { display: flex; align-items: center; }
.flex-b  { display: flex; align-items: center; justify-content: space-between; }
.flex-cc { display: flex; align-items: center; justify-content: center; }
.flex-col { display: flex; flex-direction: column; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-5 { gap: 20px; }
.mt-3 { margin-top: 12px; }
.mt-5 { margin-top: 20px; }
.mb-5 { margin-bottom: 20px; }
.text-theme { color: var(--main-color); }
.text-g-500 { color: var(--art-gray-500); }
.text-g-600 { color: var(--art-gray-600); }
.text-g-700 { color: var(--art-gray-700); }
.text-g-900 { color: var(--art-gray-900); }
.text-success { color: #13deb9; }
.text-danger  { color: #fa896b; }
.c-p { cursor: pointer; }
