/* ============================================================
 * base.css —— 原型公共样式
 * 新增页面直接 <link rel="stylesheet" href="../assets/css/base.css">
 * ============================================================ */

:root {
  --c-bg: #f5f6f8;
  --c-surface: #ffffff;
  --c-border: #e3e6eb;
  --c-border-strong: #d0d5dd;
  --c-text: #1f2329;
  --c-text-2: #5a6272;
  --c-text-3: #8a91a0;
  --c-primary: #2563eb;
  --c-primary-weak: #eaf1ff;
  --c-danger: #d92d20;
  --c-success: #039855;
  --c-warn: #b54708;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

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

a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 顶部条 ---------- */
.topbar {
  height: 56px;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar .brand {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .2px;
}

.topbar .crumb { color: var(--c-text-3); font-size: 13px; }
.topbar .spacer { flex: 1; }

/* ---------- 页面容器 ---------- */
.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
}

.page-head h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.page-head .desc { color: var(--c-text-2); font-size: 13px; margin-bottom: 2px; }
.page-head .spacer { flex: 1; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card + .card { margin-top: 16px; }

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--c-border);
  font-weight: 600;
  font-size: 14px;
}

.card-head .spacer { flex: 1; }
.card-body { padding: 18px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border-radius: 6px;
  border: 1px solid var(--c-border-strong);
  background: var(--c-surface);
  color: var(--c-text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, border-color .12s;
}

.btn:hover { background: #f7f8fa; }
.btn-primary { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.btn-primary:hover { background: #1d4fd8; border-color: #1d4fd8; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--c-text-2); }
.btn-ghost:hover { background: #f0f2f5; }
.btn-sm { height: 26px; padding: 0 10px; font-size: 12px; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }

.table th {
  text-align: left;
  font-weight: 600;
  color: var(--c-text-2);
  background: #fafbfc;
  padding: 10px 16px;
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}

.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fbfcfd; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.muted { color: var(--c-text-3); }
.nowrap { white-space: nowrap; }

/* ---------- 状态标签 ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 12px;
  background: #f0f2f5;
  color: var(--c-text-2);
  white-space: nowrap;
}

.tag-success { background: #e7f6ef; color: var(--c-success); }
.tag-warn { background: #fdf3e7; color: var(--c-warn); }
.tag-danger { background: #fdeceb; color: var(--c-danger); }
.tag-primary { background: var(--c-primary-weak); color: var(--c-primary); }

.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- 表单 ---------- */
.form-row { margin-bottom: 18px; }
.form-row:last-child { margin-bottom: 0; }

.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--c-text-2);
}

.form-label .req { color: var(--c-danger); margin-right: 3px; }

.input, .select, .textarea {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--c-border-strong);
  border-radius: 6px;
  background: #fff;
  font: inherit;
  font-size: 13px;
  color: var(--c-text);
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}

.textarea { height: auto; padding: 8px 10px; resize: vertical; }

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.input::placeholder { color: #b3b9c4; }
.hint { margin-top: 6px; font-size: 12px; color: var(--c-text-3); }
.err { margin-top: 6px; font-size: 12px; color: var(--c-danger); }

.input-group { display: flex; }
.input-group .input { border-radius: 6px 0 0 6px; }
.input-group .btn { border-radius: 0 6px 6px 0; border-left: none; }

/* ---------- 布局工具 ---------- */
.row { display: flex; gap: 12px; align-items: center; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.mt-0 { margin-top: 0; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.flex-end { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- 首页导航卡 ---------- */
.nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.nav-card {
  display: block;
  padding: 16px 18px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: inherit;
  transition: border-color .12s, transform .12s, box-shadow .12s;
}

.nav-card:hover {
  text-decoration: none;
  border-color: var(--c-primary);
  box-shadow: 0 4px 16px rgba(16, 24, 40, .08);
  transform: translateY(-1px);
}

.nav-card .t { font-weight: 600; margin-bottom: 4px; }
.nav-card .d { font-size: 12px; color: var(--c-text-3); line-height: 1.5; }
