:root {
  color-scheme: light;
  --navy: #142844;
  --ink: #162640;
  --muted: #4d5f77;
  --line: #dbe2ec;
  --surface: #fff;
  --accent: #245887;
  font-family: "Segoe UI", "Microsoft YaHei UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: #f2f5f9; line-height: 1.55; }
.wrap { width: min(1160px, calc(100% - 40px)); margin-inline: auto; }
.client { max-width: 810px; }
.masthead { background: var(--navy); color: white; }
.brand { min-height: 72px; display: flex; align-items: center; gap: 14px; font-size: 0.88rem; font-weight: 650; letter-spacing: 0.08em; }
.monogram { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 auto; border: 1px solid #a0b3cc; border-radius: 5px; font: 1rem Georgia, serif; }
.language { margin-left: auto; background: transparent; border-color: #a0b3cc; white-space: nowrap; }
.language:hover:not(:disabled) { background: #284568; }
.intro { padding: 28px 0 20px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.9rem, 5vw, 2.7rem); letter-spacing: -0.025em; line-height: 1.2; }
h2 { font-size: 1.18rem; line-height: 1.35; }
.intro p { margin-top: 7px; color: var(--muted); }
.editor { display: grid; grid-template-columns: minmax(280px, 0.75fr) minmax(0, 1.25fr); align-items: start; gap: 18px; }
.panel { padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 2px 8px #14284408; min-width: 0; }
.notice { border: 1px solid #e1cb99; background: #fff7e7; color: #694809; padding: 9px 13px; border-radius: 6px; margin-bottom: 16px; }
form { display: grid; gap: 13px; margin-top: 14px; }
label { display: grid; gap: 5px; font-weight: 600; }
input, button, select { font: inherit; border-radius: 6px; }
input:not([type=checkbox]), select { width: 100%; min-width: 0; padding: 7px 10px; border: 1px solid #aab8c9; background: white; color: var(--ink); min-height: 42px; }
input[type=file] { font-size: 0.92rem; }
button { border: 1px solid transparent; padding: 6px 13px; min-height: 41px; cursor: pointer; background: var(--navy); color: white; font-weight: 620; justify-self: start; }
button:hover:not(:disabled) { background: var(--accent); }
button:disabled { opacity: 0.48; cursor: default; }
.secondary { background: #fff; color: var(--navy); border-color: #acbacc; }
.secondary:hover:not(:disabled) { background: #edf4fb; }
:focus-visible { outline: 3px solid #3287d1; outline-offset: 2px; }
.hint, .feedback { color: var(--muted); font-size: 0.91rem; }
.feedback:empty { display: none; }
.error { color: #9c2b29; }
.document { text-align: center; }
.document h2 { overflow-wrap: anywhere; }
.empty { display: grid; place-items: center; min-height: 250px; margin-top: 14px; background: #edf2f8; color: var(--muted); border: 1px dashed #b9c7d9; border-radius: 8px; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 12px; margin: 14px 0 10px; font-variant-numeric: tabular-nums; }
.paper { display: inline-block; position: relative; width: 100%; max-width: 710px; vertical-align: middle; background: #fff; box-shadow: 0 0 0 1px var(--line); }
body[data-view=admin] .paper { cursor: crosshair; }
#page { display: block; width: 100%; height: auto; }
.marker { position: absolute; display: grid; place-items: center; border: 2px dashed #2166a3; border-radius: 3px; background: #d4eafeaa; color: #103c66; pointer-events: none; padding: 2px; overflow: hidden; font-size: clamp(0.62rem, 2vw, 0.85rem); font-weight: 700; }
.marker.initials { border-color: #71509b; background: #ebe0f5bb; color: #442568; }
.placement-controls { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.field-list { display: grid; gap: 5px; margin: 0; padding-left: 1.5em; }
.field-list li::marker { color: var(--muted); }
.field-list button { margin-right: 5px; min-height: 33px; font-size: 0.9rem; }
.result, .requests, .client .panel + .panel { margin-top: 17px; }
.result label { margin: 10px 0; }
.copy-row, .section-heading { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.copy-row button { flex: 0 0 auto; }
.table-scroll { overflow: auto; margin-top: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
th, td { border-bottom: 1px solid var(--line); text-align: left; padding: 9px 8px; }
th { color: var(--muted); white-space: nowrap; }
td { overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
a { color: #174f83; }
.actions button { font-size: 0.85rem; min-height: 30px; padding: 3px 7px; }
.unlock { max-width: 420px; }
.client .document .section-heading { text-align: left; flex-wrap: wrap; }
.signing label { max-width: 560px; }
.pad-label { display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.mark-pad canvas { display: block; width: 100%; aspect-ratio: 3.5; touch-action: none; background: #fbfdff; border: 1px solid #9aacc2; border-radius: 7px; cursor: crosshair; margin-top: 5px; }
#initials-box { width: min(100%, 310px); }
#pad-initials { aspect-ratio: 2; }
.checkbox { display: flex; align-items: start; column-gap: 9px; font-weight: 400; }
.checkbox input { margin-top: 5px; width: 17px; height: 17px; flex: 0 0 auto; }
.completion button { margin-top: 12px; }
footer { color: var(--muted); padding: 22px 0 30px; font-size: 0.86rem; }
@media (max-width: 700px) {
  .wrap { width: calc(100% - 24px); }
  .editor { grid-template-columns: 1fr; }
  .panel { padding: 15px; }
  .brand { min-height: 60px; letter-spacing: 0.02em; }
  .client { display: flex; flex-direction: column; }
}
