/* =============================================================================
 * assets/theme.css —— 全站统一设计规范（后台 /admin 与前台 / 共用同一套变量与基础组件）
 *
 * 定位：**唯一的设计令牌与基础组件来源**。
 *   - 各端自己的 styles.css 只保留"页面级布局"（侧栏、栅格、卡片编排等）；
 *   - 颜色、圆角、阴影、字阶、按钮/输入框/徽章/空态等基础视觉一律由此文件提供；
 *   - 后续新增页面只需引用本文件即可自动获得一致外观，无需复制粘贴样式。
 *
 * 零依赖，无构建步骤。
 * ========================================================================== */

:root {
  /* 品牌与语义色 */
  --brand: #3b6ef5;
  --brand-d: #2f5bd7;
  --brand-soft: #eaf0fe;
  --ok: #16a34a; --ok-soft: #e7f6ec;
  --warn: #d97706; --warn-soft: #fdf2e3;
  --danger: #dc2626; --danger-soft: #fdeaea;
  --info: #0284c7; --info-soft: #e8f4fc;
  /* 中性色 */
  --ink: #1e2430; --ink2: #59637a; --ink3: #8b94a9;
  --line: #e5e9f1; --line2: #eef1f6;
  --panel: #fff; --bg: #f3f5f9;
  /* 形状与层次 */
  --r: 12px; --r-s: 8px; --r-xs: 6px;
  --sh: 0 1px 3px rgba(20, 30, 60, .06), 0 8px 24px rgba(20, 30, 60, .05);
  --sh-lg: 0 12px 40px rgba(15, 23, 42, .18);
  --focus: 0 0 0 3px rgba(59, 110, 245, .16);
  /* 间距刻度（两端统一使用，避免各自为政） */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  /* 等价别名：把历史遗留的变量名映射到同一批令牌。
   * 这样前端（site.css）与后台（admin/styles.css）沿用各自的类名写法即可，
   * 不必为了统一外观去改动大量已有样式，也不会出现"两套颜色各说各话"。 */
  --radius: var(--r); --radius-s: var(--r-s); --radius-xs: var(--r-xs);
  --shadow: var(--sh); --shadow-lg: var(--sh-lg);
  --card: var(--panel); --sub: var(--ink2); --bad: var(--danger);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* 后台侧栏：与前台同一套浅色语言（顶栏/卡片/边框），不再使用深色底 */
  --side: #fff;
  --side-2: var(--line2);
  --side-ink: var(--ink2);
  --side-ink-on: var(--brand);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; }

/* ---------------- 按钮（两端同一形态） ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  border-radius: var(--r-s); padding: 8px 14px; font-size: 13px; line-height: 1.4;
  cursor: pointer; user-select: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s;
}
.btn:hover { border-color: #cdd5e4; background: #f8fafd; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-d); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { filter: brightness(.94); }
.btn.warn { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink2); }
.btn.ghost:hover { background: var(--line2); }
.btn.sm { padding: 5px 11px; font-size: 12.5px; }
.btn.xs { padding: 3px 9px; font-size: 12px; border-radius: var(--r-xs); }
.btn:disabled, .btn.disabled {
  opacity: .5; cursor: not-allowed; pointer-events: none;
  background: var(--line2); color: var(--ink3); border-color: var(--line);
}

/* ---------------- 表单控件 ---------------- */
.input, .select, textarea.input {
  width: 100%; border: 1px solid var(--line); border-radius: var(--r-s);
  padding: 8px 11px; font-size: 13px; font-family: inherit; color: var(--ink);
  background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, textarea.input:focus { border-color: var(--brand); box-shadow: var(--focus); }
.input::placeholder { color: var(--ink3); }
.select { appearance: none; padding-right: 28px; background-repeat: no-repeat; background-position: right 10px center; }
/* 下拉箭头（内联 SVG，避免额外图片请求） */
.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2359637a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* 表单字段容器：label 在上、控件在下（两端共用，保证弹窗与登录页排版一致） */
.field { margin-bottom: var(--s3); }
.field > label,
.field > .lbl {
  display: block; font-size: 12.5px; font-weight: 600;
  color: var(--ink2); margin-bottom: 5px;
}
.field .hint { font-size: 12px; color: var(--ink3); margin-top: 4px; }
.field .hint.bad, .field .field-tip.bad { color: var(--danger); }
.field-tip { font-size: 12px; color: var(--danger); min-height: 16px; margin-top: 4px; }
.input.is-bad, .input.is-error { border-color: var(--danger); }
.input.is-bad:focus { box-shadow: 0 0 0 3px rgba(220, 38, 38, .14); }

/* ---------------- 徽章 / 状态 ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }
.badge.mute { background: var(--line2); color: var(--ink2); }

/* ---------------- 卡片 / 分隔 / 文本 ---------------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); }
.divider { height: 1px; background: var(--line2); margin: var(--s4) 0; }
.muted { color: var(--ink3); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.flex { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }

/* ---------------- 空态 / 加载 / 错误 ---------------- */
.empty { padding: 44px 20px; text-align: center; color: var(--ink3); line-height: 1.9; }
.empty .ico { width: 34px; height: 34px; opacity: .45; margin-bottom: var(--s2); }
.loading { padding: 40px; text-align: center; color: var(--ink3); }
.loading::after {
  content: ""; display: inline-block; width: 16px; height: 16px; margin-left: 8px; vertical-align: -3px;
  border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%;
  animation: theme-spin .8s linear infinite;
}
@keyframes theme-spin { to { transform: rotate(360deg); } }

/* ---------------- 内联图标（与后台 icon() 同风格） ---------------- */
.ico {
  width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; vertical-align: -.12em; flex: none;
}
.ico.lg { width: 20px; height: 20px; }

/* ---------------- 统一焦点可见性（键盘可达性） ---------------- */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none; box-shadow: var(--focus); border-radius: var(--r-xs);
}

/* ---------------- 账号限制提示（两端共用） ---------------- */
.restrict-bar {
  display: flex; align-items: center; gap: 8px; max-width: 1080px;
  margin: var(--s3) auto 0; padding: var(--s3) var(--s4);
  border-radius: var(--r-s); font-size: 13.5px; line-height: 1.6; box-shadow: var(--sh);
}
.restrict-bar.warn { background: var(--warn-soft); color: #92400e; border: 1px solid #f6dfb8; }
.restrict-bar.danger { background: var(--danger-soft); color: #991b1b; border: 1px solid #f7c9c9; }
.restrict-inline {
  background: var(--warn-soft); color: #92400e; border: 1px solid #f6dfb8;
  border-radius: var(--r-s); padding: var(--s3) 14px; font-size: 13px; line-height: 1.7; margin-bottom: 10px;
}
