* { box-sizing: border-box; }

body {
  font-family: -apple-system, "Segoe UI", "PingFang SC", sans-serif;
  margin: 0;
  background: #f5f6fa;
  color: #1c1e2a;
}

header {
  padding: 20px 28px 12px;
  background: #ffffff;
  border-bottom: 1px solid #dde1eb;
}

h1 {
  font-size: 20px;
  margin: 0 0 14px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

#search-form {
  display: flex;
  gap: 8px;
}

#search-form input[type="text"] {
  flex: 1;
  max-width: 260px;
}

#days-input {
  width: 64px;
  text-align: center;
}

.days-label {
  font-size: 13px;
  color: #8a92aa;
  white-space: nowrap;
}

#search-form input,
#search-form button {
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #c8d0e0;
  background: #ffffff;
  color: #1c1e2a;
  font-size: 14px;
}

#search-form button {
  background: #3b6ef0;
  border-color: #3b6ef0;
  color: #ffffff;
  cursor: pointer;
  font-weight: 600;
}

#search-form button:hover { background: #2d5de0; }

#status {
  min-height: 18px;
  margin: 10px 0 0;
  font-size: 13px;
  color: #8a92aa;
}

.enrich-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
  font-size: 12px;
  color: #6a7290;
}
.enrich-dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f0a800;
}
.enrich-status[data-state="loading"] .enrich-dot {
  animation: enrich-pulse 0.9s ease-in-out infinite;
}
.enrich-status[data-state="done"] .enrich-dot {
  background: #2eaa55;
  animation: none;
}
@keyframes enrich-pulse {
  0%   { box-shadow: 0 0 0 0   rgba(240, 168, 0, 0.6); }
  60%  { box-shadow: 0 0 0 7px rgba(240, 168, 0, 0);   }
  100% { box-shadow: 0 0 0 0   rgba(240, 168, 0, 0);   }
}

main {
  padding: 28px 28px 60px;
  position: relative;
  max-width: 1440px;
}

.company-info {
  font-size: 14px;
  color: #4a5068;
}

#tab-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  border-bottom: 1px solid #dde1eb;
  margin-bottom: 20px;
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: #ffffff;
  border: 1px solid #d0d5e2;
  border-radius: 6px;
  color: #8a92aa;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.tab:hover { background: #eef1f8; color: #3a4055; }
.tab.active { background: #eef1f8; color: #1c1e2a; border-color: #3b6ef0; }
.tab-close {
  font-size: 14px;
  line-height: 1;
  color: #c0c8da;
  transition: color 0.1s;
}
.tab:hover .tab-close, .tab.active .tab-close { color: #8a92aa; }
.tab-close:hover { color: #1c1e2a !important; }

.tab-pane { /* panes shown/hidden via the hidden attribute */ }

.company-info {
  margin-bottom: 20px;
}

.company-header {
  font-size: 14px;
  color: #4a5068;
  margin-bottom: 10px;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #d0d5e2;
  background: #ffffff;
  color: #3a4055;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.filter-pill:hover { border-color: #a0a8bc; color: #1c1e2a; }
.filter-pill.off {
  opacity: 0.35;
  color: #a0a8bc;
  border-color: #e8eaf2;
  text-decoration: line-through;
}
.fp-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.entry.dimmed > .entry-row {
  opacity: 0.15;
  pointer-events: none;
}
.company-header b { color: #0d0f1a; font-size: 16px; font-weight: 600; }
.company-header .meta { color: #8a92aa; }

/* ---- Timeline: an ordered list of evenly-spaced event rows along a
   single restrained spine, newest first. Real-world filing dates cluster
   unevenly, so position is by sequence (not by literal date distance) —
   that's what keeps every row legible and avoids overlap entirely. ---- */
.pane-layout {
  display: flex;
  align-items: flex-start;
  gap: 24px;
}

.timeline-wrapper {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 880px;
  padding: 4px 8px;
}

.timeline-inner {
  position: relative;
}

/* ---- Price chart panel: a sticky aside showing a simple line/area chart
   of closing prices, with a summary line that reflects whichever timeline
   entry the user is currently hovering (or the overall period by default). ---- */
.price-panel {
  flex: 1 1 360px;
  min-width: 280px;
  position: sticky;
  top: 20px;
  padding: 18px 22px;
  border: 1px solid #d0d5e2;
  border-radius: 10px;
  background: #ffffff;
}

.price-summary {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.price-ticker { font-weight: 700; font-size: 15px; color: #1c1e2a; }
.price-value { font-size: 20px; font-weight: 700; color: #1c1e2a; }
.price-change { font-size: 13px; font-weight: 600; }
.price-summary-date { font-size: 12px; color: #8a92aa; margin-left: auto; }

.price-chart {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}
.price-line { fill: none; stroke: #3b6ef0; stroke-width: 1.5; }
.price-area { fill: rgba(59, 110, 240, 0.08); stroke: none; }
.price-hover-wick { stroke-width: 1; }
.price-hover-body { stroke: none; }
.price-hover-wick[hidden],
.price-hover-body[hidden] { display: none; }

.price-ohlc {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 11px;
  color: #8a92aa;
}
.price-ohlc b { color: #4a5068; font-weight: 600; }
/* visibility (not display) keeps this row's height reserved at all times,
   so the chart above doesn't resize when hovering toggles it on/off. */
.price-ohlc-empty { visibility: hidden; }

.price-date-range {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 11px;
  color: #8a92aa;
}

.price-10q {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #e8eaf2;
}
.p10q-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}
.p10q-label {
  font-size: 13px;
  font-weight: 600;
  color: #1c1e2a;
}
.p10q-label::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  font-size: 10px;
  color: #8a92aa;
  transition: transform 0.15s;
}
.price-10q.expanded .p10q-label::before {
  transform: rotate(90deg);
}
.p10q-date {
  font-size: 11px;
  color: #8a92aa;
}
.p10q-extra {
  display: none;
  margin-top: 10px;
}
.price-10q.expanded .p10q-extra {
  display: block;
}

@media (max-width: 1000px) {
  .pane-layout {
    flex-direction: column;
  }
  .timeline-wrapper {
    max-width: none;
    width: 100%;
  }
  .price-panel {
    position: static;
    width: 100%;
    flex: 1 1 auto;
  }
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Sits inside the scrolling content (not the scroll container) so it scrolls
   in lockstep with the rows it connects — no scroll-position recalculation
   needed, just redraw when row layout changes (expand/collapse, resize). */
.link-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.link-path {
  fill: none;
  stroke: #c48000;
  stroke-width: 2;
  stroke-dasharray: 5 4;
  opacity: 0.85;
}
.link-endpoint {
  fill: #c48000;
  opacity: 0.9;
}

.related-link {
  cursor: pointer;
  color: #b07800;
}
.related-link:hover { text-decoration: underline; }
.related-link.muted {
  cursor: default;
  color: #a0a8bc;
}
.related-link.muted:hover { text-decoration: none; }
.related-link .link-icon { display: inline-block; transform: rotate(45deg); }
.related-link .related-hint {
  color: #8a92aa;
  font-size: 12px;
}

@keyframes link-pulse {
  0%, 100% { box-shadow: none; }
  35% { box-shadow: 0 0 0 3px rgba(196, 128, 0, 0.3); }
}
.entry.pulse .entry-card {
  animation: link-pulse 1.2s ease;
}

.entry {
  position: relative;
}

/* One continuous spine per row; consecutive rows' lines join into a
   single unbroken line, and it keeps running through an expanded
   row's detail panel rather than breaking around it. */
.entry::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 100px;
  width: 1px;
  background: #dde1eb;
}
.entry:first-child::before { top: 18px; }
.entry:last-child::before { bottom: calc(100% - 18px); }

.entry-row {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 14px;
}

.entry-date {
  flex: 0 0 78px;
  padding-top: 13px;
  text-align: right;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: #8a92aa;
}

.entry-spine {
  position: relative;
  z-index: 1;
  flex: 0 0 16px;
  display: flex;
  justify-content: center;
}

.marker {
  align-self: flex-start;
  margin-top: 12px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  box-shadow: 0 0 0 3px #f5f6fa;
  transition: transform 0.15s ease;
}

.entry:hover .marker,
.entry.expanded .marker {
  transform: scale(1.6);
}

.entry-card {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 3px 0;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.entry:hover .entry-card,
.entry.expanded .entry-card {
  background: #ffffff;
  border-color: #d8dce8;
}

/* ---- Expanding panel ---- */
.entry-details {
  display: grid;
  grid-template-rows: 0fr;
  margin-left: 122px;
  transition: grid-template-rows 0.2s ease;
}
.entry.expanded .entry-details {
  grid-template-rows: 1fr;
}

.entry-details-clip {
  overflow: hidden;
  min-height: 0;
}

.entry-details-inner {
  padding: 2px 14px 16px;
  font-size: 13px;
  line-height: 1.7;
  color: #4a5068;
}

.entry-details .field {
  display: inline-block;
  width: 136px;
  white-space: nowrap;
  color: #8a92aa;
}

.entry-details a { color: #3b6ef0; text-decoration: none; }
.entry-details a:hover { text-decoration: underline; }

.extra-title {
  margin-top: 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: #a0a8bc;
}

.extra-line { margin-top: 4px; }
.extra-line.muted, .extra-loading { color: #a0a8bc; font-style: italic; }

/* ---- Financial statement tabs (10-K / 10-Q detail panel) ---- */
.fin-stmts { margin-top: 12px; }

.fin-tabbar {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
}
.fin-tab {
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid #d0d5e2;
  background: #ffffff;
  color: #8a92aa;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.fin-tab:hover { color: #3a4055; border-color: #a0a8bc; }
.fin-tab.active { background: #eef1f8; color: #1c1e2a; border-color: #3b6ef0; }

.fin-pane { display: none; }
.fin-pane.active { display: block; }

.fin-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.fin-table {
  border-collapse: collapse;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  width: 100%;
}
.fin-table th {
  padding: 5px 14px 5px 0;
  text-align: right;
  font-size: 11px;
  font-weight: 600;
  color: #8a92aa;
  border-bottom: 1px solid #dde1eb;
  white-space: nowrap;
  min-width: 100px;
}
.fin-table th:first-child {
  text-align: left;
  width: 40%;
  min-width: 160px;
}
.fin-table td {
  padding: 3px 14px 3px 0;
  border-bottom: 1px solid #eaecf4;
  color: #3a4055;
  min-width: 100px;
}
.fin-label {
  color: #6a7290;
  text-align: left;
  width: 40%;
  min-width: 160px;
}
.fin-val { text-align: right; white-space: nowrap; }
.fin-table tr.fin-sub .fin-label {
  padding-left: 14px;
  color: #8a92aa;
  font-size: 11px;
}

.trades {
  margin-top: 6px;
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.trades th, .trades td {
  padding: 4px 14px 4px 0;
  text-align: left;
  border-bottom: 1px solid #dde1eb;
  color: #3a4055;
  white-space: nowrap;
}
.trades th {
  color: #8a92aa;
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.items {
  margin: 4px 0 0;
  padding-left: 18px;
  color: #3a4055;
}
.items li { margin-bottom: 2px; }
.items b { color: #1c1e2a; }

.excerpt {
  margin: 4px 0 0;
  color: #6a7290;
  white-space: pre-line;
}

.hld-table { margin-top: 8px; }
.hld-row {
  display: grid;
  grid-template-columns: 48px 1fr auto auto;
  align-items: baseline;
  gap: 0 12px;
  padding: 5px 0;
  border-top: 1px solid #dde1eb;
  font-size: 12px;
  line-height: 1.4;
}
.hld-ticker { font-weight: 700; color: #2e7fc4; font-size: 11px; }
.hld-name { color: #3a4055; }
.hld-shares { font-size: 11px; }
.hld-value { text-align: right; color: #1c1e2a; white-space: nowrap; }

.prs-facts { margin-top: 6px; }
.prs-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 3px 0;
  font-size: 13px;
  color: #3a4055;
}
.prs-row .field {
  flex: 0 0 160px;
  color: #8a92aa;
  font-size: 12px;
}
.prs-flag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: #eaecf4;
  color: #5a6278;
  margin-right: 4px;
}

.footnote-ref {
  border-bottom: 1px dotted #a0a8bc;
  cursor: help;
}

.footnotes {
  margin: 4px 0 0;
  padding-left: 18px;
  color: #6a7290;
  font-size: 12px;
  line-height: 1.6;
}
.footnotes li { margin-bottom: 6px; }
.footnotes b { color: #3a4055; font-weight: 600; }

.badge {
  flex: 0 0 auto;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
}

.entry-desc {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: #3a4055;
}

.person-card-trigger {
  border-bottom: 1px dotted #a0a8bc;
  cursor: pointer;
}
.person-card-trigger:hover { color: #1c1e2a; }

.person-card {
  position: fixed;
  z-index: 50;
  width: 240px;
  padding: 12px 14px;
  background: #ffffff;
  border: 1px solid #d0d5e2;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  font-size: 12px;
  line-height: 1.55;
  color: #3a4055;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.person-card.visible { opacity: 1; transform: translateY(0); }
.person-card .pc-name { font-size: 14px; font-weight: 700; color: #1c1e2a; }
.person-card .pc-role { margin-top: 2px; color: #6a7290; }
.person-card .pc-divider { height: 1px; margin: 9px 0; background: #dde1eb; }
.person-card .pc-line { margin-top: 3px; }

.news-sent-inline {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 600;
  opacity: 0.85;
  white-space: nowrap;
}

.news-meta {
  font-size: 12px;
  color: #8a92aa;
  margin-bottom: 6px;
}
.news-body {
  margin: 0 0 4px;
  color: #6a7290;
  font-size: 13px;
  line-height: 1.6;
}

.empty {
  padding: 20px 0;
  color: #8a92aa;
  font-size: 13px;
}
