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

:root {
  --brand: #185fa5;
  --brand-light: #e6f1fb;
  --text: #1f2329;
  --text-2: #646a73;
  --text-3: #8f959e;
  --line: #e5e6eb;
  --bg: #f4f5f7;
  --card: #ffffff;
  --ok: #0f6e56;
  --ok-bg: #e1f5ee;
  --warn: #854f0b;
  --warn-bg: #faeeda;
  --danger: #a32d2d;
  --danger-bg: #fcebeb;
}

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

#app { max-width: 560px; margin: 0 auto; padding-bottom: 76px; min-height: 100vh; background: var(--bg); overflow-x: hidden; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 14px 16px 12px;
}
.topbar h1 { margin: 0; font-size: 17px; font-weight: 500; letter-spacing: .2px; }
.topbar .sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.wrap { padding: 14px 16px 8px; }

.card {
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 16px;
  margin-bottom: 12px;
}
.card h2 { margin: 0 0 12px; font-size: 14px; font-weight: 500; color: var(--text); }

.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.field label .req { color: var(--danger); margin-left: 2px; }

input[type=text], input[type=tel], input[type=date], select, textarea {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  color: var(--text);
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  font-family: inherit;
  appearance: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); background: #fff; }
textarea { resize: vertical; min-height: 64px; }
select { background-image: none; }

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.row > * { min-width: 0; }

.btn {
  display: block; width: 100%;
  padding: 12px;
  font-size: 16px;
  font-weight: 500;
  color: #fff;
  background: var(--brand);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
}
.btn:active { opacity: .85; }
.btn:disabled { background: #b5d4f4; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn.small { width: auto; display: inline-block; padding: 7px 14px; font-size: 13px; border-radius: 8px; }
.btn.danger { background: #fff; color: var(--danger); border: 1px solid #f0c4c4; }

.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  flex: 1;
  text-align: center;
  padding: 9px 0 10px;
  font-size: 12px;
  color: var(--text-3);
  text-decoration: none;
}
.tabs a.on { color: var(--brand); }
.tabs a .ico { display: block; font-size: 17px; line-height: 1.2; margin-bottom: 1px; }

.item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.item .hd { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.item .name { font-size: 15px; font-weight: 500; }
.item .meta { font-size: 12.5px; color: var(--text-3); margin-top: 3px; }
.item .body { font-size: 13.5px; color: var(--text-2); margin-top: 8px; }
.item .acts { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

.tag {
  display: inline-block;
  padding: 2px 9px;
  font-size: 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.tag.gray { background: #f1f2f4; color: var(--text-2); }
.tag.blue { background: var(--brand-light); color: var(--brand); }
.tag.green { background: var(--ok-bg); color: var(--ok); }
.tag.amber { background: var(--warn-bg); color: var(--warn); }
.tag.red { background: var(--danger-bg); color: var(--danger); }

.empty { text-align: center; padding: 48px 20px; color: var(--text-3); font-size: 14px; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.stat .k { font-size: 12px; color: var(--text-3); }
.stat .v { font-size: 24px; font-weight: 500; color: var(--text); line-height: 1.3; }
.stat .v small { font-size: 13px; font-weight: 400; color: var(--text-3); margin-left: 3px; }

.toast {
  position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%);
  background: rgba(0,0,0,.82); color: #fff; padding: 12px 20px;
  border-radius: 10px; font-size: 14px; z-index: 999; max-width: 78%;
  text-align: center; line-height: 1.5;
}

.mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  background: #fff; width: 100%; max-width: 560px;
  border-radius: 16px 16px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  max-height: 86vh; overflow-y: auto;
}
.sheet h3 { margin: 0 0 4px; font-size: 16px; font-weight: 500; }
.sheet .hint { font-size: 13px; color: var(--text-3); margin-bottom: 16px; }

.qrbox { display: flex; flex-direction: column; align-items: center; padding: 8px 0 4px; }
.qrbox .frame { padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.qrbox .tip { font-size: 12.5px; color: var(--text-3); margin-top: 10px; text-align: center; }

.voucher-card { text-align: center; }
.voucher-card .holder { font-size: 20px; font-weight: 500; margin-bottom: 2px; }
.voucher-card .role { font-size: 13px; color: var(--text-3); margin-bottom: 14px; }
.voucher-card .code { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--text-3); letter-spacing: .5px; margin-top: 10px; word-break: break-all; }

.kv { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid #f2f3f5; font-size: 14px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--text-2); }
.kv .v { color: var(--text); text-align: right; }

.notice { background: var(--brand-light); color: var(--brand); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
