:root {
  --paper: #fffff8;
  --ink: #111111;
  --ink-secondary: #4a4a4a;
  --ink-muted: #767676;
  --ink-light: #ababab;
  --rule: #d8d8d0;
  --series-1: #111111;
  --series-2: #5a5a5a;
  --series-3: #9a9a9a;
  --gate-buy-strong: #c5d6b8;
  --gate-buy-weak: #dce8d4;
  --gate-hold: #e8e8e0;
  --gate-sell-weak: #eaded8;
  --gate-sell-strong: #dcc8c0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  font-size: 14px;
  line-height: 1.45;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

header {
  padding: 1.5rem 1.75rem 0.75rem;
  border-bottom: 0.5px solid var(--rule);
}

.ticker-nav {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.ticker-nav__link {
  color: var(--ink-muted);
  text-decoration: none;
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
}

.ticker-nav__link--active,
.ticker-nav__link:hover {
  color: var(--ink);
}

.ticker-nav__link.htmx-request {
  color: var(--ink);
  opacity: 0.55;
  pointer-events: none;
}

.viz-loading {
  display: none;
  align-items: center;
  gap: 0.5rem;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  padding: 0.5rem 1.75rem;
  font-size: 0.8125rem;
  color: var(--ink);
  background: var(--paper);
  border-bottom: 0.5px solid var(--rule);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--ink) 6%, transparent);
}

.viz-loading.is-visible,
.viz-loading.htmx-request {
  display: flex;
}

.viz-loading__label::after {
  content: " …";
  animation: viz-loading-pulse 0.9s ease-in-out infinite;
}

@keyframes viz-loading-pulse {
  0%,
  100% {
    opacity: 0.2;
  }
  50% {
    opacity: 1;
  }
}

body.viz-loading-active #viz-charts,
body.viz-loading-active #charts {
  opacity: 0.2;
  pointer-events: none;
  transition: opacity 80ms ease;
}

body.viz-loading-active::before {
  content: "";
  position: fixed;
  inset: 0;
  top: 2.5rem;
  z-index: 15;
  background: color-mix(in srgb, var(--paper) 55%, transparent);
  pointer-events: none;
}

header h1 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 400;
  letter-spacing: 0.02em;
}

header p {
  margin: 0.2rem 0 0;
  color: var(--ink-muted);
  font-size: 0.8125rem;
  font-style: italic;
}

.chart-interpret {
  margin: 0 0 0.5rem;
}

.chart-interpret summary {
  cursor: pointer;
  font-size: 0.6875rem;
  color: var(--ink-muted);
  user-select: none;
  list-style: none;
}

.chart-interpret summary::-webkit-details-marker {
  display: none;
}

.chart-interpret summary::before {
  content: "▸ ";
  display: inline-block;
  width: 0.85rem;
}

.chart-interpret[open] summary::before {
  content: "▾ ";
}

.chart-interpret-body {
  margin-top: 0.4rem;
}

.chart-interpret-intro {
  margin: 0 0 0.35rem;
  font-size: 0.6875rem;
  line-height: 1.45;
  color: var(--ink-secondary);
}

.chart-interpret ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.chart-interpret li {
  margin: 0 0 0.3rem;
  font-size: 0.6875rem;
  line-height: 1.45;
  color: var(--ink-secondary);
}

.chart-interpret li:last-child {
  margin-bottom: 0;
}

.interpret-tag {
  font-weight: 600;
  color: var(--ink);
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  padding: 0 0.5rem 2rem;
}

@media (max-width: 960px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

.chart-card-secondary {
  grid-column: 1 / -1;
}

.chart-card-secondary h2 {
  color: var(--ink-muted, #666);
  font-weight: 500;
}

.chart-note {
  margin: 0 0 0.5rem;
  font-size: 0.6875rem;
  line-height: 1.4;
  color: var(--ink-muted, #888);
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin: 0 0 0.35rem;
  font-size: 0.6875rem;
  color: var(--ink-muted, #666);
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.chart-legend-swatch {
  display: inline-flex;
  align-items: center;
  width: 1.5rem;
  color: var(--legend-color);
}

.chart-legend-line {
  flex: 1;
  height: 0;
  border-top: 1.25px solid currentColor;
}

.chart-legend-swatch--dashed .chart-legend-line {
  border-top-style: dashed;
  border-top-width: 1px;
}

.chart-legend-dot {
  flex-shrink: 0;
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  border-radius: 50%;
  background: currentColor;
}

.chart-legend-dot--hollow {
  border: 1.25px solid currentColor;
  background: var(--paper);
}

.chart-card {
  padding: 1.25rem 1.25rem 0.75rem;
  border-bottom: 0.5px solid var(--rule);
}

.chart-card:nth-child(odd) {
  border-right: 0.5px solid var(--rule);
}

@media (max-width: 960px) {
  .chart-card:nth-child(odd) {
    border-right: none;
  }
}

.chart-card h2 {
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.chart-card svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.axis text {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 9px;
  fill: var(--ink-muted);
}

.axis path,
.axis line {
  stroke: var(--rule);
}

.axis .domain {
  stroke: var(--ink-light);
  stroke-width: 0.5px;
}

.axis .tick line {
  stroke: var(--rule);
  stroke-width: 0.5px;
}

.axis--y .tick line {
  stroke: none;
}

.baseline {
  stroke: var(--ink-light);
  stroke-width: 0.5px;
}

.line-gate {
  fill: none;
  stroke-width: 0.75px;
  opacity: 0.85;
}

.line-primary {
  fill: none;
  stroke: var(--series-1);
  stroke-width: 1.25px;
}

.line-secondary {
  fill: none;
  stroke: var(--series-2);
  stroke-width: 1px;
  stroke-dasharray: 4 3;
}

.sparkline {
  fill: none;
  stroke: var(--series-1);
  stroke-width: 1px;
}

.sparkline--operating {
  stroke: var(--series-2);
  stroke-dasharray: 3 2;
}

.sparkline--net {
  stroke: var(--series-3);
}

.sparkline-label {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 9px;
  fill: var(--ink-secondary);
}

.sparkline-value {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 9px;
  font-weight: 600;
  fill: var(--ink);
  text-anchor: end;
}

.sparkline-end {
  fill: var(--series-1);
}

.sparkline-end--operating {
  fill: var(--series-2);
}

.sparkline-end--net {
  fill: var(--series-3);
}

.direct-label {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 9px;
  fill: var(--ink-secondary);
}

.direct-label-value {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 9px;
  font-weight: 600;
  fill: var(--ink);
}

.gate-zone {
  opacity: 0.5;
}

.gate-zone--buy-strong {
  fill: var(--gate-buy-strong);
}

.gate-zone--buy-weak {
  fill: var(--gate-buy-weak);
}

.gate-zone--hold {
  fill: var(--gate-hold);
}

.gate-zone--sell-weak {
  fill: var(--gate-sell-weak);
}

.gate-zone--sell-strong {
  fill: var(--gate-sell-strong);
}

.gate-price-label {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 8px;
  fill: var(--ink-secondary);
}

.gate-edge {
  stroke: var(--rule);
  stroke-width: 0.5px;
}

.incomplete-region {
  fill: url(#incomplete-hatch);
  opacity: 0.55;
  pointer-events: none;
}

.incomplete-label {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 8px;
  font-style: italic;
  fill: var(--ink-muted);
  pointer-events: none;
}

.line-open {
  stroke-dasharray: 4 3;
  opacity: 0.85;
}

.error {
  padding: 2rem 1.75rem;
  color: #8b1a1a;
  font-style: italic;
}

footer {
  padding: 0.75rem 1.75rem 2rem;
  font-size: 0.6875rem;
  color: var(--ink-light);
  font-style: italic;
  border-top: 0.5px solid var(--rule);
}

.lede {
  max-width: 42rem;
  margin: 0.75rem 0 0;
  color: var(--ink-secondary);
}

.book-wrap {
  overflow-x: auto;
  padding: 0 1.75rem 1rem;
}

.book {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.book th,
.book td {
  padding: 0.45rem 0.6rem;
  border-bottom: 0.5px solid var(--rule);
  text-align: left;
  white-space: nowrap;
}

.book th.num,
.book td.num {
  text-align: right;
}

.book-anchor {
  display: block;
  color: var(--ink-muted);
  font-size: 0.75rem;
}

.book-cheap {
  color: #1d6b3a;
}

.book-rich {
  color: #8a2a2a;
}

.logout {
  margin-left: auto;
}

.logout button {
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font: inherit;
  cursor: pointer;
}

.login {
  max-width: 24rem;
  margin: 4rem auto;
  padding: 0 1.5rem;
}

.login form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.login input[type="password"] {
  font: inherit;
  padding: 0.4rem 0.5rem;
  border: 0.5px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
}

.login button {
  align-self: start;
  font: inherit;
  padding: 0.35rem 0.8rem;
  border: 0;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
}

.login-error {
  color: #8a2a2a;
}

.disclaimer {
  color: var(--ink-secondary);
}
