:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.12);
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  --paper-shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

body {
  padding: 0 24px 32px;
}

button,
input,
textarea,
a {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  max-width: 1440px;
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 20px;
  padding: 22px 0;
  background: #ffffff;
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}

.logo {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
  padding-top: 32px;
}

.builder-column {
  display: grid;
  gap: 24px;
  align-content: start;
}

.template-compact {
  display: grid;
  gap: 14px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.template-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.template-summary h2 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.template-summary p,
.template-flow {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.template-inline {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  gap: 14px 18px;
  align-items: end;
}

.template-select {
  display: grid;
  gap: 8px;
}

.template-select span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.template-select select {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  color: var(--text);
  outline: none;
}

.template-select select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 40px;
  box-shadow: var(--shadow);
}

.panel-header {
  display: grid;
  gap: 10px;
  margin-bottom: 28px;
}

.panel-header.compact {
  margin-bottom: 20px;
}

.panel-header h1,
.panel-header h2,
.section-head h3,
.preview-toolbar h2,
.modal-card h2 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.panel-header h1 {
  font-size: clamp(24px, 3vw, 30px);
}

.panel-header h2,
.preview-toolbar h2 {
  font-size: 24px;
}

.panel-header p,
.section-head p,
.preview-toolbar p,
.modal-copy,
.status-message {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.step-label,
.modal-tag {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  white-space: nowrap;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.resume-form {
  display: grid;
  gap: 0;
}

.form-section {
  display: grid;
  gap: 20px;
  padding: 44px 0;
}

.form-section:first-of-type {
  padding-top: 0;
}

.form-section + .form-section {
  border-top: 1px solid #eef2f7;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.field-grid .field:first-child {
  grid-column: 1 / -1;
}

.field,
.experience-card {
  display: grid;
  gap: 10px;
}

.field span,
.experience-title {
  font-size: 14px;
  font-weight: 600;
}

.field input,
.field textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  color: var(--text);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #94a3b8;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  background: #ffffff;
}

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

.experience-list {
  display: grid;
  gap: 18px;
}

.experience-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #ffffff;
}

.experience-card .field {
  gap: 22px;
}

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

.primary-button,
.secondary-button,
.remove-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.primary-button {
  background: var(--accent);
  color: #ffffff;
}

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

.secondary-button,
.remove-button {
  background: #ffffff;
  color: var(--text);
  border-color: var(--line-strong);
}

.secondary-button:hover,
.remove-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.primary-button:hover,
.secondary-button:hover,
.remove-button:hover {
  transform: translateY(-1px);
}

.remove-button {
  min-height: 38px;
  padding: 0 14px;
}

.action-row {
  display: flex;
  gap: 12px;
  padding-top: 32px;
}

.status-message {
  min-height: 24px;
  padding-top: 16px;
}

.status-message.error {
  color: #dc2626;
}

.preview-column {
  align-self: start;
  position: sticky;
  top: 96px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 20px;
  height: calc(100vh - 120px);
  min-height: 0;
}

.preview-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.preview-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.preview-canvas {
  display: grid;
  place-items: start center;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface-muted);
  overflow: auto;
  min-height: 0;
  height: 100%;
  scrollbar-gutter: stable;
}

.resume-paper {
  width: min(100%, 794px);
  min-height: 1123px;
  padding: 54px 52px;
  background: #ffffff;
  color: #0f172a;
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: var(--paper-shadow);
}

.resume-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 2px solid #0f172a;
}

.resume-name {
  margin: 0 0 8px;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.resume-role {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.resume-contact {
  display: grid;
  gap: 8px;
  justify-items: end;
  font-size: 14px;
  color: #334155;
}

.resume-section {
  padding-top: 26px;
}

.resume-section-title {
  margin-bottom: 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.resume-section-body {
  display: grid;
  gap: 18px;
  font-size: 14px;
  line-height: 1.7;
}

.empty-state {
  color: #94a3b8;
}

.preview-experience-item {
  display: grid;
  gap: 6px;
}

.preview-topline {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: baseline;
}

.preview-company {
  font-size: 16px;
  font-weight: 700;
}

.preview-role {
  font-weight: 600;
  color: #334155;
}

.preview-dates {
  white-space: nowrap;
  font-size: 13px;
  color: #475569;
}

.preview-description {
  margin: 0;
  white-space: pre-line;
}

.education-list {
  display: grid;
  gap: 8px;
}

.skill-list {
  display: grid;
  gap: 10px;
}

.skill-chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  font-size: 12px;
  color: #334155;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.45);
}

.hidden {
  display: none;
}

.modal-card {
  width: min(100%, 480px);
  padding: 28px;
  border-radius: 24px;
  background: #ffffff;
  box-shadow: var(--paper-shadow);
}

.modal-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.mobile-preview-toggle,
.close-preview-button {
  display: none;
}

body.preview-open {
  overflow: hidden;
}

@media (max-width: 720px) {
  body {
    padding: 0 16px 24px;
  }

  .site-header {
    padding: 18px 0;
  }

  .panel,
  .preview-canvas,
  .resume-paper {
    padding: 20px;
  }

  .template-inline {
    grid-template-columns: 1fr;
  }

  .field-grid,
  .section-head,
  .resume-header,
  .preview-topline,
  .template-summary {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .preview-column {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 30;
    background: #ffffff;
    padding: 16px;
    gap: 16px;
    height: 100vh;
    top: 0;
  }

  .preview-column.is-mobile-open {
    display: grid;
  }

  .preview-toolbar {
    display: grid;
    gap: 14px;
    align-items: start;
  }

  .preview-actions {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .mobile-preview-toggle,
  .close-preview-button {
    display: inline-flex;
  }

  .resume-paper {
    min-height: auto;
  }

  .resume-contact {
    justify-items: start;
  }
}

@media print {
  .resume-paper {
    border: none !important;
    box-shadow: none !important;
  }

  .resume-section {
    border: none !important;
  }

  .preview-canvas {
    border: none !important;
    background: none !important;
  }
}
