/* Dark Pool and Lit Flow print tape */

.legend-widget:is([data-type-id="dark_pool"], [data-type-id="lit_flow"]) .legend-widget-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
}

.legend-widget:is([data-type-id="dark_pool"], [data-type-id="lit_flow"]) .legend-widget-inner {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

.equity-tape {
  --equity-tape-accent: #ad88cd;
  container: equity-tape / inline-size;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  color: var(--legend-text, #e8e8e8);
}

.equity-tape--lit {
  --equity-tape-accent: #56a89f;
}

.equity-tape-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  gap: 8px;
  padding: 7px 12px;
  color: var(--legend-text-muted, #9ca3af);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  white-space: nowrap;
}

.equity-tape-summary strong {
  margin-left: 3px;
  color: var(--legend-text, #e8e8e8);
  font-weight: 650;
}

.equity-tape-scroll {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: auto;
}

.equity-tape-table {
  width: 100%;
  min-width: 420px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.equity-tape-table :is(th, td) {
  box-sizing: border-box;
  padding: 4px 10px;
  border-bottom: 1px solid var(--legend-border, rgba(255, 255, 255, 0.12));
  text-align: right;
  white-space: nowrap;
}

.equity-tape-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  height: 28px;
  background: var(--legend-bg-elevated, #0d0d0d);
  color: var(--legend-text-muted, #9ca3af);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.equity-tape-table td {
  height: 46px;
}

.equity-tape-table .equity-tape-symbol {
  text-align: left;
}

.equity-tape-table :is(.equity-tape-quote, .equity-tape-volume, .equity-tape-time) {
  color: var(--legend-text-muted, #9ca3af);
}

.equity-tape-row {
  cursor: pointer;
}

.equity-tape-row:is(:hover, :focus-within) td {
  background: var(--legend-bg-elevated, #0d0d0d);
}

.equity-tape-open {
  appearance: none;
  padding: 1px 0;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: 750;
}

.equity-tape-open:focus-visible,
.equity-tape-scroll:focus-visible {
  outline: 2px solid var(--legend-accent, #facc15);
  outline-offset: 2px;
}

.equity-tape-scroll:focus-visible {
  outline-offset: -2px;
}

.equity-tape-venue,
.equity-tape-canceled {
  margin-left: 5px;
  color: var(--legend-text-muted, #9ca3af);
  font-size: 10px;
}

.equity-tape-canceled {
  color: #f99a92;
  font-weight: 650;
}

.equity-tape-row--canceled .equity-tape-value {
  color: var(--legend-text-muted, #9ca3af);
}

.equity-tape-value {
  font-weight: 700;
}

.equity-tape-context {
  display: none;
}

.equity-tape-meter {
  display: block;
  width: 52px;
  max-width: 100%;
  height: 2px;
  margin: 3px 0 0 auto;
  border-radius: 1px;
  background: var(--legend-border, rgba(255, 255, 255, 0.12));
  overflow: hidden;
}

.equity-tape-meter > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--equity-tape-accent);
}

.equity-tape-empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--legend-text-muted, #9ca3af);
  font-size: 12px;
}

@container equity-tape (max-width: 640px) {
  .equity-tape-table {
    min-width: 288px;
    font-size: 12px;
  }

  .equity-tape-table :is(.equity-tape-quote, .equity-tape-volume) {
    display: none;
  }

  .equity-tape-row--has-context .equity-tape-identity {
    position: relative;
  }

  .equity-tape-row--has-context td {
    height: 50px;
    padding-bottom: 20px;
  }

  .equity-tape-context {
    position: absolute;
    inset-inline-start: 0;
    top: calc(100% + 4px);
    display: flex;
    width: max-content;
    gap: 14px;
    font-size: 11px;
    color: var(--legend-text-muted, #9ca3af);
  }

  .equity-tape-context-label {
    margin-inline-end: 2px;
    font-weight: 650;
  }
}

@container equity-tape (max-width: 370px) {
  .equity-tape-context {
    gap: 9px;
  }

  .equity-tape-table :is(th, td) {
    padding-inline: 6px;
  }

  .equity-tape-summary {
    padding-inline: 6px;
  }

  .equity-tape-venue {
    margin-left: 3px;
  }
}

.legend-widget[data-type-id="dark_pool"] > .legend-widget-header {
  position: relative;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  min-height: 40px;
}

.legend-widget[data-type-id="dark_pool"] > .legend-widget-header .legend-dp-toolbar {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 0 1 auto;
  min-width: 0;
  max-width: none;
  margin-left: 4px;
}

.legend-widget[data-type-id="dark_pool"] .legend-dp-mode-toggle {
  flex: 0 0 auto;
  border-color: color-mix(in srgb, #c084fc 28%, var(--legend-border));
}

.legend-widget[data-type-id="dark_pool"] .legend-dp-mode-btn.is-active {
  background: color-mix(in srgb, #c084fc 22%, transparent);
  color: #e9d5ff;
}

.legend-widget[data-type-id="dark_pool"] .legend-dp-filters {
  flex: 0 0 auto;
}

.legend-widget[data-type-id="dark_pool"] .legend-dp-filters-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 10px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: var(--banana-radius);
  border: 1px solid var(--legend-border);
  background: var(--legend-bg-elevated);
  color: var(--legend-text-muted);
  cursor: pointer;
  white-space: nowrap;
}

.legend-widget[data-type-id="dark_pool"] .legend-dp-filters-btn:hover {
  color: var(--legend-text);
  border-color: color-mix(in srgb, #c084fc 35%, var(--legend-border));
}

.legend-widget[data-type-id="dark_pool"] .legend-dp-filters-btn--active {
  color: #e9d5ff;
  border-color: color-mix(in srgb, #c084fc 40%, var(--legend-border));
  background: color-mix(in srgb, #c084fc 12%, var(--legend-bg-elevated));
}

.legend-widget[data-type-id="dark_pool"] .legend-dp-filters-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--banana-radius);
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  color: #1a1028;
  background: #c084fc;
}

.legend-widget[data-type-id="dark_pool"] .legend-dp-filters-badge[hidden] {
  display: none !important;
}

.legend-widget[data-type-id="dark_pool"] .legend-dp-filters-caret {
  font-size: 9px;
  opacity: 0.75;
}

.legend-widget[data-type-id="dark_pool"] .legend-dp-filters-panel {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 8px;
  z-index: 200;
  width: min(300px, calc(100% - 16px));
  box-sizing: border-box;
  padding: 10px;
  border-radius: var(--banana-radius);
  border: 1px solid color-mix(in srgb, #c084fc 22%, var(--legend-border));
  background: var(--legend-bg-widget, #141414);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.legend-widget[data-type-id="dark_pool"] .legend-dp-filters-panel.is-open {
  display: block;
}

.legend-widget[data-type-id="dark_pool"] > .legend-widget-header:has(.legend-dp-filters-panel.is-open) {
  z-index: 50;
}

.legend-widget[data-type-id="dark_pool"] .legend-dp-filters-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
}

.legend-widget[data-type-id="dark_pool"] .legend-dp-filter-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.legend-widget[data-type-id="dark_pool"] .legend-dp-filter-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--legend-text-muted);
}

.legend-widget[data-type-id="dark_pool"] .legend-dp-filter {
  width: 100%;
  box-sizing: border-box;
  font-size: 11px;
  padding: 5px 7px;
  border-radius: var(--banana-radius);
  border: 1px solid var(--legend-border);
  background: var(--legend-bg-elevated);
  color: var(--legend-text);
}

.legend-widget[data-type-id="dark_pool"] .legend-dp-filter:focus {
  outline: none;
  border-color: color-mix(in srgb, #c084fc 45%, var(--legend-border));
}

.legend-widget[data-type-id="dark_pool"] .legend-dp-filters-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--legend-border);
}

.legend-widget[data-type-id="dark_pool"] .legend-dp-filters-clear {
  font: inherit;
  font-size: 10px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--banana-radius);
  border: 1px solid var(--legend-border);
  background: transparent;
  color: var(--legend-text-muted);
  cursor: pointer;
}

.legend-widget[data-type-id="dark_pool"] .legend-dp-filters-clear:hover {
  color: var(--legend-text);
  background: rgba(255, 255, 255, 0.06);
}

.legend-widget[data-type-id="dark_pool"] .legend-dp-ticker {
  flex: 0 1 auto;
  min-width: 0;
}

.legend-widget[data-type-id="dark_pool"][data-dark-pool-mode="recent"] .legend-dp-ticker {
  display: none;
}

.legend-widget[data-type-id="dark_pool"] .legend-widget-date {
  flex: 0 0 auto;
}

.legend-widget[data-type-id="dark_pool"] .legend-widget-header-spacer {
  flex: 1 1 auto;
  min-width: 8px;
}

/* Detail modal */
.dp-modal {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.dp-modal[hidden] {
  display: none !important;
}

.dp-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.dp-modal__dialog {
  position: relative;
  width: min(520px, 100%);
  max-height: 85vh;
  overflow: auto;
  border-radius: var(--banana-radius);
  border: 1px solid var(--legend-border);
  background: var(--legend-bg-widget, #141414);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.dp-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--legend-border);
}

.dp-modal__title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--legend-text, #f3f4f6);
}

.dp-modal__close {
  font: inherit;
  font-size: 22px;
  line-height: 1;
  border: none;
  background: transparent;
  color: var(--legend-text-muted);
  cursor: pointer;
}

.dp-modal__body {
  padding: 12px 16px 16px;
}

.dp-detail-section {
  margin-bottom: 14px;
}

.dp-detail-section__title {
  margin: 0 0 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--legend-text-muted);
}

.dp-detail-list {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(110px, 38%) 1fr;
  gap: 6px 12px;
  font-size: 11px;
}

.dp-detail-list dt {
  margin: 0;
  color: var(--legend-text-muted);
  font-weight: 600;
}

.dp-detail-list dd {
  margin: 0;
  word-break: break-all;
  color: var(--legend-text, #f3f4f6);
}

body.darkpool-modal-open {
  overflow: hidden;
}
