@import url("https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@500;600;700&family=Sarabun:wght@400;500;600;700&display=swap");

:root {
  --survey-bg: #f4f7f5;
  --survey-surface: #ffffff;
  --survey-ink: #1a2e28;
  --survey-muted: #5c6f68;
  --survey-accent: #0b6e4f;
  --survey-accent-soft: #e4f2ec;
  --survey-line: #c8ddd4;
  --survey-warn: #b45309;
  --survey-font-display: "Chakra Petch", "Sarabun", sans-serif;
  --survey-font-body: "Sarabun", system-ui, sans-serif;
}

body.portal-body,
body.survey-body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 8%, rgba(11, 110, 79, 0.08), transparent 34%),
    radial-gradient(circle at 88% 0%, rgba(26, 46, 40, 0.05), transparent 28%),
    var(--survey-bg);
  color: var(--survey-ink);
  font-family: var(--survey-font-body);
}

.portal-shell,
.survey-shell {
  width: min(1080px, calc(100% - 2rem));
  margin: 0 auto;
}

.portal-header,
.survey-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 0 0.75rem;
}

.portal-brand,
.survey-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.portal-mark,
.survey-mark {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 12px;
  background: linear-gradient(145deg, #0b6e4f, #084f39);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--survey-font-display);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.portal-title h1,
.survey-title h1 {
  margin: 0;
  font-family: var(--survey-font-display);
  font-size: 1.15rem;
  font-weight: 700;
}

.portal-title p,
.survey-title p {
  margin: 0.15rem 0 0;
  color: var(--survey-muted);
  font-size: 0.88rem;
}

.portal-header-minimal {
  padding-top: 2rem;
}

.portal-header-minimal .portal-title h1 {
  font-family: var(--survey-font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.survey-step-label {
  margin-top: 0.35rem !important;
  color: var(--survey-accent) !important;
  font-weight: 600;
}

.portal-hero {
  margin: 1rem 0 1.5rem;
  padding: 1.6rem 1.4rem;
  border: 1px solid var(--survey-line);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(228, 242, 236, 0.72));
}

.portal-hero h2 {
  margin: 0 0 0.5rem;
  font-family: var(--survey-font-display);
  font-size: clamp(1.35rem, 2.5vw, 1.85rem);
  line-height: 1.25;
}

.portal-hero p {
  margin: 0;
  color: var(--survey-muted);
  line-height: 1.6;
  max-width: 62ch;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.portal-shell--single {
  width: min(520px, calc(100% - 2rem));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2rem 0 2.5rem;
}

.portal-header--single {
  justify-content: center;
  text-align: center;
  padding-top: 0;
}

.portal-header--single .portal-title p {
  margin-inline: auto;
  max-width: 34ch;
}

.project-grid--single {
  display: flex;
  justify-content: center;
}

.project-card--featured {
  width: 100%;
  align-items: center;
  text-align: center;
  gap: 1rem;
  padding: 2rem 1.75rem 1.85rem;
  border-radius: 22px;
  box-shadow: 0 18px 42px rgba(26, 46, 40, 0.08);
}

.project-card--featured:hover {
  transform: translateY(-3px);
}

.project-card-mark {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 14px;
  background: linear-gradient(145deg, #0b6e4f, #084f39);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--survey-font-display);
  font-weight: 700;
  letter-spacing: 0.05em;
}

.project-card-eyebrow {
  margin: 0;
  color: var(--survey-accent);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.project-card--featured h3 {
  font-size: clamp(1.25rem, 3.5vw, 1.65rem);
  line-height: 1.35;
  max-width: 28ch;
}

.project-card-desc {
  margin: 0;
  color: var(--survey-muted);
  font-size: 0.95rem;
  line-height: 1.6;
  max-width: 36ch;
}

.project-card-meta--featured {
  justify-content: center;
  gap: 0.55rem 0.85rem;
}

.project-card-code {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: var(--survey-accent-soft);
  color: var(--survey-accent);
  font-weight: 700;
}

.project-card-cta {
  width: 100%;
  min-height: 3rem;
  margin-top: 0.35rem;
  font-size: 1rem;
}

.portal-shell--single .portal-footer {
  margin-top: 1.5rem;
  margin-bottom: 0;
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.1rem 1.15rem;
  border: 1px solid var(--survey-line);
  border-radius: 16px;
  background: var(--survey-surface);
  box-shadow: 0 10px 24px rgba(26, 46, 40, 0.04);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.project-card:hover {
  transform: translateY(-2px);
  border-color: #9fc5b4;
}

.project-card h3 {
  margin: 0;
  font-family: var(--survey-font-display);
  font-size: 1.05rem;
}

.project-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
  color: var(--survey-muted);
  font-size: 0.88rem;
}

.portal-footer {
  margin: 2rem 0 2.5rem;
  text-align: center;
  color: var(--survey-muted);
  font-size: 0.88rem;
}

.portal-footer a {
  color: var(--survey-accent);
  text-decoration: none;
  font-weight: 600;
}

.survey-progress {
  margin: 0.5rem 0 1.25rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--survey-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
}

.survey-progress-track {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.35rem;
}

.survey-progress-node {
  text-align: center;
  font-size: 0.72rem;
  color: var(--survey-muted);
  line-height: 1.25;
}

.survey-progress-dot {
  width: 0.72rem;
  height: 0.72rem;
  margin: 0 auto 0.35rem;
  border-radius: 999px;
  background: #d7e5de;
  border: 2px solid #d7e5de;
}

.survey-progress-node.active .survey-progress-dot {
  background: var(--survey-accent);
  border-color: var(--survey-accent);
}

.survey-progress-node.done .survey-progress-dot {
  background: #fff;
  border-color: var(--survey-accent);
}

.survey-progress-node.active,
.survey-progress-node.done {
  color: var(--survey-ink);
  font-weight: 600;
}

.survey-card {
  border: 1px solid var(--survey-line);
  border-radius: 18px;
  background: var(--survey-surface);
  padding: 1.35rem 1.25rem;
  box-shadow: 0 12px 28px rgba(26, 46, 40, 0.05);
}

.survey-card h2 {
  margin: 0 0 0.35rem;
  font-family: var(--survey-font-display);
  font-size: 1.25rem;
}

.survey-card .subtitle {
  margin: 0 0 1rem;
  color: var(--survey-muted);
  line-height: 1.55;
}

.survey-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

.survey-actions.between {
  justify-content: space-between;
}

.survey-search-results {
  margin-top: 0.35rem;
  border: 1px solid var(--survey-line);
  border-radius: 12px;
  background: #fff;
  max-height: 240px;
  overflow: auto;
}

.survey-search-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid #edf3ef;
  background: transparent;
  padding: 0.75rem 0.9rem;
  cursor: pointer;
}

.survey-search-item:last-child {
  border-bottom: 0;
}

.survey-search-item:hover,
.survey-search-item.active {
  background: var(--survey-accent-soft);
}

.survey-search-item strong {
  display: block;
  font-size: 0.95rem;
}

.survey-search-item span {
  display: block;
  margin-top: 0.15rem;
  color: var(--survey-muted);
  font-size: 0.84rem;
}

.survey-selected {
  margin-top: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: var(--survey-accent-soft);
  border: 1px solid #b9d8c9;
}

.survey-identity-warning {
  margin-bottom: 1.1rem;
  padding: 1rem 1.05rem 1rem 1.15rem;
  border-radius: 14px;
  border: 2px solid #e8a84a;
  border-left-width: 6px;
  border-left-color: #d97706;
  background: linear-gradient(135deg, #fff8eb 0%, #fffdf8 72%);
  box-shadow: 0 8px 22px rgba(217, 119, 6, 0.12);
}

.survey-identity-warning-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-bottom: 0.45rem;
}

.survey-identity-warning-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.62rem;
  border-radius: 999px;
  background: #d97706;
  color: #fff;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.survey-identity-warning-title {
  font-size: 1.02rem;
  color: #7c2d12;
}

.survey-identity-warning-text {
  margin: 0;
  color: #92400e;
  font-size: 0.95rem;
  line-height: 1.65;
}

.survey-identity-warning-em {
  color: #b45309;
  font-size: 1.02em;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
}

.survey-selected.survey-selected-locked {
  padding: 0;
  overflow: hidden;
  border: 2px solid #e8a84a;
  background: #fffdf8;
  box-shadow: 0 8px 22px rgba(217, 119, 6, 0.1);
}

.survey-selected-lock-banner {
  padding: 0.85rem 1rem;
  background: linear-gradient(135deg, #ffedd5 0%, #fff7ed 100%);
  border-bottom: 1px solid #f0c27a;
}

.survey-selected-lock-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: #ea580c;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.survey-selected-lock-badge::before {
  content: "🔒";
  font-size: 0.82rem;
  line-height: 1;
}

.survey-selected-lock-text {
  margin: 0.5rem 0 0;
  color: #9a3412;
  font-size: 0.92rem;
  line-height: 1.55;
}

.survey-selected-person {
  padding: 0.9rem 1rem 1rem;
}

.survey-selected-person strong {
  display: block;
  font-size: 1.08rem;
  color: #1a2e28;
}

.survey-selected-person div {
  margin-top: 0.25rem;
  color: var(--survey-muted);
  font-size: 0.88rem;
}

.survey-start-actions {
  flex-direction: column;
  align-items: stretch;
  gap: 0.55rem;
}

.survey-continue-warning {
  margin: 0;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border: 1px solid #cfe0ee;
  background: #f5f9fc;
  color: #334155;
  font-size: 0.92rem;
  line-height: 1.5;
  text-align: center;
}

.survey-continue-warning strong {
  color: #0b6e4f;
}

.survey-selected-actions {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.survey-resume-panel {
  margin-bottom: 1.1rem;
}

.survey-resume-card {
  padding: 1rem 1.05rem;
  border-radius: 14px;
  border: 2px solid #7eb89f;
  background: linear-gradient(135deg, #eef8f3 0%, #f8fcfa 70%);
  box-shadow: 0 8px 18px rgba(11, 110, 79, 0.08);
}

.survey-resume-head {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
}

.survey-resume-badge {
  display: inline-flex;
  align-self: flex-start;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  background: #0b6e4f;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
}

.survey-resume-head strong {
  font-size: 1.05rem;
  line-height: 1.35;
}

.survey-resume-meta {
  color: var(--survey-muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.survey-resume-note {
  margin: 0.65rem 0 0;
  color: #0b4f3a;
  font-size: 0.9rem;
  line-height: 1.5;
  font-weight: 600;
}

.survey-resume-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.survey-actions-left {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

@media (max-width: 640px) {
  .survey-resume-actions .btn,
  .survey-actions-left .btn {
    width: 100%;
  }
}

.employee-hint-card {
  margin-bottom: 1rem;
}

.employee-hint-name {
  font-size: 1rem;
}

.employee-hint-meta {
  margin-top: 0.2rem;
  color: var(--survey-muted);
  font-size: 0.88rem;
}

.employee-hint-dept {
  margin-top: 0.55rem;
  font-size: 0.92rem;
}

.employee-dept-tag {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #9fc5b4;
  color: var(--survey-accent);
  font-weight: 700;
}

.employee-dept-tag.is-locked {
  border-color: #f0d4a8;
  background: #fffaf3;
  color: #9a3412;
}

.employee-hint-lock {
  margin-top: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  border: 1px solid #f0d4a8;
  background: #fffaf3;
  color: #9a3412;
  font-size: 0.88rem;
  line-height: 1.45;
  font-weight: 600;
}

.unit-select-wrap.is-locked .unit-select {
  border-color: #e8b86d;
  background: #fffaf3;
  font-weight: 600;
}

.unit-recommend {
  margin-bottom: 1.1rem;
  padding: 1rem 1.05rem;
  border-radius: 14px;
  border: 2px solid var(--survey-accent);
  background: linear-gradient(135deg, #e8f5ef 0%, #f8fcfa 68%);
  box-shadow: 0 8px 20px rgba(11, 110, 79, 0.1);
}

.unit-recommend.is-applied {
  border-color: #7eb89f;
  background: linear-gradient(135deg, #f2faf6 0%, #ffffff 70%);
}

.unit-recommend-head {
  margin-bottom: 0.55rem;
}

.unit-recommend-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: var(--survey-accent);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.unit-recommend-badge::before {
  content: "★";
  font-size: 0.72rem;
}

.unit-recommend-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.unit-recommend-text strong {
  display: block;
  font-family: var(--survey-font-display);
  font-size: 1.02rem;
  line-height: 1.4;
}

.unit-recommend-text span {
  display: block;
  margin-top: 0.2rem;
  color: var(--survey-muted);
  font-size: 0.86rem;
}

.unit-select-field {
  margin-top: 0.25rem;
}

.unit-select-wrap {
  position: relative;
}

.unit-select-wrap::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 1rem;
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--survey-accent);
  border-bottom: 2px solid var(--survey-accent);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

.unit-select {
  width: 100%;
  min-height: 3.1rem;
  padding: 0.75rem 2.5rem 0.75rem 0.95rem;
  border: 2px solid var(--survey-line);
  border-radius: 12px;
  background: #fff;
  color: var(--survey-ink);
  font-family: var(--survey-font-body);
  font-size: 1rem;
  line-height: 1.4;
  appearance: none;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.unit-select:hover {
  border-color: #9fc5b4;
}

.unit-select:focus {
  outline: none;
  border-color: var(--survey-accent);
  box-shadow: 0 0 0 3px rgba(11, 110, 79, 0.15);
}

.unit-select-wrap.is-recommended .unit-select {
  border-color: var(--survey-accent);
  background: #f7fcf9;
  font-weight: 600;
}

.unit-select-wrap.is-error .unit-select {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.guide-content {
  max-height: 52vh;
  overflow: auto;
  padding-right: 0.35rem;
  line-height: 1.7;
  color: var(--survey-ink);
}

.guide-content h3 {
  margin: 1.1rem 0 0.45rem;
  font-family: var(--survey-font-display);
  font-size: 1rem;
}

.guide-content h3:first-child {
  margin-top: 0;
}

.guide-content p,
.guide-content li {
  color: var(--survey-muted);
}

.guide-content ol {
  padding-left: 1.2rem;
}

.guide-item {
  margin-top: 1.15rem;
  padding-top: 1rem;
  border-top: 1px solid #e8f0ec;
}

.guide-item:first-of-type {
  margin-top: 0.75rem;
}

.guide-item p {
  margin: 0 0 0.75rem;
}

.guide-item p:last-child {
  margin-bottom: 0;
}

.guide-item strong {
  color: var(--survey-ink);
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.field-label-row label {
  margin: 0;
}

.field-add-btn {
  min-width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 8px;
  font-size: 1.15rem;
  line-height: 1;
  font-weight: 700;
  color: var(--survey-accent);
  border: 1px solid #b9dcc9;
  background: #f4fbf7;
}

.field-add-btn:hover,
.field-add-btn.active {
  background: #e8f6ee;
  border-color: var(--survey-accent);
}

#add-activity-modal .placement-extra-field {
  display: none !important;
}

#add-activity-modal .placement-extra-field.is-visible {
  display: grid !important;
}

.work-search-bar {
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--survey-line);
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fcfa, #fff);
}

.work-search-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}

.work-search-field {
  flex: 1 1 240px;
  min-width: 0;
}

.work-add-btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.work-search-bar .field {
  margin: 0;
}

.work-search-bar input[type="search"] {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--survey-line);
  border-radius: 10px;
  font: inherit;
  background: #fff;
}

.work-search-bar input[type="search"]:focus {
  outline: 2px solid rgba(11, 110, 79, 0.22);
  border-color: var(--survey-accent);
}

.work-search-hint {
  margin: 0.45rem 0 0;
  color: var(--survey-muted);
  font-size: 0.84rem;
}

.work-search-results {
  margin-top: 0.55rem;
}

.work-activity-card.work-search-match {
  border-color: #9ecdb8;
  box-shadow: 0 0 0 1px rgba(11, 110, 79, 0.12);
}

.work-activity-card.work-search-focus {
  animation: work-search-pulse 1.2s ease;
}

@keyframes work-search-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(11, 110, 79, 0);
  }
  35% {
    box-shadow: 0 0 0 4px rgba(11, 110, 79, 0.18);
  }
}

.work-category-block {
  margin-top: 0.85rem;
}

.work-category-block:first-child {
  margin-top: 0;
}

.work-fold {
  border: 1px solid #e2ece7;
  border-radius: 12px;
  background: #fcfefd;
  overflow: hidden;
}

.work-fold + .work-fold,
.work-fold + .work-activity-card,
.work-activity-card + .work-fold {
  margin-top: 0.55rem;
}

.work-fold-category {
  border-color: #c5ddd2;
  background: #fff;
}

.work-fold-group {
  background: #f6faf8;
}

.work-fold-subgroup {
  background: #fbfdfc;
  margin-left: 0.35rem;
}

.work-fold-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.8rem 0.95rem;
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  line-height: 1.4;
}

.work-fold-summary::-webkit-details-marker {
  display: none;
}

.work-fold-summary::before {
  content: "▸";
  margin-right: 0.45rem;
  color: var(--survey-accent);
  transition: transform 0.15s ease;
}

.work-fold[open] > .work-fold-summary::before {
  transform: rotate(90deg);
}

.work-fold-summary-category {
  font-family: var(--survey-font-display);
  font-size: 1rem;
  background: #eef6f1;
}

.work-fold-title {
  flex: 1;
  min-width: 0;
}

.work-fold-meta {
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--survey-muted);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #dce9e2;
}

.work-fold-body {
  padding: 0.65rem 0.75rem 0.85rem;
  border-top: 1px solid #e8f0ec;
}

.work-fold-body-category {
  padding: 0.75rem;
}

.work-activity-card {
  position: relative;
  border: 1px solid #e2ece7;
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 0.85rem;
  background: #fcfefd;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease,
    opacity 0.2s ease;
}

#work-list.work-list-has-active .work-activity-card:not(.is-active):not([hidden]) {
  background: #f7faf9;
  border-color: #e8efeb;
  box-shadow: none;
}

.work-activity-card.is-active {
  border-color: var(--survey-accent);
  background: #f2fbf6;
  box-shadow:
    0 0 0 3px rgba(11, 110, 79, 0.14),
    0 10px 28px rgba(11, 110, 79, 0.1);
  opacity: 1 !important;
}

.work-activity-card.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.85rem;
  bottom: 0.85rem;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--survey-accent);
}

.work-activity-card.is-active .work-activity-head::after {
  content: "กำลังกรอก";
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--survey-accent);
  background: #e4f2ec;
  border: 1px solid #b9dcc9;
  border-radius: 999px;
  padding: 0.12rem 0.55rem;
  white-space: nowrap;
}

.work-activity-card + .work-activity-card {
  margin-top: 0.65rem;
}

.field select.is-invalid,
.field input.is-invalid {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.12);
}

.work-activity-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.work-activity-head .work-activity-name {
  flex: 1;
  min-width: 0;
}

.work-activity-head-tools {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  flex: 0 0 auto;
}

.work-activity-grid .work-ai-notes-field {
  display: none !important;
}

.work-activity-grid .work-ai-notes-field.is-visible {
  display: grid !important;
  grid-column: 1 / -1;
  margin-top: 0.35rem;
  padding-top: 0.65rem;
  border-top: 1px dashed #d7e5de;
}

.work-ai-note-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.45rem;
  margin-bottom: 0.45rem;
}

.work-ai-note-badges-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--survey-muted);
  flex: 0 0 auto;
}

.work-ai-note-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid #b9dcc9;
  background: #f0f9f4;
  color: #0b6e4f;
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.work-ai-note-badge:hover {
  background: #e4f2ec;
  border-color: #8fc9ad;
}

.work-ai-note-badge:active {
  transform: scale(0.97);
}

.work-activity-grid .work-ai-notes-field textarea {
  width: 100%;
  min-height: 6.5rem;
  resize: vertical;
  border: 1px solid var(--survey-line);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  font: inherit;
  line-height: 1.5;
}

.work-delete-own-btn {
  color: #dc2626 !important;
  border-color: #fecaca !important;
  min-height: 1.6rem;
  padding: 0.1rem 0.45rem !important;
  font-size: 0.78rem;
}

.work-category-empty {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.9rem;
}

.work-category-empty p {
  margin: 0;
}

.work-fold-summary .work-delete-own-btn {
  margin-left: auto;
  flex: 0 0 auto;
}

.work-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #7a9a8a;
  cursor: grab;
  touch-action: none;
  flex: 0 0 auto;
}

.work-reorder-btns {
  display: inline-flex;
  flex-direction: column;
  gap: 0.1rem;
}

.work-reorder-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.45rem;
  height: 1.15rem;
  padding: 0;
  border: 1px solid #c5ddd2;
  border-radius: 6px;
  background: #fff;
  color: var(--survey-accent);
  font-size: 0.62rem;
  line-height: 1;
  cursor: pointer;
}

.work-reorder-btn:hover:not(:disabled) {
  background: #eef6f1;
  border-color: var(--survey-accent);
}

.work-reorder-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.work-drag-handle:active {
  cursor: grabbing;
}

.work-drag-grip {
  display: block;
  width: 0.45rem;
  height: 1rem;
  background:
    radial-gradient(circle, currentColor 0.12rem, transparent 0.14rem) 0 0 / 100% 33.33%,
    radial-gradient(circle, currentColor 0.12rem, transparent 0.14rem) 0 50% / 100% 33.33%,
    radial-gradient(circle, currentColor 0.12rem, transparent 0.14rem) 0 100% / 100% 33.33%;
}

.work-activity-card.is-work-dragging {
  opacity: 0.45;
}

.work-activity-card.drop-before {
  box-shadow: inset 0 3px 0 var(--survey-accent);
}

.work-activity-card.drop-after {
  box-shadow: inset 0 -3px 0 var(--survey-accent);
}

.is-work-dragging-active .work-activity-card[data-work-drag-item] {
  transition: box-shadow 0.12s ease;
}

.work-activity-name {
  margin: 0;
  font-weight: 600;
  line-height: 1.45;
  flex: 1 1 auto;
  min-width: 0;
}

.work-activity-badge {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: #0b6e4f;
  background: #e4f2ec;
  border: 1px solid #b9dcc9;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
}

.work-activity-card.work-activity-custom {
  border-color: #b9dcc9;
  background: #f8fcfa;
}

.work-activity-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 0.85rem;
  align-items: end;
}

.work-activity-grid .field {
  margin: 0;
  min-width: 0;
}

.work-activity-grid .field label {
  font-size: 0.82rem;
  line-height: 1.35;
}

.work-activity-grid input,
.work-activity-grid select {
  width: 100%;
}

.work-ref {
  font-size: 0.8rem;
  color: var(--survey-muted);
}

.work-ref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.35rem;
  flex-wrap: wrap;
}

.work-ref-fill {
  flex-shrink: 0;
  padding: 0.2rem 0.55rem !important;
  min-height: auto !important;
  font-size: 0.78rem !important;
  border-color: #b9d8c9 !important;
  color: var(--survey-accent) !important;
  background: #f7fcf9 !important;
}

.work-ref-fill:hover {
  background: var(--survey-accent-soft) !important;
  border-color: var(--survey-accent) !important;
}

.autosave-status {
  position: sticky;
  top: 0.5rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--survey-line);
  color: var(--survey-muted);
  font-size: 0.82rem;
}

.autosave-status.saving {
  color: var(--survey-warn);
}

.autosave-status.saved {
  color: var(--survey-accent);
}

.autosave-status.error {
  color: #b91c1c;
  border-color: #f5c2c0;
  background: #fef2f2;
}

.work-activity-saved-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: #e4f2ec;
  border: 1px solid #b9dcc9;
  color: #0b6e4f;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.work-activity-card.has-saved-values {
  border-color: #9fc5b4;
}

.work-activity-grid input[type="number"] {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #0f172a;
  min-height: 2.6rem;
  background: #fff;
}

.work-activity-grid input[type="number"]::placeholder {
  color: #94a3b8;
  font-weight: 500;
  opacity: 1;
}

.work-ref strong {
  color: #0b6e4f;
  font-weight: 700;
}

.feedback-item {
  margin-bottom: 1rem;
}

.feedback-item label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
  line-height: 1.45;
}

.feedback-item textarea {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  border: 1px solid var(--survey-line);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  font: inherit;
}

.survey-done-icon {
  width: 3.5rem;
  height: 3.5rem;
  margin: 0 auto 0.85rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--survey-accent-soft);
  color: var(--survey-accent);
  font-size: 1.5rem;
}

.survey-done-card {
  text-align: center;
}

@media (min-width: 1024px) {
  body.survey-body .survey-shell {
    width: min(1320px, calc(100% - 2rem));
  }

  .work-activity-grid {
    grid-template-columns:
      minmax(7.5rem, 1fr)
      minmax(7.5rem, 1fr)
      minmax(11rem, 1.35fr)
      minmax(11rem, 1.35fr)
      minmax(5.5rem, 6.5rem);
    gap: 0.75rem 0.85rem;
    align-items: end;
  }

  .work-activity-grid .work-ai-notes-field.is-visible {
    margin-top: 0.5rem;
    padding-top: 0.75rem;
  }

  .work-activity-grid .work-ai-notes-field textarea {
    min-height: 7rem;
  }

  .work-activity-grid .field[data-custom-wrap][hidden],
  .work-activity-grid .work-ai-notes-field:not(.is-visible) {
    display: none !important;
  }

  .work-activity-grid .field label {
    font-size: 0.8rem;
    margin-bottom: 0.32rem;
  }

  .work-activity-grid input,
  .work-activity-grid select {
    font-size: 0.92rem;
    padding: 0.55rem 0.65rem;
    min-height: 2.5rem;
  }

  .work-ref-row {
    margin-top: 0.32rem;
    gap: 0.35rem;
  }

  .work-ref {
    font-size: 0.76rem;
    line-height: 1.3;
  }

  .work-ref-fill {
    font-size: 0.74rem !important;
    padding: 0.15rem 0.5rem !important;
  }
}

@media (min-width: 761px) and (max-width: 1023px) {
  .work-activity-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.7rem 0.8rem;
  }

  .work-activity-grid .work-field-role,
  .work-activity-grid .work-field-custom {
    grid-column: span 1;
  }

  .work-activity-grid .work-field-ai {
    max-width: 8rem;
  }
}

@media (max-width: 760px) {
  .survey-progress-track {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    row-gap: 0.55rem;
  }

  .work-activity-grid {
    grid-template-columns: 1fr;
  }
}