/* Capa propia sobre SolidCraft web: el botón «PC», su panel y los avisos. */
html, body { overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#cad-pc, #cad-panel, #cad-avisos { font: 15px/1.35 -apple-system, "Segoe UI", system-ui, sans-serif; color: #e9edf3; }
#cad-pc {
  position: fixed; left: max(10px, env(safe-area-inset-left)); bottom: calc(max(0px, env(safe-area-inset-bottom)) + 58px); z-index: 50;
  width: 46px; height: 46px; border-radius: 23px; border: 1px solid #4b5566; background: #262b34e6; color: #e9edf3;
  font-weight: 600; font-size: 14px; letter-spacing: .5px; box-shadow: 0 2px 10px #0008; touch-action: manipulation; cursor: pointer;
}
#cad-pc::after { content: ""; position: absolute; right: 5px; top: 5px; width: 8px; height: 8px; border-radius: 4px; background: #3ecf6e; }
#cad-pc.sin-pc::after { background: #8a93a3; }
#cad-pc:active { background: #343b48; }
#cad-panel {
  position: fixed; left: max(10px, env(safe-area-inset-left)); bottom: calc(max(0px, env(safe-area-inset-bottom)) + 112px); z-index: 50;
  width: min(340px, calc(100vw - 80px)); max-height: min(560px, calc(100vh - 170px)); overflow: auto; -webkit-overflow-scrolling: touch;
  padding: 12px; border-radius: 14px; border: 1px solid #4b5566; background: #20242cf5; box-shadow: 0 8px 30px #000a;
  display: flex; flex-direction: column; gap: 8px;
}
#cad-panel[hidden] { display: none; }
.cad-titulo { font-weight: 600; font-size: 16px; }
.cad-nota { color: #a9b2c1; font-size: 13px; overflow-wrap: anywhere; }
.cad-fila {
  min-height: 44px; padding: 8px 12px; border-radius: 10px; border: 1px solid #485163; background: #2c323d; color: inherit;
  font: inherit; text-align: left; touch-action: manipulation; cursor: pointer;
}
.cad-fila:active { background: #3a4250; }
.cad-fila.principal { background: #2f6fed; border-color: #2f6fed; font-weight: 600; }
.cad-fila.principal:active { background: #295fcb; }
.cad-fila.archivo { min-height: 40px; font-size: 14px; }
.cad-lista { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow: auto; padding: 2px; }
.cad-lista[hidden] { display: none; }
.cad-casilla { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 4px; }
.cad-casilla input { width: 22px; height: 22px; flex: none; accent-color: #2f6fed; }
#cad-avisos {
  position: fixed; left: 50%; bottom: max(64px, calc(env(safe-area-inset-bottom) + 64px)); transform: translateX(-50%); z-index: 60;
  display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none;
}
.cad-aviso { padding: 8px 14px; border-radius: 18px; background: #20242cf0; border: 1px solid #4b5566; box-shadow: 0 4px 16px #0008; transition: opacity .35s; }
.cad-aviso.malo { border-color: #d6524b; }
.cad-aviso.fuera { opacity: 0; }
@media (prefers-reduced-motion: reduce) { .cad-aviso { transition: none; } }

/* Pantalla de carga propia: tapa todo hasta que el motor contesta; los botones no salen antes. */
html.cad-cargando .s3-capa, html.cad-cargando #cad-pc, html.cad-cargando #cad-panel { display: none !important; }
#cad-carga { position: fixed; inset: 0; z-index: 2147483000; display: flex; align-items: center; justify-content: center; background: #1b1b1c; color: #e9edf3;
  font: 15px/1.4 -apple-system, "Segoe UI", system-ui, sans-serif; transition: opacity .4s; }
#cad-carga.fuera { opacity: 0; pointer-events: none; }
#cad-carga img { width: min(34vmin, 180px); height: auto; }
#cad-carga .textos { position: absolute; left: 50%; top: calc(50% + min(17vmin, 90px) + 22px); transform: translateX(-50%); width: min(86vw, 480px); text-align: center; }
#cad-carga .etapa { font-size: 17px; font-weight: 600; }
#cad-carga .nota { margin-top: 12px; color: #aab2bf; }
#cad-carga .detalle, #cad-carga .enviado { margin-top: 10px; color: #8a93a1; font-size: 12.5px; overflow-wrap: anywhere; -webkit-user-select: text; user-select: text; }
#cad-carga .detalle:empty, #cad-carga .enviado:empty { display: none; }
#cad-carga .barra { height: 4px; margin: 12px auto 0; width: min(60vw, 240px); border-radius: 2px; background: #33373f; overflow: hidden; }
#cad-carga .barra i { display: block; height: 100%; width: 38%; border-radius: 2px; background: #ff9838; animation: cad-vaiven 1.5s ease-in-out infinite alternate; }
@keyframes cad-vaiven { from { transform: translateX(-20%); } to { transform: translateX(185%); } }
#cad-carga[data-estado="fallo"] .barra { display: none; }
#cad-carga[data-estado="fallo"] .etapa { color: #ff8f86; }
#cad-carga .botones { margin-top: 16px; }
#cad-carga button { min-height: 44px; padding: 0 24px; border: 0; border-radius: 22px; background: #ff9838; color: #1d1206; font: inherit; font-weight: 600; cursor: pointer; }
@media (prefers-reduced-motion: reduce) { #cad-carga .barra i { animation: none; width: 100%; opacity: .5; } #cad-carga { transition: none; } }
