:root {
  --navy: #0C0F1E;
  --blue: #3B4CC8;
  --yellow: #E8C800;
  --cream: #F2EFE6;
  --gray: #6b7280;
  --border: #e2e0d8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--navy);
  font-family: 'Inter', sans-serif;
  font-weight: 400;
}

h1, h2, h3 { font-family: 'Space Grotesk', sans-serif; font-weight: 700; margin: 0 0 0.5em; }

header.topbar {
  background: var(--navy);
  color: var(--cream);
  padding: 18px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header.topbar .brand {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 0.02em;
}

header.topbar .brand .dot { color: var(--yellow); }

.topnav a {
  color: var(--cream);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}
.topnav a:hover { color: var(--yellow); }

main {
  max-width: 880px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px;
  margin-bottom: 24px;
}

label { display: block; font-weight: 500; margin-bottom: 6px; margin-top: 18px; }
label:first-of-type { margin-top: 0; }

input[type=text], input[type=email], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 15px;
  background: #fff;
  color: var(--navy);
}

textarea { resize: vertical; min-height: 60px; }

input[type=file] { margin-top: 4px; }

button, .btn {
  display: inline-block;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 15px;
  padding: 12px 22px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  background: var(--blue);
  color: #fff;
  text-decoration: none;
}

button:hover, .btn:hover { opacity: 0.9; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

button.secondary, .btn.secondary {
  background: transparent;
  color: var(--navy);
  border: 1px solid var(--navy);
}

button.accent, .btn.accent { background: var(--yellow); color: var(--navy); }

.row { display: flex; gap: 12px; align-items: center; }
.row.between { justify-content: space-between; }

.warning {
  background: #fff7d6;
  border: 1px solid var(--yellow);
  color: #6b5900;
  padding: 12px 16px;
  border-radius: 6px;
  margin-top: 16px;
  font-size: 14px;
  display: none;
}
.warning.show { display: block; }

.error-box {
  background: #fdeaea;
  border: 1px solid #d9534f;
  color: #8a1f1f;
  padding: 14px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
}

.slide-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}

.slide-card .meta {
  font-size: 13px;
  color: var(--gray);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

.spinner {
  width: 36px; height: 36px;
  border: 4px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 40px auto 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-wrap { text-align: center; padding: 60px 20px; }
.loading-wrap p { color: var(--gray); }

.progress-track {
  width: 100%;
  max-width: 320px;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin: 20px auto 0;
}
.progress-fill {
  height: 100%;
  background: var(--blue);
  width: 0%;
  transition: width 0.4s ease;
}
.stage-label {
  margin-top: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray);
}

.slide-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.slide-item { display: flex; flex-direction: column; gap: 8px; }
.slide-item img {
  width: 100%;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: block;
}
.slide-revise { display: flex; gap: 6px; }
.slide-revise-input {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  padding: 8px 10px;
}
.slide-revise-btn { font-size: 13px; padding: 8px 12px; white-space: nowrap; }
.slide-revise-error { color: #d9534f; font-size: 12px; }

.caption-block { margin-bottom: 20px; }
.caption-block pre {
  white-space: pre-wrap;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px;
  margin-top: 8px;
}

.preset-map-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
@media (max-width: 700px) {
  .slide-grid { grid-template-columns: repeat(2, 1fr); }
  .preset-map-grid { grid-template-columns: 1fr; }
}

.badge {
  display: inline-block;
  background: var(--yellow);
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 8px;
}

.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.thumbs img { width: 90px; height: 112px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); }

.callout {
  background: #eef1fd;
  border: 1px solid var(--blue);
  color: var(--navy);
  padding: 12px 16px;
  border-radius: 6px;
  margin-top: 16px;
  font-size: 14px;
}

.swatch-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.swatch {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: inline-block;
}

.hint { color: var(--gray); font-size: 13px; margin-top: 6px; }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}
.breadcrumb a { color: var(--blue); text-decoration: none; font-weight: 600; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-current { color: var(--navy); font-weight: 700; }
.breadcrumb-sep { color: var(--gray); }

.photo-chip-list { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.photo-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 8px 6px 14px;
  font-size: 13px;
  color: var(--navy);
  max-width: 220px;
}
.photo-chip-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray);
  font-size: 16px;
  line-height: 1;
  padding: 0 4px;
}
.photo-chip-remove:hover { color: #d9534f; }

.photo-picker { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.photo-option {
  width: 64px; height: 64px;
  border-radius: 8px;
  border: 2px solid var(--border);
  background: #fff;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-option img { width: 100%; height: 100%; object-fit: cover; }
.photo-option.selected { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(59,76,200,0.25); }
.photo-option.none-option {
  width: auto;
  height: 64px;
  padding: 0 14px;
  font-size: 13px;
  color: var(--gray);
  font-weight: 600;
}

.preview-modal {
  position: fixed;
  inset: 0;
  background: rgba(12,15,30,0.72);
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}
.preview-modal-content {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  max-width: 960px;
  max-height: 90vh;
  overflow-y: auto;
}
.preview-images {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  flex-wrap: wrap;
  justify-content: center;
}
.preview-images img {
  width: 260px;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--cream);
  aspect-ratio: 1080 / 1350;
  object-fit: cover;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 4px;
}
.preset-card {
  display: flex;
  flex-direction: column;
  border: 2px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  background: #fff;
  position: relative;
}
.preset-card input[type="radio"] {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 18px;
  height: 18px;
  margin: 0;
  z-index: 2;
}
.preset-card img {
  width: 100%;
  aspect-ratio: 1080 / 1350;
  object-fit: cover;
  background: var(--cream);
  display: block;
}
.preset-card-img-placeholder {
  width: 100%;
  aspect-ratio: 1080 / 1350;
  background: var(--cream);
  color: var(--gray);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 12px;
  padding: 8px;
}
.preset-card-name {
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
}
.preset-card.selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(59,76,200,0.25);
}
