/* Manual terminal trade sharing into Signal. */
.terminal-signal-share-modal {
  align-items: end;
  padding: 0;
}

.terminal-signal-share-sheet {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: min(520px, 100%);
  max-height: calc(100dvh - 4px);
  padding: 10px 12px max(10px, env(safe-area-inset-bottom, 0px));
  border: 1px solid #23262c;
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  background: #0a0c0f;
  overflow: hidden;
}

.terminal-signal-share-head {
  position: relative;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between;
  flex: 0 0 auto;
  min-height: 44px;
  margin-bottom: 8px;
  padding: 0 50px 8px 2px;
  border-bottom: 1px solid #202329;
}

.terminal-signal-share-head h3 {
  margin: 0;
  color: #f5f6f7;
  font-size: 21px;
  font-weight: 760;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.terminal-signal-share-head .modal-close-icon {
  width: 44px !important;
  min-width: 44px !important;
  height: 44px !important;
  min-height: 44px !important;
  border: 0 !important;
  border-radius: 10px !important;
  background: #1b1d22 !important;
  color: #f5f6f7 !important;
  box-shadow: none !important;
}

.terminal-signal-share-head .modal-close-icon:hover {
  background: #24272d !important;
}

.terminal-signal-share-head .modal-close-icon:focus-visible {
  outline: 2px solid #f13229;
  outline-offset: 2px;
}

.terminal-signal-share-head .modal-close-icon svg {
  width: 23px;
  height: 23px;
  stroke: currentColor;
  stroke-width: 2;
}

.terminal-signal-share-body {
  display: grid;
  flex: 1 1 auto;
  gap: 10px;
  min-height: 0;
  max-height: calc(100dvh - 128px);
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.terminal-signal-share-body::-webkit-scrollbar { display: none; }

.terminal-signal-share-state {
  display: grid;
  place-items: center;
  min-height: 112px;
  padding: 16px;
  color: #a5a7ad;
  text-align: center;
}

.terminal-signal-share-preview {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.terminal-signal-share-section {
  box-sizing: border-box;
  min-width: 0;
  border: 1px solid #24272e;
  border-radius: 14px;
  background: #13161a;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}

.terminal-signal-share-summary {
  padding: 10px 12px;
}

.terminal-signal-share-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid #25282f;
}

.terminal-signal-share-section-head > span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.terminal-signal-share-section-head strong {
  color: #f2f3f5;
  font-size: 14px;
  font-weight: 760;
  line-height: 1.2;
}

.terminal-signal-share-section-head small {
  color: #777b84;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.terminal-signal-share-section-head > small {
  flex: 0 0 auto;
  padding: 5px 7px;
  border: 1px solid #2b2e35;
  border-radius: 999px;
  background: #191c21;
  letter-spacing: 0.02em;
  text-transform: none;
}

.terminal-signal-share-market {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  padding: 0;
}

.terminal-signal-share-market-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.terminal-signal-share-market-main .asset-glyph {
  flex: 0 0 auto;
}

.terminal-signal-share-market-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.terminal-signal-share-market-copy strong {
  overflow: hidden;
  color: #f7f7f8;
  font-size: 17px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.terminal-signal-share-market-copy span,
.terminal-signal-share-pnl span,
.terminal-signal-share-note {
  color: #97999f;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
}

.terminal-signal-share-pnl {
  display: grid;
  gap: 2px;
  flex: 0 0 auto;
  text-align: right;
}

.terminal-signal-share-pnl strong {
  color: #f7f7f8;
  font-size: 17px;
  line-height: 1.15;
}

.terminal-signal-share-pnl strong.positive { color: #63d38b; }
.terminal-signal-share-pnl strong.negative { color: #ff6961; }

.terminal-signal-share-post-preview {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #292c33;
  border-radius: 11px;
  background: #0f1115;
}

.terminal-signal-share-post-preview > summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 14px;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 11px 0 12px;
  color: #b8bbc2;
  list-style: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.terminal-signal-share-post-preview > summary::-webkit-details-marker { display: none; }

.terminal-signal-share-post-preview > summary::after {
  width: 7px;
  height: 7px;
  margin-top: -4px;
  border-right: 1.5px solid #747780;
  border-bottom: 1.5px solid #747780;
  content: "";
  transform: rotate(45deg);
  transition: transform 140ms ease, margin 140ms ease;
}

.terminal-signal-share-post-preview[open] > summary::after {
  margin-top: 4px;
  transform: rotate(225deg);
}

.terminal-signal-share-post-preview > summary:hover { background: #1b1d22; }

.terminal-signal-share-post-preview > summary:focus-visible {
  outline: 2px solid #f13229;
  outline-offset: -2px;
}

.terminal-signal-share-post-preview > summary > span {
  overflow: hidden;
  font-size: 12px;
  font-weight: 680;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.terminal-signal-share-post-preview > summary > small {
  color: #747780;
  font-size: 10px;
  font-weight: 620;
  line-height: 1.2;
  white-space: nowrap;
}

.terminal-signal-share-post-preview-copy {
  display: grid;
  gap: 4px;
  padding: 4px 12px 12px;
  border-top: 1px solid #24272d;
}

.terminal-signal-share-post-preview-copy > strong {
  color: #e7e8eb;
  font-size: 14px;
  font-weight: 710;
  line-height: 1.25;
}

.terminal-signal-share-post-preview-copy > p {
  margin: 0;
  color: #a9acb3;
  font-size: 12px;
  font-weight: 540;
  line-height: 1.45;
  white-space: pre-line;
}

.terminal-signal-share-note {
  margin: 0;
  padding: 10px 2px 0;
  border-top: 1px solid #25282f;
  color: #888b93;
  font-size: 11px;
  line-height: 1.4;
}

.terminal-signal-share-publication {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.terminal-signal-share-notice {
  padding: 8px 10px;
  border: 0;
  border-radius: 9px;
  background: #211c14;
  color: #f0c77e;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.4;
}

.terminal-signal-share-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, 0.62fr) minmax(0, 1.38fr);
  flex: 0 0 auto;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #202329;
  background: #0a0c0f;
}

.terminal-signal-share-actions:empty {
  display: none;
}

.terminal-signal-share-sheet .terminal-signal-share-actions .button {
  min-height: 48px !important;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 740;
  box-shadow: none !important;
}

.terminal-signal-share-actions .terminal-signal-share-confirm,
.terminal-signal-share-actions .terminal-signal-share-confirm.button-primary {
  border-color: #f13229 !important;
  background: #f13229 !important;
  color: #fff !important;
  box-shadow: none !important;
}

.terminal-signal-share-actions .terminal-signal-share-confirm:hover:not(:disabled) {
  border-color: #ff443b !important;
  background: #ff443b !important;
  color: #fff !important;
}

.terminal-signal-share-actions .terminal-signal-share-confirm:disabled {
  border-color: #f13229 !important;
  background: #f13229 !important;
  color: #fff !important;
  opacity: 0.52;
}

.terminal-signal-share-actions .button-secondary {
  border-color: transparent !important;
  background: #1a1c21 !important;
  color: #b5b8bf !important;
}

.terminal-signal-share-button,
.trade-mobile-card .button.terminal-signal-share-button,
.view-section[data-view="terminal"] .trade-ledger-actions .button.terminal-signal-share-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px !important;
  padding: 0 11px !important;
  border: 1px solid rgba(255, 255, 255, 0.11) !important;
  border-radius: 10px !important;
  background: #202328 !important;
  color: #c9ccd2 !important;
  font-size: 12px !important;
  font-weight: 660 !important;
  box-shadow: none !important;
}

.terminal-signal-share-button:hover:not(:disabled),
.terminal-signal-share-button:active:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.19) !important;
  background: #292c32 !important;
  color: #fff !important;
}

.terminal-signal-share-button svg {
  display: block;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

@media (max-width: 640px) {
  .view-section[data-view="terminal"] .trade-ledger-item .trade-ledger-actions {
    padding-top: 7px !important;
  }

  .view-section[data-view="terminal"] .trade-ledger-item .trade-ledger-actions .trade-action-row {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

  .view-section[data-view="terminal"] .trade-ledger-item .trade-ledger-actions .button.terminal-signal-share-button {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0 !important;
  }
}

@media (max-width: 640px) and (pointer: coarse) {
  .view-section[data-view="terminal"] .trade-ledger-item .trade-ledger-actions .button.terminal-signal-share-button {
    min-height: 44px !important;
  }
}

/* Trade-card presentation controls. */
.terminal-signal-share-card-options {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
}

.terminal-signal-share-setting-group {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid #292c33;
  border-radius: 11px;
  background: #0f1115;
}

.terminal-signal-share-option-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  color: #aeb1b8;
  font-size: 10px;
  font-weight: 730;
  line-height: 1.25;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.terminal-signal-share-option-label small {
  color: #777a82;
  font: inherit;
  font-size: 10px;
  font-weight: 620;
  letter-spacing: 0;
  text-transform: none;
}

.terminal-signal-share-segments {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
  gap: 4px;
  min-width: 0;
  padding: 2px;
  border: 1px solid #292c33;
  border-radius: 10px;
  background: #181b20;
}

.terminal-signal-share-segment {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 44px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #92959d;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.terminal-signal-share-segment:hover {
  border-color: transparent;
  background: #22252b;
  color: #e4e5e8;
}

.terminal-signal-share-segment.is-selected,
.terminal-signal-share-segment.is-active,
.terminal-signal-share-segment[aria-selected="true"],
.terminal-signal-share-segment[aria-pressed="true"] {
  border-color: #f13229;
  background: #f13229;
  color: #fff;
  box-shadow: none;
}

.terminal-signal-share-segment:focus-visible,
.terminal-signal-share-chart-toggle:focus-visible,
.terminal-signal-share-chart-toggle input[type="checkbox"]:focus-visible {
  outline: 2px solid rgba(241, 50, 41, 0.92);
  outline-offset: 2px;
}

.terminal-signal-share-segment:disabled {
  cursor: default;
  opacity: 0.46;
}

.terminal-signal-share-chart-toggle {
  position: relative;
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 56px;
  padding: 7px 10px 7px 12px;
  border: 1px solid #2a2d34;
  border-radius: 11px;
  background: #191c21;
  color: #d8dade;
  font: inherit;
  font-size: 12px;
  font-weight: 690;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.terminal-signal-share-chart-toggle:hover {
  border-color: #343840;
  background: #202329;
}

.terminal-signal-share-toggle-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding-right: 2px;
}

.terminal-signal-share-toggle-copy strong {
  color: #e5e6e9;
  font-size: 12px;
  font-weight: 720;
  line-height: 1.25;
}

.terminal-signal-share-toggle-copy small {
  overflow: hidden;
  color: #81848c;
  font-size: 10px;
  font-weight: 560;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.terminal-signal-share-chart-toggle[aria-pressed] {
  padding-right: 64px;
}

.terminal-signal-share-chart-toggle[aria-pressed]::after {
  position: absolute;
  top: 50%;
  right: 12px;
  width: 42px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  background: #292b31;
  content: "";
  transform: translateY(-50%);
}

.terminal-signal-share-chart-toggle[aria-pressed]::before {
  position: absolute;
  top: 50%;
  right: 33px;
  z-index: 1;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f4f4f5;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.34);
  content: "";
  transform: translateY(-50%);
  transition: right 150ms ease;
}

.terminal-signal-share-chart-toggle[aria-pressed="true"] {
  border-color: rgba(241, 50, 41, 0.32);
  background: #1c1c20;
  color: #fff;
}

.terminal-signal-share-chart-toggle[aria-pressed="true"]::after {
  border-color: #f13229;
  background: #f13229;
}

.terminal-signal-share-chart-toggle[aria-pressed="true"]::before {
  right: 15px;
}

.terminal-signal-share-chart-toggle input[type="checkbox"] {
  position: relative;
  appearance: none;
  flex: 0 0 auto;
  box-sizing: border-box;
  width: 44px;
  height: 26px;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  background: #292b31;
  cursor: pointer;
}

.terminal-signal-share-chart-toggle input[type="checkbox"]::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f4f4f5;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.34);
  content: "";
  transition: transform 150ms ease;
}

.terminal-signal-share-chart-toggle input[type="checkbox"]:checked {
  border-color: #f13229;
  background: #f13229;
}

.terminal-signal-share-chart-toggle input[type="checkbox"]:checked::after {
  transform: translateX(18px);
}

.terminal-signal-share-card-preview {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.terminal-signal-share-card-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.terminal-signal-share-card-preview-head strong {
  color: #c9cbd1;
  font-size: 11px;
  font-weight: 710;
  line-height: 1.25;
}

.terminal-signal-share-card-preview-head small {
  color: #6f727a;
  font-size: 10px;
  font-weight: 650;
  line-height: 1.2;
}

.terminal-signal-share-card-stage {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 148px;
  padding: 10px;
  border: 0;
  border-radius: 10px;
  background: #0b0d10;
  overflow: hidden;
}

.terminal-signal-share-card-canvas {
  display: block;
  width: min(236px, 70vw);
  max-width: 100%;
  height: auto;
  aspect-ratio: auto;
  border: 0;
  border-radius: 9px;
  background: transparent;
  box-shadow: none;
  object-fit: contain;
}

.terminal-signal-share-card-status {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #9699a1;
  font-size: 11px;
  font-weight: 630;
  line-height: 1.4;
  text-align: center;
}

.terminal-signal-share-card-status.is-error,
.terminal-signal-share-card-status[data-state="error"] {
  border-color: transparent;
  color: #ff8a84;
}

.terminal-signal-share-export {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
}

.terminal-signal-share-export-button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  box-sizing: border-box;
  min-width: 0;
  min-height: 46px;
  padding: 5px 7px;
  border: 1px solid #2a2d34;
  border-radius: 10px;
  background: #181a1f;
  color: #c9cbd1;
  font: inherit;
  font-size: 11px;
  font-weight: 690;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.terminal-signal-share-export-button:hover:not(:disabled) {
  border-color: #373b43;
  background: #22252b;
  color: #fff;
}

.terminal-signal-share-export-button.is-primary {
  border-color: rgba(241, 50, 41, 0.4);
  background: rgba(241, 50, 41, 0.12);
  color: #fff;
}

.terminal-signal-share-export-button.is-primary:hover:not(:disabled) {
  border-color: rgba(241, 50, 41, 0.68);
  background: rgba(241, 50, 41, 0.2);
}

.terminal-signal-share-export-button:focus-visible {
  outline: 2px solid #f13229;
  outline-offset: 2px;
}

.terminal-signal-share-export-button:disabled {
  cursor: default;
  opacity: 0.42;
}

.terminal-signal-share-export-button svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

@media (min-width: 720px) {
  .terminal-signal-share-modal { align-items: center; padding: 18px; }
  .terminal-signal-share-sheet { max-height: min(760px, calc(100dvh - 36px)); border-radius: 22px; }
}

@media (max-width: 360px) {
  .terminal-signal-share-sheet { padding: 8px 10px max(8px, env(safe-area-inset-bottom, 0px)); }
  .terminal-signal-share-head { margin-bottom: 7px; padding-bottom: 7px; }
  .terminal-signal-share-head h3 { font-size: 20px; }
  .terminal-signal-share-body,
  .terminal-signal-share-preview { gap: 8px; }
  .terminal-signal-share-actions { grid-template-columns: minmax(0, 0.58fr) minmax(0, 1.42fr); }
  .terminal-signal-share-section { border-radius: 12px; }
  .terminal-signal-share-summary { padding: 9px 10px; }
  .terminal-signal-share-card-options { gap: 9px; padding: 10px; }
  .terminal-signal-share-publication { padding: 10px; }
  .terminal-signal-share-setting-group { padding: 8px; }
  .terminal-signal-share-segments { grid-template-columns: repeat(auto-fit, minmax(78px, 1fr)); }
  .terminal-signal-share-segment { padding-inline: 7px; font-size: 11px; }
  .terminal-signal-share-card-preview { padding: 0; }
  .terminal-signal-share-card-stage { padding: 8px; }
  .terminal-signal-share-card-canvas { width: min(220px, 68vw); height: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .terminal-signal-share-chart-toggle[aria-pressed]::before,
  .terminal-signal-share-chart-toggle input[type="checkbox"]::after,
  .terminal-signal-share-post-preview > summary::after { transition: none; }
}
