:root {
  /* paleta de marca — igual a onyxdynamics.net (styles.css) */
  --bg: #0a0a10;
  --surface: #14121c;
  --surface-2: #1c1826;
  --line: #2a2438;
  --purple: #b026ff;
  --purple-dim: #7c1fd6;
  --magenta: #ff2ec4;
  --cyan: #22e8d4;
  --text: #f0eefc;
  --muted: #9b93b3;
  --muted-2: #6b6383;

  /* alias usados en el resto de este archivo (para no tocar cada regla) */
  --base: var(--bg);
  --mantle: var(--surface);
  --surface0: var(--line);
  --surface1: var(--muted-2);
  --accent: var(--purple);
  --subtext: var(--muted);
  --text-inv: var(--bg);
  --hover: var(--magenta);
  --danger: #ff6b6b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font-family: 'Inter', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-image:
    radial-gradient(600px circle at 15% 0%, rgba(176, 38, 255, 0.22), transparent 65%),
    radial-gradient(500px circle at 100% 25%, rgba(255, 46, 196, 0.15), transparent 65%),
    radial-gradient(700px circle at 50% 100%, rgba(34, 232, 212, 0.12), transparent 65%);
  background-attachment: fixed;
  position: relative;
}
/* grano + viñeta sutil, igual que onyxdynamics.net — por encima de todo
   (z-index alto) porque aquí las tarjetas cubren casi toda la pantalla;
   detrás (como en el sitio) quedaría oculto y no se notaría */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 999999;
  pointer-events: none;
  opacity: 0.35;
  mix-blend-mode: overlay;
  background-image:
    radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.3) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.35'/%3E%3C/svg%3E");
  background-size: cover, 120px 120px;
}

h1, h2, h3, button, .titulo, .hub-seccion-titulo, th {
  font-family: 'Chakra Petch', sans-serif;
}

#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

header {
  padding: 18px 16px 10px;
  text-align: center;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 10, 16, 0.82);
  backdrop-filter: blur(10px);
  position: relative;
}
.btn-volver {
  position: absolute; left: 14px; top: 18px;
  color: var(--muted); text-decoration: none; font-size: 12px;
  font-family: 'Chakra Petch', sans-serif;
  font-weight: 600; letter-spacing: .5px;
  transition: color .2s ease;
}
.btn-volver:active { color: var(--purple); }
.brand { display: flex; align-items: center; justify-content: center; gap: 10px; }
.brand-logo { width: 32px; height: 32px; object-fit: contain; }
.brand-logo-sm { width: 22px; height: 22px; }
header h1 {
  margin: 0; font-size: 22px; letter-spacing: 2px;
  color: var(--purple); font-weight: 600;
}
header .sub {
  font-size: 10px; letter-spacing: 2px; color: var(--muted);
  margin-top: 4px; text-transform: uppercase;
}

main {
  flex: 1; overflow-y: auto; padding: 14px 14px 90px;
  -webkit-overflow-scrolling: touch;
}

.vista { display: none; }
.vista.activa { display: block; }

.card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--cyan);
  border-radius: 2px;
  padding: 16px 14px;
  margin-bottom: 14px;
}
.card > .titulo {
  font-size: 11px; font-weight: 600; letter-spacing: 1.2px;
  color: var(--cyan); text-transform: uppercase; margin-bottom: 10px;
}

label { display: block; font-size: 11px; color: var(--muted); margin: 8px 0 4px; }

select, input[type=text], input[type=number] {
  width: 100%; padding: 10px 12px; font-size: 15px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 2px;
  font-family: 'Inter', sans-serif;
}
select:focus, input:focus {
  outline: none; border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(176, 38, 255, 0.15);
}

.fila-swap { display: flex; justify-content: center; margin: 6px 0; }
.btn-swap {
  background: var(--surface-2); border: 1px solid var(--purple);
  color: var(--purple); font-size: 18px; width: 44px; height: 44px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  transition: box-shadow .2s ease;
}
.btn-swap:active { box-shadow: 0 0 18px rgba(176,38,255,0.4); }

.formula {
  font-size: 11px; color: var(--muted); text-align: center;
  padding: 8px 4px; word-break: break-word;
}

/* ── botones: clonados 1:1 de .btn / .btn-primary / .btn-ghost del sitio ── */
button {
  font-family: 'Chakra Petch', sans-serif; border: none; border-radius: 2px;
  padding: 13px; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: box-shadow .2s ease, transform .2s ease, background .15s ease, border-color .15s ease;
}
.btn-primario {
  background: var(--purple); color: var(--bg); width: 100%;
  box-shadow: 0 0 24px rgba(176, 38, 255, 0.35);
}
.btn-primario:active { box-shadow: 0 0 34px rgba(176, 38, 255, 0.6); transform: translateY(-1px); }
.btn-secundario {
  background: transparent; color: var(--text); width: 100%;
  border: 1px solid var(--line); margin-top: 8px;
}
.btn-secundario:active { border-color: var(--muted); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 6px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--cyan); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
tr:nth-child(even) td { background: rgba(255,255,255,0.02); }

.historial-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12px;
}
.historial-vacio { color: var(--muted); font-size: 12px; text-align: center; padding: 12px 0; }

nav.tabs {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; background: rgba(10, 10, 16, 0.92);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
nav.tabs button {
  flex: 1; background: transparent; border-radius: 0;
  color: var(--muted); font-size: 11px; letter-spacing: .5px;
  padding: 12px 4px; font-weight: 600;
}
nav.tabs button.activo { color: var(--purple); border-top: 2px solid var(--purple); }

.grupo-decimales { display: flex; align-items: center; gap: 8px; }
.grupo-decimales select { width: auto; }

/* ── HUB ─────────────────────────────────────────────────────── */
.hub-slogan {
  font-size: 12px; font-style: italic; color: var(--purple);
  letter-spacing: 1px; margin-top: 2px;
  font-family: 'Chakra Petch', sans-serif;
}
.hub-seccion { margin-bottom: 22px; }
.hub-seccion-titulo {
  font-size: 11px; font-weight: 600; letter-spacing: 1.5px;
  color: var(--muted); text-transform: uppercase; margin-bottom: 10px;
}
/* clonado de .catalog-card-filled: calmada en reposo, glow morado solo al tocar */
.hub-app-btn {
  display: block; width: 100%; text-align: left; text-decoration: none;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line); border-left: 3px solid var(--cyan);
  font-weight: 600; font-size: 15px; padding: 16px;
  border-radius: 2px; margin-bottom: 10px;
  transition: border-color .25s ease, box-shadow .25s ease;
}
.hub-app-btn:active {
  border-color: var(--purple);
  box-shadow: 0 12px 24px -10px rgba(0,0,0,0.55), 0 0 24px rgba(176,38,255,0.18);
}
.hub-app-btn .tag { font-size: 11px; opacity: .8; display: block; margin-top: 4px; font-weight: normal; color: var(--muted); font-family: 'Inter', sans-serif; }
.hub-app-btn.bloqueado {
  background: transparent; color: var(--muted);
  border: 1px dashed var(--line); border-left: 3px dashed var(--muted-2);
  pointer-events: none; opacity: .75;
}
footer.hub-footer {
  text-align: center; padding: 16px 0 24px; font-size: 10px;
  color: var(--muted-2); letter-spacing: 2px; font-weight: 600;
  font-family: 'Chakra Petch', sans-serif;
}

/* ── TERMODINÁMICA: filas/columnas dinámicas ───────────────────── */
.pasos {
  font-size: 12px; color: var(--muted); line-height: 1.6;
  white-space: pre-wrap; word-break: break-word;
}
.pasos .warn { color: var(--magenta); font-weight: 600; }

.fila-dinamica {
  display: flex; gap: 6px; align-items: center; margin-bottom: 8px;
}
.fila-dinamica input { flex: 1; min-width: 0; }
.btn-quitar {
  flex-shrink: 0; width: 32px; height: 32px; border-radius: 2px;
  background: rgba(255,107,107,0.12); color: var(--danger); border: 1px solid rgba(255,107,107,0.4);
  font-size: 16px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.btn-quitar:active { background: rgba(255,107,107,0.25); border-color: var(--danger); }

.tabla-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tabla-scroll table { min-width: 100%; }
.tabla-scroll input {
  width: 84px; padding: 6px; font-size: 13px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 2px;
}
.tabla-scroll th, .tabla-scroll td { padding: 6px 4px; white-space: nowrap; }
.celda-quitar { text-align: center; }

/* ── MECANISMOS ─────────────────────────────────────────────────── */
.warn-log { color: var(--magenta) !important; }
.fila-no-conv td { background: rgba(255, 46, 196, 0.12); }
.grafica-eje { stroke: var(--line); stroke-width: 1; }
.grafica-linea { fill: none; stroke: var(--purple); stroke-width: 2; }
.grafica-titulo { fill: var(--cyan); font-size: 10px; font-family: 'Chakra Petch', sans-serif; font-weight: 600; }
.grafica-tick { fill: var(--muted); font-size: 9px; font-family: 'Inter', sans-serif; }
textarea { font-family: 'Inter', sans-serif; }
