:root {
  color-scheme: dark;
  font-family: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #000;
  color: #f4f4f5;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --bg: #000;
  --surface: #0a0a0b;
  --surface-raised: #131315;
  --hover: #1b1b1e;
  --border: #222225;
  --line-strong: #37373c;
  --muted: #8c8c94;
  --faint: #8c8c94;
  --accent: #ffb84d;
  --accent-ink: #0b0b0c;
  --accent-wash: rgb(255 184 77 / 16%);
  --danger: #ff5d6c;
  --ok: #7ddba8;
  --radius: 11px;
  --motion-fast: 120ms;
  --motion-base: 200ms;
  --motion-medium: 280ms;
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  background: #121212;
}

body {
  min-height: 100vh;
}

[hidden] {
  display: none !important;
}

.login-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  background: #121212;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
}

.page-view h2 {
  margin: 0;
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -.03em;
}

.page-intro {
  margin: 8px 0 24px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.discord-button {
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  padding: 0 24px;
  border: 0;
  border-radius: 9px;
  font: inherit;
  font-size: 16px;
  font-weight: 650;
  color: #fff;
  background: #5865f2;
  cursor: pointer;
  transition: background-color .15s ease, transform .15s ease;
}

.discord-button:hover:not(:disabled) {
  background: #4752c4;
}

.discord-button:active:not(:disabled) {
  transform: translateY(1px);
}

.discord-button:disabled {
  cursor: not-allowed;
}

.discord-button.is-failed,
.discord-button.is-failed:hover {
  background: #5865f2;
}

.button-icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
}

.button-icon > svg {
  width: 24px;
  height: 24px;
}

.spinner,
.popup-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #e3e3e355;
  border-top-color: #e3e3e3;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.failure-icon {
  overflow: visible;
}

.failure-icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 34;
  stroke-dashoffset: 34;
  animation: draw-x .28s ease-out forwards;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes draw-x {
  to {
    stroke-dashoffset: 0;
  }
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
}

.sidebar {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 14px 16px;
  border-right: 1px solid var(--border);
  background: #121212;
}

.account-menu {
  position: relative;
  margin-left: auto;
}

.account-trigger {
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 12px 5px 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #e3e3e3;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color var(--motion-fast) ease, border-color var(--motion-fast) ease;
}

.account-trigger:hover,
.account-trigger[aria-expanded="true"] {
  border-color: var(--border);
  background: #000;
}

.account-trigger .avatar,
.avatar-fallback {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
}

.avatar-fallback {
  display: grid;
  place-items: center;
  background: #121212;
  color: #e3e3e3;
  font-size: 13px;
  font-weight: 600;
}

.account-trigger-name {
  overflow: hidden;
  max-width: 200px;
  font-size: 14px;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-chevron {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--faint);
  transition: transform var(--motion-base) var(--ease-out), color var(--motion-fast) ease;
}

.account-chevron path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.account-trigger[aria-expanded="true"] .account-chevron {
  transform: rotate(180deg);
  color: var(--accent);
}

.account-popover {
  position: absolute;
  z-index: 5;
  top: calc(100% + 6px);
  right: 0;
  width: min(280px, calc(100vw - 32px));
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #121212;
  box-shadow: 0 16px 40px #0009, 0 2px 8px #0008;
  animation: popover-in var(--motion-base) var(--ease-out) both;
  transform-origin: top right;
}

@keyframes popover-in {
  from {
    opacity: 0;
    transform: translateY(-5px) scale(.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.popover-heading {
  display: grid;
  gap: 4px;
  padding: 2px 2px 12px;
}

.popover-name,
.popover-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.popover-name {
  color: #e3e3e3;
  font-size: 14px;
  font-weight: 600;
}

.popover-email {
  color: var(--muted);
  font-size: 12px;
}

.popover-details {
  margin: 0;
  padding: 8px 2px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.popover-details > div {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 10px;
  padding: 5px 0;
  font-size: 12px;
}

.popover-details dt {
  color: var(--muted);
}

.popover-details dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.popover-sign-out {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 8px;
  padding: 0 6px;
  border: 0;
  border-radius: 5px;
  color: #ff6b6b;
  background: transparent;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: color var(--motion-fast) ease, background-color var(--motion-fast) ease;
}

.popover-sign-out:hover {
  background: #ff6b6b1a;
  color: #ff8585;
}

.popover-sign-out svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.sidebar-title {
  padding: 4px 10px 24px;
  color: #e3e3e3;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -.015em;
  text-decoration: none;
}

.sidebar-nav {
  display: grid;
  gap: 4px;
}

.nav-link {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: 13px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: color var(--motion-fast) ease, background-color var(--motion-fast) ease, transform var(--motion-fast) ease;
}

.nav-link:hover {
  color: #e3e3e3;
  background: var(--accent-wash);
  transform: translateX(2px);
}

.nav-link[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-wash);
}

.nav-toggle {
  width: 100%;
  font-family: inherit;
  cursor: pointer;
}

.nav-toggle[aria-expanded="true"] {
  color: var(--accent);
  background: var(--accent-wash);
}

.nav-chevron {
  width: 14px !important;
  height: 14px !important;
  margin-left: auto;
  transition: transform var(--motion-base) var(--ease-out);
}

.nav-toggle[aria-expanded="true"] .nav-chevron {
  transform: rotate(180deg);
}

.nav-link svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.subnav {
  display: grid;
  gap: 2px;
  margin: 2px 0 6px 19px;
  padding-left: 12px;
  border-left: 1px solid var(--border);
  animation: subnav-in var(--motion-base) var(--ease-out) both;
}

.subnav-link {
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 0 9px;
  border-radius: 5px;
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
  transition: color var(--motion-fast) ease, background-color var(--motion-fast) ease;
}

.subnav-link:hover,
.subnav-link[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-wash);
}

@keyframes subnav-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.main-panel {
  min-width: 0;
}

.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 32px;
  border-bottom: 1px solid var(--border);
  background: #121212;
}

.topbar .account-menu {
  flex: none;
}

.page-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.avatar {
  flex: none;
  border-radius: 50%;
  background: var(--surface-raised);
  object-fit: cover;
}

.page-content {
  width: min(100%, 960px);
  padding: 40px 32px 64px;
}

.app-shell:not([hidden]) .page-content {
  animation: page-in var(--motion-medium) var(--ease-out) both;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-view h2 {
  font-size: 24px;
}

.forms-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-link,
.secondary-link,
.primary-button,
.quiet-button,
.remove-question,
.remove-user {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--motion-fast) ease, background-color var(--motion-fast) ease, color var(--motion-fast) ease, border-color var(--motion-fast) ease;
}

.primary-link,
.primary-button {
  color: #121212;
  background: var(--accent);
}

.primary-link:hover,
.primary-button:hover:not(:disabled) {
  background: #a4c5ff;
  transform: translateY(-1px);
}

.secondary-link,
.quiet-button {
  border-color: var(--border);
  color: var(--text, #e3e3e3);
  background: #121212;
}

.secondary-link:hover,
.quiet-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.primary-button:disabled {
  cursor: wait;
  opacity: .6;
}

.editor-panel {
  width: min(100%, 700px);
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #121212;
}

.field-label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 8px;
  color: #e3e3e3;
  font-size: 13px;
  font-weight: 550;
}

.field-label span,
.form-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.text-input {
  width: 100%;
  min-height: 42px;
  margin: 0 0 18px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: #e3e3e3;
  background: #121212;
  font: inherit;
  font-size: 13px;
  transition: border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease;
}

.text-input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-wash);
}

.text-area {
  min-height: 88px;
  resize: vertical;
}

.question-header,
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.question-header {
  margin: 4px 0 14px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.question-header h3,
.list-heading,
.editor-panel > h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.question-header .quiet-button {
  min-height: 34px;
}

.question-row {
  position: relative;
  z-index: 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--border);
  animation: subnav-in var(--motion-base) var(--ease-out) both;
}

.question-row + .question-row {
  margin-top: 14px;
}

.question-row.dropdown-active,
.public-question.dropdown-active {
  z-index: 50;
}

.question-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px auto;
  align-items: start;
  gap: 8px;
}

.question-controls .text-input {
  min-width: 0;
}

.question-type {
  padding-right: 8px;
}

.remove-question,
.remove-user {
  min-height: 40px;
  border-color: var(--border);
  color: #ff777c;
  background: transparent;
}

.remove-question:hover,
.remove-user:hover {
  border-color: #ff777c66;
  background: #ff777c14;
}

.form-actions {
  justify-content: flex-end;
  margin-top: 10px;
}

.inline-status {
  flex: 1;
  margin: 0;
  color: #ff9296;
  font-size: 13px;
  line-height: 1.5;
}

.inline-status[data-kind="success"] {
  color: var(--accent);
}

.record-list {
  width: min(100%, 700px);
  display: grid;
  gap: 8px;
}

.record-link,
.user-record {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: inherit;
  background: #121212;
  text-decoration: none;
  transition: border-color var(--motion-fast) ease, background-color var(--motion-fast) ease, transform var(--motion-fast) ease;
}

.record-link:hover {
  border-color: #8ab4ff66;
  background: var(--accent-wash);
  transform: translateY(-1px);
}

.record-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.record-copy strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
}

.record-copy > span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
}

.record-meta {
  flex: none;
  color: var(--muted);
  font-size: 12px;
}

.back-link {
  display: inline-flex;
  margin-bottom: 20px;
  color: var(--accent);
  font-size: 13px;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.question-preview {
  display: grid;
  gap: 10px;
  padding-left: 22px;
}

.question-preview li {
  padding-left: 4px;
}

.question-preview strong,
.question-preview span {
  display: block;
  font-size: 13px;
}

.question-preview span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.form-meta {
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.public-form-shell {
  min-height: 100vh;
  display: grid;
  place-items: start center;
  padding: clamp(24px, 8vh, 80px) 20px;
}

.public-form-card {
  width: min(100%, 680px);
  padding: clamp(22px, 5vw, 40px);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #121212;
  box-shadow: 0 18px 50px #0005;
  animation: page-in var(--motion-medium) var(--ease-out) both;
}

.public-form-card h1 {
  margin: 0;
  font-size: clamp(24px, 5vw, 32px);
  letter-spacing: -.03em;
}

.public-question-fields {
  display: grid;
  gap: 20px;
}

.public-question .text-input {
  margin-bottom: 0;
}

.privacy-notice {
  margin: 18px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.public-form-card .primary-button {
  min-width: 150px;
}

.submission-success {
  margin: 20px 0 0;
  color: var(--accent);
  line-height: 1.6;
}

.share-panel,
.responses-section {
  width: min(100%, 700px);
  margin-top: 22px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #121212;
}

.share-panel h3,
.responses-section > h3 {
  margin: 0;
  font-size: 14px;
}

.share-panel > p {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.share-link {
  display: block;
  overflow-wrap: anywhere;
  color: var(--accent);
  font-size: 13px;
}

.response-list {
  display: grid;
  gap: 10px;
}

.response-card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #121212;
}

.response-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  color: var(--muted);
  font-size: 12px;
}

.response-trace {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.response-answers {
  display: grid;
  gap: 12px;
  margin: 16px 0 0;
}

.response-answer dt {
  color: var(--muted);
  font-size: 12px;
}

.response-answer dd {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.55;
}

.managed-user-note {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.admin-editor {
  margin-bottom: 32px;
}

.permission-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.permission-fields legend {
  padding: 0 5px;
  color: var(--muted);
  font-size: 12px;
}

.permission-fields label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #e3e3e3;
  font-size: 13px;
  cursor: pointer;
}

.permission-fields input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.list-heading {
  margin: 0 0 12px;
}

.user-record {
  min-height: 60px;
  flex-wrap: wrap;
}

.user-summary {
  min-width: 0;
  display: flex;
  flex: 1;
  align-items: center;
  gap: 12px;
}

.user-avatar,
.collaborator-avatar {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  background: var(--surface-raised);
  object-fit: cover;
}

.user-identity {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.user-identity > * {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-identity > span,
.user-identity code,
.user-permissions-summary {
  color: var(--muted);
  font-size: 12px;
}

.user-record-actions,
.user-editor-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.user-inline-editor {
  width: 100%;
  display: grid;
  gap: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.user-inline-editor .permission-fields {
  justify-content: flex-start;
}

.permission-fields input:disabled {
  opacity: .55;
}

.permission-required small {
  color: var(--muted);
  font-size: 11px;
}

.sign-out-dialog {
  width: min(100% - 32px, 400px);
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: #e3e3e3;
  background: #121212;
  box-shadow: 0 24px 70px #000b;
  animation: dialog-in var(--motion-medium) var(--ease-out) both;
}

.sign-out-dialog::backdrop {
  background: #000a;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.dialog-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  border-radius: 8px;
  color: #ff6b6b;
  background: #ff6b6b1a;
}

.dialog-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.sign-out-dialog h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -.02em;
}

.sign-out-dialog > p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.sign-out-dialog > .dialog-error {
  color: #e3e3e3;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 24px;
}

.dialog-actions button {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: #e3e3e3;
  background: #121212;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.dialog-actions button:hover {
  color: #121212;
  background: #e3e3e3;
}

.dialog-actions .dialog-confirm {
  border-color: #ff6b6b;
  color: #121212;
  background: #ff6b6b;
}

.dialog-actions .dialog-confirm:hover {
  background: #ff8585;
}

.dialog-actions .dialog-confirm:disabled {
  cursor: wait;
  opacity: .65;
}

.empty-state {
  max-width: 680px;
  padding: 32px 24px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.status-message {
  margin: 18px 0 0;
  color: #e3e3e3;
  font-size: 13px;
  line-height: 1.5;
}

.popup-page {
  display: grid;
  place-items: center;
}

.popup-status {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.popup-spinner {
  width: 18px;
  height: 18px;
}

@media (max-width: 720px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
  }

  .sidebar {
    min-height: auto;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-title {
    padding: 0 8px;
  }

  .sidebar-nav {
    grid-row: 2;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar {
    min-height: 68px;
    padding: 10px 20px;
  }

  .page-content {
    padding: 32px 20px 48px;
  }

  .question-controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .question-controls .text-input {
    margin-bottom: 8px;
  }

  .remove-question {
    justify-self: start;
    margin-bottom: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none;
    animation: none !important;
  }
}

html,
body {
  background: var(--bg);
}

body,
button,
input,
select,
textarea {
  font-family: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;
}

::selection {
  color: var(--accent-ink);
  background: var(--accent);
}

.sidebar,
.topbar,
.login-shell {
  background: var(--bg);
}

.sidebar {
  border-color: var(--border);
}

.sidebar-title,
.page-title,
.page-view h2,
.field-label,
.popover-name,
.popover-details dd,
.account-trigger {
  color: var(--ink, #f4f4f5);
}

.nav-link,
.subnav-link,
.page-intro,
.popover-email,
.popover-details dt,
.record-meta,
.record-copy > span,
.form-meta,
.share-panel > p,
.response-meta,
.privacy-notice {
  color: var(--muted);
}

.nav-link:hover,
.nav-link[aria-current="page"],
.nav-toggle[aria-expanded="true"],
.subnav-link:hover,
.subnav-link[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-wash);
}

.account-trigger {
  border-color: var(--line-strong);
  background: var(--surface);
}

.account-trigger:hover,
.account-trigger[aria-expanded="true"],
.account-popover,
.editor-panel,
.share-panel,
.responses-section,
.response-card,
.record-link,
.user-record,
.sign-out-dialog {
  border-color: var(--border);
  background: var(--surface);
}

.account-trigger:hover,
.account-trigger[aria-expanded="true"] {
  border-color: var(--line-strong);
}

.account-popover,
.sign-out-dialog {
  box-shadow: 0 18px 48px #000b, 0 2px 8px #0008;
}

.text-input,
input[type="text"],
input[type="url"],
input[type="file"],
select,
textarea {
  border-color: var(--line-strong);
  border-radius: var(--radius);
  color: #f4f4f5;
  background: var(--surface);
  font: inherit;
}

.text-input:hover,
input:hover,
textarea:hover,
select:hover {
  border-color: var(--muted);
}

.text-input:focus,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-wash);
}

.primary-link,
.primary-button,
.dialog-actions .dialog-confirm {
  color: var(--accent-ink);
  background: var(--accent);
}

.primary-link:hover,
.primary-button:hover:not(:disabled),
.dialog-actions .dialog-confirm:hover {
  color: var(--accent-ink);
  background: #ffca75;
}

.secondary-link,
.quiet-button,
.dialog-actions button {
  border-color: var(--line-strong);
  color: #f4f4f5;
  background: var(--surface);
}

.secondary-link:hover,
.quiet-button:hover,
.dialog-actions button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--hover);
}

.remove-question,
.remove-user {
  color: var(--danger);
}

.record-link:hover {
  border-color: var(--accent);
  background: var(--hover);
}

.public-form-shell {
  padding: clamp(24px, 7vh, 68px) 20px;
  background: var(--bg);
}

.public-form-card {
  width: min(100%, 720px);
  overflow: visible;
  padding: 0 0 30px;
  border-color: var(--border);
  border-radius: 20px;
  background: transparent;
  box-shadow: none;
}

.public-form-banner {
  width: 100%;
  height: clamp(150px, 30vw, 260px);
  display: block;
  margin-bottom: 0;
  border-radius: 20px 20px 0 0;
  object-fit: cover;
}

.public-form-card > h1,
.public-form-card > .page-intro,
.public-form-card > form,
.public-form-card > .submission-success,
.public-form-card > .status-message {
  margin-right: 28px;
  margin-left: 28px;
}

.public-form-card > h1 {
  margin-top: 0;
  padding-top: 27px;
  color: #f4f4f5;
  font-size: clamp(30px, 6vw, 42px);
  line-height: 1.08;
}

.public-form-card > .page-intro {
  margin-top: 10px;
  margin-bottom: 24px;
}

.public-question-fields {
  gap: 12px;
}

.public-question {
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.public-question .field-label {
  margin-bottom: 12px;
  font-size: 15px;
  font-weight: 580;
}

.public-question .text-input {
  min-height: 42px;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
}

.public-question textarea.text-input {
  min-height: 90px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 12px;
}

.public-question .text-input:focus {
  border-color: var(--accent);
  box-shadow: none;
}

.public-question textarea.text-input:focus {
  box-shadow: 0 0 0 4px var(--accent-wash);
}

.public-form-card .privacy-notice {
  margin-top: 20px;
}

.public-form-card .primary-button {
  min-height: 44px;
  margin-top: 4px;
  border: 0;
  border-radius: 8px;
  font-size: 14px;
}

.detail-banner {
  width: min(100%, 700px);
  max-height: 240px;
  margin: 0 0 20px;
  border-radius: 12px;
  object-fit: cover;
}

.banner-editor {
  display: grid;
  gap: 12px;
  margin: -22px -22px 24px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-raised);
}

.banner-editor h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 620;
}

.banner-editor p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.banner-preview {
  display: grid;
  gap: 9px;
}

.banner-preview img {
  width: 100%;
  max-height: 180px;
  border: 1px solid var(--border);
  border-radius: 9px;
  object-fit: cover;
}

.banner-upload {
  width: fit-content;
  cursor: pointer;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.question-row {
  margin: 0 0 12px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.question-row + .question-row {
  margin-top: 0;
}

.question-row .field-label {
  margin-bottom: 10px;
}

.editor-panel {
  padding: 22px;
  border-radius: 16px;
  box-shadow: 0 1px 2px #0004;
}

.text-input {
  min-height: 44px;
  padding: 10px 13px;
  font-size: 14px;
}

.text-area {
  min-height: 100px;
}

.question-header {
  margin: 10px 0 14px;
  border-top: 1px solid var(--border);
}

.share-panel,
.responses-section {
  border-radius: 12px;
}

.form-access-notice {
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid #ffb84d55;
  border-radius: 9px;
  color: #ffd18a;
  background: #ffb84d12;
  font-size: 13px;
  line-height: 1.55;
}

.form-collaborators {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.form-collaborators h4 {
  margin: 0;
  font-size: 14px;
}

.form-collaborators > p,
.form-collaborators > form > p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.collaborator-form {
  margin-top: 14px;
}

.collaborator-entry {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.collaborator-entry .text-input {
  max-width: 360px;
  margin: 0;
}

.collaborator-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.collaborator-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
}

.collaborator-item code {
  overflow-wrap: anywhere;
  color: #e3e3e3;
  font-size: 12px;
}

.collaborator-item .remove-user {
  min-height: 32px;
  flex: none;
}

.responses-section > h3,
.share-panel h3 {
  font-size: 18px;
}

.sign-out-dialog {
  color: #f4f4f5;
}

.dialog-actions .dialog-confirm {
  border-color: var(--danger);
  color: #111;
  background: var(--danger);
}

.dialog-actions .dialog-confirm:hover {
  background: #ff7b86;
}

@media (max-width: 720px) {
  .collaborator-entry {
    flex-direction: column;
  }

  .collaborator-entry .text-input {
    width: 100%;
    max-width: none;
  }

  .public-form-card > h1,
  .public-form-card > .page-intro,
  .public-form-card > form,
  .public-form-card > .submission-success,
  .public-form-card > .status-message {
    margin-right: 16px;
    margin-left: 16px;
  }

  .public-question {
    padding: 17px;
  }

  .banner-editor {
    margin-right: -22px;
    margin-left: -22px;
  }
}

.form-tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 24px;
  border-bottom: 1px solid var(--border);
}

.form-tab {
  position: relative;
  min-height: 42px;
  padding: 0 13px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: color var(--motion-fast) ease;
}

.form-tab:hover,
.form-tab[aria-selected="true"] {
  color: var(--accent);
}

.form-tab[aria-selected="true"]::after {
  position: absolute;
  right: 10px;
  bottom: -1px;
  left: 10px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
  content: "";
}

.form-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.form-heading-row .page-intro {
  max-width: 680px;
}

.form-state {
  flex: none;
  padding: 6px 10px;
  border: 1px solid #7ddba844;
  border-radius: 999px;
  color: var(--ok);
  font-size: 12px;
}

.form-state[data-state="closed"] {
  border-color: #ff5d6c55;
  color: #ff9296;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}

.detail-actions [hidden] {
  display: none;
}

.danger-button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid #ff5d6c55;
  border-radius: 6px;
  color: var(--danger);
  background: transparent;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color var(--motion-fast) ease, background-color var(--motion-fast) ease;
}

.danger-button:hover {
  border-color: var(--danger);
  background: #ff5d6c14;
}

.form-setting-summary {
  margin: 16px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

.form-settings {
  display: grid;
  gap: 14px;
  margin: 22px 0 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.form-settings h3 {
  margin: 0;
  font-size: 14px;
}

.toggle-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 48px;
  cursor: pointer;
}

.toggle-row > span:first-child {
  display: grid;
  gap: 4px;
  color: #f4f4f5;
  font-size: 13px;
}

.toggle-row small {
  max-width: 530px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.switch-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.switch {
  position: relative;
  flex: none;
  width: 38px;
  height: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-raised);
  transition: background-color var(--motion-fast) ease, border-color var(--motion-fast) ease;
}

.switch::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted);
  content: "";
  transition: transform var(--motion-fast) var(--ease-out), background-color var(--motion-fast) ease;
}

.switch-input:checked + .switch {
  border-color: var(--accent);
  background: var(--accent-wash);
}

.switch-input:checked + .switch::after {
  transform: translateX(16px);
  background: var(--accent);
}

.switch-input:focus-visible + .switch {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.question-controls {
  grid-template-columns: minmax(0, 1fr) minmax(170px, 220px) auto;
}

.question-type {
  min-width: 0;
}

.question-options-editor {
  display: grid;
  gap: 6px;
  margin: 4px 0 12px;
}

.question-options-editor .field-label {
  display: grid;
  gap: 8px;
}

.question-options-editor .text-area {
  margin: 0;
}

.question-required {
  justify-content: flex-start;
  width: fit-content;
  min-height: 30px;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.question-required > span:first-child {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.question-required .switch {
  width: 32px;
  height: 19px;
}

.question-required .switch::after {
  width: 11px;
  height: 11px;
}

.question-required .switch-input:checked + .switch::after {
  transform: translateX(13px);
}

.remove-question:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.dropdown-select {
  position: relative;
  min-width: 0;
  width: 100%;
}

.dropdown-trigger {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: #f4f4f5;
  background: var(--surface);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease;
}

.dropdown-trigger:hover,
.dropdown-select.is-open .dropdown-trigger,
.dropdown-trigger:focus-visible {
  border-color: var(--accent);
}

.dropdown-trigger:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--accent-wash);
}

.dropdown-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-value.is-placeholder {
  color: var(--muted);
}

.dropdown-chevron {
  flex: none;
  width: 8px;
  height: 8px;
  border-right: 1.6px solid var(--muted);
  border-bottom: 1.6px solid var(--muted);
  transform: translateY(-2px) rotate(45deg);
  transition: transform var(--motion-base) var(--ease-out), border-color var(--motion-fast) ease;
}

.dropdown-select.is-open .dropdown-chevron {
  transform: translateY(2px) rotate(225deg);
  border-color: var(--accent);
}

.dropdown-options {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  z-index: 60;
  max-height: 248px;
  overflow: auto;
  margin: 0;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-raised);
  box-shadow: 0 20px 50px #000b, 0 2px 8px #0008;
  list-style: none;
  animation: dropdown-in 140ms var(--ease-out) both;
}

.dropdown-options[hidden] {
  display: none;
}

.dropdown-option {
  position: relative;
  width: 100%;
  min-height: 36px;
  padding: 8px 34px 8px 11px;
  border: 0;
  border-radius: 8px;
  color: #e3e3e3;
  background: transparent;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.dropdown-option:hover,
.dropdown-option:focus-visible {
  outline: none;
  background: var(--hover);
}

.dropdown-option[aria-selected="true"] {
  color: var(--accent);
  font-weight: 600;
}

.dropdown-option[aria-selected="true"]::after {
  position: absolute;
  top: calc(50% - 5px);
  right: 13px;
  width: 10px;
  height: 5px;
  border-bottom: 2px solid var(--accent);
  border-left: 2px solid var(--accent);
  content: "";
  transform: rotate(-45deg);
}

@keyframes dropdown-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(.99);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.public-answer-dropdown {
  margin-top: 8px;
}

.public-question {
  position: relative;
  z-index: 0;
}

.choice-options {
  display: grid;
  gap: 10px;
}

.choice-option {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #e3e3e3;
  font-size: 14px;
  cursor: pointer;
}

.rating-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.rating-option {
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.rating-option:has(input:checked) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-wash);
}

.question-optional {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.choice-input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--accent);
}

.form-closed-notice {
  margin: 18px 28px 0;
  padding: 14px 16px;
  border: 1px solid #ff5d6c55;
  border-radius: 9px;
  color: #ff9296;
  background: #ff5d6c0d;
  font-size: 14px;
}

.form-action-dialog .dialog-icon {
  color: var(--danger);
}

.form-action-dialog .dialog-icon svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

@media (max-width: 720px) {
  .form-heading-row {
    flex-direction: column-reverse;
    gap: 10px;
  }

  .question-controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .question-controls .dropdown-select {
    grid-row: 2;
  }

  .question-controls .remove-question {
    justify-self: start;
  }

  .form-closed-notice {
    margin-right: 16px;
    margin-left: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dropdown-options {
    animation: none;
  }
}
