#stock-intro {
  margin-top: 1em;
}

#stock-intro h1 {
  font-weight: 700;
  font-size: 2em;
  line-height: 1.1;
  margin: 0.2em 0 0.1em 0;
}

#stock-intro h3.sub {
  font-weight: 400;
  font-style: italic;
  font-size: 1em;
  color: #666;
  margin: 0 0 1em 0;
}

#stock-intro h3 {
  font-weight: 600;
  font-size: 1.25em;
  margin: 1.5em 0 0.5em 0;
}

#stock-intro p {
  margin: 0.4em 0;
}

#stock-intro p.lede {
  font-size: 1.1em;
  font-weight: 600;
  margin: 0.5em 0 1em 0;
}

#stock-status {
  color: #666;
  font-style: italic;
}

.amount-control {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  margin: 1.2em 0 0.4em 0;
  padding: 0.5em 0.8em;
  background-color: #f4f0e6;
  border: 1px solid #d9c9a8;
  border-radius: 4px;
}

.amount-control label {
  font-weight: 600;
  color: #444;
}

.amount-input {
  font-weight: 600;
  color: #222;
}

#amount {
  width: 5.5em;
  margin-left: 0.15em;
  padding: 0.25em 0.4em;
  font: inherit;
  font-weight: 600;
  border: 1px solid #ccc;
  border-radius: 3px;
  background-color: #fff;
}

#amount:focus {
  outline: 2px solid #c5e1a5;
  border-color: #4a7c2e;
}

#stock-results {
  margin-top: 1em;
}

.table-wrap {
  /* No overflow constraint — overflow-x: auto would create a scrolling ancestor
     and prevent the thead/category-row from sticking to the viewport. */
}

#stock-table {
  width: 100%;
  border-collapse: collapse;
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  table-layout: fixed;
}

#stock-table thead th:nth-child(1) { width: 24%; }
#stock-table thead th:nth-child(2) { width: 11%; }
#stock-table thead th:nth-child(3) { width: 11%; }
#stock-table thead th:nth-child(4) { width: 40%; }
#stock-table thead th:nth-child(5) { width: 14%; }

#stock-table thead th {
  background-color: #d9e8c7;
  font-family: "Inter", Arial, sans-serif;
  font-weight: 600;
  padding: 0.6em 0.8em;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid #c0d4a8;
  position: sticky;
  top: 0;
  z-index: 3;
}

#stock-table thead th:first-child {
  text-align: left;
}

#stock-table tbody td {
  padding: 0.5em 0.8em;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid #f0f0f0;
}

#stock-table tbody td:first-child {
  text-align: left;
}

.category-row {
  cursor: pointer;
  background-color: #f4f0e6;
  font-weight: 600;
}

.category-row td {
  padding: 0.7em 0.8em !important;
  border-bottom: 1px solid #d9c9a8 !important;
  border-top: 1px solid #d9c9a8 !important;
  position: sticky;
  top: var(--cat-top, 36px);
  z-index: 2;
  background-color: #f4f0e6;
}

.category-row:hover td {
  background-color: #ebe2cc;
}

.detail-header th {
  position: sticky;
  top: var(--detail-header-top, 72px);
  z-index: 1;
  background-color: #ebf0e4;
  font-family: "Inter", Arial, sans-serif;
  font-weight: 600;
  font-size: 12px;
  padding: 0.5em 0.8em;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid #c0d4a8;
  color: #444;
}

.detail-header th:first-child {
  text-align: left;
}

.category-label {
  font-family: "Inter", Arial, sans-serif;
}

.triangle {
  display: inline-block;
  width: 1em;
  color: #666;
  font-size: 0.8em;
}

.detail-row td {
  font-size: 12px;
}

.detail-row td.indent {
  padding-left: 2.5em !important;
  color: #555;
}

.info-icon {
  margin-left: 0.4em;
  color: #555;
  font-size: 1.05em;
}

.detail-row:hover .info-icon {
  color: #222;
}

.detail-row:hover td {
  background-color: #f6f9f1;
}

.tqqq-win {
  color: #4a7c2e;
  font-weight: 600;
}

.qqq-win {
  color: #b00020;
  font-weight: 600;
}

.muted {
  color: #999;
}

.margin-cell {
  white-space: nowrap;
}

.margin-inner {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.7em;
}

.margin-value {
  flex: 1;
  text-align: right;
}

.squares {
  display: inline-flex;
  gap: 2px;
  flex-shrink: 0;
  vertical-align: middle;
}

.square {
  display: inline-block;
  width: 8px;
  height: 8px;
  border: 1px solid #d0d0d0;
  background-color: #fff;
  box-sizing: border-box;
}

.square.filled {
  background-color: #4a7c2e;
  border-color: #4a7c2e;
}

.square.filled.qqq {
  background-color: #b00020;
  border-color: #b00020;
}

@media (max-width: 768px) {
  #stock-table {
    font-size: 12px;
  }

  #stock-table thead th,
  #stock-table tbody td {
    padding: 0.4em 0.6em;
  }

  .detail-row td {
    font-size: 11px;
  }

  .detail-row td.indent {
    padding-left: 1.5em !important;
  }
}
