.tf-dock {
  position: fixed;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 100000;
  display: flex;
  align-items: center;
  gap: 8px;
}

body.site-page > .tf-dock,
body.site-page > .tf-dialog,
body.site-page > .tf-notice {
  position: fixed;
}

.tf-launch {
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, .17);
  border-radius: 14px;
  padding: 10px 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #f7f4ff;
  background: rgba(12, 17, 36, .94);
  box-shadow: 0 14px 38px rgba(0, 0, 0, .3);
  backdrop-filter: blur(14px);
  font: 800 12px/1.1 Inter, ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0;
  cursor: pointer;
}

.tf-launch:hover {
  border-color: rgba(158, 130, 255, .55);
  background: rgba(24, 32, 61, .98);
  transform: translateY(-1px);
}

.tf-launch-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 22px;
  color: #10131f;
  background: linear-gradient(135deg, #cbbaff, #72d9ff);
  font-size: 15px;
  font-weight: 950;
}

.tf-dialog {
  width: min(560px, calc(100% - 24px));
  max-height: min(860px, calc(100dvh - 24px));
  padding: 0;
  color: #f6f3ff;
  background: linear-gradient(145deg, #151d37, #0c1124);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 20px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .52);
  overflow: auto;
}

.tf-dialog::backdrop {
  background: rgba(3, 5, 14, .78);
  backdrop-filter: blur(9px);
}

.tf-form {
  padding: 24px;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}

.tf-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.tf-head h2 {
  margin: 4px 0 0;
  color: #fff;
  font: 800 27px/1.1 Georgia, "Times New Roman", serif;
  letter-spacing: 0;
}

.tf-kicker {
  color: #72d9ff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.tf-close {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 50%;
  color: #f6f3ff;
  background: rgba(255, 255, 255, .05);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.tf-types {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.tf-type {
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 12px;
  color: #cbd2e5;
  background: rgba(255, 255, 255, .04);
  font: 800 13px/1.2 Inter, ui-sans-serif, system-ui, sans-serif;
  cursor: pointer;
}

.tf-type[aria-pressed="true"] {
  color: #10131f;
  border-color: transparent;
  background: linear-gradient(135deg, #cbbaff, #72d9ff);
}

.tf-field {
  display: grid;
  gap: 8px;
  margin-top: 15px;
}

.tf-field > span,
.tf-field > legend {
  color: #dce1ef;
  font-size: 12px;
  font-weight: 850;
}

.tf-field > legend {
  padding: 0;
}

.tf-field > span small {
  color: #8f99b4;
  font-size: 10px;
  font-weight: 650;
}

.tf-device-field {
  min-width: 0;
  margin-inline: 0;
  padding: 0;
  border: 0;
}

.tf-device-field[hidden] {
  display: none;
}

.tf-device-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.tf-device-option {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.tf-device-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.tf-device-option span {
  min-height: 46px;
  display: grid;
  place-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 12px;
  color: #cbd2e5;
  background: rgba(255, 255, 255, .04);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  transition: .16s ease;
}

.tf-device-option:hover span {
  border-color: rgba(158, 130, 255, .5);
  background: rgba(255, 255, 255, .065);
}

.tf-device-option input:checked + span {
  color: #10131f;
  border-color: transparent;
  background: linear-gradient(135deg, #cbbaff, #72d9ff);
}

.tf-device-option input:focus-visible + span {
  outline: 2px solid rgba(114, 217, 255, .72);
  outline-offset: 2px;
}

.tf-field select,
.tf-field textarea,
.tf-field input[type="text"] {
  width: 100%;
  color: #f6f3ff;
  background: rgba(255, 255, 255, .055);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 12px;
  padding: 12px 13px;
  font: 500 14px/1.45 Inter, ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0;
}

.tf-field select {
  min-height: 46px;
  padding-right: 38px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tf-field select option {
  color: #171b2c;
  background: #fff;
}

.tf-field textarea {
  min-height: 128px;
  resize: vertical;
}

.tf-field select:focus,
.tf-field textarea:focus,
.tf-field input[type="text"]:focus {
  outline: 2px solid rgba(114, 217, 255, .72);
  outline-offset: 2px;
}

.tf-field input[type="text"]::placeholder,
.tf-field textarea::placeholder {
  color: #7f89a4;
  opacity: 1;
}

.tf-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-top: 8px;
  color: #a9b1ca;
  font-size: 11px;
  line-height: 1.4;
}

.tf-meta p {
  margin: 0;
  max-width: 390px;
}

.tf-count {
  white-space: nowrap;
}

.tf-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 20px;
}

.tf-button {
  min-height: 44px;
  border-radius: 12px;
  padding: 11px 16px;
  font: 850 13px/1 Inter, ui-sans-serif, system-ui, sans-serif;
  cursor: pointer;
}

.tf-button-secondary {
  color: #f6f3ff;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .05);
}

.tf-button-primary {
  color: #10131f;
  border: 0;
  background: linear-gradient(135deg, #cbbaff, #72d9ff 62%, #f4c96b);
}

.tf-button:disabled {
  opacity: .58;
  cursor: wait;
}

.tf-status {
  min-height: 18px;
  margin: 12px 0 0;
  color: #a9b1ca;
  font-size: 12px;
  line-height: 1.4;
}

.tf-status[data-state="error"] {
  color: #ff9eb0;
}

.tf-status[data-state="success"] {
  color: #8ce0b4;
}

.tf-notice {
  position: fixed;
  left: 50%;
  bottom: max(76px, calc(env(safe-area-inset-bottom) + 76px));
  z-index: 100001;
  max-width: calc(100% - 28px);
  padding: 12px 16px;
  color: #10131f;
  background: #f4c96b;
  border-radius: 12px;
  box-shadow: 0 16px 42px rgba(0, 0, 0, .35);
  font: 850 12px/1.35 Inter, ui-sans-serif, system-ui, sans-serif;
  text-align: center;
  transform: translate(-50%, 14px);
  opacity: 0;
  pointer-events: none;
  transition: .2s ease;
}

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

@media (max-width: 700px) {
  .tf-dock {
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
  }

  .tf-launch {
    width: 46px;
    height: 46px;
    min-height: 46px;
    padding: 0;
    border-radius: 50%;
  }

  .tf-launch-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .tf-launch-icon {
    width: 24px;
    height: 24px;
    flex-basis: 24px;
  }

  .tf-dialog {
    width: calc(100% - 14px);
    max-height: calc(100dvh - 14px);
    border-radius: 17px;
  }

  .tf-form {
    padding: 19px 15px 16px;
  }

  .tf-head h2 {
    font-size: 24px;
  }

  .tf-field textarea {
    min-height: 112px;
  }

  .tf-meta {
    display: block;
  }

  .tf-count {
    display: block;
    margin-top: 5px;
  }
}

@media print {
  .tf-dock,
  .tf-dialog,
  .tf-notice {
    display: none !important;
  }
}
