/* BuyTron — sistema visual.
   Mobile primero; desde 960 px la navegación pasa a una barra lateral.
   Colores como tokens; el modo oscuro tiene sus propios pasos (no es una inversión). */

:root {
  color-scheme: light;
  --bg: #f5f5f8;
  --surface: #ffffff;
  --surface-2: #f0f0f5;
  --surface-3: #e7e7ef;
  --line: #e2e2ea;
  --line-strong: #cfcfdb;
  --text: #15151c;
  --text-2: #55556a;
  --text-3: #8a8a9e;
  --brand: #4338ca;
  --brand-2: #6d28d9;
  --brand-soft: #eef0ff;
  --brand-ink: #3730a3;
  --on-brand: #ffffff;
  --familia: #e8590c;
  --familia-soft: #fff1e8;
  --empresa: #1d64d8;
  --empresa-soft: #e9f1ff;
  --online: #7c3aed;
  --online-soft: #f3edff;
  --good: #0a8f0a;
  --good-soft: #e8f7e8;
  --warning: #b77900;
  --warning-mark: #fab219;
  --warning-soft: #fff6e0;
  --critical: #c42f2f;
  --critical-soft: #fdecec;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --shadow-1: 0 1px 2px rgba(20, 20, 40, .06), 0 1px 3px rgba(20, 20, 40, .04);
  --shadow-2: 0 8px 28px rgba(20, 20, 50, .12), 0 2px 6px rgba(20, 20, 50, .06);
  --radius: 16px;
  --radius-sm: 10px;
  --gutter: 16px;
  --nav-h: 68px;
  --top-h: 56px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --num: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #101015; --surface: #18181f; --surface-2: #202029; --surface-3: #2a2a35; --line: #2c2c37; --line-strong: #3a3a47;
    --text: #f1f1f5; --text-2: #b4b4c4; --text-3: #7d7d90;
    --brand: #7c7cf8; --brand-2: #a78bfa; --brand-soft: #23234a; --brand-ink: #b9b9ff; --on-brand: #0d0d1a;
    --familia: #ff8a4c; --familia-soft: #3a2216; --empresa: #6aa5ff; --empresa-soft: #172640;
    --online: #b18cff; --online-soft: #2a1f45; --good: #4cc94c; --good-soft: #15301a; --warning: #fab219; --warning-soft: #3a2e10;
    --critical: #ff6b6b; --critical-soft: #3d1a1a; --series-1: #3987e5; --series-2: #d95926;
    --shadow-1: 0 1px 2px rgba(0,0,0,.4); --shadow-2: 0 10px 30px rgba(0,0,0,.5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101015; --surface: #18181f; --surface-2: #202029; --surface-3: #2a2a35; --line: #2c2c37; --line-strong: #3a3a47;
  --text: #f1f1f5; --text-2: #b4b4c4; --text-3: #7d7d90;
  --brand: #7c7cf8; --brand-2: #a78bfa; --brand-soft: #23234a; --brand-ink: #b9b9ff; --on-brand: #0d0d1a;
  --familia: #ff8a4c; --familia-soft: #3a2216; --empresa: #6aa5ff; --empresa-soft: #172640;
  --online: #b18cff; --online-soft: #2a1f45; --good: #4cc94c; --good-soft: #15301a; --warning: #fab219; --warning-soft: #3a2e10;
  --critical: #ff6b6b; --critical-soft: #3d1a1a; --series-1: #3987e5; --series-2: #d95926;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4); --shadow-2: 0 10px 30px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-ink); text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 24px; font-weight: 750; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0; }
.num { font-family: var(--num); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.strong { font-weight: 650; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.arranque { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--text-2); font-weight: 650; }
.arranque img { border-radius: 18px; animation: latir 1.4s ease-in-out infinite; }
@keyframes latir { 50% { transform: scale(.94); opacity: .8; } }

/* ── Estructura ───────────────────────────────────────────── */
.app { min-height: 100dvh; }
.top {
  position: sticky; top: 0; z-index: 30; height: calc(var(--top-h) + var(--safe-t)); padding: var(--safe-t) var(--gutter) 0;
  display: flex; align-items: center; gap: 10px; background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); border-bottom: 1px solid transparent;
}
.top.con-borde { border-bottom-color: var(--line); }
.top .titulo { font-size: 17px; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .marca { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: -0.02em; font-size: 18px; }
.top .marca img { width: 28px; height: 28px; border-radius: 8px; }
.main { padding: 8px var(--gutter) calc(var(--nav-h) + var(--safe-b) + 28px); max-width: 1180px; margin: 0 auto; }
.pantalla { display: grid; gap: 16px; animation: entrar .18s ease-out; }
@keyframes entrar { from { opacity: 0; transform: translateY(4px); } }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: calc(var(--nav-h) + var(--safe-b)); padding: 0 6px var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; background: var(--surface); border-top: 1px solid var(--line);
}
.nav a { display: grid; justify-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--text-3); padding: 8px 0; border-radius: 12px; }
.nav a svg { width: 24px; height: 24px; }
.nav a.activo { color: var(--brand-ink); }
.nav .fab {
  justify-self: center; width: 58px; height: 58px; border-radius: 20px; display: grid; place-items: center; margin-top: -26px;
  background: linear-gradient(145deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: 0 10px 24px color-mix(in srgb, var(--brand) 45%, transparent);
  border: 4px solid var(--bg);
}
.nav .fab svg { width: 28px; height: 28px; }
.lateral { display: none; }

@media (min-width: 960px) {
  :root { --gutter: 28px; }
  .app { display: grid; grid-template-columns: 248px 1fr; }
  .nav { display: none; }
  .lateral {
    display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100dvh; padding: 20px 14px; border-right: 1px solid var(--line);
    background: var(--surface); overflow-y: auto;
  }
  .lateral .marca { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: -0.02em; padding: 4px 10px 18px; }
  .lateral .marca img { width: 34px; height: 34px; border-radius: 10px; }
  .lateral .cargar { margin: 0 4px 14px; }
  .lateral a.item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: var(--text-2); font-weight: 600; font-size: 14px; }
  .lateral a.item svg { width: 20px; height: 20px; flex: none; }
  .lateral a.item:hover { background: var(--surface-2); color: var(--text); }
  .lateral a.item.activo { background: var(--brand-soft); color: var(--brand-ink); }
  .lateral .grupo { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 16px 12px 6px; }
  .lateral .pie { margin-top: auto; padding-top: 16px; }
  .main { padding: 8px var(--gutter) 48px; }
  .top { padding: 0 var(--gutter); }
  .top .marca { display: none; }
  .solo-movil { display: none !important; }
}
@media (max-width: 959px) { .solo-desktop { display: none !important; } }

/* ── Bloques ─────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-1); min-width: 0; }
.card.plano { box-shadow: none; }
.card.click { cursor: pointer; transition: transform .12s, box-shadow .12s; }
.card.click:active { transform: scale(.99); }
.card-cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-cab h2, .card-cab h3 { flex: 1; min-width: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: 1fr; }
.grid-3 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.fila { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fila.entre { justify-content: space-between; }
.fila.arriba { align-items: flex-start; }
.fila.wrap { flex-wrap: wrap; }
.col { display: grid; gap: 4px; min-width: 0; }
.crece { flex: 1; min-width: 0; }
.cortar { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sep { height: 1px; background: var(--line); margin: 4px 0; }
.seccion-titulo { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px; margin: 6px 2px -4px; }
.seccion-titulo h2 { font-size: 16px; }

.hero { border-radius: 22px; padding: 20px; color: #fff; background: linear-gradient(140deg, #4338ca 0%, #6d28d9 55%, #9333ea 100%); box-shadow: var(--shadow-2); position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.18), transparent 70%); }
.hero .etiqueta { font-size: 13px; opacity: .85; font-weight: 600; }
.hero .grande { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; margin: 2px 0 6px; }
.hero .chips-hero { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; position: relative; z-index: 1; }
.hero .chip-hero { background: rgba(255,255,255,.16); border-radius: 999px; padding: 5px 11px; font-size: 13px; font-weight: 600; }

.stat { display: grid; gap: 2px; }
.stat .k { font-size: 12px; color: var(--text-2); font-weight: 600; }
.stat .v { font-size: 22px; font-weight: 750; letter-spacing: -0.02em; }
.stat .d { font-size: 12px; }

/* ── Botones y controles ──────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-weight: 650; cursor: pointer; white-space: nowrap;
  transition: background .12s, transform .08s, opacity .12s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.primario { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primario:hover { filter: brightness(1.06); }
.btn.grad { background: linear-gradient(135deg, var(--brand), var(--brand-2)); border: 0; color: #fff; box-shadow: 0 8px 20px color-mix(in srgb, var(--brand) 35%, transparent); }
.btn.suave { background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); }
.btn.fantasma { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.fantasma:hover { background: var(--surface-2); }
.btn.peligro { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 35%, transparent); background: var(--surface); }
.btn.chico { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.bloque { width: 100%; }
.btn.grande { min-height: 54px; font-size: 16px; border-radius: 16px; }
.icono-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; border: 0; background: transparent; color: var(--text-2); cursor: pointer; position: relative; flex: none; }
.icono-btn:hover { background: var(--surface-2); }
.icono-btn svg { width: 22px; height: 22px; }
.punto { position: absolute; top: 7px; right: 7px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--critical); color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--bg); }

.campo { display: grid; gap: 6px; min-width: 0; }
.campo > span { font-size: 13px; font-weight: 650; color: var(--text-2); }
.campo .ayuda { font-size: 12px; color: var(--text-3); font-weight: 500; }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface);
  outline: none; transition: border-color .12s, box-shadow .12s; -webkit-appearance: none; appearance: none;
}
select.input { background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
textarea.input { min-height: 90px; resize: vertical; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.input.monto { font-size: 28px; font-weight: 750; min-height: 62px; letter-spacing: -0.02em; }
.form { display: grid; gap: 14px; }
.form .fila > .campo { flex: 1; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 550; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }

.buscador { position: relative; }
.buscador svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--text-3); pointer-events: none; }
.buscador .input { padding-left: 44px; min-height: 50px; border-radius: 14px; font-size: 16px; }

.segmento { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmento button { border: 0; background: transparent; padding: 7px 13px; border-radius: 9px; font-weight: 650; font-size: 13px; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.segmento button.activo { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.segmento.bloque { display: flex; width: 100%; }
.segmento.bloque button { flex: 1; }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: -2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; flex: none;
}
.chip.activo { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip svg { width: 15px; height: 15px; }

.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; background: var(--surface-2); color: var(--text-2); }
.tag svg { width: 12px; height: 12px; }
.tag.familia { background: var(--familia-soft); color: var(--familia); }
.tag.empresa { background: var(--empresa-soft); color: var(--empresa); }
.tag.online { background: var(--online-soft); color: var(--online); }
.tag.good { background: var(--good-soft); color: var(--good); }
.tag.warning { background: var(--warning-soft); color: var(--warning); }
.tag.critical { background: var(--critical-soft); color: var(--critical); }
.tag.brand { background: var(--brand-soft); color: var(--brand-ink); }

.positivo { color: var(--good); }
.negativo { color: var(--critical); }

/* ── Listas ──────────────────────────────────────────────── */
.lista { display: grid; }
.lista > .renglon + .renglon { border-top: 1px solid var(--line); }
.renglon { display: flex; align-items: center; gap: 12px; padding: 12px 2px; min-width: 0; }
.renglon.click { cursor: pointer; border-radius: 10px; }
.renglon.click:hover { background: var(--surface-2); }
.renglon .der { text-align: right; flex: none; }
.avatar { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--text-2); font-weight: 800; font-size: 14px; overflow: hidden; }
.avatar svg { width: 20px; height: 20px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.familia { background: var(--familia-soft); color: var(--familia); }
.avatar.empresa { background: var(--empresa-soft); color: var(--empresa); }
.avatar.brand { background: var(--brand-soft); color: var(--brand-ink); }
.avatar.good { background: var(--good-soft); color: var(--good); }
.avatar.critical { background: var(--critical-soft); color: var(--critical); }

.vacio { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 32px 16px; color: var(--text-2); }
.vacio svg { width: 44px; height: 44px; color: var(--text-3); }
.vacio h3 { color: var(--text); }

.tabla-wrap { overflow-x: auto; margin: 0 -4px; }
table.tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla th { text-align: left; font-size: 12px; color: var(--text-2); font-weight: 650; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tabla td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tabla td.n, .tabla th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabla tr:last-child td { border-bottom: 0; }

/* ── Barras de progreso (presupuestos) ───────────────────── */
.barra { height: 10px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.barra > i { display: block; height: 100%; border-radius: 6px; background: var(--good); transition: width .4s ease; }
.barra.warning > i { background: var(--warning-mark); }
.barra.critical > i { background: var(--critical); }

/* ── Hojas (modales) ─────────────────────────────────────── */
.velo { position: fixed; inset: 0; z-index: 80; background: rgba(10, 10, 20, .45); display: flex; align-items: flex-end; justify-content: center; animation: aparecer .15s ease-out; }
@keyframes aparecer { from { opacity: 0; } }
.hoja {
  width: 100%; max-width: 620px; max-height: 92dvh; overflow-y: auto; background: var(--surface); border-radius: 24px 24px 0 0;
  padding: 10px 20px calc(20px + var(--safe-b)); box-shadow: var(--shadow-2); animation: subir .22s cubic-bezier(.2, .9, .3, 1);
}
.hoja .asa { width: 40px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 0 auto 12px; }
.hoja-cab { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.hoja-cab h2 { flex: 1; }
@keyframes subir { from { transform: translateY(40px); opacity: .5; } }
@media (min-width: 720px) {
  .velo { align-items: center; }
  .hoja { border-radius: 22px; padding: 22px 26px; }
  .hoja .asa { display: none; }
  .hoja.ancha { max-width: 860px; }
}

.toast-zona { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + var(--safe-b) + 16px); z-index: 120; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
@media (min-width: 960px) { .toast-zona { bottom: 24px; } }
.toast { background: #1d1d27; color: #fff; padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow-2); font-size: 14px; font-weight: 550; display: flex; gap: 10px; align-items: center; animation: subir .2s ease-out; pointer-events: auto; }
.toast.error { background: var(--critical); }
.toast svg { width: 18px; height: 18px; flex: none; }

.banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); font-size: 14px; }
.banner svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.banner.brand { background: var(--brand-soft); color: var(--brand-ink); }
.banner.warning { background: var(--warning-soft); color: var(--warning); }
.banner.critical { background: var(--critical-soft); color: var(--critical); }
.banner.online { background: var(--online-soft); color: var(--online); }
.banner.good { background: var(--good-soft); color: var(--good); }
.banner .crece { color: var(--text); }

.giro { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: girar .7s linear infinite; flex: none; }
@keyframes girar { to { transform: rotate(360deg); } }
.esqueleto { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: brillo 1.2s infinite; border-radius: 10px; }
@keyframes brillo { to { background-position: -200% 0; } }

/* ── Cámara ──────────────────────────────────────────────── */
.camara { position: fixed; inset: 0; z-index: 100; background: #000; color: #fff; display: grid; grid-template-rows: auto 1fr auto; }
.camara video { width: 100%; height: 100%; object-fit: cover; }
.camara .visor { position: relative; overflow: hidden; }
.camara .guia { position: absolute; inset: 7% 9%; border: 2px solid rgba(255,255,255,.55); border-radius: 18px; pointer-events: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.25); }
.camara .cab { display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--safe-t)) 14px 10px; background: linear-gradient(#000c, transparent); position: absolute; top: 0; left: 0; right: 0; z-index: 2; }
.camara .cab .icono-btn { color: #fff; background: rgba(255,255,255,.12); }
.camara .pista { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; font-size: 14px; font-weight: 600; text-shadow: 0 1px 4px #000; z-index: 2; }
.camara .controles { padding: 14px 18px calc(18px + var(--safe-b)); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; background: #000; }
.camara .disparador { width: 76px; height: 76px; border-radius: 50%; border: 5px solid #fff; background: rgba(255,255,255,.2); cursor: pointer; transition: transform .08s; }
.camara .disparador:active { transform: scale(.92); background: #fff; }
.camara .miniaturas { display: flex; gap: 6px; overflow-x: auto; }
.camara .miniaturas img { width: 44px; height: 58px; object-fit: cover; border-radius: 8px; border: 2px solid #fff; flex: none; }
.camara .listo { justify-self: end; }
.camara .flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.camara .flash.on { animation: flash .25s; }
@keyframes flash { 0% { opacity: .8; } 100% { opacity: 0; } }

.fotos-tira { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.fotos-tira .foto { position: relative; flex: none; }
.fotos-tira img { width: 72px; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.fotos-tira .quitar { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: var(--text); color: var(--bg); display: grid; place-items: center; cursor: pointer; }
.fotos-tira .quitar svg { width: 14px; height: 14px; }
.fotos-tira .mas { width: 72px; height: 96px; border-radius: 10px; border: 2px dashed var(--line-strong); display: grid; place-items: center; color: var(--text-3); background: transparent; cursor: pointer; }

.visor-comp { display: grid; gap: 8px; }
.visor-comp img { border-radius: 12px; border: 1px solid var(--line); width: 100%; max-height: 70vh; object-fit: contain; background: var(--surface-2); }

/* ── Dictado ─────────────────────────────────────────────── */
.dictado { display: grid; gap: 18px; }
.dictado-hero {
  border-radius: 28px; padding: 26px 20px 22px; display: grid; justify-items: center; gap: 14px; text-align: center; position: relative; overflow: hidden;
  background: radial-gradient(120% 80% at 50% 0%, #7c3aed 0%, #4338ca 45%, #1e1b4b 100%); color: #fff; box-shadow: var(--shadow-2);
}
.dictado-hero .ilustracion { width: 150px; height: 120px; opacity: .95; }
.mic { position: relative; width: 112px; height: 112px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center; background: #fff; color: #4338ca; box-shadow: 0 10px 40px rgba(0,0,0,.35); z-index: 1; transition: transform .15s; }
.mic svg { width: 44px; height: 44px; }
.mic:active { transform: scale(.96); }
.mic .onda { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(255,255,255,.6); pointer-events: none; transform: scale(var(--nivel, 1)); transition: transform .08s linear; }
.mic .onda.o2 { border-color: rgba(255,255,255,.3); transform: scale(calc(var(--nivel, 1) * 1.18)); }
.mic.escuchando { background: #ff4d6d; color: #fff; }
.mic.escuchando .onda { animation: respirar 1.6s ease-in-out infinite; }
@keyframes respirar { 50% { opacity: .4; } }
.transcripcion { min-height: 48px; font-size: 16px; line-height: 1.5; max-width: 560px; }
.transcripcion .interino { opacity: .6; }
.item-vivo { animation: nacer .35s cubic-bezier(.2, .9, .3, 1.3); }
@keyframes nacer { from { opacity: 0; transform: translateY(8px) scale(.97); } }
.item-lista { display: flex; align-items: center; gap: 12px; padding: 11px 4px; }
.item-lista + .item-lista { border-top: 1px solid var(--line); }
.item-lista .bolita { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-ink); font-size: 12px; font-weight: 800; flex: none; }
.item-lista.tentativo { opacity: .55; }
.item-lista.marcado .texto { text-decoration: line-through; color: var(--text-3); }

/* ── Análisis de compra ──────────────────────────────────── */
.comercio-card { border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); padding: 14px; display: grid; gap: 10px; }
.comercio-card .cab { display: flex; align-items: center; gap: 12px; }
.comercio-card .total { font-size: 20px; font-weight: 800; }
.online-fila { border-left: 3px solid var(--online); background: var(--online-soft); border-radius: 8px; padding-left: 8px !important; }

/* ── Gráficos ────────────────────────────────────────────── */
.grafico { width: 100%; height: auto; overflow: visible; }
.grafico text { fill: var(--text-2); font-size: 11px; font-family: var(--font); }
.grafico .eje { stroke: var(--line); }
.grafico .s1 { fill: var(--series-1); }
.grafico .s2 { fill: var(--series-2); }
.grafico .linea { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.grafico .hit { fill: transparent; cursor: pointer; }
.leyenda { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.leyenda i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tooltip { position: fixed; z-index: 150; pointer-events: none; background: var(--text); color: var(--bg); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; box-shadow: var(--shadow-2); max-width: 240px; }
.barras-h { display: grid; gap: 10px; }
.barras-h .b { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.barras-h .pista-b { height: 10px; border-radius: 0 5px 5px 0; background: transparent; }
.barras-h .pista-b > i { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--series-1); min-width: 2px; }

/* ── Login ───────────────────────────────────────────────── */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(110% 70% at 50% 0%, var(--brand-soft), var(--bg) 70%); }
.login .caja { width: min(100%, 380px); display: grid; gap: 20px; }
.login .logo { display: grid; justify-items: center; gap: 10px; text-align: center; }
.login .logo img { width: 76px; height: 76px; border-radius: 22px; box-shadow: var(--shadow-2); }

/* ── Espacio (Familia / Empresa) ─────────────────────────── */
.espacio-pill { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; }
.espacio-pill i { width: 8px; height: 8px; border-radius: 50%; }
.espacio-pill.familia i { background: var(--familia); }
.espacio-pill.empresa i { background: var(--empresa); }

.offline-aviso { position: sticky; top: calc(var(--top-h) + var(--safe-t)); z-index: 25; margin: 0 calc(-1 * var(--gutter)); padding: 8px var(--gutter); background: var(--warning-soft); color: var(--warning); font-size: 13px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.offline-aviso svg { width: 16px; height: 16px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@media (forced-colors: active) { .barra > i, .barras-h .pista-b > i { background: CanvasText; } }
@media (max-width: 959px) {
  .top .segmento button { padding: 6px 9px; font-size: 12.5px; }
}
@media (max-width: 440px) { .top .marca-txt { display: none; } }

/* Acciones rápidas del Inicio: la principal a lo ancho, las otras en fila. */
.acciones { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.acciones .principal { grid-column: 1 / -1; }
.acciones .btn { padding: 0 10px; }
@media (min-width: 720px) { .acciones { grid-template-columns: 2fr 1fr 1fr 1fr; } .acciones .principal { grid-column: auto; } }
.stats-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stats-3 .v { font-size: clamp(15px, 4.4vw, 22px); overflow-wrap: anywhere; }
.avatar.puesto { width: 28px; height: 28px; border-radius: 9px; font-size: 12px; }
/* Fichas clave → valor: el valor puede ocupar varios renglones (direcciones largas). */
.tabla.ficha { table-layout: fixed; }
.tabla.ficha td:first-child { width: 38%; }
.tabla.ficha td.n { white-space: normal; overflow-wrap: anywhere; }
.lateral .cargar { padding: 0 12px; font-size: 14px; }
