:root {
  --red: #C0001B;
  --red-logo: #C41A1A;
  --ink: #1E252D;
  --muted: #8A94A6;
  --paper: #F7F8FA;
  --line: #e6e8ee;
  --shadow: 0 8px 14px -4px rgb(30 37 45 / 0.12);
  font-family: Manrope, sans-serif;
  font-size: 17px;
}

strong, b {
  font-weight: 600;
}

svg.icon-svg {
  width: 1.2em;
  height: 1.2em;
  max-width: 100%;
  display: inline-block;
  vertical-align: middle;
  flex: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #e8ecf1;
  color: var(--ink);
}

body {
  min-height: 100dvh;
}

.chat-shell {
  width: min(100%, 28rem);
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: 0 0 0 1px rgb(30 37 45 / 0.06);
  overflow: hidden;
}

.chat-header {
  flex: none;
  background: var(--red-logo);
  color: #fff;
  padding: max(0.35rem, env(safe-area-inset-top)) 0.75rem 0.45rem;
}

.chat-header__inner {
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  align-items: center;
}

.chat-header img {
  height: 42px;
  width: auto;
  max-width: 210px;
  justify-self: center;
  display: block;
}

.chat-header__close {
  justify-self: end;
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgb(255 255 255 / 0.3);
  background: linear-gradient(135deg, #25D366 0%, #1EBE5D 100%);
  color: #fff;
  display: grid;
  place-items: center;
  text-decoration: none;
  box-shadow: 0 4px 12px rgb(0 0 0 / 0.18);
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.chat-header__close:hover,
.chat-header__close:active {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 6px 16px rgb(0 0 0 / 0.24);
}

.chat-header__close svg {
  width: 20px;
  height: 20px;
  display: block;
  flex: none;
}

.chat-header__pulse {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 0 0 rgb(255 255 255 / 0.7);
  animation: wa-pulse 2.2s infinite;
  flex: none;
}

@keyframes wa-pulse {
  0% { box-shadow: 0 0 0 0 rgb(255 255 255 / 0.75); }
  70% { box-shadow: 0 0 0 6px rgb(255 255 255 / 0); }
  100% { box-shadow: 0 0 0 0 rgb(255 255 255 / 0); }
}

.chat-main {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #fff;
}

.stage {
  position: relative;
  z-index: 1;
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: transparent;
}

.watermark {
  pointer-events: none;
  background: url('/brand/generali-lion.png') center / min(68%, 250px) no-repeat;
  opacity: 0.2;
}

.stage--bottom .watermark {
  flex: 1;
  min-height: 7.5rem;
}

.stage--top .watermark {
  position: absolute;
  inset: 0;
}

.sheet {
  padding: 1.15rem 1rem max(1rem, env(safe-area-inset-bottom));
}

.stage--top .sheet {
  position: relative;
  z-index: 1;
  min-height: 0;
  flex: 1;
  overflow-y: auto;
}

.stage--top .sheet:has(.created),
.stage--top .sheet:has(.history),
.stage--top .sheet:has(.fotos) {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 0.85rem 0.75rem max(0.85rem, env(safe-area-inset-bottom));
}

.stage--bottom .sheet {
  flex: none;
  padding-top: 0.35rem;
}

.chat-dock-intro {
  margin: 0 0 0.75rem;
  font-size: 1.08rem;
  font-weight: 400;
  line-height: 1.45;
  white-space: pre-wrap;
}

.chat-menu-scroll {
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding-right: 0.1rem;
}

.chat-menu-item {
  width: 100%;
  min-height: 3.5rem;
  border-radius: 999px;
  border: 1px solid #efe8dc;
  background: #f6f1e8;
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  font-size: 1.05rem;
  text-align: left;
  padding: 0.7rem 1rem 0.7rem 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.chat-menu-item:active { transform: scale(0.99); }

.chat-menu-item__icon {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  display: grid;
  place-items: center;
  flex: none;
  font-size: 0.95rem;
}

.chat-menu-item__icon svg {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
}

.chat-menu-item span:last-child { flex: 1; }

.created {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: #fff;
  border: 1.5px solid #f0c4c9;
  border-radius: 28px;
  padding: 2rem 1.25rem 1.4rem;
  box-shadow: 0 18px 40px rgb(30 37 45 / 0.08);
}

.created h2 {
  margin: 1rem 0 0.35rem;
  font-size: 1.7rem;
  letter-spacing: -0.02em;
}

.created-mark {
  width: 5.4rem;
  height: 5.4rem;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  border: 3px solid #fff;
  box-shadow: 0 0 0 8px #fff, 0 0 0 10px #f0c4c9;
  display: grid;
  place-items: center;
}

.created-mark svg {
  width: 2.6rem;
  height: 2.6rem;
  display: block;
}

.created .service {
  margin: 0 0 0.85rem;
  color: var(--red);
  font-size: 1.15rem;
  font-weight: 800;
}

.created-meta { margin-bottom: 0.85rem; }

.created .case {
  margin: 0.15rem 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

.created-copy {
  margin: 0 0 1.35rem;
  max-width: 22rem;
  line-height: 1.45;
  font-weight: 600;
}

.created .track,
.created .primary {
  width: 100%;
  min-height: 3.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  text-decoration: none;
}

.created .primary svg,
.created .track svg,
button.primary svg,
.primary svg,
.track svg,
.locate svg {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
  flex: none;
}

.created .track {
  margin: 0.7rem 0 0;
  border: 2px solid var(--red);
  border-radius: 999px;
  background: #fff;
  color: var(--red);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.created--ok { border-color: #c8ead4; }

.created--ok .created-mark {
  background: #128a3e;
  box-shadow: 0 0 0 8px #fff, 0 0 0 10px #c8ead4;
}

.created-facts {
  width: 100%;
  margin: 0.15rem 0 0.35rem;
  padding: 0.8rem 0.95rem;
  border-radius: 16px;
  background: #f4faf6;
  text-align: left;
}

.created-facts p {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.4rem 0;
  font-size: 0.92rem;
}

.created-facts span {
  color: var(--muted);
  font-weight: 400;
}

.created-facts strong { font-weight: 600; }

.created .track + .primary { margin-top: 1.7rem; }

.history {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  gap: 0.75rem;
}

.history h2 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.35;
}

.history-list {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding-right: 0.1rem;
}

.assist {
  background: #fff;
  border: 1px solid #f0c4c9;
  border-radius: 18px;
  padding: 0.9rem 1rem 0.85rem;
  box-shadow: var(--shadow);
}

.assist-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.assist h3 {
  margin: 0.2rem 0;
  font-size: 1.05rem;
}

.assist p { margin: 0.15rem 0; }

.assist .status {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.82rem;
  font-weight: 800;
}

.status--proceso { color: #128a3e; }
.status--concluida { color: var(--red); }

.assist-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.75rem;
}

.assist-track {
  width: 100%;
  min-height: 2.6rem;
  border: 2px solid var(--red);
  border-radius: 999px;
  background: #fff;
  color: var(--red);
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1rem;
}

.assist-cancel {
  width: 100%;
  margin-top: 0;
  border: 0;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font: inherit;
  font-weight: 500;
  padding: 0.7rem 1rem;
  cursor: pointer;
}

.empty {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}

.contacts, .call-list { display: flex; flex-direction: column; gap: 0.65rem; }

.call {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--ink);
  background: #fff;
  border: 1px solid #f0c4c9;
  border-radius: 18px;
  padding: 0.75rem 0.85rem;
  box-shadow: var(--shadow);
}

.call small {
  display: block;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.75rem;
}

.call strong { font-size: 1rem; }

.composer, .gate {
  display: flex;
  gap: 0.5rem;
}

.composer input, .gate input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.85rem 1rem;
  font: inherit;
  color: var(--ink);
  outline: none;
}

.composer input:focus, .gate input:focus { border-color: var(--red); }

button.primary, .composer button, .gate button {
  border: 0;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font: inherit;
  font-weight: 700;
  padding: 0.85rem 1rem;
  cursor: pointer;
}

.composer button {
  width: 3.15rem;
  min-width: 3.15rem;
  height: 3.15rem;
  padding: 0;
  display: grid;
  place-items: center;
  flex: none;
}

.composer button svg {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
}

button.secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

button.inverted { background: var(--ink); }

.location {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.file input { display: none; }

.hint {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.error {
  color: var(--red);
  font-size: 0.82rem;
  margin: 0.45rem 0 0;
}

.fotos {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  gap: 0.65rem;
}

.fotos h2 {
  margin: 0;
  font-size: 1.25rem;
}

.fotos-list {
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding-right: 0.1rem;
}

.foto-slot {
  border: 1.5px solid #f0c4c9;
  border-radius: 18px;
  background: #fff;
  padding: 0.75rem 0.8rem;
}

.foto-slot.is-lista { border-color: #b7e0c4; }

.foto-slot header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.foto-slot header span {
  color: var(--red);
  font-size: 0.75rem;
  font-weight: 700;
}

.foto-slot header span.opcional { color: var(--muted); }

.foto-slot.is-lista header span { color: #128a3e; }

.foto-slot p {
  margin: 0.2rem 0 0.55rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.foto-acciones {
  display: flex;
  gap: 0.45rem;
}

.foto-acciones button {
  flex: 1;
  min-height: 2.6rem;
  border-radius: 999px;
  border: 1px solid var(--red);
  background: #fff;
  color: var(--red);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.foto-slot input { display: none; }

.foto-vista img {
  width: 100%;
  height: 7.5rem;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}

.foto-vista span {
  display: inline-block;
  margin-top: 0.4rem;
  color: #128a3e;
  font-size: 0.78rem;
  font-weight: 700;
}

.foto-subiendo {
  padding: 0.85rem 0.2rem 0.35rem;
}

.foto-subiendo span {
  font-weight: 700;
}

.foto-subiendo small {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
}

.foto-bar {
  margin-top: 0.55rem;
  height: 0.4rem;
  border-radius: 999px;
  background: #f6e6e8;
  overflow: hidden;
}

.foto-bar span {
  display: block;
  height: 100%;
  width: 38%;
  border-radius: inherit;
  background: var(--red);
  animation: foto-carga 1.1s ease-in-out infinite;
}

@keyframes foto-carga {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(280%); }
}

.fotos-cuenta {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
}

.fotos .primary:disabled {
  opacity: 0.45;
  cursor: default;
}
