:root {
  --ink: #111014;
  --slate: #3b3a44;
  --muted: #7b7a86;
  --accent: #ff6a3d;
  --accent-2: #f0b429;
  --card: #fef5eb;
  --panel: #ffffff;
  --shadow: rgba(17, 16, 20, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top, #fff4e8 0%, #f5efe9 38%, #eef1f7 100%);
  min-height: 100vh;
}

.bg-orbit {
  position: fixed;
  top: -120px;
  right: -120px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: conic-gradient(from 140deg, #ff6a3d, #f0b429, #ffd7b5, #ff6a3d);
  filter: blur(0.5px);
  opacity: 0.35;
  z-index: -1;
  animation: orbit 12s ease-in-out infinite;
}

@keyframes orbit {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(-20px, 20px, 0) scale(1.05);
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
}

.hero {
  padding: 48px 24px 24px;
}

.hero-inner {
  max-width: none;
  width: 100%;
  margin: 0 auto;
  display: grid;
  gap: 28px;
  align-items: center;
}

.tag {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: #111014;
  color: #fff;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 600;
}

h1 {
  font-size: clamp(28px, 4vw, 44px);
  margin: 12px 0 8px;
}

.subtitle {
  color: var(--slate);
  max-width: 620px;
  margin: 0;
}

.stat-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.stat {
  background: var(--panel);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 12px 24px var(--shadow);
}

.stat .label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat .value {
  display: block;
  font-size: 22px;
  font-weight: 700;
  margin-top: 6px;
}

.stat .hint {
  color: var(--muted);
  font-size: 12px;
}

.container {
  max-width: none;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px 60px;
  display: grid;
  gap: 24px;
}

.panel {
  background: var(--panel);
  border-radius: 20px;
  box-shadow: 0 16px 40px var(--shadow);
  overflow: hidden;
}

.panel-head {
  padding: 24px 24px 0;
}

.panel-head h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.panel-head p {
  color: var(--muted);
  margin: 0;
}

.panel-body {
  padding: 20px 24px 28px;
  overflow-x: auto;
}

.add-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  margin-bottom: 20px;
}

.auto-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--slate);
}

.auto-row button {
  padding: 10px 14px;
  border-radius: 10px;
  border: none;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.auto-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auto-controls label {
  font-size: 13px;
  color: var(--muted);
}

.auto-controls select {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #e0d9d2;
  background: #fff;
  font-size: 13px;
}

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

.filter-row label {
  font-size: 13px;
  color: var(--muted);
  min-width: 110px;
}

.filter-row input {
  width: 100%;
  max-width: 360px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e0d9d2;
  background: #fff;
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
}

.filter-row button {
  padding: 10px 14px;
  border-radius: 10px;
  border: none;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.status-line {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}

.table .row button {
  padding: 6px 10px;
  border-radius: 999px;
  border: none;
  background: #111014;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
}

.add-form input {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #e0d9d2;
  background: #fff;
  font-size: 14px;
}

.add-form button {
  padding: 12px 18px;
  border-radius: 12px;
  border: none;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.card {
  background: var(--card);
  border-radius: 16px;
  padding: 16px;
  position: relative;
  border: 1px solid rgba(255, 106, 61, 0.12);
}

.card h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

.card .price {
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
}

.card .delta {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  margin-top: 6px;
}

.card .score {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
}

.card .remove {
  position: absolute;
  top: 12px;
  right: 12px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.table {
  display: grid;
  gap: 12px;
}

.chart-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.chart-controls label {
  font-weight: 600;
  color: var(--slate);
}

.chart-controls select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e0d9d2;
  background: #fff;
  min-width: 160px;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.chart-notice {
  display: none;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff3e6;
  border: 1px solid rgba(255, 106, 61, 0.2);
  color: #7a3b1b;
  font-size: 14px;
}

.chart-card {
  background: #f8f3ef;
  border-radius: 16px;
  padding: 16px;
}

.chart-card h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.row {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  align-items: center;
  background: #f8f3ef;
  border-radius: 14px;
  padding: 14px 16px;
}

.signals-row {
  grid-template-columns: 160px repeat(4, minmax(120px, 1fr)) 140px 140px;
}

.top10-row {
  grid-template-columns: 160px 120px repeat(3, minmax(105px, 1fr)) 260px 220px 120px;
}

.portfolio-row {
  grid-template-columns: 130px 140px 130px 130px 90px 100px 320px 220px;
  min-width: 1350px;
}

#portfolioTable .signal-info {
  max-width: 300px;
  white-space: normal;
}

.row.header {
  background: transparent;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.row .cell-title {
  font-weight: 600;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #111014;
  color: #fff;
  font-size: 12px;
}

.freshness-wrap {
  margin-top: 6px;
}

.freshness-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 4px 8px;
}

.freshness-live {
  background: #1f9d55;
  color: #fff;
}

.freshness-stale {
  background: #9b2c2c;
  color: #fff;
}

/* Badge per segnali predittivi */
.signal-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 5px 9px;
  white-space: nowrap;
}

.signal-strong-exit {
  background: linear-gradient(135deg, #c0392b, #e74c3c);
  color: #fff;
  box-shadow: 0 2px 8px rgba(192, 57, 43, 0.3);
}

.signal-consider-exit {
  background: linear-gradient(135deg, #f39c12, #f0b429);
  color: #fff;
  box-shadow: 0 2px 8px rgba(243, 156, 18, 0.3);
}

.signal-hold {
  background: linear-gradient(135deg, #27ae60, #2ecc71);
  color: #fff;
  box-shadow: 0 2px 8px rgba(39, 174, 96, 0.3);
}

.signal-strong-entry {
  background: linear-gradient(135deg, #2c7a4b, #27ae60);
  color: #fff;
  box-shadow: 0 2px 8px rgba(44, 122, 75, 0.3);
}

.signal-consider-entry {
  background: linear-gradient(135deg, #3498db, #5dade2);
  color: #fff;
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.signal-wait {
  background: linear-gradient(135deg, #7b7a86, #95a5a6);
  color: #fff;
  box-shadow: 0 2px 8px rgba(123, 122, 134, 0.3);
}

.signal-avoid {
  background: linear-gradient(135deg, #8e44ad, #9b59b6);
  color: #fff;
  box-shadow: 0 2px 8px rgba(142, 68, 173, 0.3);
}

.signal-info {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.3;
  max-width: 200px;
}

.preopen-box {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed rgba(17, 16, 20, 0.14);
}

.mini-chart-empty {
  font-size: 11px;
  color: var(--muted);
}

.api-notice {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: #c0392b;
  line-height: 1.3;
}

.disclaimer {
  border: 1px dashed rgba(17, 16, 20, 0.12);
}

@media (max-width: 900px) {
  .add-form {
    grid-template-columns: 1fr;
  }
  .auto-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .auto-controls {
    width: 100%;
    flex-wrap: wrap;
  }
  .filter-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .row {
    grid-template-columns: 1fr;
  }
}
