:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --line: #e3e8ef;
  --text: #1f2a37;
  --muted: #6b7785;
  --primary: #2563eb;
  --primary-d: #1d4ed8;
  --danger: #dc2626;
  --ok: #16a34a;
  --shadow: 0 2px 10px rgba(20, 30, 50, .08);
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}
.hidden { display: none !important; }

/* 登录 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card {
  background: var(--card); padding: 36px 32px; border-radius: 14px; box-shadow: var(--shadow);
  width: 340px; display: flex; flex-direction: column; gap: 14px;
}
.login-card h1 { margin: 0; font-size: 22px; }
.login-card .sub { margin: -6px 0 6px; color: var(--muted); }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.login-card input {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px;
}

/* 顶栏 */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); padding: 14px 22px; border-bottom: 1px solid var(--line);
}
.brand { font-size: 18px; font-weight: 700; }
.userbox { display: flex; align-items: center; gap: 12px; color: var(--muted); }

/* 工具栏 */
.toolbar { display: flex; gap: 12px; padding: 18px 22px 6px; flex-wrap: wrap; }
.toolbar input[type=text] {
  flex: 1; min-width: 240px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
}

/* 按钮 */
.btn {
  padding: 9px 16px; border: 1px solid var(--line); background: var(--card); border-radius: 8px;
  cursor: pointer; font-size: 14px; color: var(--text); text-decoration: none; display: inline-block;
}
.btn:hover { border-color: #c7d0db; }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-d); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: #f1c4c4; }

/* 表格 */
.table-wrap { padding: 8px 22px 30px; }
table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f8fafc; font-weight: 700; color: var(--muted); white-space: nowrap; }
td .val { white-space: pre-wrap; max-width: 320px; }
.row-actions { white-space: nowrap; }
.row-actions button { margin-right: 6px; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(20,30,50,.45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-card { background: var(--card); border-radius: 12px; width: 540px; max-width: 94vw; max-height: 90vh; overflow: auto; box-shadow: var(--shadow); }
.modal-card.wide { width: 720px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-head .x { border: none; background: none; font-size: 24px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.sec { margin: 6px 0 0; font-size: 14px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

.modal-body label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.modal-body input, .modal-body select, .modal-body textarea {
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-weight: 400; font-family: inherit;
}
.modal-body label.chk { flex-direction: row; align-items: center; gap: 8px; font-weight: 600; }
.opt-label { font-weight: 600; }

/* 字段表 */
.field-table th, .field-table td { padding: 9px 10px; }
.field-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-form label { font-weight: 600; }
.field-form .chk, .field-form .modal-foot { grid-column: 1 / -1; }

.error { color: var(--danger); font-size: 13px; min-height: 18px; }
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: #1f2a37; color: #fff; padding: 11px 20px; border-radius: 8px; z-index: 100; font-size: 14px;
  box-shadow: var(--shadow);
}
