/* Data Hub — namespaced (.dh-). Shared buttons, cards, fields, tabs,
   tables and badges come from portal-ui.css. */

.dh-title {
  margin: 0 0 8px;
}

.dh-lead {
  margin: 0 0 24px;
  color: var(--ink-2);
  line-height: 1.5;
  max-width: 46rem;
}

.dh-panel .dh-lead + .dh-help {
  margin: -12px 0 16px;
  max-width: 46rem;
}

.dh-help code {
  font-size: 0.92em;
}

.dh-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.dh-main > .dh-panel,
.dh-main > form.dh-panel {
  margin-bottom: 20px;
}

.dh-panel h2 {
  margin: 0 0 12px;
}

.dh-table-wrap {
  overflow-x: auto;
  margin: 0 -12px;
  padding: 0 12px;
}

/* Row actions stay quiet until needed. */
.dh-table .dh-btn {
  min-height: 28px;
  padding: 0 10px;
  font-size: var(--fs-xs);
  background: transparent;
  color: var(--info);
}

.dh-table .dh-btn:hover { background: var(--info-tint); }

.dh-table .dh-col-action {
  width: 1%;
  white-space: nowrap;
  text-align: right;
  vertical-align: middle;
}

.dh-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 20px;
}

.dh-check {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 8px;
  font-size: var(--fs-sm);
}

.dh-preview {
  margin: 0 0 16px;
  padding: 16px;
  border-radius: var(--r-md);
  background: var(--fill);
}

.dh-preview h3 {
  margin: 0 0 6px;
}

.dh-json {
  margin: 0;
  padding: 16px;
  background: var(--fill);
  color: var(--ink);
  border-radius: var(--r-md);
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  max-height: 28rem;
}

.dh-disclosures {
  margin: 8px 0 20px;
  padding: 0;
  list-style: none;
}

.dh-disclosures li {
  margin: 0 0 14px;
  line-height: 1.5;
}

.dh-disclosures .dh-pill {
  margin-left: 6px;
}

.dh-main-wide {
  width: min(1280px, 100%);
}

.dh-summaries-split {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr);
  gap: 24px 32px;
  align-items: start;
}

.dh-summaries-main .dh-lead {
  margin-bottom: 16px;
}

.dh-summaries-main .dh-field {
  margin-bottom: 0;
}

.dh-summaries-controls {
  padding: 18px;
  background: var(--fill);
  border-radius: var(--r-md);
}

.dh-summaries-controls h3 {
  margin: 0 0 14px;
}

.dh-summaries-controls .dh-field {
  margin-bottom: 14px;
}

.dh-summaries-controls .dh-actions {
  margin: 14px 0 0;
}

.dh-summaries-controls .dh-help {
  font-size: var(--fs-xs);
}

@media (max-width: 800px) {
  .dh-summaries-split {
    grid-template-columns: 1fr;
  }
}

.dh-table-compare thead tr:first-child th {
  padding-bottom: 2px;
  border-bottom: 0;
  color: var(--ink-2);
  font-weight: 600;
}

.dh-table-compare thead tr:last-child th {
  padding-top: 2px;
}

.dh-table-compare th.dh-group,
.dh-table-compare td.dh-group {
  border-left: 1px solid var(--hairline);
}

/* Metrics read as a quiet row of large numbers. */
.dh-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0;
  margin: 20px 0 24px;
  padding: 4px 0;
}

.dh-metric {
  padding: 4px 20px;
  border-left: 1px solid var(--hairline);
}

.dh-metric:first-child {
  border-left: 0;
  padding-left: 0;
}

.dh-metric span {
  display: block;
  font-size: var(--fs-xs);
  color: var(--ink-3);
  margin-bottom: 2px;
}

.dh-metric strong {
  font-size: var(--fs-xl);
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.dh-metric strong.dh-pos { color: var(--pos); }
.dh-metric strong.dh-neg { color: var(--neg); }

.dh-metric-compare {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 4px;
  font-size: var(--fs-xs);
  color: var(--ink-3);
}

.dh-metric-compare .dh-pos,
.dh-metric-compare .dh-neg { font-variant-numeric: tabular-nums; }

@media (max-width: 640px) {
  .dh-metrics { grid-template-columns: 1fr 1fr; row-gap: 16px; }
  .dh-metric:nth-child(odd) { border-left: 0; padding-left: 0; }
}

.dh-summary-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.dh-returns-fee {
  min-width: 180px;
  margin: 0;
}

.dh-returns-board {
  display: grid;
  gap: 28px;
}

.dh-returns-board > .dh-table-wrap {
  min-width: 0;
  margin: 0;
  padding: 0;
}

.dh-returns-table {
  width: max-content;
  min-width: 100%;
}

.dh-returns-strategy {
  font-weight: 600;
  vertical-align: middle;
  width: 8.5rem;
  white-space: normal;
  color: var(--ink);
}

.dh-summary-card h2 { margin-bottom: 6px; }

/* Stepper: labelled dots on a thin line. */
.dh-stepper {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  margin: 0 0 24px;
  padding: 0;
}

.dh-step {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  color: var(--ink-3);
}

.dh-step::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fill-active);
  flex: none;
}

.dh-step + .dh-step::after {
  content: '';
  position: absolute;
  left: -22px;
  top: 50%;
  width: 16px;
  height: 1px;
  background: var(--hairline-strong);
}

.dh-step.is-done { color: var(--ink-2); }
.dh-step.is-done::before { background: var(--accent); }

.dh-step-back {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.dh-step.is-active {
  color: var(--ink);
  font-weight: 600;
}

.dh-step.is-active::before {
  background: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-tint);
}

/* In-page tabs (e.g. summary profiles) sit with breathing room. */
.dh-main .dh-tabs {
  margin: 12px 0 16px;
}

.dh-details {
  margin: 12px 0 16px;
}

.dh-details summary {
  cursor: pointer;
  color: var(--ink-2);
  font-size: var(--fs-sm);
  font-weight: 500;
  margin-bottom: 8px;
}

.dh-lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 12px;
}

.dh-lib-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.dh-lib-desk-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0 0 20px;
  padding: 12px 0 8px;
  background: var(--bg, #fff);
  border-bottom: 1px solid var(--hairline);
}

.dh-lib-desk-bar .dh-tabs {
  margin: 0 0 8px;
}

.dh-lib-desk-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: flex-end;
}

.dh-lib-desk-meta .dh-help {
  margin: 0;
}

.dh-lib-desk-meta .dh-field {
  margin: 0;
  min-width: 10rem;
}

.dh-lib-desk {
  display: grid;
  grid-template-columns: minmax(11rem, 14rem) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.dh-lib-rail {
  position: sticky;
  top: 6.5rem;
}

.dh-lib-rail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dh-lib-rail-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  cursor: pointer;
}

.dh-lib-rail-item:hover {
  background: var(--fill);
  color: var(--ink);
}

.dh-lib-rail-item.is-active {
  background: var(--gold-tint, var(--info-tint));
  border-color: var(--hairline-strong);
  color: var(--ink);
  font-weight: 600;
}

.dh-lib-desk-main,
.dh-lib-firm {
  min-width: 0;
}

@media (max-width: 720px) {
  .dh-lib-desk {
    grid-template-columns: 1fr;
  }

  .dh-lib-rail {
    position: static;
  }

  .dh-lib-rail-list {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .dh-lib-rail-item {
    width: auto;
  }
}

.dh-table input,
.dh-table select,
.dh-table textarea {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  min-height: 32px;
  padding: 4px 8px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-xs);
  background: var(--surface);
}

.dh-prompt {
  display: flex;
  flex-direction: column;
  min-height: 28rem;
  margin-bottom: 20px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--surface);
}

.dh-thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  max-height: 36rem;
  overflow: auto;
  padding: 16px;
}

.dh-prompt-empty,
.dh-prompt-note {
  margin: 0;
  color: var(--ink-2);
  line-height: 1.5;
}

.dh-prompt-note {
  padding: 0 16px 8px;
}

.dh-msg {
  max-width: 40rem;
  padding: 12px 14px;
  border-radius: var(--r-md);
  line-height: 1.5;
}

.dh-msg p {
  margin: 0 0 6px;
}

.dh-msg ul {
  margin: 0 0 8px;
  padding-left: 1.15rem;
}

.dh-msg .dh-actions {
  margin: 8px 0 0;
}

.dh-msg-you {
  align-self: flex-end;
  background: var(--info-tint);
}

.dh-msg-hub {
  align-self: flex-start;
  background: var(--fill);
}

.dh-composer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--hairline);
}

.dh-composer textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 4.5rem;
  max-height: 16rem;
  resize: vertical;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  line-height: 1.5;
}

.dh-composer textarea:focus {
  outline: none;
}

.dh-msg-text {
  white-space: pre-wrap;
  max-height: 12rem;
  overflow: auto;
}

.dh-composer-bar {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.dh-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dh-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-xs);
}

.dh-msg-you .dh-chip {
  background: var(--surface);
}

.dh-chip-remove {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  font: inherit;
  line-height: 1;
}

.dh-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
