/* ============================================================
   DOJO · style.css — Tema industrial dark, responsive
   ============================================================ */

/* ─── Variables ─────────────────────────────────────────── */
:root {
  --bg:          #0f1117;
  --bg2:         #181c27;
  --bg3:         #1f2436;
  --border:      #2a3050;
  --accent:      #3b82f6;
  --accent-h:    #2563eb;
  --danger:      #ef4444;
  --danger-h:    #dc2626;
  --success:     #22c55e;
  --warn:        #f59e0b;
  --text:        #e2e8f0;
  --text2:       #94a3b8;
  --text3:       #64748b;
  --cam-w:       340px;
  --radius:      8px;
  --radius-lg:   14px;
}

/* ─── Reset & base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Layout ────────────────────────────────────────────── */
.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar__logo {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--accent);
}

.topbar__sub {
  font-size: .8rem;
  color: var(--text2);
  border-left: 1px solid var(--border);
  padding-left: 14px;
}

.topbar__back {
  margin-left: auto;
  font-size: .85rem;
  color: var(--text2);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
}

.topbar__back:hover { color: var(--text); }

.main {
  flex: 1;
  padding: 20px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

/* ─── Index / Hero ──────────────────────────────────────── */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 32px;
  padding: 40px 20px;
}

.hero__logo {
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: 6px;
  color: var(--accent);
}

.hero__title {
  font-size: 1.25rem;
  color: var(--text2);
  text-align: center;
}

.hero__actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 320px;
}

/* ─── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: .95rem;
  font-weight: 600;
  transition: background .15s, transform .1s, opacity .15s;
  white-space: nowrap;
}

.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn--primary   { background: var(--accent);  color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--accent-h); }

.btn--danger    { background: var(--danger);  color: #fff; }
.btn--danger:hover:not(:disabled) { background: var(--danger-h); }

.btn--secondary { background: var(--bg3);     color: var(--text); border: 1px solid var(--border); }
.btn--secondary:hover:not(:disabled) { background: var(--border); }

.btn--success   { background: var(--success); color: #fff; }
.btn--success:hover:not(:disabled) { background: #16a34a; }

.btn--full { width: 100%; }
.btn--sm   { font-size: .8rem; padding: 5px 12px; }

/* ─── Cards ─────────────────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
}

.card__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── Two-column layout ─────────────────────────────────── */
.two-col {
  display: grid;
  grid-template-columns: var(--cam-w) 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 700px) {
  .two-col { grid-template-columns: 1fr; }
}

/* ─── Camera widget ─────────────────────────────────────── */
.cam-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
}

.cam-wrap video,
.cam-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cam-wrap canvas { pointer-events: none; }

.cam-status {
  font-size: .82rem;
  color: var(--text3);
  margin: 8px 0 4px;
  min-height: 1.2em;
}

.cam-status--error  { color: var(--danger); }
.cam-status--ok     { color: var(--success); }

.cam-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.cam-btn { flex: 1; min-width: 120px; font-size: .85rem; padding: 9px 12px; }

/* ─── Live indicator ────────────────────────────────────── */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .75rem;
  font-weight: 700;
  color: var(--success);
  margin-left: auto;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 1.4s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .3; }
}

/* ─── Detected name ─────────────────────────────────────── */
.detected-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--success);
  min-height: 1.5em;
  margin: 10px 0 4px;
  text-align: center;
}

/* ─── Form ──────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

.form-label {
  font-size: .82rem;
  color: var(--text2);
  font-weight: 600;
}

.form-input {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: .95rem;
  transition: border-color .15s;
  width: 100%;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ─── Info box ──────────────────────────────────────────── */
.info-box {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: .88rem;
  color: var(--text2);
  line-height: 1.7;
}

.info-box p { margin-bottom: 4px; }

/* ─── Table ─────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-top: 24px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}

thead th {
  background: var(--bg3);
  color: var(--text2);
  font-weight: 700;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,.025); }

tbody td {
  padding: 10px 14px;
  vertical-align: middle;
  color: var(--text);
}

.td-foto img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg3);
}

.td-foto .no-foto {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.td-name  { font-weight: 600; }
.td-email { font-size: .82rem; color: var(--text2); }

.td-coords {
  font-family: monospace;
  font-size: .82rem;
  color: var(--text2);
}

.td-address {
  font-size: .82rem;
  color: var(--text3);
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
  background: var(--bg3);
  color: var(--text2);
}

/* ─── Toast ─────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 22px;
  font-size: .92rem;
  font-weight: 600;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), opacity .2s;
  opacity: 0;
  z-index: 9999;
  pointer-events: none;
  white-space: nowrap;
  max-width: 90vw;
}

@media (max-width: 600px) {
  #toast {
    left: 0;
    right: 0;
    bottom: 16px;
    width: calc(100% - 32px);
    margin: 0 16px;
    transform: translateY(80px);
    white-space: normal;
    word-break: break-word;
    text-align: center;
    max-width: none;
    box-sizing: border-box;
  }
  #toast.show {
    transform: translateY(0);
  }
}

#toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

#toast.toast--ok    { border-color: var(--success); color: var(--success); }
#toast.toast--error { border-color: var(--danger);  color: var(--danger);  }
#toast.toast--saved { border-color: #f5c400; color: #f5c400; font-size: 1rem; }

/* Toast de paso en progreso */
#toast.toast--step {
  border-color: var(--accent);
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Toast persistente (error con Ok) */
#toast.toast--persistent {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.toast-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--accent);
  border-top-color: transparent;
  border-radius: 50%;
  animation: toast-spin .7s linear infinite;
  flex-shrink: 0;
}

@keyframes toast-spin {
  to { transform: rotate(360deg); }
}

.toast-ok-btn {
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 4px 14px;
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}
.toast-ok-btn:hover { filter: brightness(1.15); }

/* ─── PIN Modal ─────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.hidden { display: none; }

.modal-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px 20px;
  width: 100%;
  max-width: 320px;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 18px;
}

.pin-display {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}

.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  transition: background .1s, border-color .1s;
}

.pin-dot.filled {
  background: var(--accent);
  border-color: var(--accent);
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.pin-key {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 700;
  padding: 16px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .12s;
  text-align: center;
}

.pin-key:hover  { background: var(--border); }
.pin-key:active { background: var(--accent); color: #fff; }

.pin-key--del   { font-size: .95rem; color: var(--text2); }
.pin-key--zero  { grid-column: 2; }

@keyframes shake {
  0%,100%{ transform: translateX(0); }
  20%    { transform: translateX(-8px); }
  40%    { transform: translateX(8px); }
  60%    { transform: translateX(-5px); }
  80%    { transform: translateX(5px); }
}

.shake { animation: shake .4s ease; }

/* ─── Camera Modal ──────────────────────────────────────── */
.cam-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  padding: 20px;
}

.cam-modal.hidden { display: none; }

.cam-modal__box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 340px;
  overflow: hidden;
}

.cam-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.cam-modal__title { font-weight: 700; }

.cam-modal__close {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
}

.cam-modal__close:hover { color: var(--text); }

.cam-modal__list {
  list-style: none;
  padding: 8px 0;
  max-height: 260px;
  overflow-y: auto;
}

.cam-modal__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  cursor: pointer;
  transition: background .12s;
  font-size: .93rem;
}

.cam-modal__item:hover { background: var(--bg3); }

.cam-modal__item--active { color: var(--accent); font-weight: 600; }

.cam-modal__check { margin-left: auto; font-size: .9rem; }

.cam-modal__empty {
  padding: 20px;
  text-align: center;
  color: var(--text3);
  font-size: .88rem;
}

/* ─── Section title ─────────────────────────────────────── */
.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text2);
  margin: 28px 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── Spinner ───────────────────────────────────────────── */
.spinner {
  width: 18px;
  height: 18px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Utilities ─────────────────────────────────────────── */
.hidden  { display: none !important; }
.mt-12   { margin-top: 12px; }
.mt-16   { margin-top: 16px; }
.text-sm { font-size: .85rem; }
.text-muted { color: var(--text2); }
.mono    { font-family: monospace; }

/* ─── Filtros de tabla ──────────────────────────────────────── */
.table-filters {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  margin-bottom: 8px;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.filter-group--narrow {
  flex: 0 0 90px;
}

.filter-group--pdf {
  flex: 0 0 72px;
}

.filter-label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}

.filter-input {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: .88rem;
  padding: 7px 10px;
  outline: none;
  transition: border-color .15s;
  width: 100%;
  box-sizing: border-box;
}

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

.filter-pdf-btn {
  width: 100%;
  white-space: nowrap;
  padding: 7px 8px;
  font-size: .82rem;
}

.pagination-info {
  font-size: .8rem;
  color: var(--text2);
  margin-bottom: 10px;
  min-height: 1.2em;
}

@media (max-width: 600px) {
  .table-filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    flex-wrap: unset;
  }
  .filter-group--narrow,
  .filter-group--pdf {
    flex: unset;
  }
}

/* Multi-select personalizado */
.multi-select-wrap {
  position: relative;
}

.multi-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: .88rem;
  padding: 7px 10px;
  cursor: pointer;
  user-select: none;
  transition: border-color .15s;
}

.multi-select-trigger:hover { border-color: var(--accent); }
.multi-select-trigger.open  { border-color: var(--accent); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }

.multi-select-caret { font-size: .7rem; margin-left: 8px; transition: transform .15s; }
.multi-select-trigger.open .multi-select-caret { transform: rotate(180deg); }

.multi-select-dropdown {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: var(--bg2);
  border: 1px solid var(--accent);
  border-top: none;
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
  max-height: 200px;
  overflow-y: auto;
  z-index: 200;
  display: none;
}

.multi-select-dropdown.open { display: block; }

.multi-select-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: .87rem;
  transition: background .1s;
}

.multi-select-item:hover { background: var(--bg3); }
.multi-select-item input[type=checkbox] { accent-color: var(--accent); width: 14px; height: 14px; }

/* ─── Colores de estado geográfico ─────────────────────────── */
tr.geo-ok   { background: rgba(56, 161, 105, 0.18); }
tr.geo-fail { background: rgba(220, 53, 69, 0.18); }
tr.geo-ok:hover   { background: rgba(56, 161, 105, 0.30); }
tr.geo-fail:hover { background: rgba(220, 53, 69, 0.30); }

/* ─── Modal detalle registro ────────────────────────────────── */
/* ─── Detail Cards — popup 25vh × 90vw, 4 columnas ─────────────────── */
.detail-card {
  position: fixed;
  left: 5vw;
  bottom: 0;
  width: 90vw;
  height: 33vh;
  min-height: 180px;
  max-height: 90vh;
  background: var(--bg2);
  border: 1.5px solid #3b82f6;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -6px 32px rgba(0,0,0,.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1000;
  transition: height .05s linear;
}

/* Handle de redimensionado — borde superior arrastrable */
.detail-card__resize {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  cursor: ns-resize;
  z-index: 10;
  border-radius: 16px 16px 0 0;
}
.detail-card__resize:hover,
.detail-card__resize:active {
  background: rgba(59,130,246,.25);
}

.detail-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
}
.detail-card__header:active { cursor: grabbing; }

.detail-card__title {
  font-weight: 700;
  font-size: .88rem;
  color: #3b82f6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.detail-card__close {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 1rem;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 6px;
  transition: background .12s, color .12s;
  flex-shrink: 0;
}
.detail-card__close:hover { color: #ef4444; background: rgba(239,68,68,.12); }

/* ── 4 columnas ─────────────────────────────────────────────────── */
.detail-card__cols {
  display: grid;
  grid-template-columns: 20% 30% 1fr 1fr;
  gap: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.dc-col {
  padding: 8px 10px;
  border-right: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.dc-col:last-child { border-right: none; }

/* Col 1 — foto persona */
.dc-col--foto {
  align-items: flex-start;
  justify-content: flex-start;
}
.dc-foto-img {
  width: 100%;
  max-height: calc(var(--dc-h, 33vh) - 80px);
  object-fit: cover;
  border-radius: 8px;
}
.dc-no-foto {
  font-size: 2.5rem;
  text-align: center;
  color: var(--text3);
}
.dc-nombre {
  font-size: .8rem;
  font-weight: 700;
  color: var(--text2);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

/* Col 2 — mapa */
.dc-col--mapa {
  padding: 6px;
}
.dc-col--mapa iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 8px;
  display: block;
  flex: 1;
  min-height: 0;
}
.dc-no-map {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: var(--text3);
  font-size: .85rem;
}

/* Col 3 — datos del registro */
.dc-col--datos {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(59,130,246,.3) transparent;
}
.dc-field {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.dc-label {
  font-size: .68rem;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.dc-val {
  font-size: .82rem;
  color: var(--text);
  word-break: break-word;
}
.dc-val.mono { font-family: monospace; font-size: .78rem; }

.detail-geo-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
}
.detail-geo-badge--ok   { background: rgba(56,161,105,.2); color: #38a169; }
.detail-geo-badge--fail { background: rgba(220,53,69,.2);  color: #dc3545; }
.detail-geo-badge--none { background: var(--bg3); color: var(--text3); }

/* Col 4 — fotos TS */
.dc-col--tsfotos {
  overflow: hidden;
}
.dc-ts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.dc-ts-add {
  font-size: .75rem;
  color: #3b82f6;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid rgba(59,130,246,.4);
  transition: background .12s;
  user-select: none;
}
.dc-ts-add:hover { background: rgba(59,130,246,.1); }

.dc-ts-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(59,130,246,.3) transparent;
  align-content: flex-start;
  padding-top: 2px;
}
.dc-ts-loading,
.dc-ts-empty {
  font-size: .8rem;
  color: var(--text3);
  padding: 4px;
}

.dc-ts-thumb {
  width: calc(50% - 3px);
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  cursor: zoom-in;
  border: 1px solid var(--border);
  flex-shrink: 0;
  transition: transform .12s;
}
.dc-ts-thumb:hover { transform: scale(1.03); }
.dc-ts-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.dc-ts-thumb--loading {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg3);
  font-size: 1.2rem;
}

/* Responsive detail-card */
@media (max-width: 700px) {
  .detail-card {
    left: 0;
    width: 100vw;
    height: 50vh;
    border-radius: 16px 16px 0 0;
  }
  .detail-card__cols {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
  }
  .dc-col--mapa { display: none; } /* ocultar mapa en pantallas muy pequeñas */
}

/* Zoom de foto TS */
.dc-ts-zoom {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: 20px;
}
.dc-ts-zoom__body {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  max-width: 90vw;
  max-height: 90vh;
}
.dc-ts-zoom__img {
  max-height: 80vh;
  max-width: 55vw;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 8px 40px rgba(0,0,0,.7);
  flex-shrink: 0;
}
.dc-ts-zoom__side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 320px;
  max-width: 440px;
  flex: 1;
  position: relative;
}
.dc-ts-zoom__label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: .9rem;
  font-weight: 600;
  color: #e2e8f0;
  width: 100%;
}
.dc-ts-zoom__select,
.dc-ts-zoom__glosa {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 7px;
  color: #f1f5f9;
  padding: 8px 10px;
  font-size: .9rem;
  width: 100%;
}
.dc-ts-zoom__select option { background: #1e293b; color: #f1f5f9; }
.dc-ts-zoom__glosa {
  resize: vertical;
  min-height: 120px;
  flex: 1;
  font-family: inherit;
  font-size: .9rem;
}
.dc-ts-zoom__btns {
  display: flex;
  flex-direction: row;
  gap: 8px;
  margin-top: auto;
  flex-wrap: wrap;
}
.dc-ts-zoom__cerrar,
.dc-ts-zoom__grabar,
.dc-ts-zoom__borrar {
  padding: 9px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 600;
  transition: opacity .12s;
  flex: 1;
  text-align: center;
}

/* Botón cerrar: esquina superior derecha del panel */
.dc-ts-zoom__cerrar {
  position: absolute;
  top: -36px;
  right: 0;
  flex: none;
  width: auto;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: .85rem;
}
.dc-ts-zoom__cerrar { background: rgba(255,255,255,.15); color: #f1f5f9; }
.dc-ts-zoom__grabar { background: #3b82f6; color: #fff; }
.dc-ts-zoom__borrar { background: #ef4444; color: #fff; }
.dc-ts-zoom__cerrar:hover,
.dc-ts-zoom__grabar:hover,
.dc-ts-zoom__borrar:hover { opacity: .82; }

@media (max-width: 600px) {
  .dc-ts-zoom__body   { flex-direction: column; align-items: center; }
  .dc-ts-zoom__img    { max-width: 90vw; max-height: 45vh; }
  .dc-ts-zoom__side   { max-width: 90vw; width: 100%; }
  .dc-ts-zoom__btns   { flex-direction: row; }
  .dc-ts-zoom__cerrar,
  .dc-ts-zoom__grabar,
  .dc-ts-zoom__borrar { width: auto; flex: 1; }
}

/* ─── Btn inline ─────────────────────────────────────────────── */
.btn--icon {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text2);
  cursor: pointer;
  padding: 4px 8px;
  font-size: .82rem;
  transition: background .12s, color .12s;
}
.btn--icon:hover { background: var(--bg3); color: var(--text); }
.btn--icon--danger { color: var(--red, #dc3545); border-color: var(--red, #dc3545); }
.btn--icon--danger:hover { background: rgba(220,53,69,.12); }

/* ─── Admin map (Leaflet dark theme overrides) ──────────────────────────────── */
#adminMap .leaflet-container { background: var(--bg2); }
#adminMap .leaflet-control-attribution { font-size: .65rem; }
#adminMap .leaflet-draw-toolbar a,
#adminMap .leaflet-control-zoom a {
  background: var(--bg2) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
#adminMap .leaflet-draw-toolbar a:hover,
#adminMap .leaflet-control-zoom a:hover {
  background: var(--bg3) !important;
}
#adminMap .leaflet-tooltip {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
#adminMap .leaflet-tooltip-top::before {
  border-top-color: var(--border);
}

.btn--active { background: #1d4ed8 !important; color: #fff !important; box-shadow: 0 0 0 2px #93c5fd; }
