* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #f4f5f7;
  color: #222;
  line-height: 1.6;
}
a { color: #1559b6; text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px 20px;
  background: #1f2d3d;
  color: #fff;
  flex-wrap: wrap;
}
.topbar .brand { color: #fff; font-weight: 600; font-size: 17px; }
.topbar nav { display: flex; gap: 18px; flex-wrap: wrap; }
.topbar nav a { color: #c9d4e2; }
.topbar nav a:hover { color: #fff; text-decoration: none; }
.topbar .who { margin-left: auto; color: #c9d4e2; display: flex; gap: 12px; align-items: center; }
.topbar .who a { color: #8fa8c5; }
.badge {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  margin-left: 4px;
  border-radius: 9px;
  background: #e04b4b;
  color: #fff;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
}
main { max-width: 1080px; margin: 24px auto; padding: 0 16px 60px; }
.flash {
  background: #e8f3ec;
  border: 1px solid #b7ddc4;
  color: #1e6b3a;
  padding: 9px 14px;
  border-radius: 6px;
  margin-bottom: 16px;
}
.impersonate-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  background: #fff8e1;
  border: 1px solid #f0d68a;
  color: #7a5a00;
  padding: 8px 14px;
  border-radius: 6px;
  margin-bottom: 16px;
}
.impersonate-bar form { margin: 0; }
.card {
  background: #fff;
  border: 1px solid #e3e6eb;
  border-radius: 8px;
  padding: 18px 20px;
  margin-bottom: 18px;
}
.card h2 { margin: 0 0 14px; font-size: 17px; }
.card h3 { margin: 18px 0 10px; font-size: 15px; }
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar h1 { font-size: 19px; margin: 0; }
.toolbar .spacer { flex: 1; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; min-width: 640px; }
th, td { border-bottom: 1px solid #eceef2; padding: 8px 10px; text-align: left; vertical-align: top; white-space: nowrap; }
th { color: #666; font-weight: 500; white-space: nowrap; background: #fafbfc; }
tr:last-child td { border-bottom: 0; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; }
.tag.draft { background: #eef0f3; color: #666; }
.tag.pending { background: #fff4e0; color: #9a6200; }
.tag.returned { background: #fdecec; color: #a52a2a; }
.tag.done { background: #e8f3ec; color: #1e6b3a; }
.btn, button {
  display: inline-block;
  padding: 7px 16px;
  border: 1px solid #c9d0da;
  border-radius: 6px;
  background: #fff;
  color: #222;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}
.btn:hover, button:hover { background: #f2f4f7; text-decoration: none; }
.btn.primary, button.primary { background: #1559b6; border-color: #1559b6; color: #fff; }
.btn.primary:hover, button.primary:hover { background: #124a96; }
.btn.danger, button.danger { color: #a52a2a; border-color: #e0b4b4; }
.btn.small, button.small { padding: 3px 10px; font-size: 13px; }
label { display: block; font-size: 13px; color: #555; margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #c9d0da;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.field { margin-bottom: 14px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.muted { color: #777; font-size: 13px; }
.pre { white-space: pre-wrap; word-break: break-word; background: #fafbfc; border: 1px solid #eceef2; border-radius: 6px; padding: 12px; }
.calc-preview { margin: 6px 0 16px; padding: 12px 14px; border: 1px solid #cfe0f5; background: #f4f8fd; border-radius: 6px; }
.calc-total { font-size: 26px; font-weight: 600; color: #1559b6; line-height: 1.25; }
.summary { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.summary div { background: #fafbfc; border: 1px solid #eceef2; border-radius: 6px; padding: 8px 10px; }
.summary span { display: block; font-size: 12px; color: #777; }
.summary strong { font-size: 16px; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { border-left: 3px solid #d8dde5; padding: 0 0 14px 14px; margin-left: 4px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline .when { color: #888; font-size: 12px; }
.inline-form { display: inline; }
.login-box { max-width: 360px; margin: 8vh auto 0; }
.login-box .card { padding: 26px 28px; }
.user-list { display: flex; flex-direction: column; gap: 10px; }
.user-row {
  display: grid;
  grid-template-columns: 1.1fr 1.1fr .9fr .9fr .5fr .5fr 1.1fr auto;
  gap: 10px;
  align-items: end;
  padding-bottom: 10px;
  border-bottom: 1px solid #eceef2;
}
.user-row input[type=checkbox] { margin-top: 10px; }
@media (max-width: 900px) {
  .user-row { grid-template-columns: 1fr 1fr; }
  .user-row > div:last-child { grid-column: 1 / -1; }
}
.error { color: #a52a2a; font-size: 13px; }
@media (max-width: 760px) {
  .summary { grid-template-columns: repeat(2, 1fr); }
  .grid2, .grid3, .grid4 { grid-template-columns: 1fr; }
  .topbar { gap: 12px; }
  .topbar .who { margin-left: 0; }
  main { margin-top: 14px; }
}