:root {
  --phi-orange: #ec7206;
  --phi-blue: #132f52;
  --phi-ink: #182239;
  --phi-muted: #647084;
  --phi-line: #dfe5ee;
  --phi-soft: #f6f8fb;
  --phi-white: #ffffff;
  --danger: #b42318;
  --success: #0f7b45;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--phi-ink);
  background: linear-gradient(180deg, #ffffff 0%, #f6f8fb 100%);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  line-height: 1.45;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 28px;
  border-bottom: 1px solid rgba(19, 47, 82, 0.12);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.brand-title {
  display: grid;
  gap: 1px;
}

.brand-title strong {
  font-size: 16px;
}

.brand-title span,
.eyebrow,
.field-note {
  color: var(--phi-muted);
  font-size: 12px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex: 1;
}

.topbar-spacer {
  flex: 1 1 auto;
  min-width: 24px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  min-height: calc(100vh - 71px);
}

.sidebar {
  position: sticky;
  top: 71px;
  height: calc(100vh - 71px);
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-right: 1px solid rgba(19, 47, 82, 0.12);
  background: #ffffff;
  padding: 22px;
}

.sidebar-toggle {
  flex: 0 0 auto;
  min-width: 38px;
}

.layout.sidebar-collapsed {
  grid-template-columns: 72px minmax(0, 1fr);
}

.layout.sidebar-collapsed .sidebar {
  padding: 14px 8px;
  overflow-x: hidden;
}

.layout.sidebar-collapsed .sidebar .section-header {
  justify-content: center;
  margin-bottom: 12px;
}

.layout.sidebar-collapsed .sidebar .section-header > div,
.layout.sidebar-collapsed .form-list-title small,
.layout.sidebar-collapsed .status-row {
  display: none;
}

.layout.sidebar-collapsed .form-list-item {
  justify-items: center;
  min-height: 48px;
  padding: 10px 8px;
}

.layout.sidebar-collapsed .form-list-title span {
  display: block;
  width: 36px;
  overflow: hidden;
  text-align: center;
  text-overflow: clip;
  white-space: nowrap;
}

.workspace {
  padding: 26px;
}

.stack {
  display: grid;
  gap: 16px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.editor-header {
  position: sticky;
  top: 72px;
  z-index: 8;
  padding: 14px 0;
  background: rgba(246, 248, 251, 0.96);
  backdrop-filter: blur(12px);
}

.section-header h1,
.section-header h2,
.section-header h3,
.public-card h1,
.thank-you h1 {
  margin: 0;
  line-height: 1.05;
}

.section-header h1,
.public-card h1 {
  font-size: clamp(30px, 4vw, 52px);
  max-width: 900px;
}

.section-header p,
.public-card p,
.empty-state p {
  margin: 8px 0 0;
  color: var(--phi-muted);
}

.form-list {
  display: grid;
  gap: 10px;
}

.form-list-item {
  width: 100%;
  text-align: left;
  padding: 14px;
  border: 1px solid var(--phi-line);
  border-radius: 8px;
  background: #fff;
  color: var(--phi-ink);
  display: grid;
  gap: 6px;
}

.form-list-item.active {
  border-color: var(--phi-orange);
  box-shadow: inset 4px 0 0 var(--phi-orange);
}

.form-list-item strong {
  font-size: 15px;
}

.form-list-title {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.form-list-title small {
  color: var(--phi-muted);
  font-size: 13px;
  font-weight: 700;
}

.status-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 8px;
  background: #eef4fb;
  color: var(--phi-blue);
  font-size: 12px;
  font-weight: 700;
}

.pill.orange {
  background: #fff0e4;
  color: #a54a00;
}

.pill.green {
  background: #e8f7ef;
  color: var(--success);
}

.user-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 8px;
  background: #f0f4f8;
  color: var(--phi-muted);
  font-size: 12px;
  font-weight: 800;
}

.status-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.status-choice {
  display: grid;
  gap: 4px;
  min-height: 78px;
  padding: 12px;
  border: 1px solid var(--phi-line);
  border-radius: 8px;
  background: #fff;
  color: var(--phi-ink);
  text-align: left;
  cursor: pointer;
}

.status-choice strong {
  font-size: 14px;
}

.status-choice small {
  color: var(--phi-muted);
  font-size: 12px;
  line-height: 1.25;
}

.status-choice.draft {
  background: #f8fafc;
  border-color: #d7dee8;
}

.status-choice.published {
  background: #e8f7ef;
  border-color: #b9e4ca;
}

.status-choice.closed {
  background: #fff0e4;
  border-color: #f4c69b;
}

.status-choice.active {
  box-shadow: inset 0 0 0 2px currentColor;
}

.status-choice.draft.active {
  color: var(--phi-blue);
}

.status-choice.published.active {
  color: var(--success);
}

.status-choice.closed.active {
  color: #a54a00;
}

.panel {
  min-width: 0;
  border: 1px solid rgba(19, 47, 82, 0.13);
  border-radius: 8px;
  background: #fff;
}

.panel-body {
  min-width: 0;
  padding: 18px;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 7px;
}

.field-label-with-help {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
}

.info-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #eef4fb;
  color: var(--phi-blue);
  font-size: 12px;
  font-weight: 900;
  cursor: help;
}

.tooltip-popover {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  width: min(280px, 80vw);
  padding: 10px 12px;
  border: 1px solid var(--phi-line);
  border-radius: 8px;
  background: #fff;
  color: var(--phi-ink);
  box-shadow: 0 12px 34px rgba(19, 47, 82, 0.16);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.info-tooltip:hover .tooltip-popover,
.info-tooltip:focus .tooltip-popover {
  opacity: 1;
  transform: translate(-50%, 0);
}

.field label {
  font-weight: 700;
  font-size: 13px;
}

.input,
.textarea,
.select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cad3df;
  border-radius: 8px;
  background: #fff;
  color: var(--phi-ink);
  padding: 10px 12px;
  outline: 0;
}

.textarea {
  min-height: 92px;
  resize: vertical;
}

.multiline-control {
  min-height: 118px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.input:focus,
.textarea:focus,
.select:focus,
.answer-control:focus {
  border-color: var(--phi-orange);
  box-shadow: 0 0 0 4px rgba(236, 114, 6, 0.12);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--phi-blue);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.button.secondary {
  background: #eef4fb;
  color: var(--phi-blue);
}

.button.orange {
  background: var(--phi-orange);
}

.button.ghost {
  background: transparent;
  color: var(--phi-blue);
  border: 1px solid var(--phi-line);
}

.button.danger {
  background: #fff0ef;
  color: var(--danger);
}

.compact-button {
  min-height: 38px;
  padding: 10px 14px;
  font-size: 14px;
}

.compact-select {
  min-height: 38px;
  min-width: 180px;
  padding: 8px 10px;
  font-size: 14px;
}

.user-admin-form {
  display: grid;
  gap: 18px;
}

.user-organization-fields {
  padding-top: 18px;
  border-top: 1px solid var(--phi-line);
}

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

.user-management-table th:last-child,
.user-management-table td:last-child {
  width: 280px;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.tab {
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff;
  color: var(--phi-blue);
  border: 1px solid var(--phi-line);
  font-weight: 800;
}

.tab.active {
  color: #fff;
  background: var(--phi-blue);
  border-color: var(--phi-blue);
}

.editor-shell {
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.editor-shell.editor-nav-collapsed {
  grid-template-columns: 72px minmax(0, 1fr);
}

.editor-nav {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 12px;
}

.editor-nav-card,
.editor-nav-list {
  border: 1px solid rgba(19, 47, 82, 0.13);
  border-radius: 8px;
  background: #fff;
}

.editor-nav-card {
  display: grid;
  gap: 4px;
  padding: 16px;
}

.editor-nav-toggle {
  justify-self: end;
  min-width: 38px;
}

.editor-nav-collapsed .editor-nav-card {
  justify-items: center;
  padding: 8px;
}

.editor-nav-collapsed .editor-nav-card .eyebrow,
.editor-nav-collapsed .editor-nav-card strong,
.editor-nav-collapsed .editor-nav-card p,
.editor-nav-collapsed .editor-nav-item span,
.editor-nav-collapsed .editor-nav-item small {
  display: none;
}

.editor-nav-card p {
  margin: 0;
  color: var(--phi-muted);
  font-size: 13px;
}

.editor-nav-list {
  display: grid;
  gap: 6px;
  padding: 8px;
}

.editor-nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--phi-ink);
  text-align: left;
  font-weight: 800;
}

.editor-nav-collapsed .editor-nav-item {
  justify-content: center;
  min-height: 42px;
  padding: 10px;
}

.editor-nav-collapsed .editor-nav-item::before {
  content: attr(data-short);
}

.editor-nav-item small {
  color: var(--phi-muted);
  font-size: 12px;
}

.editor-nav-item.active {
  background: #fff6ef;
  border-color: rgba(236, 114, 6, 0.38);
  color: var(--phi-blue);
}

.editor-content {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.module-tabs {
  display: none;
}

.overview-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
  border: 1px solid rgba(236, 114, 6, 0.22);
  border-radius: 8px;
  background: linear-gradient(180deg, #fffaf6 0%, #ffffff 100%);
}

.overview-hero h2 {
  margin: 4px 0 0;
  font-size: 34px;
  line-height: 1;
}

.overview-hero p {
  max-width: 720px;
  margin: 10px 0 0;
  color: var(--phi-muted);
}

.overview-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.overview-stat-card {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--phi-line);
  border-radius: 8px;
  background: #fff;
}

.overview-stat-card span,
.overview-stat-card small {
  color: var(--phi-muted);
}

.overview-stat-card strong {
  font-size: 28px;
  line-height: 1;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 18px;
}

.macro-list {
  display: grid;
  gap: 10px;
}

.macro-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--phi-line);
  border-radius: 8px;
  background: #f8fafc;
}

.macro-row span {
  color: var(--phi-muted);
}

.geo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.macro-group {
  display: grid;
  align-content: start;
  gap: 10px;
}

.phase-pipeline,
.activity-list,
.communications-grid {
  display: grid;
  gap: 12px;
}

.phase-pipeline {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.phase-pipeline-card,
.activity-item,
.communication-card {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--phi-line);
  border-radius: 8px;
  background: #fff;
}

.phase-pipeline-card b {
  font-size: 22px;
  line-height: 1;
  color: var(--phi-blue);
}

.activity-item span,
.activity-item small,
.communication-card p {
  color: var(--phi-muted);
  margin: 0;
}

.compact-empty {
  min-height: 120px;
}

.builder-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.builder-map {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(19, 47, 82, 0.13);
  border-radius: 8px;
  background: #fff;
}

.builder-map-header {
  display: grid;
  gap: 4px;
}

.builder-map-header strong {
  font-size: 18px;
}

.builder-map-header p {
  margin: 0;
  color: var(--phi-muted);
  font-size: 13px;
}

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

.builder-map-page {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--phi-line);
  border-radius: 8px;
  color: var(--phi-ink);
  text-decoration: none;
  background: #f8fafc;
  text-align: left;
  cursor: pointer;
}

.builder-map-page.active {
  border-color: rgba(236, 114, 6, 0.72);
  background: #fff6ef;
  box-shadow: inset 0 0 0 1px rgba(236, 114, 6, 0.24);
}

.builder-map-page.active .builder-map-number {
  background: var(--phi-blue);
  color: #fff;
}

.builder-map-page strong,
.builder-map-page small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.builder-map-page small {
  margin-top: 2px;
  color: var(--phi-muted);
}

.builder-map-number,
.page-number,
.question-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-weight: 850;
}

.builder-map-number {
  width: 30px;
  height: 30px;
  background: #fff0e4;
  color: #a54a00;
}

.builder-intro {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border: 1px solid rgba(236, 114, 6, 0.25);
  border-radius: 8px;
  background: #fffaf6;
}

.builder-intro h2,
.builder-flow-title h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
}

.builder-intro p {
  max-width: 760px;
  margin: 8px 0 0;
  color: var(--phi-muted);
}

.builder-meta {
  box-shadow: 0 8px 24px rgba(19, 47, 82, 0.05);
}

.builder-flow-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-top: 6px;
}

.phase-card,
.page-card,
.question-card {
  border: 1px solid var(--phi-line);
  border-radius: 8px;
  background: #fff;
}

.phase-card {
  overflow: hidden;
  scroll-margin-top: 92px;
  border-color: rgba(236, 114, 6, 0.34);
  box-shadow: 0 14px 34px rgba(19, 47, 82, 0.08);
}

.page-card {
  overflow: hidden;
  scroll-margin-top: 92px;
  border-color: rgba(19, 47, 82, 0.22);
  box-shadow: 0 10px 30px rgba(19, 47, 82, 0.06);
}

.phase-card-header,
.page-card-header,
.question-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--phi-line);
}

.phase-card-header {
  background: #fff6ef;
  border-bottom: 1px solid rgba(236, 114, 6, 0.22);
}

.page-card-header {
  background: #eef4fb;
}

.page-title-row,
.question-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.page-title-row h3 {
  margin: 0;
  font-size: 22px;
}

.page-title-row p {
  margin: 4px 0 0;
  color: var(--phi-muted);
  font-size: 13px;
}

.page-number {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  background: var(--phi-blue);
  color: #fff;
  font-size: 20px;
}

.page-card-body {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.page-settings,
.questions-section {
  display: grid;
  gap: 12px;
}

.section-label {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 8px;
  background: #f0f4f8;
  color: var(--phi-blue);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.section-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.questions-section {
  padding: 14px;
  border: 1px dashed #c7d3e2;
  border-radius: 8px;
  background: #fbfcfe;
}

.questions-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.question-card {
  margin: 0;
  border-color: rgba(19, 47, 82, 0.16);
}

.question-card.is-collapsed .question-card-header,
.criterion-card.is-collapsed {
  background: #f8fafc;
}

.question-card-body {
  padding: 14px;
}

.question-card-header {
  background: #fff;
}

.question-title-row strong {
  display: block;
  overflow-wrap: anywhere;
}

.question-number {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  background: #fff0e4;
  color: #a54a00;
}

.page-empty {
  padding: 18px;
  border: 1px solid var(--phi-line);
  border-radius: 8px;
  background: #fff;
}

.page-empty p {
  margin: 6px 0 0;
  color: var(--phi-muted);
}

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

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

.criterion-card {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--phi-line);
  border-radius: 8px;
  background: #fff;
}

.criterion-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.criterion-card-header strong {
  display: block;
  overflow-wrap: anywhere;
}

.compact-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.criteria-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.criteria-selector-header {
  margin-bottom: 0;
}

.criteria-selector-header > span {
  font-weight: 800;
}

.criteria-selector.criteria-selector-compact {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
}

.criteria-active-list {
  display: grid;
  gap: 10px;
}

.criterion-choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--phi-line);
  border-radius: 8px;
  background: #f8fafc;
  cursor: pointer;
}

.criterion-choice.active-selected {
  min-height: 68px;
  border-color: rgba(236, 114, 6, 0.48);
  background: #fff6ef;
  box-shadow: inset 4px 0 0 var(--phi-orange);
}

.criterion-choice.compact {
  align-items: center;
  min-height: 48px;
  padding: 9px 10px;
}

.criterion-choice input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--phi-orange);
}

.criterion-choice span,
.criterion-choice strong,
.criterion-choice small {
  display: block;
}

.criterion-choice strong {
  overflow-wrap: anywhere;
}

.criterion-choice.compact strong {
  font-size: 13px;
  line-height: 1.25;
}

.criterion-choice small {
  margin-top: 3px;
  color: var(--phi-muted);
  font-size: 12px;
  font-weight: 700;
}

.inactive-criteria-drawer {
  border: 1px solid #dfe5ee;
  border-radius: 8px;
  background: #f8fafc;
}

.inactive-criteria-drawer summary {
  min-height: 42px;
  padding: 10px 12px;
  color: var(--phi-muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 850;
}

.inactive-criteria-drawer[open] {
  padding-bottom: 10px;
}

.inactive-criteria-drawer[open] summary {
  border-bottom: 1px solid #dfe5ee;
  margin-bottom: 10px;
}

.inactive-criteria-drawer .criteria-selector {
  padding: 0 10px;
}

.compact-criteria-empty {
  min-height: 44px;
  color: var(--phi-muted);
  font-weight: 800;
}

.option-row,
.inline-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.question-config-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #dfe5ee;
  border-radius: 8px;
  background: #f8fafc;
}

.toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--phi-ink);
  font-weight: 800;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--phi-orange);
}

.condition-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.preview-frame {
  min-height: 520px;
  border: 1px solid var(--phi-line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.public-view {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: 32px 20px 18px;
  overflow: hidden;
}

.animated-public-view::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.24;
  background:
    linear-gradient(120deg, transparent 0%, rgba(236, 114, 6, 0.18) 32%, transparent 64%),
    linear-gradient(180deg, rgba(19, 47, 82, 0.06), transparent 46%);
  background-size: 180% 180%, 100% 100%;
  animation: publicSweep 8s ease-in-out infinite alternate;
}

.public-card {
  position: relative;
  z-index: 1;
  width: min(900px, 100%);
  margin-top: auto;
  display: grid;
  gap: 24px;
  padding: clamp(26px, 5vw, 54px);
  border: 1px solid rgba(19, 47, 82, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 24px 80px rgba(19, 47, 82, 0.14);
  backdrop-filter: blur(22px);
  animation: publicCardIn 520ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.public-session-bar {
  position: relative;
  z-index: 2;
  width: min(900px, 100%);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  margin-bottom: 14px;
  color: #6f7b8c;
  font-size: 14px;
  font-weight: 800;
}

.public-session-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
}

.support-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--phi-blue);
  color: #fff;
  font-size: 21px;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 10px 28px rgba(19, 47, 82, 0.18);
}

.support-button:hover {
  background: var(--phi-orange);
}

.public-footer {
  position: relative;
  z-index: 1;
  width: min(900px, 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: auto;
  padding-top: 18px;
  color: #a8b0bd;
  font-size: 13px;
  font-weight: 700;
}

.public-footer nav {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.public-footer a {
  color: #a8b0bd;
  text-decoration: none;
}

.public-footer a:hover {
  color: #7f8998;
  text-decoration: underline;
}

.legal-view {
  background: #f6f8fb;
}

.auth-view {
  min-height: 100vh;
  justify-content: flex-start;
  align-items: center;
  padding: 32px 20px;
  overflow: auto;
}

.auth-view .public-card {
  margin-top: auto;
  margin-bottom: auto;
  transform: translateY(-4vh);
}

.auth-view .public-footer {
  margin-top: 18px;
}

.legal-card {
  align-content: start;
}

.auth-card {
  width: min(520px, 100%);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-actions {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.auth-actions .button {
  width: 100%;
}

.legal-content {
  display: grid;
  gap: 12px;
  color: var(--phi-muted);
  font-size: 16px;
}

.legal-content p {
  margin: 0;
}

.legal-content ul {
  margin: 0;
  padding-left: 20px;
}

.legal-content li + li {
  margin-top: 4px;
}

.legal-content article {
  display: grid;
  gap: 6px;
}

.legal-content h2 {
  margin: 0;
  color: var(--phi-ink);
  font-size: 18px;
}

.public-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.public-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  animation: softPop 520ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.partner-logo {
  max-width: 150px;
  max-height: 58px;
  object-fit: contain;
}

.partner-logo-preview {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-height: 88px;
}

.partner-logo-preview img {
  max-width: 180px;
  max-height: 76px;
  object-fit: contain;
  padding: 8px;
  border: 1px solid var(--phi-line);
  border-radius: 8px;
  background: #fff;
}

.font-size-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 10px;
}

.font-size-option {
  display: grid;
  gap: 2px;
  min-height: 64px;
  padding: 12px;
  border: 1px solid rgba(19, 47, 82, 0.16);
  border-radius: 8px;
  background: #fff;
  color: var(--phi-ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.font-size-option strong {
  font-size: 14px;
}

.font-size-option small {
  color: var(--phi-muted);
  font-weight: 800;
}

.font-size-option:hover,
.font-size-option.selected {
  border-color: var(--phi-orange);
  box-shadow: 0 12px 28px rgba(19, 47, 82, 0.1);
  transform: translateY(-1px);
}

.font-size-option.selected {
  box-shadow: inset 4px 0 0 var(--phi-orange), 0 12px 28px rgba(19, 47, 82, 0.1);
}

.design-live-preview {
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 1px solid rgba(19, 47, 82, 0.12);
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(19, 47, 82, 0.08);
}

.design-live-preview .public-logo {
  width: 44px;
  height: 44px;
}

.design-live-preview .partner-logo {
  max-width: 120px;
  max-height: 46px;
}

.design-preview-question {
  display: block;
  color: inherit;
  font-size: var(--question-font-size, 27px);
  font-weight: 850;
  line-height: 1.08;
  letter-spacing: 0;
}

.design-preview-answer {
  padding: 10px 0 12px;
  border-bottom: 2px solid rgba(19, 47, 82, 0.22);
  color: var(--phi-muted);
  font-weight: 700;
}

.design-preview-button {
  justify-self: start;
  color: #fff;
}

.regulation-preview {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-height: 88px;
  color: var(--phi-muted);
  font-weight: 800;
}

.regulation-acceptance {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(236, 114, 6, 0.28);
  border-radius: 8px;
  background: #fff8f1;
  color: var(--phi-ink);
  font-size: 15px;
  font-weight: 800;
}

.acceptance-stack {
  display: grid;
  gap: 10px;
}

.regulation-acceptance a {
  color: var(--phi-blue);
  font-weight: 900;
}

.regulation-acceptance input {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  accent-color: var(--phi-orange);
}

.step-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 8px;
  background: rgba(19, 47, 82, 0.07);
  color: var(--phi-blue);
  font-size: 13px;
  font-weight: 850;
}

.public-copy {
  display: grid;
  gap: 8px;
  animation: slideFadeUp 520ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.public-copy h1 {
  margin: 0;
  transform-origin: left center;
}

.progress {
  height: 8px;
  background: rgba(19, 47, 82, 0.11);
  border-radius: 8px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: var(--active-primary, var(--phi-orange));
  transition: width 420ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.question-block {
  display: grid;
  gap: 16px;
  animation: slideFadeUp 460ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: 80ms;
}

.question-label {
  display: block;
  font-size: var(--question-font-size, 27px);
  line-height: 1.08;
  font-weight: 850;
  letter-spacing: 0;
}

.required-mark {
  color: var(--active-primary, var(--phi-orange));
}

.answer-control {
  width: 100%;
  min-height: 58px;
  border: 0;
  border-bottom: 2px solid rgba(19, 47, 82, 0.25);
  background: transparent;
  color: var(--phi-ink);
  padding: 12px 0;
  outline: 0;
  font-size: 22px;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.answer-control:focus {
  transform: translateY(-1px);
}

textarea.answer-control {
  min-height: 140px;
  resize: vertical;
}

.other-answer-control {
  margin-top: 8px;
}

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

.choice-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 12px;
  border: 1px solid rgba(19, 47, 82, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--phi-ink);
  text-align: left;
  font-weight: 800;
  transform: translateY(0);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
}

.choice-option:hover {
  transform: translateY(-2px);
  border-color: var(--active-primary, var(--phi-orange));
  box-shadow: 0 14px 30px rgba(19, 47, 82, 0.1);
  background: #fff;
}

.choice-option.selected {
  border-color: var(--active-primary, var(--phi-orange));
  box-shadow: inset 4px 0 0 var(--active-primary, var(--phi-orange));
}

.upload-answer {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px dashed rgba(19, 47, 82, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.upload-answer:hover {
  transform: translateY(-2px);
  border-color: var(--active-primary, var(--phi-orange));
  box-shadow: 0 14px 30px rgba(19, 47, 82, 0.1);
}

.upload-answer input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.upload-answer span {
  color: var(--phi-blue);
  font-size: 18px;
  font-weight: 850;
}

.upload-answer small {
  color: var(--phi-muted);
  font-weight: 700;
}

.form-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.continue-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  animation: slideFadeUp 460ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: 140ms;
}

.keyboard-hint {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--phi-muted);
  font-size: 14px;
  font-weight: 700;
}

.keyboard-hint kbd {
  min-width: 42px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 4px 8px;
  border: 1px solid rgba(19, 47, 82, 0.12);
  border-radius: 6px;
  background: rgba(19, 47, 82, 0.06);
  color: var(--phi-blue);
  font-family: inherit;
  font-size: 13px;
  font-weight: 850;
}

.public-card .button {
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.public-card .button:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(19, 47, 82, 0.18);
  filter: brightness(1.03);
}

.error {
  color: var(--danger);
  font-weight: 700;
}

.empty-state,
.thank-you {
  min-height: 280px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 12px;
}

.responses-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.responses-table th,
.responses-table td {
  padding: 12px;
  border-bottom: 1px solid var(--phi-line);
  text-align: left;
  vertical-align: top;
}

.responses-table th {
  color: var(--phi-muted);
  font-size: 12px;
  text-transform: uppercase;
}

.responses-table th:last-child,
.responses-table td:last-child {
  width: 120px;
  text-align: right;
}

.responses-table .empty-cell {
  color: var(--phi-muted);
  text-align: left;
}

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
}

.table-scroll .responses-table {
  min-width: 760px;
}

.response-groups {
  display: grid;
  gap: 12px;
}

.response-group-card {
  border: 1px solid var(--phi-line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.response-group-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
}

.response-group-header h3 {
  margin: 2px 0 4px;
  font-size: 18px;
}

.response-group-header p,
.response-group-header small {
  margin: 0;
  color: var(--phi-muted);
  font-weight: 700;
}

.response-group-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.response-answer-list {
  display: grid;
  gap: 10px;
  padding: 0 14px 14px;
}

.response-answer-row {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--phi-line);
  border-radius: 8px;
  background: #f8fafc;
}

.section-header.compact {
  margin-bottom: 12px;
}

.evaluation-layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 18px;
}

.evaluation-list {
  display: grid;
  gap: 10px;
}

.evaluation-item,
.phase-switcher-item {
  width: 100%;
  border: 1px solid var(--phi-line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--phi-ink);
  text-align: left;
  padding: 12px;
  cursor: pointer;
}

.evaluation-item.active,
.phase-switcher-item.active {
  border-color: rgba(236, 114, 6, 0.72);
  background: #fff6ef;
}

.evaluation-item strong,
.phase-switcher-item strong {
  display: block;
}

.evaluation-item span,
.evaluation-item small,
.phase-switcher-item small {
  display: block;
  color: var(--phi-muted);
}

.phase-switcher {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.phase-switcher-item {
  width: auto;
  min-width: 180px;
}

.evaluation-summary,
.ranking-header,
.evaluation-actions,
.evaluation-footer-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.score-card {
  min-width: 160px;
  padding: 12px 14px;
  border: 1px solid rgba(236, 114, 6, 0.24);
  border-radius: 8px;
  background: #fff6ef;
}

.score-card strong {
  display: block;
  font-size: 28px;
  line-height: 1;
  margin-top: 4px;
}

.score-card small {
  color: var(--phi-muted);
}

.ranking-header .score-card {
  max-width: min(520px, 100%);
}

.ranking-header .score-card strong {
  font-size: 18px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.evaluation-score-list {
  display: grid;
  gap: 6px;
  min-width: 220px;
}

.evaluation-score-item {
  display: grid;
  gap: 2px;
  padding: 8px;
  border: 1px solid var(--phi-line);
  border-radius: 8px;
  background: #f8fafc;
}

.evaluation-score-item strong {
  font-size: 12px;
}

.evaluation-score-item span,
.evaluation-score-item small {
  color: var(--phi-muted);
  font-weight: 700;
}

.answers-stack {
  display: grid;
  gap: 12px;
}

.answer-review-card {
  border: 1px solid var(--phi-line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.answer-review-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.answer-value {
  min-height: 46px;
  padding: 12px;
  border: 1px solid var(--phi-line);
  border-radius: 8px;
  background: #f8fafc;
  white-space: pre-wrap;
  word-break: break-word;
}

.response-answer-value {
  margin-top: 6px;
}

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

.file-answer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--phi-line);
  border-radius: 8px;
  background: #fff;
}

.file-answer-item strong,
.file-answer-item small {
  display: block;
}

.file-answer-item small {
  margin-top: 3px;
  color: var(--phi-muted);
  font-weight: 700;
}

.file-answer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.legacy-file-answer {
  border-style: dashed;
  background: #fff8f1;
}

.button.micro {
  min-height: 30px;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 6px;
}

.review-criteria-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.review-criterion-item {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid #dfe5ee;
  border-radius: 8px;
  background: #f8fafc;
}

.review-criterion-item strong {
  color: var(--phi-blue);
}

.review-criterion-item span,
.review-criterion-item small {
  color: var(--phi-muted);
  font-size: 12px;
  font-weight: 700;
}

.subtle-panel {
  border: 1px solid var(--phi-line);
  border-radius: 8px;
  background: #f8fafc;
}

.response-delete {
  min-height: 36px;
  padding: 8px 10px;
}

.toast {
  position: fixed;
  right: 18px;
  top: 18px;
  z-index: 30;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--phi-blue);
  color: #fff;
  box-shadow: 0 12px 30px rgba(19, 47, 82, 0.18);
  font-weight: 800;
}

.hidden {
  display: none !important;
}

@keyframes publicCardIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes slideFadeUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes softPop {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes publicSweep {
  from {
    background-position: 0% 50%, 0 0;
  }
  to {
    background-position: 100% 50%, 0 0;
  }
}

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

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .editor-shell,
  .builder-layout,
  .overview-grid,
  .overview-stats {
    grid-template-columns: 1fr;
  }

  .builder-map,
  .editor-nav {
    position: static;
  }

  .editor-nav {
    display: none;
  }

  .module-tabs {
    display: flex;
  }

  .sidebar {
    position: static;
    height: auto;
    max-height: 42vh;
    overflow-y: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(19, 47, 82, 0.12);
  }

  .grid.two,
  .grid.three,
  .status-picker,
  .geo-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .topbar,
  .section-header,
  .section-line,
  .form-nav,
  .builder-flow-title,
  .builder-intro,
  .overview-hero,
  .page-card-header,
  .question-card-header,
  .criterion-card-header,
  .questions-section-header {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    padding: 14px 16px;
  }

  .sidebar,
  .workspace {
    padding: 16px;
  }

  .topbar-actions,
  .option-row,
  .inline-row,
  .continue-row,
  .evaluation-layout,
  .evaluation-summary,
  .ranking-header,
  .evaluation-actions,
  .evaluation-footer-actions {
    width: 100%;
  }

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

  .public-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .public-footer nav {
    justify-content: flex-start;
  }

  .page-title-row,
  .question-title-row {
    align-items: flex-start;
  }

  .button,
  .tab {
    width: 100%;
  }

  .answer-control {
    font-size: 19px;
  }
}
