/* BOSSEO Stocks AI - dark trading-desk theme.
   Self-contained: no webfonts or CDN assets, so the page renders even when the
   origin is the only thing reachable. */

:root {
  --navy-900: #070b16;
  --navy-800: #0c1224;
  --navy-700: #121a31;
  --navy-600: #1a2340;
  --navy-500: #24304f;
  --line: rgba(148, 170, 214, 0.16);
  --text: #e8edf8;
  --text-dim: #93a2c2;
  --text-faint: #64748f;
  --accent: #4f8cff;
  --accent-soft: rgba(79, 140, 255, 0.16);
  --up: #2fbf71;
  --down: #f4556b;
  --warn: #f0b429;
  --radius: 14px;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.42);
  --font: "Segoe UI", -apple-system, BlinkMacSystemFont, "Inter", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

/* The UA stylesheet hides [hidden] with display:none, but any rule of ours that
   sets `display` outranks it and the element stays visible. `.busy` is display:
   grid, so without this the loading overlay never dismissed and, being full
   screen, it also swallowed every chart hover. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(1100px 620px at 78% -12%, rgba(79, 140, 255, 0.14), transparent 62%),
    radial-gradient(900px 560px at 4% 108%, rgba(47, 191, 113, 0.09), transparent 60%),
    var(--navy-900);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

.shell { display: flex; min-height: 100vh; }

/* ---------- sidebar ---------- */
.sidebar {
  width: 252px;
  flex: 0 0 252px;
  background: linear-gradient(180deg, var(--navy-800), var(--navy-900));
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: 0;
  height: 100vh;
}

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

.brand-mark {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-weight: 700; font-size: 20px;
  color: #fff;
  background: linear-gradient(140deg, var(--accent), #7a4fff);
  box-shadow: 0 8px 22px rgba(79, 140, 255, 0.4);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 16px; letter-spacing: 0.2px; }
.brand-text span { font-size: 11px; color: var(--text-faint); }

.nav { display: flex; flex-direction: column; gap: 4px; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border: none; border-radius: 10px;
  background: transparent;
  color: var(--text-dim);
  font: inherit; font-size: 14px;
  text-align: left; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--navy-700); color: var(--text); }
.nav-item.is-active { background: var(--accent-soft); color: #fff; }

.nav-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; opacity: 0.55;
}
.nav-item.is-active .nav-dot { opacity: 1; box-shadow: 0 0 10px var(--accent); }

.sidebar-foot { margin-top: auto; font-size: 12px; }
.status-line { display: flex; align-items: center; gap: 8px; color: var(--text-dim); }

.dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.dot-idle { background: var(--text-faint); }
.dot-ok { background: var(--up); box-shadow: 0 0 9px var(--up); }
.dot-warn { background: var(--warn); box-shadow: 0 0 9px var(--warn); }
.dot-bad { background: var(--down); box-shadow: 0 0 9px var(--down); }

/* ---------- layout ---------- */
.content { flex: 1; padding: 26px 30px 60px; max-width: 1440px; min-width: 0; }
.view { display: none; }
.view.is-active { display: block; animation: fade 0.22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.page-head { margin-bottom: 18px; }
.page-head h1 { margin: 0 0 4px; font-size: 25px; font-weight: 650; letter-spacing: -0.2px; }
.page-head p { margin: 0; max-width: 78ch; font-size: 13.5px; line-height: 1.55; }

.muted { color: var(--text-dim); }
.small { font-size: 12px; }
.right { text-align: right; }

/* ---------- cards ---------- */
.card {
  background: linear-gradient(180deg, rgba(26, 35, 64, 0.72), rgba(12, 18, 36, 0.86));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.card-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  color: var(--text-faint);
  margin-bottom: 9px;
}

.controls {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end;
}

.field { display: flex; flex-direction: column; gap: 6px; min-width: 118px; }
.field-grow { flex: 1 1 210px; min-width: 190px; }
.field label { font-size: 11.5px; color: var(--text-dim); display: flex; gap: 6px; align-items: center; }

.pill {
  background: var(--accent-soft);
  color: #cfe0ff;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
  font-family: var(--mono);
}

input[type="text"], select {
  background: var(--navy-900);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 9px;
  padding: 9px 11px;
  font: inherit; font-size: 14px;
  width: 100%;
}
input[type="text"]:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  height: 4px; border-radius: 4px;
  background: var(--navy-500);
  width: 100%; margin: 8px 0;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--accent); cursor: pointer;
  box-shadow: 0 0 0 4px var(--accent-soft);
}
input[type="range"]::-moz-range-thumb {
  width: 15px; height: 15px; border: none; border-radius: 50%;
  background: var(--accent); cursor: pointer;
}

.btn {
  border: 1px solid var(--line);
  background: var(--navy-600);
  color: var(--text);
  border-radius: 9px;
  padding: 10px 18px;
  font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s, filter 0.15s;
}
.btn:hover { filter: brightness(1.16); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #6f5cff);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 20px rgba(79, 140, 255, 0.3);
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- typeahead ---------- */
.typeahead { position: relative; }
.suggestions {
  position: absolute; z-index: 40; top: calc(100% + 5px); left: 0; right: 0;
  background: var(--navy-700);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
  max-height: 260px; overflow-y: auto;
}
.suggestion {
  padding: 9px 12px; cursor: pointer;
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}
.suggestion:last-child { border-bottom: none; }
.suggestion:hover, .suggestion.is-active { background: var(--accent-soft); }
.suggestion .sym { font-family: var(--mono); font-weight: 600; }
.suggestion .nm { color: var(--text-dim); font-size: 12px; text-align: right; }

/* ---------- stat cards ---------- */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
}
.grid-cards .card { margin-bottom: 16px; }

.stat-value { font-size: 25px; font-weight: 650; font-family: var(--mono); letter-spacing: -0.5px; }

.signal-card { position: relative; overflow: hidden; }
.signal-action { font-size: 24px; font-weight: 750; letter-spacing: 0.4px; }
.signal-action.buy { color: var(--up); }
.signal-action.sell { color: var(--down); }
.signal-action.hold { color: var(--warn); }
.signal-meta { display: flex; gap: 16px; font-size: 12px; color: var(--text-dim); margin-top: 6px; }
.signal-meta strong { color: var(--text); font-family: var(--mono); }

.meter { height: 5px; border-radius: 5px; background: var(--navy-500); margin-top: 12px; overflow: hidden; }
.meter-fill { height: 100%; width: 0; border-radius: 5px; transition: width 0.4s ease; background: var(--warn); }

.value-up { color: var(--up); }
.value-down { color: var(--down); }

/* ---------- chart ---------- */
.chart-card { position: relative; }
.chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; flex-wrap: wrap; margin-bottom: 6px; }
.chart-head h2 { margin: 0 0 3px; font-size: 17px; font-weight: 620; }
.chart { width: 100%; min-height: 300px; }
.chart svg { display: block; width: 100%; height: auto; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-dim); }
.legend span { display: flex; align-items: center; gap: 5px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.swatch-up { background: var(--up); }
.swatch-down { background: var(--down); }
.swatch-forecast { background: var(--accent); }
.swatch-band { background: rgba(79, 140, 255, 0.28); }

.tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(7, 11, 22, 0.96);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 11px;
  font-size: 12px;
  font-family: var(--mono);
  line-height: 1.6;
  box-shadow: var(--shadow);
  z-index: 30;
  white-space: nowrap;
}
.tooltip .tt-title { font-family: var(--font); font-weight: 600; margin-bottom: 3px; }

/* ---------- tables ---------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1080px) { .two-col { grid-template-columns: 1fr; } }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--text-faint);
  padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 9px 10px; border-bottom: 1px solid rgba(148, 170, 214, 0.08); vertical-align: top; }
.table tbody tr:hover { background: rgba(79, 140, 255, 0.06); }
.table td.right, .table th.right { text-align: right; font-family: var(--mono); }
.table .sym { font-family: var(--mono); font-weight: 600; }

.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 650; letter-spacing: 0.3px; white-space: nowrap;
}
.badge-buy { background: rgba(47, 191, 113, 0.16); color: var(--up); }
.badge-sell { background: rgba(244, 85, 107, 0.16); color: var(--down); }
.badge-hold { background: rgba(240, 180, 41, 0.16); color: var(--warn); }

.detail-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px;
}
.detail-item {
  background: rgba(7, 11, 22, 0.5);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
}
.detail-item .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.7px; color: var(--text-faint); }
.detail-item .v { font-family: var(--mono); font-size: 14px; margin-top: 3px; }

.narrative { margin: 0; font-size: 13.5px; line-height: 1.68; color: #dbe4f5; }

.prose { font-size: 13.5px; line-height: 1.68; color: #cfd9ee; }
.prose h3 { font-size: 14px; margin: 18px 0 6px; color: #fff; }
.prose p { margin: 0 0 10px; max-width: 84ch; }

/* ---------- ask ---------- */
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  background: var(--navy-700); border: 1px solid var(--line);
  color: var(--text-dim); border-radius: 999px;
  padding: 6px 13px; font: inherit; font-size: 12.5px; cursor: pointer;
}
.chip:hover { color: #fff; border-color: var(--accent); }

.thread { display: flex; flex-direction: column; gap: 14px; }
.bubble { border-radius: var(--radius); padding: 14px 16px; border: 1px solid var(--line); }
.bubble-q { background: var(--accent-soft); border-color: rgba(79, 140, 255, 0.34); align-self: flex-end; max-width: 72%; }
.bubble-a { background: linear-gradient(180deg, rgba(26, 35, 64, 0.72), rgba(12, 18, 36, 0.86)); box-shadow: var(--shadow); }
.bubble-q .who, .bubble-a .who {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-faint); margin-bottom: 6px;
}
.bubble-a .answer-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.bubble-a .answer-head .sym { font-family: var(--mono); font-weight: 650; font-size: 15px; }

/* ---------- misc ---------- */
.alert {
  background: rgba(244, 85, 107, 0.1);
  border: 1px solid rgba(244, 85, 107, 0.4);
  color: #ffc9d1;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

.busy {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(4, 7, 14, 0.66);
  backdrop-filter: blur(2px);
  display: grid; place-items: center;
}
.busy-box {
  background: var(--navy-700); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px 30px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  box-shadow: var(--shadow); font-size: 13px; color: var(--text-dim);
}
.spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid var(--navy-500); border-top-color: var(--accent);
  animation: spin 0.85s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: static; flex-direction: row; align-items: center; gap: 16px; }
  /* Wrap rather than scroll: as a single scrolling strip the fourth nav item sat
     off-screen at phone widths with nothing to hint it was there. */
  .nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-foot { margin: 0; }
  .content { padding: 18px 16px 50px; }
}

@media (max-width: 560px) {
  .sidebar { flex-direction: column; align-items: stretch; }
  .nav { width: 100%; }
  .nav-item { flex: 1 1 auto; justify-content: center; }
}
