:root {
  --bg: #0a0d13;
  --panel: #111620;
  --panel-2: #161c28;
  --line: #1f2735;
  --text: #e7eaf0;
  --muted: #8790a3;
  --faint: #5a6377;
  --high: #ff4d5e;
  --high-bg: rgba(255, 77, 94, 0.12);
  --med: #ffb020;
  --med-bg: rgba(255, 176, 32, 0.12);
  --low: #6f7a90;
  --live: #2bd576;
  --accent: #5b8cff;
  --radius: 10px;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 Inter, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }

/* header */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 20px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10; background: rgba(10, 13, 19, 0.92); backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand h1 { font-size: 18px; margin: 0; letter-spacing: -0.01em; white-space: nowrap; }
.radar {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--live); position: relative; flex: none;
}
.radar::after {
  content: ""; position: absolute; inset: -2px; border-radius: 50%;
  background: conic-gradient(rgba(43, 213, 118, 0.55), transparent 30%);
  animation: sweep 3s linear infinite;
}
@keyframes sweep { to { transform: rotate(360deg); } }
.status { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 0 rgba(43, 213, 118, 0.6); animation: pulse 2s infinite; }
.status.stale .dot { background: var(--med); animation: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(43, 213, 118, 0); } 100% { box-shadow: 0 0 0 0 rgba(43, 213, 118, 0); } }
.top-actions { display: flex; gap: 8px; flex: none; }
.btn {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; font-size: 13px;
}
.btn:hover { border-color: var(--faint); }
.btn.on { border-color: var(--live); color: var(--live); }
.btn.ghost { background: transparent; }

.ticker { border-bottom: 1px solid var(--line); min-height: 46px; }

/* layout */
.layout {
  display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 20px;
  max-width: 1280px; margin: 0 auto; padding: 20px;
}
.side { display: flex; flex-direction: column; gap: 20px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 6px; }
.hint { font-size: 12px; color: var(--faint); margin: 0 0 12px; }

/* calendar */
.cal, .top-list, .news { list-style: none; margin: 0; padding: 0; }
.cal li { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); align-items: center; }
.cal li:first-child { border-top: 0; }
.cal .cur { font: 600 11px var(--mono); color: var(--muted); text-align: center; border: 1px solid var(--line); border-radius: 6px; padding: 3px 0; }
.cal .high .cur { color: var(--high); border-color: rgba(255, 77, 94, 0.4); }
.cal .ev-title { font-size: 14px; font-weight: 500; }
.cal .ev-meta { font-size: 12px; color: var(--muted); font-family: var(--mono); }
.cal .when { font: 600 12px var(--mono); text-align: right; white-space: nowrap; }
.cal .soon .when { color: var(--high); }
.cal .past { opacity: 0.45; }
.cal .day { grid-template-columns: 1fr; padding: 12px 0 2px; border-top: 0; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); }

/* top stories */
.top-list li { padding: 9px 0; border-top: 1px solid var(--line); }
.top-list li:first-child { border-top: 0; }
.top-list a { font-size: 14px; font-weight: 500; display: block; }
.top-list a:hover { color: var(--accent); }
.top-list .meta { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.seg button { background: none; border: 0; border-radius: 6px; padding: 6px 12px; font-size: 13px; color: var(--muted); }
.seg button.on { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
#f-search {
  flex: 1 1 180px; min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 12px; color: var(--text); font: inherit; font-size: 14px;
}
#f-search:focus { outline: none; border-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip { background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; font-size: 12px; color: var(--muted); }
.chip.on { border-color: var(--accent); color: var(--text); background: rgba(91, 140, 255, 0.12); }

.new-banner {
  background: var(--high-bg); border: 1px solid rgba(255, 77, 94, 0.35); color: var(--text);
  border-radius: 8px; padding: 9px 12px; font-size: 13px; margin-bottom: 12px; cursor: pointer;
}

/* news */
.news li {
  display: grid; grid-template-columns: 4px 1fr; gap: 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px 14px 0; margin-bottom: 8px; overflow: hidden;
}
.news li::before { content: ""; border-radius: 0 3px 3px 0; background: var(--low); opacity: 0.5; }
.news li.high::before { background: var(--high); opacity: 1; }
.news li.medium::before { background: var(--med); opacity: 1; }
.news li.fresh { border-color: rgba(255, 77, 94, 0.45); }
.news .row1 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.badge { font: 600 10.5px var(--mono); letter-spacing: 0.04em; text-transform: uppercase; padding: 2px 7px; border-radius: 5px; }
.badge.high { color: var(--high); background: var(--high-bg); }
.badge.medium { color: var(--med); background: var(--med-bg); }
.badge.low { color: var(--low); background: rgba(111, 122, 144, 0.12); }
.badge.new { color: #0a0d13; background: var(--live); }
.news .time { font-family: var(--mono); }
.news .multi { color: var(--live); }
.news h3 { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.35; }
.news h3 a:hover { color: var(--accent); }
.news .sum { margin: 6px 0 0; color: var(--muted); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.outlook { margin-top: 10px; padding: 9px 11px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.ol-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ol-label { color: var(--muted); margin-right: 2px; }
.dir { font: 600 12px var(--mono); padding: 2px 7px; border-radius: 5px; white-space: nowrap; }
.dir.up { color: var(--live); background: rgba(43, 213, 118, 0.12); }
.dir.down { color: var(--high); background: var(--high-bg); }
.top-list .dir { font-size: 10.5px; padding: 1px 5px; }
.ai-tag { font: 600 10.5px var(--mono); color: #c9b6ff; background: rgba(150, 110, 255, 0.16); border-radius: 5px; padding: 2px 6px; cursor: help; }
.ol-meta { color: var(--faint); font-size: 12px; margin-left: 4px; }
.ol-why { color: var(--muted); margin-top: 6px; line-height: 1.4; }
.ol-why b { color: var(--text); font-weight: 600; }
.ol-row + .ol-moved, .ol-why + .ol-moved { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.ol-moved { color: var(--muted); }
.ol-moved b { color: var(--med); font-weight: 600; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.tag { font: 600 11px var(--mono); padding: 2px 6px; border-radius: 4px; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.tag.cat { font-family: inherit; font-weight: 500; color: var(--muted); }
.also { font-size: 12px; color: var(--faint); margin-top: 6px; }
.also a { color: var(--muted); text-decoration: underline; text-decoration-color: var(--line); }
.also a:hover { color: var(--text); }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }

.foot { max-width: 1280px; margin: 0 auto; padding: 10px 20px 40px; font-size: 12px; color: var(--muted); }
.foot .muted { color: var(--faint); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 16px; gap: 16px; }
  .side { display: contents; }
  .p-cal { order: 0; }
  .feed { order: 1; }
  .p-top { order: 2; }
  .top { padding: 12px 16px; }
  .brand h1 { font-size: 16px; }
  .status #status-text { display: none; }
  .foot { padding: 10px 16px 32px; }
}
@media (max-width: 480px) {
  .seg button { padding: 6px 9px; }
  .news h3 { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  .radar::after, .dot { animation: none; }
}

/* Match the widget iframe's own color-scheme, otherwise Chrome paints it an opaque white backdrop */
.tradingview-widget-container, .tradingview-widget-container iframe { color-scheme: light; }
