.survey-builder-layout,
.survey-builder-main,
.survey-builder-form {
  display: grid;
  gap: 16px;
}

.survey-builder-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.survey-builder-head h3 {
  margin: 0 0 6px;
  font-size: 20px;
}

.survey-preview-toggle.active {
  border-color: rgba(215, 0, 91, 0.42);
  color: var(--brand);
  background: var(--brand-soft);
}

.survey-step-panel {
  display: grid;
  gap: 14px;
}

.survey-step-head {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.survey-step-head > span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 900;
}

.survey-step-head h3,
.survey-step-head p {
  margin: 0;
}

.survey-step-head h3 {
  font-size: 18px;
}

.survey-design-panel summary {
  cursor: pointer;
  list-style: none;
}

.survey-design-panel summary::-webkit-details-marker {
  display: none;
}

.survey-design-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding-top: 12px;
}

.survey-step-grid .field,
.survey-design-body .field {
  margin-bottom: 0;
}

.survey-field-list {
  display: grid;
  gap: 12px;
}

.survey-field-row {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel);
}

.survey-question-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.survey-question-summary {
  min-width: 0;
  display: flex;
  align-items: center;
  min-height: 40px;
}

.survey-question-summary strong {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.survey-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.survey-card-actions .ghost,
.survey-card-actions .danger {
  min-height: 36px;
  padding: 8px 10px;
  font-size: 13px;
}

.survey-card-body {
  display: grid;
  gap: 10px;
}

.survey-field-row-collapsed .survey-card-body {
  display: none;
}

.survey-field-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 8px;
  align-items: start;
}

.survey-question-text-stack {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.survey-field-text-control {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.survey-field-text-control small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.survey-field-type-control {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.survey-field-type-control select,
.survey-add-row select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 9px 10px;
}

.survey-field-text-control textarea {
  min-height: 78px;
  resize: vertical;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.survey-field-text-control [data-survey-field-description] {
  min-height: 96px;
}

.survey-field-text-control em {
  justify-self: end;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.survey-image-control,
.survey-style-controls,
.survey-theme-grid {
  display: grid;
  gap: 8px;
}

.survey-theme-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 10px;
}

.survey-style-controls {
  grid-template-columns: minmax(0, 140px) minmax(0, 140px) auto;
  align-items: end;
}

.survey-theme-grid label,
.survey-style-controls label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.survey-theme-grid .check-inline,
.survey-style-controls .check-inline {
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  font-size: 13px;
}

.file-inline {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  gap: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 9px 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.file-inline input {
  max-width: min(360px, 100%);
}

.survey-header-image-preview,
.survey-field-image-preview {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.survey-header-image-preview img,
.survey-field-image-preview img {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: contain;
}

.survey-field-image-preview {
  max-width: 420px;
}

.survey-field-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.survey-options-box {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.survey-condition-box {
  display: grid;
  gap: 8px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 10px;
}

.survey-condition-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.survey-condition-controls[hidden] {
  display: none;
}

.survey-options-box[hidden] {
  display: none;
}

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

.survey-option-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.survey-option-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.survey-add-row {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(220px, 1fr);
  gap: 10px;
  align-items: stretch;
}

.survey-add-button {
  width: 100%;
  min-height: 52px;
  border-style: dashed;
}

.survey-save-bar {
  position: sticky;
  bottom: 10px;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  padding: 12px;
}

.survey-save-bar > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.survey-save-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.survey-preview-panel {
  display: grid;
  gap: 14px;
}

.survey-preview-panel[hidden] {
  display: none;
}

.survey-preview-frame {
  width: min(420px, 100%);
  margin: 0 auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.survey-preview-frame .survey-public-card {
  width: 100%;
  margin: 0;
  box-shadow: var(--shadow);
}

.survey-item details {
  margin-top: 10px;
}

.survey-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 10px;
}

.survey-stats {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.survey-public-shell {
  min-height: 100vh;
  background: var(--soft);
  padding: 36px 16px;
}

.survey-public-card {
  width: min(720px, 100%);
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: grid;
  gap: 16px;
  padding: 0 24px 24px;
}

.survey-public-accent {
  height: 10px;
  background: var(--survey-accent, var(--brand));
  margin: 0 -24px;
}

.survey-public-header-image {
  margin: -2px -24px 0;
  background: var(--soft);
  border-bottom: 1px solid var(--line);
}

.survey-public-header-image img {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
}

.survey-public-card h1 {
  margin: 0;
  font-size: 28px;
}

.survey-public-description {
  margin: 0;
  line-height: 1.7;
}

.survey-question {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.survey-question-label {
  display: block;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.survey-question-description {
  margin: -2px 0 4px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.survey-question-image {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.survey-question-image img {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
}

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

.choice-list label,
.yesno-choice-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--ink);
}

.choice-list input,
.yesno-choice-list input {
  width: auto;
}

.yesno-choice-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.yesno-choice-list label {
  min-width: 96px;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--panel);
}

.choice-other-input {
  width: min(100%, 420px);
  margin-top: 2px;
}

.rating-choice-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.rating-choice-list label {
  display: grid;
  cursor: pointer;
}

.rating-choice-list input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.rating-choice-list span {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #8a5a00;
  font-weight: 800;
}

.rating-choice-list em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.rating-choice-list input:checked + span {
  border-color: var(--brand);
  background: #eef4ff;
  color: var(--brand);
}

.rating-comment-input {
  min-height: 88px;
}

.survey-comment-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.survey-comment-list p {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
}

.privacy-box,
.success-box {
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
  color: var(--muted);
  white-space: pre-wrap;
}

.success-box {
  background: var(--good-soft);
  color: var(--good);
  font-weight: 800;
}

