:root {
  color-scheme: light;
  --ink: #1d1642;
  --muted: #625a7d;
  --line: #e7e0f7;
  --surface: #ffffff;
  --soft: #f7f3ff;
  --violet: #6537e8;
  --violet-deep: #281060;
  --orange: #ff8a24;
  --green: #149d53;
  --shadow: 0 12px 32px rgba(42, 20, 104, .09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: #fbf9ff;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  line-height: 1.65;
}

a { color: var(--violet); text-decoration: none; }
a:hover { text-decoration: underline; }

.progress {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 40;
  height: 4px;
  background: linear-gradient(90deg, var(--violet), var(--orange));
  transform: scaleX(0);
  transform-origin: left;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .84);
  color: var(--ink);
  font-size: .85rem;
  font-weight: 700;
  text-decoration: none;
}
.pill.public { color: var(--green); border-color: rgba(20, 157, 83, .22); background: rgba(20, 157, 83, .08); }
.pill.private { color: #a65300; border-color: rgba(255, 138, 36, .28); background: rgba(255, 138, 36, .11); }

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 42px auto 72px;
  display: grid;
  grid-template-columns: minmax(250px, 330px) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.page-shell.contract-only {
  width: min(920px, calc(100% - 32px));
  display: block;
}

.contract-label {
  margin: 0 0 12px;
}

.doc-meta {
  position: sticky;
  top: 24px;
  padding: 28px;
  border: 1px solid rgba(231, 224, 247, .94);
  border-radius: 8px;
  background: rgba(255, 255, 255, .9);
  box-shadow: var(--shadow);
}
.eyebrow {
  display: inline-flex;
  margin-bottom: 14px;
  color: var(--orange);
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.doc-meta h1 {
  margin: 0;
  font-size: clamp(1.65rem, 4vw, 2.55rem);
  line-height: 1.12;
  letter-spacing: 0;
}
.doc-meta p { color: var(--muted); margin: 16px 0 24px; }
.doc-meta dl { margin: 0; display: grid; gap: 14px; }
.doc-meta div { padding-top: 14px; border-top: 1px solid var(--line); }
.doc-meta dt { color: var(--muted); font-size: .78rem; font-weight: 800; text-transform: uppercase; }
.doc-meta dd { margin: 3px 0 0; font-weight: 700; overflow-wrap: anywhere; }

.document {
  padding: clamp(24px, 4vw, 48px);
  border: 1px solid rgba(231, 224, 247, .96);
  border-radius: 8px;
  background: rgba(255, 255, 255, .96);
  box-shadow: var(--shadow);
}
.document h2 {
  margin: 34px 0 14px;
  color: var(--violet-deep);
  font-size: clamp(1.28rem, 3vw, 1.78rem);
  line-height: 1.25;
  letter-spacing: 0;
}
.document h2:first-child { margin-top: 0; }
.document .contract-heading {
  margin: 0 0 8px;
  text-align: center;
  color: var(--violet-deep);
  font-size: clamp(1.22rem, 3vw, 1.62rem);
  line-height: 1.32;
}
.document .contract-heading.contract-intro {
  margin: 18px 0 16px;
  font-size: 1.05rem;
  line-height: 1.55;
  font-weight: 700;
}
.document .contract-heading + .contract-heading {
  margin-top: 18px;
}
.document .contract-subheading {
  margin: 4px 0;
  text-align: center;
  color: var(--ink);
  font-weight: 700;
}
.document .contract-subheading + p:not(.contract-subheading) {
  margin-top: 24px;
}
.document h3 {
  margin: 26px 0 10px;
  color: var(--violet);
  font-size: 1.08rem;
  line-height: 1.35;
  letter-spacing: 0;
}
.document p { margin: 10px 0; color: #2d2550; }
.document ul {
  margin: 12px 0 18px;
  padding-left: 1.2rem;
}
.document li { margin: 7px 0; }
.document strong { color: var(--violet-deep); }

.clause {
  padding-left: 16px;
  border-left: 3px solid rgba(101, 55, 232, .2);
}
.label-line {
  margin-top: 18px;
  color: var(--violet-deep);
  font-weight: 850;
}
.field-note {
  padding: 10px 14px;
  border-left: 3px solid rgba(255, 138, 36, .42);
  border-radius: 8px;
  background: rgba(255, 138, 36, .07);
  font-weight: 700;
}
.notice {
  margin: 0 0 28px;
  padding: 18px 20px;
  border-radius: 8px;
  border: 1px solid rgba(101, 55, 232, .22);
  background: #faf7ff;
}
.notice strong {
  display: block;
  margin-bottom: 6px;
  color: var(--violet-deep);
}
.notice p { margin: 0; color: var(--muted); }
.notice-private {
  border-color: rgba(255, 138, 36, .34);
  background: #fff7ed;
}

.back-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 8px;
  background: var(--violet);
  color: #fff;
  font-size: 1.35rem;
  box-shadow: 0 16px 34px rgba(101, 55, 232, .3);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: .2s ease;
}
.back-top.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

@media (max-width: 880px) {
  .page-shell { grid-template-columns: 1fr; margin-top: 18px; }
  .doc-meta { position: relative; top: auto; border-radius: 8px; }
  .document { border-radius: 8px; }
}

@media (max-width: 560px) {
  .pill { min-height: 32px; padding: 0 10px; font-size: .78rem; }
  .page-shell { width: min(100% - 20px, 1180px); }
}
