.sm-signal-dialog {
  width: min(570px, calc(100% - 32px));
  max-height: min(92vh, 760px);
  padding: 0;
  overflow: auto;
  border: 1px solid rgba(37, 239, 255, 0.28);
  border-radius: 26px;
  background: linear-gradient(145deg, #111b29, #080e17);
  color: #fff;
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.72);
  scrollbar-width: thin;
}

.sm-signal-dialog::backdrop {
  background: rgba(3, 7, 12, 0.8);
  backdrop-filter: blur(12px);
}

.sm-signal-dialog[open] {
  animation: sm-signal-in 0.25s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes sm-signal-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.sm-signal-head {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 18px 22px 15px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(10, 17, 27, 0.92);
  backdrop-filter: blur(14px);
}

.sm-signal-head > div > span {
  color: var(--cyan, #25efff);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.sm-signal-head h2 {
  margin: 6px 0 4px;
  font-size: clamp(27px, 5vw, 38px);
  line-height: 0.96;
  letter-spacing: -0.055em;
}

.sm-signal-head p {
  margin: 0;
  color: var(--muted, #96a1b3);
  font-size: 10px;
  line-height: 1.45;
}

.sm-signal-head > button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.045);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
}

#sm-signal-form,
.sm-signal-form {
  padding: 16px 22px 0;
  display: grid;
  gap: 12px;
}

.sm-form-section {
  display: grid;
  gap: 11px;
}

.sm-section-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 2px;
}

.sm-section-title span {
  color: #f8fbff;
  font-size: 13px;
  font-weight: 900;
}

.sm-section-title small {
  max-width: 230px;
  color: var(--muted, #96a1b3);
  font-size: 8px;
  line-height: 1.4;
  text-align: right;
}

.sm-signal-row,
.sm-signal-target-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px;
  gap: 10px;
}

.sm-signal-target-row {
  grid-template-columns: minmax(0, 1fr) minmax(190px, 0.85fr);
  align-items: start;
}

#sm-signal-form label,
.sm-form-field,
#sm-signal-manage-form label {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #d9e5f0;
  font-size: 9px;
  font-weight: 850;
}

.sm-signal-row em {
  color: var(--muted, #96a1b3);
  font-size: 8px;
  font-style: normal;
  font-weight: 650;
}

#sm-signal-form input,
#sm-signal-form select,
#sm-signal-form textarea,
#sm-signal-manage-form input,
#sm-signal-manage-form select,
#sm-signal-manage-form textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 13px;
  background: #080f18;
  color: #fff;
  font: inherit;
  font-size: 11px;
  outline: 0;
}

#sm-signal-form textarea {
  min-height: 74px;
  max-height: 150px;
  resize: none;
  line-height: 1.5;
}

#sm-signal-manage-form textarea {
  min-height: 100px;
  resize: vertical;
}

#sm-signal-form input:focus,
#sm-signal-form select:focus,
#sm-signal-form textarea:focus,
#sm-signal-manage-form input:focus,
#sm-signal-manage-form select:focus,
#sm-signal-manage-form textarea:focus {
  border-color: var(--cyan, #25efff);
  box-shadow: 0 0 0 4px rgba(37, 239, 255, 0.07);
}

#sm-signal-form [data-error],
.sm-pin-field [data-manage-error] {
  min-height: 12px;
  color: #ff82b9;
  font-size: 8px;
  font-weight: 700;
}

.sm-signal-helper {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.sm-signal-helper b {
  color: var(--muted, #96a1b3);
  font-size: 8px;
  font-weight: 850;
}

.sm-signal-helper small {
  flex: 1;
}

.sm-activity-field {
  gap: 7px;
}

.sm-activity-dropdown {
  position: relative;
  display: grid;
  gap: 7px;
}

.sm-activity-toggle {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 13px;
  background: #080f18;
  color: #fff;
  font: inherit;
  font-size: 11px;
  font-weight: 850;
  cursor: pointer;
}

.sm-activity-toggle span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sm-activity-toggle span:last-child {
  color: var(--cyan, #25efff);
  font-size: 18px;
  line-height: 1;
  transition: transform 0.16s ease;
}

.sm-activity-dropdown.is-open .sm-activity-toggle span:last-child {
  transform: rotate(180deg);
}

.sm-activity-toggle:hover,
.sm-activity-toggle:focus-visible {
  border-color: rgba(37, 239, 255, 0.45);
  box-shadow: 0 0 0 4px rgba(37, 239, 255, 0.07);
}

.sm-activity-list {
  display: grid;
  gap: 6px;
  max-height: min(320px, 42vh);
  padding: 8px;
  overflow: auto;
  border: 1px solid rgba(37, 239, 255, 0.2);
  border-radius: 15px;
  background: rgba(7, 13, 22, 0.98);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.34);
}

.sm-activity-list[hidden] {
  display: none;
}

.sm-activity-option {
  width: 100%;
  min-height: 39px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: #c5d1dd;
  font: inherit;
  font-size: 10px;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease,
    transform 0.16s ease;
}

.sm-activity-option:hover,
.sm-activity-option:focus-visible {
  border-color: rgba(37, 239, 255, 0.45);
  color: #fff;
}

.sm-activity-option.active {
  border-color: rgba(37, 239, 255, 0.65);
  background: rgba(37, 239, 255, 0.14);
  color: var(--cyan, #25efff);
  box-shadow: 0 0 20px rgba(37, 239, 255, 0.09);
}

.sm-activity-option.active::after {
  content: "✓";
  color: var(--cyan, #25efff);
}

.sm-duration-field {
  margin: 0;
  padding: 0;
  border: 0;
}

.sm-duration-field legend {
  margin-bottom: 7px;
  color: #d9e5f0;
  font-size: 9px;
  font-weight: 850;
}

.sm-duration-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.sm-duration-options label {
  min-width: 0;
  cursor: pointer;
}

.sm-duration-options input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.sm-duration-options span {
  min-height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted, #96a1b3);
  font-size: 9px;
  font-weight: 900;
}

.sm-duration-options input:checked + span {
  border-color: rgba(37, 239, 255, 0.48);
  background: rgba(37, 239, 255, 0.12);
  color: var(--cyan, #25efff);
}

.sm-duration-field > small {
  display: block;
  margin-top: 4px;
}

.sm-signal-selfie {
  border: 1px solid rgba(37, 239, 255, 0.16);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.032);
  overflow: hidden;
}

.sm-selfie-toggle {
  width: 100%;
  min-height: 54px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.sm-selfie-toggle-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.sm-selfie-toggle-main strong {
  font-size: 11px;
  font-weight: 950;
}

.sm-selfie-toggle-main small {
  color: var(--muted, #96a1b3);
  font-size: 8px;
  font-weight: 700;
}

.sm-selfie-summary-thumb img {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  object-fit: cover;
  background: #07101a;
}

.sm-selfie-chevron {
  color: var(--cyan, #25efff);
  font-size: 20px;
  line-height: 1;
  transition: transform 0.18s ease;
}

.sm-signal-selfie.is-open .sm-selfie-chevron {
  transform: rotate(180deg);
}

.sm-selfie-panel {
  padding: 0 12px 12px;
  display: grid;
  gap: 10px;
}

.sm-selfie-panel[hidden] {
  display: none;
}

.sm-selfie-warning {
  margin: 0;
  padding: 10px 11px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.04);
  color: #aebccc;
  font-size: 8px;
  line-height: 1.5;
}

.sm-selfie-actions,
.sm-selfie-preview-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sm-selfie-actions label,
.sm-selfie-preview-actions label,
.sm-selfie-preview-actions button {
  min-height: 42px;
  display: grid;
  place-items: center;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.045);
  color: #dce8f1;
  font: inherit;
  font-size: 9px;
  font-weight: 850;
  text-align: center;
  cursor: pointer;
}

.sm-selfie-actions input,
.sm-selfie-preview-actions input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.sm-selfie-actions label:hover,
.sm-selfie-preview-actions label:hover,
.sm-selfie-preview-actions button:hover {
  border-color: rgba(37, 239, 255, 0.42);
  background: rgba(37, 239, 255, 0.08);
  color: #fff;
}

.sm-selfie-preview {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.sm-selfie-preview[hidden],
.sm-selfie-actions[hidden] {
  display: none;
}

.sm-selfie-preview img {
  width: 74px;
  height: 74px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 17px;
  object-fit: cover;
  background: #07101a;
}

.sm-selfie-preview strong {
  display: block;
  color: #fff;
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sm-selfie-preview p {
  margin: 3px 0 8px;
  color: var(--muted, #96a1b3);
  font-size: 8px;
  line-height: 1.45;
}

.sm-selfie-preview-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.sm-selfie-preview-actions button {
  color: #ff8fc2;
}

.sm-pin-field {
  padding: 12px;
  display: grid;
  gap: 9px;
  border: 1px solid rgba(255, 209, 102, 0.22);
  border-radius: 16px;
  background: rgba(255, 209, 102, 0.045);
}

.sm-pin-copy {
  display: grid;
  gap: 3px;
}

.sm-pin-copy span,
.sm-pin-field > span {
  color: #ffe7a1;
  font-size: 10px;
  font-weight: 950;
}

.sm-pin-copy small,
.sm-pin-field > small {
  color: var(--muted, #96a1b3);
  font-size: 8px;
  line-height: 1.45;
}

.sm-pin-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.sm-pin-input-row button {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.045);
  color: #f8fbff;
  font: inherit;
  font-size: 9px;
  font-weight: 900;
  cursor: pointer;
}

.sm-signal-actions {
  position: sticky;
  bottom: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 9px;
  margin: 2px -22px 0;
  padding: 12px 22px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  background: linear-gradient(180deg, rgba(8, 14, 23, 0.82), rgba(8, 14, 23, 0.98));
  backdrop-filter: blur(16px);
}

.sm-signal-actions .btn {
  width: 100%;
  min-height: 46px;
  text-align: center;
}

.sm-signal-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  max-width: calc(100% - 28px);
  padding: 12px 17px;
  border-radius: 13px;
  background: #f5fbff;
  color: #08101a;
  font-size: 10px;
  font-weight: 900;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translate(-50%, 14px);
  pointer-events: none;
  transition: 0.22s;
}

.sm-signal-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.sm-signal-auth {
  padding: 22px 25px 27px;
  display: grid;
  gap: 12px;
}

.sm-signal-auth[hidden],
#sm-signal-form[hidden] {
  display: none;
}

.sm-signal-auth strong {
  font-size: 17px;
}

.sm-signal-auth p {
  margin: 0 0 4px;
  color: var(--muted, #96a1b3);
  font-size: 9px;
  line-height: 1.55;
}

.sm-signal-auth label {
  display: grid;
  gap: 6px;
  color: #cdd7e2;
  font-size: 9px;
  font-weight: 800;
}

.sm-signal-auth input {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 12px;
  background: #080f18;
  color: #fff;
  outline: 0;
}

.sm-signal-auth input:focus {
  border-color: var(--cyan, #25efff);
  box-shadow: 0 0 0 4px rgba(37, 239, 255, 0.07);
}

.sm-signal-auth [data-auth-error] {
  min-height: 14px;
  color: #ff82b9;
  font-size: 8px;
}

.sm-signal-auth > a {
  color: var(--cyan, #25efff);
  font-size: 9px;
  text-align: center;
}

.sm-signal-auth button:disabled,
#sm-signal-form button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.sm-signal-success {
  padding: 36px 25px 30px;
  text-align: center;
}

.sm-signal-success[hidden],
[data-manage-fields][hidden] {
  display: none;
}

.sm-signal-success > span {
  width: 58px;
  height: 58px;
  margin: auto;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: rgba(101, 242, 163, 0.12);
  color: #65f2a3;
  font-size: 28px;
}

.sm-signal-success h3 {
  margin: 18px 0 9px;
  font-size: 24px;
}

.sm-signal-success p {
  margin: 0 auto 22px;
  max-width: 400px;
  color: var(--muted, #96a1b3);
  font-size: 11px;
  line-height: 1.6;
}

.sm-signal-success strong {
  color: #fff;
}

#sm-signal-manage-form {
  padding: 22px 25px 0;
  display: grid;
  gap: 13px;
}

#sm-signal-manage-form [data-manage-fields] {
  display: grid;
  gap: 13px;
}

#sm-signal-manage-form .danger {
  border-color: #ff2b8a;
  background: #ff2b8a;
  color: #fff;
}

.signal-manage-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 6px !important;
  margin-top: 10px !important;
  padding-top: 9px !important;
  border-top: 1px solid rgba(255, 255, 255, 0.09) !important;
}

.signal-manage-actions button {
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5df;
  font: inherit;
  font-size: 8px;
  font-weight: 850;
  cursor: pointer;
}

.signal-manage-actions button:last-child {
  color: #ff88bc;
}

.route-signal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.route-signal-head > strong {
  font-size: 10px;
}

.venue-signal-card p {
  margin: 5px 0;
  color: #dce6ef;
  font-size: 10px;
  line-height: 1.5;
}

@media (max-width: 650px) {
  .sm-signal-dialog {
    width: calc(100% - 16px);
    max-height: 94dvh;
    border-radius: 22px;
  }

  .sm-signal-head {
    padding: 15px 15px 13px;
  }

  .sm-signal-head h2 {
    font-size: 30px;
  }

  #sm-signal-form,
  .sm-signal-form {
    padding: 14px 15px 0;
    gap: 10px;
  }

  .sm-section-title {
    display: grid;
    gap: 3px;
  }

  .sm-section-title small {
    max-width: none;
    text-align: left;
  }

  .sm-signal-row {
    grid-template-columns: minmax(0, 1fr) 84px;
    gap: 8px;
  }

  .sm-signal-target-row {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .sm-activity-list {
    max-height: min(300px, 46vh);
  }

  .sm-activity-option {
    min-height: 40px;
  }

  .sm-duration-options {
    gap: 6px;
  }

  .sm-duration-options span {
    min-height: 38px;
  }

  .sm-selfie-preview {
    grid-template-columns: 66px minmax(0, 1fr);
  }

  .sm-selfie-preview img {
    width: 66px;
    height: 66px;
    border-radius: 15px;
  }

  .sm-selfie-preview-actions {
    grid-template-columns: 1fr;
  }

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

  .sm-pin-input-row {
    grid-template-columns: minmax(0, 1fr) 86px;
  }

  .sm-signal-actions {
    margin: 2px -15px 0;
    padding: 11px 15px calc(11px + env(safe-area-inset-bottom));
  }

  #sm-signal-manage-form {
    padding: 19px 18px 0;
  }

  .sm-signal-manage .sm-signal-row {
    grid-template-columns: 1fr;
  }

  .signal-manage-actions button {
    min-height: 44px;
    flex: 1;
  }

  .sm-signal-success {
    padding: 32px 18px;
  }
}

@media (max-width: 340px) {
  .sm-signal-dialog {
    width: calc(100% - 10px);
  }

  .sm-signal-head h2 {
    font-size: 27px;
  }

  .sm-signal-head p {
    font-size: 9px;
  }

  #sm-signal-form,
  .sm-signal-form {
    padding-left: 12px;
    padding-right: 12px;
  }

  .sm-signal-row {
    grid-template-columns: minmax(0, 1fr) 76px;
  }

  .sm-pin-input-row {
    grid-template-columns: minmax(0, 1fr) 78px;
  }

  .sm-pin-input-row button {
    padding-inline: 8px;
    font-size: 8px;
  }

  .sm-signal-actions {
    margin-left: -12px;
    margin-right: -12px;
    padding-left: 12px;
    padding-right: 12px;
  }
}
