/* ===== CHAT HIGHLIGHT STROBE ===== */
@keyframes chat-highlight-strobe {

  0%,
  100% {
    outline: 2px solid #3fa34d;
  }

  25%,
  75% {
    outline: 2px solid transparent;
  }

  50% {
    outline: 2px solid #3fa34d;
  }
}

.chat-highlight-strobe {
  animation: chat-highlight-strobe 0.6s ease-in-out 3;
}

/* ===== RESET Y BASE ===== */
/* Leaflet.markercluster custom colors matching app palette */
.marker-cluster-small {
  background-color: rgba(63, 163, 77, 0.6);
}

.marker-cluster-medium {
  background-color: rgba(224, 166, 60, 0.6);
}

.marker-cluster-large {
  background-color: rgba(214, 69, 69, 0.6);
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background-color: inherit;
}

/* Custom cluster icon: circular badge with emoji + count */
.marker-cluster {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50% !important;
  width: 40px !important;
  height: 40px !important;
}

.marker-cluster .cluster-counts {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  line-height: 1;
  white-space: nowrap;
}

.marker-cluster .cluster-emoji {
  font-size: 14px;
  line-height: 1;
}

.marker-cluster .cluster-total {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

* {
  box-sizing: border-box;
}

/* Remove the default (often white/blue) focus outline. Keyboard users
   still get a subtle, theme-consistent indicator via :focus-visible. */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid rgba(69, 214, 214, 0.6);
  outline-offset: 0px;
}

:root {
  /* Live-tracked heights (updated by JS via ResizeObserver).
     Defaults are fallbacks until the first measurement runs. */
  --top-bar-height: 47px;
  --driver-height: 0px;
  --surface: 42, 42, 42;
}

html {
  min-width: 100vw;
  max-width: 100vw;
  min-height: 100vh;
  min-height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: scroll;
  overscroll-behavior: contain;
  /* scrollbar-gutter: stable ; */
  margin: 0;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  background: #0f1115;
  color: #eaeaea;
  min-width: 100vw;
  max-width: 100vw;
  min-height: 100vh;
  min-height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
}

*::-webkit-scrollbar {
  display: none;
}

body {
  scrollbar-width: none;
  /* Firefox */
  -ms-overflow-style: none;
  /* IE/Edge */
}

body::-webkit-scrollbar {
  display: none;
}

body {
  scrollbar-width: none;
  /* Firefox */
  -ms-overflow-style: none;
  /* IE/Edge */
}

.map-sidebar-list::-webkit-scrollbar {
  display: none;
}

.map-sidebar-list {
  scrollbar-width: none;
  /* Firefox */
  -ms-overflow-style: none;
  /* IE/Edge */
}

h1 {
  /* font-size: 1rem; */
  margin: 0 0 5px 0;
}

.name {
  text-transform: uppercase;
  font-size: 110%;
  margin-bottom: 5px;
}

#commentsContainer {
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* The map panel is a fixed full-viewport layer that sits BEHIND the
   sticky top bar and driver (which float over it with translucent blur).
   It is taken out of the body's flex/scroll flow entirely, so the other
   tab panels scroll normally between the sticky bars without the map's
   100dvh forcing overflow. Visibility is toggled from JS (showMap/
   hideMap) so it only paints on the map tab. */
#tabMapPanel {
  position: relative;
  inset: 0;
  padding: 0 !important;
  z-index: 1;
  /* below the sticky bars (9999/1000) and content */
}

#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.leaflet-control-zoom {
  bottom: 25px;
  /* bottom: calc(var(--driver-height) + 25px); */
  /* Move to bottom-right */
}

/* ===== OFFSCREEN ARROWS (items outside the viewport) ===== */
#offscreenArrows {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 999999000000;
}

.offscreen-arrow {
  position: absolute;
  pointer-events: auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(20, 20, 20, 0.7);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  transform: translate(-50%, -50%);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  transition: background 0.15s;
}

.offscreen-arrow:hover {
  background: rgba(60, 60, 60, 0.9);
}

.offscreen-arrow .arrow-glyph {
  display: block;
  line-height: 1;
}

.map-sidebar {
  display: none;
  position: fixed;
  /* Start below the sticky top bar so the first card isn't occluded. */
  top: var(--top-bar-height);
  left: 0px;
  bottom: var(--driver-height);
  width: 220px;
  max-width: calc(100% - 20px);
  background: rgba(40, 40, 40, 0.55);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 9999;
  flex-direction: column;
  overflow: hidden;
}

.map-sidebar-title {
  display: none;
  flex: 0 0 auto;
  padding: 10px 12px 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #ccc;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.map-sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 2px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.map-sidebar-card {
  display: flex;
  overflow: hidden;
  align-items: center;
  gap: 8px;
  /* Keep natural height: without this, flex-shrink:1 (default) squeezes
     every card to fit the list height when there are many items, instead
     of letting the list scroll. */
  flex-shrink: 0;
  /* Background and left border are derived from the status color (set
     inline as --status-color) via color-mix, matching the main cards. */
  background: color-mix(in srgb,
      var(--status-color, #888888) 12%,
      rgba(26, 29, 36, 0.85));
  border-left: 3px solid var(--status-color, #888888);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.map-sidebar-card:hover {
  background: color-mix(in srgb,
      var(--status-color, #888888) 20%,
      rgba(34, 38, 46, 0.85));
}

/* Angel is a special light-blue case (deceased), not a dark status tint. */
.map-sidebar-card.angel {
  background: rgba(127, 184, 236, 0.62);
  border-left-color: #add8e6;
}

.map-sidebar-photo {
  width: 40px;
  height: 40px;
  object-fit: cover;
  flex-shrink: 0;
  /* background: #12151c; */
}

.map-sidebar-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.map-sidebar-name {
  font-weight: 600;
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-sidebar-meta {
  font-size: 0.72rem;
  color: #999;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-sidebar-card .status-tag {
  margin-left: 0;
  flex-shrink: 0;
  font-size: 62%;
  padding: 3px 5px;
}

@media (max-width: 768px) {
  .leaflet-control-zoom {
    bottom: 25px;
    /* bottom: calc(var(--driver-height) + 40px); */
    /* Move to bottom-right */
  }

  .map-sidebar {
    top: auto;
    left: 0;
    right: 0;
    bottom: var(--driver-height);
    width: auto;
    max-width: 100%;
    /* Fixed height so the horizontal strip doesn't collapse (flex:1 child
       in an auto-height column flex container shrinks to 0). */
    height: 56px;
  }

  .map-sidebar-list {
    flex: 0 0 auto;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .map-sidebar-card {
    flex: 0 0 auto;
    width: 190px;
    height: 100%;
  }
}

.top-bar {
  position: sticky;
  top: 0px;
  gap: 5px;
  background: rgba(var(--surface), 0.38);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid rgb(var(--surface), 0.62);
  padding: 5px;
  z-index: 9999;
}

.crear {
  border: 1px solid gray;
  padding: 8px 10px;
  border-radius: 10px;
  margin-bottom: 8px;
  background: teal;
}

.tool-bar {
  display: flex;
  position: sticky;
  top: 47px;
  flex: 1;
  width: 100%;
  /* max-width: calc(100%-50px); */
  padding: 5px;
  z-index: 999;
  margin-bottom: 5px;
}

/* Button that opens the creation modal (replaces inline forms) */
.crear-btn {
  text-align: left;
  border: 1px solid palegoldenrod;
  padding: 5px 10px;
  border-radius: 5px;
  margin-right: auto;
  background: teal;
  color: palegoldenrod;
  font-size: 70% !important;
  font-weight: 700;
  cursor: pointer;
}

.crear-btn:hover {
  filter: brightness(1.1);
}

/* NUEVO buttons float above the driver instead of sitting inline with the
   tab buttons. #driver is position:sticky, so it is the containing block for
   these absolutely-positioned buttons. bottom:100% = the driver's top edge;
   +5px lifts the button just above it. */
#crear,
#subCrearBtn {
  position: absolute;
  right: 10px;
  bottom: calc(100% + 5px);
  z-index: 1001;
}

/* ===== FILTER ROW (inside .tool-bar) ===== */
.filter-row {
  display: flex;
  justify-content: right;
  gap: 5px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}

.filter-pills {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.filter-pill {
  border: 1px solid #333;
  background: #1a1d24;
  color: #ccc;
  padding: 4px 9px;
  border-radius: 14px;
  font-size: 70%;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.12s,
    color 0.12s,
    border-color 0.12s;
}

.filter-pill:hover {
  filter: brightness(1.25);
}

.filter-pill.active {
  background: teal;
  color: palegoldenrod;
  border-color: palegoldenrod;
}

/* Status pills: active color follows the status color. */
.filter-pill[data-status="desaparecido"].active {
  background: #e57373;
  color: #fff;
  border-color: #e57373;
}

.filter-pill[data-status="encontrado"].active {
  background: #66bb6a;
  color: #fff;
  border-color: #66bb6a;
}

.filter-pill[data-status="angel"].active {
  background: #add8e6;
  color: #222;
  border-color: #add8e6;
}

.filter-pill[data-status="seguro"].active {
  background: #66bb6a;
  color: #fff;
  border-color: #66bb6a;
}

.filter-pill[data-status="danado"].active {
  background: #f0c060;
  color: #222;
  border-color: #f0c060;
}

.filter-pill[data-status="colapsado"].active {
  background: #d06060;
  color: #fff;
  border-color: #d06060;
}

.filter-pill[data-status="acopio"].active {
  background: #ffffff;
  color: #222;
  border-color: #ffffff;
}

.filter-select {
  padding: 4px 8px;
  border-radius: 14px;
  border: 1px solid #333;
  background: #1a1d24;
  color: #eaeaea;
  font-size: 70%;
  cursor: pointer;
  max-width: 160px;
}

.filter-select:focus {
  outline: none;
  border-color: palegoldenrod;
}

.filter-input {
  padding: 4px 8px;
  border-radius: 14px;
  border: 1px solid #333;
  background: #1a1d24;
  color: #eaeaea;
  font-size: 70%;
  max-width: 120px;
}

.filter-input::placeholder {
  color: #777;
}

.filter-input:focus {
  outline: none;
  border-color: palegoldenrod;
}

/* ===== WIKI ===== */
.wiki {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0;
}

.wiki details {
  background: #1a1d24;
  border: 1px solid #2a2e36;
  border-radius: 10px;
  overflow: hidden;
}

.wiki summary {
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 600;
  list-style: none;
  user-select: none;
}

.wiki summary::-webkit-details-marker {
  display: none;
}

.wiki summary::before {
  content: "▸ ";
  color: #d64545;
}

.wiki details[open] summary::before {
  content: "▾ ";
}

.wiki-body {
  padding: 0 14px 12px 14px;
  color: #c9ccd2;
  line-height: 1.6;
}

.wiki-body p,
.wiki-body ul,
.wiki-body ol {
  margin: 6px 0;
}

.wiki-body li {
  margin-bottom: 4px;
}

.wiki-body b {
  color: #eaeaea;
}

/* Each form inside the crear modal; only the active one is shown */
.crear-form-wrap {
  display: none;
}

.crear-form-wrap.active {
  display: block;
}

/* Forms inside the modal reuse .crear form styling */
#crearModal .crear-form-wrap form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

#crearModal .crear-form-wrap form select {
  max-width: 100px;
}

#crearModal .crear-form-wrap form input,
#crearModal .crear-form-wrap form select {
  flex: 1 1 150px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #333;
  background: #1a1d24;
  color: #eaeaea;
}

#crearModal .crear-form-wrap form .gps-btn {
  flex: 0 0 auto;
  background: #333;
  padding: 10px 14px;
}

#crearModal .crear-form-wrap form .gps-btn:hover {
  background: #444;
}

/* Promote modal metadata line (intent, creator, date) */
.promote-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 0.8rem;
  color: #999;
  margin-bottom: 8px;
}

/* Original text box (read-only message preview) */
.original-text-box {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}
.original-text-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #ccc;
}
.original-text-area {
  width: 100%;
  min-height: 60px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #333;
  background: #1a1d24;
  color: #eaeaea;
  font-size: 0.85rem;
  resize: vertical;
  white-space: pre-wrap;
}

/* Items detectados section (for backlog promotion) */
.items-detected {
  width: 100%;
  margin-top: 8px;
  border: 1px solid #333;
  border-radius: 8px;
  background: #1a1d24;
}
.items-header {
  padding: 8px 12px;
  font-weight: 600;
  color: #ccc;
  border-bottom: 1px solid #2a2d36;
}
.items-detected summary {
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 600;
  color: #ccc;
}
.items-detected summary:hover {
  color: #fff;
}
.items-list {
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.item-row {
  display: flex;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid #2a2d36;
  font-size: 0.85rem;
}
.item-row:last-child {
  border-bottom: none;
}
.item-key {
  font-weight: 600;
  color: #888;
  min-width: 100px;
}
.item-value {
  color: #eaeaea;
  flex: 1;
  word-break: break-word;
}

/* Editable items list — each item is a card that wraps responsively */
.item-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px;
  border: 1px solid #2a2d36;
  border-radius: 8px;
  background: #14161c;
  margin-bottom: 6px;
}
.item-row:last-child {
  margin-bottom: 0;
}
.item-name-input,
.item-qty-input,
.item-type-input,
.item-from-input,
.item-to-input {
  padding: 6px 8px;
  border-radius: 4px;
  border: 1px solid #333;
  background: #1a1d24;
  color: #eaeaea;
  font-size: 0.85rem;
  min-width: 0;
}
.item-name-input {
  flex: 1 1 100%;
}
.item-qty-input {
  flex: 0 1 70px;
}
.item-type-input {
  flex: 1 1 160px;
  min-width: 160px;
}
.item-from-input,
.item-to-input {
  flex: 1 1 140px;
}
.item-remove-btn {
  flex: 0 0 auto;
  margin-left: auto;
}
.item-remove-btn,
.item-add-btn {
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #444;
  background: #2a2d36;
  color: #ccc;
  cursor: pointer;
  font-size: 0.8rem;
}
.item-remove-btn:hover {
  background: #444;
  color: #fff;
}
.item-add-btn {
  margin-top: 8px;
  width: 100%;
  background: #333;
}
.item-add-btn:hover {
  background: #444;
}

.crear form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  align-items: center;
}

.crear form input,
.crear form select {
  flex: 1 1 150px;
  min-width: 120px;
  padding: 10px 12px;
  /* font-size: 0.95rem; */
  border-radius: 8px;
  border: 1px solid #333;
  background: #1a1d24;
  color: #eaeaea;
}

.crear form .gps-btn {
  flex: 0 0 auto;
  background: #333;
  padding: 10px 14px;
}

.crear form .gps-btn:hover {
  background: #444;
}

.crear form button[type="submit"] {
  flex: 1 1 100px;
  background: #d64545;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  /* font-size: 0.95rem; */
  transition: background 0.15s;
}

.crear form button[type="submit"]:hover {
  background: #b53838;
}

/* ===== BOTÓN DE SUBIDA DE ARCHIVO PERSONALIZADO ===== */
.custom-file-upload {
  position: relative;
  display: inline-block;
  padding: 10px 16px;
  background: #2a2e36;
  color: #ddd;
  border-radius: 8px;
  cursor: pointer;
  /* font-size: 0.95rem; */
  transition: background 0.15s;
  border: 1px solid #444;
  flex: 0 0 auto;
  white-space: nowrap;
}

.custom-file-upload:hover {
  background: #3a3e46;
}

.custom-file-upload input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.file-name {
  display: none;
  color: #999;
  /* font-size: 0.85rem; */
  margin-left: 6px;
  flex: 1 1 120px;
  min-width: 80px;
  padding: 6px 0;
}

/* ===== TABS ===== */
.tabs {
  display: flex;
  padding: 8px;
  padding-top: 12px;
  gap: 5px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}

#driver {
  position: sticky;
  bottom: 0px;
  left: 0px;
  z-index: 1000;
}

.driver-inner {
  overflow: hidden;
  background: rgba(20, 20, 20, 0.85);
  backdrop-filter: blur(5px);
  border-top: 2px solid rgba(var(--surface), 0.62);
  display: flex;
  flex-direction: column;
  border-radius: 10px 10px 0px 0px;
  /* overflow: hidden; */
  /* gap: 10px; */
  /* padding-left: 5px; */
  /* padding-right: 5px; */
  /* padding-top: 11px; */
  min-width: 100%;
  max-width: 100%;
}

button {
  min-width: 25px;
  padding: 5px;
  border-radius: 8px;
  border: 1px solid rgba(var(--surface), 0.38);
  background: rgba(20, 20, 20, 0.8);
  color: #888;
  cursor: pointer;
  box-shadow:
    rgba(0, 0, 0, 0.4) 0px 2px 4px,
    rgba(0, 0, 0, 0.3) 0px 7px 13px -3px,
    rgba(60, 60, 60, 0.8) 0px 3px 0px;
  /* outside, below */
  transition: background 0.15s;
  transform: translateY(-3px);
}

input,
textarea {
  padding: 5px;
  padding-left: 20px;
  border-radius: 8px;
  border: 2px solid rgba(var(--surface), 0.62);
  background: rgba(10, 10, 10, 0.8);
  color: #888;
  /* font-size: 0.95rem; */
}

.tab-btn {
  opacity: 0.8;
  position: relative;
}

.tab-btn.active,
.sub-tab-btn.active {
  opacity: 1;
  background: rgba(0, 128, 128, 0.62);
  color: white;

  box-shadow:
    rgba(0, 0, 0, 0.4) 0px 2px 4px,
    rgba(0, 0, 0, 0.3) 0px 7px 13px -3px,
    rgba(60, 60, 60, 0.8) 0px 0px 0px;

  transform: translateY(0px);
}

/* live count badge on category tabs */
.tab-btn .n,
.sub-tab-btn .n {
  position: absolute;
  top: -8px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  font-family: ui-monospace, monospace;
  font-size: 62%;
  font-weight: 1000;
  padding: 0px 3px;
  line-height: 16px;
  text-align: center;
  border-radius: 6px;
  background: rgba(20, 20, 20, 0.38);
  opacity: 0.85;
  color: white;
  vertical-align: middle;
  box-shadow: 0 0 0 1px rgba(100, 100, 100, 0.8);
}

.tab-btn.active .n,
.sub-tab-btn.active .n {
  background: rgba(0, 128, 128, 0.38);
  /* color: blue; */
  box-shadow: 0 0 0 1px rgba(0, 160, 160, 0.8);
}

.tab-panel {
  display: none;
  padding: 5px;
  flex: 1;
}

.tab-panel.active {
  display: block;
}

.search-row>input {
  border-radius: 0px !important;
  border: none !important;
  border-bottom: 2px solid rgba(var(--surface), 0.62) !important;
  padding: 10px 20px !important;
  text-align: center;
}

.search-row input[type="search"] {
  width: 100%;
}

/* ===== LISTA ===== */
.list {
  display: grid;
  padding-bottom: 200px;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
}

.wiki {
  padding-bottom: 200px;
}

.card {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 200px;
  /* max-width: 300px; */
  min-height: 170px;
  max-height: 170px;
  font-size: 62%;
  /* Background and left border are derived from the status color (set
     inline as --status-color by the card renderers) via color-mix, so
     there's no per-status hardcoding to keep in sync. */
  background: color-mix(in srgb, var(--status-color, #888888) 12%, #1a1d24);
  border-radius: 10px;
  border-left: 4px solid var(--status-color, #888888);
  cursor: default;
  overflow: hidden;
  transition: background 0.15s;
  box-shadow:
    rgba(0, 0, 0, 0.4) 0px 2px 4px,
    rgba(0, 0, 0, 0.3) 0px 7px 13px -3px,
    rgba(60, 60, 60, 0.8) 0px 3px 0px;
}

.card:hover {
  background: color-mix(in srgb, var(--status-color, #888888) 20%, #22262e);
}

.card.colaborador {
  min-height: 120px;
  max-height: 120px;
}

.card.colaborador .card-photo {
  width: 70px;
  min-height: 70px;
  max-height: 70px;
}

.card.colaborador .card-inner {
  gap: 4px;
}

.card.colaborador .card-main {
  padding: 6px 0;
}

.card .card-inner {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  margin-left: 5px;
  overflow: hidden;
}

.card-photo {
  width: 130px;
  min-height: 100%;
  max-height: 100%;
  object-fit: cover;
  flex-shrink: 0;
  /* background: #12151c; */
}

.card-main {
  display: flex;
  overflow: hidden;
  /* flex-direction: column; */
  flex: 1;
  /* padding: 5px; */
}

.card .info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.card .name {
  font-weight: 600;
  /* font-size: 1.05rem; */
}

.card .meta {
  /* font-size: 0.8rem; */
  /* color: #999; */
}

.card .actions {
  /* display: flex; */
  padding: 5px;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
  margin-left: auto;
  pointer-events: auto;
}

.card .actions button {
  font-size: 85% !important;
}

.anuncio-text {
  padding: 5px;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  font-family: inherit;
  margin: 0;
  /* font-size: 1.05rem; */
  font-weight: 600;
  color: #eaeaea;
}

.map-search-result {
  padding: 8px 10px;
  cursor: pointer;
  /* font-size: 0.85rem; */
  border-bottom: 1px solid #2a2e36;
}

.map-search-result:hover {
  background: #22262e;
}

.map-search-result:last-child {
  border-bottom: none;
}

#mapPickerContainer {
  height: 320px;
  /* border-radius: 10px; */
  overflow: hidden;
  /* margin-bottom: 12px; */
}

.extra-location-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: #12151c;
  border-radius: 8px;
  padding: 6px 10px;
  margin-bottom: 6px;
  /* font-size: 0.85rem; */
  flex-wrap: wrap;
}

.nearby-item {
  cursor: pointer;
  padding: 7px 10px;
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  /* font-size: 0.88rem; */
}

.nearby-item:hover {
  background: #1a1d24;
}

.nearby-item .nearby-dist {
  color: #888;
  /* font-size: 0.78rem; */
  flex: 0 0 auto;
}

#mapPickerContext {
  align-items: center;
  gap: 8px;
  background: #12151c;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 10px;
  /* font-size: 0.9rem; */
}

.btn-share {
  background: #1e6b52;
  color: #ccc;
}

.btn-share:hover {
  background: #24805f;
}

/* ===== STATUS TAGS ===== */
.status-tag {
  margin: 5px;
  margin-left: auto;
  text-transform: uppercase;
  padding: 5px;
  border-radius: 4px;
  background: #888888;
  display: inline-block;
  letter-spacing: 0.3px;
  color: white;
  font-size: 80%;
}

.status-tag.encontrado,
.status-tag.seguro {
  background: #66bb6a;
}

.status-tag.danado {
  background: #f0c060;
  color: #222;
}

.status-tag.colapsado {
  background: #d06060;
}

.status-tag.acopio {
  background: #ffffff;
  color: #222;
}

.status-tag.colaborador {
  background: #888888;
}

.empty {
  display: none;
  text-align: center;
  color: #666;
  padding: 40px 0;
}

.photo-preview {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 8px;
}

.comment-badge {
  /* font-size: 0.78rem; */
  color: #9aa0a6;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.comment-item {
  background: #12151c;
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-left: 2px solid #d64545;
}

.comment-item .comment-text {
  color: #eaeaea;
  word-break: break-word;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  font-family: inherit;
  margin: 0;
}

.comment-item .comment-meta {
  /* font-size: 0.7rem; */
  color: #888;
}

#commentForm {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

#commentForm textarea {
  flex: 1;
  min-height: 100px;
}

#commentForm button {
  margin-left: auto;
}

.sub-tabs .tab-label {
  display: none;
}

@media (max-width: 900px) {
  .tab-label {
    display: none;
  }

  /* Building status pills: icon only on small screens. */
  .filter-pill .pill-label {
    display: none;
  }
}

@media (max-width: 480px) {

  .crear form input,
  .crear form select {
    flex: 1 1 100%;
  }

  .custom-file-upload {
    flex: 1 1 100%;
    text-align: center;
  }
}

.sismo-head {
  position: sticky;
  top: calc(var(--top-bar-height) + 5px);
  z-index: 998;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ===== ALERTA SISMO (card, consistente con .card) ===== */
.alerta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 14px;
  background: #1a1d24;
  border: 1px solid #333;
  border-left: 4px solid #74b9ff;
  border-radius: 10px;
  box-shadow:
    rgba(0, 0, 0, 0.4) 0px 2px 4px,
    rgba(0, 0, 0, 0.3) 0px 7px 13px -3px;
  transition:
    background 0.3s,
    border-color 0.3s;
}

.alerta-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 70%;
  color: #999;
}

.alerta-title {
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.alerta-rel {
  color: #ccc;
  font-weight: 600;
}

.alerta-body {
  display: flex;
  align-items: center;
  gap: 12px;
}

.alerta-mag {
  min-width: 56px;
  text-align: center;
  font-size: 150%;
  font-weight: 800;
  border-radius: 8px;
  padding: 4px 0;
  background: #74b9ff;
  color: #0f1115;
}

.alerta-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.alerta-lugar {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.alerta-hora {
  font-size: 80%;
  color: #999;
}

.alerta.peligro {
  border-left-color: #d63031;
  background: #2a1518;
  animation: pulse 1.5s infinite;
}

.alerta.peligro .alerta-mag {
  background: #d63031;
  color: #fff;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.02);
  }

  100% {
    transform: scale(1);
  }
}

/* ===== LISTA TEXTO DE SISMOS (fallback sin ECharts) ===== */
.sismos-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 4px;
}

.sismo-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #1a1d24;
  border: 1px solid #333;
  border-left: 4px solid #74b9ff;
  font-size: 14px;
  box-shadow:
    rgba(0, 0, 0, 0.4) 0px 2px 4px,
    rgba(0, 0, 0, 0.3) 0px 7px 13px -3px;
}

/* Borde izquierdo según magnitud (agrupa visualmente) */
.sismo-row.sev-0 {
  border-left-color: #74b9ff;
}

.sismo-row.sev-4 {
  border-left-color: #fdcb6e;
}

.sismo-row.sev-5 {
  border-left-color: #e17055;
}

.sismo-row.sev-6 {
  border-left-color: #d63031;
}

.sismo-row .sismo-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.sismo-row .sismo-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sismo-row .mag {
  min-width: 42px;
  text-align: center;
  font-weight: bold;
  font-size: 16px;
  border-radius: 6px;
  padding: 2px 0;
}

.sismo-row .mag.m0 {
  background: #74b9ff;
  color: #0f1115;
}

.sismo-row .mag.m4 {
  background: #fdcb6e;
  color: #0f1115;
}

.sismo-row .mag.m5 {
  background: #e17055;
  color: #fff;
}

.sismo-row .mag.m6 {
  background: #d63031;
  color: #fff;
}

.sismo-row .place {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sismo-row .rel {
  font-size: 12px;
  color: #999;
  white-space: nowrap;
}

.sismo-row .meta {
  font-size: 12px;
  color: #999;
}

.sismo-row a {
  color: #74b9ff;
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
}

.sismo-row a:hover {
  text-decoration: underline;
}

.sismo-row .depth-pill {
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid #333;
  background: #1a1d24;
  color: #ccc;
  font-size: 12px;
  white-space: nowrap;
}

/* ===== FEED EN VIVO (ventana corta, poll 60s) ===== */
.sismo-live {
  border: 1px solid #2f3b4d;
  border-radius: 10px;
  background: rgba(var(--surface), 0.38);
  backdrop-filter: blur(10px);
  overflow: hidden;
  box-shadow:
    rgba(0, 0, 0, 0.4) 0px 2px 4px,
    rgba(0, 0, 0, 0.3) 0px 7px 13px -3px;
}

.sismo-live-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid #2a2f3a;
  background: rgba(var(--surface), 0.23);
}

.sismo-live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #3ddc84;
  box-shadow: 0 0 0 0 rgba(61, 220, 132, 0.6);
  animation: live-pulse 2s infinite;
}

@keyframes live-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(61, 220, 132, 0.6);
  }

  70% {
    box-shadow: 0 0 0 8px rgba(61, 220, 132, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(61, 220, 132, 0);
  }
}

.sismo-live-title {
  font-size: 75%;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #3ddc84;
}

.sismo-live-updated {
  margin-left: auto;
  font-size: 70%;
  color: #888;
}

.sismo-live-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 170px;
  overflow-y: auto;
}

.sismo-live-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-left: 4px solid #74b9ff;
  font-size: 13px;
}

.sismo-live-item+.sismo-live-item {
  border-top: 1px solid #23272f;
}

.sismo-live-item.sev-0 {
  border-left-color: #74b9ff;
}

.sismo-live-item.sev-4 {
  border-left-color: #fdcb6e;
}

.sismo-live-item.sev-5 {
  border-left-color: #e17055;
}

.sismo-live-item.sev-6 {
  border-left-color: #d63031;
}

.sismo-live-item .mag {
  min-width: 38px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  border-radius: 6px;
  padding: 2px 0;
}

.sismo-live-item .mag.m0 {
  background: #74b9ff;
  color: #0f1115;
}

.sismo-live-item .mag.m4 {
  background: #fdcb6e;
  color: #0f1115;
}

.sismo-live-item .mag.m5 {
  background: #e17055;
  color: #fff;
}

.sismo-live-item .mag.m6 {
  background: #d63031;
  color: #fff;
}

.sismo-live-item .place {
  flex: 1;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.sismo-live-item .rel {
  font-size: 12px;
  color: #999;
  white-space: nowrap;
}

.sismo-live-item .depth {
  font-size: 11px;
  color: #aaa;
  white-space: nowrap;
}

.sismo-live-empty {
  padding: 12px;
  font-size: 13px;
  color: #999;
}

/* ============================================================
   SUB-TABS de la pestaña Colaboradores (privada)
   ============================================================ */
.sub-tabs {
  display: flex;
  /* flex-direction: column; */
  gap: 4px;
  padding: 5px;
  padding-top: 10px;
  overflow-x: auto;
  border-bottom: 1px solid rgba(var(--surface), 0.62);
  /* background: rgba(var(--surface), 0.23); */
  flex-shrink: 0;
  height: auto;
}

.sub-tab-btn {
  opacity: 0.8;
}

.sub-tab-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ccc;
}

/* .sub-tab-btn.active { */
/* background: rgba(0, 128, 128, 0.62); */
/* color: white; */
/* background: rgba(69, 214, 214, 0.15); */
/* color: #45d6d6; */
/* } */

/* Botones de acción (DONAR/REPORTAR/CREAR/COLABORAR) dentro de la barra de sub-tabs */
.sub-tabs .crear-btn {
  margin-right: 0;
  text-align: center;
  white-space: nowrap;
  flex-shrink: 0;
}

.sub-tab-panel {
  display: none;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.sub-tab-panel.active {
  display: flex;
  flex-direction: column;
}

/* Chat modal sub-tab panels: allow vertical scrolling of list content */
#chatModalSubPanels .sub-tab-panel {
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

#chatModalSubPanels .sub-tab-panel .list {
  padding-bottom: 40px;
  overflow-y: auto;
  min-height: 0;
  overscroll-behavior: contain;
}

/* Main collaborator tab panels - prevent overscroll bounce */
#tabColab.active {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#colabPrivateWrapper .sub-tab-panel {
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

#colabPrivateWrapper .sub-tab-panel .list {
  overflow-y: auto;
  min-height: 0;
  overscroll-behavior: contain;
}

/* The voluntarios panel wraps its list in #colabListWrapper; make it
   fill the panel and constrain height so the inner list can scroll. */
#colabListWrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

#colabListWrapper .list {
  flex: 1;
  min-height: 0;
}

/* ============================================================
   Status tags por tipo (donaciones / necesidades / logística)
   ============================================================ */
/* Donaciones */
.status-tag.donacion-disponible {
  background: rgba(63, 163, 77, 0.2);
  color: #3fa34d;
}

.status-tag.donacion-reservado {
  background: rgba(240, 173, 78, 0.2);
  color: #f0ad4e;
}

.status-tag.donacion-entregado {
  background: rgba(128, 128, 128, 0.2);
  color: #888;
}

.status-tag.donacion-vencido {
  background: rgba(214, 48, 49, 0.2);
  color: #d63031;
}

/* Necesidades */
.status-tag.necesidad-abierta {
  background: rgba(214, 48, 49, 0.2);
  color: #d63031;
}

.status-tag.necesidad-en_proceso {
  background: rgba(240, 173, 78, 0.2);
  color: #f0ad4e;
}

.status-tag.necesidad-cubierta {
  background: rgba(63, 163, 77, 0.2);
  color: #3fa34d;
}

.status-tag.necesidad-urgente {
  background: rgba(214, 48, 49, 0.25);
  color: #ff5050;
}

/* Logística */
.status-tag.logistica-pendiente {
  background: rgba(128, 128, 128, 0.2);
  color: #888;
}

.status-tag.logistica-en_ruta {
  background: rgba(69, 214, 214, 0.2);
  color: #45d6d6;
}

.status-tag.logistica-completado {
  background: rgba(63, 163, 77, 0.2);
  color: #3fa34d;
}

.status-tag.logistica-cancelado {
  background: rgba(214, 48, 49, 0.2);
  color: #d63031;
}

.status-tag.backlog-pending {
  background: rgba(214, 143, 0, 0.25);
  color: #e0a500;
}

.status-tag.backlog-accepted {
  background: rgba(63, 163, 77, 0.2);
  color: #3fa34d;
}

.status-tag.backlog-rejected {
  background: rgba(214, 48, 49, 0.2);
  color: #d63031;
}

.backlog-raw pre {
  margin: 6px 0 0;
  padding: 8px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 6px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 240px;
  overflow-y: auto;
}

.backlog-raw summary {
  cursor: pointer;
  color: #aaa;
  font-size: 0.8rem;
}

/* ===== Media grid (WhatsApp-style album) inside chat bubbles ===== */
.msg-sender-name {
  padding: 3px 5px;
}

.chat-media-grid {
  display: grid;
  gap: 2px;
  border-radius: 8px;
  overflow: hidden;
}

.chat-media-item {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #12151c;
}

/* Single-image groups: item fills the grid (grid aspect-ratio is the
   source of truth), so the bubble size is fixed before the image loads. */
.chat-media-grid[data-count="1"] .chat-media-item {
  aspect-ratio: auto;
  height: 100%;
}

.chat-media-grid[data-count="1"] .chat-media-item img,
.chat-media-grid[data-count="1"] .chat-media-item video {
  object-fit: cover !important;
}

.chat-media-more {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  pointer-events: none;
}

/* ===== Lightbox ===== */
#mediaLightbox {
  padding: 0;
  overflow: hidden;
}

#mediaLightbox .modal-content {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

#mediaLightbox [data-modal-body] {
  min-height: 0;
}

#lightboxStage {
  overflow: hidden;
  min-height: 0;
}

#lightboxStage img,
#lightboxStage video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  min-height: 0;
  object-fit: contain;
  display: block;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(20, 20, 20, 0.6);
  color: #fff;
  border: none;
  font-size: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 20;
}

.lightbox-prev {
  left: 10px;
}

.lightbox-next {
  right: 10px;
}

.lightbox-nav[disabled] {
  opacity: 0.25;
  cursor: default;
}

/* Recording button state */
#chatMicBtn.recording {
  color: #e53935;
  animation: pulse-rec 1s ease-in-out infinite;
}

@keyframes pulse-rec {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}
