/* Launchpad treasury widget — headline-stat block + top holdings table.
   Same visual language as launchpad-live-coins.css; intentionally heavier
   on the headline figure since treasury value IS the operator KPI. */

.lt-section {
  position: relative;
  margin: 24px 0;
  background: linear-gradient(145deg, var(--color-bg-card, #16161a) 0%, rgba(0, 0, 0, 0.18) 100%);
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.08));
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.06), inset 0 1px rgba(255, 255, 255, 0.04);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.lt-section::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(212, 175, 55, 0.45) 50%, transparent 100%);
  z-index: 1;
  pointer-events: none;
}

.lt-section:hover {
  border-color: rgba(212, 175, 55, 0.22);
  box-shadow: 0 0 32px rgba(212, 175, 55, 0.10), inset 0 1px rgba(255, 255, 255, 0.05);
}

.lt-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--color-border, #ffffff14);
}

.lt-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text, #fff);
  margin: 0 0 10px;
  letter-spacing: -0.01em;
}

/* Wallet row — short address pill + "Updated <ts>" pill, separated by
   structural flex gap (12px) rather than an inline " · " character.
   Both items render as their own visual chips so the eye reads them
   as two distinct pieces of metadata, not one run-on string. */
.lt-wallet {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, monospace);
  font-size: 0.7rem;
  color: var(--color-text-dim, #ffffff60);
}

.lt-wallet-link {
  color: var(--accent, #d4af37);
  text-decoration: none;
}

.lt-wallet-link:hover,
.lt-wallet-link:focus-visible { text-decoration: underline; }

/* "Updated <ts>" sub-pill — gold-tint chip on the same scale as the
   AVICI hero's "Updated Xm ago". Sits inline with the wallet address
   but reads as its own metadata, not a tail of the address string. */
.lt-updated {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(var(--color-terracotta-rgb), 0.06);
  border: 1px solid rgba(var(--color-terracotta-rgb), 0.14);
  color: var(--color-text-dim, #ffffff60);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.lt-headline {
  text-align: right;
  flex-shrink: 0;
}

.lt-headline-value {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, monospace);
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent, #d4af37);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.05;
  text-shadow: 0 0 18px rgba(212, 175, 55, 0.30);
}

body.dark .lt-headline-value {
  text-shadow: 0 0 22px rgba(212, 175, 55, 0.40);
}

.lt-headline-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-dim, #ffffff60);
  margin-top: 4px;
}

.lt-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  background: var(--color-border, #ffffff14);
  border-bottom: 1px solid var(--color-border, #ffffff14);
}

.lt-kpi {
  background: var(--color-bg-card, #ffffff04);
  padding: 14px 18px;
  transition: background-color 0.2s ease;
}

.lt-kpi:hover { background: rgba(212, 175, 55, 0.05); }

.lt-kpi-value {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, monospace);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text, #fff);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.lt-kpi-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-dim, #ffffff60);
  margin-top: 4px;
}

.lt-kpi-sub {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, monospace);
  font-size: 0.7rem;
  color: var(--color-text-muted, #ffffff80);
  margin-top: 2px;
}

.lt-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.lt-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
  font-size: 0.85rem;
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, monospace);
}

.lt-table th,
.lt-table td {
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--color-border, #ffffff10);
}

.lt-table th {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-dim, #ffffff60);
  position: sticky;
  top: 0;
  background: var(--color-bg, transparent);
  z-index: 1;
  white-space: nowrap;
}

/* Sortable column header — clickable, keyboard-accessible, with caret. */
.lt-th-sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.lt-th-sortable:hover {
  color: var(--accent, #d4af37);
  background: rgba(212, 175, 55, 0.06);
}

.lt-th-sortable:focus-visible {
  outline: 2px solid var(--accent, #d4af37);
  outline-offset: -2px;
  color: var(--accent, #d4af37);
}

.lt-th-sortable[aria-sort="ascending"],
.lt-th-sortable[aria-sort="descending"] {
  color: var(--accent, #d4af37);
}

.lt-sort-caret {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.7em;
  opacity: 0.35;
  transition: opacity 0.15s ease;
  font-family: var(--font-mono, ui-monospace, monospace);
}

.lt-th-sortable:hover .lt-sort-caret { opacity: 0.7; }

.lt-th-sortable[aria-sort="ascending"] .lt-sort-caret,
.lt-th-sortable[aria-sort="descending"] .lt-sort-caret { opacity: 1; }

.lt-th-sortable[aria-sort="none"] .lt-sort-caret::before,
.lt-th-sortable:not([aria-sort]) .lt-sort-caret::before { content: "↕"; }
.lt-th-sortable[aria-sort="ascending"] .lt-sort-caret::before { content: "▲"; }
.lt-th-sortable[aria-sort="descending"] .lt-sort-caret::before { content: "▼"; }

.lt-table tbody tr {
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.lt-table tbody tr:hover {
  background: rgba(212, 175, 55, 0.06);
  box-shadow: inset 3px 0 0 var(--accent, #d4af37);
}

.lt-table tbody tr:last-child td { border-bottom: none; }

.lt-num {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Even out the row rhythm. Without an explicit width hint, a 5-column
   table gives the icon-bearing Token cell ~50% of the row and clusters
   the right-aligned numeric cells in a tight strip on the far right —
   leaving a wide dead zone in the middle that reads as "out of shape".
   Capping .lt-tk + giving each numeric cell a min-width keeps the row
   visually centered no matter how short the data is (e.g. SOL = 45). */
.lt-tk {
  max-width: 320px;
  width: 1%;        /* shrink-to-fit, distributes leftover space to numerics */
  white-space: nowrap;
}

.lt-table .lt-num { min-width: 110px; }
.lt-table .lt-value { min-width: 130px; }

/* Rank column — same width + color treatment as launchpad-live-coins
   .lc-rank so the two tables read with the same visual contract. */
.lt-rank {
  width: 36px;
  color: var(--color-text-dim, #ffffff60);
  font-size: 0.75rem;
}

/* 32px avatar promotion — same recipe as launchpad-live-coins.css.
   The two tables share the launchpad page so visual contract must
   match. HTML attr stays 28; CSS scales up; mono fallback obeys. */
.lt-tk .token-icon {
  width: 32px;
  height: 32px;
}
.lt-tk .token-icon-mono {
  font-size: 0.78rem;
}

.lt-tk .lt-name {
  font-family: var(--font-sans, system-ui, sans-serif);
  font-weight: 600;
  color: var(--color-text, #fff);
  letter-spacing: -0.01em;
  font-size: 0.92rem;
  line-height: 1.25;
}

/* Ticker subtext — mono uppercase with letter-spacing, matches the
   live-coins recipe so the two tables read with the same visual
   contract on the same page. */
.lt-tk .lt-sub {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, monospace);
  font-size: 0.66rem;
  color: var(--color-text-dim, #ffffff60);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
  line-height: 1.2;
  margin-top: 1px;
}

.lt-value { font-weight: 700; color: var(--color-text, #fff); }
.lt-pct {
  font-weight: 400;
  color: var(--color-text-dim, #ffffff60);
  font-size: 0.72rem;
  margin-left: 4px;
}

.lt-dim { color: var(--color-text-dim, #ffffff60); }

.lt-sr {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.lt-empty {
  padding: 36px 20px;
  text-align: center;
  color: var(--color-text-muted, #ffffff80);
  font-size: 0.85rem;
}

/* Tablet (641px – 900px): tighten padding, drop one column. */
@media (max-width: 900px) {
  .lt-table { min-width: 0; }
  .lt-table th, .lt-table td { padding: 9px 12px; }
}

/* Mobile (≤640px): card-stack layout. Each row becomes a self-contained
   card with label/value pairs sourced from the [data-label] attr on each
   <td>. Table semantics preserved (good for AT). */
@media (max-width: 640px) {
  .lt-section { border-radius: 12px; }

  .lt-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 16px 14px;
    gap: 10px;
  }
  .lt-header h2 { font-size: 0.95rem; }
  .lt-headline { text-align: left; width: 100%; }
  .lt-headline-value { font-size: 1.6rem; }
  .lt-headline-label { margin-top: 2px; }

  .lt-kpis { grid-template-columns: 1fr 1fr; }
  .lt-kpi { padding: 12px 14px; }

  .lt-table-wrap { padding: 8px 8px 4px; }

  /* Visually hide thead but keep it for screen readers. */
  .lt-table thead {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .lt-table,
  .lt-table tbody,
  .lt-table tr,
  .lt-table td {
    display: block;
    width: 100%;
  }

  .lt-table { min-width: 0; }

  /* Reset the desktop column-distribution constraints — on the card
     stack each td fills the row, so the desktop max/min widths would
     cap content awkwardly. */
  .lt-tk { max-width: none; white-space: normal; }
  .lt-table .lt-num,
  .lt-table .lt-value { min-width: 0; }

  .lt-table tr {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--color-border, rgba(255, 255, 255, 0.08));
    border-radius: 10px;
    margin-bottom: 10px;
    padding: 12px 14px;
    position: relative;
  }
  .lt-table tr:last-child { margin-bottom: 0; }
  .lt-table tr:hover { background: rgba(212, 175, 55, 0.06); }

  .lt-table td {
    padding: 5px 0;
    border-bottom: none;
    text-align: right;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
  }

  .lt-table td::before {
    content: attr(data-label);
    color: var(--color-text-dim, #ffffff60);
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-weight: 600;
    flex-shrink: 0;
  }

  /* Token cell takes the full row, label suppressed (icon + name carry
     it). Banner-style — avatar pinned left, name/ticker stack right. */
  .lt-table td.lt-tk {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
    padding: 0 0 10px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--color-border, rgba(255, 255, 255, 0.06));
  }
  .lt-table td.lt-tk::before { display: none; }
  /* 36px avatar on mobile carries the identity weight that desktop
     gets from icon + rank-column adjacency. */
  .lt-table td.lt-tk .token-icon { width: 36px; height: 36px; }
  .lt-table td.lt-tk .token-icon-mono { font-size: 0.85rem; }
  .lt-table td.lt-tk .token-cell { gap: 14px; padding-right: 56px; /* room for the rank pill */ }
  .lt-table td.lt-tk .lt-name { font-size: 1rem; }

  /* Rank — corner pill matching live-coins: gold-tint background +
     border so it reads as a "stack rank" sticker. */
  .lt-table td.lt-rank {
    position: absolute;
    top: 12px;
    right: 14px;
    width: auto;
    padding: 2px 8px;
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, monospace);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--color-text-muted, #ffffff80);
    background: rgba(212, 175, 55, 0.06);
    border: 1px solid rgba(212, 175, 55, 0.22);
    border-radius: 999px;
  }
  .lt-table td.lt-rank::before { content: "#"; display: inline; color: var(--color-text-dim, #ffffff60); margin: 0; padding: 0; font-size: 0.62rem; letter-spacing: 0; text-transform: none; font-weight: 700; }

  /* Drop the Price column on stacked layout to keep cards short. */
  .lt-hide-narrow { display: none !important; }
}
