/* ================== VEHICLE PHOTO GALLERY MODAL (ui-gallery.js) ==================
   Pixel target: design_handoff_galeria_vehiculo. Accent #2563eb, tile radius 14px,
   modal radius 18px. Mounted in #galleryRoot. */
@keyframes gmSheetIn { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes gmFadeIn  { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.gm-overlay {
  position: fixed; inset: 0; z-index: 1200;
  display: flex; align-items: center; justify-content: center; padding: 28px;
  background: rgba(15, 23, 42, .45);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .2s ease;
}
.gm-overlay.in { opacity: 1; }

.gm-sheet {
  position: relative; width: 100%; max-width: 920px; max-height: 88vh;
  display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border: 1px solid #ececf1; border-radius: 18px;
  box-shadow: 0 30px 80px -20px rgba(15, 23, 42, .5);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #18181b;
  opacity: 0; transform: translateY(14px) scale(.985);
  transition: opacity .22s ease, transform .22s cubic-bezier(.16, 1, .3, 1);
}
.gm-sheet.in { opacity: 1; transform: none; }

/* head */
.gm-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid #f0f0f3; flex: none; }
.gm-head-info { display: flex; align-items: center; gap: 11px; min-width: 0; }
.gm-head-icon { width: 36px; height: 36px; border-radius: 10px; background: #eff4ff; color: #2563eb; display: flex; align-items: center; justify-content: center; flex: none; }
.gm-head-titles { min-width: 0; }
.gm-title { font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.gm-sub { font-size: 12.5px; color: #a1a1aa; margin-top: 1px; }
.gm-close { width: 34px; height: 34px; padding: 0; border-radius: 9px; border: none; background: #f4f4f5; color: #52525b; display: flex; align-items: center; justify-content: center; cursor: pointer; flex: none; transition: background .15s ease, color .15s ease; }
.gm-close:hover { background: #e9e9ec; color: #18181b; }

/* toolbar */
.gm-toolbar { display: flex; align-items: center; gap: 12px; padding: 14px 20px 0; flex: none; }
.gm-toolbar-spacer { flex: 1; }
.gm-selectall { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: 9px; border: 1px solid #e4e4e7; background: #fff; color: #3f3f46; font-size: 13px; font-weight: 550; cursor: pointer; }
.gm-selectall:hover { background: #fafafa; border-color: #d4d4d8; }
.gm-checkbox { width: 17px; height: 17px; border-radius: 5px; border: 1.5px solid #cbcbd1; background: #fff; display: flex; align-items: center; justify-content: center; }
.gm-checkbox.checked { border-color: #2563eb; background: #2563eb; }
.gm-add-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 9px; border: none; background: #2563eb; color: #fff; font-size: 13.5px; font-weight: 600; cursor: pointer; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); }
.gm-add-btn:hover { filter: brightness(1.08); }

/* body + grid */
.gm-body { flex: 1; overflow-y: auto; padding: 16px 20px 20px; min-height: 0; }
.gm-body.file-over { outline: 2px dashed #2563eb; outline-offset: -10px; border-radius: 14px; }
.gm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }

/* tile */
.gm-tile { position: relative; aspect-ratio: 4 / 3; border-radius: 14px; overflow: hidden; background: #0b1220; cursor: grab; user-select: none; box-shadow: 0 1px 2px rgba(16, 24, 40, .08); transition: box-shadow .18s ease, opacity .15s ease, transform .15s ease; }
.gm-tile:hover { transform: translateY(-2px); }
.gm-tile.cover { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #2563eb; }
.gm-tile.selected { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #2563eb, 0 14px 30px -14px rgba(16, 24, 40, .5); }
.gm-tile.dragging { opacity: .4; }
.gm-tile.insert-before { box-shadow: -3px 0 0 0 #2563eb, 0 1px 2px rgba(16, 24, 40, .08); }
.gm-tile.insert-after { box-shadow: 3px 0 0 0 #2563eb, 0 1px 2px rgba(16, 24, 40, .08); }
.gm-tile-img { position: absolute; inset: 0; background-size: cover; background-position: center; }
.gm-tile-grad { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(0,0,0,.34) 0%, rgba(0,0,0,0) 24%, rgba(0,0,0,0) 56%, rgba(0,0,0,.56) 100%); }

.gm-tile-check { position: absolute; top: 8px; left: 8px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(255,255,255,.92); background: rgba(11,18,32,.34); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 6; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.gm-tile-check.checked { border-color: #2563eb; background: #2563eb; }

.gm-cover-badge { position: absolute; top: 8px; right: 8px; display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 6px; background: rgba(37,99,235,.96); color: #fff; font-size: 11px; font-weight: 650; z-index: 4; box-shadow: 0 2px 6px rgba(0,0,0,.25); }

.gm-tile-actions { position: absolute; bottom: 8px; right: 8px; display: flex; gap: 6px; z-index: 4; }
.gm-act { width: 30px; height: 30px; padding: 0; border-radius: 8px; border: none; background: rgba(11,18,32,.5); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: background .15s ease; }
.gm-act svg, .gm-close svg, .gm-lb-nav svg, .gm-lb-close svg { display: block; flex: none; }
.gm-act.cover:hover { background: #2563eb; }
.gm-act.del:hover { background: #dc2626; }

.gm-uploading { position: absolute; inset: 0; background: rgba(11,18,32,.55); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; z-index: 5; }
.gm-spinner { animation: spin .8s linear infinite; }
.gm-pct { font-size: 11.5px; color: #fff; font-weight: 600; }
.gm-progress { position: absolute; bottom: 0; left: 0; right: 0; height: 4px; background: rgba(255,255,255,.25); }
.gm-progress-bar { height: 100%; background: #2563eb; border-radius: 999px; transition: width .3s ease; }

.gm-error { position: absolute; inset: 0; background: rgba(127,29,29,.62); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; z-index: 5; }
.gm-retry { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px; border-radius: 7px; border: 1px solid rgba(255,255,255,.6); background: rgba(255,255,255,.15); color: #fff; font-size: 11px; font-weight: 600; cursor: pointer; }
.gm-retry:hover { background: rgba(255,255,255,.28); }

.gm-add-tile { aspect-ratio: 4 / 3; border-radius: 14px; border: 1.5px dashed #d4d4d8; background: #fbfbfd; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; cursor: pointer; color: #71717a; font-size: 12px; font-weight: 600; transition: .15s; }
.gm-add-tile:hover { border-color: #2563eb; color: #2563eb; background: #f5f8ff; }

/* empty state */
.gm-empty { border: 1.5px dashed #d4d4d8; border-radius: 14px; background: #fbfbfd; padding: 56px 24px; text-align: center; cursor: pointer; transition: .15s; }
.gm-empty:hover { border-color: #2563eb; background: #f5f8ff; }
.gm-empty-icon { width: 58px; height: 58px; border-radius: 15px; background: #eff4ff; color: #2563eb; display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }
.gm-empty-title { font-size: 15.5px; font-weight: 600; margin-bottom: 5px; }
.gm-empty-sub { font-size: 13.5px; color: #71717a; margin-bottom: 18px; }
.gm-empty-cta { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 17px; border-radius: 9px; background: #2563eb; color: #fff; font-size: 13.5px; font-weight: 600; }

/* footer */
.gm-footer { flex: none; border-top: 1px solid #f0f0f3; padding: 14px 20px; min-height: 64px; display: flex; align-items: center; }
.gm-footrow, .gm-selbar { display: flex; align-items: center; gap: 12px; width: 100%; }
.gm-selbar { animation: gmFadeIn .15s ease; }
.gm-status { font-size: 12.5px; color: #a1a1aa; }
.gm-selcount { font-size: 13px; font-weight: 600; }
.gm-btn { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.gm-btn.primary { background: #2563eb; color: #fff; border: none; box-shadow: 0 1px 2px rgba(16,24,40,.16); }
.gm-btn.primary:hover { filter: brightness(1.08); }
.gm-btn.secondary { background: #fff; color: #3f3f46; border-color: #e4e4e7; height: 34px; padding: 0 12px; border-radius: 9px; font-size: 12.5px; }
.gm-btn.secondary:hover { background: #fafafa; }
.gm-btn.danger { background: #fff; color: #dc2626; border-color: #f1d4d4; height: 34px; padding: 0 12px; border-radius: 9px; font-size: 12.5px; }
.gm-btn.danger:hover { background: #fef2f2; }
.gm-btn.ghost { background: transparent; color: #71717a; border: none; height: 34px; padding: 0 13px; border-radius: 9px; font-size: 13px; font-weight: 550; }
.gm-btn.ghost:hover { background: #f4f4f5; color: #18181b; }

/* lightbox */
.gm-lightbox { position: fixed; inset: 0; z-index: 1300; display: flex; align-items: center; justify-content: center; padding: 40px; background: rgba(8,11,18,.86); opacity: 0; transition: opacity .18s ease; }
.gm-lightbox.in { opacity: 1; }
.gm-lb-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 10px; box-shadow: 0 20px 60px -20px rgba(0,0,0,.8); }
.gm-lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; padding: 0; border-radius: 50%; border: none; background: rgba(255,255,255,.12); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.gm-lb-nav:hover { background: rgba(255,255,255,.24); }
.gm-lb-nav.prev { left: 24px; }
.gm-lb-nav.next { right: 24px; }
.gm-lb-close { position: absolute; top: 24px; right: 24px; width: 40px; height: 40px; padding: 0; border-radius: 50%; border: none; background: rgba(255,255,255,.12); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.gm-lb-close:hover { background: rgba(255,255,255,.24); }

@media (max-width: 640px) {
  .gm-overlay { padding: 0; align-items: stretch; }
  .gm-sheet { max-width: 100%; max-height: 100vh; border-radius: 0; }
  .gm-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}
