:root {
  --bg: #0c0f14;
  --panel: #12161e;
  --border: #252b36;
  --text: #e8ecf1;
  --muted: #8b95a5;
  --accent: #3ee0b8;
  --accent-dim: #2a9d7f;
  --danger: #f87171;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: "DM Sans", system-ui, sans-serif; font-size: 15px; }

a { color: var(--accent); }

.app-root { display: flex; min-height: 100vh; }
.nav-rail {
  width: 238px; flex-shrink: 0; background: var(--panel); border-right: 1px solid var(--border);
  padding: 1rem 0.65rem; display: flex; flex-direction: column; gap: 2px;
  min-height: 100vh;
}
.nav-rail .brand { padding: 0.5rem 0.75rem 1rem; border-bottom: 1px solid var(--border); margin-bottom: 0.5rem; }
.brand-row { display: flex; align-items: center; gap: 10px; }
.brand-mark { flex-shrink: 0; line-height: 0; }
.brand-mark svg,
.brand-mark img { display: block; border-radius: 10px; box-shadow: 0 4px 18px rgba(62, 224, 184, 0.18); }
.brand-text strong { color: var(--accent); font-size: 1.05rem; display: block; }
.brand-text small { color: var(--muted); display: block; margin-top: 0.25rem; font-size: 0.75rem; }

.home-hero {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  margin: 0 0 1.25rem;
}
.home-hero-svg { flex-shrink: 0; line-height: 0; }
.home-hero-svg svg,
.home-hero-svg img {
  display: block;
  border-radius: 22px;
  box-shadow: 0 12px 40px rgba(62, 224, 184, 0.2);
}
.home-hero h1 { margin: 0 0 4px; font-size: 1.62rem; font-weight: 700; letter-spacing: -0.03em; }
.home-hero p { margin: 0; color: var(--muted); font-size: 0.92rem; line-height: 1.35; }

.nav-btn {
  width: 100%; text-align: left; padding: 0.45rem 0.65rem; border-radius: 8px; border: none; background: transparent;
  color: var(--muted); font-size: 0.88rem; cursor: pointer; font-family: inherit;
}
.nav-btn:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.nav-btn.active { background: rgba(62, 224, 184, 0.12); color: var(--accent); font-weight: 600; }
.nav-logout { margin-top: 0; color: var(--muted); font-size: 0.82rem !important; }
.nav-logout:hover { color: var(--danger); background: rgba(248, 113, 113, 0.08); }

.nav-health {
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--muted);
  padding: 0.45rem 0.65rem 0.25rem;
  border-top: 1px solid var(--border);
  margin-top: 2px;
}
.nav-health strong { color: var(--accent); font-weight: 600; }

.login-shell {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.login-wrap { width: 100%; max-width: 400px; }
.login-card {
  padding: 1.5rem 1.35rem;
}
.login-brand-mark { text-align: center; margin-bottom: 0.35rem; line-height: 0; }
.login-brand-mark img {
  border-radius: 18px;
  box-shadow: 0 12px 36px rgba(62, 224, 184, 0.22);
}
.login-title {
  margin: 0.5rem 0 0.25rem;
  text-align: center;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--accent);
}
.login-lead { text-align: center; margin-bottom: 1rem !important; }
.login-submit { width: 100%; margin-top: 14px; }

.nav-glossary {
  margin: 10px 0.65rem 6px;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
  font-size: 0.8rem;
  color: var(--muted);
}
.nav-glossary summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
  list-style: none;
}
.nav-glossary summary::-webkit-details-marker { display: none; }
.nav-glossary-body { margin-top: 8px; line-height: 1.45; }
.nav-glossary-body p { margin: 0 0 6px; }
.nav-glossary-body p:last-child { margin-bottom: 0; }
.nav-g-more { font-size: 0.76rem; opacity: 0.95; }

.guide-glossary summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--accent);
}
.guide-glossary-inner { padding-top: 0.35rem; }
.gloss-h {
  margin: 0.85rem 0 0.4rem;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.gloss-h:first-of-type { margin-top: 0; }
.gloss-dl {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(88px, 34%) 1fr;
  gap: 0.35rem 0.85rem;
  font-size: 0.87rem;
  line-height: 1.42;
}
.gloss-dl dt {
  margin: 0;
  font-weight: 600;
  color: var(--text);
}
.gloss-dl dd { margin: 0; color: var(--muted); }

main.content { flex: 1; padding: 1.5rem 2rem 3rem; max-width: 1200px; }
h2.section-title {
  margin: 0 0 0.35rem; font-size: 1.4rem; letter-spacing: -0.02em; font-weight: 700;
}
.section-desc { margin: 0 0 1.25rem; color: var(--muted); font-size: 0.92rem; line-height: 1.5; }

.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.15rem 1.25rem; margin-bottom: 1rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.card h3 {
  margin: 0 0 0.85rem; font-size: 0.74rem; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted); font-weight: 600;
  padding-bottom: 0.5rem; border-bottom: 1px solid var(--border);
}

.grid2 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid3 {
  display: grid; gap: 0.75rem 1rem;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  align-items: end;
}

label.f { font-size: 0.78rem; color: var(--muted); display: block; margin-bottom: 0.2rem; }
input, select, textarea {
  width: 100%; padding: 0.5rem 0.6rem; border-radius: 8px; border: 1px solid var(--border);
  background: #0a0d12; color: var(--text); font-family: inherit;
  font-size: 0.88rem; transition: border-color 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: rgba(62,224,184,0.5);
  box-shadow: 0 0 0 3px rgba(62,224,184,0.08);
}
textarea { min-height: 140px; font-family: ui-monospace, monospace; font-size: 0.8rem; }

button.btn {
  font-family: inherit; font-weight: 600; font-size: 0.85rem; padding: 0.5rem 0.95rem;
  border-radius: 10px; border: 1px solid transparent; cursor: pointer;
}
.btn-primary { background: linear-gradient(165deg, var(--accent), var(--accent-dim)); color: #061512; border: none; }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }

.kpi-grid {
  display: grid; gap: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
}
.kpi {
  background: linear-gradient(145deg, #0e1219, #0a0d12);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 0.7rem 0.8rem;
  transition: border-color 0.15s ease;
}
.kpi:hover { border-color: rgba(62,224,184,0.3); }
.kpi .k {
  font-size: 0.68rem; text-transform: uppercase; color: var(--muted);
  letter-spacing: 0.06em; margin-bottom: 0.15rem;
}
.kpi .v { font-size: 1.12rem; font-weight: 700; margin-top: 0.2rem; color: var(--text); }

.err-box { border: 1px solid var(--danger); color: var(--danger); padding: 0.75rem; border-radius: 10px; background: rgba(248,113,113,0.08); white-space: pre-wrap; margin: 0.75rem 0; }

.alert-mode-card {
  border-color: rgba(62, 224, 184, 0.35);
  box-shadow: 0 0 0 1px rgba(62, 224, 184, 0.08);
}
.alert-mode-select { font-size: 1rem !important; font-weight: 600; padding: 0.55rem 0.6rem !important; }
.alert-mode-label { color: var(--accent) !important; font-weight: 600 !important; letter-spacing: 0.03em !important; font-size: 0.82rem !important; }
.hint-no-odds {
  margin: 0.75rem 0 0;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  font-size: 0.84rem;
  color: var(--text);
  background: rgba(62, 224, 184, 0.1);
  border: 1px solid rgba(62, 224, 184, 0.25);
  line-height: 1.4;
}

.table-wrap {
  overflow: auto; max-height: 520px;
  border: 1px solid var(--border); border-radius: 10px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
table.data { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
table.data th, table.data td {
  padding: 0.5rem 0.65rem; border-bottom: 1px solid var(--border); text-align: left;
  white-space: nowrap;
}
table.data th {
  position: sticky; top: 0; background: #0e1219; color: var(--muted);
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 2px solid var(--border);
}
table.data tbody tr:nth-child(even) { background: rgba(255,255,255,0.02); }
table.data tbody tr:hover { background: rgba(62,224,184,0.04); }
table.data td:first-child { font-weight: 600; color: var(--text); }

.plot-box {
  width: 100%; min-height: 320px; margin: 0.75rem 0;
  border-radius: 12px; overflow: hidden;
  border: 1px solid var(--border);
  background: rgba(14,18,25,0.6);
}

.verdict {
  border-left: 3px solid var(--border); padding: 0.55rem 0.75rem; margin: 0.35rem 0;
  background: linear-gradient(90deg, rgba(10,13,18,0.8), transparent);
  border-radius: 0 8px 8px 0; font-size: 0.85rem; line-height: 1.45;
}
.verdict.green { border-color: var(--accent); background: linear-gradient(90deg, rgba(62,224,184,0.06), transparent); }
.verdict.yellow { border-color: #fbbf24; background: linear-gradient(90deg, rgba(251,191,36,0.06), transparent); }
.verdict.red { border-color: var(--danger); background: linear-gradient(90deg, rgba(248,113,113,0.06), transparent); }

/* Pagina Accesso / Home */
.access-landing { max-width: 740px; }
.access-hero-row {
  display: flex;
  align-items: center;
  gap: 1.35rem;
  margin-bottom: 1.5rem;
}
.access-hero-mark { flex-shrink: 0; line-height: 0; }
.access-hero-mark img {
  display: block;
  width: 92px;
  height: 92px;
  border-radius: 22px;
  box-shadow: 0 14px 44px rgba(62, 224, 184, 0.24);
}
.access-title {
  margin: 0;
  font-size: 1.88rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--accent);
  line-height: 1.1;
}
.access-tagline {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.35;
}
.access-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.35rem;
}
.access-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.62rem 1.1rem;
  border-radius: 11px;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.access-btn:hover { transform: translateY(-1px); }
.access-btn-primary {
  background: linear-gradient(165deg, var(--accent), var(--accent-dim));
  color: #061210;
  box-shadow: 0 10px 28px rgba(62, 224, 184, 0.25);
}
.access-btn-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.access-btn-secondary:hover { border-color: rgba(62, 224, 184, 0.45); color: var(--accent); }
.access-steps-card { margin-bottom: 1rem; }
.access-step-list {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--text);
  line-height: 1.58;
  font-size: 0.92rem;
}
.access-step-list li { margin: 0.55rem 0; }
.access-cmd {
  display: block;
  margin-top: 0.45rem;
  padding: 0.72rem 0.82rem;
  border-radius: 10px;
  background: #0a0d12;
  border: 1px solid var(--border);
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  white-space: pre-wrap;
  word-break: break-all;
}
.access-console-hint {
  margin: 0 0 1.05rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}
.access-inline-link {
  color: var(--accent);
  font-weight: 600;
}
.access-note-li { color: var(--muted); }
.access-note-li code { color: var(--text); }

.book-lines-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  margin-top: 10px;
}

.home-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.home-feature-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.2rem;
}
.home-feature-icon {
  font-size: 2rem;
  line-height: 1;
}
.home-feature-card h3 {
  margin: 0;
  font-size: 1.05rem;
}
.home-feature-card .section-desc {
  margin: 0;
  font-size: 0.88rem;
  flex: 1;
}
.home-feature-badge {
  display: inline-block;
  width: fit-content;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 10px;
  border-radius: 4px;
  margin-top: 0.4rem;
}
.home-badge-base { background: #10b981; color: #fff; }
.home-badge-pro { background: #8b5cf6; color: #fff; }

.home-plans { margin: 2rem 0 1rem; }
.home-plans-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.home-plan-card {
  padding: 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.home-plan-highlight { border: 2px solid #10b981; }
.home-plan-pro { border: 2px solid #8b5cf6; }
.home-plan-name {
  margin: 0 0 0.3rem;
  font-size: 1.3rem;
}
.home-plan-price {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 1rem;
}
.home-plan-list {
  list-style: none;
  padding: 0;
  margin: 0;
  text-align: left;
  font-size: 0.92rem;
  line-height: 1.8;
}
.home-plan-list li::before {
  content: "\2713 ";
  color: var(--accent);
  font-weight: 700;
}

.narrative-details summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 8px;
}
.narrative-details summary:hover { color: var(--accent); }
.narrative-details[open] summary { color: var(--text); }

.nav-user-badge {
  padding: 8px 14px;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-user-badge small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 170px;
}
.nav-role-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 4px;
  width: fit-content;
}
.nav-role-admin { background: #f59e0b; color: #000; }
.nav-role-pro { background: #8b5cf6; color: #fff; }
.nav-role-base { background: #10b981; color: #fff; }
.nav-role-free { background: var(--border); color: var(--muted); }

h2.section-title + .section-desc { margin-bottom: 1.25rem; }

/* Interactive chart cards */
.ichart-card { padding: 0 !important; overflow: hidden; }
.ichart-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.85rem 1.15rem 0.65rem; gap: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.ichart-title {
  font-size: 0.95rem; font-weight: 700; color: var(--text);
  letter-spacing: -0.01em;
}
.ichart-badge {
  font-size: 0.78rem; font-weight: 700; padding: 3px 10px;
  border-radius: 6px; white-space: nowrap;
}
.ichart-card .plot-box {
  border: none; border-radius: 0; margin: 0;
  background: transparent;
}
.ichart-controls {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.7rem 1.15rem; border-top: 1px solid var(--border);
  background: rgba(10,13,18,0.5);
}
.ichart-label {
  font-size: 0.74rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  flex-shrink: 0;
}
.ichart-slider {
  flex: 1; height: 6px; -webkit-appearance: none; appearance: none;
  background: var(--border); border-radius: 3px; border: none; padding: 0;
  cursor: pointer;
}
.ichart-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px;
  border-radius: 50%; background: #FFE66D; cursor: grab;
  box-shadow: 0 2px 8px rgba(255,230,109,0.35);
}
.ichart-slider::-moz-range-thumb {
  width: 18px; height: 18px; border: none;
  border-radius: 50%; background: #FFE66D; cursor: grab;
}
.ichart-num {
  width: 70px !important; text-align: center;
  font-weight: 700; font-size: 0.88rem;
  background: rgba(255,230,109,0.08); border-color: rgba(255,230,109,0.3);
  color: #FFE66D;
}

.chart-label {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.78rem; color: var(--muted); margin: 0.65rem 0 0.25rem;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
}
.chart-label::before {
  content: ""; display: inline-block; width: 3px; height: 14px;
  border-radius: 2px; background: var(--accent); flex-shrink: 0;
}

.plot-box .modebar { opacity: 0.4; transition: opacity 0.2s; }
.plot-box:hover .modebar { opacity: 1; }

.grid2 > .card { break-inside: avoid; }

button.btn { transition: all 0.15s ease; }
button.btn:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,0,0,0.3); }

@media (max-width: 860px) {
  .access-hero-row { flex-direction: column; align-items: flex-start; }
  .app-root { flex-direction: column; }
  .nav-rail { width: 100%; flex-direction: row; flex-wrap: wrap; border-right: none; border-bottom: 1px solid var(--border); }
  .nav-btn { width: auto; flex: 1 1 45%; }
}
