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

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f5f3ef;
  color: #1f2428;
}

[hidden] {
  display: none !important;
}

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

.container {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

h1 {
  text-align: center;
  font-size: 2rem;
  line-height: 1.15;
  margin-bottom: 8px;
}

.subtitle {
  text-align: center;
  color: #61676d;
  margin-bottom: 28px;
}

.form-container {
  max-width: 760px;
}

.answer-form {
  display: grid;
  gap: 16px;
}

.single-field {
  display: grid;
  gap: 8px;
  padding: 18px;
  border-radius: 8px;
  background: #fff;
  border-left: 6px solid #999;
  box-shadow: 0 8px 24px rgba(28, 32, 36, 0.08);
}

.single-field span {
  font-size: 1rem;
  font-weight: 700;
}

.single-field textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  border: 1px solid #d7dce0;
  border-radius: 8px;
  padding: 12px 14px;
  line-height: 1.45;
  color: #1f2428;
  background: #fbfcfd;
}

.single-field textarea:focus {
  outline: none;
  border-color: #1f7a8c;
  box-shadow: 0 0 0 3px rgba(31, 122, 140, 0.14);
  background: #fff;
}

.single-field-success {
  border-left-color: #2f8f5b;
}

.single-field-lapse {
  border-left-color: #c4573f;
}

.single-field-insight {
  border-left-color: #2f66b3;
}

.btn-submit {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 14px 18px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: #202529;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s, transform 0.12s;
}

.btn-submit:hover {
  background: #32393f;
}

.btn-submit:active {
  transform: translateY(1px);
}

.btn-submit:disabled {
  cursor: default;
  opacity: 0.7;
}

.thanks-panel {
  margin-top: 28px;
  padding: 48px 24px;
  text-align: center;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(28, 32, 36, 0.08);
}

.thanks-panel h2 {
  font-size: 2rem;
}

.thanks-image {
  display: block;
  width: min(320px, 80vw);
  height: auto;
  margin: 0 auto 24px;
}

.public-page {
  min-height: 100vh;
  overflow: hidden;
  background: #fff;
}

.public-layout {
  display: grid;
  grid-template-columns: minmax(260px, 42vw) minmax(420px, 1fr);
  min-height: 100vh;
}

.illustration-placeholder {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 32px;
  background: transparent;
}

.public-illustration {
  display: block;
  width: min(72%, 460px);
  height: auto;
}

.responses-panel {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  height: 100vh;
}

.response-section {
  display: grid;
  grid-template-rows: auto 0fr;
  flex: 0 0 auto;
  min-height: 0;
  padding: 18px 22px;
  background: transparent;
  overflow: hidden;
  transition: flex 0.22s ease, grid-template-rows 0.22s ease;
}

.response-section.is-open {
  grid-template-rows: auto minmax(0, 1fr);
  flex: 1 1 auto;
}

.response-section header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 40px;
  margin-bottom: 12px;
}

.response-section h2 {
  font-size: 1.2rem;
  line-height: 1.1;
}

.response-success h2 {
  color: #237449;
}

.response-lapse h2 {
  color: #a64532;
}

.response-insight h2 {
  color: #245a9d;
}

.toggle-section {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #202529;
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 500;
  transition: color 0.18s, transform 0.18s;
}

.toggle-section:hover {
  color: #667078;
  transform: scale(1.08);
}

.response-list {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.response-list:not(.is-visible) {
  display: flex;
  overflow: hidden;
}

.response-item {
  position: relative;
  flex: 0 1 220px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 6px;
  color: #fff;
  line-height: 1.25;
  word-break: break-word;
  cursor: default;
}

.response-success .response-item {
  background: #1f6b42;
}

.response-lapse .response-item {
  background: #8f3929;
}

.response-insight .response-item {
  background: #1d4d8f;
}

.response-item:hover::after,
.response-item:focus-visible::after {
  content: attr(data-full);
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 30;
  width: max-content;
  max-width: min(420px, 70vw);
  padding: 10px 12px;
  border-radius: 6px;
  background: #202529;
  color: #fff;
  box-shadow: 0 10px 24px rgba(31, 36, 40, 0.22);
  font-size: 0.9rem;
  line-height: 1.35;
  white-space: pre-wrap;
}

.empty-section {
  color: #778088;
  padding: 8px 0;
}

.counts-indicator {
  position: fixed;
  right: 12px;
  bottom: 10px;
  z-index: 20;
  padding: 5px 8px;
  background: transparent;
  color: rgba(31, 36, 40, 0.55);
  font-size: 0.78rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.admin-container {
  max-width: 1100px;
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}

.search-input {
  flex: 1;
  min-width: 220px;
  padding: 10px 14px;
  border: 1px solid #cfd6dc;
  border-radius: 8px;
  background: #fff;
}

.search-input:focus {
  outline: none;
  border-color: #1f7a8c;
  box-shadow: 0 0 0 3px rgba(31, 122, 140, 0.14);
}

.admin-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-btn,
.pagination-btn,
.page-size-select {
  min-height: 36px;
  padding: 8px 14px;
  border: 1px solid #cfd6dc;
  border-radius: 8px;
  background: #fff;
  color: #202529;
  cursor: pointer;
}

.filter-btn.active,
.pagination-btn.active {
  background: #202529;
  color: #fff;
  border-color: #202529;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 24px 0;
  flex-wrap: wrap;
}

.pagination-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(28, 32, 36, 0.08);
}

.admin-table th {
  padding: 12px 14px;
  background: #202529;
  color: #fff;
  text-align: left;
  font-size: 0.86rem;
}

.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #e8ecef;
  vertical-align: top;
}

.admin-table tr:last-child td {
  border-bottom: 0;
}

.section-badge {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 7px;
  border-radius: 50%;
  vertical-align: -1px;
}

.section-badge.green {
  background: #2f8f5b;
}

.section-badge.blue {
  background: #c4573f;
}

.section-badge.red {
  background: #2f66b3;
}

.text-cell {
  max-width: 420px;
  line-height: 1.4;
  word-break: break-word;
}

.version-badge {
  display: inline-block;
  margin-right: 6px;
  padding: 2px 6px;
  border-radius: 5px;
  background: #eef2f5;
  color: #61676d;
  font-size: 0.75rem;
}

.inactive-marker {
  opacity: 0.55;
  font-style: italic;
}

.actions-cell {
  white-space: nowrap;
}

.btn-action {
  margin-right: 5px;
  padding: 7px 10px;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}

.btn-edit {
  background: #e7f1f3;
  color: #176474;
}

.btn-delete {
  background: #f8e9e4;
  color: #a64532;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(31, 36, 40, 0.5);
}

.modal {
  width: min(560px, 100%);
  padding: 24px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(31, 36, 40, 0.24);
}

.modal h3 {
  margin-bottom: 14px;
}

.modal textarea {
  width: 100%;
  min-height: 130px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid #cfd6dc;
  border-radius: 8px;
  resize: vertical;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-actions button {
  min-height: 38px;
  padding: 8px 18px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.btn-save {
  background: #202529;
  color: #fff;
}

.btn-cancel {
  background: #eceff1;
  color: #202529;
}

.loading,
.no-data,
.error {
  padding: 28px;
  text-align: center;
  color: #667078;
}

.error {
  color: #a64532;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 200;
  transform: translateX(-50%);
  max-width: min(440px, calc(100vw - 32px));
  padding: 13px 18px;
  border-radius: 8px;
  background: #202529;
  color: #fff;
  text-align: center;
  box-shadow: 0 10px 30px rgba(31, 36, 40, 0.2);
  animation: toastIn 0.25s ease, toastOut 0.25s ease 2.75s forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@media (max-width: 820px) {
  .public-page {
    overflow: auto;
  }

  .public-layout {
    display: block;
    min-height: 100vh;
  }

  .illustration-placeholder {
    min-height: 220px;
  }

  .public-illustration {
    width: min(260px, 80%);
  }

  .responses-panel {
    min-height: calc(100vh - 220px);
    height: calc(100vh - 220px);
  }

  .response-section {
    padding: 16px;
  }
}

@media (max-width: 560px) {
  .container {
    width: min(100% - 24px, 920px);
    padding: 20px 0;
  }

  h1 {
    font-size: 1.7rem;
  }

  .single-field {
    padding: 14px;
  }

  .single-field textarea {
    min-height: 100px;
  }

  .response-section header {
    align-items: flex-start;
  }

  .toggle-section {
    width: 28px;
  }

  .admin-table {
    display: block;
    overflow-x: auto;
  }
}
