/* Constela — sistema de diseño v2 ("bóveda de medianoche + plano técnico").
   Mezcla dos referencias (carpeta design/): Status (lienzo casi negro, UNA sola señal de color, tarjetas de 20 px,
   botones de 12 px, orbes de brillo atmosféricos) y Dovetail (retícula de plano técnico, etiquetas en monoespaciada,
   superficies planas sin sombras). Cada app tiene su propio color de señal (--accent, lo pone core.js desde app.json).
   Reglas: sin degradés en texto ni en botones (solo orbes de fondo), sin sombras fuertes, un solo color cromático por página. */

@font-face { font-family: 'Inter'; src: url('/shared/fonts/inter-latin-wght-normal.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('/shared/fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }

:root {
  /* Paleta (Status) */
  --ink: #09101c; --slate: #131d2f; --steel: #1b273d; --plate: #3a4049;
  --mist: #647084; --ash: #a1abbd; --pale: #dce0e5; --cloud: #f0f2f5; --paper: #ffffff;
  --signal: #2a4af5; --violet: #7140fd; --amber: #f6b03c;
  /* Nombres que usan las apps (se mantienen) */
  --bg: var(--ink); --s1: #0b1424; --s2: var(--slate); --s3: #1b273d; --line: #243350;
  --accent: #2a4af5; --accent-l: #8da0ff;
  --text: #f0f2f5; --text2: #a1abbd; --muted: #7c889d;
  --ok: #34d399; --bad: #ef5a5a; --warn: #f6b03c; --info: #6f86ff;
  --grid: rgba(36, 51, 80, .45);
  --radius: 20px; --radius-btn: 12px; --radius-sm: 8px;
  --shadow: 0 4px 20px rgba(9, 16, 28, .08);
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-h: var(--font);
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  position: relative; isolation: isolate; margin: 0; color: var(--text); background: var(--ink);
  font: 400 16px/1.5 var(--font); letter-spacing: -.005em; min-height: 100vh; display: flex; flex-direction: column;
  font-feature-settings: 'liga' on, 'cv11' on;
}
/* Fondo: mapa de estrellas con constelaciones (por el nombre "Constela") + orbes de brillo. Solo atmósfera: nunca lleva contenido. */
body::before {
  content: ''; position: fixed; inset: -720px 0 0 -720px; z-index: -2; pointer-events: none;
  background-image: url('/shared/constelacion.svg'); background-size: 720px 720px; background-repeat: repeat;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, .75) 55%, rgba(0, 0, 0, .45) 100%); mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, .75) 55%, rgba(0, 0, 0, .45) 100%);
  animation: cielo 240s linear infinite;
}
@keyframes cielo { to { transform: translate(720px, 720px); } }
body::after {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(520px 420px at 88% -6%, color-mix(in srgb, var(--accent) 34%, transparent), transparent 70%),
    radial-gradient(560px 460px at 4% 2%, rgba(113, 64, 253, .20), transparent 70%);
}
h1, h2, h3 { margin: 0; line-height: 1.18; font-weight: 600; letter-spacing: -.02em; }
a { color: var(--accent-l); text-underline-offset: 4px; }
a:hover { color: #fff; }
:focus-visible { outline: 2px solid var(--accent-l); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); letter-spacing: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.eyebrow { display: inline-block; font: 400 .75rem/1 var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--ash); }

/* Carcasa de las apps */
header.shell { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 0 18px; min-height: 64px; flex-wrap: wrap;
  background: color-mix(in srgb, var(--ink) 80%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--steel); }
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; font-weight: 600; letter-spacing: -.02em; }
.brand:hover { color: #fff; }
.logo { width: 28px; height: 28px; border-radius: 8px; display: block; }
.title { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 160px; padding-left: 14px; border-left: 1px solid var(--steel); }
.title .appicon { width: 28px; height: 28px; border-radius: 8px; }
.title h1 { font-size: 1.02rem; font-weight: 600; }
.chip { font: 400 .7rem var(--mono); background: var(--slate); border: 1px solid var(--steel); color: var(--ash); border-radius: 999px; padding: 2px 9px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
main { width: 100%; max-width: 1200px; margin: 0 auto; padding: 28px 24px 64px; flex: 1; }
footer.shell-foot { display: flex; gap: 18px; flex-wrap: wrap; padding: 20px 16px; border-top: 1px solid var(--steel); color: var(--muted); font-size: .85rem; justify-content: center; }
footer a { color: var(--ash); }
.link { background: none; border: 0; color: var(--ash); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; font: inherit; padding: 0; }
.link:hover { color: #fff; }

/* Controles */
.btn { font: 500 .94rem var(--font); letter-spacing: -.005em; background: var(--slate); color: var(--text); border: 1px solid var(--steel); border-radius: var(--radius-btn); padding: 8px 16px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; transition: background .15s, border-color .15s, transform .1s; }
.btn:hover:not(:disabled) { background: var(--steel); color: #fff; border-color: var(--plate); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 86%, #fff); border-color: transparent; color: #fff; }
.btn.small { min-height: 34px; padding: 4px 12px; font-size: .85rem; border-radius: 10px; }
.btn.big { min-height: 48px; padding: 10px 22px; font-size: 1rem; }
.premium-btn { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 45%, var(--steel)); }
.premium-btn.on { background: color-mix(in srgb, var(--amber) 14%, var(--slate)); }
.icon-btn { background: none; border: 0; color: var(--ash); font-size: 1.1rem; cursor: pointer; min-width: 40px; min-height: 40px; border-radius: 10px; }
.icon-btn:hover { background: var(--steel); color: #fff; }
input, select, textarea { font: 400 1rem var(--font); width: 100%; background: var(--s1); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-btn); padding: 9px 12px; min-height: 42px; transition: border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color: #55617a; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-l); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent); }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--accent); }
input[type=range] { padding: 0; accent-color: var(--accent); min-height: 28px; border: 0; box-shadow: none; background: none; }
input[type=color] { padding: 2px; height: 42px; }
label { display: block; font-size: .82rem; font-weight: 500; color: var(--ash); margin: 14px 0 5px; }
label.inline { display: inline-flex; align-items: center; gap: 8px; margin: 6px 14px 6px 0; font-size: .95rem; color: var(--text); font-weight: 400; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; align-items: center; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.card { background: var(--slate); border: 1px solid var(--steel); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card h2 { font-size: 1.1rem; margin-bottom: 10px; }
.pro { font: 400 .62rem var(--mono); letter-spacing: .08em; background: var(--amber); color: #1a1205; border-radius: 4px; padding: 2px 6px; vertical-align: middle; margin-left: 6px; }
.msg { min-height: 1.2em; margin: 8px 0 0; font-size: .9rem; }
.msg.bad, .bad { color: var(--bad); }
.msg.ok, .ok { color: var(--ok); }
.tip { background: color-mix(in srgb, var(--info) 12%, transparent); border-left: 3px solid var(--info); padding: 8px 12px; border-radius: 6px; }
.warn { color: var(--warn); }
p.warn { background: color-mix(in srgb, var(--warn) 10%, transparent); border-left: 3px solid var(--warn); padding: 8px 12px; border-radius: 6px; color: var(--text); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--steel); }
th { color: var(--ash); font: 400 .72rem var(--mono); letter-spacing: .06em; text-transform: uppercase; }
td.num, th.num { text-align: right; font-family: var(--mono); }
.bar { height: 6px; background: var(--ink); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); transition: width .25s; }

/* Modal, avisos */
.backdrop { position: fixed; inset: 0; background: rgba(5, 9, 17, .78); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: var(--slate); border: 1px solid var(--line); border-radius: var(--radius); width: 100%; max-width: 520px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 30px 80px -20px #000; }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--steel); }
.modal-head h2 { font-size: 1.05rem; }
.modal-body { padding: 18px 20px 22px; overflow: auto; }
.modal-body h3 { margin: 20px 0 6px; color: var(--accent-l); font: 400 .75rem var(--mono); letter-spacing: .07em; text-transform: uppercase; }
.modal-body h3:first-child { margin-top: 0; }
.toasts { position: fixed; left: 12px; right: 12px; top: 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 60; pointer-events: none; }
.toast { background: var(--steel); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 12px; padding: 10px 14px; display: flex; align-items: center; gap: 12px; pointer-events: auto; max-width: 560px; }
.consent { position: fixed; left: 12px; right: 12px; bottom: 12px; max-width: 760px; margin: 0 auto; background: var(--slate); border: 1px solid var(--line); border-radius: 16px; padding: 10px 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; z-index: 40; font-size: .9rem; }
.consent span { flex: 1; min-width: 200px; }
.blocker { position: fixed; inset: 0; background: rgba(5, 9, 17, .95); display: grid; place-items: center; z-index: 90; padding: 20px; text-align: center; }
.blocker .box { background: var(--slate); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; max-width: 420px; display: grid; gap: 12px; justify-items: center; }

/* Impresión */
@media print {
  body { background: #fff; color: #000; display: block; }
  body::before, body::after { display: none; }
  header.shell, footer.shell-foot, .consent, .toasts, .no-print { display: none !important; }
  main { max-width: none; padding: 0; }
  .card { background: #fff; border-color: #bbb; color: #000; box-shadow: none; }
  .muted, th { color: #444; }
  a { color: #000; }
}
@media (max-width: 560px) {
  .title { order: 3; flex-basis: 100%; border-left: 0; padding: 0 0 10px; }
  header.shell .actions { margin-left: auto; }
  main { padding: 20px 14px 56px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* Compra online dentro de la app */
.buy-box { border: 1px solid var(--accent-l, #b79cf0); border-radius: 14px; padding: 12px 14px; margin: 12px 0; background: color-mix(in srgb, var(--accent, #774ab3) 10%, transparent); }
.buy-box h3 { margin: 0 0 8px; font-size: 1rem; }
.buy-plan { display: flex; align-items: center; gap: 10px; padding: 8px 4px; cursor: pointer; }
.buy-plan input { width: auto; margin: 0; }
.buy-plan span:nth-of-type(1) { flex: 1; }
.buy-price { font-weight: 700; white-space: nowrap; }
