:root {
  --brand: #1f2a44;
  --brand-2: #345075;
  --accent: #ff6b35;
  --accent-soft: #fff1ea;
  --blue: #2563eb;
  --green: #16a34a;
  --amber: #f59e0b;
  --red: #dc2626;
  --bg: #f4f6fa;
  --card: #ffffff;
  --line: #e6eaf2;
  --text: #1c2333;
  --text-2: #5b6580;
  --text-3: #8b94a9;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(28, 35, 51, .06);
  --shadow-lg: 0 12px 32px rgba(28, 35, 51, .12);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--blue); text-decoration: none; }
input, select, textarea { font-family: inherit; font-size: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border: none; border-radius: 10px; cursor: pointer;
  background: var(--brand); color: #fff; font-size: 14px; font-weight: 500;
  transition: .15s; white-space: nowrap;
}
.btn:hover { opacity: .9; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); }
.btn.ghost { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: var(--red); }
.btn.sm { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.input, .select, .textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--text); outline: none; transition: .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.textarea { min-height: 110px; resize: vertical; line-height: 1.7; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.tag {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 12px; background: #eef2f9; color: var(--text-2); margin: 2px 4px 2px 0;
}
.tag.orange { background: var(--accent-soft); color: var(--accent); }
.tag.green { background: #e8f7ee; color: var(--green); }
.tag.blue { background: #e8f0fe; color: var(--blue); }
.tag.red { background: #fdecec; color: var(--red); }
.tag.gray { background: #f0f2f6; color: var(--text-3); }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.empty { text-align: center; padding: 46px 16px; color: var(--text-3); font-size: 13px; }
.empty .ico { font-size: 34px; display: block; margin-bottom: 10px; opacity: .45; }

/* Toast */
#toast {
  position: fixed; left: 50%; top: 24px; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast-item {
  background: rgba(28, 35, 51, .94); color: #fff; padding: 10px 18px;
  border-radius: 10px; font-size: 13px; box-shadow: var(--shadow-lg);
  animation: tin .22s ease;
}
.toast-item.ok { background: #16a34a; }
.toast-item.err { background: #dc2626; }
.toast-item.info { background: #334155; }
@keyframes tin { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* Modal */
.modal-mask {
  position: fixed; inset: 0; background: rgba(20, 26, 40, .5); z-index: 900;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fin .16s ease;
}
@keyframes fin { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 520px;
  max-height: 88vh; overflow: auto; box-shadow: var(--shadow-lg);
}
.modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  font-size: 16px; font-weight: 600; display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; background: #fff; z-index: 2;
}
.modal-body { padding: 20px; }
.modal-foot {
  padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end;
  position: sticky; bottom: 0; background: #fff;
}
.close-x { cursor: pointer; color: var(--text-3); font-size: 22px; line-height: 1; }

/* Table */
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th {
  text-align: left; padding: 10px 12px; color: var(--text-3);
  font-weight: 500; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.grid td { padding: 11px 12px; border-bottom: 1px solid #f2f4f9; vertical-align: middle; }
table.grid tr:hover td { background: #fafbfe; }

/* Loader */
.spin {
  width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff; border-radius: 50%; display: inline-block; animation: sp .7s linear infinite;
}
.spin.dark { border-color: rgba(31, 42, 68, .2); border-top-color: var(--brand); }
@keyframes sp { to { transform: rotate(360deg) } }

.center-loading { text-align: center; padding: 40px; color: var(--text-3); }
