@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/fonts/PlusJakartaSans-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/fonts/PlusJakartaSans-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/fonts/PlusJakartaSans-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #24103C;
  --plum: #47276F;
  --plum-deep: #3A1F5C;
  --muted: #585161;
  --faint: #787084;
  --line: #E6DFEC;
  --canvas: #F4EFFA;
  --paper: #fff;
  --wash: #F7F4F9;
  --ok: #1E5C3A;
  --ok-wash: #F3F7F4;
  --danger: #731111;
  --shadow: 0 1px 2px rgba(36, 16, 60, 0.04), 0 16px 40px rgba(36, 16, 60, 0.05);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; }

button { cursor: pointer; }
button:disabled { opacity: 0.6; cursor: default; }

:focus-visible {
  outline: 2px solid var(--plum);
  outline-offset: 2px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 22px 20px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.brand img { width: 32px; height: 32px; }

.top p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 20px 48px;
}

.layout { display: grid; gap: 20px; }

.intro h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: -0.04em;
}

.lead {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 16px;
}

form, .sheet, .empty, .pending {
  background: var(--paper);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

form { margin-top: 22px; padding: 20px; }

label {
  display: block;
  margin-top: 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--plum);
}

label:first-of-type { margin-top: 0; }

input {
  display: block;
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
  font-size: 18px;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

#pin { letter-spacing: 0.22em; }

.hint {
  margin: 6px 0 0;
  color: var(--faint);
  font-size: 13px;
  line-height: 1.4;
}

.message {
  min-height: 1.3em;
  margin: 14px 0 0;
  color: var(--danger);
  font-size: 14px;
}

#submit, .download {
  border: 0;
  border-radius: 12px;
  background: var(--plum);
  color: #fff;
  font-weight: 600;
}

#submit {
  width: 100%;
  margin-top: 16px;
  padding: 14px 16px;
}

#submit:hover:not(:disabled),
.download:hover:not(:disabled) { background: var(--plum-deep); }

.stage { min-width: 0; }

.empty, .pending {
  padding: 28px 24px;
}

.empty-kicker, .kicker {
  margin: 0;
  color: var(--plum);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.empty-title {
  margin: 8px 0 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.empty p:last-child, .pending {
  margin: 8px 0 0;
  color: var(--muted);
}

.pending { margin: 0; }

.sheet { padding: 22px 18px 20px; }

.sheet-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.sheet h2 { font-size: 13px; }

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 0;
  color: var(--ok);
  font-size: 14px;
  font-weight: 500;
}

.status svg {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.code {
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--wash);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  font-weight: 600;
  white-space: nowrap;
}

.code-label {
  display: block;
  margin-bottom: 2px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.issued {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.value {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--wash);
}

.figure {
  margin: 4px 0 0;
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.words {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.value-note {
  margin: 8px 0 0;
  font-size: 14px;
}

.parties {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.party {
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--wash);
}

.role {
  margin: 0;
  color: var(--plum);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.name {
  margin: 4px 0 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.detail {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.statement {
  margin: 16px 0 0;
  font-size: 15px;
  line-height: 1.55;
}

.lines { margin-top: 22px; }

.lines-head h3 {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.count {
  color: var(--faint);
  font-size: 13px;
  font-weight: 500;
}

.table-wrap {
  margin-top: 12px;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 280px;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

col.date { width: 28%; }
col.num { width: 26%; }

th {
  padding: 0 12px 8px 0;
  color: var(--plum);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
}

td {
  padding: 12px 12px 12px 0;
  border-top: 1px solid var(--line);
  vertical-align: top;
  line-height: 1.4;
}

th.num, td.num {
  text-align: right;
  white-space: nowrap;
}

th:last-child, td:last-child { padding-right: 0; }

.is-collapsed tr.extra { display: none; }

.more {
  margin-top: 4px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: var(--plum);
  font-size: 14px;
  font-weight: 600;
}

.more:hover { text-decoration: underline; }

.facts {
  display: grid;
  gap: 14px;
  margin: 22px 0 0;
}

.fact { min-width: 0; }

dt {
  margin: 0;
  color: var(--plum);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

dd {
  margin: 3px 0 0;
  white-space: pre-line;
}

.actions { margin-top: 22px; }

.download {
  width: 100%;
  padding: 14px 16px;
}

.action-error {
  min-height: 0;
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 14px;
}

.action-error:empty { display: none; }

.action-note, .retention {
  margin: 8px 0 0;
  color: var(--faint);
  font-size: 13px;
  line-height: 1.45;
}

.retention {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.about { margin-top: 36px; }

.about h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.about-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.about article {
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
}

.about h3 {
  margin: 0;
  font-size: 15px;
}

.about p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.site-foot {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px 36px;
}

.site-foot p {
  margin: 0;
  color: var(--faint);
  font-size: 13px;
}

@media (min-width: 720px) {
  .parties, .facts, .about-grid { grid-template-columns: 1fr 1fr; }
  .fact.wide { grid-column: 1 / -1; }
  .sheet { padding: 28px 28px 24px; }
  .figure { font-size: 40px; }
  col.date { width: 22%; }
  col.num { width: 22%; }
  .download { width: auto; min-width: 240px; }
}

@media (min-width: 980px) {
  .top { padding: 28px 28px 0; }
  main { padding: 36px 28px 56px; }
  .site-foot { padding: 0 28px 48px; }
  .layout {
    grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
    align-items: start;
    gap: 28px;
  }
  .intro { position: sticky; top: 20px; }
  .intro h1 { font-size: 36px; }
  .empty {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 280px;
  }
  .about-grid { grid-template-columns: 1fr 1fr 1fr 1fr; }
}

@media (max-width: 979px) {
  .stage:not(.has-result):not(.is-loading) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

@media print {
  body { background: #fff; }
  .top, .intro, .about, .site-foot, .more, .actions, .empty, .pending { display: none !important; }
  main { padding: 0; max-width: none; }
  .layout { display: block; }
  .stage { display: block !important; }
  .sheet { box-shadow: none; padding: 0; }
  .is-collapsed tr.extra { display: table-row; }
  .result, #result { display: block !important; }
}
