:root {
  --bg: #0b1020;
  --text: #f5f7fb;
  --muted: #aab3c5;
  --line: rgba(255,255,255,.12);
  --buy: #20c997;
  --sell: #ff6b6b;
  --hold: #f4c430;
  --button: #4f7cff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(circle at top, #18213d 0%, var(--bg) 42%, #060913 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.app-shell {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 18px;
  padding-bottom: calc(18px + env(safe-area-inset-bottom));
}

.hero-card,
.card {
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.03));
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 18px 55px rgba(0,0,0,.28);
  backdrop-filter: blur(10px);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: linear-gradient(135deg, #4f7cff, #20c997);
}

h1, h2, p { margin: 0; }

h1 { font-size: 1.7rem; letter-spacing: -.04em; }
h2 { font-size: 1.25rem; }

.brand-row p, footer p, .disclaimer, .summary, label, .section-title p {
  color: var(--muted);
}

.risk-banner {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid rgba(244,196,48,.35);
  background: rgba(244,196,48,.11);
  color: #ffe58a;
  border-radius: 16px;
  font-size: .93rem;
}

label {
  display: block;
  margin-bottom: 8px;
  font-size: .92rem;
}

select,
input {
  width: 100%;
  color: var(--text);
  background: rgba(255,255,255,.08);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 14px;
  font-size: 1rem;
  outline: none;
}

option {
  color: #111827;
}

button {
  border: 0;
  border-radius: 15px;
  padding: 12px 14px;
  color: white;
  background: var(--button);
  font-weight: 700;
  cursor: pointer;
}

button.secondary {
  background: rgba(255,255,255,.1);
  border: 1px solid var(--line);
}

button.danger {
  background: rgba(255,107,107,.2);
  border: 1px solid rgba(255,107,107,.35);
}

button:disabled {
  opacity: .65;
  cursor: not-allowed;
}

.button-grid,
.trade-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.trade-row {
  grid-template-columns: .7fr 1fr 1fr;
}

.result-header,
.list-item,
.section-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.section-title {
  align-items: flex-start;
  margin-bottom: 14px;
}

.eyebrow {
  color: var(--muted);
  text-transform: uppercase;
  font-size: .72rem;
  letter-spacing: .12em;
  margin-bottom: 4px;
}

.signal-badge {
  border-radius: 999px;
  padding: 10px 13px;
  font-weight: 900;
  letter-spacing: .04em;
}

.signal-badge.buy { background: rgba(32,201,151,.16); color: var(--buy); border: 1px solid rgba(32,201,151,.36); }
.signal-badge.sell { background: rgba(255,107,107,.16); color: var(--sell); border: 1px solid rgba(255,107,107,.36); }
.signal-badge.hold { background: rgba(244,196,48,.16); color: var(--hold); border: 1px solid rgba(244,196,48,.36); }

.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.metric,
.list-item,
.portfolio-summary {
  background: rgba(255,255,255,.06);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}

.metric span,
.small {
  color: var(--muted);
  display: block;
  font-size: .82rem;
}

.metric strong { font-size: 1.2rem; }

.confidence-track {
  margin-top: 16px;
  height: 12px;
  background: rgba(255,255,255,.08);
  border-radius: 999px;
  overflow: hidden;
}

.confidence-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #f4c430, #20c997);
  transition: width .25s ease;
}

.summary, .disclaimer {
  margin-top: 14px;
  line-height: 1.45;
}

.disclaimer { font-size: .82rem; }

.histogram {
  display: grid;
  gap: 9px;
}

.hist-row {
  display: grid;
  grid-template-columns: 110px 1fr 38px;
  gap: 8px;
  align-items: center;
}

.hist-label {
  color: var(--muted);
  font-size: .76rem;
}

.hist-track {
  height: 18px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  overflow: hidden;
}

.hist-bar {
  height: 100%;
  background: linear-gradient(90deg, #4f7cff, #20c997);
  border-radius: 999px;
}

.hist-count {
  color: var(--muted);
  font-size: .82rem;
  text-align: right;
}

.list {
  display: grid;
  gap: 10px;
}

.list-item strong {
  display: block;
}

.portfolio-summary {
  margin: 12px 0;
  color: var(--text);
}

.error-card {
  border-color: rgba(255,107,107,.35);
  color: #ffd1d1;
  background: rgba(255,107,107,.10);
}

.hidden { display: none; }

footer {
  padding: 8px 4px 0;
  font-size: .82rem;
  text-align: center;
}

@media (max-width: 520px) {
  .button-grid,
  .trade-row,
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  button { width: 100%; }

  .hist-row {
    grid-template-columns: 92px 1fr 30px;
  }
}


.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  margin-top: 12px;
}

.checkbox-row input {
  width: auto;
}

.news-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.news-tab {
  background: rgba(255,255,255,.08);
  border: 1px solid var(--line);
  padding: 10px 8px;
  font-size: .85rem;
}

.news-tab.active {
  background: var(--button);
}

.news-list {
  display: grid;
  gap: 12px;
}

.news-card {
  background: rgba(255,255,255,.06);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}

.news-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.news-meta {
  color: var(--muted);
  font-size: .8rem;
  margin-bottom: 8px;
}

.news-summary {
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: 10px;
}

.news-card a {
  color: #9db8ff;
  text-decoration: none;
  font-weight: 700;
}

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