/* ============================================================
   青训物料系统设计系统 v1（theme.css）
   现代轻量 B 端风格：墨色 + 菠萝黄强调，移动优先，8px 栅格
   ============================================================ */

:root {
  /* 品牌与中性色 */
  --brand: #ffb800;
  --brand-deep: #f0a000;
  --brand-soft: #fff7e0;
  --ink-1: #1f2329;
  --ink-2: #4e5969;
  --ink-3: #86909c;
  --line: #e5e6eb;
  --line-soft: #f0f1f3;
  --bg: #f5f6f8;
  --card: #ffffff;
  --primary: #1f2329;
  --info: #165dff;
  --success: #00b42a;
  --warning: #ff7d00;
  --danger: #f53f3f;
  --danger-soft: #ffece8;
  --info-soft: #e8f3ff;
  --warn-soft: #fff7e8;
  --ok-soft: #e8ffea;

  /* 尺寸 */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --shadow-1: 0 1px 4px rgba(31, 35, 41, 0.06);
  --shadow-2: 0 6px 20px rgba(31, 35, 41, 0.10);
  --topbar-h: 60px;
  --maxw: 1280px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
    "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink-1);
  /* 随屏幕宽度平滑缩放：13 寸约 14.4px、1080P 约 15.4px、27 寸约 16.8px，手机兜底 14px */
  font-size: clamp(14px, 11.2px + 0.22vw, 17px);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--info); text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; }

/* ---------------- 顶部导航栏 ---------------- */
.qx-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-h);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
}
.qx-topbar .qx-title {
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.qx-topbar .qx-title .qx-logo {
  width: 32px;
  height: 32px;
  display: inline-grid;
  line-height: 0;
}
.qx-logo-svg { width: 100%; height: 100%; display: block; }
.qx-topbar .qx-spacer { flex: 1; }
.qx-topbar .qx-user { color: var(--ink-3); font-size: 13px; }

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

/* ---------------- 按钮 ---------------- */
.qx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s, transform 0.05s;
  user-select: none;
}
.qx-btn:active { transform: scale(0.98); }
.qx-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.qx-btn-primary { background: var(--primary); color: #fff; }
.qx-btn-primary:hover { background: #000; }
.qx-btn-accent { background: var(--brand); color: var(--ink-1); font-weight: 600; }
.qx-btn-accent:hover { background: var(--brand-deep); }
.qx-btn-ghost { background: #fff; border-color: var(--line); color: var(--ink-2); }
.qx-btn-ghost:hover { border-color: var(--ink-3); color: var(--ink-1); }
.qx-btn-danger { background: #fff; border-color: var(--danger); color: var(--danger); }
.qx-btn-danger:hover { background: var(--danger-soft); }
.qx-btn-sm { min-height: 30px; padding: 0 12px; font-size: 13px; }
.qx-btn-block { width: 100%; }

/* ---------------- 卡片与网格 ---------------- */
.qx-card {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  padding: 20px;
}
.qx-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.qx-stat {
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.qx-stat .qx-stat-ic {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--brand-soft);
  display: grid;
  place-items: center;
  font-size: 22px;
  flex-shrink: 0;
}
.qx-stat .qx-stat-num { font-size: 26px; font-weight: 700; line-height: 1.1; }
.qx-stat .qx-stat-label { font-size: 13px; color: var(--ink-3); }

/* ---------------- 表单 ---------------- */
.qx-field { margin-bottom: 16px; }
.qx-field label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; font-weight: 500; }
.qx-input, .qx-select, .qx-textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--ink-1);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.qx-textarea { min-height: 84px; resize: vertical; }
.qx-input:focus, .qx-select:focus, .qx-textarea:focus {
  outline: none;
  border-color: var(--brand-deep);
  box-shadow: 0 0 0 3px rgba(255, 184, 0, 0.18);
}
.qx-search {
  display: flex;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: 14px;
  box-shadow: var(--shadow-1);
  margin-bottom: 18px;
}
.qx-search .qx-input { margin: 0; }

/* ---------------- 标签/提示条 ---------------- */
.qx-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: var(--line-soft);
  color: var(--ink-2);
}
.qx-tag-brand { background: var(--brand-soft); color: #a86f00; }
.qx-hint {
  border-radius: var(--r-sm);
  padding: 12px 16px;
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.qx-hint-warn { background: var(--warn-soft); color: #b86e00; border-color: #ffe2b8; }
.qx-hint-info { background: var(--info-soft); color: #0e42d2; border-color: #c7dcff; }

/* ---------------- 模态框 ---------------- */
.qx-modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 20, 0.55);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.qx-modal-mask.show { display: flex; }
.qx-modal {
  background: #fff;
  border-radius: var(--r-lg);
  width: 520px;
  max-width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  padding: 24px;
  animation: qx-pop 0.16s ease;
}
@keyframes qx-pop { from { transform: translateY(12px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }
.qx-modal h3 { font-size: 17px; margin-bottom: 18px; }
.qx-modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.qx-modal-close { float: right; cursor: pointer; color: var(--ink-3); font-size: 22px; line-height: 1; background: none; border: 0; }

/* ---------------- Toast ---------------- */
#qx-toast-root { position: fixed; top: 76px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.qx-toast {
  background: rgba(31, 35, 41, 0.92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: var(--shadow-2);
  animation: qx-pop 0.15s ease;
  max-width: 86vw;
}
.qx-toast.ok { background: rgba(0, 150, 40, 0.94); }
.qx-toast.err { background: rgba(220, 40, 40, 0.94); }

/* ---------------- 空状态 ---------------- */
.qx-empty { text-align: center; color: var(--ink-3); padding: 64px 20px; }
.qx-empty .qx-empty-ic { font-size: 46px; margin-bottom: 12px; opacity: 0.7; }

/* ---------------- 表格（手机横滚） ---------------- */
.qx-table-wrap {
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow-1);
}
.qx-table { width: 100%; border-collapse: collapse; min-width: 560px; }
.qx-table th, .qx-table td { padding: 12px 14px; text-align: left; font-size: 13px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.qx-table th { background: #fafbfc; color: var(--ink-2); font-weight: 600; position: sticky; top: 0; }

/* ---------------- 图片库 ---------------- */
.qx-img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.qx-img-card { background: #fff; border: 1px solid var(--line-soft); border-radius: var(--r-md); overflow: hidden; }
.qx-img-card .qx-thumb { width: 100%; aspect-ratio: 1/1; object-fit: cover; background: var(--line-soft); cursor: zoom-in; }
.qx-img-card .qx-img-meta { padding: 8px 10px; font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- 功能主页分组 ---------------- */
.qx-section-title { font-size: 14px; font-weight: 600; color: var(--ink-2); margin: 22px 0 12px; display: flex; align-items: center; gap: 8px; }
.qx-section-title::before { content: ""; width: 4px; height: 14px; border-radius: 2px; background: var(--brand); }
.qx-app-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  padding: clamp(18px, 1.6vw, 26px) 16px clamp(16px, 1.4vw, 22px);
  color: inherit;
  transition: border-color 0.18s, transform 0.14s, box-shadow 0.18s;
  box-shadow: var(--shadow-1);
}
.qx-app-card:hover { border-color: var(--brand); box-shadow: var(--shadow-2); transform: translateY(-3px); }
/* 手绘插图：无底色，与白卡融为一体 */
.qx-app-art { display: block; line-height: 0; margin-bottom: clamp(10px, 1vw, 14px); }
.qx-ic-svg {
  width: clamp(54px, 4.2vw, 78px); height: auto;
  transition: transform 0.18s ease;
  filter: drop-shadow(0 3px 6px rgba(31, 35, 41, 0.08));
}
.qx-app-card:hover .qx-ic-svg { transform: translateY(-3px) scale(1.06); }
.qx-app-txt { display: block; }
.qx-app-card h4 { font-size: clamp(15px, 0.5vw + 13px, 17.5px); color: var(--ink-1); margin-bottom: 4px; font-weight: 600; }
.qx-app-card p { font-size: clamp(12.5px, 0.35vw + 11px, 14px); color: var(--ink-3); line-height: 1.45; }

/* 工作台欢迎条 */
.qx-hero {
  margin-bottom: 10px;
  padding: clamp(20px, 2vw, 30px) clamp(20px, 2.2vw, 32px);
  border-radius: var(--r-lg);
  background: linear-gradient(120deg, #1f2329, #3a3f47);
  color: #fff;
}
.qx-hero h2 { font-size: clamp(20px, 1vw + 16px, 26px); margin-bottom: 6px; font-weight: 700; }
.qx-hero p { color: rgba(255, 255, 255, .66); font-size: clamp(13px, 0.4vw + 11.5px, 15px); }

/* ---------------- 登录页 ---------------- */
.qx-auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.qx-auth-hero { background: var(--primary); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.qx-auth-hero .qx-brand { font-size: 22px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.qx-auth-hero .qx-brand .qx-logo { width: 44px; height: 44px; display: inline-grid; line-height: 0; }
.qx-auth-hero h2 { font-size: 34px; line-height: 1.3; margin-bottom: 14px; }
.qx-auth-hero p { color: rgba(255,255,255,0.65); font-size: 15px; max-width: 420px; }
.qx-auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px; background: #fff; }
.qx-auth-card { width: 380px; max-width: 100%; }
.qx-auth-card h1 { font-size: 24px; margin-bottom: 6px; }
.qx-auth-card .qx-sub { color: var(--ink-3); font-size: 14px; margin-bottom: 30px; }

/* ---------------- 移动端适配 ---------------- */
@media (max-width: 768px) {
  :root { --topbar-h: 52px; }
  .qx-topbar { padding: 0 14px; gap: 8px; }
  .qx-topbar .qx-title { font-size: 15px; }
  .qx-topbar .qx-user { display: none; }
  .qx-container { padding: 14px; }
  .qx-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .qx-img-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .qx-btn { min-height: 42px; padding: 0 14px; }
  .qx-btn-sm { min-height: 34px; }
  .qx-card { padding: 14px; }
  .qx-auth-wrap { grid-template-columns: 1fr; }
  .qx-auth-hero { display: none; }
  .qx-auth-panel { padding: 28px 20px; }
  .qx-modal { padding: 18px; }
  .qx-search { flex-direction: column; padding: 12px; }
}
@media (max-width: 420px) {
  .qx-grid { grid-template-columns: 1fr 1fr; }
  .qx-stat { padding: 14px; }
  .qx-stat .qx-stat-ic { width: 38px; height: 38px; font-size: 18px; }
}

/* ===== Tabs ===== */
.qx-tabs { display: flex; gap: 4px; background: var(--surface); border-radius: var(--radius); padding: 5px; margin-bottom: 16px; box-shadow: var(--shadow-sm); overflow-x: auto; -webkit-overflow-scrolling: touch; }
.qx-tab { flex: 1; min-width: max-content; padding: 10px 16px; text-align: center; border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--ink-2); cursor: pointer; border: 0; background: transparent; white-space: nowrap; transition: all .18s; }
.qx-tab:hover { background: var(--bg); }
.qx-tab.active { background: var(--brand); color: #1f2329; font-weight: 600; box-shadow: 0 2px 8px rgba(255,184,0,.35); }

/* ===== 标签变体 ===== */
.qx-tag-success { background: #e6f7ec; color: #1a8a43; }
.qx-tag-gray { background: var(--line); color: var(--ink-2); }
.qx-tag-purple { background: #f3e8ff; color: #7c3aed; }

/* ===== 模块授权勾选 ===== */
.qx-check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qx-check-item { display: flex; align-items: center; gap: 8px; padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 13.5px; color: var(--ink-1); transition: all .15s; user-select: none; }
.qx-check-item:hover { border-color: var(--brand-soft); }
.qx-check-item input { width: 16px; height: 16px; accent-color: var(--brand-deep); }
.qx-check-item.on { border-color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.qx-module-chips { display: flex; flex-wrap: wrap; gap: 4px; max-width: 260px; }
.qx-module-chip { font-size: 11px; background: var(--brand-soft); color: #8a5a00; padding: 2px 7px; border-radius: 999px; }
.qx-module-chip.all { background: #e6f7ec; color: #1a8a43; }

/* ===== 页面内操作行 ===== */
.qx-row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.qx-row-actions .qx-btn { padding: 5px 10px; font-size: 12px; }

/* ===== 移动端 ===== */
@media (max-width: 768px) {
  .qx-check-grid { grid-template-columns: 1fr; }
  .qx-hide-mobile { display: none; }
}

/* ===== 统计行 / 拖拽态（补充分页复用） ===== */
.qx-stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.qx-drag { border-color: var(--brand) !important; background: var(--brand-soft) !important; }
.qx-btn[disabled] { opacity: .55; pointer-events: none; }

/* ===== 工作台应用网格（纵向手绘插图卡，列宽随屏自适应） ===== */
.qx-app-grid { grid-template-columns: repeat(auto-fill, minmax(clamp(180px, 13vw, 248px), 1fr)); gap: clamp(14px, 1.1vw, 22px); }

/* ===== 大屏自适应：13 寸 → 27 寸逐级放大字号与容器，手机不受影响 ===== */
@media (min-width: 1600px) {
  :root { --maxw: 1480px; }
  .qx-topbar .qx-title { font-size: 19px; }
  .qx-btn { font-size: 15px; }
  .qx-input { font-size: 15px; }
  .qx-table th, .qx-table td { font-size: 14px; padding: 14px 16px; }
  .qx-section-title { font-size: 15.5px; }
  .qx-modal h3 { font-size: 19px; }
  .qx-stat .qx-stat-num { font-size: 30px; }
  .qx-card { padding: 22px; }
}
@media (min-width: 2100px) {
  :root { --maxw: 1760px; }
  .qx-topbar .qx-title { font-size: 21px; }
  .qx-btn { font-size: 16px; }
  .qx-input { font-size: 16px; }
  .qx-table th, .qx-table td { font-size: 15px; }
  .qx-section-title { font-size: 17px; }
  .qx-modal h3 { font-size: 21px; }
  .qx-stat .qx-stat-num { font-size: 34px; }
  .qx-card { padding: 26px; }
}

/* ===== 平板 / 手机端应用网格收敛为紧凑两列 ===== */
@media (max-width: 768px) {
  .qx-app-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
}
@media (max-width: 480px) {
  .qx-app-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .qx-ic-svg { width: 52px; }
  .qx-app-card { padding: 16px 10px 14px; }
}
