/* ──────────────────────────────────────────────────────────────────────────
   Video Assistant Dashboard — cream theme (matches extension)
   ────────────────────────────────────────────────────────────────────────── */

:root {
  --bg-primary: #f5efe6;
  --bg-secondary: #ebe0d0;
  --bg-tertiary: #fff4d0;
  --bg-card: rgba(255, 255, 255, 0.5);
  --text-primary: #3d2817;
  --text-heading: #2b1810;
  --text-muted: #6b5a4a;
  --accent: #8b4513;
  --accent-hover: #a0522d;
  --accent-soft: rgba(139, 69, 19, 0.08);
  --border: #d4c4a8;
  --border-strong: #b8a384;
  --code-bg: #ebe0d0;
  --code-text: #5c3317;
  --warning-bg: var(--bg-tertiary);
  --warning-text: #5c4a00;
  --warning-border: #d4b94e;
  --success-bg: #dde8d4;
  --success-text: #3f6421;
  --error-bg: #f4d8d6;
  --error-text: #a0413e;
  /* ── Replay signal colours — keep in sync with CLR object in app.js ── */
  --replay-buy:        #3f6421;
  --replay-sell:       #a0413e;
  --replay-trade-buy:  #1a5fa8;
  --replay-trade-sell: #c07800;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

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

button {
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 8px 14px;
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
button:hover { background: var(--accent-soft); }
button.primary { background: var(--accent); color: #fff; }
button.primary:hover { background: var(--accent-hover); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

input[type=text], input[type=search], input[type=url], input[type=password], select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }

/* ── Layout ─────────────────────────────────────────────────────────────── */

#app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 22px 14px;
}

.sidebar-header h1 {
  margin: 0 0 18px;
  color: var(--text-heading);
  font-size: 18px;
  font-weight: 700;
}

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

.sidebar-nav a {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
}

.sidebar-nav a:hover { background: var(--accent-soft); text-decoration: none; }
.sidebar-nav a.active { background: var(--accent); color: #fff; }

.sidebar-footer {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-primary);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}

.topbar-search {
  flex: 1;
  max-width: 560px;
}

/* Link diretto alla pagina crediti/billing di Anthropic (Anthropic non espone
   un endpoint col saldo residuo → si apre la Console a mano). */
.topbar-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px 10px;
  background: var(--bg-secondary);
}
.topbar-link:hover {
  color: var(--accent, #8b4513);
  border-color: var(--accent, #8b4513);
}

.content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

.detail-codex-reviewed {
  background:
    linear-gradient(180deg, rgba(26,95,168,0.10), rgba(26,95,168,0.03) 260px),
    var(--bg-primary);
  border: 2px solid rgba(26,95,168,0.28);
  border-radius: 14px;
  padding: 18px;
}

.codex-review {
  background: #e8f1fb;
  border: 1px solid #8bb4df;
  border-left: 5px solid #1a5fa8;
  box-shadow: 0 2px 10px rgba(26,95,168,0.08);
}

.codex-review-critical {
  background: #f8e7e5;
  border-color: #d08a83;
  border-left-color: #a0413e;
}

.codex-review-major {
  background: #fff0d8;
  border-color: #d9a85a;
  border-left-color: #c07800;
}

.codex-review-minor {
  background: #e8f1fb;
}

.codex-review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.codex-review-head h2 { margin: 0; }

.codex-review-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 800;
  background: #1a5fa8;
  color: #fff;
}

.codex-review-status-queued {
  background: #c07800;
}

.codex-review-headline {
  margin: 8px 0 12px;
  font-weight: 800;
  color: var(--text-heading);
}

.codex-review-json summary {
  cursor: pointer;
  font-weight: 700;
  color: #1a5fa8;
}

.empty {
  padding: 80px 20px;
  text-align: center;
  color: var(--text-muted);
}

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

/* ── Pills / badges ────────────────────────────────────────────────────── */

.pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3px 10px;
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.pill-ok { background: var(--success-bg); color: var(--success-text); border-color: var(--success-text); }
.pill-warn { background: var(--warning-bg); color: var(--warning-text); border-color: var(--warning-border); }
.pill-err { background: var(--error-bg); color: var(--error-text); border-color: var(--error-text); }

.badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2px 10px;
  background: var(--bg-secondary);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}
.badge-low { background: var(--error-bg); color: var(--error-text); }
.badge-mid { background: #faf0d4; color: #8a6d00; }
.badge-high { background: var(--success-bg); color: var(--success-text); }

.tag {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2px 9px;
  margin: 2px 4px 2px 0;
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 11px;
}

/* ── Cards / lists ─────────────────────────────────────────────────────── */

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  background: var(--bg-card);
  box-shadow: 0 1px 2px rgba(61, 40, 23, 0.05);
  transition: border-color 0.15s, transform 0.05s;
}
.card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.card-selectable { user-select: none; -webkit-user-select: none; }
.card-selectable:hover { transform: none; }
.card-selected {
  border-color: var(--accent, #8b4513) !important;
  box-shadow: 0 0 0 2px var(--accent, #8b4513), 0 1px 2px rgba(61, 40, 23, 0.1);
  background: var(--bg-secondary, #ebe0d0);
}

.card-thumb {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 10px;
  background: var(--bg-secondary);
}

.card-title {
  margin: 0 0 6px;
  color: var(--text-heading);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0;
  font-size: 12px;
  color: var(--text-muted);
}

.card-meta > * { display: inline-flex; align-items: center; gap: 4px; }

.card-tags { display: flex; flex-wrap: wrap; margin-top: 8px; }

.card-summary {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 13px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Banner "stai guardando la COPIA LOCALE" (dev backend, non i dati veri) ── */
.local-backend-banner {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #a0413e;
  color: #fff;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  border-bottom: 2px solid #7a2f2d;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.local-backend-banner .lbb-switch {
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.5); color: #fff;
  border-radius: 7px; cursor: pointer; font: inherit; font-size: 12px; padding: 2px 9px; margin-left: 10px;
}
.local-backend-banner .lbb-switch:hover { background: rgba(255,255,255,.3); }
.local-backend-banner a {
  color: #fff;
  text-decoration: underline;
  font-weight: 700;
  white-space: nowrap;
}
.local-backend-banner a:hover { color: #ffe9e7; }

/* ── View toggle (Card ↔ Elenco) ── */
.view-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 10px 0 4px;
}
.view-toggle button {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 6px;
}
.view-toggle button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ── Vista elenco = TABELLA (un video per riga, zebra) ── */
.video-table-wrap {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-card);
}
.video-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}
.video-table thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-strong);
  position: sticky;
  top: 0;
  z-index: 1;
}
.video-table tbody td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}
/* Solo titolo e autore troncano con i puntini; le colonne corte non si clippano */
.video-table .vt-title,
.video-table .vt-author { overflow: hidden; text-overflow: ellipsis; }
.video-table tbody tr { cursor: pointer; }
.video-table tbody tr.vt-alt { background: rgba(139, 69, 19, 0.045); }  /* zebra */
.video-table tbody tr:hover { background: var(--accent-soft); }
.video-table tbody tr.card-selected { background: var(--bg-secondary); box-shadow: inset 3px 0 0 var(--accent); }
.video-table tbody tr:last-child td { border-bottom: none; }

/* Larghezze colonne */
.vt-c-check, .vt-check { width: 38px; text-align: center; }
.vt-c-title { width: auto; }
.vt-c-author { width: 17%; }
.vt-c-date { width: 110px; }
.vt-c-cat { width: 130px; }
.vt-c-rating { width: 84px; }

/* Titolo su una riga sola: tronca con i puntini (hover = titolo completo) */
.video-table .vt-title { white-space: nowrap; }
.video-table .vt-title .vt-dot { margin-right: 6px; }
.video-table .vt-titletext {
  font-weight: 600;
  color: var(--text-heading);
  text-decoration: none;
}
.video-table tbody tr:hover .vt-titletext { color: var(--accent-hover); }
.video-table .vt-title .pill { margin-left: 6px; vertical-align: middle; }
.video-table .vt-author { color: var(--text-muted); }
.video-table .vt-date { color: var(--text-muted); white-space: nowrap; }
.video-table .vt-cat .pill { text-transform: capitalize; }
.video-table .vt-checkbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: var(--bg-primary);
  border: 2px solid var(--accent);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}

@media (max-width: 680px) {
  .video-table .vt-c-author, .video-table .vt-author { display: none; }
  .vt-c-date, .video-table .vt-date { width: 84px; }
  .vt-c-cat { width: 96px; }
}

/* ── Detail page ───────────────────────────────────────────────────────── */

.detail {
  max-width: 920px;
  margin: 0 auto;
}

.detail-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 18px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.detail-header h1 {
  margin: 0;
  color: var(--text-heading);
  font-size: 26px;
  line-height: 1.2;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  color: var(--text-muted);
  font-size: 13px;
}

.detail-section {
  margin: 28px 0;
}

.detail-section h2 {
  margin: 0 0 12px;
  color: var(--text-heading);
  font-size: 18px;
  font-weight: 700;
}

.section-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  font-size: 13px;
}
.section-table th, .section-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.section-table tr:last-child td { border-bottom: 0; }
.section-table th { background: var(--bg-secondary); color: var(--text-heading); font-weight: 700; }

.watch-section {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  margin: 6px 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
}
.watch-section .ts {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-weight: 700;
  color: var(--accent);
}

/* Markdown reader */

.markdown {
  padding: 6px 0 12px;
  font-size: 15px;
  line-height: 1.7;
}
.markdown h1, .markdown h2, .markdown h3, .markdown h4 {
  color: var(--text-heading);
  font-weight: 700;
  line-height: 1.3;
}
.markdown h1 { margin: 22px 0 10px; font-size: 22px; }
.markdown h2 { margin: 20px 0 8px; font-size: 18px; }
.markdown h3 { margin: 16px 0 8px; font-size: 16px; }
.markdown h4 { margin: 14px 0 8px; font-size: 15px; }
.markdown p, .markdown ul, .markdown ol { margin: 8px 0; }
.markdown ul, .markdown ol { padding-left: 22px; }
.markdown li::marker { color: var(--accent); }
.markdown strong, .markdown b { color: var(--text-heading); }
.markdown hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.markdown blockquote {
  margin: 12px 0;
  border-left: 3px solid var(--accent);
  padding-left: 12px;
  color: var(--text-muted);
  font-style: italic;
}
.markdown code {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  background: var(--code-bg);
  color: var(--code-text);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.markdown pre {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 12px;
  background: var(--code-bg);
  color: var(--code-text);
}
.markdown pre code { border: 0; padding: 0; background: transparent; }

details.transcript-collapse {
  margin: 28px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--bg-card);
}
details.transcript-collapse > summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--accent);
}
.transcript-text {
  margin-top: 10px;
  max-height: 360px;
  overflow-y: auto;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  color: var(--text-muted);
  white-space: pre-wrap;
}

/* ── Filters bar ───────────────────────────────────────────────────────── */

.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  padding: 14px 16px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
}

.filter-group label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-group select, .filter-group input {
  font-size: 13px;
  padding: 6px 10px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  margin-top: 22px;
}

/* ── Settings panel ────────────────────────────────────────────────────── */

.settings-panel {
  position: fixed;
  inset: 0;
  background: rgba(61, 40, 23, 0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.settings-panel[hidden] { display: none; }

.settings-card {
  width: min(440px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-primary);
  box-shadow: 0 6px 18px rgba(61, 40, 23, 0.25);
}

.settings-card h2 { margin-top: 0; color: var(--text-heading); }
.settings-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0;
  font-size: 13px;
  color: var(--text-muted);
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

/* ── Stats page ────────────────────────────────────────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}

.stat-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  background: var(--bg-card);
}
.stat-card .stat-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stat-card .stat-value {
  display: block;
  margin-top: 4px;
  color: var(--text-heading);
  font-size: 24px;
  font-weight: 700;
}

.bars { display: flex; flex-direction: column; gap: 6px; max-width: 520px; }
.bar-row { display: grid; grid-template-columns: 60px 1fr 80px; align-items: center; gap: 10px; font-size: 13px; }
.bar-fill { height: 14px; border-radius: 7px; background: var(--accent); min-width: 2px; }

/* ── Gold Review page ──────────────────────────────────────────────────── */

.gold-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  font-size: 13px;
}
.gold-progress-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
  overflow: hidden;
}
.gold-progress-bar > div {
  height: 100%;
  background: var(--accent);
  transition: width 0.2s ease;
}

.gold-card {
  max-width: 820px;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 24px;
  background: var(--bg-card);
}
.gold-card h2 {
  margin: 0 0 4px;
  color: var(--text-heading);
  font-size: 18px;
}
.gold-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.gold-quote {
  margin: 14px 0 18px;
  padding: 14px 16px;
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background: rgba(139, 69, 19, 0.05);
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.55;
}
.gold-quote-meta {
  margin-top: 6px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  color: var(--text-muted);
}

.gold-fields {
  display: grid;
  grid-template-columns: minmax(140px, max-content) 1fr;
  gap: 6px 14px;
  margin: 14px 0 18px;
  font-size: 13px;
}
.gold-fields dt {
  color: var(--text-muted);
  font-weight: 700;
}
.gold-fields dd {
  margin: 0;
  color: var(--text-primary);
  word-break: break-word;
}
.gold-fields dd.null { color: var(--text-muted); font-style: italic; }
.gold-fields dd code {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  background: var(--code-bg);
  color: var(--code-text);
  font-size: 12px;
}

.gold-reasoning {
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  background: rgba(255,255,255,0.18);
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}
.gold-reasoning.empty { font-style: italic; }

.gold-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.gold-actions button {
  flex: 1 1 auto;
  min-width: 140px;
  padding: 10px 14px;
  font-size: 14px;
}
.gold-actions .btn-approve {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: var(--success-text);
}
.gold-actions .btn-approve:hover { background: #cce0c0; }
.gold-actions .btn-needs-fix {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-color: var(--warning-border);
}
.gold-actions .btn-needs-fix:hover { background: #fff0b0; }
.gold-actions .btn-reject {
  background: var(--error-bg);
  color: var(--error-text);
  border-color: var(--error-text);
}
.gold-actions .btn-reject:hover { background: #f2c5c2; }

.gold-form {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,0.45);
}
.gold-form label {
  display: block;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--text-muted);
}
.gold-form select, .gold-form textarea, .gold-form input[type=text] {
  width: 100%;
  margin-top: 4px;
}
.gold-form textarea { min-height: 80px; resize: vertical; }

.gold-summary .stat-card { text-align: center; }
.gold-summary-section { margin-top: 24px; }
.gold-summary-section h3 { margin: 0 0 10px; color: var(--text-heading); font-size: 16px; }

.gold-tf-question {
  margin: 14px 0 4px;
  font-size: 13px;
  color: var(--text-muted);
}
.gold-tf-options { display: flex; gap: 8px; flex-wrap: wrap; }
.gold-tf-options button { flex: 0 0 auto; padding: 6px 14px; font-size: 12px; }

.gold-recommendation {
  margin-top: 22px;
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.5;
}
.gold-recommendation.warn { background: var(--warning-bg); color: var(--warning-text); border: 1px solid var(--warning-border); }
.gold-recommendation.ok { background: var(--success-bg); color: var(--success-text); border: 1px solid var(--success-text); }

/* ── Mobile ────────────────────────────────────────────────────────────── */

@media (max-width: 800px) {
  #app { grid-template-columns: 1fr; }
  /* La colonna NON diventa piu' una barra sopra il contenuto. Prima si
     apriva in orizzontale e andava a capo: con sei gruppi e quaranta voci
     occupava mezzo schermo prima della prima riga di contenuto. Ora esce di
     scena e la apre il pulsante ☰ — il cassetto e il suo comportamento
     stanno in lib/sidebar.js, che e' l'unico posto in cui vivono, anche per
     le pagine autonome che questo foglio non lo caricano. */
  .sidebar { padding: 16px 13px; }
  .sidebar-header h1 { font-size: 16px; }
  .content { padding: 16px; }
  .topbar { padding: 10px 14px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ──── Category tabs / back link / stat list (Gate 2) ──── */
.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px 0;
}
.category-tab {
  padding: 6px 14px;
  border: 1px solid var(--border, #d6d2c4);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  color: inherit;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.category-tab:hover {
  background: var(--surface-alt, #f6f0dc);
}
.category-tab.active {
  background: var(--accent, #b87333);
  color: #fff;
  border-color: var(--accent, #b87333);
}
.category-header {
  margin: 18px 0 10px 0;
  font-size: 16px;
  letter-spacing: 0.02em;
  opacity: 0.85;
}
.back-link {
  display: inline-block;
  margin: 0 0 12px 0;
  font-size: 13px;
  color: var(--accent, #b87333);
  text-decoration: none;
}
.back-link:hover { text-decoration: underline; }
.stat-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 14px;
  margin: 0;
}
.stat-list dt { opacity: 0.7; }
.stat-list dd { margin: 0; }

/* ──── Knowledge (learning block — prompt v2.1+) ──── */
.knowledge-section { display: flex; flex-direction: column; gap: 12px; }
.knowledge-header { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0; }
.k-pill, .k-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.02em;
  border: 1px solid var(--border, #d6d2c4);
}
.k-pill-subject  { background: var(--accent, #b87333); color: #fff; border-color: var(--accent, #b87333); font-weight: 600; }
.k-pill-content  { background: var(--surface-alt, #f6f0dc); color: inherit; }
.k-badge-skill   { background: transparent; opacity: 0.85; }
.k-badge-relevance.k-badge-high   { background: #2c7a3d; color: #fff; border-color: #2c7a3d; }
.k-badge-relevance.k-badge-medium { background: #cda03a; color: #fff; border-color: #cda03a; }
.k-badge-relevance.k-badge-low    { background: transparent; opacity: 0.7; }
.k-use-case { margin: 0 0 6px 0; font-style: italic; }
.k-block { padding: 6px 0; }
.k-block .k-label { font-size: 13px; margin: 0 0 6px 0; opacity: 0.8; font-weight: 600; }
.k-collapsible > summary { cursor: pointer; font-size: 13px; opacity: 0.85; font-weight: 600; padding: 4px 0; }
.k-collapsible[open] > summary { margin-bottom: 6px; }
.k-block-body { padding-left: 6px; }
.k-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.k-chip {
  display: inline-block;
  padding: 3px 10px;
  font-size: 12px;
  border-radius: 6px;
  background: var(--surface-alt, #f6f0dc);
  border: 1px solid var(--border, #d6d2c4);
}
.k-chip-concept   { background: #efe7d2; }
.k-chip-tool      { background: #e6e0c8; }
.k-chip-framework { background: #ddd5bd; }
.k-chip-prereq    { background: transparent; opacity: 0.85; }
.k-list { margin: 0; padding-left: 22px; }
.k-list li { margin: 3px 0; line-height: 1.5; }
.k-list-timestamps li a { color: var(--accent, #b87333); text-decoration: none; }
.k-list-timestamps li a:hover { text-decoration: underline; }

/* ──── Pass A failure badge / banner (session 3) ──── */
.pill-warn {
  background: #cd6a1a;
  color: #fff;
  border-color: #cd6a1a;
  font-weight: 600;
}
.pass-a-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin: 0 0 14px 0;
  background: #fdf1dc;
  border: 1px solid #cd6a1a;
  border-radius: 8px;
  color: #5b3300;
}
.pass-a-banner-text { flex: 1 1 auto; font-size: 14px; }
.pass-a-banner-btn {
  padding: 6px 14px;
  border: 1px solid #cd6a1a;
  background: #cd6a1a;
  color: #fff;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.pass-a-banner-btn:hover:not(:disabled) { background: #b95a14; }
.pass-a-banner-btn:disabled { opacity: 0.7; cursor: wait; }

/* ──── Thumbnail placeholder (session 5) ──── */
.card-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-alt, #f6f0dc);
  border: 1px dashed var(--border, #d6d2c4);
  font-size: 36px;
  color: var(--accent, #b87333);
  opacity: 0.55;
}
.card-thumb-placeholder-icon { line-height: 1; }

/* ──── Replay Dashboard ─────────────────────────────────────────────────── */
.replay-root { display: flex; flex-direction: column; gap: 12px; padding: 16px; min-height: 0; }

.replay-controls {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  padding: 10px 12px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 8px;
}
.replay-ctrl-left { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.replay-ctrl-sep { color: var(--border-strong); padding: 0 2px; }
.replay-t-display { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; }

.replay-speed-btn { padding: 5px 10px; font-size: 12px; }
.replay-speed-btn.active { background: var(--accent); color: #fff; }

.replay-body {
  display: flex; gap: 12px; align-items: flex-start; min-height: 0;
}
.replay-charts { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.replay-chart-wrap { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.replay-chart-label { padding: 4px 10px; font-size: 12px; font-weight: 600; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.replay-svg-wrap { width: 100%; }
.replay-svg-wrap svg { display: block; width: 100%; user-select: none; -webkit-user-select: none; }
.replay-svg-wrap svg.panning { cursor: grabbing !important; }
/* MTF state bands panel — compact, no extra padding */
.replay-mtf-outer .replay-chart-label { font-size: 11px; font-weight: 500; padding: 3px 10px; }

.replay-side-panel {
  width: 280px; flex-shrink: 0; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px; font-size: 13px; max-height: 380px; overflow-y: auto;
}
.replay-sp-section { margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.replay-sp-section:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.replay-sp-heading { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); margin-bottom: 4px; letter-spacing: 0.05em; }
.replay-sp-row { display: flex; justify-content: space-between; gap: 6px; line-height: 1.7; }
.replay-sp-label { color: var(--text-muted); white-space: nowrap; }
.replay-sp-val { font-weight: 600; text-align: right; }
.replay-sp-reason { margin-top: 4px; font-size: 12px; color: var(--text-muted); white-space: pre-wrap; line-height: 1.5; }

.replay-event-log { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; max-height: 200px; overflow-y: auto; }
.replay-ev-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.replay-ev-table th { padding: 6px 10px; text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg-secondary); }
.replay-ev-table td { padding: 5px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.replay-event-row { cursor: pointer; transition: background 0.1s; }
.replay-event-row:hover { background: var(--accent-soft); }
.replay-event-row.active { background: var(--bg-tertiary); }
.replay-event-row.future td { opacity: 0.4; }
.replay-ev-time { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--text-muted); }

.replay-badge { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.replay-badge-utbot    { background: #dde8d4; color: #3f6421; }
.replay-badge-signal   { background: #e8dff5; color: #5a3580; }
.replay-badge-decision { background: var(--bg-tertiary); color: #5c4a00; }
.replay-badge-telegram { background: #d4e8f5; color: #1a5a80; }
.replay-badge-command  { background: #f5e8d4; color: #7a4a1a; }
.replay-badge-trade    { background: #dde8d4; color: #1a5040; }

.replay-empty { padding: 12px; color: var(--text-muted); font-size: 13px; font-style: italic; }

.replay-csv-wrap { display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.replay-csv-btn { font-size: 12px; padding: 5px 10px; }
.replay-csv-area { font-family: monospace; font-size: 12px; width: 360px; }

.replay-legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; padding: 4px 0; }
.replay-legend-item { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-muted); }
/* UT Bot legend: thin tall band */
.replay-legend-dash   { display: inline-block; width: 4px; height: 12px; border-radius: 1px; opacity: 0.75; }
/* Trade legend: slightly wider */
.replay-legend-tbuy, .replay-legend-tsell { width: 5px; height: 14px; opacity: 0.9; }
/* Cursor: horizontal dash */
.replay-legend-cursor { width: 14px; height: 2px; opacity: 1; }
.replay-legend-utbuy   { background: #3f6421; }
.replay-legend-utsell  { background: #a0413e; }
.replay-legend-tbuy    { background: #1a5fa8; }
.replay-legend-tsell   { background: #c07800; }
.replay-legend-cursor  { background: #8b4513; }
.replay-legend-mtflong { background: #3f8c1a; opacity: 0.8; width: 18px; height: 9px; border-radius: 1px; }
.replay-legend-mtfshort{ background: #c0392b; opacity: 0.8; width: 18px; height: 9px; border-radius: 1px; }

.replay-sp-focused { border-left: 3px solid #d4a017; background: rgba(212,160,23,0.06); padding-left: 8px; border-radius: 0 4px 4px 0; }
/* Focused panel: signal-type border + tint */
.replay-sp-focused--buy   { border-left-color: #3f8c1a; background: rgba(63,140,26,0.07); }
.replay-sp-focused--sell  { border-left-color: #c0392b; background: rgba(192,57,43,0.07); }
.replay-sp-focused--tbuy  { border-left-color: #1a5fa8; background: rgba(26,95,168,0.07); }
.replay-sp-focused--tsell { border-left-color: #c07800; background: rgba(192,120,0,0.07); }
/* Focused panel headings */
.replay-sp-heading--buy   { color: #4caf2a; }
.replay-sp-heading--sell  { color: #e05040; }
.replay-sp-heading--tbuy  { color: #4a90d9; }
.replay-sp-heading--tsell { color: #e09020; }
/* UT Bot state row value colors */
.replay-sp-val--long  { color: #4caf2a; font-weight: 600; }
.replay-sp-val--short { color: #e05040; font-weight: 600; }
/* Speed select dropdown */
.replay-speed-sel { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); border-radius: 4px; padding: 3px 6px; font-size: 12px; cursor: pointer; max-width: 75px; min-width: 0; }
.replay-speed-sel:focus { outline: none; border-color: var(--accent); }

/* ── Day nav + LIVE button / label (P2/P3) ──────────────────────────── */
.replay-live-btn   { color: #c0392b; font-weight: 700; }
.replay-live-label { display: inline-block; font-size: 11px; font-weight: 700;
                     color: #fff; background: #c0392b; border-radius: 3px;
                     padding: 1px 6px; letter-spacing: 0.04em; }
/* display:inline-block above would override UA [hidden]; this rule restores it */
.replay-live-label[hidden] { display: none; }

/* ── Freshness / status badge bar (P4) ──────────────────────────────── */
.replay-status-bar   { display: flex; gap: 6px; align-items: center; padding: 3px 0 2px; flex-wrap: wrap; min-height: 24px; }
.replay-status-badge { font-size: 11px; font-weight: 600; border-radius: 10px; padding: 2px 9px; }
.replay-badge-fresh      { background: #dde8d4; color: #1a5040; }
.replay-badge-stale      { background: #f5e8d4; color: #7a3a00; }
.replay-badge-no-signals { background: #ebe0d0; color: #6b5a4a; }
.replay-badge-historical { background: #e8e0f0; color: #4a3a70; }

/* ── MTF band hover tooltip (P2) ────────────────────────────────────── */
.replay-mtf-tip {
  position: fixed; pointer-events: none; z-index: 9999;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 6px; box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  padding: 8px 10px; font-size: 12px; color: var(--text);
  min-width: 220px; max-width: 280px; display: none;
}
.mtip-head { font-weight: 700; font-size: 13px; margin-bottom: 6px; padding-bottom: 5px; border-bottom: 1px solid var(--border); }
.mtip-tbl  { width: 100%; border-collapse: collapse; }
.mtip-k    { color: var(--text-muted); padding: 1px 8px 1px 0; white-space: nowrap; vertical-align: top; }
.mtip-v    { font-weight: 600; text-align: right; padding: 1px 0; }
.mtip-mono { font-family: monospace; font-size: 11px; font-weight: 400; }
.mtip-sep-r td { padding: 3px 0 0; border-top: 1px solid var(--border); }

/* ── T212 import toggle + status (bug-fix session) ───────────────────── */
.replay-t212-toggle-lbl { font-size: 12px; cursor: pointer; user-select: none;
                          display: flex; align-items: center; gap: 4px; }
.replay-import-status   { font-size: 11px; color: var(--text-muted); font-style: italic;
                          align-self: center; }

/* ── Real-time event ticker ────────────────────────────────────────── */
.replay-ticker {
  display: flex; align-items: center; gap: 0; flex-wrap: nowrap;
  padding: 4px 12px; font-size: 12px; color: var(--text);
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 6px; white-space: nowrap; overflow: hidden;
  margin-bottom: 0;
}
.replay-ticker-sep  { color: var(--border); padding: 0 7px; user-select: none; }
.replay-ticker-lbl  { color: var(--text-muted); }
.replay-ticker-time { font-variant-numeric: tabular-nums; }
.replay-ticker-val  { font-variant-numeric: tabular-nums; }
.replay-ticker-val--long  { color: #4caf2a; font-weight: 700; }
.replay-ticker-val--short { color: #e05040; font-weight: 700; }
.replay-ticker-badge { display: inline-block; padding: 1px 6px; border-radius: 8px;
                       font-size: 11px; font-weight: 700; white-space: nowrap;
                       vertical-align: middle; }
.replay-ticker-badge--utbuy   { background: #dde8d4; color: #1a5040; }
.replay-ticker-badge--utsell  { background: #f5d5d5; color: #8b1c1c; }
.replay-ticker-badge--tbuy    { background: #d4e0f5; color: #1a3a80; }
.replay-ticker-badge--tsell   { background: #f5e8c0; color: #7a4a00; }
.replay-ticker-badge--decision { background: #ede0f5; color: #5a2080; }
.replay-ticker-badge--telegram { background: #d4e8f5; color: #1a5a80; }
.replay-ticker-badge--signal   { background: #e8dff5; color: #5a3580; }
.replay-ticker-badge--command  { background: #f5e8d4; color: #7a4a1a; }

@media (max-width: 800px) {
  .replay-body { flex-direction: column; }
  .replay-side-panel { width: 100%; max-height: none; }
  .replay-ticker { flex-wrap: wrap; }
}

/* ──── Guest / share mode (no auth) ──────────────────────────────────────── */
body.guest .sidebar,
body.guest .topbar,
body.guest #settings-panel { display: none !important; }

body.guest #app { grid-template-columns: 1fr; }

body.guest .main {
  max-width: 820px;
  margin: 0 auto;
  width: 100%;
}

body.guest .content { padding: 24px 20px; }

.guest-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  color: var(--text-muted);
  font-size: 13px;
}
.guest-brand strong { color: var(--text-heading); font-size: 15px; }

/* ──── Profilo / Memoria ─────────────────────────────────────────────────── */
.profile-memory-box {
  width: 100%;
  box-sizing: border-box;
  min-height: 260px;
  resize: vertical;
  font-family: "SF Mono", "Menlo", monospace;
  font-size: 13px;
  line-height: 1.7;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.usefulness-card {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 8px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  font-size: 14px;
  line-height: 1.65;
}

/* ──── Live Signals V2 REVIVED (chip categorizzati + expand/collapse + BTC vs MSTR) ── */
.live-card-v2 .live-card-head-v2 { gap:8px; align-items:center; cursor:default; }
.live-asset-name-v2 { user-select:none; }
.live-asset-name-v2:hover { color:var(--accent); }
.live-caret-v2 { font-size:14px; color:var(--text-muted); cursor:pointer; user-select:none; transition:transform .2s; }
/* Caret default = ▾ (expanded). Collapsed state rotates 180° → ▴ visual flip */
.live-card-v2:not(.live-card-expanded) .live-caret-v2 { transform:rotate(-90deg); opacity:0.6; }

/* V2: dots SEMPRE visibili (sono l'identità della pagina). Doppioni nascosti. */
.live-card-v2 .live-consensus,
.live-card-v2 .live-indicators,
.live-card-v2 .live-derivatives { display:none !important; }
/* In collapsed mode (rare — user click) nascondiamo anche dots labels under */
.live-card-v2:not(.live-card-expanded) .live-dot-age,
.live-card-v2:not(.live-card-expanded) .live-dot-flip { display:none; }

/* V2 chip row — usa full width, gap moderato */
.v2-chip-row { display:flex; flex-wrap:wrap; gap:8px; padding:10px 0 4px; align-items:center; }
.v2-chip { display:inline-flex; align-items:center; gap:7px; padding:5px 11px; border-radius:6px; font-size:12px; font-family:"SF Mono",monospace; border-left:3px solid var(--border); flex:0 0 auto; }
.v2-chip-label { font-size:10px; color:var(--text-muted); font-weight:700; letter-spacing:0.5px; }
.v2-chip-val { font-weight:700; font-size:13px; }

/* Countdown to next data refresh — discreet, monospace */
.v2-countdown {
  font-size:10px;
  font-family:"SF Mono","Menlo",monospace;
  color:var(--text-muted);
  opacity:0.55;
  margin-left:8px;
  font-variant-numeric:tabular-nums;
  cursor:help;
}

/* Equity session badge */
.v2-session-badge {
  display:inline-block;
  font-size:10px;
  font-weight:800;
  letter-spacing:0.6px;
  padding:2px 6px;
  border-radius:3px;
  margin-left:8px;
  font-family:"SF Mono",monospace;
  cursor:help;
}
.v2-session-regular { background:#d1fae5; color:#065f46; }
.v2-session-pre     { background:#fed7aa; color:#9a3412; }
.v2-session-after   { background:#e9d5ff; color:#6b21a8; }
.v2-session-closed  { background:#f3f4f6; color:#6b7280; }

/* Last regular close reference (only shown when not in regular session) */
.v2-last-close { font-size:11px; margin-left:8px; }

/* Market Quality meta-indicator (CHANGE 6) — calm aesthetic, sparse */
.v2-mq-slot { padding:8px 0 4px; }
.v2-mq {
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px 12px;
  border-radius:6px;
  border-left:4px solid var(--border);
  font-size:12px;
  max-width:100%;
}
.v2-mq-glyph { font-size:14px; font-weight:700; }
.v2-mq-label { font-weight:800; font-size:12px; letter-spacing:0.5px; }
.v2-mq-sub { color:var(--text-muted); font-size:11px; font-family:"SF Mono",monospace; }
.v2-mq-clean     { border-color:#3f6421; background:rgba(63,100,33,0.10);  color:#3f6421; }
.v2-mq-mixed     { border-color:#d4b94e; background:rgba(212,185,78,0.10); color:#5c4a00; }
.v2-mq-noisy     { border-color:#c07800; background:rgba(192,120,0,0.15);  color:#7a4d00; }
.v2-mq-dangerous { border-color:#c44;    background:rgba(204,68,68,0.20);  color:#7a1a1a; font-weight:700; }
/* 5 categories — Risk replaces Macro (CHANGE 2) */
.v2-chip-price     { border-color:#1a5fa8; background:rgba(26,95,168,0.06); }
.v2-chip-momentum  { border-color:#d4b94e; background:rgba(212,185,78,0.08); }
.v2-chip-volume    { border-color:#3f6421; background:rgba(63,100,33,0.06); }
.v2-chip-sentiment { border-color:#6b21a8; background:rgba(107,33,168,0.06); }
.v2-chip-risk      { border-color:#c07800; background:rgba(192,120,0,0.06); }

/* Expanded details box — visible only when card is expanded */
.v2-expanded-box { display:none; padding:8px 0; }
.live-card-expanded .v2-expanded-box { display:block; }
.v2-expanded { display:flex; flex-direction:column; gap:8px; }
.v2-cat { padding:8px 12px; border-radius:6px; border-left:3px solid var(--border); font-size:13px; }
.v2-cat-title { font-size:10px; font-weight:700; color:var(--text-muted); letter-spacing:0.4px; margin-bottom:4px; }
.v2-cat-body { line-height:1.6; }
.v2-cat-price { border-color:#1a5fa8; background:rgba(26,95,168,0.04); }
.v2-cat-risk  { border-color:#c07800; background:rgba(192,120,0,0.04); }

/* BTC vs MSTR sub-page */
.v2-header { display:flex; align-items:center; gap:12px; margin-bottom:14px; flex-wrap:wrap; }
.v2-btc-mstr-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-bottom:14px; }
.v2-big-tile { padding:16px; background:var(--bg-card); border:1px solid var(--border); border-radius:10px; }
.v2-corr-block { padding:14px 16px; border-radius:8px; background:var(--accent-soft); border-left:3px solid var(--accent); line-height:1.8; font-size:13px; }
@media (max-width:600px) {
  .v2-btc-mstr-grid { grid-template-columns:1fr; }
  .v2-chip { font-size:10px; padding:2px 6px; }
}

/* ──── MSTR Decision Console (V2) ────────────────────────────────────────── */
.console-header { display:flex; align-items:center; gap:12px; margin-bottom:16px; flex-wrap:wrap; }
.console-btn { font-size:12px; padding:6px 12px; }
.console-root { display:flex; flex-direction:column; gap:12px; max-width:760px; margin:0 auto; }
.console-setup { padding:16px 18px; border-radius:10px; border-left:6px solid var(--border-strong); background:var(--bg-card); }
.console-setup-head { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.console-label-badge { font-size:22px; font-weight:800; letter-spacing:0.6px; }
.console-arrow { font-size:20px; opacity:0.7; }
.console-action-badge { font-size:13px; font-weight:700; letter-spacing:0.4px; padding:4px 10px; border-radius:5px; background:rgba(0,0,0,0.08); }
.console-setup-meta { margin-top:8px; font-size:12px; color:var(--text-muted); }
.console-warnings { list-style:none; padding:0; margin:12px 0 6px; display:flex; flex-direction:column; gap:4px; }
.console-warn-item, .console-hard-item, .console-clean-item { display:flex; align-items:baseline; gap:8px; font-size:14px; }
.console-warn-icon { font-size:14px; flex-shrink:0; }
.console-warn-code { font-size:11px; font-family:"SF Mono",monospace; }
.console-reasoning { margin-top:10px; padding:8px 12px; border-left:2px solid var(--border); font-size:13px; font-style:italic; color:var(--text-muted); line-height:1.55; }
.console-setup-clean       { border-color:#16a34a; background:#d1fae5; }
.console-setup-mixed       { border-color:#f59e0b; background:#fef3c7; }
.console-setup-risky       { border-color:#dc2626; background:#fce7e7; }
.console-setup-extended    { border-color:#6b21a8; background:#ede9fe; }
.console-setup-low-quality { border-color:#000;    background:#f3f4f6; }
.console-setup-no-signal   { border-color:#9ca3af; background:#f9fafb; }
/* 🧭 Punto della Situazione */
.console-assessment { padding:14px 18px; border-radius:10px; border-left:6px solid var(--accent); background:var(--bg-card); }
.ca-head { display:flex; align-items:baseline; justify-content:space-between; gap:10px; flex-wrap:wrap; }
.ca-title { font-weight:700; font-size:15px; color:var(--text-heading); }
.ca-age { font-size:12px; }
.ca-text { margin-top:10px; font-size:14px; line-height:1.6; color:var(--text-primary); }
.ca-text strong { color:var(--text-heading); }
.ca-text.ca-dim { opacity:.6; }
.ca-controls { display:flex; gap:8px; flex-wrap:wrap; margin-top:12px; }
.ca-toggle, .ca-run { font-size:13px; padding:7px 14px; border-radius:8px; border:1px solid var(--border-strong); cursor:pointer; font-weight:600; }
.ca-toggle.on { background:#d1fae5; border-color:#16a34a; color:#065f46; }
.ca-toggle.off { background:var(--bg-secondary); color:var(--text-muted); }
.ca-run { background:var(--accent); color:#fff; border-color:var(--accent); }
.ca-run:disabled { opacity:.6; cursor:default; }
.ca-foot { margin-top:10px; font-size:11px; }

.console-btc-context { padding:10px 14px; border-radius:8px; display:flex; flex-direction:column; gap:4px; font-size:14px; }
.console-btc-label { font-weight:700; }
.console-btc-risk-on  { background:#d1fae5; color:#065f46; }
.console-btc-risk-off { background:#fce7e7; color:#991b1b; }
.console-btc-mixed    { background:#fef3c7; color:#92400e; }
.console-pair { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.console-asset-tile { padding:12px 14px; border-radius:8px; background:var(--bg-card); border:1px solid var(--border); }
.console-asset-name { font-size:14px; font-weight:700; color:var(--text-muted); }
.console-asset-price-row { display:flex; align-items:baseline; gap:10px; margin-top:4px; flex-wrap:wrap; }
.console-asset-price { font-size:20px; font-weight:700; }
.console-asset-change { font-size:13px; font-weight:600; }
.console-asset-tf { font-size:12px; margin-top:6px; font-weight:600; }
.console-ratio { padding:10px 14px; border-radius:8px; background:var(--bg-secondary); font-size:14px; }
.console-ratio-interp { margin-top:4px; font-size:12px; }
.console-mtf { padding:10px 14px; border-radius:8px; background:var(--bg-card); border:1px solid var(--border); }
.console-mtf-title { font-size:12px; font-weight:700; color:var(--text-muted); margin-bottom:8px; letter-spacing:0.5px; text-transform:uppercase; }
.console-mtf-row { display:grid; grid-template-columns:56px repeat(5,1fr); align-items:center; gap:6px; padding:4px 0; }
.console-mtf-header { font-size:11px; color:var(--text-muted); border-bottom:1px solid var(--border); }
.console-mtf-th { text-align:center; font-weight:600; }
.console-mtf-label { font-weight:700; font-size:13px; }
.console-mtf-cell { text-align:center; padding:6px 0; border-radius:4px; font-size:14px; font-weight:700; }
.console-mtf-long  { background:#22c55e; color:#fff; }
.console-mtf-short { background:#ef4444; color:#fff; }
.console-mtf-none  { background:#d1d5db; color:#6b7280; }
.live-banner-console { padding:8px 14px; margin-bottom:14px; background:var(--accent-soft); border-left:3px solid var(--accent); border-radius:6px; font-size:13px; }
@media (max-width:600px) {
  .console-pair { grid-template-columns:1fr; }
  .console-label-badge { font-size:18px; }
  .console-setup { padding:12px 14px; }
  .console-mtf-row { grid-template-columns:50px repeat(5,1fr); gap:4px; }
  .console-mtf-cell { padding:5px 0; font-size:13px; }
  .console-asset-price { font-size:17px; }
}

/* Live Signals docs collapsible */
.live-docs summary::-webkit-details-marker { display: none; }
.live-docs summary::marker { content: ""; }
.live-docs summary::before {
  content: "▶";
  display: inline-block;
  margin-right: 8px;
  transition: transform 0.2s;
}
.live-docs[open] summary::before { transform: rotate(90deg); }
.live-docs h3 { font-size: 14px; margin-top: 16px; }
.live-docs table th { background: var(--bg-secondary); }
.live-docs table td, .live-docs table th { border-bottom: 1px solid var(--border); }
.live-docs code {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: "SF Mono", monospace;
  font-size: 0.92em;
}

/* Timestamp links inside summaries/articles/transcripts */
.ts-link {
  display: inline-block;
  padding: 1px 6px;
  margin: 0 1px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent) !important;
  font-family: "SF Mono", "Menlo", monospace;
  font-size: 0.92em;
  font-weight: 600;
  text-decoration: none !important;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s;
}
.ts-link:hover {
  background: var(--accent);
  color: #fff !important;
  border-color: var(--accent);
}
.ts-link::before {
  content: "▶";
  font-size: 0.7em;
  margin-right: 4px;
  opacity: 0.7;
}

/* ──── Live Signals page ─────────────────────────────────────────────────── */
.live-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.live-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
}

.live-card-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.live-price {
  font-size: 22px;
  font-weight: 700;
}

/* Verde scuro per USD (riferimento US) */
.live-price-usd {
  color: #1a5fa8;
}

/* Granata per GBP (riferimento UK) */
.live-price-gbp {
  color: #a04000;
  font-size: 18px;
}

.live-change {
  font-size: 14px;
  font-weight: 600;
}

.live-up   { color: #16a34a; }
.live-down { color: #dc2626; }

.live-dots {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0 6px;
}

.live-dot-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 56px;
}

.live-dot-age {
  font-size: 10px;
  line-height: 1.3;
  margin-top: 3px;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.2px;
  font-variant-numeric: tabular-nums;
}

.live-dot-flip {
  font-size: 10px;
  line-height: 1.3;
  color: var(--text-muted);
  opacity: 0.75;
  font-family: "SF Mono", "Menlo", monospace;
  font-variant-numeric: tabular-nums;
}

.live-dot-age-active  { color: var(--text-heading); opacity: 1; }
.live-dot-flip-active { color: var(--text-primary); opacity: 0.85; }

.live-dot {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  cursor: help;
  transition: transform 0.1s;
  user-select: none;
}

.live-dot:hover { transform: scale(1.08); }

/* Repainting halo — pulsating yellow ring around dot whose live (in-formation)
   UT Bot state differs from the confirmed state. Warning: signal may flip. */
.live-dot-repaint {
  animation: live-pulse-repaint 1.6s ease-in-out infinite;
  position: relative;
}
@keyframes live-pulse-repaint {
  0%, 100% { box-shadow: 0 0 0 0 rgba(212, 185, 78, 0.85), inset 0 -2px 0 rgba(0,0,0,0.15); }
  50%      { box-shadow: 0 0 0 8px rgba(212, 185, 78, 0),    inset 0 -2px 0 rgba(0,0,0,0.15); }
}

.live-dot-long {
  background: #22c55e;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.2), 0 1px 3px rgba(34,197,94,0.3);
}
.live-dot-short {
  background: #ef4444;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.2), 0 1px 3px rgba(239,68,68,0.3);
}
.live-dot-nodata {
  background: #b8a384;
  color: rgba(255,255,255,0.7);
  opacity: 0.45;
}

.live-consensus {
  margin: 10px 0 14px;
  font-size: 16px;
  font-weight: 700;
}

.live-verdict-long  { color: #16a34a; }
.live-verdict-short { color: #dc2626; }

.live-indicators {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-secondary);
  border-radius: 8px;
}

.live-ind {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.live-ind-label {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.live-ind-val {
  font-weight: 600;
  font-family: "SF Mono", monospace;
}

.live-bb-bar {
  display: inline-block;
  width: 60px;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  position: relative;
  vertical-align: middle;
  margin-right: 4px;
}

/* Derivatives row — slightly different styling so it doesn't blend with indicators */
.live-derivatives {
  margin-top: 8px;
  background: rgba(139, 69, 19, 0.04);
  border: 1px dashed var(--border);
}

/* Fear & Greed chip in the page header */
.fng-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: 600;
  border: 1px solid;
  cursor: help;
  user-select: none;
}
.fng-extreme-fear  { background: #fce7e7; color: #991b1b; border-color: #fca5a5; }
.fng-fear          { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.fng-neutral       { background: #f3f4f6; color: #4b5563; border-color: #d1d5db; }
.fng-greed         { background: #d1fae5; color: #065f46; border-color: #6ee7b7; }
.fng-extreme-greed { background: #a7f3d0; color: #064e3b; border-color: #34d399; }
.live-bb-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #fff4d0 50%, #ef4444);
  border-radius: 4px;
}

@media (max-width: 800px) {
  .live-dot { width: 44px; height: 44px; font-size: 12px; }
  .live-dots { gap: 6px; }
}

/* ──── Compact view (toggle) ─────────────────────────────────────────────── */
body.live-compact .live-card { padding: 10px 14px; }
body.live-compact .live-card-head { margin-bottom: 6px; gap: 10px; }
body.live-compact .live-price { font-size: 16px; }
body.live-compact .live-price-gbp { font-size: 13px; }
body.live-compact .live-dot { width: 36px; height: 36px; font-size: 10px; }
body.live-compact .live-dot-age,
body.live-compact .live-dot-flip { font-size: 9px; line-height: 1.1; }
body.live-compact .live-indicators {
  padding: 6px 10px;
  font-size: 11px;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
}
body.live-compact .live-consensus { font-size: 13px; margin: 4px 0 6px; }
body.live-compact .live-dots { gap: 5px; margin: 6px 0 4px; }

/* ── Bottoni "Spiega" / "Distanza" sui valori della console ───────────────── */
.cx-btns { display: flex; gap: 8px; margin: 8px 0; }
.cx-btn { font-size: 12px; font-weight: 700; border: 1px solid var(--border-strong); background: transparent; color: var(--text-muted); padding: 5px 10px; border-radius: 8px; cursor: pointer; }
.cx-btn.cx-on { background: #ffb547; color: #2b1810; border-color: #ffb547; }
.cx-explain, .cx-dist { display: none; }
/* tap-to-open: tocca il valore per aprire la spiegazione (identico desktop/touch) */
body.show-explain .cx-row.cx-open .cx-explain { display: block; margin-top: 5px; font-size: 11.5px; color: var(--text-muted); line-height: 1.5; border-left: 2px solid var(--border-strong); padding-left: 8px; }
body.show-explain .cx-explain b { color: var(--text-primary); }
body.show-explain .cx-row { cursor: pointer; }
body.show-explain .cx-row .cx-lbl::after { content: " ⓘ"; color: #9a6b12; font-weight: 700; }
body.show-explain .cx-row.cx-open .cx-lbl::after { content: " ▲"; color: var(--text-muted); }
body.show-dist .cx-dist { display: block; margin-top: 5px; font-size: 12px; }
.cx-d { display: block; font-weight: 700; margin: 1px 0; }
.cx-d.up { color: #1a9d54; } .cx-d.dn { color: #c0392b; }
.cx-tail { color: var(--text-muted); font-size: 10px; font-weight: 400; margin-top: 2px; }
.cx-alert { background: rgba(255,181,71,.08); border: 1px solid rgba(255,181,71,.4); border-radius: 8px; padding: 9px 11px; margin-top: 10px; }
.cx-alert-h { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-bottom: 4px; }
.cx-alert .cx-d { color: var(--text-primary); }
.cx-nat { display: inline-block; font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 99px; margin-bottom: 4px; }
.cx-nat.fact { background: rgba(15,185,177,.16); color: #0a7d76; }
.cx-nat.heur { background: rgba(255,181,71,.18); color: #9a6b12; }

/* ── Live Signals: chip tap-to-open (Spiega/Distanza) ─────────────────────── */
.cx-chipdetail { display: none; flex-basis: 100%; width: 100%; margin: 2px 0 8px; padding: 8px 10px; background: rgba(0,0,0,.035); border-radius: 8px; }
.v2-chip.cx-open + .cx-chipdetail { display: block; }
.cx-chipdetail .cx-explain, .cx-chipdetail .cx-dist { display: none; }
body.show-explain .cx-chipdetail .cx-explain { display: block; font-size: 12px; color: var(--text-muted); line-height: 1.5; }
body.show-explain .cx-chipdetail .cx-explain b { color: var(--text-primary); }
body.show-dist .cx-chipdetail .cx-dist { display: block; font-size: 12px; margin-top: 6px; }
body.show-explain .v2-chip, body.show-dist .v2-chip { cursor: pointer; }
body.show-explain .v2-chip .v2-chip-label::after, body.show-dist .v2-chip .v2-chip-label::after { content: " ⓘ"; color: #9a6b12; font-weight: 700; font-size: 10px; }
.v2-chip.cx-open .v2-chip-label::after { content: " ▲"; color: var(--text-muted); }
.cx-since { font-size: 10px; color: var(--text-muted); font-weight: 400; white-space: nowrap; }
.cx-tr { font-weight: 700; } .cx-tr.up { color: #1a9d54; } .cx-tr.dn { color: #c0392b; }
/* ── Barrette verticali del range (min basso / max alto / tacca = prezzo ora) ── */
.range-gauges { display: flex; gap: 7px; align-items: center; flex: none; }
.gz { display: flex; flex-direction: column; align-items: center; width: 34px; }
.gz-max, .gz-min { font-size: 8.5px; color: var(--text-muted); line-height: 1.3; font-variant-numeric: tabular-nums; }
.gz-bar { position: relative; width: 13px; height: 50px; border: 1px solid var(--border-strong); border-radius: 3px; background: rgba(0,0,0,.03); margin: 1px 0; overflow: hidden; }
.gz-empty { opacity: .35; }
.gz-fill { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(139,69,19,.12); }
.gz-tick { position: absolute; left: -2px; right: -2px; height: 2px; background: var(--accent); border-radius: 2px; }
.gz-lbl { font-size: 9px; font-weight: 700; color: var(--text-muted); margin-top: 1px; }

/* ── Portfolio view ───────────────────────────────────────────── */
.pf-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 12px; }
.pf-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.pf-table thead th { text-align: left; padding: 9px 11px; background: rgba(139, 69, 19, 0.06);
  border-bottom: 1px solid var(--border-strong); font-weight: 600; white-space: nowrap; }
.pf-table td { padding: 8px 11px; border-bottom: 1px solid var(--border); }
.pf-table tbody tr.pf-alt { background: rgba(139, 69, 19, 0.045); }
.pf-table .pf-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pf-table thead th.pf-num { text-align: right; }
.pf-pos { color: var(--success-text); font-weight: 600; }
.pf-neg { color: var(--error-text); font-weight: 600; }
.pf-tag { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px;
  background: var(--accent-soft); color: var(--accent); border: 1px solid var(--border); }
.pf-note-row td { padding-top: 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.pf-totals { margin: 4px 0 18px; }
.pf-totals-inner { padding: 10px 13px; background: rgba(139, 69, 19, 0.05);
  border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
.pf-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.pf-in { padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px;
  background: var(--card, #fff); min-width: 150px; }
.pf-in-sm { min-width: 80px; max-width: 110px; }
.pf-btn { padding: 7px 14px; border-radius: 6px; cursor: pointer; }
.pf-btn-add { background: var(--accent); color: #fff; border: 1px solid var(--accent); }
.pf-mini { padding: 2px 6px; border: none; background: transparent; cursor: pointer; font-size: 14px; }
.pf-mini:hover { background: var(--accent-soft); border-radius: 4px; }

/* ── Portfolio capitale (pfd) ─────────────────────────────────── */
.pfd-badge { display:inline-block; padding:3px 10px; border-radius:99px; font-size:12px; font-weight:700;
  background: var(--error-bg); color: var(--error-text); vertical-align:middle; }
.pfd-grid { display:grid; gap:12px; }
.pfd-top { grid-template-columns:repeat(4,1fr); margin-bottom:14px; }
@media(max-width:720px){ .pfd-top{ grid-template-columns:repeat(2,1fr); } }
.pfd-card { background: rgba(139,69,19,0.045); border:1px solid var(--border); border-radius:12px; padding:14px; margin-bottom:14px; }
.pfd-acc-card { border-color: var(--accent); }
.pfd-k { color: var(--text-muted); font-size:11px; text-transform:uppercase; letter-spacing:.04em; }
.pfd-v { font-size:22px; font-weight:700; margin-top:4px; }
.pfd-pos { color: var(--success-text); font-weight:600; }
.pfd-neg { color: var(--error-text); font-weight:600; }
.pfd-tbl { width:100%; border-collapse:collapse; margin-top:8px; }
.pfd-tbl th, .pfd-tbl td { text-align:right; padding:6px 9px; border-bottom:1px solid var(--border); font-variant-numeric:tabular-nums; }
.pfd-tbl th:first-child, .pfd-tbl td:first-child { text-align:left; }
.pfd-tbl th { color: var(--text-muted); font-size:11px; text-transform:uppercase; font-weight:600; }
.pfd-acc-h { display:flex; justify-content:space-between; align-items:baseline; margin-bottom:2px; }
.pfd-lad .pfd-now { background: var(--accent-soft); }
.pfd-note { background: rgba(139,69,19,0.05); border:1px solid var(--border); border-radius:8px; padding:8px 12px; font-size:12px; color: var(--text-muted); margin:10px 0 14px; }
.pfd-warn { background: var(--error-bg); border:1px solid var(--error-text); border-radius:8px; padding:8px 12px; font-size:12px; color: var(--error-text); margin-bottom:12px; }
.pfd-cxbtns { display:flex; gap:8px; margin-bottom:14px; }
.pfd-cxbtns button { background:#e8ddc8; color: var(--text-muted); border:1px solid var(--border); padding:6px 12px; border-radius:8px; cursor:pointer; font-weight:600; }
.pfd-cxbtns button.on { background: var(--accent); color:#fff; border-color: var(--accent); }
.pfd-in { background: var(--card,#fff); border:1px solid var(--border); color: var(--fg,inherit); border-radius:6px; padding:3px 6px; width:84px; text-align:right; }
.pfd-btn { background: var(--accent); border:0; color:#fff; padding:5px 12px; border-radius:8px; font-weight:700; cursor:pointer; margin-left:6px; }
.pfd .cx-explain { display:none; margin-top:8px; font-size:12px; color: var(--text-muted); line-height:1.55; border-left:2px solid var(--border-strong); padding-left:9px; }
body.show-explain .pfd .cx-explain { display:block; }
.pfd .cx-dist { display:none; }
body.show-dist .pfd .cx-dist { display:inline; }

/* ══════════════════════════════════════════════════════════════════
   Vista 📉 Aldo — trade reali
   ══════════════════════════════════════════════════════════════════ */
.al-win { color:#1a9d5a; }
.al-loss { color:#d1435b; }
.al-flat { color: var(--text-muted); }
.al-sub { font-size:11px; color: var(--text-muted); margin-top:3px; }
.al-tiny { font-size:10.5px; color: var(--text-muted); }
.al-mono { font-variant-numeric: tabular-nums; }
.al-tag { display:inline-block; padding:1px 7px; border-radius:5px; font-size:11px; font-weight:700; }
.al-tag.al-btc { background:#f7931a22; color:#c9781a; }
.al-tag.al-eth { background:#627eea22; color:#5a72d6; }
.al-tag.al-tao { background:#12b98122; color:#0f9d6b; }
.al-dir { font-size:11px; font-weight:600; }
.al-dir.al-long { color:#1a9d5a; }
.al-dir.al-short { color:#d1435b; }
.al-open { color:#c9781a; font-weight:600; }
.al-openrow { opacity:.62; }
/* vinti = leggero grassetto · persi = leggermente sbiaditi (colpo d'occhio) */
.al-winrow td { font-weight:600; }
.al-lossrow { opacity:.5; }
.al-lossrow td { font-weight:400; }
.al-berow { opacity:.72; }
/* Fonte + link */
.al-srccell { white-space:nowrap; }
.al-src { display:inline-block; padding:1px 6px; border-radius:5px; font-size:10.5px; font-weight:700; }
.al-src.al-both { background:#1a9d5a22; color:#158049; }
.al-src.al-tmonly { background: var(--card-alt,#eee); color: var(--text-muted); }
.al-lnk { font-size:11px; color: var(--accent); text-decoration:none; margin-left:5px; white-space:nowrap; }
.al-lnk:hover { text-decoration:underline; }
.al-month td:first-child { font-weight:600; }
/* barra filtro fonte */
.al-srcbar { display:flex; gap:8px; margin:0 0 14px; flex-wrap:wrap; }
.al-sbtn { background: var(--card,#fff); color: var(--text-muted); border:1px solid var(--border); border-radius:9px; padding:7px 14px; cursor:pointer; font-weight:700; font-size:13px; }
.al-sbtn span { display:inline-block; min-width:18px; margin-left:5px; padding:0 6px; border-radius:99px; background: var(--card-alt,#eee); font-size:11px; }
.al-sbtn.on { background: var(--accent); color:#fff; border-color: var(--accent); }
.al-sbtn.on span { background: rgba(255,255,255,.25); }
.al-src.al-yt { background:#12b98122; color:#0f9d6b; }
.al-clo { color: var(--text-muted); font-size:11px; }
.al-upd { color:#c9781a; font-size:11px; }
.al-chart { display:block; margin:2px 0; }
.al-baseline { stroke: var(--border-strong,#bbb); stroke-width:1; stroke-dasharray:4 4; }
.al-eqline { fill:none; stroke:#1a9d5a; stroke-width:2; stroke-linejoin:round; stroke-linecap:round; }
.al-conc { margin-top:8px; font-size:12px; color: var(--text-muted); line-height:1.5; background: var(--card-alt,#f6efe0); border-radius:8px; padding:8px 11px; }
.al-splits { grid-template-columns: repeat(auto-fit,minmax(210px,1fr)); }
.al-mini th, .al-mini td { padding:4px 7px; font-size:12px; }
.al-tbl { font-size:12.5px; }
.al-tbl td, .al-tbl th { white-space:nowrap; }
.al-toggle { display:inline-flex; gap:0; border:1px solid var(--border); border-radius:8px; overflow:hidden; }
.al-tbtn { background:transparent; color: var(--text-muted); border:0; padding:5px 11px; cursor:pointer; font-weight:600; font-size:12px; }
.al-tbtn.on { background: var(--accent); color:#fff; }
.al-caveat { border-left:3px solid #d1435b; }
.al-caveats { margin:6px 0 8px; padding-left:18px; font-size:12.5px; line-height:1.6; color: var(--fg,inherit); }
.al-caveats li { margin-bottom:5px; }

/* ══════════════════════════════════════════════════════════════════
   TEMA "Handwritten" — bianco/ink nero, font scritto a mano moderno.
   Attivato da body/html.theme-hand (toggle ✍️). Font di sistema → offline-safe.
   ══════════════════════════════════════════════════════════════════ */
html.theme-hand {
  --bg-primary: #ffffff;
  --bg-secondary: #f6f6f4;
  --bg-tertiary: #f0efec;
  --bg-card: #ffffff;
  --text-primary: #16130f;
  --text-heading: #000000;
  --text-muted: #6a6a66;
  --accent: #111111;
  --accent-hover: #3a3a3a;
  --accent-soft: rgba(0, 0, 0, 0.05);
  --border: #e6e5e1;
  --border-strong: #cbcac4;
  --warning-bg: #fff8e6;
  --success-bg: #e8f3ea;
  --success-text: #1a7f37;
  --error-bg: #fbe9e7;
  --error-text: #c62828;
}
/* font pulito e leggibile (Avenir Next → fallback moderni di sistema, offline-safe) */
html.theme-hand body,
html.theme-hand button,
html.theme-hand input,
html.theme-hand select,
html.theme-hand textarea {
  font-family: "Avenir Next", "Avenir", "Segoe UI", system-ui,
               -apple-system, "Helvetica Neue", Arial, sans-serif;
  letter-spacing: .1px;
}
html.theme-hand body { font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
html.theme-hand h1, html.theme-hand h2, html.theme-hand h3 { letter-spacing: -.2px; font-weight: 700; }
/* tocco moderno: bordi sottili, ombre leggere, un po' più d'aria */
html.theme-hand .card,
html.theme-hand .pfd-card,
html.theme-hand .video-table-wrap,
html.theme-hand .pf-table-wrap {
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
html.theme-hand .sidebar { background: #fafafa; border-right: 1px solid var(--border); }
html.theme-hand .sidebar-nav a.active { background: #111; color: #fff; }
html.theme-hand a { text-decoration: none; border-bottom: 1px solid rgba(0,0,0,.25); }
html.theme-hand a:hover { border-bottom-color: #000; }
/* ...ma NON quelli di navigazione: la riga qui sopra prende ogni <a> della
   pagina, colonna a sinistra compresa, e la trasforma in un elenco di link
   sottolineati appiccicati. Nella colonna i link sono bottoni, non testo. */
html.theme-hand .sidebar-nav a,
html.theme-hand .sidebar-nav a:hover,
html.theme-hand .topnav a,
html.theme-hand .sidebar-footer a { border-bottom: none; }
html.theme-hand .sidebar-nav a { margin-bottom: 1px; }
/* i blocchi codice/transcript restano leggibili (monospazio), non scritti a mano */
html.theme-hand pre, html.theme-hand code, html.theme-hand .mtip-mono { font-family: ui-monospace, "SF Mono", Menlo, monospace !important; letter-spacing: 0; }
/* bottone toggle tema */
#theme-toggle { margin-top: 6px; width: 100%; }

/* ══════════════════════════════════════════════════════════════════════════
   📉 Aldo — vista trade, versione tabellare "da report"
   Prefisso alx- per non collidere con le vecchie regole al-.
   ══════════════════════════════════════════════════════════════════════════ */
.alx { max-width: 1180px; margin: 0 auto; }
.alx-head { display:flex; align-items:baseline; gap:10px; flex-wrap:wrap; margin-bottom:2px; }
.alx-head h1 { margin:0; font-size:22px; letter-spacing:-.01em; }
.alx-when { font-size:11.5px; color:var(--text-muted); }

/* ── pannello verdetto ─────────────────────────────────────────────────── */
.alx-verdict { border:1px solid var(--warning-border); background:var(--warning-bg);
  border-radius:10px; padding:14px 16px; margin:12px 0 18px; }
.alx-verdict h2 { margin:0 0 6px; font-size:14px; letter-spacing:.02em; text-transform:uppercase; color:var(--warning-text); }
.alx-verdict p { margin:0 0 8px; font-size:13.5px; line-height:1.5; }
.alx-verdict p:last-child { margin-bottom:0; }
.alx-verdict b { color:var(--text-heading); }

/* ── KPI ───────────────────────────────────────────────────────────────── */
.alx-kpis { display:grid; grid-template-columns:repeat(auto-fit,minmax(158px,1fr)); gap:10px; margin-bottom:8px; }
.alx-kpi { border:1px solid var(--border); border-radius:9px; background:var(--bg-card); padding:10px 12px; }
.alx-kpi .k { font-size:10.5px; text-transform:uppercase; letter-spacing:.05em; color:var(--text-muted); font-weight:600; }
.alx-kpi .v { font-size:24px; font-weight:700; line-height:1.15; margin-top:3px; font-variant-numeric:tabular-nums; }
.alx-kpi .s { font-size:11px; color:var(--text-muted); margin-top:2px; line-height:1.35; }
.alx-groupttl { font-size:11px; text-transform:uppercase; letter-spacing:.06em; color:var(--text-muted);
  font-weight:700; margin:16px 0 6px; padding-bottom:3px; border-bottom:1px solid var(--border); }

/* ── tabelle ricche ────────────────────────────────────────────────────── */
.alx-panel { border:1px solid var(--border); border-radius:10px; background:var(--bg-card);
  padding:0; margin-bottom:16px; overflow:hidden; }
.alx-panel > .ph { padding:11px 14px; border-bottom:1px solid var(--border); background:var(--bg-secondary); }
.alx-panel > .ph b { font-size:13.5px; }
.alx-panel > .ph .sub { font-size:11.5px; color:var(--text-muted); margin-top:2px; line-height:1.4; }
.alx-scroll { overflow-x:auto; }

table.alx-t { width:100%; border-collapse:collapse; font-size:13px; }
table.alx-t th, table.alx-t td {
  padding:7px 10px; text-align:right; font-variant-numeric:tabular-nums;
  border-bottom:1px solid var(--border); border-right:1px solid var(--border);
  white-space:nowrap; }
table.alx-t th:last-child, table.alx-t td:last-child { border-right:0; }
table.alx-t th:first-child, table.alx-t td:first-child { text-align:left; }
table.alx-t td.l, table.alx-t th.l { text-align:left; }
table.alx-t td.c, table.alx-t th.c { text-align:center; }
table.alx-t thead th {
  position:sticky; top:0; z-index:2; background:var(--bg-secondary);
  font-size:10.5px; text-transform:uppercase; letter-spacing:.04em; font-weight:700;
  color:var(--text-muted); border-bottom:2px solid var(--border-strong); }
table.alx-t tbody tr:nth-child(even of :not(.alx-det)) { background:rgba(0,0,0,.018); }
table.alx-t tbody tr:hover { background:var(--accent-soft); }
table.alx-t tfoot td { font-weight:700; border-top:2px solid var(--border-strong);
  background:var(--bg-secondary); border-bottom:0; }
table.alx-t th.sortable { cursor:pointer; user-select:none; }
table.alx-t th.sortable:hover { color:var(--text-heading); }
table.alx-t th .arw { opacity:.35; font-size:9px; margin-left:2px; }
table.alx-t th.on .arw { opacity:1; }

/* righe della tabella trade */
tr.alx-r { cursor:pointer; }
tr.alx-r.win  td:first-child { box-shadow:inset 3px 0 0 #1a9d5a; }
tr.alx-r.loss td:first-child { box-shadow:inset 3px 0 0 #d1435b; }
tr.alx-r.be   td:first-child { box-shadow:inset 3px 0 0 var(--text-muted); }
tr.alx-r.open td:first-child { box-shadow:inset 3px 0 0 #c9781a; }
tr.alx-r.nonum { color:var(--text-muted); }
tr.alx-det > td { background:var(--bg-secondary); padding:12px 16px; white-space:normal;
  text-align:left; border-bottom:2px solid var(--border-strong); }
.alx-det dl { display:grid; grid-template-columns:auto 1fr; gap:4px 14px; margin:0; font-size:12.5px; }
.alx-det dt { color:var(--text-muted); font-weight:600; }
.alx-det dd { margin:0; }
.alx-note { font-size:12.5px; line-height:1.5; margin-bottom:8px; }

/* pill / badge */
.alx-p { display:inline-block; padding:1px 7px; border-radius:5px; font-size:11px; font-weight:700; line-height:1.6; }
.alx-p.btc{background:#f7931a22;color:#a35f10} .alx-p.eth{background:#627eea22;color:#4a5eb8}
.alx-p.tao{background:#12b98122;color:#0c7a55} .alx-p.sol{background:#9945ff22;color:#6b2fb5}
.alx-p.alt{background:var(--bg-secondary);color:var(--text-muted)}
.alx-p.long{background:#1a9d5a1c;color:#158049} .alx-p.short{background:#d1435b1c;color:#b03146}
.alx-p.ok{background:#1a9d5a1c;color:#158049} .alx-p.ko{background:#d1435b1c;color:#b03146}
.alx-p.mid{background:var(--bg-secondary);color:var(--text-muted)}
.alx-p.warn{background:#d4b94e33;color:#7a6410}
.alx-w{color:#1a9d5a;font-weight:600} .alx-l{color:#d1435b;font-weight:600} .alx-m{color:var(--text-muted)}
.alx-nd { color:var(--text-muted); font-style:italic; font-size:11.5px; }

/* barra di copertura */
.alx-bar { display:inline-block; width:78px; height:8px; border-radius:4px;
  background:var(--border); overflow:hidden; vertical-align:middle; }
.alx-bar > i { display:block; height:100%; background:#1a9d5a; }
.alx-bar.low > i { background:#d1435b; }
.alx-bar.mid > i { background:#d4a017; }

/* filtri */
.alx-filters { display:flex; gap:8px; flex-wrap:wrap; align-items:center;
  padding:10px 14px; border-bottom:1px solid var(--border); background:var(--bg-primary); }
.alx-filters select, .alx-filters input {
  font:inherit; font-size:12.5px; padding:4px 8px; border:1px solid var(--border);
  border-radius:6px; background:var(--bg-card); color:var(--text-primary); }
.alx-filters input { min-width:150px; }
.alx-filters label { font-size:11px; text-transform:uppercase; letter-spacing:.04em;
  color:var(--text-muted); font-weight:600; }
.alx-count { margin-left:auto; font-size:12px; color:var(--text-muted); font-variant-numeric:tabular-nums; }
.alx-tabs { display:flex; gap:6px; }
.alx-tab { font:inherit; font-size:12.5px; padding:5px 12px; border:1px solid var(--border);
  border-radius:7px; background:var(--bg-card); color:var(--text-primary); cursor:pointer; }
.alx-tab.on { background:var(--accent); border-color:var(--accent); color:#fff; font-weight:600; }
.alx-tab span { opacity:.65; margin-left:4px; font-variant-numeric:tabular-nums; }
.alx-tab.on span { opacity:.85; }

.alx-lnk { color:var(--accent); text-decoration:none; font-size:11.5px; white-space:nowrap; }
.alx-lnk:hover { text-decoration:underline; }
.alx-foot { font-size:11.5px; color:var(--text-muted); line-height:1.55; padding:10px 14px; }
.alx-caveats { margin:0; padding-left:18px; font-size:12.5px; line-height:1.6; }
.alx-caveats li { margin-bottom:6px; }
.alx-caveats li:last-child { margin-bottom:0; }

@media (max-width:640px){
  .alx-head h1 { font-size:19px; }
  table.alx-t { font-size:12px; }
  table.alx-t th, table.alx-t td { padding:6px 7px; }
  .alx-kpi .v { font-size:20px; }
  .alx-filters { gap:6px; }
  .alx-filters input { min-width:110px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   📐 Livelli di riferimento — le linee che i trader tracciano sul grafico
   (aperture, massimi/minimi del lunedì, settimana e mese precedenti).
   Prefisso lvr-. Stessa impostazione da report delle tabelle alx-: bordi su
   ogni colonna, intestazione fissa, numeri tabulari.
   ⚠️ I valori sono in USD e lo dicono in chiaro: il portafoglio è in GBP.
   ══════════════════════════════════════════════════════════════════════════ */
.lvr { font-size:13px; }
.lvr-h { display:flex; align-items:baseline; gap:9px; flex-wrap:wrap; margin-bottom:8px; }
.lvr-h b { font-size:13.5px; }
.lvr-when { font-size:11.5px; color:var(--text-muted); }
/* la tabella scorre DENTRO il suo riquadro: da telefono la pagina non si
   sposta di lato. Senza il min-width:0 la griglia del diario la lascia
   sbordare invece di stringerla. */
.lvr-scroll { overflow-x:auto; min-width:0; border:1px solid var(--border); border-radius:9px; }
table.lvr-t { width:100%; border-collapse:collapse; font-size:12.5px; }
table.lvr-t th, table.lvr-t td {
  padding:6px 10px; text-align:right; font-variant-numeric:tabular-nums;
  border-bottom:1px solid var(--border); border-right:1px solid var(--border);
  white-space:nowrap; }
table.lvr-t th:last-child, table.lvr-t td:last-child { border-right:0; }
table.lvr-t tr:last-child td { border-bottom:0; }
table.lvr-t td.l, table.lvr-t th.l { text-align:left; }
table.lvr-t thead th {
  position:sticky; top:0; z-index:2; background:var(--bg-secondary);
  font-size:10px; text-transform:uppercase; letter-spacing:.04em; font-weight:700;
  color:var(--text-muted); border-bottom:2px solid var(--border-strong); }
table.lvr-t tbody tr:hover { background:var(--accent-soft); }
/* il prezzo, infilato nella scala al posto giusto: si vede a colpo d'occhio
   quali livelli stanno sopra e quali sotto */
table.lvr-t tr.lvr-px td { background:var(--bg-secondary); border-top:2px solid var(--border-strong);
  border-bottom:2px solid var(--border-strong); }
.lvr-sw { display:inline-flex; gap:4px; }
.lvr-sb { font:inherit; font-size:11px; font-weight:700; padding:1px 8px; border:1px solid var(--border);
  border-radius:6px; background:var(--bg-card); color:var(--text-muted); cursor:pointer; }
.lvr-sb:hover { border-color:var(--accent); color:var(--accent); }
.lvr-sb.on { background:var(--accent); border-color:var(--accent); color:#fff; }
.lvr-g { display:block; font-size:10.5px; color:var(--text-muted); font-weight:400; margin-top:1px; }
.lvr-su { color:#1a9d5a; font-weight:600; }
.lvr-giu { color:#d1435b; font-weight:600; }
.lvr-m { color:var(--text-muted); }
.lvr-note { font-size:11.5px; line-height:1.55; color:var(--text-muted); margin-top:8px; }
.lvr-note b { color:var(--text-heading); }
.lvr-avviso { font-size:11.5px; line-height:1.5; margin-top:8px; padding:7px 10px;
  border:1px solid var(--warning-border); background:var(--warning-bg);
  color:var(--warning-text); border-radius:8px; }
.lvr-vuoto { font-size:12.5px; color:var(--text-muted); line-height:1.5; }
.lvr-come { margin-top:6px; }
.lvr-come > summary { cursor:pointer; font-size:11.5px; color:var(--text-muted); }
.lvr-come > summary:hover { color:var(--accent); }
.lvr-come p { font-size:11.5px; line-height:1.55; color:var(--text-muted); margin:6px 0 0; }

@media (max-width:640px){
  table.lvr-t { font-size:11.5px; }
  table.lvr-t th, table.lvr-t td { padding:5px 7px; }
}

/* pulsante "copia link" nell'intestazione Aldo */
.alx-head { justify-content: flex-start; }
.alx-share {
  font: inherit; font-size: 12.5px; font-weight: 600; margin-left: auto;
  padding: 5px 12px; border: 1px solid var(--border); border-radius: 7px;
  background: var(--bg-card); color: var(--text-primary); cursor: pointer;
  white-space: nowrap; transition: background .15s, border-color .15s, color .15s;
}
.alx-share:hover { background: var(--accent-soft); border-color: var(--border-strong); }
.alx-share.done { background: #1a9d5a; border-color: #1a9d5a; color: #fff; }
@media (max-width: 640px) { .alx-share { margin-left: 0; } }

/* schede Bybit dentro il dettaglio di un trade */
.alx-foto { display:flex; flex-wrap:wrap; gap:8px; margin-top:7px; }
.alx-foto a { display:block; line-height:0; border:1px solid var(--border); border-radius:8px;
  overflow:hidden; background:var(--bg-secondary); transition:border-color .15s, transform .15s; }
.alx-foto a:hover { border-color:var(--accent); transform:translateY(-1px); }
.alx-foto img { display:block; width:150px; height:auto; max-height:190px; object-fit:cover; object-position:top left; }
@media (max-width:640px){ .alx-foto img { width:118px; max-height:150px; } }

/* ── visore foto a comparsa ─────────────────────────────────────────────── */
.alx-foto button.alx-fbtn { padding:0; border:1px solid var(--border); border-radius:8px; overflow:hidden;
  background:var(--bg-secondary); cursor:zoom-in; line-height:0; transition:border-color .15s, transform .15s; }
.alx-foto button.alx-fbtn:hover { border-color:var(--accent); transform:translateY(-1px); }

.fvis { position:fixed; inset:0; z-index:9999; display:none; align-items:center; justify-content:center;
  background:rgba(20,12,6,.78); backdrop-filter:blur(3px); padding:22px; }
.fvis.on { display:flex; }
.fvis-box { background:var(--bg-primary); border:1px solid var(--border-strong); border-radius:14px;
  box-shadow:0 18px 50px rgba(0,0,0,.4); max-width:min(94vw,940px); max-height:92vh;
  display:flex; flex-direction:column; overflow:hidden; }
.fvis-top { display:flex; align-items:center; gap:10px; padding:9px 12px;
  border-bottom:1px solid var(--border); background:var(--bg-secondary); }
.fvis-tit { flex:1; font-size:13px; font-weight:600; font-variant-numeric:tabular-nums; }
.fvis-apri, .fvis-x { border:1px solid var(--border); background:var(--bg-card); color:var(--text-primary);
  border-radius:7px; cursor:pointer; font:inherit; font-size:14px; line-height:1; padding:5px 9px; text-decoration:none; }
.fvis-apri:hover, .fvis-x:hover { border-color:var(--accent); color:var(--accent); }
.fvis-img { flex:1; overflow:auto; display:flex; align-items:center; justify-content:center; padding:10px; }
.fvis-img img { max-width:100%; max-height:72vh; display:block; border-radius:8px; }
.fvis-bot { display:flex; align-items:center; justify-content:center; gap:16px; padding:8px 12px;
  border-top:1px solid var(--border); background:var(--bg-secondary); }
.fvis-n { font-size:12px; color:var(--text-muted); font-variant-numeric:tabular-nums; min-width:64px; text-align:center; }
.fvis-nav { border:1px solid var(--border); background:var(--bg-card); color:var(--text-primary);
  border-radius:8px; cursor:pointer; font:inherit; font-size:19px; line-height:1; padding:2px 13px 5px; }
.fvis-nav:hover { border-color:var(--accent); color:var(--accent); }
@media (max-width:640px){ .fvis { padding:10px; } .fvis-img img { max-height:64vh; } }
.alx-foto button.alx-fbtn.letta { border-color:#1a9d5a; box-shadow:inset 0 0 0 1px #1a9d5a44; }

/* ── diario: le giornate ricostruite dall'archivio ──────────────────────── */
.dia .autotag { font-size:10.5px; text-transform:uppercase; letter-spacing:.05em; font-weight:700;
  color:var(--text-muted); border:1px solid var(--border); border-radius:20px; padding:2px 9px; }
.dia .autolist { display:flex; flex-direction:column; gap:8px; margin-top:6px; }
.dia .autov { border-left:3px solid var(--border); padding:5px 0 5px 10px; }
.dia .autov .ah { display:flex; align-items:baseline; gap:8px; flex-wrap:wrap; }
.dia .autov .voto { font-size:11px; font-weight:800; border-radius:5px; padding:1px 6px; min-width:22px; text-align:center; }
.dia .autov .voto.vhi { background:#1a9d5a22; color:#158049; }
.dia .autov .voto.vmd { background:#d4b94e33; color:#7a6410; }
.dia .autov .voto.vlo { background:var(--bg-secondary); color:var(--text-muted); }
.dia .autov .can { font-size:11.5px; color:var(--text-muted); font-weight:600; }
.dia .autov .ttl { font-size:13.5px; font-weight:600; text-decoration:none; color:var(--text-primary); flex:1; min-width:180px; }
.dia .autov .ttl:hover { color:var(--accent); text-decoration:underline; }
.dia .autov .yt { font-size:12px; text-decoration:none; color:var(--accent); }
.dia .autov .ver { font-size:12px; color:var(--text-muted); line-height:1.5; margin-top:2px; }
.dia .autoas { margin-bottom:9px; }
.dia .autolv { display:flex; flex-wrap:wrap; gap:5px; margin-top:4px; }
.dia .lvchip { font-size:12px; font-variant-numeric:tabular-nums; background:var(--bg-secondary);
  border:1px solid var(--border); border-radius:6px; padding:2px 7px; cursor:default; }
.dia .lvchip i { font-style:normal; font-size:10px; color:var(--accent); font-weight:700; margin-left:3px; }

/* Il diario da telefono: le colonne della griglia devono potersi restringere,
   altrimenti il calendario (7 celle con aspect-ratio) allarga tutto e SAB/DOM
   finiscono fuori schermo. `min-width:0` è la cura standard per grid/flex. */
.dia .diacols, .dia .diacols > * { min-width: 0; }
.dia .calgrid { min-width: 0; }
.dia .cald { min-width: 0; font-size: clamp(10px, 3vw, 12px); }
.dia .autolist, .dia .autov, .dia .autov .ah { min-width: 0; }
.dia .autov .ttl { overflow-wrap: anywhere; }
@media (max-width: 420px) {
  .dia .cald.hdr { font-size: 8.5px; letter-spacing: 0; }
  .dia .lvchip { font-size: 11px; padding: 2px 5px; }
}

/* ── barra laterale a gruppi apribili ───────────────────────────────────────
   29 voci in fila non si leggono. I gruppi usano <details>, così funzionano
   anche senza JS e da tastiera; il gruppo che contiene la pagina aperta si
   apre da solo, e lo stato aperto/chiuso resta fra una visita e l'altra.     */
.sidebar-nav .grp { margin: 1px 0; }
.sidebar-nav .grp > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 6px;
  padding: 7px 10px; border-radius: 8px; font-size: 13px; font-weight: 600;
  color: var(--text-primary); transition: background .12s;
}
.sidebar-nav .grp > summary::-webkit-details-marker { display: none; }
.sidebar-nav .grp > summary::after {
  content: "›"; margin-left: auto; font-size: 15px; line-height: 1;
  color: var(--text-muted); transition: transform .15s;
}
.sidebar-nav .grp[open] > summary::after { transform: rotate(90deg); }
.sidebar-nav .grp > summary:hover { background: var(--accent-soft); }
.sidebar-nav .grp[open] > summary { color: var(--text-heading); }
/* i figli rientrati, con una guida verticale che li tiene insieme */
.sidebar-nav .grp > a {
  margin-left: 10px; padding-left: 12px;
  border-left: 1px solid var(--border); font-size: 12.5px;
}
.sidebar-nav .grp > a:first-of-type { margin-top: 1px; }
/* il gruppo che contiene la pagina aperta si fa notare anche da chiuso */
.sidebar-nav .grp.dentro > summary { background: var(--accent-soft); color: var(--text-heading); }
.sidebar-nav .grp.dentro > summary::before {
  content: ""; width: 4px; height: 4px; border-radius: 50%;
  background: var(--accent); flex: 0 0 auto;
}
.sidebar-nav a.solo { font-weight: 600; }

/* ──── 🧭 Il Quadro ─────────────────────────────────────────────────────── */
.qdr .qsub{color:var(--text-muted);margin:2px 0 18px;max-width:62ch;line-height:1.5}
.qdr .qgen{color:var(--text-muted);font-size:.82rem}
.qdr .sec{margin:26px 0 10px;font-size:1.05rem;border-bottom:1px solid var(--border);padding-bottom:6px}
.qdr .qgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:10px}
.qdr .qcard{border:1px solid var(--border);border-radius:10px;padding:10px 12px;background:var(--bg-secondary)}
.qdr .qa{font-size:.78rem;color:var(--text-muted);letter-spacing:.04em}
.qdr .qp{font-size:1.25rem;font-weight:700;margin:2px 0}
.qdr .qut{font-size:.8rem;font-weight:600}

.qdr .qev{border:1px solid var(--border);border-left:3px solid var(--acc,#f7931a);border-radius:8px;
  padding:10px 12px;margin-bottom:8px;background:var(--bg-secondary)}
.qdr .qev.qold{opacity:.5;border-left-color:var(--text-muted)}
.qdr .qevh{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap}
.qdr .qevd{color:var(--text-muted);font-size:.82rem;font-variant-numeric:tabular-nums}
.qdr .qevc{margin-left:auto;font-size:.82rem;font-weight:700;color:var(--text-muted)}
.qdr .qevc.qnow{color:var(--acc,#f7931a)}
.qdr .qevb{margin-top:6px;line-height:1.5}
.qdr .qevf{margin-top:6px;font-size:.78rem;color:var(--text-muted)}

.qdr .qfilt{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin:0 0 12px;
  font-size:.82rem;color:var(--text-muted)}
.qdr .qbtn{border:1px solid var(--border);background:var(--bg-secondary);color:var(--text);
  border-radius:999px;padding:3px 11px;cursor:pointer;font-size:.82rem}
.qdr .qbtn:hover{border-color:var(--acc,#f7931a)}
.qdr .qbtn.on{background:var(--acc,#f7931a);color:#141414;font-weight:700;border-color:transparent}

.qdr .qlv{border:1px solid var(--border);border-left:3px solid var(--text-muted);border-radius:8px;
  padding:9px 12px;margin-bottom:7px;background:var(--bg-secondary)}
.qdr .qlv.qforte{box-shadow:inset 3px 0 0 rgba(247,147,26,.35)}
.qdr .qlh{display:flex;align-items:baseline;gap:9px;flex-wrap:wrap}
.qdr .qlvl{font-size:1.05rem;font-variant-numeric:tabular-nums}
.qdr .qld{font-weight:700;font-variant-numeric:tabular-nums}
.qdr .qlt,.qdr .qlc,.qdr .qlg{font-size:.78rem;color:var(--text-muted)}
.qdr .qlc{font-weight:600}
.qdr .qlrow{margin-top:4px;line-height:1.45;font-size:.92rem}
.qdr .qlrow.qlno{color:var(--text-muted)}
.qdr .qlk{display:inline-block;min-width:62px;font-size:.72rem;text-transform:uppercase;
  letter-spacing:.05em;color:var(--text-muted);font-weight:700}
.qdr .qlf{margin-top:6px;font-size:.78rem;color:var(--text-muted)}
.qdr .qlf a{color:var(--text-muted)}
.qdr .qmore{margin:6px 0 0}
.qdr .qwarn{margin:14px 0 0;font-size:.84rem;color:var(--text-muted);line-height:1.5;max-width:70ch}

.qdr .qte{border:1px solid var(--border);border-radius:10px;padding:12px 14px;margin-bottom:10px;
  background:var(--bg-secondary)}
.qdr .qteh{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap;margin-bottom:6px}
.qdr .qtec{font-size:.8rem;color:var(--text-muted)}
.qdr .qteb{line-height:1.55}
.qdr .qtet,.qdr .qtev{margin-top:8px;line-height:1.5;font-size:.92rem;
  padding-left:10px;border-left:2px solid var(--border)}
.qdr .qtev{color:var(--text-muted)}

.qdr .qpunto{border:1px solid var(--border);border-radius:10px;background:var(--bg-secondary)}
.qdr .qpunto summary{padding:10px 14px;cursor:pointer;font-weight:600}
.qdr .qptx{padding:0 14px 14px;line-height:1.6;max-width:78ch}
.qdr .qall{margin-top:10px;font-size:.88rem}
@media (max-width:640px){
  .qdr .qlk{min-width:0;margin-right:6px}
  .qdr .qevc{margin-left:0}
}
.qdr .qlv>summary{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap;cursor:pointer;
  list-style:none;padding:2px 0}
.qdr .qlv>summary::-webkit-details-marker{display:none}
.qdr .qlv>summary::before{content:"▸";color:var(--text-muted);font-size:.8rem;flex:none}
.qdr .qlv[open]>summary::before{content:"▾"}
.qdr .qln{font-size:.82rem;color:var(--text-muted)}
.qdr .qlchi{font-size:.78rem;color:var(--text-muted);flex:1;min-width:0;overflow:hidden;
  text-overflow:ellipsis;white-space:nowrap;text-align:right}
.qdr .qlv.qconv{background:linear-gradient(90deg,rgba(247,147,26,.07),transparent 60%)}
.qdr .qlvoce{margin-top:9px;padding-top:9px;border-top:1px dashed var(--border)}
.qdr .qlvoce .qlh{margin-bottom:2px}

/* Diario — video non di mercato, messi da parte ma non nascosti */
.dia .dnot{color:var(--text-muted);font-weight:400;font-size:.86em}
.dia .dsec-alt{opacity:.72}
.dia .dsec-alt summary .dsh{font-weight:500}
.dia .autov-alt .ttl{color:var(--text-muted)}
.dia .dcat{font-size:.74rem;color:var(--text-muted);margin-left:auto;
  border:1px solid var(--border);border-radius:999px;padding:1px 8px;flex:none}
.qdr .qgbp{font-size:.86rem;color:var(--text-muted);font-variant-numeric:tabular-nums;margin-left:5px}
.qdr .qmano{font-size:.68rem;border:1px solid var(--border);border-radius:999px;padding:0 6px;
  color:var(--text-muted);font-weight:400}
.qdr .qcit{margin-top:7px;font-size:.9rem;line-height:1.45;opacity:.85;
  padding-left:10px;border-left:2px solid var(--border)}
.qdr .qmin{white-space:nowrap;font-weight:700;text-decoration:none;color:var(--acc,#f7931a)}
.qdr .qmin:hover{text-decoration:underline}
