*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --border: #e5e5e7;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.47;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

header {
  margin-bottom: 2.5rem;
  text-align: center;
}

header h1 {
  margin: 0 0 0.35em;
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.subtitle {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.error {
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  background: #fff5f5;
  color: #c53030;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  border: 1px solid #feb2b2;
}

.cv-form {
  background: var(--surface);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.form-section {
  margin-bottom: 2rem;
}

.form-section:last-of-type {
  margin-bottom: 0;
}

.form-section h2 {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.upload-section {
  padding: 1.25rem;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
}

.hint {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.hint code {
  color: var(--text-secondary);
}

.hint strong {
  font-weight: 700;
  color: inherit;
}

.row {
  margin-bottom: 0;
}

.row label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.upload-zone {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 1.25rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.upload-zone.drag-over {
  border-color: var(--accent);
  background: rgba(0, 113, 227, 0.04);
}

.file-input {
  position: absolute;
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
}

.upload-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.25rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease;
}

.upload-trigger:hover {
  background: var(--accent-hover);
}

.upload-trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.upload-filename {
  font-size: 0.9rem;
  color: var(--text-secondary);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-filename.has-file {
  color: var(--text);
  font-weight: 500;
}

.sections-elements-section .section-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sections-elements-section .section-block {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.sections-elements-section .section-block:last-child {
  border-bottom: none;
}

.sections-elements-section .section-include .section-name {
  font-weight: 500;
  color: var(--text);
}

.sections-elements-section .element-checks {
  margin-top: 0.35rem;
  margin-left: 1.75rem;
  padding-left: 0.5rem;
  border-left: 2px solid var(--border);
}

.sections-elements-section .element-row {
  padding: 0.25rem 0;
}

.sections-elements-section .element-row .label-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--text);
}

.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.label-text {
  user-select: none;
}

.actions {
  margin-top: 1rem;
  padding-top: 0.75rem;
}

.actions button {
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.85rem 1.5rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease;
}

.actions button:hover {
  background: var(--accent-hover);
}

.actions button:active {
  opacity: 0.95;
}

.actions button:first-of-type {
  margin-top: 0;
}

.hidden-cv-data {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.customize-intro {
  margin-bottom: 1.5rem;
}

.section-cards {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.section-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.section-card-header {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}

.section-card-header .section-name {
  font-weight: 600;
  font-size: 1rem;
}

.section-card-body {
  padding: 0.75rem 1rem 1rem;
}

.section-card-body.entry-section {
  padding-top: 0.5rem;
}

.entry-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.entry-list-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.entry-list-actions {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
}

.link-btn:hover {
  text-decoration: underline;
}

.entry-list-actions .sep {
  margin: 0 0.25rem;
  color: var(--border);
}

.entry-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 12rem;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.entry-list li {
  border-bottom: 1px solid var(--border);
}

.entry-list li:last-child {
  border-bottom: none;
}

.entry-row {
  margin: 0;
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.entry-label {
  font-size: 0.9rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.element-section {
  border-top: 1px solid var(--border);
}

.element-list-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 0.35rem;
}

.section-card-body .element-checks {
  margin-left: 0;
  padding-left: 0;
  border-left: none;
}

.back-link {
  display: inline-block;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
  color: var(--accent);
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.actions .btn-primary {
  width: 100%;
}