:root {
  color-scheme: light;
  --navy: #172554;
  --navy-2: #263765;
  --blue: #356d9e;
  --blue-soft: #eaf1f8;
  --ink: #17202a;
  --muted: #657080;
  --line: #d8dee7;
  --soft: #f5f7fa;
  --white: #ffffff;
  --green: #1f6a55;
  --green-soft: #eaf6f1;
  --shadow: 0 18px 55px rgba(23, 37, 84, 0.09);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #f3f5f8;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.locked {
  overflow: hidden;
}

body.locked > :not(.access-gate) {
  filter: blur(7px);
  pointer-events: none;
  user-select: none;
}

.access-gate {
  position: fixed;
  z-index: 100;
  display: grid;
  inset: 0;
  place-items: center;
  padding: 24px;
  background: rgba(23, 37, 84, 0.58);
  backdrop-filter: blur(10px);
}

.access-gate[hidden] {
  display: none;
}

.access-card {
  width: min(440px, 100%);
  min-width: 0;
  overflow: hidden;
  padding: 40px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 22px;
  background: var(--white);
  box-shadow: 0 28px 80px rgba(10, 20, 50, 0.28);
}

.access-card h1 {
  margin-top: 9px;
  max-width: 100%;
  font-size: clamp(30px, 6vw, 44px);
  overflow-wrap: anywhere;
}

.access-card > * {
  min-width: 0;
}

.access-card > p {
  margin-top: 14px;
  color: var(--muted);
  line-height: 1.55;
}

.access-mark {
  margin-bottom: 24px;
}

.access-field {
  display: grid;
  gap: 8px;
  margin-top: 26px;
}

.access-field input {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--white);
}

.access-field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(53, 109, 158, 0.12);
  outline: none;
}

.access-card .generate-button {
  width: 100%;
  margin-top: 18px;
}

button, input { font: inherit; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--navy);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 11px;
  color: white;
  background: var(--navy);
  font-weight: 900;
}

.brand strong,
.brand small { display: block; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 12px; }

.privacy-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

.privacy-note span {
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border-radius: 50%;
  background: var(--green-soft);
}

main {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.hero {
  max-width: 820px;
  padding: 54px 0 34px;
}

.back-link {
  display: inline-block;
  margin-bottom: 32px;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}

.back-link:hover { color: var(--navy); }

.eyebrow {
  margin-bottom: 12px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1, h2, p { margin: 0; }

h1 {
  max-width: 760px;
  color: var(--navy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(38px, 5vw, 62px);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.03;
}

.hero p {
  max-width: 750px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.65;
}

.builder-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  gap: 24px;
  align-items: start;
  padding-bottom: 70px;
}

.form-card,
.summary-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.form-card { padding: 34px; }

.step {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 14px;
  align-items: start;
}

.step-number {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 10px;
  color: var(--navy);
  background: var(--blue-soft);
  font-weight: 850;
}

.step h2,
.summary-card h2 {
  color: var(--navy);
  font-size: 20px;
}

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

.entity-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 22px;
}

.entity-option {
  position: relative;
  display: grid;
  min-height: 108px;
  padding: 16px;
  align-content: space-between;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.entity-option:hover {
  transform: translateY(-1px);
  border-color: #a9b8cb;
}

.entity-option.selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(53, 109, 158, 0.12);
  background: #fbfdff;
}

.entity-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.entity-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 9px;
  color: var(--navy);
  background: var(--blue-soft);
  font-size: 11px;
  font-weight: 900;
}

hr {
  margin: 32px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.fields-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.field {
  display: grid;
  gap: 7px;
}

.field.full { grid-column: 1 / -1; }
.field[hidden] { display: none; }

.field span {
  color: var(--navy-2);
  font-size: 12px;
  font-weight: 800;
}

.field input {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  border: 1px solid #cfd6df;
  border-radius: 10px;
  outline: none;
  color: var(--ink);
  background: #fff;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(53, 109, 158, 0.12);
}

.field input::placeholder { color: #a2a9b3; }

.field input.invalid {
  border-color: #b45345;
  background: #fffafa;
}

.validation-message {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid #f2c6bf;
  border-radius: 10px;
  color: #8a3328;
  background: #fff4f2;
  font-size: 13px;
}

.generate-button {
  display: flex;
  width: 100%;
  min-height: 52px;
  margin-top: 24px;
  padding: 0 18px;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-radius: 11px;
  color: #fff;
  background: var(--navy);
  font-weight: 850;
  cursor: pointer;
}

.generate-button:hover { background: #0f1d47; }
.generate-button:disabled { cursor: wait; opacity: 0.7; }

.summary-card {
  position: sticky;
  top: 24px;
  overflow: hidden;
}

.summary-top {
  display: flex;
  gap: 13px;
  align-items: center;
  padding: 24px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}

.summary-top small,
.document-list small,
.result-heading small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.summary-top h2 { margin-top: 3px; }

.document-badge {
  display: grid;
  width: 64px;
  height: 52px;
  place-items: center;
  border-radius: 8px 8px 8px 2px;
  color: #fff;
  background: var(--navy);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.document-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 10px 24px;
  list-style: none;
}

.document-list li {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid #edf0f4;
}

.document-list li:last-child { border-bottom: 0; }

.document-list strong { color: var(--navy-2); font-size: 13px; }
.document-list small { margin-top: 3px; }

.file-icon {
  display: grid;
  width: 28px;
  height: 32px;
  place-items: center;
  border-radius: 6px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 11px;
  font-weight: 900;
}

.status {
  padding: 4px 7px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--soft);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.status.ready {
  color: var(--green);
  background: var(--green-soft);
}

.result-panel {
  margin: 0 18px 18px;
  padding: 18px;
  border: 1px solid #bcdcca;
  border-radius: 12px;
  background: #f7fcf9;
}

.result-heading {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--green);
}

.success-check {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--green);
  font-weight: 900;
}

.result-heading small { margin-top: 3px; }

.download-primary {
  width: 100%;
  min-height: 44px;
  margin-top: 16px;
  border: 0;
  border-radius: 9px;
  color: #fff;
  background: var(--green);
  font-weight: 850;
  cursor: pointer;
}

.download-links {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.download-links button,
.download-links a {
  padding: 4px 0;
  border: 0;
  color: var(--navy);
  background: transparent;
  font-size: 12px;
  text-align: left;
  text-decoration: underline;
  cursor: pointer;
}

.security-box {
  margin: 0 24px 24px;
  padding: 14px;
  border-radius: 10px;
  color: var(--muted);
  background: var(--soft);
  font-size: 12px;
  line-height: 1.5;
}

.security-box strong { color: var(--navy-2); }
.security-box p { margin-top: 4px; }

footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 24px max(24px, calc((100vw - 1180px) / 2));
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: #fff;
  font-size: 12px;
}

@media (max-width: 960px) {
  .builder-layout { grid-template-columns: 1fr; }
  .summary-card { position: static; }
}

@media (max-width: 680px) {
  .site-header { min-height: 68px; padding: 0 18px; }
  .privacy-note { display: none; }
  main { width: min(100% - 24px, 1180px); }
  .hero { padding: 34px 4px 24px; }
  .back-link { margin-bottom: 24px; }
  h1 { font-size: 39px; }
  .hero p { font-size: 16px; }
  .form-card { padding: 22px 16px; }
  .entity-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fields-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  footer { display: grid; padding: 22px 18px; }
}
