* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  background: #f3f5fb;
  color: #1f2937;
}

.container {
  width: min(1280px, 94%);
  margin: 0 auto;
}

.hero {
  background: linear-gradient(135deg, #1f4fd6, #3f6cf4);
  color: #fff;
  padding: 44px 0 34px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(1.7rem, 2.8vw, 2.5rem);
}

.hero p {
  margin: 0;
  opacity: 0.95;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 20px;
  margin: 20px auto 34px;
}

.card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  padding: 18px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.step {
  border: 1px solid #d8e0f2;
  background: #f8faff;
  color: #334155;
  border-radius: 10px;
  padding: 10px 8px;
  cursor: pointer;
  font-size: 0.9rem;
}

.step.active {
  border-color: #1f4fd6;
  background: #1f4fd6;
  color: #fff;
}

.step-panel {
  display: none;
}

.step-panel.active {
  display: block;
}

h2 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 1.2rem;
}

h3 {
  margin-top: 0;
  font-size: 1.05rem;
}

label {
  display: block;
  margin: 10px 0 6px;
  font-weight: 600;
  font-size: 0.92rem;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #d2dbef;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #1f4fd6;
  box-shadow: 0 0 0 3px rgba(31, 79, 214, 0.14);
}

.actions-row {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
}

.btn {
  border: none;
  border-radius: 10px;
  background: #1f4fd6;
  color: #fff;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
}

.btn.secondary {
  background: #edf2ff;
  color: #1e3a8a;
}

.btn.danger {
  background: #dc2626;
  color: #fff;
}

.archive-panel {
  margin-top: 20px;
  border-top: 1px solid #e5eaf7;
  padding-top: 15px;
}

.archive-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.archive-select {
  min-height: 170px;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.doc-preview {
  background: #fff;
  border: 1px solid #dce4f4;
  border-radius: 10px;
  padding: 34px 34px;
  min-height: 640px;
  max-height: 76vh;
  overflow: auto;
  line-height: 1.65;
  color: #111827;
}

.doc-title {
  text-align: center;
  font-size: 1.35rem;
  margin: 0 0 22px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.doc-article {
  margin: 0 0 14px;
  text-align: justify;
}

.doc-article strong {
  display: inline-block;
  min-width: 145px;
}

.doc-signatures {
  margin-top: 28px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}

.doc-sign-box {
  border-top: 1px solid #94a3b8;
  padding-top: 8px;
  min-height: 72px;
}

@media (max-width: 1040px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .doc-preview {
    min-height: 420px;
  }
}

@media print {
  body * {
    visibility: hidden !important;
  }

  .preview-card,
  .preview-card * {
    visibility: visible !important;
  }

  .preview-card {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
  }

  .preview-header {
    display: none;
  }

  .doc-preview {
    border: none;
    border-radius: 0;
    max-height: none;
    min-height: auto;
    padding: 20mm 16mm;
  }

  @page {
    size: A4;
    margin: 12mm;
  }
}
