/* ============================================================
   双端共用基础层：设计令牌 / 按钮 / 表单 / 表格 / 弹窗 / 提示
   设计语言：清亮专业（Light Professional）
   ============================================================ */
:root {
  /* 品牌与状态 */
  --brand: #2563eb;
  --brand-d: #1d4ed8;
  --brand-l: #eff6ff;
  --brand-g: linear-gradient(135deg, #3b82f6, #1d4ed8);
  --ok: #10b981;
  --warn: #f59e0b;
  --err: #ef4444;
  --info: #0891b2;
  --purple: #8b5cf6;

  /* 文本层级 */
  --txt: #0f172a;
  --txt2: #475569;
  --txt3: #94a3b8;

  /* 面与线 */
  --line: #e6eaf2;
  --line-2: #eef2f8;
  --bg: #f5f7fc;
  --card: #ffffff;

  /* 圆角与阴影（三级 elevation） */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 14px rgba(15, 23, 42, .05);
  --shadow-md: 0 2px 4px rgba(15, 23, 42, .04), 0 10px 28px rgba(15, 23, 42, .08);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, .16);

  /* 间距节奏 */
  --gap: 14px;
  --pad: 20px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--txt); background: var(--bg); font-size: 14px; -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #c8d2e0; border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #a9b6c9; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

@keyframes fadein { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: #fff; color: var(--txt2); cursor: pointer; white-space: nowrap;
  transition: all .16s cubic-bezier(.4, 0, .2, 1); font-size: 13px; font-weight: 500;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
}
.btn:hover { border-color: #bfd3f7; color: var(--brand); background: #f8fbff; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand-g); border-color: transparent; color: #fff; box-shadow: 0 2px 8px rgba(37, 99, 235, .28); }
.btn.primary:hover { background: linear-gradient(135deg, #2f74ef, #1a44c4); color: #fff; box-shadow: 0 4px 14px rgba(37, 99, 235, .34); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ok:hover { filter: brightness(.94); color: #fff; }
.btn.warn { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn.err { background: var(--err); border-color: var(--err); color: #fff; }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; }
.btn.ghost:hover { background: #f1f5f9; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 7px; }
.btn.lg { height: 40px; padding: 0 20px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .ic { width: 15px; height: 15px; }

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.fld { display: flex; flex-direction: column; gap: 7px; }
.fld.full { grid-column: 1 / -1; }
.fld.half { grid-column: span 1; }
.fld > label { font-size: 12.5px; color: var(--txt2); font-weight: 600; letter-spacing: .2px; }
.fld > label i { color: var(--err); font-style: normal; margin-left: 2px; }
.ipt {
  height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; outline: none; width: 100%; transition: border-color .15s, box-shadow .15s;
}
.ipt:hover { border-color: #cfd8e6; }
.ipt:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .13); }
textarea.ipt { height: auto; padding: 9px 12px; line-height: 1.6; resize: vertical; }
select.ipt { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 30px; }
.ipt-static { min-height: 38px; display: flex; align-items: center; padding: 7px 12px; background: #f7f9fc; border: 1px dashed var(--line); border-radius: var(--radius-sm); color: var(--txt2); }
.tip { font-size: 11.5px; color: var(--txt3); }

/* ---------- 弹窗 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 900;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: fadein .15s; backdrop-filter: blur(3px);
}
.mask.leaving { opacity: 0; transition: opacity .18s; }
.modal, .drawer {
  background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; max-height: 88vh; animation: pop .2s cubic-bezier(.2, .8, .3, 1); overflow: hidden;
}
.modal-hd, .drawer-hd {
  height: 56px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line-2); flex: none; background: #fff;
}
.modal-hd b, .drawer-hd b { font-size: 15.5px; font-weight: 600; }
.x { font-size: 24px; color: var(--txt3); cursor: pointer; line-height: 1; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 7px; transition: .15s; }
.x:hover { color: var(--txt); background: #f1f5f9; }
.modal-bd, .drawer-bd { padding: 20px; overflow: auto; flex: 1; }
.modal-ft { padding: 13px 20px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 10px; flex: none; background: #fafbfd; }
.drawer { border-radius: 0; height: 100vh; max-height: 100vh; position: absolute; right: 0; top: 0; animation: slidein .24s cubic-bezier(.2, .8, .3, 1); border-radius: var(--radius-lg) 0 0 var(--radius-lg); }
@keyframes slidein { from { transform: translateX(40px); opacity: .5; } to { transform: none; opacity: 1; } }

/* ---------- 表格 ---------- */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.tbl thead th {
  background: #f7f9fc; color: var(--txt2); font-weight: 600; text-align: left;
  padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
  position: sticky; top: 0; z-index: 2; font-size: 12.5px; letter-spacing: .3px;
}
.tbl thead th::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--line); }
.tbl tbody td { padding: 12px 14px; border-bottom: 1px solid #f4f6fa; color: var(--txt); }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: #f6f9ff; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .link { color: var(--brand); cursor: pointer; font-weight: 500; }
.tbl .link:hover { text-decoration: underline; }
.empty { padding: 52px; text-align: center; color: var(--txt3); background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); font-size: 13px; }

/* ---------- 徽标 / 进度 ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; line-height: 1.7; white-space: nowrap; font-weight: 500; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 11.5px; background: #f1f5f9; color: var(--txt2); margin-right: 4px; }
.prog { position: relative; height: 20px; background: #eef2f7; border-radius: 10px; overflow: hidden; min-width: 90px; }
.prog-bar { height: 100%; border-radius: 10px; transition: width .35s cubic-bezier(.4, 0, .2, 1); }
.prog span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--txt); font-weight: 600; }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; justify-content: space-between; padding: 14px 2px; }
.pager .total { color: var(--txt3); font-size: 12.5px; }
.pager .pgs { display: flex; gap: 5px; }
.pg { min-width: 32px; height: 32px; border: 1px solid var(--line); background: #fff; border-radius: var(--radius-sm); cursor: pointer; color: var(--txt2); transition: .15s; font-size: 13px; }
.pg:hover { border-color: var(--brand); color: var(--brand); }
.pg.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }

/* ---------- 小组件 ---------- */
.ic { display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ic svg { width: 100%; height: 100%; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.kv { display: grid; grid-template-columns: 100px 1fr; gap: 10px 14px; font-size: 13px; align-items: baseline; }
.kv dt { color: var(--txt3); }
.kv dd { margin: 0; color: var(--txt); word-break: break-all; }
.sec-title { font-size: 14px; font-weight: 600; margin: 18px 0 12px; display: flex; align-items: center; gap: 8px; }
.sec-title::before { content: ''; width: 3px; height: 14px; background: var(--brand); border-radius: 2px; }
.muted { color: var(--txt3); }
.tr { text-align: right; }
.flex { display: flex; gap: 10px; align-items: center; }
.spacer { flex: 1; }
.loader { padding: 48px; text-align: center; color: var(--txt3); font-size: 13px; }
