:root {
  --bg: #f3f4f8;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #d7dce5;
  --primary: #2e6bff;
  --primary-hover: #1f56d9;
  --error: #b42318;
  --success: #067647;
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}

.page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.form-card {
  width: 100%;
  max-width: 920px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 32px;
}

.form-header {
  margin-bottom: 28px;
}

.form-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.form-logo {
  display: block;
  width: min(100%, 280px);
  height: auto;
}

.language-switcher {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
}

.language-switcher label {
  color: var(--muted);
  font-weight: 500;
}

.language-switcher select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  background: #fff;
}

.form-header h1,
.success-card h2,
.section-title {
  margin: 0 0 8px;
  font-size: 1.75rem;
  font-weight: 700;
}

.section-title {
  font-size: 1.35rem;
  margin-top: 8px;
}

.form-description,
.section-description,
.intro-section-text {
  margin: 0;
  color: var(--muted);
}

.intro-section {
  margin-top: 20px;
}

.intro-section-title {
  margin: 0 0 8px;
  font-size: 1.35rem;
  font-weight: 700;
}

.intro-section-text + .intro-section-text {
  margin-top: 8px;
}

.intro-section a {
  color: var(--primary);
  text-decoration: underline;
}

.intro-section a:hover {
  text-decoration: none;
}

#contact-fields {
  margin-bottom: 24px;
}

.form-section-block {
  margin: 28px 0;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.field,
.category-group,
.confirmation-group {
  margin-bottom: 20px;
}

.field-label,
.category-title {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.category-group,
.confirmation-group {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  background: #fafbff;
}

.category-group legend,
.confirmation-group legend {
  padding: 0 4px;
}

.required {
  color: var(--error);
}

.field input[type="text"],
.field input[type="email"],
.field input[type="url"],
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  font: inherit;
  background: #fff;
}

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

.document-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  background: #fafbff;
}

.document-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.document-card-title {
  margin: 0;
  font-size: 1.1rem;
}

.add-document-button {
  width: 100%;
  margin-top: 4px;
}

.text-button {
  border: none;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.text-button:hover {
  color: var(--primary-hover);
}

.document-card input[type="file"],
.file-picker-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.file-picker-control {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.file-picker-button {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  background: #fff;
  font: inherit;
  cursor: pointer;
}

.file-picker-button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.file-picker-status {
  color: var(--muted);
  font-size: 0.92rem;
}

.checkbox-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
  font-weight: 400;
  cursor: pointer;
}

.checkbox-item input {
  margin-top: 4px;
}

.checkbox-item a {
  color: var(--primary);
  text-decoration: underline;
}

.checkbox-item a:hover {
  text-decoration: none;
}

.radio-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
  font-weight: 400;
  cursor: pointer;
}

.radio-item input {
  margin-top: 4px;
}

.radio-item span {
  flex: 1;
}

.doc-type-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.year-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(3, auto);
  grid-auto-flow: column;
  gap: 4px 12px;
  margin-top: 8px;
}

.year-checkbox-item {
  margin-bottom: 0;
  font-size: 0.92rem;
}

.year-other-field {
  margin-top: 12px;
}

.doc-type-categories .category-picker-item {
  margin-bottom: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafbff;
}

.doc-type-options {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafbff;
}

.doc-type-options-title {
  margin: 0 0 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}

.doc-type-option-group .radio-item {
  gap: 6px;
  margin-bottom: 4px;
  font-size: 0.82rem;
  line-height: 1.35;
}

.doc-type-option-group .radio-item:last-child {
  margin-bottom: 0;
}

.doc-type-category {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
}

.doc-type-category .category-title {
  margin-bottom: 4px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.doc-type-category .radio-item {
  gap: 6px;
  margin-bottom: 4px;
  font-size: 0.82rem;
  line-height: 1.35;
}

.doc-type-category .radio-item:last-child {
  margin-bottom: 0;
}

.doc-type-category .radio-item input {
  margin-top: 2px;
  flex-shrink: 0;
}

.field-help {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.file-drop {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: 10px;
  background: #fafbff;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.file-drop.dragover {
  border-color: var(--primary);
  background: #f5f8ff;
}

.file-drop input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-drop-content {
  padding: 28px 16px;
  text-align: center;
  pointer-events: none;
}

.file-drop-title {
  margin: 0 0 4px;
  font-weight: 600;
}

.file-drop-subtitle,
.file-drop-hint {
  margin: 0;
  color: var(--muted);
}

.actions {
  margin-top: 28px;
}

.submit-button,
.secondary-button {
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.submit-button {
  width: 100%;
  color: #fff;
  background: var(--primary);
}

.submit-button:hover:not(:disabled) {
  background: var(--primary-hover);
}

.submit-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.secondary-button {
  margin-top: 20px;
  color: var(--text);
  background: #eef2ff;
}

.form-error {
  margin: 16px 0 0;
  color: var(--error);
}

.success-card {
  text-align: center;
}

.success-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #ecfdf3;
  color: var(--success);
  font-size: 1.5rem;
  font-weight: 700;
}

.reference,
.reference-list {
  margin-top: 16px;
  color: var(--muted);
}

.reference-ids {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}

.reference-ids li {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

@media (max-width: 640px) {
  .form-card {
    padding: 24px 18px;
  }

  .doc-type-grid {
    grid-template-columns: 1fr;
  }

  .year-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(6, auto);
  }
}
