:root {
  --green: #087443;
  --green-dark: #075b36;
  --green-light: #eaf5ee;
  --gold: #c49a3a;
  --text: #182820;
  --muted: #68756d;
  --border: #e0e8e2;
  --background: #f5f8f6;
  --white: #ffffff;
  --shadow: 0 12px 35px rgba(24, 40, 32, 0.07);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--background);
  color: var(--text);
  line-height: 1.6;
}

a {
  color: var(--green);
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
a,
input,
textarea,
select {
  -webkit-tap-highlight-color: transparent;
}

.topbar {
  min-height: 76px;
  padding: 15px 5%;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

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

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: var(--green);
  color: white;
  font-weight: 800;
  font-size: 23px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
  line-height: 1.3;
}

.brand small {
  margin-top: 3px;
  color: var(--green);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
}

.back-link {
  font-size: 14px;
  font-weight: 700;
}

.workspace {
  width: min(1400px, 92%);
  margin: 0 auto;
  padding: 42px 0 60px;
}

.welcome {
  padding: 34px;
  border: 1px solid #dbece0;
  border-radius: 22px;
  background:
    radial-gradient(circle at 90% 10%, rgba(196, 154, 58, 0.15), transparent 30%),
    linear-gradient(135deg, #eaf5ee, #ffffff 72%);
}

.eyebrow,
.step-label {
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.6px;
}

.welcome h1 {
  margin: 8px 0 10px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.2;
  letter-spacing: -1px;
}

.welcome p {
  max-width: 650px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.tool-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 24px 0;
}

.tool-tabs a {
  display: inline-block;
  padding: 11px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--white);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.tool-tabs a.active {
  border-color: var(--green);
  background: var(--green);
  color: white;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.form-card,
.preview-card,
.help-card {
  min-width: 0;
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.card-heading {
  margin-bottom: 25px;
}

.card-heading h2,
.preview-heading h2 {
  margin: 5px 0;
  font-size: 23px;
  letter-spacing: -0.5px;
}

.card-heading p,
.download-actions p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.field {
  margin-bottom: 19px;
}

.field[hidden] {
  display: none !important;
}

.field label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field textarea,
.field select {
  display: block;
  width: 100%;
  min-height: 46px;
  padding: 12px 13px;
  border: 1px solid #d7e1d9;
  border-radius: 9px;
  background: #fcfdfc;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field textarea {
  min-height: 95px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(8, 116, 67, 0.1);
}

.field input::placeholder,
.field textarea::placeholder {
  color: #9aa69e;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 25px;
}

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 46px;
  padding: 12px 17px;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  transition: transform 0.2s, background 0.2s;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: var(--green);
  color: white;
}

.button-primary:hover {
  background: var(--green-dark);
}

.button-secondary {
  border-color: var(--border);
  background: white;
  color: var(--text);
}

.privacy-note {
  margin: 20px 0 0;
  padding: 12px;
  border-radius: 9px;
  background: #f3f7f4;
  color: var(--muted);
  font-size: 11px;
}

.preview-card {
  position: sticky;
  top: 16px;
}

.preview-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.preview-status {
  padding: 5px 9px;
  border-radius: 20px;
  background: var(--green-light);
  color: var(--green);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.document-preview {
  min-height: 550px;
  padding: 35px 30px;
  border: 1px solid #e0e4e0;
  background: white;
  box-shadow: 0 5px 18px rgba(24, 40, 32, 0.06);
  overflow-wrap: anywhere;
}

.document-top {
  padding-bottom: 20px;
  border-bottom: 2px solid var(--green);
}

.document-top h1 {
  margin: 0 0 4px;
  color: var(--green-dark);
  font-size: 26px;
  line-height: 1.25;
}

.document-top > p {
  margin: 5px 0;
}

#preview-title {
  font-size: 14px;
  font-weight: 700;
}

.contact-line {
  color: var(--muted);
  font-size: 11px;
}

.document-section {
  margin-top: 24px;
}

.document-section h3 {
  margin: 0 0 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border);
  color: var(--green-dark);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.document-section p {
  margin: 0;
  color: #354139;
  font-size: 12px;
  line-height: 1.8;
  white-space: pre-line;
}

.document-preview.modern .document-top {
  border-bottom-color: var(--gold);
}

.document-preview.modern .document-top h1,
.document-preview.modern .document-section h3 {
  color: #263b32;
}

.document-preview.modern .document-section h3 {
  border-bottom-color: var(--gold);
}

.download-actions {
  margin-top: 22px;
}

.download-actions .button {
  width: 100%;
}

.download-actions p {
  text-align: center;
  margin-top: 10px;
}

.help-card {
  margin-top: 26px;
  box-shadow: none;
}

.help-card h2 {
  margin: 0 0 7px;
  font-size: 19px;
}

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

.help-card a {
  font-size: 13px;
  font-weight: 800;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 24px 5%;
  border-top: 1px solid var(--border);
  background: white;
  color: var(--muted);
  font-size: 12px;
}

.footer p {
  margin: 0;
}

.footer a {
  font-weight: 700;
}

@media (max-width: 950px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .preview-card {
    position: static;
  }

  .document-preview {
    min-height: 450px;
  }
}

@media (max-width: 600px) {
  .topbar {
    padding: 13px 4%;
    gap: 10px;
  }

  .brand {
    gap: 8px;
  }

  .brand-icon {
    width: 38px;
    height: 38px;
    font-size: 20px;
  }

  .brand strong {
    font-size: 12px;
  }

  .brand small {
    font-size: 9px;
  }

  .back-link {
    font-size: 12px;
    white-space: nowrap;
  }

  .workspace {
    width: 94%;
    padding-top: 22px;
  }

  .welcome {
    padding: 23px 19px;
    border-radius: 16px;
  }

  .welcome h1 {
    font-size: 29px;
  }

  .welcome p {
    font-size: 14px;
  }

  .tool-tabs {
    gap: 7px;
    margin: 18px 0;
  }

  .tool-tabs a {
    padding: 9px 11px;
    font-size: 12px;
  }

  .form-card,
  .preview-card,
  .help-card {
    padding: 18px;
    border-radius: 14px;
  }

  .card-heading h2,
  .preview-heading h2 {
    font-size: 20px;
  }

  .field-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions .button {
    width: 100%;
  }

  .document-preview {
    min-height: 420px;
    padding: 25px 20px;
  }

  .document-top h1 {
    font-size: 23px;
  }

  .footer {
    flex-direction: column;
    text-align: center;
  }
}

@media print {
  @page {
    size: A4;
    margin: 16mm;
  }

  body {
    background: white;
  }

  body * {
    visibility: hidden !important;
  }

  #document-preview,
  #document-preview * {
    visibility: visible !important;
  }

  #document-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    overflow: visible;
  }

  .document-section {
    break-inside: avoid;
  }
  }
