:root {
  --bg: #f4f1ea;
  --ink: #1c1914;
  --muted: #6b6458;
  --line: #d9d2c5;
  --paper: #fffdf8;
  --accent: #0f6a56;
  --accent-ink: #f7fffb;
  --warn: #8a2f1d;
  --ok: #1d6b3a;
  --shadow: 0 18px 40px rgba(28, 25, 20, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(1200px 500px at 10% -10%, #efe7d6 0%, transparent 55%),
    var(--bg);
  color: var(--ink);
  min-height: 100dvh;
}

a { color: var(--accent); text-decoration: none; }
.wrap { width: min(1080px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 64px; }
.wrap.wide { width: min(1180px, calc(100% - 32px)); }
.top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 24px;
}
.brand { font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
h1 { font-size: clamp(28px, 5vw, 44px); line-height: 1.1; margin: 8px 0 10px; letter-spacing: -0.04em; }
.lead { max-width: 42rem; color: var(--muted); line-height: 1.7; margin: 0 0 28px; }

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: 1.2fr 0.8fr; }
@media (max-width: 860px) { .grid.two { grid-template-columns: 1fr; } }

label { display: block; font-size: 14px; margin: 0 0 8px; }
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, white);
  border-color: var(--accent);
}
input.is-invalid, textarea.is-invalid {
  border-color: var(--warn);
  background: #fff8f6;
}
input.is-invalid:focus, textarea.is-invalid:focus {
  outline: 2px solid color-mix(in srgb, var(--warn) 35%, white);
  border-color: var(--warn);
}
.field-hint { margin: 8px 0 0; font-size: 13px; color: var(--muted); line-height: 1.55; }
.field-hint.err { color: var(--warn); }
input:focus, textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, white);
  border-color: var(--accent);
}
.btn {
  appearance: none;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.flash { padding: 12px 14px; border-radius: 12px; margin: 0 0 16px; }
.flash.ok { background: #e8f6ec; color: var(--ok); }
.flash.err { background: #f8e8e4; color: var(--warn); }
.steps { margin: 0; padding-left: 18px; color: var(--muted); line-height: 1.8; }
.mono { font-family: ui-monospace, Consolas, monospace; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.stat {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
@media (max-width: 860px) { .stat { grid-template-columns: repeat(2, 1fr); } }
.stat b { display: block; font-size: 24px; }
.stat span { color: var(--muted); font-size: 13px; }
.codes { display: grid; gap: 8px; }
.codechip {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  background: #f7f3ea;
  border-radius: 12px;
  padding: 10px 12px;
  font-family: ui-monospace, Consolas, monospace;
}
.muted { color: var(--muted); }
.qr { width: 220px; height: 220px; background: #fff; border-radius: 16px; border: 1px solid var(--line); }
.footer { margin-top: 28px; color: var(--muted); font-size: 13px; }
.hidden { display: none; }
.help-shots {
  display: grid;
  gap: 14px;
}
.help-shots img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}
.help-shots figcaption {
  color: var(--muted);
  font-size: 13px;
  margin-top: 8px;
}
.record {
  border-top: 1px solid var(--line);
  padding: 18px 0 8px;
}
.record:first-of-type { border-top: 0; padding-top: 4px; }
.record-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.record-meta { margin: 8px 0 12px; font-size: 13px; }
.urlbox .url {
  display: block;
  margin-top: 6px;
  word-break: break-all;
  line-height: 1.5;
}
.url-clip {
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
pre.raw, .bubble pre {
  white-space: pre-wrap;
  word-break: break-word;
  font: 13px/1.55 ui-monospace, Consolas, monospace;
  margin: 8px 0 0;
}
.thread { margin-top: 14px; display: grid; gap: 10px; }
.bubble {
  border-radius: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
}
.bubble.out { background: #f7f3ea; }
.bubble.in { background: #eef6f3; }
.bubble-kicker { color: var(--muted); font-size: 12px; }
.pill {
  flex: none;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: #fff;
}
.pill.success { background: #e8f6ec; color: var(--ok); }
.pill.failed, .pill.error { background: #f8e8e4; color: var(--warn); }
.pill.sent, .pill.processing, .pill.replied { background: #eef6f3; color: var(--accent); }
.pill.need_points { background: #f8efe4; color: #8a5a1d; }
.pill.cancelled { background: #f3f0ea; color: var(--muted); }
.searchbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 14px 0 10px;
}
.searchbar input { flex: 1; }
.searchbar .btn { white-space: nowrap; }
.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.pager-pages {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}
.page {
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  background: #fff;
  font-size: 13px;
}
.page.current {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.page.dots { border: 0; background: transparent; min-width: auto; }
.btn.disabled {
  opacity: 0.45;
  pointer-events: none;
}
@media (max-width: 860px) {
  .searchbar { flex-wrap: wrap; }
}
.result {
  border-top: 1px solid var(--line);
  padding: 10px 0;
}
.result:first-of-type { border-top: 0; }
.result summary {
  display: flex;
  gap: 12px;
  align-items: center;
  cursor: pointer;
  list-style: none;
}
.result summary::-webkit-details-marker { display: none; }
.result summary .pill { margin-left: auto; }
.result-body {
  margin-top: 10px;
  padding: 12px;
  background: #f7f3ea;
  border-radius: 12px;
}
.result-body .url {
  display: block;
  margin-top: 4px;
  word-break: break-all;
  line-height: 1.5;
}
