:root {
  --bg: #f5efe2;
  --bg-accent: #e8d2a5;
  --ink: #1f1b16;
  --muted: #5c5449;
  --panel: rgba(255, 252, 245, 0.92);
  --line: rgba(31, 27, 22, 0.12);
  --brand: #b44923;
  --brand-dark: #8f3517;
  --ok: #176b3d;
  --shadow: 0 16px 40px rgba(31, 27, 22, 0.08);
}

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background:
    radial-gradient(circle at 15% 10%, rgba(180, 73, 35, 0.12), transparent 45%),
    radial-gradient(circle at 90% 20%, rgba(232, 210, 165, 0.9), transparent 40%),
    linear-gradient(180deg, #f8f2e7 0%, #f4ecdd 60%, #efe6d5 100%);
}

.hero {
  padding: 2rem 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

.hero__inner {
  max-width: 1500px;
  margin: 0 auto;
  background: linear-gradient(135deg, rgba(180, 73, 35, 0.12), rgba(255, 255, 255, 0.7));
  border: 1px solid rgba(180, 73, 35, 0.16);
  border-radius: 18px;
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
}

.hero--admin .hero__inner {
  background: linear-gradient(135deg, rgba(23, 107, 61, 0.1), rgba(255, 255, 255, 0.8));
  border-color: rgba(23, 107, 61, 0.18);
}

.hero__inner--public-design {
  padding: 0.9rem 1.1rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
}

h1, h2, h3 {
  margin: 0;
}

.hero__subtitle {
  margin-top: 0.4rem;
  color: var(--muted);
}

.layout {
  max-width: 1500px;
  margin: 0 auto;
  padding: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
  align-items: start;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card--wide {
  grid-column: 1 / -1;
}

.card h2 {
  margin-bottom: 0.75rem;
  font-size: 1.05rem;
}

#surveySectionTitle {
  color: #1b67cd;
}

.stack {
  display: grid;
  gap: 0.75rem;
}

label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.92rem;
}

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

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  background: #fffdf8;
  color: var(--ink);
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid rgba(180, 73, 35, 0.18);
  border-color: rgba(180, 73, 35, 0.35);
}

button {
  border: 0;
  border-radius: 10px;
  padding: 0.7rem 0.95rem;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--brand-dark);
}

button.secondary {
  background: #dfd5c0;
  color: var(--ink);
}

button.secondary:hover {
  background: #d4c7ac;
}

button.danger {
  background: #b32727;
}

button.danger:hover {
  background: #922020;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem;
}

legend {
  padding: 0 0.35rem;
  color: var(--muted);
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem;
}

.checkbox-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(130px, 1fr);
  gap: 0.45rem;
  width: max-content;
  min-width: 100%;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--ink);
  background: #fffcf6;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.45rem 0.6rem;
}

.checkbox-item--entry {
  justify-content: center;
  flex-direction: column;
  text-align: center;
  min-height: 72px;
  min-width: 130px;
  gap: 0.35rem;
}

.checkbox-item--entry span {
  font-size: 0.84rem;
  line-height: 1.2;
}

.checkbox-item--entry input {
  transform: scale(1.12);
}

.checkbox-item input {
  width: auto;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.entry-line {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
}

.entry-line__name {
  height: 100%;
}

.entry-line__name input {
  min-height: 48px;
}

.entry-line__choices {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf8;
  padding: 0.65rem;
  overflow-x: auto;
  overflow-y: hidden;
}

.entry-line__choices-title {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0.45rem;
}

.hint.success {
  color: var(--ok);
  font-weight: 600;
}

.entry-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.entry-actions .hint {
  flex: 1;
}

.totals {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.totals li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  background: #fffcf6;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 380px;
}

th, td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 0.55rem 0.4rem;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.tag {
  display: inline-block;
  margin: 0 0.3rem 0.25rem 0;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: #efe2cb;
  border: 1px solid rgba(31, 27, 22, 0.08);
  font-size: 0.82rem;
}

.comments {
  list-style: none;
  padding: 0;
  margin: 0.9rem 0 0;
  display: grid;
  gap: 0.6rem;
}

.comments li {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  background: #fffcf7;
}

.comments-panel {
  grid-column: 1 / -1 !important;
}

.comments-panel__grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.comments-panel__form {
  margin: 0;
}

.comments-panel__list {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.45);
  padding: 0.75rem;
  min-height: 220px;
}

.comments-panel__list .comments {
  margin-top: 0;
}

.design-canvas {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-height: 120px;
  border: 1px dashed rgba(31, 27, 22, 0.2);
  border-radius: 12px;
  background:
    linear-gradient(0deg, rgba(255,255,255,0.7), rgba(255,255,255,0.7)),
    linear-gradient(90deg, rgba(31,27,22,0.04) 1px, transparent 1px),
    linear-gradient(rgba(31,27,22,0.04) 1px, transparent 1px);
  background-size: auto, 20px 20px, 20px 20px;
  background-position: 0 0, 0 0, 0 0;
  overflow: auto;
}

.design-canvas--public {
  min-height: 180px;
  border: none !important;
  background: none !important;
  outline: none !important;
  overflow: hidden;
  box-shadow: none !important;
}

.design-canvas--hero {
  margin-top: 0.75rem;
  min-height: 90px;
  border: none !important;
  background: none !important;
  outline: none !important;
  box-shadow: none !important;
  overflow: hidden;
}

.hero__inner--public-design .design-canvas--hero {
  margin-top: 0;
}

.design-canvas--public .design-item,
.design-canvas--hero .design-item {
  position: absolute;
  overflow: hidden;
  pointer-events: auto;
  user-select: none;
  cursor: zoom-in;
  border-radius: 8px;
}

.design-item--zoomable {
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.design-item--header-zoomhint:hover,
.design-item--header-zoomhint:focus-visible {
  transform: scale(1.02);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}

.design-canvas--public .design-item__img,
.design-canvas--hero .design-item__img {
  position: absolute;
  display: block;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.design-item__zoomhint {
  position: absolute;
  right: 6px;
  bottom: 6px;
  z-index: 2;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.7);
  font-size: 0.95rem;
  line-height: 1;
  pointer-events: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

.design-item--header-zoomhint:hover .design-item__zoomhint,
.design-item--header-zoomhint:focus-visible .design-item__zoomhint {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.85);
}

.design-canvas--public .design-item:focus-visible,
.design-canvas--hero .design-item:focus-visible {
  outline: 2px solid rgba(12, 94, 200, 0.55);
  outline-offset: 2px;
}

.design-canvas--public .design-text-item,
.design-canvas--hero .design-text-item {
  position: absolute;
  display: block;
  overflow: hidden;
  white-space: pre-wrap;
  line-height: 1.15;
  pointer-events: auto;
  user-select: text;
}

.design-canvas--admin {
  width: min(100%, 1400px);
  overflow: hidden;
  outline: none;
}

.design-editor-item {
  position: absolute;
  border: 1px solid rgba(11, 87, 188, 0.35);
  border-radius: 6px;
  overflow: hidden;
  background: rgba(255,255,255,0.4);
}

.design-editor-item--image {
  background: transparent;
  border-color: transparent;
}

.design-editor-item.is-active {
  border-color: rgba(180, 73, 35, 0.65);
  box-shadow: 0 0 0 2px rgba(180, 73, 35, 0.15);
}

.design-editor-item--image.is-active {
  border-color: transparent;
  box-shadow: none;
}

.design-editor-item img {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: block;
  max-width: none;
  max-height: none;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.design-editor-crop-shade {
  position: absolute;
  background: rgba(20, 20, 20, 0.38);
  pointer-events: none;
}

.design-editor-crop-frame {
  position: absolute;
  border: 1px dashed rgba(255, 255, 255, 0.95);
  box-shadow: inset 0 0 0 1px rgba(11, 87, 188, 0.35);
  pointer-events: none;
}

.design-editor-text {
  width: 100%;
  height: 100%;
  padding: 4px 6px;
  overflow: hidden;
  white-space: pre-wrap;
  line-height: 1.15;
  background: rgba(255, 255, 255, 0.65);
  cursor: text;
  outline: none;
}

.design-editor-text:focus {
  box-shadow: inset 0 0 0 2px rgba(11, 87, 188, 0.25);
  background: rgba(255, 255, 255, 0.8);
}

.design-editor-text:not(.is-editing) {
  caret-color: transparent;
}

.design-editor-text.is-editing {
  cursor: text;
  background: rgba(255, 255, 255, 0.9);
}

.design-editor-item__move,
.design-editor-item__resize,
.design-editor-item__crop {
  position: absolute;
  border: 1px solid rgba(31, 27, 22, 0.18);
  background: rgba(255,255,255,0.9);
  color: #1f1b16;
  border-radius: 4px;
  width: 20px;
  height: 20px;
  min-width: 20px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  line-height: 1;
}

.design-editor-item__move {
  top: 4px;
  left: 4px;
  cursor: move;
}

.design-editor-item__resize {
  right: 4px;
  bottom: 4px;
  cursor: nwse-resize;
}

.design-editor-item__crop {
  z-index: 2;
  width: 18px;
  height: 18px;
  min-width: 18px;
  font-size: 0.62rem;
  line-height: 1;
  opacity: 0.9;
}

.design-editor-item__crop--left {
  cursor: ew-resize;
}

.design-editor-item__crop--right {
  cursor: ew-resize;
}

.design-editor-item__crop--top {
  cursor: ns-resize;
}

.design-editor-item__crop--bottom {
  cursor: ns-resize;
}

.design-item-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffcf6;
  padding: 0.55rem 0.65rem;
  display: grid;
  gap: 0.5rem;
}

.design-item-row__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.design-text-controls {
  display: grid;
  gap: 0.5rem;
}

.design-image-controls {
  display: grid;
  gap: 0.5rem;
}

.design-text-controls textarea {
  min-height: 58px;
  resize: vertical;
}

.design-text-controls__row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.5rem;
}

.design-mini-label {
  display: grid;
  gap: 0.2rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.design-mini-label input,
.design-mini-label select {
  padding: 0.4rem 0.5rem;
  min-height: 36px;
}

.comment-head {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 0.35rem;
}

.inline-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.inline-form input {
  flex: 1;
}

.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.admin-config-form {
  gap: 0.9rem;
}

.admin-config-top {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.9fr);
  grid-template-areas:
    "title meta"
    "subtitle meta";
  gap: 0.75rem;
  align-items: start;
}

.admin-config-top__title {
  grid-area: title;
}

.admin-config-top__subtitle {
  grid-area: subtitle;
}

.admin-config-top__meta {
  grid-area: meta;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffcf6;
  padding: 0.6rem;
}

.admin-config-top__meta > .checkbox-item {
  margin: 0;
}

.admin-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}

.overlay-config-grid {
  display: grid;
  gap: 0.75rem;
}

.overlay-config-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffcf6;
  padding: 0.65rem;
  display: grid;
  gap: 0.55rem;
}

.overlay-config-block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.overlay-config-block__head .small {
  margin: 0;
}

.overlay-config-block__texts {
  display: grid;
  gap: 0.55rem;
}

.overlay-thumb-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: flex-start;
  align-content: flex-start;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.45);
  padding: 0.5rem;
  min-height: 48px;
}

.overlay-thumb-list.is-empty {
  align-content: center;
}

.overlay-thumb-item {
  display: grid;
  grid-template-rows: 54px auto;
  gap: 0.35rem;
  align-items: stretch;
  border: 1px solid rgba(31, 27, 22, 0.08);
  border-radius: 10px;
  background: #fffcf7;
  padding: 0.4rem;
  width: 102px;
  flex: 0 0 auto;
}

.overlay-thumb-item__img {
  width: 100%;
  height: 54px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(31, 27, 22, 0.1);
  background: #ece7db;
  cursor: zoom-in;
}

.overlay-thumb-item__meta {
  min-width: 0;
  display: grid;
  gap: 0.2rem;
}

.overlay-thumb-item__url {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overlay-thumb-item__actions {
  display: grid;
  gap: 0.25rem;
}

.overlay-thumb-item__actions button {
  min-height: 28px;
  padding: 0.2rem 0.35rem;
  font-size: 0.72rem;
  width: 100%;
}

.admin-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.5rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffcf6;
  padding: 0.35rem 0.45rem;
  width: 100%;
}

.admin-row input {
  min-height: 34px;
  padding: 0.4rem 0.55rem;
}

.admin-row button {
  min-height: 32px;
  padding: 0.32rem 0.55rem;
  white-space: nowrap;
}

.entry-editor-list {
  display: grid;
  gap: 0.75rem;
}

.entry-editor {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem;
  background: #fffcf6;
  display: grid;
  gap: 0.6rem;
}

.entry-editor__head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.entry-editor__actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.small {
  font-size: 0.85rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.matrix-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  overscroll-behavior-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbf7ee;
}

.matrix-wrap.matrix-wrap--entry-active {
  touch-action: pan-x;
}

.entry-view-panel[hidden] {
  display: none !important;
}

.entry-view-toggle {
  display: none;
  margin-bottom: 0.65rem;
  padding: 0.18rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  width: fit-content;
  gap: 0.2rem;
}

.seg-toggle {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.32rem 0.65rem;
  font-size: 0.83rem;
  min-height: 30px;
}

.seg-toggle.is-active {
  background: #0c5ec8;
  color: #fff;
}

.mobile-entry {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem;
  background: #fcf8ef;
  display: grid;
  gap: 0.75rem;
}

.mobile-entry__field {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.mobile-entry__field input {
  min-height: 42px;
}

.mobile-entry__inline-submit {
  display: flex;
  justify-content: flex-end;
  margin-top: -0.1rem;
}

.mobile-entry__inline-submit-btn {
  min-height: 38px;
  padding: 0.38rem 0.9rem;
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
  border: 1px solid rgba(12, 94, 200, 0.28);
}

.mobile-entry__group {
  display: grid;
  gap: 0.45rem;
}

.mobile-entry__group-head {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.mobile-entry__choices {
  display: grid;
  gap: 0.45rem;
}

.mobile-choice {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 0.6rem;
  border: 1px solid rgba(12, 94, 200, 0.18);
  border-radius: 12px;
  background: #eff5ff;
  color: #14365f;
  padding: 0.55rem 0.65rem;
  min-height: 46px;
  cursor: pointer;
}

.mobile-choice input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.mobile-choice__mark {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #0a4ca6;
  color: #cfe3ff;
  font-weight: 800;
}

.mobile-choice__label {
  font-weight: 600;
  line-height: 1.2;
}

.mobile-choice.is-checked {
  background: #e8ffe1;
  border-color: rgba(43, 214, 0, 0.35);
  color: #1f3f14;
}

.mobile-choice.is-checked .mobile-choice__mark {
  background: #2bd600;
  color: #fff;
}

.mobile-entry__totals {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.35rem;
}

.mobile-total {
  display: grid;
  gap: 0.18rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,0.75);
  padding: 0.45rem 0.55rem;
  font-size: 0.86rem;
}

.mobile-total__head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
}

.mobile-total strong {
  color: var(--brand-dark);
}

.mobile-total__names {
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.15;
  opacity: 0.95;
  word-break: break-word;
}

.mobile-entry-hint {
  margin: 0;
  color: var(--muted);
}

.mobile-edit-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: rgba(16, 18, 24, 0.42);
  display: grid;
  align-items: end;
  padding: 0;
}

.mobile-edit-overlay[hidden] {
  display: none !important;
}

.mobile-edit-sheet {
  background: #f8f4ea;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  box-shadow: 0 -12px 40px rgba(0,0,0,0.18);
  max-height: min(88dvh, 88vh);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.mobile-edit-sheet__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.8rem 0.55rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.55);
}

.mobile-edit-sheet__body {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 0.7rem;
  padding: 0.7rem 0.75rem calc(0.75rem + env(safe-area-inset-bottom));
}

.mobile-edit-sheet__actions {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  background: linear-gradient(180deg, rgba(248,244,234,0.85), #f8f4ea 22%);
  padding-top: 0.45rem;
}

.mobile-edit-sheet__actions #mobileEditSaveBtn {
  grid-column: 1 / -1;
}

.mobile-edit-sheet__actions #mobileEditMessage {
  grid-column: 1 / -1;
  margin: 0;
}

body.has-mobile-edit-open {
  overflow: hidden;
}

.survey-matrix {
  min-width: 780px;
}

.admin-readonly-matrix {
  min-width: 100%;
}

.admin-overview-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.9rem;
  margin-bottom: 0.4rem;
}

.admin-overview-controls__filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.admin-overview-controls__reset {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-left: 0.35rem;
  padding-left: 0.6rem;
  border-left: 1px dashed rgba(31, 27, 22, 0.18);
}

.admin-overview-controls button {
  min-height: 34px;
}

.admin-overview-filter-btn.is-active,
.admin-overview-filter-btn.is-active:hover {
  background: #1b67cd;
  color: #f3f9ff;
  border-color: rgba(14, 80, 167, 0.55);
}

.admin-overview-delete-btn {
  margin-left: 0.2rem;
}

.admin-overview-delete-btn.is-active,
.admin-overview-delete-btn.is-active:hover {
  background: #b32727;
  color: #fff;
  border-color: rgba(124, 18, 18, 0.6);
}

.admin-archive-select-check {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #1b67cd;
}

.admin-readonly-matrix .matrix-row {
  grid-template-columns: minmax(var(--admin-name-col-min, 165px), 1.05fr) repeat(var(--matrix-cols, 6), minmax(var(--admin-data-col-min, 92px), 1fr));
}

.admin-readonly-matrix .matrix-row--header .matrix-cell {
  min-height: 88px;
}

.admin-readonly-matrix .matrix-row .matrix-cell--name {
  z-index: 1;
}

.admin-readonly-matrix .matrix-row--header .matrix-cell--name {
  z-index: 2;
}

.admin-readonly-matrix__head-inner {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
}

.admin-readonly-matrix__hide-btn {
  position: absolute;
  top: -2px;
  right: -1px;
  width: 18px;
  height: 18px;
  min-width: 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 0;
  line-height: 1;
  font-size: 0.82rem;
}

.admin-readonly-matrix__hide-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.admin-readonly-matrix__gift-cell {
  justify-content: flex-start;
  align-items: center;
  text-align: left;
  font-size: 0.72rem;
  line-height: 1.15;
  padding: 0.28rem 0.38rem;
  white-space: normal;
  overflow-wrap: anywhere;
}

.admin-readonly-matrix__gift-head .matrix-category-label {
  font-size: 0.74rem;
}

.admin-readonly-matrix--few-cols .matrix-category-label {
  font-size: 0.92rem;
  line-height: 1.12;
  max-height: calc(4 * 1.12em);
}

.admin-readonly-matrix--few-cols .matrix-cell--name {
  font-size: 0.98rem;
}

.admin-readonly-matrix--few-cols .matrix-cell--choice,
.admin-readonly-matrix--few-cols .matrix-cell--total {
  font-size: 1.18rem;
}

.admin-readonly-matrix--few-cols .admin-readonly-matrix__gift-cell {
  font-size: 0.83rem;
}

.admin-readonly-matrix--very-few-cols .matrix-category-label {
  font-size: 1rem;
}

.admin-readonly-matrix--very-few-cols .admin-readonly-matrix__gift-cell {
  font-size: 0.9rem;
}

.matrix-row {
  display: grid;
  grid-template-columns: minmax(165px, 0.95fr) repeat(var(--matrix-cols, 6), minmax(88px, 0.85fr));
}

.matrix-cell {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0.35rem 0.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: #fffdf7;
  min-height: 38px;
}

.matrix-row .matrix-cell:last-child {
  border-right: 0;
}

.matrix-row--header .matrix-cell {
  background: #242a31;
  color: #f3f5f7;
  font-weight: 600;
  align-items: center;
  min-height: 108px;
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
  line-height: 1.15;
}

.matrix-row--header .matrix-cell--category {
  background: linear-gradient(180deg, #2e7fe3, #1b67cd);
  color: #f3f9ff;
  padding-left: 0.3rem;
  padding-right: 0.3rem;
}

.matrix-category-label {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-wrap: balance;
  line-height: 1.15;
  font-size: 0.82rem;
  max-height: calc(4 * 1.15em);
}

.matrix-row--input .matrix-cell {
  min-height: 40px;
}

.matrix-cell--name {
  justify-content: flex-start;
  align-items: center;
  flex-direction: row;
  gap: 0.2rem;
  text-align: left;
  background: linear-gradient(180deg, #2e7fe3, #1b67cd);
  color: #f3f9ff;
  font-size: 0.88rem;
}

.matrix-row .matrix-cell--name {
  position: sticky;
  left: 0;
  z-index: 2;
}

.matrix-row--header .matrix-cell--name {
  z-index: 4;
  background: linear-gradient(180deg, #2e7fe3, #1b67cd);
  color: #f3f9ff;
  font-size: 0.92rem;
}

.matrix-cell--header-name-action {
  justify-content: flex-start !important;
  align-items: flex-start !important;
  flex-direction: column !important;
  gap: 0.12rem;
}

.matrix-cell--header-name-action.is-submit-mode {
  justify-content: center !important;
  align-items: center !important;
  text-align: center !important;
}

.matrix-cell--header-name-action.is-submit-mode > span {
  display: none;
}

.matrix-row--totals .matrix-cell--name {
  z-index: 3;
}

.matrix-cell--input-name {
  background: linear-gradient(180deg, #2a78db, #1962c3);
  padding: 0.2rem 0.35rem;
  justify-content: center;
  align-items: center;
  flex-direction: row;
}

.matrix-cell--input-name input {
  width: 100%;
  min-width: 0;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.98);
  padding: 0.24rem 0.42rem;
  min-height: 28px;
  line-height: 1.1;
}

.matrix-row--header .matrix-cell--name,
.matrix-row--totals .matrix-cell--name {
  justify-content: flex-start;
  align-items: center;
  flex-direction: row;
}

.matrix-inline-submit-btn {
  justify-self: center;
  align-self: center;
  margin-left: auto;
  margin-right: auto;
  min-height: 24px;
  padding: 0.12rem 0.5rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 170, 170, 0.45);
  background: rgba(179, 39, 39, 0.78);
  color: #fff;
  font-size: 0.68rem;
  line-height: 1;
}

.matrix-inline-submit-btn:hover {
  background: rgba(146, 32, 32, 0.9);
}

.matrix-name {
  font-weight: 600;
  line-height: 1.1;
  font-size: 0.95em;
}

.matrix-name--clickable {
  cursor: pointer;
}

.matrix-name--clickable:hover {
  text-decoration: underline;
}

.matrix-name-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  width: 100%;
  min-width: 0;
}

.matrix-name-wrap .matrix-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matrix-cell--edit-name {
  padding: 0.16rem 0.22rem;
}

.matrix-name-edit-wrap {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  width: 100%;
  min-width: 0;
}

.matrix-inline-name-input {
  width: 100%;
  min-width: 0;
  min-height: 24px;
  padding: 0.12rem 0.32rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.98);
  color: #111;
  line-height: 1.05;
}

.matrix-inline-btn {
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 5px;
  width: 22px;
  height: 22px;
  min-width: 22px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 0.74rem;
}

.matrix-inline-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.matrix-inline-btn--save {
  background: rgba(43, 214, 0, 0.22);
  border-color: rgba(43, 214, 0, 0.45);
}

.matrix-inline-btn--danger {
  background: rgba(179, 39, 39, 0.35);
  border-color: rgba(255, 160, 160, 0.35);
}

.matrix-comment-btn {
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 6px;
  width: 22px;
  height: 22px;
  min-width: 22px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 0.72rem;
}

.matrix-comment-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.matrix-edit-btn {
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 6px;
  width: 24px;
  height: 24px;
  min-width: 24px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 0.9rem;
}

.matrix-edit-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.matrix-source {
  font-size: 0.75rem;
  opacity: 0.9;
  padding: 0.15rem 0.35rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
}

.matrix-cell--choice {
  font-size: 1.05rem;
  background: #eff5ff;
  color: #14365f;
  border-bottom-color: rgba(12, 94, 200, 0.14);
  border-right-color: rgba(12, 94, 200, 0.14);
}

.matrix-cell--choice.is-checked {
  background: #e8ffe1;
  color: #1f3f14;
  font-weight: 800;
}

.matrix-cell--input-choice {
  cursor: pointer;
  user-select: none;
  position: relative;
  gap: 0.25rem;
}

.matrix-cell--edit-choice {
  cursor: pointer;
  user-select: none;
  gap: 0.18rem;
}

.matrix-cell--edit-choice input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.matrix-cell--input-choice input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.matrix-cell--input-choice .matrix-input-mark {
  font-weight: 800;
  line-height: 1;
}

.matrix-cell--input-choice:hover,
.matrix-cell--edit-choice:hover {
  background: #e3efff;
}

.matrix-cell--input-choice.is-checked:hover,
.matrix-cell--edit-choice.is-checked:hover {
  background: #dcffd2;
}

.matrix-row--totals .matrix-cell {
  background: #efe2cb;
  font-weight: 700;
}

.matrix-row--totals .matrix-cell--total {
  color: var(--brand-dark);
  font-size: 1.05rem;
}

.image-lightbox {
  display: none !important;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(10, 10, 14, 0.88);
  place-items: center;
  padding: 0;
  cursor: zoom-out;
}

.image-lightbox.is-open {
  display: grid !important;
}

.image-lightbox__stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  overflow: hidden;
  border-radius: 0;
  box-shadow: none;
  background: rgba(255,255,255,0.02);
}

.image-lightbox canvas {
  display: block;
  display: block;
  max-width: 100%;
  max-height: 100%;
  margin: 0 auto;
}

body.has-lightbox-open {
  overflow: hidden;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

.save-feedback-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10020;
  background: rgba(10, 10, 14, 0.8);
  place-items: center;
  padding: 0.8rem;
}

.save-feedback-overlay.is-open {
  display: grid;
}

.save-feedback-overlay[hidden] {
  display: none !important;
}

.save-feedback-overlay__sheet {
  position: relative;
  width: min(100vw - 1.2rem, 1180px);
  height: min(100vh - 1.2rem, 900px);
  border-radius: 18px;
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 15%, rgba(43, 126, 227, 0.22), transparent 45%),
    radial-gradient(circle at 90% 15%, rgba(125, 251, 61, 0.18), transparent 38%),
    #18202a;
  box-shadow: 0 20px 50px rgba(0,0,0,0.35);
}

.save-feedback-overlay__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  background: #0f141b;
}

.save-feedback-overlay__shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8,10,14,0.12), rgba(8,10,14,0.72));
}

.save-feedback-overlay__content {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 0.5rem;
  padding: 0.9rem 1rem calc(1rem + env(safe-area-inset-bottom));
  pointer-events: none;
}

.save-feedback-overlay__text {
  margin: 0;
  color: #fff;
  font-size: clamp(1rem, 1.25vw + 0.9rem, 1.55rem);
  line-height: 1.15;
  font-weight: 700;
  text-shadow: 0 2px 12px rgba(0,0,0,0.45);
  white-space: pre-line;
}

.save-feedback-overlay__text--top {
  align-self: start;
  padding: 0.5rem 0.65rem;
  border-radius: 12px;
  background: rgba(8,10,14,0.48);
}

.save-feedback-overlay__text--bottom {
  align-self: end;
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  background: rgba(8,10,14,0.58);
}

.save-feedback-overlay__text--bottom.is-secondary {
  font-size: clamp(0.95rem, 1.05vw + 0.8rem, 1.3rem);
}

.save-feedback-overlay__actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  align-self: end;
  justify-self: start;
  pointer-events: auto;
}

.save-feedback-overlay__countdown {
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.86rem;
  line-height: 1;
  min-width: 2.6ch;
  text-align: left;
  text-shadow: 0 1px 8px rgba(0,0,0,0.35);
}

.save-feedback-overlay__content .secondary {
  border-color: rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.12);
  color: #fff;
}

.save-feedback-overlay__content .secondary:hover {
  background: rgba(255,255,255,0.2);
}

.save-feedback-overlay__content .secondary:disabled {
  opacity: 0.45;
  cursor: default;
  background: rgba(255,255,255,0.08);
}

body.has-save-feedback-open {
  overflow: hidden;
}

.matrix-cell--empty {
  justify-content: flex-start;
  color: var(--muted);
}

@media (max-width: 700px) {
  #surveySectionTitle {
    display: none;
  }

  .image-lightbox {
    padding: 0;
  }

  .image-lightbox__stage {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }

  .save-feedback-overlay {
    padding: 0;
  }

  .save-feedback-overlay__sheet {
    width: 100vw;
    height: 100dvh;
    max-width: 100vw;
    max-height: 100dvh;
    border-radius: 0;
  }

  .save-feedback-overlay__content {
    gap: 0.4rem;
    padding: 0.7rem 0.7rem calc(2rem + env(safe-area-inset-bottom));
  }

  .save-feedback-overlay__text {
    font-size: clamp(1rem, 2.5vw + 0.75rem, 1.25rem);
  }

  .save-feedback-overlay__text--top,
  .save-feedback-overlay__text--bottom {
    padding: 0.45rem 0.55rem;
    border-radius: 10px;
  }

  .save-feedback-overlay__text--bottom {
    margin-bottom: 0.25rem;
  }

  .save-feedback-overlay__content .secondary {
    margin-bottom: 0.15rem;
    min-height: 38px;
    padding: 0.38rem 0.72rem;
  }

  .save-feedback-overlay__actions {
    gap: 0.4rem;
  }

  .save-feedback-overlay__countdown {
    font-size: 0.8rem;
  }

  .hero {
    padding: 0.54rem 0.45rem 0.34rem;
  }

  .hero__inner--public-design {
    padding: 0.24rem 0.35rem 0.24rem;
    border-radius: 12px;
    min-height: 64px;
    overflow: visible;
  }

  .layout {
    padding: 0.5rem;
    gap: 0.65rem;
  }

  .card {
    padding: 0.65rem;
    border-radius: 12px;
  }

  #mainDesignSection {
    padding: 0.3rem;
  }

  .design-canvas--hero {
    min-height: 58px;
    overflow: visible;
  }

  .design-canvas--public {
    min-height: 120px;
    overflow: visible;
  }

  .design-canvas--hero .design-text-item,
  .design-canvas--public .design-text-item {
    overflow: visible;
  }

  .design-item__zoomhint {
    width: 22px;
    height: 22px;
    right: 4px;
    bottom: 4px;
    font-size: 0.78rem;
  }

  .entry-view-toggle {
    display: inline-flex;
  }

  .mobile-edit-sheet__body {
    padding: 0.55rem 0.55rem calc(0.65rem + env(safe-area-inset-bottom));
  }

  .mobile-edit-sheet__head {
    padding: 0.55rem 0.6rem 0.45rem;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .admin-row {
    grid-template-columns: 1fr;
  }

  .admin-config-top {
    grid-template-columns: 1fr;
    grid-template-areas:
      "title"
      "subtitle"
      "meta";
  }

  .overlay-config-block__head {
    align-items: stretch;
  }

  .overlay-config-block__head button {
    width: 100%;
  }

  .inline-form {
    flex-direction: column;
  }

  .comments-panel__grid {
    grid-template-columns: 1fr;
  }

  .design-canvas--admin {
    width: 100%;
  }

  .entry-actions {
    align-items: stretch;
  }

  .entry-actions button {
    width: 100%;
    font-size: 0.76rem;
    min-height: 34px;
    padding: 0.38rem 0.6rem;
  }

  .entry-line {
    grid-template-columns: 1fr;
  }

  .checkbox-strip {
    grid-auto-columns: minmax(110px, 1fr);
  }

  .matrix-row {
    grid-template-columns: minmax(106px, 0.68fr) repeat(var(--matrix-cols, 6), minmax(80px, 1fr));
  }

  .matrix-cell--name {
    font-size: 0.66rem;
  }

  .matrix-row--header .matrix-cell--category {
    padding-left: 0.12rem !important;
    padding-right: 0.12rem !important;
  }

  .matrix-row--header {
    align-items: stretch !important;
  }

  .matrix-row--header .matrix-cell {
    min-height: 80px !important;
    height: 80px !important;
    max-height: 80px !important;
    align-items: flex-start !important;
    overflow: hidden !important;
    padding-top: 0.22rem !important;
    padding-bottom: 0.32rem !important;
    padding-left: 0.14rem !important;
    padding-right: 0.14rem !important;
  }

  .matrix-row--header .matrix-cell--name {
    padding-top: 0.3rem !important;
    font-size: 0.6rem !important;
    line-height: 1 !important;
  }

  .matrix-row--header .matrix-cell--name.matrix-cell--header-name-action {
    align-items: center !important;
  }

  .matrix-row--header .matrix-cell--name.matrix-cell--header-name-action > span {
    width: 100%;
    text-align: center;
    font-size: 0.66rem;
    font-weight: 700;
    line-height: 1;
  }

  .matrix-category-label {
    font-size: 0.5rem !important;
    line-height: 1.15 !important;
    letter-spacing: -0.01em !important;
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 4 !important;
    line-clamp: 4 !important;
    max-height: calc(4 * 1.15em + 0.28em) !important;
    overflow: hidden !important;
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    text-wrap: unset !important;
    padding-bottom: 0.12em !important;
  }

  .matrix-category-label--forced-break {
    text-align: center;
    font-size: 0.49rem !important;
    line-height: 1.15 !important;
    letter-spacing: -0.015em !important;
    max-height: none !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
    padding-bottom: 0.12em !important;
  }

  .matrix-name {
    font-size: 0.82em;
  }

  .matrix-cell--input-name input {
    font-size: 16px;
    padding: 0.14rem 0.28rem;
    min-height: 22px;
  }

  .matrix-cell--input-name input::placeholder {
    font-size: 0.46rem;
    line-height: 1;
    letter-spacing: -0.01em;
    color: rgba(92, 84, 73, 0.75);
  }

  .matrix-row--totals .matrix-cell--name {
    font-size: 0.46rem !important;
  }

  .matrix-row--totals .matrix-cell--total {
    font-size: 0.62rem !important;
    line-height: 1;
  }

  #entryFormMobile > .entry-actions > button[type="submit"] {
    font-size: 0.68rem;
    min-height: 30px;
    padding: 0.28rem 0.5rem;
  }

  #entryForm > .entry-actions > button[type="submit"] {
    font-size: 0.68rem;
    min-height: 30px;
    padding: 0.28rem 0.5rem;
  }

  .survey-matrix {
    min-width: 820px;
  }

  #entryFormMobile input[type="text"],
  #entryFormMobile textarea,
  #mobileEditForm input[type="text"] {
    font-size: 16px !important;
  }

  .matrix-wrap {
    position: relative;
  }

  .matrix-wrap::after {
    content: "";
    position: sticky;
    right: 0;
    top: 0;
    float: right;
    width: 22px;
    height: 100%;
    pointer-events: none;
    background: linear-gradient(90deg, rgba(251,247,238,0), rgba(251,247,238,0.98));
  }

  .matrix-comment-btn,
  .matrix-edit-btn {
    display: none !important;
  }

  .matrix-name-wrap {
    justify-content: flex-start;
  }
}
