/* ── Scheda Tecnica Popup ── */
.octo-scheda-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,0.4);
  backdrop-filter: blur(4px); z-index: 80; display: none;
}
.octo-scheda-popup {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(920px, 94vw); height: 88vh; max-height: 88vh;
  background: var(--surface, #fff);
  border-radius: 12px; border: 1px solid var(--border, #d1d5db);
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.25);
  z-index: 81; display: none; flex-direction: column; overflow: hidden;
}
.octo-scheda-popup.active { display: flex; }
.octo-scheda-backdrop.active { display: block; }
.octo-scheda-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border, #d1d5db);
  flex-shrink: 0;
}
.octo-scheda-title { font-size: 16px; font-weight: 600; }
.octo-scheda-close {
  background: none; border: none; font-size: 22px; cursor: pointer;
  color: var(--text-muted, #6b7280); padding: 4px 8px;
}
.octo-scheda-close:hover { color: var(--danger, #dc2626); }
.octo-scheda-body {
  flex: 1; overflow-y: auto; padding: 18px;
}
.octo-scheda-section {
  margin-bottom: 18px; background: var(--surface-alt, #f9fafb);
  border-radius: 8px; border: 1px solid var(--border, #e5e7eb);
  padding: 14px 16px;
}
.octo-scheda-section h3 {
  font-size: 13px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: #2563eb; margin: 0 0 10px;
  padding-bottom: 6px; border-bottom: 2px solid #2563eb;
}
.octo-scheda-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
}
.octo-scheda-field label {
  display: block; font-size: 10px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: #2563eb; margin-bottom: 2px;
}
.octo-scheda-field span {
  font-size: 13px; font-weight: 500;
}
.octo-scheda-codice {
  background: #eff4ff; padding: 6px 10px; border-radius: 6px;
  border-left: 3px solid #2563eb; color: #2563eb;
  font-family: monospace; font-size: 12px; font-weight: 600;
  margin-top: 8px; word-break: break-all;
}
.octo-scheda-table {
  width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px;
}
.octo-scheda-table th {
  text-align: left; padding: 4px 8px; font-size: 10px;
  text-transform: uppercase; color: #2563eb;
  background: #eff4ff; border-bottom: 1px solid var(--border, #e5e7eb);
}
.octo-scheda-table td {
  padding: 4px 8px; border-bottom: 1px solid var(--border, #f3f4f6);
}
.octo-scheda-empty {
  color: var(--text-muted, #6b7280); font-style: italic; font-size: 12px;
}
.octo-scheda-loading {
  text-align: center; padding: 40px; color: var(--text-muted, #6b7280);
}
.octo-scheda-deriv {
  padding: 6px 10px; border-radius: 6px; font-size: 12px; margin: 4px 0;
}
.octo-scheda-section a { color: #2563eb; text-decoration: none; }
.octo-scheda-section a:hover { text-decoration: underline; }
.octo-scheda-deriv-prev { background: #eff4ff; border-left: 3px solid #2563eb; }
.octo-scheda-deriv-curr { background: #dcfce7; border-left: 3px solid #16a34a; font-weight: 600; }
.octo-scheda-deriv-succ { background: #fef3c7; border-left: 3px solid #d97706; }
.octo-scheda-deriv-sopp { background: #fef2f2; border-left: 3px solid #dc2626; color: #991b1b; }
/* ── Scheda Tabs ── */
.octo-scheda-tabs {
  display: flex; gap: 0; border-bottom: 2px solid var(--border, #e5e7eb);
  margin: 0 -18px; padding: 0 18px; flex-shrink: 0;
}
.octo-scheda-tab {
  padding: 10px 20px; font-size: 13px; font-weight: 600;
  color: var(--text-muted, #6b7280); background: none; border: none;
  cursor: pointer; position: relative; transition: color 0.15s;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.octo-scheda-tab:hover { color: #2563eb; }
.octo-scheda-tab.active {
  color: #2563eb; border-bottom-color: #2563eb;
}
.octo-scheda-tab-panel { display: none; }
.octo-scheda-tab-panel.active { display: block; }
/* ── Evoluzione Graph ── */
.octo-evo-container {
  width: 100%; height: calc(88vh - 160px); min-height: 400px;
  position: relative; background: #f8fafc;
  border-radius: 10px; border: 1px solid #e2e8f0;
  overflow: hidden; transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
}
.octo-evo-container.octo-evo-fullscreen {
  position: fixed; inset: 0; z-index: 90;
  width: 100vw !important; height: 100vh !important;
  border-radius: 0; border: none;
  min-height: unset;
}
.octo-evo-toolbar {
  position: absolute; top: 10px; right: 10px; z-index: 10;
  display: flex; gap: 3px; background: rgba(255,255,255,0.95);
  padding: 4px; border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.04);
  backdrop-filter: blur(8px);
}
.octo-evo-toolbar button {
  width: 32px; height: 32px; display: flex; align-items: center;
  justify-content: center; font-size: 13px; font-weight: 600;
  border: none; background: transparent; border-radius: 6px;
  cursor: pointer; color: #475569; transition: all 0.15s;
}
.octo-evo-toolbar button:hover {
  background: #e0e7ff; color: #3730a3;
}
.octo-evo-toolbar button.active {
  background: #4f46e5; color: #fff;
}
.octo-evo-toolbar .octo-evo-tb-sep {
  width: 1px; background: #e2e8f0; margin: 4px 2px;
}
.octo-evo-legend {
  position: absolute; bottom: 10px; left: 10px; z-index: 10;
  display: flex; flex-direction: column; gap: 6px; font-size: 11px;
  color: #475569; background: rgba(255,255,255,0.96);
  padding: 10px 14px; border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.04);
  backdrop-filter: blur(8px); max-width: 220px;
}
.octo-evo-legend-title {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: #94a3b8; margin-bottom: 1px;
}
.octo-evo-legend-row {
  display: flex; flex-wrap: wrap; gap: 8px 12px;
}
.octo-evo-legend-item { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.octo-evo-legend-dot {
  width: 10px; height: 10px; border-radius: 3px; display: inline-block;
  flex-shrink: 0;
}
.octo-evo-legend-line {
  width: 16px; height: 3px; border-radius: 2px; display: inline-block;
  flex-shrink: 0;
}
.octo-evo-legend-line.dashed {
  background: repeating-linear-gradient(90deg, var(--lc) 0, var(--lc) 4px, transparent 4px, transparent 7px);
  height: 3px;
}
.octo-evo-summary {
  position: absolute; top: 10px; left: 10px; z-index: 10;
  font-size: 11px; color: #475569;
  background: rgba(255,255,255,0.96); padding: 8px 12px;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.04);
  backdrop-filter: blur(8px); max-width: 300px;
}
.octo-evo-loading {
  display: flex; align-items: center; justify-content: center;
  height: 100%; color: #94a3b8; font-size: 13px;
}
/* ── Market Charts ── */
.octo-market-chart-container {
  background: var(--surface-alt, #f9fafb); border-radius: 8px;
  border: 1px solid var(--border, #e5e7eb); padding: 16px;
  margin-bottom: 18px;
}
.octo-market-chart-container h4 {
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: #2563eb; margin: 0 0 12px;
}
.octo-market-chart-svg {
  width: 100%; overflow: visible;
}
.octo-market-legend {
  display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px;
  font-size: 11px; color: var(--text-secondary, #475569);
}
.octo-market-legend-item {
  display: flex; align-items: center; gap: 4px;
}
.octo-market-legend-dot {
  width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0;
}
.octo-market-no-data {
  text-align: center; padding: 30px; color: var(--text-muted, #6b7280);
  font-style: italic; font-size: 12px;
}
/* Info button */
.octo-info-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: #2563eb; color: #fff; font-size: 10px; font-weight: 700;
  font-style: italic; font-family: Georgia, serif;
  cursor: pointer; margin-left: 6px; vertical-align: middle;
  border: none; line-height: 1; flex-shrink: 0;
}
.octo-info-btn:hover { background: #1d4ed8; }
/* Info popup overlay */
.octo-info-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,0.35);
  backdrop-filter: blur(2px); z-index: 90; display: none;
}
.octo-info-overlay.active { display: block; }
.octo-info-popup {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: min(520px, 90vw); max-height: 80vh; overflow-y: auto;
  background: #fff; border-radius: 10px; border: 1px solid #d1d5db;
  box-shadow: 0 20px 40px -12px rgba(0,0,0,.2);
  z-index: 91; display: none; padding: 20px 24px;
}
.octo-info-popup.active { display: block; }
.octo-info-popup h4 {
  font-size: 14px; font-weight: 600; color: #2563eb;
  margin: 0 0 12px; padding-bottom: 8px; border-bottom: 2px solid #2563eb;
}
.octo-info-popup p { font-size: 12px; line-height: 1.6; margin: 0 0 10px; color: #374151; }
.octo-info-popup strong { color: #111827; }
.octo-info-popup .info-formula {
  background: #eff4ff; padding: 8px 12px; border-radius: 6px;
  border-left: 3px solid #2563eb; font-family: monospace; font-size: 11px;
  margin: 8px 0 12px; color: #1e40af;
}
.octo-info-popup .info-close {
  display: block; margin: 14px auto 0; padding: 6px 20px;
  background: #2563eb; color: #fff; border: none; border-radius: 6px;
  font-size: 12px; font-weight: 600; cursor: pointer;
}
.octo-info-popup .info-close:hover { background: #1d4ed8; }
