/* El Tiempo — apariencia de app del tiempo (oscura, móvil primero). */

.kpush {
  --kp-bg1: #0b1220;
  --kp-bg2: #13233f;
  --kp-card: rgba(255, 255, 255, 0.07);
  --kp-card2: rgba(255, 255, 255, 0.11);
  --kp-line: rgba(255, 255, 255, 0.12);
  --kp-fg: #eef2f8;
  --kp-muted: rgba(238, 242, 248, 0.62);
  --kp-accent: #7cc4ff;

  color-scheme: dark;
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--kp-fg);
  background:
    radial-gradient(120% 60% at 85% -10%, rgba(124, 196, 255, 0.16), transparent 60%),
    linear-gradient(180deg, var(--kp-bg1), var(--kp-bg2) 60%, #0d1526);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.kpush *,
.kpush *::before,
.kpush *::after { box-sizing: border-box; }

/* El atributo [hidden] debe ocultar SIEMPRE, aunque una clase defina display
   (p. ej. .kp-iconbtn es inline-flex; sin esto, hidden no lo ocultaría). */
.kpush [hidden] { display: none !important; }

.kp-wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) 16px calc(28px + env(safe-area-inset-bottom));
}

/* ------------------------------------------------------------- cabecera */

.kp-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 2px 12px;
}

.kp-city {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.kp-date {
  margin-top: 2px;
  font-size: 13px;
  color: var(--kp-muted);
}

.kp-actions { display: flex; gap: 8px; }

.kp-iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--kp-line);
  border-radius: 12px;
  background: var(--kp-card);
  color: var(--kp-fg);
  font-size: 17px;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.kp-iconbtn:active { background: var(--kp-card2); }
.kp-dim { opacity: 0.45; }

/* Confirmación mínima: parpadeo de 200 ms del icono de refresco. */
.kp-blink { animation: kp-blink 0.2s linear 1; }

@keyframes kp-blink {
  0%, 100% { background: var(--kp-card); }
  50% { background: var(--kp-accent); color: #08131f; }
}

.kp-spin svg { animation: kp-rot 0.9s linear infinite; }

@keyframes kp-rot { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------- ciudades */

.kp-citybar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 12px;
  scrollbar-width: none;
}

.kp-citybar::-webkit-scrollbar { display: none; }

.kp-chip {
  flex: 0 0 auto;
  padding: 7px 14px;
  border: 1px solid var(--kp-line);
  border-radius: 999px;
  background: var(--kp-card);
  color: var(--kp-muted);
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}

.kp-chip.on {
  background: var(--kp-card2);
  color: var(--kp-fg);
  border-color: rgba(124, 196, 255, 0.5);
}

.kp-chip-add { min-width: 38px; font-size: 16px; text-align: center; }

/* ---------------------------------------------------------------- vistas */

.kp-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 16px;
  border: 1px solid var(--kp-line);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
}

.kp-tabs button {
  padding: 9px 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--kp-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.kp-tabs button.on { background: var(--kp-card2); color: var(--kp-fg); }

/* ------------------------------------------------------------------ hoy */

.kp-now { text-align: center; padding: 8px 0 4px; }

.kp-bigicon {
  font-size: 84px;
  line-height: 1.1;
  cursor: default;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.35));
}

.kp-temp {
  font-size: 76px;
  font-weight: 200;
  letter-spacing: -2px;
  margin-top: -6px;
}

.kp-desc { font-size: 17px; font-weight: 600; }

.kp-minmax { margin-top: 4px; font-size: 14px; color: var(--kp-muted); }

.kp-extras {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 18px 0 14px;
}

.kp-extra {
  padding: 10px 6px;
  border: 1px solid var(--kp-line);
  border-radius: 14px;
  background: var(--kp-card);
  text-align: center;
}

.kp-extra span { display: block; font-size: 11px; color: var(--kp-muted); margin-bottom: 3px; }
.kp-extra strong { font-size: 15px; font-weight: 600; }

.kp-hourly {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 12px 8px;
  border: 1px solid var(--kp-line);
  border-radius: 18px;
  background: var(--kp-card);
  scrollbar-width: none;
}

.kp-hourly::-webkit-scrollbar { display: none; }

.kp-hour { flex: 0 0 56px; text-align: center; }
.kp-hour-t { font-size: 12px; color: var(--kp-muted); }
.kp-hour-i { font-size: 22px; margin: 6px 0 2px; }
.kp-hour-pp { font-size: 10px; color: var(--kp-accent); min-height: 13px; }
.kp-hour-v { font-size: 15px; font-weight: 600; }

/* --------------------------------------------------------------- 7 días */

.kp-week-now {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 14px;
}

.kp-week-icon { font-size: 34px; }
.kp-week-temp { font-size: 30px; font-weight: 300; }
.kp-week-desc { font-size: 14px; color: var(--kp-muted); }

.kp-days {
  border: 1px solid var(--kp-line);
  border-radius: 18px;
  background: var(--kp-card);
  padding: 4px 14px;
}

.kp-day {
  display: grid;
  grid-template-columns: 44px 52px 34px 1fr 34px;
  align-items: center;
  gap: 8px;
  padding: 11px 0;
  border-bottom: 1px solid var(--kp-line);
}

.kp-day:last-child { border-bottom: 0; }

.kp-day-n { font-size: 15px; font-weight: 600; }
.kp-day-i { font-size: 20px; display: flex; align-items: center; gap: 4px; }
.kp-day-pp { font-size: 10px; color: var(--kp-accent); }
.kp-day-lo { font-size: 14px; color: var(--kp-muted); text-align: right; }
.kp-day-hi { font-size: 14px; font-weight: 600; text-align: right; }

.kp-day-bar {
  position: relative;
  height: 5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.3);
}

.kp-day-bar i {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #4aa3ff, #ffd166);
}

/* ----------------------------------------------------------- estado vacío */

.kp-empty { text-align: center; padding: 60px 10px; color: var(--kp-muted); }
.kp-empty-icon { font-size: 64px; margin-bottom: 8px; }

.kp-btn {
  margin-top: 14px;
  padding: 11px 22px;
  border: 0;
  border-radius: 999px;
  background: var(--kp-accent);
  color: #08131f;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

/* ---------------------------------------------------------------- sheets */

.kp-sheet-bg {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  z-index: 40;
}

.kp-sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(480px, 100%);
  max-height: 78vh;
  max-height: 78dvh;
  overflow-y: auto;
  padding: 14px 16px calc(20px + env(safe-area-inset-bottom));
  border-radius: 22px 22px 0 0;
  background: #101c31;
  border: 1px solid var(--kp-line);
  border-bottom: 0;
  z-index: 41;
  animation: kp-up 0.18s ease-out;
}

@keyframes kp-up {
  from { transform: translate(-50%, 24px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.kp-sheet-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}

.kp-sheet-h h2 {
  margin: 0;
  font-size: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}
.kp-sheet h3 { margin: 18px 0 8px; font-size: 13px; color: var(--kp-muted); font-weight: 600; }

.kp-input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--kp-line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  color: var(--kp-fg);
  font-size: 15px;
  outline: none;
}

.kp-input:focus { border-color: rgba(124, 196, 255, 0.6); }

.kp-results { margin-top: 10px; }

.kp-result {
  display: flex;
  width: 100%;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  margin-bottom: 6px;
  border: 1px solid var(--kp-line);
  border-radius: 12px;
  background: var(--kp-card);
  color: var(--kp-fg);
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}

.kp-result span { font-size: 12px; color: var(--kp-muted); }

.kp-saved-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px;
  border-bottom: 1px solid var(--kp-line);
  font-size: 15px;
}

.kp-saved-row:last-child { border-bottom: 0; }

.kp-muted { color: var(--kp-muted); font-size: 14px; text-align: center; padding: 14px 0; }

/* -------------------------------------------------------------- historial */

.kp-hist { display: flex; flex-direction: column; }

.kp-hist-row {
  display: grid;
  grid-template-columns: 34px 22px 1fr 18px auto;
  align-items: center;
  gap: 10px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--kp-line);
  font-size: 14px;
}

.kp-hist-row:last-child { border-bottom: 0; }

.kp-hist-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  color: #fff;
  font-weight: 800;
  font-size: 15px;
}

.kp-hist-letter.g { background: #16a34a; }
.kp-hist-letter.r { background: #dc2626; }
.kp-hist-letter.m { background: #475569; }

.kp-hist-sym { text-align: center; }
.kp-hist-ok { color: var(--kp-accent); font-size: 13px; }
.kp-hist-t { color: var(--kp-muted); font-size: 12px; text-align: right; }

/* ---------------------------------------------------------------- toast */

.kp-toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(16, 28, 49, 0.95);
  border: 1px solid var(--kp-line);
  color: var(--kp-fg);
  font-size: 14px;
  z-index: 60;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- login */

.kpush-login {
  display: flex;
  min-height: 60dvh;
  align-items: center;
  justify-content: center;
}

.kpush-login a {
  padding: 12px 26px;
  border-radius: 999px;
  background: #7cc4ff;
  color: #08131f;
  font-weight: 700;
  text-decoration: none;
}

/* Login integrado en la fachada */
.kp-login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  min-height: 80dvh;
  padding: 24px 16px;
}

.kp-login-card {
  width: 100%;
  max-width: 340px;
  text-align: center;
  padding: 28px 22px 24px;
  border: 1px solid var(--kp-line);
  border-radius: 22px;
  background: var(--kp-card);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.kp-login-logo { font-size: 52px; line-height: 1; }

.kp-login-title {
  margin: 8px 0 18px;
  font-size: 24px;
  font-weight: 700;
  color: var(--kp-fg);
}

.kp-login-form { display: flex; flex-direction: column; gap: 10px; }

.kp-login-form input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--kp-line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--kp-fg);
  font-size: 16px; /* 16px evita el zoom automático en iOS al enfocar */
  outline: none;
}

.kp-login-form input:focus { border-color: rgba(124, 196, 255, 0.6); }

.kp-login-btn {
  margin-top: 4px;
  padding: 12px 16px;
  border: 0;
  border-radius: 12px;
  background: var(--kp-accent);
  color: #08131f;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.kp-login-btn:disabled { opacity: 0.6; cursor: default; }

.kp-login-error {
  margin: 4px 0 0;
  color: #ff9aa2;
  font-size: 13px;
}

/* ------------------------------------------------------------- webcam / stream */

.kp-webcam-card {
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--kp-line);
  border-radius: 18px;
  background: var(--kp-card);
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
}

.kp-webcam-card:active {
  transform: scale(0.99);
  background: var(--kp-card2);
}

.kp-webcam-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.kp-webcam-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--kp-fg);
}

.kp-webcam-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px #22c55e;
  animation: kp-pulse 2s infinite;
}

@keyframes kp-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.kp-webcam-city {
  font-size: 13px;
  color: var(--kp-muted);
}

.kp-webcam-body {
  height: 85px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(255, 255, 255, 0.12);
}

.kp-webcam-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--kp-muted);
  font-size: 13px;
}

.kp-webcam-placeholder svg {
  opacity: 0.6;
}

/* Tapadera modal webcam offline */
.kp-webcam-cover-box {
  text-align: center;
  padding: 24px 12px 16px;
}

.kp-webcam-offline-icon {
  font-size: 50px;
  margin-bottom: 12px;
  display: inline-block;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}

.kp-webcam-cover-box h3 {
  margin: 0 0 8px;
  font-size: 18px;
  color: var(--kp-fg);
}

.kp-webcam-subtext {
  font-size: 12px;
  color: var(--kp-muted);
  margin-top: 14px;
  opacity: 0.75;
}

/* Contenedor del stream P2P a pantalla completa */
.kp-stream-wrap {
  position: absolute;
  inset: 0;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  border-radius: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #000;
  z-index: 10;
}

.kp-stream-wrap .kp-webcam-cover-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
  padding: 24px 16px;
  box-sizing: border-box;
}

/* Sheet a pantalla completa total para cámara / videollamada P2P (edge-to-edge) */
.kp-sheet.kp-sheet-stream,
.kp-sheet:has(.kp-stream-wrap) {
  position: fixed;
  inset: 0;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  transform: none;
  background: #000;
  z-index: 50;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
  animation: kp-stream-fade 0.2s ease-out;
}

@keyframes kp-stream-fade {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.kp-sheet.kp-sheet-stream .kp-sheet-h,
.kp-sheet:has(.kp-stream-wrap) .kp-sheet-h {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  margin: 0;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 18px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.4) 65%, transparent 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.kp-sheet.kp-sheet-stream .kp-sheet-h > *,
.kp-sheet:has(.kp-stream-wrap) .kp-sheet-h > * {
  pointer-events: auto;
}

.kp-sheet.kp-sheet-stream .kp-sheet-h h2,
.kp-sheet:has(.kp-stream-wrap) .kp-sheet-h h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.kp-sheet.kp-sheet-stream .kp-sheet-h .kp-iconbtn,
.kp-sheet:has(.kp-stream-wrap) .kp-sheet-h .kp-iconbtn,
.kp-sheet.kp-sheet-stream .kp-sheet-h [data-close],
.kp-sheet:has(.kp-stream-wrap) .kp-sheet-h [data-close] {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.15s, transform 0.1s;
  flex-shrink: 0;
}

.kp-sheet.kp-sheet-stream .kp-sheet-h .kp-iconbtn:active,
.kp-sheet:has(.kp-stream-wrap) .kp-sheet-h .kp-iconbtn:active,
.kp-sheet.kp-sheet-stream .kp-sheet-h [data-close]:active,
.kp-sheet:has(.kp-stream-wrap) .kp-sheet-h [data-close]:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.28);
}

.kp-sheet.kp-sheet-stream .kp-stream-wrap,
.kp-sheet:has(.kp-stream-wrap) .kp-stream-wrap {
  position: absolute;
  inset: 0;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  border-radius: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #000;
  z-index: 10;
}

.kp-stream-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 100%;
  width: 100%;
  color: rgba(255, 255, 255, 0.9);
  font-size: 15px;
  background: #000;
}

.kp-stream-iframe {
  position: absolute;
  inset: 0;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #000;
}

/* Botones de acción en la cabecera superior (chat, rotar, voltear, formato, apagar) */
.kp-stream-top-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  margin-right: 4px;
  flex-shrink: 0;
}

.kp-stream-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  font-size: 17px;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

@media (max-width: 390px) {
  .kp-stream-top-actions {
    gap: 4px;
    margin-right: 2px;
  }
  .kp-stream-icon-btn {
    width: 32px;
    height: 32px;
    font-size: 15px;
  }
  .kp-sheet.kp-sheet-stream .kp-sheet-h .kp-iconbtn,
  .kp-sheet:has(.kp-stream-wrap) .kp-sheet-h .kp-iconbtn,
  .kp-sheet.kp-sheet-stream .kp-sheet-h [data-close],
  .kp-sheet:has(.kp-stream-wrap) .kp-sheet-h [data-close] {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
}

.kp-stream-icon-btn:active {
  transform: scale(0.92);
}

.kp-stream-icon-btn.is-off {
  background: rgba(220, 38, 38, 0.9);
  border-color: rgba(255, 120, 120, 0.7);
  color: #fff;
}

.kp-stream-icon-btn.is-active {
  background: rgba(124, 196, 255, 0.35);
  border-color: rgba(124, 196, 255, 0.8);
  color: #fff;
}

.kp-stream-icon-btn.is-rear {
  background: rgba(37, 99, 235, 0.85);
  border-color: rgba(147, 197, 253, 0.7);
  color: #fff;
}

/* Subtítulos mudos efímeros sobre el vídeo */
.kp-sub-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding: 20px 16px calc(24px + env(safe-area-inset-bottom, 0px));
  gap: 8px;
  z-index: 80;
  overflow: hidden;
}

.kp-sub-bubble {
  max-width: 90%;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(10, 20, 35, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(124, 196, 255, 0.35);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  word-break: break-word;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  animation: kp-sub-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.kp-sub-bubble.is-own {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(16, 28, 49, 0.85);
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  font-style: italic;
}

.kp-sub-bubble.is-leaving {
  opacity: 0;
  transform: translateY(-10px) scale(0.95);
}

@keyframes kp-sub-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Barra flotante para escribir mensaje efímero */
.kp-sub-bar {
  position: absolute;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  left: 14px;
  right: 14px;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 16px;
  border-radius: 999px;
  background: rgba(10, 20, 35, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(124, 196, 255, 0.4);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65);
  animation: kp-sub-in 0.18s ease-out;
}

.kp-sub-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: none;
  color: #fff;
  font-size: 14px;
  font-family: inherit;
}

.kp-sub-input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.kp-sub-cancel {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  touch-action: manipulation;
  transition: background 0.15s, color 0.15s;
}

.kp-sub-cancel:active {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.kp-sub-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: #7cc4ff;
  color: #08131f;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  touch-action: manipulation;
  transition: transform 0.1s, background 0.15s;
}

.kp-sub-send:active {
  transform: scale(0.9);
  background: #52aaff;
}

/* -------------------------------------------------------- chat secreto */

.kp-chat-h-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.kp-chat-h-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--kp-card2);
  border: 1px solid var(--kp-line);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
}

.kp-chat-status {
  font-size: 11px;
  color: var(--kp-muted);
  display: block;
}

.kp-chat-h-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.kp-btn-del:hover, .kp-btn-del:active {
  background: rgba(220, 38, 38, 0.25);
  border-color: rgba(220, 38, 38, 0.5);
}

.kp-chat-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 52vh;
  max-height: 52dvh;
  min-height: 180px;
  overflow-y: auto;
  padding: 8px 4px 14px;
  margin-bottom: 8px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.kp-chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  position: relative;
  word-break: break-word;
}

.kp-chat-msg.me {
  align-self: flex-end;
  align-items: flex-end;
}

.kp-chat-msg.partner {
  align-self: flex-start;
  align-items: flex-start;
}

.kp-chat-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--kp-fg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  word-break: break-word;
  overflow-wrap: break-word;
}

.kp-chat-msg.me .kp-chat-bubble {
  background: linear-gradient(135deg, #1e40af, #2563eb);
  border-bottom-right-radius: 4px;
  color: #ffffff;
}

.kp-chat-msg.partner .kp-chat-bubble {
  background: var(--kp-card2);
  border: 1px solid var(--kp-line);
  border-bottom-left-radius: 4px;
}

.kp-chat-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--kp-muted);
  margin-top: 3px;
  padding: 0 4px;
}

.kp-chat-img {
  max-width: 220px;
  max-height: 220px;
  border-radius: 12px;
  cursor: pointer;
  display: block;
  object-fit: cover;
  border: 1px solid var(--kp-line);
  transition: opacity 0.15s ease;
}

.kp-chat-img:active {
  opacity: 0.8;
}

.kp-chat-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--kp-line);
}

.kp-chat-input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--kp-line);
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.3);
  color: var(--kp-fg);
  font-size: 14px;
  outline: none;
}

.kp-chat-input:focus {
  border-color: var(--kp-accent);
}

.kp-chat-btn-cam,
.kp-chat-btn-send {
  flex-shrink: 0;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.kp-chat-btn-send {
  background: var(--kp-accent);
  color: #0b1220;
  border: none;
  font-weight: bold;
}

.kp-chat-btn-send:active {
  background: #60a5fa;
}

.kp-chat-confirm-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(11, 18, 32, 0.96);
  border-radius: 22px 22px 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
  text-align: center;
}

.kp-chat-confirm-overlay h3 {
  margin: 0 0 10px;
  font-size: 17px;
  color: #fff;
}

.kp-chat-confirm-overlay p {
  font-size: 13px;
  color: var(--kp-muted);
  margin: 0 0 20px;
  line-height: 1.4;
}

.kp-chat-confirm-btns {
  display: flex;
  gap: 12px;
  width: 100%;
}

.kp-chat-confirm-btns button {
  flex: 1;
  padding: 11px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--kp-line);
}

.kp-btn-danger {
  background: #dc2626;
  color: #fff;
  border: none !important;
}

.kp-btn-cancel {
  background: var(--kp-card);
  color: var(--kp-fg);
}

/* Visor Lightbox a pantalla completa */
.kp-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.94);
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.kp-lightbox[hidden] {
  display: none !important;
}

.kp-lightbox img {
  max-width: 96vw;
  max-height: 88vh;
  max-height: 88dvh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.8);
}

.kp-lightbox-close {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top));
  right: 16px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(30, 41, 59, 0.85);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}


/* v2.12.0 — Walkie-talkie (push-to-talk) */
.kp-stream-icon-btn.kp-ptt { touch-action: none; -webkit-touch-callout: none; }
.kp-stream-icon-btn.kp-ptt.is-talking {
  background: rgba(239, 68, 68, 0.85);
  border-color: rgba(255, 255, 255, 0.7);
  transform: scale(1.12);
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.35);
  animation: kp-ptt-pulse 1s ease-in-out infinite;
}
@keyframes kp-ptt-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.35); }
  50% { box-shadow: 0 0 0 7px rgba(239, 68, 68, 0.15); }
}
@media (max-width: 360px) {
  .kp-stream-top-actions { gap: 2px; }
  .kp-stream-icon-btn { width: 29px; height: 29px; font-size: 14px; }
}

/* v2.12.0 — Estado de entrega en historial */
.kp-hist-ok.kp-st-sent { color: var(--kp-muted, #8a94a6); }
.kp-hist-ok.kp-st-delivered { color: var(--kp-accent); letter-spacing: -3px; }
.kp-hist-ok.kp-st-replied { color: #22c55e; font-weight: 700; }