:root {
  --bg: #f4f4f4;
  --surface: #ffffff;
  --surface-2: #f8f8f8;
  --text: #161616;
  --muted: #525252;
  --border: #c6c6c6;
  --border-soft: #e0e0e0;
  --accent: #0f62fe;
  --accent-hover: #0353e9;
  --danger: #da1e28;
  --warning: #f1c21b;
  --success: #24a148;
  --focus: #0f62fe;
  font-family: "IBM Plex Sans", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  letter-spacing: 0;
}

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

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(360px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 24px;
  display: grid;
  gap: 16px;
}

.login-panel .brand {
  min-width: 0;
  font-size: 18px;
}

.login-panel label {
  display: grid;
  gap: 8px;
}

.login-panel input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  padding: 0 10px;
  background: var(--surface-2);
  color: var(--text);
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
}
.login-panel .check-row {
  display: inline-flex;
}
.check-row input {
  width: 16px;
  height: 16px;
  min-height: 0;
  padding: 0;
}

.login-error {
  color: var(--danger);
  font-size: 13px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 48px 1fr;
}

.topbar {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: #262626;
  color: #f4f4f4;
}

.brand {
  font-weight: 600;
  min-width: 96px;
}

.topbar .spacer { flex: 1; }
.status-chip {
  border: 1px solid #6f6f6f;
  color: #f4f4f4;
  padding: 3px 8px;
  font-size: 12px;
}
.stay-wait {
  color: var(--text);
  background: var(--warning);
  border-color: var(--warning);
}
.media-wait {
  color: var(--text);
  background: #ff832b;
  border-color: #ff832b;
}

.btn {
  min-height: 32px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 0 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.btn:hover { border-color: #8d8d8d; }
.btn:disabled {
  cursor: not-allowed;
  color: #8d8d8d;
  background: #f4f4f4;
  border-color: var(--border-soft);
}
.btn.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.btn.primary:hover { background: var(--accent-hover); }
.btn.primary:disabled {
  color: #8d8d8d;
  background: #f4f4f4;
  border-color: var(--border-soft);
}
.btn.ghost {
  background: transparent;
  color: inherit;
  border-color: transparent;
}
.btn.ghost.active-top {
  background: #393939;
}
.btn.icon {
  width: 32px;
  padding: 0;
  justify-content: center;
}
.btn.mini {
  min-height: 26px;
  min-width: 28px;
  padding: 0 7px;
  justify-content: center;
  font-size: 12px;
}
.btn:focus, .cell-input:focus, .script-textarea:focus {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.main-grid {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 360px;
  min-height: calc(100vh - 48px);
}

.sidebar, .script-panel {
  background: var(--surface);
  border-right: 1px solid var(--border-soft);
  min-width: 0;
}
.script-panel {
  border-right: 0;
  border-left: 1px solid var(--border-soft);
}

.panel-head {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  border-bottom: 1px solid var(--border-soft);
  font-weight: 600;
}

.project-list, .qnav {
  overflow: auto;
  max-height: calc(100vh - 136px);
}

.project-row, .qnav-row {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
}
.project-row:hover, .qnav-row:hover { background: var(--surface-2); }
.project-row.active, .qnav-row.active {
  border-left: 4px solid var(--accent);
  padding-left: 8px;
  background: #edf5ff;
}
.project-row.prev-project {
  box-shadow: inset 0 0 0 2px #f1c21b;
}
.project-title, .qnav-title { font-weight: 600; }
.project-meta, .qnav-meta { color: var(--muted); font-size: 12px; }
.project-status {
  display: inline-flex;
  align-items: center;
  min-width: 42px;
  justify-content: center;
  margin-right: 6px;
  padding: 1px 5px;
  color: #fff;
  background: #525252;
  font-size: 11px;
  font-weight: 500;
}
.status-10, .status-3, .status-live { background: #198038; }
.status-1, .status-test { background: #0f62fe; }
.status-2, .status-9 { background: #da1e28; }
.status-4, .status-5, .status-6, .status-7 { background: #6f6f6f; }
.project-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.workbench {
  min-width: 0;
  display: grid;
  grid-template-rows: 44px 1fr;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface);
  min-width: 0;
}
.segmented {
  display: inline-flex;
  border: 1px solid var(--border);
  height: 32px;
}
.segmented button {
  border: 0;
  border-right: 1px solid var(--border);
  background: var(--surface);
  padding: 0 14px;
  cursor: pointer;
}
.segmented button:last-child { border-right: 0; }
.segmented button.active {
  background: #393939;
  color: #fff;
}

.grid-wrap {
  overflow: auto;
  background: var(--surface);
  position: relative;
}

.hidden-file {
  display: none;
}

.project-editor {
  overflow: auto;
  background: var(--surface);
  padding: 14px 16px 40px;
}

.users-wrap {
  min-width: 0;
  overflow: auto;
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(280px, 360px);
  gap: 16px;
  align-items: start;
}

.admin-user-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border-soft);
}
.admin-user-table th,
.admin-user-table td {
  border-bottom: 1px solid var(--border-soft);
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
}
.admin-user-table th {
  background: var(--surface-2);
  font-weight: 600;
}
.admin-user-table tr {
  cursor: pointer;
}
.admin-user-table tr:hover,
.admin-user-table tr.active {
  background: #edf5ff;
}
.admin-user-form {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  padding: 12px;
  display: grid;
  gap: 12px;
}

.project-section-title {
  height: 32px;
  display: flex;
  align-items: center;
  margin-top: 10px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-soft);
  font-weight: 600;
}

.project-form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 8px;
}

.field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.field span {
  color: var(--muted);
  font-size: 12px;
}

.field input {
  width: 100%;
  min-height: 32px;
  border: 1px solid var(--border);
  padding: 5px 8px;
  background: #fff;
}
.field select {
  width: 100%;
  min-height: 32px;
  border: 1px solid var(--border);
  padding: 5px 8px;
  background: #fff;
}

.group-grid {
  display: grid;
  gap: 8px;
}

.group-row {
  display: grid;
  grid-template-columns: 34px repeat(7, minmax(120px, 1fr));
  gap: 8px;
  align-items: end;
}

.group-label {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #393939;
  color: #fff;
  font-weight: 600;
}

.sheet {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
}
.sheet th, .sheet td {
  border-right: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
}
.sheet th {
  position: sticky;
  top: 0;
  z-index: 3;
  height: 30px;
  background: #e0e0e0;
  color: #393939;
  font-size: 12px;
  font-weight: 600;
}
.sheet .row-head {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 52px;
  min-width: 52px;
  text-align: right;
  padding: 6px 8px;
  background: #f4f4f4;
  color: var(--muted);
  font-size: 12px;
}
.sheet th.row-head { z-index: 4; }
.sheet td {
  min-width: 90px;
  max-width: 360px;
  height: 30px;
  background: #fff;
}
.sheet td.wide { min-width: 340px; }
.sheet td.medium { min-width: 160px; }
.sheet tr.selected td { background: #edf5ff; }
.sheet tr.has-error td { background: #fff1f1; }
.sheet tr.has-warning td { background: #fff8e1; }
.sheet tr.has-info td { background: #edf5ff; }
.sheet td.has-cell-error {
  background: #ffd7d9;
  box-shadow: inset 0 0 0 1px #da1e28;
}
.sheet td.has-cell-warning {
  background: #fff4ce;
  box-shadow: inset 0 0 0 1px #f1c21b;
}
.sheet td.has-cell-info {
  background: #e5f6ff;
  box-shadow: inset 0 0 0 1px #0f62fe;
}
.sheet td.has-source-error {
  background: #fff1f1;
  box-shadow: inset 0 0 0 1px #da1e28, inset 3px 0 0 #da1e28;
}
.sheet td.has-source-cell:not(.has-source-error):not(.has-source-formula):not(.has-cell-error):not(.has-cell-warning):not(.has-cell-info) {
  box-shadow: inset 0 -1px 0 #a8a8a8;
}
.sheet td.has-source-formula:not(.has-source-error):not(.has-cell-error):not(.has-cell-warning):not(.has-cell-info) {
  box-shadow: inset 0 -2px 0 #8d8d8d;
}
.sheet td.has-source-validation:not(.has-source-error):not(.has-cell-error):not(.has-cell-warning):not(.has-cell-info) {
  box-shadow: inset 0 -1px 0 #0f62fe;
}

.cell-input {
  min-height: 30px;
  width: 100%;
  padding: 6px 7px;
  white-space: pre-wrap;
  word-break: break-word;
}
.cell-input[contenteditable="false"] {
  color: var(--muted);
  background: #f8f8f8;
}
.cell-select {
  border: 0;
  border-radius: 0;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.script-stats {
  min-height: 28px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: 12px;
}
.script-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  height: calc(100vh - 120px);
}
.script-editor {
  min-width: 0;
  display: grid;
  grid-template-rows: 32px minmax(0, 1fr);
  border-right: 1px solid var(--border-soft);
}
.script-editor:last-child {
  border-right: 0;
}
.script-editor > span {
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-bottom: 1px solid var(--border-soft);
  color: #525252;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}
.script-textarea {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  padding: 12px;
  resize: none;
  background: #fff;
  color: #161616;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
}

.analysis-wrap {
  overflow: auto;
  background: var(--surface);
  padding: 14px 16px 40px;
}

.analysis-main {
  min-width: 720px;
}

.analysis-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
}

.analysis-key {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.analysis-title {
  font-weight: 600;
  line-height: 1.45;
}

.analysis-summary {
  display: flex;
  gap: 8px;
}

.analysis-summary div {
  min-width: 96px;
  border-left: 1px solid var(--border-soft);
  padding-left: 12px;
}

.analysis-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.analysis-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.analysis-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 12px;
  background: #fff;
}

.analysis-table th,
.analysis-table td {
  border-right: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  padding: 7px 8px;
  text-align: left;
  vertical-align: top;
}

.analysis-table th {
  background: #e0e0e0;
  color: #393939;
  font-size: 12px;
  font-weight: 600;
}

.analysis-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.analysis-table.compact {
  max-width: 360px;
}

.analysis-index tr {
  cursor: pointer;
}

.analysis-index tr:hover td {
  background: var(--surface-2);
}

.analysis-index tr.active td {
  background: #edf5ff;
}

.empty-state {
  padding: 20px 0;
  color: var(--muted);
}

.survey-shell {
  max-width: 1180px;
  margin: 0 auto;
  min-height: 100vh;
  background: #fff;
  border-left: 1px solid var(--border-soft);
  border-right: 1px solid var(--border-soft);
}
.survey-head {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 16px;
  background: #fff;
  border-bottom: 1px solid var(--border-soft);
}
.survey-view {
  height: 30px;
}
.survey-view button {
  padding: 0 10px;
}
.survey-layout {
  display: grid;
  grid-template-columns: 188px minmax(0, 1fr);
  align-items: start;
}
.survey-nav {
  position: sticky;
  top: 52px;
  max-height: calc(100vh - 52px);
  overflow: auto;
  border-right: 1px solid var(--border-soft);
  background: #fff;
}
.survey-nav-head {
  height: 36px;
  padding: 10px 12px 0;
  color: var(--muted);
  font-size: 12px;
}
.survey-nav-list {
  padding: 0 0 12px;
}
.survey-nav-row {
  display: grid;
  grid-template-columns: minmax(38px, auto) minmax(0, 1fr);
  gap: 6px;
  width: 100%;
  min-height: 34px;
  padding: 6px 10px 6px 12px;
  border: 0;
  border-left: 3px solid transparent;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.survey-nav-row:hover {
  background: var(--surface);
}
.survey-nav-row.active {
  border-left-color: var(--accent);
  background: #edf5ff;
}
.survey-nav-key {
  font-weight: 600;
  font-size: 12px;
}
.survey-nav-text {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.survey-body { padding: 18px 16px 96px; }
.question {
  scroll-margin-top: 64px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border-soft);
}
.question-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  line-height: 1.5;
}
.mix-table-group {
  scroll-margin-top: 64px;
  margin: 18px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.mix-table-row {
  display: grid;
  grid-template-columns: minmax(160px, var(--mix-label-width, 20%)) 1fr;
  border-top: 1px solid var(--border-soft);
}
.mix-table-row:first-child {
  border-top: 0;
}
.mix-question-cell {
  padding: 14px 12px;
  border-right: 1px solid var(--border-soft);
  background: #f4f4f4;
}
.mix-answer-cell {
  min-width: 0;
  padding: 12px 14px;
}
.mix-table-row .question-title {
  margin-bottom: 0;
  font-size: 14px;
}
.validation-issues {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-left: 4px solid var(--danger);
  background: #fff1f1;
  color: #a2191f;
  font-size: 13px;
  line-height: 1.45;
}
.emphasis_redB { color: #da1e28; font-weight: 600; }
.emphasis_blueB { color: #0f62fe; font-weight: 600; }
.emphasis_blackB { color: #161616; font-weight: 600; }
.option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 32px;
  padding: 5px 0;
}
.single-select,
.single-search {
  width: 100%;
  max-width: 520px;
}
.single-popup {
  position: relative;
  width: min(100%, 520px);
}
.single-popup-trigger {
  width: 100%;
  justify-content: space-between;
}
.single-popup-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}
.single-popup-option {
  width: 100%;
  min-height: 32px;
  border: 0;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  padding: 7px 10px;
  cursor: pointer;
}
.single-popup-option:hover,
.single-popup-option.active {
  background: #edf5ff;
}
.single-popup-option:last-child {
  border-bottom: 0;
}
.scale-single-grid {
  display: grid;
  grid-template-columns: repeat(var(--scale-cols, 5), minmax(76px, 1fr));
  max-width: 860px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-right: 0;
  border-bottom: 0;
}
.scale-step {
  min-width: 0;
  min-height: 86px;
  display: grid;
  grid-template-rows: minmax(34px, 1fr) 18px 24px;
  align-items: center;
  justify-items: center;
  gap: 4px;
  padding: 8px 6px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: #ffffff;
  text-align: center;
  cursor: pointer;
}
.scale-step:hover,
.scale-step:focus-within {
  box-shadow: inset 0 0 0 2px var(--focus);
}
.scale-step input {
  margin: 0;
}
.scale-label {
  width: 100%;
  min-width: 0;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.scale-number {
  color: var(--muted);
  font-size: 12px;
}
.scale-gradation-0 { background: #f3f3f3; }
.scale-gradation-1 { background: #f5fafe; }
.scale-gradation-2 { background: #e3eefb; }
.scale-gradation-3 { background: #d0e2f9; }
.scale-gradation-4 { background: #bed7f5; }
.scale-gradation-5 { background: #abccf3; }
.scale-gradation-6 { background: #99c0f0; }
.scale-gradation-7 { background: #86b5ee; }
.scale-gradation-8 { background: #74a9eb; }
.scale-gradation-9 { background: #619ee9; }
.scale-gradation-10 { background: #4f93e6; }
.scale-gradation-11 { background: #2d7ee1; }
.scale-gradation-12 { background: #1e70d5; }
.bpto-table {
  display: grid;
  width: min(100%, 760px);
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  background: var(--surface);
}
.bpto-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 72px;
  min-height: 36px;
  color: var(--text);
}
.bpto-row:hover .bpto-cell,
.bpto-row:focus-within .bpto-cell {
  background: #edf5ff;
}
.bpto-head .bpto-cell {
  min-height: 28px;
  background: #f4f4f4;
}
.bpto-cell {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 8px 10px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.bpto-choice-cell {
  justify-content: center;
}
.single-search-wrap {
  position: relative;
  width: min(100%, 560px);
}
.single-search-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  align-items: stretch;
}
.single-search-row > .single-search {
  max-width: none;
}
.single-search-button {
  min-width: 64px;
  border: 1px solid var(--border);
  border-left: 0;
  background: #f4f4f4;
  color: var(--text);
  font-weight: 600;
}
.single-search-list {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}
.single-search-list[hidden] {
  display: none;
}
.single-search-option {
  width: 100%;
  min-height: 34px;
  border: 0;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  padding: 7px 10px;
  cursor: pointer;
}
.single-search-option:hover,
.single-search-option.active {
  background: #edf5ff;
}
.single-search-option:last-child {
  border-bottom: 0;
}
.multi-search-wrap {
  max-width: 680px;
}
.multi-search-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  align-items: stretch;
  margin-bottom: 8px;
}
.multi-search {
  width: 100%;
}
.multi-search-button {
  min-width: 64px;
  border: 1px solid var(--border);
  border-left: 0;
  background: #f4f4f4;
  color: var(--text);
  font-weight: 600;
}
.multi-search-list {
  display: grid;
  gap: 2px;
}
.multi-search-option[hidden] {
  display: none;
}
.rank-search-wrap {
  max-width: 680px;
}
.rank-search-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  align-items: stretch;
  margin-bottom: 8px;
}
.rank-search {
  width: 100%;
}
.rank-search-button {
  min-width: 64px;
  border: 1px solid var(--border);
  border-left: 0;
  background: #f4f4f4;
  color: var(--text);
  font-weight: 600;
}
.rank-slot-list {
  display: grid;
  gap: 6px;
}
.rank-slot-row {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}
.rank-slot-label {
  font-size: 13px;
  color: var(--muted);
}
.rank-image-grid {
  align-items: stretch;
}
.rank-image-choice {
  grid-template-columns: minmax(0, 1fr);
}
.rank-image-select {
  width: 100%;
  margin-top: 8px;
}
.numeric-unit-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  max-width: 520px;
}
.numeric-unit-field .number-field {
  max-width: none;
  border-right: 0;
}
.numeric-unit {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--border);
  background: #f4f4f4;
  color: var(--muted);
  white-space: nowrap;
}
.image-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 8px;
  max-width: 860px;
}
.image-choice {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  min-height: 42px;
  padding: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.image-choice input {
  margin-top: 3px;
}
.image-choice-content {
  min-width: 0;
  line-height: 1.4;
}
.image-choice-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin-bottom: 6px;
}
.image-map-wrap {
  display: grid;
  gap: 10px;
  max-width: 900px;
}
.image-map-visual {
  position: relative;
  width: fit-content;
  max-width: 100%;
  border: 1px solid var(--border);
  background: #fff;
}
.image-map-visual img {
  display: block;
  max-width: 100%;
  height: auto;
}
.image-map-visual area {
  cursor: pointer;
}
.image-map-option-list {
  max-width: 900px;
}
.image-map-rank-overlays {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.image-map-rank-overlay {
  position: absolute;
  min-width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  border-radius: 9px;
  background: #c03b2b;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.8);
}
.media-question .question-title {
  margin-bottom: 10px;
}
.media-frame {
  max-width: 860px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.media-frame video,
.media-frame audio,
.media-frame img {
  display: block;
  width: 100%;
}
.media-frame video {
  max-height: 480px;
  background: #000;
}
.media-frame audio {
  min-height: 42px;
}
.media-image-frame {
  width: fit-content;
  max-width: 860px;
}
.media-image-frame img {
  max-width: 100%;
  height: auto;
}
.media-link {
  display: inline-flex;
  max-width: 860px;
  min-height: 36px;
  align-items: center;
  padding: 7px 10px;
  border: 1px solid var(--border);
  color: var(--accent);
  overflow-wrap: anywhere;
}
.numeric-grid,
.numeric-total-grid {
  display: grid;
  gap: 6px;
  max-width: 720px;
}
.numeric-row,
.numeric-total-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(120px, 180px);
  gap: 10px;
  align-items: center;
  min-height: 36px;
}
.numeric-label {
  min-width: 0;
  line-height: 1.4;
}
.numeric-total-non {
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
.numeric-total-summary {
  color: var(--muted);
}
.numeric-total-readonly {
  background: var(--panel);
  color: var(--muted);
}
.coding-open-grid, .text-open-grid, .text-single-grid, .phone-open-grid, .custom-field-grid {
  display: grid;
  gap: 8px;
  max-width: 820px;
}
.coding-open-row, .text-open-row, .text-single-row, .phone-open-row, .custom-field-row {
  display: grid;
  grid-template-columns: minmax(160px, 240px) minmax(220px, 1fr);
  gap: 10px;
  align-items: start;
}
.coding-open-label, .text-open-label, .text-single-label, .phone-open-label, .custom-field-label {
  min-width: 0;
  padding-top: 7px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.coding-open-field, .text-open-field, .custom-field-input {
  min-height: 56px;
}
.text-open-non-row, .text-single-special-row {
  align-items: center;
}
.text-open-non-row .text-open-label, .text-single-special-row .text-single-label {
  padding-top: 0;
}
.text-single-field, .phone-open-field {
  max-width: 260px;
}
.slider-control {
  --slider-width: 520px;
  display: grid;
  grid-template-columns: minmax(160px, var(--slider-width)) minmax(88px, auto);
  gap: 10px;
  align-items: center;
  width: 100%;
  max-width: calc(var(--slider-width) + 132px);
}
.slider-range-wrap {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.slider-range {
  width: 100%;
  min-width: 0;
  accent-color: var(--accent);
}
.slider-ticks {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
}
.slider-number-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.slider-number {
  max-width: none;
}
.slider-unit {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.geolocation-grid {
  display: grid;
  max-width: 760px;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}
.geo-row {
  display: grid;
  grid-template-columns: minmax(120px, 160px) minmax(220px, 1fr);
  min-height: 42px;
}
.geo-label,
.geo-inputs,
.geo-row > textarea {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.geo-label {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  background: #f4f4f4;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
}
.geo-inputs {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 5px 8px;
}
.geo-inputs .text-field,
.geo-row > textarea {
  max-width: none;
  border: 0;
}
.geo-row > textarea {
  min-height: 58px;
  resize: vertical;
}
.address-grid {
  display: grid;
  max-width: 760px;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}
.address-row {
  display: grid;
  grid-template-columns: minmax(120px, 160px) minmax(220px, 1fr);
  min-height: 42px;
}
.address-label,
.address-row > .text-field,
.address-search-cell,
.address-search-results {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.address-label {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  background: #f4f4f4;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
}
.address-row > .text-field {
  max-width: none;
  border-top: 0;
  border-left: 0;
}
.address-search-cell {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  align-items: stretch;
}
.address-search-cell > .text-field {
  max-width: none;
  border: 0;
}
.address-search-button {
  min-width: 64px;
  border: 0;
  border-left: 1px solid var(--border);
  background: #f4f4f4;
  color: var(--text);
  font-weight: 600;
}
.address-search-button:disabled {
  color: var(--muted);
}
.address-search-results {
  grid-column: 1 / -1;
  display: grid;
  gap: 0;
  background: #fff;
}
.address-search-results[hidden] {
  display: none;
}
.address-candidate {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(120px, auto);
  gap: 12px;
  align-items: center;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: #fff;
  text-align: left;
}
.address-candidate:last-child {
  border-bottom: 0;
}
.address-candidate:hover,
.address-candidate:focus {
  background: #eef5ff;
}
.address-candidate-main {
  color: var(--text);
}
.address-candidate-meta {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}
.upload-grid {
  display: grid;
  max-width: 760px;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}
.upload-row {
  display: grid;
  grid-template-columns: minmax(120px, 160px) minmax(260px, 1fr);
  min-height: 42px;
}
.upload-label,
.upload-inputs {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.upload-label {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  background: #f4f4f4;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
}
.upload-inputs {
  display: grid;
  grid-template-columns: minmax(160px, auto) minmax(120px, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 6px 8px;
}
.file-field {
  width: 100%;
  min-width: 0;
  font: inherit;
  color: var(--text);
}
.upload-name {
  display: grid;
  gap: 2px;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  line-height: 1.35;
}
.upload-download {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.upload-download:hover {
  text-decoration: underline;
}
.upload-file-meta {
  color: var(--muted);
  font-size: 12px;
}
.type97-upload-grid {
  display: grid;
  max-width: 760px;
  gap: 8px;
}
.type97-upload-special {
  background: var(--surface-muted);
}
.maxdiff-grid {
  display: grid;
  max-width: 760px;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}
.maxdiff-head,
.maxdiff-row {
  display: grid;
  grid-template-columns: 56px minmax(180px, 1fr) 56px;
  min-height: 36px;
}
.maxdiff-head {
  background: #f4f4f4;
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
}
.maxdiff-head span,
.maxdiff-choice,
.maxdiff-label {
  display: flex;
  align-items: center;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.maxdiff-head span,
.maxdiff-choice {
  justify-content: center;
}
.maxdiff-label {
  min-width: 0;
  padding: 6px 10px;
  line-height: 1.4;
}
.sidebyside-grid {
  display: grid;
  max-width: 900px;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}
.sidebyside-head,
.sidebyside-row {
  display: grid;
  grid-template-columns: minmax(132px, 180px) minmax(180px, 1fr) minmax(132px, 180px);
  min-height: 40px;
}
.sidebyside-head {
  background: #f4f4f4;
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
}
.sidebyside-head span,
.sidebyside-row > select,
.sidebyside-cell,
.sidebyside-label {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.sidebyside-head span {
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebyside-row > select {
  max-width: none;
  min-height: 40px;
  border-top: 0;
  border-left: 0;
}
.sidebyside-label {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 6px 10px;
  line-height: 1.4;
}
.sidebyside-cell {
  min-width: 0;
  padding: 6px 8px;
}
.sidebyside-options {
  display: grid;
  gap: 4px;
}
.sidebyside-option {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  min-height: 26px;
  line-height: 1.35;
}
.sidebyside-slot {
  max-width: none;
  margin-bottom: 6px;
}
.sidebyside-slot:last-child {
  margin-bottom: 0;
}
[data-step-index][hidden] {
  display: none !important;
}
.option-step-list {
  display: grid;
  gap: 2px;
}
.option-step-row {
  min-width: 0;
}
.option-step-row > .image-choice {
  height: 100%;
}
.step-next-wrap {
  max-width: 900px;
  margin-top: 8px;
}
.matrixsingle-grid {
  display: grid;
  max-width: 760px;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}
.matrixsingle-head,
.matrixsingle-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(132px, 220px);
  min-height: 40px;
}
.matrixsingle-head {
  background: #f4f4f4;
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
}
.matrixsingle-head span,
.matrixsingle-label,
.matrixsingle-row > select {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.matrixsingle-head span {
  display: flex;
  align-items: center;
  justify-content: center;
}
.matrixsingle-label {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 6px 10px;
  line-height: 1.4;
}
.matrixsingle-row > select {
  max-width: none;
  min-height: 40px;
  border-top: 0;
  border-left: 0;
}
.matrixmulti-grid {
  display: grid;
  max-width: 860px;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}
.matrixmulti-head,
.matrixmulti-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.4fr);
  min-height: 40px;
}
.matrixmulti-head {
  background: #f4f4f4;
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
}
.matrixmulti-head span,
.matrixmulti-label,
.matrixmulti-cell {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.matrixmulti-head span {
  display: flex;
  align-items: center;
  justify-content: center;
}
.matrixmulti-label {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 6px 10px;
  line-height: 1.4;
}
.matrixmulti-cell {
  min-width: 0;
  padding: 6px 8px;
}
.matrixmulti-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 4px 10px;
}
.matrixmulti-option {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  min-height: 26px;
  line-height: 1.35;
}
.matrixmulti-slot {
  max-width: none;
  margin-bottom: 6px;
}
.matrixmulti-slot:last-child {
  margin-bottom: 0;
}
.matrixslider-shell {
  display: grid;
  gap: 12px;
  max-width: 900px;
}
.matrixslider-shell-media {
  max-width: 960px;
}
.matrixslider-track {
  display: grid;
  gap: 8px;
  max-width: 900px;
  overflow-x: auto;
}
.matrixslider-grid {
  display: grid;
  width: 100%;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}
.matrixslider-media {
  max-width: 860px;
}
.matrixslider-media .media-frame {
  max-width: none;
}
.matrixslider-video-panel {
  padding: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.matrixslider-video-panel .media-frame {
  border: 0;
  background: #000;
}
.matrixslider-head,
.matrixslider-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(260px, 1.2fr);
  min-height: 44px;
}
.matrixslider-head {
  background: #f4f4f4;
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
}
.matrixslider-head span,
.matrixslider-label,
.matrixslider-row > .slider-control {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.matrixslider-head span {
  display: flex;
  align-items: center;
  justify-content: center;
}
.matrixslider-label {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 6px 10px;
  line-height: 1.4;
}
.matrixslider-row > .slider-control {
  max-width: none;
  min-height: 44px;
  padding: 5px 8px;
}
.matrixnumeric-grid {
  display: grid;
  max-width: 980px;
  overflow-x: auto;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}
.matrixnumeric-head,
.matrixnumeric-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) repeat(var(--matrixnumeric-cols), minmax(110px, 150px));
  min-width: max-content;
  min-height: 40px;
}
.matrixnumeric-head {
  background: #f4f4f4;
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
}
.matrixnumeric-head span,
.matrixnumeric-label,
.matrixnumeric-input {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.matrixnumeric-head span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 6px 8px;
  line-height: 1.3;
}
.matrixnumeric-label {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 6px 10px;
  line-height: 1.4;
}
.matrixnumeric-input {
  width: 100%;
  max-width: none;
  min-height: 40px;
  border-top: 0;
  border-left: 0;
}
.text-field, .number-field {
  width: 100%;
  max-width: 520px;
  min-height: 34px;
  border: 1px solid var(--border);
  padding: 6px 8px;
}
.survey-actions {
  position: sticky;
  bottom: 0;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  background: #fff;
  border-top: 1px solid var(--border-soft);
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: #262626;
  color: #fff;
  padding: 10px 12px;
  min-width: 220px;
  z-index: 20;
}

.hidden { display: none !important; }

@media (max-width: 980px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
  .sidebar, .script-panel {
    display: none;
  }
  .toolbar {
    overflow-x: auto;
  }
	  .script-grid {
	    grid-template-columns: 1fr;
	  }
	  .users-wrap,
	  .project-form-grid,
  .group-row,
  .numeric-row,
  .numeric-total-row,
  .address-row,
  .geo-row,
  .sidebyside-head,
  .sidebyside-row,
  .matrixsingle-head,
  .matrixsingle-row,
  .matrixmulti-head,
  .matrixmulti-row,
  .matrixslider-head,
  .matrixslider-row,
  .matrixnumeric-head,
  .matrixnumeric-row {
    grid-template-columns: 1fr;
    min-width: 0;
  }
  .slider-control {
    grid-template-columns: 1fr;
  }
  .geo-inputs {
    grid-template-columns: 1fr;
  }
  .address-search-cell {
    grid-template-columns: 1fr;
  }
  .address-search-button {
    min-height: 36px;
    border-left: 0;
    border-top: 1px solid var(--border);
  }
  .address-candidate {
    grid-template-columns: 1fr;
  }
  .address-candidate-meta {
    text-align: left;
  }
  .single-search-row {
    grid-template-columns: 1fr;
  }
  .single-search-button {
    min-height: 36px;
    border-left: 1px solid var(--border);
    border-top: 0;
  }
  .multi-search-row,
  .rank-search-row {
    grid-template-columns: 1fr;
  }
  .multi-search-button,
  .rank-search-button {
    min-height: 36px;
    border-left: 1px solid var(--border);
    border-top: 0;
  }
}

@media (max-width: 760px) {
  .survey-shell {
    max-width: none;
    border-left: 0;
    border-right: 0;
  }
  .survey-layout {
    display: block;
  }
  .survey-nav {
    top: 52px;
    z-index: 3;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--border-soft);
  }
  .survey-nav-head {
    display: none;
  }
  .survey-nav-list {
    display: flex;
    padding: 0;
  }
  .survey-nav-row {
    grid-template-columns: 1fr;
    min-width: 92px;
    border-left: 0;
    border-bottom: 3px solid transparent;
  }
  .survey-nav-row.active {
    border-bottom-color: var(--accent);
  }
  .survey-nav-text {
    display: none;
  }
}
