:root {
  --bg: #e9eef1;
  --bg-deep: #d5dee4;
  --card: rgba(255, 255, 255, 0.86);
  --card-solid: #fbfcfd;
  --ink: #14212b;
  --muted: #5b6b76;
  --line: rgba(20, 33, 43, 0.12);
  --line-strong: rgba(20, 33, 43, 0.18);
  --accent: #0f6e6a;
  --accent-deep: #0a524f;
  --accent-soft: #d7efed;
  --accent-glow: rgba(15, 110, 106, 0.18);
  --amber: #9a6418;
  --red: #a33a3a;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.55) inset, 0 10px 28px rgba(20, 33, 43, 0.06);
  --shadow-lift: 0 14px 36px rgba(20, 33, 43, 0.1);
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --pad: 24px;
  --radius: 16px;
  --radius-sm: 10px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
html { color-scheme: light; }
body {
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  background:
    radial-gradient(900px 520px at 12% -8%, rgba(15, 110, 106, 0.16), transparent 55%),
    radial-gradient(700px 480px at 92% 8%, rgba(52, 92, 120, 0.14), transparent 50%),
    linear-gradient(165deg, #f3f7f8 0%, var(--bg) 42%, var(--bg-deep) 100%);
  background-attachment: fixed;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.45'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  mix-blend-mode: soft-light;
}
body > * { position: relative; z-index: 1; }
body.booting .site-head .who { visibility: hidden; }
.boot-screen {
  min-height: 48vh;
  display: grid;
  place-items: center;
  padding: 48px 0;
}
.boot-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 14px;
}
.boot-card .mark {
  width: 52px;
  height: 52px;
  font-size: 24px;
  animation: boot-pulse 1.1s var(--ease) infinite;
}
@keyframes boot-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.96); opacity: 0.72; }
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }

.shell {
  width: min(840px, 100%);
  margin: 0 auto;
  padding-left: max(var(--pad), env(safe-area-inset-left));
  padding-right: max(var(--pad), env(safe-area-inset-right));
}
.shell.wide { width: min(1120px, 100%); }

.site-head {
  position: sticky;
  top: 0;
  z-index: 8;
  background: rgba(243, 247, 248, 0.78);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px) saturate(1.2);
}
.site-head .shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
}
main.shell {
  padding-top: 36px;
  padding-bottom: max(80px, env(safe-area-inset-bottom));
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #f4fffe;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  box-shadow: 0 8px 18px var(--accent-glow);
}
.brand b {
  display: block;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.brand small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
  margin-top: 1px;
}
.who {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.who-phone {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
}

h1 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(34px, 5vw, 48px);
  line-height: 1.18;
  margin: 0 0 14px;
  letter-spacing: 0.01em;
}
h2 {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 8px;
  letter-spacing: 0.01em;
}
.lead { color: var(--muted); margin: 0 0 18px; max-width: 34em; font-size: 16px; }
.notes { margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: 14px; }
.notes li {
  position: relative;
  padding-left: 16px;
  margin: 0 0 10px;
}
.notes li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 400px);
  gap: 48px;
  align-items: start;
}
.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-deep);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.18em;
}
.enter-copy {
  padding-top: 12px;
}
body:not(.admin) .enter-copy {
  animation: rise 0.7s var(--ease) both;
}
body:not(.admin) #enter-form {
  animation: rise 0.7s var(--ease) 0.08s both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  backdrop-filter: blur(10px);
}
.card + .card, .stack > .card + .card { margin-top: 16px; }
.card label:first-of-type { margin-top: 0; }
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 16px 0 6px;
  letter-spacing: 0.04em;
}
label span, .hint { color: var(--muted); font-weight: 400; font-size: 13px; }

select,
input[type="text"],
input[type="password"],
input[type="tel"],
input[type="number"],
input:not([type]) {
  width: 100%;
  height: 48px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.92);
  padding: 0 14px;
  font-size: 16px;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.row, .gen-row, .section-head, .card-head {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.section-head, .card-head {
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 14px;
}
.section-head h2, .card-head h2 { margin: 0; }
.card-head input { width: min(280px, 100%); }
.keys-toolbar { align-items: flex-start; }
.keys-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex: 1 1 280px;
  min-width: 0;
}
.keys-filters select,
.keys-filters input {
  min-height: 40px;
  margin: 0;
}
.keys-filters select {
  flex: 0 1 168px;
  min-width: 128px;
  max-width: 100%;
}
.keys-filters input {
  flex: 1 1 160px;
  width: auto !important;
  min-width: 140px;
  max-width: 100%;
}
.gen-row { margin-top: 14px; align-items: flex-end; }
.gen-row label { margin-top: 0; }
.gen-row .field-phone { flex: 1 1 220px; min-width: 180px; }
.gen-row .field-kind { flex: 0 0 140px; }
.gen-row .field-kind select { width: 100%; }
.gen-row .field-count { flex: 0 0 88px; }
.gen-row .count { width: 100%; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.88);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.18s var(--ease), background 0.18s var(--ease), border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(15, 110, 106, 0.35);
  box-shadow: 0 8px 18px rgba(20, 33, 43, 0.06);
}
.btn:active:not(:disabled) { transform: none; }
.btn.pri {
  background: linear-gradient(160deg, #14827d 0%, var(--accent-deep) 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 20px var(--accent-glow);
}
.btn.pri:hover:not(:disabled) {
  background: linear-gradient(160deg, #17918b 0%, var(--accent) 100%);
  box-shadow: 0 12px 24px var(--accent-glow);
}
.btn.pri:disabled {
  background: #b7c2c8;
  border-color: #b7c2c8;
  color: #fff;
  box-shadow: none;
  transform: none;
}
.btn.big { height: 50px; padding: 0 22px; width: 100%; font-size: 16px; }
.btn.ghost { background: transparent; }
.btn:disabled { cursor: not-allowed; }
.btn.tiny { height: 34px; padding: 0 12px; border-radius: 8px; font-size: 13px; }
.err { color: var(--red); min-height: 1.4em; font-size: 14px; margin: 8px 0 0; }
.ok { color: var(--accent); font-size: 14px; margin: 8px 0 0; }

.topbar {
  position: sticky;
  top: 72px;
  z-index: 6;
  margin: 0 calc(var(--pad) * -1) 18px;
  padding: 14px var(--pad) 16px;
  background: rgba(243, 247, 248, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.bar-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.progress-label { font-size: 15px; font-weight: 500; }
.progress-label b { font-family: var(--serif); font-size: 1.15em; color: var(--accent-deep); }
.bar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bar {
  height: 5px;
  background: rgba(20, 33, 43, 0.08);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 10px;
}
.bar i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), #2a9b8f);
  border-radius: inherit;
  transition: width 0.35s var(--ease);
}

.part {
  font-family: var(--serif);
  font-size: 21px;
  margin: 32px 0 14px;
  letter-spacing: 0.02em;
}
.q {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  margin: 0 0 12px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.q.miss {
  border-color: rgba(154, 100, 24, 0.55);
  box-shadow: 0 0 0 3px rgba(154, 100, 24, 0.12);
}
.qid {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.qt { font-size: 16.5px; margin: 4px 0 14px; font-weight: 500; }
.opts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.opts.binary { grid-template-columns: 1fr 1fr; }
.opt {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-sm);
  min-height: 44px;
  padding: 8px 6px;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease), transform 0.18s var(--ease);
}
.opt:hover:not(:disabled) {
  border-color: rgba(15, 110, 106, 0.45);
  transform: translateY(-1px);
}
.opt:disabled { cursor: default; }
.opt.on {
  background: linear-gradient(160deg, #14827d 0%, var(--accent-deep) 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 14px var(--accent-glow);
}

.pick {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  margin: 0 0 12px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.pick:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
}
.pick b {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: 0.02em;
}
.pick span { display: block; }
.pick .hint { color: var(--muted); margin-top: 2px; font-size: 13px; }
.pick-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.pick-top b { margin: 0; }
.pick-go {
  margin-top: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent, #b45309);
}
.age-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}
.age-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  text-align: left;
  padding: 18px 16px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: var(--card-solid, #fff);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.age-card b { font-size: 20px; }
.age-card span { font-size: 13px; color: var(--muted); }
.age-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
@media (max-width: 560px) {
  .age-grid { grid-template-columns: 1fr; }
}
.kind-tag {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.4;
}
.kind-tag.kind-quick {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fdba74;
}
.kind-tag.kind-formal {
  background: #ecfeff;
  color: #0e7490;
  border: 1px solid #67e8f9;
}
.kind-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.kind-cell .kind-name { font-size: 14px; }
.pick.pick-quick {
  background: linear-gradient(90deg, rgba(194, 65, 12, 0.06), transparent 48%);
  border-color: #fdba74;
}
.pick.pick-formal {
  background: linear-gradient(90deg, rgba(14, 116, 144, 0.06), transparent 48%);
  border-color: #a5f3fc;
}
.pick-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.agent-link-card.card-quick {
  border-color: #fdba74;
  background: linear-gradient(180deg, #fff7ed 0%, #fff 42%);
}
.agent-link-card.card-formal {
  border-color: #a5f3fc;
  background: linear-gradient(180deg, #ecfeff 0%, #fff 42%);
}
.agent-link-card .kind-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
tr.row-quick td:first-child { box-shadow: inset 3px 0 0 #ea580c; }
tr.row-formal td:first-child { box-shadow: inset 3px 0 0 #0891b2; }
tr.row-quick td:first-child { box-shadow: inset 3px 0 0 #ea580c; }
tr.row-formal td:first-child { box-shadow: inset 3px 0 0 #0891b2; }

.stage {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.3;
  border: 1px solid transparent;
  white-space: nowrap;
}
.stage::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}
.stage-unbound,
.stage-distributed,
.stage-bound {
  color: #475569;
  background: #e8eef4;
  border-color: #d5dee8;
}
.stage-distributed {
  color: #5b4b8a;
  background: #efeaf8;
  border-color: #d9d0ef;
}
.stage-answering {
  color: #0e6490;
  background: #dff3fb;
  border-color: #b6e3f3;
}
.stage-answered {
  color: #9a5b00;
  background: #fff1d6;
  border-color: #f0d39a;
}
.stage-handed {
  color: #1d4fbf;
  background: #e4ecff;
  border-color: #c3d2f8;
}
.stage-generating {
  color: #c2410c;
  background: #ffeadc;
  border-color: #f5c4a4;
}
.stage-reported {
  color: #0f766e;
  background: #d8f3ef;
  border-color: #a7e0d8;
}
.stage-void {
  color: #6b7280;
  background: #eef0f2;
  border-color: #dde1e6;
}

.pick.stage-unbound,
.pick.stage-distributed,
.pick.stage-bound { border-left-color: #64748b; }
.pick.stage-distributed { border-left-color: #7c6bb0; }
.pick.stage-answering { border-left-color: #0e6490; }
.pick.stage-answered { border-left-color: #d97706; }
.pick.stage-handed { border-left-color: #2563eb; }
.pick.stage-generating { border-left-color: #ea580c; }
.pick.stage-reported { border-left-color: #0f766e; }
.pick.stage-void { border-left-color: #9ca3af; }

tr.stage-unbound,
tr.stage-distributed,
tr.stage-bound { background: rgba(100, 116, 139, 0.05); }
tr.stage-distributed { background: rgba(124, 107, 176, 0.07); }
tr.stage-answering { background: rgba(14, 100, 144, 0.06); }
tr.stage-answered { background: rgba(217, 119, 6, 0.07); }
tr.stage-handed { background: rgba(37, 99, 235, 0.06); }
tr.stage-generating { background: rgba(234, 88, 12, 0.07); }
tr.stage-reported { background: rgba(15, 118, 110, 0.07); }
tr.stage-void { background: rgba(156, 163, 175, 0.08); }

td.owner-agent {
  color: #5b4b8a;
  font-weight: 600;
}
td.owner { color: var(--muted); }

.stage-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.quiz-actions { margin-top: 22px; }
.wait-actions .btn { flex: 1 1 140px; }
.quiz-actions .btn.big { width: auto; min-width: 180px; }
.foot {
  color: var(--muted);
  font-size: 13px;
  margin-top: 36px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.toast {
  position: fixed;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(8px);
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s var(--ease);
  z-index: 20;
  max-width: calc(100% - 32px);
  text-align: center;
  box-shadow: 0 12px 28px rgba(20, 33, 43, 0.22);
}
.toast.on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.report-head {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 16px;
}
.report-head h2 { margin: 0 0 4px; }
.report-head .hint { margin: 0; }
.report-actions { width: auto; }
.report-actions .btn { min-width: 0; }
.pdf-viewer {
  width: 100%;
  min-height: 320px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
  padding: 0;
}
.pdf-page-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  background: #fff;
}
.pdf-viewer .pdf-page {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  vertical-align: top;
  background: #fff;
}
.pdf-status {
  margin: 0;
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.pdf-status.pdf-progress {
  padding: 12px 16px;
  background: #fff;
}
.pdf-status.err { color: var(--red); }
body.on-report .foot { display: none; }

.login-panel { width: min(440px, 100%); margin: 6vh auto 0; }
.seg {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(20, 33, 43, 0.05);
  border: 1px solid var(--line);
}
.seg button {
  flex: 1 1 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.seg button:hover:not(:disabled) {
  transform: none;
  box-shadow: none;
  border-color: transparent;
}
.seg button[aria-selected="true"] {
  background: #fff;
  color: var(--ink);
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(20, 33, 43, 0.08);
}
.tabs { display: flex; gap: 8px; overflow-x: auto; margin: 4px 0 18px; padding-bottom: 2px; }
.tabs button { flex: 0 0 auto; }
.tabs button[aria-selected="true"] {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td {
  text-align: left;
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.04em;
}
.ops { display: flex; flex-wrap: wrap; gap: 6px; }
.code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.02em;
}
.fresh { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 0; }
.fresh .line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.fresh .code { flex: 1 1 180px; min-width: 0; word-break: break-all; }
.fresh .k { font-size: 13px; color: var(--muted); flex: 1 1 100%; }
.fresh .btn-copy-link,
.btn-copy-link {
  background: #b45309;
  color: #fff;
  border-color: #b45309;
  font-weight: 700;
  font-size: 15px;
  padding: 12px 18px;
  min-height: 44px;
}
.fresh .btn-copy-link:hover,
.btn-copy-link:hover {
  filter: brightness(1.05);
}
body.admin.role-agent .fresh .line {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 14px;
}
body.admin.role-agent .fresh .code {
  font-size: 13px;
  color: var(--muted);
}
body.admin.role-agent .fresh .btn-copy-link {
  width: 100%;
  font-size: 17px;
  padding: 14px 18px;
}
.agent-links { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.agent-link-card {
  background: var(--card-solid, #fff);
  border: 1px solid #e7e1d6;
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.agent-link-card .meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.agent-link-card .issue-no {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 2px;
}
.agent-link-card .phone {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
td.issue-no {
  white-space: nowrap;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.agent-link-card .kind {
  font-size: 14px;
  color: var(--muted);
}
.agent-link-card .btn-copy-link { width: 100%; }
body.admin.role-agent .stage-legend,
body.admin.role-agent .hq-col { display: none !important; }
.issue-actions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex: 1 1 220px;
}
.issue-actions .field-count { flex: 0 0 72px; }
.issue-actions .btn { flex: 1 1 auto; min-width: 0; }
body.admin.role-agent .page-title {
  font-size: 26px;
  letter-spacing: -0.02em;
}
body.admin.role-agent .issue-card h2 {
  font-size: 18px;
  margin: 0 0 6px;
}
body.admin.role-agent .issue-card .hint {
  margin: 0 0 16px;
  font-size: 13.5px;
  line-height: 1.55;
}
body.admin.role-agent .field-kind { flex: 1 1 100%; }
body.admin.role-agent .field-phone { flex: 1 1 100%; }
body.admin.role-agent #key-kind,
body.admin.role-agent #key-phone {
  min-height: 48px;
  font-size: 16px;
}
body.admin.role-agent .tabs {
  background: rgba(20, 33, 43, 0.05);
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
  margin: 0 0 16px;
}
body.admin.role-agent .tabs .btn {
  border: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 999px;
  height: 36px;
  flex: 1 1 0;
}
body.admin.role-agent .tabs .btn[aria-selected="true"] {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(20, 33, 43, 0.1);
}
body.admin.role-agent .agent-link-card {
  box-shadow: 0 8px 24px rgba(20, 33, 43, 0.06);
}
body.admin.role-agent .fresh .line {
  background: linear-gradient(180deg, #ecfdf5 0%, #fff 70%);
  border: 1px solid #6ee7b7;
  border-radius: 14px;
}
body.admin.role-agent .links-card .card-head {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
  body.admin.role-agent .links-card .card-head input {
  width: 100%;
  min-height: 44px;
}
pre.sample {
  background: #14212b;
  color: #eef4f6;
  border-radius: 12px;
  padding: 14px;
  overflow: auto;
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-all;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.birth-grid { display: grid; grid-template-columns: 1.4fr 0.8fr 0.8fr; gap: 8px; }
.place-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.page-title { font-size: 32px; margin-bottom: 4px; }

body.admin {
  background: linear-gradient(180deg, #f3f7f8 0%, var(--bg) 100%);
}
body.admin::before { opacity: 0.22; }
body.admin .card {
  background: var(--card-solid);
  backdrop-filter: none;
}

@media (max-width: 800px) {
  :root { --pad: 16px; }
  .keys-filters { width: 100%; flex: 1 1 100%; }
  .keys-filters select,
  .keys-filters input { flex: 1 1 100%; width: 100% !important; }
  h1 { font-size: 30px; }
  .split, .grid2, .place-grid { grid-template-columns: 1fr; gap: 18px; }
  .login-panel { margin-top: 20px; }
  body:not(.admin) main.shell { padding-top: 20px; }
  .site-head { position: sticky; top: 0; }
  .site-head .shell {
    min-height: 0;
    padding-top: 12px;
    padding-bottom: 12px;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
  }
  .brand { flex: 1 1 auto; min-width: 0; }
  .brand b { font-size: 15px; }
  .brand small {
    max-width: 46vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .who {
    flex: 1 1 100%;
    justify-content: flex-start;
    gap: 8px;
  }
  .who-phone {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
  }
  .who .btn { flex: 0 0 auto; }
  .topbar { top: 0; }
  .enter-copy { padding-top: 4px; }
  .card { padding: 18px; border-radius: 14px; }
  .pick { padding: 16px; }
  .pick b { font-size: 18px; }
  .opts { grid-template-columns: 1fr 1fr; }
  .opts .opt:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .bar-meta, .bar-actions, .section-head, .card-head, .gen-row, .report-head { align-items: stretch; }
  .bar-actions, .section-head .row, .gen-row, .report-actions { width: 100%; }
  .bar-actions .btn, .section-head .btn, .quiz-actions .btn, .report-actions .btn { flex: 1 1 calc(50% - 8px); }
  .quiz-actions .btn.big { width: 100%; }
  .card-head input { width: 100%; }
  .gen-row { flex-direction: column; }
  .gen-row > div, .gen-row .count, .gen-row .btn { width: 100%; }
  .issue-actions { width: 100%; flex: 1 1 auto; }
  .issue-actions .field-count { flex: 0 0 76px; }
  .issue-actions .btn.big { width: auto; height: 48px; }
  body.admin.role-agent main.shell { padding-top: 18px; }
  body.admin.role-agent .section-head { margin-bottom: 4px; }
  body.admin.role-agent .page-title { font-size: 24px; margin-bottom: 2px; }
  body.admin.role-agent #staff-line { font-size: 13px; margin-bottom: 8px !important; }
  body.admin.role-agent .card { padding: 16px; border-radius: 18px; box-shadow: var(--shadow); }
  body.admin.role-agent .btn-copy-link {
    width: 100%;
    border-radius: 14px;
    font-size: 16px;
    min-height: 48px;
  }
  body.admin.role-agent .agent-link-card .phone { font-size: 22px; font-variant-numeric: tabular-nums; }
  body.admin.role-agent .agent-links { gap: 14px; }
  .report-head { margin-bottom: 12px; }
  .report-head h2 { font-size: 26px; }
  .pdf-viewer {
    margin: 0 calc(var(--pad) * -1);
    width: calc(100% + var(--pad) * 2);
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    min-height: 50vh;
    box-shadow: none;
  }
  .pdf-page-stack { padding: 0; gap: 0; }
  table, thead, tbody, tr, th, td { display: block; }
  thead { display: none; }
  tr {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin: 0 0 10px;
    padding: 6px 0;
    background: var(--card-solid);
  }
  td {
    border: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 12px;
    white-space: normal;
  }
  td::before {
    content: attr(data-label);
    color: var(--muted);
    flex: 0 0 4.5em;
    font-size: 12px;
    padding-top: 2px;
  }
  td.code, td.ops-cell { word-break: break-all; }
  tr.empty { background: transparent; border: 0; padding: 0; }
  tr.empty td { display: block; text-align: center; color: var(--muted); }
  tr.empty td::before { content: none; }
}
@media (min-width: 801px) {
  th, td { white-space: nowrap; }
  td.code { white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
