:root {
  --bg: #070b12;
  --panel: #0e1522;
  --panel2: #121b2c;
  --line: #1e2a3f;
  --text: #e8eef9;
  --muted: #8b9bb8;
  --neon: #3dffb5;
  --neon2: #5b8cff;
  --sell: #ff5c7a;
  --buy: #3dffb5;
  --hold: #8b9bb8;
  --unload: #ffb020;
  --accum: #5b8cff;
  --radius: 16px;
  --shadow: 0 20px 60px rgba(0,0,0,.45);
  --pad: clamp(0.75rem, 2.5vw, 1.5rem);
  font-family: "Segoe UI", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--text);
  background: radial-gradient(1200px 600px at 10% -10%, #13203a 0%, transparent 55%),
              radial-gradient(900px 500px at 100% 0%, #0c2a22 0%, transparent 50%),
              var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100vw;
}
img, svg, video { max-width: 100%; height: auto; }
.bg-grid {
  position: fixed; inset: 0; pointer-events: none; opacity: .22;
  background-image:
    linear-gradient(rgba(91,140,255,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(91,140,255,.08) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 20%, #000 20%, transparent 75%);
}
.top {
  position: relative;
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 0.85rem; padding: var(--pad) var(--pad) 0.35rem; flex-wrap: wrap;
}
.brand { display: flex; gap: 0.85rem; align-items: center; min-width: 0; flex: 1 1 220px; }
.brand > div:last-child { min-width: 0; }
.logo {
  flex: 0 0 auto;
  width: 48px; height: 48px; border-radius: 14px;
  display: grid; place-items: center; font-weight: 800; letter-spacing: .04em;
  background: linear-gradient(135deg, var(--neon), var(--neon2));
  color: #041018; box-shadow: 0 0 30px rgba(61,255,181,.35);
}
h1 {
  margin: 0; font-size: clamp(1.05rem, 3.6vw, 1.35rem); font-weight: 750;
  line-height: 1.25; word-wrap: break-word;
}
h1 span { color: var(--neon); font-weight: 600; }
.sub {
  margin: .25rem 0 0; color: var(--muted);
  font-size: clamp(0.78rem, 2.4vw, 0.9rem); line-height: 1.35;
}
.status-pill {
  display: flex; align-items: center; gap: .55rem;
  padding: .55rem .85rem; border-radius: 999px;
  background: rgba(61,255,181,.08); border: 1px solid rgba(61,255,181,.35);
  font-size: clamp(0.75rem, 2.2vw, 0.85rem);
  max-width: 100%;
  flex: 0 1 auto;
}
.status-pill #statusText { overflow-wrap: anywhere; }
.dot {
  flex: 0 0 auto;
  width: 8px; height: 8px; border-radius: 50%; background: var(--neon);
  box-shadow: 0 0 12px var(--neon); animation: pulse 1.6s infinite;
}
@keyframes pulse { 50% { opacity: .45; transform: scale(.85); } }

.kpis {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  padding: 0.85rem var(--pad);
}
.kpi {
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.9rem 1rem; box-shadow: var(--shadow);
  min-width: 0;
}
.kpi .label { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.kpi .val {
  font-size: clamp(1.1rem, 3.5vw, 1.45rem); font-weight: 750; margin-top: .25rem;
  overflow-wrap: anywhere;
}
.kpi .val.pos { color: var(--neon); }
.kpi .val.neg { color: var(--sell); }

.grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  padding: 0 var(--pad) 1.5rem;
}
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }

.panel {
  background: rgba(14,21,34,.92);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.9rem; box-shadow: var(--shadow); backdrop-filter: blur(8px);
  min-width: 0;
}
.panel-h {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: .75rem; margin-bottom: .75rem; flex-wrap: wrap;
}
.panel-h h2 { margin: 0; font-size: 1rem; }
.muted { color: var(--muted); font-size: .82rem; }
.btn {
  border: 0; cursor: pointer; border-radius: 10px;
  padding: .55rem .9rem; min-height: 42px;
  background: linear-gradient(135deg, var(--neon2), #7a5cff); color: white; font-weight: 650;
  touch-action: manipulation;
}
.btn:active { transform: translateY(1px); }

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-height: min(420px, 60vh);
  border-radius: 10px;
}
table { width: 100%; border-collapse: collapse; font-size: .86rem; min-width: 640px; }
th, td { padding: .55rem .45rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th {
  color: var(--muted); font-weight: 600; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .06em;
  position: sticky; top: 0; background: #0e1522; z-index: 1;
}
.badge {
  display: inline-block; padding: .2rem .45rem; border-radius: 7px;
  font-size: .72rem; font-weight: 800; letter-spacing: .04em;
}
.badge.BUY, .badge.ACCUMULATE { background: rgba(61,255,181,.15); color: var(--buy); }
.badge.SELL { background: rgba(255,92,122,.15); color: var(--sell); }
.badge.UNLOAD_FAST { background: rgba(255,176,32,.18); color: var(--unload); }
.badge.HOLD { background: rgba(139,155,184,.12); color: var(--hold); }

/* Mobile card lists (signals / tape) */
.mobile-list { display: none; flex-direction: column; gap: .65rem; }
.mobile-item {
  border: 1px solid var(--line); border-radius: 12px; padding: .75rem .8rem;
  background: linear-gradient(160deg, #121b2c, #0c1320);
}
.mobile-item .mi-top {
  display: flex; justify-content: space-between; gap: .5rem; align-items: flex-start;
  margin-bottom: .35rem;
}
.mobile-item h3 { margin: 0; font-size: .92rem; line-height: 1.3; }
.mobile-item .mi-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: .35rem .75rem;
  font-size: .8rem; margin: .45rem 0;
}
.mobile-item .mi-grid span { color: var(--muted); }
.mobile-item .mi-why { font-size: .8rem; color: #b7c6e0; line-height: 1.35; margin-top: .35rem; }

.feed { list-style: none; margin: 0; padding: 0; max-height: min(420px, 50vh); overflow: auto; }
.feed li {
  padding: .65rem .2rem; border-bottom: 1px solid var(--line);
  font-size: .84rem; color: #c9d4ea; overflow-wrap: anywhere;
}
.feed time { display: block; color: var(--muted); font-size: .72rem; margin-bottom: .2rem; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: .75rem;
}
.card {
  border: 1px solid var(--line); border-radius: 14px; padding: .85rem;
  background: linear-gradient(160deg, #121b2c, #0c1320);
  min-width: 0;
}
.card h3 { margin: 0 0 .35rem; font-size: .95rem; overflow-wrap: anywhere; }
.card .meta { color: var(--muted); font-size: .78rem; margin-bottom: .5rem; overflow-wrap: anywhere; }
.card .row { display: flex; justify-content: space-between; gap: .5rem; font-size: .84rem; margin: .2rem 0; }
.card .tip { margin-top: .55rem; font-size: .8rem; color: #b7c6e0; line-height: 1.35; overflow-wrap: anywhere; }

.tabs { display: flex; gap: .4rem; margin-bottom: .75rem; flex-wrap: wrap; }
.tab {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  border-radius: 999px; padding: .45rem .75rem; min-height: 40px;
  cursor: pointer; font-size: .8rem; touch-action: manipulation;
}
.tab.on { color: var(--text); border-color: var(--neon2); background: rgba(91,140,255,.12); }
.pack .verdict {
  padding: .75rem; border-radius: 12px; margin-bottom: .75rem;
  background: rgba(91,140,255,.1); border: 1px solid rgba(91,140,255,.25);
  overflow-wrap: anywhere;
}
.pack ul { margin: .4rem 0 0; padding-left: 1.1rem; color: #c5d0e6; font-size: .84rem; }
.pack li { margin: .35rem 0; overflow-wrap: anywhere; }
.foot {
  position: relative; padding: 0 var(--pad) 2rem;
  color: var(--muted); font-size: .78rem; line-height: 1.45;
}
.foot strong { color: var(--text); }

/* ===== Responsive breakpoints ===== */
@media (max-width: 1100px) {
  .grid { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: auto; }
}
@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .top { flex-direction: column; align-items: stretch; }
  .status-pill { align-self: stretch; justify-content: flex-start; }
  .logo { width: 44px; height: 44px; font-size: .9rem; }
  /* Prefer cards over wide tables on phones */
  .desktop-only { display: none !important; }
  .mobile-list { display: flex; }
  .table-wrap { max-height: none; }
  .feed { max-height: 280px; }
  .panel { padding: 0.85rem; }
}
@media (max-width: 420px) {
  .kpis { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  .mobile-item .mi-grid { grid-template-columns: 1fr; }
}
@media (min-width: 721px) {
  .mobile-list { display: none !important; }
}
