:root {
  color-scheme: dark;
  --bg: #101010;
  --surface: #151515;
  --surface-soft: #101010;
  --surface-hover: #1d1d1d;
  --control-hover: #272727;
  --focus-bg: #111111;
  --focus-ring: rgba(255, 255, 255, 0.055);

  --text: #f6f6f6;
  --text-muted: #b9b9b9;
  --text-soft: #818181;

  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);

  --radius-xl: 16px;
  --radius-lg: 14px;
  --radius-md: 12px;
  --radius-sm: 10px;

  --shadow-soft: 0 14px 36px rgba(0, 0, 0, 0.28);

  --container: 520px;
  --stack-gap: 10px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f3f5f8;
  --surface-hover: #f7f8fa;
  --control-hover: #eef1f5;
  --focus-bg: #ffffff;
  --focus-ring: rgba(15, 23, 42, 0.08);

  --text: #15171a;
  --text-muted: #4b5563;
  --text-soft: #7a8390;

  --border: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(15, 23, 42, 0.18);

  --shadow-soft: 0 14px 36px rgba(15, 23, 42, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: "Roboto", sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body:not(.survey-page) {
  --home-panel-gap: 12px;
}

a {
  color: inherit;
  text-decoration: none;
}

input,
button,
select {
  font: inherit;
}

.survey-page input,
.survey-page select {
  font: inherit;
}

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: var(--bg);
  opacity: 1;
  visibility: visible;
  transition:
    opacity 240ms ease,
    visibility 240ms ease;
}

.loading-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-mark {
  width: 230px;
  height: 230px;
  display: grid;
  place-items: center;
  perspective: 720px;
}

.loading-logo {
  display: block;
  width: 200px;
  height: 200px;
  object-fit: contain;
  filter: drop-shadow(0 10px 22px rgba(0, 121, 255, 0.22));
  transform-style: preserve-3d;
  animation: loading-logo-spin 2200ms cubic-bezier(0.55, 0.08, 0.24, 1) infinite;
}

.loading-logo-light {
  display: none;
}

[data-theme="light"] .loading-logo-dark {
  display: none;
}

[data-theme="light"] .loading-logo-light {
  display: block;
}

@keyframes loading-logo-spin {
  0% {
    transform: rotateY(0deg) rotateX(0deg) scale(1);
  }

  50% {
    transform: rotateY(180deg) rotateX(8deg) scale(1.04);
  }

  to {
    transform: rotateY(360deg) rotateX(0deg) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-logo {
    animation-duration: 3200ms;
  }
}

.page-shell {
  width: 100%;
  min-height: 100vh;
  padding: 18px 16px 28px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

@supports (padding: max(0px)) {
  .page-shell {
    padding:
      max(18px, env(safe-area-inset-top))
      max(16px, env(safe-area-inset-right))
      max(28px, env(safe-area-inset-bottom))
      max(16px, env(safe-area-inset-left));
  }
}

.page-container {
  width: 100%;
  max-width: var(--container);
}

.survey-page .page-container {
  min-width: 0;
}

.profile-card,
.search-card,
.footer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
}

.profile-card {
  overflow: hidden;
}

.profile-top {
  padding: 16px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.company-logo {
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  color: #111111;
}

.company-logo img {
  width: 70%;
  height: 70%;
  object-fit: contain;
}

.profile-top > div:last-child,
.profile-title {
  min-width: 0;
}

.survey-home-button {
  margin-left: auto;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 0 0 auto;
  background: var(--surface-soft);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    transform 180ms ease;
}

.survey-home-button:hover {
  background: var(--control-hover);
  border-color: var(--border-strong);
  color: var(--text);
}

.survey-home-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.survey-home-button i {
  font-size: 20px;
  line-height: 1;
}

.company-name {
  margin: 0 0 4px;
  font-size: 16px;
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

h1 {
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 500;
  color: var(--text-muted);
}

.profile-divider {
  width: 100%;
  height: 1px;
  background: var(--border);
}

.profile-description {
  margin: 0;
  padding: 16px;
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: -0.02em;
  color: var(--text-muted);
  text-align: left;
}

.search-card {
  margin-top: var(--stack-gap);
  padding: 16px;
}

.search-card label {
  display: block;
  margin-bottom: 10px;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--text);
}

.search-input-wrap {
  position: relative;
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 13px;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: translateY(-50%);
  color: var(--text-soft);
  pointer-events: none;
}

.search-icon i {
  font-size: 15px;
  line-height: 1;
}

.search-input-wrap input {
  width: 100%;
  height: 48px;
  padding: 0 14px 0 38px;
  border: 1px solid var(--border);
  outline: none;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 16px;
  transition:
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.search-input-wrap input::placeholder {
  color: var(--text-soft);
}

.search-input-wrap input:focus {
  border-color: var(--border-strong);
  background: var(--focus-bg);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.link-section {
  margin-top: var(--stack-gap);
}

.link-list {
  display: grid;
  gap: var(--home-panel-gap);
}

.link-category-group {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  display: grid;
  gap: 12px;
  background: var(--surface);
}

.link-category-header {
  padding: 0 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.link-category-header h2 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
  font-weight: 500;
  letter-spacing: 0;
}

.link-category-header span {
  flex: 0 0 auto;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.4;
  font-weight: 600;
}

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

.link-card {
  min-height: 78px;
  padding: 14px;
  border-radius: var(--radius-md);
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.link-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--text-muted);
  flex: 0 0 auto;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease;
}

.link-icon i {
  font-size: 18px;
  line-height: 1;
}

.link-card:hover .link-icon {
  background: var(--control-hover);
  border-color: var(--border-strong);
  color: var(--text);
}

.link-card:hover {
  transform: translateY(-2px);
  background: var(--surface-hover);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-soft);
}

.link-card:active {
  transform: translateY(0) scale(0.99);
}

.link-content {
  min-width: 0;
}

.link-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.link-title {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.link-description {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.4;
  letter-spacing: -0.02em;
  overflow: hidden;
  display: -webkit-box;
  line-clamp: 1;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.link-arrow {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  background: transparent;
  border: 1px solid transparent;
  opacity: 0.72;
  transform: translateX(0);
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    opacity 180ms ease,
    transform 180ms ease;
}

.link-arrow svg {
  width: 18px;
  height: 18px;
  display: block;
  stroke: currentColor;
}

.link-card:hover .link-arrow {
  color: var(--text);
  background: var(--control-hover);
  border-color: var(--border);
  opacity: 1;
  transform: translate(2px, -2px);
}

.empty-state {
  padding: 34px 16px 30px;
  text-align: center;
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
  border: 1px dashed var(--border-strong);
}

.empty-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 26px;
}

.empty-state h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.03em;
  color: var(--text);
}

.empty-state p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

.footer {
  position: relative;
  margin-top: var(--stack-gap);
  padding: 18px 16px;
  text-align: center;
}

.footer p {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.6;
}

.footer p:first-child {
  color: var(--text-muted);
  font-weight: 400;
}

body:not(.survey-page) .search-card,
body:not(.survey-page) .link-section,
body:not(.survey-page) .footer {
  margin-top: var(--home-panel-gap);
}

.theme-switch {
  position: absolute;
  top: 50%;
  right: 16px;
  margin-top: 0;
  display: inline-flex;
  align-items: center;
  color: var(--text-soft);
  line-height: 1;
  transform: translateY(-50%);
}

.theme-switch-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.theme-toggle {
  appearance: none;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  display: grid;
  align-items: center;
  place-items: center;
  background: var(--surface-soft);
  color: var(--text-soft);
  cursor: pointer;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease;
}

.theme-toggle:hover {
  background: var(--control-hover);
  border-color: var(--border-strong);
  color: var(--text);
}

.theme-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.theme-toggle i {
  font-size: 13px;
  line-height: 1;
}

@media (min-width: 760px) {
  .page-shell {
    padding: 54px 24px;
  }

  .page-container {
    max-width: 720px;
  }

  .profile-top {
    padding: 32px 20px 24px;
    align-items: center;
    gap: 16px;
  }

  .company-logo {
    width: 62px;
    height: 62px;
  }

  h1 {
    font-size: 15px;
  }

  .profile-description {
    padding: 20px 20px 20px;
    font-size: 14px;
  }

  .search-card {
    padding: 22px;
  }

  .link-category-group {
    padding: 20px;
  }

  .link-category-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
}

@media (min-width: 1080px) {
  .page-container {
    max-width: 1022px;
  }

  .survey-page .page-container {
    max-width: 1022px;
  }

  .link-card {
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 14px;
  }

  .link-icon {
    width: 42px;
    height: 42px;
  }

  .link-description {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-clamp: unset;
    -webkit-line-clamp: unset;
    -webkit-box-orient: unset;
  }
}

@media (max-width: 380px) {
  .page-shell {
    padding: 16px 14px 22px;
  }

  @supports (padding: max(0px)) {
    .page-shell {
      padding:
        max(16px, env(safe-area-inset-top))
        max(14px, env(safe-area-inset-right))
        max(22px, env(safe-area-inset-bottom))
        max(14px, env(safe-area-inset-left));
    }
  }

  .profile-top {
    padding: 14px;
  }

  .company-logo {
    width: 48px;
    height: 48px;
  }

  .profile-description {
    padding: 14px;
  }

  .search-card {
    padding: 14px;
  }

  .link-category-group {
    padding: 14px;
  }

  .link-card {
    min-height: 74px;
    padding: 12px;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 10px;
  }

  .link-icon {
    width: 38px;
    height: 38px;
  }

  .link-arrow {
    width: 32px;
    height: 32px;
  }
}

.survey-form {
  min-width: 0;
  margin-top: var(--stack-gap);
  display: grid;
  gap: var(--stack-gap);
}

body.survey-page {
  --stack-gap: 12px;
  overflow-x: hidden;
}

.survey-card,
.survey-actions,
.survey-saved-panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
}

.survey-card {
  padding: 16px;
}

.survey-card-header {
  min-width: 0;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.survey-card-header h2 {
  min-width: 0;
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
  font-weight: 700;
  color: var(--text);
}

.survey-field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.survey-field-grid label,
.survey-row-field {
  display: block;
  min-width: 0;
}

.survey-field-grid span {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 600;
  color: var(--text-muted);
}

.survey-field-grid input,
.survey-row-field input,
.survey-row-field select {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 44px;
  min-width: 0;
  min-inline-size: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  padding: 0 12px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 15px;
  transition:
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

@supports (-webkit-touch-callout: none) {
  @media (hover: none) and (pointer: coarse) {
    .survey-field-grid input[type="date"] {
      display: flex;
      align-items: center;
      width: 100%;
      max-width: 100%;
      inline-size: 100%;
      max-inline-size: 100%;
      min-inline-size: 0;
      padding-block: 0;
      line-height: normal;
      appearance: none;
      -webkit-appearance: none;
    }

    .survey-field-grid input[type="date"]::-webkit-date-and-time-value {
      display: flex;
      align-items: center;
      min-height: 100%;
      min-width: 0;
      margin: 0;
      line-height: 1.2;
      text-align: left;
    }
  }
}

.survey-field-grid input:focus,
.survey-row-field input:focus,
.survey-row-field select:focus {
  border-color: var(--border-strong);
  background: var(--focus-bg);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.survey-add-row,
.survey-remove-row,
.survey-primary-action,
.survey-list-action,
.survey-modal-backdrop,
.survey-modal-close {
  appearance: none;
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--text-muted);
  background: var(--surface-soft);
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    transform 180ms ease;
}

.survey-remove-row {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-sm);
  display: inline-grid;
  place-items: center;
}

.survey-add-row {
  min-height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.survey-add-row:hover,
.survey-remove-row:hover,
.survey-primary-action:hover,
.survey-list-action:hover,
.survey-modal-close:hover {
  background: var(--control-hover);
  border-color: var(--border-strong);
  color: var(--text);
}

.survey-remove-row:hover,
.survey-list-action-danger:hover {
  background: rgba(244, 63, 94, 0.14);
  border-color: rgba(251, 113, 133, 0.5);
  color: #fb7185;
}

.survey-primary-action:active {
  transform: translateY(1px);
}

.survey-table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

.survey-table {
  min-width: 760px;
  display: grid;
  gap: 8px;
}

.survey-table-pulls {
  min-width: 980px;
}

.survey-row {
  display: grid;
  align-items: end;
  gap: 8px;
}

.survey-table-pulls .survey-row {
  grid-template-columns:
    42px
    minmax(136px, 1fr)
    90px
    105px
    minmax(136px, 0.95fr)
    minmax(160px, 1.1fr)
    minmax(140px, 1fr)
    44px;
}

.survey-table-items .survey-row {
  grid-template-columns: 42px minmax(220px, 1fr) 120px 120px 140px 44px;
}

.survey-table-remarks .survey-row {
  grid-template-columns: 42px minmax(220px, 1fr) 44px;
}

.survey-table-documentation {
  min-width: 0;
}

.survey-table-documentation .survey-row:not(.survey-row-header) {
  position: relative;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "photo"
    "description";
  align-items: start;
  gap: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  overflow: hidden;
}

.survey-table-documentation .survey-row-number {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  width: 44px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.survey-table-documentation .survey-photo-field {
  grid-area: photo;
}

.survey-table-documentation .survey-row-field {
  grid-area: description;
  padding: 10px;
}

.survey-table-documentation .survey-remove-row {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.survey-photo-field {
  position: relative;
  min-width: 0;
  padding: 0;
}

.survey-photo-preview {
  position: relative;
  min-width: 0;
  aspect-ratio: 16 / 10;
  max-height: none;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 12px;
}

.survey-photo-drop-hint {
  display: none;
  color: var(--text-soft);
  font-size: 11px;
}

.survey-photo-preview i {
  font-size: 20px;
}

.survey-photo-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.survey-photo-actions {
  position: absolute;
  top: 10px;
  right: 62px;
  z-index: 3;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 6px;
}

.survey-photo-choice {
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius-sm) - 2px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}

.survey-photo-choice i {
  font-size: 16px;
}

.survey-photo-choice:hover {
  border-color: var(--border-strong);
  background: var(--control-hover);
  color: var(--text);
}

.survey-photo-status {
  position: absolute;
  top: 50px;
  right: 0;
  width: 210px;
  margin: 0;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius-sm) - 2px);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.4;
}

.survey-photo-status:empty {
  display: none;
}

.survey-photo-status-info {
  color: var(--text-muted);
}

.survey-photo-status-danger {
  color: #fb7185;
}

.survey-photo-field.is-dragging {
  background: var(--control-hover);
  box-shadow: inset 0 0 0 4px var(--focus-ring);
}

.survey-photo-field.is-processing .survey-photo-preview img {
  opacity: 0.45;
}

.survey-photo-choice:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.survey-photo-choice:disabled {
  cursor: wait;
  opacity: 0.55;
}

.survey-photo-file {
  display: none;
}

.survey-table-documentation .survey-remove-row {
  align-self: start;
}

.survey-row-header {
  align-items: center;
  padding: 0 2px;
}

.survey-row-header span {
  text-align: left;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.35;
  font-weight: 700;
}

.survey-row-number {
  height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  background: var(--surface-soft);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
}

.survey-remove-row {
  align-self: end;
}

.survey-actions {
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.survey-primary-action {
  min-height: 48px;
  border-radius: var(--radius-sm);
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
}

.survey-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  padding: 18px;
  display: grid;
  place-items: center;
}

.survey-modal[hidden] {
  display: none;
}

.survey-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.62);
}

.survey-modal-panel {
  position: relative;
  width: min(100%, 800px);
  max-height: min(78vh, 620px);
  padding: 16px;
  overflow: auto;
  box-shadow: var(--shadow-soft);
}

.survey-unsaved-modal {
  z-index: 9100;
}

.survey-unsaved-modal .survey-unsaved-panel {
  width: min(100%, 560px);
}

.survey-unsaved-panel > p {
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

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

.survey-unsaved-actions .survey-list-action {
  flex: 1 1 auto;
  min-height: 42px;
}

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

.survey-saved-header h2,
.survey-saved-text h3,
.survey-saved-empty {
  margin: 0;
}

.survey-saved-header h2 {
  font-size: 15px;
  line-height: 1.35;
  font-weight: 700;
  color: var(--text);
}

.survey-modal-close {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-sm);
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}

.survey-saved-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.survey-saved-tools .survey-saved-search {
  flex: 1 1 200px;
  min-width: 0;
  margin-bottom: 0;
}

.survey-saved-tools .survey-import-action {
  flex: 0 0 auto;
  min-height: 42px;
  white-space: nowrap;
}

.survey-import-action:disabled {
  opacity: 0.55;
  cursor: wait;
}

.survey-saved-search {
  position: relative;
  display: block;
  margin-bottom: 12px;
}

.survey-saved-search-icon {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  transform: translateY(-50%);
  pointer-events: none;
}

.survey-saved-search-icon i {
  font-size: 14px;
  line-height: 1;
}

.survey-saved-search input {
  width: 100%;
  height: 42px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  padding: 0 12px 0 38px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 14px;
  transition:
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.survey-saved-search input:focus {
  border-color: var(--border-strong);
  background: var(--focus-bg);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

@supports (-webkit-touch-callout: none) {
  @media (hover: none) and (pointer: coarse) {
    .survey-saved-search input {
      font-size: 16px;
    }
  }
}

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

.survey-saved-item {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  background: var(--surface-soft);
}

.survey-saved-text {
  min-width: 0;
}

.survey-saved-text h3 {
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
  font-weight: 700;
  white-space: normal;
  overflow-wrap: anywhere;
}

.survey-saved-text p,
.survey-saved-empty {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
}

.survey-saved-text p {
  margin: 4px 0 0;
}

.survey-list-action {
  min-height: 38px;
  border-radius: var(--radius-sm);
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
}

.survey-toast {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 9500;
  width: min(calc(100vw - 36px), 380px);
  padding: 12px 14px;
  border: 1px solid var(--toast-border, var(--border-strong));
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  opacity: 0;
  transform: translate(-50%, -10px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.survey-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.survey-toast[hidden] {
  display: none;
}

.survey-toast i {
  margin-top: 1px;
  flex: 0 0 auto;
  color: var(--toast-accent, var(--text-muted));
  font-size: 16px;
  line-height: 1;
}

.survey-toast span {
  min-width: 0;
}

.survey-toast-success {
  --toast-accent: #34d399;
  --toast-bg: rgba(16, 185, 129, 0.14);
  --toast-border: rgba(52, 211, 153, 0.5);
}

.survey-toast-warning {
  --toast-accent: #fbbf24;
  --toast-bg: rgba(245, 158, 11, 0.14);
  --toast-border: rgba(251, 191, 36, 0.5);
}

.survey-toast-danger {
  --toast-accent: #fb7185;
  --toast-bg: rgba(244, 63, 94, 0.14);
  --toast-border: rgba(251, 113, 133, 0.5);
}

.survey-toast-info {
  --toast-accent: #60a5fa;
  --toast-bg: rgba(59, 130, 246, 0.14);
  --toast-border: rgba(96, 165, 250, 0.48);
}

@media (min-width: 760px) {
  .survey-field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .survey-field-wide {
    grid-column: 1 / -1;
  }

  .survey-card {
    padding: 20px;
  }

  .survey-saved-panel {
    padding: 20px;
  }

  .survey-saved-item {
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
  }

  .survey-table-documentation {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .survey-table-documentation .survey-row:not(.survey-row-header) {
    align-content: start;
  }

  .survey-photo-preview {
    aspect-ratio: 16 / 9;
  }

  .survey-photo-drop-hint {
    display: block;
  }

  .survey-actions {
    grid-template-columns:
      minmax(0, 0.75fr)
      minmax(0, 0.75fr)
      minmax(0, 0.75fr)
      minmax(0, 1.35fr)
      minmax(0, 1.25fr)
      minmax(0, 0.9fr);
    gap: 8px;
    padding: 16px;
  }

  .survey-primary-action {
    min-height: 46px;
    padding: 0 8px;
    gap: 7px;
    font-size: 13px;
    white-space: nowrap;
  }
}

@media (min-width: 1080px) {
  .survey-actions {
    grid-template-columns:
      minmax(0, 0.75fr)
      minmax(0, 0.75fr)
      minmax(0, 0.75fr)
      minmax(0, 1.35fr)
      minmax(0, 1.25fr)
      minmax(0, 0.9fr);
    gap: 10px;
  }

  .survey-primary-action {
    padding: 0 10px;
    font-size: 14px;
  }
}

@media (max-width: 640px) {
  .survey-form {
    gap: 12px;
  }

  .survey-card {
    padding: 14px;
  }

  .survey-card-header {
    margin-bottom: 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .survey-card-header h2 {
    padding: 0 2px;
  }

  .survey-field-grid {
    gap: 10px;
  }

  .survey-field-grid input,
  .survey-row-field input,
  .survey-row-field select {
    height: 46px;
    font-size: 16px;
  }

  .survey-add-row {
    width: 100%;
    min-height: 42px;
  }

  .survey-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 12px;
  }

  .survey-primary-action {
    min-height: 46px;
    padding: 0 12px;
    font-size: 13px;
  }

  .survey-modal {
    padding: 12px;
    place-items: end center;
  }

  .survey-modal-panel {
    width: 100%;
    max-height: min(86vh, 620px);
    padding: 14px;
    border-radius: var(--radius-lg) var(--radius-lg) var(--radius-sm) var(--radius-sm);
  }

  .survey-saved-tools .survey-import-action {
    width: 100%;
  }

  .survey-toast {
    top: 12px;
    width: min(calc(100vw - 24px), 380px);
  }
}

@media (max-width: 480px) {
  .survey-home-button {
    width: 44px;
    min-height: 44px;
    padding: 0;
  }

  .survey-home-button i {
    font-size: 26px;
  }

  .survey-home-button span {
    display: none;
  }

  .survey-actions {
    grid-template-columns: 1fr;
  }

  .survey-primary-action {
    justify-content: flex-start;
    padding: 0 14px;
  }

  .survey-saved-item {
    padding: 12px;
  }

  .survey-list-action {
    min-height: 42px;
  }
}

@media (max-width: 759px) {
  .survey-actions-slot {
    min-width: 0;
    min-height: 58px;
  }

  .survey-actions {
    position: fixed;
    left: max(16px, env(safe-area-inset-left));
    right: max(16px, env(safe-area-inset-right));
    bottom: calc(8px + env(safe-area-inset-bottom));
    z-index: 8000;
    width: auto;
    max-width: 520px;
    margin-inline: auto;
    padding: 6px;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-soft);
  }

  .survey-actions.is-docked {
    position: static;
    left: auto;
    right: auto;
    bottom: auto;
    z-index: auto;
    width: 100%;
    max-width: none;
    margin-inline: 0;
    box-shadow: none;
  }

  .survey-primary-action {
    width: 100%;
    min-width: 0;
    min-height: 46px;
    padding: 5px 0 4px;
    border: 0;
    justify-content: center;
    flex-direction: column;
    gap: 3px;
    background: transparent;
  }

  .survey-primary-action i {
    font-size: 18px;
    line-height: 1;
  }

  .survey-primary-action span {
    display: none;
  }

  .survey-primary-action::after {
    content: attr(data-mobile-label);
    display: block;
    color: inherit;
    font-size: 10px;
    line-height: 1;
    font-weight: 500;
    white-space: nowrap;
  }
}

@media (max-width: 380px) {
  .survey-actions {
    left: max(14px, env(safe-area-inset-left));
    right: max(14px, env(safe-area-inset-right));
  }
}
