:root {
  --navy: #0A2540;
  --green: #00A86B;
  --red: #D32F2F;
  --gray: #F5F7FA;
  --border: #E3E8EF;
  --text: #1A2533;
  --muted: #5B6B7B;
  --white: #ffffff;
  --shadow: 0 1px 3px rgba(10, 37, 64, 0.08), 0 4px 12px rgba(10, 37, 64, 0.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #FBFCFE;
  color: var(--text);
  line-height: 1.55;
}

/* Disclaimer bar */
.disclaimer-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #FFF8E1;
  border-bottom: 1px solid #F0D98C;
  color: #5C4A00;
  font-size: 12.5px;
  padding: 8px 18px;
  text-align: center;
}

/* Header */
.site-header {
  background: var(--navy);
  color: var(--white);
  padding: 20px 24px;
}
.brand { display: flex; align-items: center; gap: 14px; max-width: 1080px; margin: 0 auto; }
.logo {
  width: 48px; height: 48px; border-radius: 12px;
  background: rgba(255,255,255,0.1); display: grid; place-items: center; font-size: 24px;
}
.site-header h1 { font-size: 24px; letter-spacing: -0.3px; }
.tagline { color: #A9C0D6; font-size: 13.5px; }

/* Layout */
.container { max-width: 1080px; margin: 28px auto; padding: 0 20px; }

/* Search */
.search-card, .pipeline-card, .panel, .summary-card, .error-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 20px;
}
.search-card h2 { font-size: 19px; color: var(--navy); }
.hint { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.search-row { display: flex; gap: 10px; align-items: flex-start; }
.search-input-wrap { position: relative; flex: 1; }
#tickerInput {
  width: 100%; padding: 13px 16px; font-size: 15px;
  border: 1px solid var(--border); border-radius: 10px; outline: none;
  transition: border-color .15s;
}

/* Suggestions dropdown */
.suggestions {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 50;
  list-style: none; margin: 0; padding: 6px;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 8px 28px rgba(10,37,64,.14); max-height: 320px; overflow-y: auto;
}
.suggestion {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: 8px; cursor: pointer;
}
.suggestion:hover, .suggestion.active { background: var(--gray); }
.sugg-sym {
  font-weight: 700; color: var(--navy); font-size: 14px; min-width: 92px;
}
.sugg-name { flex: 1; font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sugg-tag {
  font-size: 11px; font-weight: 600; color: var(--muted);
  background: var(--gray); border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px;
}
.suggestion.active .sugg-tag { background: #fff; }
.sugg-empty { padding: 12px; font-size: 13px; color: var(--muted); text-align: center; }
#tickerInput:focus { border-color: var(--navy); }
#analyzeBtn {
  background: var(--navy); color: #fff; border: none; border-radius: 10px;
  padding: 0 26px; font-size: 15px; font-weight: 600; cursor: pointer; transition: background .15s;
}
#analyzeBtn:hover { background: #0d3157; }
#analyzeBtn:disabled { opacity: .55; cursor: not-allowed; }
.examples { margin-top: 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.examples span { color: var(--muted); font-size: 13px; }
.chip {
  background: var(--gray); border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 14px; font-size: 13px; cursor: pointer; color: var(--navy); font-weight: 600;
}
.chip:hover { background: #e9eef5; }

/* Pipeline */
.pipeline-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; gap: 12px; }
.pipeline-card h3 { font-size: 17px; color: var(--navy); display: flex; align-items: center; gap: 8px; }
.pipeline-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.live-dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--red); display: inline-block;
  box-shadow: 0 0 0 0 rgba(211,47,47,.6); animation: blink 1.2s infinite;
}
.live-text { font-size: 11px; font-weight: 800; color: var(--red); letter-spacing: 1px; }
@keyframes blink {
  0% { box-shadow: 0 0 0 0 rgba(211,47,47,.5); }
  70% { box-shadow: 0 0 0 8px rgba(211,47,47,0); }
  100% { box-shadow: 0 0 0 0 rgba(211,47,47,0); }
}
.total-clock { text-align: right; background: var(--gray); border-radius: 10px; padding: 8px 14px; }
.clock-label { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.clock-val { font-size: 20px; font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; }

/* Agent relay — vertical timeline */
.agent-flow { display: flex; flex-direction: column; }
.agent-node { display: flex; gap: 16px; }

/* Left rail: dot + connecting line */
.node-rail { display: flex; flex-direction: column; align-items: center; width: 46px; flex-shrink: 0; }
.node-dot {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  font-size: 20px; background: var(--gray); border: 2px solid var(--border);
  color: var(--muted); position: relative; transition: all .35s ease; z-index: 1;
}
.rail-line { flex: 1; width: 3px; background: var(--border); position: relative; min-height: 30px; overflow: hidden; }
.rail-fill { position: absolute; inset: 0; height: 0; background: var(--green); transition: height .5s ease; }
.rail-pulse {
  position: absolute; left: 50%; top: -10px; transform: translateX(-50%);
  width: 11px; height: 11px; border-radius: 50%; background: var(--green); opacity: 0;
  box-shadow: 0 0 10px rgba(0,168,107,.8);
}
.agent-node:last-child .rail-line { display: none; }

/* Body */
.node-body {
  flex: 1; padding-bottom: 22px; opacity: .55; transition: opacity .35s;
}
.node-head { display: flex; align-items: center; gap: 10px; }
.node-name { font-weight: 700; font-size: 15px; color: var(--navy); }
.node-status {
  font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px;
  background: var(--gray); color: var(--muted); text-transform: uppercase; letter-spacing: .4px;
}
.node-timer {
  margin-left: auto; font-size: 13px; font-weight: 700; color: var(--muted);
  font-variant-numeric: tabular-nums; min-width: 52px; text-align: right;
}
.node-role { font-size: 13px; color: var(--muted); margin-top: 3px; }
.node-output {
  margin-top: 8px; display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; color: var(--navy);
  background: #E2F5EC; border: 1px solid #BfeAd3; border-radius: 8px;
  padding: 5px 11px; opacity: 0; transform: translateY(4px) scale(.96);
  transition: opacity .3s, transform .3s;
}
.node-output.show { opacity: 1; transform: translateY(0) scale(1); }
.node-output .arrow { color: var(--green); }

/* Active state */
.agent-node.active .node-body { opacity: 1; }
.agent-node.active .node-dot {
  background: var(--navy); color: #fff; border-color: var(--navy);
  box-shadow: 0 0 0 0 rgba(10,37,64,.5); animation: ring 1.3s infinite;
}
@keyframes ring {
  0% { box-shadow: 0 0 0 0 rgba(10,37,64,.45); }
  70% { box-shadow: 0 0 0 12px rgba(10,37,64,0); }
  100% { box-shadow: 0 0 0 0 rgba(10,37,64,0); }
}
.agent-node.active .node-dot .node-icon { animation: pulse 1s infinite; }
.agent-node.active .node-status { background: #EAF2FB; color: var(--navy); }
.agent-node.active .node-timer { color: var(--navy); }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(.78); } }

/* Done state */
.agent-node.done .node-body { opacity: 1; }
.agent-node.done .node-dot { background: var(--green); color: #fff; border-color: var(--green); }
.agent-node.done .node-status { background: #E2F5EC; color: var(--green); }
.agent-node.done .node-timer { color: var(--green); }
.agent-node.done .rail-fill { height: 100%; }
.rail-pulse.flow { animation: drop 0.7s ease-in forwards; }
@keyframes drop {
  0% { top: -10px; opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* Terminal-style log */
.agent-log {
  margin-top: 16px; background: #0A1A2F; border-radius: 10px; padding: 14px 16px;
  font-family: "SF Mono", "Cascadia Code", Consolas, monospace; font-size: 12.5px;
  color: #9FE3C4; max-height: 190px; overflow-y: auto; line-height: 1.7;
}
.agent-log:empty { display: none; }
.log-line { white-space: pre-wrap; animation: fadein .25s ease; }
.log-line .t { color: #5B7A99; }
.log-line .ok { color: #00D08A; }
.log-line .run { color: #6FB7FF; }
.log-line .pkt { color: #FFD37A; }
.log-line .err { color: #FF8A80; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* Error */
.error-card { border-color: #F3C2C2; background: #FDECEC; color: #8A1F1F; }

/* Summary */
.summary-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.summary-card h2 { font-size: 22px; color: var(--navy); }
.ticker-line { font-size: 15px; margin-top: 4px; }
.ticker-line #rPrice { font-weight: 700; }
.range { color: var(--muted); font-size: 13px; margin-top: 2px; }
.change.up { color: var(--green); font-weight: 600; }
.change.down { color: var(--red); font-weight: 600; }
.rec-badge {
  font-size: 22px; font-weight: 800; letter-spacing: .5px;
  padding: 12px 24px; border-radius: 12px; color: #fff; min-width: 110px; text-align: center;
}
.rec-badge.buy { background: var(--green); }
.rec-badge.sell { background: var(--red); }
.rec-badge.hold { background: #E8A317; }

.summary-actions { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.download-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: #fff; color: var(--navy); border: 1.5px solid var(--navy);
  border-radius: 10px; padding: 9px 16px; font-size: 13.5px; font-weight: 700;
  cursor: pointer; transition: background .15s, color .15s, transform .1s; white-space: nowrap;
}
.download-btn:hover { background: var(--navy); color: #fff; }
.download-btn:active { transform: scale(.97); }
.download-btn:disabled { opacity: .6; cursor: progress; }
.download-btn .dl-icon { font-size: 15px; }

.levels {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 20px;
}
.level-box {
  background: var(--gray); border-radius: 10px; padding: 14px; display: flex;
  flex-direction: column; gap: 4px; border-left: 4px solid var(--navy);
}
.level-box .lbl { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.level-box .val { font-size: 19px; font-weight: 700; color: var(--navy); }
.level-box.buy { border-left-color: var(--green); }
.level-box.target { border-left-color: var(--navy); }
.level-box.stop { border-left-color: var(--red); }
.level-box.score { border-left-color: #E8A317; }
.llm-note { font-size: 12px; color: var(--muted); margin-top: 12px; font-style: italic; }

/* Panels */
.panel h3 { font-size: 16px; color: var(--navy); margin-bottom: 10px; }
.explanation { font-size: 14.5px; color: var(--text); white-space: pre-wrap; }
.collapsible summary {
  font-size: 16px; font-weight: 700; color: var(--navy); cursor: pointer;
  list-style: none; display: flex; align-items: center; gap: 10px;
}
.collapsible summary::-webkit-details-marker { display: none; }
.collapsible summary::before { content: "▸"; transition: transform .15s; color: var(--muted); }
.collapsible[open] summary::before { transform: rotate(90deg); }
.panel-body { margin-top: 16px; }
.pill {
  font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
  background: var(--gray); color: var(--muted);
}

/* Technical table */
.ind-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ind-table th, .ind-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.ind-table th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.ind-table td:nth-child(4) { color: var(--muted); }
.sig { font-weight: 700; padding: 2px 10px; border-radius: 999px; font-size: 12px; }
.sig.bullish { background: #E2F5EC; color: var(--green); }
.sig.bearish { background: #FBE5E5; color: var(--red); }
.sig.neutral { background: var(--gray); color: var(--muted); }

/* Sentiment */
.sent-summary { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.sent-stat { background: var(--gray); padding: 10px 16px; border-radius: 10px; }
.sent-stat b { display: block; font-size: 18px; color: var(--navy); }
.sent-stat span { font-size: 12px; color: var(--muted); }
.headline-row {
  display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); align-items: flex-start;
}
.headline-row:last-child { border-bottom: none; }
.score-tag {
  font-weight: 700; font-size: 13px; padding: 4px 10px; border-radius: 8px; min-width: 56px; text-align: center;
}
.score-tag.positive { background: #E2F5EC; color: var(--green); }
.score-tag.negative { background: #FBE5E5; color: var(--red); }
.score-tag.neutral { background: var(--gray); color: var(--muted); }
.headline-row .h-title { font-weight: 600; font-size: 14px; }
.headline-row .h-reason { font-size: 13px; color: var(--muted); }

/* News */
.news-card { padding: 14px 0; border-bottom: 1px solid var(--border); }
.news-card:last-child { border-bottom: none; }
.news-card a { color: var(--navy); font-weight: 600; text-decoration: none; font-size: 14.5px; }
.news-card a:hover { text-decoration: underline; }
.news-meta { font-size: 12px; color: var(--muted); margin: 4px 0; }
.news-snippet { font-size: 13px; color: var(--text); }

/* Footer */
.site-footer { background: var(--navy); color: #A9C0D6; padding: 24px; text-align: center; margin-top: 40px; }
.footer-disclaimer { color: #FFD9A0; font-size: 12.5px; max-width: 800px; margin: 0 auto 10px; }
.site-footer p { font-size: 12.5px; }

.hidden { display: none !important; }

@media (max-width: 700px) {
  .levels { grid-template-columns: repeat(2, 1fr); }
  .summary-head { flex-direction: column; }
  .search-row { flex-direction: column; }
}
