/* E-Cost · hoja de estilos común
   Los colores, la cáscara y los campos viven aquí para que todas las
   pantallas se parezcan entre sí. index.html todavía lleva su copia
   propia heredada del diseño original; se migrará a este archivo.      */

:root{
  --brand:#047857; --brand-dark:#065F46; --brand-light:#10B981; --accent:#10B981;
  --page-bg:#F7F7F7; --text:#333333; --text-muted:#767676; --line:#CCCCCC;
  --btn-off:#9BD9C4; --ease:cubic-bezier(0.4,0,0.2,1);
}
*{ box-sizing:border-box; }
html,body{ margin:0; padding:0; }
body{
  font-family:Arial,Helvetica,sans-serif; color:var(--text); background:var(--page-bg);
  min-height:100vh; display:flex; flex-direction:column; font-size:16px;
}
a{ color:var(--brand); text-decoration:none; }
a:hover{ text-decoration:underline; }
a:focus-visible, button:focus-visible, input:focus-visible{ outline:2px solid var(--brand-light); outline-offset:2px; }

/* Barra superior */
.header{
  height:64px; background:var(--brand); color:#fff; display:flex; align-items:center;
  gap:14px; padding:0 22px; flex-shrink:0;
}
.header b{ font-size:19px; font-weight:700; letter-spacing:-0.01em; }
.header .marca{ display:flex; align-items:center; gap:10px; }
.header .derecha{ margin-left:auto; display:flex; align-items:center; gap:14px; font-size:14px; }

/* Contenido centrado */
.centro{ flex:1; display:flex; justify-content:center; align-items:flex-start; padding:48px 24px; }
.tarjeta{
  width:100%; max-width:420px; background:#fff; border-radius:14px; padding:32px 34px 34px;
  box-shadow:0 2px 6px rgba(0,0,0,0.06), 0 14px 36px rgba(0,0,0,0.09);
  display:flex; flex-direction:column; gap:14px;
}
.tarjeta h1{ margin:0; font-size:26px; font-weight:700; color:var(--brand); line-height:1.2; }
.tarjeta .bajada{ margin:0; font-size:14.5px; line-height:1.55; color:var(--text-muted); }

/* Campos con la etiqueta que sube */
.form-field{ position:relative; padding-top:20px; }
.form-field input{
  width:100%; border:none; border-bottom:1px solid var(--line); background:transparent;
  font-family:inherit; font-size:16px; color:var(--text); padding:4px 28px 8px 0; outline:none;
}
.form-field label{
  position:absolute; left:0; top:24px; font-size:16px; color:var(--text-muted);
  pointer-events:none; transform-origin:left top;
  transition:transform .15s var(--ease), color .15s var(--ease);
}
.form-field input:focus ~ label, .form-field input.filled ~ label{
  transform:translateY(-22px) scale(0.75); color:var(--brand);
}
.form-field .bar{
  position:absolute; left:0; right:0; bottom:0; height:2px; background:var(--brand);
  transform:scaleX(0); transition:transform .15s var(--ease);
}
.form-field input:focus ~ .bar{ transform:scaleX(1); }
.eye{ position:absolute; right:0; bottom:4px; background:none; border:none; padding:2px; color:var(--brand); cursor:pointer; display:flex; }

/* Botones */
.btn-primary{
  font-family:inherit; font-size:17px; color:#fff; background:var(--btn-off);
  border:2px solid transparent; border-radius:24px; padding:10px 40px; cursor:not-allowed;
  transition:background .2s var(--ease); align-self:center;
}
.btn-primary.enabled{ background:var(--brand); cursor:pointer; }
.btn-primary.enabled:hover{ background:var(--brand-dark); }
.btn-primary.cargando{ cursor:progress; opacity:.75; }
.btn-texto{
  font-family:inherit; font-size:14px; color:var(--brand); background:#fff;
  border:1.5px solid var(--brand); border-radius:20px; padding:8px 18px; cursor:pointer;
}
.btn-texto:hover{ background:#EEF6F1; }

/* Avisos */
.aviso{
  display:none; padding:11px 14px; border-radius:6px; font-size:13.5px; line-height:1.5;
}
.aviso.visible{ display:block; }
.aviso.error{ background:#FDECEA; color:#A02216; }
.aviso.ok{ background:#EAF6EF; color:var(--brand); }

/* Pie */
.footer{
  background:#EEEEEE; color:var(--text-muted); font-size:12px; text-align:center;
  padding:14px 20px; flex-shrink:0;
}

@media (prefers-reduced-motion:reduce){ *{ transition:none !important; animation:none !important; } }

/* ---- Páginas legales (privacidad, condiciones) ---- */
.legal{ flex:1; width:100%; max-width:760px; margin:0 auto; padding:44px 24px 72px; }
.legal h1{ font-size:30px; font-weight:700; color:var(--brand); margin:0 0 6px; line-height:1.2; }
.legal .fecha{ font-size:13px; color:var(--text-muted); margin:0 0 30px; }
.legal h2{ font-size:19px; font-weight:700; color:var(--brand-dark); margin:34px 0 10px; line-height:1.3; }
.legal p{ margin:0 0 12px; line-height:1.65; }
.legal ul{ margin:0 0 12px; padding-left:22px; }
.legal li{ margin-bottom:8px; line-height:1.6; }
.legal .destacado{
  background:#EEF6F1; border-left:3px solid var(--brand); border-radius:0 8px 8px 0;
  padding:14px 18px; margin:18px 0;
}
.legal .destacado p:last-child{ margin-bottom:0; }
.legal .volver{ display:inline-block; margin-top:34px; font-size:14px; }

/* ---- Asistente E-Cost (burbuja de chat) ----
   Se inyecta desde js/ecost-asistente.js en cualquier pantalla con sesión. */
.assistant{ position:fixed; right:22px; bottom:60px; display:flex; align-items:flex-end; gap:8px; z-index:40; }
.assistant .bubble{ background:#fff; border-radius:12px 12px 2px 12px; padding:8px 12px; font-size:13px; box-shadow:0 4px 14px rgba(0,0,0,0.2); max-width:150px; }
.assistant .bubble b{ color:var(--brand); }
.assistant .avatar{ width:56px; height:56px; border-radius:50%; background:var(--brand); display:flex; align-items:center; justify-content:center; box-shadow:0 4px 14px rgba(5,150,105,0.45); cursor:pointer; animation:bob 2.4s ease-in-out infinite; border:none; }
.assistant.hidden{ display:none; }
@keyframes bob{ 0%,100%{ transform:translateY(0);} 50%{ transform:translateY(-5px);} }

.chat{ position:fixed; right:22px; bottom:22px; width:360px; max-width:calc(100vw - 44px); height:520px; max-height:calc(100vh - 120px); background:#fff; border-radius:14px; box-shadow:0 12px 40px rgba(0,0,0,0.28); display:none; flex-direction:column; overflow:hidden; z-index:70; }
.chat.open{ display:flex; animation:pop .2s var(--ease); }
@keyframes pop{ from{ opacity:0; transform:translateY(14px) scale(0.98);} to{ opacity:1; transform:none;} }

.chat-head{ background:var(--brand); color:#fff; padding:12px 14px; display:flex; align-items:center; gap:10px; }
.chat-head .av{ width:34px; height:34px; border-radius:50%; background:rgba(255,255,255,0.18); display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.chat-head .who{ flex:1; min-width:0; }
.chat-head .who b{ font-size:14px; display:block; }
.chat-head .who small{ font-size:11px; opacity:.85; display:flex; align-items:center; gap:5px; }
.chat-head .who small::before{ content:""; width:7px; height:7px; border-radius:50%; background:#7CF3B8; display:inline-block; flex-shrink:0; }
.chat-head .who small.apagado::before{ background:#F3C57C; }
.chat-head .close{ background:none; border:none; color:#fff; cursor:pointer; padding:4px; display:flex; border-radius:4px; }
.chat-head .close:hover{ background:rgba(255,255,255,0.15); }

.chat-body{ flex:1; overflow-y:auto; padding:14px; background:#F4F7F5; display:flex; flex-direction:column; gap:10px; }
.msg{ max-width:84%; padding:9px 12px; border-radius:12px; font-size:13.5px; line-height:1.5; white-space:pre-wrap; word-wrap:break-word; }
.msg.bot{ align-self:flex-start; background:#fff; border:1px solid #E4E9E6; border-bottom-left-radius:3px; }
.msg.user{ align-self:flex-end; background:var(--brand); color:#fff; border-bottom-right-radius:3px; }
.msg.aviso{ align-self:center; background:#FBF0DF; border:1px solid #EBD9BC; color:#7A4A08; font-size:12.5px; text-align:center; max-width:95%; }
.msg.pensando{ align-self:flex-start; background:#fff; border:1px solid #E4E9E6; color:var(--text-muted); font-style:italic; }

.quick{ display:flex; flex-wrap:wrap; gap:6px; padding:0 14px 8px; background:#F4F7F5; }
.quick button{ font:inherit; font-size:12px; color:var(--brand); background:#fff; border:1px solid var(--brand); border-radius:14px; padding:5px 10px; cursor:pointer; }
.quick button:hover{ background:#EEF6F1; }

.chat-input{ display:flex; gap:8px; padding:10px; border-top:1px solid #E4E9E6; background:#fff; }
.chat-input input{ flex:1; border:1px solid var(--line); border-radius:20px; padding:8px 14px; font:inherit; font-size:14px; outline:none; min-width:0; }
.chat-input input:focus{ border-color:var(--brand); }
.chat-input .send{ background:var(--brand); border:none; border-radius:50%; width:38px; height:38px; color:#fff; cursor:pointer; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.chat-input .send:hover{ background:var(--brand-dark); }
.chat-input .send:disabled{ background:var(--btn-off); cursor:not-allowed; }

@media (max-width:520px){
  .assistant{ right:16px; bottom:20px; }
  .assistant .bubble{ display:none; }
  .chat{ right:12px; left:12px; width:auto; bottom:12px; }
}

/* ---- Barra de "estar dentro de una empresa" ---- */
.barra-empresa{ gap:18px; }
.barra-empresa .contexto{ display:flex; flex-direction:column; line-height:1.25; min-width:0; }
.barra-empresa .contexto b{ font-size:15px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.barra-empresa .contexto small{ font-size:11.5px; opacity:.85; }
.barra-empresa .menu{ display:flex; gap:4px; margin-left:10px; }
.barra-empresa .menu a{
  color:#fff; font-size:14px; padding:7px 13px; border-radius:20px; text-decoration:none; white-space:nowrap;
}
.barra-empresa .menu a:hover{ background:rgba(255,255,255,.14); text-decoration:none; }
.barra-empresa .menu a.act{ background:rgba(255,255,255,.22); font-weight:700; }
.barra-empresa .derecha{ margin-left:auto; display:flex; align-items:center; gap:10px; }
.conmutador{
  display:flex; border:1px solid rgba(255,255,255,.45); border-radius:20px; overflow:hidden;
  background:transparent; padding:0; cursor:pointer; font:inherit;
}
.conmutador span{ padding:5px 11px; font-size:12.5px; color:#fff; opacity:.7; }
.conmutador span.on{ background:#fff; color:var(--brand); font-weight:700; opacity:1; }
.barra-empresa .salir{ background:transparent; color:#fff; border-color:rgba(255,255,255,.5); font-size:13px; padding:6px 14px; }
@media (max-width:760px){
  .barra-empresa .contexto small{ display:none; }
  .barra-empresa .menu a{ padding:7px 9px; font-size:13px; }
  .barra-empresa .salir{ display:none; }
}

/* ---- Catálogo de sucesos (Registrar) ---- */
.grupo-titulo{
  font-size:12px; letter-spacing:.11em; text-transform:uppercase; color:var(--text-muted);
  font-weight:700; margin:26px 0 12px;
}
.sucesos{ display:grid; grid-template-columns:repeat(auto-fill,minmax(250px,1fr)); gap:13px; }
.suceso{
  background:#fff; border:1px solid #E2E8E5; border-radius:13px; padding:17px 18px;
  text-align:left; font:inherit; cursor:pointer; display:flex; gap:13px; align-items:flex-start;
  box-shadow:0 1px 2px rgba(0,0,0,.04), 0 6px 18px rgba(0,0,0,.05);
  transition:transform .16s var(--ease), border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.suceso:hover{ transform:translateY(-2px); border-color:var(--brand-light); box-shadow:0 4px 10px rgba(0,0,0,.06), 0 14px 28px rgba(0,0,0,.09); }
.suceso .ic{
  width:38px; height:38px; border-radius:10px; background:#EAF6EF; color:var(--brand);
  display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
.suceso b{ display:block; font-size:15px; color:var(--brand); line-height:1.3; margin-bottom:3px; }
.suceso span{ font-size:12.5px; line-height:1.5; color:var(--text-muted); }

/* ---- Formulario de un suceso ---- */
.velo{
  position:fixed; inset:0; background:rgba(12,32,24,.45); z-index:80;
  display:flex; align-items:flex-start; justify-content:center; padding:28px 16px; overflow-y:auto;
}
.hoja-suceso{
  background:#fff; border-radius:16px; width:100%; max-width:520px; padding:26px 28px 28px;
  box-shadow:0 20px 60px rgba(0,0,0,.3); display:flex; flex-direction:column; gap:2px;
  animation:subir .22s var(--ease);
}
@keyframes subir{ from{ opacity:0; transform:translateY(16px);} to{ opacity:1; transform:none;} }
.hoja-suceso h2{ margin:0; font-size:20px; color:var(--brand); }
.hoja-suceso .ayuda{ margin:4px 0 16px; font-size:13.5px; line-height:1.55; color:var(--text-muted); }
.hoja-suceso .cerrar{
  position:absolute; top:14px; right:16px; background:none; border:none; cursor:pointer; color:var(--text-muted); padding:6px;
}
.monto-fila{ display:flex; gap:12px; align-items:flex-end; }
.monto-fila .form-field{ flex:1; }
.mini-conmutador{
  display:flex; border:1px solid var(--line); border-radius:18px; overflow:hidden; background:#fff;
  padding:0; cursor:pointer; font:inherit; flex-shrink:0; margin-bottom:8px;
}
.mini-conmutador span{ padding:6px 12px; font-size:13px; color:var(--text-muted); }
.mini-conmutador span.on{ background:var(--brand); color:#fff; font-weight:700; }
.total-linea{
  background:#EEF6F1; border-left:3px solid var(--brand); border-radius:0 8px 8px 0;
  padding:11px 15px; margin-top:14px; font-size:14px; display:flex; justify-content:space-between; gap:12px;
}
.total-linea b{ color:var(--brand); font-size:16px; }
.casilla{ display:flex; align-items:center; gap:10px; margin-top:14px; font-size:14px; cursor:pointer; }
.casilla input{ width:18px; height:18px; accent-color:var(--brand); cursor:pointer; }
.acciones-hoja{ display:flex; justify-content:flex-end; gap:12px; margin-top:22px; }
