:root {
  --bg: #0b0f17;
  --card: #121928;
  --card2: #0f1623;
  --text: #eef5ff;
  --muted: #93a4bb;
  --line: rgba(255,255,255,.08);
  --shadow: 0 18px 40px rgba(0,0,0,.35);
  --radius: 22px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(41, 121, 255, .18), transparent 28rem),
    radial-gradient(circle at top right, rgba(0, 230, 118, .08), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.page {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px;
}
.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 26px 0 16px;
}
.eyebrow {
  color: #7dd3fc;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .78rem;
  margin: 0 0 8px;
}
h1 {
  font-size: clamp(2rem, 8vw, 4.4rem);
  line-height: .9;
  margin: 0;
}
.sub {
  color: var(--muted);
  max-width: 680px;
  margin: 12px 0 0;
}
.status-pill {
  white-space: nowrap;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: .8rem;
  font-weight: 800;
  border: 1px solid var(--line);
}
.status-pill.ok { background: rgba(0, 200, 83, .13); color: #69f0ae; }
.status-pill.bad { background: rgba(255, 82, 82, .13); color: #ff8a80; }
.grid {
  display: grid;
  gap: 14px;
}
.top-grid {
  grid-template-columns: 1.2fr 1fr 1fr;
}
.card {
  background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.02)), var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin: 14px 0;
}
.card h2 {
  font-size: 1rem;
  margin: 0 0 14px;
  color: #d9e7ff;
}
.card-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
}
.card-top span, .muted, footer, small {
  color: var(--muted);
}
.price {
  font-size: clamp(2rem, 9vw, 4.2rem);
  font-weight: 900;
  letter-spacing: -0.06em;
  margin: 12px 0;
}
.decision, .trade-row, .event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.side, .tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: .76rem;
  font-weight: 800;
  text-transform: uppercase;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.05);
}
.side-long { background: rgba(0, 200, 83, .16); color: #69f0ae; }
.side-short { background: rgba(255, 82, 82, .16); color: #ff8a80; }
.side-none { background: rgba(255,255,255,.08); color: #cbd5e1; }
.metric { margin: 12px 0; }
.metric-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
  color: #dbeafe;
}
.metric-hint {
  color: var(--muted);
  font-size: .78rem;
  margin-top: 6px;
}
.bar-wrap {
  height: 12px;
  background: rgba(255,255,255,.08);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 999px;
  box-shadow: 0 0 22px currentColor;
}
.chips {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.chip {
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
}
.chip span {
  display: block;
  color: var(--muted);
  font-size: .78rem;
  margin-bottom: 6px;
}
.chip strong {
  font-size: 1.05rem;
}
.event-list, .article-list {
  display: grid;
  gap: 10px;
}
.event, .article {
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 13px;
}
.event h3 {
  font-size: 1rem;
  margin: 10px 0 7px;
  overflow-wrap: anywhere;
  word-break: normal;
}
.event-key {
  font-size: .75rem;
  margin: -2px 0 8px;
  overflow-wrap: anywhere;
}
.event p {
  margin: 0;
  color: #c3d2e8;
  overflow-wrap: anywhere;
}
.article strong, .article small, .reason-cell {
  overflow-wrap: anywhere;
}
.event-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.event-head strong {
  margin-left: auto;
  font-size: 1.05rem;
}
.event-meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: .78rem;
}
.article {
  display: block;
  color: var(--text);
  text-decoration: none;
}
.article strong {
  display: block;
  margin: 8px 0 4px;
}
.pos { color: #69f0ae; }
.neg { color: #ff8a80; }
.neu { color: #ffe082; }
.error {
  border-color: rgba(255, 82, 82, .35);
}
pre {
  white-space: pre-wrap;
  background: #020617;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  overflow: auto;
}
footer {
  text-align: center;
  padding: 26px 0 12px;
}
@media (max-width: 900px) {
  .top-grid { grid-template-columns: 1fr; }
  .chips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { flex-direction: column; }
}
@media (max-width: 520px) {
  .page { padding: 12px; }
  .card { padding: 14px; border-radius: 18px; }
  .chips { grid-template-columns: 1fr; }
  .price { font-size: 2.55rem; }
}

/* Trade history */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card2);
}
.trade-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}
.trade-table th,
.trade-table td {
  padding: 11px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: .88rem;
}
.trade-table th {
  color: var(--muted);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  background: rgba(255,255,255,.035);
}
.trade-table tr:last-child td {
  border-bottom: 0;
}
.reason-cell {
  color: var(--muted);
  min-width: 260px;
  max-width: 480px;
}
.action-open { background: rgba(0, 200, 83, .13); color: #69f0ae; }
.action-close { background: rgba(255, 193, 7, .13); color: #ffe082; }
.article small {
  display: block;
  line-height: 1.45;
  color: var(--muted);
}
@media (max-width: 720px) {
  .table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }
  .trade-table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0 10px;
  }
  .trade-table thead {
    display: none;
  }
  .trade-table,
  .trade-table tbody,
  .trade-table tr,
  .trade-table td {
    display: block;
    width: 100%;
  }
  .trade-table tr {
    background: var(--card2);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 8px 10px;
  }
  .trade-table td {
    border: 0;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 2px;
    font-size: .9rem;
  }
  .trade-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    flex: 0 0 92px;
  }
  .reason-cell {
    max-width: none;
    min-width: 0;
    display: block !important;
  }
  .reason-cell::before {
    display: block;
    margin-bottom: 5px;
  }
}

/* v5: clearer latest-news cards */
.article-list-detailed {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
}
.article-card {
  min-width: 0;
  overflow: hidden;
}
.article-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.article-title {
  display: block;
  color: var(--text);
  font-weight: 850;
  line-height: 1.25;
  text-decoration: none;
  margin: 8px 0 6px;
  overflow-wrap: anywhere;
  word-break: normal;
}
.article-title:hover { text-decoration: underline; }
.article-source {
  color: var(--muted);
  font-size: .86rem;
  margin-bottom: 10px;
  overflow-wrap: anywhere;
}
.article-times {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 8px;
}
.article-times div {
  background: rgba(255,255,255,.035);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  min-width: 0;
}
.article-times span {
  display: block;
  color: var(--muted);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 4px;
}
.article-times strong {
  display: block;
  font-size: .86rem;
  overflow-wrap: anywhere;
}
.status-processed { background: rgba(0, 200, 83, .13); color: #69f0ae; }
.status-new { background: rgba(255, 193, 7, .13); color: #ffe082; }
.status-error { background: rgba(255, 82, 82, .13); color: #ff8a80; }
@media (max-width: 520px) {
  .article-list-detailed { grid-template-columns: 1fr; }
  .article-times { grid-template-columns: 1fr; }
}
