/* ===========================================================
   Calculadora Lunar Cientifica - Bento Grid Painel
   ===========================================================
   Orquestra cl-spotlight standalone (acima, ja contendo
   telemetry bar) + grid de 3 tiles abaixo.
   Tiles: Heatmap (g), Occultations (j), Uncertainty (k).
          Cada um ocupa 2col x 1row.
   Suporta dark mode via body.dark-mode e prefers-reduced-motion.
   =========================================================== */

/* === Fonte mono pra numeros vivos === */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700&display=swap');

/* === Variaveis (light mode default) === */
:root {
  --cl-bento-bg: #ffffff;
  --cl-bento-bg-alt: #f8fafc;
  --cl-bento-bg-soft: #f1f5f9;
  --cl-bento-fg: #0f172a;
  --cl-bento-muted: #64748b;
  --cl-bento-border: #e2e8f0;
  --cl-bento-border-soft: rgba(15, 23, 42, 0.06);
  --cl-bento-accent-cyan: #22d3ee;
  --cl-bento-accent-amber: #f5a524;
  --cl-bento-accent-orange: #fb923c;
  --cl-bento-accent-red: #ef4444;
  --cl-bento-accent-green: #10b981;
  --cl-bento-accent-blue: #2563eb;
  --cl-bento-accent-purple: #a855f7;
  --cl-bento-accent-pink: #ec4899;
  --cl-bento-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --cl-bento-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
  --cl-bento-shadow-hover: 0 4px 12px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.05);
  --cl-bento-radius: 14px;
  --cl-bento-radius-sm: 8px;
  --cl-bento-gap: 12px;
}

body.dark-mode {
  --cl-bento-bg: #0b0f1a;
  --cl-bento-bg-alt: #111827;
  --cl-bento-bg-soft: #1e293b;
  --cl-bento-fg: #e6eaf2;
  --cl-bento-muted: #94a3b8;
  --cl-bento-border: #334155;
  --cl-bento-border-soft: rgba(226, 232, 240, 0.06);
  --cl-bento-shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.3);
  --cl-bento-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.6), 0 2px 6px rgba(0, 0, 0, 0.35);
}

/* === Reset basico do container === */
.cl-bento, .cl-bento * {
  box-sizing: border-box;
}

/* === Numeros vivos (qualquer counter, distancia, fase, delta) === */
.cl-bento-num {
  font-family: var(--cl-bento-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  letter-spacing: -0.01em;
}
.cl-bento-num--xs { font-size: 0.78rem; }
.cl-bento-num--sm { font-size: 0.86rem; }
.cl-bento-num--md { font-size: 1.05rem; font-weight: 600; }
.cl-bento-num--lg { font-size: 1.6rem; font-weight: 700; }
.cl-bento-num--xl { font-size: 2.4rem; font-weight: 700; line-height: 1.05; }
.cl-bento-num--live { transition: color 0.18s ease; }
.cl-bento-num--positive { color: var(--cl-bento-accent-green); }
.cl-bento-num--negative { color: var(--cl-bento-accent-red); }
.cl-bento-num--neutral { color: var(--cl-bento-muted); }

/* === Telemetry bar (sticky abaixo do form) === */
.cl-bento-telemetry {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: center;
  padding: 10px 14px;
  margin-bottom: 14px;
  background: var(--cl-bento-bg-alt);
  border: 1px solid var(--cl-bento-border);
  border-radius: var(--cl-bento-radius);
  font-family: var(--cl-bento-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
  color: var(--cl-bento-fg);
  backdrop-filter: blur(6px);
}
.cl-bento-telemetry__heading {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cl-bento-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.cl-bento-telemetry__item {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
}
.cl-bento-telemetry__label {
  color: var(--cl-bento-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.cl-bento-telemetry__value {
  font-weight: 600;
  color: var(--cl-bento-fg);
}
.cl-bento-telemetry__pause {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--cl-bento-border);
  background: var(--cl-bento-bg);
  border-radius: 8px;
  cursor: pointer;
  color: var(--cl-bento-fg);
  font-family: var(--cl-bento-mono);
  font-size: 0.9rem;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.cl-bento-telemetry__pause:hover {
  background: var(--cl-bento-bg-soft);
  border-color: var(--cl-bento-accent-cyan);
}
.cl-bento-telemetry__pause[aria-pressed="true"] {
  background: var(--cl-bento-accent-amber);
  color: #fff;
  border-color: var(--cl-bento-accent-amber);
}

/* === Telemetry bar embutida no Spotlight (cor coerente com gradient) === */
.cl-spotlight .cl-bento-telemetry {
    margin: 16px 0 0;
    background: rgba(0, 0, 0, 0.20);
    border: 1px solid rgba(255, 255, 255, 0.10);
    color: #e2e8f0;
    backdrop-filter: none;
    border-radius: 10px;
    padding: 8px 12px;
    position: static;
    /* desabilita sticky quando dentro do spotlight */
}
.cl-spotlight .cl-bento-telemetry__heading {
    color: #94a3b8;
}
.cl-spotlight .cl-bento-telemetry__label {
    color: #94a3b8;
}
.cl-spotlight .cl-bento-telemetry__value {
    color: #ffffff;
}
.cl-spotlight .cl-bento-telemetry__sep {
    color: rgba(226, 232, 240, 0.4);
}
.cl-spotlight .cl-bento-telemetry__pause {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
    color: #e2e8f0;
}
.cl-spotlight .cl-bento-telemetry__pause:hover {
    background: rgba(34, 211, 238, 0.18);
}

/* === cl-feat-grid quando dentro do cl-spotlight (fundo gradient azul-noite) === */
.cl-spotlight .cl-feat-grid {
    margin-top: 14px;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.cl-spotlight .cl-feat {
    background: rgba(255, 255, 255, 0.06);
    border: none;
    border-radius: 8px;
    padding: 10px 12px;
}
.cl-spotlight .cl-feat__head {
    color: #94a3b8;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    margin-bottom: 4px;
}
.cl-spotlight .cl-feat__value {
    color: #ffffff;
    font-family: var(--cl-bento-mono);
    font-variant-numeric: tabular-nums;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.1;
}
.cl-spotlight .cl-feat__sub {
    color: #cbd5e1;
    font-size: 0.72rem;
    margin-top: 2px;
}

/* === Bento Grid Layout === */
.cl-bento {
  width: 100%;
  margin-top: 16px;
  color: var(--cl-bento-fg);
}
.cl-bento-grid {
  display: grid;
  gap: var(--cl-bento-gap);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(0, auto);
  /* Bump 2026-05-09: apenas 1 tile (heatmap=g) acima da Sandbox.
     Os tiles j (Occultations) e k (Uncertainty) viraram sections
     standalone abaixo da Sandbox e nao sao mais areas do Bento. */
  grid-template-areas:
    "g g";
}
@media (max-width: 640px) {
  .cl-bento-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "g";
  }
}

/* === Tile J: lunar occultations === */
.cl-bento-tile--occultations {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cl-occ__head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--cl-bento-border);
}
.cl-occ__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--cl-bento-fg);
}
.cl-occ__sub {
  margin: 0;
  font-size: 0.75rem;
  color: var(--cl-bento-muted);
}
.cl-occ__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cl-occ__item {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr) minmax(0, 1fr) minmax(0, 0.6fr);
  gap: 8px;
  padding: 6px 8px;
  background: var(--cl-bento-bg-alt);
  border-radius: 6px;
  font-size: 0.78rem;
  align-items: center;
}
.cl-occ__star {
  font-family: var(--cl-bento-mono);
  font-weight: 600;
  color: var(--cl-bento-fg);
}
.cl-occ__vmag {
  font-family: var(--cl-bento-mono);
  font-variant-numeric: tabular-nums;
  color: var(--cl-bento-accent-amber);
}
.cl-occ__time {
  font-family: var(--cl-bento-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
  color: var(--cl-bento-muted);
}
.cl-occ__dur {
  font-family: var(--cl-bento-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--cl-bento-accent-cyan);
}
.cl-occ__empty {
  margin: 0;
  padding: 14px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--cl-bento-muted);
  font-style: italic;
}
.cl-occ__note {
  margin: 6px 0 0;
  padding-top: 8px;
  border-top: 1px dashed var(--cl-bento-border);
  font-size: 0.7rem;
  color: var(--cl-bento-muted);
  line-height: 1.4;
}

/* === Tile K: uncertainty budget (GUM, JCGM 100:2008) === */
.cl-bento-tile--uncertainty {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cl-uncert__head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--cl-bento-border);
}
.cl-uncert__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--cl-bento-fg);
}
.cl-uncert__sub {
  margin: 0;
  font-size: 0.75rem;
  color: var(--cl-bento-muted);
}
.cl-uncert__summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  padding: 8px 0;
}
.cl-uncert__summary-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  background: var(--cl-bento-bg-alt);
  border: 1px solid var(--cl-bento-border-soft);
  border-radius: var(--cl-bento-radius-sm);
}
.cl-uncert__summary-label {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--cl-bento-muted);
}
.cl-uncert__summary-value {
  font-family: var(--cl-bento-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--cl-bento-fg);
}
.cl-uncert__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  font-family: var(--cl-bento-mono);
  font-variant-numeric: tabular-nums;
}
.cl-uncert__table thead th {
  text-align: left;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cl-bento-muted);
  padding: 6px 8px;
  border-bottom: 1px solid var(--cl-bento-border);
  background: var(--cl-bento-bg-alt);
}
.cl-uncert__table tbody td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--cl-bento-border-soft);
  color: var(--cl-bento-fg);
}
.cl-uncert__table tbody tr:last-child td {
  border-bottom: none;
}
.cl-uncert__extras {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: var(--cl-bento-bg-alt);
  border-radius: var(--cl-bento-radius-sm);
  border: 1px solid var(--cl-bento-border-soft);
}
.cl-uncert__extras-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--cl-bento-muted);
}
.cl-uncert__note {
  margin: 6px 0 0;
  padding-top: 8px;
  border-top: 1px dashed var(--cl-bento-border);
  font-size: 0.7rem;
  color: var(--cl-bento-muted);
  line-height: 1.4;
}

/* === Wave 4: MC cross-validation, Allan deviation, CCSDS OEM export === */
.cl-uncert__mc,
.cl-uncert__allan {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--cl-bento-border);
}
.cl-uncert__mc-title,
.cl-uncert__allan-title {
  margin: 0 0 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--cl-bento-fg);
}
.cl-uncert__mc-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 12px;
  font-family: var(--cl-bento-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  margin: 0;
}
.cl-uncert__mc-list dt {
  color: var(--cl-bento-muted);
  font-weight: 600;
}
.cl-uncert__mc-list dd {
  margin: 0;
  color: var(--cl-bento-fg);
}
.cl-uncert__mc-error {
  margin: 8px 0 0;
  font-size: 0.74rem;
  color: var(--cl-bento-accent-red);
}
.cl-uncert__allan-table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  /* Bump 2026-05-09b: tabela ocupa full-width do card. Sem margin auto, sem
     max-width, sem padding lateral extra (o card .cl-bento-tile ja tem 18px
     de padding lateral). table-layout: fixed mantem alinhamento estavel
     entre header e body independente do tamanho dos numeros (e-9 vs e-10). */
  table-layout: fixed;
  font-family: var(--cl-bento-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.74rem;
}
/* Bump 2026-05-09b: tau column compacta (header curto, valores pequenos);
   sigma column ocupa o resto. Antes ambas eram 50/50 o que "centralizava"
   visualmente o conteudo right-aligned, deixando 40% de espaco em branco a
   esquerda. */
.cl-uncert__allan-col-tau {
  width: 35%;
}
.cl-uncert__allan-col-sigma {
  width: 65%;
}
.cl-uncert__allan-table th,
.cl-uncert__allan-table td {
  padding: 3px 6px;
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid var(--cl-bento-border-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Bump 2026-05-09b: headers a esquerda (padrao tabular), valores numericos
   a direita (convencao numerica). Antes ambos eram right-aligned, o que
   junto com colunas 50/50 dava aparencia de centralizacao. */
.cl-uncert__allan-table th {
  text-align: left;
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  color: var(--cl-bento-muted);
}
.cl-uncert__allan-table td {
  text-align: right;
}
.cl-uncert__export {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--cl-bento-border);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.cl-uncert__export-link,
.cl-uncert__export-btn {
  display: inline-block;
  padding: 6px 10px;
  background: var(--cl-bento-bg-soft);
  border: 1px solid var(--cl-bento-border);
  border-radius: var(--cl-bento-radius-sm);
  font-family: var(--cl-bento-mono);
  font-size: 0.75rem;
  color: var(--cl-bento-fg);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease;
}
.cl-uncert__export-link:hover,
.cl-uncert__export-btn:hover {
  background: var(--cl-bento-bg-alt);
  border-color: var(--cl-bento-accent-cyan);
}

/* === Tile base === */
.cl-bento-tile {
  background: var(--cl-bento-bg);
  border: 1px solid var(--cl-bento-border);
  border-radius: var(--cl-bento-radius);
  padding: 16px 18px;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--cl-bento-shadow);
  transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.cl-bento-tile:hover {
  box-shadow: var(--cl-bento-shadow-hover);
}
.cl-bento-tile h3,
.cl-bento-tile__title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cl-bento-muted);
}
.cl-bento-tile__subtitle {
  font-size: 0.86rem;
  color: var(--cl-bento-muted);
  line-height: 1.4;
}
.cl-bento-tile__footer {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--cl-bento-border-soft);
  font-size: 0.74rem;
  color: var(--cl-bento-muted);
}

/* Bump 2026-05-09: tiles j/k movidos para sections standalone abaixo da
   Sandbox. Esta variante remove qualquer grid-area inherited e ajusta
   spacing pra respirar entre as sections sequenciais. */
.cl-bento-tile--standalone {
  grid-area: auto;
}
.cl-section-spotlight,
.cl-section-occultations,
.cl-section-uncertainty {
  margin-top: 18px;
  margin-bottom: 18px;
}
.cl-section-spotlight > .cl-section-title,
.cl-section-occultations > .cl-section-title,
.cl-section-uncertainty > .cl-section-title {
  margin: 0 0 12px;
}

/* Mapeamento das areas (3 tiles ativos no grid) */
.cl-bento--heatmap      { grid-area: g; }
.cl-bento--occultations { grid-area: j; }
.cl-bento--uncertainty  { grid-area: k; }

/* === Tile error fallback === */
.cl-bento-tile-error,
.cl-bento-tile.is-error {
  background: rgba(239, 68, 68, 0.08);
  border-color: var(--cl-bento-accent-red);
  color: var(--cl-bento-accent-red);
  padding: 12px 14px;
  font-size: 0.86rem;
}
body.dark-mode .cl-bento-tile-error,
body.dark-mode .cl-bento-tile.is-error {
  background: rgba(239, 68, 68, 0.16);
}

/* ===========================================================
   Spotlight standalone (acima do grid Bento)
   =========================================================== */
.cl-spotlight--standalone {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #1e3a8a 100%);
  color: #e2e8f0;
  border-radius: var(--cl-bento-radius);
  padding: 22px 26px;
  margin: 0 0 16px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
}
.cl-spotlight__top {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  margin-bottom: 18px;
}
.cl-spotlight__globe {
  min-width: 0;
  width: 100%;
  max-width: 380px;
}
.cl-spotlight__globe svg {
  width: 100%;
  height: auto;
  display: block;
}
.cl-spotlight__meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cl-spotlight__title {
  margin: 0 0 4px;
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
}
.cl-spotlight__phase {
  margin: 0;
  color: #cbd5e1;
  font-size: 0.95rem;
  font-weight: 600;
}
.cl-spotlight__jd,
.cl-spotlight__models {
  margin: 0;
  color: #94a3b8;
  font-size: 0.78rem;
  line-height: 1.5;
  word-break: break-word;
}
.cl-spotlight__models strong {
  color: #cbd5e1;
}
.cl-spotlight__clocks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 6px;
}
.cl-spotlight__clock {
  background: rgba(255, 255, 255, 0.06);
  padding: 8px 10px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.cl-spotlight__clock-label {
  font-size: 0.62rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}
.cl-spotlight__clock-value {
  font-family: var(--cl-bento-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.86rem;
  color: #fff;
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* Stats embaixo: full-width 4 colunas */
.cl-spotlight__stats-row {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 16px;
}
.cl-spotlight__stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.cl-spotlight__stats .cl-sci-stat {
  background: rgba(255, 255, 255, 0.06);
  padding: 10px 12px;
  border-radius: 8px;
  min-width: 0;
  overflow: hidden;
}
.cl-sci-stat__label {
  font-size: 0.62rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  margin-bottom: 3px;
  line-height: 1.1;
}
.cl-sci-stat__value {
  font-family: var(--cl-bento-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

/* Responsive: 2 col em viewport medio, 1 col em mobile */
@media (max-width: 980px) {
  .cl-spotlight__top {
    grid-template-columns: minmax(0, 1fr);
  }
  .cl-spotlight__globe {
    max-width: 320px;
    margin: 0 auto;
  }
  .cl-spotlight__stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 480px) {
  .cl-spotlight__stats {
    grid-template-columns: 1fr;
  }
}

/* ===========================================================
   Tile B: Sparkline
   =========================================================== */
.cl-spark {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cl-spark__hero {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.cl-spark__hero-num {
  font-family: var(--cl-bento-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--cl-bento-fg);
}
.cl-spark__hero-unit {
  font-size: 0.82rem;
  color: var(--cl-bento-muted);
}
.cl-spark__delta {
  font-family: var(--cl-bento-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}
.cl-spark__delta--up {
  color: var(--cl-bento-accent-green);
  background: rgba(16, 185, 129, 0.12);
}
.cl-spark__delta--down {
  color: var(--cl-bento-accent-red);
  background: rgba(239, 68, 68, 0.12);
}
.cl-spark__delta--flat {
  color: var(--cl-bento-muted);
  background: rgba(100, 116, 139, 0.10);
}
.cl-spark__chart {
  width: 100%;
  height: 60px;
  position: relative;
}
.cl-spark__caption {
  font-size: 0.72rem;
  color: var(--cl-bento-muted);
}
@media (prefers-reduced-motion: reduce) {
  .cl-spark__chart canvas { animation: none !important; transition: none !important; }
}

/* ===========================================================
   Tile D: Compass
   =========================================================== */
.cl-compass {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.cl-compass__svg {
  width: 100%;
  max-width: 180px;
  height: auto;
  display: block;
}
.cl-compass__bg-circle {
  fill: var(--cl-bento-bg-alt);
  stroke: var(--cl-bento-border);
  stroke-width: 1.5;
}
.cl-compass__tick {
  stroke: var(--cl-bento-muted);
  stroke-width: 1;
}
.cl-compass__tick--major {
  stroke: var(--cl-bento-fg);
  stroke-width: 1.5;
}
.cl-compass__label {
  font-family: var(--cl-bento-mono);
  font-size: 0.72rem;
  font-weight: 700;
  fill: var(--cl-bento-muted);
}
.cl-compass__needle-az {
  stroke: var(--cl-bento-accent-cyan);
  stroke-width: 3;
  stroke-linecap: round;
  transition: transform 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
  transform-origin: center;
}
.cl-compass__needle-alt {
  stroke: var(--cl-bento-accent-amber);
  stroke-width: 2;
  stroke-dasharray: 4 3;
  stroke-linecap: round;
}
.cl-compass__center {
  fill: var(--cl-bento-fg);
}
.cl-compass__readout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  font-size: 0.78rem;
}
.cl-compass__readout-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cl-compass__readout-label {
  color: var(--cl-bento-muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}
.cl-compass__readout-value {
  font-family: var(--cl-bento-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--cl-bento-fg);
}
@media (prefers-reduced-motion: reduce) {
  .cl-compass__needle-az { transition: none; }
}

/* ===========================================================
   Tile E: Ring (illumination percent)
   =========================================================== */
.cl-ring {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.cl-ring__svg {
  width: 100%;
  max-width: 160px;
  height: auto;
  display: block;
  transform: rotate(-90deg);
}
.cl-ring__bg {
  fill: none;
  stroke: var(--cl-bento-border);
  stroke-width: 8;
}
.cl-ring__fill {
  fill: none;
  stroke: var(--cl-bento-accent-amber);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.cl-ring__center {
  text-align: center;
  font-family: var(--cl-bento-mono);
  font-variant-numeric: tabular-nums;
}
.cl-ring__center-num {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--cl-bento-fg);
}
.cl-ring__center-label {
  font-size: 0.72rem;
  color: var(--cl-bento-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.cl-ring__phase-name {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--cl-bento-fg);
  text-align: center;
}
@media (prefers-reduced-motion: reduce) {
  .cl-ring__fill { transition: none; }
}

/* ===========================================================
   Tile F: Next event
   =========================================================== */
.cl-event {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cl-event__type {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cl-bento-accent-purple);
}
.cl-event__type-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cl-bento-accent-purple);
}
.cl-event__name {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--cl-bento-fg);
  line-height: 1.3;
}
.cl-event__date {
  font-family: var(--cl-bento-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.86rem;
  color: var(--cl-bento-muted);
}
.cl-event__countdown {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cl-event__countdown-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cl-bento-muted);
  font-weight: 700;
}
.cl-event__countdown-num {
  font-family: var(--cl-bento-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--cl-bento-fg);
}

/* ===========================================================
   Tile G: Libration heatmap
   =========================================================== */
.cl-heat {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cl-heat__legend {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.74rem;
  color: var(--cl-bento-muted);
  flex-wrap: wrap;
}
.cl-heat__legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 4px;
  vertical-align: middle;
  background: var(--cl-bento-border);
}
.cl-heat__legend-swatch--cool {
  background: #22d3ee;
}
.cl-heat__legend-swatch--warm {
  background: #fb923c;
}
.cl-heat__chart-wrap {
  width: 100%;
  height: 220px;
  min-height: 220px;
  position: relative;
}
.cl-heat__fallback {
  display: none;
  width: 100%;
  max-height: 240px;
  overflow-y: auto;
  margin-top: 6px;
}
.cl-heat__table {
  width: 100%;
  font-size: 0.7rem;
  border-collapse: collapse;
  font-family: var(--cl-bento-mono);
  font-variant-numeric: tabular-nums;
}
.cl-heat__table thead th {
  text-align: right;
  padding: 4px 6px;
  border-bottom: 1px solid var(--cl-bento-border);
  color: var(--cl-bento-muted);
  text-transform: uppercase;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  font-weight: 700;
}
.cl-heat__table tbody td {
  padding: 3px 6px;
  text-align: right;
  border-bottom: 1px solid var(--cl-bento-border-soft);
}
.cl-heat__table th:first-child,
.cl-heat__table td:first-child {
  text-align: left;
}
.cl-heat__table tbody tr:hover {
  background: var(--cl-bento-bg-alt);
}
.cl-heat__noscript {
  margin: 6px 0 0;
  font-size: 0.78rem;
  color: var(--cl-bento-muted);
  font-style: italic;
}
/* Reveal the fallback table whenever ECharts fails to render. Explicit
   data-render-failed flag on the wrap is the primary signal (set by JS
   catch handlers); body.no-echarts is a second-chance global flag; the
   :empty selector is a final safety net for the case where the wrap
   never received any child node at all. */
.cl-heat__chart-wrap[data-render-failed="true"] + .cl-heat__fallback,
.cl-heat__chart-wrap:empty + .cl-heat__fallback,
body.no-echarts .cl-heat__fallback {
  display: block !important;
}
/* Hide the chart-wrap once flagged as failed so the fallback table
   becomes the primary visual content (no empty 220px hole). */
.cl-heat__chart-wrap[data-render-failed="true"] {
  display: none;
}
.cl-heat__caption {
  font-size: 0.72rem;
  color: var(--cl-bento-muted);
  line-height: 1.4;
}

/* ===========================================================
   Tile H: Sandbox (sliders + inputs)
   =========================================================== */
.cl-sandbox {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cl-sandbox__intro {
  font-size: 0.82rem;
  color: var(--cl-bento-muted);
  line-height: 1.4;
}
.cl-sandbox__group {
  border: 1px solid var(--cl-bento-border);
  border-radius: 10px;
  padding: 8px 12px;
  background: var(--cl-bento-bg-alt);
  transition: border-color 0.15s ease;
}
.cl-sandbox__group[open] {
  border-color: var(--cl-bento-accent-cyan);
}
.cl-sandbox__group > summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.86rem;
  padding: 4px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--cl-bento-fg);
  list-style: none;
}
.cl-sandbox__group > summary::-webkit-details-marker { display: none; }
.cl-sandbox__group > summary::before {
  content: '+';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: var(--cl-bento-bg);
  border: 1px solid var(--cl-bento-border);
  font-family: var(--cl-bento-mono);
  font-size: 0.78rem;
  font-weight: 700;
}
.cl-sandbox__group[open] > summary::before {
  content: '-';
}
.cl-sandbox__row {
  display: grid;
  grid-template-columns: minmax(160px, 1.6fr) minmax(120px, 2fr) minmax(80px, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--cl-bento-border-soft);
  position: relative;
}
.cl-sandbox__row::after {
  /* Tick triangle below the slider pointing to the real value position. */
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--cl-bento-accent-green);
  bottom: -2px;
  left: calc(var(--real-pct, 50%) - 3px);
  clip-path: polygon(0 100%, 100% 100%, 50% 0);
  pointer-events: none;
}
.cl-sandbox__row--num-only {
  grid-template-columns: minmax(160px, 1.6fr) minmax(120px, 1fr) auto;
}
.cl-sandbox__row--num-only::after {
  /* No tick triangle on number-only rows (no range slider to mark). */
  display: none;
}
@media (max-width: 720px) {
  .cl-sandbox__row,
  .cl-sandbox__row--num-only {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .cl-sandbox__label { grid-column: 1 / -1; }
}
.cl-sandbox__label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.cl-sandbox__symbol {
  font-family: var(--cl-bento-mono);
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--cl-bento-fg);
}
.cl-sandbox__name {
  font-size: 0.86rem;
  color: var(--cl-bento-fg);
}
.cl-sandbox__hint {
  font-size: 0.72rem;
  color: var(--cl-bento-muted);
  line-height: 1.3;
}
.cl-sandbox__range {
  width: 100%;
  accent-color: var(--cl-bento-accent-cyan);
  cursor: pointer;
  height: 4px;
  /* CSS variable --real-pct is populated inline by PHP with the position of
     the real value in % along the range (0-100). Renders a vertical green
     bar overlay on the slider track at the real value position. */
  background-image: linear-gradient(
    to right,
    transparent calc(var(--real-pct, 50%) - 2px),
    var(--cl-bento-accent-green) calc(var(--real-pct, 50%) - 2px),
    var(--cl-bento-accent-green) calc(var(--real-pct, 50%) + 2px),
    transparent calc(var(--real-pct, 50%) + 2px)
  );
  background-size: 100% 4px;
  background-position: center;
  background-repeat: no-repeat;
}
.cl-sandbox__num {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--cl-bento-border);
  border-radius: 6px;
  font-family: var(--cl-bento-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.86rem;
  background: var(--cl-bento-bg);
  color: var(--cl-bento-fg);
  transition: border-color 0.15s ease;
}
.cl-sandbox__num:focus {
  outline: none;
  border-color: var(--cl-bento-accent-cyan);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15);
}
.cl-sandbox__num--scientific {
  font-size: 0.78rem;
}
.cl-sandbox__badge {
  font-family: var(--cl-bento-mono);
  font-size: 0.68rem;
  padding: 3px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.cl-sandbox__badge--real {
  background: var(--cl-bento-accent-green);
  color: #fff;
}
.cl-sandbox__badge--explore {
  background: var(--cl-bento-accent-orange);
  color: #fff;
}
.cl-sandbox__chart-wrap {
  width: 100%;
  height: 220px;
  margin-top: 10px;
  position: relative;
}
.cl-sandbox__actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.cl-sandbox__btn {
  padding: 6px 12px;
  border: 1px solid var(--cl-bento-border);
  border-radius: 8px;
  background: var(--cl-bento-bg);
  color: var(--cl-bento-fg);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.cl-sandbox__btn:hover {
  border-color: var(--cl-bento-accent-cyan);
  background: var(--cl-bento-bg-soft);
}
.cl-sandbox__btn--primary {
  background: var(--cl-bento-accent-cyan);
  color: #0b1220;
  border-color: var(--cl-bento-accent-cyan);
}
.cl-sandbox__btn--primary:hover {
  background: #0bbcd6;
  border-color: #0bbcd6;
}

/* ===========================================================
   Tile I: Eclipse timeline
   =========================================================== */
.cl-timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cl-timeline__legend {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.74rem;
  color: var(--cl-bento-muted);
  flex-wrap: wrap;
}
.cl-timeline__svg {
  width: 100%;
  height: 100px;
  display: block;
}
.cl-timeline__axis {
  stroke: var(--cl-bento-border);
  stroke-width: 1;
}
.cl-timeline__tick {
  stroke: var(--cl-bento-muted);
  stroke-width: 1;
}
.cl-timeline__label {
  font-family: var(--cl-bento-mono);
  font-size: 0.68rem;
  fill: var(--cl-bento-muted);
}
.cl-timeline__event {
  cursor: pointer;
  transition: r 0.15s ease;
}
.cl-timeline__event:hover {
  r: 8;
}
.cl-timeline__event--solar { fill: var(--cl-bento-accent-amber); }
.cl-timeline__event--lunar { fill: var(--cl-bento-accent-purple); }
.cl-timeline__caption {
  font-size: 0.72rem;
  color: var(--cl-bento-muted);
  line-height: 1.4;
}

/* ===========================================================
   prefers-reduced-motion global
   =========================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
  .cl-spotlight__clock-value,
  .cl-bento-telemetry__value,
  .cl-spark__hero-num,
  .cl-event__countdown-num {
    /* texto continua atualizando via JS, mas sem transicao visual */
  }
}

/* ===========================================================
   Dark mode adjustments tile-a-tile
   =========================================================== */
body.dark-mode .cl-bento-tile {
  background: #0f172a;
  border-color: #334155;
}
/* Spotlight standalone ja e dark fixo (gradiente azul-noite), nao precisa
   de override em body.dark-mode. Mantemos so a regra de tile-base acima. */
body.dark-mode .cl-compass__bg-circle {
  fill: #111827;
  stroke: #334155;
}
body.dark-mode .cl-ring__bg {
  stroke: #334155;
}
body.dark-mode .cl-sandbox__group {
  background: #111827;
}
body.dark-mode .cl-sandbox__group > summary::before {
  background: #0b0f1a;
  border-color: #334155;
}
body.dark-mode .cl-sandbox__num {
  background: #0b0f1a;
  border-color: #334155;
  color: #e6eaf2;
}
body.dark-mode .cl-sandbox__btn {
  background: #0b0f1a;
  color: #e6eaf2;
}
body.dark-mode .cl-bento-telemetry {
  background: rgba(17, 24, 39, 0.85);
  border-color: #334155;
}
body.dark-mode .cl-bento-telemetry__pause {
  background: #0b0f1a;
  color: #e6eaf2;
  border-color: #334155;
}
body.dark-mode .cl-spark__delta--up {
  background: rgba(16, 185, 129, 0.18);
}
body.dark-mode .cl-spark__delta--down {
  background: rgba(239, 68, 68, 0.18);
}
body.dark-mode .cl-spark__delta--flat {
  background: rgba(148, 163, 184, 0.16);
}

/* ===========================================================
   Print
   =========================================================== */
@media print {
  .cl-bento-telemetry__pause { display: none; }
  .cl-bento-tile { box-shadow: none; break-inside: avoid; }
  .cl-bento-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: none;
  }
  .cl-bento-tile { grid-area: auto !important; }
}
