/* Plexium Tino — la piel de Tino de la app (orbe con destellos, sello IA magenta, burbujas) sobre la marca Plexium. */
@font-face {
  font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 500 800; font-display: swap;
  src: url("fonts/plus-jakarta-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 500 800; font-display: swap;
  src: url("fonts/plus-jakarta-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #FBFAFE; --surface: #FFFFFF; --surface2: #F4F2FB; --ink: #201939; --muted: #5A5578; --line: #E6E2F4;
  --primary: #6B4EE6; --on-primary: #FFFFFF; --primary-soft: #F1EDFE; --grad-a: #8A52F4; --grad-b: #2A6BE0;
  --ai: #8B005A; --ai-bright: #B3127A; --ai-soft: #FCE8F4; --spark: #F59BD3;
  --ok: #0E6B45; --ok-soft: #DDF3E8; --ok-fill: #2BB57E; --warn: #8A5300; --warn-soft: #FCEFD3; --warn-fill: #F0A020;
  --err: #B42318; --err-soft: #FBE0DD; --info: #0B6277;
  --side: #241C5A; --side-ink: #EDEBFA; --side-muted: #BFB1FE; --side-active: #F1EDFE; --side-active-ink: #5638CD;
  --c1: #6B4EE6; --c2: #2A6BE0; --c3: #B3127A; --c4: #2BB57E; --c5: #F0A020; --c6: #0B6277;
  --bar: #6B4EE6; --bar-prev: #DCD5FB; --bar-hi: #B3127A;
  --shadow: 0 1px 2px rgba(32, 25, 57, .06), 0 8px 24px rgba(32, 25, 57, .06);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15122B; --surface: #201939; --surface2: #282549; --ink: #EDEEF5; --muted: #B1AFC0; --line: #353155;
    --primary: #A894FB; --on-primary: #15122B; --primary-soft: #282549; --ai: #F59BD3; --ai-bright: #F59BD3; --ai-soft: #3A1D3A;
    --ok: #4FCB8B; --ok-soft: #173D2E; --warn: #F0B54A; --warn-soft: #3D2F12; --err: #F07A7A; --err-soft: #44201F; --info: #6FC7DA;
    --side: #1A1540; --bar: #A894FB; --bar-prev: #3A3466; --bar-hi: #F59BD3; --c1: #A894FB; --c2: #6FA0F5; --c3: #F59BD3;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15122B; --surface: #201939; --surface2: #282549; --ink: #EDEEF5; --muted: #B1AFC0; --line: #353155;
  --primary: #A894FB; --on-primary: #15122B; --primary-soft: #282549; --ai: #F59BD3; --ai-bright: #F59BD3; --ai-soft: #3A1D3A;
  --ok: #4FCB8B; --ok-soft: #173D2E; --warn: #F0B54A; --warn-soft: #3D2F12; --err: #F07A7A; --err-soft: #44201F; --info: #6FC7DA;
  --side: #1A1540; --bar: #A894FB; --bar-prev: #3A3466; --bar-hi: #F59BD3; --c1: #A894FB; --c2: #6FA0F5; --c3: #F59BD3;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 500 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 8px; }

/* ── Orbe con destellos (como TinoOrb de la app) ── */
.orb { --s: 40px; width: var(--s); height: var(--s); flex: none; border-radius: 50%; position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--primary-soft), var(--ai-soft)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 18%, transparent); }
.orb.sm { --s: 28px; } .orb.lg { --s: 72px; }
/* Destello de cuatro puntas (mismo dibujo que la app), en % para cualquier tamaño. */
.orb::before, .orb::after { content: ""; position: absolute; background: linear-gradient(135deg, var(--primary), var(--ai));
  clip-path: polygon(50% 0, 58% 42%, 100% 50%, 58% 58%, 50% 100%, 42% 58%, 0 50%, 42% 42%); }
.orb::before { width: 46%; height: 46%; left: 18%; top: 30%; transform-origin: center; animation: breathe 3.2s ease-in-out infinite; }
.orb::after { width: 24%; height: 24%; left: 56%; top: 20%; animation: pulse 3.2s ease-in-out infinite; }
.orb.thinking::before { animation: spin 2.4s cubic-bezier(.65, 0, .35, 1) infinite; }
.orb.thinking::after { animation: pulse 0.8s ease-in-out infinite; }
.orb.thinking { background: linear-gradient(110deg, var(--primary-soft) 30%, color-mix(in srgb, var(--surface) 80%, transparent) 50%, var(--ai-soft) 70%);
  background-size: 300% 100%; animation: sweep 2.4s linear infinite; }
@keyframes breathe { 50% { transform: scale(1.06); } }
@keyframes pulse { 50% { transform: scale(1.2); } }
@keyframes spin { to { transform: rotate(180deg); } }
@keyframes sweep { to { background-position: -300% 0; } }
@media (prefers-reduced-motion: reduce) { .orb, .orb::before, .orb::after { animation: none !important; } }

.ia { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 99px; background: var(--ai); color: #fff;
  font: 800 11px/18px var(--font); letter-spacing: .04em; }
:root:not([data-theme="light"]) .ia { color: #FFFFFF; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ia { background: #8B005A; } }

/* ── Botones y campos ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border: 0; border-radius: 12px;
  background: var(--primary); color: var(--on-primary); font-weight: 700; text-decoration: none; }
.btn.ok { background: #0E6B45; color: #fff; } .btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn:disabled { opacity: .55; cursor: default; }
.field { width: 100%; min-height: 52px; padding: 0 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }

/* ── Ingreso ── */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 28px 24px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { margin: 6px 0 0; font-size: 26px; font-weight: 800; letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.muted { color: var(--muted); } .small { font-size: 14px; }
.msg { font-weight: 600; font-size: 14px; } .msg.err { color: var(--err); } .msg.ok { color: var(--ok); }
.boot { min-height: 100vh; display: grid; place-items: center; }

/* ── Estructura ── */
.shell { display: grid; grid-template-columns: 1fr; height: 100vh; height: 100dvh; }
.side { display: none; }
.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; height: 100dvh; }
@media (min-width: 1024px) {
  .shell { grid-template-columns: 300px 1fr; }
  .side { display: flex; flex-direction: column; gap: 6px; background: var(--side); color: var(--side-ink); padding: 18px 14px; overflow-y: auto; }
  .top .menu, .chips { display: none !important; }
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 14px; font-weight: 800; font-size: 20px; }
.brand small { display: block; font-size: 12px; font-weight: 600; color: var(--side-muted); }
.side h2 { margin: 14px 8px 4px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--side-muted); }
.biz { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 10px; border: 0; border-radius: 12px; background: transparent; color: inherit; }
.biz:hover { background: rgba(255, 255, 255, .07); }
.biz.on { background: var(--side-active); color: var(--side-active-ink); }
.biz .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; font-weight: 800; font-size: 13px;
  background: rgba(255, 255, 255, .12); }
.biz.on .ic { background: #fff; }
.biz .tx { min-width: 0; } .biz b { display: block; font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.biz span { display: block; font-size: 12px; opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .grow { flex: 1; }
.side select { width: 100%; min-height: 44px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .08); color: var(--side-ink); padding: 0 10px; }
.side select option { color: #201939; }
.side .foot { border-top: 1px solid rgba(255, 255, 255, .12); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.side .foot a, .side .foot button { color: var(--side-muted); background: none; border: 0; padding: 4px 6px; text-align: left; text-decoration: none; font-weight: 600; }
.tab { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border: 0; border-radius: 12px; background: transparent; color: inherit; font-weight: 700; text-align: left; }
.tab.on { background: rgba(255, 255, 255, .1); } .tab .soon { margin-left: auto; font-size: 11px; color: var(--side-muted); font-weight: 600; }

.top { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface); min-height: 64px; }
.top .t { flex: 1; min-width: 0; }
.top .t b { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 800; }
.top .t span { display: block; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 44px; height: 44px; flex: none; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; font-size: 20px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface); scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; max-width: 240px; min-height: 40px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }

/* ── Conversación ── */
.thread { flex: 1; overflow-y: auto; padding: 20px 16px 24px; }
.col { max-width: 780px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.welcome { display: flex; flex-direction: column; gap: 12px; padding-top: 12px; }
.welcome h1 { margin: 6px 0 0; font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--primary-soft); font-size: 14px; }
.sugs { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .sugs { grid-template-columns: 1fr 1fr; } }
.sug { min-height: 56px; padding: 12px 14px; text-align: left; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; box-shadow: var(--shadow); }
.sug:hover { border-color: var(--primary); }
.q { align-self: flex-end; max-width: min(88%, 560px); background: var(--primary); color: var(--on-primary); padding: 12px 16px; border-radius: 18px 18px 4px 18px;
  font-weight: 600; overflow-wrap: anywhere; }
.a { display: flex; flex-direction: column; gap: 10px; }
.who { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.bubble { position: relative; padding: 16px 18px; border-radius: 4px 18px 18px 18px; background: var(--surface); white-space: pre-wrap; overflow-wrap: anywhere;
  border: 1.5px solid transparent; background-image: linear-gradient(var(--surface), var(--surface)), linear-gradient(135deg, var(--primary), var(--ai));
  background-origin: border-box; background-clip: padding-box, border-box; box-shadow: var(--shadow); }
.bubble strong { font-weight: 800; }
.thinking-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.thinking-row b { display: block; font-size: 13px; color: var(--ai-bright); } .thinking-row span { font-size: 14px; }
.follow { display: flex; flex-wrap: wrap; gap: 8px; }
.follow button { min-height: 40px; padding: 6px 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 14px; text-align: left; }
.src { font-size: 12px; color: var(--muted); }
.blocks { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .blocks { grid-template-columns: 1fr 1fr; } .blocks > .wide { grid-column: 1 / -1; } }
.fade-in { animation: fade .4s ease both; } @keyframes fade { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .fade-in { animation: none; } }

.cardx { padding: 20px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.cardx h2 { margin: 0; font-size: 20px; font-weight: 800; }
.cardx.err { border-color: color-mix(in srgb, var(--err) 40%, var(--line)); }
.cardx.ai { border: 1.5px solid transparent; background-image: linear-gradient(var(--surface), var(--surface)), linear-gradient(135deg, var(--primary), var(--ai));
  background-origin: border-box; background-clip: padding-box, border-box; }
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.checks li { display: flex; gap: 10px; align-items: flex-start; } .checks li::before { content: "✓"; flex: none; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); font-weight: 800; font-size: 13px; }

.composer { border-top: 1px solid var(--line); background: var(--surface); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
.composer form { max-width: 780px; margin: 0 auto; display: flex; gap: 10px; }
.composer input { flex: 1; min-width: 0; min-height: 52px; padding: 0 18px; border-radius: 99px; border: 1px solid var(--line); background: var(--bg); }
.composer .send { width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--primary); color: var(--on-primary); font-size: 22px; flex: none; }
.composer .send:disabled { opacity: .45; }
.composer p { max-width: 780px; margin: 8px auto 0; font-size: 12px; color: var(--muted); }

/* ── Bloques ── */
.blk { min-width: 0; padding: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.blk-t { margin: 0; font-size: 14px; font-weight: 700; color: var(--muted); }
.blk-n { margin: 0; font-size: 12px; color: var(--muted); }
.metrics { padding: 0; border: 0; background: none; gap: 10px; }
.m { padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.m-t { font-size: 13px; color: var(--muted); font-weight: 600; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.m-l { font-size: 14px; font-weight: 800; margin-top: 4px; }
.m-v { font-size: 22px; font-weight: 800; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; overflow-wrap: anywhere; }
.m.hero .m-v { font-size: 30px; }
.m-h, .m-d { font-size: 12px; color: var(--muted); margin-top: 4px; }
.m-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.delta { font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 99px; }
.delta.up { background: var(--ok-soft); color: var(--ok); } .delta.down { background: var(--err-soft); color: var(--err); }
.bars { width: 100%; height: 132px; display: block; }
.b-bar { fill: var(--bar); } .b-bar.hi { fill: var(--bar-hi); } .b-prev { fill: var(--bar-prev); }
.b-x { position: relative; height: 18px; font-size: 11px; color: var(--muted); }
.b-x span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.legend { display: flex; gap: 6px 14px; align-items: center; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.sw.now { background: var(--bar); } .sw.prev { background: var(--bar-prev); }
.donut { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.donut svg { width: 120px; height: 120px; flex: none; }
.dn-lg { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.dn-lg li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dn-l { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .dn-v { font-weight: 700; white-space: nowrap; }
.rk { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.rk li { display: flex; gap: 10px; } .rk-n { width: 24px; height: 24px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); font-weight: 800; font-size: 12px;
  display: grid; place-items: center; flex: none; }
.rk-b { flex: 1; min-width: 0; } .rk-top { display: flex; gap: 10px; justify-content: space-between; }
.rk-l { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .rk-v { font-weight: 800; white-space: nowrap; }
.rk-s { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.rk-bar { height: 6px; border-radius: 99px; background: var(--surface2); margin-top: 6px; overflow: hidden; }
.rk-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--grad-a), var(--grad-b)); }
.tbl-wrap { overflow-x: auto; margin: 0 -4px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 6px 4px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 4px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .end { text-align: right; white-space: nowrap; font-weight: 700; }
.td-s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.ok.badge, .ok.dot, .av.ok { background: var(--ok-soft); color: var(--ok); } .warn.badge, .av.warn { background: var(--warn-soft); color: var(--warn); }
.err.badge, .av.err { background: var(--err-soft); color: var(--err); } .ai.badge, .av.ai { background: var(--ai-soft); color: var(--ai); }
.muted.badge, .av.muted { background: var(--surface2); color: var(--muted); }
.dot.warn { background: var(--warn-fill); } .dot.err { background: var(--err); } .dot.ok { background: var(--ok-fill); } .dot.ai { background: var(--ai); } .dot.muted { background: var(--muted); }
.ls-total { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface2); }
.ls-total .m-v { font-size: 22px; margin: 0; }
.ls { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.ls li { display: flex; gap: 10px; align-items: center; }
.av { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.ls-b { flex: 1; min-width: 0; } .ls-l { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .ls-s { font-size: 12px; color: var(--muted); }
.ls-r { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; max-width: 50%; }
.ls-v { font-weight: 800; white-space: nowrap; }

/* ── Menú del celular ── */
dialog.sheet { border: 0; padding: 0; width: min(420px, 100%); max-height: 90vh; border-radius: 20px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
dialog.sheet::backdrop { background: rgba(21, 18, 43, .5); }
.sheet-in { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.sheet-in select { width: 100%; min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); padding: 0 12px; }
