* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f5f7fa;
  color: #333;
  line-height: 1.5;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 20px;
}

h1 {
  font-size: 28px;
  margin-bottom: 8px;
  color: #1a3a5c;
}

.subtitle {
  color: #666;
  margin-bottom: 32px;
  font-size: 15px;
}

.layout {
  display: flex;
  gap: 40px;
  align-items: flex-start;
}

.form-panel {
  flex: 1;
  background: #fff;
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.preview-panel {
  flex: 1;
  position: sticky;
  top: 20px;
}

.preview-panel h2,
.form-panel h2 {
  font-size: 18px;
  margin-bottom: 20px;
  color: #1a3a5c;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin-bottom: 4px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #1a3a5c;
}

.btn {
  display: inline-block;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary {
  background: #1a3a5c;
  color: #fff;
}

.btn-primary:hover {
  background: #14304d;
}

.btn-secondary {
  background: #e8ecf1;
  color: #1a3a5c;
}

.btn-secondary:hover {
  background: #dce1e8;
}

.btn-group {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

.preview-box {
  background: #fff;
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1a3a5c;
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  z-index: 999;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Instructions page */
.instructions-container {
  max-width: 700px;
  margin: 0 auto;
  padding: 40px 20px;
}

.instructions-container h1 {
  margin-bottom: 4px;
}

.step {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.step h3 {
  font-size: 16px;
  margin-bottom: 12px;
  color: #1a3a5c;
}

.step .btn {
  margin-bottom: 12px;
}

.client-list {
  list-style: none;
}

.client-list li {
  padding: 10px 0;
  border-bottom: 1px solid #eee;
}

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

.client-list a {
  color: #1a3a5c;
  text-decoration: none;
  font-weight: 500;
}

.client-list a:hover {
  text-decoration: underline;
}

/* Archive */
.archive-section {
  margin-top: 40px;
}

.archive-section h2 {
  font-size: 18px;
  color: #1a3a5c;
  margin-bottom: 16px;
}

.archive-group-heading {
  font-size: 14px;
  font-weight: 600;
  color: #1a3a5c;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 24px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e5e9ee;
}
.archive-group-heading:first-child { margin-top: 0; }
.archive-group-count {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 500;
  color: #fff;
  background: #2c5f8a;
  border-radius: 999px;
  vertical-align: middle;
}

.archive-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.archive-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.archive-info strong {
  font-size: 14px;
  color: #333;
}

.archive-meta {
  font-size: 13px;
  color: #888;
}

.archive-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }
  .preview-panel {
    position: static;
  }
}

/* ── Drag-and-drop zone ─────────────────────────────────────── */
.drop-zone {
  border: 2px dashed #c0cfe0;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  color: #666;
  font-size: 13px;
}
.drop-zone.drag-over {
  border-color: #1a3a5c;
  background: #eef4fb;
}
.drop-zone input[type=file] { display: none; }

/* ── Crop modal ──────────────────────────────────────────────── */
#crop-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
}
#crop-modal.open { display: flex; align-items: center; justify-content: center; }

.crop-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
}

.crop-dialog {
  position: relative;
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  max-width: 600px;
  width: calc(100vw - 32px);
  box-shadow: 0 8px 40px rgba(0,0,0,0.25);
}

.crop-dialog h3 { font-size: 16px; color: #1a3a5c; margin-bottom: 4px; }
.crop-hint { font-size: 12px; color: #999; margin-bottom: 14px; }

.crop-canvas-wrap {
  position: relative;
  display: inline-block;
  width: 100%;
  text-align: center;
}

#crop-canvas {
  max-width: 100%;
  display: block;
  margin: 0 auto;
  border-radius: 4px;
  touch-action: none; /* let pointer events drive crop, not page scroll */
}

.crop-size {
  text-align: center;
  font-size: 12px;
  color: #666;
  margin: 10px 0 0;
}

.crop-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

/* CTA WYSIWYG editor */
.cta-toolbar {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
}
.cta-toolbar-btn {
  background: #fff;
  border: 1px solid #d0d5dd;
  border-radius: 4px;
  padding: 3px 10px;
  font-size: 13px;
  cursor: pointer;
  color: #333;
  line-height: 1.4;
}
.cta-toolbar-btn:hover { background: #f0f4f8; }
.cta-editor {
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  padding: 10px 12px;
  min-height: 60px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  color: #333;
  line-height: 1.5;
  background: #fff;
  outline: none;
}
.cta-editor:focus { border-color: #2c5f8a; box-shadow: 0 0 0 2px rgba(44,95,138,0.15); }
.cta-editor:empty::before {
  content: attr(data-placeholder);
  color: #bbb;
  pointer-events: none;
}
