* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  background: #f4f5f7;
  color: #1a1a1a;
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: #fff;
  border-bottom: 1px solid #e1e4e8;
}

.toolbar h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.actions {
  display: flex;
  gap: 0.5rem;
}

.btn {
  padding: 0.5rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  background: #fff;
  color: #374151;
  font-size: 0.875rem;
  cursor: pointer;
}

.btn:hover {
  background: #f9fafb;
}

.btn.primary {
  background: #111827;
  color: #fff;
  border-color: #111827;
}

.btn.primary:hover {
  background: #374151;
}

.btn.small {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

.add {
  float: right;
  padding: 0.25rem 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.25rem;
  background: #fff;
  cursor: pointer;
  font-size: 0.75rem;
}

.workspace {
  display: flex;
  flex: 1;
  gap: 1rem;
  padding: 1rem;
}

.form-panel {
  width: 400px;
  min-width: 320px;
  max-width: 100%;
  padding: 1rem;
  background: #fff;
  border-radius: 0.5rem;
  border: 1px solid #e1e4e8;
  overflow-y: auto;
  max-height: calc(100vh - 4.5rem);
}

.panel-section {
  margin-bottom: 1.5rem;
}

.panel-section h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
}

.panel-section label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
}

input,
select,
textarea {
  width: 100%;
  margin-bottom: 0.5rem;
  padding: 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.25rem;
  font: inherit;
  font-size: 0.875rem;
}

textarea {
  resize: vertical;
}

.group {
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
}

.group input,
.group textarea {
  margin-bottom: 0.25rem;
}

.group .check {
  display: block;
  margin: 0.25rem 0;
  font-size: 0.875rem;
}

.group .remove {
  margin-top: 0.5rem;
  color: #b91c1c;
  border-color: #fca5a5;
}

.group .remove:hover {
  background: #fef2f2;
}

input:disabled {
  background: #e5e7eb;
  cursor: not-allowed;
}

.preview-panel {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: auto;
  background: #e5e7eb;
  border-radius: 0.5rem;
  padding: 1rem;
}

.cv-preview {
  width: 210mm;
  min-height: 297mm;
  padding: 20mm;
  background: #fff;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 11pt;
  line-height: 1.45;
  color: #1a1a1a;
}

.cv-preview * {
  margin: 0;
}

.cv-header {
  text-align: center;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid #111827;
  padding-bottom: 1rem;
}

.cv-name {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.cv-profession {
  font-size: 1.1rem;
  font-weight: 400;
  color: #4b5563;
  margin-bottom: 0.5rem;
}

.cv-contact {
  font-size: 0.9rem;
  color: #374151;
}

.cv-section {
  margin-top: 1.25rem;
}

.cv-section h3 {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  border-bottom: 1px solid #d1d5db;
  padding-bottom: 0.25rem;
  margin-bottom: 0.75rem;
  color: #111827;
}

.cv-item {
  margin-bottom: 0.75rem;
}

.cv-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.cv-row em {
  color: #4b5563;
  font-style: italic;
}

.cv-row span {
  white-space: nowrap;
  color: #4b5563;
}

.cv-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.cv-tags span {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  background: #f3f4f6;
  border-radius: 0.25rem;
  font-size: 0.85rem;
}

@media (max-width: 900px) {
  .workspace {
    flex-direction: column;
  }

  .form-panel {
    width: 100%;
    max-height: none;
  }

  .cv-preview {
    width: 100%;
  }
}

@media print {
  @page {
    size: A4;
    margin: 0;
  }

  body {
    background: #fff;
    margin: 0;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .toolbar,
  .form-panel {
    display: none !important;
  }

  .workspace {
    display: block;
    padding: 0;
  }

  .preview-panel {
    display: block;
    width: 100%;
    background: #fff;
    padding: 0;
    overflow: visible;
  }

  .cv-preview {
    width: 210mm;
    min-height: 297mm;
    padding: 20mm;
    margin: 0 auto;
    box-shadow: none;
    page-break-after: avoid;
    page-break-inside: auto;
  }

  .cv-preview .cv-section {
    page-break-inside: auto;
  }

  .cv-preview .cv-item {
    page-break-inside: avoid;
  }
}
