:root {
  color-scheme: light;
  --bg: #f7f7fb;
  --panel: #ffffff;
  --accent: #1b6ef3;
  --accent-soft: rgba(27, 110, 243, 0.1);
  --text: #1f2933;
  --muted: #52606d;
  --border: #d9dce3;
  --highlight: #fff3c4;
  font-family: "Inter", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

.app-header {
  padding: 2rem clamp(1.5rem, 3vw, 3rem);
  background: linear-gradient(135deg, #dfe8ff, #f2f6ff 60%, #ffffff);
  border-bottom: 1px solid var(--border);
}

.app-header h1 {
  margin: 0;
  font-size: clamp(1.8rem, 2.7vw, 2.6rem);
}

.app-header p {
  margin-top: 0.5rem;
  color: var(--muted);
  max-width: 720px;
}

.app-main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  padding: clamp(1.5rem, 3vw, 3rem);
}

.builder,
.preview {
  background: var(--panel);
  border-radius: 1rem;
  border: 1px solid var(--border);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 8rem);
}

form {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.form-section h2 {
  margin: 0 0 0.75rem 0;
  font-size: 1.1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.field-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
}

input[type="text"],
input[type="date"],
textarea {
  padding: 0.6rem 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  background: #fbfcff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}

textarea {
  resize: vertical;
}

fieldset.field {
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 1rem;
}

legend {
  font-weight: 600;
  color: var(--muted);
}

.option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  margin-bottom: 0.4rem;
}

.button-secondary,
.button-ghost,
.remove-member {
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  padding: 0.5rem 0.9rem;
  border-radius: 0.6rem;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.button-secondary:hover,
.button-ghost:hover,
.remove-member:hover {
  background: var(--accent);
  color: #fff;
}

.preview-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.preview-content {
  flex: 1;
  overflow-y: auto;
  padding-right: 1rem;
  line-height: 1.6;
  scroll-behavior: smooth;
}

.preview-content h3 {
  margin-top: 2rem;
  margin-bottom: 0.5rem;
  font-size: 1.05rem;
}

.preview-content p {
  margin: 0.5rem 0;
}

.preview-content ul {
  padding-left: 1.2rem;
  margin: 0.5rem 0 1rem;
}

.member-card {
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  padding: 1rem;
  margin-bottom: 1rem;
  background: #f8f9ff;
}

.member-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.remove-member {
  font-size: 0.85rem;
  padding: 0.35rem 0.7rem;
}

.highlight {
  background: var(--highlight);
  transition: background 0.6s ease;
}

.placeholder {
  color: var(--muted);
  font-style: italic;
}

@media (max-width: 1080px) {
  .app-main {
    grid-template-columns: 1fr;
  }

  .builder,
  .preview {
    min-height: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
