:root {
  --bg: #05070b;
  --panel: rgba(10, 14, 22, 0.9);
  --panel-2: rgba(15, 20, 30, 0.95);
  --border: rgba(120, 150, 200, 0.16);
  --text: #e8eef8;
  --muted: #9aa7bd;
  --accent: #77b6ff;
  --accent-2: #57ffd6;
  --danger: #ff6b7d;
  --success: #6dff98;
  --warning: #ffb86b;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: radial-gradient(circle at top, #0b1322 0%, #04060a 45%, #020307 100%);
  color: var(--text);
  font-family: Inter, Arial, Helvetica, sans-serif;
}

body {
  min-height: 100vh;
}

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

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(5, 8, 14, 0.88);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.brand {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.2rem;
}

.subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 4px;
}

.top-nav {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.top-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
}

.top-nav a:hover {
  color: var(--text);
}

.topbar-right {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.status-pill {
  border: 1px solid var(--border);
  background: rgba(16, 23, 35, 0.9);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  white-space: nowrap;
}

.status-pill.online {
  color: var(--success);
}

.status-pill.live {
  color: var(--accent-2);
}

.layout {
  display: grid;
  grid-template-columns: 1.35fr 0.95fr;
  min-height: calc(100vh - 80px);
}

.map-section {
  position: relative;
  min-height: 700px;
  border-right: 1px solid var(--border);
}

#map {
  width: 100%;
  height: 100%;
  min-height: 700px;
  background: #020408;
}

.side-panel {
  background: linear-gradient(180deg, rgba(8, 12, 18, 0.96), rgba(6, 9, 14, 0.98));
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 0;
}

.tab-btn {
  border: 1px solid var(--border);
  background: rgba(15, 20, 28, 0.9);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: 0.2s ease;
}

.tab-btn:hover,
.tab-btn.active {
  border-color: rgba(119, 182, 255, 0.45);
  box-shadow: 0 0 0 1px rgba(119, 182, 255, 0.2) inset;
  color: #fff;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.card {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.hero-card {
  border-color: rgba(119, 182, 255, 0.28);
}

.card h2 {
  margin-top: 0;
  margin-bottom: 10px;
}

.card h3 {
  margin-top: 22px;
  margin-bottom: 12px;
  font-size: 1rem;
  color: #dce8ff;
}

.card-subtitle,
.panel-note,
.item-meta,
.news-source,
.empty-state {
  color: var(--muted);
}

.card-header-row,
.section-headline-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.beta-badge {
  border: 1px solid rgba(87, 255, 214, 0.35);
  color: var(--accent-2);
  background: rgba(8, 24, 24, 0.85);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 0.78rem;
  white-space: nowrap;
}

.trend-pill {
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 0.78rem;
  border: 1px solid transparent;
  white-space: nowrap;
}

.trend-pill.danger {
  color: var(--danger);
  background: rgba(40, 12, 18, 0.85);
  border-color: rgba(255, 107, 125, 0.25);
}

.trend-pill.success {
  color: var(--success);
  background: rgba(10, 32, 18, 0.85);
  border-color: rgba(109, 255, 152, 0.2);
}

.floating-panel {
  position: absolute;
  z-index: 500;
  border: 1px solid var(--border);
  background: var(--panel-2);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.layers-panel {
  top: 18px;
  left: 18px;
  width: min(360px, calc(100% - 36px));
}

.alerts-panel {
  bottom: 18px;
  left: 18px;
  width: min(430px, calc(100% - 36px));
  max-height: 46%;
  overflow: auto;
}

.panel-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.panel-title-row h3 {
  margin: 0;
  font-size: 1rem;
}

.mini-sep {
  color: var(--muted);
}

.layer-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.layer-btn {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: rgba(19, 26, 39, 0.95);
  color: var(--text);
  cursor: pointer;
}

.layer-btn.active {
  border-color: rgba(87, 255, 214, 0.5);
  color: var(--accent-2);
}

.tag-row,
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.tag,
.chip {
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(17, 24, 37, 0.9);
  font-size: 0.85rem;
}

.watchlist-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.quote-card {
  border: 1px solid var(--border);
  background: rgba(17, 24, 36, 0.85);
  border-radius: 14px;
  padding: 14px;
}

.quote-card .symbol {
  font-weight: 700;
  margin-bottom: 6px;
}

.quote-card .price {
  font-size: 1.2rem;
  font-weight: 800;
}

.quote-card .change {
  margin-top: 6px;
  font-size: 0.95rem;
}

.positive {
  color: var(--success);
}

.negative {
  color: var(--danger);
}

.neutral {
  color: var(--muted);
}

.list-block,
.news-feed,
.alerts-list,
.top-signals-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list-item,
.news-item,
.alert-item,
.top-signal-item {
  border: 1px solid var(--border);
  background: rgba(17, 24, 36, 0.78);
  border-radius: 14px;
  padding: 12px;
}

.top-signal-item {
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.top-signal-item:hover {
  transform: translateY(-1px);
  border-color: rgba(119, 182, 255, 0.35);
}

.top-signal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.top-signal-title,
.item-title,
.news-title {
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 6px;
}

.top-signal-score {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.78rem;
  white-space: nowrap;
  background: rgba(16, 28, 45, 0.95);
  color: var(--accent);
  border: 1px solid rgba(119, 182, 255, 0.22);
}

.signal-type {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 0.75rem;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  color: var(--muted);
}

.signal-type.market {
  color: var(--accent);
}

.signal-type.jobs {
  color: var(--warning);
}

.signal-type.ai {
  color: var(--accent-2);
}

.signal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  gap: 10px;
}

.why-link {
  color: var(--accent);
  font-size: 0.9rem;
}

.item-meta,
.news-source {
  font-size: 0.85rem;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 6px 4px 0;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.modal.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal-dialog {
  position: relative;
  width: min(720px, calc(100vw - 32px));
  margin: 6vh auto;
  background: rgba(10, 14, 22, 0.97);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 22px;
  z-index: 1;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  border: 1px solid var(--border);
  background: rgba(18, 24, 36, 0.95);
  color: var(--text);
  border-radius: 10px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 1.2rem;
}

.modal-kicker {
  color: var(--accent-2);
  font-size: 0.8rem;
  letter-spacing: 0.08rem;
  margin-bottom: 8px;
}

.modal-meta {
  color: var(--muted);
  margin-bottom: 16px;
}

.modal-section {
  margin-top: 18px;
}

.modal-section h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.modal-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
}

.modal-list li + li {
  margin-top: 6px;
}

.confidence-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(16, 28, 45, 0.95);
  color: var(--accent);
  border: 1px solid rgba(119, 182, 255, 0.22);
}

.modal-actions {
  margin-top: 22px;
}

.modal-link {
  display: inline-flex;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(16, 23, 35, 0.9);
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .map-section {
    min-height: 520px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  #map {
    min-height: 520px;
  }
}

@media (max-width: 780px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .watchlist-grid {
    grid-template-columns: 1fr;
  }

  .tabs {
    flex-wrap: wrap;
  }

  .layers-panel,
  .alerts-panel {
    width: calc(100% - 24px);
    left: 12px;
  }

  .layers-panel {
    top: 12px;
  }

  .alerts-panel {
    bottom: 12px;
  }

  .card-header-row,
  .section-headline-row,
  .site-footer,
  .top-signal-head,
  .signal-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}