/* Panel Forja — paleta Brasa (la misma de la app, src/core/tema.ts) y
   estilo "medidor de calor". Solo modo oscuro: es el de la marca. */
:root {
  --bg: #0B0806;
  --bg-lateral: #0E0A07;
  --sup: #140E0A;
  --sup-2: #19110C;
  --sup-3: #21160F;
  --borde: #2E1F15;
  --borde-2: #3D2717;
  --borde-3: #5A3A22;
  --texto: #FFF4EA;
  --texto-2: #B8A595;
  --texto-3: #95816F;
  --brasa: #FF5A00;
  --brasa-suave: #FF8A3D;
  --brasa-oscura: #C24100;
  --oro: #FFC233;
  --azul: #5AB4FF;
  --violeta: #B48CFF;
  --rojo: #FF3D6E;
  --sobre-brasa: #1A0A00;
  --titulos: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --cuerpo: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--texto); font-family: var(--cuerpo); font-size: 14px; }
a { color: var(--brasa-suave); }
a:hover { color: #FFB37A; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--brasa); outline-offset: 2px; }
.oculto-lector { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@keyframes vivo { 0% { box-shadow: 0 0 0 0 rgba(255, 90, 0, .7); } 70% { box-shadow: 0 0 0 9px rgba(255, 90, 0, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 90, 0, 0); } }
@keyframes subir { from { width: 0; } }
@keyframes entrar { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes trazo { from { stroke-dashoffset: 1600; } to { stroke-dashoffset: 0; } }
@keyframes crecer { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes latido { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 194, 51, 0); } 50% { box-shadow: 0 0 18px 4px rgba(255, 194, 51, .55); } }
@keyframes ascua { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(-90px); opacity: 0; } }
@keyframes llega { from { opacity: 0; transform: translateX(-10px); background: #2A1206; } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Estructura ---------- */
.marco { display: flex; min-height: 100vh; }
.lateral { width: 240px; flex: none; background: var(--bg-lateral); border-right: 1px solid var(--sup-3); padding: 20px 12px 28px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.lateral .marca { display: flex; align-items: center; gap: 10px; padding: 0 12px 2px; }
.lateral .marca span { font-family: var(--titulos); font-weight: 800; font-size: 28px; letter-spacing: .14em; }
.lateral .lema { padding: 0 12px 10px; font: 700 10.5px var(--cuerpo); letter-spacing: .16em; color: var(--brasa-suave); }
.lateral h3 { margin: 16px 12px 6px; font: 700 11px var(--cuerpo); letter-spacing: .14em; text-transform: uppercase; color: var(--texto-3); }
.lateral a { display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 0 12px; border-radius: 9px; color: var(--texto-2); text-decoration: none; font: 500 13.5px var(--cuerpo); }
.lateral a::before { content: ""; width: 6px; height: 6px; border-radius: 2px; background: var(--borde-2); flex: none; }
.lateral a:hover { background: var(--sup-2); color: var(--texto); }
.lateral a.activo { background: linear-gradient(90deg, #3A1A08, var(--sup-3)); color: var(--texto); box-shadow: inset 3px 0 0 var(--brasa); }
.lateral a.activo::before { background: var(--brasa); }
.lateral a .pronto { margin-left: auto; font-size: 10px; color: var(--texto-3); }
.lateral a .insignia { margin-left: auto; min-width: 20px; height: 20px; border-radius: 99px; background: var(--brasa); color: var(--sobre-brasa); font: 700 11px/20px var(--cuerpo); text-align: center; padding: 0 6px; }

.columna { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.barra-sup { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 24px; border-bottom: 1px solid var(--sup-3); background: var(--bg-lateral); position: sticky; top: 0; z-index: 5; }
.buscador { flex: 1 1 280px; display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--borde); background: var(--sup); color: var(--texto-3); }
.buscador input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; color: var(--texto); }
.estado-vivo { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; border-radius: 99px; background: rgba(255, 90, 0, .10); color: var(--brasa-suave); font: 600 12.5px var(--cuerpo); }
.estado-vivo.caido { background: rgba(255, 61, 110, .12); color: var(--rojo); }
.punto-vivo { width: 8px; height: 8px; border-radius: 50%; background: var(--brasa); animation: vivo 1.8s infinite; }
.caido .punto-vivo { background: var(--rojo); animation: none; }
.perfil { display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font: 700 13px var(--cuerpo); color: var(--sobre-brasa); background: linear-gradient(135deg, var(--brasa), var(--oro)); }
.avatar.chico { width: 28px; height: 28px; font-size: 11px; }
.btn.boton-menu { display: none; }

.contenido:focus { outline: none; }
.contenido { padding: 24px 24px 56px; display: flex; flex-direction: column; gap: 18px; max-width: 1500px; width: 100%; }

@media (max-width: 900px) {
  .lateral { position: fixed; left: 0; top: 0; z-index: 20; transform: translateX(-100%); transition: transform .25s ease; box-shadow: 20px 0 40px rgba(0, 0, 0, .5); }
  .lateral.abierta { transform: none; }
  .btn.boton-menu { display: inline-flex; }
  .barra-sup { gap: 8px; }
  .barra-sup > a.btn, .buscador kbd, .perfil > span:last-child { display: none; }
  .buscador { order: 5; flex-basis: 100%; }
  .estado-vivo { margin-left: auto; }
  .titulo-pagina h1 { font-size: 38px; }
  .barra-sup { padding: 10px 16px; }
  .contenido { padding: 18px 16px 48px; }
}

/* ---------- Piezas ---------- */
.titulo-pagina { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 14px; }
.titulo-pagina h1 { margin: 0; font-family: var(--titulos); font-weight: 800; font-size: 46px; line-height: 1; text-transform: uppercase; }
.titulo-pagina h1 em { font-style: normal; color: var(--brasa); }
.titulo-pagina p { margin: 4px 0 0; color: var(--texto-2); }
.tarjeta { background: var(--sup); border: 1px solid var(--borde); border-radius: 18px; padding: 18px; animation: entrar .5s ease-out both; min-width: 0; }
.tarjeta.calor { position: relative; overflow: hidden; background: radial-gradient(120% 140% at 0% 100%, #2A1206 0%, var(--sup) 55%); }
.tit { margin: 0; font-family: var(--titulos); font-weight: 700; font-size: 22px; text-transform: uppercase; letter-spacing: .02em; }
.cabeza { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.fila { display: flex; flex-wrap: wrap; gap: 14px; }
.fila > * { flex: 1 1 340px; }
.rejilla-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.kpi { display: flex; flex-direction: column; gap: 6px; }
.kpi .eti { font-size: 13px; color: var(--texto-2); display: flex; justify-content: space-between; gap: 8px; }
.kpi .valor { font-family: var(--titulos); font-weight: 800; font-size: 40px; line-height: 1; }
.kpi .pie { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; font-size: 12px; color: var(--texto-3); }
.sube { color: var(--brasa-suave); font-weight: 700; font-size: 12px; }
.baja { color: var(--rojo); font-weight: 700; font-size: 12px; }
.neutro { color: var(--texto-3); font-weight: 700; font-size: 12px; }
.cifra-grande { font-family: var(--titulos); font-weight: 800; font-size: 56px; line-height: .9; }
.oro { color: var(--oro); }
.suave { color: var(--texto-2); }
.tenue { color: var(--texto-3); font-size: 12px; }

.medidor { height: 22px; border-radius: 99px; background: #2A1C13; border: 1px solid var(--borde-2); position: relative; }
.medidor .nivel { position: relative; height: 100%; min-width: 22px; border-radius: 99px; background: linear-gradient(90deg, #5A2A0E, var(--brasa-oscura) 40%, var(--brasa) 75%, var(--oro)); animation: subir 1.5s cubic-bezier(.2, .8, .2, 1) both; transition: width .8s cubic-bezier(.2, .8, .2, 1); }
.medidor .punta { position: absolute; right: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: #FFE08A; animation: latido 2.4s ease-in-out infinite; }
.medidor .marca-meta { position: absolute; top: -6px; bottom: -6px; width: 2px; background: var(--texto); opacity: .7; }
.escala { display: flex; justify-content: space-between; font-size: 11px; color: var(--texto-3); margin-top: 6px; }
.ascua { position: absolute; border-radius: 50%; animation: ascua 3.4s linear infinite; pointer-events: none; }
.barrita { height: 8px; border-radius: 99px; background: rgba(255, 244, 234, .07); overflow: hidden; }
.barrita > div { height: 100%; border-radius: 99px; background: var(--brasa); animation: subir 1.3s cubic-bezier(.2, .8, .2, 1) both; }

.grafico { width: 100%; height: auto; display: block; }
.grafico .trazo { stroke-dasharray: 1600; animation: trazo 1.8s ease-out both; }
.grafico .barra { transform-box: fill-box; transform-origin: bottom; animation: crecer .8s cubic-bezier(.2, .8, .2, 1) both; }
.leyenda { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--texto-2); }
.leyenda span { display: flex; align-items: center; gap: 6px; }
.leyenda i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.lista-eventos { display: flex; flex-direction: column; }
.evento { display: flex; align-items: center; gap: 10px; min-height: 46px; border-bottom: 1px solid var(--sup-3); animation: llega .6s ease-out both; }
.evento .txt { flex: 1; min-width: 0; font-size: 13px; }
.evento .cuando { font-size: 11px; color: var(--texto-3); white-space: nowrap; }
.chip { font: 600 11px var(--cuerpo); padding: 4px 9px; border-radius: 99px; white-space: nowrap; border: 1px solid currentColor; }
.chip.lleno { border: none; background: rgba(255, 90, 0, .16); color: var(--brasa-suave); }
.chip.gris { border: none; background: var(--sup-3); color: var(--texto-2); }

.vacio { min-height: 140px; border: 1px dashed var(--borde-2); border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 18px; color: var(--texto-2); }
.vacio strong { font-family: var(--titulos); font-size: 22px; text-transform: uppercase; color: var(--texto); }

.btn { min-height: 40px; padding: 0 16px; border-radius: 11px; border: 1px solid var(--borde-2); background: transparent; color: var(--texto); font: 600 13px var(--cuerpo); display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn:hover { border-color: var(--borde-3); background: var(--sup-2); color: var(--texto); }
.btn.primario { border: none; background: var(--brasa); color: var(--sobre-brasa); font-weight: 700; }
.btn.primario:hover { background: #FF6E1F; }
.btn.peligro { color: var(--rojo); }
.btn:disabled { opacity: .5; cursor: default; }
.segmentos { display: flex; gap: 6px; flex-wrap: wrap; }
.segmentos button { min-height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--borde); background: transparent; color: var(--texto-2); font: 600 13px var(--cuerpo); }
.segmentos button[aria-pressed="true"] { background: var(--brasa); border-color: var(--brasa); color: var(--sobre-brasa); }
.campo { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--texto-2); }
.entrada { min-height: 42px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--borde-2); background: var(--sup-2); color: var(--texto); font: 500 14px var(--cuerpo); }
textarea.entrada { padding: 10px 12px; min-height: 80px; resize: vertical; }

.tabla-caja { overflow-x: auto; }
table.tabla { width: 100%; border-collapse: collapse; min-width: 720px; }
.tabla th { text-align: left; padding: 10px 10px; font: 600 11px var(--cuerpo); letter-spacing: .08em; text-transform: uppercase; color: var(--texto-3); border-bottom: 1px solid var(--borde); white-space: nowrap; }
.tabla td { padding: 10px 10px; border-bottom: 1px solid var(--sup-3); font-size: 13px; vertical-align: middle; }
.tabla tr:hover td { background: rgba(255, 244, 234, .02); }
.persona { display: flex; align-items: center; gap: 8px; min-width: 0; }
.persona b { font-weight: 600; }
.paginacion { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 12px; color: var(--texto-3); font-size: 12px; }

.aviso { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; border: 1px dashed var(--oro); background: rgba(255, 194, 51, .06); font-size: 13px; color: var(--oro); }
.error-caja { padding: 12px 14px; border-radius: 12px; background: rgba(255, 61, 110, .1); color: var(--rojo); font-size: 13px; }
.cargando { color: var(--texto-3); padding: 30px; text-align: center; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 50; background: var(--sup-3); border: 1px solid var(--borde-3); padding: 12px 18px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); animation: entrar .3s ease-out both; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: radial-gradient(80% 80% at 20% 100%, #2A1206 0%, var(--bg) 60%); }
.login form { width: 100%; max-width: 400px; background: var(--sup); border: 1px solid var(--borde); border-radius: 22px; padding: 30px 26px; display: flex; flex-direction: column; gap: 16px; animation: entrar .5s ease-out both; }
.login h1 { margin: 0; font-family: var(--titulos); font-weight: 800; font-size: 40px; text-transform: uppercase; line-height: 1; }
.login h1 em { font-style: normal; color: var(--brasa); }

/* ---------- Dona ---------- */
.dona-caja { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.dona { position: relative; width: 150px; height: 150px; flex: none; }
.dona svg { transform: rotate(-90deg); }
.dona .centro { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.dona .centro b { font-family: var(--titulos); font-size: 32px; line-height: 1; }
.dona-lista { flex: 1; min-width: 150px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.dona-lista div { display: flex; align-items: center; gap: 8px; }
.dona-lista i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.dona-lista span { flex: 1; }
