/* ================= 设计系统 · 基础样式 ================= */
:root {
  --ink: #0b1220;
  --ink-2: #172033;
  --ink-3: #2c3a50;
  --muted: #5f6f86;
  --muted-2: #8b98ab;
  --line: #e4e9f1;
  --line-2: #eef2f7;
  --bg: #f4f6fa;
  --bg-2: #eef2f8;
  --white: #ffffff;
  --primary: #1d5cff;
  --primary-2: #0b45d8;
  --primary-soft: #eaf0ff;
  --accent: #00b39b;
  --accent-soft: #e6f8f5;
  --amber: #ee9a1f;
  --amber-soft: #fff4e2;
  --danger: #e5484d;
  --danger-soft: #fdecec;
  --cyan: #0e9bb5;
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(16, 30, 54, .06), 0 2px 8px rgba(16, 30, 54, .04);
  --shadow: 0 6px 24px rgba(16, 30, 54, .08), 0 1px 3px rgba(16, 30, 54, .05);
  --shadow-lg: 0 24px 70px rgba(10, 22, 44, .18), 0 4px 14px rgba(10, 22, 44, .08);
  --font: "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Courier New", monospace;
  --header-h: 68px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4, h5 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c9d2e0; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #aab6c8; }

/* ---------- 布局工具 ---------- */
.container { width: min(1200px, calc(100% - 48px)); margin: 0 auto; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; }
.gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; } .gap-24 { gap: 24px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; } .mt-48 { margin-top: 48px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; } .mb-32 { margin-bottom: 32px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }
.text-primary { color: var(--primary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--accent); }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent;
  background: var(--white); color: var(--ink-2); font-weight: 500; font-size: 13.5px;
  transition: all .18s var(--ease); white-space: nowrap; user-select: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn i { font-size: 14px; }
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
  color: #fff; box-shadow: 0 6px 18px rgba(29, 92, 255, .28);
}
.btn-primary:hover { box-shadow: 0 10px 26px rgba(29, 92, 255, .34); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: var(--ink-2); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { border-color: #c9d4e4; background: #fff; }
.btn-soft { background: var(--primary-soft); color: var(--primary); }
.btn-soft:hover { background: #dfe8ff; }
.btn-amber { background: linear-gradient(135deg, #f7ae3c, #ea9012); color: #23180a; box-shadow: 0 6px 18px rgba(238, 154, 31, .25); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: #f7d3d4; }
.btn-danger:hover { background: #fbdedf; }
.btn-sm { height: 32px; padding: 0 12px; border-radius: 8px; font-size: 12.5px; }
.btn-lg { height: 48px; padding: 0 26px; border-radius: 12px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; box-shadow: none; }
.btn-link { background: none; border: none; color: var(--primary); padding: 0; height: auto; font-weight: 500; }
.btn-link:hover { text-decoration: underline; transform: none; }
.icon-btn {
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--ink-3);
  transition: all .16s var(--ease);
}
.icon-btn:hover { background: var(--line-2); }
.icon-btn.active { background: var(--primary-soft); color: var(--primary); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label { font-size: 12.5px; color: var(--ink-3); font-weight: 500; }
.input, .select, .textarea {
  height: 40px; border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 0 13px; outline: none; transition: border-color .16s, box-shadow .16s; width: 100%;
}
.textarea { height: auto; min-height: 88px; padding: 10px 13px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29, 92, 255, .12); }
.input::placeholder, .textarea::placeholder { color: #aab5c5; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23708096' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-3); cursor: pointer; }
.check input { accent-color: var(--primary); width: 15px; height: 15px; }

/* ---------- 卡片 ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.card-title { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 9px; }
.card-title i { color: var(--primary); font-size: 14px; }

/* ---------- 徽标 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px;
  border-radius: 7px; font-size: 12px; font-weight: 500; line-height: 1;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge-warn { background: var(--amber-soft); color: #b57209; }
.badge-info { background: #e8f2ff; color: #1b6bd6; }
.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-cyan { background: #e2f7fa; color: #0b879e; }
.badge-success { background: var(--accent-soft); color: #078a76; }
.badge-muted { background: #eff2f6; color: #71809a; }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--bg-2); color: var(--muted); font-size: 11.5px; }

/* ---------- 表格 ---------- */
.table-wrap { width: 100%; overflow: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table th {
  position: sticky; top: 0; z-index: 2; background: #f8fafd; color: var(--muted);
  font-weight: 500; font-size: 12px; text-align: left; padding: 11px 14px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 13px 14px; border-bottom: 1px solid var(--line-2); color: var(--ink-2); vertical-align: middle; }
.table tbody tr { transition: background .14s; }
.table tbody tr:hover { background: #f8fafd; }
.table tbody tr:last-child td { border-bottom: none; }
.table .num { font-family: var(--mono); font-size: 12.5px; }
.table .actions { display: flex; gap: 4px; justify-content: flex-end; }
.table .link { color: var(--primary); font-weight: 500; cursor: pointer; }
.table .link:hover { text-decoration: underline; }
.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.toolbar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search-box { position: relative; }
.search-box i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #9aa7ba; font-size: 13px; }
.search-box .input { width: 230px; padding-left: 34px; height: 36px; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; color: var(--muted); font-size: 12.5px; }
.pager-btns { display: flex; gap: 4px; }
.pager-btns button {
  min-width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--line); background: #fff;
  color: var(--ink-3); font-size: 12.5px;
}
.pager-btns button:hover { border-color: var(--primary); color: var(--primary); }
.pager-btns button.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager-btns button:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 900; background: rgba(9, 18, 34, .46);
  backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-mask.open { display: flex; animation: fadeIn .18s var(--ease); }
.modal {
  width: min(560px, 100%); max-height: calc(100vh - 64px); background: #fff;
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  animation: modalIn .26s var(--ease); overflow: hidden;
}
.modal.modal-lg { width: min(880px, 100%); }
.modal.modal-xl { width: min(1100px, 100%); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 26px 16px; }
.modal-head h3 { font-size: 18px; }
.modal-head .sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.modal-close { width: 32px; height: 32px; border-radius: 8px; border: none; background: #f2f5fa; color: var(--muted); display: flex; align-items: center; justify-content: center; flex: none; }
.modal-close:hover { background: #e8edf5; color: var(--ink); }
.modal-body { padding: 4px 26px 22px; overflow: auto; }
.modal-foot { padding: 16px 26px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 10px; background: #fbfcfe; }
.modal .section-label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; margin: 16px 0 10px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 提示 ---------- */
.toast-wrap { position: fixed; top: 22px; right: 22px; z-index: 1200; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  min-width: 240px; max-width: 380px; background: #fff; border: 1px solid var(--line);
  border-left: 3px solid var(--primary); border-radius: 11px; box-shadow: var(--shadow);
  padding: 12px 16px; font-size: 13px; color: var(--ink-2); display: flex; gap: 10px; align-items: flex-start;
  animation: slideIn .22s var(--ease); pointer-events: auto;
}
.toast i { margin-top: 2px; }
.toast.success { border-left-color: var(--accent); }
.toast.success i { color: var(--accent); }
.toast.error { border-left-color: var(--danger); }
.toast.error i { color: var(--danger); }
.toast.warn { border-left-color: var(--amber); }
.toast.warn i { color: var(--amber); }
.toast.info i { color: var(--primary); }

/* ---------- 空状态 / 加载 ---------- */
.empty { padding: 56px 20px; text-align: center; color: var(--muted); }
.empty .ico { width: 62px; height: 62px; margin: 0 auto 14px; border-radius: 18px; background: var(--bg-2); display: flex; align-items: center; justify-content: center; color: #9aa9be; font-size: 24px; }
.empty h4 { font-size: 14px; color: var(--ink-3); margin-bottom: 4px; }
.empty p { font-size: 12.5px; }
.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.spinner.dark { border-color: #dbe3ef; border-top-color: var(--primary); }
.loading-mask { position: absolute; inset: 0; background: rgba(255,255,255,.7); display: flex; align-items: center; justify-content: center; z-index: 5; }

/* ---------- 标签页 ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tab {
  padding: 10px 4px; margin-right: 22px; border: none; background: none; color: var(--muted);
  font-size: 13.5px; font-weight: 500; border-bottom: 2px solid transparent; transition: all .16s;
}
.tab:hover { color: var(--ink); }
.tab.on { color: var(--primary); border-bottom-color: var(--primary); }
.seg { display: inline-flex; background: #f1f4f9; border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: none; background: transparent; padding: 6px 14px; border-radius: 7px; font-size: 12.5px; color: var(--muted); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }

/* ---------- 下拉 ---------- */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 168px; background: #fff;
  border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow); padding: 6px;
  display: none; z-index: 400;
}
.dropdown.open .dropdown-menu { display: block; animation: fadeIn .15s var(--ease); }
.dropdown-menu a, .dropdown-menu button {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 10px; border-radius: 7px;
  border: none; background: none; color: var(--ink-2); font-size: 13px; text-align: left;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--bg); color: var(--primary); }
.dropdown-menu i { width: 15px; text-align: center; color: var(--muted); font-size: 13px; }
.dropdown-menu a:hover i, .dropdown-menu button:hover i { color: var(--primary); }
.dropdown-divider { height: 1px; background: var(--line-2); margin: 5px 4px; }

/* ---------- 分页按钮通用 ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--bg-2); color: var(--muted); font-size: 12px; }

/* ---------- 骨架 ---------- */
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
.skeleton { background: linear-gradient(90deg, #eef2f7 25%, #f7f9fc 37%, #eef2f7 63%); background-size: 800px 100%; animation: shimmer 1.4s infinite linear; border-radius: 8px; }
