.sign-help,
.sign-help * {
  box-sizing: border-box;
}

.sign-help [hidden] {
  display: none !important;
}

.sign-help-toggle {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1100;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 13px 18px;
  border: 0;
  border-radius: 28px;
  background: #800000;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.sign-help-toggle:hover,
.sign-help-form button:hover {
  background: #005db3;
}

.sign-help-toggle:hover {
  background: #660000;
}

body.has-app-tab-bar .sign-help-toggle {
  bottom: calc(82px + env(safe-area-inset-bottom, 0px));
}

body.has-app-tab-bar .sign-help-panel {
  bottom: calc(144px + env(safe-area-inset-bottom, 0px));
}

.sign-help-toggle:focus-visible,
.sign-help button:focus-visible,
.sign-help input:focus-visible {
  outline: 3px solid #ffcc00;
  outline-offset: 2px;
}

.sign-help-panel {
  position: fixed;
  right: 20px;
  bottom: 82px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  width: min(370px, calc(100vw - 32px));
  height: min(540px, calc(100vh - 110px));
  min-height: 340px;
  overflow: hidden;
  border: 1px solid #d5deea;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
  color: #243447;
}

.sign-help-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  background: #003366;
  color: #fff;
}

.sign-help-header h2 {
  margin: 0 0 5px;
  font-size: 1.1rem;
}

.sign-help-header p,
.sign-help-privacy,
.sign-help-message p {
  margin: 0;
}

.sign-help-header p {
  font-size: 0.85rem;
  line-height: 1.4;
}

.sign-help-close {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 1rem;
}

.sign-help-close:hover {
  background: rgba(255, 255, 255, 0.15);
}

.sign-help-privacy {
  padding: 9px 14px;
  background: #f2f6fb;
  color: #42556b;
  font-size: 0.75rem;
  line-height: 1.4;
}

.sign-help-messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 14px;
}

.sign-help-message {
  max-width: 90%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.sign-help-message--assistant {
  align-self: flex-start;
  border: 1px solid #e0e7f0;
  background: #f5f7fa;
}

.sign-help-message--user {
  align-self: flex-end;
  background: #e5f0fb;
}

.sign-help-action {
  margin-top: 9px;
  padding: 7px 10px;
  border: 1px solid #004080;
  border-radius: 6px;
  background: #fff;
  color: #004080;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.sign-help-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 0 12px 10px;
}

.sign-help-prompts button {
  padding: 6px 9px;
  border: 1px solid #b7c9dd;
  border-radius: 16px;
  background: #fff;
  color: #004080;
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
}

.sign-help-prompts button:hover {
  background: #edf4fb;
}

.sign-help-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #e0e7f0;
}

.sign-help-form input {
  min-width: 0;
  flex: 1;
  padding: 10px;
  border: 1px solid #b9c5d2;
  border-radius: 7px;
  color: #243447;
  font: inherit;
}

.sign-help-form button {
  flex: 0 0 42px;
  border: 0;
  border-radius: 7px;
  background: #004080;
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
}

.sign-help-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.dark-mode .sign-help-panel {
  border-color: #444;
  background: #1e1e1e;
  color: #e0e0e0;
}

.dark-mode .sign-help-privacy {
  background: #292929;
  color: #d0d0d0;
}

.dark-mode .sign-help-message--assistant {
  border-color: #444;
  background: #2d2d2d;
}

.dark-mode .sign-help-message--user {
  background: #173c5c;
}

.dark-mode .sign-help-action,
.dark-mode .sign-help-prompts button {
  border-color: #81d4fa;
  background: #2d2d2d;
  color: #81d4fa;
}

.dark-mode .sign-help-prompts button:hover {
  background: #373737;
}

.dark-mode .sign-help-form {
  border-color: #444;
}

.dark-mode .sign-help-form input {
  border-color: #555;
  background: #2d2d2d;
  color: #e0e0e0;
}

@media (max-width: 480px) {
  .sign-help-toggle {
    right: 14px;
    bottom: 14px;
  }

  .sign-help-panel {
    right: 10px;
    bottom: 72px;
    width: calc(100vw - 20px);
    height: min(540px, calc(100vh - 88px));
  }

  body.has-app-tab-bar .sign-help-toggle {
    bottom: calc(82px + env(safe-area-inset-bottom, 0px));
  }

  body.has-app-tab-bar .sign-help-panel {
    bottom: calc(144px + env(safe-area-inset-bottom, 0px));
    height: min(540px, calc(100vh - 160px));
  }
}
