/* Albor: la app de los bots. Oscura como la maqueta; clara si el iPhone está en modo claro. */
:root {
  --bg: #0b0d10;
  --card: #15181d;
  --card-2: #1d2128;
  --line: #262b33;
  --tx: #f3f5f8;
  --tx2: #8d96a5;
  --tx3: #6f7785;
  --green: #2fbf71;
  --red: #f0565a;
  --amber: #f2a93b;
  --blue: #4c8dff;
  --blue-soft: rgba(76, 141, 255, .14);
  --blue-tx: #9cc0ff;
  --tec: #84a6ff;
  --fun: #f1b653;
  --purple: #c6a0ff;
  --barra: rgba(15, 18, 22, .9);
  --sombra: 0 10px 30px rgba(0, 0, 0, .45);
  --radio: 18px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f2f3f6;
    --card: #ffffff;
    --card-2: #eceef2;
    --line: #dfe3e9;
    --tx: #111418;
    --tx2: #5d6573;
    --tx3: #8a93a2;
    --green: #128a50;
    --red: #d23b3f;
    --amber: #a86400;
    --blue: #2c6be0;
    --blue-soft: rgba(44, 107, 224, .1);
    --blue-tx: #1f57c3;
    --tec: #2450c6;
    --fun: #8f5300;
    --purple: #6e3baa;
    --barra: rgba(248, 249, 251, .9);
    --sombra: 0 10px 30px rgba(20, 30, 50, .12);
    color-scheme: light;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--tx); }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { min-height: 100vh; min-height: 100dvh; font: 400 15px/1.4 var(--font); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
a { color: var(--blue); text-decoration: none; }
p { margin: 0; }
h1, h2, h3 { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.up { color: var(--green); }
.down { color: var(--red); }
.muted { color: var(--tx2); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }

/* Arranque */
.arranque { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 30; }
.arranque img { border-radius: 16px; opacity: .9; }

/* Pantallas */
.pantalla {
  max-width: 640px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) max(16px, env(safe-area-inset-right, 0px))
           calc(env(safe-area-inset-bottom, 0px) + 92px) max(16px, env(safe-area-inset-left, 0px));
  display: flex; flex-direction: column; gap: 12px;
}
.h1 { font-size: 30px; font-weight: 700; letter-spacing: -.4px; line-height: 1.15; }
.h2 { font-size: 20px; font-weight: 700; letter-spacing: -.2px; line-height: 1.2; }
.sub { font-size: 14px; color: var(--tx2); margin-top: -8px; }
.seccion { font-size: 13px; font-weight: 600; color: var(--tx2); text-transform: uppercase; letter-spacing: .06em; margin: 10px 2px -4px; }

.card { background: var(--card); border-radius: var(--radio); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
button.card { border: 0; text-align: left; cursor: pointer; width: 100%; }
button.card:active { transform: scale(.99); }
.row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row.entre { justify-content: space-between; }
.tag { font-size: 13px; font-weight: 600; color: var(--tx2); flex: 1; }
.precio { font-size: 34px; font-weight: 700; letter-spacing: -.6px; line-height: 1.15; }
.unit { font-size: .55em; color: var(--tx2); font-weight: 600; letter-spacing: 0; }
.cambio { font-size: 14px; font-weight: 600; }
.chispa { display: block; width: 100%; height: 46px; margin-top: 4px; overflow: visible; }
.chispa polyline { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chispa polyline.up { stroke: var(--green); }
.chispa polyline.down { stroke: var(--red); }
.frescura { font-size: 12.5px; color: var(--amber); }

.pill { display: inline-flex; align-items: center; gap: 8px; background: var(--blue-soft); color: var(--blue-tx); border-radius: 999px;
        padding: 9px 14px; font-size: 13.5px; font-weight: 600; align-self: flex-start; max-width: 100%; }
.pill svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; }

.bname { font-size: 16px; font-weight: 700; white-space: nowrap; }
.badge { font-size: 11px; font-weight: 600; color: var(--tx2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; white-space: nowrap; }
.badge.amber { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 50%, transparent); }
.badge.verde { color: var(--green); border-color: color-mix(in srgb, var(--green) 45%, transparent); }
.badge.rojo { color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, transparent); }
.badge.gris { color: var(--tx2); }
.state { margin-left: auto; font-size: 12.5px; font-weight: 600; color: var(--tx2); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: none; }
.dot.amber { background: var(--amber); }
.dot.rojo { background: var(--red); }
.dot.azul { background: var(--blue); }
.dot.verde { background: var(--green); }
.dot.gris { background: var(--tx3); }
.k { font-size: 12.5px; font-weight: 500; color: var(--tx2); margin-top: 6px; }
.v { font-size: 26px; font-weight: 700; letter-spacing: -.4px; line-height: 1.2; }
.v .extra { font-size: 13px; font-weight: 600; letter-spacing: 0; margin-left: 4px; }
.note { font-size: 13.5px; font-weight: 500; color: var(--tx2); }
.note.rojo { color: var(--red); }
.linea { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; font-weight: 500; color: var(--tx2);
         border-top: 1px solid var(--line); padding-top: 10px; margin-top: 6px; }
.linea b { font-weight: 700; white-space: nowrap; }
.pos { display: grid; gap: 6px; margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.pos .row { font-size: 14px; }
.pos .lado { font-weight: 700; }
.barras { display: flex; gap: 6px; flex-wrap: wrap; font-size: 12.5px; color: var(--tx2); }
.barras span { background: var(--card-2); border-radius: 8px; padding: 3px 8px; white-space: nowrap; }

/* Selector Real | Paper */
.seg { display: flex; background: var(--card); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { flex: 1; text-align: center; font-size: 14px; font-weight: 600; color: var(--tx2); padding: 7px 0; border-radius: 8px;
              border: 0; background: none; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--card-2); color: var(--tx); box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }

.big { font-size: 40px; font-weight: 700; letter-spacing: -.8px; line-height: 1.1; }
.grafico-caja { background: var(--card); border-radius: var(--radio); padding: 10px 6px 6px; }
.grafico { height: 300px; width: 100%; position: relative; }
.grafico.bajo { height: 210px; }
.grafico-nota { font-size: 12px; color: var(--tx3); padding: 4px 8px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid2 > div { background: var(--card); border-radius: 14px; padding: 10px 12px; min-width: 0; }
.grid2 .k { margin-top: 0; }
.v2 { font-size: 17px; font-weight: 700; margin-top: 2px; }
.s { font-size: 12px; font-weight: 500; color: var(--tx2); margin-top: 2px; }

/* Duelo */
.brazo { border-left: 4px solid var(--tec); }
.brazo.fun { border-left-color: var(--fun); }
.brazo h3 { font-size: 16px; font-weight: 700; }
.brazo.tec h3 { color: var(--tec); }
.brazo.fun h3 { color: var(--fun); }
.dir { font-weight: 700; }
.dir.LONG { color: var(--green); }
.dir.SHORT { color: var(--red); }
.dir.NEUTRAL { color: var(--tx2); }
.niveles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 6px; }
.niveles > div { background: var(--card-2); border-radius: 10px; padding: 6px 8px; min-width: 0; }
.niveles .k { margin: 0; font-size: 11.5px; }
.niveles b { font-size: 14.5px; }
.texto { font-size: 14px; line-height: 1.45; color: var(--tx); white-space: pre-wrap; overflow-wrap: anywhere; }
.texto.suave { color: var(--tx2); }
details { margin-top: 4px; }
summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--blue); list-style: none; padding: 4px 0; }
summary::-webkit-details-marker { display: none; }
summary::after { content: " ›"; }
details[open] summary::after { content: " ⌄"; }
.vigilar { margin: 4px 0 0; padding-left: 18px; display: grid; gap: 4px; font-size: 14px; }
.factor { display: grid; gap: 4px; padding: 10px 0; border-top: 1px solid var(--line); }
.factor:first-of-type { border-top: 0; }
.sesgo { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; width: 92px; flex: none; }
.sesgo i { height: 6px; border-radius: 3px; background: var(--card-2); }
.sesgo i.on.neg { background: var(--red); }
.sesgo i.on.pos { background: var(--green); }
.sesgo i.on.cero { background: var(--tx3); }
.titular { display: grid; gap: 2px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.titular:first-of-type { border-top: 0; }
.agenda { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 14px; }
.agenda .fecha { color: var(--tx2); white-space: nowrap; }

/* Avisos */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { font-size: 13px; font-weight: 600; color: var(--tx2); background: var(--card); border-radius: 999px; padding: 7px 13px;
                border: 0; cursor: pointer; white-space: nowrap; }
.chips button[aria-pressed="true"] { background: var(--tx); color: var(--bg); }
.dia { font-size: 13px; font-weight: 700; color: var(--tx2); margin: 8px 2px -2px; }
.aviso { border-bottom: 1px solid var(--line); padding: 4px 2px 12px; }
.aviso-cab { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 600; color: var(--tx2); }
.quien { display: flex; align-items: center; gap: 7px; }
.aviso-titulo { font-size: 15.5px; font-weight: 700; margin-top: 4px; overflow-wrap: anywhere; }
.aviso-texto { font-size: 13.5px; font-weight: 500; color: var(--tx2); margin-top: 2px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.boton-sec { align-self: center; border: 0; background: var(--card); color: var(--blue); font-weight: 600; border-radius: 999px; padding: 9px 18px; cursor: pointer; }

/* Notificaciones */
.interruptor { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0;
               border-top: 1px solid var(--line); font-size: 14.5px; cursor: pointer; }
.interruptor input { -webkit-appearance: none; appearance: none; width: 46px; height: 28px; margin: 0; flex: none;
                     border-radius: 999px; background: var(--line); position: relative; cursor: pointer; transition: background .15s; }
.interruptor input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
                            background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .15s; }
.interruptor input:checked { background: var(--green); }
.interruptor input:checked::after { transform: translateX(18px); }
.interruptor input:disabled { opacity: .6; }
.botones { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.boton-peq { padding: 11px 16px; font-size: 15px; margin-top: 8px; }
.boton-sec.rojo { color: var(--red); }
.boton-sec:disabled { opacity: .55; }

/* Historial */
.ops { display: grid; }
.op { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 2px; border-top: 1px solid var(--line); font-size: 14px; }
.op:first-child { border-top: 0; }
.op .neto { font-weight: 700; text-align: right; white-space: nowrap; }
.op .s { grid-column: 1 / -1; margin-top: 0; }
.pie { font-size: 12px; color: var(--tx3); text-align: center; padding: 8px 0 2px; line-height: 1.5; }
.pie a { color: var(--tx2); text-decoration: underline; text-underline-offset: 2px; }
.vacio { text-align: center; color: var(--tx2); padding: 36px 12px; font-size: 15px; }
.error-pant { color: var(--red); font-size: 14px; }

/* Barra de pestañas */
.pestanas {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: space-around;
  padding: 8px max(6px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 6px) max(6px, env(safe-area-inset-left, 0px));
  background: var(--barra); -webkit-backdrop-filter: saturate(160%) blur(18px); backdrop-filter: saturate(160%) blur(18px);
  border-top: 1px solid var(--line);
}
.pestana { appearance: none; border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 3px;
           font-size: 10.5px; font-weight: 600; color: var(--tx3); width: 64px; padding: 2px 0; cursor: pointer; }
.pestana svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pestana[aria-current="page"] { color: var(--blue); }

/* Sin conexión */
.red { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 8px); left: 50%; transform: translateX(-50%); z-index: 20;
       background: var(--card-2); color: var(--tx); font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 999px;
       box-shadow: var(--sombra); max-width: calc(100% - 32px); text-align: center; }

/* Entrada */
.entrada { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center;
           padding: calc(env(safe-area-inset-top, 0px) + 24px) 24px calc(env(safe-area-inset-bottom, 0px) + 24px); }
.entrada-caja { width: 100%; max-width: 360px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.entrada-icono { border-radius: 18px; box-shadow: var(--sombra); }
.entrada h1 { font-size: 30px; font-weight: 700; letter-spacing: -.4px; }
.entrada-texto { color: var(--tx2); font-size: 15px; }
.boton { width: 100%; border: 0; border-radius: 14px; padding: 14px 18px; font-size: 16px; font-weight: 700; color: #fff; background: var(--blue); cursor: pointer; }
.boton:disabled { opacity: .55; }
.enlace { border: 0; background: none; color: var(--blue); font-size: 14.5px; font-weight: 600; cursor: pointer; padding: 6px; }
.alta { width: 100%; display: grid; gap: 10px; text-align: left; }
.alta label { font-size: 13px; font-weight: 600; color: var(--tx2); }
.alta input { width: 100%; font: 600 20px/1.2 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .08em; text-align: center;
              text-transform: uppercase; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--tx); }
.entrada-error { color: var(--red); font-size: 14px; font-weight: 500; }
.noscript { padding: 24px; text-align: center; }

@media (min-width: 700px) {
  .pantalla { padding-top: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
