* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(180deg, var(--bg-accent) 0%, var(--bg) 220px);
  color: var(--text);
}
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 18px 60px;
}
.page-header {
  margin-bottom: 24px;
}
.page-header h1 {
  margin: 0 0 8px;
  font-size: 2rem;
}
.page-header p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}
.form-shell {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.progress {
  display: flex;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  flex-wrap: wrap;
}
.progress-step {
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--secondary-bg);
  color: var(--secondary-text);
  font-size: 0.95rem;
  font-weight: 600;
}
.progress-step.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
}
.progress-step.done {
  background: var(--success-bg);
  color: var(--success-text);
}
.section {
  border-bottom: 1px solid var(--border);
}
.section:last-child {
  border-bottom: 0;
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  background: var(--card);
  gap: 12px;
}
.section-title {
  margin: 0;
  font-size: 1.1rem;
}
.section-status {
  font-size: 0.92rem;
  color: var(--muted);
}
.section-content {
  display: none;
  padding: 0 22px 22px;
}
.section-content.open {
  display: block;
}
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 18px;
}
.field.full {
  grid-column: 1 / -1;
}
label {
  display: block;
  margin-bottom: 7px;
  font-size: 0.95rem;
  font-weight: 600;
}
input, select, textarea {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}
input[readonly] {
  background: #f8fafc;
}
textarea {
  min-height: 110px;
  resize: vertical;
}
.actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
  flex-wrap: wrap;
}
.hint {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}
button {
  border: 0;
  border-radius: 10px;
  padding: 12px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-dark);
}
.btn-secondary {
  background: var(--secondary-bg);
  color: var(--secondary-text);
}
.btn-small {
  padding: 10px 12px;
  font-size: 0.9rem;
  white-space: nowrap;
}
.date-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.optional-block {
  margin-top: 24px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--card) 90%, var(--bg-accent) 10%);
}
.optional-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.optional-block-header h3, .dynamic-item h4 {
  margin: 0;
}
.dynamic-item {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
}
.file-item {
  margin-top: 12px;
  padding: 14px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: var(--preview-bg);
}
.file-name-box {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  word-break: break-word;
}
.remove-btn {
  background: var(--danger-bg);
  color: var(--danger-text);
}
.remove-btn:hover {
  background: var(--danger-hover);
}
.small-note {
  margin-top: 6px;
  font-size: 0.88rem;
  color: var(--muted);
}
.preview {
  margin-top: 20px;
  padding: 18px;
  background: var(--preview-bg);
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
}
.preview h3 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 1rem;
}
.preview-toggle-row {
  margin-top: 12px;
}
.preview-data {
  margin-top: 14px;
  padding: 14px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #fff;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.92rem;
  line-height: 1.5;
}
.success-box {
  display: none;
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success-text);
  font-weight: 600;
}
.hidden {
  display: none !important;
}
.drop-zone {
  margin-top: 12px;
  margin-bottom: 14px;
  padding: 32px 20px;
  min-height: 170px;
  border: 3px dashed var(--primary);
  border-radius: 16px;
  background: #ffffff;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  box-shadow: inset 0 0 0 1px var(--border);
}
.drop-zone p {
  margin: 0;
}
.drop-zone strong {
  font-size: 1.05rem;
  color: var(--primary-dark);
}
.drop-zone-active {
  border-color: var(--primary-dark);
  background: var(--primary-soft);
  transform: scale(1.01);
}
.drop-zone-button {
  display: inline-block;
  margin-top: 8px;
  padding: 12px 16px;
}
.drop-zone-button input[type="file"] {
  display: none;
}
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(2px);
}
.loading-box {
  min-width: 240px;
  padding: 24px 28px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  text-align: center;
}
.loading-text {
  margin-top: 14px;
  font-weight: 600;
  color: var(--text);
}
.spinner {
  width: 42px;
  height: 42px;
  margin: 0 auto;
  border: 4px solid var(--border);
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.form-dimmed {
  pointer-events: none;
  opacity: 0.45;
  transition: opacity 0.2s ease;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@media (max-width: 720px) {
  .grid {
    grid-template-columns: 1fr;
  }
  .container {
    padding: 20px 12px 40px;
  }
  .section-header, .section-content {
    padding-left: 16px;
    padding-right: 16px;
  }
  .date-row {
    flex-direction: column;
    align-items: stretch;
  }
}
