:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --line: #e6eaf0;
  --text: #2b3440;
  --muted: #7a8699;
  --blue: #3b82f6;
  --red: #ef4444;
  --orange: #f59e0b;
  --green: #10b981;
  --radius: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, "Microsoft YaHei", "PingFang SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.brand { font-size: 18px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-right select {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 12px 24px 0;
  flex-wrap: wrap;
}
.tab {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  padding: 8px 18px;
  border-radius: 10px 10px 0 0;
  cursor: pointer;
  font-size: 14px;
}
.tab.active { background: var(--bg); color: var(--text); border-bottom-color: var(--bg); font-weight: 600; }

#content { padding: 20px 24px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.toolbar h2 { font-size: 16px; }

.btn {
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 14px;
  color: #fff;
  background: var(--blue);
}
.btn:hover { opacity: .9; }
.btn.red { background: var(--red); }
.btn.orange { background: var(--orange); }
.btn.green { background: var(--green); }
.btn.ghost { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn.sm { padding: 5px 10px; font-size: 12px; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); font-weight: 600; background: #fafbfc; }
tr:hover td { background: #fafcff; }

.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; }
.tag.blue { background: #e8f0fe; color: var(--blue); }
.tag.red { background: #fdeaea; color: var(--red); }
.tag.orange { background: #fef3e2; color: var(--orange); }

.modal-mask {
  position: fixed; inset: 0;
  background: rgba(20, 30, 45, .35);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; z-index: 50;
}
.modal-mask[hidden] { display: none; }
.modal {
  background: #fff; border-radius: 14px; padding: 22px;
  width: 720px; max-width: 100%; max-height: 80vh; overflow: auto;
}
.modal h3 { margin-bottom: 16px; }

.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { color: var(--muted); font-size: 12px; }
.field input, .field select, .field textarea {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px;
}

.items-head, .item-row {
  display: grid;
  grid-template-columns: 2fr 1.4fr 1fr 1fr 1fr 1fr 32px;
  gap: 8px; align-items: center;
}
.items-head { color: var(--muted); font-size: 12px; margin: 8px 0; }
.item-row { margin-bottom: 8px; }
.item-row input { padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; }

.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.muted { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* 打印 */
#print-area { display: none; }
@media print {
  body * { visibility: hidden; }
  #print-area, #print-area * { visibility: visible; }
  #print-area { display: block; position: absolute; left: 0; top: 0; width: 100%; padding: 24px; }
}
.print-doc { font-size: 14px; }
.print-doc h1 { text-align: center; margin-bottom: 6px; }
.print-doc .meta { margin: 12px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.print-doc table { margin-top: 12px; }
.print-sign { margin-top: 40px; display: flex; justify-content: space-between; }
